xref: /onnv-gate/usr/src/uts/common/io/nxge/nxge_hv.c (revision 11304:3092d1e303d6)
16495Sspeer /*
26495Sspeer  * CDDL HEADER START
36495Sspeer  *
46495Sspeer  * The contents of this file are subject to the terms of the
56495Sspeer  * Common Development and Distribution License (the "License").
66495Sspeer  * You may not use this file except in compliance with the License.
76495Sspeer  *
86495Sspeer  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96495Sspeer  * or http://www.opensolaris.org/os/licensing.
106495Sspeer  * See the License for the specific language governing permissions
116495Sspeer  * and limitations under the License.
126495Sspeer  *
136495Sspeer  * When distributing Covered Code, include this CDDL HEADER in each
146495Sspeer  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156495Sspeer  * If applicable, add the following below this CDDL HEADER, with the
166495Sspeer  * fields enclosed by brackets "[]" replaced with your own identifying
176495Sspeer  * information: Portions Copyright [yyyy] [name of copyright owner]
186495Sspeer  *
196495Sspeer  * CDDL HEADER END
206495Sspeer  */
216495Sspeer 
226495Sspeer /*
23*11304SJanie.Lu@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
246495Sspeer  * Use is subject to license terms.
256495Sspeer  */
266495Sspeer 
276495Sspeer /*
286495Sspeer  * nxge_hv.c
296495Sspeer  *
306495Sspeer  * This file is Sun4v specific.  It is the NXGE interface to the
316495Sspeer  * Sun4v Hypervisor.
326495Sspeer  *
336495Sspeer  */
346495Sspeer 
356495Sspeer #include <sys/nxge/nxge_impl.h>
366495Sspeer #include <sys/nxge/nxge_hio.h>
376495Sspeer 
38*11304SJanie.Lu@Sun.COM /*
39*11304SJanie.Lu@Sun.COM  * The HV VR functions are set up based on the
40*11304SJanie.Lu@Sun.COM  * the version number of the NIU API group.
41*11304SJanie.Lu@Sun.COM  * For version 2.0 and above, the NIU will be
42*11304SJanie.Lu@Sun.COM  * be referenced from the cfg-handle.
43*11304SJanie.Lu@Sun.COM  */
44*11304SJanie.Lu@Sun.COM 
458275SEric Cheng #if defined(sun4v)
468275SEric Cheng 
476495Sspeer void
nxge_hio_hv_init(nxge_t * nxge)486495Sspeer nxge_hio_hv_init(nxge_t *nxge)
496495Sspeer {
506495Sspeer 	nxge_hio_data_t *nhd = (nxge_hio_data_t *)nxge->nxge_hw_p->hio;
516495Sspeer 
526495Sspeer 	nxhv_vr_fp_t *vr;
536495Sspeer 	nxhv_dc_fp_t *tx;
546495Sspeer 	nxhv_dc_fp_t *rx;
556495Sspeer 
566495Sspeer 	/* First, the HV VR functions. */
576495Sspeer 	vr = &nhd->hio.vr;
586495Sspeer 
59*11304SJanie.Lu@Sun.COM 	/* HV Major 1 interfaces */
606495Sspeer 	vr->assign = &hv_niu_vr_assign;
61*11304SJanie.Lu@Sun.COM 	/* HV Major 2 interfaces */
62*11304SJanie.Lu@Sun.COM 	vr->cfgh_assign = &hv_niu_cfgh_vr_assign;
63*11304SJanie.Lu@Sun.COM 
646495Sspeer 	vr->unassign = &hv_niu_vr_unassign;
656495Sspeer 	vr->getinfo = &hv_niu_vr_getinfo;
666495Sspeer 
676495Sspeer 	// -------------------------------------------------------------
686495Sspeer 	/* Find the transmit functions. */
696495Sspeer 	tx = &nhd->hio.tx;
706495Sspeer 
716495Sspeer 	tx->assign = &hv_niu_tx_dma_assign;
726495Sspeer 	tx->unassign = &hv_niu_tx_dma_unassign;
736495Sspeer 	tx->get_map = &hv_niu_vr_get_txmap;
746495Sspeer 
75*11304SJanie.Lu@Sun.COM 	/* HV Major 1 interfaces */
766495Sspeer 	tx->lp_conf = &hv_niu_tx_logical_page_conf;
776495Sspeer 	tx->lp_info = &hv_niu_tx_logical_page_info;
78*11304SJanie.Lu@Sun.COM 	/* HV Major 2 interfaces */
79*11304SJanie.Lu@Sun.COM 	tx->lp_cfgh_conf = &hv_niu_cfgh_tx_logical_page_conf;
80*11304SJanie.Lu@Sun.COM 	tx->lp_cfgh_info = &hv_niu_cfgh_tx_logical_page_info;
816495Sspeer 
826495Sspeer 	tx->getinfo = &hv_niu_vrtx_getinfo;
836495Sspeer 
846495Sspeer 	/* Now find the Receive functions. */
856495Sspeer 	rx = &nhd->hio.rx;
866495Sspeer 
876495Sspeer 	rx->assign = &hv_niu_rx_dma_assign;
886495Sspeer 	rx->unassign = &hv_niu_rx_dma_unassign;
896495Sspeer 	rx->get_map = &hv_niu_vr_get_rxmap;
906495Sspeer 
91*11304SJanie.Lu@Sun.COM 	/* HV Major 1 interfaces */
926495Sspeer 	rx->lp_conf = &hv_niu_rx_logical_page_conf;
936495Sspeer 	rx->lp_info = &hv_niu_rx_logical_page_info;
94*11304SJanie.Lu@Sun.COM 	/* HV Major 2 interfaces */
95*11304SJanie.Lu@Sun.COM 	rx->lp_cfgh_conf = &hv_niu_cfgh_rx_logical_page_conf;
96*11304SJanie.Lu@Sun.COM 	rx->lp_cfgh_info = &hv_niu_cfgh_rx_logical_page_info;
976495Sspeer 
986495Sspeer 	rx->getinfo = &hv_niu_vrrx_getinfo;
996495Sspeer }
1008275SEric Cheng 
1018275SEric Cheng #endif /* defined(sun4v) */
102