diff options
author | Matthew Garrett <mjg@redhat.com> | 2012-12-05 16:33:27 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-12-05 16:38:26 -0500 |
commit | eca0d4676d8e29c209ddce0c0c1755472ffc70a6 (patch) | |
tree | 0455ac26c96f0a383665fe353d28dbeaa3e1f14b | |
parent | dd5fc854de5fd37adfcef8a366cd21a55aa01d3d (diff) |
PCI: Add pcibios_add_device
Platforms may want to provide architecture-specific functionality during
PCI enumeration. Add a pcibios_add_device() call that architectures can
override to do so.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Seth Forshee <seth.forshee@canonical.com>
-rw-r--r-- | drivers/pci/bus.c | 5 | ||||
-rw-r--r-- | drivers/pci/pci.c | 13 | ||||
-rw-r--r-- | include/linux/pci.h | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 6241fd05bd41..4f22fa16a3ba 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -170,6 +170,11 @@ int pci_bus_add_device(struct pci_dev *dev) | |||
170 | int retval; | 170 | int retval; |
171 | 171 | ||
172 | pci_fixup_device(pci_fixup_final, dev); | 172 | pci_fixup_device(pci_fixup_final, dev); |
173 | |||
174 | retval = pcibios_add_device(dev); | ||
175 | if (retval) | ||
176 | return retval; | ||
177 | |||
173 | retval = device_add(&dev->dev); | 178 | retval = device_add(&dev->dev); |
174 | if (retval) | 179 | if (retval) |
175 | return retval; | 180 | return retval; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 54858838f098..fa0ddd51a216 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1333,6 +1333,19 @@ void pcim_pin_device(struct pci_dev *pdev) | |||
1333 | dr->pinned = 1; | 1333 | dr->pinned = 1; |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | /* | ||
1337 | * pcibios_add_device - provide arch specific hooks when adding device dev | ||
1338 | * @dev: the PCI device being added | ||
1339 | * | ||
1340 | * Permits the platform to provide architecture specific functionality when | ||
1341 | * devices are added. This is the default implementation. Architecture | ||
1342 | * implementations can override this. | ||
1343 | */ | ||
1344 | int __weak pcibios_add_device (struct pci_dev *dev) | ||
1345 | { | ||
1346 | return 0; | ||
1347 | } | ||
1348 | |||
1336 | /** | 1349 | /** |
1337 | * pcibios_disable_device - disable arch specific PCI resources for device dev | 1350 | * pcibios_disable_device - disable arch specific PCI resources for device dev |
1338 | * @dev: the PCI device to disable | 1351 | * @dev: the PCI device to disable |
diff --git a/include/linux/pci.h b/include/linux/pci.h index ee2179546c63..195c2593bd31 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -1592,6 +1592,7 @@ void pcibios_disable_device(struct pci_dev *dev); | |||
1592 | void pcibios_set_master(struct pci_dev *dev); | 1592 | void pcibios_set_master(struct pci_dev *dev); |
1593 | int pcibios_set_pcie_reset_state(struct pci_dev *dev, | 1593 | int pcibios_set_pcie_reset_state(struct pci_dev *dev, |
1594 | enum pcie_reset_state state); | 1594 | enum pcie_reset_state state); |
1595 | int pcibios_add_device(struct pci_dev *dev); | ||
1595 | 1596 | ||
1596 | #ifdef CONFIG_PCI_MMCONFIG | 1597 | #ifdef CONFIG_PCI_MMCONFIG |
1597 | extern void __init pci_mmcfg_early_init(void); | 1598 | extern void __init pci_mmcfg_early_init(void); |