xref: /illumos-gate/usr/src/uts/common/io/nxge/nxge_hv.c (revision 4df55fde)
1678453a8Sspeer /*
2678453a8Sspeer  * CDDL HEADER START
3678453a8Sspeer  *
4678453a8Sspeer  * The contents of this file are subject to the terms of the
5678453a8Sspeer  * Common Development and Distribution License (the "License").
6678453a8Sspeer  * You may not use this file except in compliance with the License.
7678453a8Sspeer  *
8678453a8Sspeer  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9678453a8Sspeer  * or http://www.opensolaris.org/os/licensing.
10678453a8Sspeer  * See the License for the specific language governing permissions
11678453a8Sspeer  * and limitations under the License.
12678453a8Sspeer  *
13678453a8Sspeer  * When distributing Covered Code, include this CDDL HEADER in each
14678453a8Sspeer  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15678453a8Sspeer  * If applicable, add the following below this CDDL HEADER, with the
16678453a8Sspeer  * fields enclosed by brackets "[]" replaced with your own identifying
17678453a8Sspeer  * information: Portions Copyright [yyyy] [name of copyright owner]
18678453a8Sspeer  *
19678453a8Sspeer  * CDDL HEADER END
20678453a8Sspeer  */
21678453a8Sspeer 
22678453a8Sspeer /*
23*4df55fdeSJanie Lu  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24678453a8Sspeer  * Use is subject to license terms.
25678453a8Sspeer  */
26678453a8Sspeer 
27678453a8Sspeer /*
28678453a8Sspeer  * nxge_hv.c
29678453a8Sspeer  *
30678453a8Sspeer  * This file is Sun4v specific.  It is the NXGE interface to the
31678453a8Sspeer  * Sun4v Hypervisor.
32678453a8Sspeer  *
33678453a8Sspeer  */
34678453a8Sspeer 
35678453a8Sspeer #include <sys/nxge/nxge_impl.h>
36678453a8Sspeer #include <sys/nxge/nxge_hio.h>
37678453a8Sspeer 
38*4df55fdeSJanie Lu /*
39*4df55fdeSJanie Lu  * The HV VR functions are set up based on the
40*4df55fdeSJanie Lu  * the version number of the NIU API group.
41*4df55fdeSJanie Lu  * For version 2.0 and above, the NIU will be
42*4df55fdeSJanie Lu  * be referenced from the cfg-handle.
43*4df55fdeSJanie Lu  */
44*4df55fdeSJanie Lu 
45da14cebeSEric Cheng #if defined(sun4v)
46da14cebeSEric Cheng 
47678453a8Sspeer void
nxge_hio_hv_init(nxge_t * nxge)48678453a8Sspeer nxge_hio_hv_init(nxge_t *nxge)
49678453a8Sspeer {
50678453a8Sspeer 	nxge_hio_data_t *nhd = (nxge_hio_data_t *)nxge->nxge_hw_p->hio;
51678453a8Sspeer 
52678453a8Sspeer 	nxhv_vr_fp_t *vr;
53678453a8Sspeer 	nxhv_dc_fp_t *tx;
54678453a8Sspeer 	nxhv_dc_fp_t *rx;
55678453a8Sspeer 
56678453a8Sspeer 	/* First, the HV VR functions. */
57678453a8Sspeer 	vr = &nhd->hio.vr;
58678453a8Sspeer 
59*4df55fdeSJanie Lu 	/* HV Major 1 interfaces */
60678453a8Sspeer 	vr->assign = &hv_niu_vr_assign;
61*4df55fdeSJanie Lu 	/* HV Major 2 interfaces */
62*4df55fdeSJanie Lu 	vr->cfgh_assign = &hv_niu_cfgh_vr_assign;
63*4df55fdeSJanie Lu 
64678453a8Sspeer 	vr->unassign = &hv_niu_vr_unassign;
65678453a8Sspeer 	vr->getinfo = &hv_niu_vr_getinfo;
66678453a8Sspeer 
67678453a8Sspeer 	// -------------------------------------------------------------
68678453a8Sspeer 	/* Find the transmit functions. */
69678453a8Sspeer 	tx = &nhd->hio.tx;
70678453a8Sspeer 
71678453a8Sspeer 	tx->assign = &hv_niu_tx_dma_assign;
72678453a8Sspeer 	tx->unassign = &hv_niu_tx_dma_unassign;
73678453a8Sspeer 	tx->get_map = &hv_niu_vr_get_txmap;
74678453a8Sspeer 
75*4df55fdeSJanie Lu 	/* HV Major 1 interfaces */
76678453a8Sspeer 	tx->lp_conf = &hv_niu_tx_logical_page_conf;
77678453a8Sspeer 	tx->lp_info = &hv_niu_tx_logical_page_info;
78*4df55fdeSJanie Lu 	/* HV Major 2 interfaces */
79*4df55fdeSJanie Lu 	tx->lp_cfgh_conf = &hv_niu_cfgh_tx_logical_page_conf;
80*4df55fdeSJanie Lu 	tx->lp_cfgh_info = &hv_niu_cfgh_tx_logical_page_info;
81678453a8Sspeer 
82678453a8Sspeer 	tx->getinfo = &hv_niu_vrtx_getinfo;
83678453a8Sspeer 
84678453a8Sspeer 	/* Now find the Receive functions. */
85678453a8Sspeer 	rx = &nhd->hio.rx;
86678453a8Sspeer 
87678453a8Sspeer 	rx->assign = &hv_niu_rx_dma_assign;
88678453a8Sspeer 	rx->unassign = &hv_niu_rx_dma_unassign;
89678453a8Sspeer 	rx->get_map = &hv_niu_vr_get_rxmap;
90678453a8Sspeer 
91*4df55fdeSJanie Lu 	/* HV Major 1 interfaces */
92678453a8Sspeer 	rx->lp_conf = &hv_niu_rx_logical_page_conf;
93678453a8Sspeer 	rx->lp_info = &hv_niu_rx_logical_page_info;
94*4df55fdeSJanie Lu 	/* HV Major 2 interfaces */
95*4df55fdeSJanie Lu 	rx->lp_cfgh_conf = &hv_niu_cfgh_rx_logical_page_conf;
96*4df55fdeSJanie Lu 	rx->lp_cfgh_info = &hv_niu_cfgh_rx_logical_page_info;
97678453a8Sspeer 
98678453a8Sspeer 	rx->getinfo = &hv_niu_vrrx_getinfo;
99678453a8Sspeer }
100da14cebeSEric Cheng 
101da14cebeSEric Cheng #endif /* defined(sun4v) */
102