6785726 libpciaccess needs to use the correct BAR index on solaris
authorNiveditha Rau <Niveditha.Rau@Sun.COM>
Tue, 16 Dec 2008 14:44:11 -0800
changeset 597 5eaa732af166
parent 596 73560b30aae8
child 598 48acf24353fc
6785726 libpciaccess needs to use the correct BAR index on solaris
open-src/lib/libpciaccess/6785726.patch
open-src/lib/libpciaccess/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libpciaccess/6785726.patch	Tue Dec 16 14:44:11 2008 -0800
@@ -0,0 +1,74 @@
+--- src/solx_devfs.c	Tue Dec 16 09:33:33 2008
++++ src/solx_devfs.c	Tue Dec 16 10:39:28 2008
+@@ -671,6 +671,7 @@
+     int i;
+     pciaddr_t bytes;
+     int len = 0;
++    uint ent = 0;
+ 
+     err = pci_device_solx_devfs_read( dev, config, 0, 256, & bytes );
+     args.node = DI_NODE_NIL;
+@@ -752,13 +753,21 @@
+     }
+ 
+     /*
+-     * solaris has its own BAR index. To be sure that
+-     * Xorg has the same BAR number as solaris. ????
++     * Solaris has its own BAR index. 
++     * Linux give two region slot for 64 bit address.
+      */
+     for (i = 0; i < len; i = i + CELL_NUMS_1275) {
+-	int ent = i/CELL_NUMS_1275;
+ 
+ 	reg = (pci_regspec_t *)&regbuf[i];
++	ent = reg->pci_phys_hi & 0xff;
++	/*
++	 * G35 broken in BAR0
++	 */
++	ent = (ent - PCI_CONF_BASE0) >> 2;
++	if (ent >= 6) {
++		printf("error ent = %d\n", ent);
++		break;
++	}
+ 
+ 	/*
+ 	 * non relocatable resource is excluded
+@@ -772,6 +781,17 @@
+ 	    dev->regions[ent].is_prefetchable = 1;
+ 	}
+ 
++	
++
++	/*
++	 * We split the shift count 32 into two 16 to
++	 * avoid the complaining of the compiler
++	 */
++	dev->regions[ent].base_addr = reg->pci_phys_low +
++	    ((reg->pci_phys_mid << 16) << 16);
++	dev->regions[ent].size = reg->pci_size_low +
++	    ((reg->pci_size_hi << 16) << 16);
++
+ 	switch (reg->pci_phys_hi & PCI_REG_ADDR_M) {
+ 	    case PCI_ADDR_IO:
+ 		dev->regions[ent].is_IO = 1;
+@@ -780,17 +800,11 @@
+ 		break;
+ 	    case PCI_ADDR_MEM64:
+ 		dev->regions[ent].is_64 = 1;
++		/*
++		 * Skip one slot for 64 bit address
++		 */
+ 		break;
+ 	}
+-
+-	/*
+-	 * We split the shift count 32 into two 16 to
+-	 * avoid the complaining of the compiler
+-	 */
+-	dev->regions[ent].base_addr = reg->pci_phys_low +
+-	    ((reg->pci_phys_mid << 16) << 16);
+-	dev->regions[ent].size = reg->pci_size_low +
+-	    ((reg->pci_size_hi << 16) << 16);
+     }
+ 
+     return (err);
--- a/open-src/lib/libpciaccess/Makefile	Mon Dec 15 18:42:01 2008 -0800
+++ b/open-src/lib/libpciaccess/Makefile	Tue Dec 16 14:44:11 2008 -0800
@@ -38,7 +38,7 @@
 MODULE_VERSION=0.10.5
 
 # Patches to apply to source after unpacking, in order
-SOURCE_PATCHES = scanpci.man.patch
+SOURCE_PATCHES = scanpci.man.patch 6785726.patch
 
 # Library name
 LIBNAME=libpciaccess