PPC64: Add pcibios_remove_root_bus
PATCH 1/2 PPC64: Add pcibios_remove_root_bus
From: John Rose <[email protected]>
The following patch creates pcibios_remove_root_bus(), which performs the ppc64-specific actions for removal of PCI Host Bridges. This call is invoked by the RPA DLPAR driver upon PHB removal.
Signed-off-by John Rose <[email protected]>
Signed-off-by Paul Mackerras <[email protected]>
arch/ppc64/kernel/pSeries_pci.c +48 -0
@@ -472,6 +472,54 @@remap_bus_range (hose->bus); } + +/* RPA-specific bits for removing PHBs */ +int pcibios_remove_root_bus (struct pci_controller *phb) +{ +struct pci_bus *b = phb->bus; +struct resource *res; +int rc, i; + + res = b->resource[0 ]; +if (!res->flags) { +printk (KERN_ERR "%s: no IO resource for PHB %s\n" , __FUNCTION__, + b->name); +return 1 ; + } + + rc =unmap_bus_range (b); +if (rc) { +printk (KERN_ERR "%s: failed to unmap IO on bus %s\n" , + __FUNCTION__, b->name); +return 1 ; + } + +if (release_resource (res)) { +printk (KERN_ERR "%s: failed to release IO on bus %s\n" , + __FUNCTION__, b->name); +return 1 ; + } + +for (i =1 ; i <3 ; ++i) { + res = b->resource[i]; +if (!res->flags && i ==0 ) { +printk (KERN_ERR "%s: no MEM resource for PHB %s\n" , + __FUNCTION__, b->name); +return 1 ; + } +if (res->flags &&release_resource (res)) { +printk (KERN_ERR +"%s: failed to release IO %d on bus %s\n" , + __FUNCTION__, i, b->name); +return 1 ; + } + } + +list_del (&phb->list_node); +return 0 ; +} +EXPORT_SYMBOL (pcibios_remove_root_bus); +static void __init pSeries_request_regions (void ) {struct device_node *i8042;
include/asm-ppc64/pci-bridge.h +2 -0
@@ -90,6 +90,8 @@extern void pci_process_bridge_OF_ranges (struct pci_controller *hose,struct device_node *dev,int primary); +extern int pcibios_remove_root_bus (struct pci_controller *phb); +/* Use this macro after the PCI bus walk for max performance when it * is known that sysdata is correct. */
Greg KH
AppliedQuoted 5 lines · Paul Mackerras
From: John Rose <[email protected]>
The following patch creates
pcibios_remove_root_bus(), which performs the ppc64-specific actions for removal of PCI Host Bridges. This call is invoked by the RPA DLPAR driver upon PHB removal.
Applied, thanks.
greg k-h