From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: To: From: Benjamin Herrenschmidt Date: Fri, 14 Dec 2007 15:56:15 +1100 Subject: [PATCH 15/15] [POWERPC] Various fixes to pcibios_enable_device() In-Reply-To: <1197608163.200976.87755569596.qpush@grosgo> Message-Id: <20071214045621.DECAADE721@ozlabs.org> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Our implementation of pcibios_enable_device() has a couple of problems. One is that it should not check IORESOURCE_UNSET, as this might be left dangling after resource assignment (shouldn't but there are bugs), but instead, we make it check resource->parent which should be a reliable indication that the resource has been successfully claimed (it's in the resource tree). Then, we also need to skip ROM resources that haven't been enabled as x86 does. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/pci-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- linux-merge.orig/arch/powerpc/kernel/pci-common.c 2007-12-14 15:49:34.000000000 +1100 +++ linux-merge/arch/powerpc/kernel/pci-common.c 2007-12-14 15:49:36.000000000 +1100 @@ -1147,7 +1147,10 @@ int pcibios_enable_device(struct pci_dev r = &dev->resource[idx]; if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) continue; - if (r->flags & IORESOURCE_UNSET) { + if ((idx == PCI_ROM_RESOURCE) && + (!(r->flags & IORESOURCE_ROM_ENABLE))) + continue; + if (r->parent == NULL) { printk(KERN_ERR "PCI: Device %s not available because" " of resource collisions\n", pci_name(dev)); return -EINVAL;