1 #pragma varargck type "T" int
2 #pragma varargck type "T" uint
9 BusCBUS = 0, /* Corollary CBUS */
10 BusCBUSII, /* Corollary CBUS II */
11 BusEISA, /* Extended ISA */
12 BusFUTURE, /* IEEE Futurebus */
13 BusINTERN, /* Internal bus */
14 BusISA, /* Industry Standard Architecture */
15 BusMBI, /* Multibus I */
16 BusMBII, /* Multibus II */
17 BusMCA, /* Micro Channel Architecture */
20 BusNUBUS, /* Apple Macintosh NuBus */
21 BusPCI, /* Peripheral Component Interconnect */
22 BusPCMCIA, /* PC Memory Card International Association */
23 BusTC, /* DEC TurboChannel */
24 BusVL, /* VESA Local bus */
26 BusXPRESS, /* Express System Bus */
29 #define MKBUS(t,b,d,f) (((t)<<24)|(((b)&0xFF)<<16)|(((d)&0x1F)<<11)|(((f)&0x07)<<8))
30 #define BUSFNO(tbdf) (((tbdf)>>8)&0x07)
31 #define BUSDNO(tbdf) (((tbdf)>>11)&0x1F)
32 #define BUSBNO(tbdf) (((tbdf)>>16)&0xFF)
33 #define BUSTYPE(tbdf) ((tbdf)>>24)
34 #define BUSBDF(tbdf) ((tbdf)&0x00FFFF00)
35 #define BUSUNKNOWN (-1)
37 enum { /* type 0 & type 1 pre-defined header */
38 PciVID = 0x00, /* vendor ID */
39 PciDID = 0x02, /* device ID */
40 PciPCR = 0x04, /* command */
41 PciPSR = 0x06, /* status */
42 PciRID = 0x08, /* revision ID */
43 PciCCRp = 0x09, /* programming interface class code */
44 PciCCRu = 0x0A, /* sub-class code */
45 PciCCRb = 0x0B, /* base class code */
46 PciCLS = 0x0C, /* cache line size */
47 PciLTR = 0x0D, /* latency timer */
48 PciHDT = 0x0E, /* header type */
49 PciBST = 0x0F, /* BIST */
51 PciBAR0 = 0x10, /* base address */
54 PciINTL = 0x3C, /* interrupt line */
55 PciINTP = 0x3D, /* interrupt pin */
58 /* ccrb (base class code) values; controller types */
60 Pcibcpci1 = 0, /* pci 1.0; no class codes defined */
61 Pcibcstore = 1, /* mass storage */
62 Pcibcnet = 2, /* network */
63 Pcibcdisp = 3, /* display */
64 Pcibcmmedia = 4, /* multimedia */
65 Pcibcmem = 5, /* memory */
66 Pcibcbridge = 6, /* bridge */
67 Pcibccomm = 7, /* simple comms (e.g., serial) */
68 Pcibcbasesys = 8, /* base system */
69 Pcibcinput = 9, /* input */
70 Pcibcdock = 0xa, /* docking stations */
71 Pcibcproc = 0xb, /* processors */
72 Pcibcserial = 0xc, /* serial bus (e.g., USB) */
73 Pcibcwireless = 0xd, /* wireless */
74 Pcibcintell = 0xe, /* intelligent i/o */
75 Pcibcsatcom = 0xf, /* satellite comms */
76 Pcibccrypto = 0x10, /* encryption/decryption */
77 Pcibcdacq = 0x11, /* data acquisition & signal proc. */
80 /* ccru (sub-class code) values; common cases only */
83 Pciscscsi = 0, /* SCSI */
84 Pciscide = 1, /* IDE (ATA) */
85 Pciscsata = 6, /* SATA */
88 Pciscether = 0, /* Ethernet */
91 Pciscvga = 0, /* VGA */
92 Pciscxga = 1, /* XGA */
96 Pcischostpci = 0, /* host/pci */
97 Pciscpcicpci = 1, /* pci/pci */
100 Pciscserial = 0, /* 16450, etc. */
101 Pciscmultiser = 1, /* multiport serial */
104 Pciscusb = 3, /* USB */
107 enum { /* type 0 pre-defined header */
108 PciCIS = 0x28, /* cardbus CIS pointer */
109 PciSVID = 0x2C, /* subsystem vendor ID */
110 PciSID = 0x2E, /* subsystem ID */
111 PciEBAR0 = 0x30, /* expansion ROM base address */
112 PciMGNT = 0x3E, /* burst period length */
113 PciMLT = 0x3F, /* maximum latency between bursts */
116 enum { /* type 1 pre-defined header */
117 PciPBN = 0x18, /* primary bus number */
118 PciSBN = 0x19, /* secondary bus number */
119 PciUBN = 0x1A, /* subordinate bus number */
120 PciSLTR = 0x1B, /* secondary latency timer */
121 PciIBR = 0x1C, /* I/O base */
122 PciILR = 0x1D, /* I/O limit */
123 PciSPSR = 0x1E, /* secondary status */
124 PciMBR = 0x20, /* memory base */
125 PciMLR = 0x22, /* memory limit */
126 PciPMBR = 0x24, /* prefetchable memory base */
127 PciPMLR = 0x26, /* prefetchable memory limit */
128 PciPUBR = 0x28, /* prefetchable base upper 32 bits */
129 PciPULR = 0x2C, /* prefetchable limit upper 32 bits */
130 PciIUBR = 0x30, /* I/O base upper 16 bits */
131 PciIULR = 0x32, /* I/O limit upper 16 bits */
132 PciEBAR1 = 0x28, /* expansion ROM base address */
133 PciBCR = 0x3E, /* bridge control register */
136 enum { /* type 2 pre-defined header */
139 PciCBPBN = 0x18, /* primary bus number */
140 PciCBSBN = 0x19, /* secondary bus number */
141 PciCBUBN = 0x1A, /* subordinate bus number */
142 PciCBSLTR = 0x1B, /* secondary latency timer */
147 PciCBIBR0 = 0x2C, /* I/O base */
148 PciCBILR0 = 0x30, /* I/O limit */
149 PciCBIBR1 = 0x34, /* I/O base */
150 PciCBILR1 = 0x38, /* I/O limit */
151 PciCBSVID = 0x40, /* subsystem vendor ID */
152 PciCBSID = 0x42, /* subsystem ID */
153 PciCBLMBAR = 0x44, /* legacy mode base address */
158 Barioaddr = 1<<0, /* vs. memory addr */
160 Barwidthmask = MASK(2),
175 int tbdf; /* type+bus+device+function */
176 ushort vid; /* vendor ID */
177 ushort did; /* device ID */
189 ulong bar; /* base address */
197 uchar intl; /* interrupt line */
200 Pcidev* link; /* next device on this bno */
202 Pcidev* bridge; /* down a bus */
204 int pmrb; /* power management register block */
219 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW)