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

[PATCH] Fix booting on some recent G5s

Some recent G5s have a problem with PCI/HT probing.  They crash (machine
check) during the probe of some slot numbers, it seems to be related to
some functions beeing disabled by the firmware inside the K2 ASIC.

This patch limits the config space accesses to devices that are present
in the OF device-tree.  This fixes the problem and shouldn't "add" any
limitation.  If you plug a "random" PCI card with no OF driver, the
firmware will still build a node for it with the default set of
properties created from the config space. 
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2f3ce491
......@@ -316,6 +316,10 @@ u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
unsigned int addr;
int i;
struct device_node *np = pci_busdev_to_OF_node(bus, devfn);
if (np == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
/*
* When a device in K2 is powered down, we die on config
* cycle accesses. Fix that here.
......@@ -363,6 +367,9 @@ u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
unsigned int addr;
int i;
struct device_node *np = pci_busdev_to_OF_node(bus, devfn);
if (np == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
/*
* When a device in K2 is powered down, we die on config
* cycle accesses. Fix that here.
......
......@@ -271,7 +271,7 @@ static int __pmac u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 *val)
{
struct pci_controller *hose;
struct device_node *busdn;
struct device_node *busdn, *dn;
unsigned long addr;
if (bus->self)
......@@ -284,6 +284,16 @@ static int __pmac u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
/* We only allow config cycles to devices that are in OF device-tree
* as we are apparently having some weird things going on with some
* revs of K2 on recent G5s
*/
for (dn = busdn->child; dn; dn = dn->sibling)
if (dn->devfn == devfn)
break;
if (dn == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
......
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