Bring in fixes for a bug which occurs when the filesystem become fulls.
[dragonfly.git] / sys / bus / pci / pcisupport.c
blob21eeae9556fcce35e28673bb42a198765e5936a5
1 /**************************************************************************
2 **
3 ** $FreeBSD: src/sys/pci/pcisupport.c,v 1.154.2.15 2003/04/29 15:55:06 simokawa Exp $
4 ** $DragonFly: src/sys/bus/pci/pcisupport.c,v 1.20 2006/12/22 23:12:17 swildner Exp $
5 **
6 ** Device driver for DEC/INTEL PCI chipsets.
7 **
8 ** FreeBSD
9 **
10 **-------------------------------------------------------------------------
12 ** Written for FreeBSD by
13 ** wolf@cologne.de Wolfgang Stanglmeier
14 ** se@mi.Uni-Koeln.de Stefan Esser
16 **-------------------------------------------------------------------------
18 ** Copyright (c) 1994,1995 Stefan Esser. All rights reserved.
20 ** Redistribution and use in source and binary forms, with or without
21 ** modification, are permitted provided that the following conditions
22 ** are met:
23 ** 1. Redistributions of source code must retain the above copyright
24 ** notice, this list of conditions and the following disclaimer.
25 ** 2. Redistributions in binary form must reproduce the above copyright
26 ** notice, this list of conditions and the following disclaimer in the
27 ** documentation and/or other materials provided with the distribution.
28 ** 3. The name of the author may not be used to endorse or promote products
29 ** derived from this software without specific prior written permission.
31 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
32 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
33 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
35 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
40 ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 ***************************************************************************
45 #include "opt_bus.h"
46 #include "opt_pci.h"
48 #include <sys/param.h>
49 #include <sys/systm.h>
50 #include <sys/malloc.h>
51 #include <sys/kernel.h>
52 #include <sys/bus.h>
53 #include <sys/rman.h>
55 #include "pcivar.h"
56 #include "pcireg.h"
58 #include <vm/vm.h>
59 #include <vm/vm_object.h>
60 #include <vm/pmap.h>
62 #include "pcib_if.h"
63 #include "pcib_private.h"
65 /*---------------------------------------------------------
67 ** Intel chipsets for 486 / Pentium processor
69 **---------------------------------------------------------
72 static void
73 fixbushigh_i1225(device_t dev)
75 int sublementarybus;
77 sublementarybus = pci_read_config(dev, 0x41, 1);
78 if (sublementarybus != 0xff) {
79 pci_set_secondarybus(dev, sublementarybus + 1);
80 pci_set_subordinatebus(dev, sublementarybus + 1);
84 static void
85 fixwsc_natoma(device_t dev)
87 int pmccfg;
89 pmccfg = pci_read_config(dev, 0x50, 2);
90 #if defined(SMP)
91 if (pmccfg & 0x8000) {
92 kprintf("Correcting Natoma config for SMP\n");
93 pmccfg &= ~0x8000;
94 pci_write_config(dev, 0x50, pmccfg, 2);
96 #else
97 if ((pmccfg & 0x8000) == 0) {
98 kprintf("Correcting Natoma config for non-SMP\n");
99 pmccfg |= 0x8000;
100 pci_write_config(dev, 0x50, pmccfg, 2);
102 #endif
105 const char *
106 pci_bridge_type(device_t dev)
108 char *descr, tmpbuf[120];
110 if (pci_get_class(dev) != PCIC_BRIDGE)
111 return NULL;
113 switch (pci_get_subclass(dev)) {
114 case PCIS_BRIDGE_HOST: strcpy(tmpbuf, "Host to PCI"); break;
115 case PCIS_BRIDGE_ISA: strcpy(tmpbuf, "PCI to ISA"); break;
116 case PCIS_BRIDGE_EISA: strcpy(tmpbuf, "PCI to EISA"); break;
117 case PCIS_BRIDGE_MCA: strcpy(tmpbuf, "PCI to MCA"); break;
118 case PCIS_BRIDGE_PCI: strcpy(tmpbuf, "PCI to PCI"); break;
119 case PCIS_BRIDGE_PCMCIA: strcpy(tmpbuf, "PCI to PCMCIA"); break;
120 case PCIS_BRIDGE_NUBUS: strcpy(tmpbuf, "PCI to NUBUS"); break;
121 case PCIS_BRIDGE_CARDBUS: strcpy(tmpbuf, "PCI to CardBus"); break;
122 case PCIS_BRIDGE_OTHER: strcpy(tmpbuf, "PCI to Other"); break;
123 default:
124 ksnprintf(tmpbuf, sizeof(tmpbuf),
125 "PCI to 0x%x", pci_get_subclass(dev));
126 break;
128 ksnprintf(tmpbuf+strlen(tmpbuf), sizeof(tmpbuf)-strlen(tmpbuf),
129 " bridge (vendor=%04x device=%04x)",
130 pci_get_vendor(dev), pci_get_device(dev));
131 descr = kmalloc (strlen(tmpbuf) +1, M_DEVBUF, M_WAITOK);
132 strcpy(descr, tmpbuf);
133 return descr;
136 const char *
137 pci_usb_match(device_t dev)
139 switch (pci_get_devid(dev)) {
141 /* Intel -- vendor 0x8086 */
142 case 0x70208086:
143 return ("Intel 82371SB (PIIX3) USB controller");
144 case 0x71128086:
145 return ("Intel 82371AB/EB (PIIX4) USB controller");
146 case 0x24128086:
147 return ("Intel 82801AA (ICH) USB controller");
148 case 0x24228086:
149 return ("Intel 82801AB (ICH0) USB controller");
150 case 0x24428086:
151 return ("Intel 82801BA/BAM (ICH2) USB controller USB-A");
152 case 0x24448086:
153 return ("Intel 82801BA/BAM (ICH2) USB controller USB-B");
155 /* VIA Technologies -- vendor 0x1106 (0x1107 on the Apollo Master) */
156 case 0x30381106:
157 return ("VIA 83C572 USB controller");
159 /* AcerLabs -- vendor 0x10b9 */
160 case 0x523710b9:
161 return ("AcerLabs M5237 (Aladdin-V) USB controller");
163 /* OPTi -- vendor 0x1045 */
164 case 0xc8611045:
165 return ("OPTi 82C861 (FireLink) USB controller");
167 /* NEC -- vendor 0x1033 */
168 case 0x00351033:
169 return ("NEC uPD 9210 USB controller");
171 /* CMD Tech -- vendor 0x1095 */
172 case 0x06701095:
173 return ("CMD Tech 670 (USB0670) USB controller");
174 case 0x06731095:
175 return ("CMD Tech 673 (USB0673) USB controller");
178 if (pci_get_class(dev) == PCIC_SERIALBUS
179 && pci_get_subclass(dev) == PCIS_SERIALBUS_USB) {
180 if (pci_get_progif(dev) == 0x00 /* UHCI */ ) {
181 return ("UHCI USB controller");
182 } else if (pci_get_progif(dev) == 0x10 /* OHCI */ ) {
183 return ("OHCI USB controller");
184 } else {
185 return ("USB controller");
188 return NULL;
191 const char *
192 pci_ata_match(device_t dev)
195 switch (pci_get_devid(dev)) {
197 /* Intel -- vendor 0x8086 */
198 case 0x12308086:
199 return ("Intel PIIX ATA controller");
200 case 0x70108086:
201 return ("Intel PIIX3 ATA controller");
202 case 0x71118086:
203 return ("Intel PIIX4 ATA controller");
204 case 0x12348086:
205 return ("Intel 82371MX mobile PCI ATA accelerator (MPIIX)");
207 /* Promise -- vendor 0x105a */
208 case 0x4d33105a:
209 return ("Promise Ultra/33 ATA controller");
210 case 0x4d38105a:
211 return ("Promise Ultra/66 ATA controller");
213 /* AcerLabs -- vendor 0x10b9 */
214 case 0x522910b9:
215 return ("AcerLabs Aladdin ATA controller");
217 /* VIA Technologies -- vendor 0x1106 (0x1107 on the Apollo Master) */
218 case 0x05711106:
219 switch (pci_read_config(dev, 0x08, 1)) {
220 case 1:
221 return ("VIA 85C586 ATA controller");
222 case 6:
223 return ("VIA 85C586 ATA controller");
225 /* FALL THROUGH */
226 case 0x15711106:
227 return ("VIA Apollo ATA controller");
229 /* CMD Tech -- vendor 0x1095 */
230 case 0x06401095:
231 return ("CMD 640 ATA controller");
232 case 0x06461095:
233 return ("CMD 646 ATA controller");
235 /* Cypress -- vendor 0x1080 */
236 case 0xc6931080:
237 return ("Cypress 82C693 ATA controller");
239 /* Cyrix -- vendor 0x1078 */
240 case 0x01021078:
241 return ("Cyrix 5530 ATA controller");
243 /* SiS -- vendor 0x1039 */
244 case 0x55131039:
245 return ("SiS 5591 ATA controller");
247 /* Highpoint tech -- vendor 0x1103 */
248 case 0x00041103:
249 return ("HighPoint HPT366 ATA controller");
252 if (pci_get_class(dev) == PCIC_STORAGE &&
253 pci_get_subclass(dev) == PCIS_STORAGE_IDE)
254 return ("Unknown PCI ATA controller");
256 return NULL;
260 const char*
261 pci_chip_match(device_t dev)
263 unsigned rev;
265 switch (pci_get_devid(dev)) {
266 /* Intel -- vendor 0x8086 */
267 case 0x00088086:
268 /* Silently ignore this one! What is it, anyway ??? */
269 return ("");
270 case 0x71108086:
272 * On my laptop (Tecra 8000DVD), this device has a
273 * bogus subclass 0x80 so make sure that it doesn't
274 * match the generic 'chip' driver by accident.
276 return NULL;
277 case 0x12258086:
278 fixbushigh_i1225(dev);
279 return ("Intel 824?? host to PCI bridge");
280 case 0x71808086:
281 return ("Intel 82443LX (440 LX) host to PCI bridge");
282 case 0x71908086:
283 return ("Intel 82443BX (440 BX) host to PCI bridge");
284 case 0x71928086:
285 return ("Intel 82443BX host to PCI bridge (AGP disabled)");
286 case 0x71a08086:
287 return ("Intel 82443GX host to PCI bridge");
288 case 0x71a18086:
289 return ("Intel 82443GX host to AGP bridge");
290 case 0x71a28086:
291 return ("Intel 82443GX host to PCI bridge (AGP disabled)");
292 case 0x84c48086:
293 return ("Intel 82454KX/GX (Orion) host to PCI bridge");
294 case 0x84ca8086:
295 return ("Intel 82451NX Memory and I/O controller");
296 case 0x04868086:
297 return ("Intel 82425EX PCI system controller");
298 case 0x04838086:
299 return ("Intel 82424ZX (Saturn) cache DRAM controller");
300 case 0x04a38086:
301 rev = pci_get_revid(dev);
302 if (rev == 16 || rev == 17)
303 return ("Intel 82434NX (Neptune) PCI cache memory controller");
304 return ("Intel 82434LX (Mercury) PCI cache memory controller");
305 case 0x122d8086:
306 return ("Intel 82437FX PCI cache memory controller");
307 case 0x12358086:
308 return ("Intel 82437MX mobile PCI cache memory controller");
309 case 0x12508086:
310 return ("Intel 82439HX PCI cache memory controller");
311 case 0x70308086:
312 return ("Intel 82437VX PCI cache memory controller");
313 case 0x71008086:
314 return ("Intel 82439TX System controller (MTXC)");
315 case 0x71138086:
316 return ("Intel 82371AB Power management controller");
317 case 0x719b8086:
318 return ("Intel 82443MX Power management controller");
319 case 0x12378086:
320 fixwsc_natoma(dev);
321 return ("Intel 82440FX (Natoma) PCI and memory controller");
322 case 0x84c58086:
323 return ("Intel 82453KX/GX (Orion) PCI memory controller");
324 case 0x71208086:
325 return ("Intel 82810 (i810 GMCH) Host To Hub bridge");
326 case 0x71228086:
327 return ("Intel 82810-DC100 (i810-DC100 GMCH) Host To Hub bridge");
328 case 0x71248086:
329 return ("Intel 82810E (i810E GMCH) Host To Hub bridge");
330 case 0x24158086:
331 return ("Intel 82801AA (ICH) AC'97 Audio Controller");
332 case 0x24258086:
333 return ("Intel 82801AB (ICH0) AC'97 Audio Controller");
335 /* Sony -- vendor 0x104d */
336 case 0x8009104d:
337 return ("Sony CXD1947A FireWire Host Controller");
339 /* SiS -- vendor 0x1039 */
340 case 0x04961039:
341 return ("SiS 85c496 PCI/VL Bridge");
342 case 0x04061039:
343 return ("SiS 85c501");
344 case 0x06011039:
345 return ("SiS 85c601");
346 case 0x55911039:
347 return ("SiS 5591 host to PCI bridge");
348 case 0x00011039:
349 return ("SiS 5591 host to AGP bridge");
351 /* VLSI -- vendor 0x1004 */
352 case 0x00051004:
353 return ("VLSI 82C592 Host to PCI bridge");
354 case 0x01011004:
355 return ("VLSI 82C532 Eagle II Peripheral controller");
356 case 0x01041004:
357 return ("VLSI 82C535 Eagle II System controller");
358 case 0x01051004:
359 return ("VLSI 82C147 IrDA controller");
361 /* VIA Technologies -- vendor 0x1106 (0x1107 on the Apollo Master) */
362 case 0x15761107:
363 return ("VIA 82C570 (Apollo Master) system controller");
364 case 0x05851106:
365 return ("VIA 82C585 (Apollo VP1/VPX) system controller");
366 case 0x05951106:
367 case 0x15951106:
368 return ("VIA 82C595 (Apollo VP2) system controller");
369 case 0x05971106:
370 return ("VIA 82C597 (Apollo VP3) system controller");
371 /* XXX Here is MVP3, I got the datasheet but NO M/B to test it */
372 /* totally. Please let me know if anything wrong. -F */
373 /* XXX need info on the MVP3 -- any takers? */
374 case 0x05981106:
375 return ("VIA 82C598MVP (Apollo MVP3) host bridge");
376 case 0x30401106:
377 case 0x30501106:
378 case 0x30571106:
379 return NULL;
380 case 0x30581106:
381 return ("VIA 82C686 AC97 Audio");
382 case 0x30681106:
383 return ("VIA 82C686 AC97 Modem");
385 /* AMD -- vendor 0x1022 */
386 case 0x70061022:
387 return ("AMD-751 host to PCI bridge");
388 case 0x700e1022:
389 return ("AMD-761 host to PCI bridge");
391 /* AcerLabs -- vendor 0x10b9 */
392 /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */
393 /* id is '10b9" but the register always shows "10b9". -Foxfair */
394 case 0x154110b9:
395 return ("AcerLabs M1541 (Aladdin-V) PCI host bridge");
396 case 0x710110b9:
397 return ("AcerLabs M15x3 Power Management Unit");
399 /* OPTi -- vendor 0x1045 */
400 case 0xc5571045:
401 return ("Opti 82C557 (Viper-M) host to PCI bridge");
402 case 0xc5581045:
403 return ("Opti 82C558 (Viper-M) ISA+IDE");
404 case 0xc8221045:
405 return ("OPTi 82C822 host to PCI Bridge");
407 /* Texas Instruments -- vendor 0x104c */
408 case 0xac1c104c:
409 return ("Texas Instruments PCI1225 CardBus controller");
410 case 0xac50104c:
411 return ("Texas Instruments PCI1410 CardBus controller");
412 case 0xac51104c:
413 return ("Texas Instruments PCI1420 CardBus controller");
414 case 0xac1b104c:
415 return ("Texas Instruments PCI1450 CardBus controller");
416 case 0xac52104c:
417 return ("Texas Instruments PCI1451 CardBus controller");
419 /* NeoMagic -- vendor 0x10c8 */
420 case 0x800510c8:
421 return ("NeoMagic MagicMedia 256AX Audio controller");
422 case 0x800610c8:
423 return ("NeoMagic MagicMedia 256ZX Audio controller");
425 /* ESS Technology Inc -- vendor 0x125d */
426 case 0x1978125d:
427 return ("ESS Technology Maestro 2E Audio controller");
429 /* Toshiba -- vendor 0x1179 */
430 case 0x07011179:
431 return ("Toshiba Fast Infra Red controller");
434 if (pci_get_class(dev) == PCIC_BRIDGE
435 && pci_get_subclass(dev) != PCIS_BRIDGE_PCI
436 && pci_get_subclass(dev) != PCIS_BRIDGE_ISA
437 && pci_get_subclass(dev) != PCIS_BRIDGE_EISA)
438 return pci_bridge_type(dev);
440 return NULL;
443 /*---------------------------------------------------------
445 ** Catchall driver for VGA devices
447 ** By Garrett Wollman
448 ** <wollman@halloran-eldar.lcs.mit.edu>
450 **---------------------------------------------------------
453 const char *
454 pci_vga_match(device_t dev)
456 u_int id = pci_get_devid(dev);
457 const char *vendor, *chip, *type;
459 vendor = chip = type = 0;
460 switch (id & 0xffff) {
461 case 0x003d:
462 vendor = "Real 3D";
463 switch (id >> 16) {
464 case 0x00d1:
465 chip = "i740"; break;
467 break;
468 case 0x10c8:
469 vendor = "NeoMagic";
470 switch (id >> 16) {
471 case 0x0003:
472 chip = "MagicGraph 128ZV"; break;
473 case 0x0004:
474 chip = "MagicGraph 128XD"; break;
475 case 0x0005:
476 chip = "MagicMedia 256AV"; break;
477 case 0x0006:
478 chip = "MagicMedia 256ZX"; break;
480 break;
481 case 0x121a:
482 vendor = "3Dfx";
483 type = "graphics accelerator";
484 switch (id >> 16) {
485 case 0x0001:
486 chip = "Voodoo"; break;
487 case 0x0002:
488 chip = "Voodoo 2"; break;
489 case 0x0003:
490 chip = "Voodoo Banshee"; break;
491 case 0x0005:
492 chip = "Voodoo 3"; break;
494 break;
495 case 0x102b:
496 vendor = "Matrox";
497 type = "graphics accelerator";
498 switch (id >> 16) {
499 case 0x0518:
500 chip = "MGA 2085PX"; break;
501 case 0x0519:
502 chip = "MGA Millennium 2064W"; break;
503 case 0x051a:
504 chip = "MGA 1024SG/1064SG/1164SG"; break;
505 case 0x051b:
506 chip = "MGA Millennium II 2164W"; break;
507 case 0x051f:
508 chip = "MGA Millennium II 2164WA-B AG"; break;
509 case 0x0520:
510 chip = "MGA G200"; break;
511 case 0x0521:
512 chip = "MGA G200 AGP"; break;
513 case 0x0525:
514 chip = "MGA G400 AGP"; break;
515 case 0x0d10:
516 chip = "MGA Impression"; break;
517 case 0x1000:
518 chip = "MGA G100"; break;
519 case 0x1001:
520 chip = "MGA G100 AGP"; break;
521 case 0x2527:
522 chip = "MGA G550 AGP"; break;
525 break;
526 case 0x1002:
527 vendor = "ATI";
528 type = "graphics accelerator";
529 switch (id >> 16) {
530 case 0x4158:
531 chip = "Mach32"; break;
532 case 0x4354:
533 chip = "Mach64-CT"; break;
534 case 0x4358:
535 chip = "Mach64-CX"; break;
536 case 0x4554:
537 chip = "Mach64-ET"; break;
538 case 0x4654:
539 case 0x5654:
540 chip = "Mach64-VT"; break;
541 case 0x4742:
542 chip = "Mach64-GB"; break;
543 case 0x4744:
544 chip = "Mach64-GD"; break;
545 case 0x4749:
546 chip = "Mach64-GI"; break;
547 case 0x474d:
548 chip = "Mach64-GM"; break;
549 case 0x474e:
550 chip = "Mach64-GN"; break;
551 case 0x474f:
552 chip = "Mach64-GO"; break;
553 case 0x4750:
554 chip = "Mach64-GP"; break;
555 case 0x4751:
556 chip = "Mach64-GQ"; break;
557 case 0x4752:
558 chip = "Mach64-GR"; break;
559 case 0x4753:
560 chip = "Mach64-GS"; break;
561 case 0x4754:
562 chip = "Mach64-GT"; break;
563 case 0x4755:
564 chip = "Mach64-GU"; break;
565 case 0x4756:
566 chip = "Mach64-GV"; break;
567 case 0x4757:
568 chip = "Mach64-GW"; break;
569 case 0x4758:
570 chip = "Mach64-GX"; break;
571 case 0x4c4d:
572 chip = "Mobility-1"; break;
573 case 0x4c52:
574 chip = "RageMobility-P/M"; break;
575 case 0x475a:
576 chip = "Mach64-GZ"; break;
577 case 0x5245:
578 chip = "Rage128-RE"; break;
579 case 0x5246:
580 chip = "Rage128-RF"; break;
581 case 0x524b:
582 chip = "Rage128-RK"; break;
583 case 0x524c:
584 chip = "Rage128-RL"; break;
586 break;
587 case 0x1005:
588 vendor = "Avance Logic";
589 switch (id >> 16) {
590 case 0x2301:
591 chip = "ALG2301"; break;
592 case 0x2302:
593 chip = "ALG2302"; break;
595 break;
596 case 0x100c:
597 vendor = "Tseng Labs";
598 type = "graphics accelerator";
599 switch (id >> 16) {
600 case 0x3202:
601 case 0x3205:
602 case 0x3206:
603 case 0x3207:
604 chip = "ET4000 W32P"; break;
605 case 0x3208:
606 chip = "ET6000/ET6100"; break;
607 case 0x4702:
608 chip = "ET6300"; break;
610 break;
611 case 0x100e:
612 vendor = "Weitek";
613 type = "graphics accelerator";
614 switch (id >> 16) {
615 case 0x9001:
616 chip = "P9000"; break;
617 case 0x9100:
618 chip = "P9100"; break;
620 break;
621 case 0x1013:
622 vendor = "Cirrus Logic";
623 switch (id >> 16) {
624 case 0x0038:
625 chip = "GD7548"; break;
626 case 0x0040:
627 chip = "GD7555"; break;
628 case 0x004c:
629 chip = "GD7556"; break;
630 case 0x00a0:
631 chip = "GD5430"; break;
632 case 0x00a4:
633 case 0x00a8:
634 chip = "GD5434"; break;
635 case 0x00ac:
636 chip = "GD5436"; break;
637 case 0x00b8:
638 chip = "GD5446"; break;
639 case 0x00bc:
640 chip = "GD5480"; break;
641 case 0x00d0:
642 chip = "GD5462"; break;
643 case 0x00d4:
644 case 0x00d5:
645 chip = "GD5464"; break;
646 case 0x00d6:
647 chip = "GD5465"; break;
648 case 0x1200:
649 chip = "GD7542"; break;
650 case 0x1202:
651 chip = "GD7543"; break;
652 case 0x1204:
653 chip = "GD7541"; break;
655 break;
656 case 0x1023:
657 vendor = "Trident";
658 break; /* let default deal with it */
659 case 0x102c:
660 vendor = "Chips & Technologies";
661 switch (id >> 16) {
662 case 0x00b8:
663 chip = "64310"; break;
664 case 0x00d8:
665 chip = "65545"; break;
666 case 0x00dc:
667 chip = "65548"; break;
668 case 0x00c0:
669 chip = "69000"; break;
670 case 0x00e0:
671 chip = "65550"; break;
672 case 0x00e4:
673 chip = "65554"; break;
674 case 0x00e5:
675 chip = "65555"; break;
676 case 0x00f4:
677 chip = "68554"; break;
679 break;
680 case 0x1039:
681 vendor = "SiS";
682 switch (id >> 16) {
683 case 0x0001:
684 chip = "86c201"; break;
685 case 0x0002:
686 chip = "86c202"; break;
687 case 0x0205:
688 chip = "86c205"; break;
689 case 0x0215:
690 chip = "86c215"; break;
691 case 0x0225:
692 chip = "86c225"; break;
693 case 0x0200:
694 chip = "5597/98"; break;
695 case 0x6326:
696 chip = "6326"; break;
697 case 0x6306:
698 chip = "530/620"; break;
700 break;
701 case 0x105d:
702 vendor = "Number Nine";
703 type = "graphics accelerator";
704 switch (id >> 16) {
705 case 0x2309:
706 chip = "Imagine 128"; break;
707 case 0x2339:
708 chip = "Imagine 128 II"; break;
710 break;
711 case 0x1142:
712 vendor = "Alliance";
713 switch (id >> 16) {
714 case 0x3210:
715 chip = "PM6410"; break;
716 case 0x6422:
717 chip = "PM6422"; break;
718 case 0x6424:
719 chip = "PMAT24"; break;
721 break;
722 case 0x1163:
723 vendor = "Rendition Verite";
724 switch (id >> 16) {
725 case 0x0001:
726 chip = "V1000"; break;
727 case 0x2000:
728 chip = "V2000"; break;
730 break;
731 case 0x1236:
732 vendor = "Sigma Designs";
733 if ((id >> 16) == 0x6401)
734 chip = "REALmagic64/GX";
735 break;
736 case 0x5333:
737 vendor = "S3";
738 type = "graphics accelerator";
739 switch (id >> 16) {
740 case 0x8811:
741 chip = "Trio"; break;
742 case 0x8812:
743 chip = "Aurora 64"; break;
744 case 0x8814:
745 chip = "Trio 64UV+"; break;
746 case 0x8901:
747 chip = "Trio 64V2/DX/GX"; break;
748 case 0x8902:
749 chip = "Plato"; break;
750 case 0x8904:
751 chip = "Trio3D"; break;
752 case 0x8880:
753 chip = "868"; break;
754 case 0x88b0:
755 chip = "928"; break;
756 case 0x88c0:
757 case 0x88c1:
758 chip = "864"; break;
759 case 0x88d0:
760 case 0x88d1:
761 chip = "964"; break;
762 case 0x88f0:
763 chip = "968"; break;
764 case 0x5631:
765 chip = "ViRGE"; break;
766 case 0x883d:
767 chip = "ViRGE VX"; break;
768 case 0x8a01:
769 chip = "ViRGE DX/GX"; break;
770 case 0x8a10:
771 chip = "ViRGE GX2"; break;
772 case 0x8a13:
773 chip = "Trio3D/2X"; break;
774 case 0x8a20:
775 case 0x8a21:
776 chip = "Savage3D"; break;
777 case 0x8a22:
778 chip = "Savage 4"; break;
779 case 0x8c01:
780 chip = "ViRGE MX"; break;
781 case 0x8c03:
782 chip = "ViRGE MX+"; break;
784 break;
785 case 0xedd8:
786 vendor = "ARK Logic";
787 switch (id >> 16) {
788 case 0xa091:
789 chip = "1000PV"; break;
790 case 0xa099:
791 chip = "2000PV"; break;
792 case 0xa0a1:
793 chip = "2000MT"; break;
794 case 0xa0a9:
795 chip = "2000MI"; break;
797 break;
798 case 0x3d3d:
799 vendor = "3D Labs";
800 type = "graphics accelerator";
801 switch (id >> 16) {
802 case 0x0001:
803 chip = "300SX"; break;
804 case 0x0002:
805 chip = "500TX"; break;
806 case 0x0003:
807 chip = "Delta"; break;
808 case 0x0004:
809 chip = "PerMedia"; break;
811 break;
812 case 0x10de:
813 vendor = "NVidia";
814 type = "graphics accelerator";
815 switch (id >> 16) {
816 case 0x0008:
817 chip = "NV1"; break;
818 case 0x0020:
819 chip = "Riva TNT"; break;
820 case 0x0028:
821 chip = "Riva TNT2"; break;
822 case 0x0029:
823 chip = "Riva Ultra TNT2"; break;
824 case 0x002c:
825 chip = "Riva Vanta TNT2"; break;
826 case 0x002d:
827 chip = "Riva Ultra Vanta TNT2"; break;
828 case 0x00a0:
829 chip = "Riva Integrated TNT2"; break;
830 case 0x0100:
831 chip = "GeForce 256"; break;
832 case 0x0101:
833 chip = "GeForce DDR"; break;
834 case 0x0103:
835 chip = "Quadro"; break;
836 case 0x0150:
837 case 0x0151:
838 case 0x0152:
839 chip = "GeForce2 GTS"; break;
840 case 0x0153:
841 chip = "Quadro2"; break;
843 break;
844 case 0x12d2:
845 vendor = "NVidia/SGS-Thomson";
846 type = "graphics accelerator";
847 switch (id >> 16) {
848 case 0x0018:
849 chip = "Riva128"; break;
851 break;
852 case 0x104a:
853 vendor = "SGS-Thomson";
854 switch (id >> 16) {
855 case 0x0008:
856 chip = "STG2000"; break;
858 break;
859 case 0x8086:
860 vendor = "Intel";
861 switch (id >> 16) {
862 case 0x7121:
863 chip = "82810 (i810 GMCH)"; break;
864 case 0x7123:
865 chip = "82810-DC100 (i810-DC100 GMCH)"; break;
866 case 0x7125:
867 chip = "82810E (i810E GMCH)"; break;
868 case 0x7800:
869 chip = "i740 AGP"; break;
871 break;
872 case 0x10ea:
873 vendor = "Intergraphics";
874 switch (id >> 16) {
875 case 0x1680:
876 chip = "IGA-1680"; break;
877 case 0x1682:
878 chip = "IGA-1682"; break;
880 break;
883 if (vendor && chip) {
884 char *buf;
885 int len;
887 if (type == 0)
888 type = "SVGA controller";
890 len = strlen(vendor) + strlen(chip) + strlen(type) + 4;
891 MALLOC(buf, char *, len, M_TEMP, M_WAITOK);
892 ksprintf(buf, "%s %s %s", vendor, chip, type);
893 return buf;
896 switch (pci_get_class(dev)) {
898 case PCIC_OLD:
899 if (pci_get_subclass(dev) != PCIS_OLD_VGA)
900 return 0;
901 if (type == 0)
902 type = "VGA-compatible display device";
903 break;
905 case PCIC_DISPLAY:
906 if (type == 0) {
907 if (pci_get_subclass(dev) == PCIS_DISPLAY_VGA)
908 type = "VGA-compatible display device";
909 else {
911 * If it isn't a vga display device,
912 * don't pretend we found one.
914 return 0;
917 break;
919 default:
920 return 0;
923 * If we got here, we know for sure it's some sort of display
924 * device, but we weren't able to identify it specifically.
925 * At a minimum we can return the type, but we'd like to
926 * identify the vendor and chip ID if at all possible.
927 * (Some of the checks above intentionally don't bother for
928 * vendors where we know the chip ID is the same as the
929 * model number.)
931 if (vendor) {
932 char *buf;
933 int len;
935 len = strlen(vendor) + 7 + 4 + 1 + strlen(type) + 1;
936 MALLOC(buf, char *, len, M_TEMP, M_WAITOK);
937 ksprintf(buf, "%s model %04x %s", vendor, id >> 16, type);
938 return buf;
940 return type;
943 /*---------------------------------------------------------
945 ** Devices to ignore
947 **---------------------------------------------------------
950 static const char*
951 ign_match(device_t dev)
953 switch (pci_get_devid(dev)) {
955 case 0x10001042ul: /* wd */
956 return ("SMC FDC 37c665");
959 return NULL;
962 static int
963 ign_probe(device_t dev)
965 const char *s;
967 s = ign_match(dev);
968 if (s) {
969 device_set_desc(dev, s);
970 device_quiet(dev);
971 return -1000;
973 return ENXIO;
976 static int
977 ign_attach(device_t dev)
979 return 0;
982 static device_method_t ign_methods[] = {
983 /* Device interface */
984 DEVMETHOD(device_probe, ign_probe),
985 DEVMETHOD(device_attach, ign_attach),
987 { 0, 0 }
990 static driver_t ign_driver = {
991 "ign",
992 ign_methods,
996 static devclass_t ign_devclass;
998 DRIVER_MODULE(ign, pci, ign_driver, ign_devclass, 0, 0);