Author: branden
Date: 2004-11-18 14:30:09 -0500 (Thu, 18 Nov 2004)
New Revision: 2031

Modified:
   trunk/debian/CHANGESETS
   trunk/debian/TODO
   trunk/debian/changelog
   trunk/debian/patches/049_Xserver_recognize_Linux_2.6_proc_bus_pci.diff
Log:
Apply patch from David Mosberger that replaces the fix for #225526 with
one that works on systems that do not have a PCI bus numbered 0.  Thanks,
David!  (Closes: #279436)

Correct changeset number.


Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS     2004-11-17 21:48:32 UTC (rev 2030)
+++ trunk/debian/CHANGESETS     2004-11-18 19:30:09 UTC (rev 2031)
@@ -10,7 +10,7 @@
 
 Miscellaneous cosmetic fixes.
     1915, 1916, 1919, 1920, 1932, 1934, 1940, 1951, 1960, 2008, 2014, 2015,
-    2016, 2020, 2021, 2022, 2028, 2029
+    2016, 2020, 2021, 2022, 2028, 2030
 
 Update Danish debconf template translations (thanks, Claus Hindsgaul).
 (Closes: #274101)
@@ -310,4 +310,9 @@
 connectives in scripts.
     2029
 
+Apply patch from David Mosberger that replaces the fix for #225526 with
+one that works on systems that do not have a PCI bus numbered 0.  Thanks,
+David!  (Closes: #279436)
+    2031
+
 vim:set ai et sts=4 sw=4 tw=80:

Modified: trunk/debian/TODO
===================================================================
--- trunk/debian/TODO   2004-11-17 21:48:32 UTC (rev 2030)
+++ trunk/debian/TODO   2004-11-18 19:30:09 UTC (rev 2031)
@@ -52,7 +52,6 @@
   launch xterm, per recommendation from Recai Oktas.  If a valid locale isn't
   set, bail out (would resolve #246398).  (This patch would be Debian-specific
   because validlocale is a Perl utility provided by base-config.)
-* #279436: apply David Mosberger's PCI domain fix [patch; BR]
 
 4.3.0.dfsg.1-10
 --------------

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2004-11-17 21:48:32 UTC (rev 2030)
+++ trunk/debian/changelog      2004-11-18 19:30:09 UTC (rev 2031)
@@ -185,6 +185,10 @@
   * Replace many occurences of XSI connectives in test(1) with POSIX shell
     connectives in scripts.
 
+  * Apply patch from David Mosberger that replaces the fix for #225526 with
+    one that works on systems that do not have a PCI bus numbered 0.  Thanks,
+    David!  (Closes: #279436)
+
   Changes by Denis Barbier and Fabio M. Di Nitto:
 
   * Edit xc/programs/xkbcomp/symbols/pc/Imakefile so that the new pc/us_intl
@@ -267,7 +271,7 @@
     exiting upon encountering the first shell interpeter that fails on the
     script; instead, attempt all the interpreters and report all that fail.
 
- -- Branden Robinson <[EMAIL PROTECTED]>  Tue, 16 Nov 2004 10:27:46 -0500
+ -- Branden Robinson <[EMAIL PROTECTED]>  Wed, 17 Nov 2004 18:00:21 -0500
 
 xfree86 (4.3.0.dfsg.1-8) unstable; urgency=high
 

Modified: trunk/debian/patches/049_Xserver_recognize_Linux_2.6_proc_bus_pci.diff
===================================================================
--- trunk/debian/patches/049_Xserver_recognize_Linux_2.6_proc_bus_pci.diff      
2004-11-17 21:48:32 UTC (rev 2030)
+++ trunk/debian/patches/049_Xserver_recognize_Linux_2.6_proc_bus_pci.diff      
2004-11-18 19:30:09 UTC (rev 2031)
@@ -2,23 +2,55 @@
 
 Fix XFree86 X server's PCI bus support code to be able to cope with both
 Linux 2.4 and Linux 2.6 styles of organization for /proc/bus/pci,
-checking for the 2.6 style first.
+checking for the 2.4 style first.
 
-This patch by Daniel Seyffer and Ciaran McCreesh.
+This patch supersedes one by Daniel Seyffer and Ciaran McCreesh, which had
+problems on some systems.  Quoting David Mosberger:
 
+  [That patch] is keeping X from working on my machine.  That machine is a bit
+  unusual in the sense that it has no PCI bus numbered 0:
+
+   $ ls /proc/bus/pci/
+   40/  60/  80/  81/  devices
+
+  Due to this, the workaround for bug #225526 actually ends up breaking
+  X on my machine:
+[...]
+  So, on my machine (bus is < 256), the stat("/proc/bus/pci/00", &ignored)
+  call fails and then X attempts to use PCI-domain numbers,
+  which is wrong for my machine.
+
+  As far as I know, it is bogus to assume every machine has a PCI bus
+  numbered 0.
+
+This patch by David Mosberger.
+
 Not submitted to XFree86.
 
---- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c~  2004-06-03 
09:52:19.000000000 -0500
-+++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c   2004-06-03 
09:54:49.000000000 -0500
-@@ -104,6 +104,7 @@
-       static int      lbus,ldev,lfunc,fd = -1;
+--- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c~  2004-11-17 
17:52:27.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c   2004-11-17 
17:52:44.000000000 -0500
+@@ -101,7 +101,19 @@
+ static int
+ linuxPciOpenFile(PCITAG tag)
+ {
+-      static int      lbus,ldev,lfunc,fd = -1;
++      static int      lbus,ldev,lfunc,fd = -1,with_domain = 0;
++      static const char *format_string[2][2] = {
++          /* without PCI domain #: */
++          {
++              "/proc/bus/pci/%02x/%02x.%1x",  /* bus # < 256 */
++              "/proc/bus/pci/%04x/%02x.%1x"   /* bus # >= 256 */
++          },
++          /* with PCI domain #: */
++          {
++              "/proc/bus/pci/0000:%02x/%02x.%1x",     /* bus # < 256 */
++              "/proc/bus/pci/0000:%04x/%02x.%1x"      /* bus # >= 256 */
++          }
++      };
        int             bus, dev, func;
        char            file[32];
-+      struct stat     ignored;
  
-       bus  = PCI_BUS_FROM_TAG(tag);
-       dev  = PCI_DEV_FROM_TAG(tag);
-@@ -111,12 +112,21 @@
+@@ -111,13 +123,20 @@
        if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) {
                if (fd != -1)
                        close(fd);
@@ -28,21 +60,20 @@
 -              else
 -                      sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
 -                              bus, dev, func);
-+              if (bus < 256) {
-+                      if (stat("/proc/bus/pci/00", &ignored) < 0)
-+                              sprintf(file, 
"/proc/bus/pci/0000:%02x/%02x.%1x",
-+                                      bus, dev, func);
-+                      else
-+                              sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
-+                                      bus, dev, func);
-+              } else {
-+                      if (stat("/proc/bus/pci/00", &ignored) < 0)
-+                              sprintf(file, 
"/proc/bus/pci/0000:%04x/%02x.%1x",
-+                                      bus, dev, func);
-+                      else
-+                              sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
-+                                      bus, dev, func);
++        retry:
++              sprintf(file, format_string[with_domain][bus >= 256],
++                      bus, dev, func);
+               fd = open(file,O_RDWR);
++
++              if (fd < 0) {
++                      if (!with_domain) {
++                              /* try again, this time with domains */
++                              with_domain = 1;
++                              goto retry;
++                      }
++                      /* failed even with domains; fall back again */
++                      with_domain = 0;
 +              }
-               fd = open(file,O_RDWR);
                lbus  = bus;
                ldev  = dev;
+               lfunc = func;

Reply via email to