Commit a1ee5595 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] Fix lockup accessing config space on G5

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.
parent 4838bc63
...@@ -221,7 +221,7 @@ static long __pmac g5_fw_enable(struct device_node* node, long param, long value ...@@ -221,7 +221,7 @@ static long __pmac g5_fw_enable(struct device_node* node, long param, long value
mb(); mb();
k2_skiplist[1] = NULL; k2_skiplist[1] = NULL;
} else { } else {
k2_skiplist[0] = pdev; k2_skiplist[1] = pdev;
mb(); mb();
MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE); MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE);
} }
......
...@@ -152,7 +152,6 @@ static int __pmac macrisc_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -152,7 +152,6 @@ static int __pmac macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
struct pci_controller *hose; struct pci_controller *hose;
struct device_node *busdn; struct device_node *busdn;
unsigned long addr; unsigned long addr;
int i;
if (bus->self) if (bus->self)
busdn = pci_device_to_OF_node(bus->self); busdn = pci_device_to_OF_node(bus->self);
...@@ -164,24 +163,6 @@ static int __pmac macrisc_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -164,24 +163,6 @@ static int __pmac macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
if (hose == NULL) if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND; 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); addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
if (!addr) if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
...@@ -209,7 +190,6 @@ static int __pmac macrisc_write_config(struct pci_bus *bus, unsigned int devfn, ...@@ -209,7 +190,6 @@ static int __pmac macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
struct pci_controller *hose; struct pci_controller *hose;
struct device_node *busdn; struct device_node *busdn;
unsigned long addr; unsigned long addr;
int i;
if (bus->self) if (bus->self)
busdn = pci_device_to_OF_node(bus->self); busdn = pci_device_to_OF_node(bus->self);
...@@ -221,15 +201,6 @@ static int __pmac macrisc_write_config(struct pci_bus *bus, unsigned int devfn, ...@@ -221,15 +201,6 @@ static int __pmac macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
if (hose == NULL) if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND; 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); addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
if (!addr) if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
...@@ -265,6 +236,17 @@ static struct pci_ops macrisc_pci_ops = ...@@ -265,6 +236,17 @@ static struct pci_ops macrisc_pci_ops =
* implement self-view of the HT host yet * 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) \ #define U3_HT_CFA0(devfn, off) \
((((unsigned long)devfn) << 8) | offset) ((((unsigned long)devfn) << 8) | offset)
#define U3_HT_CFA1(bus, devfn, off) \ #define U3_HT_CFA1(bus, devfn, off) \
...@@ -305,6 +287,24 @@ static int __pmac u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -305,6 +287,24 @@ static int __pmac u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
if (!addr) if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND; 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 * Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4. * suitably aligned and that len is 1, 2 or 4.
...@@ -343,6 +343,13 @@ static int __pmac u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, ...@@ -343,6 +343,13 @@ static int __pmac u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
if (!addr) if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND; 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 * Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4. * suitably aligned and that len is 1, 2 or 4.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment