diff options
64 files changed, 796 insertions, 681 deletions
diff --git a/Documentation/devicetree/bindings/pci/ti-pci.txt b/Documentation/devicetree/bindings/pci/ti-pci.txt index 3d217911b313..60e25161f351 100644 --- a/Documentation/devicetree/bindings/pci/ti-pci.txt +++ b/Documentation/devicetree/bindings/pci/ti-pci.txt | |||
@@ -23,6 +23,9 @@ PCIe Designware Controller | |||
23 | interrupt-map-mask, | 23 | interrupt-map-mask, |
24 | interrupt-map : as specified in ../designware-pcie.txt | 24 | interrupt-map : as specified in ../designware-pcie.txt |
25 | 25 | ||
26 | Optional Property: | ||
27 | - gpios : Should be added if a gpio line is required to drive PERST# line | ||
28 | |||
26 | Example: | 29 | Example: |
27 | axi { | 30 | axi { |
28 | compatible = "simple-bus"; | 31 | compatible = "simple-bus"; |
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index 82f738e5d54c..cded02c890aa 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c | |||
@@ -242,12 +242,7 @@ pci_restore_srm_config(void) | |||
242 | 242 | ||
243 | void pcibios_fixup_bus(struct pci_bus *bus) | 243 | void pcibios_fixup_bus(struct pci_bus *bus) |
244 | { | 244 | { |
245 | struct pci_dev *dev = bus->self; | 245 | struct pci_dev *dev; |
246 | |||
247 | if (pci_has_flag(PCI_PROBE_ONLY) && dev && | ||
248 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | ||
249 | pci_read_bridge_bases(bus); | ||
250 | } | ||
251 | 246 | ||
252 | list_for_each_entry(dev, &bus->devices, bus_list) { | 247 | list_for_each_entry(dev, &bus->devices, bus_list) { |
253 | pdev_save_srm_config(dev); | 248 | pdev_save_srm_config(dev); |
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts index a63bf78191ea..f9a4b317ed2f 100644 --- a/arch/arm/boot/dts/am57xx-beagle-x15.dts +++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts | |||
@@ -693,3 +693,7 @@ | |||
693 | }; | 693 | }; |
694 | }; | 694 | }; |
695 | }; | 695 | }; |
696 | |||
697 | &pcie1 { | ||
698 | gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; | ||
699 | }; | ||
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index e60677e25d62..b058b3146874 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
@@ -211,7 +211,7 @@ | |||
211 | #address-cells = <1>; | 211 | #address-cells = <1>; |
212 | ranges = <0x51000000 0x51000000 0x3000 | 212 | ranges = <0x51000000 0x51000000 0x3000 |
213 | 0x0 0x20000000 0x10000000>; | 213 | 0x0 0x20000000 0x10000000>; |
214 | pcie@51000000 { | 214 | pcie1: pcie@51000000 { |
215 | compatible = "ti,dra7-pcie"; | 215 | compatible = "ti,dra7-pcie"; |
216 | reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; | 216 | reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; |
217 | reg-names = "rc_dbics", "ti_conf", "config"; | 217 | reg-names = "rc_dbics", "ti_conf", "config"; |
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h index 28b9bb35949e..8857d2869a5f 100644 --- a/arch/arm/include/asm/mach/pci.h +++ b/arch/arm/include/asm/mach/pci.h | |||
@@ -19,9 +19,7 @@ struct pci_bus; | |||
19 | struct device; | 19 | struct device; |
20 | 20 | ||
21 | struct hw_pci { | 21 | struct hw_pci { |
22 | #ifdef CONFIG_PCI_MSI | ||
23 | struct msi_controller *msi_ctrl; | 22 | struct msi_controller *msi_ctrl; |
24 | #endif | ||
25 | struct pci_ops *ops; | 23 | struct pci_ops *ops; |
26 | int nr_controllers; | 24 | int nr_controllers; |
27 | void **private_data; | 25 | void **private_data; |
@@ -42,9 +40,6 @@ struct hw_pci { | |||
42 | * Per-controller structure | 40 | * Per-controller structure |
43 | */ | 41 | */ |
44 | struct pci_sys_data { | 42 | struct pci_sys_data { |
45 | #ifdef CONFIG_PCI_MSI | ||
46 | struct msi_controller *msi_ctrl; | ||
47 | #endif | ||
48 | struct list_head node; | 43 | struct list_head node; |
49 | int busnr; /* primary bus number */ | 44 | int busnr; /* primary bus number */ |
50 | u64 mem_offset; /* bus->cpu memory mapping offset */ | 45 | u64 mem_offset; /* bus->cpu memory mapping offset */ |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index fcbbbb1b9e95..874e1823f803 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -18,15 +18,6 @@ | |||
18 | 18 | ||
19 | static int debug_pci; | 19 | static int debug_pci; |
20 | 20 | ||
21 | #ifdef CONFIG_PCI_MSI | ||
22 | struct msi_controller *pcibios_msi_controller(struct pci_dev *dev) | ||
23 | { | ||
24 | struct pci_sys_data *sysdata = dev->bus->sysdata; | ||
25 | |||
26 | return sysdata->msi_ctrl; | ||
27 | } | ||
28 | #endif | ||
29 | |||
30 | /* | 21 | /* |
31 | * We can't use pci_get_device() here since we are | 22 | * We can't use pci_get_device() here since we are |
32 | * called from interrupt context. | 23 | * called from interrupt context. |
@@ -459,12 +450,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, | |||
459 | 450 | ||
460 | for (nr = busnr = 0; nr < hw->nr_controllers; nr++) { | 451 | for (nr = busnr = 0; nr < hw->nr_controllers; nr++) { |
461 | sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL); | 452 | sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL); |
462 | if (!sys) | 453 | if (WARN(!sys, "PCI: unable to allocate sys data!")) |
463 | panic("PCI: unable to allocate sys data!"); | 454 | break; |
464 | 455 | ||
465 | #ifdef CONFIG_PCI_MSI | ||
466 | sys->msi_ctrl = hw->msi_ctrl; | ||
467 | #endif | ||
468 | sys->busnr = busnr; | 456 | sys->busnr = busnr; |
469 | sys->swizzle = hw->swizzle; | 457 | sys->swizzle = hw->swizzle; |
470 | sys->map_irq = hw->map_irq; | 458 | sys->map_irq = hw->map_irq; |
@@ -486,11 +474,14 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, | |||
486 | if (hw->scan) | 474 | if (hw->scan) |
487 | sys->bus = hw->scan(nr, sys); | 475 | sys->bus = hw->scan(nr, sys); |
488 | else | 476 | else |
489 | sys->bus = pci_scan_root_bus(parent, sys->busnr, | 477 | sys->bus = pci_scan_root_bus_msi(parent, |
490 | hw->ops, sys, &sys->resources); | 478 | sys->busnr, hw->ops, sys, |
479 | &sys->resources, hw->msi_ctrl); | ||
491 | 480 | ||
492 | if (!sys->bus) | 481 | if (WARN(!sys->bus, "PCI: unable to scan bus!")) { |
493 | panic("PCI: unable to scan bus!"); | 482 | kfree(sys); |
483 | break; | ||
484 | } | ||
494 | 485 | ||
495 | busnr = sys->bus->busn_res.end + 1; | 486 | busnr = sys->bus->busn_res.end + 1; |
496 | 487 | ||
@@ -521,6 +512,8 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) | |||
521 | struct pci_bus *bus = sys->bus; | 512 | struct pci_bus *bus = sys->bus; |
522 | 513 | ||
523 | if (!pci_has_flag(PCI_PROBE_ONLY)) { | 514 | if (!pci_has_flag(PCI_PROBE_ONLY)) { |
515 | struct pci_bus *child; | ||
516 | |||
524 | /* | 517 | /* |
525 | * Size the bridge windows. | 518 | * Size the bridge windows. |
526 | */ | 519 | */ |
@@ -530,25 +523,15 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) | |||
530 | * Assign resources. | 523 | * Assign resources. |
531 | */ | 524 | */ |
532 | pci_bus_assign_resources(bus); | 525 | pci_bus_assign_resources(bus); |
533 | } | ||
534 | 526 | ||
527 | list_for_each_entry(child, &bus->children, node) | ||
528 | pcie_bus_configure_settings(child); | ||
529 | } | ||
535 | /* | 530 | /* |
536 | * Tell drivers about devices found. | 531 | * Tell drivers about devices found. |
537 | */ | 532 | */ |
538 | pci_bus_add_devices(bus); | 533 | pci_bus_add_devices(bus); |
539 | } | 534 | } |
540 | |||
541 | list_for_each_entry(sys, &head, node) { | ||
542 | struct pci_bus *bus = sys->bus; | ||
543 | |||
544 | /* Configure PCI Express settings */ | ||
545 | if (bus && !pci_has_flag(PCI_PROBE_ONLY)) { | ||
546 | struct pci_bus *child; | ||
547 | |||
548 | list_for_each_entry(child, &bus->children, node) | ||
549 | pcie_bus_configure_settings(child); | ||
550 | } | ||
551 | } | ||
552 | } | 535 | } |
553 | 536 | ||
554 | #ifndef CONFIG_PCI_HOST_ITE8152 | 537 | #ifndef CONFIG_PCI_HOST_ITE8152 |
diff --git a/arch/arm64/boot/dts/apm/apm-storm.dtsi b/arch/arm64/boot/dts/apm/apm-storm.dtsi index 58093edeea2e..d831bc2ac204 100644 --- a/arch/arm64/boot/dts/apm/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm/apm-storm.dtsi | |||
@@ -490,7 +490,8 @@ | |||
490 | 0xe0 0xd0000000 0x0 0x00040000>; /* PCI config space */ | 490 | 0xe0 0xd0000000 0x0 0x00040000>; /* PCI config space */ |
491 | reg-names = "csr", "cfg"; | 491 | reg-names = "csr", "cfg"; |
492 | ranges = <0x01000000 0x00 0x00000000 0xe0 0x10000000 0x00 0x00010000 /* io */ | 492 | ranges = <0x01000000 0x00 0x00000000 0xe0 0x10000000 0x00 0x00010000 /* io */ |
493 | 0x02000000 0x00 0x80000000 0xe1 0x80000000 0x00 0x80000000>; /* mem */ | 493 | 0x02000000 0x00 0x80000000 0xe1 0x80000000 0x00 0x80000000 /* mem */ |
494 | 0x43000000 0xf0 0x00000000 0xf0 0x00000000 0x10 0x00000000>; /* mem */ | ||
494 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 | 495 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 |
495 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; | 496 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; |
496 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; | 497 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; |
@@ -513,8 +514,9 @@ | |||
513 | reg = < 0x00 0x1f2c0000 0x0 0x00010000 /* Controller registers */ | 514 | reg = < 0x00 0x1f2c0000 0x0 0x00010000 /* Controller registers */ |
514 | 0xd0 0xd0000000 0x0 0x00040000>; /* PCI config space */ | 515 | 0xd0 0xd0000000 0x0 0x00040000>; /* PCI config space */ |
515 | reg-names = "csr", "cfg"; | 516 | reg-names = "csr", "cfg"; |
516 | ranges = <0x01000000 0x0 0x00000000 0xd0 0x10000000 0x00 0x00010000 /* io */ | 517 | ranges = <0x01000000 0x00 0x00000000 0xd0 0x10000000 0x00 0x00010000 /* io */ |
517 | 0x02000000 0x0 0x80000000 0xd1 0x80000000 0x00 0x80000000>; /* mem */ | 518 | 0x02000000 0x00 0x80000000 0xd1 0x80000000 0x00 0x80000000 /* mem */ |
519 | 0x43000000 0xd8 0x00000000 0xd8 0x00000000 0x08 0x00000000>; /* mem */ | ||
518 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 | 520 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 |
519 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; | 521 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; |
520 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; | 522 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; |
@@ -537,8 +539,9 @@ | |||
537 | reg = < 0x00 0x1f2d0000 0x0 0x00010000 /* Controller registers */ | 539 | reg = < 0x00 0x1f2d0000 0x0 0x00010000 /* Controller registers */ |
538 | 0x90 0xd0000000 0x0 0x00040000>; /* PCI config space */ | 540 | 0x90 0xd0000000 0x0 0x00040000>; /* PCI config space */ |
539 | reg-names = "csr", "cfg"; | 541 | reg-names = "csr", "cfg"; |
540 | ranges = <0x01000000 0x0 0x00000000 0x90 0x10000000 0x0 0x00010000 /* io */ | 542 | ranges = <0x01000000 0x00 0x00000000 0x90 0x10000000 0x00 0x00010000 /* io */ |
541 | 0x02000000 0x0 0x80000000 0x91 0x80000000 0x0 0x80000000>; /* mem */ | 543 | 0x02000000 0x00 0x80000000 0x91 0x80000000 0x00 0x80000000 /* mem */ |
544 | 0x43000000 0x94 0x00000000 0x94 0x00000000 0x04 0x00000000>; /* mem */ | ||
542 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 | 545 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 |
543 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; | 546 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; |
544 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; | 547 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; |
@@ -561,8 +564,9 @@ | |||
561 | reg = < 0x00 0x1f500000 0x0 0x00010000 /* Controller registers */ | 564 | reg = < 0x00 0x1f500000 0x0 0x00010000 /* Controller registers */ |
562 | 0xa0 0xd0000000 0x0 0x00040000>; /* PCI config space */ | 565 | 0xa0 0xd0000000 0x0 0x00040000>; /* PCI config space */ |
563 | reg-names = "csr", "cfg"; | 566 | reg-names = "csr", "cfg"; |
564 | ranges = <0x01000000 0x0 0x00000000 0xa0 0x10000000 0x0 0x00010000 /* io */ | 567 | ranges = <0x01000000 0x00 0x00000000 0xa0 0x10000000 0x00 0x00010000 /* io */ |
565 | 0x02000000 0x0 0x80000000 0xa1 0x80000000 0x0 0x80000000>; /* mem */ | 568 | 0x02000000 0x00 0x80000000 0xa1 0x80000000 0x00 0x80000000 /* mem */ |
569 | 0x43000000 0xb0 0x00000000 0xb0 0x00000000 0x10 0x00000000>; /* mem */ | ||
566 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 | 570 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 |
567 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; | 571 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; |
568 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; | 572 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; |
@@ -585,8 +589,9 @@ | |||
585 | reg = < 0x00 0x1f510000 0x0 0x00010000 /* Controller registers */ | 589 | reg = < 0x00 0x1f510000 0x0 0x00010000 /* Controller registers */ |
586 | 0xc0 0xd0000000 0x0 0x00200000>; /* PCI config space */ | 590 | 0xc0 0xd0000000 0x0 0x00200000>; /* PCI config space */ |
587 | reg-names = "csr", "cfg"; | 591 | reg-names = "csr", "cfg"; |
588 | ranges = <0x01000000 0x0 0x00000000 0xc0 0x10000000 0x0 0x00010000 /* io */ | 592 | ranges = <0x01000000 0x00 0x00000000 0xc0 0x10000000 0x00 0x00010000 /* io */ |
589 | 0x02000000 0x0 0x80000000 0xc1 0x80000000 0x0 0x80000000>; /* mem */ | 593 | 0x02000000 0x00 0x80000000 0xc1 0x80000000 0x00 0x80000000 /* mem */ |
594 | 0x43000000 0xc8 0x00000000 0xc8 0x00000000 0x08 0x00000000>; /* mem */ | ||
590 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 | 595 | dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000 |
591 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; | 596 | 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>; |
592 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; | 597 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; |
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c index 0635bd6c2af3..34bb4b13e079 100644 --- a/arch/frv/mb93090-mb00/pci-frv.c +++ b/arch/frv/mb93090-mb00/pci-frv.c | |||
@@ -175,14 +175,6 @@ static void __init pcibios_assign_resources(void) | |||
175 | if (!r->start && r->end) | 175 | if (!r->start && r->end) |
176 | pci_assign_resource(dev, idx); | 176 | pci_assign_resource(dev, idx); |
177 | } | 177 | } |
178 | |||
179 | if (pci_probe & PCI_ASSIGN_ROMS) { | ||
180 | r = &dev->resource[PCI_ROM_RESOURCE]; | ||
181 | r->end -= r->start; | ||
182 | r->start = 0; | ||
183 | if (r->end) | ||
184 | pci_assign_resource(dev, PCI_ROM_RESOURCE); | ||
185 | } | ||
186 | } | 178 | } |
187 | } | 179 | } |
188 | 180 | ||
diff --git a/arch/frv/mb93090-mb00/pci-frv.h b/arch/frv/mb93090-mb00/pci-frv.h index a7e487fe76ed..d51992ff5a61 100644 --- a/arch/frv/mb93090-mb00/pci-frv.h +++ b/arch/frv/mb93090-mb00/pci-frv.h | |||
@@ -14,14 +14,6 @@ | |||
14 | #define DBG(x...) | 14 | #define DBG(x...) |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #define PCI_PROBE_BIOS 0x0001 | ||
18 | #define PCI_PROBE_CONF1 0x0002 | ||
19 | #define PCI_PROBE_CONF2 0x0004 | ||
20 | #define PCI_NO_CHECKS 0x0400 | ||
21 | #define PCI_ASSIGN_ROMS 0x1000 | ||
22 | #define PCI_BIOS_IRQ_SCAN 0x2000 | ||
23 | #define PCI_ASSIGN_ALL_BUSSES 0x4000 | ||
24 | |||
25 | extern unsigned int __nongpreldata pci_probe; | 17 | extern unsigned int __nongpreldata pci_probe; |
26 | 18 | ||
27 | /* pci-frv.c */ | 19 | /* pci-frv.c */ |
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c index f211839e2cae..f9c86c475bbd 100644 --- a/arch/frv/mb93090-mb00/pci-vdk.c +++ b/arch/frv/mb93090-mb00/pci-vdk.c | |||
@@ -294,8 +294,6 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
294 | printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); | 294 | printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); |
295 | #endif | 295 | #endif |
296 | 296 | ||
297 | pci_read_bridge_bases(bus); | ||
298 | |||
299 | if (bus->number == 0) { | 297 | if (bus->number == 0) { |
300 | struct pci_dev *dev; | 298 | struct pci_dev *dev; |
301 | list_for_each_entry(dev, &bus->devices, bus_list) { | 299 | list_for_each_entry(dev, &bus->devices, bus_list) { |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 7cc3be9fa7c6..d89b6013c941 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -533,10 +533,9 @@ void pcibios_fixup_bus(struct pci_bus *b) | |||
533 | { | 533 | { |
534 | struct pci_dev *dev; | 534 | struct pci_dev *dev; |
535 | 535 | ||
536 | if (b->self) { | 536 | if (b->self) |
537 | pci_read_bridge_bases(b); | ||
538 | pcibios_fixup_bridge_resources(b->self); | 537 | pcibios_fixup_bridge_resources(b->self); |
539 | } | 538 | |
540 | list_for_each_entry(dev, &b->devices, bus_list) | 539 | list_for_each_entry(dev, &b->devices, bus_list) |
541 | pcibios_fixup_device_resources(dev); | 540 | pcibios_fixup_device_resources(dev); |
542 | platform_pci_fixup_bus(b); | 541 | platform_pci_fixup_bus(b); |
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index ae838ed5fcf2..6b8b75266801 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -863,14 +863,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus) | |||
863 | 863 | ||
864 | void pcibios_fixup_bus(struct pci_bus *bus) | 864 | void pcibios_fixup_bus(struct pci_bus *bus) |
865 | { | 865 | { |
866 | /* When called from the generic PCI probe, read PCI<->PCI bridge | 866 | /* Fixup the bus */ |
867 | * bases. This is -not- called when generating the PCI tree from | ||
868 | * the OF device-tree. | ||
869 | */ | ||
870 | if (bus->self != NULL) | ||
871 | pci_read_bridge_bases(bus); | ||
872 | |||
873 | /* Now fixup the bus bus */ | ||
874 | pcibios_setup_bus_self(bus); | 867 | pcibios_setup_bus_self(bus); |
875 | 868 | ||
876 | /* Now fixup devices on that bus */ | 869 | /* Now fixup devices on that bus */ |
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index b8a0bf5766f2..c6996cf67a5c 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c | |||
@@ -311,12 +311,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
311 | 311 | ||
312 | void pcibios_fixup_bus(struct pci_bus *bus) | 312 | void pcibios_fixup_bus(struct pci_bus *bus) |
313 | { | 313 | { |
314 | struct pci_dev *dev = bus->self; | ||
315 | |||
316 | if (pci_has_flag(PCI_PROBE_ONLY) && dev && | ||
317 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | ||
318 | pci_read_bridge_bases(bus); | ||
319 | } | ||
320 | } | 314 | } |
321 | 315 | ||
322 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); | 316 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); |
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c index b5b036f64275..b7ab8378964c 100644 --- a/arch/mn10300/unit-asb2305/pci-asb2305.c +++ b/arch/mn10300/unit-asb2305/pci-asb2305.c | |||
@@ -183,18 +183,16 @@ static int __init pcibios_assign_resources(void) | |||
183 | struct pci_dev *dev = NULL; | 183 | struct pci_dev *dev = NULL; |
184 | struct resource *r; | 184 | struct resource *r; |
185 | 185 | ||
186 | if (!(pci_probe & PCI_ASSIGN_ROMS)) { | 186 | /* Try to use BIOS settings for ROMs, otherwise let |
187 | /* Try to use BIOS settings for ROMs, otherwise let | 187 | pci_assign_unassigned_resources() allocate the new |
188 | pci_assign_unassigned_resources() allocate the new | 188 | addresses. */ |
189 | addresses. */ | 189 | for_each_pci_dev(dev) { |
190 | for_each_pci_dev(dev) { | 190 | r = &dev->resource[PCI_ROM_RESOURCE]; |
191 | r = &dev->resource[PCI_ROM_RESOURCE]; | 191 | if (!r->flags || !r->start) |
192 | if (!r->flags || !r->start) | 192 | continue; |
193 | continue; | 193 | if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { |
194 | if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { | 194 | r->end -= r->start; |
195 | r->end -= r->start; | 195 | r->start = 0; |
196 | r->start = 0; | ||
197 | } | ||
198 | } | 196 | } |
199 | } | 197 | } |
200 | 198 | ||
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h index 9e17aca5a2a1..96c484b12226 100644 --- a/arch/mn10300/unit-asb2305/pci-asb2305.h +++ b/arch/mn10300/unit-asb2305/pci-asb2305.h | |||
@@ -20,13 +20,6 @@ | |||
20 | #define DBG(x...) | 20 | #define DBG(x...) |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #define PCI_PROBE_BIOS 1 | ||
24 | #define PCI_PROBE_CONF1 2 | ||
25 | #define PCI_PROBE_CONF2 4 | ||
26 | #define PCI_NO_CHECKS 0x400 | ||
27 | #define PCI_ASSIGN_ROMS 0x1000 | ||
28 | #define PCI_BIOS_IRQ_SCAN 0x2000 | ||
29 | |||
30 | extern unsigned int pci_probe; | 23 | extern unsigned int pci_probe; |
31 | 24 | ||
32 | /* pci-asb2305.c */ | 25 | /* pci-asb2305.c */ |
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 3dfe2d31c67b..deaa893efba5 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
@@ -324,7 +324,6 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
324 | struct pci_dev *dev; | 324 | struct pci_dev *dev; |
325 | 325 | ||
326 | if (bus->self) { | 326 | if (bus->self) { |
327 | pci_read_bridge_bases(bus); | ||
328 | pcibios_fixup_bridge_resources(bus->self); | 327 | pcibios_fixup_bridge_resources(bus->self); |
329 | } | 328 | } |
330 | 329 | ||
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index b9de34d44fcb..02c1d5dcee4d 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1044,13 +1044,7 @@ void pcibios_set_master(struct pci_dev *dev) | |||
1044 | 1044 | ||
1045 | void pcibios_fixup_bus(struct pci_bus *bus) | 1045 | void pcibios_fixup_bus(struct pci_bus *bus) |
1046 | { | 1046 | { |
1047 | /* When called from the generic PCI probe, read PCI<->PCI bridge | 1047 | /* Fixup the bus */ |
1048 | * bases. This is -not- called when generating the PCI tree from | ||
1049 | * the OF device-tree. | ||
1050 | */ | ||
1051 | pci_read_bridge_bases(bus); | ||
1052 | |||
1053 | /* Now fixup the bus bus */ | ||
1054 | pcibios_setup_bus_self(bus); | 1048 | pcibios_setup_bus_self(bus); |
1055 | 1049 | ||
1056 | /* Now fixup devices on that bus */ | 1050 | /* Now fixup devices on that bus */ |
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index efc3fa54c90b..c8c62c7fc31c 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c | |||
@@ -126,7 +126,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, | |||
126 | { | 126 | { |
127 | struct pci_dev *dev; | 127 | struct pci_dev *dev; |
128 | const char *type; | 128 | const char *type; |
129 | struct pci_slot *slot; | ||
130 | 129 | ||
131 | dev = pci_alloc_dev(bus); | 130 | dev = pci_alloc_dev(bus); |
132 | if (!dev) | 131 | if (!dev) |
@@ -145,10 +144,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, | |||
145 | dev->needs_freset = 0; /* pcie fundamental reset required */ | 144 | dev->needs_freset = 0; /* pcie fundamental reset required */ |
146 | set_pcie_port_type(dev); | 145 | set_pcie_port_type(dev); |
147 | 146 | ||
148 | list_for_each_entry(slot, &dev->bus->slots, list) | 147 | pci_dev_assign_slot(dev); |
149 | if (PCI_SLOT(dev->devfn) == slot->number) | ||
150 | dev->slot = slot; | ||
151 | |||
152 | dev->vendor = get_int_prop(node, "vendor-id", 0xffff); | 148 | dev->vendor = get_int_prop(node, "vendor-id", 0xffff); |
153 | dev->device = get_int_prop(node, "device-id", 0xffff); | 149 | dev->device = get_int_prop(node, "device-id", 0xffff); |
154 | dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0); | 150 | dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0); |
diff --git a/arch/sh/drivers/pci/pci-sh4.h b/arch/sh/drivers/pci/pci-sh4.h index cbf763b3015e..0288efc17ff3 100644 --- a/arch/sh/drivers/pci/pci-sh4.h +++ b/arch/sh/drivers/pci/pci-sh4.h | |||
@@ -11,14 +11,6 @@ | |||
11 | 11 | ||
12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
13 | 13 | ||
14 | /* startup values */ | ||
15 | #define PCI_PROBE_BIOS 1 | ||
16 | #define PCI_PROBE_CONF1 2 | ||
17 | #define PCI_PROBE_CONF2 4 | ||
18 | #define PCI_NO_CHECKS 0x400 | ||
19 | #define PCI_ASSIGN_ROMS 0x1000 | ||
20 | #define PCI_BIOS_IRQ_SCAN 0x2000 | ||
21 | |||
22 | #define SH4_PCICR 0x100 /* PCI Control Register */ | 14 | #define SH4_PCICR 0x100 /* PCI Control Register */ |
23 | #define SH4_PCICR_PREFIX 0xA5000000 /* CR prefix for write */ | 15 | #define SH4_PCICR_PREFIX 0xA5000000 /* CR prefix for write */ |
24 | #define SH4_PCICR_FTO 0x00000400 /* TRDY/IRDY Enable */ | 16 | #define SH4_PCICR_FTO 0x00000400 /* TRDY/IRDY Enable */ |
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index c928bc64b4ba..3a0e1a986bfe 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -249,7 +249,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, | |||
249 | struct pci_bus *bus, int devfn) | 249 | struct pci_bus *bus, int devfn) |
250 | { | 250 | { |
251 | struct dev_archdata *sd; | 251 | struct dev_archdata *sd; |
252 | struct pci_slot *slot; | ||
253 | struct platform_device *op; | 252 | struct platform_device *op; |
254 | struct pci_dev *dev; | 253 | struct pci_dev *dev; |
255 | const char *type; | 254 | const char *type; |
@@ -290,10 +289,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, | |||
290 | dev->multifunction = 0; /* maybe a lie? */ | 289 | dev->multifunction = 0; /* maybe a lie? */ |
291 | set_pcie_port_type(dev); | 290 | set_pcie_port_type(dev); |
292 | 291 | ||
293 | list_for_each_entry(slot, &dev->bus->slots, list) | 292 | pci_dev_assign_slot(dev); |
294 | if (PCI_SLOT(dev->devfn) == slot->number) | ||
295 | dev->slot = slot; | ||
296 | |||
297 | dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); | 293 | dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); |
298 | dev->device = of_getintprop_default(node, "device-id", 0xffff); | 294 | dev->device = of_getintprop_default(node, "device-id", 0xffff); |
299 | dev->subsystem_vendor = | 295 | dev->subsystem_vendor = |
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h index 164e3f8d3c3d..fa1195dae425 100644 --- a/arch/x86/include/asm/pci_x86.h +++ b/arch/x86/include/asm/pci_x86.h | |||
@@ -93,8 +93,6 @@ extern raw_spinlock_t pci_config_lock; | |||
93 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); | 93 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); |
94 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); | 94 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); |
95 | 95 | ||
96 | extern bool mp_should_keep_irq(struct device *dev); | ||
97 | |||
98 | struct pci_raw_ops { | 96 | struct pci_raw_ops { |
99 | int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn, | 97 | int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn, |
100 | int reg, int len, u32 *val); | 98 | int reg, int len, u32 *val); |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 8fd6f44aee83..09d3afc0a181 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -166,7 +166,6 @@ void pcibios_fixup_bus(struct pci_bus *b) | |||
166 | { | 166 | { |
167 | struct pci_dev *dev; | 167 | struct pci_dev *dev; |
168 | 168 | ||
169 | pci_read_bridge_bases(b); | ||
170 | list_for_each_entry(dev, &b->devices, bus_list) | 169 | list_for_each_entry(dev, &b->devices, bus_list) |
171 | pcibios_fixup_device_resources(dev); | 170 | pcibios_fixup_device_resources(dev); |
172 | } | 171 | } |
@@ -673,24 +672,22 @@ int pcibios_add_device(struct pci_dev *dev) | |||
673 | return 0; | 672 | return 0; |
674 | } | 673 | } |
675 | 674 | ||
676 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 675 | int pcibios_alloc_irq(struct pci_dev *dev) |
677 | { | 676 | { |
678 | int err; | 677 | return pcibios_enable_irq(dev); |
679 | |||
680 | if ((err = pci_enable_resources(dev, mask)) < 0) | ||
681 | return err; | ||
682 | |||
683 | if (!pci_dev_msi_enabled(dev)) | ||
684 | return pcibios_enable_irq(dev); | ||
685 | return 0; | ||
686 | } | 678 | } |
687 | 679 | ||
688 | void pcibios_disable_device (struct pci_dev *dev) | 680 | void pcibios_free_irq(struct pci_dev *dev) |
689 | { | 681 | { |
690 | if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq) | 682 | if (pcibios_disable_irq) |
691 | pcibios_disable_irq(dev); | 683 | pcibios_disable_irq(dev); |
692 | } | 684 | } |
693 | 685 | ||
686 | int pcibios_enable_device(struct pci_dev *dev, int mask) | ||
687 | { | ||
688 | return pci_enable_resources(dev, mask); | ||
689 | } | ||
690 | |||
694 | int pci_ext_cfg_avail(void) | 691 | int pci_ext_cfg_avail(void) |
695 | { | 692 | { |
696 | if (raw_pci_ext_ops) | 693 | if (raw_pci_ext_ops) |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 9a2b7101ae8a..e58565556703 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -62,19 +62,6 @@ static void pci_fixup_umc_ide(struct pci_dev *d) | |||
62 | } | 62 | } |
63 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, pci_fixup_umc_ide); | 63 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, pci_fixup_umc_ide); |
64 | 64 | ||
65 | static void pci_fixup_ncr53c810(struct pci_dev *d) | ||
66 | { | ||
67 | /* | ||
68 | * NCR 53C810 returns class code 0 (at least on some systems). | ||
69 | * Fix class to be PCI_CLASS_STORAGE_SCSI | ||
70 | */ | ||
71 | if (!d->class) { | ||
72 | dev_warn(&d->dev, "Fixing NCR 53C810 class code\n"); | ||
73 | d->class = PCI_CLASS_STORAGE_SCSI << 8; | ||
74 | } | ||
75 | } | ||
76 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, pci_fixup_ncr53c810); | ||
77 | |||
78 | static void pci_fixup_latency(struct pci_dev *d) | 65 | static void pci_fixup_latency(struct pci_dev *d) |
79 | { | 66 | { |
80 | /* | 67 | /* |
diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c index 27062303c881..22aaefb4f1ca 100644 --- a/arch/x86/pci/intel_mid_pci.c +++ b/arch/x86/pci/intel_mid_pci.c | |||
@@ -211,7 +211,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev) | |||
211 | struct irq_alloc_info info; | 211 | struct irq_alloc_info info; |
212 | int polarity; | 212 | int polarity; |
213 | 213 | ||
214 | if (dev->irq_managed && dev->irq > 0) | 214 | if (pci_has_managed_irq(dev)) |
215 | return 0; | 215 | return 0; |
216 | 216 | ||
217 | if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) | 217 | if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) |
@@ -234,10 +234,13 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev) | |||
234 | 234 | ||
235 | static void intel_mid_pci_irq_disable(struct pci_dev *dev) | 235 | static void intel_mid_pci_irq_disable(struct pci_dev *dev) |
236 | { | 236 | { |
237 | if (!mp_should_keep_irq(&dev->dev) && dev->irq_managed && | 237 | if (pci_has_managed_irq(dev)) { |
238 | dev->irq > 0) { | ||
239 | mp_unmap_irq(dev->irq); | 238 | mp_unmap_irq(dev->irq); |
240 | dev->irq_managed = 0; | 239 | dev->irq_managed = 0; |
240 | /* | ||
241 | * Don't reset dev->irq here, otherwise | ||
242 | * intel_mid_pci_irq_enable() will fail on next call. | ||
243 | */ | ||
241 | } | 244 | } |
242 | } | 245 | } |
243 | 246 | ||
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index 9bd115484745..32e70343e6fd 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -1202,7 +1202,7 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1202 | struct pci_dev *temp_dev; | 1202 | struct pci_dev *temp_dev; |
1203 | int irq; | 1203 | int irq; |
1204 | 1204 | ||
1205 | if (dev->irq_managed && dev->irq > 0) | 1205 | if (pci_has_managed_irq(dev)) |
1206 | return 0; | 1206 | return 0; |
1207 | 1207 | ||
1208 | irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, | 1208 | irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, |
@@ -1230,8 +1230,7 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1230 | } | 1230 | } |
1231 | dev = temp_dev; | 1231 | dev = temp_dev; |
1232 | if (irq >= 0) { | 1232 | if (irq >= 0) { |
1233 | dev->irq_managed = 1; | 1233 | pci_set_managed_irq(dev, irq); |
1234 | dev->irq = irq; | ||
1235 | dev_info(&dev->dev, "PCI->APIC IRQ transform: " | 1234 | dev_info(&dev->dev, "PCI->APIC IRQ transform: " |
1236 | "INT %c -> IRQ %d\n", 'A' + pin - 1, irq); | 1235 | "INT %c -> IRQ %d\n", 'A' + pin - 1, irq); |
1237 | return 0; | 1236 | return 0; |
@@ -1257,24 +1256,10 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1257 | return 0; | 1256 | return 0; |
1258 | } | 1257 | } |
1259 | 1258 | ||
1260 | bool mp_should_keep_irq(struct device *dev) | ||
1261 | { | ||
1262 | if (dev->power.is_prepared) | ||
1263 | return true; | ||
1264 | #ifdef CONFIG_PM | ||
1265 | if (dev->power.runtime_status == RPM_SUSPENDING) | ||
1266 | return true; | ||
1267 | #endif | ||
1268 | |||
1269 | return false; | ||
1270 | } | ||
1271 | |||
1272 | static void pirq_disable_irq(struct pci_dev *dev) | 1259 | static void pirq_disable_irq(struct pci_dev *dev) |
1273 | { | 1260 | { |
1274 | if (io_apic_assign_pci_irqs && !mp_should_keep_irq(&dev->dev) && | 1261 | if (io_apic_assign_pci_irqs && pci_has_managed_irq(dev)) { |
1275 | dev->irq_managed && dev->irq) { | ||
1276 | mp_unmap_irq(dev->irq); | 1262 | mp_unmap_irq(dev->irq); |
1277 | dev->irq = 0; | 1263 | pci_reset_managed_irq(dev); |
1278 | dev->irq_managed = 0; | ||
1279 | } | 1264 | } |
1280 | } | 1265 | } |
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c index b848cc3dc913..d27b4dcf221f 100644 --- a/arch/xtensa/kernel/pci.c +++ b/arch/xtensa/kernel/pci.c | |||
@@ -210,10 +210,6 @@ subsys_initcall(pcibios_init); | |||
210 | 210 | ||
211 | void pcibios_fixup_bus(struct pci_bus *bus) | 211 | void pcibios_fixup_bus(struct pci_bus *bus) |
212 | { | 212 | { |
213 | if (bus->parent) { | ||
214 | /* This is a subordinate bridge */ | ||
215 | pci_read_bridge_bases(bus); | ||
216 | } | ||
217 | } | 213 | } |
218 | 214 | ||
219 | void pcibios_set_master(struct pci_dev *dev) | 215 | void pcibios_set_master(struct pci_dev *dev) |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 304eccb0ae5c..afa16c557c17 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -412,7 +412,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
412 | return 0; | 412 | return 0; |
413 | } | 413 | } |
414 | 414 | ||
415 | if (dev->irq_managed && dev->irq > 0) | 415 | if (pci_has_managed_irq(dev)) |
416 | return 0; | 416 | return 0; |
417 | 417 | ||
418 | entry = acpi_pci_irq_lookup(dev, pin); | 418 | entry = acpi_pci_irq_lookup(dev, pin); |
@@ -457,8 +457,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
457 | kfree(entry); | 457 | kfree(entry); |
458 | return rc; | 458 | return rc; |
459 | } | 459 | } |
460 | dev->irq = rc; | 460 | pci_set_managed_irq(dev, rc); |
461 | dev->irq_managed = 1; | ||
462 | 461 | ||
463 | if (link) | 462 | if (link) |
464 | snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link); | 463 | snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link); |
@@ -481,17 +480,9 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
481 | u8 pin; | 480 | u8 pin; |
482 | 481 | ||
483 | pin = dev->pin; | 482 | pin = dev->pin; |
484 | if (!pin || !dev->irq_managed || dev->irq <= 0) | 483 | if (!pin || !pci_has_managed_irq(dev)) |
485 | return; | 484 | return; |
486 | 485 | ||
487 | /* Keep IOAPIC pin configuration when suspending */ | ||
488 | if (dev->dev.power.is_prepared) | ||
489 | return; | ||
490 | #ifdef CONFIG_PM | ||
491 | if (dev->dev.power.runtime_status == RPM_SUSPENDING) | ||
492 | return; | ||
493 | #endif | ||
494 | |||
495 | entry = acpi_pci_irq_lookup(dev, pin); | 486 | entry = acpi_pci_irq_lookup(dev, pin); |
496 | if (!entry) | 487 | if (!entry) |
497 | return; | 488 | return; |
@@ -511,6 +502,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
511 | dev_dbg(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); | 502 | dev_dbg(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); |
512 | if (gsi >= 0) { | 503 | if (gsi >= 0) { |
513 | acpi_unregister_gsi(gsi); | 504 | acpi_unregister_gsi(gsi); |
514 | dev->irq_managed = 0; | 505 | pci_reset_managed_irq(dev); |
515 | } | 506 | } |
516 | } | 507 | } |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 7e62751abfac..a46660204e3a 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -351,6 +351,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
351 | /* JMicron 362B and 362C have an AHCI function with IDE class code */ | 351 | /* JMicron 362B and 362C have an AHCI function with IDE class code */ |
352 | { PCI_VDEVICE(JMICRON, 0x2362), board_ahci_ign_iferr }, | 352 | { PCI_VDEVICE(JMICRON, 0x2362), board_ahci_ign_iferr }, |
353 | { PCI_VDEVICE(JMICRON, 0x236f), board_ahci_ign_iferr }, | 353 | { PCI_VDEVICE(JMICRON, 0x236f), board_ahci_ign_iferr }, |
354 | /* May need to update quirk_jmicron_async_suspend() for additions */ | ||
354 | 355 | ||
355 | /* ATI */ | 356 | /* ATI */ |
356 | { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ | 357 | { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ |
@@ -1451,18 +1452,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1451 | else if (pdev->vendor == 0x177d && pdev->device == 0xa01c) | 1452 | else if (pdev->vendor == 0x177d && pdev->device == 0xa01c) |
1452 | ahci_pci_bar = AHCI_PCI_BAR_CAVIUM; | 1453 | ahci_pci_bar = AHCI_PCI_BAR_CAVIUM; |
1453 | 1454 | ||
1454 | /* | ||
1455 | * The JMicron chip 361/363 contains one SATA controller and one | ||
1456 | * PATA controller,for powering on these both controllers, we must | ||
1457 | * follow the sequence one by one, otherwise one of them can not be | ||
1458 | * powered on successfully, so here we disable the async suspend | ||
1459 | * method for these chips. | ||
1460 | */ | ||
1461 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | ||
1462 | (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | ||
1463 | pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | ||
1464 | device_disable_async_suspend(&pdev->dev); | ||
1465 | |||
1466 | /* acquire resources */ | 1455 | /* acquire resources */ |
1467 | rc = pcim_enable_device(pdev); | 1456 | rc = pcim_enable_device(pdev); |
1468 | if (rc) | 1457 | if (rc) |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 47e418b8c8ba..4d1a5d2c4287 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -143,18 +143,6 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
143 | }; | 143 | }; |
144 | const struct ata_port_info *ppi[] = { &info, NULL }; | 144 | const struct ata_port_info *ppi[] = { &info, NULL }; |
145 | 145 | ||
146 | /* | ||
147 | * The JMicron chip 361/363 contains one SATA controller and one | ||
148 | * PATA controller,for powering on these both controllers, we must | ||
149 | * follow the sequence one by one, otherwise one of them can not be | ||
150 | * powered on successfully, so here we disable the async suspend | ||
151 | * method for these chips. | ||
152 | */ | ||
153 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | ||
154 | (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | ||
155 | pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | ||
156 | device_disable_async_suspend(&pdev->dev); | ||
157 | |||
158 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); | 146 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); |
159 | } | 147 | } |
160 | 148 | ||
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 0649b94f5958..697291aceea7 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -408,6 +408,10 @@ struct device_domain_info { | |||
408 | struct list_head global; /* link to global list */ | 408 | struct list_head global; /* link to global list */ |
409 | u8 bus; /* PCI bus number */ | 409 | u8 bus; /* PCI bus number */ |
410 | u8 devfn; /* PCI devfn number */ | 410 | u8 devfn; /* PCI devfn number */ |
411 | struct { | ||
412 | u8 enabled:1; | ||
413 | u8 qdep; | ||
414 | } ats; /* ATS state */ | ||
411 | struct device *dev; /* it's NULL for PCIe-to-PCI bridge */ | 415 | struct device *dev; /* it's NULL for PCIe-to-PCI bridge */ |
412 | struct intel_iommu *iommu; /* IOMMU used by this device */ | 416 | struct intel_iommu *iommu; /* IOMMU used by this device */ |
413 | struct dmar_domain *domain; /* pointer to domain */ | 417 | struct dmar_domain *domain; /* pointer to domain */ |
@@ -1391,19 +1395,26 @@ iommu_support_dev_iotlb (struct dmar_domain *domain, struct intel_iommu *iommu, | |||
1391 | 1395 | ||
1392 | static void iommu_enable_dev_iotlb(struct device_domain_info *info) | 1396 | static void iommu_enable_dev_iotlb(struct device_domain_info *info) |
1393 | { | 1397 | { |
1398 | struct pci_dev *pdev; | ||
1399 | |||
1394 | if (!info || !dev_is_pci(info->dev)) | 1400 | if (!info || !dev_is_pci(info->dev)) |
1395 | return; | 1401 | return; |
1396 | 1402 | ||
1397 | pci_enable_ats(to_pci_dev(info->dev), VTD_PAGE_SHIFT); | 1403 | pdev = to_pci_dev(info->dev); |
1404 | if (pci_enable_ats(pdev, VTD_PAGE_SHIFT)) | ||
1405 | return; | ||
1406 | |||
1407 | info->ats.enabled = 1; | ||
1408 | info->ats.qdep = pci_ats_queue_depth(pdev); | ||
1398 | } | 1409 | } |
1399 | 1410 | ||
1400 | static void iommu_disable_dev_iotlb(struct device_domain_info *info) | 1411 | static void iommu_disable_dev_iotlb(struct device_domain_info *info) |
1401 | { | 1412 | { |
1402 | if (!info->dev || !dev_is_pci(info->dev) || | 1413 | if (!info->ats.enabled) |
1403 | !pci_ats_enabled(to_pci_dev(info->dev))) | ||
1404 | return; | 1414 | return; |
1405 | 1415 | ||
1406 | pci_disable_ats(to_pci_dev(info->dev)); | 1416 | pci_disable_ats(to_pci_dev(info->dev)); |
1417 | info->ats.enabled = 0; | ||
1407 | } | 1418 | } |
1408 | 1419 | ||
1409 | static void iommu_flush_dev_iotlb(struct dmar_domain *domain, | 1420 | static void iommu_flush_dev_iotlb(struct dmar_domain *domain, |
@@ -1415,16 +1426,11 @@ static void iommu_flush_dev_iotlb(struct dmar_domain *domain, | |||
1415 | 1426 | ||
1416 | spin_lock_irqsave(&device_domain_lock, flags); | 1427 | spin_lock_irqsave(&device_domain_lock, flags); |
1417 | list_for_each_entry(info, &domain->devices, link) { | 1428 | list_for_each_entry(info, &domain->devices, link) { |
1418 | struct pci_dev *pdev; | 1429 | if (!info->ats.enabled) |
1419 | if (!info->dev || !dev_is_pci(info->dev)) | ||
1420 | continue; | ||
1421 | |||
1422 | pdev = to_pci_dev(info->dev); | ||
1423 | if (!pci_ats_enabled(pdev)) | ||
1424 | continue; | 1430 | continue; |
1425 | 1431 | ||
1426 | sid = info->bus << 8 | info->devfn; | 1432 | sid = info->bus << 8 | info->devfn; |
1427 | qdep = pci_ats_queue_depth(pdev); | 1433 | qdep = info->ats.qdep; |
1428 | qi_flush_dev_iotlb(info->iommu, sid, qdep, addr, mask); | 1434 | qi_flush_dev_iotlb(info->iommu, sid, qdep, addr, mask); |
1429 | } | 1435 | } |
1430 | spin_unlock_irqrestore(&device_domain_lock, flags); | 1436 | spin_unlock_irqrestore(&device_domain_lock, flags); |
@@ -2275,6 +2281,8 @@ static struct dmar_domain *dmar_insert_dev_info(struct intel_iommu *iommu, | |||
2275 | 2281 | ||
2276 | info->bus = bus; | 2282 | info->bus = bus; |
2277 | info->devfn = devfn; | 2283 | info->devfn = devfn; |
2284 | info->ats.enabled = 0; | ||
2285 | info->ats.qdep = 0; | ||
2278 | info->dev = dev; | 2286 | info->dev = dev; |
2279 | info->domain = domain; | 2287 | info->domain = domain; |
2280 | info->iommu = iommu; | 2288 | info->iommu = iommu; |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index a0580afe1713..baec33c4e698 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -560,9 +560,6 @@ dino_fixup_bus(struct pci_bus *bus) | |||
560 | } else if (bus->parent) { | 560 | } else if (bus->parent) { |
561 | int i; | 561 | int i; |
562 | 562 | ||
563 | pci_read_bridge_bases(bus); | ||
564 | |||
565 | |||
566 | for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { | 563 | for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { |
567 | if((bus->self->resource[i].flags & | 564 | if((bus->self->resource[i].flags & |
568 | (IORESOURCE_IO | IORESOURCE_MEM)) == 0) | 565 | (IORESOURCE_IO | IORESOURCE_MEM)) == 0) |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index dceb9ddfd99a..901e1a3fa4e2 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -693,7 +693,6 @@ lba_fixup_bus(struct pci_bus *bus) | |||
693 | if (bus->parent) { | 693 | if (bus->parent) { |
694 | int i; | 694 | int i; |
695 | /* PCI-PCI Bridge */ | 695 | /* PCI-PCI Bridge */ |
696 | pci_read_bridge_bases(bus); | ||
697 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) | 696 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) |
698 | pci_claim_bridge_resource(bus->self, i); | 697 | pci_claim_bridge_resource(bus->self, i); |
699 | } else { | 698 | } else { |
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 73e4af400a5a..be3f631c3f75 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
@@ -33,6 +33,7 @@ obj-$(CONFIG_PCI_IOV) += iov.o | |||
33 | # | 33 | # |
34 | obj-$(CONFIG_ALPHA) += setup-irq.o | 34 | obj-$(CONFIG_ALPHA) += setup-irq.o |
35 | obj-$(CONFIG_ARM) += setup-irq.o | 35 | obj-$(CONFIG_ARM) += setup-irq.o |
36 | obj-$(CONFIG_ARM64) += setup-irq.o | ||
36 | obj-$(CONFIG_UNICORE32) += setup-irq.o | 37 | obj-$(CONFIG_UNICORE32) += setup-irq.o |
37 | obj-$(CONFIG_SUPERH) += setup-irq.o | 38 | obj-$(CONFIG_SUPERH) += setup-irq.o |
38 | obj-$(CONFIG_MIPS) += setup-irq.o | 39 | obj-$(CONFIG_MIPS) += setup-irq.o |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index d9b64a175990..769f7e35f1a2 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -439,6 +439,56 @@ static const struct pci_vpd_ops pci_vpd_pci22_ops = { | |||
439 | .release = pci_vpd_pci22_release, | 439 | .release = pci_vpd_pci22_release, |
440 | }; | 440 | }; |
441 | 441 | ||
442 | static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count, | ||
443 | void *arg) | ||
444 | { | ||
445 | struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn)); | ||
446 | ssize_t ret; | ||
447 | |||
448 | if (!tdev) | ||
449 | return -ENODEV; | ||
450 | |||
451 | ret = pci_read_vpd(tdev, pos, count, arg); | ||
452 | pci_dev_put(tdev); | ||
453 | return ret; | ||
454 | } | ||
455 | |||
456 | static ssize_t pci_vpd_f0_write(struct pci_dev *dev, loff_t pos, size_t count, | ||
457 | const void *arg) | ||
458 | { | ||
459 | struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn)); | ||
460 | ssize_t ret; | ||
461 | |||
462 | if (!tdev) | ||
463 | return -ENODEV; | ||
464 | |||
465 | ret = pci_write_vpd(tdev, pos, count, arg); | ||
466 | pci_dev_put(tdev); | ||
467 | return ret; | ||
468 | } | ||
469 | |||
470 | static const struct pci_vpd_ops pci_vpd_f0_ops = { | ||
471 | .read = pci_vpd_f0_read, | ||
472 | .write = pci_vpd_f0_write, | ||
473 | .release = pci_vpd_pci22_release, | ||
474 | }; | ||
475 | |||
476 | static int pci_vpd_f0_dev_check(struct pci_dev *dev) | ||
477 | { | ||
478 | struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn)); | ||
479 | int ret = 0; | ||
480 | |||
481 | if (!tdev) | ||
482 | return -ENODEV; | ||
483 | if (!tdev->vpd || !tdev->multifunction || | ||
484 | dev->class != tdev->class || dev->vendor != tdev->vendor || | ||
485 | dev->device != tdev->device) | ||
486 | ret = -ENODEV; | ||
487 | |||
488 | pci_dev_put(tdev); | ||
489 | return ret; | ||
490 | } | ||
491 | |||
442 | int pci_vpd_pci22_init(struct pci_dev *dev) | 492 | int pci_vpd_pci22_init(struct pci_dev *dev) |
443 | { | 493 | { |
444 | struct pci_vpd_pci22 *vpd; | 494 | struct pci_vpd_pci22 *vpd; |
@@ -447,12 +497,21 @@ int pci_vpd_pci22_init(struct pci_dev *dev) | |||
447 | cap = pci_find_capability(dev, PCI_CAP_ID_VPD); | 497 | cap = pci_find_capability(dev, PCI_CAP_ID_VPD); |
448 | if (!cap) | 498 | if (!cap) |
449 | return -ENODEV; | 499 | return -ENODEV; |
500 | if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0) { | ||
501 | int ret = pci_vpd_f0_dev_check(dev); | ||
502 | |||
503 | if (ret) | ||
504 | return ret; | ||
505 | } | ||
450 | vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC); | 506 | vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC); |
451 | if (!vpd) | 507 | if (!vpd) |
452 | return -ENOMEM; | 508 | return -ENOMEM; |
453 | 509 | ||
454 | vpd->base.len = PCI_VPD_PCI22_SIZE; | 510 | vpd->base.len = PCI_VPD_PCI22_SIZE; |
455 | vpd->base.ops = &pci_vpd_pci22_ops; | 511 | if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0) |
512 | vpd->base.ops = &pci_vpd_f0_ops; | ||
513 | else | ||
514 | vpd->base.ops = &pci_vpd_pci22_ops; | ||
456 | mutex_init(&vpd->lock); | 515 | mutex_init(&vpd->lock); |
457 | vpd->cap = cap; | 516 | vpd->cap = cap; |
458 | vpd->busy = false; | 517 | vpd->busy = false; |
@@ -531,6 +590,14 @@ static inline int pcie_cap_version(const struct pci_dev *dev) | |||
531 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; | 590 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; |
532 | } | 591 | } |
533 | 592 | ||
593 | static bool pcie_downstream_port(const struct pci_dev *dev) | ||
594 | { | ||
595 | int type = pci_pcie_type(dev); | ||
596 | |||
597 | return type == PCI_EXP_TYPE_ROOT_PORT || | ||
598 | type == PCI_EXP_TYPE_DOWNSTREAM; | ||
599 | } | ||
600 | |||
534 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | 601 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) |
535 | { | 602 | { |
536 | int type = pci_pcie_type(dev); | 603 | int type = pci_pcie_type(dev); |
@@ -546,10 +613,7 @@ bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | |||
546 | 613 | ||
547 | static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev) | 614 | static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev) |
548 | { | 615 | { |
549 | int type = pci_pcie_type(dev); | 616 | return pcie_downstream_port(dev) && |
550 | |||
551 | return (type == PCI_EXP_TYPE_ROOT_PORT || | ||
552 | type == PCI_EXP_TYPE_DOWNSTREAM) && | ||
553 | pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT; | 617 | pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT; |
554 | } | 618 | } |
555 | 619 | ||
@@ -628,10 +692,9 @@ int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val) | |||
628 | * State bit in the Slot Status register of Downstream Ports, | 692 | * State bit in the Slot Status register of Downstream Ports, |
629 | * which must be hardwired to 1b. (PCIe Base Spec 3.0, sec 7.8) | 693 | * which must be hardwired to 1b. (PCIe Base Spec 3.0, sec 7.8) |
630 | */ | 694 | */ |
631 | if (pci_is_pcie(dev) && pos == PCI_EXP_SLTSTA && | 695 | if (pci_is_pcie(dev) && pcie_downstream_port(dev) && |
632 | pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) { | 696 | pos == PCI_EXP_SLTSTA) |
633 | *val = PCI_EXP_SLTSTA_PDS; | 697 | *val = PCI_EXP_SLTSTA_PDS; |
634 | } | ||
635 | 698 | ||
636 | return 0; | 699 | return 0; |
637 | } | 700 | } |
@@ -657,10 +720,9 @@ int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val) | |||
657 | return ret; | 720 | return ret; |
658 | } | 721 | } |
659 | 722 | ||
660 | if (pci_is_pcie(dev) && pos == PCI_EXP_SLTCTL && | 723 | if (pci_is_pcie(dev) && pcie_downstream_port(dev) && |
661 | pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) { | 724 | pos == PCI_EXP_SLTSTA) |
662 | *val = PCI_EXP_SLTSTA_PDS; | 725 | *val = PCI_EXP_SLTSTA_PDS; |
663 | } | ||
664 | 726 | ||
665 | return 0; | 727 | return 0; |
666 | } | 728 | } |
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c index a8099d4d0c9d..eeb9fb2b47aa 100644 --- a/drivers/pci/ats.c +++ b/drivers/pci/ats.c | |||
@@ -17,34 +17,15 @@ | |||
17 | 17 | ||
18 | #include "pci.h" | 18 | #include "pci.h" |
19 | 19 | ||
20 | static int ats_alloc_one(struct pci_dev *dev, int ps) | 20 | void pci_ats_init(struct pci_dev *dev) |
21 | { | 21 | { |
22 | int pos; | 22 | int pos; |
23 | u16 cap; | ||
24 | struct pci_ats *ats; | ||
25 | 23 | ||
26 | pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS); | 24 | pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS); |
27 | if (!pos) | 25 | if (!pos) |
28 | return -ENODEV; | 26 | return; |
29 | |||
30 | ats = kzalloc(sizeof(*ats), GFP_KERNEL); | ||
31 | if (!ats) | ||
32 | return -ENOMEM; | ||
33 | |||
34 | ats->pos = pos; | ||
35 | ats->stu = ps; | ||
36 | pci_read_config_word(dev, pos + PCI_ATS_CAP, &cap); | ||
37 | ats->qdep = PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : | ||
38 | PCI_ATS_MAX_QDEP; | ||
39 | dev->ats = ats; | ||
40 | |||
41 | return 0; | ||
42 | } | ||
43 | 27 | ||
44 | static void ats_free_one(struct pci_dev *dev) | 28 | dev->ats_cap = pos; |
45 | { | ||
46 | kfree(dev->ats); | ||
47 | dev->ats = NULL; | ||
48 | } | 29 | } |
49 | 30 | ||
50 | /** | 31 | /** |
@@ -56,43 +37,36 @@ static void ats_free_one(struct pci_dev *dev) | |||
56 | */ | 37 | */ |
57 | int pci_enable_ats(struct pci_dev *dev, int ps) | 38 | int pci_enable_ats(struct pci_dev *dev, int ps) |
58 | { | 39 | { |
59 | int rc; | ||
60 | u16 ctrl; | 40 | u16 ctrl; |
41 | struct pci_dev *pdev; | ||
61 | 42 | ||
62 | BUG_ON(dev->ats && dev->ats->is_enabled); | 43 | if (!dev->ats_cap) |
63 | |||
64 | if (ps < PCI_ATS_MIN_STU) | ||
65 | return -EINVAL; | 44 | return -EINVAL; |
66 | 45 | ||
67 | if (dev->is_physfn || dev->is_virtfn) { | 46 | if (WARN_ON(dev->ats_enabled)) |
68 | struct pci_dev *pdev = dev->is_physfn ? dev : dev->physfn; | 47 | return -EBUSY; |
69 | |||
70 | mutex_lock(&pdev->sriov->lock); | ||
71 | if (pdev->ats) | ||
72 | rc = pdev->ats->stu == ps ? 0 : -EINVAL; | ||
73 | else | ||
74 | rc = ats_alloc_one(pdev, ps); | ||
75 | |||
76 | if (!rc) | ||
77 | pdev->ats->ref_cnt++; | ||
78 | mutex_unlock(&pdev->sriov->lock); | ||
79 | if (rc) | ||
80 | return rc; | ||
81 | } | ||
82 | 48 | ||
83 | if (!dev->is_physfn) { | 49 | if (ps < PCI_ATS_MIN_STU) |
84 | rc = ats_alloc_one(dev, ps); | 50 | return -EINVAL; |
85 | if (rc) | ||
86 | return rc; | ||
87 | } | ||
88 | 51 | ||
52 | /* | ||
53 | * Note that enabling ATS on a VF fails unless it's already enabled | ||
54 | * with the same STU on the PF. | ||
55 | */ | ||
89 | ctrl = PCI_ATS_CTRL_ENABLE; | 56 | ctrl = PCI_ATS_CTRL_ENABLE; |
90 | if (!dev->is_virtfn) | 57 | if (dev->is_virtfn) { |
91 | ctrl |= PCI_ATS_CTRL_STU(ps - PCI_ATS_MIN_STU); | 58 | pdev = pci_physfn(dev); |
92 | pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl); | 59 | if (pdev->ats_stu != ps) |
93 | 60 | return -EINVAL; | |
94 | dev->ats->is_enabled = 1; | 61 | |
62 | atomic_inc(&pdev->ats_ref_cnt); /* count enabled VFs */ | ||
63 | } else { | ||
64 | dev->ats_stu = ps; | ||
65 | ctrl |= PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU); | ||
66 | } | ||
67 | pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl); | ||
95 | 68 | ||
69 | dev->ats_enabled = 1; | ||
96 | return 0; | 70 | return 0; |
97 | } | 71 | } |
98 | EXPORT_SYMBOL_GPL(pci_enable_ats); | 72 | EXPORT_SYMBOL_GPL(pci_enable_ats); |
@@ -103,28 +77,25 @@ EXPORT_SYMBOL_GPL(pci_enable_ats); | |||
103 | */ | 77 | */ |
104 | void pci_disable_ats(struct pci_dev *dev) | 78 | void pci_disable_ats(struct pci_dev *dev) |
105 | { | 79 | { |
80 | struct pci_dev *pdev; | ||
106 | u16 ctrl; | 81 | u16 ctrl; |
107 | 82 | ||
108 | BUG_ON(!dev->ats || !dev->ats->is_enabled); | 83 | if (WARN_ON(!dev->ats_enabled)) |
109 | 84 | return; | |
110 | pci_read_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, &ctrl); | ||
111 | ctrl &= ~PCI_ATS_CTRL_ENABLE; | ||
112 | pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl); | ||
113 | |||
114 | dev->ats->is_enabled = 0; | ||
115 | 85 | ||
116 | if (dev->is_physfn || dev->is_virtfn) { | 86 | if (atomic_read(&dev->ats_ref_cnt)) |
117 | struct pci_dev *pdev = dev->is_physfn ? dev : dev->physfn; | 87 | return; /* VFs still enabled */ |
118 | 88 | ||
119 | mutex_lock(&pdev->sriov->lock); | 89 | if (dev->is_virtfn) { |
120 | pdev->ats->ref_cnt--; | 90 | pdev = pci_physfn(dev); |
121 | if (!pdev->ats->ref_cnt) | 91 | atomic_dec(&pdev->ats_ref_cnt); |
122 | ats_free_one(pdev); | ||
123 | mutex_unlock(&pdev->sriov->lock); | ||
124 | } | 92 | } |
125 | 93 | ||
126 | if (!dev->is_physfn) | 94 | pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, &ctrl); |
127 | ats_free_one(dev); | 95 | ctrl &= ~PCI_ATS_CTRL_ENABLE; |
96 | pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl); | ||
97 | |||
98 | dev->ats_enabled = 0; | ||
128 | } | 99 | } |
129 | EXPORT_SYMBOL_GPL(pci_disable_ats); | 100 | EXPORT_SYMBOL_GPL(pci_disable_ats); |
130 | 101 | ||
@@ -132,16 +103,13 @@ void pci_restore_ats_state(struct pci_dev *dev) | |||
132 | { | 103 | { |
133 | u16 ctrl; | 104 | u16 ctrl; |
134 | 105 | ||
135 | if (!pci_ats_enabled(dev)) | 106 | if (!dev->ats_enabled) |
136 | return; | 107 | return; |
137 | if (!pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS)) | ||
138 | BUG(); | ||
139 | 108 | ||
140 | ctrl = PCI_ATS_CTRL_ENABLE; | 109 | ctrl = PCI_ATS_CTRL_ENABLE; |
141 | if (!dev->is_virtfn) | 110 | if (!dev->is_virtfn) |
142 | ctrl |= PCI_ATS_CTRL_STU(dev->ats->stu - PCI_ATS_MIN_STU); | 111 | ctrl |= PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU); |
143 | 112 | pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl); | |
144 | pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl); | ||
145 | } | 113 | } |
146 | EXPORT_SYMBOL_GPL(pci_restore_ats_state); | 114 | EXPORT_SYMBOL_GPL(pci_restore_ats_state); |
147 | 115 | ||
@@ -159,23 +127,16 @@ EXPORT_SYMBOL_GPL(pci_restore_ats_state); | |||
159 | */ | 127 | */ |
160 | int pci_ats_queue_depth(struct pci_dev *dev) | 128 | int pci_ats_queue_depth(struct pci_dev *dev) |
161 | { | 129 | { |
162 | int pos; | ||
163 | u16 cap; | 130 | u16 cap; |
164 | 131 | ||
132 | if (!dev->ats_cap) | ||
133 | return -EINVAL; | ||
134 | |||
165 | if (dev->is_virtfn) | 135 | if (dev->is_virtfn) |
166 | return 0; | 136 | return 0; |
167 | 137 | ||
168 | if (dev->ats) | 138 | pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap); |
169 | return dev->ats->qdep; | 139 | return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : PCI_ATS_MAX_QDEP; |
170 | |||
171 | pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS); | ||
172 | if (!pos) | ||
173 | return -ENODEV; | ||
174 | |||
175 | pci_read_config_word(dev, pos + PCI_ATS_CAP, &cap); | ||
176 | |||
177 | return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : | ||
178 | PCI_ATS_MAX_QDEP; | ||
179 | } | 140 | } |
180 | EXPORT_SYMBOL_GPL(pci_ats_queue_depth); | 141 | EXPORT_SYMBOL_GPL(pci_ats_queue_depth); |
181 | 142 | ||
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig index c132bddc03f3..1272b8002884 100644 --- a/drivers/pci/host/Kconfig +++ b/drivers/pci/host/Kconfig | |||
@@ -53,7 +53,7 @@ config PCI_RCAR_GEN2_PCIE | |||
53 | 53 | ||
54 | config PCI_HOST_GENERIC | 54 | config PCI_HOST_GENERIC |
55 | bool "Generic PCI host controller" | 55 | bool "Generic PCI host controller" |
56 | depends on ARM && OF | 56 | depends on (ARM || ARM64) && OF |
57 | help | 57 | help |
58 | Say Y here if you want to support a simple generic PCI host | 58 | Say Y here if you want to support a simple generic PCI host |
59 | controller, such as the one emulated by kvmtool. | 59 | controller, such as the one emulated by kvmtool. |
@@ -135,7 +135,7 @@ config PCIE_IPROC_PLATFORM | |||
135 | through the generic platform bus interface | 135 | through the generic platform bus interface |
136 | 136 | ||
137 | config PCIE_IPROC_BCMA | 137 | config PCIE_IPROC_BCMA |
138 | bool "Broadcom iProc PCIe BCMA bus driver" | 138 | tristate "Broadcom iProc PCIe BCMA bus driver" |
139 | depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST) | 139 | depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST) |
140 | select PCIE_IPROC | 140 | select PCIE_IPROC |
141 | select BCMA | 141 | select BCMA |
diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c index 80db09e47800..199e29a044cd 100644 --- a/drivers/pci/host/pci-dra7xx.c +++ b/drivers/pci/host/pci-dra7xx.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/irqdomain.h> | 17 | #include <linux/irqdomain.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/of_gpio.h> | ||
20 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
21 | #include <linux/phy/phy.h> | 22 | #include <linux/phy/phy.h> |
22 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
@@ -83,6 +84,17 @@ static inline void dra7xx_pcie_writel(struct dra7xx_pcie *pcie, u32 offset, | |||
83 | writel(value, pcie->base + offset); | 84 | writel(value, pcie->base + offset); |
84 | } | 85 | } |
85 | 86 | ||
87 | static inline u32 dra7xx_pcie_readl_rc(struct pcie_port *pp, u32 offset) | ||
88 | { | ||
89 | return readl(pp->dbi_base + offset); | ||
90 | } | ||
91 | |||
92 | static inline void dra7xx_pcie_writel_rc(struct pcie_port *pp, u32 offset, | ||
93 | u32 value) | ||
94 | { | ||
95 | writel(value, pp->dbi_base + offset); | ||
96 | } | ||
97 | |||
86 | static int dra7xx_pcie_link_up(struct pcie_port *pp) | 98 | static int dra7xx_pcie_link_up(struct pcie_port *pp) |
87 | { | 99 | { |
88 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | 100 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); |
@@ -155,7 +167,6 @@ static int dra7xx_pcie_intx_map(struct irq_domain *domain, unsigned int irq, | |||
155 | { | 167 | { |
156 | irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); | 168 | irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); |
157 | irq_set_chip_data(irq, domain->host_data); | 169 | irq_set_chip_data(irq, domain->host_data); |
158 | set_irq_flags(irq, IRQF_VALID); | ||
159 | 170 | ||
160 | return 0; | 171 | return 0; |
161 | } | 172 | } |
@@ -325,6 +336,9 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) | |||
325 | struct device *dev = &pdev->dev; | 336 | struct device *dev = &pdev->dev; |
326 | struct device_node *np = dev->of_node; | 337 | struct device_node *np = dev->of_node; |
327 | char name[10]; | 338 | char name[10]; |
339 | int gpio_sel; | ||
340 | enum of_gpio_flags flags; | ||
341 | unsigned long gpio_flags; | ||
328 | 342 | ||
329 | dra7xx = devm_kzalloc(dev, sizeof(*dra7xx), GFP_KERNEL); | 343 | dra7xx = devm_kzalloc(dev, sizeof(*dra7xx), GFP_KERNEL); |
330 | if (!dra7xx) | 344 | if (!dra7xx) |
@@ -382,9 +396,25 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) | |||
382 | 396 | ||
383 | pm_runtime_enable(dev); | 397 | pm_runtime_enable(dev); |
384 | ret = pm_runtime_get_sync(dev); | 398 | ret = pm_runtime_get_sync(dev); |
385 | if (IS_ERR_VALUE(ret)) { | 399 | if (ret < 0) { |
386 | dev_err(dev, "pm_runtime_get_sync failed\n"); | 400 | dev_err(dev, "pm_runtime_get_sync failed\n"); |
387 | goto err_phy; | 401 | goto err_get_sync; |
402 | } | ||
403 | |||
404 | gpio_sel = of_get_gpio_flags(dev->of_node, 0, &flags); | ||
405 | if (gpio_is_valid(gpio_sel)) { | ||
406 | gpio_flags = (flags & OF_GPIO_ACTIVE_LOW) ? | ||
407 | GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH; | ||
408 | ret = devm_gpio_request_one(dev, gpio_sel, gpio_flags, | ||
409 | "pcie_reset"); | ||
410 | if (ret) { | ||
411 | dev_err(&pdev->dev, "gpio%d request failed, ret %d\n", | ||
412 | gpio_sel, ret); | ||
413 | goto err_gpio; | ||
414 | } | ||
415 | } else if (gpio_sel == -EPROBE_DEFER) { | ||
416 | ret = -EPROBE_DEFER; | ||
417 | goto err_gpio; | ||
388 | } | 418 | } |
389 | 419 | ||
390 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD); | 420 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD); |
@@ -395,12 +425,14 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) | |||
395 | 425 | ||
396 | ret = dra7xx_add_pcie_port(dra7xx, pdev); | 426 | ret = dra7xx_add_pcie_port(dra7xx, pdev); |
397 | if (ret < 0) | 427 | if (ret < 0) |
398 | goto err_add_port; | 428 | goto err_gpio; |
399 | 429 | ||
400 | return 0; | 430 | return 0; |
401 | 431 | ||
402 | err_add_port: | 432 | err_gpio: |
403 | pm_runtime_put(dev); | 433 | pm_runtime_put(dev); |
434 | |||
435 | err_get_sync: | ||
404 | pm_runtime_disable(dev); | 436 | pm_runtime_disable(dev); |
405 | 437 | ||
406 | err_phy: | 438 | err_phy: |
@@ -431,6 +463,85 @@ static int __exit dra7xx_pcie_remove(struct platform_device *pdev) | |||
431 | return 0; | 463 | return 0; |
432 | } | 464 | } |
433 | 465 | ||
466 | #ifdef CONFIG_PM_SLEEP | ||
467 | static int dra7xx_pcie_suspend(struct device *dev) | ||
468 | { | ||
469 | struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev); | ||
470 | struct pcie_port *pp = &dra7xx->pp; | ||
471 | u32 val; | ||
472 | |||
473 | /* clear MSE */ | ||
474 | val = dra7xx_pcie_readl_rc(pp, PCI_COMMAND); | ||
475 | val &= ~PCI_COMMAND_MEMORY; | ||
476 | dra7xx_pcie_writel_rc(pp, PCI_COMMAND, val); | ||
477 | |||
478 | return 0; | ||
479 | } | ||
480 | |||
481 | static int dra7xx_pcie_resume(struct device *dev) | ||
482 | { | ||
483 | struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev); | ||
484 | struct pcie_port *pp = &dra7xx->pp; | ||
485 | u32 val; | ||
486 | |||
487 | /* set MSE */ | ||
488 | val = dra7xx_pcie_readl_rc(pp, PCI_COMMAND); | ||
489 | val |= PCI_COMMAND_MEMORY; | ||
490 | dra7xx_pcie_writel_rc(pp, PCI_COMMAND, val); | ||
491 | |||
492 | return 0; | ||
493 | } | ||
494 | |||
495 | static int dra7xx_pcie_suspend_noirq(struct device *dev) | ||
496 | { | ||
497 | struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev); | ||
498 | int count = dra7xx->phy_count; | ||
499 | |||
500 | while (count--) { | ||
501 | phy_power_off(dra7xx->phy[count]); | ||
502 | phy_exit(dra7xx->phy[count]); | ||
503 | } | ||
504 | |||
505 | return 0; | ||
506 | } | ||
507 | |||
508 | static int dra7xx_pcie_resume_noirq(struct device *dev) | ||
509 | { | ||
510 | struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev); | ||
511 | int phy_count = dra7xx->phy_count; | ||
512 | int ret; | ||
513 | int i; | ||
514 | |||
515 | for (i = 0; i < phy_count; i++) { | ||
516 | ret = phy_init(dra7xx->phy[i]); | ||
517 | if (ret < 0) | ||
518 | goto err_phy; | ||
519 | |||
520 | ret = phy_power_on(dra7xx->phy[i]); | ||
521 | if (ret < 0) { | ||
522 | phy_exit(dra7xx->phy[i]); | ||
523 | goto err_phy; | ||
524 | } | ||
525 | } | ||
526 | |||
527 | return 0; | ||
528 | |||
529 | err_phy: | ||
530 | while (--i >= 0) { | ||
531 | phy_power_off(dra7xx->phy[i]); | ||
532 | phy_exit(dra7xx->phy[i]); | ||
533 | } | ||
534 | |||
535 | return ret; | ||
536 | } | ||
537 | #endif | ||
538 | |||
539 | static const struct dev_pm_ops dra7xx_pcie_pm_ops = { | ||
540 | SET_SYSTEM_SLEEP_PM_OPS(dra7xx_pcie_suspend, dra7xx_pcie_resume) | ||
541 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(dra7xx_pcie_suspend_noirq, | ||
542 | dra7xx_pcie_resume_noirq) | ||
543 | }; | ||
544 | |||
434 | static const struct of_device_id of_dra7xx_pcie_match[] = { | 545 | static const struct of_device_id of_dra7xx_pcie_match[] = { |
435 | { .compatible = "ti,dra7-pcie", }, | 546 | { .compatible = "ti,dra7-pcie", }, |
436 | {}, | 547 | {}, |
@@ -442,6 +553,7 @@ static struct platform_driver dra7xx_pcie_driver = { | |||
442 | .driver = { | 553 | .driver = { |
443 | .name = "dra7-pcie", | 554 | .name = "dra7-pcie", |
444 | .of_match_table = of_dra7xx_pcie_match, | 555 | .of_match_table = of_dra7xx_pcie_match, |
556 | .pm = &dra7xx_pcie_pm_ops, | ||
445 | }, | 557 | }, |
446 | }; | 558 | }; |
447 | 559 | ||
diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index ba46e581db99..265dd25169bf 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c | |||
@@ -38,7 +38,16 @@ struct gen_pci_cfg_windows { | |||
38 | const struct gen_pci_cfg_bus_ops *ops; | 38 | const struct gen_pci_cfg_bus_ops *ops; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* | ||
42 | * ARM pcibios functions expect the ARM struct pci_sys_data as the PCI | ||
43 | * sysdata. Add pci_sys_data as the first element in struct gen_pci so | ||
44 | * that when we use a gen_pci pointer as sysdata, it is also a pointer to | ||
45 | * a struct pci_sys_data. | ||
46 | */ | ||
41 | struct gen_pci { | 47 | struct gen_pci { |
48 | #ifdef CONFIG_ARM | ||
49 | struct pci_sys_data sys; | ||
50 | #endif | ||
42 | struct pci_host_bridge host; | 51 | struct pci_host_bridge host; |
43 | struct gen_pci_cfg_windows cfg; | 52 | struct gen_pci_cfg_windows cfg; |
44 | struct list_head resources; | 53 | struct list_head resources; |
@@ -48,8 +57,7 @@ static void __iomem *gen_pci_map_cfg_bus_cam(struct pci_bus *bus, | |||
48 | unsigned int devfn, | 57 | unsigned int devfn, |
49 | int where) | 58 | int where) |
50 | { | 59 | { |
51 | struct pci_sys_data *sys = bus->sysdata; | 60 | struct gen_pci *pci = bus->sysdata; |
52 | struct gen_pci *pci = sys->private_data; | ||
53 | resource_size_t idx = bus->number - pci->cfg.bus_range->start; | 61 | resource_size_t idx = bus->number - pci->cfg.bus_range->start; |
54 | 62 | ||
55 | return pci->cfg.win[idx] + ((devfn << 8) | where); | 63 | return pci->cfg.win[idx] + ((devfn << 8) | where); |
@@ -64,8 +72,7 @@ static void __iomem *gen_pci_map_cfg_bus_ecam(struct pci_bus *bus, | |||
64 | unsigned int devfn, | 72 | unsigned int devfn, |
65 | int where) | 73 | int where) |
66 | { | 74 | { |
67 | struct pci_sys_data *sys = bus->sysdata; | 75 | struct gen_pci *pci = bus->sysdata; |
68 | struct gen_pci *pci = sys->private_data; | ||
69 | resource_size_t idx = bus->number - pci->cfg.bus_range->start; | 76 | resource_size_t idx = bus->number - pci->cfg.bus_range->start; |
70 | 77 | ||
71 | return pci->cfg.win[idx] + ((devfn << 12) | where); | 78 | return pci->cfg.win[idx] + ((devfn << 12) | where); |
@@ -198,13 +205,6 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci) | |||
198 | return 0; | 205 | return 0; |
199 | } | 206 | } |
200 | 207 | ||
201 | static int gen_pci_setup(int nr, struct pci_sys_data *sys) | ||
202 | { | ||
203 | struct gen_pci *pci = sys->private_data; | ||
204 | list_splice_init(&pci->resources, &sys->resources); | ||
205 | return 1; | ||
206 | } | ||
207 | |||
208 | static int gen_pci_probe(struct platform_device *pdev) | 208 | static int gen_pci_probe(struct platform_device *pdev) |
209 | { | 209 | { |
210 | int err; | 210 | int err; |
@@ -214,13 +214,7 @@ static int gen_pci_probe(struct platform_device *pdev) | |||
214 | struct device *dev = &pdev->dev; | 214 | struct device *dev = &pdev->dev; |
215 | struct device_node *np = dev->of_node; | 215 | struct device_node *np = dev->of_node; |
216 | struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); | 216 | struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); |
217 | struct hw_pci hw = { | 217 | struct pci_bus *bus, *child; |
218 | .nr_controllers = 1, | ||
219 | .private_data = (void **)&pci, | ||
220 | .setup = gen_pci_setup, | ||
221 | .map_irq = of_irq_parse_and_map_pci, | ||
222 | .ops = &gen_pci_ops, | ||
223 | }; | ||
224 | 218 | ||
225 | if (!pci) | 219 | if (!pci) |
226 | return -ENOMEM; | 220 | return -ENOMEM; |
@@ -258,7 +252,27 @@ static int gen_pci_probe(struct platform_device *pdev) | |||
258 | return err; | 252 | return err; |
259 | } | 253 | } |
260 | 254 | ||
261 | pci_common_init_dev(dev, &hw); | 255 | /* Do not reassign resources if probe only */ |
256 | if (!pci_has_flag(PCI_PROBE_ONLY)) | ||
257 | pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); | ||
258 | |||
259 | bus = pci_scan_root_bus(dev, 0, &gen_pci_ops, pci, &pci->resources); | ||
260 | if (!bus) { | ||
261 | dev_err(dev, "Scanning rootbus failed"); | ||
262 | return -ENODEV; | ||
263 | } | ||
264 | |||
265 | pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); | ||
266 | |||
267 | if (!pci_has_flag(PCI_PROBE_ONLY)) { | ||
268 | pci_bus_size_bridges(bus); | ||
269 | pci_bus_assign_resources(bus); | ||
270 | |||
271 | list_for_each_entry(child, &bus->children, node) | ||
272 | pcie_bus_configure_settings(child); | ||
273 | } | ||
274 | |||
275 | pci_bus_add_devices(bus); | ||
262 | return 0; | 276 | return 0; |
263 | } | 277 | } |
264 | 278 | ||
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 233a196c6e66..8f3a9813c4e5 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -117,11 +117,7 @@ static int pcie_phy_wait_ack(void __iomem *dbi_base, int addr) | |||
117 | val = addr << PCIE_PHY_CTRL_DATA_LOC; | 117 | val = addr << PCIE_PHY_CTRL_DATA_LOC; |
118 | writel(val, dbi_base + PCIE_PHY_CTRL); | 118 | writel(val, dbi_base + PCIE_PHY_CTRL); |
119 | 119 | ||
120 | ret = pcie_phy_poll_ack(dbi_base, 0); | 120 | return pcie_phy_poll_ack(dbi_base, 0); |
121 | if (ret) | ||
122 | return ret; | ||
123 | |||
124 | return 0; | ||
125 | } | 121 | } |
126 | 122 | ||
127 | /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ | 123 | /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ |
@@ -148,11 +144,7 @@ static int pcie_phy_read(void __iomem *dbi_base, int addr , int *data) | |||
148 | /* deassert Read signal */ | 144 | /* deassert Read signal */ |
149 | writel(0x00, dbi_base + PCIE_PHY_CTRL); | 145 | writel(0x00, dbi_base + PCIE_PHY_CTRL); |
150 | 146 | ||
151 | ret = pcie_phy_poll_ack(dbi_base, 0); | 147 | return pcie_phy_poll_ack(dbi_base, 0); |
152 | if (ret) | ||
153 | return ret; | ||
154 | |||
155 | return 0; | ||
156 | } | 148 | } |
157 | 149 | ||
158 | static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) | 150 | static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) |
diff --git a/drivers/pci/host/pci-keystone-dw.c b/drivers/pci/host/pci-keystone-dw.c index f34892e0edb4..f1d0749ebbf0 100644 --- a/drivers/pci/host/pci-keystone-dw.c +++ b/drivers/pci/host/pci-keystone-dw.c | |||
@@ -196,7 +196,6 @@ static int ks_dw_pcie_msi_map(struct irq_domain *domain, unsigned int irq, | |||
196 | irq_set_chip_and_handler(irq, &ks_dw_pcie_msi_irq_chip, | 196 | irq_set_chip_and_handler(irq, &ks_dw_pcie_msi_irq_chip, |
197 | handle_level_irq); | 197 | handle_level_irq); |
198 | irq_set_chip_data(irq, domain->host_data); | 198 | irq_set_chip_data(irq, domain->host_data); |
199 | set_irq_flags(irq, IRQF_VALID); | ||
200 | 199 | ||
201 | return 0; | 200 | return 0; |
202 | } | 201 | } |
@@ -277,7 +276,6 @@ static int ks_dw_pcie_init_legacy_irq_map(struct irq_domain *d, | |||
277 | irq_set_chip_and_handler(irq, &ks_dw_pcie_legacy_irq_chip, | 276 | irq_set_chip_and_handler(irq, &ks_dw_pcie_legacy_irq_chip, |
278 | handle_level_irq); | 277 | handle_level_irq); |
279 | irq_set_chip_data(irq, d->host_data); | 278 | irq_set_chip_data(irq, d->host_data); |
280 | set_irq_flags(irq, IRQF_VALID); | ||
281 | 279 | ||
282 | return 0; | 280 | return 0; |
283 | } | 281 | } |
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 70aa09556ec5..67ec5e1c99db 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -879,6 +879,7 @@ static void mvebu_pcie_msi_enable(struct mvebu_pcie *pcie) | |||
879 | return; | 879 | return; |
880 | 880 | ||
881 | pcie->msi = of_pci_find_msi_chip_by_node(msi_node); | 881 | pcie->msi = of_pci_find_msi_chip_by_node(msi_node); |
882 | of_node_put(msi_node); | ||
882 | 883 | ||
883 | if (pcie->msi) | 884 | if (pcie->msi) |
884 | pcie->msi->dev = &pcie->pdev->dev; | 885 | pcie->msi->dev = &pcie->pdev->dev; |
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 10c05718dbfd..81df0c1fe063 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -1248,7 +1248,6 @@ static int tegra_msi_map(struct irq_domain *domain, unsigned int irq, | |||
1248 | { | 1248 | { |
1249 | irq_set_chip_and_handler(irq, &tegra_msi_irq_chip, handle_simple_irq); | 1249 | irq_set_chip_and_handler(irq, &tegra_msi_irq_chip, handle_simple_irq); |
1250 | irq_set_chip_data(irq, domain->host_data); | 1250 | irq_set_chip_data(irq, domain->host_data); |
1251 | set_irq_flags(irq, IRQF_VALID); | ||
1252 | 1251 | ||
1253 | tegra_cpuidle_pcie_irqs_in_use(); | 1252 | tegra_cpuidle_pcie_irqs_in_use(); |
1254 | 1253 | ||
diff --git a/drivers/pci/host/pci-xgene-msi.c b/drivers/pci/host/pci-xgene-msi.c index 2d31d4d6fd08..398c9bfe13a9 100644 --- a/drivers/pci/host/pci-xgene-msi.c +++ b/drivers/pci/host/pci-xgene-msi.c | |||
@@ -223,7 +223,6 @@ static int xgene_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, | |||
223 | irq_domain_set_info(domain, virq, msi_irq, | 223 | irq_domain_set_info(domain, virq, msi_irq, |
224 | &xgene_msi_bottom_irq_chip, domain->host_data, | 224 | &xgene_msi_bottom_irq_chip, domain->host_data, |
225 | handle_simple_irq, NULL, NULL); | 225 | handle_simple_irq, NULL, NULL); |
226 | set_irq_flags(virq, IRQF_VALID); | ||
227 | 226 | ||
228 | return 0; | 227 | return 0; |
229 | } | 228 | } |
@@ -582,7 +581,6 @@ error: | |||
582 | static struct platform_driver xgene_msi_driver = { | 581 | static struct platform_driver xgene_msi_driver = { |
583 | .driver = { | 582 | .driver = { |
584 | .name = "xgene-msi", | 583 | .name = "xgene-msi", |
585 | .owner = THIS_MODULE, | ||
586 | .of_match_table = xgene_msi_match_table, | 584 | .of_match_table = xgene_msi_match_table, |
587 | }, | 585 | }, |
588 | .probe = xgene_msi_probe, | 586 | .probe = xgene_msi_probe, |
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index a9dfb70d623a..0236ab9d5720 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c | |||
@@ -321,8 +321,16 @@ static int xgene_pcie_map_ranges(struct xgene_pcie_port *port, | |||
321 | return ret; | 321 | return ret; |
322 | break; | 322 | break; |
323 | case IORESOURCE_MEM: | 323 | case IORESOURCE_MEM: |
324 | xgene_pcie_setup_ob_reg(port, res, OMR1BARL, res->start, | 324 | if (res->flags & IORESOURCE_PREFETCH) |
325 | res->start - window->offset); | 325 | xgene_pcie_setup_ob_reg(port, res, OMR2BARL, |
326 | res->start, | ||
327 | res->start - | ||
328 | window->offset); | ||
329 | else | ||
330 | xgene_pcie_setup_ob_reg(port, res, OMR1BARL, | ||
331 | res->start, | ||
332 | res->start - | ||
333 | window->offset); | ||
326 | break; | 334 | break; |
327 | case IORESOURCE_BUS: | 335 | case IORESOURCE_BUS: |
328 | break; | 336 | break; |
@@ -514,6 +522,7 @@ static int xgene_pcie_msi_enable(struct pci_bus *bus) | |||
514 | if (!bus->msi) | 522 | if (!bus->msi) |
515 | return -ENODEV; | 523 | return -ENODEV; |
516 | 524 | ||
525 | of_node_put(msi_node); | ||
517 | bus->msi->dev = &bus->dev; | 526 | bus->msi->dev = &bus->dev; |
518 | return 0; | 527 | return 0; |
519 | } | 528 | } |
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 69486be7181e..8d52ce73f842 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
@@ -350,7 +350,6 @@ static int dw_pcie_msi_map(struct irq_domain *domain, unsigned int irq, | |||
350 | { | 350 | { |
351 | irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_simple_irq); | 351 | irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_simple_irq); |
352 | irq_set_chip_data(irq, domain->host_data); | 352 | irq_set_chip_data(irq, domain->host_data); |
353 | set_irq_flags(irq, IRQF_VALID); | ||
354 | 353 | ||
355 | return 0; | 354 | return 0; |
356 | } | 355 | } |
@@ -388,7 +387,7 @@ int dw_pcie_host_init(struct pcie_port *pp) | |||
388 | addrp = of_get_address(np, index, NULL, NULL); | 387 | addrp = of_get_address(np, index, NULL, NULL); |
389 | pp->cfg0_mod_base = of_read_number(addrp, ns); | 388 | pp->cfg0_mod_base = of_read_number(addrp, ns); |
390 | pp->cfg1_mod_base = pp->cfg0_mod_base + pp->cfg0_size; | 389 | pp->cfg1_mod_base = pp->cfg0_mod_base + pp->cfg0_size; |
391 | } else { | 390 | } else if (!pp->va_cfg0_base) { |
392 | dev_err(pp->dev, "missing *config* reg space\n"); | 391 | dev_err(pp->dev, "missing *config* reg space\n"); |
393 | } | 392 | } |
394 | 393 | ||
@@ -526,7 +525,6 @@ int dw_pcie_host_init(struct pcie_port *pp) | |||
526 | 525 | ||
527 | #ifdef CONFIG_PCI_MSI | 526 | #ifdef CONFIG_PCI_MSI |
528 | dw_pcie_msi_chip.dev = pp->dev; | 527 | dw_pcie_msi_chip.dev = pp->dev; |
529 | dw_pci.msi_ctrl = &dw_pcie_msi_chip; | ||
530 | #endif | 528 | #endif |
531 | 529 | ||
532 | dw_pci.nr_controllers = 1; | 530 | dw_pci.nr_controllers = 1; |
@@ -708,8 +706,15 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
708 | struct pcie_port *pp = sys_to_pcie(sys); | 706 | struct pcie_port *pp = sys_to_pcie(sys); |
709 | 707 | ||
710 | pp->root_bus_nr = sys->busnr; | 708 | pp->root_bus_nr = sys->busnr; |
711 | bus = pci_scan_root_bus(pp->dev, sys->busnr, | 709 | |
712 | &dw_pcie_ops, sys, &sys->resources); | 710 | if (IS_ENABLED(CONFIG_PCI_MSI)) |
711 | bus = pci_scan_root_bus_msi(pp->dev, sys->busnr, &dw_pcie_ops, | ||
712 | sys, &sys->resources, | ||
713 | &dw_pcie_msi_chip); | ||
714 | else | ||
715 | bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops, | ||
716 | sys, &sys->resources); | ||
717 | |||
713 | if (!bus) | 718 | if (!bus) |
714 | return NULL; | 719 | return NULL; |
715 | 720 | ||
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index d77481ea553e..fe2efb141a9b 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c | |||
@@ -58,9 +58,17 @@ | |||
58 | #define SYS_RC_INTX_EN 0x330 | 58 | #define SYS_RC_INTX_EN 0x330 |
59 | #define SYS_RC_INTX_MASK 0xf | 59 | #define SYS_RC_INTX_MASK 0xf |
60 | 60 | ||
61 | static inline struct iproc_pcie *sys_to_pcie(struct pci_sys_data *sys) | 61 | static inline struct iproc_pcie *iproc_data(struct pci_bus *bus) |
62 | { | 62 | { |
63 | return sys->private_data; | 63 | struct iproc_pcie *pcie; |
64 | #ifdef CONFIG_ARM | ||
65 | struct pci_sys_data *sys = bus->sysdata; | ||
66 | |||
67 | pcie = sys->private_data; | ||
68 | #else | ||
69 | pcie = bus->sysdata; | ||
70 | #endif | ||
71 | return pcie; | ||
64 | } | 72 | } |
65 | 73 | ||
66 | /** | 74 | /** |
@@ -71,8 +79,7 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus *bus, | |||
71 | unsigned int devfn, | 79 | unsigned int devfn, |
72 | int where) | 80 | int where) |
73 | { | 81 | { |
74 | struct pci_sys_data *sys = bus->sysdata; | 82 | struct iproc_pcie *pcie = iproc_data(bus); |
75 | struct iproc_pcie *pcie = sys_to_pcie(sys); | ||
76 | unsigned slot = PCI_SLOT(devfn); | 83 | unsigned slot = PCI_SLOT(devfn); |
77 | unsigned fn = PCI_FUNC(devfn); | 84 | unsigned fn = PCI_FUNC(devfn); |
78 | unsigned busno = bus->number; | 85 | unsigned busno = bus->number; |
@@ -186,32 +193,34 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie) | |||
186 | int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) | 193 | int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) |
187 | { | 194 | { |
188 | int ret; | 195 | int ret; |
196 | void *sysdata; | ||
189 | struct pci_bus *bus; | 197 | struct pci_bus *bus; |
190 | 198 | ||
191 | if (!pcie || !pcie->dev || !pcie->base) | 199 | if (!pcie || !pcie->dev || !pcie->base) |
192 | return -EINVAL; | 200 | return -EINVAL; |
193 | 201 | ||
194 | if (pcie->phy) { | 202 | ret = phy_init(pcie->phy); |
195 | ret = phy_init(pcie->phy); | 203 | if (ret) { |
196 | if (ret) { | 204 | dev_err(pcie->dev, "unable to initialize PCIe PHY\n"); |
197 | dev_err(pcie->dev, "unable to initialize PCIe PHY\n"); | 205 | return ret; |
198 | return ret; | 206 | } |
199 | } | ||
200 | |||
201 | ret = phy_power_on(pcie->phy); | ||
202 | if (ret) { | ||
203 | dev_err(pcie->dev, "unable to power on PCIe PHY\n"); | ||
204 | goto err_exit_phy; | ||
205 | } | ||
206 | 207 | ||
208 | ret = phy_power_on(pcie->phy); | ||
209 | if (ret) { | ||
210 | dev_err(pcie->dev, "unable to power on PCIe PHY\n"); | ||
211 | goto err_exit_phy; | ||
207 | } | 212 | } |
208 | 213 | ||
209 | iproc_pcie_reset(pcie); | 214 | iproc_pcie_reset(pcie); |
210 | 215 | ||
216 | #ifdef CONFIG_ARM | ||
211 | pcie->sysdata.private_data = pcie; | 217 | pcie->sysdata.private_data = pcie; |
218 | sysdata = &pcie->sysdata; | ||
219 | #else | ||
220 | sysdata = pcie; | ||
221 | #endif | ||
212 | 222 | ||
213 | bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, | 223 | bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, sysdata, res); |
214 | &pcie->sysdata, res); | ||
215 | if (!bus) { | 224 | if (!bus) { |
216 | dev_err(pcie->dev, "unable to create PCI root bus\n"); | 225 | dev_err(pcie->dev, "unable to create PCI root bus\n"); |
217 | ret = -ENOMEM; | 226 | ret = -ENOMEM; |
@@ -229,7 +238,9 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) | |||
229 | 238 | ||
230 | pci_scan_child_bus(bus); | 239 | pci_scan_child_bus(bus); |
231 | pci_assign_unassigned_bus_resources(bus); | 240 | pci_assign_unassigned_bus_resources(bus); |
241 | #ifdef CONFIG_ARM | ||
232 | pci_fixup_irqs(pci_common_swizzle, pcie->map_irq); | 242 | pci_fixup_irqs(pci_common_swizzle, pcie->map_irq); |
243 | #endif | ||
233 | pci_bus_add_devices(bus); | 244 | pci_bus_add_devices(bus); |
234 | 245 | ||
235 | return 0; | 246 | return 0; |
@@ -239,12 +250,9 @@ err_rm_root_bus: | |||
239 | pci_remove_root_bus(bus); | 250 | pci_remove_root_bus(bus); |
240 | 251 | ||
241 | err_power_off_phy: | 252 | err_power_off_phy: |
242 | if (pcie->phy) | 253 | phy_power_off(pcie->phy); |
243 | phy_power_off(pcie->phy); | ||
244 | err_exit_phy: | 254 | err_exit_phy: |
245 | if (pcie->phy) | 255 | phy_exit(pcie->phy); |
246 | phy_exit(pcie->phy); | ||
247 | |||
248 | return ret; | 256 | return ret; |
249 | } | 257 | } |
250 | EXPORT_SYMBOL(iproc_pcie_setup); | 258 | EXPORT_SYMBOL(iproc_pcie_setup); |
@@ -254,10 +262,8 @@ int iproc_pcie_remove(struct iproc_pcie *pcie) | |||
254 | pci_stop_root_bus(pcie->root_bus); | 262 | pci_stop_root_bus(pcie->root_bus); |
255 | pci_remove_root_bus(pcie->root_bus); | 263 | pci_remove_root_bus(pcie->root_bus); |
256 | 264 | ||
257 | if (pcie->phy) { | 265 | phy_power_off(pcie->phy); |
258 | phy_power_off(pcie->phy); | 266 | phy_exit(pcie->phy); |
259 | phy_exit(pcie->phy); | ||
260 | } | ||
261 | 267 | ||
262 | return 0; | 268 | return 0; |
263 | } | 269 | } |
diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h index ba0a108309cc..c9e4c10a462e 100644 --- a/drivers/pci/host/pcie-iproc.h +++ b/drivers/pci/host/pcie-iproc.h | |||
@@ -21,7 +21,7 @@ | |||
21 | * @dev: pointer to device data structure | 21 | * @dev: pointer to device data structure |
22 | * @base: PCIe host controller I/O register base | 22 | * @base: PCIe host controller I/O register base |
23 | * @resources: linked list of all PCI resources | 23 | * @resources: linked list of all PCI resources |
24 | * @sysdata: Per PCI controller data | 24 | * @sysdata: Per PCI controller data (ARM-specific) |
25 | * @root_bus: pointer to root bus | 25 | * @root_bus: pointer to root bus |
26 | * @phy: optional PHY device that controls the Serdes | 26 | * @phy: optional PHY device that controls the Serdes |
27 | * @irqs: interrupt IDs | 27 | * @irqs: interrupt IDs |
@@ -29,7 +29,9 @@ | |||
29 | struct iproc_pcie { | 29 | struct iproc_pcie { |
30 | struct device *dev; | 30 | struct device *dev; |
31 | void __iomem *base; | 31 | void __iomem *base; |
32 | #ifdef CONFIG_ARM | ||
32 | struct pci_sys_data sysdata; | 33 | struct pci_sys_data sysdata; |
34 | #endif | ||
33 | struct pci_bus *root_bus; | 35 | struct pci_bus *root_bus; |
34 | struct phy *phy; | 36 | struct phy *phy; |
35 | int irqs[IPROC_PCIE_MAX_NUM_IRQS]; | 37 | int irqs[IPROC_PCIE_MAX_NUM_IRQS]; |
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index c086210f2ffd..7678fe0820d7 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c | |||
@@ -664,7 +664,6 @@ static int rcar_msi_map(struct irq_domain *domain, unsigned int irq, | |||
664 | { | 664 | { |
665 | irq_set_chip_and_handler(irq, &rcar_msi_irq_chip, handle_simple_irq); | 665 | irq_set_chip_and_handler(irq, &rcar_msi_irq_chip, handle_simple_irq); |
666 | irq_set_chip_data(irq, domain->host_data); | 666 | irq_set_chip_data(irq, domain->host_data); |
667 | set_irq_flags(irq, IRQF_VALID); | ||
668 | 667 | ||
669 | return 0; | 668 | return 0; |
670 | } | 669 | } |
diff --git a/drivers/pci/host/pcie-spear13xx.c b/drivers/pci/host/pcie-spear13xx.c index c49fbdc0f6e4..98d2683181bc 100644 --- a/drivers/pci/host/pcie-spear13xx.c +++ b/drivers/pci/host/pcie-spear13xx.c | |||
@@ -223,8 +223,7 @@ static irqreturn_t spear13xx_pcie_irq_handler(int irq, void *arg) | |||
223 | status = readl(&app_reg->int_sts); | 223 | status = readl(&app_reg->int_sts); |
224 | 224 | ||
225 | if (status & MSI_CTRL_INT) { | 225 | if (status & MSI_CTRL_INT) { |
226 | if (!IS_ENABLED(CONFIG_PCI_MSI)) | 226 | BUG_ON(!IS_ENABLED(CONFIG_PCI_MSI)); |
227 | BUG(); | ||
228 | dw_handle_msi_irq(pp); | 227 | dw_handle_msi_irq(pp); |
229 | } | 228 | } |
230 | 229 | ||
diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c index f1a06a091ccb..1aeaa914bd30 100644 --- a/drivers/pci/host/pcie-xilinx.c +++ b/drivers/pci/host/pcie-xilinx.c | |||
@@ -338,7 +338,6 @@ static int xilinx_pcie_msi_map(struct irq_domain *domain, unsigned int irq, | |||
338 | { | 338 | { |
339 | irq_set_chip_and_handler(irq, &xilinx_msi_irq_chip, handle_simple_irq); | 339 | irq_set_chip_and_handler(irq, &xilinx_msi_irq_chip, handle_simple_irq); |
340 | irq_set_chip_data(irq, domain->host_data); | 340 | irq_set_chip_data(irq, domain->host_data); |
341 | set_irq_flags(irq, IRQF_VALID); | ||
342 | 341 | ||
343 | return 0; | 342 | return 0; |
344 | } | 343 | } |
@@ -377,7 +376,6 @@ static int xilinx_pcie_intx_map(struct irq_domain *domain, unsigned int irq, | |||
377 | { | 376 | { |
378 | irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); | 377 | irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); |
379 | irq_set_chip_data(irq, domain->host_data); | 378 | irq_set_chip_data(irq, domain->host_data); |
380 | set_irq_flags(irq, IRQF_VALID); | ||
381 | 379 | ||
382 | return 0; | 380 | return 0; |
383 | } | 381 | } |
@@ -449,14 +447,17 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data) | |||
449 | return IRQ_HANDLED; | 447 | return IRQ_HANDLED; |
450 | } | 448 | } |
451 | 449 | ||
452 | /* Clear interrupt FIFO register 1 */ | 450 | if (!(val & XILINX_PCIE_RPIFR1_MSI_INTR)) { |
453 | pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK, | 451 | /* Clear interrupt FIFO register 1 */ |
454 | XILINX_PCIE_REG_RPIFR1); | 452 | pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK, |
453 | XILINX_PCIE_REG_RPIFR1); | ||
455 | 454 | ||
456 | /* Handle INTx Interrupt */ | 455 | /* Handle INTx Interrupt */ |
457 | val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >> | 456 | val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >> |
458 | XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1; | 457 | XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1; |
459 | generic_handle_irq(irq_find_mapping(port->irq_domain, val)); | 458 | generic_handle_irq(irq_find_mapping(port->irq_domain, |
459 | val)); | ||
460 | } | ||
460 | } | 461 | } |
461 | 462 | ||
462 | if (status & XILINX_PCIE_INTR_MSI) { | 463 | if (status & XILINX_PCIE_INTR_MSI) { |
@@ -647,9 +648,15 @@ static struct pci_bus *xilinx_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
647 | struct pci_bus *bus; | 648 | struct pci_bus *bus; |
648 | 649 | ||
649 | port->root_busno = sys->busnr; | 650 | port->root_busno = sys->busnr; |
650 | bus = pci_scan_root_bus(port->dev, sys->busnr, &xilinx_pcie_ops, | ||
651 | sys, &sys->resources); | ||
652 | 651 | ||
652 | if (IS_ENABLED(CONFIG_PCI_MSI)) | ||
653 | bus = pci_scan_root_bus_msi(port->dev, sys->busnr, | ||
654 | &xilinx_pcie_ops, sys, | ||
655 | &sys->resources, | ||
656 | &xilinx_pcie_msi_chip); | ||
657 | else | ||
658 | bus = pci_scan_root_bus(port->dev, sys->busnr, | ||
659 | &xilinx_pcie_ops, sys, &sys->resources); | ||
653 | return bus; | 660 | return bus; |
654 | } | 661 | } |
655 | 662 | ||
@@ -847,7 +854,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev) | |||
847 | 854 | ||
848 | #ifdef CONFIG_PCI_MSI | 855 | #ifdef CONFIG_PCI_MSI |
849 | xilinx_pcie_msi_chip.dev = port->dev; | 856 | xilinx_pcie_msi_chip.dev = port->dev; |
850 | hw.msi_ctrl = &xilinx_pcie_msi_chip; | ||
851 | #endif | 857 | #endif |
852 | pci_common_init_dev(dev, &hw); | 858 | pci_common_init_dev(dev, &hw); |
853 | 859 | ||
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 56d8486dc167..d1fab97d6b01 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -83,12 +83,12 @@ GET_STATUS(attention_status, u8) | |||
83 | GET_STATUS(latch_status, u8) | 83 | GET_STATUS(latch_status, u8) |
84 | GET_STATUS(adapter_status, u8) | 84 | GET_STATUS(adapter_status, u8) |
85 | 85 | ||
86 | static ssize_t power_read_file(struct pci_slot *slot, char *buf) | 86 | static ssize_t power_read_file(struct pci_slot *pci_slot, char *buf) |
87 | { | 87 | { |
88 | int retval; | 88 | int retval; |
89 | u8 value; | 89 | u8 value; |
90 | 90 | ||
91 | retval = get_power_status(slot->hotplug, &value); | 91 | retval = get_power_status(pci_slot->hotplug, &value); |
92 | if (retval) | 92 | if (retval) |
93 | return retval; | 93 | return retval; |
94 | 94 | ||
@@ -140,22 +140,22 @@ static struct pci_slot_attribute hotplug_slot_attr_power = { | |||
140 | .store = power_write_file | 140 | .store = power_write_file |
141 | }; | 141 | }; |
142 | 142 | ||
143 | static ssize_t attention_read_file(struct pci_slot *slot, char *buf) | 143 | static ssize_t attention_read_file(struct pci_slot *pci_slot, char *buf) |
144 | { | 144 | { |
145 | int retval; | 145 | int retval; |
146 | u8 value; | 146 | u8 value; |
147 | 147 | ||
148 | retval = get_attention_status(slot->hotplug, &value); | 148 | retval = get_attention_status(pci_slot->hotplug, &value); |
149 | if (retval) | 149 | if (retval) |
150 | return retval; | 150 | return retval; |
151 | 151 | ||
152 | return sprintf(buf, "%d\n", value); | 152 | return sprintf(buf, "%d\n", value); |
153 | } | 153 | } |
154 | 154 | ||
155 | static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, | 155 | static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf, |
156 | size_t count) | 156 | size_t count) |
157 | { | 157 | { |
158 | struct hotplug_slot_ops *ops = slot->hotplug->ops; | 158 | struct hotplug_slot_ops *ops = pci_slot->hotplug->ops; |
159 | unsigned long lattention; | 159 | unsigned long lattention; |
160 | u8 attention; | 160 | u8 attention; |
161 | int retval = 0; | 161 | int retval = 0; |
@@ -169,7 +169,7 @@ static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, | |||
169 | goto exit; | 169 | goto exit; |
170 | } | 170 | } |
171 | if (ops->set_attention_status) | 171 | if (ops->set_attention_status) |
172 | retval = ops->set_attention_status(slot->hotplug, attention); | 172 | retval = ops->set_attention_status(pci_slot->hotplug, attention); |
173 | module_put(ops->owner); | 173 | module_put(ops->owner); |
174 | 174 | ||
175 | exit: | 175 | exit: |
@@ -184,12 +184,12 @@ static struct pci_slot_attribute hotplug_slot_attr_attention = { | |||
184 | .store = attention_write_file | 184 | .store = attention_write_file |
185 | }; | 185 | }; |
186 | 186 | ||
187 | static ssize_t latch_read_file(struct pci_slot *slot, char *buf) | 187 | static ssize_t latch_read_file(struct pci_slot *pci_slot, char *buf) |
188 | { | 188 | { |
189 | int retval; | 189 | int retval; |
190 | u8 value; | 190 | u8 value; |
191 | 191 | ||
192 | retval = get_latch_status(slot->hotplug, &value); | 192 | retval = get_latch_status(pci_slot->hotplug, &value); |
193 | if (retval) | 193 | if (retval) |
194 | return retval; | 194 | return retval; |
195 | 195 | ||
@@ -201,12 +201,12 @@ static struct pci_slot_attribute hotplug_slot_attr_latch = { | |||
201 | .show = latch_read_file, | 201 | .show = latch_read_file, |
202 | }; | 202 | }; |
203 | 203 | ||
204 | static ssize_t presence_read_file(struct pci_slot *slot, char *buf) | 204 | static ssize_t presence_read_file(struct pci_slot *pci_slot, char *buf) |
205 | { | 205 | { |
206 | int retval; | 206 | int retval; |
207 | u8 value; | 207 | u8 value; |
208 | 208 | ||
209 | retval = get_adapter_status(slot->hotplug, &value); | 209 | retval = get_adapter_status(pci_slot->hotplug, &value); |
210 | if (retval) | 210 | if (retval) |
211 | return retval; | 211 | return retval; |
212 | 212 | ||
@@ -307,43 +307,43 @@ static bool has_test_file(struct pci_slot *pci_slot) | |||
307 | return false; | 307 | return false; |
308 | } | 308 | } |
309 | 309 | ||
310 | static int fs_add_slot(struct pci_slot *slot) | 310 | static int fs_add_slot(struct pci_slot *pci_slot) |
311 | { | 311 | { |
312 | int retval = 0; | 312 | int retval = 0; |
313 | 313 | ||
314 | /* Create symbolic link to the hotplug driver module */ | 314 | /* Create symbolic link to the hotplug driver module */ |
315 | pci_hp_create_module_link(slot); | 315 | pci_hp_create_module_link(pci_slot); |
316 | 316 | ||
317 | if (has_power_file(slot)) { | 317 | if (has_power_file(pci_slot)) { |
318 | retval = sysfs_create_file(&slot->kobj, | 318 | retval = sysfs_create_file(&pci_slot->kobj, |
319 | &hotplug_slot_attr_power.attr); | 319 | &hotplug_slot_attr_power.attr); |
320 | if (retval) | 320 | if (retval) |
321 | goto exit_power; | 321 | goto exit_power; |
322 | } | 322 | } |
323 | 323 | ||
324 | if (has_attention_file(slot)) { | 324 | if (has_attention_file(pci_slot)) { |
325 | retval = sysfs_create_file(&slot->kobj, | 325 | retval = sysfs_create_file(&pci_slot->kobj, |
326 | &hotplug_slot_attr_attention.attr); | 326 | &hotplug_slot_attr_attention.attr); |
327 | if (retval) | 327 | if (retval) |
328 | goto exit_attention; | 328 | goto exit_attention; |
329 | } | 329 | } |
330 | 330 | ||
331 | if (has_latch_file(slot)) { | 331 | if (has_latch_file(pci_slot)) { |
332 | retval = sysfs_create_file(&slot->kobj, | 332 | retval = sysfs_create_file(&pci_slot->kobj, |
333 | &hotplug_slot_attr_latch.attr); | 333 | &hotplug_slot_attr_latch.attr); |
334 | if (retval) | 334 | if (retval) |
335 | goto exit_latch; | 335 | goto exit_latch; |
336 | } | 336 | } |
337 | 337 | ||
338 | if (has_adapter_file(slot)) { | 338 | if (has_adapter_file(pci_slot)) { |
339 | retval = sysfs_create_file(&slot->kobj, | 339 | retval = sysfs_create_file(&pci_slot->kobj, |
340 | &hotplug_slot_attr_presence.attr); | 340 | &hotplug_slot_attr_presence.attr); |
341 | if (retval) | 341 | if (retval) |
342 | goto exit_adapter; | 342 | goto exit_adapter; |
343 | } | 343 | } |
344 | 344 | ||
345 | if (has_test_file(slot)) { | 345 | if (has_test_file(pci_slot)) { |
346 | retval = sysfs_create_file(&slot->kobj, | 346 | retval = sysfs_create_file(&pci_slot->kobj, |
347 | &hotplug_slot_attr_test.attr); | 347 | &hotplug_slot_attr_test.attr); |
348 | if (retval) | 348 | if (retval) |
349 | goto exit_test; | 349 | goto exit_test; |
@@ -352,45 +352,45 @@ static int fs_add_slot(struct pci_slot *slot) | |||
352 | goto exit; | 352 | goto exit; |
353 | 353 | ||
354 | exit_test: | 354 | exit_test: |
355 | if (has_adapter_file(slot)) | 355 | if (has_adapter_file(pci_slot)) |
356 | sysfs_remove_file(&slot->kobj, | 356 | sysfs_remove_file(&pci_slot->kobj, |
357 | &hotplug_slot_attr_presence.attr); | 357 | &hotplug_slot_attr_presence.attr); |
358 | exit_adapter: | 358 | exit_adapter: |
359 | if (has_latch_file(slot)) | 359 | if (has_latch_file(pci_slot)) |
360 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr); | 360 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_latch.attr); |
361 | exit_latch: | 361 | exit_latch: |
362 | if (has_attention_file(slot)) | 362 | if (has_attention_file(pci_slot)) |
363 | sysfs_remove_file(&slot->kobj, | 363 | sysfs_remove_file(&pci_slot->kobj, |
364 | &hotplug_slot_attr_attention.attr); | 364 | &hotplug_slot_attr_attention.attr); |
365 | exit_attention: | 365 | exit_attention: |
366 | if (has_power_file(slot)) | 366 | if (has_power_file(pci_slot)) |
367 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr); | 367 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_power.attr); |
368 | exit_power: | 368 | exit_power: |
369 | pci_hp_remove_module_link(slot); | 369 | pci_hp_remove_module_link(pci_slot); |
370 | exit: | 370 | exit: |
371 | return retval; | 371 | return retval; |
372 | } | 372 | } |
373 | 373 | ||
374 | static void fs_remove_slot(struct pci_slot *slot) | 374 | static void fs_remove_slot(struct pci_slot *pci_slot) |
375 | { | 375 | { |
376 | if (has_power_file(slot)) | 376 | if (has_power_file(pci_slot)) |
377 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr); | 377 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_power.attr); |
378 | 378 | ||
379 | if (has_attention_file(slot)) | 379 | if (has_attention_file(pci_slot)) |
380 | sysfs_remove_file(&slot->kobj, | 380 | sysfs_remove_file(&pci_slot->kobj, |
381 | &hotplug_slot_attr_attention.attr); | 381 | &hotplug_slot_attr_attention.attr); |
382 | 382 | ||
383 | if (has_latch_file(slot)) | 383 | if (has_latch_file(pci_slot)) |
384 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr); | 384 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_latch.attr); |
385 | 385 | ||
386 | if (has_adapter_file(slot)) | 386 | if (has_adapter_file(pci_slot)) |
387 | sysfs_remove_file(&slot->kobj, | 387 | sysfs_remove_file(&pci_slot->kobj, |
388 | &hotplug_slot_attr_presence.attr); | 388 | &hotplug_slot_attr_presence.attr); |
389 | 389 | ||
390 | if (has_test_file(slot)) | 390 | if (has_test_file(pci_slot)) |
391 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_test.attr); | 391 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_test.attr); |
392 | 392 | ||
393 | pci_hp_remove_module_link(slot); | 393 | pci_hp_remove_module_link(pci_slot); |
394 | } | 394 | } |
395 | 395 | ||
396 | static struct hotplug_slot *get_slot_from_name(const char *name) | 396 | static struct hotplug_slot *get_slot_from_name(const char *name) |
@@ -467,37 +467,37 @@ EXPORT_SYMBOL_GPL(__pci_hp_register); | |||
467 | 467 | ||
468 | /** | 468 | /** |
469 | * pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem | 469 | * pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem |
470 | * @hotplug: pointer to the &struct hotplug_slot to deregister | 470 | * @slot: pointer to the &struct hotplug_slot to deregister |
471 | * | 471 | * |
472 | * The @slot must have been registered with the pci hotplug subsystem | 472 | * The @slot must have been registered with the pci hotplug subsystem |
473 | * previously with a call to pci_hp_register(). | 473 | * previously with a call to pci_hp_register(). |
474 | * | 474 | * |
475 | * Returns 0 if successful, anything else for an error. | 475 | * Returns 0 if successful, anything else for an error. |
476 | */ | 476 | */ |
477 | int pci_hp_deregister(struct hotplug_slot *hotplug) | 477 | int pci_hp_deregister(struct hotplug_slot *slot) |
478 | { | 478 | { |
479 | struct hotplug_slot *temp; | 479 | struct hotplug_slot *temp; |
480 | struct pci_slot *slot; | 480 | struct pci_slot *pci_slot; |
481 | 481 | ||
482 | if (!hotplug) | 482 | if (!slot) |
483 | return -ENODEV; | 483 | return -ENODEV; |
484 | 484 | ||
485 | mutex_lock(&pci_hp_mutex); | 485 | mutex_lock(&pci_hp_mutex); |
486 | temp = get_slot_from_name(hotplug_slot_name(hotplug)); | 486 | temp = get_slot_from_name(hotplug_slot_name(slot)); |
487 | if (temp != hotplug) { | 487 | if (temp != slot) { |
488 | mutex_unlock(&pci_hp_mutex); | 488 | mutex_unlock(&pci_hp_mutex); |
489 | return -ENODEV; | 489 | return -ENODEV; |
490 | } | 490 | } |
491 | 491 | ||
492 | list_del(&hotplug->slot_list); | 492 | list_del(&slot->slot_list); |
493 | 493 | ||
494 | slot = hotplug->pci_slot; | 494 | pci_slot = slot->pci_slot; |
495 | fs_remove_slot(slot); | 495 | fs_remove_slot(pci_slot); |
496 | dbg("Removed slot %s from the list\n", hotplug_slot_name(hotplug)); | 496 | dbg("Removed slot %s from the list\n", hotplug_slot_name(slot)); |
497 | 497 | ||
498 | hotplug->release(hotplug); | 498 | slot->release(slot); |
499 | slot->hotplug = NULL; | 499 | pci_slot->hotplug = NULL; |
500 | pci_destroy_slot(slot); | 500 | pci_destroy_slot(pci_slot); |
501 | mutex_unlock(&pci_hp_mutex); | 501 | mutex_unlock(&pci_hp_mutex); |
502 | 502 | ||
503 | return 0; | 503 | return 0; |
@@ -506,7 +506,7 @@ EXPORT_SYMBOL_GPL(pci_hp_deregister); | |||
506 | 506 | ||
507 | /** | 507 | /** |
508 | * pci_hp_change_slot_info - changes the slot's information structure in the core | 508 | * pci_hp_change_slot_info - changes the slot's information structure in the core |
509 | * @hotplug: pointer to the slot whose info has changed | 509 | * @slot: pointer to the slot whose info has changed |
510 | * @info: pointer to the info copy into the slot's info structure | 510 | * @info: pointer to the info copy into the slot's info structure |
511 | * | 511 | * |
512 | * @slot must have been registered with the pci | 512 | * @slot must have been registered with the pci |
@@ -514,13 +514,13 @@ EXPORT_SYMBOL_GPL(pci_hp_deregister); | |||
514 | * | 514 | * |
515 | * Returns 0 if successful, anything else for an error. | 515 | * Returns 0 if successful, anything else for an error. |
516 | */ | 516 | */ |
517 | int pci_hp_change_slot_info(struct hotplug_slot *hotplug, | 517 | int pci_hp_change_slot_info(struct hotplug_slot *slot, |
518 | struct hotplug_slot_info *info) | 518 | struct hotplug_slot_info *info) |
519 | { | 519 | { |
520 | if (!hotplug || !info) | 520 | if (!slot || !info) |
521 | return -ENODEV; | 521 | return -ENODEV; |
522 | 522 | ||
523 | memcpy(hotplug->info, info, sizeof(struct hotplug_slot_info)); | 523 | memcpy(slot->info, info, sizeof(struct hotplug_slot_info)); |
524 | 524 | ||
525 | return 0; | 525 | return 0; |
526 | } | 526 | } |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 57cd1327346f..62d6fe6c3714 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -101,18 +101,12 @@ struct controller { | |||
101 | unsigned int power_fault_detected; | 101 | unsigned int power_fault_detected; |
102 | }; | 102 | }; |
103 | 103 | ||
104 | #define INT_BUTTON_IGNORE 0 | ||
105 | #define INT_PRESENCE_ON 1 | 104 | #define INT_PRESENCE_ON 1 |
106 | #define INT_PRESENCE_OFF 2 | 105 | #define INT_PRESENCE_OFF 2 |
107 | #define INT_SWITCH_CLOSE 3 | 106 | #define INT_POWER_FAULT 3 |
108 | #define INT_SWITCH_OPEN 4 | 107 | #define INT_BUTTON_PRESS 4 |
109 | #define INT_POWER_FAULT 5 | 108 | #define INT_LINK_UP 5 |
110 | #define INT_POWER_FAULT_CLEAR 6 | 109 | #define INT_LINK_DOWN 6 |
111 | #define INT_BUTTON_PRESS 7 | ||
112 | #define INT_BUTTON_RELEASE 8 | ||
113 | #define INT_BUTTON_CANCEL 9 | ||
114 | #define INT_LINK_UP 10 | ||
115 | #define INT_LINK_DOWN 11 | ||
116 | 110 | ||
117 | #define STATIC_STATE 0 | 111 | #define STATIC_STATE 0 |
118 | #define BLINKINGON_STATE 1 | 112 | #define BLINKINGON_STATE 1 |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 2913f7e68a10..5c24e938042f 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -109,21 +109,23 @@ static int pcie_poll_cmd(struct controller *ctrl, int timeout) | |||
109 | struct pci_dev *pdev = ctrl_dev(ctrl); | 109 | struct pci_dev *pdev = ctrl_dev(ctrl); |
110 | u16 slot_status; | 110 | u16 slot_status; |
111 | 111 | ||
112 | pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); | 112 | while (true) { |
113 | if (slot_status & PCI_EXP_SLTSTA_CC) { | ||
114 | pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, | ||
115 | PCI_EXP_SLTSTA_CC); | ||
116 | return 1; | ||
117 | } | ||
118 | while (timeout > 0) { | ||
119 | msleep(10); | ||
120 | timeout -= 10; | ||
121 | pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); | 113 | pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); |
114 | if (slot_status == (u16) ~0) { | ||
115 | ctrl_info(ctrl, "%s: no response from device\n", | ||
116 | __func__); | ||
117 | return 0; | ||
118 | } | ||
119 | |||
122 | if (slot_status & PCI_EXP_SLTSTA_CC) { | 120 | if (slot_status & PCI_EXP_SLTSTA_CC) { |
123 | pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, | 121 | pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, |
124 | PCI_EXP_SLTSTA_CC); | 122 | PCI_EXP_SLTSTA_CC); |
125 | return 1; | 123 | return 1; |
126 | } | 124 | } |
125 | if (timeout < 0) | ||
126 | break; | ||
127 | msleep(10); | ||
128 | timeout -= 10; | ||
127 | } | 129 | } |
128 | return 0; /* timeout */ | 130 | return 0; /* timeout */ |
129 | } | 131 | } |
@@ -190,6 +192,11 @@ static void pcie_do_write_cmd(struct controller *ctrl, u16 cmd, | |||
190 | pcie_wait_cmd(ctrl); | 192 | pcie_wait_cmd(ctrl); |
191 | 193 | ||
192 | pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &slot_ctrl); | 194 | pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &slot_ctrl); |
195 | if (slot_ctrl == (u16) ~0) { | ||
196 | ctrl_info(ctrl, "%s: no response from device\n", __func__); | ||
197 | goto out; | ||
198 | } | ||
199 | |||
193 | slot_ctrl &= ~mask; | 200 | slot_ctrl &= ~mask; |
194 | slot_ctrl |= (cmd & mask); | 201 | slot_ctrl |= (cmd & mask); |
195 | ctrl->cmd_busy = 1; | 202 | ctrl->cmd_busy = 1; |
@@ -205,6 +212,7 @@ static void pcie_do_write_cmd(struct controller *ctrl, u16 cmd, | |||
205 | if (wait) | 212 | if (wait) |
206 | pcie_wait_cmd(ctrl); | 213 | pcie_wait_cmd(ctrl); |
207 | 214 | ||
215 | out: | ||
208 | mutex_unlock(&ctrl->ctrl_lock); | 216 | mutex_unlock(&ctrl->ctrl_lock); |
209 | } | 217 | } |
210 | 218 | ||
@@ -535,7 +543,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
535 | struct pci_dev *dev; | 543 | struct pci_dev *dev; |
536 | struct slot *slot = ctrl->slot; | 544 | struct slot *slot = ctrl->slot; |
537 | u16 detected, intr_loc; | 545 | u16 detected, intr_loc; |
538 | u8 open, present; | 546 | u8 present; |
539 | bool link; | 547 | bool link; |
540 | 548 | ||
541 | /* | 549 | /* |
@@ -546,9 +554,14 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
546 | intr_loc = 0; | 554 | intr_loc = 0; |
547 | do { | 555 | do { |
548 | pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &detected); | 556 | pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &detected); |
557 | if (detected == (u16) ~0) { | ||
558 | ctrl_info(ctrl, "%s: no response from device\n", | ||
559 | __func__); | ||
560 | return IRQ_HANDLED; | ||
561 | } | ||
549 | 562 | ||
550 | detected &= (PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD | | 563 | detected &= (PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD | |
551 | PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_PDC | | 564 | PCI_EXP_SLTSTA_PDC | |
552 | PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC); | 565 | PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC); |
553 | detected &= ~intr_loc; | 566 | detected &= ~intr_loc; |
554 | intr_loc |= detected; | 567 | intr_loc |= detected; |
@@ -581,15 +594,6 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
581 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) | 594 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) |
582 | return IRQ_HANDLED; | 595 | return IRQ_HANDLED; |
583 | 596 | ||
584 | /* Check MRL Sensor Changed */ | ||
585 | if (intr_loc & PCI_EXP_SLTSTA_MRLSC) { | ||
586 | pciehp_get_latch_status(slot, &open); | ||
587 | ctrl_info(ctrl, "Latch %s on Slot(%s)\n", | ||
588 | open ? "open" : "close", slot_name(slot)); | ||
589 | pciehp_queue_interrupt_event(slot, open ? INT_SWITCH_OPEN : | ||
590 | INT_SWITCH_CLOSE); | ||
591 | } | ||
592 | |||
593 | /* Check Attention Button Pressed */ | 597 | /* Check Attention Button Pressed */ |
594 | if (intr_loc & PCI_EXP_SLTSTA_ABP) { | 598 | if (intr_loc & PCI_EXP_SLTSTA_ABP) { |
595 | ctrl_info(ctrl, "Button pressed on Slot(%s)\n", | 599 | ctrl_info(ctrl, "Button pressed on Slot(%s)\n", |
@@ -649,13 +653,11 @@ void pcie_enable_notification(struct controller *ctrl) | |||
649 | cmd |= PCI_EXP_SLTCTL_ABPE; | 653 | cmd |= PCI_EXP_SLTCTL_ABPE; |
650 | else | 654 | else |
651 | cmd |= PCI_EXP_SLTCTL_PDCE; | 655 | cmd |= PCI_EXP_SLTCTL_PDCE; |
652 | if (MRL_SENS(ctrl)) | ||
653 | cmd |= PCI_EXP_SLTCTL_MRLSCE; | ||
654 | if (!pciehp_poll_mode) | 656 | if (!pciehp_poll_mode) |
655 | cmd |= PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE; | 657 | cmd |= PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE; |
656 | 658 | ||
657 | mask = (PCI_EXP_SLTCTL_PDCE | PCI_EXP_SLTCTL_ABPE | | 659 | mask = (PCI_EXP_SLTCTL_PDCE | PCI_EXP_SLTCTL_ABPE | |
658 | PCI_EXP_SLTCTL_MRLSCE | PCI_EXP_SLTCTL_PFDE | | 660 | PCI_EXP_SLTCTL_PFDE | |
659 | PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE | | 661 | PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE | |
660 | PCI_EXP_SLTCTL_DLLSCE); | 662 | PCI_EXP_SLTCTL_DLLSCE); |
661 | 663 | ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index f66be868ad21..2f9b1c0d1f96 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -77,24 +77,9 @@ static void pci_msi_teardown_msi_irqs(struct pci_dev *dev) | |||
77 | 77 | ||
78 | /* Arch hooks */ | 78 | /* Arch hooks */ |
79 | 79 | ||
80 | struct msi_controller * __weak pcibios_msi_controller(struct pci_dev *dev) | ||
81 | { | ||
82 | return NULL; | ||
83 | } | ||
84 | |||
85 | static struct msi_controller *pci_msi_controller(struct pci_dev *dev) | ||
86 | { | ||
87 | struct msi_controller *msi_ctrl = dev->bus->msi; | ||
88 | |||
89 | if (msi_ctrl) | ||
90 | return msi_ctrl; | ||
91 | |||
92 | return pcibios_msi_controller(dev); | ||
93 | } | ||
94 | |||
95 | int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) | 80 | int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) |
96 | { | 81 | { |
97 | struct msi_controller *chip = pci_msi_controller(dev); | 82 | struct msi_controller *chip = dev->bus->msi; |
98 | int err; | 83 | int err; |
99 | 84 | ||
100 | if (!chip || !chip->setup_irq) | 85 | if (!chip || !chip->setup_irq) |
@@ -665,6 +650,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
665 | pci_msi_set_enable(dev, 1); | 650 | pci_msi_set_enable(dev, 1); |
666 | dev->msi_enabled = 1; | 651 | dev->msi_enabled = 1; |
667 | 652 | ||
653 | pcibios_free_irq(dev); | ||
668 | dev->irq = entry->irq; | 654 | dev->irq = entry->irq; |
669 | return 0; | 655 | return 0; |
670 | } | 656 | } |
@@ -792,9 +778,9 @@ static int msix_capability_init(struct pci_dev *dev, | |||
792 | /* Set MSI-X enabled bits and unmask the function */ | 778 | /* Set MSI-X enabled bits and unmask the function */ |
793 | pci_intx_for_msi(dev, 0); | 779 | pci_intx_for_msi(dev, 0); |
794 | dev->msix_enabled = 1; | 780 | dev->msix_enabled = 1; |
795 | |||
796 | pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0); | 781 | pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0); |
797 | 782 | ||
783 | pcibios_free_irq(dev); | ||
798 | return 0; | 784 | return 0; |
799 | 785 | ||
800 | out_avail: | 786 | out_avail: |
@@ -909,6 +895,7 @@ void pci_msi_shutdown(struct pci_dev *dev) | |||
909 | 895 | ||
910 | /* Restore dev->irq to its default pin-assertion irq */ | 896 | /* Restore dev->irq to its default pin-assertion irq */ |
911 | dev->irq = desc->msi_attrib.default_irq; | 897 | dev->irq = desc->msi_attrib.default_irq; |
898 | pcibios_alloc_irq(dev); | ||
912 | } | 899 | } |
913 | 900 | ||
914 | void pci_disable_msi(struct pci_dev *dev) | 901 | void pci_disable_msi(struct pci_dev *dev) |
@@ -1009,6 +996,7 @@ void pci_msix_shutdown(struct pci_dev *dev) | |||
1009 | pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); | 996 | pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); |
1010 | pci_intx_for_msi(dev, 1); | 997 | pci_intx_for_msi(dev, 1); |
1011 | dev->msix_enabled = 0; | 998 | dev->msix_enabled = 0; |
999 | pcibios_alloc_irq(dev); | ||
1012 | } | 1000 | } |
1013 | 1001 | ||
1014 | void pci_disable_msix(struct pci_dev *dev) | 1002 | void pci_disable_msix(struct pci_dev *dev) |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 314a625b78d6..a32ba753e413 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -594,7 +594,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev) | |||
594 | /** | 594 | /** |
595 | * pci_acpi_optimize_delay - optimize PCI D3 and D3cold delay from ACPI | 595 | * pci_acpi_optimize_delay - optimize PCI D3 and D3cold delay from ACPI |
596 | * @pdev: the PCI device whose delay is to be updated | 596 | * @pdev: the PCI device whose delay is to be updated |
597 | * @adev: the companion ACPI device of this PCI device | 597 | * @handle: ACPI handle of this device |
598 | * | 598 | * |
599 | * Update the d3_delay and d3cold_delay of a PCI device from the ACPI _DSM | 599 | * Update the d3_delay and d3cold_delay of a PCI device from the ACPI _DSM |
600 | * control method of either the device itself or the PCI host bridge. | 600 | * control method of either the device itself or the PCI host bridge. |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 3cb2210de553..52a880ca1768 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -388,18 +388,31 @@ static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) | |||
388 | return error; | 388 | return error; |
389 | } | 389 | } |
390 | 390 | ||
391 | int __weak pcibios_alloc_irq(struct pci_dev *dev) | ||
392 | { | ||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | void __weak pcibios_free_irq(struct pci_dev *dev) | ||
397 | { | ||
398 | } | ||
399 | |||
391 | static int pci_device_probe(struct device *dev) | 400 | static int pci_device_probe(struct device *dev) |
392 | { | 401 | { |
393 | int error = 0; | 402 | int error; |
394 | struct pci_driver *drv; | 403 | struct pci_dev *pci_dev = to_pci_dev(dev); |
395 | struct pci_dev *pci_dev; | 404 | struct pci_driver *drv = to_pci_driver(dev->driver); |
405 | |||
406 | error = pcibios_alloc_irq(pci_dev); | ||
407 | if (error < 0) | ||
408 | return error; | ||
396 | 409 | ||
397 | drv = to_pci_driver(dev->driver); | ||
398 | pci_dev = to_pci_dev(dev); | ||
399 | pci_dev_get(pci_dev); | 410 | pci_dev_get(pci_dev); |
400 | error = __pci_device_probe(drv, pci_dev); | 411 | error = __pci_device_probe(drv, pci_dev); |
401 | if (error) | 412 | if (error) { |
413 | pcibios_free_irq(pci_dev); | ||
402 | pci_dev_put(pci_dev); | 414 | pci_dev_put(pci_dev); |
415 | } | ||
403 | 416 | ||
404 | return error; | 417 | return error; |
405 | } | 418 | } |
@@ -415,6 +428,7 @@ static int pci_device_remove(struct device *dev) | |||
415 | drv->remove(pci_dev); | 428 | drv->remove(pci_dev); |
416 | pm_runtime_put_noidle(dev); | 429 | pm_runtime_put_noidle(dev); |
417 | } | 430 | } |
431 | pcibios_free_irq(pci_dev); | ||
418 | pci_dev->driver = NULL; | 432 | pci_dev->driver = NULL; |
419 | } | 433 | } |
420 | 434 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 0008c950452c..cc76238c86fb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -81,7 +81,7 @@ unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE; | |||
81 | unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE; | 81 | unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE; |
82 | unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE; | 82 | unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE; |
83 | 83 | ||
84 | enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF; | 84 | enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_DEFAULT; |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * The default CLS is used if arch didn't set CLS explicitly and not | 87 | * The default CLS is used if arch didn't set CLS explicitly and not |
@@ -140,7 +140,6 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) | |||
140 | EXPORT_SYMBOL_GPL(pci_ioremap_bar); | 140 | EXPORT_SYMBOL_GPL(pci_ioremap_bar); |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | #define PCI_FIND_CAP_TTL 48 | ||
144 | 143 | ||
145 | static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, | 144 | static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, |
146 | u8 pos, int cap, int *ttl) | 145 | u8 pos, int cap, int *ttl) |
@@ -196,8 +195,6 @@ static int __pci_bus_find_cap_start(struct pci_bus *bus, | |||
196 | return PCI_CAPABILITY_LIST; | 195 | return PCI_CAPABILITY_LIST; |
197 | case PCI_HEADER_TYPE_CARDBUS: | 196 | case PCI_HEADER_TYPE_CARDBUS: |
198 | return PCI_CB_CAPABILITY_LIST; | 197 | return PCI_CB_CAPABILITY_LIST; |
199 | default: | ||
200 | return 0; | ||
201 | } | 198 | } |
202 | 199 | ||
203 | return 0; | 200 | return 0; |
@@ -972,7 +969,7 @@ static int pci_save_pcix_state(struct pci_dev *dev) | |||
972 | struct pci_cap_saved_state *save_state; | 969 | struct pci_cap_saved_state *save_state; |
973 | 970 | ||
974 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); | 971 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
975 | if (pos <= 0) | 972 | if (!pos) |
976 | return 0; | 973 | return 0; |
977 | 974 | ||
978 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); | 975 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); |
@@ -995,7 +992,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev) | |||
995 | 992 | ||
996 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); | 993 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); |
997 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); | 994 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
998 | if (!save_state || pos <= 0) | 995 | if (!save_state || !pos) |
999 | return; | 996 | return; |
1000 | cap = (u16 *)&save_state->cap.data[0]; | 997 | cap = (u16 *)&save_state->cap.data[0]; |
1001 | 998 | ||
@@ -1092,6 +1089,9 @@ void pci_restore_state(struct pci_dev *dev) | |||
1092 | 1089 | ||
1093 | pci_restore_pcix_state(dev); | 1090 | pci_restore_pcix_state(dev); |
1094 | pci_restore_msi_state(dev); | 1091 | pci_restore_msi_state(dev); |
1092 | |||
1093 | /* Restore ACS and IOV configuration state */ | ||
1094 | pci_enable_acs(dev); | ||
1095 | pci_restore_iov_state(dev); | 1095 | pci_restore_iov_state(dev); |
1096 | 1096 | ||
1097 | dev->state_saved = false; | 1097 | dev->state_saved = false; |
@@ -2159,7 +2159,7 @@ static int _pci_add_cap_save_buffer(struct pci_dev *dev, u16 cap, | |||
2159 | else | 2159 | else |
2160 | pos = pci_find_capability(dev, cap); | 2160 | pos = pci_find_capability(dev, cap); |
2161 | 2161 | ||
2162 | if (pos <= 0) | 2162 | if (!pos) |
2163 | return 0; | 2163 | return 0; |
2164 | 2164 | ||
2165 | save_state = kzalloc(sizeof(*save_state) + size, GFP_KERNEL); | 2165 | save_state = kzalloc(sizeof(*save_state) + size, GFP_KERNEL); |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 4ff0ff1c4088..24ba9dc8910a 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #define PCI_CFG_SPACE_SIZE 256 | 4 | #define PCI_CFG_SPACE_SIZE 256 |
5 | #define PCI_CFG_SPACE_EXP_SIZE 4096 | 5 | #define PCI_CFG_SPACE_EXP_SIZE 4096 |
6 | 6 | ||
7 | #define PCI_FIND_CAP_TTL 48 | ||
8 | |||
7 | extern const unsigned char pcie_link_speed[]; | 9 | extern const unsigned char pcie_link_speed[]; |
8 | 10 | ||
9 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev); | 11 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev); |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 2f0ce668a775..88122dc2e1b1 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -448,7 +448,7 @@ static int resume_iter(struct device *dev, void *data) | |||
448 | } | 448 | } |
449 | 449 | ||
450 | /** | 450 | /** |
451 | * pcie_port_device_suspend - resume port services associated with a PCIe port | 451 | * pcie_port_device_resume - resume port services associated with a PCIe port |
452 | * @dev: PCI Express port to handle | 452 | * @dev: PCI Express port to handle |
453 | */ | 453 | */ |
454 | int pcie_port_device_resume(struct device *dev) | 454 | int pcie_port_device_resume(struct device *dev) |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f6ae0d0052eb..04cfc60f7860 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -826,6 +826,9 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
826 | child->bridge_ctl = bctl; | 826 | child->bridge_ctl = bctl; |
827 | } | 827 | } |
828 | 828 | ||
829 | /* Read and initialize bridge resources */ | ||
830 | pci_read_bridge_bases(child); | ||
831 | |||
829 | cmax = pci_scan_child_bus(child); | 832 | cmax = pci_scan_child_bus(child); |
830 | if (cmax > subordinate) | 833 | if (cmax > subordinate) |
831 | dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n", | 834 | dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n", |
@@ -886,6 +889,9 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
886 | 889 | ||
887 | if (!is_cardbus) { | 890 | if (!is_cardbus) { |
888 | child->bridge_ctl = bctl; | 891 | child->bridge_ctl = bctl; |
892 | |||
893 | /* Read and initialize bridge resources */ | ||
894 | pci_read_bridge_bases(child); | ||
889 | max = pci_scan_child_bus(child); | 895 | max = pci_scan_child_bus(child); |
890 | } else { | 896 | } else { |
891 | /* | 897 | /* |
@@ -1138,7 +1144,6 @@ int pci_setup_device(struct pci_dev *dev) | |||
1138 | { | 1144 | { |
1139 | u32 class; | 1145 | u32 class; |
1140 | u8 hdr_type; | 1146 | u8 hdr_type; |
1141 | struct pci_slot *slot; | ||
1142 | int pos = 0; | 1147 | int pos = 0; |
1143 | struct pci_bus_region region; | 1148 | struct pci_bus_region region; |
1144 | struct resource *res; | 1149 | struct resource *res; |
@@ -1154,10 +1159,7 @@ int pci_setup_device(struct pci_dev *dev) | |||
1154 | dev->error_state = pci_channel_io_normal; | 1159 | dev->error_state = pci_channel_io_normal; |
1155 | set_pcie_port_type(dev); | 1160 | set_pcie_port_type(dev); |
1156 | 1161 | ||
1157 | list_for_each_entry(slot, &dev->bus->slots, list) | 1162 | pci_dev_assign_slot(dev); |
1158 | if (PCI_SLOT(dev->devfn) == slot->number) | ||
1159 | dev->slot = slot; | ||
1160 | |||
1161 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) | 1163 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) |
1162 | set this higher, assuming the system even supports it. */ | 1164 | set this higher, assuming the system even supports it. */ |
1163 | dev->dma_mask = 0xffffffff; | 1165 | dev->dma_mask = 0xffffffff; |
@@ -1273,13 +1275,51 @@ int pci_setup_device(struct pci_dev *dev) | |||
1273 | bad: | 1275 | bad: |
1274 | dev_err(&dev->dev, "ignoring class %#08x (doesn't match header type %02x)\n", | 1276 | dev_err(&dev->dev, "ignoring class %#08x (doesn't match header type %02x)\n", |
1275 | dev->class, dev->hdr_type); | 1277 | dev->class, dev->hdr_type); |
1276 | dev->class = PCI_CLASS_NOT_DEFINED; | 1278 | dev->class = PCI_CLASS_NOT_DEFINED << 8; |
1277 | } | 1279 | } |
1278 | 1280 | ||
1279 | /* We found a fine healthy device, go go go... */ | 1281 | /* We found a fine healthy device, go go go... */ |
1280 | return 0; | 1282 | return 0; |
1281 | } | 1283 | } |
1282 | 1284 | ||
1285 | static void pci_configure_mps(struct pci_dev *dev) | ||
1286 | { | ||
1287 | struct pci_dev *bridge = pci_upstream_bridge(dev); | ||
1288 | int mps, p_mps, rc; | ||
1289 | |||
1290 | if (!pci_is_pcie(dev) || !bridge || !pci_is_pcie(bridge)) | ||
1291 | return; | ||
1292 | |||
1293 | mps = pcie_get_mps(dev); | ||
1294 | p_mps = pcie_get_mps(bridge); | ||
1295 | |||
1296 | if (mps == p_mps) | ||
1297 | return; | ||
1298 | |||
1299 | if (pcie_bus_config == PCIE_BUS_TUNE_OFF) { | ||
1300 | dev_warn(&dev->dev, "Max Payload Size %d, but upstream %s set to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n", | ||
1301 | mps, pci_name(bridge), p_mps); | ||
1302 | return; | ||
1303 | } | ||
1304 | |||
1305 | /* | ||
1306 | * Fancier MPS configuration is done later by | ||
1307 | * pcie_bus_configure_settings() | ||
1308 | */ | ||
1309 | if (pcie_bus_config != PCIE_BUS_DEFAULT) | ||
1310 | return; | ||
1311 | |||
1312 | rc = pcie_set_mps(dev, p_mps); | ||
1313 | if (rc) { | ||
1314 | dev_warn(&dev->dev, "can't set Max Payload Size to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n", | ||
1315 | p_mps); | ||
1316 | return; | ||
1317 | } | ||
1318 | |||
1319 | dev_info(&dev->dev, "Max Payload Size set to %d (was %d, max %d)\n", | ||
1320 | p_mps, mps, 128 << dev->pcie_mpss); | ||
1321 | } | ||
1322 | |||
1283 | static struct hpp_type0 pci_default_type0 = { | 1323 | static struct hpp_type0 pci_default_type0 = { |
1284 | .revision = 1, | 1324 | .revision = 1, |
1285 | .cache_line_size = 8, | 1325 | .cache_line_size = 8, |
@@ -1401,6 +1441,8 @@ static void pci_configure_device(struct pci_dev *dev) | |||
1401 | struct hotplug_params hpp; | 1441 | struct hotplug_params hpp; |
1402 | int ret; | 1442 | int ret; |
1403 | 1443 | ||
1444 | pci_configure_mps(dev); | ||
1445 | |||
1404 | memset(&hpp, 0, sizeof(hpp)); | 1446 | memset(&hpp, 0, sizeof(hpp)); |
1405 | ret = pci_get_hp_params(dev, &hpp); | 1447 | ret = pci_get_hp_params(dev, &hpp); |
1406 | if (ret) | 1448 | if (ret) |
@@ -1545,6 +1587,9 @@ static void pci_init_capabilities(struct pci_dev *dev) | |||
1545 | /* Single Root I/O Virtualization */ | 1587 | /* Single Root I/O Virtualization */ |
1546 | pci_iov_init(dev); | 1588 | pci_iov_init(dev); |
1547 | 1589 | ||
1590 | /* Address Translation Services */ | ||
1591 | pci_ats_init(dev); | ||
1592 | |||
1548 | /* Enable ACS P2P upstream forwarding */ | 1593 | /* Enable ACS P2P upstream forwarding */ |
1549 | pci_enable_acs(dev); | 1594 | pci_enable_acs(dev); |
1550 | } | 1595 | } |
@@ -1796,22 +1841,6 @@ static void pcie_write_mrrs(struct pci_dev *dev) | |||
1796 | dev_err(&dev->dev, "MRRS was unable to be configured with a safe value. If problems are experienced, try running with pci=pcie_bus_safe\n"); | 1841 | dev_err(&dev->dev, "MRRS was unable to be configured with a safe value. If problems are experienced, try running with pci=pcie_bus_safe\n"); |
1797 | } | 1842 | } |
1798 | 1843 | ||
1799 | static void pcie_bus_detect_mps(struct pci_dev *dev) | ||
1800 | { | ||
1801 | struct pci_dev *bridge = dev->bus->self; | ||
1802 | int mps, p_mps; | ||
1803 | |||
1804 | if (!bridge) | ||
1805 | return; | ||
1806 | |||
1807 | mps = pcie_get_mps(dev); | ||
1808 | p_mps = pcie_get_mps(bridge); | ||
1809 | |||
1810 | if (mps != p_mps) | ||
1811 | dev_warn(&dev->dev, "Max Payload Size %d, but upstream %s set to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n", | ||
1812 | mps, pci_name(bridge), p_mps); | ||
1813 | } | ||
1814 | |||
1815 | static int pcie_bus_configure_set(struct pci_dev *dev, void *data) | 1844 | static int pcie_bus_configure_set(struct pci_dev *dev, void *data) |
1816 | { | 1845 | { |
1817 | int mps, orig_mps; | 1846 | int mps, orig_mps; |
@@ -1819,10 +1848,9 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data) | |||
1819 | if (!pci_is_pcie(dev)) | 1848 | if (!pci_is_pcie(dev)) |
1820 | return 0; | 1849 | return 0; |
1821 | 1850 | ||
1822 | if (pcie_bus_config == PCIE_BUS_TUNE_OFF) { | 1851 | if (pcie_bus_config == PCIE_BUS_TUNE_OFF || |
1823 | pcie_bus_detect_mps(dev); | 1852 | pcie_bus_config == PCIE_BUS_DEFAULT) |
1824 | return 0; | 1853 | return 0; |
1825 | } | ||
1826 | 1854 | ||
1827 | mps = 128 << *(u8 *)data; | 1855 | mps = 128 << *(u8 *)data; |
1828 | orig_mps = pcie_get_mps(dev); | 1856 | orig_mps = pcie_get_mps(dev); |
@@ -2101,8 +2129,9 @@ void pci_bus_release_busn_res(struct pci_bus *b) | |||
2101 | res, ret ? "can not be" : "is"); | 2129 | res, ret ? "can not be" : "is"); |
2102 | } | 2130 | } |
2103 | 2131 | ||
2104 | struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, | 2132 | struct pci_bus *pci_scan_root_bus_msi(struct device *parent, int bus, |
2105 | struct pci_ops *ops, void *sysdata, struct list_head *resources) | 2133 | struct pci_ops *ops, void *sysdata, |
2134 | struct list_head *resources, struct msi_controller *msi) | ||
2106 | { | 2135 | { |
2107 | struct resource_entry *window; | 2136 | struct resource_entry *window; |
2108 | bool found = false; | 2137 | bool found = false; |
@@ -2119,6 +2148,8 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, | |||
2119 | if (!b) | 2148 | if (!b) |
2120 | return NULL; | 2149 | return NULL; |
2121 | 2150 | ||
2151 | b->msi = msi; | ||
2152 | |||
2122 | if (!found) { | 2153 | if (!found) { |
2123 | dev_info(&b->dev, | 2154 | dev_info(&b->dev, |
2124 | "No busn resource found for root bus, will use [bus %02x-ff]\n", | 2155 | "No busn resource found for root bus, will use [bus %02x-ff]\n", |
@@ -2133,6 +2164,13 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, | |||
2133 | 2164 | ||
2134 | return b; | 2165 | return b; |
2135 | } | 2166 | } |
2167 | |||
2168 | struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, | ||
2169 | struct pci_ops *ops, void *sysdata, struct list_head *resources) | ||
2170 | { | ||
2171 | return pci_scan_root_bus_msi(parent, bus, ops, sysdata, resources, | ||
2172 | NULL); | ||
2173 | } | ||
2136 | EXPORT_SYMBOL(pci_scan_root_bus); | 2174 | EXPORT_SYMBOL(pci_scan_root_bus); |
2137 | 2175 | ||
2138 | struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, | 2176 | struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index e9fd0e90fa3b..de5f610e0810 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -163,7 +163,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82439TX, quirk_ | |||
163 | * VIA Apollo KT133 needs PCI latency patch | 163 | * VIA Apollo KT133 needs PCI latency patch |
164 | * Made according to a windows driver based patch by George E. Breese | 164 | * Made according to a windows driver based patch by George E. Breese |
165 | * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm | 165 | * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm |
166 | * and http://www.georgebreese.com/net/software/#PCI | ||
167 | * Also see http://www.au-ja.org/review-kt133a-1-en.phtml for | 166 | * Also see http://www.au-ja.org/review-kt133a-1-en.phtml for |
168 | * the info on which Mr Breese based his work. | 167 | * the info on which Mr Breese based his work. |
169 | * | 168 | * |
@@ -424,10 +423,12 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, quirk_ati_ | |||
424 | */ | 423 | */ |
425 | static void quirk_amd_nl_class(struct pci_dev *pdev) | 424 | static void quirk_amd_nl_class(struct pci_dev *pdev) |
426 | { | 425 | { |
427 | /* | 426 | u32 class = pdev->class; |
428 | * Use 'USB Device' (0x0c03fe) instead of PCI header provided | 427 | |
429 | */ | 428 | /* Use "USB Device (not host controller)" class */ |
430 | pdev->class = 0x0c03fe; | 429 | pdev->class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe; |
430 | dev_info(&pdev->dev, "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n", | ||
431 | class, pdev->class); | ||
431 | } | 432 | } |
432 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB, | 433 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB, |
433 | quirk_amd_nl_class); | 434 | quirk_amd_nl_class); |
@@ -1569,6 +1570,18 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB3 | |||
1569 | 1570 | ||
1570 | #endif | 1571 | #endif |
1571 | 1572 | ||
1573 | static void quirk_jmicron_async_suspend(struct pci_dev *dev) | ||
1574 | { | ||
1575 | if (dev->multifunction) { | ||
1576 | device_disable_async_suspend(&dev->dev); | ||
1577 | dev_info(&dev->dev, "async suspend disabled to avoid multi-function power-on ordering issue\n"); | ||
1578 | } | ||
1579 | } | ||
1580 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE, 8, quirk_jmicron_async_suspend); | ||
1581 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0, quirk_jmicron_async_suspend); | ||
1582 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_JMICRON, 0x2362, quirk_jmicron_async_suspend); | ||
1583 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_JMICRON, 0x236f, quirk_jmicron_async_suspend); | ||
1584 | |||
1572 | #ifdef CONFIG_X86_IO_APIC | 1585 | #ifdef CONFIG_X86_IO_APIC |
1573 | static void quirk_alder_ioapic(struct pci_dev *pdev) | 1586 | static void quirk_alder_ioapic(struct pci_dev *pdev) |
1574 | { | 1587 | { |
@@ -1894,6 +1907,15 @@ static void quirk_netmos(struct pci_dev *dev) | |||
1894 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, | 1907 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, |
1895 | PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos); | 1908 | PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos); |
1896 | 1909 | ||
1910 | static void quirk_f0_vpd_link(struct pci_dev *dev) | ||
1911 | { | ||
1912 | if (!dev->multifunction || !PCI_FUNC(dev->devfn)) | ||
1913 | return; | ||
1914 | dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0; | ||
1915 | } | ||
1916 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, | ||
1917 | PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link); | ||
1918 | |||
1897 | static void quirk_e100_interrupt(struct pci_dev *dev) | 1919 | static void quirk_e100_interrupt(struct pci_dev *dev) |
1898 | { | 1920 | { |
1899 | u16 command, pmcsr; | 1921 | u16 command, pmcsr; |
@@ -1986,14 +2008,18 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s); | |||
1986 | 2008 | ||
1987 | static void fixup_rev1_53c810(struct pci_dev *dev) | 2009 | static void fixup_rev1_53c810(struct pci_dev *dev) |
1988 | { | 2010 | { |
1989 | /* rev 1 ncr53c810 chips don't set the class at all which means | 2011 | u32 class = dev->class; |
2012 | |||
2013 | /* | ||
2014 | * rev 1 ncr53c810 chips don't set the class at all which means | ||
1990 | * they don't get their resources remapped. Fix that here. | 2015 | * they don't get their resources remapped. Fix that here. |
1991 | */ | 2016 | */ |
2017 | if (class) | ||
2018 | return; | ||
1992 | 2019 | ||
1993 | if (dev->class == PCI_CLASS_NOT_DEFINED) { | 2020 | dev->class = PCI_CLASS_STORAGE_SCSI << 8; |
1994 | dev_info(&dev->dev, "NCR 53c810 rev 1 detected; setting PCI class\n"); | 2021 | dev_info(&dev->dev, "NCR 53c810 rev 1 PCI class overridden (%#08x -> %#08x)\n", |
1995 | dev->class = PCI_CLASS_STORAGE_SCSI; | 2022 | class, dev->class); |
1996 | } | ||
1997 | } | 2023 | } |
1998 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); | 2024 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); |
1999 | 2025 | ||
@@ -2241,7 +2267,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x9601, quirk_amd_780_apc_msi); | |||
2241 | * return 1 if a HT MSI capability is found and enabled */ | 2267 | * return 1 if a HT MSI capability is found and enabled */ |
2242 | static int msi_ht_cap_enabled(struct pci_dev *dev) | 2268 | static int msi_ht_cap_enabled(struct pci_dev *dev) |
2243 | { | 2269 | { |
2244 | int pos, ttl = 48; | 2270 | int pos, ttl = PCI_FIND_CAP_TTL; |
2245 | 2271 | ||
2246 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | 2272 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); |
2247 | while (pos && ttl--) { | 2273 | while (pos && ttl--) { |
@@ -2300,7 +2326,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | |||
2300 | /* Force enable MSI mapping capability on HT bridges */ | 2326 | /* Force enable MSI mapping capability on HT bridges */ |
2301 | static void ht_enable_msi_mapping(struct pci_dev *dev) | 2327 | static void ht_enable_msi_mapping(struct pci_dev *dev) |
2302 | { | 2328 | { |
2303 | int pos, ttl = 48; | 2329 | int pos, ttl = PCI_FIND_CAP_TTL; |
2304 | 2330 | ||
2305 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | 2331 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); |
2306 | while (pos && ttl--) { | 2332 | while (pos && ttl--) { |
@@ -2379,7 +2405,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, | |||
2379 | 2405 | ||
2380 | static int ht_check_msi_mapping(struct pci_dev *dev) | 2406 | static int ht_check_msi_mapping(struct pci_dev *dev) |
2381 | { | 2407 | { |
2382 | int pos, ttl = 48; | 2408 | int pos, ttl = PCI_FIND_CAP_TTL; |
2383 | int found = 0; | 2409 | int found = 0; |
2384 | 2410 | ||
2385 | /* check if there is HT MSI cap or enabled on this device */ | 2411 | /* check if there is HT MSI cap or enabled on this device */ |
@@ -2504,7 +2530,7 @@ out: | |||
2504 | 2530 | ||
2505 | static void ht_disable_msi_mapping(struct pci_dev *dev) | 2531 | static void ht_disable_msi_mapping(struct pci_dev *dev) |
2506 | { | 2532 | { |
2507 | int pos, ttl = 48; | 2533 | int pos, ttl = PCI_FIND_CAP_TTL; |
2508 | 2534 | ||
2509 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | 2535 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); |
2510 | while (pos && ttl--) { | 2536 | while (pos && ttl--) { |
@@ -2829,12 +2855,15 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors); | |||
2829 | 2855 | ||
2830 | static void fixup_ti816x_class(struct pci_dev *dev) | 2856 | static void fixup_ti816x_class(struct pci_dev *dev) |
2831 | { | 2857 | { |
2858 | u32 class = dev->class; | ||
2859 | |||
2832 | /* TI 816x devices do not have class code set when in PCIe boot mode */ | 2860 | /* TI 816x devices do not have class code set when in PCIe boot mode */ |
2833 | dev_info(&dev->dev, "Setting PCI class for 816x PCIe device\n"); | 2861 | dev->class = PCI_CLASS_MULTIMEDIA_VIDEO << 8; |
2834 | dev->class = PCI_CLASS_MULTIMEDIA_VIDEO; | 2862 | dev_info(&dev->dev, "PCI class overridden (%#08x -> %#08x)\n", |
2863 | class, dev->class); | ||
2835 | } | 2864 | } |
2836 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_TI, 0xb800, | 2865 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_TI, 0xb800, |
2837 | PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class); | 2866 | PCI_CLASS_NOT_DEFINED, 8, fixup_ti816x_class); |
2838 | 2867 | ||
2839 | /* Some PCIe devices do not work reliably with the claimed maximum | 2868 | /* Some PCIe devices do not work reliably with the claimed maximum |
2840 | * payload size supported. | 2869 | * payload size supported. |
@@ -2862,7 +2891,8 @@ static void quirk_intel_mc_errata(struct pci_dev *dev) | |||
2862 | int err; | 2891 | int err; |
2863 | u16 rcc; | 2892 | u16 rcc; |
2864 | 2893 | ||
2865 | if (pcie_bus_config == PCIE_BUS_TUNE_OFF) | 2894 | if (pcie_bus_config == PCIE_BUS_TUNE_OFF || |
2895 | pcie_bus_config == PCIE_BUS_DEFAULT) | ||
2866 | return; | 2896 | return; |
2867 | 2897 | ||
2868 | /* Intel errata specifies bits to change but does not say what they are. | 2898 | /* Intel errata specifies bits to change but does not say what they are. |
@@ -3028,7 +3058,16 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c26, quirk_remove_d3_delay); | |||
3028 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c4e, quirk_remove_d3_delay); | 3058 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c4e, quirk_remove_d3_delay); |
3029 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c02, quirk_remove_d3_delay); | 3059 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c02, quirk_remove_d3_delay); |
3030 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c22, quirk_remove_d3_delay); | 3060 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c22, quirk_remove_d3_delay); |
3031 | 3061 | /* Intel Cherrytrail devices do not need 10ms d3_delay */ | |
3062 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2280, quirk_remove_d3_delay); | ||
3063 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b0, quirk_remove_d3_delay); | ||
3064 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b8, quirk_remove_d3_delay); | ||
3065 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22d8, quirk_remove_d3_delay); | ||
3066 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22dc, quirk_remove_d3_delay); | ||
3067 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b5, quirk_remove_d3_delay); | ||
3068 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b7, quirk_remove_d3_delay); | ||
3069 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2298, quirk_remove_d3_delay); | ||
3070 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x229c, quirk_remove_d3_delay); | ||
3032 | /* | 3071 | /* |
3033 | * Some devices may pass our check in pci_intx_mask_supported if | 3072 | * Some devices may pass our check in pci_intx_mask_supported if |
3034 | * PCI_COMMAND_INTX_DISABLE works though they actually do not properly | 3073 | * PCI_COMMAND_INTX_DISABLE works though they actually do not properly |
@@ -3326,28 +3365,6 @@ fs_initcall_sync(pci_apply_final_quirks); | |||
3326 | * reset a single function if other methods (e.g. FLR, PM D0->D3) are | 3365 | * reset a single function if other methods (e.g. FLR, PM D0->D3) are |
3327 | * not available. | 3366 | * not available. |
3328 | */ | 3367 | */ |
3329 | static int reset_intel_generic_dev(struct pci_dev *dev, int probe) | ||
3330 | { | ||
3331 | int pos; | ||
3332 | |||
3333 | /* only implement PCI_CLASS_SERIAL_USB at present */ | ||
3334 | if (dev->class == PCI_CLASS_SERIAL_USB) { | ||
3335 | pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); | ||
3336 | if (!pos) | ||
3337 | return -ENOTTY; | ||
3338 | |||
3339 | if (probe) | ||
3340 | return 0; | ||
3341 | |||
3342 | pci_write_config_byte(dev, pos + 0x4, 1); | ||
3343 | msleep(100); | ||
3344 | |||
3345 | return 0; | ||
3346 | } else { | ||
3347 | return -ENOTTY; | ||
3348 | } | ||
3349 | } | ||
3350 | |||
3351 | static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe) | 3368 | static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe) |
3352 | { | 3369 | { |
3353 | /* | 3370 | /* |
@@ -3506,8 +3523,6 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { | |||
3506 | reset_ivb_igd }, | 3523 | reset_ivb_igd }, |
3507 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_M2_VGA, | 3524 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_M2_VGA, |
3508 | reset_ivb_igd }, | 3525 | reset_ivb_igd }, |
3509 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, | ||
3510 | reset_intel_generic_dev }, | ||
3511 | { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID, | 3526 | { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID, |
3512 | reset_chelsio_generic_dev }, | 3527 | reset_chelsio_generic_dev }, |
3513 | { 0 } | 3528 | { 0 } |
@@ -3655,6 +3670,28 @@ DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias); | |||
3655 | DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias); | 3670 | DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias); |
3656 | 3671 | ||
3657 | /* | 3672 | /* |
3673 | * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero) | ||
3674 | * class code. Fix it. | ||
3675 | */ | ||
3676 | static void quirk_tw686x_class(struct pci_dev *pdev) | ||
3677 | { | ||
3678 | u32 class = pdev->class; | ||
3679 | |||
3680 | /* Use "Multimedia controller" class */ | ||
3681 | pdev->class = (PCI_CLASS_MULTIMEDIA_OTHER << 8) | 0x01; | ||
3682 | dev_info(&pdev->dev, "TW686x PCI class overridden (%#08x -> %#08x)\n", | ||
3683 | class, pdev->class); | ||
3684 | } | ||
3685 | DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6864, PCI_CLASS_NOT_DEFINED, 8, | ||
3686 | quirk_tw686x_class); | ||
3687 | DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6865, PCI_CLASS_NOT_DEFINED, 8, | ||
3688 | quirk_tw686x_class); | ||
3689 | DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6868, PCI_CLASS_NOT_DEFINED, 8, | ||
3690 | quirk_tw686x_class); | ||
3691 | DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6869, PCI_CLASS_NOT_DEFINED, 8, | ||
3692 | quirk_tw686x_class); | ||
3693 | |||
3694 | /* | ||
3658 | * AMD has indicated that the devices below do not support peer-to-peer | 3695 | * AMD has indicated that the devices below do not support peer-to-peer |
3659 | * in any system where they are found in the southbridge with an AMD | 3696 | * in any system where they are found in the southbridge with an AMD |
3660 | * IOMMU in the system. Multifunction devices that do not support | 3697 | * IOMMU in the system. Multifunction devices that do not support |
@@ -3848,6 +3885,9 @@ static const struct pci_dev_acs_enabled { | |||
3848 | { PCI_VENDOR_ID_INTEL, 0x105F, pci_quirk_mf_endpoint_acs }, | 3885 | { PCI_VENDOR_ID_INTEL, 0x105F, pci_quirk_mf_endpoint_acs }, |
3849 | { PCI_VENDOR_ID_INTEL, 0x1060, pci_quirk_mf_endpoint_acs }, | 3886 | { PCI_VENDOR_ID_INTEL, 0x1060, pci_quirk_mf_endpoint_acs }, |
3850 | { PCI_VENDOR_ID_INTEL, 0x10D9, pci_quirk_mf_endpoint_acs }, | 3887 | { PCI_VENDOR_ID_INTEL, 0x10D9, pci_quirk_mf_endpoint_acs }, |
3888 | /* I219 */ | ||
3889 | { PCI_VENDOR_ID_INTEL, 0x15b7, pci_quirk_mf_endpoint_acs }, | ||
3890 | { PCI_VENDOR_ID_INTEL, 0x15b8, pci_quirk_mf_endpoint_acs }, | ||
3851 | /* Intel PCH root ports */ | 3891 | /* Intel PCH root ports */ |
3852 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs }, | 3892 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs }, |
3853 | { 0x19a2, 0x710, pci_quirk_mf_endpoint_acs }, /* Emulex BE3-R */ | 3893 | { 0x19a2, 0x710, pci_quirk_mf_endpoint_acs }, /* Emulex BE3-R */ |
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index 396c200b9ddb..429d34c348b9 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | struct kset *pci_slots_kset; | 15 | struct kset *pci_slots_kset; |
16 | EXPORT_SYMBOL_GPL(pci_slots_kset); | 16 | EXPORT_SYMBOL_GPL(pci_slots_kset); |
17 | static DEFINE_MUTEX(pci_slot_mutex); | ||
17 | 18 | ||
18 | static ssize_t pci_slot_attr_show(struct kobject *kobj, | 19 | static ssize_t pci_slot_attr_show(struct kobject *kobj, |
19 | struct attribute *attr, char *buf) | 20 | struct attribute *attr, char *buf) |
@@ -106,9 +107,11 @@ static void pci_slot_release(struct kobject *kobj) | |||
106 | dev_dbg(&slot->bus->dev, "dev %02x, released physical slot %s\n", | 107 | dev_dbg(&slot->bus->dev, "dev %02x, released physical slot %s\n", |
107 | slot->number, pci_slot_name(slot)); | 108 | slot->number, pci_slot_name(slot)); |
108 | 109 | ||
110 | down_read(&pci_bus_sem); | ||
109 | list_for_each_entry(dev, &slot->bus->devices, bus_list) | 111 | list_for_each_entry(dev, &slot->bus->devices, bus_list) |
110 | if (PCI_SLOT(dev->devfn) == slot->number) | 112 | if (PCI_SLOT(dev->devfn) == slot->number) |
111 | dev->slot = NULL; | 113 | dev->slot = NULL; |
114 | up_read(&pci_bus_sem); | ||
112 | 115 | ||
113 | list_del(&slot->list); | 116 | list_del(&slot->list); |
114 | 117 | ||
@@ -191,12 +194,22 @@ static int rename_slot(struct pci_slot *slot, const char *name) | |||
191 | return result; | 194 | return result; |
192 | } | 195 | } |
193 | 196 | ||
197 | void pci_dev_assign_slot(struct pci_dev *dev) | ||
198 | { | ||
199 | struct pci_slot *slot; | ||
200 | |||
201 | mutex_lock(&pci_slot_mutex); | ||
202 | list_for_each_entry(slot, &dev->bus->slots, list) | ||
203 | if (PCI_SLOT(dev->devfn) == slot->number) | ||
204 | dev->slot = slot; | ||
205 | mutex_unlock(&pci_slot_mutex); | ||
206 | } | ||
207 | |||
194 | static struct pci_slot *get_slot(struct pci_bus *parent, int slot_nr) | 208 | static struct pci_slot *get_slot(struct pci_bus *parent, int slot_nr) |
195 | { | 209 | { |
196 | struct pci_slot *slot; | 210 | struct pci_slot *slot; |
197 | /* | 211 | |
198 | * We already hold pci_bus_sem so don't worry | 212 | /* We already hold pci_slot_mutex */ |
199 | */ | ||
200 | list_for_each_entry(slot, &parent->slots, list) | 213 | list_for_each_entry(slot, &parent->slots, list) |
201 | if (slot->number == slot_nr) { | 214 | if (slot->number == slot_nr) { |
202 | kobject_get(&slot->kobj); | 215 | kobject_get(&slot->kobj); |
@@ -253,7 +266,7 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | |||
253 | int err = 0; | 266 | int err = 0; |
254 | char *slot_name = NULL; | 267 | char *slot_name = NULL; |
255 | 268 | ||
256 | down_write(&pci_bus_sem); | 269 | mutex_lock(&pci_slot_mutex); |
257 | 270 | ||
258 | if (slot_nr == -1) | 271 | if (slot_nr == -1) |
259 | goto placeholder; | 272 | goto placeholder; |
@@ -301,16 +314,18 @@ placeholder: | |||
301 | INIT_LIST_HEAD(&slot->list); | 314 | INIT_LIST_HEAD(&slot->list); |
302 | list_add(&slot->list, &parent->slots); | 315 | list_add(&slot->list, &parent->slots); |
303 | 316 | ||
317 | down_read(&pci_bus_sem); | ||
304 | list_for_each_entry(dev, &parent->devices, bus_list) | 318 | list_for_each_entry(dev, &parent->devices, bus_list) |
305 | if (PCI_SLOT(dev->devfn) == slot_nr) | 319 | if (PCI_SLOT(dev->devfn) == slot_nr) |
306 | dev->slot = slot; | 320 | dev->slot = slot; |
321 | up_read(&pci_bus_sem); | ||
307 | 322 | ||
308 | dev_dbg(&parent->dev, "dev %02x, created physical slot %s\n", | 323 | dev_dbg(&parent->dev, "dev %02x, created physical slot %s\n", |
309 | slot_nr, pci_slot_name(slot)); | 324 | slot_nr, pci_slot_name(slot)); |
310 | 325 | ||
311 | out: | 326 | out: |
312 | kfree(slot_name); | 327 | kfree(slot_name); |
313 | up_write(&pci_bus_sem); | 328 | mutex_unlock(&pci_slot_mutex); |
314 | return slot; | 329 | return slot; |
315 | err: | 330 | err: |
316 | kfree(slot); | 331 | kfree(slot); |
@@ -332,9 +347,9 @@ void pci_destroy_slot(struct pci_slot *slot) | |||
332 | dev_dbg(&slot->bus->dev, "dev %02x, dec refcount to %d\n", | 347 | dev_dbg(&slot->bus->dev, "dev %02x, dec refcount to %d\n", |
333 | slot->number, atomic_read(&slot->kobj.kref.refcount) - 1); | 348 | slot->number, atomic_read(&slot->kobj.kref.refcount) - 1); |
334 | 349 | ||
335 | down_write(&pci_bus_sem); | 350 | mutex_lock(&pci_slot_mutex); |
336 | kobject_put(&slot->kobj); | 351 | kobject_put(&slot->kobj); |
337 | up_write(&pci_bus_sem); | 352 | mutex_unlock(&pci_slot_mutex); |
338 | } | 353 | } |
339 | EXPORT_SYMBOL_GPL(pci_destroy_slot); | 354 | EXPORT_SYMBOL_GPL(pci_destroy_slot); |
340 | 355 | ||
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h index 72031785fe1d..57e0b8250947 100644 --- a/include/linux/pci-ats.h +++ b/include/linux/pci-ats.h | |||
@@ -3,55 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
5 | 5 | ||
6 | /* Address Translation Service */ | ||
7 | struct pci_ats { | ||
8 | int pos; /* capability position */ | ||
9 | int stu; /* Smallest Translation Unit */ | ||
10 | int qdep; /* Invalidate Queue Depth */ | ||
11 | int ref_cnt; /* Physical Function reference count */ | ||
12 | unsigned int is_enabled:1; /* Enable bit is set */ | ||
13 | }; | ||
14 | |||
15 | #ifdef CONFIG_PCI_ATS | ||
16 | |||
17 | int pci_enable_ats(struct pci_dev *dev, int ps); | ||
18 | void pci_disable_ats(struct pci_dev *dev); | ||
19 | int pci_ats_queue_depth(struct pci_dev *dev); | ||
20 | |||
21 | /** | ||
22 | * pci_ats_enabled - query the ATS status | ||
23 | * @dev: the PCI device | ||
24 | * | ||
25 | * Returns 1 if ATS capability is enabled, or 0 if not. | ||
26 | */ | ||
27 | static inline int pci_ats_enabled(struct pci_dev *dev) | ||
28 | { | ||
29 | return dev->ats && dev->ats->is_enabled; | ||
30 | } | ||
31 | |||
32 | #else /* CONFIG_PCI_ATS */ | ||
33 | |||
34 | static inline int pci_enable_ats(struct pci_dev *dev, int ps) | ||
35 | { | ||
36 | return -ENODEV; | ||
37 | } | ||
38 | |||
39 | static inline void pci_disable_ats(struct pci_dev *dev) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | static inline int pci_ats_queue_depth(struct pci_dev *dev) | ||
44 | { | ||
45 | return -ENODEV; | ||
46 | } | ||
47 | |||
48 | static inline int pci_ats_enabled(struct pci_dev *dev) | ||
49 | { | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | #endif /* CONFIG_PCI_ATS */ | ||
54 | |||
55 | #ifdef CONFIG_PCI_PRI | 6 | #ifdef CONFIG_PCI_PRI |
56 | 7 | ||
57 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); | 8 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 860c751810fc..3c8eb57de620 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -180,6 +180,8 @@ enum pci_dev_flags { | |||
180 | PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6), | 180 | PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6), |
181 | /* Do not use PM reset even if device advertises NoSoftRst- */ | 181 | /* Do not use PM reset even if device advertises NoSoftRst- */ |
182 | PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), | 182 | PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), |
183 | /* Get VPD from function 0 VPD */ | ||
184 | PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), | ||
183 | }; | 185 | }; |
184 | 186 | ||
185 | enum pci_irq_reroute_variant { | 187 | enum pci_irq_reroute_variant { |
@@ -343,6 +345,7 @@ struct pci_dev { | |||
343 | unsigned int msi_enabled:1; | 345 | unsigned int msi_enabled:1; |
344 | unsigned int msix_enabled:1; | 346 | unsigned int msix_enabled:1; |
345 | unsigned int ari_enabled:1; /* ARI forwarding */ | 347 | unsigned int ari_enabled:1; /* ARI forwarding */ |
348 | unsigned int ats_enabled:1; /* Address Translation Service */ | ||
346 | unsigned int is_managed:1; | 349 | unsigned int is_managed:1; |
347 | unsigned int needs_freset:1; /* Dev requires fundamental reset */ | 350 | unsigned int needs_freset:1; /* Dev requires fundamental reset */ |
348 | unsigned int state_saved:1; | 351 | unsigned int state_saved:1; |
@@ -375,7 +378,9 @@ struct pci_dev { | |||
375 | struct pci_sriov *sriov; /* SR-IOV capability related */ | 378 | struct pci_sriov *sriov; /* SR-IOV capability related */ |
376 | struct pci_dev *physfn; /* the PF this VF is associated with */ | 379 | struct pci_dev *physfn; /* the PF this VF is associated with */ |
377 | }; | 380 | }; |
378 | struct pci_ats *ats; /* Address Translation Service */ | 381 | u16 ats_cap; /* ATS Capability offset */ |
382 | u8 ats_stu; /* ATS Smallest Translation Unit */ | ||
383 | atomic_t ats_ref_cnt; /* number of VFs with ATS enabled */ | ||
379 | #endif | 384 | #endif |
380 | phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ | 385 | phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ |
381 | size_t romlen; /* Length of ROM if it's not from the BAR */ | 386 | size_t romlen; /* Length of ROM if it's not from the BAR */ |
@@ -446,7 +451,8 @@ struct pci_bus { | |||
446 | struct list_head children; /* list of child buses */ | 451 | struct list_head children; /* list of child buses */ |
447 | struct list_head devices; /* list of devices on this bus */ | 452 | struct list_head devices; /* list of devices on this bus */ |
448 | struct pci_dev *self; /* bridge device as seen by parent */ | 453 | struct pci_dev *self; /* bridge device as seen by parent */ |
449 | struct list_head slots; /* list of slots on this bus */ | 454 | struct list_head slots; /* list of slots on this bus; |
455 | protected by pci_slot_mutex */ | ||
450 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; | 456 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; |
451 | struct list_head resources; /* address space routed to this bus */ | 457 | struct list_head resources; /* address space routed to this bus */ |
452 | struct resource busn_res; /* bus numbers routed to this bus */ | 458 | struct resource busn_res; /* bus numbers routed to this bus */ |
@@ -738,10 +744,11 @@ struct pci_driver { | |||
738 | void pcie_bus_configure_settings(struct pci_bus *bus); | 744 | void pcie_bus_configure_settings(struct pci_bus *bus); |
739 | 745 | ||
740 | enum pcie_bus_config_types { | 746 | enum pcie_bus_config_types { |
741 | PCIE_BUS_TUNE_OFF, | 747 | PCIE_BUS_TUNE_OFF, /* don't touch MPS at all */ |
742 | PCIE_BUS_SAFE, | 748 | PCIE_BUS_DEFAULT, /* ensure MPS matches upstream bridge */ |
743 | PCIE_BUS_PERFORMANCE, | 749 | PCIE_BUS_SAFE, /* use largest MPS boot-time devices support */ |
744 | PCIE_BUS_PEER2PEER, | 750 | PCIE_BUS_PERFORMANCE, /* use MPS and MRRS for best performance */ |
751 | PCIE_BUS_PEER2PEER, /* set MPS = 128 for all devices */ | ||
745 | }; | 752 | }; |
746 | 753 | ||
747 | extern enum pcie_bus_config_types pcie_bus_config; | 754 | extern enum pcie_bus_config_types pcie_bus_config; |
@@ -787,6 +794,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, | |||
787 | int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); | 794 | int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); |
788 | int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); | 795 | int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); |
789 | void pci_bus_release_busn_res(struct pci_bus *b); | 796 | void pci_bus_release_busn_res(struct pci_bus *b); |
797 | struct pci_bus *pci_scan_root_bus_msi(struct device *parent, int bus, | ||
798 | struct pci_ops *ops, void *sysdata, | ||
799 | struct list_head *resources, | ||
800 | struct msi_controller *msi); | ||
790 | struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, | 801 | struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, |
791 | struct pci_ops *ops, void *sysdata, | 802 | struct pci_ops *ops, void *sysdata, |
792 | struct list_head *resources); | 803 | struct list_head *resources); |
@@ -797,6 +808,11 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | |||
797 | const char *name, | 808 | const char *name, |
798 | struct hotplug_slot *hotplug); | 809 | struct hotplug_slot *hotplug); |
799 | void pci_destroy_slot(struct pci_slot *slot); | 810 | void pci_destroy_slot(struct pci_slot *slot); |
811 | #ifdef CONFIG_SYSFS | ||
812 | void pci_dev_assign_slot(struct pci_dev *dev); | ||
813 | #else | ||
814 | static inline void pci_dev_assign_slot(struct pci_dev *dev) { } | ||
815 | #endif | ||
800 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 816 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
801 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 817 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
802 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 818 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
@@ -963,6 +979,23 @@ static inline int pci_is_managed(struct pci_dev *pdev) | |||
963 | return pdev->is_managed; | 979 | return pdev->is_managed; |
964 | } | 980 | } |
965 | 981 | ||
982 | static inline void pci_set_managed_irq(struct pci_dev *pdev, unsigned int irq) | ||
983 | { | ||
984 | pdev->irq = irq; | ||
985 | pdev->irq_managed = 1; | ||
986 | } | ||
987 | |||
988 | static inline void pci_reset_managed_irq(struct pci_dev *pdev) | ||
989 | { | ||
990 | pdev->irq = 0; | ||
991 | pdev->irq_managed = 0; | ||
992 | } | ||
993 | |||
994 | static inline bool pci_has_managed_irq(struct pci_dev *pdev) | ||
995 | { | ||
996 | return pdev->irq_managed && pdev->irq > 0; | ||
997 | } | ||
998 | |||
966 | void pci_disable_device(struct pci_dev *dev); | 999 | void pci_disable_device(struct pci_dev *dev); |
967 | 1000 | ||
968 | extern unsigned int pcibios_max_latency; | 1001 | extern unsigned int pcibios_max_latency; |
@@ -1295,6 +1328,19 @@ int ht_create_irq(struct pci_dev *dev, int idx); | |||
1295 | void ht_destroy_irq(unsigned int irq); | 1328 | void ht_destroy_irq(unsigned int irq); |
1296 | #endif /* CONFIG_HT_IRQ */ | 1329 | #endif /* CONFIG_HT_IRQ */ |
1297 | 1330 | ||
1331 | #ifdef CONFIG_PCI_ATS | ||
1332 | /* Address Translation Service */ | ||
1333 | void pci_ats_init(struct pci_dev *dev); | ||
1334 | int pci_enable_ats(struct pci_dev *dev, int ps); | ||
1335 | void pci_disable_ats(struct pci_dev *dev); | ||
1336 | int pci_ats_queue_depth(struct pci_dev *dev); | ||
1337 | #else | ||
1338 | static inline void pci_ats_init(struct pci_dev *d) { } | ||
1339 | static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; } | ||
1340 | static inline void pci_disable_ats(struct pci_dev *d) { } | ||
1341 | static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; } | ||
1342 | #endif | ||
1343 | |||
1298 | void pci_cfg_access_lock(struct pci_dev *dev); | 1344 | void pci_cfg_access_lock(struct pci_dev *dev); |
1299 | bool pci_cfg_access_trylock(struct pci_dev *dev); | 1345 | bool pci_cfg_access_trylock(struct pci_dev *dev); |
1300 | void pci_cfg_access_unlock(struct pci_dev *dev); | 1346 | void pci_cfg_access_unlock(struct pci_dev *dev); |
@@ -1646,6 +1692,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, | |||
1646 | int pcibios_add_device(struct pci_dev *dev); | 1692 | int pcibios_add_device(struct pci_dev *dev); |
1647 | void pcibios_release_device(struct pci_dev *dev); | 1693 | void pcibios_release_device(struct pci_dev *dev); |
1648 | void pcibios_penalize_isa_irq(int irq, int active); | 1694 | void pcibios_penalize_isa_irq(int irq, int active); |
1695 | int pcibios_alloc_irq(struct pci_dev *dev); | ||
1696 | void pcibios_free_irq(struct pci_dev *dev); | ||
1649 | 1697 | ||
1650 | #ifdef CONFIG_HIBERNATE_CALLBACKS | 1698 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
1651 | extern struct dev_pm_ops pcibios_pm_ops; | 1699 | extern struct dev_pm_ops pcibios_pm_ops; |