xref: /titanic_41/usr/src/uts/common/io/hxge/hpi_vir.h (revision 8e50dcc9f00b393d43e6aa42b820bcbf1d3e1ce4)
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  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _HPI_VIR_H
27 #define	_HPI_VIR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <hpi.h>
36 #include <hxge_peu_hw.h>
37 
38 /*
39  * Virtualization and Logical devices HPI error codes
40  */
41 #define	VIR_ERR_ST		(VIR_BLK_ID << HPI_BLOCK_ID_SHIFT)
42 #define	VIR_ID_SHIFT(n)		(n << HPI_PORT_CHAN_SHIFT)
43 
44 #define	VIR_LD_INVALID		(HPI_BK_ERROR_START | 0x30)
45 #define	VIR_LDG_INVALID		(HPI_BK_ERROR_START | 0x31)
46 #define	VIR_LDSV_INVALID	(HPI_BK_ERROR_START | 0x32)
47 
48 #define	VIR_INTM_TM_INVALID	(HPI_BK_ERROR_START | 0x33)
49 #define	VIR_TM_RES_INVALID	(HPI_BK_ERROR_START | 0x34)
50 #define	VIR_SID_VEC_INVALID	(HPI_BK_ERROR_START | 0x35)
51 
52 /*
53  * Error codes of logical devices and groups functions.
54  */
55 #define	HPI_VIR_LD_INVALID(n) 	(VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LD_INVALID)
56 #define	HPI_VIR_LDG_INVALID(n)	(VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LDG_INVALID)
57 #define	HPI_VIR_LDSV_INVALID(n) (VIR_ID_SHIFT(n) | \
58 					VIR_ERR_ST | VIR_LDSV_INVALID)
59 #define	HPI_VIR_INTM_TM_INVALID(n)	(VIR_ID_SHIFT(n) | \
60 					VIR_ERR_ST | VIR_INTM_TM_INVALID)
61 #define	HPI_VIR_TM_RES_INVALID		(VIR_ERR_ST | VIR_TM_RES_INVALID)
62 #define	HPI_VIR_SID_VEC_INVALID(n)	(VIR_ID_SHIFT(n) | \
63 						VIR_ERR_ST | VIR_TM_RES_INVALID)
64 
65 /*
66  * Logical device definitions.
67  */
68 #define	LDG_NUM_STEP		4
69 #define	LD_NUM_OFFSET(ld)	(ld * LDG_NUM_STEP)
70 
71 #define	LDSV_STEP		8192
72 #define	LDSVG_OFFSET(ldg)	(ldg * LDSV_STEP)
73 #define	LDSV_OFFSET(ldv)	(ldv * LDSV_STEP)
74 #define	LDSV_OFFSET_MASK(ld)	(LD_INTR_MASK + LDSV_OFFSET(ld))
75 
76 #define	LDG_SID_STEP		8192
77 #define	LDG_SID_OFFSET(ldg)	(ldg * LDG_SID_STEP)
78 
79 typedef enum {
80 	VECTOR0,
81 	VECTOR1,
82 } ldsv_type_t;
83 
84 /*
85  * Definitions for the system interrupt data.
86  */
87 typedef struct _fzc_sid {
88 	uint8_t		ldg;
89 	uint8_t		vector;
90 } fzc_sid_t, *p_fzc_sid_t;
91 
92 /*
93  * Virtualization and Interrupt Prototypes.
94  */
95 hpi_status_t hpi_fzc_ldg_num_set(hpi_handle_t handle, uint8_t ld, uint8_t ldg);
96 hpi_status_t hpi_ldsv_ldfs_get(hpi_handle_t handle, uint8_t ldg,
97     uint32_t *vector0_p, uint32_t *vecto1_p);
98 hpi_status_t hpi_ldsv_get(hpi_handle_t handle, uint8_t ldg, ldsv_type_t vector,
99     uint32_t *ldf_p);
100 hpi_status_t hpi_intr_mask_set(hpi_handle_t handle, uint8_t ld,
101     uint8_t ldf_mask);
102 hpi_status_t hpi_intr_ldg_mgmt_set(hpi_handle_t handle, uint8_t ldg,
103     boolean_t arm, uint8_t timer);
104 hpi_status_t hpi_fzc_ldg_timer_res_set(hpi_handle_t handle, uint32_t res);
105 hpi_status_t hpi_fzc_sid_set(hpi_handle_t handle, fzc_sid_t sid);
106 hpi_status_t hpi_fzc_sys_err_mask_set(hpi_handle_t handle, boolean_t mask);
107 hpi_status_t hpi_fzc_sys_err_stat_get(hpi_handle_t handle,
108     dev_err_stat_t *statp);
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _HPI_VIR_H */
115