[PATCH] Fix lockup accessing config space on G5
From: Benjamin Herrenschmidt
Date: Wed Mar 10 2004 - 21:00:32 EST
Hi !
This patch fixes the code that workaround lockups when accessing
the config space of devices on K2 when they are shut down. The
code was there but in the wrong place ;) And a typo prevented the
ohci1394 version of it from working.
===== arch/ppc64/kernel/pmac_feature.c 1.1 vs edited =====
--- 1.1/arch/ppc64/kernel/pmac_feature.c Thu Feb 12 14:47:55 2004
+++ edited/arch/ppc64/kernel/pmac_feature.c Thu Mar 11 11:49:03 2004
@@ -221,7 +221,7 @@
mb();
k2_skiplist[1] = NULL;
} else {
- k2_skiplist[0] = pdev;
+ k2_skiplist[1] = pdev;
mb();
MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE);
}
===== arch/ppc64/kernel/pmac_pci.c 1.3 vs edited =====
--- 1.3/arch/ppc64/kernel/pmac_pci.c Mon Mar 1 11:50:37 2004
+++ edited/arch/ppc64/kernel/pmac_pci.c Thu Mar 11 11:47:52 2004
@@ -152,7 +152,6 @@
struct pci_controller *hose;
struct device_node *busdn;
unsigned long addr;
- int i;
if (bus->self)
busdn = pci_device_to_OF_node(bus->self);
@@ -164,24 +163,6 @@
if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
- /*
- * When a device in K2 is powered down, we die on config
- * cycle accesses. Fix that here.
- */
- for (i=0; i<2; i++)
- if (k2_skiplist[i] && k2_skiplist[i]->bus == bus &&
- k2_skiplist[i]->devfn == devfn) {
- switch (len) {
- case 1:
- *val = 0xff; break;
- case 2:
- *val = 0xffff; break;
- default:
- *val = 0xfffffffful; break;
- }
- return PCIBIOS_SUCCESSFUL;
- }
-
addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
@@ -209,7 +190,6 @@
struct pci_controller *hose;
struct device_node *busdn;
unsigned long addr;
- int i;
if (bus->self)
busdn = pci_device_to_OF_node(bus->self);
@@ -221,15 +201,6 @@
if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
- /*
- * When a device in K2 is powered down, we die on config
- * cycle accesses. Fix that here.
- */
- for (i=0; i<2; i++)
- if (k2_skiplist[i] && k2_skiplist[i]->bus == bus &&
- k2_skiplist[i]->devfn == devfn)
- return PCIBIOS_SUCCESSFUL;
-
addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
@@ -265,6 +236,17 @@
* implement self-view of the HT host yet
*/
+static int skip_k2_device(struct pci_bus *bus, unsigned int devfn)
+{
+ int i;
+
+ for (i=0; i<2; i++)
+ if (k2_skiplist[i] && k2_skiplist[i]->bus == bus &&
+ k2_skiplist[i]->devfn == devfn)
+ return 1;
+ return 0;
+}
+
#define U3_HT_CFA0(devfn, off) \
((((unsigned long)devfn) << 8) | offset)
#define U3_HT_CFA1(bus, devfn, off) \
@@ -306,6 +288,24 @@
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
/*
+ * When a device in K2 is powered down, we die on config
+ * cycle accesses. Fix that here. We may ultimately want
+ * to cache the config space for those instead of returning
+ * 0xffffffff's to make life easier to HW detection tools
+ */
+ if (skip_k2_device(bus, devfn)) {
+ switch (len) {
+ case 1:
+ *val = 0xff; break;
+ case 2:
+ *val = 0xffff; break;
+ default:
+ *val = 0xfffffffful; break;
+ }
+ return PCIBIOS_SUCCESSFUL;
+ }
+
+ /*
* Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4.
*/
@@ -344,6 +344,13 @@
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
/*
+ * When a device in K2 is powered down, we die on config
+ * cycle accesses. Fix that here.
+ */
+ if (skip_k2_device(bus, devfn))
+ return PCIBIOS_SUCCESSFUL;
+
+ /*
* Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4.
*/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/