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