xref: /titanic_50/usr/src/uts/common/io/nxge/nxge_hv.c (revision d6114e2d100d9ec3b45f9968d45ac2e3a0827af0)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * nxge_hv.c
29  *
30  * This file is Sun4v specific.  It is the NXGE interface to the
31  * Sun4v Hypervisor.
32  *
33  */
34 
35 #include <sys/nxge/nxge_impl.h>
36 #include <sys/nxge/nxge_hio.h>
37 
38 /*
39  * The HV VR functions are set up based on the
40  * the version number of the NIU API group.
41  * For version 2.0 and above, the NIU will be
42  * be referenced from the cfg-handle.
43  */
44 
45 #if defined(sun4v)
46 
47 void
48 nxge_hio_hv_init(nxge_t *nxge)
49 {
50 	nxge_hio_data_t *nhd = (nxge_hio_data_t *)nxge->nxge_hw_p->hio;
51 
52 	nxhv_vr_fp_t *vr;
53 	nxhv_dc_fp_t *tx;
54 	nxhv_dc_fp_t *rx;
55 
56 	/* First, the HV VR functions. */
57 	vr = &nhd->hio.vr;
58 
59 	/* HV Major 1 interfaces */
60 	vr->assign = &hv_niu_vr_assign;
61 	/* HV Major 2 interfaces */
62 	vr->cfgh_assign = &hv_niu_cfgh_vr_assign;
63 
64 	vr->unassign = &hv_niu_vr_unassign;
65 	vr->getinfo = &hv_niu_vr_getinfo;
66 
67 	// -------------------------------------------------------------
68 	/* Find the transmit functions. */
69 	tx = &nhd->hio.tx;
70 
71 	tx->assign = &hv_niu_tx_dma_assign;
72 	tx->unassign = &hv_niu_tx_dma_unassign;
73 	tx->get_map = &hv_niu_vr_get_txmap;
74 
75 	/* HV Major 1 interfaces */
76 	tx->lp_conf = &hv_niu_tx_logical_page_conf;
77 	tx->lp_info = &hv_niu_tx_logical_page_info;
78 	/* HV Major 2 interfaces */
79 	tx->lp_cfgh_conf = &hv_niu_cfgh_tx_logical_page_conf;
80 	tx->lp_cfgh_info = &hv_niu_cfgh_tx_logical_page_info;
81 
82 	tx->getinfo = &hv_niu_vrtx_getinfo;
83 
84 	/* Now find the Receive functions. */
85 	rx = &nhd->hio.rx;
86 
87 	rx->assign = &hv_niu_rx_dma_assign;
88 	rx->unassign = &hv_niu_rx_dma_unassign;
89 	rx->get_map = &hv_niu_vr_get_rxmap;
90 
91 	/* HV Major 1 interfaces */
92 	rx->lp_conf = &hv_niu_rx_logical_page_conf;
93 	rx->lp_info = &hv_niu_rx_logical_page_info;
94 	/* HV Major 2 interfaces */
95 	rx->lp_cfgh_conf = &hv_niu_cfgh_rx_logical_page_conf;
96 	rx->lp_cfgh_info = &hv_niu_cfgh_rx_logical_page_info;
97 
98 	rx->getinfo = &hv_niu_vrrx_getinfo;
99 }
100 
101 #endif /* defined(sun4v) */
102