summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-12-29 22:07:36 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-12-29 22:07:36 +0000
commit6cf412815cc5de091b6398fe891cff923cbdafed (patch)
tree94a06ca9c146dec73e87cd4d6e02ffb12e229a73
parent3c442b8516cef6bae47d46af74f117104b33ef7c (diff)
Move ifb identification to its own routine. We can not simply have the ifb
probe win over vgafb, since one may configure a kernel with vgafb but without ifb (especially slackers who forget to rerun config).
-rw-r--r--sys/arch/sparc64/conf/files.sparc649
-rw-r--r--sys/arch/sparc64/dev/ifb.c25
-rw-r--r--sys/arch/sparc64/dev/ifb_ident.c65
-rw-r--r--sys/arch/sparc64/dev/vgafb.c23
-rw-r--r--sys/arch/sparc64/include/fbvar.h4
5 files changed, 80 insertions, 46 deletions
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64
index 7b9bc87419a..aff4ebb7f1a 100644
--- a/sys/arch/sparc64/conf/files.sparc64
+++ b/sys/arch/sparc64/conf/files.sparc64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.sparc64,v 1.111 2008/08/13 19:30:02 kettenis Exp $
+# $OpenBSD: files.sparc64,v 1.112 2008/12/29 22:07:35 miod Exp $
# $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $
# maxpartitions must be first item in files.${ARCH}
@@ -113,11 +113,14 @@ file arch/sparc64/dev/pci_machdep.c psycho | schizo | pyro | vpci
attach hme at pci with hme_pci
file dev/pci/if_hme_pci.c hme_pci
-device vgafb: wsemuldisplaydev, rasops_bswap, rasops8, rasops16, rasops32
+define ifb_ident
+file arch/sparc64/dev/ifb_ident.c ifb_ident
+
+device vgafb: ifb_ident, wsemuldisplaydev, rasops_bswap, rasops8, rasops16, rasops32
attach vgafb at pci
file arch/sparc64/dev/vgafb.c vgafb
-device ifb: wsemuldisplaydev, rasops8
+device ifb: ifb_ident, wsemuldisplaydev, rasops_bswap, rasops8
attach ifb at pci
file arch/sparc64/dev/ifb.c ifb
diff --git a/sys/arch/sparc64/dev/ifb.c b/sys/arch/sparc64/dev/ifb.c
index 2161a4b930a..e5d4bd8bbae 100644
--- a/sys/arch/sparc64/dev/ifb.c
+++ b/sys/arch/sparc64/dev/ifb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifb.c,v 1.9 2008/12/29 21:54:52 miod Exp $ */
+/* $OpenBSD: ifb.c,v 1.10 2008/12/29 22:07:35 miod Exp $ */
/*
* Copyright (c) 2007, 2008 Miodrag Vallat.
@@ -272,31 +272,10 @@ void ifb_copyrows(void *, int, int, int);
void ifb_eraserows(void *, int, int, long);
void ifb_do_cursor(struct rasops_info *);
-const struct pci_matchid ifb_devices[] = {
- { PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_EXPERT3D },
- { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_6210 },
- { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_5110 },/* Sun XVR-500 */
- { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_7210 },
-};
-
int
ifbmatch(struct device *parent, void *cf, void *aux)
{
- struct pci_attach_args *paa = aux;
- int node;
- char *name;
-
- if (pci_matchbyid(paa, ifb_devices,
- sizeof(ifb_devices) / sizeof(ifb_devices[0])) != 0)
- return 1;
-
- node = PCITAG_NODE(paa->pa_tag);
- name = getpropstring(node, "name");
- if (strcmp(name, "SUNW,Expert3D") == 0 ||
- strcmp(name, "SUNW,Expert3D-Lite") == 0)
- return 1;
-
- return 0;
+ return ifb_ident(aux);
}
void
diff --git a/sys/arch/sparc64/dev/ifb_ident.c b/sys/arch/sparc64/dev/ifb_ident.c
new file mode 100644
index 00000000000..745c00e4798
--- /dev/null
+++ b/sys/arch/sparc64/dev/ifb_ident.c
@@ -0,0 +1,65 @@
+/* $OpenBSD: ifb_ident.c,v 1.1 2008/12/29 22:07:35 miod Exp $ */
+
+/*
+ * Copyright (c) 2007, 2008 Miodrag Vallat.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Identify an Expert3D card.
+ * Used by both vgafb and ifb.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/autoconf.h>
+#include <machine/openfirm.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
+
+#include <machine/fbvar.h>
+
+static const struct pci_matchid ifb_devices[] = {
+ { PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_EXPERT3D },
+ { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_6210 },
+ { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_5110 },/* Sun XVR-500 */
+ { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_7210 },
+};
+
+int
+ifb_ident(void *aux)
+{
+ struct pci_attach_args *paa = aux;
+ int node;
+ char *name;
+
+ if (pci_matchbyid(paa, ifb_devices,
+ sizeof(ifb_devices) / sizeof(ifb_devices[0])) != 0)
+ return 1;
+
+ node = PCITAG_NODE(paa->pa_tag);
+ name = getpropstring(node, "name");
+ if (strcmp(name, "SUNW,Expert3D") == 0 ||
+ strcmp(name, "SUNW,Expert3D-Lite") == 0)
+ return 1;
+
+ return 0;
+}
diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c
index c6943f76d04..6978da34132 100644
--- a/sys/arch/sparc64/dev/vgafb.c
+++ b/sys/arch/sparc64/dev/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.55 2008/12/27 17:23:01 miod Exp $ */
+/* $OpenBSD: vgafb.c,v 1.56 2008/12/29 22:07:35 miod Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -110,13 +110,6 @@ struct cfdriver vgafb_cd = {
extern int allowaperture;
#endif
-static const struct pci_matchid ifb_devices[] = {
- { PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_EXPERT3D },
- { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_6210 },
- { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_5110 },/* Sun XVR-500 */
- { PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_7210 }
-};
-
int
vgafbmatch(parent, vcf, aux)
struct device *parent;
@@ -124,26 +117,18 @@ vgafbmatch(parent, vcf, aux)
{
struct pci_attach_args *pa = aux;
int node;
- char *name;
/*
- * Do not match on Expert3D devices, which need a different
- * driver.
+ * Do not match on Expert3D devices, which are driven by ifb(4).
*/
- if (pci_matchbyid(pa, ifb_devices,
- sizeof(ifb_devices) / sizeof(ifb_devices[0])) != 0)
- return (0);
-
- node = PCITAG_NODE(pa->pa_tag);
- name = getpropstring(node, "name");
- if (strcmp(name, "SUNW,Expert3D") == 0 ||
- strcmp(name, "SUNW,Expert3D-Lite") == 0)
+ if (ifb_ident(aux) != 0)
return (0);
/*
* XXX Non-console devices do not get configured by the PROM,
* XXX so do not attach them yet.
*/
+ node = PCITAG_NODE(pa->pa_tag);
if (!vgafb_is_console(node))
return (0);
diff --git a/sys/arch/sparc64/include/fbvar.h b/sys/arch/sparc64/include/fbvar.h
index aadb7339ac3..f1a46869afe 100644
--- a/sys/arch/sparc64/include/fbvar.h
+++ b/sys/arch/sparc64/include/fbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fbvar.h,v 1.7 2008/12/27 17:23:03 miod Exp $ */
+/* $OpenBSD: fbvar.h,v 1.8 2008/12/29 22:07:35 miod Exp $ */
/* $NetBSD: fbvar.h,v 1.9 1997/07/07 23:31:30 pk Exp $ */
/*
@@ -76,3 +76,5 @@ void fbwscons_console_init(struct sunfb *, int);
void fbwscons_setcolormap(struct sunfb *,
void (*)(void *, u_int, u_int8_t, u_int8_t, u_int8_t));
void fbwscons_attach(struct sunfb *, struct wsdisplay_accessops *, int);
+
+int ifb_ident(void *);