--- a/open-src/lib/libpciaccess/Makefile Mon Aug 27 12:34:43 2012 -0700
+++ b/open-src/lib/libpciaccess/Makefile Wed Oct 03 16:03:26 2012 -0700
@@ -41,7 +41,8 @@
scanpci.man.patch \
primary-vga.patch,-p1 \
scanpci_64bit.patch,-p1 \
- sparc.patch
+ sparc.patch \
+ nexus_devlist.patch,-p1
# Library name
LIBNAME=libpciaccess
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libpciaccess/nexus_devlist.patch Wed Oct 03 16:03:26 2012 -0700
@@ -0,0 +1,113 @@
+From: Mark Logan <[email protected]>
+Date: Tue, 28 Aug 2012 15:03:51 -0700
+Subject: Re: CR 7186363 Updated, P2 xserver/programs scanpci is core dumping on M5000
+
+--- a/src/common_init.c Tue Aug 28 11:56:52 2012
++++ b/src/common_init.c Tue Aug 28 11:56:52 2012
+@@ -112,15 +112,22 @@
+ }
+ }
+
++#ifdef __sparc
++ if ( pci_sys->methods->destroy != NULL ) {
++ (*pci_sys->methods->destroy)();
++ }
++#endif
++
+ free( pci_sys->devices );
+ pci_sys->devices = NULL;
+ pci_sys->num_devices = 0;
+ }
+
+-
++#ifndef __sparc
+ if ( pci_sys->methods->destroy != NULL ) {
+ (*pci_sys->methods->destroy)();
+ }
++#endif
+
+ free( pci_sys );
+ pci_sys = NULL;
+--- a/src/solx_devfs.c Tue Aug 28 11:56:53 2012
++++ b/src/solx_devfs.c Tue Aug 28 11:56:53 2012
+@@ -72,7 +72,7 @@
+ char *dev_path;
+ struct nexus *next;
+ #ifdef __sparc
+- struct pci_device **devlist;
++ size_t *devlist;
+ volatile size_t num_allocated_elems;
+ volatile size_t num_devices;
+ #endif
+@@ -151,7 +151,8 @@
+
+ for (nexus = nexus_list ; nexus != NULL ; nexus = nexus->next) {
+ for (i = 0; i < nexus->num_devices; i++) {
+- if (nexus->devlist[i] == dev)
++ size_t dev_idx = nexus->devlist[i];
++ if (&pci_sys->devices[dev_idx].base == dev)
+ return nexus;
+ }
+ }
+@@ -207,7 +208,8 @@
+ int i;
+
+ for (i = 0; i < nexus->num_devices; i++) {
+- dev = nexus->devlist[i];
++ size_t dev_idx = nexus->devlist[i];
++ dev = &pci_sys->devices[dev_idx].base;
+ if (MAPPING_DEV_PATH(dev))
+ di_devfs_path_free((char *) MAPPING_DEV_PATH(dev));
+ }
+@@ -454,7 +456,8 @@
+ * function number.
+ */
+
+- pci_base = &pinfo->devices[pinfo->num_devices].base;
++ size_t dev_idx = pinfo->num_devices;
++ pci_base = &pinfo->devices[dev_idx].base;
+
+ pci_base->domain = nexus->domain;
+ pci_base->bus = prg_p->bus_no;
+@@ -477,7 +480,7 @@
+ pci_base->subdevice_id = GET_CONFIG_VAL_16(PCI_CONF_SUBSYSID);
+ pci_base->irq = GET_CONFIG_VAL_8(PCI_CONF_ILINE);
+
+- pinfo->devices[pinfo->num_devices].header_type
++ pinfo->devices[dev_idx].header_type
+ = GET_CONFIG_VAL_8(PCI_CONF_HEADER);
+
+ #ifdef DEBUG
+@@ -508,19 +511,19 @@
+ }
+
+ #ifdef __sparc
+- nexus->devlist[nexus->num_devices++] = pci_base;
++ nexus->devlist[nexus->num_devices++] = dev_idx;
+
+ if (nexus->num_devices == nexus->num_allocated_elems) {
+- struct pci_device **new_devs;
++ size_t *new_devs;
+ size_t new_num_elems = nexus->num_allocated_elems * 2;
+
+ new_devs = realloc(nexus->devlist,
+- new_num_elems * sizeof (struct pci_device *));
++ new_num_elems * sizeof (size_t *));
+ if (new_devs == NULL)
+ return (rval);
+ (void) memset(&new_devs[nexus->num_devices], 0,
+ nexus->num_allocated_elems *
+- sizeof (struct pci_device *));
++ sizeof (size_t *));
+ nexus->num_allocated_elems = new_num_elems;
+ nexus->devlist = new_devs;
+ }
+@@ -714,7 +717,7 @@
+
+ #ifdef __sparc
+ if ((nexus->devlist = calloc(INITIAL_NUM_DEVICES,
+- sizeof (struct pci_device *))) == NULL) {
++ sizeof (size_t *))) == NULL) {
+ (void) fprintf(stderr, "Error allocating memory for nexus devlist: %s\n",
+ strerror(errno));
+ free (nexus);