FreeBSD/Linux Kernel Cross Reference
sys/pci/pcisupport.c
1 /**************************************************************************
2 **
3 ** $FreeBSD$
4 **
5 ** Device driver for DEC/INTEL PCI chipsets.
6 **
7 ** FreeBSD
8 **
9 **-------------------------------------------------------------------------
10 **
11 ** Written for FreeBSD by
12 ** wolf@cologne.de Wolfgang Stanglmeier
13 ** se@mi.Uni-Koeln.de Stefan Esser
14 **
15 **-------------------------------------------------------------------------
16 **
17 ** Copyright (c) 1994,1995 Stefan Esser. All rights reserved.
18 **
19 ** Redistribution and use in source and binary forms, with or without
20 ** modification, are permitted provided that the following conditions
21 ** are met:
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.
29 **
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.
40 **
41 ***************************************************************************
42 */
43
44 #include "opt_pci.h"
45 #include "opt_smp.h"
46
47 #include <sys/param.h>
48 #include <sys/systm.h>
49 #include <sys/malloc.h>
50 #include <sys/kernel.h>
51
52 #include <pci/pcivar.h>
53 #include <pci/pcireg.h>
54
55 #include <vm/vm.h>
56 #include <vm/vm_object.h>
57 #include <vm/pmap.h>
58
59 /*---------------------------------------------------------
60 **
61 ** Intel chipsets for 486 / Pentium processor
62 **
63 **---------------------------------------------------------
64 */
65
66 static const char* chipset_probe (pcici_t tag, pcidi_t type);
67 static void chipset_attach(pcici_t tag, int unit);
68 static u_long chipset_count;
69
70 struct pci_device chipset_device = {
71 "chip",
72 chipset_probe,
73 chipset_attach,
74 &chipset_count,
75 NULL
76 };
77
78 /*DATA_SET (pcidevice_set, chipset_device);*/
79
80 struct condmsg {
81 unsigned char port;
82 unsigned char mask;
83 unsigned char value;
84 char flags;
85 const char *text;
86 };
87
88 static char*
89 generic_pci_bridge (pcici_t tag)
90 {
91 char *descr, tmpbuf[120];
92 unsigned classreg = pci_conf_read (tag, PCI_CLASS_REG);
93
94 if ((classreg & PCI_CLASS_MASK) == PCI_CLASS_BRIDGE) {
95
96 unsigned id = pci_conf_read (tag, PCI_ID_REG);
97
98 switch (classreg >> 16 & 0xff) {
99 case 0: strcpy(tmpbuf, "Host to PCI"); break;
100 case 1: strcpy(tmpbuf, "PCI to ISA"); break;
101 case 2: strcpy(tmpbuf, "PCI to EISA"); break;
102 case 4: strcpy(tmpbuf, "PCI to PCI"); break;
103 case 5: strcpy(tmpbuf, "PCI to PCMCIA"); break;
104 case 7: strcpy(tmpbuf, "PCI to CardBus"); break;
105 default:
106 snprintf(tmpbuf, sizeof(tmpbuf),
107 "PCI to 0x%x", classreg>>16 & 0xff);
108 break;
109 }
110 snprintf(tmpbuf+strlen(tmpbuf), sizeof(tmpbuf)-strlen(tmpbuf),
111 " bridge (vendor=%04x device=%04x)",
112 id & 0xffff, (id >> 16) & 0xffff);
113 descr = malloc (strlen(tmpbuf) +1, M_DEVBUF, M_WAITOK);
114 strcpy(descr, tmpbuf);
115 return descr;
116 }
117 return 0;
118 }
119
120 /*
121 * XXX Both fixbushigh_orion() and fixbushigh_i1225() are bogus in that way,
122 * that they store the highest bus number to scan in this device's config
123 * data, though it is about PCI buses attached to the CPU independently!
124 * The same goes for fixbushigh_450nx.
125 */
126
127 static void
128 fixbushigh_orion(pcici_t tag)
129 {
130 tag->secondarybus = pci_cfgread(tag, 0x4a, 1);
131 tag->subordinatebus = pci_cfgread(tag, 0x4b, 1);
132 }
133
134 static void
135 fixbushigh_i1225(pcici_t tag)
136 {
137 int sublementarybus;
138
139 sublementarybus = pci_cfgread(tag, 0x41, 1);
140 if (sublementarybus != 0xff)
141 tag->secondarybus = tag->subordinatebus = sublementarybus +1;
142 }
143
144
145 /*
146 * This reads the PCI config space for the 82451NX MIOC in the 450NX
147 * chipset to determine the PCI bus configuration.
148 *
149 * Assuming the BIOS has set up the MIOC properly, this will correctly
150 * report the number of PCI busses in the system.
151 *
152 * A small problem is that the Host to PCI bridge control is in the MIOC,
153 * while the host-pci bridges are separate PCI devices. So it really
154 * isn't easily possible to set up the subordinatebus mappings as the
155 * 82454NX PCI expander bridges are probed, although that makes the
156 * most sense.
157 */
158 static void
159 fixbushigh_450nx(pcici_t tag)
160 {
161 int subordinatebus;
162 unsigned long devmap;
163
164 /*
165 * Read the DEVMAP field, so we know which fields to check.
166 * If the Host-PCI bridge isn't marked as present by the BIOS,
167 * we have to assume it doesn't exist.
168 * If this doesn't find all the PCI busses, complain to the
169 * BIOS vendor. There is nothing more we can do.
170 */
171 devmap = pci_cfgread(tag, 0xd6, 2) & 0x3c;
172 if (!devmap)
173 panic("450NX MIOC: No host to PCI bridges marked present.\n");
174 /*
175 * Since the buses are configured in order, we just have to
176 * find the highest bus, and use those numbers.
177 */
178 if (devmap & 0x20) { /* B1 */
179 subordinatebus = pci_cfgread(tag, 0xd5, 1);
180 } else if (devmap & 0x10) { /* A1 */
181 subordinatebus = pci_cfgread(tag, 0xd4, 1);
182 } else if (devmap & 0x8) { /* B0 */
183 subordinatebus = pci_cfgread(tag, 0xd2, 1);
184 } else /* if (devmap & 0x4) */ { /* A0 */
185 subordinatebus = pci_cfgread(tag, 0xd1, 1);
186 }
187 if (subordinatebus == 255) {
188 printf("fixbushigh_450nx: bogus highest PCI bus %d",
189 subordinatebus);
190 #ifdef NBUS
191 subordinatebus = NBUS - 2;
192 #else
193 subordinatebus = 10;
194 #endif
195 printf(", reduced to %d\n", subordinatebus);
196 }
197
198 if (bootverbose)
199 printf("fixbushigh_450nx: subordinatebus is %d\n",
200 subordinatebus);
201
202 tag->secondarybus = tag->subordinatebus = subordinatebus;
203 }
204
205 static void
206 fixbushigh_Ross(pcici_t tag)
207 {
208 int secondarybus;
209
210 /* just guessing the secondary bus register number ... */
211 secondarybus = pci_cfgread(tag, 0x45, 1);
212 if (secondarybus != 0)
213 tag->secondarybus = tag->subordinatebus = secondarybus + 1;
214 }
215
216 static void
217 fixwsc_natoma(pcici_t tag)
218 {
219 int pmccfg;
220
221 pmccfg = pci_cfgread(tag, 0x50, 2);
222 #if defined(SMP)
223 if (pmccfg & 0x8000) {
224 printf("Correcting Natoma config for SMP\n");
225 pmccfg &= ~0x8000;
226 pci_cfgwrite(tag, 0x50, 2, pmccfg);
227 }
228 #else
229 if ((pmccfg & 0x8000) == 0) {
230 printf("Correcting Natoma config for non-SMP\n");
231 pmccfg |= 0x8000;
232 pci_cfgwrite(tag, 0x50, 2, pmccfg);
233 }
234 #endif
235 }
236
237
238 static const char*
239 chipset_probe (pcici_t tag, pcidi_t type)
240 {
241 unsigned rev;
242 char *descr;
243
244 switch (type) {
245 /* Intel -- vendor 0x8086 */
246 case 0x00088086:
247 /* Silently ignore this one! What is it, anyway ??? */
248 return ("");
249 case 0x04868086:
250 return ("Intel 82425EX PCI system controller");
251 case 0x04848086:
252 rev = (unsigned) pci_conf_read (tag, PCI_CLASS_REG) & 0xff;
253 if (rev == 3)
254 return ("Intel 82378ZB PCI to ISA bridge");
255 return ("Intel 82378IB PCI to ISA bridge");
256 case 0x04838086:
257 return ("Intel 82424ZX (Saturn) cache DRAM controller");
258 case 0x04828086:
259 return ("Intel 82375EB PCI-EISA bridge");
260 case 0x04a38086:
261 rev = (unsigned) pci_conf_read (tag, PCI_CLASS_REG) & 0xff;
262 if (rev == 16 || rev == 17)
263 return ("Intel 82434NX (Neptune) PCI cache memory controller");
264 return ("Intel 82434LX (Mercury) PCI cache memory controller");
265 case 0x12258086:
266 fixbushigh_i1225(tag);
267 return ("Intel 824?? host to PCI bridge");
268 case 0x122d8086:
269 return ("Intel 82437FX PCI cache memory controller");
270 case 0x122e8086:
271 return ("Intel 82371FB PCI to ISA bridge");
272 case 0x12348086:
273 return ("Intel 82371MX mobile PCI I/O IDE accelerator (MPIIX)");
274 case 0x12358086:
275 return ("Intel 82437MX mobile PCI cache memory controller");
276 case 0x12508086:
277 return ("Intel 82439HX PCI cache memory controller");
278 case 0x70008086:
279 return ("Intel 82371SB PCI to ISA bridge");
280 case 0x70308086:
281 return ("Intel 82437VX PCI cache memory controller");
282 case 0x71008086:
283 return ("Intel 82439TX System Controller (MTXC)");
284 case 0x71108086:
285 return ("Intel 82371AB PCI to ISA bridge");
286 case 0x71138086:
287 return ("Intel 82371AB Power management controller");
288 case 0x71808086:
289 return ("Intel 82443LX host to PCI bridge");
290 case 0x71818086:
291 return ("Intel 82443LX PCI-PCI bridge");
292 case 0x71908086:
293 return ("Intel 82443BX host to PCI bridge");
294 case 0x71918086:
295 return ("Intel 82443BX host to AGP bridge");
296 case 0x71928086:
297 return ("Intel 82443BX host to PCI bridge (AGP disabled)");
298 case 0x71a08086:
299 return ("Intel 82443GX host to PCI bridge");
300 case 0x71a18086:
301 return ("Intel 82443GX host to AGP bridge");
302 case 0x71a28086:
303 return ("Intel 82443GX host to PCI bridge (AGP disabled)");
304 case 0x12378086:
305 fixwsc_natoma(tag);
306 return ("Intel 82440FX (Natoma) PCI and memory controller");
307 case 0x84c48086:
308 fixbushigh_orion(tag);
309 return ("Intel 82454KX/GX (Orion) host to PCI bridge");
310 case 0x84c58086:
311 return ("Intel 82453KX/GX (Orion) PCI memory controller");
312 case 0x84ca8086:
313 fixbushigh_450nx(tag);
314 return ("Intel 82451NX Memory and I/O Controller");
315 case 0x84cb8086:
316 return ("Intel 82454NX PCI Expander Bridge");
317 case 0x124b8086:
318 return ("Intel 82380FB mobile PCI to PCI bridge");
319
320 /* SiS -- vendor 0x1039 */
321 case 0x04961039:
322 return ("SiS 85c496");
323 case 0x04061039:
324 return ("SiS 85c501");
325 case 0x00081039:
326 return ("SiS 85c503");
327 case 0x06011039:
328 return ("SiS 85c601");
329 case 0x55911039:
330 return ("SiS 5591 host to PCI bridge");
331 case 0x00011039:
332 return ("SiS 5591 host to AGP bridge");
333
334 /* VLSI -- vendor 0x1004 */
335 case 0x00051004:
336 return ("VLSI 82C592 Host to PCI bridge");
337 case 0x00061004:
338 return ("VLSI 82C593 PCI to ISA bridge");
339 case 0x01011004:
340 return ("VLSI 82C532 Eagle II Peripheral Controller");
341 case 0x01021004:
342 return ("VLSI 82C534 Eagle II PCI Bus bridge");
343 case 0x01031004:
344 return ("VLSI 82C538 Eagle II PCI Docking bridge");
345 case 0x01041004:
346 return ("VLSI 82C535 Eagle II System Controller");
347 case 0x01051004:
348 return ("VLSI 82C147 IrDA Controller");
349
350 /* VIA Technologies -- vendor 0x1106
351 * Note that the old Apollo Master chipset is not in here, as VIA
352 * does not seem to have any docs on their website for it, and I do
353 * not have a Master board in my posession. -LC
354 */
355 case 0x05851106:
356 return("VIA 82C585 (Apollo VP1/VPX) system controller");
357 case 0x05861106: /* south bridge section -- IDE is covered in ide_pci.c */
358 return("VIA 82C586 PCI-ISA bridge");
359 case 0x05951106:
360 case 0x15951106:
361 return("VIA 82C595 (Apollo VP2) system controller");
362 case 0x05971106:
363 return("VIA 82C597 (Apollo VP3) system controller");
364 /* XXX need info on the MVP3 -- any takers? */
365 case 0x30401106:
366 return("VIA 82C586B ACPI interface");
367 /* XXX Here is MVP3, I got the datasheet but NO M/B to test it */
368 /* totally. Please let me know if anything wrong. -F */
369 case 0x05981106:
370 return("VIA 82C598MVP (Apollo MVP3) host bridge");
371 case 0x85981106:
372 return("VIA 82C598MVP (Apollo MVP3) PCI-PCI bridge");
373
374 /* AcerLabs -- vendor 0x10b9 */
375 /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */
376 /* id is '10b9" but the register always shows "10b9". -Foxfair */
377 case 0x154110b9:
378 return("AcerLabs M1541 (Aladdin-V) PCI host bridge");
379 case 0x153310b9:
380 return("AcerLabs M1533 portable PCI-ISA bridge");
381 case 0x154310b9:
382 return("AcerLabs M1543 desktop PCI-ISA bridge");
383 case 0x524710b9:
384 return("AcerLabs M5247 PCI-PCI(AGP Supported) bridge");
385 case 0x524310b9:/* 5243 seems like 5247, need more info to divide*/
386 return("AcerLabs M5243 PCI-PCI bridge");
387 case 0x710110b9:
388 return ("AcerLabs M15x3 Power Management Unit");
389
390 /* Cyrix -- vendor 0x1078 */
391 case 0x00001078:
392 return ("Cyrix Cx5510 PCI-ISA bridge");
393 case 0x01001078:
394 return ("Cyrix Cx5530 PCI-ISA bridge");
395
396 /* NEC -- vendor 0x1033 */
397 case 0x00011033:
398 return ("NEC 0001 PCI to PC-98 C-bus bridge");
399 case 0x00021033:
400 return ("NEC 0002 PCI to PC-98 local bus bridge");
401 case 0x00161033:
402 return ("NEC 0016 PCI to PC-98 local bus bridge");
403 case 0x002c1033:
404 return ("NEC 002C PCI to PC-98 C-bus bridge");
405 case 0x003b1033:
406 return ("NEC 003B PCI to PC-98 C-bus bridge");
407
408 /* OPTi -- vendor 0x1045 */
409 case 0xc8221045:
410 return ("OPTi 82C822 host to PCI Bridge");
411
412 /* Ross (?) -- vendor 0x1166 */
413 case 0x00051166:
414 fixbushigh_Ross(tag);
415 return ("Ross (?) host to PCI bridge");
416
417 /* Others */
418 case 0x00221014:
419 return ("IBM 82351 PCI-PCI bridge");
420 case 0x00011011:
421 return ("DEC 21050 PCI-PCI bridge");
422 };
423
424 if (descr = generic_pci_bridge(tag))
425 return descr;
426
427 return NULL;
428 }
429
430 #ifndef PCI_QUIET
431
432 #define M_XX 0 /* end of list */
433 #define M_EQ 1 /* mask and return true if equal */
434 #define M_NE 2 /* mask and return true if not equal */
435 #define M_TR 3 /* don't read config, always true */
436 #define M_EN 4 /* mask and print "enabled" if true, "disabled" if false */
437 #define M_NN 5 /* opposite sense of M_EN */
438
439 static const struct condmsg conf82425ex[] =
440 {
441 { 0x00, 0x00, 0x00, M_TR, "\tClock " },
442 { 0x50, 0x06, 0x00, M_EQ, "25" },
443 { 0x50, 0x06, 0x02, M_EQ, "33" },
444 { 0x50, 0x04, 0x04, M_EQ, "??", },
445 { 0x00, 0x00, 0x00, M_TR, "MHz, L1 Cache " },
446 { 0x50, 0x01, 0x00, M_EQ, "Disabled\n" },
447 { 0x50, 0x09, 0x01, M_EQ, "Write-through\n" },
448 { 0x50, 0x09, 0x09, M_EQ, "Write-back\n" },
449
450 { 0x00, 0x00, 0x00, M_TR, "\tL2 Cache " },
451 { 0x52, 0x07, 0x00, M_EQ, "Disabled" },
452 { 0x52, 0x0f, 0x01, M_EQ, "64KB Write-through" },
453 { 0x52, 0x0f, 0x02, M_EQ, "128KB Write-through" },
454 { 0x52, 0x0f, 0x03, M_EQ, "256KB Write-through" },
455 { 0x52, 0x0f, 0x04, M_EQ, "512KB Write-through" },
456 { 0x52, 0x0f, 0x01, M_EQ, "64KB Write-back" },
457 { 0x52, 0x0f, 0x02, M_EQ, "128KB Write-back" },
458 { 0x52, 0x0f, 0x03, M_EQ, "256KB Write-back" },
459 { 0x52, 0x0f, 0x04, M_EQ, "512KB Write-back" },
460 { 0x53, 0x01, 0x00, M_EQ, ", 3-" },
461 { 0x53, 0x01, 0x01, M_EQ, ", 2-" },
462 { 0x53, 0x06, 0x00, M_EQ, "3-3-3" },
463 { 0x53, 0x06, 0x02, M_EQ, "2-2-2" },
464 { 0x53, 0x06, 0x04, M_EQ, "1-1-1" },
465 { 0x53, 0x06, 0x06, M_EQ, "?-?-?" },
466 { 0x53, 0x18, 0x00, M_EQ, "/4-2-2-2\n" },
467 { 0x53, 0x18, 0x08, M_EQ, "/3-2-2-2\n" },
468 { 0x53, 0x18, 0x10, M_EQ, "/?-?-?-?\n" },
469 { 0x53, 0x18, 0x18, M_EQ, "/2-1-1-1\n" },
470
471 { 0x56, 0x00, 0x00, M_TR, "\tDRAM: " },
472 { 0x56, 0x02, 0x02, M_EQ, "Fast Code Read, " },
473 { 0x56, 0x04, 0x04, M_EQ, "Fast Data Read, " },
474 { 0x56, 0x08, 0x08, M_EQ, "Fast Write, " },
475 { 0x57, 0x20, 0x20, M_EQ, "Pipelined CAS" },
476 { 0x57, 0x2e, 0x00, M_NE, "\n\t" },
477 { 0x57, 0x00, 0x00, M_TR, "Timing: RAS: " },
478 { 0x57, 0x07, 0x00, M_EQ, "4" },
479 { 0x57, 0x07, 0x01, M_EQ, "3" },
480 { 0x57, 0x07, 0x02, M_EQ, "2" },
481 { 0x57, 0x07, 0x04, M_EQ, "1.5" },
482 { 0x57, 0x07, 0x05, M_EQ, "1" },
483 { 0x57, 0x00, 0x00, M_TR, " Clocks, CAS Read: " },
484 { 0x57, 0x18, 0x00, M_EQ, "3/1", },
485 { 0x57, 0x18, 0x00, M_EQ, "2/1", },
486 { 0x57, 0x18, 0x00, M_EQ, "1.5/0.5", },
487 { 0x57, 0x18, 0x00, M_EQ, "1/1", },
488 { 0x57, 0x00, 0x00, M_TR, ", CAS Write: " },
489 { 0x57, 0x20, 0x00, M_EQ, "2/1", },
490 { 0x57, 0x20, 0x20, M_EQ, "1/1", },
491 { 0x57, 0x00, 0x00, M_TR, "\n" },
492
493 { 0x40, 0x01, 0x01, M_EQ, "\tCPU-to-PCI Byte Merging\n" },
494 { 0x40, 0x02, 0x02, M_EQ, "\tCPU-to-PCI Bursting\n" },
495 { 0x40, 0x04, 0x04, M_EQ, "\tPCI Posted Writes\n" },
496 { 0x40, 0x20, 0x00, M_EQ, "\tDRAM Parity Disabled\n" },
497
498 { 0x48, 0x03, 0x01, M_EQ, "\tPCI IDE controller: Primary (1F0h-1F7h,3F6h,3F7h)" },
499 { 0x48, 0x03, 0x02, M_EQ, "\tPCI IDE controller: Secondary (170h-177h,376h,377h)" },
500 { 0x4d, 0x01, 0x01, M_EQ, "\tRTC (70-77h)\n" },
501 { 0x4d, 0x02, 0x02, M_EQ, "\tKeyboard (60,62,64,66h)\n" },
502 { 0x4d, 0x08, 0x08, M_EQ, "\tIRQ12/M Mouse Function\n" },
503
504 /* end marker */
505 { 0 }
506 };
507
508 static const struct condmsg conf82424zx[] =
509 {
510 { 0x00, 0x00, 0x00, M_TR, "\tCPU: " },
511 { 0x50, 0xe0, 0x00, M_EQ, "486DX" },
512 { 0x50, 0xe0, 0x20, M_EQ, "486SX" },
513 { 0x50, 0xe0, 0x40, M_EQ, "486DX2 or 486DX4" },
514 { 0x50, 0xe0, 0x80, M_EQ, "Overdrive (writeback)" },
515
516 { 0x00, 0x00, 0x00, M_TR, ", bus=" },
517 { 0x50, 0x03, 0x00, M_EQ, "25MHz" },
518 { 0x50, 0x03, 0x01, M_EQ, "33MHz" },
519 { 0x53, 0x01, 0x01, M_TR, ", CPU->Memory posting "},
520 { 0x53, 0x01, 0x00, M_EQ, "OFF" },
521 { 0x53, 0x01, 0x01, M_EQ, "ON" },
522
523 { 0x56, 0x30, 0x00, M_NE, "\n\tWarning:" },
524 { 0x56, 0x20, 0x00, M_NE, " NO cache parity!" },
525 { 0x56, 0x10, 0x00, M_NE, " NO DRAM parity!" },
526 { 0x55, 0x04, 0x04, M_EQ, "\n\tWarning: refresh OFF! " },
527
528 { 0x00, 0x00, 0x00, M_TR, "\n\tCache: " },
529 { 0x52, 0x01, 0x00, M_EQ, "None" },
530 { 0x52, 0xc1, 0x01, M_EQ, "64KB" },
531 { 0x52, 0xc1, 0x41, M_EQ, "128KB" },
532 { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
533 { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
534 { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
535 { 0x52, 0x03, 0x03, M_EQ, " writeback" },
536
537 { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
538 { 0x52, 0x05, 0x01, M_EQ, "3-1-1-1" },
539 { 0x52, 0x05, 0x05, M_EQ, "2-1-1-1" },
540
541 { 0x00, 0x00, 0x00, M_TR, "\n\tDRAM:" },
542 { 0x55, 0x43, 0x00, M_NE, " page mode" },
543 { 0x55, 0x02, 0x02, M_EQ, " code fetch" },
544 { 0x55, 0x43, 0x43, M_EQ, "," },
545 { 0x55, 0x43, 0x42, M_EQ, " and" },
546 { 0x55, 0x40, 0x40, M_EQ, " read" },
547 { 0x55, 0x03, 0x03, M_EQ, " and" },
548 { 0x55, 0x43, 0x41, M_EQ, " and" },
549 { 0x55, 0x01, 0x01, M_EQ, " write" },
550 { 0x55, 0x43, 0x00, M_NE, "," },
551
552 { 0x00, 0x00, 0x00, M_TR, " memory clocks=" },
553 { 0x55, 0x20, 0x00, M_EQ, "X-2-2-2" },
554 { 0x55, 0x20, 0x20, M_EQ, "X-1-2-1" },
555
556 { 0x00, 0x00, 0x00, M_TR, "\n\tCPU->PCI: posting " },
557 { 0x53, 0x02, 0x00, M_NE, "ON" },
558 { 0x53, 0x02, 0x00, M_EQ, "OFF" },
559 { 0x00, 0x00, 0x00, M_TR, ", burst mode " },
560 { 0x54, 0x02, 0x00, M_NE, "ON" },
561 { 0x54, 0x02, 0x00, M_EQ, "OFF" },
562 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI->Memory: posting " },
563 { 0x54, 0x01, 0x00, M_NE, "ON" },
564 { 0x54, 0x01, 0x00, M_EQ, "OFF" },
565
566 { 0x00, 0x00, 0x00, M_TR, "\n" },
567
568 /* end marker */
569 { 0 }
570 };
571
572 static const struct condmsg conf82434lx[] =
573 {
574 { 0x00, 0x00, 0x00, M_TR, "\tCPU: " },
575 { 0x50, 0xe3, 0x82, M_EQ, "Pentium, 60MHz" },
576 { 0x50, 0xe3, 0x83, M_EQ, "Pentium, 66MHz" },
577 { 0x50, 0xe3, 0xa2, M_EQ, "Pentium, 90MHz" },
578 { 0x50, 0xe3, 0xa3, M_EQ, "Pentium, 100MHz" },
579 { 0x50, 0xc2, 0x82, M_NE, "(unknown)" },
580 { 0x50, 0x04, 0x00, M_EQ, " (primary cache OFF)" },
581
582 { 0x53, 0x01, 0x01, M_TR, ", CPU->Memory posting "},
583 { 0x53, 0x01, 0x01, M_NE, "OFF" },
584 { 0x53, 0x01, 0x01, M_EQ, "ON" },
585
586 { 0x53, 0x08, 0x00, M_NE, ", read around write"},
587
588 { 0x70, 0x04, 0x00, M_EQ, "\n\tWarning: Cache parity disabled!" },
589 { 0x57, 0x20, 0x00, M_NE, "\n\tWarning: DRAM parity mask!" },
590 { 0x57, 0x01, 0x00, M_EQ, "\n\tWarning: refresh OFF! " },
591
592 { 0x00, 0x00, 0x00, M_TR, "\n\tCache: " },
593 { 0x52, 0x01, 0x00, M_EQ, "None" },
594 { 0x52, 0x81, 0x01, M_EQ, "" },
595 { 0x52, 0xc1, 0x81, M_EQ, "256KB" },
596 { 0x52, 0xc1, 0xc1, M_EQ, "512KB" },
597 { 0x52, 0x03, 0x01, M_EQ, " writethrough" },
598 { 0x52, 0x03, 0x03, M_EQ, " writeback" },
599
600 { 0x52, 0x01, 0x01, M_EQ, ", cache clocks=" },
601 { 0x52, 0x21, 0x01, M_EQ, "3-2-2-2/4-2-2-2" },
602 { 0x52, 0x21, 0x21, M_EQ, "3-1-1-1" },
603
604 { 0x52, 0x01, 0x01, M_EQ, "\n\tCache flags: " },
605 { 0x52, 0x11, 0x11, M_EQ, " cache-all" },
606 { 0x52, 0x09, 0x09, M_EQ, " byte-control" },
607 { 0x52, 0x05, 0x05, M_EQ, " powersaver" },
608
609 { 0x00, 0x00, 0x00, M_TR, "\n\tDRAM:" },
610 { 0x57, 0x10, 0x00, M_EQ, " page mode" },
611
612 { 0x00, 0x00, 0x00, M_TR, " memory clocks=" },
613 { 0x57, 0xc0, 0x00, M_EQ, "X-4-4-4 (70ns)" },
614 { 0x57, 0xc0, 0x40, M_EQ, "X-4-4-4/X-3-3-3 (60ns)" },
615 { 0x57, 0xc0, 0x80, M_EQ, "???" },
616 { 0x57, 0xc0, 0xc0, M_EQ, "X-3-3-3 (50ns)" },
617 { 0x58, 0x02, 0x02, M_EQ, ", RAS-wait" },
618 { 0x58, 0x01, 0x01, M_EQ, ", CAS-wait" },
619
620 { 0x00, 0x00, 0x00, M_TR, "\n\tCPU->PCI: posting " },
621 { 0x53, 0x02, 0x02, M_EQ, "ON" },
622 { 0x53, 0x02, 0x00, M_EQ, "OFF" },
623 { 0x00, 0x00, 0x00, M_TR, ", burst mode " },
624 { 0x54, 0x02, 0x00, M_NE, "ON" },
625 { 0x54, 0x02, 0x00, M_EQ, "OFF" },
626 { 0x54, 0x04, 0x00, M_TR, ", PCI clocks=" },
627 { 0x54, 0x04, 0x00, M_EQ, "2-2-2-2" },
628 { 0x54, 0x04, 0x00, M_NE, "2-1-1-1" },
629 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI->Memory: posting " },
630 { 0x54, 0x01, 0x00, M_NE, "ON" },
631 { 0x54, 0x01, 0x00, M_EQ, "OFF" },
632
633 { 0x57, 0x01, 0x01, M_EQ, "\n\tRefresh:" },
634 { 0x57, 0x03, 0x03, M_EQ, " CAS#/RAS#(Hidden)" },
635 { 0x57, 0x03, 0x01, M_EQ, " RAS#Only" },
636 { 0x57, 0x05, 0x05, M_EQ, " BurstOf4" },
637
638 { 0x00, 0x00, 0x00, M_TR, "\n" },
639
640 /* end marker */
641 { 0 }
642 };
643
644 static const struct condmsg conf82378[] =
645 {
646 { 0x00, 0x00, 0x00, M_TR, "\tBus Modes:" },
647 { 0x41, 0x04, 0x04, M_EQ, " Bus Park," },
648 { 0x41, 0x02, 0x02, M_EQ, " Bus Lock," },
649 { 0x41, 0x02, 0x00, M_EQ, " Resource Lock," },
650 { 0x41, 0x01, 0x01, M_EQ, " GAT" },
651 { 0x4d, 0x20, 0x20, M_EQ, "\n\tCoprocessor errors enabled" },
652 { 0x4d, 0x10, 0x10, M_EQ, "\n\tMouse function enabled" },
653
654 { 0x4e, 0x30, 0x10, M_EQ, "\n\tIDE controller: Primary (1F0h-1F7h,3F6h,3F7h)" },
655 { 0x4e, 0x30, 0x30, M_EQ, "\n\tIDE controller: Secondary (170h-177h,376h,377h)" },
656 { 0x4e, 0x28, 0x08, M_EQ, "\n\tFloppy controller: 3F0h,3F1h " },
657 { 0x4e, 0x24, 0x04, M_EQ, "\n\tFloppy controller: 3F2h-3F7h " },
658 { 0x4e, 0x28, 0x28, M_EQ, "\n\tFloppy controller: 370h,371h " },
659 { 0x4e, 0x24, 0x24, M_EQ, "\n\tFloppy controller: 372h-377h " },
660 { 0x4e, 0x02, 0x02, M_EQ, "\n\tKeyboard controller: 60h,62h,64h,66h" },
661 { 0x4e, 0x01, 0x01, M_EQ, "\n\tRTC: 70h-77h" },
662
663 { 0x4f, 0x80, 0x80, M_EQ, "\n\tConfiguration RAM: 0C00h,0800h-08FFh" },
664 { 0x4f, 0x40, 0x40, M_EQ, "\n\tPort 92: enabled" },
665 { 0x4f, 0x03, 0x00, M_EQ, "\n\tSerial Port A: COM1 (3F8h-3FFh)" },
666 { 0x4f, 0x03, 0x01, M_EQ, "\n\tSerial Port A: COM2 (2F8h-2FFh)" },
667 { 0x4f, 0x0c, 0x00, M_EQ, "\n\tSerial Port B: COM1 (3F8h-3FFh)" },
668 { 0x4f, 0x0c, 0x04, M_EQ, "\n\tSerial Port B: COM2 (2F8h-2FFh)" },
669 { 0x4f, 0x30, 0x00, M_EQ, "\n\tParallel Port: LPT1 (3BCh-3BFh)" },
670 { 0x4f, 0x30, 0x04, M_EQ, "\n\tParallel Port: LPT2 (378h-37Fh)" },
671 { 0x4f, 0x30, 0x20, M_EQ, "\n\tParallel Port: LPT3 (278h-27Fh)" },
672 { 0x00, 0x00, 0x00, M_TR, "\n" },
673
674 /* end marker */
675 { 0 }
676 };
677
678 static const struct condmsg conf82437fx[] =
679 {
680 /* PCON -- PCI Control Register */
681 { 0x00, 0x00, 0x00, M_TR, "\tCPU Inactivity timer: " },
682 { 0x50, 0xe0, 0xe0, M_EQ, "8" },
683 { 0x50, 0xe0, 0xd0, M_EQ, "7" },
684 { 0x50, 0xe0, 0xc0, M_EQ, "6" },
685 { 0x50, 0xe0, 0xb0, M_EQ, "5" },
686 { 0x50, 0xe0, 0xa0, M_EQ, "4" },
687 { 0x50, 0xe0, 0x90, M_EQ, "3" },
688 { 0x50, 0xe0, 0x80, M_EQ, "2" },
689 { 0x50, 0xe0, 0x00, M_EQ, "1" },
690 { 0x00, 0x00, 0x00, M_TR, " clocks\n\tPeer Concurrency: " },
691 { 0x50, 0x08, 0x08, M_EN, 0 },
692 { 0x00, 0x00, 0x00, M_TR, "\n\tCPU-to-PCI Write Bursting: " },
693 { 0x50, 0x04, 0x00, M_NN, 0 },
694 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI Streaming: " },
695 { 0x50, 0x02, 0x00, M_NN, 0 },
696 { 0x00, 0x00, 0x00, M_TR, "\n\tBus Concurrency: " },
697 { 0x50, 0x01, 0x00, M_NN, 0 },
698
699 /* CC -- Cache Control Regsiter */
700 { 0x00, 0x00, 0x00, M_TR, "\n\tCache:" },
701 { 0x52, 0xc0, 0x80, M_EQ, " 512K" },
702 { 0x52, 0xc0, 0x40, M_EQ, " 256K" },
703 { 0x52, 0xc0, 0x00, M_EQ, " NO" },
704 { 0x52, 0x30, 0x00, M_EQ, " pipelined-burst" },
705 { 0x52, 0x30, 0x10, M_EQ, " burst" },
706 { 0x52, 0x30, 0x20, M_EQ, " asynchronous" },
707 { 0x52, 0x30, 0x30, M_EQ, " dual-bank pipelined-burst" },
708 { 0x00, 0x00, 0x00, M_TR, " secondary; L1 " },
709 { 0x52, 0x01, 0x00, M_EN, 0 },
710 { 0x00, 0x00, 0x00, M_TR, "\n" },
711
712 /* DRAMC -- DRAM Control Register */
713 { 0x57, 0x07, 0x00, M_EQ, "Warning: refresh OFF!\n" },
714 { 0x00, 0x00, 0x00, M_TR, "\tDRAM:" },
715 { 0x57, 0xc0, 0x00, M_EQ, " no memory hole" },
716 { 0x57, 0xc0, 0x40, M_EQ, " 512K-640K memory hole" },
717 { 0x57, 0xc0, 0x80, M_EQ, " 15M-16M memory hole" },
718 { 0x57, 0x07, 0x01, M_EQ, ", 50 MHz refresh" },
719 { 0x57, 0x07, 0x02, M_EQ, ", 60 MHz refresh" },
720 { 0x57, 0x07, 0x03, M_EQ, ", 66 MHz refresh" },
721
722 /* DRAMT = DRAM Timing Register */
723 { 0x00, 0x00, 0x00, M_TR, "\n\tRead burst timing: " },
724 { 0x58, 0x60, 0x00, M_EQ, "x-4-4-4/x-4-4-4" },
725 { 0x58, 0x60, 0x20, M_EQ, "x-3-3-3/x-4-4-4" },
726 { 0x58, 0x60, 0x40, M_EQ, "x-2-2-2/x-3-3-3" },
727 { 0x58, 0x60, 0x60, M_EQ, "???" },
728 { 0x00, 0x00, 0x00, M_TR, "\n\tWrite burst timing: " },
729 { 0x58, 0x18, 0x00, M_EQ, "x-4-4-4" },
730 { 0x58, 0x18, 0x08, M_EQ, "x-3-3-3" },
731 { 0x58, 0x18, 0x10, M_EQ, "x-2-2-2" },
732 { 0x58, 0x18, 0x18, M_EQ, "???" },
733 { 0x00, 0x00, 0x00, M_TR, "\n\tRAS-CAS delay: " },
734 { 0x58, 0x04, 0x00, M_EQ, "3" },
735 { 0x58, 0x04, 0x04, M_EQ, "2" },
736 { 0x00, 0x00, 0x00, M_TR, " clocks\n" },
737
738 /* end marker */
739 { 0 }
740 };
741
742 static const struct condmsg conf82437vx[] =
743 {
744 /* PCON -- PCI Control Register */
745 { 0x00, 0x00, 0x00, M_TR, "\n\tPCI Concurrency: " },
746 { 0x50, 0x08, 0x08, M_EN, 0 },
747
748 /* CC -- Cache Control Regsiter */
749 { 0x00, 0x00, 0x00, M_TR, "\n\tCache:" },
750 { 0x52, 0xc0, 0x80, M_EQ, " 512K" },
751 { 0x52, 0xc0, 0x40, M_EQ, " 256K" },
752 { 0x52, 0xc0, 0x00, M_EQ, " NO" },
753 { 0x52, 0x30, 0x00, M_EQ, " pipelined-burst" },
754 { 0x52, 0x30, 0x10, M_EQ, " burst" },
755 { 0x52, 0x30, 0x20, M_EQ, " asynchronous" },
756 { 0x52, 0x30, 0x30, M_EQ, " dual-bank pipelined-burst" },
757 { 0x00, 0x00, 0x00, M_TR, " secondary; L1 " },
758 { 0x52, 0x01, 0x00, M_EN, 0 },
759 { 0x00, 0x00, 0x00, M_TR, "\n" },
760
761 /* DRAMC -- DRAM Control Register */
762 { 0x57, 0x07, 0x00, M_EQ, "Warning: refresh OFF!\n" },
763 { 0x00, 0x00, 0x00, M_TR, "\tDRAM:" },
764 { 0x57, 0xc0, 0x00, M_EQ, " no memory hole" },
765 { 0x57, 0xc0, 0x40, M_EQ, " 512K-640K memory hole" },
766 { 0x57, 0xc0, 0x80, M_EQ, " 15M-16M memory hole" },
767 { 0x57, 0x07, 0x01, M_EQ, ", 50 MHz refresh" },
768 { 0x57, 0x07, 0x02, M_EQ, ", 60 MHz refresh" },
769 { 0x57, 0x07, 0x03, M_EQ, ", 66 MHz refresh" },
770
771 /* DRAMT = DRAM Timing Register */
772 { 0x00, 0x00, 0x00, M_TR, "\n\tRead burst timing: " },
773 { 0x58, 0x60, 0x00, M_EQ, "x-4-4-4/x-4-4-4" },
774 { 0x58, 0x60, 0x20, M_EQ, "x-3-3-3/x-4-4-4" },
775 { 0x58, 0x60, 0x40, M_EQ, "x-2-2-2/x-3-3-3" },
776 { 0x58, 0x60, 0x60, M_EQ, "???" },
777 { 0x00, 0x00, 0x00, M_TR, "\n\tWrite burst timing: " },
778 { 0x58, 0x18, 0x00, M_EQ, "x-4-4-4" },
779 { 0x58, 0x18, 0x08, M_EQ, "x-3-3-3" },
780 { 0x58, 0x18, 0x10, M_EQ, "x-2-2-2" },
781 { 0x58, 0x18, 0x18, M_EQ, "???" },
782 { 0x00, 0x00, 0x00, M_TR, "\n\tRAS-CAS delay: " },
783 { 0x58, 0x04, 0x00, M_EQ, "3" },
784 { 0x58, 0x04, 0x04, M_EQ, "2" },
785 { 0x00, 0x00, 0x00, M_TR, " clocks\n" },
786
787 /* end marker */
788 { 0 }
789 };
790
791 static const struct condmsg conf82371fb[] =
792 {
793 /* IORT -- ISA I/O Recovery Timer Register */
794 { 0x00, 0x00, 0x00, M_TR, "\tI/O Recovery Timing: 8-bit " },
795 { 0x4c, 0x40, 0x00, M_EQ, "3.5" },
796 { 0x4c, 0x78, 0x48, M_EQ, "1" },
797 { 0x4c, 0x78, 0x50, M_EQ, "2" },
798 { 0x4c, 0x78, 0x58, M_EQ, "3" },
799 { 0x4c, 0x78, 0x60, M_EQ, "4" },
800 { 0x4c, 0x78, 0x68, M_EQ, "5" },
801 { 0x4c, 0x78, 0x70, M_EQ, "6" },
802 { 0x4c, 0x78, 0x78, M_EQ, "7" },
803 { 0x4c, 0x78, 0x40, M_EQ, "8" },
804 { 0x00, 0x00, 0x00, M_TR, " clocks, 16-bit " },
805 { 0x4c, 0x04, 0x00, M_EQ, "3.5" },
806 { 0x4c, 0x07, 0x05, M_EQ, "1" },
807 { 0x4c, 0x07, 0x06, M_EQ, "2" },
808 { 0x4c, 0x07, 0x07, M_EQ, "3" },
809 { 0x4c, 0x07, 0x04, M_EQ, "4" },
810 { 0x00, 0x00, 0x00, M_TR, " clocks\n" },
811
812 /* XBCS -- X-Bus Chip Select Register */
813 { 0x00, 0x00, 0x00, M_TR, "\tExtended BIOS: " },
814 { 0x4e, 0x80, 0x80, M_EN, 0 },
815 { 0x00, 0x00, 0x00, M_TR, "\n\tLower BIOS: " },
816 { 0x4e, 0x40, 0x40, M_EN, 0 },
817 { 0x00, 0x00, 0x00, M_TR, "\n\tCoprocessor IRQ13: " },
818 { 0x4e, 0x20, 0x20, M_EN, 0 },
819 { 0x00, 0x00, 0x00, M_TR, "\n\tMouse IRQ12: " },
820 { 0x4e, 0x10, 0x10, M_EN, 0 },
821 { 0x00, 0x00, 0x00, M_TR, "\n" },
822
823 { 0x00, 0x00, 0x00, M_TR, "\tInterrupt Routing: " },
824 #define PIRQ(x, n) \
825 { 0x00, 0x00, 0x00, M_TR, n ": " }, \
826 { x, 0x80, 0x80, M_EQ, "disabled" }, \
827 { x, 0xc0, 0x40, M_EQ, "[shared] " }, \
828 { x, 0x8f, 0x03, M_EQ, "IRQ3" }, \
829 { x, 0x8f, 0x04, M_EQ, "IRQ4" }, \
830 { x, 0x8f, 0x05, M_EQ, "IRQ5" }, \
831 { x, 0x8f, 0x06, M_EQ, "IRQ6" }, \
832 { x, 0x8f, 0x07, M_EQ, "IRQ7" }, \
833 { x, 0x8f, 0x09, M_EQ, "IRQ9" }, \
834 { x, 0x8f, 0x0a, M_EQ, "IRQ10" }, \
835 { x, 0x8f, 0x0b, M_EQ, "IRQ11" }, \
836 { x, 0x8f, 0x0c, M_EQ, "IRQ12" }, \
837 { x, 0x8f, 0x0e, M_EQ, "IRQ14" }, \
838 { x, 0x8f, 0x0f, M_EQ, "IRQ15" }
839
840 /* Interrupt routing */
841 PIRQ(0x60, "A"),
842 PIRQ(0x61, ", B"),
843 PIRQ(0x62, ", C"),
844 PIRQ(0x63, ", D"),
845 PIRQ(0x70, "\n\t\tMB0"),
846 PIRQ(0x71, ", MB1"),
847
848 { 0x00, 0x00, 0x00, M_TR, "\n" },
849
850 #undef PIRQ
851
852 /* XXX - do DMA routing, too? */
853 { 0 }
854 };
855
856 static const struct condmsg conf82371fb2[] =
857 {
858 /* IDETM -- IDE Timing Register */
859 { 0x00, 0x00, 0x00, M_TR, "\tPrimary IDE: " },
860 { 0x41, 0x80, 0x80, M_EN, 0 },
861 { 0x00, 0x00, 0x00, M_TR, "\n\tSecondary IDE: " },
862 { 0x43, 0x80, 0x80, M_EN, 0 },
863 { 0x00, 0x00, 0x00, M_TR, "\n" },
864
865 /* end of list */
866 { 0 }
867 };
868
869 static char confread (pcici_t config_id, int port)
870 {
871 unsigned long portw = port & ~3;
872 unsigned long ports = (port - portw) << 3;
873
874 unsigned long l = pci_conf_read (config_id, portw);
875 return (l >> ports);
876 }
877
878 static void
879 writeconfig (pcici_t config_id, const struct condmsg *tbl)
880 {
881 while (tbl->flags != M_XX) {
882 const char *text = 0;
883
884 if (tbl->flags == M_TR) {
885 text = tbl->text;
886 } else {
887 unsigned char v = (unsigned char) confread(config_id, tbl->port);
888 switch (tbl->flags) {
889 case M_EQ:
890 if ((v & tbl->mask) == tbl->value) text = tbl->text;
891 break;
892 case M_NE:
893 if ((v & tbl->mask) != tbl->value) text = tbl->text;
894 break;
895 case M_EN:
896 text = (v & tbl->mask) ? "enabled" : "disabled";
897 break;
898 case M_NN:
899 text = (v & tbl->mask) ? "disabled" : "enabled";
900 }
901 }
902 if (text) printf ("%s", text);
903 tbl++;
904 }
905 }
906
907 #ifdef DUMPCONFIGSPACE
908 static void
909 dumpconfigspace (pcici_t tag)
910 {
911 int reg;
912 printf ("configuration space registers:");
913 for (reg = 0; reg < 0x100; reg+=4) {
914 if ((reg & 0x0f) == 0)
915 printf ("\n%02x:\t", reg);
916 printf ("%08x ", pci_conf_read (tag, reg));
917 }
918 printf ("\n");
919 }
920 #endif /* DUMPCONFIGSPACE */
921
922 #endif /* PCI_QUIET */
923
924 static void
925 chipset_attach (pcici_t config_id, int unit)
926 {
927 #ifndef PCI_QUIET
928 if (!bootverbose)
929 return;
930
931 switch (pci_conf_read (config_id, PCI_ID_REG)) {
932 case 0x04868086:
933 writeconfig (config_id, conf82425ex);
934 break;
935 case 0x04838086:
936 writeconfig (config_id, conf82424zx);
937 break;
938 case 0x04a38086:
939 writeconfig (config_id, conf82434lx);
940 break;
941 case 0x04848086:
942 writeconfig (config_id, conf82378);
943 break;
944 case 0x122d8086:
945 writeconfig (config_id, conf82437fx);
946 break;
947 case 0x70308086:
948 writeconfig (config_id, conf82437vx);
949 break;
950 case 0x70008086:
951 case 0x122e8086:
952 writeconfig (config_id, conf82371fb);
953 break;
954 case 0x70108086:
955 case 0x12308086:
956 writeconfig (config_id, conf82371fb2);
957 break;
958 #if 0
959 case 0x00011011: /* DEC 21050 */
960 case 0x00221014: /* IBM xxx */
961 writeconfig (config_id, conf_pci2pci);
962 break;
963 #endif
964 };
965 #endif /* PCI_QUIET */
966 }
967
968 /*---------------------------------------------------------
969 **
970 ** Catchall driver for VGA devices
971 **
972 ** By Garrett Wollman
973 ** <wollman@halloran-eldar.lcs.mit.edu>
974 **
975 **---------------------------------------------------------
976 */
977
978 static const char* vga_probe (pcici_t tag, pcidi_t type);
979 static void vga_attach (pcici_t tag, int unit);
980 static u_long vga_count;
981
982 static struct pci_device vga_device = {
983 "vga",
984 vga_probe,
985 vga_attach,
986 &vga_count,
987 NULL
988 };
989
990 DATA_SET (pcidevice_set, vga_device);
991
992 static const char* vga_probe (pcici_t tag, pcidi_t typea)
993 {
994 int data = pci_conf_read(tag, PCI_CLASS_REG);
995 u_int id = pci_conf_read(tag, PCI_ID_REG);
996 const char *vendor, *chip, *type;
997
998 vendor = chip = type = 0;
999
1000 switch (id & 0xffff) {
1001 case 0x10c8:
1002 vendor = "NeoMagic";
1003 switch (id >> 16) {
1004 case 0x0004:
1005 chip = "NM2160 laptop"; break;
1006 }
1007 break;
1008 case 0x121a:
1009 vendor = "3Dfx";
1010 type = "graphics accelerator";
1011 switch (id >> 16) {
1012 case 0x0003:
1013 chip = "Voodoo Banshee"; break;
1014 case 0x0005:
1015 chip = "Voodoo 3"; break;
1016 }
1017 break;
1018 case 0x102b:
1019 vendor = "Matrox";
1020 type = "graphics accelerator";
1021 switch (id >> 16) {
1022 case 0x0518:
1023 chip = "MGA 2085PX"; break;
1024 case 0x0519:
1025 chip = "MGA 2064W"; break;
1026 case 0x051a:
1027 chip = "MGA 1024SG/1064SG/1164SG"; break;
1028 case 0x051b:
1029 chip = "MGA 2164W"; break;
1030 }
1031 break;
1032
1033 case 0x1002:
1034 vendor = "ATI";
1035 type = "graphics accelerator";
1036 switch (id >> 16) {
1037 case 0x4158:
1038 chip = "Mach32"; break;
1039 case 0x4758:
1040 chip = "Mach64-GX"; break;
1041 case 0x4358:
1042 chip = "Mach64-CX"; break;
1043 case 0x4354:
1044 chip = "Mach64-CT"; break;
1045 case 0x4554:
1046 chip = "Mach64-ET"; break;
1047 case 0x5654:
1048 chip = "Mach64-VT"; break;
1049 case 0x4754:
1050 chip = "Mach64-GT"; break;
1051 }
1052 break;
1053 case 0x1005:
1054 vendor = "Avance Logic";
1055 switch (id >> 16) {
1056 case 0x2301:
1057 chip = "ALG2301"; break;
1058 }
1059 break;
1060 case 0x100c:
1061 vendor = "Tseng Labs";
1062 type = "graphics accelerator";
1063 switch (id >> 16) {
1064 case 0x3202:
1065 case 0x3205:
1066 case 0x3206:
1067 case 0x3207:
1068 chip = "ET4000 W32P"; break;
1069 case 0x3208:
1070 chip = "ET6000"; break;
1071 case 0x4702:
1072 chip = "ET6300"; break;
1073 }
1074 break;
1075 case 0x100e:
1076 vendor = "Weitek";
1077 type = "graphics accelerator";
1078 switch (id >> 16) {
1079 case 0x9001:
1080 chip = "P9000"; break;
1081 case 0x9100:
1082 chip = "P9100"; break;
1083 }
1084 break;
1085 case 0x1013:
1086 vendor = "Cirrus Logic";
1087 switch (id >> 16) {
1088 case 0x0038:
1089 chip = "GD7548"; break;
1090 case 0x00a0:
1091 chip = "GD5430"; break;
1092 case 0x00a4:
1093 case 0x00a8:
1094 chip = "GD5434"; break;
1095 case 0x00ac:
1096 chip = "GD5436"; break;
1097 case 0x00b8:
1098 chip = "GD5446"; break;
1099 case 0x00d0:
1100 chip = "GD5462"; break;
1101 case 0x00d4:
1102 chip = "GD5464"; break;
1103 case 0x1200:
1104 chip = "GD7542"; break;
1105 case 0x1202:
1106 chip = "GD7543"; break;
1107 case 0x1204:
1108 chip = "GD7541"; break;
1109 }
1110 break;
1111 case 0x1023:
1112 vendor = "Trident";
1113 break; /* let default deal with it */
1114 case 0x102c:
1115 vendor = "Chips & Technologies";
1116 if ((id >> 16) == 0x00d8)
1117 chip = "65545";
1118 break;
1119 case 0x1033:
1120 vendor = "NEC";
1121 switch (id >> 16) {
1122 case 0x0009:
1123 type = "PCI to PC-98 Core Graph bridge";
1124 break;
1125 }
1126 break;
1127 case 0x1039:
1128 vendor = "SiS";
1129 switch (id >> 16) {
1130 case 0x0001:
1131 chip = "86c201"; break;
1132 case 0x0002:
1133 chip = "86c202"; break;
1134 case 0x0205:
1135 chip = "86c205"; break;
1136 }
1137 break;
1138 case 0x105d:
1139 vendor = "Number Nine";
1140 type = "graphics accelerator";
1141 switch (id >> 16) {
1142 case 0x2309:
1143 case 0x2339:
1144 chip = "Imagine 128"; break;
1145 }
1146 break;
1147 case 0x1142:
1148 vendor = "Alliance";
1149 switch (id >> 16) {
1150 case 0x3210:
1151 chip = "PM6410"; break;
1152 case 0x6422:
1153 chip = "PM6422"; break;
1154 case 0x6424:
1155 chip = "PMAT24"; break;
1156 }
1157 break;
1158 case 0x1236:
1159 vendor = "Sigma Designs";
1160 if ((id >> 16) == 0x6401)
1161 chip = "64GX";
1162 break;
1163 case 0x5333:
1164 vendor = "S3";
1165 type = "graphics accelerator";
1166 switch (id >> 16) {
1167 case 0x8811:
1168 chip = "Trio"; break;
1169 case 0x8812:
1170 chip = "Aurora 64"; break;
1171 case 0x8814:
1172 case 0x8901:
1173 chip = "Trio 64"; break;
1174 case 0x8902:
1175 chip = "Plato"; break;
1176 case 0x8880:
1177 chip = "868"; break;
1178 case 0x88b0:
1179 chip = "928"; break;
1180 case 0x88c0:
1181 case 0x88c1:
1182 chip = "864"; break;
1183 case 0x88d0:
1184 case 0x88d1:
1185 chip = "964"; break;
1186 case 0x88f0:
1187 chip = "968"; break;
1188 case 0x5631:
1189 chip = "ViRGE"; break;
1190 case 0x883d:
1191 chip = "ViRGE VX"; break;
1192 case 0x8a01:
1193 chip = "ViRGE DX/GX"; break;
1194 }
1195 break;
1196 case 0xedd8:
1197 vendor = "ARK Logic";
1198 switch (id >> 16) {
1199 case 0xa091:
1200 chip = "1000PV"; break;
1201 case 0xa099:
1202 chip = "2000PV"; break;
1203 case 0xa0a1:
1204 chip = "2000MT"; break;
1205 case 0xa0a9:
1206 chip = "2000MI"; break;
1207 }
1208 break;
1209 case 0x3d3d:
1210 vendor = "3D Labs";
1211 type = "graphics accelerator";
1212 switch (id >> 16) {
1213 case 0x0001:
1214 chip = "300SX"; break;
1215 case 0x0002:
1216 chip = "500TX"; break;
1217 case 0x0003:
1218 chip = "Delta"; break;
1219 case 0x0004:
1220 chip = "PerMedia"; break;
1221 }
1222 break;
1223 }
1224
1225 if (vendor && chip) {
1226 char *buf;
1227 int len;
1228
1229 if (type == 0) {
1230 type = "SVGA controller";
1231 }
1232
1233 len = strlen(vendor) + strlen(chip) + strlen(type) + 4;
1234 MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
1235 if (buf)
1236 sprintf(buf, "%s %s %s", vendor, chip, type);
1237 return buf;
1238 }
1239
1240 switch (data & PCI_CLASS_MASK) {
1241
1242 case PCI_CLASS_PREHISTORIC:
1243 if ((data & PCI_SUBCLASS_MASK)
1244 != PCI_SUBCLASS_PREHISTORIC_VGA)
1245 return 0;
1246 if (type == 0)
1247 type = "VGA-compatible display device";
1248 break;
1249
1250 case PCI_CLASS_DISPLAY:
1251 if (type == 0) {
1252 if ((data & PCI_SUBCLASS_MASK)
1253 == PCI_SUBCLASS_DISPLAY_VGA)
1254 type = "VGA-compatible display device";
1255 else {
1256 /*
1257 * If it isn't a vga display device,
1258 * don't pretend we found one.
1259 */
1260 type = "Display device";
1261 return 0;
1262 }
1263 }
1264 break;
1265
1266 default:
1267 return 0;
1268 };
1269 /*
1270 * If we got here, we know for sure it's some sort of display
1271 * device, but we weren't able to identify it specifically.
1272 * At a minimum we can return the type, but we'd like to
1273 * identify the vendor and chip ID if at all possible.
1274 * (Some of the checks above intentionally don't bother for
1275 * vendors where we know the chip ID is the same as the
1276 * model number.)
1277 */
1278 if (vendor) {
1279 char *buf;
1280 int len;
1281
1282 len = strlen(vendor) + strlen(type) + 2 + 6 + 4 + 1;
1283 MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
1284 if (buf)
1285 sprintf(buf, "%s model %04x %s", vendor, id >> 16, type);
1286 return buf;
1287 }
1288 return type;
1289 }
1290
1291 static void vga_attach (pcici_t tag, int unit)
1292 {
1293 /*
1294 ** If the assigned addresses are remapped,
1295 ** the console driver has to be informed about the new address.
1296 */
1297 #if 0
1298 vm_offset_t va;
1299 vm_offset_t pa;
1300 int reg;
1301 for (reg = PCI_MAP_REG_START; reg < PCI_MAP_REG_END; reg += 4)
1302 (void) pci_map_mem (tag, reg, &va, &pa);
1303 #endif
1304 }
1305
1306 /*---------------------------------------------------------
1307 **
1308 ** Hook for loadable pci drivers
1309 **
1310 **---------------------------------------------------------
1311 */
1312
1313 static const char* lkm_probe (pcici_t tag, pcidi_t type);
1314 static void lkm_attach (pcici_t tag, int unit);
1315 static u_long lkm_count;
1316
1317 static struct pci_device lkm_device = {
1318 "lkm",
1319 lkm_probe,
1320 lkm_attach,
1321 &lkm_count,
1322 NULL
1323 };
1324
1325 DATA_SET (pcidevice_set, lkm_device);
1326
1327 static const char*
1328 lkm_probe (pcici_t tag, pcidi_t type)
1329 {
1330 /*
1331 ** Not yet!
1332 ** (Should try to load a matching driver)
1333 */
1334 return ((char*)0);
1335 }
1336
1337 static void
1338 lkm_attach (pcici_t tag, int unit)
1339 {}
1340
1341 /*---------------------------------------------------------
1342 **
1343 ** Devices to ignore
1344 **
1345 **---------------------------------------------------------
1346 */
1347
1348 static const char* ign_probe (pcici_t tag, pcidi_t type);
1349 static void ign_attach (pcici_t tag, int unit);
1350 static u_long ign_count;
1351
1352 static struct pci_device ign_device = {
1353 NULL,
1354 ign_probe,
1355 ign_attach,
1356 &ign_count,
1357 NULL
1358 };
1359
1360 DATA_SET (pcidevice_set, ign_device);
1361
1362 static const char*
1363 ign_probe (pcici_t tag, pcidi_t type)
1364 {
1365 switch (type) {
1366
1367 case 0x10001042ul: /* wd */
1368 return ("");
1369 /* return ("SMC FDC 37c665");*/
1370 };
1371 return ((char*)0);
1372 }
1373
1374 static void
1375 ign_attach (pcici_t tag, int unit)
1376 {}
Cache object: 0cbda66a1a3378bc66075d87d0cd774a
|