1 /**************************************************************************
3 ** $FreeBSD: src/sys/pci/pcisupport.c,v 1.154.2.15 2003/04/29 15:55:06 simokawa Exp $
5 ** Device driver for DEC/INTEL PCI chipsets.
9 **-------------------------------------------------------------------------
11 ** Written for FreeBSD by
12 ** wolf@cologne.de Wolfgang Stanglmeier
13 ** se@mi.Uni-Koeln.de Stefan Esser
15 **-------------------------------------------------------------------------
17 ** Copyright (c) 1994,1995 Stefan Esser. All rights reserved.
19 ** Redistribution and use in source and binary forms, with or without
20 ** modification, are permitted provided that the following conditions
22 ** 1. Redistributions of source code must retain the above copyright
23 ** notice, this list of conditions and the following disclaimer.
24 ** 2. Redistributions in binary form must reproduce the above copyright
25 ** notice, this list of conditions and the following disclaimer in the
26 ** documentation and/or other materials provided with the distribution.
27 ** 3. The name of the author may not be used to endorse or promote products
28 ** derived from this software without specific prior written permission.
30 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
31 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
32 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
34 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
35 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
39 ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 ***************************************************************************
47 #include <sys/param.h>
48 #include <sys/systm.h>
49 #include <sys/malloc.h>
50 #include <sys/kernel.h>
53 #include <pci/pcivar.h>
54 #include <pci/pcireg.h>
57 #include <vm/vm_object.h>
60 /*---------------------------------------------------------
62 ** Intel chipsets for 486 / Pentium processor
64 **---------------------------------------------------------
67 static void chipset_attach(device_t dev, int unit);
79 fixbushigh_i1225(device_t dev)
83 sublementarybus = pci_read_config(dev, 0x41, 1);
84 if (sublementarybus != 0xff) {
85 pci_set_secondarybus(dev, sublementarybus + 1);
86 pci_set_subordinatebus(dev, sublementarybus + 1);
91 fixwsc_natoma(device_t dev)
95 pmccfg = pci_read_config(dev, 0x50, 2);
97 if (pmccfg & 0x8000) {
98 printf("Correcting Natoma config for SMP\n");
100 pci_write_config(dev, 0x50, pmccfg, 2);
103 if ((pmccfg & 0x8000) == 0) {
104 printf("Correcting Natoma config for non-SMP\n");
106 pci_write_config(dev, 0x50, pmccfg, 2);
113 #define M_XX 0 /* end of list */
114 #define M_EQ 1 /* mask and return true if equal */
115 #define M_NE 2 /* mask and return true if not equal */
116 #define M_TR 3 /* don't read config, always true */
117 #define M_EN 4 /* mask and print "enabled" if true, "disabled" if false */
118 #define M_NN 5 /* opposite sense of M_EN */
120 static const struct condmsg conf82425ex[] =
122 { 0x00, 0x00, 0x00, M_TR, "\tClock " },
123 { 0x50, 0x06, 0x00, M_EQ, "25" },
124 { 0x50, 0x06, 0x02, M_EQ, "33" },
125 { 0x50, 0x04, 0x04, M_EQ, "??", },
126 { 0x00, 0x00, 0x00, M_TR, "MHz, L1 Cache " },
127 { 0x50, 0x01, 0x00, M_EQ, "Disabled\n" },
128 { 0x50, 0x09, 0x01, M_EQ, "Write-through\n" },
129 { 0x50, 0x09, 0x09, M_EQ, "Write-back\n" },
131 { 0x00, 0x00, 0x00, M_TR, "\tL2 Cache " },
132 { 0x52, 0x07, 0x00, M_EQ, "Disabled" },
133 { 0x52, 0x0f, 0x01, M_EQ, "64KB Write-through" },
134 { 0x52, 0x0f, 0x02, M_EQ, "128KB Write-through" },
135 { 0x52, 0x0f, 0x03, M_EQ, "256KB Write-through" },
136 { 0x52, 0x0f, 0x04, M_EQ, "512KB Write-through" },
137 { 0x52, 0x0f, 0x01, M_EQ, "64KB Write-back" },
138 { 0x52, 0x0f, 0x02, M_EQ, "128KB Write-back" },
139 { 0x52, 0x0f, 0x03, M_EQ, "256KB Write-back" },
140 { 0x52, 0x0f, 0x04, M_EQ, "512KB Write-back" },
141 { 0x53, 0x01, 0x00, M_EQ, ", 3-" },
142 { 0x53, 0x01, 0x01, M_EQ, ", 2-" },
143 { 0x53, 0x06, 0x00, M_EQ, "3-3-3" },
144 { 0x53, 0x06, 0x02, M_EQ, "2-2-2" },
145 { 0x53, 0x06, 0x04, M_EQ, "1-1-1" },
146 { 0x53, 0x06, 0x06, M_EQ, "?-?-?" },
147 { 0x53, 0x18, 0x00, M_EQ, "/4-2-2-2\n" },
148 { 0x53, 0x18, 0x08, M_EQ, "/3-2-2-2\n" },
149 { 0x53, 0x18, 0x10, M_EQ, "/?-?-?-?\n" },
150 { 0x53, 0x18, 0x18, M_EQ, "/2-1-1-1\n" },
152 { 0x56, 0x00, 0x00, M_TR, "\tDRAM: " },
153 { 0x56, 0x02, 0x02, M_EQ, "Fast Code Read, " },
154 { 0x56, 0x04, 0x04, M_EQ, "Fast Data Read, " },
155 { 0x56, 0x08, 0x08, M_EQ, "Fast Write, " },
156 { 0x57, 0x20, 0x20, M_EQ, "Pipelined CAS" },
157 { 0x57, 0x2e, 0x00, M_NE, "\n\t" },
158 { 0x57, 0x00, 0x00, M_TR, "Timing: RAS: " },
159 { 0x57, 0x07, 0x00, M_EQ, "4" },
160 { 0x57, 0x07, 0x01, M_EQ, "3" },
161 { 0x57, 0x07, 0x02, M_EQ, "2" },
162 { 0x57, 0x07, 0x04, M_EQ, "1.5" },
163 { 0x57, 0x07, 0x05, M_EQ, "1" },
164 { 0x57, 0x00, 0x00, M_TR, " Clocks, CAS Read: " },
165 { 0x57, 0x18, 0x00, M_EQ, "3/1", },
166 { 0x57, 0x18, 0x00, M_EQ, "2/1", },
167 { 0x57, 0x18, 0x00, M_EQ, "1.5/0.5", },
168 { 0x57, 0x18, 0x00, M_EQ, "1/1", },
169 { 0x57, 0x00, 0x00, M_TR, ", CAS Write: " },
170 { 0x57, 0x20, 0x00, M_EQ, "2/1", },
171 { 0x57, 0x20, 0x20, M_EQ, "1/1", },
172 { 0x57, 0x00, 0x00, M_TR, "\n" },
174 { 0x40, 0x01, 0x01, M_EQ, "\tCPU-to-PCI Byte Merging\n" },
175 { 0x40, 0x02, 0x02, M_EQ, "\tCPU-to-PCI Bursting\n" },
176 { 0x40, 0x04, 0x04, M_EQ, "\tPCI Posted Writes\n" },
177 { 0x40, 0x20, 0x00, M_EQ, "\tDRAM Parity Disabled\n" },
179 { 0x48, 0x03, 0x01, M_EQ, "\tPCI IDE controller: Primary (1F0h-1F7h,3F6h,3F7h)" },
180 { 0x48, 0x03, 0x02, M_EQ, "\tPCI IDE controller: Secondary (170h-177h,376h,377h)" },
181 { 0x4d, 0x01, 0x01, M_EQ, "\tRTC (70-77h)\n" },
182 { 0x4d, 0x02, 0x02, M_EQ, "\tKeyboard (60,62,64,66h)\n" },
183 { 0x4d, 0x08, 0x08, M_EQ, "\tIRQ12/M Mouse Function\n" },
189 static const struct condmsg conf82424zx[] =
191 { 0x00, 0x00, 0x00, M_TR, "\tCPU: " },
192 { 0x50, 0xe0, 0x00, M_EQ, "486DX" },
193 { 0x50, 0xe0, 0x20, M_EQ, "486SX" },
194 { 0x50, 0xe0, 0x40, M_EQ, "486DX2 or 486DX4" },
195 { 0x50, 0xe0, 0x80, M_EQ, "Overdrive (writeback)" },
197 { 0x00, 0x00, 0x00, M_TR, ", bus=" },
198 { 0x50, 0x03, 0x00, M_EQ, "25MHz" },
199 { 0x50, 0x03, 0x01, M_EQ, "33MHz" },
200 { 0x53, 0x01, 0x01, M_TR, ", CPU->Memory posting "},
201 { 0x53, 0x01, 0x00, M_EQ, "OFF" },
202 { 0x53, 0x01, 0x01, M_EQ, "ON" },
204 { 0x56, 0x30, 0x00, M_NE, "\n\tWarning:" },
205 { 0x56, 0x20, 0x00, M_NE, " NO cache parity!" },
206 { 0x56, 0x10, 0x00, M_NE, " NO DRAM parity!" },
207 { 0x55, 0x04, 0x04, M_EQ, "\n\tWarning: refresh OFF! " },
209 { 0x00, 0x00, 0x00, M_TR, "\n\tCache: " },
210 { 0x52, 0x01, 0x00, M_EQ, "None" },
211 { 0x52, 0xc1, 0x01, M_EQ, "64KB" },
212 { 0x52, 0xc1, 0x41, M_EQ, "128KB" },
213 { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
214 { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
215 { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
216 { 0x52, 0x03, 0x03, M_EQ, " writeback" },
218 { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
219 { 0x52, 0x05, 0x01, M_EQ, "3-1-1-1" },
220 { 0x52, 0x05, 0x05, M_EQ, "2-1-1-1" },
222 { 0x00, 0x00, 0x00, M_TR, "\n\tDRAM:" },
223 { 0x55, 0x43, 0x00, M_NE, " page mode" },
224 { 0x55, 0x02, 0x02, M_EQ, " code fetch" },
225 { 0x55, 0x43, 0x43, M_EQ, "," },
226 { 0x55, 0x43, 0x42, M_EQ, " and" },
227 { 0x55, 0x40, 0x40, M_EQ, " read" },
228 { 0x55, 0x03, 0x03, M_EQ, " and" },
229 { 0x55, 0x43, 0x41, M_EQ, " and" },
230 { 0x55, 0x01, 0x01, M_EQ, " write" },
231 { 0x55, 0x43, 0x00, M_NE, "," },
233 { 0x00, 0x00, 0x00, M_TR, " memory clocks=" },
234 { 0x55, 0x20, 0x00, M_EQ, "X-2-2-2" },
235 { 0x55, 0x20, 0x20, M_EQ, "X-1-2-1" },
237 { 0x00, 0x00, 0x00, M_TR, "\n\tCPU->PCI: posting " },
238 { 0x53, 0x02, 0x00, M_NE, "ON" },
239 { 0x53, 0x02, 0x00, M_EQ, "OFF" },
240 { 0x00, 0x00, 0x00, M_TR, ", burst mode " },
241 { 0x54, 0x02, 0x00, M_NE, "ON" },
242 { 0x54, 0x02, 0x00, M_EQ, "OFF" },
243 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI->Memory: posting " },
244 { 0x54, 0x01, 0x00, M_NE, "ON" },
245 { 0x54, 0x01, 0x00, M_EQ, "OFF" },
247 { 0x00, 0x00, 0x00, M_TR, "\n" },
253 static const struct condmsg conf82434lx[] =
255 { 0x00, 0x00, 0x00, M_TR, "\tCPU: " },
256 { 0x50, 0xe3, 0x82, M_EQ, "Pentium, 60MHz" },
257 { 0x50, 0xe3, 0x83, M_EQ, "Pentium, 66MHz" },
258 { 0x50, 0xe3, 0xa2, M_EQ, "Pentium, 90MHz" },
259 { 0x50, 0xe3, 0xa3, M_EQ, "Pentium, 100MHz" },
260 { 0x50, 0xc2, 0x82, M_NE, "(unknown)" },
261 { 0x50, 0x04, 0x00, M_EQ, " (primary cache OFF)" },
263 { 0x53, 0x01, 0x01, M_TR, ", CPU->Memory posting "},
264 { 0x53, 0x01, 0x01, M_NE, "OFF" },
265 { 0x53, 0x01, 0x01, M_EQ, "ON" },
267 { 0x53, 0x08, 0x00, M_NE, ", read around write"},
269 { 0x70, 0x04, 0x00, M_EQ, "\n\tWarning: Cache parity disabled!" },
270 { 0x57, 0x20, 0x00, M_NE, "\n\tWarning: DRAM parity mask!" },
271 { 0x57, 0x01, 0x00, M_EQ, "\n\tWarning: refresh OFF! " },
273 { 0x00, 0x00, 0x00, M_TR, "\n\tCache: " },
274 { 0x52, 0x01, 0x00, M_EQ, "None" },
275 { 0x52, 0x81, 0x01, M_EQ, "" },
276 { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
277 { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
278 { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
279 { 0x52, 0x03, 0x03, M_EQ, " writeback" },
281 { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
282 { 0x52, 0x21, 0x01, M_EQ, "3-2-2-2/4-2-2-2" },
283 { 0x52, 0x21, 0x21, M_EQ, "3-1-1-1" },
285 { 0x52, 0x01, 0x01, M_EQ, "\n\tCache flags: " },
286 { 0x52, 0x11, 0x11, M_EQ, " cache-all" },
287 { 0x52, 0x09, 0x09, M_EQ, " byte-control" },
288 { 0x52, 0x05, 0x05, M_EQ, " powersaver" },
290 { 0x00, 0x00, 0x00, M_TR, "\n\tDRAM:" },
291 { 0x57, 0x10, 0x00, M_EQ, " page mode" },
293 { 0x00, 0x00, 0x00, M_TR, " memory clocks=" },
294 { 0x57, 0xc0, 0x00, M_EQ, "X-4-4-4 (70ns)" },
295 { 0x57, 0xc0, 0x40, M_EQ, "X-4-4-4/X-3-3-3 (60ns)" },
296 { 0x57, 0xc0, 0x80, M_EQ, "???" },
297 { 0x57, 0xc0, 0xc0, M_EQ, "X-3-3-3 (50ns)" },
298 { 0x58, 0x02, 0x02, M_EQ, ", RAS-wait" },
299 { 0x58, 0x01, 0x01, M_EQ, ", CAS-wait" },
301 { 0x00, 0x00, 0x00, M_TR, "\n\tCPU->PCI: posting " },
302 { 0x53, 0x02, 0x02, M_EQ, "ON" },
303 { 0x53, 0x02, 0x00, M_EQ, "OFF" },
304 { 0x00, 0x00, 0x00, M_TR, ", burst mode " },
305 { 0x54, 0x02, 0x00, M_NE, "ON" },
306 { 0x54, 0x02, 0x00, M_EQ, "OFF" },
307 { 0x54, 0x04, 0x00, M_TR, ", PCI clocks=" },
308 { 0x54, 0x04, 0x00, M_EQ, "2-2-2-2" },
309 { 0x54, 0x04, 0x00, M_NE, "2-1-1-1" },
310 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI->Memory: posting " },
311 { 0x54, 0x01, 0x00, M_NE, "ON" },
312 { 0x54, 0x01, 0x00, M_EQ, "OFF" },
314 { 0x57, 0x01, 0x01, M_EQ, "\n\tRefresh:" },
315 { 0x57, 0x03, 0x03, M_EQ, " CAS#/RAS#(Hidden)" },
316 { 0x57, 0x03, 0x01, M_EQ, " RAS#Only" },
317 { 0x57, 0x05, 0x05, M_EQ, " BurstOf4" },
319 { 0x00, 0x00, 0x00, M_TR, "\n" },
325 static const struct condmsg conf82378[] =
327 { 0x00, 0x00, 0x00, M_TR, "\tBus Modes:" },
328 { 0x41, 0x04, 0x04, M_EQ, " Bus Park," },
329 { 0x41, 0x02, 0x02, M_EQ, " Bus Lock," },
330 { 0x41, 0x02, 0x00, M_EQ, " Resource Lock," },
331 { 0x41, 0x01, 0x01, M_EQ, " GAT" },
332 { 0x4d, 0x20, 0x20, M_EQ, "\n\tCoprocessor errors enabled" },
333 { 0x4d, 0x10, 0x10, M_EQ, "\n\tMouse function enabled" },
335 { 0x4e, 0x30, 0x10, M_EQ, "\n\tIDE controller: Primary (1F0h-1F7h,3F6h,3F7h)" },
336 { 0x4e, 0x30, 0x30, M_EQ, "\n\tIDE controller: Secondary (170h-177h,376h,377h)" },
337 { 0x4e, 0x28, 0x08, M_EQ, "\n\tFloppy controller: 3F0h,3F1h " },
338 { 0x4e, 0x24, 0x04, M_EQ, "\n\tFloppy controller: 3F2h-3F7h " },
339 { 0x4e, 0x28, 0x28, M_EQ, "\n\tFloppy controller: 370h,371h " },
340 { 0x4e, 0x24, 0x24, M_EQ, "\n\tFloppy controller: 372h-377h " },
341 { 0x4e, 0x02, 0x02, M_EQ, "\n\tKeyboard controller: 60h,62h,64h,66h" },
342 { 0x4e, 0x01, 0x01, M_EQ, "\n\tRTC: 70h-77h" },
344 { 0x4f, 0x80, 0x80, M_EQ, "\n\tConfiguration RAM: 0C00h,0800h-08FFh" },
345 { 0x4f, 0x40, 0x40, M_EQ, "\n\tPort 92: enabled" },
346 { 0x4f, 0x03, 0x00, M_EQ, "\n\tSerial Port A: COM1 (3F8h-3FFh)" },
347 { 0x4f, 0x03, 0x01, M_EQ, "\n\tSerial Port A: COM2 (2F8h-2FFh)" },
348 { 0x4f, 0x0c, 0x00, M_EQ, "\n\tSerial Port B: COM1 (3F8h-3FFh)" },
349 { 0x4f, 0x0c, 0x04, M_EQ, "\n\tSerial Port B: COM2 (2F8h-2FFh)" },
350 { 0x4f, 0x30, 0x00, M_EQ, "\n\tParallel Port: LPT1 (3BCh-3BFh)" },
351 { 0x4f, 0x30, 0x04, M_EQ, "\n\tParallel Port: LPT2 (378h-37Fh)" },
352 { 0x4f, 0x30, 0x20, M_EQ, "\n\tParallel Port: LPT3 (278h-27Fh)" },
353 { 0x00, 0x00, 0x00, M_TR, "\n" },
359 static const struct condmsg conf82437fx[] =
361 /* PCON -- PCI Control Register */
362 { 0x00, 0x00, 0x00, M_TR, "\tCPU Inactivity timer: " },
363 { 0x50, 0xe0, 0xe0, M_EQ, "8" },
364 { 0x50, 0xe0, 0xd0, M_EQ, "7" },
365 { 0x50, 0xe0, 0xc0, M_EQ, "6" },
366 { 0x50, 0xe0, 0xb0, M_EQ, "5" },
367 { 0x50, 0xe0, 0xa0, M_EQ, "4" },
368 { 0x50, 0xe0, 0x90, M_EQ, "3" },
369 { 0x50, 0xe0, 0x80, M_EQ, "2" },
370 { 0x50, 0xe0, 0x00, M_EQ, "1" },
371 { 0x00, 0x00, 0x00, M_TR, " clocks\n\tPeer Concurrency: " },
372 { 0x50, 0x08, 0x08, M_EN, 0 },
373 { 0x00, 0x00, 0x00, M_TR, "\n\tCPU-to-PCI Write Bursting: " },
374 { 0x50, 0x04, 0x00, M_NN, 0 },
375 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI Streaming: " },
376 { 0x50, 0x02, 0x00, M_NN, 0 },
377 { 0x00, 0x00, 0x00, M_TR, "\n\tBus Concurrency: " },
378 { 0x50, 0x01, 0x00, M_NN, 0 },
380 /* CC -- Cache Control Regsiter */
381 { 0x00, 0x00, 0x00, M_TR, "\n\tCache:" },
382 { 0x52, 0xc0, 0x80, M_EQ, " 512K" },
383 { 0x52, 0xc0, 0x40, M_EQ, " 256K" },
384 { 0x52, 0xc0, 0x00, M_EQ, " NO" },
385 { 0x52, 0x30, 0x00, M_EQ, " pipelined-burst" },
386 { 0x52, 0x30, 0x10, M_EQ, " burst" },
387 { 0x52, 0x30, 0x20, M_EQ, " asynchronous" },
388 { 0x52, 0x30, 0x30, M_EQ, " dual-bank pipelined-burst" },
389 { 0x00, 0x00, 0x00, M_TR, " secondary; L1 " },
390 { 0x52, 0x01, 0x00, M_EN, 0 },
391 { 0x00, 0x00, 0x00, M_TR, "\n" },
393 /* DRAMC -- DRAM Control Register */
394 { 0x57, 0x07, 0x00, M_EQ, "Warning: refresh OFF!\n" },
395 { 0x00, 0x00, 0x00, M_TR, "\tDRAM:" },
396 { 0x57, 0xc0, 0x00, M_EQ, " no memory hole" },
397 { 0x57, 0xc0, 0x40, M_EQ, " 512K-640K memory hole" },
398 { 0x57, 0xc0, 0x80, M_EQ, " 15M-16M memory hole" },
399 { 0x57, 0x07, 0x01, M_EQ, ", 50 MHz refresh" },
400 { 0x57, 0x07, 0x02, M_EQ, ", 60 MHz refresh" },
401 { 0x57, 0x07, 0x03, M_EQ, ", 66 MHz refresh" },
403 /* DRAMT = DRAM Timing Register */
404 { 0x00, 0x00, 0x00, M_TR, "\n\tRead burst timing: " },
405 { 0x58, 0x60, 0x00, M_EQ, "x-4-4-4/x-4-4-4" },
406 { 0x58, 0x60, 0x20, M_EQ, "x-3-3-3/x-4-4-4" },
407 { 0x58, 0x60, 0x40, M_EQ, "x-2-2-2/x-3-3-3" },
408 { 0x58, 0x60, 0x60, M_EQ, "???" },
409 { 0x00, 0x00, 0x00, M_TR, "\n\tWrite burst timing: " },
410 { 0x58, 0x18, 0x00, M_EQ, "x-4-4-4" },
411 { 0x58, 0x18, 0x08, M_EQ, "x-3-3-3" },
412 { 0x58, 0x18, 0x10, M_EQ, "x-2-2-2" },
413 { 0x58, 0x18, 0x18, M_EQ, "???" },
414 { 0x00, 0x00, 0x00, M_TR, "\n\tRAS-CAS delay: " },
415 { 0x58, 0x04, 0x00, M_EQ, "3" },
416 { 0x58, 0x04, 0x04, M_EQ, "2" },
417 { 0x00, 0x00, 0x00, M_TR, " clocks\n" },
423 static const struct condmsg conf82437vx[] =
425 /* PCON -- PCI Control Register */
426 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI Concurrency: " },
427 { 0x50, 0x08, 0x08, M_EN, 0 },
429 /* CC -- Cache Control Regsiter */
430 { 0x00, 0x00, 0x00, M_TR, "\n\tCache:" },
431 { 0x52, 0xc0, 0x80, M_EQ, " 512K" },
432 { 0x52, 0xc0, 0x40, M_EQ, " 256K" },
433 { 0x52, 0xc0, 0x00, M_EQ, " NO" },
434 { 0x52, 0x30, 0x00, M_EQ, " pipelined-burst" },
435 { 0x52, 0x30, 0x10, M_EQ, " burst" },
436 { 0x52, 0x30, 0x20, M_EQ, " asynchronous" },
437 { 0x52, 0x30, 0x30, M_EQ, " dual-bank pipelined-burst" },
438 { 0x00, 0x00, 0x00, M_TR, " secondary; L1 " },
439 { 0x52, 0x01, 0x00, M_EN, 0 },
440 { 0x00, 0x00, 0x00, M_TR, "\n" },
442 /* DRAMC -- DRAM Control Register */
443 { 0x57, 0x07, 0x00, M_EQ, "Warning: refresh OFF!\n" },
444 { 0x00, 0x00, 0x00, M_TR, "\tDRAM:" },
445 { 0x57, 0xc0, 0x00, M_EQ, " no memory hole" },
446 { 0x57, 0xc0, 0x40, M_EQ, " 512K-640K memory hole" },
447 { 0x57, 0xc0, 0x80, M_EQ, " 15M-16M memory hole" },
448 { 0x57, 0x07, 0x01, M_EQ, ", 50 MHz refresh" },
449 { 0x57, 0x07, 0x02, M_EQ, ", 60 MHz refresh" },
450 { 0x57, 0x07, 0x03, M_EQ, ", 66 MHz refresh" },
452 /* DRAMT = DRAM Timing Register */
453 { 0x00, 0x00, 0x00, M_TR, "\n\tRead burst timing: " },
454 { 0x58, 0x60, 0x00, M_EQ, "x-4-4-4/x-4-4-4" },
455 { 0x58, 0x60, 0x20, M_EQ, "x-3-3-3/x-4-4-4" },
456 { 0x58, 0x60, 0x40, M_EQ, "x-2-2-2/x-3-3-3" },
457 { 0x58, 0x60, 0x60, M_EQ, "???" },
458 { 0x00, 0x00, 0x00, M_TR, "\n\tWrite burst timing: " },
459 { 0x58, 0x18, 0x00, M_EQ, "x-4-4-4" },
460 { 0x58, 0x18, 0x08, M_EQ, "x-3-3-3" },
461 { 0x58, 0x18, 0x10, M_EQ, "x-2-2-2" },
462 { 0x58, 0x18, 0x18, M_EQ, "???" },
463 { 0x00, 0x00, 0x00, M_TR, "\n\tRAS-CAS delay: " },
464 { 0x58, 0x04, 0x00, M_EQ, "3" },
465 { 0x58, 0x04, 0x04, M_EQ, "2" },
466 { 0x00, 0x00, 0x00, M_TR, " clocks\n" },
472 static const struct condmsg conf82371fb[] =
474 /* IORT -- ISA I/O Recovery Timer Register */
475 { 0x00, 0x00, 0x00, M_TR, "\tI/O Recovery Timing: 8-bit " },
476 { 0x4c, 0x40, 0x00, M_EQ, "3.5" },
477 { 0x4c, 0x78, 0x48, M_EQ, "1" },
478 { 0x4c, 0x78, 0x50, M_EQ, "2" },
479 { 0x4c, 0x78, 0x58, M_EQ, "3" },
480 { 0x4c, 0x78, 0x60, M_EQ, "4" },
481 { 0x4c, 0x78, 0x68, M_EQ, "5" },
482 { 0x4c, 0x78, 0x70, M_EQ, "6" },
483 { 0x4c, 0x78, 0x78, M_EQ, "7" },
484 { 0x4c, 0x78, 0x40, M_EQ, "8" },
485 { 0x00, 0x00, 0x00, M_TR, " clocks, 16-bit " },
486 { 0x4c, 0x04, 0x00, M_EQ, "3.5" },
487 { 0x4c, 0x07, 0x05, M_EQ, "1" },
488 { 0x4c, 0x07, 0x06, M_EQ, "2" },
489 { 0x4c, 0x07, 0x07, M_EQ, "3" },
490 { 0x4c, 0x07, 0x04, M_EQ, "4" },
491 { 0x00, 0x00, 0x00, M_TR, " clocks\n" },
493 /* XBCS -- X-Bus Chip Select Register */
494 { 0x00, 0x00, 0x00, M_TR, "\tExtended BIOS: " },
495 { 0x4e, 0x80, 0x80, M_EN, 0 },
496 { 0x00, 0x00, 0x00, M_TR, "\n\tLower BIOS: " },
497 { 0x4e, 0x40, 0x40, M_EN, 0 },
498 { 0x00, 0x00, 0x00, M_TR, "\n\tCoprocessor IRQ13: " },
499 { 0x4e, 0x20, 0x20, M_EN, 0 },
500 { 0x00, 0x00, 0x00, M_TR, "\n\tMouse IRQ12: " },
501 { 0x4e, 0x10, 0x10, M_EN, 0 },
502 { 0x00, 0x00, 0x00, M_TR, "\n" },
504 { 0x00, 0x00, 0x00, M_TR, "\tInterrupt Routing: " },
506 { 0x00, 0x00, 0x00, M_TR, n ": " }, \
507 { x, 0x80, 0x80, M_EQ, "disabled" }, \
508 { x, 0xc0, 0x40, M_EQ, "[shared] " }, \
509 { x, 0x8f, 0x03, M_EQ, "IRQ3" }, \
510 { x, 0x8f, 0x04, M_EQ, "IRQ4" }, \
511 { x, 0x8f, 0x05, M_EQ, "IRQ5" }, \
512 { x, 0x8f, 0x06, M_EQ, "IRQ6" }, \
513 { x, 0x8f, 0x07, M_EQ, "IRQ7" }, \
514 { x, 0x8f, 0x09, M_EQ, "IRQ9" }, \
515 { x, 0x8f, 0x0a, M_EQ, "IRQ10" }, \
516 { x, 0x8f, 0x0b, M_EQ, "IRQ11" }, \
517 { x, 0x8f, 0x0c, M_EQ, "IRQ12" }, \
518 { x, 0x8f, 0x0e, M_EQ, "IRQ14" }, \
519 { x, 0x8f, 0x0f, M_EQ, "IRQ15" }
521 /* Interrupt routing */
526 PIRQ(0x70, "\n\t\tMB0"),
529 { 0x00, 0x00, 0x00, M_TR, "\n" },
533 /* XXX - do DMA routing, too? */
537 static const struct condmsg conf82371fb2[] =
539 /* IDETM -- IDE Timing Register */
540 { 0x00, 0x00, 0x00, M_TR, "\tPrimary IDE: " },
541 { 0x41, 0x80, 0x80, M_EN, 0 },
542 { 0x00, 0x00, 0x00, M_TR, "\n\tSecondary IDE: " },
543 { 0x43, 0x80, 0x80, M_EN, 0 },
544 { 0x00, 0x00, 0x00, M_TR, "\n" },
551 writeconfig (device_t dev, const struct condmsg *tbl)
553 while (tbl->flags != M_XX) {
554 const char *text = 0;
556 if (tbl->flags == M_TR) {
559 unsigned char v = pci_read_config(dev, tbl->port, 1);
560 switch (tbl->flags) {
562 if ((v & tbl->mask) == tbl->value) text = tbl->text;
565 if ((v & tbl->mask) != tbl->value) text = tbl->text;
568 text = (v & tbl->mask) ? "enabled" : "disabled";
571 text = (v & tbl->mask) ? "disabled" : "enabled";
574 if (text) printf ("%s", text);
579 #ifdef DUMPCONFIGSPACE
581 dumpconfigspace (device_t dev)
584 printf ("configuration space registers:");
585 for (reg = 0; reg < 0x100; reg+=4) {
586 if ((reg & 0x0f) == 0)
587 printf ("\n%02x:\t", reg);
588 printf ("%08x ", pci_read_config(dev, reg, 4));
592 #endif /* DUMPCONFIGSPACE */
594 #endif /* PCI_QUIET */
598 chipset_attach (device_t dev, int unit)
604 switch (pci_get_devid(dev)) {
606 writeconfig (dev, conf82425ex);
609 writeconfig (dev, conf82424zx);
612 writeconfig (dev, conf82434lx);
615 writeconfig (dev, conf82378);
618 writeconfig (dev, conf82437fx);
621 writeconfig (dev, conf82437vx);
625 writeconfig (dev, conf82371fb);
629 writeconfig (dev, conf82371fb2);
632 case 0x00011011: /* DEC 21050 */
633 case 0x00221014: /* IBM xxx */
634 writeconfig (dev, conf_pci2pci);
638 #endif /* PCI_QUIET */
642 pci_bridge_type(device_t dev)
644 char *descr, tmpbuf[120];
646 if (pci_get_class(dev) != PCIC_BRIDGE)
649 switch (pci_get_subclass(dev)) {
650 case PCIS_BRIDGE_HOST: strcpy(tmpbuf, "Host to PCI"); break;
651 case PCIS_BRIDGE_ISA: strcpy(tmpbuf, "PCI to ISA"); break;
652 case PCIS_BRIDGE_EISA: strcpy(tmpbuf, "PCI to EISA"); break;
653 case PCIS_BRIDGE_MCA: strcpy(tmpbuf, "PCI to MCA"); break;
654 case PCIS_BRIDGE_PCI: strcpy(tmpbuf, "PCI to PCI"); break;
655 case PCIS_BRIDGE_PCMCIA: strcpy(tmpbuf, "PCI to PCMCIA"); break;
656 case PCIS_BRIDGE_NUBUS: strcpy(tmpbuf, "PCI to NUBUS"); break;
657 case PCIS_BRIDGE_CARDBUS: strcpy(tmpbuf, "PCI to CardBus"); break;
658 case PCIS_BRIDGE_OTHER: strcpy(tmpbuf, "PCI to Other"); break;
660 snprintf(tmpbuf, sizeof(tmpbuf),
661 "PCI to 0x%x", pci_get_subclass(dev));
664 snprintf(tmpbuf+strlen(tmpbuf), sizeof(tmpbuf)-strlen(tmpbuf),
665 " bridge (vendor=%04x device=%04x)",
666 pci_get_vendor(dev), pci_get_device(dev));
667 descr = malloc (strlen(tmpbuf) +1, M_DEVBUF, M_WAITOK);
668 strcpy(descr, tmpbuf);
673 pcib_match(device_t dev)
675 switch (pci_get_devid(dev)) {
676 /* Intel -- vendor 0x8086 */
678 return ("Intel 82443LX (440 LX) PCI-PCI (AGP) bridge");
680 return ("Intel 82443BX (440 BX) PCI-PCI (AGP) bridge");
682 return ("Intel 82443GX (440 GX) PCI-PCI (AGP) bridge");
684 return ("Intel 82454NX PCI Expander Bridge");
686 return ("Intel 82801BA/BAM (ICH2) PCI-PCI (AGP) bridge");
688 return ("Intel 82380FB mobile PCI to PCI bridge");
690 return ("Intel 82801AA (ICH) Hub to PCI bridge");
692 return ("Intel 82801AB (ICH0) Hub to PCI bridge");
694 return ("Intel 82801BA/BAM (ICH2) Hub to PCI bridge");
696 return ("Intel 82845 PCI-PCI (AGP) bridge");
698 /* VLSI -- vendor 0x1004 */
700 return ("VLSI 82C534 Eagle II PCI Bus bridge");
702 return ("VLSI 82C538 Eagle II PCI Docking bridge");
704 /* VIA Technologies -- vendor 0x1106 */
706 return ("VIA 8363 (Apollo KT133) PCI-PCI (AGP) bridge");
708 return ("VIA 82C598MVP (Apollo MVP3) PCI-PCI (AGP) bridge");
709 /* Exclude the ACPI function of VT82Cxxx series */
715 /* AcerLabs -- vendor 0x10b9 */
716 /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */
717 /* id is '10b9" but the register always shows "10b9". -Foxfair */
719 return ("AcerLabs M5247 PCI-PCI(AGP Supported) bridge");
720 case 0x524310b9:/* 5243 seems like 5247, need more info to divide*/
721 return ("AcerLabs M5243 PCI-PCI bridge");
723 /* AMD -- vendor 0x1022 */
725 return ("AMD-751 PCI-PCI (1x/2x AGP) bridge");
727 return ("AMD-761 PCI-PCI (4x AGP) bridge");
729 /* DEC -- vendor 0x1011 */
731 return ("DEC 21050 PCI-PCI bridge");
733 return ("DEC 21052 PCI-PCI bridge");
735 return ("DEC 21150 PCI-PCI bridge");
737 return ("DEC 21152 PCI-PCI bridge");
739 return ("DEC 21153 PCI-PCI bridge");
741 return ("DEC 21154 PCI-PCI bridge");
745 return ("IBM 82351 PCI-PCI bridge");
746 /* UMC United Microelectronics 0x1060 */
748 return ("UMC UM8881 HB4 486 PCI Chipset");
751 if (pci_get_class(dev) == PCIC_BRIDGE
752 && pci_get_subclass(dev) == PCIS_BRIDGE_PCI)
753 return pci_bridge_type(dev);
758 static int pcib_probe(device_t dev)
762 desc = pcib_match(dev);
764 device_set_desc_copy(dev, desc);
771 static int pcib_attach(device_t dev)
775 chipset_attach(dev, device_get_unit(dev));
777 secondary = pci_get_secondarybus(dev);
779 device_add_child(dev, "pci", secondary);
780 return bus_generic_attach(dev);
786 pcib_read_ivar(device_t dev, device_t child, int which, u_long *result)
788 if (which == PCIB_IVAR_HOSE) {
790 * Pass up to parent bus.
792 *result = pci_get_hose(dev);
799 * Route an interrupt across a PCI bridge.
802 pcib_route_interrupt(device_t pcib, device_t dev, int pin)
808 device_printf(pcib, "Hi!\n");
812 * The PCI standard defines a swizzle of the child-side device/intpin
813 * to the parent-side intpin as follows.
815 * device = device on child bus
816 * child_intpin = intpin on child bus slot (0-3)
817 * parent_intpin = intpin on parent bus slot (0-3)
819 * parent_intpin = (device + child_intpin) % 4
821 parent_intpin = (pci_get_slot(pcib) + (pin - 1)) % 4;
824 * Our parent is a PCI bus. Its parent must export the pci interface
825 * which includes the ability to route interrupts.
827 bus = device_get_parent(pcib);
828 intnum = PCI_ROUTE_INTERRUPT(device_get_parent(bus), pcib,
830 device_printf(pcib, "routed slot %d INT%c to irq %d\n",
831 pci_get_slot(dev), 'A' + pin - 1, intnum);
835 static device_method_t pcib_methods[] = {
836 /* Device interface */
837 DEVMETHOD(device_probe, pcib_probe),
838 DEVMETHOD(device_attach, pcib_attach),
839 DEVMETHOD(device_shutdown, bus_generic_shutdown),
840 DEVMETHOD(device_suspend, bus_generic_suspend),
841 DEVMETHOD(device_resume, bus_generic_resume),
844 DEVMETHOD(bus_print_child, bus_generic_print_child),
845 DEVMETHOD(bus_read_ivar, pcib_read_ivar),
846 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
847 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
848 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
849 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
850 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
851 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
854 DEVMETHOD(pci_route_interrupt, pcib_route_interrupt),
858 static driver_t pcib_driver = {
864 static devclass_t pcib_devclass;
866 DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, 0, 0);
869 eisab_match(device_t dev)
871 switch (pci_get_devid(dev)) {
873 /* Recognize this specifically, it has PCI-HOST class (!) */
874 return ("Intel 82375EB PCI-EISA bridge");
876 if (pci_get_class(dev) == PCIC_BRIDGE
877 && pci_get_subclass(dev) == PCIS_BRIDGE_EISA)
878 return pci_bridge_type(dev);
884 isab_match(device_t dev)
888 switch (pci_get_devid(dev)) {
890 rev = pci_get_revid(dev);
892 return ("Intel 82378ZB PCI to ISA bridge");
893 return ("Intel 82378IB PCI to ISA bridge");
895 return ("Intel 82371FB PCI to ISA bridge");
897 return ("Intel 82371SB PCI to ISA bridge");
899 return ("Intel 82371AB PCI to ISA bridge");
901 return ("Intel 82443MX PCI to ISA bridge");
903 return ("Intel 82801AA (ICH) PCI to LPC bridge");
905 return ("Intel 82801AB (ICH0) PCI to LPC bridge");
907 return ("Intel 82801BA/BAM (ICH2) PCI to LPC bridge");
909 /* VLSI -- vendor 0x1004 */
911 return ("VLSI 82C593 PCI to ISA bridge");
913 /* VIA Technologies -- vendor 0x1106 */
914 case 0x05861106: /* south bridge section */
915 return ("VIA 82C586 PCI-ISA bridge");
917 return ("VIA 82C596B PCI-ISA bridge");
919 return ("VIA 82C686 PCI-ISA bridge");
921 /* AcerLabs -- vendor 0x10b9 */
922 /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */
923 /* id is '10b9" but the register always shows "10b9". -Foxfair */
925 return ("AcerLabs M1533 portable PCI-ISA bridge");
927 return ("AcerLabs M1543 desktop PCI-ISA bridge");
929 /* SiS -- vendor 0x1039 */
931 return ("SiS 85c503 PCI-ISA bridge");
933 /* Cyrix -- vendor 0x1078 */
935 return ("Cyrix Cx5510 PCI-ISA bridge");
937 return ("Cyrix Cx5530 PCI-ISA bridge");
939 /* NEC -- vendor 0x1033 */
940 /* The "C-bus" is 16-bits bus on PC98. */
942 return ("NEC 0001 PCI to PC-98 C-bus bridge");
944 return ("NEC 002C PCI to PC-98 C-bus bridge");
946 return ("NEC 003B PCI to PC-98 C-bus bridge");
947 /* UMC United Microelectronics 0x1060 */
949 return ("UMC UM8886 ISA Bridge with EIDE");
951 /* Cypress -- vendor 0x1080 */
953 if (pci_get_class(dev) == PCIC_BRIDGE
954 && pci_get_subclass(dev) == PCIS_BRIDGE_ISA)
955 return ("Cypress 82C693 PCI-ISA bridge");
958 /* ServerWorks -- vendor 0x1166 */
960 return ("ServerWorks IB6566 PCI to ISA bridge");
963 if (pci_get_class(dev) == PCIC_BRIDGE
964 && pci_get_subclass(dev) == PCIS_BRIDGE_ISA)
965 return pci_bridge_type(dev);
971 isab_probe(device_t dev)
977 desc = eisab_match(dev);
981 desc = isab_match(dev);
984 * For a PCI-EISA bridge, add both eisa and isa.
985 * Only add one instance of eisa or isa for now.
987 device_set_desc_copy(dev, desc);
988 if (is_eisa && !devclass_get_device(devclass_find("eisa"), 0))
989 device_add_child(dev, "eisa", -1);
991 if (!devclass_get_device(devclass_find("isa"), 0))
992 device_add_child(dev, "isa", -1);
999 isab_attach(device_t dev)
1001 chipset_attach(dev, device_get_unit(dev));
1002 return bus_generic_attach(dev);
1005 static device_method_t isab_methods[] = {
1006 /* Device interface */
1007 DEVMETHOD(device_probe, isab_probe),
1008 DEVMETHOD(device_attach, isab_attach),
1009 DEVMETHOD(device_shutdown, bus_generic_shutdown),
1010 DEVMETHOD(device_suspend, bus_generic_suspend),
1011 DEVMETHOD(device_resume, bus_generic_resume),
1014 DEVMETHOD(bus_print_child, bus_generic_print_child),
1015 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
1016 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
1017 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
1018 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
1019 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
1020 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
1025 static driver_t isab_driver = {
1031 static devclass_t isab_devclass;
1033 DRIVER_MODULE(isab, pci, isab_driver, isab_devclass, 0, 0);
1036 pci_usb_match(device_t dev)
1038 switch (pci_get_devid(dev)) {
1040 /* Intel -- vendor 0x8086 */
1042 return ("Intel 82371SB (PIIX3) USB controller");
1044 return ("Intel 82371AB/EB (PIIX4) USB controller");
1046 return ("Intel 82801AA (ICH) USB controller");
1048 return ("Intel 82801AB (ICH0) USB controller");
1050 return ("Intel 82801BA/BAM (ICH2) USB controller USB-A");
1052 return ("Intel 82801BA/BAM (ICH2) USB controller USB-B");
1054 /* VIA Technologies -- vendor 0x1106 (0x1107 on the Apollo Master) */
1056 return ("VIA 83C572 USB controller");
1058 /* AcerLabs -- vendor 0x10b9 */
1060 return ("AcerLabs M5237 (Aladdin-V) USB controller");
1062 /* OPTi -- vendor 0x1045 */
1064 return ("OPTi 82C861 (FireLink) USB controller");
1066 /* NEC -- vendor 0x1033 */
1068 return ("NEC uPD 9210 USB controller");
1070 /* CMD Tech -- vendor 0x1095 */
1072 return ("CMD Tech 670 (USB0670) USB controller");
1074 return ("CMD Tech 673 (USB0673) USB controller");
1077 if (pci_get_class(dev) == PCIC_SERIALBUS
1078 && pci_get_subclass(dev) == PCIS_SERIALBUS_USB) {
1079 if (pci_get_progif(dev) == 0x00 /* UHCI */ ) {
1080 return ("UHCI USB controller");
1081 } else if (pci_get_progif(dev) == 0x10 /* OHCI */ ) {
1082 return ("OHCI USB controller");
1084 return ("USB controller");
1091 pci_ata_match(device_t dev)
1094 switch (pci_get_devid(dev)) {
1096 /* Intel -- vendor 0x8086 */
1098 return ("Intel PIIX ATA controller");
1100 return ("Intel PIIX3 ATA controller");
1102 return ("Intel PIIX4 ATA controller");
1104 return ("Intel 82371MX mobile PCI ATA accelerator (MPIIX)");
1106 /* Promise -- vendor 0x105a */
1108 return ("Promise Ultra/33 ATA controller");
1110 return ("Promise Ultra/66 ATA controller");
1112 /* AcerLabs -- vendor 0x10b9 */
1114 return ("AcerLabs Aladdin ATA controller");
1116 /* VIA Technologies -- vendor 0x1106 (0x1107 on the Apollo Master) */
1118 switch (pci_read_config(dev, 0x08, 1)) {
1120 return ("VIA 85C586 ATA controller");
1122 return ("VIA 85C586 ATA controller");
1126 return ("VIA Apollo ATA controller");
1128 /* CMD Tech -- vendor 0x1095 */
1130 return ("CMD 640 ATA controller");
1132 return ("CMD 646 ATA controller");
1134 /* Cypress -- vendor 0x1080 */
1136 return ("Cypress 82C693 ATA controller");
1138 /* Cyrix -- vendor 0x1078 */
1140 return ("Cyrix 5530 ATA controller");
1142 /* SiS -- vendor 0x1039 */
1144 return ("SiS 5591 ATA controller");
1146 /* Highpoint tech -- vendor 0x1103 */
1148 return ("HighPoint HPT366 ATA controller");
1151 if (pci_get_class(dev) == PCIC_STORAGE &&
1152 pci_get_subclass(dev) == PCIS_STORAGE_IDE)
1153 return ("Unknown PCI ATA controller");
1160 chip_match(device_t dev)
1164 switch (pci_get_devid(dev)) {
1165 /* Intel -- vendor 0x8086 */
1167 /* Silently ignore this one! What is it, anyway ??? */
1171 * On my laptop (Tecra 8000DVD), this device has a
1172 * bogus subclass 0x80 so make sure that it doesn't
1173 * match the generic 'chip' driver by accident.
1177 fixbushigh_i1225(dev);
1178 return ("Intel 824?? host to PCI bridge");
1180 return ("Intel 82443LX (440 LX) host to PCI bridge");
1182 return ("Intel 82443BX (440 BX) host to PCI bridge");
1184 return ("Intel 82443BX host to PCI bridge (AGP disabled)");
1186 return ("Intel 82443GX host to PCI bridge");
1188 return ("Intel 82443GX host to AGP bridge");
1190 return ("Intel 82443GX host to PCI bridge (AGP disabled)");
1192 return ("Intel 82454KX/GX (Orion) host to PCI bridge");
1194 return ("Intel 82451NX Memory and I/O controller");
1196 return ("Intel 82425EX PCI system controller");
1198 return ("Intel 82424ZX (Saturn) cache DRAM controller");
1200 rev = pci_get_revid(dev);
1201 if (rev == 16 || rev == 17)
1202 return ("Intel 82434NX (Neptune) PCI cache memory controller");
1203 return ("Intel 82434LX (Mercury) PCI cache memory controller");
1205 return ("Intel 82437FX PCI cache memory controller");
1207 return ("Intel 82437MX mobile PCI cache memory controller");
1209 return ("Intel 82439HX PCI cache memory controller");
1211 return ("Intel 82437VX PCI cache memory controller");
1213 return ("Intel 82439TX System controller (MTXC)");
1215 return ("Intel 82371AB Power management controller");
1217 return ("Intel 82443MX Power management controller");
1220 return ("Intel 82440FX (Natoma) PCI and memory controller");
1222 return ("Intel 82453KX/GX (Orion) PCI memory controller");
1224 return ("Intel 82810 (i810 GMCH) Host To Hub bridge");
1226 return ("Intel 82810-DC100 (i810-DC100 GMCH) Host To Hub bridge");
1228 return ("Intel 82810E (i810E GMCH) Host To Hub bridge");
1230 return ("Intel 82801AA (ICH) AC'97 Audio Controller");
1232 return ("Intel 82801AB (ICH0) AC'97 Audio Controller");
1234 /* Sony -- vendor 0x104d */
1236 return ("Sony CXD1947A FireWire Host Controller");
1238 /* SiS -- vendor 0x1039 */
1240 return ("SiS 85c496 PCI/VL Bridge");
1242 return ("SiS 85c501");
1244 return ("SiS 85c601");
1246 return ("SiS 5591 host to PCI bridge");
1248 return ("SiS 5591 host to AGP bridge");
1250 /* VLSI -- vendor 0x1004 */
1252 return ("VLSI 82C592 Host to PCI bridge");
1254 return ("VLSI 82C532 Eagle II Peripheral controller");
1256 return ("VLSI 82C535 Eagle II System controller");
1258 return ("VLSI 82C147 IrDA controller");
1260 /* VIA Technologies -- vendor 0x1106 (0x1107 on the Apollo Master) */
1262 return ("VIA 82C570 (Apollo Master) system controller");
1264 return ("VIA 82C585 (Apollo VP1/VPX) system controller");
1267 return ("VIA 82C595 (Apollo VP2) system controller");
1269 return ("VIA 82C597 (Apollo VP3) system controller");
1270 /* XXX Here is MVP3, I got the datasheet but NO M/B to test it */
1271 /* totally. Please let me know if anything wrong. -F */
1272 /* XXX need info on the MVP3 -- any takers? */
1274 return ("VIA 82C598MVP (Apollo MVP3) host bridge");
1280 return ("VIA 82C686 AC97 Audio");
1282 return ("VIA 82C686 AC97 Modem");
1284 /* AMD -- vendor 0x1022 */
1286 return ("AMD-751 host to PCI bridge");
1288 return ("AMD-761 host to PCI bridge");
1290 /* NEC -- vendor 0x1033 */
1292 return ("NEC 0002 PCI to PC-98 local bus bridge");
1294 return ("NEC 0016 PCI to PC-98 local bus bridge");
1296 /* AcerLabs -- vendor 0x10b9 */
1297 /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */
1298 /* id is '10b9" but the register always shows "10b9". -Foxfair */
1300 return ("AcerLabs M1541 (Aladdin-V) PCI host bridge");
1302 return ("AcerLabs M15x3 Power Management Unit");
1304 /* OPTi -- vendor 0x1045 */
1306 return ("Opti 82C557 (Viper-M) host to PCI bridge");
1308 return ("Opti 82C558 (Viper-M) ISA+IDE");
1310 return ("OPTi 82C822 host to PCI Bridge");
1312 /* Texas Instruments -- vendor 0x104c */
1314 return ("Texas Instruments PCI1225 CardBus controller");
1316 return ("Texas Instruments PCI1410 CardBus controller");
1318 return ("Texas Instruments PCI1420 CardBus controller");
1320 return ("Texas Instruments PCI1450 CardBus controller");
1322 return ("Texas Instruments PCI1451 CardBus controller");
1324 /* NeoMagic -- vendor 0x10c8 */
1326 return ("NeoMagic MagicMedia 256AX Audio controller");
1328 return ("NeoMagic MagicMedia 256ZX Audio controller");
1330 /* ESS Technology Inc -- vendor 0x125d */
1332 return ("ESS Technology Maestro 2E Audio controller");
1334 /* Toshiba -- vendor 0x1179 */
1336 return ("Toshiba Fast Infra Red controller");
1338 /* NEC -- vendor 0x1033 */
1340 /* PCI to C-bus bridge */
1341 /* The following chipsets are PCI to PC98 C-bus bridge.
1342 * The C-bus is the 16-bits bus on PC98 and it should be probed as
1343 * PCI to ISA bridge. Because class of the C-bus is not defined,
1344 * C-bus bridges are recognized as "other bridge." To make C-bus
1345 * bridge be recognized as ISA bridge, this function returns NULL.
1353 if (pci_get_class(dev) == PCIC_BRIDGE
1354 && pci_get_subclass(dev) != PCIS_BRIDGE_PCI
1355 && pci_get_subclass(dev) != PCIS_BRIDGE_ISA
1356 && pci_get_subclass(dev) != PCIS_BRIDGE_EISA)
1357 return pci_bridge_type(dev);
1362 static int chip_probe(device_t dev)
1366 desc = chip_match(dev);
1368 if (pci_get_class(dev) == PCIC_BRIDGE
1369 && pci_get_subclass(dev) == PCIS_BRIDGE_HOST) {
1371 * Suppress printing this device since the nexus
1372 * has already described it.
1377 device_set_desc_copy(dev, desc);
1378 return -10000; /* Low match priority */
1384 static int chip_attach(device_t dev)
1386 chipset_attach(dev, device_get_unit(dev));
1391 static device_method_t chip_methods[] = {
1392 /* Device interface */
1393 DEVMETHOD(device_probe, chip_probe),
1394 DEVMETHOD(device_attach, chip_attach),
1399 static driver_t chip_driver = {
1405 static devclass_t chip_devclass;
1407 DRIVER_MODULE(chip, pci, chip_driver, chip_devclass, 0, 0);
1409 /*---------------------------------------------------------
1411 ** Catchall driver for VGA devices
1413 ** By Garrett Wollman
1414 ** <wollman@halloran-eldar.lcs.mit.edu>
1416 **---------------------------------------------------------
1419 const char* pci_vga_match(device_t dev)
1421 u_int id = pci_get_devid(dev);
1422 const char *vendor, *chip, *type;
1424 vendor = chip = type = 0;
1425 switch (id & 0xffff) {
1430 chip = "i740"; break;
1434 vendor = "NeoMagic";
1437 chip = "MagicGraph 128ZV"; break;
1439 chip = "MagicGraph 128XD"; break;
1441 chip = "MagicMedia 256AV"; break;
1443 chip = "MagicMedia 256ZX"; break;
1448 type = "graphics accelerator";
1451 chip = "Voodoo"; break;
1453 chip = "Voodoo 2"; break;
1455 chip = "Voodoo Banshee"; break;
1457 chip = "Voodoo 3"; break;
1462 type = "graphics accelerator";
1465 chip = "MGA 2085PX"; break;
1467 chip = "MGA Millennium 2064W"; break;
1469 chip = "MGA 1024SG/1064SG/1164SG"; break;
1471 chip = "MGA Millennium II 2164W"; break;
1473 chip = "MGA Millennium II 2164WA-B AG"; break;
1475 chip = "MGA G200"; break;
1477 chip = "MGA G200 AGP"; break;
1479 chip = "MGA G400 AGP"; break;
1481 chip = "MGA Impression"; break;
1483 chip = "MGA G100"; break;
1485 chip = "MGA G100 AGP"; break;
1487 chip = "MGA G550 AGP"; break;
1493 type = "graphics accelerator";
1496 chip = "Mach32"; break;
1498 chip = "Mach64-CT"; break;
1500 chip = "Mach64-CX"; break;
1502 chip = "Mach64-ET"; break;
1505 chip = "Mach64-VT"; break;
1507 chip = "Mach64-GB"; break;
1509 chip = "Mach64-GD"; break;
1511 chip = "Mach64-GI"; break;
1513 chip = "Mach64-GM"; break;
1515 chip = "Mach64-GN"; break;
1517 chip = "Mach64-GO"; break;
1519 chip = "Mach64-GP"; break;
1521 chip = "Mach64-GQ"; break;
1523 chip = "Mach64-GR"; break;
1525 chip = "Mach64-GS"; break;
1527 chip = "Mach64-GT"; break;
1529 chip = "Mach64-GU"; break;
1531 chip = "Mach64-GV"; break;
1533 chip = "Mach64-GW"; break;
1535 chip = "Mach64-GX"; break;
1537 chip = "Mobility-1"; break;
1539 chip = "RageMobility-P/M"; break;
1541 chip = "Mach64-GZ"; break;
1543 chip = "Rage128-RE"; break;
1545 chip = "Rage128-RF"; break;
1547 chip = "Rage128-RK"; break;
1549 chip = "Rage128-RL"; break;
1553 vendor = "Avance Logic";
1556 chip = "ALG2301"; break;
1558 chip = "ALG2302"; break;
1562 vendor = "Tseng Labs";
1563 type = "graphics accelerator";
1569 chip = "ET4000 W32P"; break;
1571 chip = "ET6000/ET6100"; break;
1573 chip = "ET6300"; break;
1578 type = "graphics accelerator";
1581 chip = "P9000"; break;
1583 chip = "P9100"; break;
1587 vendor = "Cirrus Logic";
1590 chip = "GD7548"; break;
1592 chip = "GD7555"; break;
1594 chip = "GD7556"; break;
1596 chip = "GD5430"; break;
1599 chip = "GD5434"; break;
1601 chip = "GD5436"; break;
1603 chip = "GD5446"; break;
1605 chip = "GD5480"; break;
1607 chip = "GD5462"; break;
1610 chip = "GD5464"; break;
1612 chip = "GD5465"; break;
1614 chip = "GD7542"; break;
1616 chip = "GD7543"; break;
1618 chip = "GD7541"; break;
1623 break; /* let default deal with it */
1625 vendor = "Chips & Technologies";
1628 chip = "64310"; break;
1630 chip = "65545"; break;
1632 chip = "65548"; break;
1634 chip = "69000"; break;
1636 chip = "65550"; break;
1638 chip = "65554"; break;
1640 chip = "65555"; break;
1642 chip = "68554"; break;
1649 type = "PCI to PC-98 Core Graph bridge";
1657 chip = "86c201"; break;
1659 chip = "86c202"; break;
1661 chip = "86c205"; break;
1663 chip = "86c215"; break;
1665 chip = "86c225"; break;
1667 chip = "5597/98"; break;
1669 chip = "6326"; break;
1671 chip = "530/620"; break;
1675 vendor = "Number Nine";
1676 type = "graphics accelerator";
1679 chip = "Imagine 128"; break;
1681 chip = "Imagine 128 II"; break;
1685 vendor = "Alliance";
1688 chip = "PM6410"; break;
1690 chip = "PM6422"; break;
1692 chip = "PMAT24"; break;
1696 vendor = "Rendition Verite";
1699 chip = "V1000"; break;
1701 chip = "V2000"; break;
1705 vendor = "Sigma Designs";
1706 if ((id >> 16) == 0x6401)
1707 chip = "REALmagic64/GX";
1711 type = "graphics accelerator";
1714 chip = "Trio"; break;
1716 chip = "Aurora 64"; break;
1718 chip = "Trio 64UV+"; break;
1720 chip = "Trio 64V2/DX/GX"; break;
1722 chip = "Plato"; break;
1724 chip = "Trio3D"; break;
1726 chip = "868"; break;
1728 chip = "928"; break;
1731 chip = "864"; break;
1734 chip = "964"; break;
1736 chip = "968"; break;
1738 chip = "ViRGE"; break;
1740 chip = "ViRGE VX"; break;
1742 chip = "ViRGE DX/GX"; break;
1744 chip = "ViRGE GX2"; break;
1746 chip = "Trio3D/2X"; break;
1749 chip = "Savage3D"; break;
1751 chip = "Savage 4"; break;
1753 chip = "ViRGE MX"; break;
1755 chip = "ViRGE MX+"; break;
1759 vendor = "ARK Logic";
1762 chip = "1000PV"; break;
1764 chip = "2000PV"; break;
1766 chip = "2000MT"; break;
1768 chip = "2000MI"; break;
1773 type = "graphics accelerator";
1776 chip = "300SX"; break;
1778 chip = "500TX"; break;
1780 chip = "Delta"; break;
1782 chip = "PerMedia"; break;
1787 type = "graphics accelerator";
1790 chip = "NV1"; break;
1792 chip = "Riva TNT"; break;
1794 chip = "Riva TNT2"; break;
1796 chip = "Riva Ultra TNT2"; break;
1798 chip = "Riva Vanta TNT2"; break;
1800 chip = "Riva Ultra Vanta TNT2"; break;
1802 chip = "Riva Integrated TNT2"; break;
1804 chip = "GeForce 256"; break;
1806 chip = "GeForce DDR"; break;
1808 chip = "Quadro"; break;
1812 chip = "GeForce2 GTS"; break;
1814 chip = "Quadro2"; break;
1818 vendor = "NVidia/SGS-Thomson";
1819 type = "graphics accelerator";
1822 chip = "Riva128"; break;
1826 vendor = "SGS-Thomson";
1829 chip = "STG2000"; break;
1836 chip = "82810 (i810 GMCH)"; break;
1838 chip = "82810-DC100 (i810-DC100 GMCH)"; break;
1840 chip = "82810E (i810E GMCH)"; break;
1842 chip = "i740 AGP"; break;
1846 vendor = "Intergraphics";
1849 chip = "IGA-1680"; break;
1851 chip = "IGA-1682"; break;
1856 if (vendor && chip) {
1861 type = "SVGA controller";
1863 len = strlen(vendor) + strlen(chip) + strlen(type) + 4;
1864 MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
1866 sprintf(buf, "%s %s %s", vendor, chip, type);
1870 switch (pci_get_class(dev)) {
1873 if (pci_get_subclass(dev) != PCIS_OLD_VGA)
1876 type = "VGA-compatible display device";
1881 if (pci_get_subclass(dev) == PCIS_DISPLAY_VGA)
1882 type = "VGA-compatible display device";
1885 * If it isn't a vga display device,
1886 * don't pretend we found one.
1897 * If we got here, we know for sure it's some sort of display
1898 * device, but we weren't able to identify it specifically.
1899 * At a minimum we can return the type, but we'd like to
1900 * identify the vendor and chip ID if at all possible.
1901 * (Some of the checks above intentionally don't bother for
1902 * vendors where we know the chip ID is the same as the
1909 len = strlen(vendor) + strlen(type) + 2 + 6 + 4 + 1;
1910 MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
1912 sprintf(buf, "%s model %04x %s", vendor, id >> 16, type);
1918 /*---------------------------------------------------------
1920 ** Devices to ignore
1922 **---------------------------------------------------------
1926 ign_probe (device_t dev)
1928 switch (pci_get_devid(dev)) {
1930 case 0x10001042ul: /* wd */
1932 /* return ("SMC FDC 37c665");*/
1938 ign_attach (device_t dev)
1943 static device_method_t ign_methods[] = {
1944 /* Device interface */
1945 DEVMETHOD(device_probe, ign_probe),
1946 DEVMETHOD(device_attach, ign_attach),
1951 static driver_t ign_driver = {
1957 static devclass_t ign_devclass;
1959 DRIVER_MODULE(ign, pci, ign_driver, ign_devclass, 0, 0);