1 /* 2 * Copyright (c) 2008 Owain G. Ainsworth <oga@nicotinebsd.org> 3 * 4 * Permission to use, copy, modify, and distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #include "vga.h" 18 #if defined(__i386__) || defined(__amd64__) 19 #include "acpi.h" 20 #endif 21 22 #include <sys/param.h> 23 #include <sys/systm.h> 24 #include <sys/malloc.h> 25 26 #include <machine/bus.h> 27 28 #include <dev/pci/pcireg.h> 29 #include <dev/pci/pcivar.h> 30 #include <dev/pci/pcidevs.h> 31 32 #include <dev/ic/mc6845reg.h> 33 #include <dev/ic/pcdisplayvar.h> 34 #include <dev/ic/vgareg.h> 35 36 #include <dev/wscons/wsdisplayvar.h> 37 #include <dev/ic/vgavar.h> 38 #include <dev/pci/vga_pcivar.h> 39 40 #include <dev/pci/drm/i915/i915_devlist.h> 41 #include <dev/pci/drm/radeon/radeon_devlist.h> 42 43 #ifdef RAMDISK_HOOKS 44 static const struct pci_matchid aperture_blacklist[] = { 45 /* server adapters found in mga200 drm driver */ 46 { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200E_SE }, 47 { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200E_SE_B }, 48 { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EH }, 49 { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200ER }, 50 { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EV }, 51 { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EW }, 52 53 /* server adapters found in ast drm driver */ 54 { PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST2000 }, 55 { PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST2100 }, 56 57 /* ati adapters found in servers */ 58 { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGEXL }, 59 { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_ES1000 }, 60 61 /* xgi found in some poweredges/supermicros/tyans */ 62 { PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z7 }, 63 { PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z9 }, 64 }; 65 66 int 67 vga_aperture_needed(struct pci_attach_args *pa) 68 { 69 #if defined(__i386__) || defined(__amd64__) || \ 70 defined(__sparc64__) || defined(__macppc__) 71 if (pci_matchbyid(pa, i915_devices, nitems(i915_devices)) || 72 pci_matchbyid(pa, radeon_devices, nitems(radeon_devices)) || 73 pci_matchbyid(pa, aperture_blacklist, nitems(aperture_blacklist))) 74 return (0); 75 #endif 76 return (1); 77 } 78 #endif /* RAMDISK_HOOKS */ 79