1 /* $NetBSD: rmixl_pcievar.h,v 1.1.2.3 2010/01/29 00:23:34 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 } rmixl_pcie_link_dispatch_t; 34 35 struct rmixl_pcie_softc; 36 37 typedef struct rmixl_pcie_link_intr { 38 struct rmixl_pcie_softc *sc; 39 LIST_HEAD(, rmixl_pcie_link_dispatch) dispatch; 40 u_int link; 41 u_int ipl; 42 bool enabled; 43 void *ih; /* mips interrupt handle */ 44 } rmixl_pcie_link_intr_t; 45 46 #define RMIXL_PCIE_NLINKS_MAX 4 47 48 typedef struct rmixl_pcie_softc { 49 device_t sc_dev; 50 struct mips_pci_chipset sc_pci_chipset; 51 bus_space_tag_t sc_pcie_cfg_memt; 52 bus_space_tag_t sc_pcie_ecfg_memt; 53 bus_dma_tag_t sc_29bit_dmat; 54 bus_dma_tag_t sc_32bit_dmat; 55 bus_dma_tag_t sc_64bit_dmat; 56 rmixl_pcie_lnktab_t sc_pcie_lnktab; 57 void *sc_fatal_ih; 58 rmixl_pcie_link_intr_t sc_link_intr[RMIXL_PCIE_NLINKS_MAX]; 59 } rmixl_pcie_softc_t; 60 61 #endif /* _MIPS_RMI_PCIE_VAR_H_ */ 62 63