aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 40e75f6a5056..8105e32117f6 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -235,7 +235,10 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
235 res->start = l64; 235 res->start = l64;
236 res->end = l64 + sz64; 236 res->end = l64 + sz64;
237 dev_printk(KERN_DEBUG, &dev->dev, 237 dev_printk(KERN_DEBUG, &dev->dev,
238 "reg %x 64bit mmio: %pR\n", pos, res); 238 "reg %x %s: %pR\n", pos,
239 (res->flags & IORESOURCE_PREFETCH) ?
240 "64bit mmio pref" : "64bit mmio",
241 res);
239 } 242 }
240 243
241 res->flags |= IORESOURCE_MEM_64; 244 res->flags |= IORESOURCE_MEM_64;
@@ -249,7 +252,9 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
249 res->end = l + sz; 252 res->end = l + sz;
250 253
251 dev_printk(KERN_DEBUG, &dev->dev, "reg %x %s: %pR\n", pos, 254 dev_printk(KERN_DEBUG, &dev->dev, "reg %x %s: %pR\n", pos,
252 (res->flags & IORESOURCE_IO) ? "io port" : "32bit mmio", 255 (res->flags & IORESOURCE_IO) ? "io port" :
256 ((res->flags & IORESOURCE_PREFETCH) ?
257 "32bit mmio pref" : "32bit mmio"),
253 res); 258 res);
254 } 259 }
255 260
@@ -692,6 +697,23 @@ static void set_pcie_port_type(struct pci_dev *pdev)
692 pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4; 697 pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4;
693} 698}
694 699
700static void set_pcie_hotplug_bridge(struct pci_dev *pdev)
701{
702 int pos;
703 u16 reg16;
704 u32 reg32;
705
706 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
707 if (!pos)
708 return;
709 pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &reg16);
710 if (!(reg16 & PCI_EXP_FLAGS_SLOT))
711 return;
712 pci_read_config_dword(pdev, pos + PCI_EXP_SLTCAP, &reg32);
713 if (reg32 & PCI_EXP_SLTCAP_HPC)
714 pdev->is_hotplug_bridge = 1;
715}
716
695#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED) 717#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
696 718
697/** 719/**
@@ -799,6 +821,7 @@ int pci_setup_device(struct pci_dev *dev)
799 pci_read_irq(dev); 821 pci_read_irq(dev);
800 dev->transparent = ((dev->class & 0xff) == 1); 822 dev->transparent = ((dev->class & 0xff) == 1);
801 pci_read_bases(dev, 2, PCI_ROM_ADDRESS1); 823 pci_read_bases(dev, 2, PCI_ROM_ADDRESS1);
824 set_pcie_hotplug_bridge(dev);
802 break; 825 break;
803 826
804 case PCI_HEADER_TYPE_CARDBUS: /* CardBus bridge header */ 827 case PCI_HEADER_TYPE_CARDBUS: /* CardBus bridge header */
@@ -1009,6 +1032,9 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
1009 /* Fix up broken headers */ 1032 /* Fix up broken headers */
1010 pci_fixup_device(pci_fixup_header, dev); 1033 pci_fixup_device(pci_fixup_header, dev);
1011 1034
1035 /* Clear the state_saved flag. */
1036 dev->state_saved = false;
1037
1012 /* Initialize various capabilities */ 1038 /* Initialize various capabilities */
1013 pci_init_capabilities(dev); 1039 pci_init_capabilities(dev);
1014 1040
@@ -1061,8 +1087,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
1061 if (dev && !dev->is_added) /* new device? */ 1087 if (dev && !dev->is_added) /* new device? */
1062 nr++; 1088 nr++;
1063 1089
1064 if ((dev && dev->multifunction) || 1090 if (dev && dev->multifunction) {
1065 (!dev && pcibios_scan_all_fns(bus, devfn))) {
1066 for (fn = 1; fn < 8; fn++) { 1091 for (fn = 1; fn < 8; fn++) {
1067 dev = pci_scan_single_device(bus, devfn + fn); 1092 dev = pci_scan_single_device(bus, devfn + fn);
1068 if (dev) { 1093 if (dev) {