xref: /illumos-gate/usr/src/uts/common/io/hxge/hpi_vir.h (revision a512c5d1)
13dec9fcdSqs /*
23dec9fcdSqs  * CDDL HEADER START
33dec9fcdSqs  *
43dec9fcdSqs  * The contents of this file are subject to the terms of the
53dec9fcdSqs  * Common Development and Distribution License (the "License").
63dec9fcdSqs  * You may not use this file except in compliance with the License.
73dec9fcdSqs  *
83dec9fcdSqs  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93dec9fcdSqs  * or http://www.opensolaris.org/os/licensing.
103dec9fcdSqs  * See the License for the specific language governing permissions
113dec9fcdSqs  * and limitations under the License.
123dec9fcdSqs  *
133dec9fcdSqs  * When distributing Covered Code, include this CDDL HEADER in each
143dec9fcdSqs  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153dec9fcdSqs  * If applicable, add the following below this CDDL HEADER, with the
163dec9fcdSqs  * fields enclosed by brackets "[]" replaced with your own identifying
173dec9fcdSqs  * information: Portions Copyright [yyyy] [name of copyright owner]
183dec9fcdSqs  *
193dec9fcdSqs  * CDDL HEADER END
203dec9fcdSqs  */
213dec9fcdSqs /*
223dec9fcdSqs  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
233dec9fcdSqs  * Use is subject to license terms.
243dec9fcdSqs  */
253dec9fcdSqs 
263dec9fcdSqs #ifndef _HPI_VIR_H
273dec9fcdSqs #define	_HPI_VIR_H
283dec9fcdSqs 
293dec9fcdSqs #ifdef	__cplusplus
303dec9fcdSqs extern "C" {
313dec9fcdSqs #endif
323dec9fcdSqs 
333dec9fcdSqs #include <hpi.h>
343dec9fcdSqs #include <hxge_peu_hw.h>
353dec9fcdSqs 
363dec9fcdSqs /*
373dec9fcdSqs  * Virtualization and Logical devices HPI error codes
383dec9fcdSqs  */
393dec9fcdSqs #define	VIR_ERR_ST		(VIR_BLK_ID << HPI_BLOCK_ID_SHIFT)
403dec9fcdSqs #define	VIR_ID_SHIFT(n)		(n << HPI_PORT_CHAN_SHIFT)
413dec9fcdSqs 
423dec9fcdSqs #define	VIR_LD_INVALID		(HPI_BK_ERROR_START | 0x30)
433dec9fcdSqs #define	VIR_LDG_INVALID		(HPI_BK_ERROR_START | 0x31)
443dec9fcdSqs #define	VIR_LDSV_INVALID	(HPI_BK_ERROR_START | 0x32)
453dec9fcdSqs 
463dec9fcdSqs #define	VIR_INTM_TM_INVALID	(HPI_BK_ERROR_START | 0x33)
473dec9fcdSqs #define	VIR_TM_RES_INVALID	(HPI_BK_ERROR_START | 0x34)
483dec9fcdSqs #define	VIR_SID_VEC_INVALID	(HPI_BK_ERROR_START | 0x35)
493dec9fcdSqs 
503dec9fcdSqs /*
513dec9fcdSqs  * Error codes of logical devices and groups functions.
523dec9fcdSqs  */
533dec9fcdSqs #define	HPI_VIR_LD_INVALID(n) 	(VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LD_INVALID)
543dec9fcdSqs #define	HPI_VIR_LDG_INVALID(n)	(VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LDG_INVALID)
553dec9fcdSqs #define	HPI_VIR_LDSV_INVALID(n) (VIR_ID_SHIFT(n) | \
563dec9fcdSqs 					VIR_ERR_ST | VIR_LDSV_INVALID)
573dec9fcdSqs #define	HPI_VIR_INTM_TM_INVALID(n)	(VIR_ID_SHIFT(n) | \
583dec9fcdSqs 					VIR_ERR_ST | VIR_INTM_TM_INVALID)
593dec9fcdSqs #define	HPI_VIR_TM_RES_INVALID		(VIR_ERR_ST | VIR_TM_RES_INVALID)
603dec9fcdSqs #define	HPI_VIR_SID_VEC_INVALID(n)	(VIR_ID_SHIFT(n) | \
613dec9fcdSqs 						VIR_ERR_ST | VIR_TM_RES_INVALID)
623dec9fcdSqs 
633dec9fcdSqs /*
643dec9fcdSqs  * Logical device definitions.
653dec9fcdSqs  */
663dec9fcdSqs #define	LDG_NUM_STEP		4
673dec9fcdSqs #define	LD_NUM_OFFSET(ld)	(ld * LDG_NUM_STEP)
683dec9fcdSqs 
693dec9fcdSqs #define	LDSV_STEP		8192
703dec9fcdSqs #define	LDSVG_OFFSET(ldg)	(ldg * LDSV_STEP)
713dec9fcdSqs #define	LDSV_OFFSET(ldv)	(ldv * LDSV_STEP)
723dec9fcdSqs #define	LDSV_OFFSET_MASK(ld)	(LD_INTR_MASK + LDSV_OFFSET(ld))
733dec9fcdSqs 
743dec9fcdSqs #define	LDG_SID_STEP		8192
753dec9fcdSqs #define	LDG_SID_OFFSET(ldg)	(ldg * LDG_SID_STEP)
763dec9fcdSqs 
773dec9fcdSqs typedef enum {
783dec9fcdSqs 	VECTOR0,
79*a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States 	VECTOR1
803dec9fcdSqs } ldsv_type_t;
813dec9fcdSqs 
823dec9fcdSqs /*
833dec9fcdSqs  * Definitions for the system interrupt data.
843dec9fcdSqs  */
853dec9fcdSqs typedef struct _fzc_sid {
863dec9fcdSqs 	uint8_t		ldg;
873dec9fcdSqs 	uint8_t		vector;
883dec9fcdSqs } fzc_sid_t, *p_fzc_sid_t;
893dec9fcdSqs 
903dec9fcdSqs /*
913dec9fcdSqs  * Virtualization and Interrupt Prototypes.
923dec9fcdSqs  */
933dec9fcdSqs hpi_status_t hpi_fzc_ldg_num_set(hpi_handle_t handle, uint8_t ld, uint8_t ldg);
943dec9fcdSqs hpi_status_t hpi_ldsv_ldfs_get(hpi_handle_t handle, uint8_t ldg,
953dec9fcdSqs     uint32_t *vector0_p, uint32_t *vecto1_p);
963dec9fcdSqs hpi_status_t hpi_ldsv_get(hpi_handle_t handle, uint8_t ldg, ldsv_type_t vector,
973dec9fcdSqs     uint32_t *ldf_p);
983dec9fcdSqs hpi_status_t hpi_intr_mask_set(hpi_handle_t handle, uint8_t ld,
993dec9fcdSqs     uint8_t ldf_mask);
1003dec9fcdSqs hpi_status_t hpi_intr_ldg_mgmt_set(hpi_handle_t handle, uint8_t ldg,
1013dec9fcdSqs     boolean_t arm, uint8_t timer);
1023dec9fcdSqs hpi_status_t hpi_fzc_ldg_timer_res_set(hpi_handle_t handle, uint32_t res);
1033dec9fcdSqs hpi_status_t hpi_fzc_sid_set(hpi_handle_t handle, fzc_sid_t sid);
1043dec9fcdSqs hpi_status_t hpi_fzc_sys_err_mask_set(hpi_handle_t handle, boolean_t mask);
1053dec9fcdSqs hpi_status_t hpi_fzc_sys_err_stat_get(hpi_handle_t handle,
1063dec9fcdSqs     dev_err_stat_t *statp);
1073dec9fcdSqs 
1083dec9fcdSqs #ifdef	__cplusplus
1093dec9fcdSqs }
1103dec9fcdSqs #endif
1113dec9fcdSqs 
1123dec9fcdSqs #endif	/* _HPI_VIR_H */
113