1 /* $NetBSD: rmixl_pcievar.h,v 1.1.2.4 2010/03/21 21:27:27 cliff Exp $ */ 2 3 #ifndef _MIPS_RMI_PCIE_VAR_H_ 4 #define _MIPS_RMI_PCIE_VAR_H_ 5 6 #include <dev/pci/pcivar.h> 7 8 typedef enum rmixl_pcie_lnkcfg_mode { 9 LCFG_NO=0, /* placeholder */ 10 LCFG_EP, /* end point */ 11 LCFG_RC, /* root complex */ 12 } rmixl_pcie_lnkcfg_mode_t; 13 14 typedef struct rmixl_pcie_lnkcfg { 15 rmixl_pcie_lnkcfg_mode_t mode; 16 u_int lanes; 17 } rmixl_pcie_lnkcfg_t; 18 19 typedef struct rmixl_pcie_lnktab { 20 u_int ncfgs; 21 const char *str; 22 const rmixl_pcie_lnkcfg_t *cfg; 23 } rmixl_pcie_lnktab_t; 24 25 typedef struct rmixl_pcie_link_dispatch { 26 LIST_ENTRY(rmixl_pcie_link_dispatch) next; 27 int (*func)(void *); 28 void *arg; 29 u_int link; 30 u_int bitno; 31 u_int irq; 32 struct evcnt count; 33 char count_name[32]; 34 } rmixl_pcie_link_dispatch_t; 35 36 struct rmixl_pcie_softc; 37 38 typedef struct rmixl_pcie_link_intr { 39 struct rmixl_pcie_softc *sc; 40 LIST_HEAD(, rmixl_pcie_link_dispatch) dispatch; 41 u_int link; 42 u_int ipl; 43 bool enabled; 44 void *ih; /* mips interrupt handle */ 45 } rmixl_pcie_link_intr_t; 46 47 #define RMIXL_PCIE_NLINKS_MAX 4 48 49 typedef struct rmixl_pcie_softc { 50 device_t sc_dev; 51 struct mips_pci_chipset sc_pci_chipset; 52 bus_space_tag_t sc_pcie_cfg_memt; 53 bus_space_tag_t sc_pcie_ecfg_memt; 54 bus_dma_tag_t sc_29bit_dmat; 55 bus_dma_tag_t sc_32bit_dmat; 56 bus_dma_tag_t sc_64bit_dmat; 57 rmixl_pcie_lnktab_t sc_pcie_lnktab; 58 int sc_tmsk; 59 void *sc_fatal_ih; 60 rmixl_pcie_link_intr_t sc_link_intr[RMIXL_PCIE_NLINKS_MAX]; 61 } rmixl_pcie_softc_t; 62 63 #endif /* _MIPS_RMI_PCIE_VAR_H_ */ 64 65