nxge_hio.h revision da14cebe459d3275048785f25bd869cb09b5307f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_NXGE_NXGE_HIO_H
#define _SYS_NXGE_NXGE_HIO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <nxge_mac.h>
#include <nxge_ipp.h>
#include <nxge_fflp.h>
#include <sys/mac_provider.h>
#if defined(sun4v)
#include <sys/vnet_res.h>
#endif
#define isLDOMservice(nxge) \
#define isLDOMguest(nxge) \
/* ------------------------------------------------------------------ */
typedef struct {
} nxhv_vr_fp_t;
typedef struct {
} nxhv_dc_fp_t;
#if defined(sun4v)
typedef struct {
} nx_vio_fp_t;
#endif
typedef struct {
#if defined(sun4v)
#endif
} nxhv_fp_t;
/* ------------------------------------------------------------------ */
typedef enum {
NXGE_HIO_TYPE_SERVICE, /* We are a service domain driver. */
NXGE_HIO_TYPE_GUEST /* We are a guest domain driver. */
typedef enum {
FUNC0_VIR = 0x1000000,
FUNC1_MNT = 0x2000000,
FUNC1_VIR = 0x3000000,
FUNC2_MNT = 0x4000000,
FUNC2_VIR = 0x5000000,
FUNC3_MNT = 0x6000000,
FUNC3_VIR = 0x7000000
#define VR_STEP 0x2000000
#define VR_VC_STEP 0x0004000
typedef enum { /* 0-8 */
} vr_region_t;
typedef enum {
} vp_channel_t;
typedef enum {
VP_BOUND_TX = 1,
} vpc_type_t;
typedef enum {
RXDMA_CFIG1 = 0,
RXDMA_CFIG2 = 8,
RBR_CFIG_A = 0x10,
RBR_CFIG_B = 0x18,
RBR_KICK = 0x20,
RBR_STAT = 0x28,
RBR_HDH = 0x30,
RBR_HDL = 0x38,
RCRCFIG_A = 0x40,
RCRCFIG_B = 0x48,
RCRSTAT_A = 0x50,
RCRSTAT_B = 0x58,
RCRSTAT_C = 0x60,
RX_DMA_ENT_MSK = 0x68,
RX_DMA_CTL_STAT = 0x70,
RCR_FLSH = 0x78,
RXMISC = 0x90,
RX_DMA_CTL_STAT_DBG = 0x98
typedef enum {
Tx_RNG_CFIG = 0,
Tx_RNG_HDL = 0x10,
Tx_RNG_KICK = 0x18,
Tx_ENT_MASK = 0x20,
Tx_CS = 0x28,
TxDMA_MBH = 0x30,
TxDMA_MBL = 0x38,
TxDMA_PRE_ST = 0x40,
Tx_RNG_ERR_LOGH = 0x48,
Tx_RNG_ERR_LOGL = 0x50,
TDMC_INTR_DBG = 0x60,
Tx_CS_DBG = 0x68
/*
* -------------------------------------------------------------
* These definitions are used to handle the virtual PIO_LDSV
* space of a VR.
* -------------------------------------------------------------
*/
#define VLDG_OFFSET 0x2000
#define VLDG_SLL 5
typedef enum {
PIO_LDSV0, /* ldf_0, 0-63 */
PIO_LDSV1, /* ldf_1, 0-63 */
PIO_LDSV2, /* ldf_0 & ldf_1, 64-69 */
PIO_LDGIMGN /* arm/timer */
} pio_ld_op_t;
#define VR_INTR_BLOCK_SIZE 8
#define HIO_INTR_BLOCK_SIZE 4
/* ------------------------------------------------------------------ */
typedef struct {
const char *name;
int offset;
typedef struct {
} nx_rdc_tbl_t;
typedef struct nxge_hio_vr {
int rdc_tbl; /* 1 of 8 RDC tables. */
int tdc_tbl; /* 1 of 8 TDC tables. */
int slot; /* According to nxge_m_mmac_add(). */
#if defined(sun4v)
#endif
typedef void (*dc_uninit_t)(nxge_t *, int);
typedef struct {
int vector; /* The DDI vector number (index) */
} hio_ldg_t;
/*
* -------------------------------------------------------------
* The service domain driver makes use of both <index>, the index
* into a VR's virtual page, and <channel>, the absolute channel
* number, what we will call here the physical channel number.
*
* The guest domain will set both fields to the same value, since
* it doesn't know any better. And if a service domain owns a
* DMA channel, it will also set both fields to the same value,
* since it is not using a VR per se.
* -------------------------------------------------------------
*/
typedef struct nx_dc {
/*
* <channel> has its normal meaning. <page> refers to the
* virtual page of the VR that <channel> has been bound to.
* Therefore, in the service domain, <page> & <channel>
* are almost always different. While in a guest domain,
* they are always the same.
*/
typedef struct {
int vrs;
unsigned sequence;
/* vr[0] is reserved for the service domain. */
/*
* -------------------------------------------------------------
* prototypes
* -------------------------------------------------------------
*/
extern void nxge_get_environs(nxge_t *);
extern int nxge_hio_init(nxge_t *);
extern void nxge_hio_uninit(nxge_t *);
/*
* ---------------------------------------------------------------------
* These are the general-purpose DMA channel group functions. That is,
* these functions are used to manage groups of TDCs or RDCs in an HIO
* environment.
*
* But is also expected that in the future they will be able to manage
* Crossbow groups.
* ---------------------------------------------------------------------
*/
extern void nxge_delay(int);
extern const char *nxge_ddi_perror(int);
/*
* ---------------------------------------------------------------------
* These are the Sun4v HIO function prototypes.
* ---------------------------------------------------------------------
*/
extern int nxge_hio_share_add_group(mac_share_handle_t,
extern int nxge_hio_share_rem_group(mac_share_handle_t,
extern void nxge_hio_share_unbind(mac_share_handle_t);
/* nxge_hio_guest.c */
extern void nxge_hio_unregister(nxge_t *);
extern int nxge_guest_regs_map(nxge_t *);
extern void nxge_guest_regs_map_free(nxge_t *);
extern void nxge_hio_start_timer(nxge_t *);
/* nxge_intr.c */
extern void nxge_hio_intr_uninit(nxge_t *);
/* nxge_hv.c */
extern void nxge_hio_hv_init(nxge_t *);
/* nxge_mac.c */
extern int nxge_hio_hostinfo_get_rdc_table(p_nxge_t);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NXGE_NXGE_HIO_H */