1 #define X86STEPPING(x) ((x) & 0x0F)
2 /* incorporates extended-model and -family bits */
3 #define X86MODEL(x) ((((x)>>4) & 0x0F) | (((x)>>16) & 0x0F)<<4)
4 #define X86FAMILY(x) ((((x)>>8) & 0x0F) | (((x)>>20) & 0xFF)<<4)
7 VectorDE = 1, /* debug exception */
8 VectorNMI = 2, /* non-maskable interrupt */
9 VectorBPT = 3, /* breakpoint */
10 VectorUD = 6, /* invalid opcode exception */
11 VectorCNA = 7, /* coprocessor not available */
12 Vector2F = 8, /* double fault */
13 VectorCSO = 9, /* coprocessor segment overrun */
14 VectorSNP = 11, /* segment not present */
15 VectorGPF = 13, /* general protection fault */
16 VectorPF = 14, /* page fault */
17 Vector15 = 15, /* reserved */
18 VectorCERR = 16, /* coprocessor error */
19 VectorAC = 17, /* alignment check */
20 VectorMC = 18, /* machine check */
21 VectorSIMD = 19, /* simd error */
23 VectorPIC = 32, /* external i8259 interrupts */
32 IrqAUX = 12, /* PS/2 port */
33 IrqIRQ13 = 13, /* coprocessor on 386 */
38 VectorLAPIC = VectorPIC+16, /* local APIC interrupts */
39 IrqLINT0 = 16, /* LINT[01] must be offsets 0 and 1 */
44 IrqSPURIOUS = 31, /* must have bits [3-0] == 0x0F */
49 VectorAPIC = 65, /* external APIC interrupts */
54 Vctl* next; /* handlers on this vector */
56 char name[KNAMELEN]; /* of driver */
57 int isintr; /* interrupt or fault/trap */
60 int (*isr)(int); /* get isr bit for this irq */
61 int (*eoi)(int); /* eoi */
63 void (*f)(Ureg*, void*); /* handler to call */
64 void* a; /* argument to call it with */
68 BusCBUS = 0, /* Corollary CBUS */
69 BusCBUSII, /* Corollary CBUS II */
70 BusEISA, /* Extended ISA */
71 BusFUTURE, /* IEEE Futurebus */
72 BusINTERN, /* Internal bus */
73 BusISA, /* Industry Standard Architecture */
74 BusMBI, /* Multibus I */
75 BusMBII, /* Multibus II */
76 BusMCA, /* Micro Channel Architecture */
79 BusNUBUS, /* Apple Macintosh NuBus */
80 BusPCI, /* Peripheral Component Interconnect */
81 BusPCMCIA, /* PC Memory Card International Association */
82 BusTC, /* DEC TurboChannel */
83 BusVL, /* VESA Local bus */
85 BusXPRESS, /* Express System Bus */
88 #define MKBUS(t,b,d,f) (((t)<<24)|(((b)&0xFF)<<16)|(((d)&0x1F)<<11)|(((f)&0x07)<<8))
89 #define BUSFNO(tbdf) (((tbdf)>>8)&0x07)
90 #define BUSDNO(tbdf) (((tbdf)>>11)&0x1F)
91 #define BUSBNO(tbdf) (((tbdf)>>16)&0xFF)
92 #define BUSTYPE(tbdf) ((tbdf)>>24)
93 #define BUSBDF(tbdf) ((tbdf)&0x00FFFF00)
94 #define BUSUNKNOWN (-1)
104 enum { /* type 0 & type 1 pre-defined header */
105 PciVID = 0x00, /* vendor ID */
106 PciDID = 0x02, /* device ID */
107 PciPCR = 0x04, /* command */
108 PciPSR = 0x06, /* status */
109 PciRID = 0x08, /* revision ID */
110 PciCCRp = 0x09, /* programming interface class code */
111 PciCCRu = 0x0A, /* sub-class code */
112 PciCCRb = 0x0B, /* base class code */
113 PciCLS = 0x0C, /* cache line size */
114 PciLTR = 0x0D, /* latency timer */
115 PciHDT = 0x0E, /* header type */
116 PciBST = 0x0F, /* BIST */
118 PciBAR0 = 0x10, /* base address */
121 PciCAP = 0x34, /* capabilities pointer */
122 PciINTL = 0x3C, /* interrupt line */
123 PciINTP = 0x3D, /* interrupt pin */
126 /* ccrb (base class code) values; controller types */
128 Pcibcpci1 = 0, /* pci 1.0; no class codes defined */
129 Pcibcstore = 1, /* mass storage */
130 Pcibcnet = 2, /* network */
131 Pcibcdisp = 3, /* display */
132 Pcibcmmedia = 4, /* multimedia */
133 Pcibcmem = 5, /* memory */
134 Pcibcbridge = 6, /* bridge */
135 Pcibccomm = 7, /* simple comms (e.g., serial) */
136 Pcibcbasesys = 8, /* base system */
137 Pcibcinput = 9, /* input */
138 Pcibcdock = 0xa, /* docking stations */
139 Pcibcproc = 0xb, /* processors */
140 Pcibcserial = 0xc, /* serial bus (e.g., USB) */
141 Pcibcwireless = 0xd, /* wireless */
142 Pcibcintell = 0xe, /* intelligent i/o */
143 Pcibcsatcom = 0xf, /* satellite comms */
144 Pcibccrypto = 0x10, /* encryption/decryption */
145 Pcibcdacq = 0x11, /* data acquisition & signal proc. */
148 /* ccru (sub-class code) values; common cases only */
151 Pciscscsi = 0, /* SCSI */
152 Pciscide = 1, /* IDE (ATA) */
155 Pciscether = 0, /* Ethernet */
158 Pciscvga = 0, /* VGA */
159 Pciscxga = 1, /* XGA */
160 Pcisc3d = 2, /* 3D */
163 Pcischostpci = 0, /* host/pci */
164 Pciscpcicpci = 1, /* pci/pci */
167 Pciscserial = 0, /* 16450, etc. */
168 Pciscmultiser = 1, /* multiport serial */
171 Pciscusb = 3, /* USB */
174 enum { /* type 0 pre-defined header */
175 PciCIS = 0x28, /* cardbus CIS pointer */
176 PciSVID = 0x2C, /* subsystem vendor ID */
177 PciSID = 0x2E, /* subsystem ID */
178 PciEBAR0 = 0x30, /* expansion ROM base address */
179 PciMGNT = 0x3E, /* burst period length */
180 PciMLT = 0x3F, /* maximum latency between bursts */
183 enum { /* type 1 pre-defined header */
184 PciPBN = 0x18, /* primary bus number */
185 PciSBN = 0x19, /* secondary bus number */
186 PciUBN = 0x1A, /* subordinate bus number */
187 PciSLTR = 0x1B, /* secondary latency timer */
188 PciIBR = 0x1C, /* I/O base */
189 PciILR = 0x1D, /* I/O limit */
190 PciSPSR = 0x1E, /* secondary status */
191 PciMBR = 0x20, /* memory base */
192 PciMLR = 0x22, /* memory limit */
193 PciPMBR = 0x24, /* prefetchable memory base */
194 PciPMLR = 0x26, /* prefetchable memory limit */
195 PciPUBR = 0x28, /* prefetchable base upper 32 bits */
196 PciPULR = 0x2C, /* prefetchable limit upper 32 bits */
197 PciIUBR = 0x30, /* I/O base upper 16 bits */
198 PciIULR = 0x32, /* I/O limit upper 16 bits */
199 PciEBAR1 = 0x28, /* expansion ROM base address */
200 PciBCR = 0x3E, /* bridge control register */
203 enum { /* type 2 pre-defined header */
206 PciCBPBN = 0x18, /* primary bus number */
207 PciCBSBN = 0x19, /* secondary bus number */
208 PciCBUBN = 0x1A, /* subordinate bus number */
209 PciCBSLTR = 0x1B, /* secondary latency timer */
214 PciCBIBR0 = 0x2C, /* I/O base */
215 PciCBILR0 = 0x30, /* I/O limit */
216 PciCBIBR1 = 0x34, /* I/O base */
217 PciCBILR1 = 0x38, /* I/O limit */
218 PciCBSVID = 0x40, /* subsystem vendor ID */
219 PciCBSID = 0x42, /* subsystem ID */
220 PciCBLMBAR = 0x44, /* legacy mode base address */
225 PciCapPMG = 0x01, /* power management */
227 PciCapVPD = 0x03, /* vital product data */
228 PciCapSID = 0x04, /* slot id */
230 PciCapCHS = 0x06, /* compact pci hot swap */
232 PciCapHTC = 0x08, /* hypertransport irq conf */
233 PciCapVND = 0x09, /* vendor specific information */
237 PciCapHSW = 0x0c, /* hot swap */
240 typedef struct Pcisiz Pcisiz;
248 typedef struct Pcidev Pcidev;
251 int tbdf; /* type+bus+device+function */
252 ushort vid; /* vendor ID */
253 ushort did; /* device ID */
265 ulong bar; /* base address */
273 uchar intl; /* interrupt line */
276 Pcidev* link; /* next device on this bno */
278 Pcidev* parent; /* up a bus */
279 Pcidev* bridge; /* down a bus */
285 int pmrb; /* power management register block */
295 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW)
297 #define ISAWADDR(va) (PADDR(va)+ISAWINDOW)
299 /* SMBus transactions */
302 SMBquick, /* sends address only */
305 SMBsend, /* sends address and cmd */
306 SMBbytewrite, /* sends address and cmd and 1 byte */
307 SMBwordwrite, /* sends address and cmd and 2 bytes */
310 SMBrecv, /* sends address, recvs 1 byte */
311 SMBbyteread, /* sends address and cmd, recv's byte */
312 SMBwordread, /* sends address and cmd, recv's 2 bytes */
315 typedef struct SMBus SMBus;
318 Rendez r; /* rendezvous point for completion interrupts */
319 void *arg; /* implementation dependent */
320 ulong base; /* port or memory base of smbus */
322 void (*transact)(SMBus*, int, int, int, uchar*);
326 * PCMCIA support code.
329 typedef struct PCMslot PCMslot;
330 typedef struct PCMconftab PCMconftab;
333 * Map between ISA memory space and PCMCIA card memory space.
336 ulong ca; /* card address */
337 ulong cea; /* card end address */
338 ulong isa; /* ISA address */
339 int len; /* length of the ISA area */
340 int attr; /* attribute memory */
344 /* configuration table entry */
348 ushort irqs; /* legal irqs */
350 uchar bit16; /* true for 16 bit access */
370 void *cp; /* controller for this slot */
371 long memlen; /* memory length */
372 uchar base; /* index register base */
373 uchar slotno; /* slot number */
376 uchar special; /* in use for a special device */
377 uchar already; /* already inited */
387 ulong msec; /* time of last slotinfo call */
388 char verstr[512]; /* version string */
389 int ncfg; /* number of configurations */
391 ushort cpresent; /* config registers present */
392 ulong caddr; /* relative address of config registers */
394 int nctab; /* number of config table entries */
396 PCMconftab *def; /* default conftab */
399 Lock mlock; /* lock down the maps */
401 PCMmap mmap[4]; /* maps, last is always for the kernel */
404 #pragma varargck type "T" int
405 #pragma varargck type "T" uint