7183318 PCIE UR fatal fabric errors on T5-x platforms(Xorg fails to start since b19) s12_02
authorhenryzh <henry.zhao@oracle.com>
Fri, 24 Aug 2012 18:52:41 -0700
changeset 1319 7de64d2be6d1
parent 1318 89149d6a88cf
child 1320 5aa479e49f22
7183318 PCIE UR fatal fabric errors on T5-x platforms(Xorg fails to start since b19) 7182626 T4-4 powers off with fatal error on running LDOM sanity tests (Memory PM or primary reconfiguration)
open-src/driver/xf86-video-mga/Makefile
open-src/driver/xf86-video-mga/sparc-bus-probe.patch
open-src/lib/libpciaccess/Makefile
open-src/lib/libpciaccess/sparc.patch
open-src/xserver/xorg/mapfile-Xorg-externs.sparc
open-src/xserver/xorg/patch-list
open-src/xserver/xorg/sparc-no-bus-probe.patch
--- a/open-src/driver/xf86-video-mga/Makefile	Wed Aug 22 19:19:20 2012 -0700
+++ b/open-src/driver/xf86-video-mga/Makefile	Fri Aug 24 18:52:41 2012 -0700
@@ -40,7 +40,8 @@
 SOURCE_PATCHES = \
 		libraries.patch,-p1 \
 		g200se_pilot3_offscreen.patch,-p1 \
-		sparc.patch,-p1
+		sparc.patch,-p1 \
+		sparc-bus-probe.patch,-p1
 
 # Man pages to apply Sun footer to & attributes to list
 SUNTOUCHED_MANPAGES=man/*.man
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/driver/xf86-video-mga/sparc-bus-probe.patch	Fri Aug 24 18:52:41 2012 -0700
@@ -0,0 +1,44 @@
+--- a/src/mga_driver.c	Fri Aug 10 17:30:22 2012
++++ b/src/mga_driver.c	Fri Aug 17 16:33:15 2012
+@@ -120,6 +120,9 @@
+ static const OptionInfoRec *	MGAAvailableOptions(int chipid, int busid);
+ static void	MGAIdentify(int flags);
+ #ifdef XSERVER_LIBPCIACCESS
++#ifdef __sparc__
++static Bool     MGACompProbe(DriverPtr drv, int flags);
++#endif
+ static Bool MGAPciProbe(DriverPtr drv, int entity_num,
+     struct pci_device * dev, intptr_t match_data);
+ #else
+@@ -535,7 +538,11 @@
+     MGA_DRIVER_NAME,
+     MGAIdentify,
+ #ifdef XSERVER_LIBPCIACCESS
++#ifdef __sparc__
++    MGACompProbe,
++#else
+     NULL,
++#endif
+ #else
+     MGAProbe,
+ #endif
+@@ -4273,3 +4280,19 @@
+ 
+ }
+ #endif
++
++#ifdef __sparc__
++static Bool
++MGACompProbe(DriverPtr drvp, int flags)
++{
++    static Bool PciInitDone = FALSE;
++
++    /* Create pci system for use by the driver */
++    if (!PciInitDone) {
++	xf86BusProbe();
++	PciInitDone = TRUE;
++    }
++
++    return xf86PciProbeDev(drvp);
++}
++#endif
--- a/open-src/lib/libpciaccess/Makefile	Wed Aug 22 19:19:20 2012 -0700
+++ b/open-src/lib/libpciaccess/Makefile	Fri Aug 24 18:52:41 2012 -0700
@@ -40,7 +40,8 @@
 	legacy-io.patch,-p1 \
 	scanpci.man.patch \
 	primary-vga.patch,-p1 \
-	scanpci_64bit.patch,-p1
+	scanpci_64bit.patch,-p1 \
+	sparc.patch
 
 # Library name
 LIBNAME=libpciaccess
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libpciaccess/sparc.patch	Fri Aug 24 18:52:41 2012 -0700
@@ -0,0 +1,158 @@
+--- src/solx_devfs.c	Tue Aug 14 10:11:53 2012
++++ src/solx_devfs.c	Fri Aug 17 11:55:38 2012
+@@ -84,6 +84,14 @@
+     struct pci_device_private * volatile devices;
+ } probe_info_t;
+ 
++#ifdef __sparc
++typedef struct bdf_table_info {
++    int bus;
++    int dev;
++    int func;
++} bdf_table_info_t;
++#endif
++
+ static nexus_t *nexus_list = NULL;
+ #if !defined(__sparc)
+ static int xsvc_fd = -1;
+@@ -91,6 +99,9 @@
+ 
+ #ifdef __sparc
+ static di_prom_handle_t di_phdl;
++static bdf_table_info_t *bdf_table = NULL;
++static size_t  num_bdfs = 0;
++static size_t  num_allocated_bdfs = 0;
+ #endif
+ 
+ /*
+@@ -251,7 +262,47 @@
+     return (rval);
+ }
+ 
++#ifdef __sparc
++static int
++create_bdf_table(di_node_t node, void *arg)
++{
++    int *regbuf = NULL;
++    int len = 0;
+ 
++    len = di_prop_lookup_ints(DDI_DEV_T_ANY, node, "reg", &regbuf);
++
++    if ((len <= 0) && di_phdl)
++	len = di_prom_prop_lookup_ints(di_phdl, node, "reg", &regbuf);
++
++    /* Exclude usb devices */
++    if (len < 5) {
++    	return (DI_WALK_CONTINUE);
++    }
++
++    bdf_table[num_bdfs].bus = PCI_REG_BUS_G(regbuf[0]);
++    bdf_table[num_bdfs].dev = PCI_REG_DEV_G(regbuf[0]);
++    bdf_table[num_bdfs].func  = PCI_REG_FUNC_G(regbuf[0]);
++
++    if (++num_bdfs == num_allocated_bdfs) {
++	bdf_table_info_t  *new_bdfs;
++	size_t new_num_bdfs = num_allocated_bdfs * 2;
++
++	new_bdfs = realloc (bdf_table,
++                   new_num_bdfs * sizeof (bdf_table_info_t));
++	if (new_bdfs == NULL)
++	    return (DI_WALK_TERMINATE);
++
++	(void) memset(&new_bdfs[num_bdfs], 0,
++                   num_allocated_bdfs *
++                   sizeof (bdf_table_info_t));
++	num_allocated_bdfs = new_num_bdfs;
++	bdf_table = new_bdfs;
++    }
++
++    return (DI_WALK_CONTINUE);
++}
++#endif
++
+ /*
+  * Probe device's functions.  Modifies many fields in the prg_p.
+  */
+@@ -276,12 +327,32 @@
+      * will force the loop as the user wants a specific function to be
+      * checked.
+      */
++
+     for (func = first_func, multi_function_device = B_FALSE;
+ 	 ((func <= last_func) &&
+ 	  ((func == first_func) || (multi_function_device)));
+ 	 func++) {
++#ifdef __sparc
++	int i;
++#endif
++
+ 	prg_p->func_no = func;
+ 
++#ifdef __sparc
++	/* Check validity of bdf */
++	for (i = 0; i < num_bdfs; i++) {
++	    if ((bdf_table[i].bus == prg_p->bus_no) && 
++		(bdf_table[i].dev == prg_p->dev_no) &&
++		(bdf_table[i].func == prg_p->func_no))
++		break;
++	}
++
++	/* Skipping if bdf device not on devinfo tree */
++	if (i == num_bdfs) {
++	    continue;
++	}
++#endif
++	    
+ 	/*
+ 	 * Four things can happen here:
+ 	 *
+@@ -551,6 +622,7 @@
+     int bus_range_found = 0;
+     int device_type_found = 0;
+     di_prom_prop_t prom_prop;
++    di_node_t rnode =  DI_NODE_NIL;
+ #endif
+ 
+ 
+@@ -674,6 +746,25 @@
+ 	nexus_dev_path = di_devfs_path(di_node);
+ 	nexus->dev_path = strdup(nexus_dev_path);
+ 	di_devfs_path_free(nexus_dev_path);
++
++#ifdef __sparc
++	if ((rnode = di_init(nexus->dev_path, DINFOCPYALL)) == DI_NODE_NIL) {
++	    (void) fprintf(stderr, "di_init failed: %s\n", strerror(errno));
++	    return (DI_WALK_TERMINATE);
++	}
++
++	if ((bdf_table = calloc(INITIAL_NUM_DEVICES,
++			sizeof (bdf_table_info_t))) == NULL) {
++	    di_fini(rnode);
++	    return (DI_WALK_TERMINATE);
++	}
++	num_bdfs = 0;
++	num_allocated_bdfs = INITIAL_NUM_DEVICES;
++
++	/* Create a bdf table for the nexus node */
++	(void) di_walk_node(rnode, DI_WALK_CLDFIRST, (void *)NULL, create_bdf_table);
++#endif 
++
+ 	if ((do_probe(nexus, pinfo) != 0) && (errno != ENXIO)) {
+ 	    (void) fprintf(stderr, "Error probing node %s: %s\n",
+ 			   nexus_path, strerror(errno));
+@@ -685,6 +776,15 @@
+ 	    nexus->next = nexus_list;
+ 	    nexus_list = nexus;
+ 	}
++#ifdef __sparc
++	if (bdf_table) {
++	    free (bdf_table);
++	    bdf_table = NULL;
++	    num_bdfs = 0;
++	    num_allocated_bdfs = 0;
++	}
++	di_fini(rnode);
++#endif
+     } else {
+ 	(void) fprintf(stderr, "Error opening %s: %s\n",
+ 		       nexus_path, strerror(errno));
--- a/open-src/xserver/xorg/mapfile-Xorg-externs.sparc	Wed Aug 22 19:19:20 2012 -0700
+++ b/open-src/xserver/xorg/mapfile-Xorg-externs.sparc	Fri Aug 24 18:52:41 2012 -0700
@@ -1779,6 +1779,7 @@
 		xf86PMGetEventFromOs                     { FLAGS = EXTERN };
 		xf86ParsePciBusString                    { FLAGS = EXTERN };
 		xf86PathIsSafe                           { FLAGS = EXTERN };
+		xf86PciProbeDev                          { FLAGS = EXTERN };
 		xf86Pix24                                { FLAGS = EXTERN };
 		xf86PointerName                          { FLAGS = EXTERN };
 		xf86PostButtonEvent                      { FLAGS = EXTERN };
--- a/open-src/xserver/xorg/patch-list	Wed Aug 22 19:19:20 2012 -0700
+++ b/open-src/xserver/xorg/patch-list	Fri Aug 24 18:52:41 2012 -0700
@@ -27,3 +27,4 @@
 record-regset.patch,-p1
 autodetect-kernel-dev-fb.patch,-p1
 workaround-7154410.patch,-p1
+sparc-no-bus-probe.patch,-p1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/xserver/xorg/sparc-no-bus-probe.patch	Fri Aug 24 18:52:41 2012 -0700
@@ -0,0 +1,71 @@
+--- a/hw/xfree86/common/xf86Init.c	Fri Aug 10 17:42:37 2012
++++ b/hw/xfree86/common/xf86Init.c	Fri Aug 10 19:45:41 2012
+@@ -453,7 +453,9 @@
+             DoShowOptions();
+ 
+         /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
++#if (!defined(__sparc__) && !defined(__sparc))
+         xf86BusProbe();
++#endif
+ 
+         if (xf86DoConfigure)
+             DoConfigure();
+--- a/hw/xfree86/common/xf86pciBus.h	Fri Aug 17 15:28:07 2012
++++ b/hw/xfree86/common/xf86pciBus.h	Fri Aug 17 15:25:34 2012
+@@ -35,7 +35,9 @@
+ 
+ void xf86PciProbe(void);
+ Bool xf86PciAddMatchingDev(DriverPtr drvp);
++#if (!defined(__sparc__) &&  !defined(__sparc))
+ Bool xf86PciProbeDev(DriverPtr drvp);
++#endif
+ void xf86PciIsolateDevice(char *argument);
+ int xf86PciMatchDriver(char *matches[], int nmatches);
+ Bool xf86PciConfigure(void *busData, struct pci_device *pDev);
+--- a/hw/xfree86/common/xf86Priv.h	Fri Aug 10 21:43:08 2012
++++ b/hw/xfree86/common/xf86Priv.h	Fri Aug 17 15:26:21 2012
+@@ -117,6 +117,11 @@
+ extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex);
+ extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
+ 
++/* xf86pciBus.c */
++#if (defined(__sparc__) || defined(__sparc))
++extern _X_EXPORT Bool xf86PciProbeDev(DriverPtr drvp);
++#endif
++
+ /* xf86Config.c */
+ 
+ extern _X_EXPORT Bool xf86PathIsSafe(const char *path);
+--- a/hw/xfree86/common/xf86AutoConfig.c	Fri Aug 24 11:29:28 2012
++++ b/hw/xfree86/common/xf86AutoConfig.c	Fri Aug 24 12:14:43 2012
+@@ -215,6 +215,10 @@
+     return ret == CONFIG_OK;
+ }
+ 
++#if (defined(__sparc__) || defined(__sparc))
++#define xf86SolarisFb0Dev	"/dev/fb0"
++#endif
++
+ static void
+ listPossibleVideoDrivers(char *matches[], int nmatches)
+ {
+@@ -250,6 +254,19 @@
+             close(fbfd);
+         }
+     }
++#if (defined(__sparc__) || defined(__sparc))
++    if (!got_vis_id) {
++        int fbfd;
++
++        fbfd = open(xf86SolarisFb0Dev, O_RDONLY);
++        if (fbfd >= 0) {
++            SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
++            if (iret >= 0)
++                got_vis_id = 1;
++            close(fbfd);
++        }
++    }
++#endif
+     if (got_vis_id) {
+         const char *cp;
+