Skip to contentSkip to conversation

ppc64: Improve PCI config accessors

PATCH New Benjamin Herrenschmidt 1 participant 1 message Oct 26, 2004 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc64: Improve PCI config accessors

This patch improves the config space access routines on G5, by adding a generic helper function to locate the pci_controller structure (to be used by an upcoming new platform too) and cleaning up the pmac routines. It includes the fix to skip devices that aren't present in the OF tree that is necessary for newer G5 desktop models.

arch/ppc64/kernel/pmac.h +0 -1
Index: linux-work/arch/ppc64/kernel/pmac.h
===================================================================
@@ -18,7 +18,6 @@
 extern void pmac_pcibios_fixup(void);
 extern void pmac_pci_init(void);
 extern void pmac_setup_pci_dma(void);
-extern void fixup_k2_sata(struct pci_dev* dev);
 extern void pmac_check_ht_link(void);
 
 extern void pmac_setup_smp(void);
include/asm-ppc64/pci-bridge.h +17 -0
Index: linux-work/include/asm-ppc64/pci-bridge.h
===================================================================
@@ -101,5 +101,22 @@
 
 extern void phbs_remap_io(void);
 
+static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
+{
+	struct device_node *busdn;
+
+	busdn = bus->sysdata;
+	if (busdn == 0) {
+		struct pci_bus *b;
+		for (b = bus->parent; b && bus->sysdata == 0; b = b->parent)
+			;
+		busdn = b->sysdata;
+	}
+	if (busdn == NULL)
+		return NULL;
+	return busdn->phb;
+}
+
+
 #endif
 #endif /* __KERNEL__ */
arch/ppc64/kernel/pmac_pci.c +53 -65

212 lines not on this page · raw message