aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/pci/fixup.c2
-rw-r--r--drivers/pci/probe.c33
-rw-r--r--include/linux/pci.h2
3 files changed, 19 insertions, 18 deletions
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index b60b2abd480c..ff3a6a336342 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -502,7 +502,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
502 */ 502 */
503static void fam10h_pci_cfg_space_size(struct pci_dev *dev) 503static void fam10h_pci_cfg_space_size(struct pci_dev *dev)
504{ 504{
505 dev->cfg_size = pci_cfg_space_size_ext(dev, 0); 505 dev->cfg_size = pci_cfg_space_size_ext(dev);
506} 506}
507 507
508DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, fam10h_pci_cfg_space_size); 508DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, fam10h_pci_cfg_space_size);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4a55bf380957..3706ce7972dd 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -842,13 +842,25 @@ static void set_pcie_port_type(struct pci_dev *pdev)
842 * reading the dword at 0x100 which must either be 0 or a valid extended 842 * reading the dword at 0x100 which must either be 0 or a valid extended
843 * capability header. 843 * capability header.
844 */ 844 */
845int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix) 845int pci_cfg_space_size_ext(struct pci_dev *dev)
846{ 846{
847 int pos;
848 u32 status; 847 u32 status;
849 848
850 if (!check_exp_pcix) 849 if (pci_read_config_dword(dev, 256, &status) != PCIBIOS_SUCCESSFUL)
851 goto skip; 850 goto fail;
851 if (status == 0xffffffff)
852 goto fail;
853
854 return PCI_CFG_SPACE_EXP_SIZE;
855
856 fail:
857 return PCI_CFG_SPACE_SIZE;
858}
859
860int pci_cfg_space_size(struct pci_dev *dev)
861{
862 int pos;
863 u32 status;
852 864
853 pos = pci_find_capability(dev, PCI_CAP_ID_EXP); 865 pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
854 if (!pos) { 866 if (!pos) {
@@ -861,23 +873,12 @@ int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix)
861 goto fail; 873 goto fail;
862 } 874 }
863 875
864 skip: 876 return pci_cfg_space_size_ext(dev);
865 if (pci_read_config_dword(dev, 256, &status) != PCIBIOS_SUCCESSFUL)
866 goto fail;
867 if (status == 0xffffffff)
868 goto fail;
869
870 return PCI_CFG_SPACE_EXP_SIZE;
871 877
872 fail: 878 fail:
873 return PCI_CFG_SPACE_SIZE; 879 return PCI_CFG_SPACE_SIZE;
874} 880}
875 881
876int pci_cfg_space_size(struct pci_dev *dev)
877{
878 return pci_cfg_space_size_ext(dev, 1);
879}
880
881static void pci_release_bus_bridge_dev(struct device *dev) 882static void pci_release_bus_bridge_dev(struct device *dev)
882{ 883{
883 kfree(dev); 884 kfree(dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a59517b4930f..509159bcd4e7 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -667,7 +667,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
667 667
668void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 668void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
669 void *userdata); 669 void *userdata);
670int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix); 670int pci_cfg_space_size_ext(struct pci_dev *dev);
671int pci_cfg_space_size(struct pci_dev *dev); 671int pci_cfg_space_size(struct pci_dev *dev);
672unsigned char pci_bus_max_busnr(struct pci_bus *bus); 672unsigned char pci_bus_max_busnr(struct pci_bus *bus);
673 673