npi_vir.h revision 6f45ec7b0b964c3be967c4880e8867ac1e7763a5
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * CDDL HEADER START
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * The contents of this file are subject to the terms of the
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Common Development and Distribution License (the "License").
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * You may not use this file except in compliance with the License.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * or http://www.opensolaris.org/os/licensing.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * See the License for the specific language governing permissions
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * and limitations under the License.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * When distributing Covered Code, include this CDDL HEADER in each
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * If applicable, add the following below this CDDL HEADER, with the
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * fields enclosed by brackets "[]" replaced with your own identifying
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * information: Portions Copyright [yyyy] [name of copyright owner]
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * CDDL HEADER END
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Use is subject to license terms.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#ifndef _NPI_VIR_H
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define _NPI_VIR_H
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#pragma ident "%Z%%M% %I% %E% SMI"
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#ifdef __cplusplus
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China#include <nxge_hw.h>
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Virtualization and Logical devices NPI error codes
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define FUNCID_INVALID PORT_INVALID
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_ERR_ST (VIR_BLK_ID << NPI_BLOCK_ID_SHIFT)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_ID_SHIFT(n) (n << NPI_PORT_CHAN_SHIFT)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_HW_BUSY (NPI_BK_HW_ERROR_START | 0x1)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_TAS_BUSY (NPI_BK_ERROR_START | 0x1)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_TAS_NOTREAD (NPI_BK_ERROR_START | 0x2)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_SR_RESET (NPI_BK_ERROR_START | 0x3)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_SR_FREE (NPI_BK_ERROR_START | 0x4)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_SR_BUSY (NPI_BK_ERROR_START | 0x5)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_SR_INVALID (NPI_BK_ERROR_START | 0x6)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_SR_NOTOWNER (NPI_BK_ERROR_START | 0x7)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_SR_INITIALIZED (NPI_BK_ERROR_START | 0x8)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_MPC_DENY (NPI_BK_ERROR_START | 0x10)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_BD_FUNC_INVALID (NPI_BK_ERROR_START | 0x20)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_BD_REG_INVALID (NPI_BK_ERROR_START | 0x21)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_BD_ID_INVALID (NPI_BK_ERROR_START | 0x22)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_BD_TXDMA_INVALID (NPI_BK_ERROR_START | 0x23)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_BD_RXDMA_INVALID (NPI_BK_ERROR_START | 0x24)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_LD_INVALID (NPI_BK_ERROR_START | 0x30)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_LDG_INVALID (NPI_BK_ERROR_START | 0x31)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_LDSV_INVALID (NPI_BK_ERROR_START | 0x32)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_INTM_TM_INVALID (NPI_BK_ERROR_START | 0x33)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_TM_RES_INVALID (NPI_BK_ERROR_START | 0x34)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define VIR_SID_VEC_INVALID (NPI_BK_ERROR_START | 0x35)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_OCODE_INVALID(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | OPCODE_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_FUNC_INVALID(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | FUNCID_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_CN_INVALID(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | CHANNEL_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Errors codes of shared register functions.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_TAS_BUSY(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_TAS_BUSY)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_TAS_NOTREAD(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_TAS_NOTREAD)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_SR_RESET(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_SR_RESET)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_SR_FREE(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_SR_FREE)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_SR_BUSY(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_SR_BUSY)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_SR_INVALID(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_SR_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_SR_NOTOWNER(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_SR_NOTOWNER)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_SR_INITIALIZED(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_SR_INITIALIZED)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Error codes of muti-partition control register functions.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_MPC_DENY (VIR_ERR_ST | VIR_MPU_DENY)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Error codes of DMA binding functions.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_BD_FUNC_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_BD_FUNC_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_BD_REG_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_BD_REG_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_BD_ID_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_BD_ID_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_BD_TXDMA_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_BD_TXDMA_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_BD_RXDMA_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_BD_RXDMA_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Error codes of logical devices and groups functions.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_LD_INVALID(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LD_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_LDG_INVALID(n) (VIR_ID_SHIFT(n) | VIR_ERR_ST | VIR_LDG_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_LDSV_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_LDSV_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_INTM_TM_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_INTM_TM_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_TM_RES_INVALID (VIR_ERR_ST | VIR_TM_RES_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_VIR_SID_VEC_INVALID(n) (VIR_ID_SHIFT(n) | \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China VIR_ERR_ST | VIR_TM_RES_INVALID)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Bit definition ([15:0] of the shared register
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * used by the driver as locking mechanism.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * [1:0] lock state (RESET, FREE, BUSY)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * [3:2] function ID (owner)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * [11:4] Implementation specific states
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * [15:12] Individual function state
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_LOCK_ST_RESET 0
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_LOCK_ST_FREE 1
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_LOCK_ST_BUSY 2
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_LOCK_ST_SHIFT 0
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_LOCK_ST_MASK 0x03
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_LOCK_FID_SHIFT 2
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_LOCK_FID_MASK 0x0C
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_IMPL_ST_SHIFT 4
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_DEV_SR_IMPL_ST_MASK 0xfff0
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_GET_LOCK_OWNER(sr) ((sr & NPI_DEV_SR_LOCK_FID_MASK) \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China >> NPI_DEV_SR_LOCK_FID_SHIFT)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_GET_LOCK_ST(sr) (sr & NPI_DEV_SR_LOCK_ST_MASK)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define NPI_GET_LOCK_IMPL_ST(sr) ((sr & NPI_DEV_SR_IMPL_ST_MASK) \
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China >> NPI_DEV_SR_IMPL_ST_SHIFT)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * DMA channel binding definitions.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define DMA_BIND_VADDR_VALIDATE(fn, rn, id, status) \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = NPI_SUCCESS; \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China if (!TXDMA_FUNC_VALID(fn)) { \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = (NPI_FAILURE | NPI_VIR_BD_FUNC_INVALID(fn)); \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China } else if (!SUBREGION_VALID(rn)) { \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = (NPI_FAILURE | NPI_VIR_BD_REG_INVALID(rn)); \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China } else if (!VIR_PAGE_INDEX_VALID(id)) { \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = (NPI_FAILURE | NPI_VIR_BD_ID_INVALID(id)); \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define DMA_BIND_TX_VALIDATE(n, status) \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = NPI_SUCCESS; \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China if (!TXDMA_CHANNEL_VALID(n)) { \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = (NPI_FAILURE | NPI_VIR_BD_TXDMA_INVALID(n)); \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define DMA_BIND_RX_VALIDATE(n, status) \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = NPI_SUCCESS; \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China if (!VRXDMA_CHANNEL_VALID(n)) { \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China status = (NPI_FAILURE | NPI_VIR_BD_RXDMA_INVALID(n)); \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define DMA_BIND_STEP 8
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define DMA_BIND_REG_OFFSET(fn, rn, id) (DMA_BIND_STEP * \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China (fn * 2 * VIR_PAGE_INDEX_MAX + \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China rn * VIR_PAGE_INDEX_MAX) + id)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * NPI defined data structure to program the DMA binding register.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinatypedef struct _fzc_dma_bind {
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China uint8_t function_id; /* 0 to 3 */
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China uint8_t sub_vir_region; /* 0 or 1 */
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China uint8_t vir_index; /* 0 to 7 */
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China boolean_t tx_bind; /* set 1 to bind */
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China uint8_t tx_channel; /* hardware channel number (0 - 23) */
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China boolean_t rx_bind; /* set 1 to bind */
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China uint8_t rx_channel; /* hardware channel number (0 - 15) */
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China} fzc_dma_bind_t, *p_fzc_dma_bind;
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Logical device definitions.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LD_NUM_STEP 8
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LD_NUM_OFFSET(ld) (ld * LDG_NUM_STEP)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDG_NUM_STEP 8
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDG_NUM_OFFSET(ldg) (ldg * LDG_NUM_STEP)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDGNUM_OFFSET(ldg) (ldg * LDG_NUM_STEP)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDSV_STEP 8192
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDSVG_OFFSET(ldg) (ldg * LDSV_STEP)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDSV_OFFSET(ldv) (ldv * LDSV_STEP)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDSV_OFFSET_MASK(ld) \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China (((ld < NXGE_MAC_LD_START) ? \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China (LD_IM0_REG + LDSV_OFFSET(ld)) : \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China (LD_IM1_REG + LDSV_OFFSET((ld - NXGE_MAC_LD_START))))); \
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDG_SID_STEP 8
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China#define LDG_SID_OFFSET(ldg) (ldg * LDG_SID_STEP)
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Definitions for the system interrupt data.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinatypedef struct _fzc_sid {
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China} fzc_sid_t, *p_fzc_sid_t;
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * Virtualization and Interrupt Prototypes.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_init():
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * This function is called to initialize the device function
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * shared register (set the software implementation lock
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * state to FREE).
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * handle - NPI handle
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If initialization is complete successfully.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * (set sr bits to free).
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_init(npi_handle_t);
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_lock_enter():
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * This function is called to lock the function shared register
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * by setting the lock state to busy.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * handle - NPI handle
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If the function id can own the lock.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * VIR_SR_INVALID
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_lock_enter(npi_handle_t);
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_lock_free():
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * This function is called to free the function shared register
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * by setting the lock state to free.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * handle - NPI handle
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If the function id can free the lock.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * VIR_SR_NOTOWNER
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * VIR_TAS_NOTREAD
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_lock_free(npi_handle_t);
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_funcid_get():
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * This function is called to get the caller's function ID.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * (based on address bits [25:26] on read access.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * (After read, the TAS bit is always set to 1. Software needs
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * to write 0 to clear.) This function will write 0 to clear
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * the TAS bit if we own it.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * handle - NPI handle
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * funcid_p - pointer to store the function id.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If get function id is complete successfully.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_funcid_get(npi_handle_t, uint8_t *);
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_sr_raw_get():
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * This function is called to get the shared register value.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * (After read, the TAS bit is always set to 1. Software needs
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * to write 0 to clear if we own it.)
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * handle - NPI handle
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * sr_p - pointer to store the shared value of this register.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If shared value get is complete successfully.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_sr_raw_get(npi_handle_t, uint16_t *);
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_sr_get():
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * This function is called to get the shared register value.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * (After read, the TAS bit is always set to 1. Software needs
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * to write 0 to clear if we own it.)
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * handle - NPI handle
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * sr_p - pointer to store the shared value of this register.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * . this will get only non-lock, non-function id portion
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * . of the register
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If shared value get is complete successfully.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_sr_get(npi_handle_t, uint16_t *);
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_sr_get_set_clear():
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * This function is called to set the shared register value.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * (Shared register must be read first. If tas bit is 0, then
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * it implies that the software can proceed to set). After
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * setting, tas bit will be cleared.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * handle - NPI handle
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * impl_sr - shared value to set (only the 8 bit
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * implementation specific state info).
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If shared value is set successfully.
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_sr_get_set_clear(npi_handle_t,
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_sr_set_only():
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * This function is called to only set the shared register value.
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * handle - NPI handle
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * impl_sr - shared value to set.
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If shared value is set successfully.
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_sr_set_only(npi_handle_t, uint16_t);
c0c934808d1b7d058148814255f32064a0e09555lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_busy():
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * This function is called to see if we can own the device.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * It will not reset the tas bit.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * handle - NPI handle
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * busy_p - pointer to store busy flag.
3ae945c326c1fc078149f2c8b11fac0cc8f6d1d6lin wang - Sun Microsystems - Beijing China * (B_TRUE: device is in use, B_FALSE: free).
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If tas bit is read successfully.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_busy(npi_handle_t, boolean_t *);
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * npi_dev_func_sr_tas_get():
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * This function is called to get the tas bit
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * (after read, this bit is always set to 1, software write 0
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * handle - NPI handle
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * tas_p - pointer to store the tas value
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * NPI_SUCCESS - If tas value get is complete successfully.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_dev_func_sr_tas_get(npi_handle_t, uint8_t *);
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * npi_fzc_mpc_set():
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * This function is called to enable the write access
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * to FZC region to function zero.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * handle - NPI handle
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing Chinanpi_status_t npi_fzc_mpc_set(npi_handle_t, boolean_t);
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * npi_fzc_mpc_get():
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * This function is called to get the access mode.
dd1de3740722a4b99a74005255effebbd20a6d70lin wang - Sun Microsystems - Beijing China * handle - NPI handle
uint8_t *);
uint64_t *);
boolean_t *);
boolean_t *);
uint8_t);
uint8_t *);
uint8_t *);
#ifdef __cplusplus