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