2 VectorDE = 1, /* debug exception */
3 VectorNMI = 2, /* non-maskable interrupt */
4 VectorBPT = 3, /* breakpoint */
5 VectorUD = 6, /* invalid opcode exception */
6 VectorCNA = 7, /* coprocessor not available */
7 Vector2F = 8, /* double fault */
8 VectorCSO = 9, /* coprocessor segment overrun */
9 VectorSNP = 11, /* segment not present */
10 VectorGPF = 13, /* general protection fault */
11 VectorPF = 14, /* page fault */
12 Vector15 = 15, /* reserved */
13 VectorCERR = 16, /* coprocessor error */
14 VectorAC = 17, /* alignment check */
15 VectorMC = 18, /* machine check */
16 VectorSIMD = 19, /* simd error */
18 VectorPIC = 32, /* external i8259 interrupts */
27 IrqAUX = 12, /* PS/2 port */
28 IrqIRQ13 = 13, /* coprocessor on 386 */
33 VectorLAPIC = VectorPIC+16, /* local APIC interrupts */
34 IrqLINT0 = 16, /* LINT[01] must be offsets 0 and 1 */
39 IrqSPURIOUS = 31, /* must have bits [3-0] == 0x0F */
44 VectorAPIC = 65, /* external APIC interrupts */
49 Vctl* next; /* handlers on this vector */
51 char name[KNAMELEN]; /* of driver */
52 int isintr; /* interrupt or fault/trap */
55 int (*isr)(int); /* get isr bit for this irq */
56 int (*eoi)(int); /* eoi */
58 void (*f)(Ureg*, void*); /* handler to call */
59 void* a; /* argument to call it with */
63 BusCBUS = 0, /* Corollary CBUS */
64 BusCBUSII, /* Corollary CBUS II */
65 BusEISA, /* Extended ISA */
66 BusFUTURE, /* IEEE Futurebus */
67 BusINTERN, /* Internal bus */
68 BusISA, /* Industry Standard Architecture */
69 BusMBI, /* Multibus I */
70 BusMBII, /* Multibus II */
71 BusMCA, /* Micro Channel Architecture */
74 BusNUBUS, /* Apple Macintosh NuBus */
75 BusPCI, /* Peripheral Component Interconnect */
76 BusPCMCIA, /* PC Memory Card International Association */
77 BusTC, /* DEC TurboChannel */
78 BusVL, /* VESA Local bus */
80 BusXPRESS, /* Express System Bus */
83 #define MKBUS(t,b,d,f) (((t)<<24)|(((b)&0xFF)<<16)|(((d)&0x1F)<<11)|(((f)&0x07)<<8))
84 #define BUSFNO(tbdf) (((tbdf)>>8)&0x07)
85 #define BUSDNO(tbdf) (((tbdf)>>11)&0x1F)
86 #define BUSBNO(tbdf) (((tbdf)>>16)&0xFF)
87 #define BUSTYPE(tbdf) ((tbdf)>>24)
88 #define BUSBDF(tbdf) ((tbdf)&0x00FFFF00)
89 #define BUSUNKNOWN (-1)
99 enum { /* type 0 & type 1 pre-defined header */
100 PciVID = 0x00, /* vendor ID */
101 PciDID = 0x02, /* device ID */
102 PciPCR = 0x04, /* command */
103 PciPSR = 0x06, /* status */
104 PciRID = 0x08, /* revision ID */
105 PciCCRp = 0x09, /* programming interface class code */
106 PciCCRu = 0x0A, /* sub-class code */
107 PciCCRb = 0x0B, /* base class code */
108 PciCLS = 0x0C, /* cache line size */
109 PciLTR = 0x0D, /* latency timer */
110 PciHDT = 0x0E, /* header type */
111 PciBST = 0x0F, /* BIST */
113 PciBAR0 = 0x10, /* base address */
116 PciCAP = 0x34, /* capabilities pointer */
117 PciINTL = 0x3C, /* interrupt line */
118 PciINTP = 0x3D, /* interrupt pin */
121 /* ccrb (base class code) values; controller types */
123 Pcibcpci1 = 0, /* pci 1.0; no class codes defined */
124 Pcibcstore = 1, /* mass storage */
125 Pcibcnet = 2, /* network */
126 Pcibcdisp = 3, /* display */
127 Pcibcmmedia = 4, /* multimedia */
128 Pcibcmem = 5, /* memory */
129 Pcibcbridge = 6, /* bridge */
130 Pcibccomm = 7, /* simple comms (e.g., serial) */
131 Pcibcbasesys = 8, /* base system */
132 Pcibcinput = 9, /* input */
133 Pcibcdock = 0xa, /* docking stations */
134 Pcibcproc = 0xb, /* processors */
135 Pcibcserial = 0xc, /* serial bus (e.g., USB) */
136 Pcibcwireless = 0xd, /* wireless */
137 Pcibcintell = 0xe, /* intelligent i/o */
138 Pcibcsatcom = 0xf, /* satellite comms */
139 Pcibccrypto = 0x10, /* encryption/decryption */
140 Pcibcdacq = 0x11, /* data acquisition & signal proc. */
143 /* ccru (sub-class code) values; common cases only */
146 Pciscscsi = 0, /* SCSI */
147 Pciscide = 1, /* IDE (ATA) */
150 Pciscether = 0, /* Ethernet */
153 Pciscvga = 0, /* VGA */
154 Pciscxga = 1, /* XGA */
155 Pcisc3d = 2, /* 3D */
158 Pcischostpci = 0, /* host/pci */
159 Pciscpcicpci = 1, /* pci/pci */
162 Pciscserial = 0, /* 16450, etc. */
163 Pciscmultiser = 1, /* multiport serial */
166 Pciscusb = 3, /* USB */
169 enum { /* type 0 pre-defined header */
170 PciCIS = 0x28, /* cardbus CIS pointer */
171 PciSVID = 0x2C, /* subsystem vendor ID */
172 PciSID = 0x2E, /* subsystem ID */
173 PciEBAR0 = 0x30, /* expansion ROM base address */
174 PciMGNT = 0x3E, /* burst period length */
175 PciMLT = 0x3F, /* maximum latency between bursts */
178 enum { /* type 1 pre-defined header */
179 PciPBN = 0x18, /* primary bus number */
180 PciSBN = 0x19, /* secondary bus number */
181 PciUBN = 0x1A, /* subordinate bus number */
182 PciSLTR = 0x1B, /* secondary latency timer */
183 PciIBR = 0x1C, /* I/O base */
184 PciILR = 0x1D, /* I/O limit */
185 PciSPSR = 0x1E, /* secondary status */
186 PciMBR = 0x20, /* memory base */
187 PciMLR = 0x22, /* memory limit */
188 PciPMBR = 0x24, /* prefetchable memory base */
189 PciPMLR = 0x26, /* prefetchable memory limit */
190 PciPUBR = 0x28, /* prefetchable base upper 32 bits */
191 PciPULR = 0x2C, /* prefetchable limit upper 32 bits */
192 PciIUBR = 0x30, /* I/O base upper 16 bits */
193 PciIULR = 0x32, /* I/O limit upper 16 bits */
194 PciEBAR1 = 0x28, /* expansion ROM base address */
195 PciBCR = 0x3E, /* bridge control register */
198 enum { /* type 2 pre-defined header */
201 PciCBPBN = 0x18, /* primary bus number */
202 PciCBSBN = 0x19, /* secondary bus number */
203 PciCBUBN = 0x1A, /* subordinate bus number */
204 PciCBSLTR = 0x1B, /* secondary latency timer */
209 PciCBIBR0 = 0x2C, /* I/O base */
210 PciCBILR0 = 0x30, /* I/O limit */
211 PciCBIBR1 = 0x34, /* I/O base */
212 PciCBILR1 = 0x38, /* I/O limit */
213 PciCBSVID = 0x40, /* subsystem vendor ID */
214 PciCBSID = 0x42, /* subsystem ID */
215 PciCBLMBAR = 0x44, /* legacy mode base address */
220 PciCapPMG = 0x01, /* power management */
222 PciCapVPD = 0x03, /* vital product data */
223 PciCapSID = 0x04, /* slot id */
225 PciCapCHS = 0x06, /* compact pci hot swap */
227 PciCapHTC = 0x08, /* hypertransport irq conf */
228 PciCapVND = 0x09, /* vendor specific information */
232 PciCapHSW = 0x0c, /* hot swap */
235 typedef struct Pcisiz Pcisiz;
243 typedef struct Pcidev Pcidev;
246 int tbdf; /* type+bus+device+function */
247 ushort vid; /* vendor ID */
248 ushort did; /* device ID */
260 ulong bar; /* base address */
268 uchar intl; /* interrupt line */
271 Pcidev* link; /* next device on this bno */
273 Pcidev* parent; /* up a bus */
274 Pcidev* bridge; /* down a bus */
280 int pmrb; /* power management register block */
290 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW)
292 #define ISAWADDR(va) (PADDR(va)+ISAWINDOW)
294 /* SMBus transactions */
297 SMBquick, /* sends address only */
300 SMBsend, /* sends address and cmd */
301 SMBbytewrite, /* sends address and cmd and 1 byte */
302 SMBwordwrite, /* sends address and cmd and 2 bytes */
305 SMBrecv, /* sends address, recvs 1 byte */
306 SMBbyteread, /* sends address and cmd, recv's byte */
307 SMBwordread, /* sends address and cmd, recv's 2 bytes */
310 typedef struct SMBus SMBus;
313 Rendez r; /* rendezvous point for completion interrupts */
314 void *arg; /* implementation dependent */
315 ulong base; /* port or memory base of smbus */
317 void (*transact)(SMBus*, int, int, int, uchar*);
321 * PCMCIA support code.
324 typedef struct PCMslot PCMslot;
325 typedef struct PCMconftab PCMconftab;
328 * Map between ISA memory space and PCMCIA card memory space.
331 ulong ca; /* card address */
332 ulong cea; /* card end address */
333 ulong isa; /* ISA address */
334 int len; /* length of the ISA area */
335 int attr; /* attribute memory */
339 /* configuration table entry */
343 ushort irqs; /* legal irqs */
345 uchar bit16; /* true for 16 bit access */
365 void *cp; /* controller for this slot */
366 long memlen; /* memory length */
367 uchar base; /* index register base */
368 uchar slotno; /* slot number */
371 uchar special; /* in use for a special device */
372 uchar already; /* already inited */
382 ulong msec; /* time of last slotinfo call */
383 char verstr[512]; /* version string */
384 int ncfg; /* number of configurations */
386 ushort cpresent; /* config registers present */
387 ulong caddr; /* relative address of config registers */
389 int nctab; /* number of config table entries */
391 PCMconftab *def; /* default conftab */
394 Lock mlock; /* lock down the maps */
396 PCMmap mmap[4]; /* maps, last is always for the kernel */
399 #pragma varargck type "T" int
400 #pragma varargck type "T" uint