diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2014-08-27 22:57:44 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-29 06:03:05 +1000 |
commit | 434073649f932b6b4b6f240006a48e24205f5a11 (patch) | |
tree | 494bf2db6893095856c4d1db17f36b0fffe1844e | |
parent | 308423515ab9a7213fee7f6992eb9f675caef128 (diff) | |
download | skiboot-434073649f932b6b4b6f240006a48e24205f5a11.zip skiboot-434073649f932b6b4b6f240006a48e24205f5a11.tar.gz skiboot-434073649f932b6b4b6f240006a48e24205f5a11.tar.bz2 |
PCI: Add pci_device_init()
The patch adds function pci_device_init(), which is called by
phb->ops->device_init() to apply common initialization on the
specified PCI device during bootup or after PE reset.
Currently, we only put the logic of MPS configuration to the
function, but more will be put there.
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | core/pci.c | 12 | ||||
-rw-r--r-- | hw/p7ioc-phb.c | 4 | ||||
-rw-r--r-- | hw/phb3.c | 4 | ||||
-rw-r--r-- | include/pci.h | 3 |
4 files changed, 11 insertions, 12 deletions
@@ -578,9 +578,9 @@ static int pci_get_mps(struct phb *phb, return 0; } -static int __pci_configure_mps(struct phb *phb, - struct pci_device *pd, - void *userdata __unused) +static int pci_configure_mps(struct phb *phb, + struct pci_device *pd, + void *userdata __unused) { uint32_t ecap, mps = phb->mps; uint16_t val; @@ -605,9 +605,9 @@ static int __pci_configure_mps(struct phb *phb, return 0; } -int32_t pci_configure_mps(struct phb *phb, struct pci_device *pd) +void pci_device_init(struct phb *phb, struct pci_device *pd) { - return __pci_configure_mps(phb, pd, NULL); + pci_configure_mps(phb, pd, NULL); } /* @@ -718,7 +718,7 @@ static void pci_scan_phb(void *data) /* Configre MPS (Max Payload Size) for PCIe domain */ pci_walk_dev(phb, pci_get_mps, &mps); phb->mps = mps; - pci_walk_dev(phb, __pci_configure_mps, NULL); + pci_walk_dev(phb, pci_configure_mps, NULL); } int64_t pci_register_phb(struct phb *phb) diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c index 0a866fa..89f7ee1 100644 --- a/hw/p7ioc-phb.c +++ b/hw/p7ioc-phb.c @@ -2190,8 +2190,8 @@ static void p7ioc_device_init(struct phb *phb, struct pci_device *dev) } } - /* Reconfigure the MPS */ - pci_configure_mps(phb, dev); + /* Common initialization for the device */ + pci_device_init(phb, dev); if (dev->dev_type == PCIE_TYPE_ROOT_PORT) p7ioc_root_port_init(phb, dev, ecap, aercap); @@ -436,8 +436,8 @@ static void phb3_device_init(struct phb *phb, struct pci_device *dev) } } - /* Reconfigure the MPS */ - pci_configure_mps(phb, dev); + /* Common initialization for the device */ + pci_device_init(phb, dev); if (dev->dev_type == PCIE_TYPE_ROOT_PORT) phb3_root_port_init(phb, dev, ecap, aercap); diff --git a/include/pci.h b/include/pci.h index 210bea3..8b0cca1 100644 --- a/include/pci.h +++ b/include/pci.h @@ -484,8 +484,7 @@ static inline int64_t pci_cfg_write32(struct phb *phb, uint32_t bdfn, extern int64_t pci_find_cap(struct phb *phb, uint16_t bdfn, uint8_t cap); extern int64_t pci_find_ecap(struct phb *phb, uint16_t bdfn, uint16_t cap, uint8_t *version); -extern int32_t pci_configure_mps(struct phb *phb, struct pci_device *pd); - +extern void pci_device_init(struct phb *phb, struct pci_device *pd); extern struct pci_device *pci_walk_dev(struct phb *phb, int (*cb)(struct phb *, struct pci_device *, |