* Wed Apr 11 2007 Adam Jackson <ajax@redhat.com> 1.2.99.905-4

- xserver-1.3.0-no-prerelease-warning.patch: Hush the useless prerelease
  warning if we happen to be building one (and even if not).
- xserver-1.3.0-pci-device-enable.patch: Make sure the PCI device is enabled
  in sysfs before we start touching it, otherwise, armageddon.
This commit is contained in:
Adam Jackson 2007-04-12 00:08:39 +00:00
parent e6652c37ad
commit 3f704b6422
2 changed files with 88 additions and 0 deletions

View File

@ -64,6 +64,7 @@ Patch2501: xserver-1.3.0-pci-bus-count.patch
Patch2502: xserver-1.3.0-mmap-failure-check.patch
Patch2503: xserver-1.3.0-rom-search.patch
Patch2504: xserver-1.3.0-domain-obiwan.patch
Patch2505: xserver-1.3.0-pci-device-enable.patch
%define moduledir %{_libdir}/xorg/modules
%define drimoduledir %{_libdir}/dri
@ -295,6 +296,7 @@ Xserver source code needed to build VNC server (Xvnc)
%patch2502 -p1 -b .mmap-check
%patch2503 -p1 -b .rom-search
%patch2504 -p1 -b .domain-obiwan
%patch2505 -p1 -b .device-enable
%build
@ -556,6 +558,8 @@ rm -rf $RPM_BUILD_ROOT
* Wed Apr 11 2007 Adam Jackson <ajax@redhat.com> 1.2.99.905-4
- xserver-1.3.0-no-prerelease-warning.patch: Hush the useless prerelease
warning if we happen to be building one (and even if not).
- xserver-1.3.0-pci-device-enable.patch: Make sure the PCI device is enabled
in sysfs before we start touching it, otherwise, armageddon.
* Tue Apr 10 2007 Adam Jackson <ajax@redhat.com> 1.2.99.905-3
- xserver-1.3.0-domain-obiwan.patch: Fix a PCI domain off-by-one. (#235861)

View File

@ -0,0 +1,84 @@
--- xorg-server-1.2.99.905/hw/xfree86/common/xf86Bus.c.device-enable 2007-02-17 20:31:36.000000000 -0500
+++ xorg-server-1.2.99.905/hw/xfree86/common/xf86Bus.c 2007-04-11 18:56:56.000000000 -0400
@@ -42,6 +42,10 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Resources.h"
+#include "Pci.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
/* Bus-specific headers */
@@ -66,6 +70,7 @@
BusRec primaryBus = { BUS_NONE, {{0}}};
static Bool xf86ResAccessEnter = FALSE;
+static int lnxEntityPrivate;
#ifdef REDUCER
/* Resources that temporarily conflict with estimated resources */
@@ -116,6 +121,9 @@
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
xf86SbusProbe();
#endif
+#ifdef linux
+ lnxEntityPrivate = xf86AllocateEntityPrivateIndex();
+#endif
}
/*
@@ -264,6 +272,39 @@
return FALSE;
}
}
+
+static void
+lnxEntityInit(int entityIndex, pointer private)
+{
+ EntityProc init;
+ EntityPtr ent = xf86Entities[entityIndex];
+
+ if (ent->bus.type == BUS_PCI) do {
+ char file[256], buf = '\0';
+ int fd;
+ int dom = PCI_DOM_FROM_BUS(ent->bus.id.pci.bus);
+ int bus = PCI_BUS_NO_DOMAIN(ent->bus.id.pci.bus);
+ int dev = ent->bus.id.pci.device;
+ int func = ent->bus.id.pci.func;
+ sprintf(file, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/enable",
+ dom, bus, dev, func);
+
+ if ((fd = open(file, O_RDWR)) < 0) {
+ xf86Msg(X_ERROR, "Unable to open %s. Be afraid.\n", file);
+ break;
+ }
+ read(fd, &buf, 1);
+ if (buf = '0') {
+ xf86Msg(X_INFO, "Enabling PCI device\n");
+ write(fd, "1", 2);
+ }
+ close(fd);
+ } while (0);
+
+ init = xf86GetEntityPrivate(entityIndex, lnxEntityPrivate)->ptr;
+ if (init)
+ init(entityIndex, private);
+}
_X_EXPORT Bool
xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
@@ -271,7 +312,12 @@
{
if (entityIndex >= xf86NumEntities)
return FALSE;
+#ifndef linux
xf86Entities[entityIndex]->entityInit = init;
+#else
+ xf86Entities[entityIndex]->entityInit = lnxEntityInit;
+ xf86GetEntityPrivate(entityIndex, lnxEntityPrivate)->ptr = init;
+#endif
xf86Entities[entityIndex]->entityEnter = enter;
xf86Entities[entityIndex]->entityLeave = leave;
xf86Entities[entityIndex]->private = private;