6 IRQether = IRQgic + 29,
13 BusCBUS = 0, /* Corollary CBUS */
14 BusCBUSII, /* Corollary CBUS II */
15 BusEISA, /* Extended ISA */
16 BusFUTURE, /* IEEE Futurebus */
17 BusINTERN, /* Internal bus */
18 BusISA, /* Industry Standard Architecture */
19 BusMBI, /* Multibus I */
20 BusMBII, /* Multibus II */
21 BusMCA, /* Micro Channel Architecture */
24 BusNUBUS, /* Apple Macintosh NuBus */
25 BusPCI, /* Peripheral Component Interconnect */
26 BusPCMCIA, /* PC Memory Card International Association */
27 BusTC, /* DEC TurboChannel */
28 BusVL, /* VESA Local bus */
30 BusXPRESS, /* Express System Bus */
33 #define MKBUS(t,b,d,f) (((t)<<24)|(((b)&0xFF)<<16)|(((d)&0x1F)<<11)|(((f)&0x07)<<8))
34 #define BUSFNO(tbdf) (((tbdf)>>8)&0x07)
35 #define BUSDNO(tbdf) (((tbdf)>>11)&0x1F)
36 #define BUSBNO(tbdf) (((tbdf)>>16)&0xFF)
37 #define BUSTYPE(tbdf) ((tbdf)>>24)
38 #define BUSBDF(tbdf) ((tbdf)&0x00FFFF00)
40 enum { /* type 0 & type 1 pre-defined header */
41 PciVID = 0x00, /* vendor ID */
42 PciDID = 0x02, /* device ID */
43 PciPCR = 0x04, /* command */
44 PciPSR = 0x06, /* status */
45 PciRID = 0x08, /* revision ID */
46 PciCCRp = 0x09, /* programming interface class code */
47 PciCCRu = 0x0A, /* sub-class code */
48 PciCCRb = 0x0B, /* base class code */
49 PciCLS = 0x0C, /* cache line size */
50 PciLTR = 0x0D, /* latency timer */
51 PciHDT = 0x0E, /* header type */
52 PciBST = 0x0F, /* BIST */
54 PciBAR0 = 0x10, /* base address */
57 PciCAP = 0x34, /* capabilities pointer */
58 PciINTL = 0x3C, /* interrupt line */
59 PciINTP = 0x3D, /* interrupt pin */
62 /* ccrb (base class code) values; controller types */
64 Pcibcpci1 = 0, /* pci 1.0; no class codes defined */
65 Pcibcstore = 1, /* mass storage */
66 Pcibcnet = 2, /* network */
67 Pcibcdisp = 3, /* display */
68 Pcibcmmedia = 4, /* multimedia */
69 Pcibcmem = 5, /* memory */
70 Pcibcbridge = 6, /* bridge */
71 Pcibccomm = 7, /* simple comms (e.g., serial) */
72 Pcibcbasesys = 8, /* base system */
73 Pcibcinput = 9, /* input */
74 Pcibcdock = 0xa, /* docking stations */
75 Pcibcproc = 0xb, /* processors */
76 Pcibcserial = 0xc, /* serial bus (e.g., USB) */
77 Pcibcwireless = 0xd, /* wireless */
78 Pcibcintell = 0xe, /* intelligent i/o */
79 Pcibcsatcom = 0xf, /* satellite comms */
80 Pcibccrypto = 0x10, /* encryption/decryption */
81 Pcibcdacq = 0x11, /* data acquisition & signal proc. */
84 /* ccru (sub-class code) values; common cases only */
87 Pciscscsi = 0, /* SCSI */
88 Pciscide = 1, /* IDE (ATA) */
89 Pciscsata = 6, /* SATA */
92 Pciscether = 0, /* Ethernet */
95 Pciscvga = 0, /* VGA */
96 Pciscxga = 1, /* XGA */
100 Pcischostpci = 0, /* host/pci */
101 Pciscpcicpci = 1, /* pci/pci */
104 Pciscserial = 0, /* 16450, etc. */
105 Pciscmultiser = 1, /* multiport serial */
108 Pciscusb = 3, /* USB */
111 enum { /* type 0 pre-defined header */
112 PciCIS = 0x28, /* cardbus CIS pointer */
113 PciSVID = 0x2C, /* subsystem vendor ID */
114 PciSID = 0x2E, /* subsystem ID */
115 PciEBAR0 = 0x30, /* expansion ROM base address */
116 PciMGNT = 0x3E, /* burst period length */
117 PciMLT = 0x3F, /* maximum latency between bursts */
120 enum { /* type 1 pre-defined header */
121 PciPBN = 0x18, /* primary bus number */
122 PciSBN = 0x19, /* secondary bus number */
123 PciUBN = 0x1A, /* subordinate bus number */
124 PciSLTR = 0x1B, /* secondary latency timer */
125 PciIBR = 0x1C, /* I/O base */
126 PciILR = 0x1D, /* I/O limit */
127 PciSPSR = 0x1E, /* secondary status */
128 PciMBR = 0x20, /* memory base */
129 PciMLR = 0x22, /* memory limit */
130 PciPMBR = 0x24, /* prefetchable memory base */
131 PciPMLR = 0x26, /* prefetchable memory limit */
132 PciPUBR = 0x28, /* prefetchable base upper 32 bits */
133 PciPULR = 0x2C, /* prefetchable limit upper 32 bits */
134 PciIUBR = 0x30, /* I/O base upper 16 bits */
135 PciIULR = 0x32, /* I/O limit upper 16 bits */
136 PciEBAR1 = 0x28, /* expansion ROM base address */
137 PciBCR = 0x3E, /* bridge control register */
140 enum { /* type 2 pre-defined header */
143 PciCBPBN = 0x18, /* primary bus number */
144 PciCBSBN = 0x19, /* secondary bus number */
145 PciCBUBN = 0x1A, /* subordinate bus number */
146 PciCBSLTR = 0x1B, /* secondary latency timer */
151 PciCBIBR0 = 0x2C, /* I/O base */
152 PciCBILR0 = 0x30, /* I/O limit */
153 PciCBIBR1 = 0x34, /* I/O base */
154 PciCBILR1 = 0x38, /* I/O limit */
155 PciCBSVID = 0x40, /* subsystem vendor ID */
156 PciCBSID = 0x42, /* subsystem ID */
157 PciCBLMBAR = 0x44, /* legacy mode base address */
162 Barioaddr = 1<<0, /* vs. memory addr */
171 { /* command register */
182 PciCapPMG = 0x01, /* power management */
184 PciCapVPD = 0x03, /* vital product data */
185 PciCapSID = 0x04, /* slot id */
187 PciCapCHS = 0x06, /* compact pci hot swap */
189 PciCapHTC = 0x08, /* hypertransport irq conf */
190 PciCapVND = 0x09, /* vendor specific information */
194 PciCapHSW = 0x0c, /* hot swap */
197 typedef struct Pcidev Pcidev;
200 int tbdf; /* type+bus+device+function */
201 ushort vid; /* vendor ID */
202 ushort did; /* device ID */
214 uintptr bar; /* base address */
218 uchar intl; /* interrupt line */
221 Pcidev* link; /* next device on this bno */
223 Pcidev* parent; /* up a bus */
224 Pcidev* bridge; /* down a bus */
226 int pmrb; /* power management register block */
235 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW)
237 #pragma varargck type "T" int
238 #pragma varargck type "T" uint