xref: /onnv-gate/usr/src/uts/common/io/hxge/hpi_vir.h (revision 7584:07b5a7770d5b)
16349Sqs148142 /*
26349Sqs148142  * CDDL HEADER START
36349Sqs148142  *
46349Sqs148142  * The contents of this file are subject to the terms of the
56349Sqs148142  * Common Development and Distribution License (the "License").
66349Sqs148142  * You may not use this file except in compliance with the License.
76349Sqs148142  *
86349Sqs148142  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96349Sqs148142  * or http://www.opensolaris.org/os/licensing.
106349Sqs148142  * See the License for the specific language governing permissions
116349Sqs148142  * and limitations under the License.
126349Sqs148142  *
136349Sqs148142  * When distributing Covered Code, include this CDDL HEADER in each
146349Sqs148142  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156349Sqs148142  * If applicable, add the following below this CDDL HEADER, with the
166349Sqs148142  * fields enclosed by brackets "[]" replaced with your own identifying
176349Sqs148142  * information: Portions Copyright [yyyy] [name of copyright owner]
186349Sqs148142  *
196349Sqs148142  * CDDL HEADER END
206349Sqs148142  */
216349Sqs148142 /*
226349Sqs148142  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
236349Sqs148142  * Use is subject to license terms.
246349Sqs148142  */
256349Sqs148142 
266349Sqs148142 #ifndef _HPI_VIR_H
276349Sqs148142 #define	_HPI_VIR_H
286349Sqs148142 
296349Sqs148142 #ifdef	__cplusplus
306349Sqs148142 extern "C" {
316349Sqs148142 #endif
326349Sqs148142 
336349Sqs148142 #include <hpi.h>
346349Sqs148142 #include <hxge_peu_hw.h>
356349Sqs148142 
366349Sqs148142 /*
376349Sqs148142  * Virtualization and Logical devices HPI error codes
386349Sqs148142  */
396349Sqs148142 #define	VIR_ERR_ST		(VIR_BLK_ID << HPI_BLOCK_ID_SHIFT)
406349Sqs148142 #define	VIR_ID_SHIFT(n)		(n << HPI_PORT_CHAN_SHIFT)
416349Sqs148142 
426349Sqs148142 #define	VIR_LD_INVALID		(HPI_BK_ERROR_START | 0x30)
436349Sqs148142 #define	VIR_LDG_INVALID		(HPI_BK_ERROR_START | 0x31)
446349Sqs148142 #define	VIR_LDSV_INVALID	(HPI_BK_ERROR_START | 0x32)
456349Sqs148142 
466349Sqs148142 #define	VIR_INTM_TM_INVALID	(HPI_BK_ERROR_START | 0x33)
476349Sqs148142 #define	VIR_TM_RES_INVALID	(HPI_BK_ERROR_START | 0x34)
486349Sqs148142 #define	VIR_SID_VEC_INVALID	(HPI_BK_ERROR_START | 0x35)
496349Sqs148142 
506349Sqs148142 /*
516349Sqs148142  * Error codes of logical devices and groups functions.
526349Sqs148142  */
536349Sqs148142 #define	HPI_VIR_LD_INVALID(n) 	(VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LD_INVALID)
546349Sqs148142 #define	HPI_VIR_LDG_INVALID(n)	(VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LDG_INVALID)
556349Sqs148142 #define	HPI_VIR_LDSV_INVALID(n) (VIR_ID_SHIFT(n) | \
566349Sqs148142 					VIR_ERR_ST | VIR_LDSV_INVALID)
576349Sqs148142 #define	HPI_VIR_INTM_TM_INVALID(n)	(VIR_ID_SHIFT(n) | \
586349Sqs148142 					VIR_ERR_ST | VIR_INTM_TM_INVALID)
596349Sqs148142 #define	HPI_VIR_TM_RES_INVALID		(VIR_ERR_ST | VIR_TM_RES_INVALID)
606349Sqs148142 #define	HPI_VIR_SID_VEC_INVALID(n)	(VIR_ID_SHIFT(n) | \
616349Sqs148142 						VIR_ERR_ST | VIR_TM_RES_INVALID)
626349Sqs148142 
636349Sqs148142 /*
646349Sqs148142  * Logical device definitions.
656349Sqs148142  */
666349Sqs148142 #define	LDG_NUM_STEP		4
676349Sqs148142 #define	LD_NUM_OFFSET(ld)	(ld * LDG_NUM_STEP)
686349Sqs148142 
696349Sqs148142 #define	LDSV_STEP		8192
706349Sqs148142 #define	LDSVG_OFFSET(ldg)	(ldg * LDSV_STEP)
716349Sqs148142 #define	LDSV_OFFSET(ldv)	(ldv * LDSV_STEP)
726349Sqs148142 #define	LDSV_OFFSET_MASK(ld)	(LD_INTR_MASK + LDSV_OFFSET(ld))
736349Sqs148142 
746349Sqs148142 #define	LDG_SID_STEP		8192
756349Sqs148142 #define	LDG_SID_OFFSET(ldg)	(ldg * LDG_SID_STEP)
766349Sqs148142 
776349Sqs148142 typedef enum {
786349Sqs148142 	VECTOR0,
79*7584SQiyan.Sun@Sun.COM 	VECTOR1
806349Sqs148142 } ldsv_type_t;
816349Sqs148142 
826349Sqs148142 /*
836349Sqs148142  * Definitions for the system interrupt data.
846349Sqs148142  */
856349Sqs148142 typedef struct _fzc_sid {
866349Sqs148142 	uint8_t		ldg;
876349Sqs148142 	uint8_t		vector;
886349Sqs148142 } fzc_sid_t, *p_fzc_sid_t;
896349Sqs148142 
906349Sqs148142 /*
916349Sqs148142  * Virtualization and Interrupt Prototypes.
926349Sqs148142  */
936349Sqs148142 hpi_status_t hpi_fzc_ldg_num_set(hpi_handle_t handle, uint8_t ld, uint8_t ldg);
946349Sqs148142 hpi_status_t hpi_ldsv_ldfs_get(hpi_handle_t handle, uint8_t ldg,
956349Sqs148142     uint32_t *vector0_p, uint32_t *vecto1_p);
966349Sqs148142 hpi_status_t hpi_ldsv_get(hpi_handle_t handle, uint8_t ldg, ldsv_type_t vector,
976349Sqs148142     uint32_t *ldf_p);
986349Sqs148142 hpi_status_t hpi_intr_mask_set(hpi_handle_t handle, uint8_t ld,
996349Sqs148142     uint8_t ldf_mask);
1006349Sqs148142 hpi_status_t hpi_intr_ldg_mgmt_set(hpi_handle_t handle, uint8_t ldg,
1016349Sqs148142     boolean_t arm, uint8_t timer);
1026349Sqs148142 hpi_status_t hpi_fzc_ldg_timer_res_set(hpi_handle_t handle, uint32_t res);
1036349Sqs148142 hpi_status_t hpi_fzc_sid_set(hpi_handle_t handle, fzc_sid_t sid);
1046349Sqs148142 hpi_status_t hpi_fzc_sys_err_mask_set(hpi_handle_t handle, boolean_t mask);
1056349Sqs148142 hpi_status_t hpi_fzc_sys_err_stat_get(hpi_handle_t handle,
1066349Sqs148142     dev_err_stat_t *statp);
1076349Sqs148142 
1086349Sqs148142 #ifdef	__cplusplus
1096349Sqs148142 }
1106349Sqs148142 #endif
1116349Sqs148142 
1126349Sqs148142 #endif	/* _HPI_VIR_H */
113