Patchwork [Fwd:,Re:,[Fwd:,Re:,[Fwd:,Re:,arima,hdama,problem] ]]

login
register
about
Submitter Myles Watson
Date 2009-10-21 18:50:23
Message ID <2831fecf0910211150m5e38c8fck36664acc31d78b62@mail.gmail.com>
Download mbox | patch
Permalink /patch/455/
State Superseded
Headers show

Comments

Myles Watson - 2009-10-21 18:50:23
On Wed, Oct 21, 2009 at 12:23 PM, Hugh Greenberg <hng@lanl.gov> wrote:

> Here is the new output:
>
> before scan bus of PCI: 00:18.0
> amdk8_scan_chains: PCI: 00:18.0, node 0
> amdk8_scan_chains: PCI: 00:18.0, node 0, link 0
> amdk8_scan_chain: PCI: 00:18.0, node 0, link 0
> connected
> Init Complete
> non coherent
> scan chain
> ht_collapse_early_enumeration: PCI: 00:18.0 children PCI: 00:18.0
> offset_unitid0
> ht_collapse_early_enumeration: ctrl = 20

And here's the next.

Thanks,
Myles
Hugh Greenberg - 2009-10-21 20:21:35
Here is the output:

before scan bus of PCI: 00:18.0
amdk8_scan_chains: PCI: 00:18.0, node 0
amdk8_scan_chains: PCI: 00:18.0, node 0, link 0
amdk8_scan_chain: PCI: 00:18.0, node 0, link 0
connected
Init Complete
non coherent
scan chain
ht_collapse_early_enumeration: PCI: 00:18.0 children PCI: 00:18.0 
offset_unitid0
ht_collapse_early_enumeration: ctrl = 20
Check collapse state
Check collapse state pci_read
pci_remember_direct: pci_bus_fallback_ops=00000000
pci_check_direct

Patch

Index: svn/src/devices/pci_device.c
===================================================================
--- svn.orig/src/devices/pci_device.c
+++ svn/src/devices/pci_device.c
@@ -1081,7 +1081,9 @@  unsigned int pci_scan_bus(struct bus *bu
 	 * scan the bus behind that child.
 	 */
 	for (child = bus->children; child; child = child->sibling) {
+		printk_debug("before scan bus of %s\n", dev_path(child));
 		max = scan_bus(child, max);
+        printk_debug("after scan bus of %s\n", dev_path(child));
 	}
 
 	/* We've scanned the bus and so we know all about what's on the other
Index: svn/src/northbridge/amd/amdk8/northbridge.c
===================================================================
--- svn.orig/src/northbridge/amd/amdk8/northbridge.c
+++ svn/src/northbridge/amd/amdk8/northbridge.c
@@ -93,19 +93,29 @@  static unsigned int amdk8_scan_chain(dev
 		unsigned min_bus;
 		unsigned max_devfn;
 
+		printk_debug("%s: %s, node %d, link %d\n", __func__,
+			     dev_path(dev), nodeid, link);
+
 		dev->link[link].cap = 0x80 + (link *0x20);
+		if (pci_read_config32(dev, dev->link[link].cap + 0x18) &
+		    ConnectionPending)
+			printk_debug("%s: connection pending %s link %d\n",
+				      __func__, dev_path(dev), link);
 		do {
 			link_type = pci_read_config32(dev, dev->link[link].cap + 0x18);
 		} while(link_type & ConnectionPending);
 		if (!(link_type & LinkConnected)) {
 			return max;
 		}
+		printk_debug("connected\n");
 		do {
 			link_type = pci_read_config32(dev, dev->link[link].cap + 0x18);
 		} while(!(link_type & InitComplete));
+		printk_debug("Init Complete\n");
 		if (!(link_type & NonCoherent)) {
 			return max;
 		}
+		printk_debug("non coherent\n");
 		/* See if there is an available configuration space mapping
 		 * register in function 1.
 		 */
@@ -199,6 +209,7 @@  static unsigned int amdk8_scan_chain(dev
 		else
 			max_devfn = (0x1f<<3) | 7;
 
+		printk_debug("scan chain\n");
 		max = hypertransport_scan_chain(&dev->link[link], 0, max_devfn, max, ht_unitid_base, offset_unitid);
 
 		/* We know the number of busses behind this bridge.  Set the
@@ -237,6 +248,8 @@  static unsigned int amdk8_scan_chains(de
 	unsigned offset_unitid = 0;
 	nodeid = amdk8_nodeid(dev);
 
+	printk_debug("%s: %s, node %d\n", __func__,
+		     dev_path(dev), nodeid);
 	if(nodeid==0) {
 		sblink = (pci_read_config32(dev, 0x64)>>8) & 3;
 #if CONFIG_SB_HT_CHAIN_ON_BUS0 > 0
@@ -248,6 +261,8 @@  static unsigned int amdk8_scan_chains(de
 	}
 
 	for(link = 0; link < dev->links; link++) {
+		printk_debug("%s: %s, node %d, link %d\n", __func__,
+			     dev_path(dev), nodeid, link);
 #if CONFIG_SB_HT_CHAIN_ON_BUS0 > 0
 		if( (nodeid == 0) && (sblink == link) ) continue; //already done
 #endif
Index: svn/src/devices/hypertransport.c
===================================================================
--- svn.orig/src/devices/hypertransport.c
+++ svn/src/devices/hypertransport.c
@@ -299,6 +299,11 @@  static void ht_collapse_early_enumeratio
 	prev.freq_off     = PCI_HT_CAP_HOST_FREQ;
 	prev.freq_cap_off = PCI_HT_CAP_HOST_FREQ_CAP;
 
+	printk_debug("%s: %s children %s offset_unitid %d\n", __func__,
+		     dev_path(bus->dev), dev_path(bus->children), offset_unitid);
+	printk_debug("%s: ctrl = %x\n", __func__,
+		     pci_read_config16(prev.dev, prev.pos + prev.ctrl_off));
+
 	/* Wait until the link initialization is complete */
 	do {
 		ctrl = pci_read_config16(prev.dev, prev.pos + prev.ctrl_off);
@@ -332,6 +337,7 @@  static void ht_collapse_early_enumeratio
         }
 #endif
 
+	printk_debug("Check collapse state\n");
         /* Check if is already collapsed */
         if((!offset_unitid)|| (offset_unitid && (!((CONFIG_HT_CHAIN_END_UNITID_BASE == 0) && (CONFIG_HT_CHAIN_END_UNITID_BASE <CONFIG_HT_CHAIN_UNITID_BASE))))) {
                 struct device dummy;
@@ -339,7 +345,9 @@  static void ht_collapse_early_enumeratio
                 dummy.bus              = bus;
                 dummy.path.type        = DEVICE_PATH_PCI;
                 dummy.path.pci.devfn = PCI_DEVFN(0, 0);
+		printk_debug("Check collapse state pci_read\n");
                 id = pci_read_config32(&dummy, PCI_VENDOR_ID);
+		printk_debug("Check collapse state after pci_read\n");
                 if ( ! ( (id == 0xffffffff) || (id == 0x00000000) ||
                     (id == 0x0000ffff) || (id == 0xffff0000) ) ) {
                              return;
@@ -349,6 +357,7 @@  static void ht_collapse_early_enumeratio
 	/* Spin through the devices and collapse any early
 	 * hypertransport enumeration.
 	 */
+	printk_debug("Collapsing devs\n");
 	for(devfn = PCI_DEVFN(1, 0); devfn <= 0xff; devfn += 8) {
 		struct device dummy;
 		uint32_t id;
@@ -356,7 +365,9 @@  static void ht_collapse_early_enumeratio
 		dummy.bus              = bus;
 		dummy.path.type        = DEVICE_PATH_PCI;
 		dummy.path.pci.devfn = devfn;
+		printk_debug("Collapse state pci_read\n");
 		id = pci_read_config32(&dummy, PCI_VENDOR_ID);
+		printk_debug("After collapse state pci_read\n");
 		if (	(id == 0xffffffff) || (id == 0x00000000) || 
 			(id == 0x0000ffff) || (id == 0xffff0000)) {
 			continue;
@@ -376,6 +387,7 @@  static void ht_collapse_early_enumeratio
 		printk_spew("Collapsing %s [%04x/%04x]\n", 
 			dev_path(&dummy), dummy.vendor, dummy.device);
 	}
+	printk_debug("Done collapsing devs\n");
 }
 
 unsigned int hypertransport_scan_chain(struct bus *bus, 
@@ -401,6 +413,8 @@  unsigned int hypertransport_scan_chain(s
 	/* Restore the hypertransport chain to it's unitialized state */
 	ht_collapse_early_enumeration(bus, offset_unitid);
 
+	printk_debug("%s: %s children %s offset_unitid %d\n", __func__,
+		     dev_path(bus->dev), dev_path(bus->children), offset_unitid);
 	/* See which static device nodes I have */
 	old_devices = bus->children;
 	bus->children = 0;
@@ -449,10 +463,13 @@  unsigned int hypertransport_scan_chain(s
 			}
 		} while((ctrl & (1 << 5)) == 0);
 		
+		printk_debug("%s: link OK\n", __func__);
 
 		/* Get and setup the device_structure */
 		dev = ht_scan_get_devs(&old_devices);
 
+		printk_debug("%s: dev = %s\n", dev_path(dev));
+		printk_debug("%s: old_devs = %s\n", dev_path(old_devices));
 		/* See if a device is present and setup the
 		 * device structure.
 		 */
Index: svn/src/arch/i386/lib/pci_ops_auto.c
===================================================================
--- svn.orig/src/arch/i386/lib/pci_ops_auto.c
+++ svn/src/arch/i386/lib/pci_ops_auto.c
@@ -47,6 +47,7 @@  const struct pci_bus_operations *pci_che
 {
 	unsigned int tmp;
 
+	printk_debug("%s\n", __func__);
 	/*
 	 * Check if configuration type 1 works.
 	 */
@@ -85,6 +86,8 @@  const struct pci_bus_operations *pci_che
 
 const struct pci_bus_operations *pci_remember_direct(void)
 {
+	printk_debug("%s: pci_bus_fallback_ops=%p\n", __func__,
+		     pci_bus_fallback_ops);
 	if (!pci_bus_fallback_ops)
 		pci_bus_fallback_ops = pci_check_direct();
 	return pci_bus_fallback_ops;