aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-03-17 01:15:02 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2015-03-23 22:15:49 -0400
commitcca87d303c85b257a7b0fd34f9d6fce1c59880a2 (patch)
tree4145eab3e328314e60b9dcc3590616a93aa7bb90 /arch/powerpc/include
parent12a89dbac7914c58b0d207ef608e1c02534708bc (diff)
powerpc/pci: Refactor pci_dn
Currently, the PCI config accessors are implemented based on device node. Unfortunately, SRIOV VFs won't have the corresponding device nodes. pci_dn will be used in replacement with device node for SRIOV VFs. So we have to use pci_dn in PCI config accessors. The patch refactors pci_dn in following aspects to make it ready to be used in PCI config accessors as we do in subsequent patch: * pci_dn is organized as a hierarchy tree. PCI device's pci_dn is put to the child list of pci_dn of its upstream bridge or PHB. VF's pci_dn will be put to the child list of pci_dn of PF's bridge. * For one particular PCI device (VF or not), its pci_dn can be found from pdev->dev.archdata.pci_data, PCI_DN(devnode), or parent's list. The fast path (fetching pci_dn through PCI device instance) is populated during early fixup time. [bhelgaas: changelog] Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/device.h6
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h11
2 files changed, 15 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 38faeded7d59..9f1371bab5fc 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -8,6 +8,9 @@
8 8
9struct dma_map_ops; 9struct dma_map_ops;
10struct device_node; 10struct device_node;
11#ifdef CONFIG_PPC64
12struct pci_dn;
13#endif
11 14
12/* 15/*
13 * Arch extensions to struct device. 16 * Arch extensions to struct device.
@@ -34,6 +37,9 @@ struct dev_archdata {
34#ifdef CONFIG_SWIOTLB 37#ifdef CONFIG_SWIOTLB
35 dma_addr_t max_direct_dma_addr; 38 dma_addr_t max_direct_dma_addr;
36#endif 39#endif
40#ifdef CONFIG_PPC64
41 struct pci_dn *pci_data;
42#endif
37#ifdef CONFIG_EEH 43#ifdef CONFIG_EEH
38 struct eeh_dev *edev; 44 struct eeh_dev *edev;
39#endif 45#endif
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 546d036fe925..706710b571c3 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -89,6 +89,7 @@ struct pci_controller {
89 89
90#ifdef CONFIG_PPC64 90#ifdef CONFIG_PPC64
91 unsigned long buid; 91 unsigned long buid;
92 struct pci_dn *pci_data;
92#endif /* CONFIG_PPC64 */ 93#endif /* CONFIG_PPC64 */
93 94
94 void *private_data; 95 void *private_data;
@@ -154,9 +155,12 @@ static inline int isa_vaddr_is_ioport(void __iomem *address)
154struct iommu_table; 155struct iommu_table;
155 156
156struct pci_dn { 157struct pci_dn {
158 int flags;
159
157 int busno; /* pci bus number */ 160 int busno; /* pci bus number */
158 int devfn; /* pci device and function number */ 161 int devfn; /* pci device and function number */
159 162
163 struct pci_dn *parent;
160 struct pci_controller *phb; /* for pci devices */ 164 struct pci_controller *phb; /* for pci devices */
161 struct iommu_table *iommu_table; /* for phb's or bridges */ 165 struct iommu_table *iommu_table; /* for phb's or bridges */
162 struct device_node *node; /* back-pointer to the device_node */ 166 struct device_node *node; /* back-pointer to the device_node */
@@ -171,14 +175,17 @@ struct pci_dn {
171#ifdef CONFIG_PPC_POWERNV 175#ifdef CONFIG_PPC_POWERNV
172 int pe_number; 176 int pe_number;
173#endif 177#endif
178 struct list_head child_list;
179 struct list_head list;
174}; 180};
175 181
176/* Get the pointer to a device_node's pci_dn */ 182/* Get the pointer to a device_node's pci_dn */
177#define PCI_DN(dn) ((struct pci_dn *) (dn)->data) 183#define PCI_DN(dn) ((struct pci_dn *) (dn)->data)
178 184
185extern struct pci_dn *pci_get_pdn_by_devfn(struct pci_bus *bus,
186 int devfn);
179extern struct pci_dn *pci_get_pdn(struct pci_dev *pdev); 187extern struct pci_dn *pci_get_pdn(struct pci_dev *pdev);
180 188extern void *update_dn_pci_info(struct device_node *dn, void *data);
181extern void * update_dn_pci_info(struct device_node *dn, void *data);
182 189
183static inline int pci_device_from_OF_node(struct device_node *np, 190static inline int pci_device_from_OF_node(struct device_node *np,
184 u8 *bus, u8 *devfn) 191 u8 *bus, u8 *devfn)