|
|
a7b17b0 |
From 24e863b0eb6ff11010a14cfd252a39df87a09d0e Mon Sep 17 00:00:00 2001
|
|
|
a7b17b0 |
From: Bernhard R. Link<brlink@debian.org>
|
|
|
a7b17b0 |
Date: Sat, 25 Oct 2008 22:19:34 +0000
|
|
|
a7b17b0 |
Subject: Bug#16501: autodetection of sbus graphic cards
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
Add automatic detection of the graphic driver to load for sbus devices.
|
|
|
a7b17b0 |
This allows xorg to work on those devices without a "Device" section.
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
Debian bug#483942.
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
Slightly modified for Fedora 9 version of xorg-server by Tom "spot" Callaway <tcallawa@redhat.com>
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
Signed-off-by: Julien Cristau <jcristau@debian.org>
|
|
|
a7b17b0 |
---
|
|
|
a7b17b0 |
diff -up xorg-server-1.5.2/hw/xfree86/common/xf86AutoConfig.c.BAD xorg-server-1.5.2/hw/xfree86/common/xf86AutoConfig.c
|
|
|
a7b17b0 |
--- xorg-server-1.5.2/hw/xfree86/common/xf86AutoConfig.c.BAD 2008-12-13 11:22:32.000000000 -0500
|
|
|
a7b17b0 |
+++ xorg-server-1.5.2/hw/xfree86/common/xf86AutoConfig.c 2008-12-13 11:27:05.000000000 -0500
|
|
|
a7b17b0 |
@@ -39,6 +39,9 @@
|
|
|
a7b17b0 |
#include "xf86Config.h"
|
|
|
a7b17b0 |
#include "xf86Priv.h"
|
|
|
a7b17b0 |
#include "xf86_OSlib.h"
|
|
|
a7b17b0 |
+#ifdef __sparc__
|
|
|
a7b17b0 |
+# include "xf86sbusBus.h"
|
|
|
a7b17b0 |
+#endif
|
|
|
a7b17b0 |
#include "dirent.h"
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
/* Sections for the default built-in configuration. */
|
|
|
a7b17b0 |
@@ -428,6 +431,12 @@ chooseVideoDriver(void)
|
|
|
a7b17b0 |
for (i=0 ; i<20 ; i++)
|
|
|
a7b17b0 |
matches[i] = NULL;
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
+#ifdef __sparc__
|
|
|
a7b17b0 |
+ char *sbusDriver = sparcDriverName();
|
|
|
a7b17b0 |
+ if (sbusDriver)
|
|
|
a7b17b0 |
+ matches[i++] = xnfstrdup(sbusDriver);
|
|
|
a7b17b0 |
+#endif
|
|
|
a7b17b0 |
+
|
|
|
a7b17b0 |
/* Find the primary device, and get some information about it. */
|
|
|
a7b17b0 |
iter = pci_slot_match_iterator_create(NULL);
|
|
|
a7b17b0 |
while ((info = pci_device_next(iter)) != NULL) {
|
|
|
a7b17b0 |
diff -up xorg-server-1.5.2/hw/xfree86/common/xf86sbusBus.h.BAD xorg-server-1.5.2/hw/xfree86/common/xf86sbusBus.h
|
|
|
a7b17b0 |
--- xorg-server-1.5.2/hw/xfree86/common/xf86sbusBus.h.BAD 2008-12-13 11:27:14.000000000 -0500
|
|
|
a7b17b0 |
+++ xorg-server-1.5.2/hw/xfree86/common/xf86sbusBus.h 2008-12-13 11:27:41.000000000 -0500
|
|
|
a7b17b0 |
@@ -60,6 +60,7 @@ extern struct sbus_devtable {
|
|
|
a7b17b0 |
int devId;
|
|
|
a7b17b0 |
int fbType;
|
|
|
a7b17b0 |
char *promName;
|
|
|
a7b17b0 |
+ char *driverName;
|
|
|
a7b17b0 |
char *descr;
|
|
|
a7b17b0 |
} sbusDeviceTable[];
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
@@ -93,5 +94,6 @@ int sparcPromGetBool(sbusPromNodePtr pno
|
|
|
a7b17b0 |
void sparcPromAssignNodes(void);
|
|
|
a7b17b0 |
char * sparcPromNode2Pathname(sbusPromNodePtr pnode);
|
|
|
a7b17b0 |
int sparcPromPathname2Node(const char *pathName);
|
|
|
a7b17b0 |
+char *sparcDriverName(void);
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
#endif /* _XF86_SBUSBUS_H */
|
|
|
a7b17b0 |
diff -up xorg-server-1.5.2/hw/xfree86/os-support/bus/Sbus.c.BAD xorg-server-1.5.2/hw/xfree86/os-support/bus/Sbus.c
|
|
|
a7b17b0 |
--- xorg-server-1.5.2/hw/xfree86/os-support/bus/Sbus.c.BAD 2008-12-13 11:27:50.000000000 -0500
|
|
|
a7b17b0 |
+++ xorg-server-1.5.2/hw/xfree86/os-support/bus/Sbus.c 2008-12-13 11:32:57.000000000 -0500
|
|
|
a7b17b0 |
@@ -54,20 +54,20 @@ static struct openpromio *promOpio;
|
|
|
a7b17b0 |
sbusDevicePtr *xf86SbusInfo = NULL;
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
struct sbus_devtable sbusDeviceTable[] = {
|
|
|
a7b17b0 |
- { SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "Sun Monochrome (bwtwo)" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", "Sun Color2 (cgtwo)" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "Sun Color3 (cgthree)" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", "Sun Color4 (cgfour)" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "Sun GX" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", "Sun CG8/RasterOps" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", "Sun GS (cgtwelve)" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "Sun SX" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", "Sun Graphics Tower" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_MGX, -1, "mgx", "Quantum 3D MGXplus" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "Sun ZX or Turbo ZX" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "Sun TCX" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "Sun FFB" },
|
|
|
a7b17b0 |
- { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "Sun Elite3D" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "sunbw2", "Sun Monochrome (bwtwo)" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", NULL, "Sun Color2 (cgtwo)" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "suncg3", "Sun Color3 (cgthree)" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", NULL, "Sun Color4 (cgfour)" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "suncg6", "Sun GX" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", NULL, "Sun CG8/RasterOps" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", NULL, "Sun GS (cgtwelve)" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "suncg14", "Sun SX" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", NULL, "Sun Graphics Tower" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_MGX, -1, "mgx", NULL, "Quantum 3D MGXplus" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "sunleo", "Sun ZX or Turbo ZX" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "suntcx", "Sun TCX" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "sunffb", "Sun FFB" },
|
|
|
a7b17b0 |
+ { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "sunffb", "Sun Elite3D" },
|
|
|
a7b17b0 |
{ 0, 0, NULL }
|
|
|
a7b17b0 |
};
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
@@ -240,6 +240,60 @@ sparcPromGetBool(sbusPromNodePtr pnode,
|
|
|
a7b17b0 |
return promGetBool(prop);
|
|
|
a7b17b0 |
}
|
|
|
a7b17b0 |
|
|
|
a7b17b0 |
+static char *
|
|
|
a7b17b0 |
+promWalkGetDriverName(int node, int oldnode)
|
|
|
a7b17b0 |
+{
|
|
|
a7b17b0 |
+ int nextnode;
|
|
|
a7b17b0 |
+ int len;
|
|
|
a7b17b0 |
+ char *prop;
|
|
|
a7b17b0 |
+ int devId, i;
|
|
|
a7b17b0 |
+
|
|
|
a7b17b0 |
+ prop = promGetProperty("device_type", &len;;
|
|
|
a7b17b0 |
+ if (prop && (len > 0)) do {
|
|
|
a7b17b0 |
+ if (!strcmp(prop, "display")) {
|
|
|
a7b17b0 |
+ prop = promGetProperty("name", &len;;
|
|
|
a7b17b0 |
+ if (!prop || len <= 0)
|
|
|
a7b17b0 |
+ break;
|
|
|
a7b17b0 |
+ while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',')
|
|
|
a7b17b0 |
+ prop++;
|
|
|
a7b17b0 |
+ for (i = 0; sbusDeviceTable[i].devId; i++)
|
|
|
a7b17b0 |
+ if (!strcmp(prop, sbusDeviceTable[i].promName))
|
|
|
a7b17b0 |
+ break;
|
|
|
a7b17b0 |
+ devId = sbusDeviceTable[i].devId;
|
|
|
a7b17b0 |
+ if (!devId)
|
|
|
a7b17b0 |
+ break;
|
|
|
a7b17b0 |
+ if (sbusDeviceTable[i].driverName)
|
|
|
a7b17b0 |
+ return sbusDeviceTable[i].driverName;
|
|
|
a7b17b0 |
+ }
|
|
|
a7b17b0 |
+ } while (0);
|
|
|
a7b17b0 |
+
|
|
|
a7b17b0 |
+ nextnode = promGetChild(node);
|
|
|
a7b17b0 |
+ if (nextnode) {
|
|
|
a7b17b0 |
+ char *name;
|
|
|
a7b17b0 |
+ name = promWalkGetDriverName(nextnode, node);
|
|
|
a7b17b0 |
+ if (name)
|
|
|
a7b17b0 |
+ return name;
|
|
|
a7b17b0 |
+ }
|
|
|
a7b17b0 |
+
|
|
|
a7b17b0 |
+ nextnode = promGetSibling(node);
|
|
|
a7b17b0 |
+ if (nextnode)
|
|
|
a7b17b0 |
+ return promWalkGetDriverName(nextnode, node);
|
|
|
a7b17b0 |
+ return NULL;
|
|
|
a7b17b0 |
+}
|
|
|
a7b17b0 |
+
|
|
|
a7b17b0 |
+char *
|
|
|
a7b17b0 |
+sparcDriverName(void)
|
|
|
a7b17b0 |
+{
|
|
|
a7b17b0 |
+ char *name;
|
|
|
a7b17b0 |
+
|
|
|
a7b17b0 |
+ if (sparcPromInit() < 0)
|
|
|
a7b17b0 |
+ return NULL;
|
|
|
a7b17b0 |
+ promGetSibling(0);
|
|
|
a7b17b0 |
+ name = promWalkGetDriverName(promRootNode, 0);
|
|
|
a7b17b0 |
+ sparcPromClose();
|
|
|
a7b17b0 |
+ return name;
|
|
|
a7b17b0 |
+}
|
|
|
a7b17b0 |
+
|
|
|
a7b17b0 |
static void
|
|
|
a7b17b0 |
promWalkAssignNodes(int node, int oldnode, int flags, sbusDevicePtr *devicePtrs)
|
|
|
a7b17b0 |
{
|