summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-06-27 22:43:42 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-06-27 22:43:42 +0000
commit39ef3eba59cdeadeaff76aad96d3fc82f79e8f3d (patch)
tree13a6e3db0b1a01a32da4a5df7cf34885bb9dc9ee
parent82e7e176fbdb228b31b59105401cc58e53b30ad4 (diff)
Stricter checks when deciding which acceleration code to use. Instead of
matching on pci id, and if no match is found, on pci subsystem id, match on openfirmware device names (which amounts to a pci id AND subsystem id exact match). This makes XVR-500 cards (``bobcat'') run without acceleration. Which is better than trying to use ``jfb'' acceleration and fail. ok kettenis@
-rw-r--r--sys/arch/sparc64/dev/ifb.c42
-rw-r--r--sys/arch/sparc64/dev/ifb_ident.c20
2 files changed, 17 insertions, 45 deletions
diff --git a/sys/arch/sparc64/dev/ifb.c b/sys/arch/sparc64/dev/ifb.c
index 554b70fbeaf..64b50550afa 100644
--- a/sys/arch/sparc64/dev/ifb.c
+++ b/sys/arch/sparc64/dev/ifb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifb.c,v 1.16 2009/01/21 17:01:31 miod Exp $ */
+/* $OpenBSD: ifb.c,v 1.17 2009/06/27 22:43:41 miod Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Miodrag Vallat.
@@ -48,7 +48,6 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
-#include <dev/pci/pcidevs.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
@@ -316,7 +315,7 @@ struct cfdriver ifb_cd = {
NULL, "ifb", DV_DULL
};
-int ifb_accel_identify(struct pci_attach_args *);
+int ifb_accel_identify(const char *);
static inline
u_int ifb_dac_value(u_int, u_int, u_int);
int ifb_getcmap(struct ifb_softc *, struct wsdisplay_cmap *);
@@ -367,7 +366,7 @@ ifbattach(struct device *parent, struct device *self, void *aux)
struct rasops_info *ri;
uint32_t dev_comm;
int node, console;
- char *text;
+ char *name, *text;
sc->sc_mem_t = paa->pa_memt;
sc->sc_pcitag = paa->pa_tag;
@@ -393,7 +392,7 @@ ifbattach(struct device *parent, struct device *self, void *aux)
* Describe the beast.
*/
- text = getpropstring(node, "name");
+ name = text = getpropstring(node, "name");
if (strncmp(text, "SUNW,", 5) == 0)
text += 5;
printf("%s: %s", self->dv_xname, text);
@@ -445,7 +444,7 @@ ifbattach(struct device *parent, struct device *self, void *aux)
* Find out what flavour of ifb we are...
*/
- sc->sc_acceltype = ifb_accel_identify(paa);
+ sc->sc_acceltype = ifb_accel_identify(name);
switch (sc->sc_acceltype) {
case IFB_ACCEL_IFB:
@@ -527,36 +526,17 @@ ifbattach(struct device *parent, struct device *self, void *aux)
* proper acceleration information.
*/
int
-ifb_accel_identify(struct pci_attach_args *pa)
+ifb_accel_identify(const char *name)
{
- uint32_t subid;
-
- subid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
-
- /*
- * If we have an exact Expert3D match, or the subsystem id
- * matches Expert3D or Expert3D-Lite, we have an IFB.
- */
-
- if (pa->pa_id ==
- PCI_ID_CODE(PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_EXPERT3D))
- return IFB_ACCEL_IFB;
- if (subid == PCI_ID_CODE(PCI_VENDOR_INTERGRAPH, 0x108) ||
- subid == PCI_ID_CODE(PCI_VENDOR_INTERGRAPH, 0x140))
+ if (strcmp(name, "SUNW,Expert3D") == 0 ||
+ strcmp(name, "SUNW,Expert3D-Lite") == 0)
return IFB_ACCEL_IFB;
- /*
- * If we have an exact 5110 match, or the subsystem id matches
- * another set of magic values, we have a JFB.
- */
-
- if (pa->pa_id ==
- PCI_ID_CODE(PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_WILDCAT_5110))
- return IFB_ACCEL_JFB;
- if (subid == PCI_ID_CODE(PCI_VENDOR_3DLABS, 0x1044) ||
- subid == PCI_ID_CODE(PCI_VENDOR_3DLABS, 0x1047))
+ if (strcmp(name, "SUNW,XVR-1200") == 0)
return IFB_ACCEL_JFB;
+ /* XVR-500 is bobcat, XVR-600 is xvr600 */
+
return IFB_ACCEL_NONE;
}
diff --git a/sys/arch/sparc64/dev/ifb_ident.c b/sys/arch/sparc64/dev/ifb_ident.c
index 745c00e4798..27791759d79 100644
--- a/sys/arch/sparc64/dev/ifb_ident.c
+++ b/sys/arch/sparc64/dev/ifb_ident.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifb_ident.c,v 1.1 2008/12/29 22:07:35 miod Exp $ */
+/* $OpenBSD: ifb_ident.c,v 1.2 2009/06/27 22:43:41 miod Exp $ */
/*
* Copyright (c) 2007, 2008 Miodrag Vallat.
@@ -30,20 +30,12 @@
#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)
{
@@ -51,14 +43,14 @@ ifb_ident(void *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)
+ strcmp(name, "SUNW,Expert3D-Lite") == 0 ||
+ strcmp(name, "SUNW,XVR-500") == 0 ||
+ strcmp(name, "SUNW,XVR-600") == 0 ||
+ strcmp(name, "SUNW,XVR-1200") == 0)
return 1;
return 0;