2 * programmable interrupt vectors (for the 8259's)
6 Bptvec= 3, /* breakpoints */
7 Mathemuvec= 7, /* math coprocessor emulation interrupt */
8 Mathovervec= 9, /* math coprocessor overrun interrupt */
9 Matherr1vec= 16, /* math coprocessor error interrupt */
10 Faultvec= 14, /* page fault */
14 VectorPIC = 24, /* external [A]PIC interrupts */
15 VectorCLOCK = VectorPIC+0,
16 VectorKBD = VectorPIC+1,
17 VectorUART1 = VectorPIC+3,
18 VectorUART0 = VectorPIC+4,
19 VectorPCMCIA = VectorPIC+5,
20 VectorFLOPPY = VectorPIC+6,
21 VectorLPT = VectorPIC+7,
22 VectorIRQ7 = VectorPIC+7,
23 VectorAUX = VectorPIC+12, /* PS/2 port */
24 VectorIRQ13 = VectorPIC+13, /* coprocessor on x386 */
25 VectorATA0 = VectorPIC+14,
26 VectorATA1 = VectorPIC+15,
27 MaxVectorPIC = VectorPIC+15,
31 BusCBUS = 0, /* Corollary CBUS */
32 BusCBUSII, /* Corollary CBUS II */
33 BusEISA, /* Extended ISA */
34 BusFUTURE, /* IEEE Futurebus */
35 BusINTERN, /* Internal bus */
36 BusISA, /* Industry Standard Architecture */
37 BusMBI, /* Multibus I */
38 BusMBII, /* Multibus II */
39 BusMCA, /* Micro Channel Architecture */
42 BusNUBUS, /* Apple Macintosh NuBus */
43 BusPCI, /* Peripheral Component Interconnect */
44 BusPCMCIA, /* PC Memory Card International Association */
45 BusTC, /* DEC TurboChannel */
46 BusVL, /* VESA Local bus */
48 BusXPRESS, /* Express System Bus */
51 #define MKBUS(t,b,d,f) (((t)<<24)|(((b)&0xFF)<<16)|(((d)&0x1F)<<11)|(((f)&0x07)<<8))
52 #define BUSFNO(tbdf) (((tbdf)>>8)&0x07)
53 #define BUSDNO(tbdf) (((tbdf)>>11)&0x1F)
54 #define BUSBNO(tbdf) (((tbdf)>>16)&0xFF)
55 #define BUSTYPE(tbdf) ((tbdf)>>24)
56 #define BUSBDF(tbdf) ((tbdf)&0x00FFFF00)
57 #define BUSUNKNOWN (-1)
67 enum { /* type 0 and type 1 pre-defined header */
68 PciVID = 0x00, /* vendor ID */
69 PciDID = 0x02, /* device ID */
70 PciPCR = 0x04, /* command */
71 PciPSR = 0x06, /* status */
72 PciRID = 0x08, /* revision ID */
73 PciCCRp = 0x09, /* programming interface class code */
74 PciCCRu = 0x0A, /* sub-class code */
75 PciCCRb = 0x0B, /* base class code */
76 PciCLS = 0x0C, /* cache line size */
77 PciLTR = 0x0D, /* latency timer */
78 PciHDT = 0x0E, /* header type */
79 PciBST = 0x0F, /* BIST */
81 PciBAR0 = 0x10, /* base address */
84 PciINTL = 0x3C, /* interrupt line */
85 PciINTP = 0x3D, /* interrupt pin */
88 /* ccrb (base class code) values; controller types */
90 Pcibcpci1 = 0, /* pci 1.0; no class codes defined */
91 Pcibcstore = 1, /* mass storage */
92 Pcibcnet = 2, /* network */
93 Pcibcdisp = 3, /* display */
94 Pcibcmmedia = 4, /* multimedia */
95 Pcibcmem = 5, /* memory */
96 Pcibcbridge = 6, /* bridge */
97 Pcibccomm = 7, /* simple comms (e.g., serial) */
98 Pcibcbasesys = 8, /* base system */
99 Pcibcinput = 9, /* input */
100 Pcibcdock = 0xa, /* docking stations */
101 Pcibcproc = 0xb, /* processors */
102 Pcibcserial = 0xc, /* serial bus (e.g., USB) */
103 Pcibcwireless = 0xd, /* wireless */
104 Pcibcintell = 0xe, /* intelligent i/o */
105 Pcibcsatcom = 0xf, /* satellite comms */
106 Pcibccrypto = 0x10, /* encryption/decryption */
107 Pcibcdacq = 0x11, /* data acquisition & signal proc. */
110 /* ccru (sub-class code) values; common cases only */
113 Pciscscsi = 0, /* SCSI */
114 Pciscide = 1, /* IDE (ATA) */
117 Pciscether = 0, /* Ethernet */
120 Pciscvga = 0, /* VGA */
121 Pciscxga = 1, /* XGA */
122 Pcisc3d = 2, /* 3D */
125 Pcischostpci = 0, /* host/pci */
126 Pciscpcicpci = 1, /* pci/pci */
129 Pciscserial = 0, /* 16450, etc. */
130 Pciscmultiser = 1, /* multiport serial */
133 Pciscusb = 3, /* USB */
136 enum { /* type 0 pre-defined header */
141 PciCIS = 0x28, /* cardbus CIS pointer */
142 PciSVID = 0x2C, /* subsystem vendor ID */
143 PciSID = 0x2E, /* cardbus CIS pointer */
144 PciEBAR0 = 0x30, /* expansion ROM base address */
145 PciMGNT = 0x3E, /* burst period length */
146 PciMLT = 0x3F, /* maximum latency between bursts */
149 enum { /* type 1 pre-defined header */
150 PciPBN = 0x18, /* primary bus number */
151 PciSBN = 0x19, /* secondary bus number */
152 PciUBN = 0x1A, /* subordinate bus number */
153 PciSLTR = 0x1B, /* secondary latency timer */
154 PciIBR = 0x1C, /* I/O base */
155 PciILR = 0x1D, /* I/O limit */
156 PciSPSR = 0x1E, /* secondary status */
157 PciMBR = 0x20, /* memory base */
158 PciMLR = 0x22, /* memory limit */
159 PciPMBR = 0x24, /* prefetchable memory base */
160 PciPMLR = 0x26, /* prefetchable memory limit */
161 PciPUBR = 0x28, /* prefetchable base upper 32 bits */
162 PciPULR = 0x2C, /* prefetchable limit upper 32 bits */
163 PciIUBR = 0x30, /* I/O base upper 16 bits */
164 PciIULR = 0x32, /* I/O limit upper 16 bits */
165 PciEBAR1 = 0x28, /* expansion ROM base address */
166 PciBCR = 0x3E, /* bridge control register */
169 enum { /* type 2 pre-defined header */
172 PciCBPBN = 0x18, /* primary bus number */
173 PciCBSBN = 0x19, /* secondary bus number */
174 PciCBUBN = 0x1A, /* subordinate bus number */
175 PciCBSLTR = 0x1B, /* secondary latency timer */
180 PciCBIBR0 = 0x2C, /* I/O base */
181 PciCBILR0 = 0x30, /* I/O limit */
182 PciCBIBR1 = 0x34, /* I/O base */
183 PciCBILR1 = 0x38, /* I/O limit */
184 PciCBBCTL = 0x3E, /* Bridge control */
185 PciCBSVID = 0x40, /* subsystem vendor ID */
186 PciCBSID = 0x42, /* subsystem ID */
187 PciCBLMBAR = 0x44, /* legacy mode base address */
190 typedef struct Pcisiz Pcisiz;
198 typedef struct Pcidev Pcidev;
199 typedef struct Pcidev {
200 int tbdf; /* type+bus+device+function */
201 ushort vid; /* vendor ID */
202 ushort did; /* device ID */
214 ulong bar; /* base address */
222 uchar intl; /* interrupt line */
225 Pcidev* link; /* next device on this bno */
227 Pcidev* bridge; /* down a bus */
233 int pmrb; /* power management register block */
237 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW)
239 #define ISAWADDR(va) (PADDR(va)+ISAWINDOW)
242 * PCMCIA support code.
244 typedef struct PCMslot PCMslot;
245 typedef struct PCMconftab PCMconftab;
248 * Map between ISA memory space and PCMCIA card memory space.
251 ulong ca; /* card address */
252 ulong cea; /* card end address */
253 ulong isa; /* ISA address */
254 int len; /* length of the ISA area */
255 int attr; /* attribute memory */
259 /* configuration table entry */
263 ushort irqs; /* legal irqs */
265 uchar bit16; /* true for 16 bit access */
285 void *cp; /* controller for this slot */
286 long memlen; /* memory length */
287 uchar base; /* index register base */
288 uchar slotno; /* slot number */
291 uchar special; /* in use for a special device */
292 uchar already; /* already inited */
302 ulong msec; /* time of last slotinfo call */
303 char verstr[512]; /* version string */
304 int ncfg; /* number of configurations */
306 ushort cpresent; /* config registers present */
307 ulong caddr; /* relative address of config registers */
309 int nctab; /* number of config table entries */
311 PCMconftab *def; /* default conftab */
314 Lock mlock; /* lock down the maps */
316 PCMmap mmap[4]; /* maps, last is always for the kernel */