[PATCH] create pcibios_remove_root_bus()

John Rose johnrose at austin.ibm.com
Thu Aug 19 07:32:27 EST 2004


The following patch creates pcibios_remove_root_bus(), which performs the
ppc64-specific actions for PHB removal.  This patch depends on the following
patches, which haven't yet been accepted :)

Patch 1: imalloc supersets - submitted 7/22/2004
http://lists.linuxppc.org/linuxppc64-dev/200407/msg00171.html

Patch 2: promote hose_list to an "official" list - submitted 8/11/2004
http://lists.linuxppc.org/linuxppc64-dev/200408/msg00041.html

Thanks-
John

Signed-off-by: John Rose <johnrose at austin.ibm.com>

diff -puN arch/ppc64/kernel/pSeries_pci.c~remove_split arch/ppc64/kernel/pSeries_pci.c
--- sles9-rc5/arch/ppc64/kernel/pSeries_pci.c~remove_split	2004-08-18 14:09:57.000000000 -0500
+++ sles9-rc5-johnrose/arch/ppc64/kernel/pSeries_pci.c	2004-08-18 16:14:59.000000000 -0500
@@ -793,3 +793,50 @@ pcibios_scan_all_fns(struct pci_bus *bus

        return 0;
 }
+
+/* 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);
diff -puN include/asm-ppc64/pci-bridge.h~remove_split include/asm-ppc64/pci-bridge.h
--- sles9-rc5/include/asm-ppc64/pci-bridge.h~remove_split	2004-08-18 14:09:57.000000000 -0500
+++ sles9-rc5-johnrose/include/asm-ppc64/pci-bridge.h	2004-08-18 16:14:59.000000000 -0500
@@ -77,6 +77,8 @@ int pci_device_loc(struct device_node *d

 struct device_node *fetch_dev_dn(struct pci_dev *dev);

+extern int pcibios_remove_root_bus(struct pci_controller *phb);
+
 /* Get a device_node from a pci_dev.  This code must be fast except in the case
  * where the sysdata is incorrect and needs to be fixed up (hopefully just once)
  */

_


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list