1 /* $OpenBSD: ifb_ident.c,v 1.1 2008/12/29 22:07:35 miod Exp $ */ 2 3 /* 4 * Copyright (c) 2007, 2008 Miodrag Vallat. 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /* 20 * Identify an Expert3D card. 21 * Used by both vgafb and ifb. 22 */ 23 24 #include <sys/param.h> 25 #include <sys/systm.h> 26 #include <sys/device.h> 27 28 #include <machine/autoconf.h> 29 #include <machine/openfirm.h> 30 31 #include <dev/pci/pcireg.h> 32 #include <dev/pci/pcivar.h> 33 #include <dev/pci/pcidevs.h> 34 35 #include <dev/wscons/wsdisplayvar.h> 36 #include <dev/rasops/rasops.h> 37 38 #include <machine/fbvar.h> 39 40 static const struct pci_matchid ifb_devices[] = { 41 { PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_EXPERT3D }, 42 { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_6210 }, 43 { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_5110 },/* Sun XVR-500 */ 44 { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_7210 }, 45 }; 46 47 int 48 ifb_ident(void *aux) 49 { 50 struct pci_attach_args *paa = aux; 51 int node; 52 char *name; 53 54 if (pci_matchbyid(paa, ifb_devices, 55 sizeof(ifb_devices) / sizeof(ifb_devices[0])) != 0) 56 return 1; 57 58 node = PCITAG_NODE(paa->pa_tag); 59 name = getpropstring(node, "name"); 60 if (strcmp(name, "SUNW,Expert3D") == 0 || 61 strcmp(name, "SUNW,Expert3D-Lite") == 0) 62 return 1; 63 64 return 0; 65 } 66