[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#246782: Gentoo-authored patch for SPARC/Linux 2.6 PCI domain problem with XFree86



[I am not subscribed to sparc@gentoo.org; please Cc the Debian bug
address me on replies.]

I was sent the following patch, but it was credited only to "the Gentoo
SPARC folks".

I'd like to be a bit more specific.  With Donnie Berkholz's assistance,
I had a look at <http://bugs.gentoo.org/show_bug.cgi?id=43630>.

It appears to me that this fix was authored by Daniel Seyffer and Ciaran
McCreesh.  I also assume that, if copyright attaches, that it is licensed
under the same terms as those in the file, used by Concurrent Computer
Corporation and Metro Link Incorporated.  (Sorry to be a pedant about
licensing; those of you who've worked with the XFree86 source code
lately can hopefully appreciate why I am being very careful.)

I will be crediting the patch accordingly; please do not hesitate to
contact me if this is incorrect.

Thanks, guys!

  Date: Wed, 19 May 2004 15:02:50 -0500
  From: "Tom 'spot' Callaway" <tcallawa@redhat.com>
  To: debian-sparc@lists.debian.org
  Subject: Re: Kernel 2.6.x breaks X on blade 100


  On Wed, 2004-05-19 at 09:49 +0200, Admar Schoonen wrote:
  > On Wed, May 19, 2004 at 08:53:04AM +0200, Elie De Brauwer wrote:
  > > I've been trying to install 2.6.6 (and 2.6.5) on my Sun Blade 100,
  > > everything boots well but X won't work, in my 2.4.x I got a working 
  > 
  > You'll have to apply a small patch for 2.6 kernels:
  > http://lists.debian.org/debian-sparc/2004/02/msg00013.html

  Or, you could fix X. Patch attached (originally done by the Gentoo SPARC
  folks).

  ~spot
  ---
  Tom "spot" Callaway <tcallawa(a)redhat*com> LCA, RHCE 
  Red Hat Sales Engineer || Aurora SPARC Linux Project Leader

  "If you are going through hell, keep going."
  - Sir Winston Churchill

--- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c.BAD	2004-04-09 14:50:59.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c	2004-04-09 14:54:14.000000000 -0500
@@ -104,6 +104,7 @@
 	static int	lbus,ldev,lfunc,fd = -1;
 	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 @@
 	if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) {
 		if (fd != -1)
 			close(fd);
-		if (bus < 256)
-			sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
-				bus, dev, func);
-		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);
+		}
 		fd = open(file,O_RDWR);
 		lbus  = bus;
 		ldev  = dev;

-- 
G. Branden Robinson                |     You are not angry with people when
Debian GNU/Linux                   |     you laugh at them.  Humor teaches
branden@debian.org                 |     them tolerance.
http://people.debian.org/~branden/ |     -- W. Somerset Maugham

Attachment: signature.asc
Description: Digital signature


Reply to: