diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-12 16:20:24 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-12 16:20:24 -0400 |
| commit | 7550cfab3d4053b54f16e2fe337affde71d1eb51 (patch) | |
| tree | dcbd567925a92ceec1174b91f50653bf914a89c7 | |
| parent | 19c1940feab777bb037c665a09f495d08a6c4e6c (diff) | |
| parent | 38a6148248e199a4a960bbaa6b8eb14f138b73e1 (diff) | |
Merge tag 'pci-v3.16-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull more PCI updates from Bjorn Helgaas:
"Here are some more things I'd like to see in v3.16-rc1:
- DMA alias iterator, part of some work to fix IOMMU issues
- MVEBU, Tegra, DesignWare changes that I forgot to include before
- Some whitespace code cleanup
Details:
IOMMU
- Add DMA alias iterator (Alex Williamson)
- Add DMA alias quirks for ASMedia, ITE, Tundra bridges (Alex Williamson)
- Add DMA alias quirks for Marvell, Ricoh devices (Alex Williamson)
- Add DMA alias quirk for HighPoint devices (Jérôme Carretero)
MSI
- Fix leak in free_msi_irqs() (Alexei Starovoitov)
Marvell MVEBU
- Remove unnecessary use of 'conf_lock' spinlock (Andrew Murray)
- Avoid setting an undefined window size (Jason Gunthorpe)
- Allow several windows with the same target/attribute (Thomas Petazzoni)
- Split PCIe BARs into multiple MBus windows when needed (Thomas Petazzoni)
- Fix off-by-one in the computed size of the mbus windows (Willy Tarreau)
NVIDIA Tegra
- Use new OF interrupt mapping when possible (Lucas Stach)
Synopsys DesignWare
- Remove unnecessary use of 'conf_lock' spinlock (Andrew Murray)
- Use new OF interrupt mapping when possible (Lucas Stach)
- Split Exynos and i.MX bindings (Lucas Stach)
- Fix comment for setting number of lanes (Mohit Kumar)
- Fix iATU programming for cfg1, io and mem viewport (Mohit Kumar)
Miscellaneous
- EXPORT_SYMBOL cleanup (Ryan Desfosses)
- Whitespace cleanup (Ryan Desfosses)
- Merge multi-line quoted strings (Ryan Desfosses)"
* tag 'pci-v3.16-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (21 commits)
PCI: Add function 1 DMA alias quirk for HighPoint RocketRaid 642L
PCI/MSI: Fix memory leak in free_msi_irqs()
PCI: Merge multi-line quoted strings
PCI: Whitespace cleanup
PCI: Move EXPORT_SYMBOL so it immediately follows function/variable
PCI: Add bridge DMA alias quirk for ITE bridge
PCI: designware: Split Exynos and i.MX bindings
PCI: Add bridge DMA alias quirk for ASMedia and Tundra bridges
PCI: Add support for PCIe-to-PCI bridge DMA alias quirks
PCI: Add function 1 DMA alias quirk for Marvell devices
PCI: Add function 0 DMA alias quirk for Ricoh devices
PCI: Add support for DMA alias quirks
PCI: Convert pci_dev_flags definitions to bit shifts
PCI: Add DMA alias iterator
PCI: mvebu: Use '%pa' for printing 'phys_addr_t' type
PCI: mvebu: Remove unnecessary use of 'conf_lock' spinlock
PCI: designware: Remove unnecessary use of 'conf_lock' spinlock
PCI: designware: Use new OF interrupt mapping when possible
PCI: designware: Fix iATU programming for cfg1, io and mem viewport
PCI: designware: Fix comment for setting number of lanes
...
66 files changed, 1065 insertions, 1039 deletions
diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt index d6fae13ff062..d0d15ee42834 100644 --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt | |||
| @@ -1,15 +1,7 @@ | |||
| 1 | * Synopsys Designware PCIe interface | 1 | * Synopsys Designware PCIe interface |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: should contain "snps,dw-pcie" to identify the | 4 | - compatible: should contain "snps,dw-pcie" to identify the core. |
| 5 | core, plus an identifier for the specific instance, such | ||
| 6 | as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". | ||
| 7 | - reg: base addresses and lengths of the pcie controller, | ||
| 8 | the phy controller, additional register for the phy controller. | ||
| 9 | - interrupts: interrupt values for level interrupt, | ||
| 10 | pulse interrupt, special interrupt. | ||
| 11 | - clocks: from common clock binding: handle to pci clock. | ||
| 12 | - clock-names: from common clock binding: should be "pcie" and "pcie_bus". | ||
| 13 | - #address-cells: set to <3> | 5 | - #address-cells: set to <3> |
| 14 | - #size-cells: set to <2> | 6 | - #size-cells: set to <2> |
| 15 | - device_type: set to "pci" | 7 | - device_type: set to "pci" |
| @@ -19,65 +11,11 @@ Required properties: | |||
| 19 | to define the mapping of the PCIe interface to interrupt | 11 | to define the mapping of the PCIe interface to interrupt |
| 20 | numbers. | 12 | numbers. |
| 21 | - num-lanes: number of lanes to use | 13 | - num-lanes: number of lanes to use |
| 14 | - clocks: Must contain an entry for each entry in clock-names. | ||
| 15 | See ../clocks/clock-bindings.txt for details. | ||
| 16 | - clock-names: Must include the following entries: | ||
| 17 | - "pcie" | ||
| 18 | - "pcie_bus" | ||
| 22 | 19 | ||
| 23 | Optional properties: | 20 | Optional properties: |
| 24 | - reset-gpio: gpio pin number of power good signal | 21 | - reset-gpio: gpio pin number of power good signal |
| 25 | |||
| 26 | Optional properties for fsl,imx6q-pcie | ||
| 27 | - power-on-gpio: gpio pin number of power-enable signal | ||
| 28 | - wake-up-gpio: gpio pin number of incoming wakeup signal | ||
| 29 | - disable-gpio: gpio pin number of outgoing rfkill/endpoint disable signal | ||
| 30 | |||
| 31 | Example: | ||
| 32 | |||
| 33 | SoC specific DT Entry: | ||
| 34 | |||
| 35 | pcie@290000 { | ||
| 36 | compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; | ||
| 37 | reg = <0x290000 0x1000 | ||
| 38 | 0x270000 0x1000 | ||
| 39 | 0x271000 0x40>; | ||
| 40 | interrupts = <0 20 0>, <0 21 0>, <0 22 0>; | ||
| 41 | clocks = <&clock 28>, <&clock 27>; | ||
| 42 | clock-names = "pcie", "pcie_bus"; | ||
| 43 | #address-cells = <3>; | ||
| 44 | #size-cells = <2>; | ||
| 45 | device_type = "pci"; | ||
| 46 | ranges = <0x00000800 0 0x40000000 0x40000000 0 0x00001000 /* configuration space */ | ||
| 47 | 0x81000000 0 0 0x40001000 0 0x00010000 /* downstream I/O */ | ||
| 48 | 0x82000000 0 0x40011000 0x40011000 0 0x1ffef000>; /* non-prefetchable memory */ | ||
| 49 | #interrupt-cells = <1>; | ||
| 50 | interrupt-map-mask = <0 0 0 0>; | ||
| 51 | interrupt-map = <0x0 0 &gic 53>; | ||
| 52 | num-lanes = <4>; | ||
| 53 | }; | ||
| 54 | |||
| 55 | pcie@2a0000 { | ||
| 56 | compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; | ||
| 57 | reg = <0x2a0000 0x1000 | ||
| 58 | 0x272000 0x1000 | ||
| 59 | 0x271040 0x40>; | ||
| 60 | interrupts = <0 23 0>, <0 24 0>, <0 25 0>; | ||
| 61 | clocks = <&clock 29>, <&clock 27>; | ||
| 62 | clock-names = "pcie", "pcie_bus"; | ||
| 63 | #address-cells = <3>; | ||
| 64 | #size-cells = <2>; | ||
| 65 | device_type = "pci"; | ||
| 66 | ranges = <0x00000800 0 0x60000000 0x60000000 0 0x00001000 /* configuration space */ | ||
| 67 | 0x81000000 0 0 0x60001000 0 0x00010000 /* downstream I/O */ | ||
| 68 | 0x82000000 0 0x60011000 0x60011000 0 0x1ffef000>; /* non-prefetchable memory */ | ||
| 69 | #interrupt-cells = <1>; | ||
| 70 | interrupt-map-mask = <0 0 0 0>; | ||
| 71 | interrupt-map = <0x0 0 &gic 56>; | ||
| 72 | num-lanes = <4>; | ||
| 73 | }; | ||
| 74 | |||
| 75 | Board specific DT Entry: | ||
| 76 | |||
| 77 | pcie@290000 { | ||
| 78 | reset-gpio = <&pin_ctrl 5 0>; | ||
| 79 | }; | ||
| 80 | |||
| 81 | pcie@2a0000 { | ||
| 82 | reset-gpio = <&pin_ctrl 22 0>; | ||
| 83 | }; | ||
diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt new file mode 100644 index 000000000000..9455fd0ec830 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | * Freescale i.MX6 PCIe interface | ||
| 2 | |||
| 3 | This PCIe host controller is based on the Synopsis Designware PCIe IP | ||
| 4 | and thus inherits all the common properties defined in designware-pcie.txt. | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | - compatible: "fsl,imx6q-pcie" | ||
| 8 | - reg: base addresse and length of the pcie controller | ||
| 9 | - interrupts: A list of interrupt outputs of the controller. Must contain an | ||
| 10 | entry for each entry in the interrupt-names property. | ||
| 11 | - interrupt-names: Must include the following entries: | ||
| 12 | - "msi": The interrupt that is asserted when an MSI is received | ||
| 13 | - clock-names: Must include the following additional entries: | ||
| 14 | - "pcie_phy" | ||
| 15 | |||
| 16 | Example: | ||
| 17 | |||
| 18 | pcie@0x01000000 { | ||
| 19 | compatible = "fsl,imx6q-pcie", "snps,dw-pcie"; | ||
| 20 | reg = <0x01ffc000 0x4000>; | ||
| 21 | #address-cells = <3>; | ||
| 22 | #size-cells = <2>; | ||
| 23 | device_type = "pci"; | ||
| 24 | ranges = <0x00000800 0 0x01f00000 0x01f00000 0 0x00080000 | ||
| 25 | 0x81000000 0 0 0x01f80000 0 0x00010000 | ||
| 26 | 0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; | ||
| 27 | num-lanes = <1>; | ||
| 28 | interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; | ||
| 29 | interrupt-names = "msi"; | ||
| 30 | #interrupt-cells = <1>; | ||
| 31 | interrupt-map-mask = <0 0 0 0x7>; | ||
| 32 | interrupt-map = <0 0 0 1 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, | ||
| 33 | <0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, | ||
| 34 | <0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, | ||
| 35 | <0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; | ||
| 36 | clocks = <&clks 144>, <&clks 206>, <&clks 189>; | ||
| 37 | clock-names = "pcie", "pcie_bus", "pcie_phy"; | ||
| 38 | }; | ||
diff --git a/Documentation/devicetree/bindings/pci/samsung,exynos5440-pcie.txt b/Documentation/devicetree/bindings/pci/samsung,exynos5440-pcie.txt new file mode 100644 index 000000000000..4f9d23d2ed67 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/samsung,exynos5440-pcie.txt | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | * Samsung Exynos 5440 PCIe interface | ||
| 2 | |||
| 3 | This PCIe host controller is based on the Synopsis Designware PCIe IP | ||
| 4 | and thus inherits all the common properties defined in designware-pcie.txt. | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | - compatible: "samsung,exynos5440-pcie" | ||
| 8 | - reg: base addresses and lengths of the pcie controller, | ||
| 9 | the phy controller, additional register for the phy controller. | ||
| 10 | - interrupts: A list of interrupt outputs for level interrupt, | ||
| 11 | pulse interrupt, special interrupt. | ||
| 12 | |||
| 13 | Example: | ||
| 14 | |||
| 15 | SoC specific DT Entry: | ||
| 16 | |||
| 17 | pcie@290000 { | ||
| 18 | compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; | ||
| 19 | reg = <0x290000 0x1000 | ||
| 20 | 0x270000 0x1000 | ||
| 21 | 0x271000 0x40>; | ||
| 22 | interrupts = <0 20 0>, <0 21 0>, <0 22 0>; | ||
| 23 | clocks = <&clock 28>, <&clock 27>; | ||
| 24 | clock-names = "pcie", "pcie_bus"; | ||
| 25 | #address-cells = <3>; | ||
| 26 | #size-cells = <2>; | ||
| 27 | device_type = "pci"; | ||
| 28 | ranges = <0x00000800 0 0x40000000 0x40000000 0 0x00001000 /* configuration space */ | ||
| 29 | 0x81000000 0 0 0x40001000 0 0x00010000 /* downstream I/O */ | ||
| 30 | 0x82000000 0 0x40011000 0x40011000 0 0x1ffef000>; /* non-prefetchable memory */ | ||
| 31 | #interrupt-cells = <1>; | ||
| 32 | interrupt-map-mask = <0 0 0 0>; | ||
| 33 | interrupt-map = <0 0 0 0 &gic GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; | ||
| 34 | num-lanes = <4>; | ||
| 35 | }; | ||
| 36 | |||
| 37 | pcie@2a0000 { | ||
| 38 | compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; | ||
| 39 | reg = <0x2a0000 0x1000 | ||
| 40 | 0x272000 0x1000 | ||
| 41 | 0x271040 0x40>; | ||
| 42 | interrupts = <0 23 0>, <0 24 0>, <0 25 0>; | ||
| 43 | clocks = <&clock 29>, <&clock 27>; | ||
| 44 | clock-names = "pcie", "pcie_bus"; | ||
| 45 | #address-cells = <3>; | ||
| 46 | #size-cells = <2>; | ||
| 47 | device_type = "pci"; | ||
| 48 | ranges = <0x00000800 0 0x60000000 0x60000000 0 0x00001000 /* configuration space */ | ||
| 49 | 0x81000000 0 0 0x60001000 0 0x00010000 /* downstream I/O */ | ||
| 50 | 0x82000000 0 0x60011000 0x60011000 0 0x1ffef000>; /* non-prefetchable memory */ | ||
| 51 | #interrupt-cells = <1>; | ||
| 52 | interrupt-map-mask = <0 0 0 0>; | ||
| 53 | interrupt-map = <0 0 0 0 &gic GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; | ||
| 54 | num-lanes = <4>; | ||
| 55 | }; | ||
| 56 | |||
| 57 | Board specific DT Entry: | ||
| 58 | |||
| 59 | pcie@290000 { | ||
| 60 | reset-gpio = <&pin_ctrl 5 0>; | ||
| 61 | }; | ||
| 62 | |||
| 63 | pcie@2a0000 { | ||
| 64 | reset-gpio = <&pin_ctrl 22 0>; | ||
| 65 | }; | ||
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 8c148f39e8d7..d292d7cb3417 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
| @@ -231,10 +231,7 @@ static int pci_vpd_pci22_wait(struct pci_dev *dev) | |||
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | if (time_after(jiffies, timeout)) { | 233 | if (time_after(jiffies, timeout)) { |
| 234 | dev_printk(KERN_DEBUG, &dev->dev, | 234 | dev_printk(KERN_DEBUG, &dev->dev, "vpd r/w failed. This is likely a firmware bug on this device. Contact the card vendor for a firmware update\n"); |
| 235 | "vpd r/w failed. This is likely a firmware " | ||
| 236 | "bug on this device. Contact the card " | ||
| 237 | "vendor for a firmware update."); | ||
| 238 | return -ETIMEDOUT; | 235 | return -ETIMEDOUT; |
| 239 | } | 236 | } |
| 240 | if (fatal_signal_pending(current)) | 237 | if (fatal_signal_pending(current)) |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 447d393725e1..73aef51a28f0 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
| @@ -226,6 +226,7 @@ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
| 226 | type_mask, alignf, alignf_data, | 226 | type_mask, alignf, alignf_data, |
| 227 | &pci_32_bit); | 227 | &pci_32_bit); |
| 228 | } | 228 | } |
| 229 | EXPORT_SYMBOL(pci_bus_alloc_resource); | ||
| 229 | 230 | ||
| 230 | void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } | 231 | void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } |
| 231 | 232 | ||
| @@ -253,6 +254,7 @@ void pci_bus_add_device(struct pci_dev *dev) | |||
| 253 | 254 | ||
| 254 | dev->is_added = 1; | 255 | dev->is_added = 1; |
| 255 | } | 256 | } |
| 257 | EXPORT_SYMBOL_GPL(pci_bus_add_device); | ||
| 256 | 258 | ||
| 257 | /** | 259 | /** |
| 258 | * pci_bus_add_devices - start driver for PCI devices | 260 | * pci_bus_add_devices - start driver for PCI devices |
| @@ -279,6 +281,7 @@ void pci_bus_add_devices(const struct pci_bus *bus) | |||
| 279 | pci_bus_add_devices(child); | 281 | pci_bus_add_devices(child); |
| 280 | } | 282 | } |
| 281 | } | 283 | } |
| 284 | EXPORT_SYMBOL(pci_bus_add_devices); | ||
| 282 | 285 | ||
| 283 | /** pci_walk_bus - walk devices on/under bus, calling callback. | 286 | /** pci_walk_bus - walk devices on/under bus, calling callback. |
| 284 | * @top bus whose devices should be walked | 287 | * @top bus whose devices should be walked |
| @@ -344,6 +347,3 @@ void pci_bus_put(struct pci_bus *bus) | |||
| 344 | } | 347 | } |
| 345 | EXPORT_SYMBOL(pci_bus_put); | 348 | EXPORT_SYMBOL(pci_bus_put); |
| 346 | 349 | ||
| 347 | EXPORT_SYMBOL(pci_bus_alloc_resource); | ||
| 348 | EXPORT_SYMBOL_GPL(pci_bus_add_device); | ||
| 349 | EXPORT_SYMBOL(pci_bus_add_devices); | ||
diff --git a/drivers/pci/host/pci-exynos.c b/drivers/pci/host/pci-exynos.c index 1632661c5b7f..c5d0ca384502 100644 --- a/drivers/pci/host/pci-exynos.c +++ b/drivers/pci/host/pci-exynos.c | |||
| @@ -545,7 +545,6 @@ static int __init add_pcie_port(struct pcie_port *pp, | |||
| 545 | pp->root_bus_nr = -1; | 545 | pp->root_bus_nr = -1; |
| 546 | pp->ops = &exynos_pcie_host_ops; | 546 | pp->ops = &exynos_pcie_host_ops; |
| 547 | 547 | ||
| 548 | spin_lock_init(&pp->conf_lock); | ||
| 549 | ret = dw_pcie_host_init(pp); | 548 | ret = dw_pcie_host_init(pp); |
| 550 | if (ret) { | 549 | if (ret) { |
| 551 | dev_err(&pdev->dev, "failed to initialize host\n"); | 550 | dev_err(&pdev->dev, "failed to initialize host\n"); |
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index a5645ae4aef0..a568efaa331c 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
| @@ -507,7 +507,6 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp, | |||
| 507 | pp->root_bus_nr = -1; | 507 | pp->root_bus_nr = -1; |
| 508 | pp->ops = &imx6_pcie_host_ops; | 508 | pp->ops = &imx6_pcie_host_ops; |
| 509 | 509 | ||
| 510 | spin_lock_init(&pp->conf_lock); | ||
| 511 | ret = dw_pcie_host_init(pp); | 510 | ret = dw_pcie_host_init(pp); |
| 512 | if (ret) { | 511 | if (ret) { |
| 513 | dev_err(&pdev->dev, "failed to initialize host\n"); | 512 | dev_err(&pdev->dev, "failed to initialize host\n"); |
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index e384e2534594..ce23e0f076b6 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
| @@ -113,7 +113,6 @@ struct mvebu_pcie { | |||
| 113 | struct mvebu_pcie_port { | 113 | struct mvebu_pcie_port { |
| 114 | char *name; | 114 | char *name; |
| 115 | void __iomem *base; | 115 | void __iomem *base; |
| 116 | spinlock_t conf_lock; | ||
| 117 | u32 port; | 116 | u32 port; |
| 118 | u32 lane; | 117 | u32 lane; |
| 119 | int devfn; | 118 | int devfn; |
| @@ -329,9 +328,11 @@ static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port, | |||
| 329 | ret = mvebu_mbus_add_window_remap_by_id(target, attribute, base, | 328 | ret = mvebu_mbus_add_window_remap_by_id(target, attribute, base, |
| 330 | sz, remap); | 329 | sz, remap); |
| 331 | if (ret) { | 330 | if (ret) { |
| 331 | phys_addr_t end = base + sz - 1; | ||
| 332 | |||
| 332 | dev_err(&port->pcie->pdev->dev, | 333 | dev_err(&port->pcie->pdev->dev, |
| 333 | "Could not create MBus window at 0x%x, size 0x%x: %d\n", | 334 | "Could not create MBus window at [mem %pa-%pa]: %d\n", |
| 334 | base, sz, ret); | 335 | &base, &end, ret); |
| 335 | mvebu_pcie_del_windows(port, base - size_mapped, | 336 | mvebu_pcie_del_windows(port, base - size_mapped, |
| 336 | size_mapped); | 337 | size_mapped); |
| 337 | return; | 338 | return; |
| @@ -613,9 +614,9 @@ static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys) | |||
| 613 | return sys->private_data; | 614 | return sys->private_data; |
| 614 | } | 615 | } |
| 615 | 616 | ||
| 616 | static struct mvebu_pcie_port * | 617 | static struct mvebu_pcie_port *mvebu_pcie_find_port(struct mvebu_pcie *pcie, |
| 617 | mvebu_pcie_find_port(struct mvebu_pcie *pcie, struct pci_bus *bus, | 618 | struct pci_bus *bus, |
| 618 | int devfn) | 619 | int devfn) |
| 619 | { | 620 | { |
| 620 | int i; | 621 | int i; |
| 621 | 622 | ||
| @@ -638,7 +639,6 @@ static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | |||
| 638 | { | 639 | { |
| 639 | struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata); | 640 | struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata); |
| 640 | struct mvebu_pcie_port *port; | 641 | struct mvebu_pcie_port *port; |
| 641 | unsigned long flags; | ||
| 642 | int ret; | 642 | int ret; |
| 643 | 643 | ||
| 644 | port = mvebu_pcie_find_port(pcie, bus, devfn); | 644 | port = mvebu_pcie_find_port(pcie, bus, devfn); |
| @@ -664,10 +664,8 @@ static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | |||
| 664 | return PCIBIOS_DEVICE_NOT_FOUND; | 664 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 665 | 665 | ||
| 666 | /* Access the real PCIe interface */ | 666 | /* Access the real PCIe interface */ |
| 667 | spin_lock_irqsave(&port->conf_lock, flags); | ||
| 668 | ret = mvebu_pcie_hw_wr_conf(port, bus, devfn, | 667 | ret = mvebu_pcie_hw_wr_conf(port, bus, devfn, |
| 669 | where, size, val); | 668 | where, size, val); |
| 670 | spin_unlock_irqrestore(&port->conf_lock, flags); | ||
| 671 | 669 | ||
| 672 | return ret; | 670 | return ret; |
| 673 | } | 671 | } |
| @@ -678,7 +676,6 @@ static int mvebu_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | |||
| 678 | { | 676 | { |
| 679 | struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata); | 677 | struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata); |
| 680 | struct mvebu_pcie_port *port; | 678 | struct mvebu_pcie_port *port; |
| 681 | unsigned long flags; | ||
| 682 | int ret; | 679 | int ret; |
| 683 | 680 | ||
| 684 | port = mvebu_pcie_find_port(pcie, bus, devfn); | 681 | port = mvebu_pcie_find_port(pcie, bus, devfn); |
| @@ -710,10 +707,8 @@ static int mvebu_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | |||
| 710 | } | 707 | } |
| 711 | 708 | ||
| 712 | /* Access the real PCIe interface */ | 709 | /* Access the real PCIe interface */ |
| 713 | spin_lock_irqsave(&port->conf_lock, flags); | ||
| 714 | ret = mvebu_pcie_hw_rd_conf(port, bus, devfn, | 710 | ret = mvebu_pcie_hw_rd_conf(port, bus, devfn, |
| 715 | where, size, val); | 711 | where, size, val); |
| 716 | spin_unlock_irqrestore(&port->conf_lock, flags); | ||
| 717 | 712 | ||
| 718 | return ret; | 713 | return ret; |
| 719 | } | 714 | } |
| @@ -786,10 +781,10 @@ static void mvebu_pcie_add_bus(struct pci_bus *bus) | |||
| 786 | } | 781 | } |
| 787 | 782 | ||
| 788 | static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev, | 783 | static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev, |
| 789 | const struct resource *res, | 784 | const struct resource *res, |
| 790 | resource_size_t start, | 785 | resource_size_t start, |
| 791 | resource_size_t size, | 786 | resource_size_t size, |
| 792 | resource_size_t align) | 787 | resource_size_t align) |
| 793 | { | 788 | { |
| 794 | if (dev->bus->number != 0) | 789 | if (dev->bus->number != 0) |
| 795 | return start; | 790 | return start; |
| @@ -839,7 +834,8 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie) | |||
| 839 | * found, maps it. | 834 | * found, maps it. |
| 840 | */ | 835 | */ |
| 841 | static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev, | 836 | static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev, |
| 842 | struct device_node *np, struct mvebu_pcie_port *port) | 837 | struct device_node *np, |
| 838 | struct mvebu_pcie_port *port) | ||
| 843 | { | 839 | { |
| 844 | struct resource regs; | 840 | struct resource regs; |
| 845 | int ret = 0; | 841 | int ret = 0; |
| @@ -1060,7 +1056,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev) | |||
| 1060 | mvebu_pcie_set_local_dev_nr(port, 1); | 1056 | mvebu_pcie_set_local_dev_nr(port, 1); |
| 1061 | 1057 | ||
| 1062 | port->dn = child; | 1058 | port->dn = child; |
| 1063 | spin_lock_init(&port->conf_lock); | ||
| 1064 | mvebu_sw_pci_bridge_init(port); | 1059 | mvebu_sw_pci_bridge_init(port); |
| 1065 | i++; | 1060 | i++; |
| 1066 | } | 1061 | } |
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index e3bf9e6d5d9a..1eaf4df3618a 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
| @@ -643,7 +643,6 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | |||
| 643 | int size, u32 *val) | 643 | int size, u32 *val) |
| 644 | { | 644 | { |
| 645 | struct pcie_port *pp = sys_to_pcie(bus->sysdata); | 645 | struct pcie_port *pp = sys_to_pcie(bus->sysdata); |
| 646 | unsigned long flags; | ||
| 647 | int ret; | 646 | int ret; |
| 648 | 647 | ||
| 649 | if (!pp) { | 648 | if (!pp) { |
| @@ -656,13 +655,11 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | |||
| 656 | return PCIBIOS_DEVICE_NOT_FOUND; | 655 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 657 | } | 656 | } |
| 658 | 657 | ||
| 659 | spin_lock_irqsave(&pp->conf_lock, flags); | ||
| 660 | if (bus->number != pp->root_bus_nr) | 658 | if (bus->number != pp->root_bus_nr) |
| 661 | ret = dw_pcie_rd_other_conf(pp, bus, devfn, | 659 | ret = dw_pcie_rd_other_conf(pp, bus, devfn, |
| 662 | where, size, val); | 660 | where, size, val); |
| 663 | else | 661 | else |
| 664 | ret = dw_pcie_rd_own_conf(pp, where, size, val); | 662 | ret = dw_pcie_rd_own_conf(pp, where, size, val); |
| 665 | spin_unlock_irqrestore(&pp->conf_lock, flags); | ||
| 666 | 663 | ||
| 667 | return ret; | 664 | return ret; |
| 668 | } | 665 | } |
| @@ -671,7 +668,6 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | |||
| 671 | int where, int size, u32 val) | 668 | int where, int size, u32 val) |
| 672 | { | 669 | { |
| 673 | struct pcie_port *pp = sys_to_pcie(bus->sysdata); | 670 | struct pcie_port *pp = sys_to_pcie(bus->sysdata); |
| 674 | unsigned long flags; | ||
| 675 | int ret; | 671 | int ret; |
| 676 | 672 | ||
| 677 | if (!pp) { | 673 | if (!pp) { |
| @@ -682,13 +678,11 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | |||
| 682 | if (dw_pcie_valid_config(pp, bus, PCI_SLOT(devfn)) == 0) | 678 | if (dw_pcie_valid_config(pp, bus, PCI_SLOT(devfn)) == 0) |
| 683 | return PCIBIOS_DEVICE_NOT_FOUND; | 679 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 684 | 680 | ||
| 685 | spin_lock_irqsave(&pp->conf_lock, flags); | ||
| 686 | if (bus->number != pp->root_bus_nr) | 681 | if (bus->number != pp->root_bus_nr) |
| 687 | ret = dw_pcie_wr_other_conf(pp, bus, devfn, | 682 | ret = dw_pcie_wr_other_conf(pp, bus, devfn, |
| 688 | where, size, val); | 683 | where, size, val); |
| 689 | else | 684 | else |
| 690 | ret = dw_pcie_wr_own_conf(pp, where, size, val); | 685 | ret = dw_pcie_wr_own_conf(pp, where, size, val); |
| 691 | spin_unlock_irqrestore(&pp->conf_lock, flags); | ||
| 692 | 686 | ||
| 693 | return ret; | 687 | return ret; |
| 694 | } | 688 | } |
diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index a169d22d517e..77f592faa7bf 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h | |||
| @@ -41,7 +41,6 @@ struct pcie_port { | |||
| 41 | void __iomem *va_cfg1_base; | 41 | void __iomem *va_cfg1_base; |
| 42 | u64 io_base; | 42 | u64 io_base; |
| 43 | u64 mem_base; | 43 | u64 mem_base; |
| 44 | spinlock_t conf_lock; | ||
| 45 | struct resource cfg; | 44 | struct resource cfg; |
| 46 | struct resource io; | 45 | struct resource io; |
| 47 | struct resource mem; | 46 | struct resource mem; |
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 8e06124aa80f..f7d3de32c9a0 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c | |||
| @@ -277,9 +277,8 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, | |||
| 277 | else if (size == 2) | 277 | else if (size == 2) |
| 278 | *val = (*val >> (8 * (where & 2))) & 0xffff; | 278 | *val = (*val >> (8 * (where & 2))) & 0xffff; |
| 279 | 279 | ||
| 280 | dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x " | 280 | dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n", |
| 281 | "where=0x%04x size=%d val=0x%08lx\n", bus->number, | 281 | bus->number, devfn, where, size, (unsigned long)*val); |
| 282 | devfn, where, size, (unsigned long)*val); | ||
| 283 | 282 | ||
| 284 | return ret; | 283 | return ret; |
| 285 | } | 284 | } |
| @@ -302,9 +301,8 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn, | |||
| 302 | if (ret != PCIBIOS_SUCCESSFUL) | 301 | if (ret != PCIBIOS_SUCCESSFUL) |
| 303 | return ret; | 302 | return ret; |
| 304 | 303 | ||
| 305 | dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x " | 304 | dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n", |
| 306 | "where=0x%04x size=%d val=0x%08lx\n", bus->number, | 305 | bus->number, devfn, where, size, (unsigned long)val); |
| 307 | devfn, where, size, (unsigned long)val); | ||
| 308 | 306 | ||
| 309 | if (size == 1) { | 307 | if (size == 1) { |
| 310 | shift = 8 * (where & 3); | 308 | shift = 8 * (where & 3); |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index 728c31f4c2c5..e291efcd02a2 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
| @@ -63,10 +63,6 @@ MODULE_LICENSE("GPL"); | |||
| 63 | MODULE_PARM_DESC(disable, "disable acpiphp driver"); | 63 | MODULE_PARM_DESC(disable, "disable acpiphp driver"); |
| 64 | module_param_named(disable, acpiphp_disabled, bool, 0444); | 64 | module_param_named(disable, acpiphp_disabled, bool, 0444); |
| 65 | 65 | ||
| 66 | /* export the attention callback registration methods */ | ||
| 67 | EXPORT_SYMBOL_GPL(acpiphp_register_attention); | ||
| 68 | EXPORT_SYMBOL_GPL(acpiphp_unregister_attention); | ||
| 69 | |||
| 70 | static int enable_slot (struct hotplug_slot *slot); | 66 | static int enable_slot (struct hotplug_slot *slot); |
| 71 | static int disable_slot (struct hotplug_slot *slot); | 67 | static int disable_slot (struct hotplug_slot *slot); |
| 72 | static int set_attention_status (struct hotplug_slot *slot, u8 value); | 68 | static int set_attention_status (struct hotplug_slot *slot, u8 value); |
| @@ -104,6 +100,7 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info) | |||
| 104 | } | 100 | } |
| 105 | return retval; | 101 | return retval; |
| 106 | } | 102 | } |
| 103 | EXPORT_SYMBOL_GPL(acpiphp_register_attention); | ||
| 107 | 104 | ||
| 108 | 105 | ||
| 109 | /** | 106 | /** |
| @@ -124,6 +121,7 @@ int acpiphp_unregister_attention(struct acpiphp_attention_info *info) | |||
| 124 | } | 121 | } |
| 125 | return retval; | 122 | return retval; |
| 126 | } | 123 | } |
| 124 | EXPORT_SYMBOL_GPL(acpiphp_unregister_attention); | ||
| 127 | 125 | ||
| 128 | 126 | ||
| 129 | /** | 127 | /** |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 91aa3d780138..602d153c7055 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
| @@ -351,11 +351,9 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data, | |||
| 351 | slot->slot = NULL; | 351 | slot->slot = NULL; |
| 352 | bridge->nr_slots--; | 352 | bridge->nr_slots--; |
| 353 | if (retval == -EBUSY) | 353 | if (retval == -EBUSY) |
| 354 | pr_warn("Slot %llu already registered by another " | 354 | pr_warn("Slot %llu already registered by another hotplug driver\n", sun); |
| 355 | "hotplug driver\n", sun); | ||
| 356 | else | 355 | else |
| 357 | pr_warn("acpiphp_register_hotplug_slot failed " | 356 | pr_warn("acpiphp_register_hotplug_slot failed (err code = 0x%x)\n", retval); |
| 358 | "(err code = 0x%x)\n", retval); | ||
| 359 | } | 357 | } |
| 360 | /* Even if the slot registration fails, we can still use it. */ | 358 | /* Even if the slot registration fails, we can still use it. */ |
| 361 | } | 359 | } |
diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h index 1356211431d0..6a0ddf757349 100644 --- a/drivers/pci/hotplug/cpci_hotplug.h +++ b/drivers/pci/hotplug/cpci_hotplug.h | |||
| @@ -56,9 +56,9 @@ struct cpci_hp_controller_ops { | |||
| 56 | int (*enable_irq) (void); | 56 | int (*enable_irq) (void); |
| 57 | int (*disable_irq) (void); | 57 | int (*disable_irq) (void); |
| 58 | int (*check_irq) (void *dev_id); | 58 | int (*check_irq) (void *dev_id); |
| 59 | int (*hardware_test) (struct slot* slot, u32 value); | 59 | int (*hardware_test) (struct slot *slot, u32 value); |
| 60 | u8 (*get_power) (struct slot* slot); | 60 | u8 (*get_power) (struct slot *slot); |
| 61 | int (*set_power) (struct slot* slot, int value); | 61 | int (*set_power) (struct slot *slot, int value); |
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | struct cpci_hp_controller { | 64 | struct cpci_hp_controller { |
| @@ -89,13 +89,13 @@ int cpci_hp_stop(void); | |||
| 89 | u8 cpci_get_attention_status(struct slot *slot); | 89 | u8 cpci_get_attention_status(struct slot *slot); |
| 90 | u8 cpci_get_latch_status(struct slot *slot); | 90 | u8 cpci_get_latch_status(struct slot *slot); |
| 91 | u8 cpci_get_adapter_status(struct slot *slot); | 91 | u8 cpci_get_adapter_status(struct slot *slot); |
| 92 | u16 cpci_get_hs_csr(struct slot * slot); | 92 | u16 cpci_get_hs_csr(struct slot *slot); |
| 93 | int cpci_set_attention_status(struct slot *slot, int status); | 93 | int cpci_set_attention_status(struct slot *slot, int status); |
| 94 | int cpci_check_and_clear_ins(struct slot * slot); | 94 | int cpci_check_and_clear_ins(struct slot *slot); |
| 95 | int cpci_check_ext(struct slot * slot); | 95 | int cpci_check_ext(struct slot *slot); |
| 96 | int cpci_clear_ext(struct slot * slot); | 96 | int cpci_clear_ext(struct slot *slot); |
| 97 | int cpci_led_on(struct slot * slot); | 97 | int cpci_led_on(struct slot *slot); |
| 98 | int cpci_led_off(struct slot * slot); | 98 | int cpci_led_off(struct slot *slot); |
| 99 | int cpci_configure_slot(struct slot *slot); | 99 | int cpci_configure_slot(struct slot *slot); |
| 100 | int cpci_unconfigure_slot(struct slot *slot); | 100 | int cpci_unconfigure_slot(struct slot *slot); |
| 101 | 101 | ||
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 00c81a3cefc9..e09cf7827d68 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c | |||
| @@ -65,10 +65,10 @@ static int thread_finished; | |||
| 65 | static int enable_slot(struct hotplug_slot *slot); | 65 | static int enable_slot(struct hotplug_slot *slot); |
| 66 | static int disable_slot(struct hotplug_slot *slot); | 66 | static int disable_slot(struct hotplug_slot *slot); |
| 67 | static int set_attention_status(struct hotplug_slot *slot, u8 value); | 67 | static int set_attention_status(struct hotplug_slot *slot, u8 value); |
| 68 | static int get_power_status(struct hotplug_slot *slot, u8 * value); | 68 | static int get_power_status(struct hotplug_slot *slot, u8 *value); |
| 69 | static int get_attention_status(struct hotplug_slot *slot, u8 * value); | 69 | static int get_attention_status(struct hotplug_slot *slot, u8 *value); |
| 70 | static int get_adapter_status(struct hotplug_slot *slot, u8 * value); | 70 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
| 71 | static int get_latch_status(struct hotplug_slot *slot, u8 * value); | 71 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
| 72 | 72 | ||
| 73 | static struct hotplug_slot_ops cpci_hotplug_slot_ops = { | 73 | static struct hotplug_slot_ops cpci_hotplug_slot_ops = { |
| 74 | .enable_slot = enable_slot, | 74 | .enable_slot = enable_slot, |
| @@ -168,7 +168,7 @@ cpci_get_power_status(struct slot *slot) | |||
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | static int | 170 | static int |
| 171 | get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | 171 | get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 172 | { | 172 | { |
| 173 | struct slot *slot = hotplug_slot->private; | 173 | struct slot *slot = hotplug_slot->private; |
| 174 | 174 | ||
| @@ -177,7 +177,7 @@ get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | |||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static int | 179 | static int |
| 180 | get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) | 180 | get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 181 | { | 181 | { |
| 182 | struct slot *slot = hotplug_slot->private; | 182 | struct slot *slot = hotplug_slot->private; |
| 183 | 183 | ||
| @@ -192,14 +192,14 @@ set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | |||
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static int | 194 | static int |
| 195 | get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) | 195 | get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 196 | { | 196 | { |
| 197 | *value = hotplug_slot->info->adapter_status; | 197 | *value = hotplug_slot->info->adapter_status; |
| 198 | return 0; | 198 | return 0; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | static int | 201 | static int |
| 202 | get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value) | 202 | get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 203 | { | 203 | { |
| 204 | *value = hotplug_slot->info->latch_status; | 204 | *value = hotplug_slot->info->latch_status; |
| 205 | return 0; | 205 | return 0; |
| @@ -299,6 +299,7 @@ error_slot: | |||
| 299 | error: | 299 | error: |
| 300 | return status; | 300 | return status; |
| 301 | } | 301 | } |
| 302 | EXPORT_SYMBOL_GPL(cpci_hp_register_bus); | ||
| 302 | 303 | ||
| 303 | int | 304 | int |
| 304 | cpci_hp_unregister_bus(struct pci_bus *bus) | 305 | cpci_hp_unregister_bus(struct pci_bus *bus) |
| @@ -329,6 +330,7 @@ cpci_hp_unregister_bus(struct pci_bus *bus) | |||
| 329 | up_write(&list_rwsem); | 330 | up_write(&list_rwsem); |
| 330 | return status; | 331 | return status; |
| 331 | } | 332 | } |
| 333 | EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus); | ||
| 332 | 334 | ||
| 333 | /* This is the interrupt mode interrupt handler */ | 335 | /* This is the interrupt mode interrupt handler */ |
| 334 | static irqreturn_t | 336 | static irqreturn_t |
| @@ -360,7 +362,7 @@ static int | |||
| 360 | init_slots(int clear_ins) | 362 | init_slots(int clear_ins) |
| 361 | { | 363 | { |
| 362 | struct slot *slot; | 364 | struct slot *slot; |
| 363 | struct pci_dev* dev; | 365 | struct pci_dev *dev; |
| 364 | 366 | ||
| 365 | dbg("%s - enter", __func__); | 367 | dbg("%s - enter", __func__); |
| 366 | down_read(&list_rwsem); | 368 | down_read(&list_rwsem); |
| @@ -614,6 +616,7 @@ cpci_hp_register_controller(struct cpci_hp_controller *new_controller) | |||
| 614 | controller = new_controller; | 616 | controller = new_controller; |
| 615 | return status; | 617 | return status; |
| 616 | } | 618 | } |
| 619 | EXPORT_SYMBOL_GPL(cpci_hp_register_controller); | ||
| 617 | 620 | ||
| 618 | static void | 621 | static void |
| 619 | cleanup_slots(void) | 622 | cleanup_slots(void) |
| @@ -653,6 +656,7 @@ cpci_hp_unregister_controller(struct cpci_hp_controller *old_controller) | |||
| 653 | status = -ENODEV; | 656 | status = -ENODEV; |
| 654 | return status; | 657 | return status; |
| 655 | } | 658 | } |
| 659 | EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller); | ||
| 656 | 660 | ||
| 657 | int | 661 | int |
| 658 | cpci_hp_start(void) | 662 | cpci_hp_start(void) |
| @@ -690,6 +694,7 @@ cpci_hp_start(void) | |||
| 690 | dbg("%s - exit", __func__); | 694 | dbg("%s - exit", __func__); |
| 691 | return 0; | 695 | return 0; |
| 692 | } | 696 | } |
| 697 | EXPORT_SYMBOL_GPL(cpci_hp_start); | ||
| 693 | 698 | ||
| 694 | int | 699 | int |
| 695 | cpci_hp_stop(void) | 700 | cpci_hp_stop(void) |
| @@ -704,6 +709,7 @@ cpci_hp_stop(void) | |||
| 704 | cpci_stop_thread(); | 709 | cpci_stop_thread(); |
| 705 | return 0; | 710 | return 0; |
| 706 | } | 711 | } |
| 712 | EXPORT_SYMBOL_GPL(cpci_hp_stop); | ||
| 707 | 713 | ||
| 708 | int __init | 714 | int __init |
| 709 | cpci_hotplug_init(int debug) | 715 | cpci_hotplug_init(int debug) |
| @@ -721,10 +727,3 @@ cpci_hotplug_exit(void) | |||
| 721 | cpci_hp_stop(); | 727 | cpci_hp_stop(); |
| 722 | cpci_hp_unregister_controller(controller); | 728 | cpci_hp_unregister_controller(controller); |
| 723 | } | 729 | } |
| 724 | |||
| 725 | EXPORT_SYMBOL_GPL(cpci_hp_register_controller); | ||
| 726 | EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller); | ||
| 727 | EXPORT_SYMBOL_GPL(cpci_hp_register_bus); | ||
| 728 | EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus); | ||
| 729 | EXPORT_SYMBOL_GPL(cpci_hp_start); | ||
| 730 | EXPORT_SYMBOL_GPL(cpci_hp_stop); | ||
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index f6ef64c2ccb5..7d48ecae6695 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c | |||
| @@ -46,7 +46,7 @@ extern int cpci_debug; | |||
| 46 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) | 46 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | u8 cpci_get_attention_status(struct slot* slot) | 49 | u8 cpci_get_attention_status(struct slot *slot) |
| 50 | { | 50 | { |
| 51 | int hs_cap; | 51 | int hs_cap; |
| 52 | u16 hs_csr; | 52 | u16 hs_csr; |
| @@ -66,7 +66,7 @@ u8 cpci_get_attention_status(struct slot* slot) | |||
| 66 | return hs_csr & 0x0008 ? 1 : 0; | 66 | return hs_csr & 0x0008 ? 1 : 0; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | int cpci_set_attention_status(struct slot* slot, int status) | 69 | int cpci_set_attention_status(struct slot *slot, int status) |
| 70 | { | 70 | { |
| 71 | int hs_cap; | 71 | int hs_cap; |
| 72 | u16 hs_csr; | 72 | u16 hs_csr; |
| @@ -93,7 +93,7 @@ int cpci_set_attention_status(struct slot* slot, int status) | |||
| 93 | return 1; | 93 | return 1; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | u16 cpci_get_hs_csr(struct slot* slot) | 96 | u16 cpci_get_hs_csr(struct slot *slot) |
| 97 | { | 97 | { |
| 98 | int hs_cap; | 98 | int hs_cap; |
| 99 | u16 hs_csr; | 99 | u16 hs_csr; |
| @@ -111,7 +111,7 @@ u16 cpci_get_hs_csr(struct slot* slot) | |||
| 111 | return hs_csr; | 111 | return hs_csr; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | int cpci_check_and_clear_ins(struct slot* slot) | 114 | int cpci_check_and_clear_ins(struct slot *slot) |
| 115 | { | 115 | { |
| 116 | int hs_cap; | 116 | int hs_cap; |
| 117 | u16 hs_csr; | 117 | u16 hs_csr; |
| @@ -140,7 +140,7 @@ int cpci_check_and_clear_ins(struct slot* slot) | |||
| 140 | return ins; | 140 | return ins; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | int cpci_check_ext(struct slot* slot) | 143 | int cpci_check_ext(struct slot *slot) |
| 144 | { | 144 | { |
| 145 | int hs_cap; | 145 | int hs_cap; |
| 146 | u16 hs_csr; | 146 | u16 hs_csr; |
| @@ -161,7 +161,7 @@ int cpci_check_ext(struct slot* slot) | |||
| 161 | return ext; | 161 | return ext; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | int cpci_clear_ext(struct slot* slot) | 164 | int cpci_clear_ext(struct slot *slot) |
| 165 | { | 165 | { |
| 166 | int hs_cap; | 166 | int hs_cap; |
| 167 | u16 hs_csr; | 167 | u16 hs_csr; |
| @@ -187,7 +187,7 @@ int cpci_clear_ext(struct slot* slot) | |||
| 187 | return 0; | 187 | return 0; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | int cpci_led_on(struct slot* slot) | 190 | int cpci_led_on(struct slot *slot) |
| 191 | { | 191 | { |
| 192 | int hs_cap; | 192 | int hs_cap; |
| 193 | u16 hs_csr; | 193 | u16 hs_csr; |
| @@ -216,7 +216,7 @@ int cpci_led_on(struct slot* slot) | |||
| 216 | return 0; | 216 | return 0; |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | int cpci_led_off(struct slot* slot) | 219 | int cpci_led_off(struct slot *slot) |
| 220 | { | 220 | { |
| 221 | int hs_cap; | 221 | int hs_cap; |
| 222 | u16 hs_csr; | 222 | u16 hs_csr; |
| @@ -303,7 +303,7 @@ int cpci_configure_slot(struct slot *slot) | |||
| 303 | return ret; | 303 | return ret; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | int cpci_unconfigure_slot(struct slot* slot) | 306 | int cpci_unconfigure_slot(struct slot *slot) |
| 307 | { | 307 | { |
| 308 | struct pci_dev *dev, *temp; | 308 | struct pci_dev *dev, *temp; |
| 309 | 309 | ||
diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c index 7536eef620b0..04fcd7811400 100644 --- a/drivers/pci/hotplug/cpcihp_generic.c +++ b/drivers/pci/hotplug/cpcihp_generic.c | |||
| @@ -78,8 +78,8 @@ static struct cpci_hp_controller generic_hpc; | |||
| 78 | 78 | ||
| 79 | static int __init validate_parameters(void) | 79 | static int __init validate_parameters(void) |
| 80 | { | 80 | { |
| 81 | char* str; | 81 | char *str; |
| 82 | char* p; | 82 | char *p; |
| 83 | unsigned long tmp; | 83 | unsigned long tmp; |
| 84 | 84 | ||
| 85 | if(!bridge) { | 85 | if(!bridge) { |
| @@ -142,8 +142,8 @@ static int query_enum(void) | |||
| 142 | static int __init cpcihp_generic_init(void) | 142 | static int __init cpcihp_generic_init(void) |
| 143 | { | 143 | { |
| 144 | int status; | 144 | int status; |
| 145 | struct resource* r; | 145 | struct resource *r; |
| 146 | struct pci_dev* dev; | 146 | struct pci_dev *dev; |
| 147 | 147 | ||
| 148 | info(DRIVER_DESC " version: " DRIVER_VERSION); | 148 | info(DRIVER_DESC " version: " DRIVER_VERSION); |
| 149 | status = validate_parameters(); | 149 | status = validate_parameters(); |
diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c index e8c4a7ccf578..6757b3ef7e10 100644 --- a/drivers/pci/hotplug/cpcihp_zt5550.c +++ b/drivers/pci/hotplug/cpcihp_zt5550.c | |||
| @@ -295,7 +295,7 @@ static struct pci_driver zt5550_hc_driver = { | |||
| 295 | 295 | ||
| 296 | static int __init zt5550_init(void) | 296 | static int __init zt5550_init(void) |
| 297 | { | 297 | { |
| 298 | struct resource* r; | 298 | struct resource *r; |
| 299 | int rc; | 299 | int rc; |
| 300 | 300 | ||
| 301 | info(DRIVER_DESC " version: " DRIVER_VERSION); | 301 | info(DRIVER_DESC " version: " DRIVER_VERSION); |
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h index 516b87738b6e..0450f405807d 100644 --- a/drivers/pci/hotplug/cpqphp.h +++ b/drivers/pci/hotplug/cpqphp.h | |||
| @@ -255,7 +255,7 @@ struct pci_func { | |||
| 255 | struct pci_resource *io_head; | 255 | struct pci_resource *io_head; |
| 256 | struct pci_resource *bus_head; | 256 | struct pci_resource *bus_head; |
| 257 | struct timer_list *p_task_event; | 257 | struct timer_list *p_task_event; |
| 258 | struct pci_dev* pci_dev; | 258 | struct pci_dev *pci_dev; |
| 259 | }; | 259 | }; |
| 260 | 260 | ||
| 261 | struct slot { | 261 | struct slot { |
| @@ -278,7 +278,7 @@ struct slot { | |||
| 278 | }; | 278 | }; |
| 279 | 279 | ||
| 280 | struct pci_resource { | 280 | struct pci_resource { |
| 281 | struct pci_resource * next; | 281 | struct pci_resource *next; |
| 282 | u32 base; | 282 | u32 base; |
| 283 | u32 length; | 283 | u32 length; |
| 284 | }; | 284 | }; |
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index 037e2612c5bd..4aaee746df88 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
| @@ -94,7 +94,7 @@ static inline int is_slot66mhz(struct slot *slot) | |||
| 94 | * | 94 | * |
| 95 | * Returns pointer to the head of the SMBIOS tables (or %NULL). | 95 | * Returns pointer to the head of the SMBIOS tables (or %NULL). |
| 96 | */ | 96 | */ |
| 97 | static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) | 97 | static void __iomem *detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) |
| 98 | { | 98 | { |
| 99 | void __iomem *fp; | 99 | void __iomem *fp; |
| 100 | void __iomem *endp; | 100 | void __iomem *endp; |
| @@ -131,7 +131,7 @@ static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *e | |||
| 131 | * | 131 | * |
| 132 | * For unexpected switch opens | 132 | * For unexpected switch opens |
| 133 | */ | 133 | */ |
| 134 | static int init_SERR(struct controller * ctrl) | 134 | static int init_SERR(struct controller *ctrl) |
| 135 | { | 135 | { |
| 136 | u32 tempdword; | 136 | u32 tempdword; |
| 137 | u32 number_of_slots; | 137 | u32 number_of_slots; |
| @@ -291,7 +291,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
| 291 | kfree(slot); | 291 | kfree(slot); |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | static int ctrl_slot_cleanup (struct controller * ctrl) | 294 | static int ctrl_slot_cleanup (struct controller *ctrl) |
| 295 | { | 295 | { |
| 296 | struct slot *old_slot, *next_slot; | 296 | struct slot *old_slot, *next_slot; |
| 297 | 297 | ||
| @@ -706,8 +706,7 @@ static int ctrl_slot_setup(struct controller *ctrl, | |||
| 706 | hotplug_slot_info->adapter_status = | 706 | hotplug_slot_info->adapter_status = |
| 707 | get_presence_status(ctrl, slot); | 707 | get_presence_status(ctrl, slot); |
| 708 | 708 | ||
| 709 | dbg("registering bus %d, dev %d, number %d, " | 709 | dbg("registering bus %d, dev %d, number %d, ctrl->slot_device_offset %d, slot %d\n", |
| 710 | "ctrl->slot_device_offset %d, slot %d\n", | ||
| 711 | slot->bus, slot->device, | 710 | slot->bus, slot->device, |
| 712 | slot->number, ctrl->slot_device_offset, | 711 | slot->number, ctrl->slot_device_offset, |
| 713 | slot_number); | 712 | slot_number); |
| @@ -837,8 +836,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 837 | 836 | ||
| 838 | bus = pdev->subordinate; | 837 | bus = pdev->subordinate; |
| 839 | if (!bus) { | 838 | if (!bus) { |
| 840 | dev_notice(&pdev->dev, "the device is not a bridge, " | 839 | dev_notice(&pdev->dev, "the device is not a bridge, skipping\n"); |
| 841 | "skipping\n"); | ||
| 842 | rc = -ENODEV; | 840 | rc = -ENODEV; |
| 843 | goto err_disable_device; | 841 | goto err_disable_device; |
| 844 | } | 842 | } |
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index f593585f2784..bde47fce3248 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
| @@ -39,9 +39,9 @@ | |||
| 39 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
| 40 | #include "cpqphp.h" | 40 | #include "cpqphp.h" |
| 41 | 41 | ||
| 42 | static u32 configure_new_device(struct controller* ctrl, struct pci_func *func, | 42 | static u32 configure_new_device(struct controller *ctrl, struct pci_func *func, |
| 43 | u8 behind_bridge, struct resource_lists *resources); | 43 | u8 behind_bridge, struct resource_lists *resources); |
| 44 | static int configure_new_function(struct controller* ctrl, struct pci_func *func, | 44 | static int configure_new_function(struct controller *ctrl, struct pci_func *func, |
| 45 | u8 behind_bridge, struct resource_lists *resources); | 45 | u8 behind_bridge, struct resource_lists *resources); |
| 46 | static void interrupt_event_handler(struct controller *ctrl); | 46 | static void interrupt_event_handler(struct controller *ctrl); |
| 47 | 47 | ||
| @@ -64,7 +64,7 @@ static void long_delay(int delay) | |||
| 64 | 64 | ||
| 65 | /* FIXME: The following line needs to be somewhere else... */ | 65 | /* FIXME: The following line needs to be somewhere else... */ |
| 66 | #define WRONG_BUS_FREQUENCY 0x07 | 66 | #define WRONG_BUS_FREQUENCY 0x07 |
| 67 | static u8 handle_switch_change(u8 change, struct controller * ctrl) | 67 | static u8 handle_switch_change(u8 change, struct controller *ctrl) |
| 68 | { | 68 | { |
| 69 | int hp_slot; | 69 | int hp_slot; |
| 70 | u8 rc = 0; | 70 | u8 rc = 0; |
| @@ -138,7 +138,7 @@ static struct slot *cpqhp_find_slot(struct controller *ctrl, u8 device) | |||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | static u8 handle_presence_change(u16 change, struct controller * ctrl) | 141 | static u8 handle_presence_change(u16 change, struct controller *ctrl) |
| 142 | { | 142 | { |
| 143 | int hp_slot; | 143 | int hp_slot; |
| 144 | u8 rc = 0; | 144 | u8 rc = 0; |
| @@ -232,7 +232,7 @@ static u8 handle_presence_change(u16 change, struct controller * ctrl) | |||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | 234 | ||
| 235 | static u8 handle_power_fault(u8 change, struct controller * ctrl) | 235 | static u8 handle_power_fault(u8 change, struct controller *ctrl) |
| 236 | { | 236 | { |
| 237 | int hp_slot; | 237 | int hp_slot; |
| 238 | u8 rc = 0; | 238 | u8 rc = 0; |
| @@ -997,7 +997,7 @@ struct pci_func *cpqhp_slot_create(u8 busnumber) | |||
| 997 | * | 997 | * |
| 998 | * Returns %0 if successful, !0 otherwise. | 998 | * Returns %0 if successful, !0 otherwise. |
| 999 | */ | 999 | */ |
| 1000 | static int slot_remove(struct pci_func * old_slot) | 1000 | static int slot_remove(struct pci_func *old_slot) |
| 1001 | { | 1001 | { |
| 1002 | struct pci_func *next; | 1002 | struct pci_func *next; |
| 1003 | 1003 | ||
| @@ -1109,7 +1109,7 @@ struct pci_func *cpqhp_slot_find(u8 bus, u8 device, u8 index) | |||
| 1109 | 1109 | ||
| 1110 | /* DJZ: I don't think is_bridge will work as is. | 1110 | /* DJZ: I don't think is_bridge will work as is. |
| 1111 | * FIXME */ | 1111 | * FIXME */ |
| 1112 | static int is_bridge(struct pci_func * func) | 1112 | static int is_bridge(struct pci_func *func) |
| 1113 | { | 1113 | { |
| 1114 | /* Check the header type */ | 1114 | /* Check the header type */ |
| 1115 | if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01) | 1115 | if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01) |
| @@ -1625,7 +1625,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
| 1625 | * @replace_flag: whether replacing or adding a new device | 1625 | * @replace_flag: whether replacing or adding a new device |
| 1626 | * @ctrl: target controller | 1626 | * @ctrl: target controller |
| 1627 | */ | 1627 | */ |
| 1628 | static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) | 1628 | static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controller *ctrl) |
| 1629 | { | 1629 | { |
| 1630 | int index; | 1630 | int index; |
| 1631 | u8 skip = 0; | 1631 | u8 skip = 0; |
| @@ -1742,7 +1742,7 @@ static void pushbutton_helper_thread(unsigned long data) | |||
| 1742 | 1742 | ||
| 1743 | 1743 | ||
| 1744 | /* this is the main worker thread */ | 1744 | /* this is the main worker thread */ |
| 1745 | static int event_thread(void* data) | 1745 | static int event_thread(void *data) |
| 1746 | { | 1746 | { |
| 1747 | struct controller *ctrl; | 1747 | struct controller *ctrl; |
| 1748 | 1748 | ||
| @@ -1992,7 +1992,7 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func) | |||
| 1992 | u16 temp_word; | 1992 | u16 temp_word; |
| 1993 | u32 tempdword; | 1993 | u32 tempdword; |
| 1994 | int rc; | 1994 | int rc; |
| 1995 | struct slot* p_slot; | 1995 | struct slot *p_slot; |
| 1996 | int physical_slot = 0; | 1996 | int physical_slot = 0; |
| 1997 | 1997 | ||
| 1998 | tempdword = 0; | 1998 | tempdword = 0; |
| @@ -2088,7 +2088,7 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) | |||
| 2088 | u8 replace_flag; | 2088 | u8 replace_flag; |
| 2089 | u32 rc = 0; | 2089 | u32 rc = 0; |
| 2090 | unsigned int devfn; | 2090 | unsigned int devfn; |
| 2091 | struct slot* p_slot; | 2091 | struct slot *p_slot; |
| 2092 | struct pci_bus *pci_bus = ctrl->pci_bus; | 2092 | struct pci_bus *pci_bus = ctrl->pci_bus; |
| 2093 | int physical_slot=0; | 2093 | int physical_slot=0; |
| 2094 | 2094 | ||
| @@ -2270,8 +2270,8 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num) | |||
| 2270 | * | 2270 | * |
| 2271 | * Returns 0 if success. | 2271 | * Returns 0 if success. |
| 2272 | */ | 2272 | */ |
| 2273 | static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, | 2273 | static u32 configure_new_device(struct controller *ctrl, struct pci_func *func, |
| 2274 | u8 behind_bridge, struct resource_lists * resources) | 2274 | u8 behind_bridge, struct resource_lists *resources) |
| 2275 | { | 2275 | { |
| 2276 | u8 temp_byte, function, max_functions, stop_it; | 2276 | u8 temp_byte, function, max_functions, stop_it; |
| 2277 | int rc; | 2277 | int rc; |
diff --git a/drivers/pci/hotplug/cpqphp_nvram.c b/drivers/pci/hotplug/cpqphp_nvram.c index 9600a392eaae..0968a9bcb345 100644 --- a/drivers/pci/hotplug/cpqphp_nvram.c +++ b/drivers/pci/hotplug/cpqphp_nvram.c | |||
| @@ -107,7 +107,7 @@ static spinlock_t int15_lock; | |||
| 107 | */ | 107 | */ |
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | static u32 add_byte( u32 **p_buffer, u8 value, u32 *used, u32 *avail) | 110 | static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail) |
| 111 | { | 111 | { |
| 112 | u8 **tByte; | 112 | u8 **tByte; |
| 113 | 113 | ||
| @@ -122,7 +122,7 @@ static u32 add_byte( u32 **p_buffer, u8 value, u32 *used, u32 *avail) | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | 124 | ||
| 125 | static u32 add_dword( u32 **p_buffer, u32 value, u32 *used, u32 *avail) | 125 | static u32 add_dword(u32 **p_buffer, u32 value, u32 *used, u32 *avail) |
| 126 | { | 126 | { |
| 127 | if ((*used + 4) > *avail) | 127 | if ((*used + 4) > *avail) |
| 128 | return(1); | 128 | return(1); |
| @@ -267,12 +267,12 @@ static u32 store_HRT (void __iomem *rom_start) | |||
| 267 | ctrl = cpqhp_ctrl_list; | 267 | ctrl = cpqhp_ctrl_list; |
| 268 | 268 | ||
| 269 | /* The revision of this structure */ | 269 | /* The revision of this structure */ |
| 270 | rc = add_byte( &pFill, 1 + ctrl->push_flag, &usedbytes, &available); | 270 | rc = add_byte(&pFill, 1 + ctrl->push_flag, &usedbytes, &available); |
| 271 | if (rc) | 271 | if (rc) |
| 272 | return(rc); | 272 | return(rc); |
| 273 | 273 | ||
| 274 | /* The number of controllers */ | 274 | /* The number of controllers */ |
| 275 | rc = add_byte( &pFill, 1, &usedbytes, &available); | 275 | rc = add_byte(&pFill, 1, &usedbytes, &available); |
| 276 | if (rc) | 276 | if (rc) |
| 277 | return(rc); | 277 | return(rc); |
| 278 | 278 | ||
| @@ -282,22 +282,22 @@ static u32 store_HRT (void __iomem *rom_start) | |||
| 282 | numCtrl++; | 282 | numCtrl++; |
| 283 | 283 | ||
| 284 | /* The bus number */ | 284 | /* The bus number */ |
| 285 | rc = add_byte( &pFill, ctrl->bus, &usedbytes, &available); | 285 | rc = add_byte(&pFill, ctrl->bus, &usedbytes, &available); |
| 286 | if (rc) | 286 | if (rc) |
| 287 | return(rc); | 287 | return(rc); |
| 288 | 288 | ||
| 289 | /* The device Number */ | 289 | /* The device Number */ |
| 290 | rc = add_byte( &pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available); | 290 | rc = add_byte(&pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available); |
| 291 | if (rc) | 291 | if (rc) |
| 292 | return(rc); | 292 | return(rc); |
| 293 | 293 | ||
| 294 | /* The function Number */ | 294 | /* The function Number */ |
| 295 | rc = add_byte( &pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available); | 295 | rc = add_byte(&pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available); |
| 296 | if (rc) | 296 | if (rc) |
| 297 | return(rc); | 297 | return(rc); |
| 298 | 298 | ||
| 299 | /* Skip the number of available entries */ | 299 | /* Skip the number of available entries */ |
| 300 | rc = add_dword( &pFill, 0, &usedbytes, &available); | 300 | rc = add_dword(&pFill, 0, &usedbytes, &available); |
| 301 | if (rc) | 301 | if (rc) |
| 302 | return(rc); | 302 | return(rc); |
| 303 | 303 | ||
| @@ -311,12 +311,12 @@ static u32 store_HRT (void __iomem *rom_start) | |||
| 311 | loop ++; | 311 | loop ++; |
| 312 | 312 | ||
| 313 | /* base */ | 313 | /* base */ |
| 314 | rc = add_dword( &pFill, resNode->base, &usedbytes, &available); | 314 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
| 315 | if (rc) | 315 | if (rc) |
| 316 | return(rc); | 316 | return(rc); |
| 317 | 317 | ||
| 318 | /* length */ | 318 | /* length */ |
| 319 | rc = add_dword( &pFill, resNode->length, &usedbytes, &available); | 319 | rc = add_dword(&pFill, resNode->length, &usedbytes, &available); |
| 320 | if (rc) | 320 | if (rc) |
| 321 | return(rc); | 321 | return(rc); |
| 322 | 322 | ||
| @@ -336,12 +336,12 @@ static u32 store_HRT (void __iomem *rom_start) | |||
| 336 | loop ++; | 336 | loop ++; |
| 337 | 337 | ||
| 338 | /* base */ | 338 | /* base */ |
| 339 | rc = add_dword( &pFill, resNode->base, &usedbytes, &available); | 339 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
| 340 | if (rc) | 340 | if (rc) |
| 341 | return(rc); | 341 | return(rc); |
| 342 | 342 | ||
| 343 | /* length */ | 343 | /* length */ |
| 344 | rc = add_dword( &pFill, resNode->length, &usedbytes, &available); | 344 | rc = add_dword(&pFill, resNode->length, &usedbytes, &available); |
| 345 | if (rc) | 345 | if (rc) |
| 346 | return(rc); | 346 | return(rc); |
| 347 | 347 | ||
| @@ -361,12 +361,12 @@ static u32 store_HRT (void __iomem *rom_start) | |||
| 361 | loop ++; | 361 | loop ++; |
| 362 | 362 | ||
| 363 | /* base */ | 363 | /* base */ |
| 364 | rc = add_dword( &pFill, resNode->base, &usedbytes, &available); | 364 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
| 365 | if (rc) | 365 | if (rc) |
| 366 | return(rc); | 366 | return(rc); |
| 367 | 367 | ||
| 368 | /* length */ | 368 | /* length */ |
| 369 | rc = add_dword( &pFill, resNode->length, &usedbytes, &available); | 369 | rc = add_dword(&pFill, resNode->length, &usedbytes, &available); |
| 370 | if (rc) | 370 | if (rc) |
| 371 | return(rc); | 371 | return(rc); |
| 372 | 372 | ||
| @@ -386,12 +386,12 @@ static u32 store_HRT (void __iomem *rom_start) | |||
| 386 | loop ++; | 386 | loop ++; |
| 387 | 387 | ||
| 388 | /* base */ | 388 | /* base */ |
| 389 | rc = add_dword( &pFill, resNode->base, &usedbytes, &available); | 389 | rc = add_dword(&pFill, resNode->base, &usedbytes, &available); |
| 390 | if (rc) | 390 | if (rc) |
| 391 | return(rc); | 391 | return(rc); |
| 392 | 392 | ||
| 393 | /* length */ | 393 | /* length */ |
| 394 | rc = add_dword( &pFill, resNode->length, &usedbytes, &available); | 394 | rc = add_dword(&pFill, resNode->length, &usedbytes, &available); |
| 395 | if (rc) | 395 | if (rc) |
| 396 | return(rc); | 396 | return(rc); |
| 397 | 397 | ||
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c index a3e3c2002b58..1c8c2f130d31 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c | |||
| @@ -81,7 +81,7 @@ static void __iomem *detect_HRT_floating_pointer(void __iomem *begin, void __iom | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) | 84 | int cpqhp_configure_device (struct controller *ctrl, struct pci_func *func) |
| 85 | { | 85 | { |
| 86 | struct pci_bus *child; | 86 | struct pci_bus *child; |
| 87 | int num; | 87 | int num; |
| @@ -121,7 +121,7 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | 123 | ||
| 124 | int cpqhp_unconfigure_device(struct pci_func* func) | 124 | int cpqhp_unconfigure_device(struct pci_func *func) |
| 125 | { | 125 | { |
| 126 | int j; | 126 | int j; |
| 127 | 127 | ||
| @@ -129,7 +129,7 @@ int cpqhp_unconfigure_device(struct pci_func* func) | |||
| 129 | 129 | ||
| 130 | pci_lock_rescan_remove(); | 130 | pci_lock_rescan_remove(); |
| 131 | for (j=0; j<8 ; j++) { | 131 | for (j=0; j<8 ; j++) { |
| 132 | struct pci_dev* temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); | 132 | struct pci_dev *temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); |
| 133 | if (temp) { | 133 | if (temp) { |
| 134 | pci_dev_put(temp); | 134 | pci_dev_put(temp); |
| 135 | pci_stop_and_remove_bus_device(temp); | 135 | pci_stop_and_remove_bus_device(temp); |
| @@ -203,7 +203,7 @@ int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) | |||
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | 205 | ||
| 206 | static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 * dev_num) | 206 | static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 *dev_num) |
| 207 | { | 207 | { |
| 208 | u16 tdevice; | 208 | u16 tdevice; |
| 209 | u32 work; | 209 | u32 work; |
| @@ -280,7 +280,7 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num | |||
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | 282 | ||
| 283 | int cpqhp_get_bus_dev (struct controller *ctrl, u8 * bus_num, u8 * dev_num, u8 slot) | 283 | int cpqhp_get_bus_dev (struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot) |
| 284 | { | 284 | { |
| 285 | /* plain (bridges allowed) */ | 285 | /* plain (bridges allowed) */ |
| 286 | return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0); | 286 | return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0); |
| @@ -465,7 +465,7 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug) | |||
| 465 | * | 465 | * |
| 466 | * returns 0 if success | 466 | * returns 0 if success |
| 467 | */ | 467 | */ |
| 468 | int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot) | 468 | int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot) |
| 469 | { | 469 | { |
| 470 | long rc; | 470 | long rc; |
| 471 | u8 class_code; | 471 | u8 class_code; |
| @@ -549,7 +549,7 @@ int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot) | |||
| 549 | * | 549 | * |
| 550 | * returns 0 if success | 550 | * returns 0 if success |
| 551 | */ | 551 | */ |
| 552 | int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func * func) | 552 | int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func) |
| 553 | { | 553 | { |
| 554 | u8 cloop; | 554 | u8 cloop; |
| 555 | u8 header_type; | 555 | u8 header_type; |
| @@ -686,7 +686,7 @@ int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func * func) | |||
| 686 | * | 686 | * |
| 687 | * returns 0 if success | 687 | * returns 0 if success |
| 688 | */ | 688 | */ |
| 689 | int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func * func) | 689 | int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func *func) |
| 690 | { | 690 | { |
| 691 | u8 cloop; | 691 | u8 cloop; |
| 692 | u8 header_type; | 692 | u8 header_type; |
| @@ -949,7 +949,7 @@ int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func * func) | |||
| 949 | * | 949 | * |
| 950 | * returns 0 if success | 950 | * returns 0 if success |
| 951 | */ | 951 | */ |
| 952 | int cpqhp_configure_board(struct controller *ctrl, struct pci_func * func) | 952 | int cpqhp_configure_board(struct controller *ctrl, struct pci_func *func) |
| 953 | { | 953 | { |
| 954 | int cloop; | 954 | int cloop; |
| 955 | u8 header_type; | 955 | u8 header_type; |
| @@ -1027,7 +1027,7 @@ int cpqhp_configure_board(struct controller *ctrl, struct pci_func * func) | |||
| 1027 | * | 1027 | * |
| 1028 | * returns 0 if the board is the same nonzero otherwise | 1028 | * returns 0 if the board is the same nonzero otherwise |
| 1029 | */ | 1029 | */ |
| 1030 | int cpqhp_valid_replace(struct controller *ctrl, struct pci_func * func) | 1030 | int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func) |
| 1031 | { | 1031 | { |
| 1032 | u8 cloop; | 1032 | u8 cloop; |
| 1033 | u8 header_type; | 1033 | u8 header_type; |
| @@ -1419,7 +1419,7 @@ int cpqhp_find_available_resources(struct controller *ctrl, void __iomem *rom_st | |||
| 1419 | * | 1419 | * |
| 1420 | * returns 0 if success | 1420 | * returns 0 if success |
| 1421 | */ | 1421 | */ |
| 1422 | int cpqhp_return_board_resources(struct pci_func * func, struct resource_lists * resources) | 1422 | int cpqhp_return_board_resources(struct pci_func *func, struct resource_lists *resources) |
| 1423 | { | 1423 | { |
| 1424 | int rc = 0; | 1424 | int rc = 0; |
| 1425 | struct pci_resource *node; | 1425 | struct pci_resource *node; |
| @@ -1475,7 +1475,7 @@ int cpqhp_return_board_resources(struct pci_func * func, struct resource_lists * | |||
| 1475 | * | 1475 | * |
| 1476 | * Puts node back in the resource list pointed to by head | 1476 | * Puts node back in the resource list pointed to by head |
| 1477 | */ | 1477 | */ |
| 1478 | void cpqhp_destroy_resource_list (struct resource_lists * resources) | 1478 | void cpqhp_destroy_resource_list (struct resource_lists *resources) |
| 1479 | { | 1479 | { |
| 1480 | struct pci_resource *res, *tres; | 1480 | struct pci_resource *res, *tres; |
| 1481 | 1481 | ||
| @@ -1522,7 +1522,7 @@ void cpqhp_destroy_resource_list (struct resource_lists * resources) | |||
| 1522 | * | 1522 | * |
| 1523 | * Puts node back in the resource list pointed to by head | 1523 | * Puts node back in the resource list pointed to by head |
| 1524 | */ | 1524 | */ |
| 1525 | void cpqhp_destroy_board_resources (struct pci_func * func) | 1525 | void cpqhp_destroy_board_resources (struct pci_func *func) |
| 1526 | { | 1526 | { |
| 1527 | struct pci_resource *res, *tres; | 1527 | struct pci_resource *res, *tres; |
| 1528 | 1528 | ||
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index 17c1f36315d1..4a392c44e3d3 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c | |||
| @@ -79,7 +79,7 @@ static int show_ctrl (struct controller *ctrl, char *buf) | |||
| 79 | 79 | ||
| 80 | static int show_dev (struct controller *ctrl, char *buf) | 80 | static int show_dev (struct controller *ctrl, char *buf) |
| 81 | { | 81 | { |
| 82 | char * out = buf; | 82 | char *out = buf; |
| 83 | int index; | 83 | int index; |
| 84 | struct pci_resource *res; | 84 | struct pci_resource *res; |
| 85 | struct pci_func *new_slot; | 85 | struct pci_func *new_slot; |
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index cf3ac1e4b099..f7b8684a7739 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
| @@ -74,7 +74,7 @@ static inline int get_max_adapter_speed (struct hotplug_slot *hs, u8 *value) | |||
| 74 | static inline int get_cur_bus_info(struct slot **sl) | 74 | static inline int get_cur_bus_info(struct slot **sl) |
| 75 | { | 75 | { |
| 76 | int rc = 1; | 76 | int rc = 1; |
| 77 | struct slot * slot_cur = *sl; | 77 | struct slot *slot_cur = *sl; |
| 78 | 78 | ||
| 79 | debug("options = %x\n", slot_cur->ctrl->options); | 79 | debug("options = %x\n", slot_cur->ctrl->options); |
| 80 | debug("revision = %x\n", slot_cur->ctrl->revision); | 80 | debug("revision = %x\n", slot_cur->ctrl->revision); |
| @@ -114,8 +114,8 @@ static inline int slot_update(struct slot **sl) | |||
| 114 | 114 | ||
| 115 | static int __init get_max_slots (void) | 115 | static int __init get_max_slots (void) |
| 116 | { | 116 | { |
| 117 | struct slot * slot_cur; | 117 | struct slot *slot_cur; |
| 118 | struct list_head * tmp; | 118 | struct list_head *tmp; |
| 119 | u8 slot_count = 0; | 119 | u8 slot_count = 0; |
| 120 | 120 | ||
| 121 | list_for_each(tmp, &ibmphp_slot_head) { | 121 | list_for_each(tmp, &ibmphp_slot_head) { |
| @@ -280,7 +280,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) | |||
| 280 | return rc; | 280 | return rc; |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) | 283 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 284 | { | 284 | { |
| 285 | int rc = -ENODEV; | 285 | int rc = -ENODEV; |
| 286 | struct slot *pslot; | 286 | struct slot *pslot; |
| @@ -311,7 +311,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) | |||
| 311 | return rc; | 311 | return rc; |
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value) | 314 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 315 | { | 315 | { |
| 316 | int rc = -ENODEV; | 316 | int rc = -ENODEV; |
| 317 | struct slot *pslot; | 317 | struct slot *pslot; |
| @@ -338,7 +338,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value) | |||
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | 340 | ||
| 341 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | 341 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 342 | { | 342 | { |
| 343 | int rc = -ENODEV; | 343 | int rc = -ENODEV; |
| 344 | struct slot *pslot; | 344 | struct slot *pslot; |
| @@ -364,7 +364,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | |||
| 364 | return rc; | 364 | return rc; |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 * value) | 367 | static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 *value) |
| 368 | { | 368 | { |
| 369 | int rc = -ENODEV; | 369 | int rc = -ENODEV; |
| 370 | struct slot *pslot; | 370 | struct slot *pslot; |
| @@ -433,7 +433,7 @@ static int get_max_bus_speed(struct slot *slot) | |||
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | /* | 435 | /* |
| 436 | static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 * value, u8 flag) | 436 | static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 *value, u8 flag) |
| 437 | { | 437 | { |
| 438 | int rc = -ENODEV; | 438 | int rc = -ENODEV; |
| 439 | struct slot *pslot; | 439 | struct slot *pslot; |
| @@ -471,7 +471,7 @@ static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 * value | |||
| 471 | return rc; | 471 | return rc; |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | static int get_bus_name(struct hotplug_slot *hotplug_slot, char * value) | 474 | static int get_bus_name(struct hotplug_slot *hotplug_slot, char *value) |
| 475 | { | 475 | { |
| 476 | int rc = -ENODEV; | 476 | int rc = -ENODEV; |
| 477 | struct slot *pslot = NULL; | 477 | struct slot *pslot = NULL; |
| @@ -671,7 +671,7 @@ static struct pci_func *ibm_slot_find(u8 busno, u8 device, u8 function) | |||
| 671 | { | 671 | { |
| 672 | struct pci_func *func_cur; | 672 | struct pci_func *func_cur; |
| 673 | struct slot *slot_cur; | 673 | struct slot *slot_cur; |
| 674 | struct list_head * tmp; | 674 | struct list_head *tmp; |
| 675 | list_for_each(tmp, &ibmphp_slot_head) { | 675 | list_for_each(tmp, &ibmphp_slot_head) { |
| 676 | slot_cur = list_entry(tmp, struct slot, ibm_slot_list); | 676 | slot_cur = list_entry(tmp, struct slot, ibm_slot_list); |
| 677 | if (slot_cur->func) { | 677 | if (slot_cur->func) { |
| @@ -696,8 +696,8 @@ static struct pci_func *ibm_slot_find(u8 busno, u8 device, u8 function) | |||
| 696 | static void free_slots(void) | 696 | static void free_slots(void) |
| 697 | { | 697 | { |
| 698 | struct slot *slot_cur; | 698 | struct slot *slot_cur; |
| 699 | struct list_head * tmp; | 699 | struct list_head *tmp; |
| 700 | struct list_head * next; | 700 | struct list_head *next; |
| 701 | 701 | ||
| 702 | debug("%s -- enter\n", __func__); | 702 | debug("%s -- enter\n", __func__); |
| 703 | 703 | ||
| @@ -825,10 +825,10 @@ static int ibm_configure_device(struct pci_func *func) | |||
| 825 | /******************************************************* | 825 | /******************************************************* |
| 826 | * Returns whether the bus is empty or not | 826 | * Returns whether the bus is empty or not |
| 827 | *******************************************************/ | 827 | *******************************************************/ |
| 828 | static int is_bus_empty(struct slot * slot_cur) | 828 | static int is_bus_empty(struct slot *slot_cur) |
| 829 | { | 829 | { |
| 830 | int rc; | 830 | int rc; |
| 831 | struct slot * tmp_slot; | 831 | struct slot *tmp_slot; |
| 832 | u8 i = slot_cur->bus_on->slot_min; | 832 | u8 i = slot_cur->bus_on->slot_min; |
| 833 | 833 | ||
| 834 | while (i <= slot_cur->bus_on->slot_max) { | 834 | while (i <= slot_cur->bus_on->slot_max) { |
| @@ -856,7 +856,7 @@ static int is_bus_empty(struct slot * slot_cur) | |||
| 856 | * Parameters: slot | 856 | * Parameters: slot |
| 857 | * Returns: bus is set (0) or error code | 857 | * Returns: bus is set (0) or error code |
| 858 | ***********************************************************/ | 858 | ***********************************************************/ |
| 859 | static int set_bus(struct slot * slot_cur) | 859 | static int set_bus(struct slot *slot_cur) |
| 860 | { | 860 | { |
| 861 | int rc; | 861 | int rc; |
| 862 | u8 speed; | 862 | u8 speed; |
| @@ -956,7 +956,7 @@ static int set_bus(struct slot * slot_cur) | |||
| 956 | static int check_limitations(struct slot *slot_cur) | 956 | static int check_limitations(struct slot *slot_cur) |
| 957 | { | 957 | { |
| 958 | u8 i; | 958 | u8 i; |
| 959 | struct slot * tmp_slot; | 959 | struct slot *tmp_slot; |
| 960 | u8 count = 0; | 960 | u8 count = 0; |
| 961 | u8 limitation = 0; | 961 | u8 limitation = 0; |
| 962 | 962 | ||
| @@ -1045,8 +1045,7 @@ static int enable_slot(struct hotplug_slot *hs) | |||
| 1045 | rc = check_limitations(slot_cur); | 1045 | rc = check_limitations(slot_cur); |
| 1046 | if (rc) { | 1046 | if (rc) { |
| 1047 | err("Adding this card exceeds the limitations of this bus.\n"); | 1047 | err("Adding this card exceeds the limitations of this bus.\n"); |
| 1048 | err("(i.e., >1 133MHz cards running on same bus, or " | 1048 | err("(i.e., >1 133MHz cards running on same bus, or >2 66 PCI cards running on same bus.\n"); |
| 1049 | ">2 66 PCI cards running on same bus.\n"); | ||
| 1050 | err("Try hot-adding into another bus\n"); | 1049 | err("Try hot-adding into another bus\n"); |
| 1051 | rc = -EINVAL; | 1050 | rc = -EINVAL; |
| 1052 | goto error_nopower; | 1051 | goto error_nopower; |
| @@ -1070,12 +1069,10 @@ static int enable_slot(struct hotplug_slot *hs) | |||
| 1070 | !(SLOT_PWRGD(slot_cur->status))) | 1069 | !(SLOT_PWRGD(slot_cur->status))) |
| 1071 | err("power fault occurred trying to power up\n"); | 1070 | err("power fault occurred trying to power up\n"); |
| 1072 | else if (SLOT_BUS_SPEED(slot_cur->status)) { | 1071 | else if (SLOT_BUS_SPEED(slot_cur->status)) { |
| 1073 | err("bus speed mismatch occurred. please check " | 1072 | err("bus speed mismatch occurred. please check current bus speed and card capability\n"); |
| 1074 | "current bus speed and card capability\n"); | ||
| 1075 | print_card_capability(slot_cur); | 1073 | print_card_capability(slot_cur); |
| 1076 | } else if (SLOT_BUS_MODE(slot_cur->ext_status)) { | 1074 | } else if (SLOT_BUS_MODE(slot_cur->ext_status)) { |
| 1077 | err("bus mode mismatch occurred. please check " | 1075 | err("bus mode mismatch occurred. please check current bus mode and card capability\n"); |
| 1078 | "current bus mode and card capability\n"); | ||
| 1079 | print_card_capability(slot_cur); | 1076 | print_card_capability(slot_cur); |
| 1080 | } | 1077 | } |
| 1081 | ibmphp_update_slot_info(slot_cur); | 1078 | ibmphp_update_slot_info(slot_cur); |
| @@ -1098,8 +1095,7 @@ static int enable_slot(struct hotplug_slot *hs) | |||
| 1098 | goto error_power; | 1095 | goto error_power; |
| 1099 | } | 1096 | } |
| 1100 | if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) { | 1097 | if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) { |
| 1101 | err("bus speed mismatch occurred. please check current bus " | 1098 | err("bus speed mismatch occurred. please check current bus speed and card capability\n"); |
| 1102 | "speed and card capability\n"); | ||
| 1103 | print_card_capability(slot_cur); | 1099 | print_card_capability(slot_cur); |
| 1104 | goto error_power; | 1100 | goto error_power; |
| 1105 | } | 1101 | } |
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index bd044158b36c..0f65ac555434 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c | |||
| @@ -563,7 +563,7 @@ static int first_slot_num (u8 slot_num, u8 first_slot, u8 var) | |||
| 563 | return rc; | 563 | return rc; |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | static struct opt_rio_lo * find_rxe_num (u8 slot_num) | 566 | static struct opt_rio_lo *find_rxe_num (u8 slot_num) |
| 567 | { | 567 | { |
| 568 | struct opt_rio_lo *opt_lo_ptr; | 568 | struct opt_rio_lo *opt_lo_ptr; |
| 569 | 569 | ||
| @@ -575,7 +575,7 @@ static struct opt_rio_lo * find_rxe_num (u8 slot_num) | |||
| 575 | return NULL; | 575 | return NULL; |
| 576 | } | 576 | } |
| 577 | 577 | ||
| 578 | static struct opt_rio * find_chassis_num (u8 slot_num) | 578 | static struct opt_rio *find_chassis_num (u8 slot_num) |
| 579 | { | 579 | { |
| 580 | struct opt_rio *opt_vg_ptr; | 580 | struct opt_rio *opt_vg_ptr; |
| 581 | 581 | ||
| @@ -593,7 +593,7 @@ static struct opt_rio * find_chassis_num (u8 slot_num) | |||
| 593 | static u8 calculate_first_slot (u8 slot_num) | 593 | static u8 calculate_first_slot (u8 slot_num) |
| 594 | { | 594 | { |
| 595 | u8 first_slot = 1; | 595 | u8 first_slot = 1; |
| 596 | struct slot * slot_cur; | 596 | struct slot *slot_cur; |
| 597 | 597 | ||
| 598 | list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) { | 598 | list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) { |
| 599 | if (slot_cur->ctrl) { | 599 | if (slot_cur->ctrl) { |
| @@ -607,7 +607,7 @@ static u8 calculate_first_slot (u8 slot_num) | |||
| 607 | 607 | ||
| 608 | #define SLOT_NAME_SIZE 30 | 608 | #define SLOT_NAME_SIZE 30 |
| 609 | 609 | ||
| 610 | static char *create_file_name (struct slot * slot_cur) | 610 | static char *create_file_name (struct slot *slot_cur) |
| 611 | { | 611 | { |
| 612 | struct opt_rio *opt_vg_ptr = NULL; | 612 | struct opt_rio *opt_vg_ptr = NULL; |
| 613 | struct opt_rio_lo *opt_lo_ptr = NULL; | 613 | struct opt_rio_lo *opt_lo_ptr = NULL; |
| @@ -1192,7 +1192,7 @@ int ibmphp_register_pci (void) | |||
| 1192 | } | 1192 | } |
| 1193 | return rc; | 1193 | return rc; |
| 1194 | } | 1194 | } |
| 1195 | static int ibmphp_probe (struct pci_dev * dev, const struct pci_device_id *ids) | 1195 | static int ibmphp_probe (struct pci_dev *dev, const struct pci_device_id *ids) |
| 1196 | { | 1196 | { |
| 1197 | struct controller *ctrl; | 1197 | struct controller *ctrl; |
| 1198 | 1198 | ||
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 5fc7a089f532..a936022956e6 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c | |||
| @@ -533,7 +533,7 @@ static u8 hpc_readcmdtoindex (u8 cmd, u8 index) | |||
| 533 | * | 533 | * |
| 534 | * Return 0 or error codes | 534 | * Return 0 or error codes |
| 535 | *---------------------------------------------------------------------*/ | 535 | *---------------------------------------------------------------------*/ |
| 536 | int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) | 536 | int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) |
| 537 | { | 537 | { |
| 538 | void __iomem *wpg_bbar = NULL; | 538 | void __iomem *wpg_bbar = NULL; |
| 539 | struct controller *ctlr_ptr; | 539 | struct controller *ctlr_ptr; |
| @@ -672,7 +672,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) | |||
| 672 | * | 672 | * |
| 673 | * Action: issue a WRITE command to HPC | 673 | * Action: issue a WRITE command to HPC |
| 674 | *---------------------------------------------------------------------*/ | 674 | *---------------------------------------------------------------------*/ |
| 675 | int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) | 675 | int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) |
| 676 | { | 676 | { |
| 677 | void __iomem *wpg_bbar = NULL; | 677 | void __iomem *wpg_bbar = NULL; |
| 678 | struct controller *ctlr_ptr; | 678 | struct controller *ctlr_ptr; |
| @@ -1102,7 +1102,7 @@ void __exit ibmphp_hpc_stop_poll_thread (void) | |||
| 1102 | * Value: | 1102 | * Value: |
| 1103 | *---------------------------------------------------------------------*/ | 1103 | *---------------------------------------------------------------------*/ |
| 1104 | static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar, | 1104 | static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar, |
| 1105 | u8 * pstatus) | 1105 | u8 *pstatus) |
| 1106 | { | 1106 | { |
| 1107 | int rc = 0; | 1107 | int rc = 0; |
| 1108 | u8 done = 0; | 1108 | u8 done = 0; |
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index 639ea3a75e14..2fd296706ce7 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
| @@ -47,7 +47,7 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno); | |||
| 47 | * We also assign the same irq numbers for multi function devices. | 47 | * We also assign the same irq numbers for multi function devices. |
| 48 | * These are PIC mode, so shouldn't matter n.e.ways (hopefully) | 48 | * These are PIC mode, so shouldn't matter n.e.ways (hopefully) |
| 49 | */ | 49 | */ |
| 50 | static void assign_alt_irq (struct pci_func * cur_func, u8 class_code) | 50 | static void assign_alt_irq (struct pci_func *cur_func, u8 class_code) |
| 51 | { | 51 | { |
| 52 | int j; | 52 | int j; |
| 53 | for (j = 0; j < 4; j++) { | 53 | for (j = 0; j < 4; j++) { |
| @@ -137,8 +137,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
| 137 | "Please choose another device.\n", cur_func->device); | 137 | "Please choose another device.\n", cur_func->device); |
| 138 | return -ENODEV; | 138 | return -ENODEV; |
| 139 | } else if (class == PCI_CLASS_DISPLAY_VGA) { | 139 | } else if (class == PCI_CLASS_DISPLAY_VGA) { |
| 140 | err ("The device %x is not supported for hot plugging. " | 140 | err ("The device %x is not supported for hot plugging. Please choose another device.\n", |
| 141 | "Please choose another device.\n", cur_func->device); | 141 | cur_func->device); |
| 142 | return -ENODEV; | 142 | return -ENODEV; |
| 143 | } | 143 | } |
| 144 | switch (hdr_type) { | 144 | switch (hdr_type) { |
| @@ -179,8 +179,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
| 179 | case PCI_HEADER_TYPE_MULTIBRIDGE: | 179 | case PCI_HEADER_TYPE_MULTIBRIDGE: |
| 180 | class >>= 8; | 180 | class >>= 8; |
| 181 | if (class != PCI_CLASS_BRIDGE_PCI) { | 181 | if (class != PCI_CLASS_BRIDGE_PCI) { |
| 182 | err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. " | 182 | err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", |
| 183 | "Please insert another card.\n", cur_func->device); | 183 | cur_func->device); |
| 184 | return -ENODEV; | 184 | return -ENODEV; |
| 185 | } | 185 | } |
| 186 | assign_alt_irq (cur_func, class_code); | 186 | assign_alt_irq (cur_func, class_code); |
| @@ -247,8 +247,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno) | |||
| 247 | class >>= 8; | 247 | class >>= 8; |
| 248 | debug ("class now is %x\n", class); | 248 | debug ("class now is %x\n", class); |
| 249 | if (class != PCI_CLASS_BRIDGE_PCI) { | 249 | if (class != PCI_CLASS_BRIDGE_PCI) { |
| 250 | err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. " | 250 | err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", |
| 251 | "Please insert another card.\n", cur_func->device); | 251 | cur_func->device); |
| 252 | return -ENODEV; | 252 | return -ENODEV; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| @@ -1073,7 +1073,7 @@ error: | |||
| 1073 | * Input: bridge function | 1073 | * Input: bridge function |
| 1074 | * Output: amount of resources needed | 1074 | * Output: amount of resources needed |
| 1075 | *****************************************************************************/ | 1075 | *****************************************************************************/ |
| 1076 | static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno) | 1076 | static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno) |
| 1077 | { | 1077 | { |
| 1078 | int count, len[6]; | 1078 | int count, len[6]; |
| 1079 | u16 vendor_id; | 1079 | u16 vendor_id; |
| @@ -1125,13 +1125,11 @@ static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno) | |||
| 1125 | 1125 | ||
| 1126 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ | 1126 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ |
| 1127 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { | 1127 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { |
| 1128 | err ("The device %x is VGA compatible and as is not supported for hot plugging. " | 1128 | err ("The device %x is VGA compatible and as is not supported for hot plugging. Please choose another device.\n", device); |
| 1129 | "Please choose another device.\n", device); | ||
| 1130 | amount->not_correct = 1; | 1129 | amount->not_correct = 1; |
| 1131 | return amount; | 1130 | return amount; |
| 1132 | } else if (class == PCI_CLASS_DISPLAY_VGA) { | 1131 | } else if (class == PCI_CLASS_DISPLAY_VGA) { |
| 1133 | err ("The device %x is not supported for hot plugging. " | 1132 | err ("The device %x is not supported for hot plugging. Please choose another device.\n", device); |
| 1134 | "Please choose another device.\n", device); | ||
| 1135 | amount->not_correct = 1; | 1133 | amount->not_correct = 1; |
| 1136 | return amount; | 1134 | return amount; |
| 1137 | } | 1135 | } |
| @@ -1483,12 +1481,10 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
| 1483 | debug ("hdr_type %x, class %x\n", hdr_type, class); | 1481 | debug ("hdr_type %x, class %x\n", hdr_type, class); |
| 1484 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ | 1482 | class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ |
| 1485 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { | 1483 | if (class == PCI_CLASS_NOT_DEFINED_VGA) { |
| 1486 | err ("The device %x function %x is VGA compatible and is not supported for hot removing. " | 1484 | err ("The device %x function %x is VGA compatible and is not supported for hot removing. Please choose another device.\n", device, function); |
| 1487 | "Please choose another device.\n", device, function); | ||
| 1488 | return -ENODEV; | 1485 | return -ENODEV; |
| 1489 | } else if (class == PCI_CLASS_DISPLAY_VGA) { | 1486 | } else if (class == PCI_CLASS_DISPLAY_VGA) { |
| 1490 | err ("The device %x function %x is not supported for hot removing. " | 1487 | err ("The device %x function %x is not supported for hot removing. Please choose another device.\n", device, function); |
| 1491 | "Please choose another device.\n", device, function); | ||
| 1492 | return -ENODEV; | 1488 | return -ENODEV; |
| 1493 | } | 1489 | } |
| 1494 | 1490 | ||
| @@ -1513,9 +1509,7 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
| 1513 | case PCI_HEADER_TYPE_BRIDGE: | 1509 | case PCI_HEADER_TYPE_BRIDGE: |
| 1514 | class >>= 8; | 1510 | class >>= 8; |
| 1515 | if (class != PCI_CLASS_BRIDGE_PCI) { | 1511 | if (class != PCI_CLASS_BRIDGE_PCI) { |
| 1516 | err ("This device %x function %x is not PCI-to-PCI bridge, " | 1512 | err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); |
| 1517 | "and is not supported for hot-removing. " | ||
| 1518 | "Please try another card.\n", device, function); | ||
| 1519 | return -ENODEV; | 1513 | return -ENODEV; |
| 1520 | } | 1514 | } |
| 1521 | rc = unconfigure_boot_bridge (busno, device, function); | 1515 | rc = unconfigure_boot_bridge (busno, device, function); |
| @@ -1529,9 +1523,7 @@ static int unconfigure_boot_card (struct slot *slot_cur) | |||
| 1529 | case PCI_HEADER_TYPE_MULTIBRIDGE: | 1523 | case PCI_HEADER_TYPE_MULTIBRIDGE: |
| 1530 | class >>= 8; | 1524 | class >>= 8; |
| 1531 | if (class != PCI_CLASS_BRIDGE_PCI) { | 1525 | if (class != PCI_CLASS_BRIDGE_PCI) { |
| 1532 | err ("This device %x function %x is not PCI-to-PCI bridge, " | 1526 | err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); |
| 1533 | "and is not supported for hot-removing. " | ||
| 1534 | "Please try another card.\n", device, function); | ||
| 1535 | return -ENODEV; | 1527 | return -ENODEV; |
| 1536 | } | 1528 | } |
| 1537 | rc = unconfigure_boot_bridge (busno, device, function); | 1529 | rc = unconfigure_boot_bridge (busno, device, function); |
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c index a265acb2d518..f34745abd5b6 100644 --- a/drivers/pci/hotplug/ibmphp_res.c +++ b/drivers/pci/hotplug/ibmphp_res.c | |||
| @@ -46,9 +46,9 @@ static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8); | |||
| 46 | 46 | ||
| 47 | static LIST_HEAD(gbuses); | 47 | static LIST_HEAD(gbuses); |
| 48 | 48 | ||
| 49 | static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8 busno, int flag) | 49 | static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc *curr, u8 busno, int flag) |
| 50 | { | 50 | { |
| 51 | struct bus_node * newbus; | 51 | struct bus_node *newbus; |
| 52 | 52 | ||
| 53 | if (!(curr) && !(flag)) { | 53 | if (!(curr) && !(flag)) { |
| 54 | err ("NULL pointer passed\n"); | 54 | err ("NULL pointer passed\n"); |
| @@ -69,7 +69,7 @@ static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8 | |||
| 69 | return newbus; | 69 | return newbus; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc * curr) | 72 | static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc *curr) |
| 73 | { | 73 | { |
| 74 | struct resource_node *rs; | 74 | struct resource_node *rs; |
| 75 | 75 | ||
| @@ -93,7 +93,7 @@ static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc * cur | |||
| 93 | 93 | ||
| 94 | static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) | 94 | static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) |
| 95 | { | 95 | { |
| 96 | struct bus_node * newbus; | 96 | struct bus_node *newbus; |
| 97 | struct range_node *newrange; | 97 | struct range_node *newrange; |
| 98 | u8 num_ranges = 0; | 98 | u8 num_ranges = 0; |
| 99 | 99 | ||
| @@ -789,8 +789,7 @@ int ibmphp_remove_resource (struct resource_node *res) | |||
| 789 | bus_cur = find_bus_wprev (res->busno, NULL, 0); | 789 | bus_cur = find_bus_wprev (res->busno, NULL, 0); |
| 790 | 790 | ||
| 791 | if (!bus_cur) { | 791 | if (!bus_cur) { |
| 792 | err ("cannot find corresponding bus of the io resource to remove " | 792 | err ("cannot find corresponding bus of the io resource to remove bailing out...\n"); |
| 793 | "bailing out...\n"); | ||
| 794 | return -ENODEV; | 793 | return -ENODEV; |
| 795 | } | 794 | } |
| 796 | 795 | ||
| @@ -934,9 +933,9 @@ int ibmphp_remove_resource (struct resource_node *res) | |||
| 934 | return 0; | 933 | return 0; |
| 935 | } | 934 | } |
| 936 | 935 | ||
| 937 | static struct range_node * find_range (struct bus_node *bus_cur, struct resource_node * res) | 936 | static struct range_node *find_range (struct bus_node *bus_cur, struct resource_node *res) |
| 938 | { | 937 | { |
| 939 | struct range_node * range = NULL; | 938 | struct range_node *range = NULL; |
| 940 | 939 | ||
| 941 | switch (res->type) { | 940 | switch (res->type) { |
| 942 | case IO: | 941 | case IO: |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index cfa92a984e62..56d8486dc167 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
| @@ -59,14 +59,12 @@ static bool debug; | |||
| 59 | #define DRIVER_DESC "PCI Hot Plug PCI Core" | 59 | #define DRIVER_DESC "PCI Hot Plug PCI Core" |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | ////////////////////////////////////////////////////////////////// | ||
| 63 | |||
| 64 | static LIST_HEAD(pci_hotplug_slot_list); | 62 | static LIST_HEAD(pci_hotplug_slot_list); |
| 65 | static DEFINE_MUTEX(pci_hp_mutex); | 63 | static DEFINE_MUTEX(pci_hp_mutex); |
| 66 | 64 | ||
| 67 | /* Weee, fun with macros... */ | 65 | /* Weee, fun with macros... */ |
| 68 | #define GET_STATUS(name,type) \ | 66 | #define GET_STATUS(name, type) \ |
| 69 | static int get_##name (struct hotplug_slot *slot, type *value) \ | 67 | static int get_##name(struct hotplug_slot *slot, type *value) \ |
| 70 | { \ | 68 | { \ |
| 71 | struct hotplug_slot_ops *ops = slot->ops; \ | 69 | struct hotplug_slot_ops *ops = slot->ops; \ |
| 72 | int retval = 0; \ | 70 | int retval = 0; \ |
| @@ -92,42 +90,41 @@ static ssize_t power_read_file(struct pci_slot *slot, char *buf) | |||
| 92 | 90 | ||
| 93 | retval = get_power_status(slot->hotplug, &value); | 91 | retval = get_power_status(slot->hotplug, &value); |
| 94 | if (retval) | 92 | if (retval) |
| 95 | goto exit; | 93 | return retval; |
| 96 | retval = sprintf (buf, "%d\n", value); | 94 | |
| 97 | exit: | 95 | return sprintf(buf, "%d\n", value); |
| 98 | return retval; | ||
| 99 | } | 96 | } |
| 100 | 97 | ||
| 101 | static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf, | 98 | static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf, |
| 102 | size_t count) | 99 | size_t count) |
| 103 | { | 100 | { |
| 104 | struct hotplug_slot *slot = pci_slot->hotplug; | 101 | struct hotplug_slot *slot = pci_slot->hotplug; |
| 105 | unsigned long lpower; | 102 | unsigned long lpower; |
| 106 | u8 power; | 103 | u8 power; |
| 107 | int retval = 0; | 104 | int retval = 0; |
| 108 | 105 | ||
| 109 | lpower = simple_strtoul (buf, NULL, 10); | 106 | lpower = simple_strtoul(buf, NULL, 10); |
| 110 | power = (u8)(lpower & 0xff); | 107 | power = (u8)(lpower & 0xff); |
| 111 | dbg ("power = %d\n", power); | 108 | dbg("power = %d\n", power); |
| 112 | 109 | ||
| 113 | if (!try_module_get(slot->ops->owner)) { | 110 | if (!try_module_get(slot->ops->owner)) { |
| 114 | retval = -ENODEV; | 111 | retval = -ENODEV; |
| 115 | goto exit; | 112 | goto exit; |
| 116 | } | 113 | } |
| 117 | switch (power) { | 114 | switch (power) { |
| 118 | case 0: | 115 | case 0: |
| 119 | if (slot->ops->disable_slot) | 116 | if (slot->ops->disable_slot) |
| 120 | retval = slot->ops->disable_slot(slot); | 117 | retval = slot->ops->disable_slot(slot); |
| 121 | break; | 118 | break; |
| 122 | 119 | ||
| 123 | case 1: | 120 | case 1: |
| 124 | if (slot->ops->enable_slot) | 121 | if (slot->ops->enable_slot) |
| 125 | retval = slot->ops->enable_slot(slot); | 122 | retval = slot->ops->enable_slot(slot); |
| 126 | break; | 123 | break; |
| 127 | 124 | ||
| 128 | default: | 125 | default: |
| 129 | err ("Illegal value specified for power\n"); | 126 | err("Illegal value specified for power\n"); |
| 130 | retval = -EINVAL; | 127 | retval = -EINVAL; |
| 131 | } | 128 | } |
| 132 | module_put(slot->ops->owner); | 129 | module_put(slot->ops->owner); |
| 133 | 130 | ||
| @@ -150,24 +147,22 @@ static ssize_t attention_read_file(struct pci_slot *slot, char *buf) | |||
| 150 | 147 | ||
| 151 | retval = get_attention_status(slot->hotplug, &value); | 148 | retval = get_attention_status(slot->hotplug, &value); |
| 152 | if (retval) | 149 | if (retval) |
| 153 | goto exit; | 150 | return retval; |
| 154 | retval = sprintf(buf, "%d\n", value); | ||
| 155 | 151 | ||
| 156 | exit: | 152 | return sprintf(buf, "%d\n", value); |
| 157 | return retval; | ||
| 158 | } | 153 | } |
| 159 | 154 | ||
| 160 | static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, | 155 | static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, |
| 161 | size_t count) | 156 | size_t count) |
| 162 | { | 157 | { |
| 163 | struct hotplug_slot_ops *ops = slot->hotplug->ops; | 158 | struct hotplug_slot_ops *ops = slot->hotplug->ops; |
| 164 | unsigned long lattention; | 159 | unsigned long lattention; |
| 165 | u8 attention; | 160 | u8 attention; |
| 166 | int retval = 0; | 161 | int retval = 0; |
| 167 | 162 | ||
| 168 | lattention = simple_strtoul (buf, NULL, 10); | 163 | lattention = simple_strtoul(buf, NULL, 10); |
| 169 | attention = (u8)(lattention & 0xff); | 164 | attention = (u8)(lattention & 0xff); |
| 170 | dbg (" - attention = %d\n", attention); | 165 | dbg(" - attention = %d\n", attention); |
| 171 | 166 | ||
| 172 | if (!try_module_get(ops->owner)) { | 167 | if (!try_module_get(ops->owner)) { |
| 173 | retval = -ENODEV; | 168 | retval = -ENODEV; |
| @@ -196,11 +191,9 @@ static ssize_t latch_read_file(struct pci_slot *slot, char *buf) | |||
| 196 | 191 | ||
| 197 | retval = get_latch_status(slot->hotplug, &value); | 192 | retval = get_latch_status(slot->hotplug, &value); |
| 198 | if (retval) | 193 | if (retval) |
| 199 | goto exit; | 194 | return retval; |
| 200 | retval = sprintf (buf, "%d\n", value); | ||
| 201 | 195 | ||
| 202 | exit: | 196 | return sprintf(buf, "%d\n", value); |
| 203 | return retval; | ||
| 204 | } | 197 | } |
| 205 | 198 | ||
| 206 | static struct pci_slot_attribute hotplug_slot_attr_latch = { | 199 | static struct pci_slot_attribute hotplug_slot_attr_latch = { |
| @@ -215,11 +208,9 @@ static ssize_t presence_read_file(struct pci_slot *slot, char *buf) | |||
| 215 | 208 | ||
| 216 | retval = get_adapter_status(slot->hotplug, &value); | 209 | retval = get_adapter_status(slot->hotplug, &value); |
| 217 | if (retval) | 210 | if (retval) |
| 218 | goto exit; | 211 | return retval; |
| 219 | retval = sprintf (buf, "%d\n", value); | ||
| 220 | 212 | ||
| 221 | exit: | 213 | return sprintf(buf, "%d\n", value); |
| 222 | return retval; | ||
| 223 | } | 214 | } |
| 224 | 215 | ||
| 225 | static struct pci_slot_attribute hotplug_slot_attr_presence = { | 216 | static struct pci_slot_attribute hotplug_slot_attr_presence = { |
| @@ -228,7 +219,7 @@ static struct pci_slot_attribute hotplug_slot_attr_presence = { | |||
| 228 | }; | 219 | }; |
| 229 | 220 | ||
| 230 | static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, | 221 | static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, |
| 231 | size_t count) | 222 | size_t count) |
| 232 | { | 223 | { |
| 233 | struct hotplug_slot *slot = pci_slot->hotplug; | 224 | struct hotplug_slot *slot = pci_slot->hotplug; |
| 234 | unsigned long ltest; | 225 | unsigned long ltest; |
| @@ -237,7 +228,7 @@ static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, | |||
| 237 | 228 | ||
| 238 | ltest = simple_strtoul (buf, NULL, 10); | 229 | ltest = simple_strtoul (buf, NULL, 10); |
| 239 | test = (u32)(ltest & 0xffffffff); | 230 | test = (u32)(ltest & 0xffffffff); |
| 240 | dbg ("test = %d\n", test); | 231 | dbg("test = %d\n", test); |
| 241 | 232 | ||
| 242 | if (!try_module_get(slot->ops->owner)) { | 233 | if (!try_module_get(slot->ops->owner)) { |
| 243 | retval = -ENODEV; | 234 | retval = -ENODEV; |
| @@ -261,6 +252,7 @@ static struct pci_slot_attribute hotplug_slot_attr_test = { | |||
| 261 | static bool has_power_file(struct pci_slot *pci_slot) | 252 | static bool has_power_file(struct pci_slot *pci_slot) |
| 262 | { | 253 | { |
| 263 | struct hotplug_slot *slot = pci_slot->hotplug; | 254 | struct hotplug_slot *slot = pci_slot->hotplug; |
| 255 | |||
| 264 | if ((!slot) || (!slot->ops)) | 256 | if ((!slot) || (!slot->ops)) |
| 265 | return false; | 257 | return false; |
| 266 | if ((slot->ops->enable_slot) || | 258 | if ((slot->ops->enable_slot) || |
| @@ -273,6 +265,7 @@ static bool has_power_file(struct pci_slot *pci_slot) | |||
| 273 | static bool has_attention_file(struct pci_slot *pci_slot) | 265 | static bool has_attention_file(struct pci_slot *pci_slot) |
| 274 | { | 266 | { |
| 275 | struct hotplug_slot *slot = pci_slot->hotplug; | 267 | struct hotplug_slot *slot = pci_slot->hotplug; |
| 268 | |||
| 276 | if ((!slot) || (!slot->ops)) | 269 | if ((!slot) || (!slot->ops)) |
| 277 | return false; | 270 | return false; |
| 278 | if ((slot->ops->set_attention_status) || | 271 | if ((slot->ops->set_attention_status) || |
| @@ -284,6 +277,7 @@ static bool has_attention_file(struct pci_slot *pci_slot) | |||
| 284 | static bool has_latch_file(struct pci_slot *pci_slot) | 277 | static bool has_latch_file(struct pci_slot *pci_slot) |
| 285 | { | 278 | { |
| 286 | struct hotplug_slot *slot = pci_slot->hotplug; | 279 | struct hotplug_slot *slot = pci_slot->hotplug; |
| 280 | |||
| 287 | if ((!slot) || (!slot->ops)) | 281 | if ((!slot) || (!slot->ops)) |
| 288 | return false; | 282 | return false; |
| 289 | if (slot->ops->get_latch_status) | 283 | if (slot->ops->get_latch_status) |
| @@ -294,6 +288,7 @@ static bool has_latch_file(struct pci_slot *pci_slot) | |||
| 294 | static bool has_adapter_file(struct pci_slot *pci_slot) | 288 | static bool has_adapter_file(struct pci_slot *pci_slot) |
| 295 | { | 289 | { |
| 296 | struct hotplug_slot *slot = pci_slot->hotplug; | 290 | struct hotplug_slot *slot = pci_slot->hotplug; |
| 291 | |||
| 297 | if ((!slot) || (!slot->ops)) | 292 | if ((!slot) || (!slot->ops)) |
| 298 | return false; | 293 | return false; |
| 299 | if (slot->ops->get_adapter_status) | 294 | if (slot->ops->get_adapter_status) |
| @@ -304,6 +299,7 @@ static bool has_adapter_file(struct pci_slot *pci_slot) | |||
| 304 | static bool has_test_file(struct pci_slot *pci_slot) | 299 | static bool has_test_file(struct pci_slot *pci_slot) |
| 305 | { | 300 | { |
| 306 | struct hotplug_slot *slot = pci_slot->hotplug; | 301 | struct hotplug_slot *slot = pci_slot->hotplug; |
| 302 | |||
| 307 | if ((!slot) || (!slot->ops)) | 303 | if ((!slot) || (!slot->ops)) |
| 308 | return false; | 304 | return false; |
| 309 | if (slot->ops->hardware_test) | 305 | if (slot->ops->hardware_test) |
| @@ -397,13 +393,13 @@ static void fs_remove_slot(struct pci_slot *slot) | |||
| 397 | pci_hp_remove_module_link(slot); | 393 | pci_hp_remove_module_link(slot); |
| 398 | } | 394 | } |
| 399 | 395 | ||
| 400 | static struct hotplug_slot *get_slot_from_name (const char *name) | 396 | static struct hotplug_slot *get_slot_from_name(const char *name) |
| 401 | { | 397 | { |
| 402 | struct hotplug_slot *slot; | 398 | struct hotplug_slot *slot; |
| 403 | struct list_head *tmp; | 399 | struct list_head *tmp; |
| 404 | 400 | ||
| 405 | list_for_each (tmp, &pci_hotplug_slot_list) { | 401 | list_for_each(tmp, &pci_hotplug_slot_list) { |
| 406 | slot = list_entry (tmp, struct hotplug_slot, slot_list); | 402 | slot = list_entry(tmp, struct hotplug_slot, slot_list); |
| 407 | if (strcmp(hotplug_slot_name(slot), name) == 0) | 403 | if (strcmp(hotplug_slot_name(slot), name) == 0) |
| 408 | return slot; | 404 | return slot; |
| 409 | } | 405 | } |
| @@ -436,8 +432,7 @@ int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, | |||
| 436 | if ((slot->info == NULL) || (slot->ops == NULL)) | 432 | if ((slot->info == NULL) || (slot->ops == NULL)) |
| 437 | return -EINVAL; | 433 | return -EINVAL; |
| 438 | if (slot->release == NULL) { | 434 | if (slot->release == NULL) { |
| 439 | dbg("Why are you trying to register a hotplug slot " | 435 | dbg("Why are you trying to register a hotplug slot without a proper release function?\n"); |
| 440 | "without a proper release function?\n"); | ||
| 441 | return -EINVAL; | 436 | return -EINVAL; |
| 442 | } | 437 | } |
| 443 | 438 | ||
| @@ -468,6 +463,7 @@ out: | |||
| 468 | mutex_unlock(&pci_hp_mutex); | 463 | mutex_unlock(&pci_hp_mutex); |
| 469 | return result; | 464 | return result; |
| 470 | } | 465 | } |
| 466 | EXPORT_SYMBOL_GPL(__pci_hp_register); | ||
| 471 | 467 | ||
| 472 | /** | 468 | /** |
| 473 | * 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 |
| @@ -506,6 +502,7 @@ int pci_hp_deregister(struct hotplug_slot *hotplug) | |||
| 506 | 502 | ||
| 507 | return 0; | 503 | return 0; |
| 508 | } | 504 | } |
| 505 | EXPORT_SYMBOL_GPL(pci_hp_deregister); | ||
| 509 | 506 | ||
| 510 | /** | 507 | /** |
| 511 | * 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 |
| @@ -527,24 +524,23 @@ int pci_hp_change_slot_info(struct hotplug_slot *hotplug, | |||
| 527 | 524 | ||
| 528 | return 0; | 525 | return 0; |
| 529 | } | 526 | } |
| 527 | EXPORT_SYMBOL_GPL(pci_hp_change_slot_info); | ||
| 530 | 528 | ||
| 531 | static int __init pci_hotplug_init (void) | 529 | static int __init pci_hotplug_init(void) |
| 532 | { | 530 | { |
| 533 | int result; | 531 | int result; |
| 534 | 532 | ||
| 535 | result = cpci_hotplug_init(debug); | 533 | result = cpci_hotplug_init(debug); |
| 536 | if (result) { | 534 | if (result) { |
| 537 | err ("cpci_hotplug_init with error %d\n", result); | 535 | err("cpci_hotplug_init with error %d\n", result); |
| 538 | goto err_cpci; | 536 | return result; |
| 539 | } | 537 | } |
| 540 | 538 | ||
| 541 | info (DRIVER_DESC " version: " DRIVER_VERSION "\n"); | 539 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
| 542 | |||
| 543 | err_cpci: | ||
| 544 | return result; | 540 | return result; |
| 545 | } | 541 | } |
| 546 | 542 | ||
| 547 | static void __exit pci_hotplug_exit (void) | 543 | static void __exit pci_hotplug_exit(void) |
| 548 | { | 544 | { |
| 549 | cpci_hotplug_exit(); | 545 | cpci_hotplug_exit(); |
| 550 | } | 546 | } |
| @@ -557,7 +553,3 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
| 557 | MODULE_LICENSE("GPL"); | 553 | MODULE_LICENSE("GPL"); |
| 558 | module_param(debug, bool, 0644); | 554 | module_param(debug, bool, 0644); |
| 559 | MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); | 555 | MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); |
| 560 | |||
| 561 | EXPORT_SYMBOL_GPL(__pci_hp_register); | ||
| 562 | EXPORT_SYMBOL_GPL(pci_hp_deregister); | ||
| 563 | EXPORT_SYMBOL_GPL(pci_hp_change_slot_info); | ||
diff --git a/drivers/pci/hotplug/pciehp_acpi.c b/drivers/pci/hotplug/pciehp_acpi.c index 20fea57d2149..93cc9266e8cb 100644 --- a/drivers/pci/hotplug/pciehp_acpi.c +++ b/drivers/pci/hotplug/pciehp_acpi.c | |||
| @@ -103,10 +103,10 @@ static int __init dummy_probe(struct pcie_device *dev) | |||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | static struct pcie_port_service_driver __initdata dummy_driver = { | 105 | static struct pcie_port_service_driver __initdata dummy_driver = { |
| 106 | .name = "pciehp_dummy", | 106 | .name = "pciehp_dummy", |
| 107 | .port_type = PCIE_ANY_PORT, | 107 | .port_type = PCIE_ANY_PORT, |
| 108 | .service = PCIE_PORT_SERVICE_HP, | 108 | .service = PCIE_PORT_SERVICE_HP, |
| 109 | .probe = dummy_probe, | 109 | .probe = dummy_probe, |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | static int __init select_detection_mode(void) | 112 | static int __init select_detection_mode(void) |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 0e0a2fff20a3..a2297db80813 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
| @@ -266,8 +266,7 @@ static int pciehp_probe(struct pcie_device *dev) | |||
| 266 | rc = init_slot(ctrl); | 266 | rc = init_slot(ctrl); |
| 267 | if (rc) { | 267 | if (rc) { |
| 268 | if (rc == -EBUSY) | 268 | if (rc == -EBUSY) |
| 269 | ctrl_warn(ctrl, "Slot already registered by another " | 269 | ctrl_warn(ctrl, "Slot already registered by another hotplug driver\n"); |
| 270 | "hotplug driver\n"); | ||
| 271 | else | 270 | else |
| 272 | ctrl_err(ctrl, "Slot initialization failed\n"); | 271 | ctrl_err(ctrl, "Slot initialization failed\n"); |
| 273 | goto err_out_release_ctlr; | 272 | goto err_out_release_ctlr; |
| @@ -312,12 +311,12 @@ static void pciehp_remove(struct pcie_device *dev) | |||
| 312 | } | 311 | } |
| 313 | 312 | ||
| 314 | #ifdef CONFIG_PM | 313 | #ifdef CONFIG_PM |
| 315 | static int pciehp_suspend (struct pcie_device *dev) | 314 | static int pciehp_suspend(struct pcie_device *dev) |
| 316 | { | 315 | { |
| 317 | return 0; | 316 | return 0; |
| 318 | } | 317 | } |
| 319 | 318 | ||
| 320 | static int pciehp_resume (struct pcie_device *dev) | 319 | static int pciehp_resume(struct pcie_device *dev) |
| 321 | { | 320 | { |
| 322 | struct controller *ctrl; | 321 | struct controller *ctrl; |
| 323 | struct slot *slot; | 322 | struct slot *slot; |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index c75e6a678dcc..ff32e85e1de6 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
| @@ -175,7 +175,7 @@ void pciehp_handle_linkstate_change(struct slot *p_slot) | |||
| 175 | hotplug controller logic | 175 | hotplug controller logic |
| 176 | */ | 176 | */ |
| 177 | 177 | ||
| 178 | static void set_slot_off(struct controller *ctrl, struct slot * pslot) | 178 | static void set_slot_off(struct controller *ctrl, struct slot *pslot) |
| 179 | { | 179 | { |
| 180 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ | 180 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ |
| 181 | if (POWER_CTRL(ctrl)) { | 181 | if (POWER_CTRL(ctrl)) { |
| @@ -376,14 +376,12 @@ static void handle_button_press_event(struct slot *p_slot) | |||
| 376 | pciehp_get_power_status(p_slot, &getstatus); | 376 | pciehp_get_power_status(p_slot, &getstatus); |
| 377 | if (getstatus) { | 377 | if (getstatus) { |
| 378 | p_slot->state = BLINKINGOFF_STATE; | 378 | p_slot->state = BLINKINGOFF_STATE; |
| 379 | ctrl_info(ctrl, | 379 | ctrl_info(ctrl, "PCI slot #%s - powering off due to button press\n", |
| 380 | "PCI slot #%s - powering off due to button " | 380 | slot_name(p_slot)); |
| 381 | "press.\n", slot_name(p_slot)); | ||
| 382 | } else { | 381 | } else { |
| 383 | p_slot->state = BLINKINGON_STATE; | 382 | p_slot->state = BLINKINGON_STATE; |
| 384 | ctrl_info(ctrl, | 383 | ctrl_info(ctrl, "PCI slot #%s - powering on due to button press\n", |
| 385 | "PCI slot #%s - powering on due to button " | 384 | slot_name(p_slot)); |
| 386 | "press.\n", slot_name(p_slot)); | ||
| 387 | } | 385 | } |
| 388 | /* blink green LED and turn off amber */ | 386 | /* blink green LED and turn off amber */ |
| 389 | pciehp_green_led_blink(p_slot); | 387 | pciehp_green_led_blink(p_slot); |
| @@ -404,8 +402,8 @@ static void handle_button_press_event(struct slot *p_slot) | |||
| 404 | else | 402 | else |
| 405 | pciehp_green_led_off(p_slot); | 403 | pciehp_green_led_off(p_slot); |
| 406 | pciehp_set_attention_status(p_slot, 0); | 404 | pciehp_set_attention_status(p_slot, 0); |
| 407 | ctrl_info(ctrl, "PCI slot #%s - action canceled " | 405 | ctrl_info(ctrl, "PCI slot #%s - action canceled due to button press\n", |
| 408 | "due to button press\n", slot_name(p_slot)); | 406 | slot_name(p_slot)); |
| 409 | p_slot->state = STATIC_STATE; | 407 | p_slot->state = STATIC_STATE; |
| 410 | break; | 408 | break; |
| 411 | case POWEROFF_STATE: | 409 | case POWEROFF_STATE: |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 1463412cf7f8..42914e04d110 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
| @@ -174,12 +174,10 @@ static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
| 174 | * event even though it supports none of power | 174 | * event even though it supports none of power |
| 175 | * controller, attention led, power led and EMI. | 175 | * controller, attention led, power led and EMI. |
| 176 | */ | 176 | */ |
| 177 | ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to " | 177 | ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to wait for command completed event\n"); |
| 178 | "wait for command completed event.\n"); | ||
| 179 | ctrl->no_cmd_complete = 0; | 178 | ctrl->no_cmd_complete = 0; |
| 180 | } else { | 179 | } else { |
| 181 | ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe " | 180 | ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe the controller is broken\n"); |
| 182 | "the controller is broken.\n"); | ||
| 183 | } | 181 | } |
| 184 | } | 182 | } |
| 185 | 183 | ||
| @@ -203,7 +201,7 @@ static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
| 203 | if (!(slot_ctrl & PCI_EXP_SLTCTL_HPIE) || | 201 | if (!(slot_ctrl & PCI_EXP_SLTCTL_HPIE) || |
| 204 | !(slot_ctrl & PCI_EXP_SLTCTL_CCIE)) | 202 | !(slot_ctrl & PCI_EXP_SLTCTL_CCIE)) |
| 205 | poll = 1; | 203 | poll = 1; |
| 206 | pcie_wait_cmd(ctrl, poll); | 204 | pcie_wait_cmd(ctrl, poll); |
| 207 | } | 205 | } |
| 208 | mutex_unlock(&ctrl->ctrl_lock); | 206 | mutex_unlock(&ctrl->ctrl_lock); |
| 209 | } | 207 | } |
| @@ -276,15 +274,15 @@ int pciehp_check_link_status(struct controller *ctrl) | |||
| 276 | bool found; | 274 | bool found; |
| 277 | u16 lnk_status; | 275 | u16 lnk_status; |
| 278 | 276 | ||
| 279 | /* | 277 | /* |
| 280 | * Data Link Layer Link Active Reporting must be capable for | 278 | * Data Link Layer Link Active Reporting must be capable for |
| 281 | * hot-plug capable downstream port. But old controller might | 279 | * hot-plug capable downstream port. But old controller might |
| 282 | * not implement it. In this case, we wait for 1000 ms. | 280 | * not implement it. In this case, we wait for 1000 ms. |
| 283 | */ | 281 | */ |
| 284 | if (ctrl->link_active_reporting) | 282 | if (ctrl->link_active_reporting) |
| 285 | pcie_wait_link_active(ctrl); | 283 | pcie_wait_link_active(ctrl); |
| 286 | else | 284 | else |
| 287 | msleep(1000); | 285 | msleep(1000); |
| 288 | 286 | ||
| 289 | /* wait 100ms before read pci conf, and try in 1s */ | 287 | /* wait 100ms before read pci conf, and try in 1s */ |
| 290 | msleep(100); | 288 | msleep(100); |
| @@ -295,7 +293,7 @@ int pciehp_check_link_status(struct controller *ctrl) | |||
| 295 | ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); | 293 | ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); |
| 296 | if ((lnk_status & PCI_EXP_LNKSTA_LT) || | 294 | if ((lnk_status & PCI_EXP_LNKSTA_LT) || |
| 297 | !(lnk_status & PCI_EXP_LNKSTA_NLW)) { | 295 | !(lnk_status & PCI_EXP_LNKSTA_NLW)) { |
| 298 | ctrl_err(ctrl, "Link Training Error occurs \n"); | 296 | ctrl_err(ctrl, "Link Training Error occurs\n"); |
| 299 | return -1; | 297 | return -1; |
| 300 | } | 298 | } |
| 301 | 299 | ||
| @@ -414,7 +412,7 @@ void pciehp_set_attention_status(struct slot *slot, u8 value) | |||
| 414 | return; | 412 | return; |
| 415 | 413 | ||
| 416 | switch (value) { | 414 | switch (value) { |
| 417 | case 0 : /* turn off */ | 415 | case 0: /* turn off */ |
| 418 | slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF; | 416 | slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF; |
| 419 | break; | 417 | break; |
| 420 | case 1: /* turn on */ | 418 | case 1: /* turn on */ |
| @@ -470,7 +468,7 @@ void pciehp_green_led_blink(struct slot *slot) | |||
| 470 | PCI_EXP_SLTCTL_PWR_IND_BLINK); | 468 | PCI_EXP_SLTCTL_PWR_IND_BLINK); |
| 471 | } | 469 | } |
| 472 | 470 | ||
| 473 | int pciehp_power_on_slot(struct slot * slot) | 471 | int pciehp_power_on_slot(struct slot *slot) |
| 474 | { | 472 | { |
| 475 | struct controller *ctrl = slot->ctrl; | 473 | struct controller *ctrl = slot->ctrl; |
| 476 | struct pci_dev *pdev = ctrl_dev(ctrl); | 474 | struct pci_dev *pdev = ctrl_dev(ctrl); |
| @@ -496,7 +494,7 @@ int pciehp_power_on_slot(struct slot * slot) | |||
| 496 | return retval; | 494 | return retval; |
| 497 | } | 495 | } |
| 498 | 496 | ||
| 499 | void pciehp_power_off_slot(struct slot * slot) | 497 | void pciehp_power_off_slot(struct slot *slot) |
| 500 | { | 498 | { |
| 501 | struct controller *ctrl = slot->ctrl; | 499 | struct controller *ctrl = slot->ctrl; |
| 502 | 500 | ||
| @@ -756,7 +754,7 @@ static inline void dbg_ctrl(struct controller *ctrl) | |||
| 756 | ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16); | 754 | ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16); |
| 757 | } | 755 | } |
| 758 | 756 | ||
| 759 | #define FLAG(x,y) (((x) & (y)) ? '+' : '-') | 757 | #define FLAG(x, y) (((x) & (y)) ? '+' : '-') |
| 760 | 758 | ||
| 761 | struct controller *pcie_init(struct pcie_device *dev) | 759 | struct controller *pcie_init(struct pcie_device *dev) |
| 762 | { | 760 | { |
| @@ -783,14 +781,14 @@ struct controller *pcie_init(struct pcie_device *dev) | |||
| 783 | */ | 781 | */ |
| 784 | if (NO_CMD_CMPL(ctrl) || | 782 | if (NO_CMD_CMPL(ctrl) || |
| 785 | !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl))) | 783 | !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl))) |
| 786 | ctrl->no_cmd_complete = 1; | 784 | ctrl->no_cmd_complete = 1; |
| 787 | 785 | ||
| 788 | /* Check if Data Link Layer Link Active Reporting is implemented */ | 786 | /* Check if Data Link Layer Link Active Reporting is implemented */ |
| 789 | pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap); | 787 | pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap); |
| 790 | if (link_cap & PCI_EXP_LNKCAP_DLLLARC) { | 788 | if (link_cap & PCI_EXP_LNKCAP_DLLLARC) { |
| 791 | ctrl_dbg(ctrl, "Link Active Reporting supported\n"); | 789 | ctrl_dbg(ctrl, "Link Active Reporting supported\n"); |
| 792 | ctrl->link_active_reporting = 1; | 790 | ctrl->link_active_reporting = 1; |
| 793 | } | 791 | } |
| 794 | 792 | ||
| 795 | /* Clear all remaining event bits in Slot Status register */ | 793 | /* Clear all remaining event bits in Slot Status register */ |
| 796 | pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, | 794 | pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index b6cb1df67097..5f871f4c4af1 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
| @@ -46,9 +46,8 @@ int pciehp_configure_device(struct slot *p_slot) | |||
| 46 | 46 | ||
| 47 | dev = pci_get_slot(parent, PCI_DEVFN(0, 0)); | 47 | dev = pci_get_slot(parent, PCI_DEVFN(0, 0)); |
| 48 | if (dev) { | 48 | if (dev) { |
| 49 | ctrl_err(ctrl, "Device %s already exists " | 49 | ctrl_err(ctrl, "Device %s already exists at %04x:%02x:00, cannot hot-add\n", |
| 50 | "at %04x:%02x:00, cannot hot-add\n", pci_name(dev), | 50 | pci_name(dev), pci_domain_nr(parent), parent->number); |
| 51 | pci_domain_nr(parent), parent->number); | ||
| 52 | pci_dev_put(dev); | 51 | pci_dev_put(dev); |
| 53 | ret = -EEXIST; | 52 | ret = -EEXIST; |
| 54 | goto out; | 53 | goto out; |
diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c index ac69094e4b20..d062c008fc95 100644 --- a/drivers/pci/hotplug/pcihp_skeleton.c +++ b/drivers/pci/hotplug/pcihp_skeleton.c | |||
| @@ -51,7 +51,7 @@ static LIST_HEAD(slot_list); | |||
| 51 | #define dbg(format, arg...) \ | 51 | #define dbg(format, arg...) \ |
| 52 | do { \ | 52 | do { \ |
| 53 | if (debug) \ | 53 | if (debug) \ |
| 54 | printk (KERN_DEBUG "%s: " format "\n", \ | 54 | printk(KERN_DEBUG "%s: " format "\n", \ |
| 55 | MY_NAME , ## arg); \ | 55 | MY_NAME , ## arg); \ |
| 56 | } while (0) | 56 | } while (0) |
| 57 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) | 57 | #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) |
| @@ -128,18 +128,18 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | |||
| 128 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 128 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
| 129 | 129 | ||
| 130 | switch (status) { | 130 | switch (status) { |
| 131 | case 0: | 131 | case 0: |
| 132 | /* | 132 | /* |
| 133 | * Fill in code here to turn light off | 133 | * Fill in code here to turn light off |
| 134 | */ | 134 | */ |
| 135 | break; | 135 | break; |
| 136 | 136 | ||
| 137 | case 1: | 137 | case 1: |
| 138 | default: | 138 | default: |
| 139 | /* | 139 | /* |
| 140 | * Fill in code here to turn light on | 140 | * Fill in code here to turn light on |
| 141 | */ | 141 | */ |
| 142 | break; | 142 | break; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | return retval; | 145 | return retval; |
| @@ -153,12 +153,12 @@ static int hardware_test(struct hotplug_slot *hotplug_slot, u32 value) | |||
| 153 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 153 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); |
| 154 | 154 | ||
| 155 | switch (value) { | 155 | switch (value) { |
| 156 | case 0: | 156 | case 0: |
| 157 | /* Specify a test here */ | 157 | /* Specify a test here */ |
| 158 | break; | 158 | break; |
| 159 | case 1: | 159 | case 1: |
| 160 | /* Specify another test here */ | 160 | /* Specify another test here */ |
| 161 | break; | 161 | break; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | return retval; | 164 | return retval; |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 984d708552f6..93aa29f6d39c 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | 39 | ||
| 40 | bool rpaphp_debug; | 40 | bool rpaphp_debug; |
| 41 | LIST_HEAD(rpaphp_slot_head); | 41 | LIST_HEAD(rpaphp_slot_head); |
| 42 | EXPORT_SYMBOL_GPL(rpaphp_slot_head); | ||
| 42 | 43 | ||
| 43 | #define DRIVER_VERSION "0.1" | 44 | #define DRIVER_VERSION "0.1" |
| 44 | #define DRIVER_AUTHOR "Linda Xie <lxie@us.ibm.com>" | 45 | #define DRIVER_AUTHOR "Linda Xie <lxie@us.ibm.com>" |
| @@ -88,7 +89,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) | |||
| 88 | * @hotplug_slot: slot to get status | 89 | * @hotplug_slot: slot to get status |
| 89 | * @value: pointer to store status | 90 | * @value: pointer to store status |
| 90 | */ | 91 | */ |
| 91 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | 92 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 92 | { | 93 | { |
| 93 | int retval, level; | 94 | int retval, level; |
| 94 | struct slot *slot = (struct slot *)hotplug_slot->private; | 95 | struct slot *slot = (struct slot *)hotplug_slot->private; |
| @@ -104,14 +105,14 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | |||
| 104 | * @hotplug_slot: slot to get status | 105 | * @hotplug_slot: slot to get status |
| 105 | * @value: pointer to store status | 106 | * @value: pointer to store status |
| 106 | */ | 107 | */ |
| 107 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) | 108 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 108 | { | 109 | { |
| 109 | struct slot *slot = (struct slot *)hotplug_slot->private; | 110 | struct slot *slot = (struct slot *)hotplug_slot->private; |
| 110 | *value = slot->hotplug_slot->info->attention_status; | 111 | *value = slot->hotplug_slot->info->attention_status; |
| 111 | return 0; | 112 | return 0; |
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) | 115 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
| 115 | { | 116 | { |
| 116 | struct slot *slot = (struct slot *)hotplug_slot->private; | 117 | struct slot *slot = (struct slot *)hotplug_slot->private; |
| 117 | int rc, state; | 118 | int rc, state; |
| @@ -241,6 +242,7 @@ int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, | |||
| 241 | 242 | ||
| 242 | return -EINVAL; | 243 | return -EINVAL; |
| 243 | } | 244 | } |
| 245 | EXPORT_SYMBOL_GPL(rpaphp_get_drc_props); | ||
| 244 | 246 | ||
| 245 | static int is_php_type(char *drc_type) | 247 | static int is_php_type(char *drc_type) |
| 246 | { | 248 | { |
| @@ -350,6 +352,7 @@ int rpaphp_add_slot(struct device_node *dn) | |||
| 350 | /* XXX FIXME: reports a failure only if last entry in loop failed */ | 352 | /* XXX FIXME: reports a failure only if last entry in loop failed */ |
| 351 | return retval; | 353 | return retval; |
| 352 | } | 354 | } |
| 355 | EXPORT_SYMBOL_GPL(rpaphp_add_slot); | ||
| 353 | 356 | ||
| 354 | static void __exit cleanup_slots(void) | 357 | static void __exit cleanup_slots(void) |
| 355 | { | 358 | { |
| @@ -443,7 +446,3 @@ struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { | |||
| 443 | 446 | ||
| 444 | module_init(rpaphp_init); | 447 | module_init(rpaphp_init); |
| 445 | module_exit(rpaphp_exit); | 448 | module_exit(rpaphp_exit); |
| 446 | |||
| 447 | EXPORT_SYMBOL_GPL(rpaphp_add_slot); | ||
| 448 | EXPORT_SYMBOL_GPL(rpaphp_slot_head); | ||
| 449 | EXPORT_SYMBOL_GPL(rpaphp_get_drc_props); | ||
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index 613043f7576f..bada20999870 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
| @@ -188,7 +188,7 @@ static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot, | |||
| 188 | return 0; | 188 | return 0; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static struct hotplug_slot * sn_hp_destroy(void) | 191 | static struct hotplug_slot *sn_hp_destroy(void) |
| 192 | { | 192 | { |
| 193 | struct slot *slot; | 193 | struct slot *slot; |
| 194 | struct pci_slot *pci_slot; | 194 | struct pci_slot *pci_slot; |
| @@ -250,15 +250,13 @@ static int sn_slot_enable(struct hotplug_slot *bss_hotplug_slot, | |||
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | if (rc == PCI_L1_ERR) { | 252 | if (rc == PCI_L1_ERR) { |
| 253 | dev_dbg(&slot->pci_bus->self->dev, | 253 | dev_dbg(&slot->pci_bus->self->dev, "L1 failure %d with message: %s", |
| 254 | "L1 failure %d with message: %s", | ||
| 255 | resp.resp_sub_errno, resp.resp_l1_msg); | 254 | resp.resp_sub_errno, resp.resp_l1_msg); |
| 256 | return -EPERM; | 255 | return -EPERM; |
| 257 | } | 256 | } |
| 258 | 257 | ||
| 259 | if (rc) { | 258 | if (rc) { |
| 260 | dev_dbg(&slot->pci_bus->self->dev, | 259 | dev_dbg(&slot->pci_bus->self->dev, "insert failed with error %d sub-error %d\n", |
| 261 | "insert failed with error %d sub-error %d\n", | ||
| 262 | rc, resp.resp_sub_errno); | 260 | rc, resp.resp_sub_errno); |
| 263 | return -EIO; | 261 | return -EIO; |
| 264 | } | 262 | } |
| @@ -288,21 +286,18 @@ static int sn_slot_disable(struct hotplug_slot *bss_hotplug_slot, | |||
| 288 | } | 286 | } |
| 289 | 287 | ||
| 290 | if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_EMPTY_33MHZ)) { | 288 | if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_EMPTY_33MHZ)) { |
| 291 | dev_dbg(&slot->pci_bus->self->dev, | 289 | dev_dbg(&slot->pci_bus->self->dev, "Cannot remove last 33MHz card\n"); |
| 292 | "Cannot remove last 33MHz card\n"); | ||
| 293 | return -EPERM; | 290 | return -EPERM; |
| 294 | } | 291 | } |
| 295 | 292 | ||
| 296 | if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_L1_ERR)) { | 293 | if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_L1_ERR)) { |
| 297 | dev_dbg(&slot->pci_bus->self->dev, | 294 | dev_dbg(&slot->pci_bus->self->dev, "L1 failure %d with message \n%s\n", |
| 298 | "L1 failure %d with message \n%s\n", | ||
| 299 | resp.resp_sub_errno, resp.resp_l1_msg); | 295 | resp.resp_sub_errno, resp.resp_l1_msg); |
| 300 | return -EPERM; | 296 | return -EPERM; |
| 301 | } | 297 | } |
| 302 | 298 | ||
| 303 | if ((action == PCI_REQ_SLOT_ELIGIBLE) && rc) { | 299 | if ((action == PCI_REQ_SLOT_ELIGIBLE) && rc) { |
| 304 | dev_dbg(&slot->pci_bus->self->dev, | 300 | dev_dbg(&slot->pci_bus->self->dev, "remove failed with error %d sub-error %d\n", |
| 305 | "remove failed with error %d sub-error %d\n", | ||
| 306 | rc, resp.resp_sub_errno); | 301 | rc, resp.resp_sub_errno); |
| 307 | return -EIO; | 302 | return -EIO; |
| 308 | } | 303 | } |
| @@ -417,8 +412,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
| 417 | phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion); | 412 | phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion); |
| 418 | 413 | ||
| 419 | if (acpi_bus_get_device(phandle, &pdevice)) { | 414 | if (acpi_bus_get_device(phandle, &pdevice)) { |
| 420 | dev_dbg(&slot->pci_bus->self->dev, | 415 | dev_dbg(&slot->pci_bus->self->dev, "no parent device, assuming NULL\n"); |
| 421 | "no parent device, assuming NULL\n"); | ||
| 422 | pdevice = NULL; | 416 | pdevice = NULL; |
| 423 | } | 417 | } |
| 424 | 418 | ||
| @@ -447,10 +441,8 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
| 447 | 441 | ||
| 448 | ret = acpi_bus_scan(chandle); | 442 | ret = acpi_bus_scan(chandle); |
| 449 | if (ACPI_FAILURE(ret)) { | 443 | if (ACPI_FAILURE(ret)) { |
| 450 | printk(KERN_ERR "%s: acpi_bus_scan " | 444 | printk(KERN_ERR "%s: acpi_bus_scan failed (0x%x) for slot %d func %d\n", |
| 451 | "failed (0x%x) for slot %d " | 445 | __func__, ret, (int)(adr>>16), |
| 452 | "func %d\n", __func__, | ||
| 453 | ret, (int)(adr>>16), | ||
| 454 | (int)(adr&0xffff)); | 446 | (int)(adr&0xffff)); |
| 455 | /* try to continue on */ | 447 | /* try to continue on */ |
| 456 | } | 448 | } |
| @@ -471,11 +463,9 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
| 471 | mutex_unlock(&sn_hotplug_mutex); | 463 | mutex_unlock(&sn_hotplug_mutex); |
| 472 | 464 | ||
| 473 | if (rc == 0) | 465 | if (rc == 0) |
| 474 | dev_dbg(&slot->pci_bus->self->dev, | 466 | dev_dbg(&slot->pci_bus->self->dev, "insert operation successful\n"); |
| 475 | "insert operation successful\n"); | ||
| 476 | else | 467 | else |
| 477 | dev_dbg(&slot->pci_bus->self->dev, | 468 | dev_dbg(&slot->pci_bus->self->dev, "insert operation failed rc = %d\n", rc); |
| 478 | "insert operation failed rc = %d\n", rc); | ||
| 479 | 469 | ||
| 480 | return rc; | 470 | return rc; |
| 481 | } | 471 | } |
| @@ -561,8 +551,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
| 561 | acpi_status ret; | 551 | acpi_status ret; |
| 562 | ret = acpi_unload_table_id(ssdt_id); | 552 | ret = acpi_unload_table_id(ssdt_id); |
| 563 | if (ACPI_FAILURE(ret)) { | 553 | if (ACPI_FAILURE(ret)) { |
| 564 | printk(KERN_ERR "%s: acpi_unload_table_id " | 554 | printk(KERN_ERR "%s: acpi_unload_table_id failed (0x%x) for id %d\n", |
| 565 | "failed (0x%x) for id %d\n", | ||
| 566 | __func__, ret, ssdt_id); | 555 | __func__, ret, ssdt_id); |
| 567 | /* try to continue on */ | 556 | /* try to continue on */ |
| 568 | } | 557 | } |
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index 61529097464d..5897d516427b 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
| @@ -180,7 +180,7 @@ int shpchp_configure_device(struct slot *p_slot); | |||
| 180 | int shpchp_unconfigure_device(struct slot *p_slot); | 180 | int shpchp_unconfigure_device(struct slot *p_slot); |
| 181 | void cleanup_slots(struct controller *ctrl); | 181 | void cleanup_slots(struct controller *ctrl); |
| 182 | void shpchp_queue_pushbutton_work(struct work_struct *work); | 182 | void shpchp_queue_pushbutton_work(struct work_struct *work); |
| 183 | int shpc_init( struct controller *ctrl, struct pci_dev *pdev); | 183 | int shpc_init(struct controller *ctrl, struct pci_dev *pdev); |
| 184 | 184 | ||
| 185 | static inline const char *slot_name(struct slot *slot) | 185 | static inline const char *slot_name(struct slot *slot) |
| 186 | { | 186 | { |
| @@ -295,7 +295,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) | |||
| 295 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); | 295 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); |
| 296 | } | 296 | } |
| 297 | /* restore MiscII register */ | 297 | /* restore MiscII register */ |
| 298 | pci_read_config_dword( p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp ); | 298 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp ); |
| 299 | 299 | ||
| 300 | if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK) | 300 | if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK) |
| 301 | pcix_misc2_temp |= SERRFATALENABLE_MASK; | 301 | pcix_misc2_temp |= SERRFATALENABLE_MASK; |
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index faf13abd5b99..294ef4b10cf1 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
| @@ -143,8 +143,7 @@ static int init_slots(struct controller *ctrl) | |||
| 143 | snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); | 143 | snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); |
| 144 | hotplug_slot->ops = &shpchp_hotplug_slot_ops; | 144 | hotplug_slot->ops = &shpchp_hotplug_slot_ops; |
| 145 | 145 | ||
| 146 | ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " | 146 | ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x hp_slot=%x sun=%x slot_device_offset=%x\n", |
| 147 | "hp_slot=%x sun=%x slot_device_offset=%x\n", | ||
| 148 | pci_domain_nr(ctrl->pci_dev->subordinate), | 147 | pci_domain_nr(ctrl->pci_dev->subordinate), |
| 149 | slot->bus, slot->device, slot->hp_slot, slot->number, | 148 | slot->bus, slot->device, slot->hp_slot, slot->number, |
| 150 | ctrl->slot_device_offset); | 149 | ctrl->slot_device_offset); |
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index 6efc2ec5e4db..a81fb67ea9a1 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c | |||
| @@ -162,7 +162,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl) | |||
| 162 | 162 | ||
| 163 | p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 163 | p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
| 164 | 164 | ||
| 165 | if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { | 165 | if (!(p_slot->hpc_ops->query_power_fault(p_slot))) { |
| 166 | /* | 166 | /* |
| 167 | * Power fault Cleared | 167 | * Power fault Cleared |
| 168 | */ | 168 | */ |
| @@ -196,8 +196,8 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, | |||
| 196 | 196 | ||
| 197 | ctrl_dbg(ctrl, "Change speed to %d\n", speed); | 197 | ctrl_dbg(ctrl, "Change speed to %d\n", speed); |
| 198 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { | 198 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { |
| 199 | ctrl_err(ctrl, "%s: Issue of set bus speed mode command " | 199 | ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", |
| 200 | "failed\n", __func__); | 200 | __func__); |
| 201 | return WRONG_BUS_FREQUENCY; | 201 | return WRONG_BUS_FREQUENCY; |
| 202 | } | 202 | } |
| 203 | return rc; | 203 | return rc; |
| @@ -215,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot, | |||
| 215 | */ | 215 | */ |
| 216 | if (flag) { | 216 | if (flag) { |
| 217 | if (asp < bsp) { | 217 | if (asp < bsp) { |
| 218 | ctrl_err(ctrl, "Speed of bus %x and adapter %x " | 218 | ctrl_err(ctrl, "Speed of bus %x and adapter %x mismatch\n", |
| 219 | "mismatch\n", bsp, asp); | 219 | bsp, asp); |
| 220 | rc = WRONG_BUS_FREQUENCY; | 220 | rc = WRONG_BUS_FREQUENCY; |
| 221 | } | 221 | } |
| 222 | return rc; | 222 | return rc; |
| @@ -250,8 +250,7 @@ static int board_added(struct slot *p_slot) | |||
| 250 | 250 | ||
| 251 | hp_slot = p_slot->device - ctrl->slot_device_offset; | 251 | hp_slot = p_slot->device - ctrl->slot_device_offset; |
| 252 | 252 | ||
| 253 | ctrl_dbg(ctrl, | 253 | ctrl_dbg(ctrl, "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", |
| 254 | "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", | ||
| 255 | __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); | 254 | __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); |
| 256 | 255 | ||
| 257 | /* Power on slot without connecting to bus */ | 256 | /* Power on slot without connecting to bus */ |
| @@ -263,8 +262,8 @@ static int board_added(struct slot *p_slot) | |||
| 263 | 262 | ||
| 264 | if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) { | 263 | if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) { |
| 265 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { | 264 | if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { |
| 266 | ctrl_err(ctrl, "%s: Issue of set bus speed mode command" | 265 | ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", |
| 267 | " failed\n", __func__); | 266 | __func__); |
| 268 | return WRONG_BUS_FREQUENCY; | 267 | return WRONG_BUS_FREQUENCY; |
| 269 | } | 268 | } |
| 270 | 269 | ||
| @@ -277,8 +276,7 @@ static int board_added(struct slot *p_slot) | |||
| 277 | 276 | ||
| 278 | rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); | 277 | rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); |
| 279 | if (rc) { | 278 | if (rc) { |
| 280 | ctrl_err(ctrl, "Can't get adapter speed or " | 279 | ctrl_err(ctrl, "Can't get adapter speed or bus mode mismatch\n"); |
| 281 | "bus mode mismatch\n"); | ||
| 282 | return WRONG_BUS_FREQUENCY; | 280 | return WRONG_BUS_FREQUENCY; |
| 283 | } | 281 | } |
| 284 | 282 | ||
| @@ -289,8 +287,8 @@ static int board_added(struct slot *p_slot) | |||
| 289 | if (!list_empty(&ctrl->pci_dev->subordinate->devices)) | 287 | if (!list_empty(&ctrl->pci_dev->subordinate->devices)) |
| 290 | slots_not_empty = 1; | 288 | slots_not_empty = 1; |
| 291 | 289 | ||
| 292 | ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d," | 290 | ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, max_bus_speed %d\n", |
| 293 | " max_bus_speed %d\n", __func__, slots_not_empty, asp, | 291 | __func__, slots_not_empty, asp, |
| 294 | bsp, msp); | 292 | bsp, msp); |
| 295 | 293 | ||
| 296 | rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); | 294 | rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); |
| @@ -490,12 +488,12 @@ static void handle_button_press_event(struct slot *p_slot) | |||
| 490 | p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 488 | p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
| 491 | if (getstatus) { | 489 | if (getstatus) { |
| 492 | p_slot->state = BLINKINGOFF_STATE; | 490 | p_slot->state = BLINKINGOFF_STATE; |
| 493 | ctrl_info(ctrl, "PCI slot #%s - powering off due to " | 491 | ctrl_info(ctrl, "PCI slot #%s - powering off due to button press\n", |
| 494 | "button press.\n", slot_name(p_slot)); | 492 | slot_name(p_slot)); |
| 495 | } else { | 493 | } else { |
| 496 | p_slot->state = BLINKINGON_STATE; | 494 | p_slot->state = BLINKINGON_STATE; |
| 497 | ctrl_info(ctrl, "PCI slot #%s - powering on due to " | 495 | ctrl_info(ctrl, "PCI slot #%s - powering on due to button press\n", |
| 498 | "button press.\n", slot_name(p_slot)); | 496 | slot_name(p_slot)); |
| 499 | } | 497 | } |
| 500 | /* blink green LED and turn off amber */ | 498 | /* blink green LED and turn off amber */ |
| 501 | p_slot->hpc_ops->green_led_blink(p_slot); | 499 | p_slot->hpc_ops->green_led_blink(p_slot); |
| @@ -518,8 +516,8 @@ static void handle_button_press_event(struct slot *p_slot) | |||
| 518 | else | 516 | else |
| 519 | p_slot->hpc_ops->green_led_off(p_slot); | 517 | p_slot->hpc_ops->green_led_off(p_slot); |
| 520 | p_slot->hpc_ops->set_attention_status(p_slot, 0); | 518 | p_slot->hpc_ops->set_attention_status(p_slot, 0); |
| 521 | ctrl_info(ctrl, "PCI slot #%s - action canceled due to " | 519 | ctrl_info(ctrl, "PCI slot #%s - action canceled due to button press\n", |
| 522 | "button press\n", slot_name(p_slot)); | 520 | slot_name(p_slot)); |
| 523 | p_slot->state = STATIC_STATE; | 521 | p_slot->state = STATIC_STATE; |
| 524 | break; | 522 | break; |
| 525 | case POWEROFF_STATE: | 523 | case POWEROFF_STATE: |
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index 2d7f474ca0ec..29e22352822c 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c | |||
| @@ -341,8 +341,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) | |||
| 341 | 341 | ||
| 342 | cmd_status = hpc_check_cmd_status(slot->ctrl); | 342 | cmd_status = hpc_check_cmd_status(slot->ctrl); |
| 343 | if (cmd_status) { | 343 | if (cmd_status) { |
| 344 | ctrl_err(ctrl, | 344 | ctrl_err(ctrl, "Failed to issued command 0x%x (error code = %d)\n", |
| 345 | "Failed to issued command 0x%x (error code = %d)\n", | ||
| 346 | cmd, cmd_status); | 345 | cmd, cmd_status); |
| 347 | retval = -EIO; | 346 | retval = -EIO; |
| 348 | } | 347 | } |
| @@ -404,7 +403,7 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status) | |||
| 404 | return 0; | 403 | return 0; |
| 405 | } | 404 | } |
| 406 | 405 | ||
| 407 | static int hpc_get_power_status(struct slot * slot, u8 *status) | 406 | static int hpc_get_power_status(struct slot *slot, u8 *status) |
| 408 | { | 407 | { |
| 409 | struct controller *ctrl = slot->ctrl; | 408 | struct controller *ctrl = slot->ctrl; |
| 410 | u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); | 409 | u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); |
| @@ -528,7 +527,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode) | |||
| 528 | return retval; | 527 | return retval; |
| 529 | } | 528 | } |
| 530 | 529 | ||
| 531 | static int hpc_query_power_fault(struct slot * slot) | 530 | static int hpc_query_power_fault(struct slot *slot) |
| 532 | { | 531 | { |
| 533 | struct controller *ctrl = slot->ctrl; | 532 | struct controller *ctrl = slot->ctrl; |
| 534 | u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); | 533 | u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); |
| @@ -614,7 +613,7 @@ static void hpc_release_ctlr(struct controller *ctrl) | |||
| 614 | release_mem_region(ctrl->mmio_base, ctrl->mmio_size); | 613 | release_mem_region(ctrl->mmio_base, ctrl->mmio_size); |
| 615 | } | 614 | } |
| 616 | 615 | ||
| 617 | static int hpc_power_on_slot(struct slot * slot) | 616 | static int hpc_power_on_slot(struct slot *slot) |
| 618 | { | 617 | { |
| 619 | int retval; | 618 | int retval; |
| 620 | 619 | ||
| @@ -625,7 +624,7 @@ static int hpc_power_on_slot(struct slot * slot) | |||
| 625 | return retval; | 624 | return retval; |
| 626 | } | 625 | } |
| 627 | 626 | ||
| 628 | static int hpc_slot_enable(struct slot * slot) | 627 | static int hpc_slot_enable(struct slot *slot) |
| 629 | { | 628 | { |
| 630 | int retval; | 629 | int retval; |
| 631 | 630 | ||
| @@ -638,7 +637,7 @@ static int hpc_slot_enable(struct slot * slot) | |||
| 638 | return retval; | 637 | return retval; |
| 639 | } | 638 | } |
| 640 | 639 | ||
| 641 | static int hpc_slot_disable(struct slot * slot) | 640 | static int hpc_slot_disable(struct slot *slot) |
| 642 | { | 641 | { |
| 643 | int retval; | 642 | int retval; |
| 644 | 643 | ||
| @@ -720,7 +719,7 @@ static int shpc_get_cur_bus_speed(struct controller *ctrl) | |||
| 720 | } | 719 | } |
| 721 | 720 | ||
| 722 | 721 | ||
| 723 | static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) | 722 | static int hpc_set_bus_speed_mode(struct slot *slot, enum pci_bus_speed value) |
| 724 | { | 723 | { |
| 725 | int retval; | 724 | int retval; |
| 726 | struct controller *ctrl = slot->ctrl; | 725 | struct controller *ctrl = slot->ctrl; |
| @@ -974,8 +973,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
| 974 | for (i = 0; i < 9 + num_slots; i++) { | 973 | for (i = 0; i < 9 + num_slots; i++) { |
| 975 | rc = shpc_indirect_read(ctrl, i, &tempdword); | 974 | rc = shpc_indirect_read(ctrl, i, &tempdword); |
| 976 | if (rc) { | 975 | if (rc) { |
| 977 | ctrl_err(ctrl, | 976 | ctrl_err(ctrl, "Cannot read creg (index = %d)\n", |
| 978 | "Cannot read creg (index = %d)\n", i); | 977 | i); |
| 979 | goto abort; | 978 | goto abort; |
| 980 | } | 979 | } |
| 981 | ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword); | 980 | ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword); |
| @@ -1060,10 +1059,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
| 1060 | /* Installs the interrupt handler */ | 1059 | /* Installs the interrupt handler */ |
| 1061 | rc = pci_enable_msi(pdev); | 1060 | rc = pci_enable_msi(pdev); |
| 1062 | if (rc) { | 1061 | if (rc) { |
| 1063 | ctrl_info(ctrl, | 1062 | ctrl_info(ctrl, "Can't get msi for the hotplug controller\n"); |
| 1064 | "Can't get msi for the hotplug controller\n"); | 1063 | ctrl_info(ctrl, "Use INTx for the hotplug controller\n"); |
| 1065 | ctrl_info(ctrl, | ||
| 1066 | "Use INTx for the hotplug controller\n"); | ||
| 1067 | } | 1064 | } |
| 1068 | 1065 | ||
| 1069 | rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, | 1066 | rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, |
| @@ -1071,8 +1068,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
| 1071 | ctrl_dbg(ctrl, "request_irq %d (returns %d)\n", | 1068 | ctrl_dbg(ctrl, "request_irq %d (returns %d)\n", |
| 1072 | ctrl->pci_dev->irq, rc); | 1069 | ctrl->pci_dev->irq, rc); |
| 1073 | if (rc) { | 1070 | if (rc) { |
| 1074 | ctrl_err(ctrl, "Can't get irq %d for the hotplug " | 1071 | ctrl_err(ctrl, "Can't get irq %d for the hotplug controller\n", |
| 1075 | "controller\n", ctrl->pci_dev->irq); | 1072 | ctrl->pci_dev->irq); |
| 1076 | goto abort_iounmap; | 1073 | goto abort_iounmap; |
| 1077 | } | 1074 | } |
| 1078 | } | 1075 | } |
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index 9202d133485c..469454e0cc48 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c | |||
| @@ -46,9 +46,9 @@ int shpchp_configure_device(struct slot *p_slot) | |||
| 46 | 46 | ||
| 47 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); | 47 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); |
| 48 | if (dev) { | 48 | if (dev) { |
| 49 | ctrl_err(ctrl, "Device %s already exists " | 49 | ctrl_err(ctrl, "Device %s already exists at %04x:%02x:%02x, cannot hot-add\n", |
| 50 | "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), | 50 | pci_name(dev), pci_domain_nr(parent), |
| 51 | pci_domain_nr(parent), p_slot->bus, p_slot->device); | 51 | p_slot->bus, p_slot->device); |
| 52 | pci_dev_put(dev); | 52 | pci_dev_put(dev); |
| 53 | ret = -EINVAL; | 53 | ret = -EINVAL; |
| 54 | goto out; | 54 | goto out; |
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c index e8c31fe20566..52875b360463 100644 --- a/drivers/pci/hotplug/shpchp_sysfs.c +++ b/drivers/pci/hotplug/shpchp_sysfs.c | |||
| @@ -38,7 +38,7 @@ | |||
| 38 | static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) | 38 | static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) |
| 39 | { | 39 | { |
| 40 | struct pci_dev *pdev; | 40 | struct pci_dev *pdev; |
| 41 | char * out = buf; | 41 | char *out = buf; |
| 42 | int index, busnr; | 42 | int index, busnr; |
| 43 | struct resource *res; | 43 | struct resource *res; |
| 44 | struct pci_bus *bus; | 44 | struct pci_bus *bus; |
diff --git a/drivers/pci/htirq.c b/drivers/pci/htirq.c index d68b030ab533..a94dd2c4183a 100644 --- a/drivers/pci/htirq.c +++ b/drivers/pci/htirq.c | |||
| @@ -102,7 +102,7 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update) | |||
| 102 | spin_unlock_irqrestore(&ht_irq_lock, flags); | 102 | spin_unlock_irqrestore(&ht_irq_lock, flags); |
| 103 | 103 | ||
| 104 | max_irq = (data >> 16) & 0xff; | 104 | max_irq = (data >> 16) & 0xff; |
| 105 | if ( idx > max_irq) | 105 | if (idx > max_irq) |
| 106 | return -EINVAL; | 106 | return -EINVAL; |
| 107 | 107 | ||
| 108 | cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); | 108 | cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); |
| @@ -131,6 +131,7 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update) | |||
| 131 | 131 | ||
| 132 | return irq; | 132 | return irq; |
| 133 | } | 133 | } |
| 134 | EXPORT_SYMBOL(__ht_create_irq); | ||
| 134 | 135 | ||
| 135 | /** | 136 | /** |
| 136 | * ht_create_irq - create an irq and attach it to a device. | 137 | * ht_create_irq - create an irq and attach it to a device. |
| @@ -146,6 +147,7 @@ int ht_create_irq(struct pci_dev *dev, int idx) | |||
| 146 | { | 147 | { |
| 147 | return __ht_create_irq(dev, idx, NULL); | 148 | return __ht_create_irq(dev, idx, NULL); |
| 148 | } | 149 | } |
| 150 | EXPORT_SYMBOL(ht_create_irq); | ||
| 149 | 151 | ||
| 150 | /** | 152 | /** |
| 151 | * ht_destroy_irq - destroy an irq created with ht_create_irq | 153 | * ht_destroy_irq - destroy an irq created with ht_create_irq |
| @@ -165,7 +167,4 @@ void ht_destroy_irq(unsigned int irq) | |||
| 165 | 167 | ||
| 166 | kfree(cfg); | 168 | kfree(cfg); |
| 167 | } | 169 | } |
| 168 | |||
| 169 | EXPORT_SYMBOL(__ht_create_irq); | ||
| 170 | EXPORT_SYMBOL(ht_create_irq); | ||
| 171 | EXPORT_SYMBOL(ht_destroy_irq); | 170 | EXPORT_SYMBOL(ht_destroy_irq); |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 27a7e67ddfe4..13f3d3037272 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
| @@ -413,7 +413,7 @@ static void free_msi_irqs(struct pci_dev *dev) | |||
| 413 | if (dev->msi_irq_groups) { | 413 | if (dev->msi_irq_groups) { |
| 414 | sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups); | 414 | sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups); |
| 415 | msi_attrs = dev->msi_irq_groups[0]->attrs; | 415 | msi_attrs = dev->msi_irq_groups[0]->attrs; |
| 416 | list_for_each_entry(entry, &dev->msi_list, list) { | 416 | while (msi_attrs[count]) { |
| 417 | dev_attr = container_of(msi_attrs[count], | 417 | dev_attr = container_of(msi_attrs[count], |
| 418 | struct device_attribute, attr); | 418 | struct device_attribute, attr); |
| 419 | kfree(dev_attr->attr.name); | 419 | kfree(dev_attr->attr.name); |
| @@ -980,8 +980,7 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) | |||
| 980 | 980 | ||
| 981 | /* Check whether driver already requested for MSI irq */ | 981 | /* Check whether driver already requested for MSI irq */ |
| 982 | if (dev->msi_enabled) { | 982 | if (dev->msi_enabled) { |
| 983 | dev_info(&dev->dev, "can't enable MSI-X " | 983 | dev_info(&dev->dev, "can't enable MSI-X (MSI IRQ already assigned)\n"); |
| 984 | "(MSI IRQ already assigned)\n"); | ||
| 985 | return -EINVAL; | 984 | return -EINVAL; |
| 986 | } | 985 | } |
| 987 | status = msix_capability_init(dev, entries, nvec); | 986 | status = msix_capability_init(dev, entries, nvec); |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 837d71f5390b..3f8e3dbcaa7c 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
| @@ -77,6 +77,7 @@ int pci_add_dynid(struct pci_driver *drv, | |||
| 77 | 77 | ||
| 78 | return retval; | 78 | return retval; |
| 79 | } | 79 | } |
| 80 | EXPORT_SYMBOL_GPL(pci_add_dynid); | ||
| 80 | 81 | ||
| 81 | static void pci_free_dynids(struct pci_driver *drv) | 82 | static void pci_free_dynids(struct pci_driver *drv) |
| 82 | { | 83 | { |
| @@ -98,15 +99,15 @@ static void pci_free_dynids(struct pci_driver *drv) | |||
| 98 | * | 99 | * |
| 99 | * Allow PCI IDs to be added to an existing driver via sysfs. | 100 | * Allow PCI IDs to be added to an existing driver via sysfs. |
| 100 | */ | 101 | */ |
| 101 | static ssize_t | 102 | static ssize_t store_new_id(struct device_driver *driver, const char *buf, |
| 102 | store_new_id(struct device_driver *driver, const char *buf, size_t count) | 103 | size_t count) |
| 103 | { | 104 | { |
| 104 | struct pci_driver *pdrv = to_pci_driver(driver); | 105 | struct pci_driver *pdrv = to_pci_driver(driver); |
| 105 | const struct pci_device_id *ids = pdrv->id_table; | 106 | const struct pci_device_id *ids = pdrv->id_table; |
| 106 | __u32 vendor, device, subvendor=PCI_ANY_ID, | 107 | __u32 vendor, device, subvendor = PCI_ANY_ID, |
| 107 | subdevice=PCI_ANY_ID, class=0, class_mask=0; | 108 | subdevice = PCI_ANY_ID, class = 0, class_mask = 0; |
| 108 | unsigned long driver_data=0; | 109 | unsigned long driver_data = 0; |
| 109 | int fields=0; | 110 | int fields = 0; |
| 110 | int retval = 0; | 111 | int retval = 0; |
| 111 | 112 | ||
| 112 | fields = sscanf(buf, "%x %x %x %x %x %x %lx", | 113 | fields = sscanf(buf, "%x %x %x %x %x %x %lx", |
| @@ -166,8 +167,8 @@ static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); | |||
| 166 | * | 167 | * |
| 167 | * Removes a dynamic pci device ID to this driver. | 168 | * Removes a dynamic pci device ID to this driver. |
| 168 | */ | 169 | */ |
| 169 | static ssize_t | 170 | static ssize_t store_remove_id(struct device_driver *driver, const char *buf, |
| 170 | store_remove_id(struct device_driver *driver, const char *buf, size_t count) | 171 | size_t count) |
| 171 | { | 172 | { |
| 172 | struct pci_dynid *dynid, *n; | 173 | struct pci_dynid *dynid, *n; |
| 173 | struct pci_driver *pdrv = to_pci_driver(driver); | 174 | struct pci_driver *pdrv = to_pci_driver(driver); |
| @@ -235,6 +236,7 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, | |||
| 235 | } | 236 | } |
| 236 | return NULL; | 237 | return NULL; |
| 237 | } | 238 | } |
| 239 | EXPORT_SYMBOL(pci_match_id); | ||
| 238 | 240 | ||
| 239 | static const struct pci_device_id pci_device_id_any = { | 241 | static const struct pci_device_id pci_device_id_any = { |
| 240 | .vendor = PCI_ANY_ID, | 242 | .vendor = PCI_ANY_ID, |
| @@ -372,8 +374,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, | |||
| 372 | * returns 0 on success, else error. | 374 | * returns 0 on success, else error. |
| 373 | * side-effect: pci_dev->driver is set to drv when drv claims pci_dev. | 375 | * side-effect: pci_dev->driver is set to drv when drv claims pci_dev. |
| 374 | */ | 376 | */ |
| 375 | static int | 377 | static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) |
| 376 | __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) | ||
| 377 | { | 378 | { |
| 378 | const struct pci_device_id *id; | 379 | const struct pci_device_id *id; |
| 379 | int error = 0; | 380 | int error = 0; |
| @@ -390,7 +391,7 @@ __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) | |||
| 390 | return error; | 391 | return error; |
| 391 | } | 392 | } |
| 392 | 393 | ||
| 393 | static int pci_device_probe(struct device * dev) | 394 | static int pci_device_probe(struct device *dev) |
| 394 | { | 395 | { |
| 395 | int error = 0; | 396 | int error = 0; |
| 396 | struct pci_driver *drv; | 397 | struct pci_driver *drv; |
| @@ -406,10 +407,10 @@ static int pci_device_probe(struct device * dev) | |||
| 406 | return error; | 407 | return error; |
| 407 | } | 408 | } |
| 408 | 409 | ||
| 409 | static int pci_device_remove(struct device * dev) | 410 | static int pci_device_remove(struct device *dev) |
| 410 | { | 411 | { |
| 411 | struct pci_dev * pci_dev = to_pci_dev(dev); | 412 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 412 | struct pci_driver * drv = pci_dev->driver; | 413 | struct pci_driver *drv = pci_dev->driver; |
| 413 | 414 | ||
| 414 | if (drv) { | 415 | if (drv) { |
| 415 | if (drv->remove) { | 416 | if (drv->remove) { |
| @@ -537,8 +538,8 @@ static int pci_pm_reenable_device(struct pci_dev *pci_dev) | |||
| 537 | 538 | ||
| 538 | static int pci_legacy_suspend(struct device *dev, pm_message_t state) | 539 | static int pci_legacy_suspend(struct device *dev, pm_message_t state) |
| 539 | { | 540 | { |
| 540 | struct pci_dev * pci_dev = to_pci_dev(dev); | 541 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 541 | struct pci_driver * drv = pci_dev->driver; | 542 | struct pci_driver *drv = pci_dev->driver; |
| 542 | 543 | ||
| 543 | if (drv && drv->suspend) { | 544 | if (drv && drv->suspend) { |
| 544 | pci_power_t prev = pci_dev->current_state; | 545 | pci_power_t prev = pci_dev->current_state; |
| @@ -564,8 +565,8 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state) | |||
| 564 | 565 | ||
| 565 | static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) | 566 | static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) |
| 566 | { | 567 | { |
| 567 | struct pci_dev * pci_dev = to_pci_dev(dev); | 568 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 568 | struct pci_driver * drv = pci_dev->driver; | 569 | struct pci_driver *drv = pci_dev->driver; |
| 569 | 570 | ||
| 570 | if (drv && drv->suspend_late) { | 571 | if (drv && drv->suspend_late) { |
| 571 | pci_power_t prev = pci_dev->current_state; | 572 | pci_power_t prev = pci_dev->current_state; |
| @@ -595,8 +596,8 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) | |||
| 595 | 596 | ||
| 596 | static int pci_legacy_resume_early(struct device *dev) | 597 | static int pci_legacy_resume_early(struct device *dev) |
| 597 | { | 598 | { |
| 598 | struct pci_dev * pci_dev = to_pci_dev(dev); | 599 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 599 | struct pci_driver * drv = pci_dev->driver; | 600 | struct pci_driver *drv = pci_dev->driver; |
| 600 | 601 | ||
| 601 | return drv && drv->resume_early ? | 602 | return drv && drv->resume_early ? |
| 602 | drv->resume_early(pci_dev) : 0; | 603 | drv->resume_early(pci_dev) : 0; |
| @@ -604,8 +605,8 @@ static int pci_legacy_resume_early(struct device *dev) | |||
| 604 | 605 | ||
| 605 | static int pci_legacy_resume(struct device *dev) | 606 | static int pci_legacy_resume(struct device *dev) |
| 606 | { | 607 | { |
| 607 | struct pci_dev * pci_dev = to_pci_dev(dev); | 608 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 608 | struct pci_driver * drv = pci_dev->driver; | 609 | struct pci_driver *drv = pci_dev->driver; |
| 609 | 610 | ||
| 610 | pci_fixup_device(pci_fixup_resume, pci_dev); | 611 | pci_fixup_device(pci_fixup_resume, pci_dev); |
| 611 | 612 | ||
| @@ -1255,6 +1256,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, | |||
| 1255 | /* register with core */ | 1256 | /* register with core */ |
| 1256 | return driver_register(&drv->driver); | 1257 | return driver_register(&drv->driver); |
| 1257 | } | 1258 | } |
| 1259 | EXPORT_SYMBOL(__pci_register_driver); | ||
| 1258 | 1260 | ||
| 1259 | /** | 1261 | /** |
| 1260 | * pci_unregister_driver - unregister a pci driver | 1262 | * pci_unregister_driver - unregister a pci driver |
| @@ -1266,12 +1268,12 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, | |||
| 1266 | * driverless. | 1268 | * driverless. |
| 1267 | */ | 1269 | */ |
| 1268 | 1270 | ||
| 1269 | void | 1271 | void pci_unregister_driver(struct pci_driver *drv) |
| 1270 | pci_unregister_driver(struct pci_driver *drv) | ||
| 1271 | { | 1272 | { |
| 1272 | driver_unregister(&drv->driver); | 1273 | driver_unregister(&drv->driver); |
| 1273 | pci_free_dynids(drv); | 1274 | pci_free_dynids(drv); |
| 1274 | } | 1275 | } |
| 1276 | EXPORT_SYMBOL(pci_unregister_driver); | ||
| 1275 | 1277 | ||
| 1276 | static struct pci_driver pci_compat_driver = { | 1278 | static struct pci_driver pci_compat_driver = { |
| 1277 | .name = "compat" | 1279 | .name = "compat" |
| @@ -1284,19 +1286,19 @@ static struct pci_driver pci_compat_driver = { | |||
| 1284 | * Returns the appropriate pci_driver structure or %NULL if there is no | 1286 | * Returns the appropriate pci_driver structure or %NULL if there is no |
| 1285 | * registered driver for the device. | 1287 | * registered driver for the device. |
| 1286 | */ | 1288 | */ |
| 1287 | struct pci_driver * | 1289 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev) |
| 1288 | pci_dev_driver(const struct pci_dev *dev) | ||
| 1289 | { | 1290 | { |
| 1290 | if (dev->driver) | 1291 | if (dev->driver) |
| 1291 | return dev->driver; | 1292 | return dev->driver; |
| 1292 | else { | 1293 | else { |
| 1293 | int i; | 1294 | int i; |
| 1294 | for(i=0; i<=PCI_ROM_RESOURCE; i++) | 1295 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) |
| 1295 | if (dev->resource[i].flags & IORESOURCE_BUSY) | 1296 | if (dev->resource[i].flags & IORESOURCE_BUSY) |
| 1296 | return &pci_compat_driver; | 1297 | return &pci_compat_driver; |
| 1297 | } | 1298 | } |
| 1298 | return NULL; | 1299 | return NULL; |
| 1299 | } | 1300 | } |
| 1301 | EXPORT_SYMBOL(pci_dev_driver); | ||
| 1300 | 1302 | ||
| 1301 | /** | 1303 | /** |
| 1302 | * pci_bus_match - Tell if a PCI device structure has a matching PCI device id structure | 1304 | * pci_bus_match - Tell if a PCI device structure has a matching PCI device id structure |
| @@ -1342,6 +1344,7 @@ struct pci_dev *pci_dev_get(struct pci_dev *dev) | |||
| 1342 | get_device(&dev->dev); | 1344 | get_device(&dev->dev); |
| 1343 | return dev; | 1345 | return dev; |
| 1344 | } | 1346 | } |
| 1347 | EXPORT_SYMBOL(pci_dev_get); | ||
| 1345 | 1348 | ||
| 1346 | /** | 1349 | /** |
| 1347 | * pci_dev_put - release a use of the pci device structure | 1350 | * pci_dev_put - release a use of the pci device structure |
| @@ -1355,6 +1358,7 @@ void pci_dev_put(struct pci_dev *dev) | |||
| 1355 | if (dev) | 1358 | if (dev) |
| 1356 | put_device(&dev->dev); | 1359 | put_device(&dev->dev); |
| 1357 | } | 1360 | } |
| 1361 | EXPORT_SYMBOL(pci_dev_put); | ||
| 1358 | 1362 | ||
| 1359 | static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) | 1363 | static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) |
| 1360 | { | 1364 | { |
| @@ -1400,19 +1404,10 @@ struct bus_type pci_bus_type = { | |||
| 1400 | .drv_groups = pci_drv_groups, | 1404 | .drv_groups = pci_drv_groups, |
| 1401 | .pm = PCI_PM_OPS_PTR, | 1405 | .pm = PCI_PM_OPS_PTR, |
| 1402 | }; | 1406 | }; |
| 1407 | EXPORT_SYMBOL(pci_bus_type); | ||
| 1403 | 1408 | ||
| 1404 | static int __init pci_driver_init(void) | 1409 | static int __init pci_driver_init(void) |
| 1405 | { | 1410 | { |
| 1406 | return bus_register(&pci_bus_type); | 1411 | return bus_register(&pci_bus_type); |
| 1407 | } | 1412 | } |
| 1408 | |||
| 1409 | postcore_initcall(pci_driver_init); | 1413 | postcore_initcall(pci_driver_init); |
| 1410 | |||
| 1411 | EXPORT_SYMBOL_GPL(pci_add_dynid); | ||
| 1412 | EXPORT_SYMBOL(pci_match_id); | ||
| 1413 | EXPORT_SYMBOL(__pci_register_driver); | ||
| 1414 | EXPORT_SYMBOL(pci_unregister_driver); | ||
| 1415 | EXPORT_SYMBOL(pci_dev_driver); | ||
| 1416 | EXPORT_SYMBOL(pci_bus_type); | ||
| 1417 | EXPORT_SYMBOL(pci_dev_get); | ||
| 1418 | EXPORT_SYMBOL(pci_dev_put); | ||
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index 45113daaa778..a3fbe2012ea3 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c | |||
| @@ -40,9 +40,8 @@ enum smbios_attr_enum { | |||
| 40 | SMBIOS_ATTR_INSTANCE_SHOW, | 40 | SMBIOS_ATTR_INSTANCE_SHOW, |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | static size_t | 43 | static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, |
| 44 | find_smbios_instance_string(struct pci_dev *pdev, char *buf, | 44 | enum smbios_attr_enum attribute) |
| 45 | enum smbios_attr_enum attribute) | ||
| 46 | { | 45 | { |
| 47 | const struct dmi_device *dmi; | 46 | const struct dmi_device *dmi; |
| 48 | struct dmi_dev_onboard *donboard; | 47 | struct dmi_dev_onboard *donboard; |
| @@ -74,9 +73,8 @@ find_smbios_instance_string(struct pci_dev *pdev, char *buf, | |||
| 74 | return 0; | 73 | return 0; |
| 75 | } | 74 | } |
| 76 | 75 | ||
| 77 | static umode_t | 76 | static umode_t smbios_instance_string_exist(struct kobject *kobj, |
| 78 | smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr, | 77 | struct attribute *attr, int n) |
| 79 | int n) | ||
| 80 | { | 78 | { |
| 81 | struct device *dev; | 79 | struct device *dev; |
| 82 | struct pci_dev *pdev; | 80 | struct pci_dev *pdev; |
| @@ -88,8 +86,8 @@ smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr, | |||
| 88 | S_IRUGO : 0; | 86 | S_IRUGO : 0; |
| 89 | } | 87 | } |
| 90 | 88 | ||
| 91 | static ssize_t | 89 | static ssize_t smbioslabel_show(struct device *dev, |
| 92 | smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf) | 90 | struct device_attribute *attr, char *buf) |
| 93 | { | 91 | { |
| 94 | struct pci_dev *pdev; | 92 | struct pci_dev *pdev; |
| 95 | pdev = to_pci_dev(dev); | 93 | pdev = to_pci_dev(dev); |
| @@ -98,9 +96,8 @@ smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 98 | SMBIOS_ATTR_LABEL_SHOW); | 96 | SMBIOS_ATTR_LABEL_SHOW); |
| 99 | } | 97 | } |
| 100 | 98 | ||
| 101 | static ssize_t | 99 | static ssize_t smbiosinstance_show(struct device *dev, |
| 102 | smbiosinstance_show(struct device *dev, | 100 | struct device_attribute *attr, char *buf) |
| 103 | struct device_attribute *attr, char *buf) | ||
| 104 | { | 101 | { |
| 105 | struct pci_dev *pdev; | 102 | struct pci_dev *pdev; |
| 106 | pdev = to_pci_dev(dev); | 103 | pdev = to_pci_dev(dev); |
| @@ -130,26 +127,22 @@ static struct attribute_group smbios_attr_group = { | |||
| 130 | .is_visible = smbios_instance_string_exist, | 127 | .is_visible = smbios_instance_string_exist, |
| 131 | }; | 128 | }; |
| 132 | 129 | ||
| 133 | static int | 130 | static int pci_create_smbiosname_file(struct pci_dev *pdev) |
| 134 | pci_create_smbiosname_file(struct pci_dev *pdev) | ||
| 135 | { | 131 | { |
| 136 | return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group); | 132 | return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group); |
| 137 | } | 133 | } |
| 138 | 134 | ||
| 139 | static void | 135 | static void pci_remove_smbiosname_file(struct pci_dev *pdev) |
| 140 | pci_remove_smbiosname_file(struct pci_dev *pdev) | ||
| 141 | { | 136 | { |
| 142 | sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); | 137 | sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); |
| 143 | } | 138 | } |
| 144 | #else | 139 | #else |
| 145 | static inline int | 140 | static inline int pci_create_smbiosname_file(struct pci_dev *pdev) |
| 146 | pci_create_smbiosname_file(struct pci_dev *pdev) | ||
| 147 | { | 141 | { |
| 148 | return -1; | 142 | return -1; |
| 149 | } | 143 | } |
| 150 | 144 | ||
| 151 | static inline void | 145 | static inline void pci_remove_smbiosname_file(struct pci_dev *pdev) |
| 152 | pci_remove_smbiosname_file(struct pci_dev *pdev) | ||
| 153 | { | 146 | { |
| 154 | } | 147 | } |
| 155 | #endif | 148 | #endif |
| @@ -175,8 +168,8 @@ static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) | |||
| 175 | buf[len] = '\n'; | 168 | buf[len] = '\n'; |
| 176 | } | 169 | } |
| 177 | 170 | ||
| 178 | static int | 171 | static int dsm_get_label(struct device *dev, char *buf, |
| 179 | dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) | 172 | enum acpi_attr_enum attr) |
| 180 | { | 173 | { |
| 181 | acpi_handle handle; | 174 | acpi_handle handle; |
| 182 | union acpi_object *obj, *tmp; | 175 | union acpi_object *obj, *tmp; |
| @@ -212,8 +205,7 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) | |||
| 212 | return len; | 205 | return len; |
| 213 | } | 206 | } |
| 214 | 207 | ||
| 215 | static bool | 208 | static bool device_has_dsm(struct device *dev) |
| 216 | device_has_dsm(struct device *dev) | ||
| 217 | { | 209 | { |
| 218 | acpi_handle handle; | 210 | acpi_handle handle; |
| 219 | 211 | ||
| @@ -225,8 +217,8 @@ device_has_dsm(struct device *dev) | |||
| 225 | 1 << DEVICE_LABEL_DSM); | 217 | 1 << DEVICE_LABEL_DSM); |
| 226 | } | 218 | } |
| 227 | 219 | ||
| 228 | static umode_t | 220 | static umode_t acpi_index_string_exist(struct kobject *kobj, |
| 229 | acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n) | 221 | struct attribute *attr, int n) |
| 230 | { | 222 | { |
| 231 | struct device *dev; | 223 | struct device *dev; |
| 232 | 224 | ||
| @@ -238,14 +230,14 @@ acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n) | |||
| 238 | return 0; | 230 | return 0; |
| 239 | } | 231 | } |
| 240 | 232 | ||
| 241 | static ssize_t | 233 | static ssize_t acpilabel_show(struct device *dev, |
| 242 | acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) | 234 | struct device_attribute *attr, char *buf) |
| 243 | { | 235 | { |
| 244 | return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW); | 236 | return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW); |
| 245 | } | 237 | } |
| 246 | 238 | ||
| 247 | static ssize_t | 239 | static ssize_t acpiindex_show(struct device *dev, |
| 248 | acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) | 240 | struct device_attribute *attr, char *buf) |
| 249 | { | 241 | { |
| 250 | return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW); | 242 | return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW); |
| 251 | } | 243 | } |
| @@ -271,33 +263,28 @@ static struct attribute_group acpi_attr_group = { | |||
| 271 | .is_visible = acpi_index_string_exist, | 263 | .is_visible = acpi_index_string_exist, |
| 272 | }; | 264 | }; |
| 273 | 265 | ||
| 274 | static int | 266 | static int pci_create_acpi_index_label_files(struct pci_dev *pdev) |
| 275 | pci_create_acpi_index_label_files(struct pci_dev *pdev) | ||
| 276 | { | 267 | { |
| 277 | return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group); | 268 | return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group); |
| 278 | } | 269 | } |
| 279 | 270 | ||
| 280 | static int | 271 | static int pci_remove_acpi_index_label_files(struct pci_dev *pdev) |
| 281 | pci_remove_acpi_index_label_files(struct pci_dev *pdev) | ||
| 282 | { | 272 | { |
| 283 | sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); | 273 | sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); |
| 284 | return 0; | 274 | return 0; |
| 285 | } | 275 | } |
| 286 | #else | 276 | #else |
| 287 | static inline int | 277 | static inline int pci_create_acpi_index_label_files(struct pci_dev *pdev) |
| 288 | pci_create_acpi_index_label_files(struct pci_dev *pdev) | ||
| 289 | { | 278 | { |
| 290 | return -1; | 279 | return -1; |
| 291 | } | 280 | } |
| 292 | 281 | ||
| 293 | static inline int | 282 | static inline int pci_remove_acpi_index_label_files(struct pci_dev *pdev) |
| 294 | pci_remove_acpi_index_label_files(struct pci_dev *pdev) | ||
| 295 | { | 283 | { |
| 296 | return -1; | 284 | return -1; |
| 297 | } | 285 | } |
| 298 | 286 | ||
| 299 | static inline bool | 287 | static inline bool device_has_dsm(struct device *dev) |
| 300 | device_has_dsm(struct device *dev) | ||
| 301 | { | 288 | { |
| 302 | return false; | 289 | return false; |
| 303 | } | 290 | } |
diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c index 2ff77509d8e5..886fb3570278 100644 --- a/drivers/pci/pci-stub.c +++ b/drivers/pci/pci-stub.c | |||
| @@ -55,7 +55,7 @@ static int __init pci_stub_init(void) | |||
| 55 | p = ids; | 55 | p = ids; |
| 56 | while ((id = strsep(&p, ","))) { | 56 | while ((id = strsep(&p, ","))) { |
| 57 | unsigned int vendor, device, subvendor = PCI_ANY_ID, | 57 | unsigned int vendor, device, subvendor = PCI_ANY_ID, |
| 58 | subdevice = PCI_ANY_ID, class=0, class_mask=0; | 58 | subdevice = PCI_ANY_ID, class = 0, class_mask = 0; |
| 59 | int fields; | 59 | int fields; |
| 60 | 60 | ||
| 61 | if (!strlen(id)) | 61 | if (!strlen(id)) |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 84c350994b06..9ff0a901ecf7 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -41,8 +41,8 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf) \ | |||
| 41 | { \ | 41 | { \ |
| 42 | struct pci_dev *pdev; \ | 42 | struct pci_dev *pdev; \ |
| 43 | \ | 43 | \ |
| 44 | pdev = to_pci_dev (dev); \ | 44 | pdev = to_pci_dev(dev); \ |
| 45 | return sprintf (buf, format_string, pdev->field); \ | 45 | return sprintf(buf, format_string, pdev->field); \ |
| 46 | } \ | 46 | } \ |
| 47 | static DEVICE_ATTR_RO(field) | 47 | static DEVICE_ATTR_RO(field) |
| 48 | 48 | ||
| @@ -58,7 +58,7 @@ static ssize_t broken_parity_status_show(struct device *dev, | |||
| 58 | char *buf) | 58 | char *buf) |
| 59 | { | 59 | { |
| 60 | struct pci_dev *pdev = to_pci_dev(dev); | 60 | struct pci_dev *pdev = to_pci_dev(dev); |
| 61 | return sprintf (buf, "%u\n", pdev->broken_parity_status); | 61 | return sprintf(buf, "%u\n", pdev->broken_parity_status); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static ssize_t broken_parity_status_store(struct device *dev, | 64 | static ssize_t broken_parity_status_store(struct device *dev, |
| @@ -77,10 +77,8 @@ static ssize_t broken_parity_status_store(struct device *dev, | |||
| 77 | } | 77 | } |
| 78 | static DEVICE_ATTR_RW(broken_parity_status); | 78 | static DEVICE_ATTR_RW(broken_parity_status); |
| 79 | 79 | ||
| 80 | static ssize_t pci_dev_show_local_cpu(struct device *dev, | 80 | static ssize_t pci_dev_show_local_cpu(struct device *dev, int type, |
| 81 | int type, | 81 | struct device_attribute *attr, char *buf) |
| 82 | struct device_attribute *attr, | ||
| 83 | char *buf) | ||
| 84 | { | 82 | { |
| 85 | const struct cpumask *mask; | 83 | const struct cpumask *mask; |
| 86 | int len; | 84 | int len; |
| @@ -101,14 +99,14 @@ static ssize_t pci_dev_show_local_cpu(struct device *dev, | |||
| 101 | } | 99 | } |
| 102 | 100 | ||
| 103 | static ssize_t local_cpus_show(struct device *dev, | 101 | static ssize_t local_cpus_show(struct device *dev, |
| 104 | struct device_attribute *attr, char *buf) | 102 | struct device_attribute *attr, char *buf) |
| 105 | { | 103 | { |
| 106 | return pci_dev_show_local_cpu(dev, 1, attr, buf); | 104 | return pci_dev_show_local_cpu(dev, 1, attr, buf); |
| 107 | } | 105 | } |
| 108 | static DEVICE_ATTR_RO(local_cpus); | 106 | static DEVICE_ATTR_RO(local_cpus); |
| 109 | 107 | ||
| 110 | static ssize_t local_cpulist_show(struct device *dev, | 108 | static ssize_t local_cpulist_show(struct device *dev, |
| 111 | struct device_attribute *attr, char *buf) | 109 | struct device_attribute *attr, char *buf) |
| 112 | { | 110 | { |
| 113 | return pci_dev_show_local_cpu(dev, 0, attr, buf); | 111 | return pci_dev_show_local_cpu(dev, 0, attr, buf); |
| 114 | } | 112 | } |
| @@ -117,8 +115,7 @@ static DEVICE_ATTR_RO(local_cpulist); | |||
| 117 | /* | 115 | /* |
| 118 | * PCI Bus Class Devices | 116 | * PCI Bus Class Devices |
| 119 | */ | 117 | */ |
| 120 | static ssize_t pci_bus_show_cpuaffinity(struct device *dev, | 118 | static ssize_t pci_bus_show_cpuaffinity(struct device *dev, int type, |
| 121 | int type, | ||
| 122 | struct device_attribute *attr, | 119 | struct device_attribute *attr, |
| 123 | char *buf) | 120 | char *buf) |
| 124 | { | 121 | { |
| @@ -149,11 +146,11 @@ static ssize_t cpulistaffinity_show(struct device *dev, | |||
| 149 | static DEVICE_ATTR_RO(cpulistaffinity); | 146 | static DEVICE_ATTR_RO(cpulistaffinity); |
| 150 | 147 | ||
| 151 | /* show resources */ | 148 | /* show resources */ |
| 152 | static ssize_t | 149 | static ssize_t resource_show(struct device *dev, struct device_attribute *attr, |
| 153 | resource_show(struct device * dev, struct device_attribute *attr, char * buf) | 150 | char *buf) |
| 154 | { | 151 | { |
| 155 | struct pci_dev * pci_dev = to_pci_dev(dev); | 152 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 156 | char * str = buf; | 153 | char *str = buf; |
| 157 | int i; | 154 | int i; |
| 158 | int max; | 155 | int max; |
| 159 | resource_size_t start, end; | 156 | resource_size_t start, end; |
| @@ -166,7 +163,7 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf) | |||
| 166 | for (i = 0; i < max; i++) { | 163 | for (i = 0; i < max; i++) { |
| 167 | struct resource *res = &pci_dev->resource[i]; | 164 | struct resource *res = &pci_dev->resource[i]; |
| 168 | pci_resource_to_user(pci_dev, i, res, &start, &end); | 165 | pci_resource_to_user(pci_dev, i, res, &start, &end); |
| 169 | str += sprintf(str,"0x%016llx 0x%016llx 0x%016llx\n", | 166 | str += sprintf(str, "0x%016llx 0x%016llx 0x%016llx\n", |
| 170 | (unsigned long long)start, | 167 | (unsigned long long)start, |
| 171 | (unsigned long long)end, | 168 | (unsigned long long)end, |
| 172 | (unsigned long long)res->flags); | 169 | (unsigned long long)res->flags); |
| @@ -175,7 +172,8 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf) | |||
| 175 | } | 172 | } |
| 176 | static DEVICE_ATTR_RO(resource); | 173 | static DEVICE_ATTR_RO(resource); |
| 177 | 174 | ||
| 178 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) | 175 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, |
| 176 | char *buf) | ||
| 179 | { | 177 | { |
| 180 | struct pci_dev *pci_dev = to_pci_dev(dev); | 178 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 181 | 179 | ||
| @@ -187,9 +185,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | |||
| 187 | } | 185 | } |
| 188 | static DEVICE_ATTR_RO(modalias); | 186 | static DEVICE_ATTR_RO(modalias); |
| 189 | 187 | ||
| 190 | static ssize_t enabled_store(struct device *dev, | 188 | static ssize_t enabled_store(struct device *dev, struct device_attribute *attr, |
| 191 | struct device_attribute *attr, const char *buf, | 189 | const char *buf, size_t count) |
| 192 | size_t count) | ||
| 193 | { | 190 | { |
| 194 | struct pci_dev *pdev = to_pci_dev(dev); | 191 | struct pci_dev *pdev = to_pci_dev(dev); |
| 195 | unsigned long val; | 192 | unsigned long val; |
| @@ -213,57 +210,56 @@ static ssize_t enabled_store(struct device *dev, | |||
| 213 | return result < 0 ? result : count; | 210 | return result < 0 ? result : count; |
| 214 | } | 211 | } |
| 215 | 212 | ||
| 216 | static ssize_t enabled_show(struct device *dev, | 213 | static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, |
| 217 | struct device_attribute *attr, char *buf) | 214 | char *buf) |
| 218 | { | 215 | { |
| 219 | struct pci_dev *pdev; | 216 | struct pci_dev *pdev; |
| 220 | 217 | ||
| 221 | pdev = to_pci_dev (dev); | 218 | pdev = to_pci_dev(dev); |
| 222 | return sprintf (buf, "%u\n", atomic_read(&pdev->enable_cnt)); | 219 | return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt)); |
| 223 | } | 220 | } |
| 224 | static DEVICE_ATTR_RW(enabled); | 221 | static DEVICE_ATTR_RW(enabled); |
| 225 | 222 | ||
| 226 | #ifdef CONFIG_NUMA | 223 | #ifdef CONFIG_NUMA |
| 227 | static ssize_t | 224 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, |
| 228 | numa_node_show(struct device *dev, struct device_attribute *attr, char *buf) | 225 | char *buf) |
| 229 | { | 226 | { |
| 230 | return sprintf (buf, "%d\n", dev->numa_node); | 227 | return sprintf(buf, "%d\n", dev->numa_node); |
| 231 | } | 228 | } |
| 232 | static DEVICE_ATTR_RO(numa_node); | 229 | static DEVICE_ATTR_RO(numa_node); |
| 233 | #endif | 230 | #endif |
| 234 | 231 | ||
| 235 | static ssize_t | 232 | static ssize_t dma_mask_bits_show(struct device *dev, |
| 236 | dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf) | 233 | struct device_attribute *attr, char *buf) |
| 237 | { | 234 | { |
| 238 | struct pci_dev *pdev = to_pci_dev(dev); | 235 | struct pci_dev *pdev = to_pci_dev(dev); |
| 239 | 236 | ||
| 240 | return sprintf (buf, "%d\n", fls64(pdev->dma_mask)); | 237 | return sprintf(buf, "%d\n", fls64(pdev->dma_mask)); |
| 241 | } | 238 | } |
| 242 | static DEVICE_ATTR_RO(dma_mask_bits); | 239 | static DEVICE_ATTR_RO(dma_mask_bits); |
| 243 | 240 | ||
| 244 | static ssize_t | 241 | static ssize_t consistent_dma_mask_bits_show(struct device *dev, |
| 245 | consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr, | 242 | struct device_attribute *attr, |
| 246 | char *buf) | 243 | char *buf) |
| 247 | { | 244 | { |
| 248 | return sprintf (buf, "%d\n", fls64(dev->coherent_dma_mask)); | 245 | return sprintf(buf, "%d\n", fls64(dev->coherent_dma_mask)); |
| 249 | } | 246 | } |
| 250 | static DEVICE_ATTR_RO(consistent_dma_mask_bits); | 247 | static DEVICE_ATTR_RO(consistent_dma_mask_bits); |
| 251 | 248 | ||
| 252 | static ssize_t | 249 | static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr, |
| 253 | msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf) | 250 | char *buf) |
| 254 | { | 251 | { |
| 255 | struct pci_dev *pdev = to_pci_dev(dev); | 252 | struct pci_dev *pdev = to_pci_dev(dev); |
| 256 | 253 | ||
| 257 | if (!pdev->subordinate) | 254 | if (!pdev->subordinate) |
| 258 | return 0; | 255 | return 0; |
| 259 | 256 | ||
| 260 | return sprintf (buf, "%u\n", | 257 | return sprintf(buf, "%u\n", |
| 261 | !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI)); | 258 | !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI)); |
| 262 | } | 259 | } |
| 263 | 260 | ||
| 264 | static ssize_t | 261 | static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr, |
| 265 | msi_bus_store(struct device *dev, struct device_attribute *attr, | 262 | const char *buf, size_t count) |
| 266 | const char *buf, size_t count) | ||
| 267 | { | 263 | { |
| 268 | struct pci_dev *pdev = to_pci_dev(dev); | 264 | struct pci_dev *pdev = to_pci_dev(dev); |
| 269 | unsigned long val; | 265 | unsigned long val; |
| @@ -290,8 +286,8 @@ msi_bus_store(struct device *dev, struct device_attribute *attr, | |||
| 290 | !!val) { | 286 | !!val) { |
| 291 | pdev->subordinate->bus_flags ^= PCI_BUS_FLAGS_NO_MSI; | 287 | pdev->subordinate->bus_flags ^= PCI_BUS_FLAGS_NO_MSI; |
| 292 | 288 | ||
| 293 | dev_warn(&pdev->dev, "forced subordinate bus to%s support MSI," | 289 | dev_warn(&pdev->dev, "forced subordinate bus to%s support MSI, bad things could happen\n", |
| 294 | " bad things could happen\n", val ? "" : " not"); | 290 | val ? "" : " not"); |
| 295 | } | 291 | } |
| 296 | 292 | ||
| 297 | return count; | 293 | return count; |
| @@ -331,9 +327,9 @@ const struct attribute_group *pci_bus_groups[] = { | |||
| 331 | NULL, | 327 | NULL, |
| 332 | }; | 328 | }; |
| 333 | 329 | ||
| 334 | static ssize_t | 330 | static ssize_t dev_rescan_store(struct device *dev, |
| 335 | dev_rescan_store(struct device *dev, struct device_attribute *attr, | 331 | struct device_attribute *attr, const char *buf, |
| 336 | const char *buf, size_t count) | 332 | size_t count) |
| 337 | { | 333 | { |
| 338 | unsigned long val; | 334 | unsigned long val; |
| 339 | struct pci_dev *pdev = to_pci_dev(dev); | 335 | struct pci_dev *pdev = to_pci_dev(dev); |
| @@ -352,9 +348,8 @@ static struct device_attribute dev_rescan_attr = __ATTR(rescan, | |||
| 352 | (S_IWUSR|S_IWGRP), | 348 | (S_IWUSR|S_IWGRP), |
| 353 | NULL, dev_rescan_store); | 349 | NULL, dev_rescan_store); |
| 354 | 350 | ||
| 355 | static ssize_t | 351 | static ssize_t remove_store(struct device *dev, struct device_attribute *attr, |
| 356 | remove_store(struct device *dev, struct device_attribute *attr, | 352 | const char *buf, size_t count) |
| 357 | const char *buf, size_t count) | ||
| 358 | { | 353 | { |
| 359 | unsigned long val; | 354 | unsigned long val; |
| 360 | 355 | ||
| @@ -369,9 +364,9 @@ static struct device_attribute dev_remove_attr = __ATTR(remove, | |||
| 369 | (S_IWUSR|S_IWGRP), | 364 | (S_IWUSR|S_IWGRP), |
| 370 | NULL, remove_store); | 365 | NULL, remove_store); |
| 371 | 366 | ||
| 372 | static ssize_t | 367 | static ssize_t dev_bus_rescan_store(struct device *dev, |
| 373 | dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, | 368 | struct device_attribute *attr, |
| 374 | const char *buf, size_t count) | 369 | const char *buf, size_t count) |
| 375 | { | 370 | { |
| 376 | unsigned long val; | 371 | unsigned long val; |
| 377 | struct pci_bus *bus = to_pci_bus(dev); | 372 | struct pci_bus *bus = to_pci_bus(dev); |
| @@ -412,7 +407,7 @@ static ssize_t d3cold_allowed_show(struct device *dev, | |||
| 412 | struct device_attribute *attr, char *buf) | 407 | struct device_attribute *attr, char *buf) |
| 413 | { | 408 | { |
| 414 | struct pci_dev *pdev = to_pci_dev(dev); | 409 | struct pci_dev *pdev = to_pci_dev(dev); |
| 415 | return sprintf (buf, "%u\n", pdev->d3cold_allowed); | 410 | return sprintf(buf, "%u\n", pdev->d3cold_allowed); |
| 416 | } | 411 | } |
| 417 | static DEVICE_ATTR_RW(d3cold_allowed); | 412 | static DEVICE_ATTR_RW(d3cold_allowed); |
| 418 | #endif | 413 | #endif |
| @@ -607,8 +602,8 @@ const struct attribute_group *pcibus_groups[] = { | |||
| 607 | NULL, | 602 | NULL, |
| 608 | }; | 603 | }; |
| 609 | 604 | ||
| 610 | static ssize_t | 605 | static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr, |
| 611 | boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) | 606 | char *buf) |
| 612 | { | 607 | { |
| 613 | struct pci_dev *pdev = to_pci_dev(dev); | 608 | struct pci_dev *pdev = to_pci_dev(dev); |
| 614 | struct pci_dev *vga_dev = vga_default_device(); | 609 | struct pci_dev *vga_dev = vga_default_device(); |
| @@ -622,22 +617,21 @@ boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 622 | } | 617 | } |
| 623 | static struct device_attribute vga_attr = __ATTR_RO(boot_vga); | 618 | static struct device_attribute vga_attr = __ATTR_RO(boot_vga); |
| 624 | 619 | ||
| 625 | static ssize_t | 620 | static ssize_t pci_read_config(struct file *filp, struct kobject *kobj, |
| 626 | pci_read_config(struct file *filp, struct kobject *kobj, | 621 | struct bin_attribute *bin_attr, char *buf, |
| 627 | struct bin_attribute *bin_attr, | 622 | loff_t off, size_t count) |
| 628 | char *buf, loff_t off, size_t count) | ||
| 629 | { | 623 | { |
| 630 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 624 | struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device, |
| 625 | kobj)); | ||
| 631 | unsigned int size = 64; | 626 | unsigned int size = 64; |
| 632 | loff_t init_off = off; | 627 | loff_t init_off = off; |
| 633 | u8 *data = (u8*) buf; | 628 | u8 *data = (u8 *) buf; |
| 634 | 629 | ||
| 635 | /* Several chips lock up trying to read undefined config space */ | 630 | /* Several chips lock up trying to read undefined config space */ |
| 636 | if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0) { | 631 | if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0) |
| 637 | size = dev->cfg_size; | 632 | size = dev->cfg_size; |
| 638 | } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { | 633 | else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) |
| 639 | size = 128; | 634 | size = 128; |
| 640 | } | ||
| 641 | 635 | ||
| 642 | if (off > size) | 636 | if (off > size) |
| 643 | return 0; | 637 | return 0; |
| @@ -700,15 +694,15 @@ pci_read_config(struct file *filp, struct kobject *kobj, | |||
| 700 | return count; | 694 | return count; |
| 701 | } | 695 | } |
| 702 | 696 | ||
| 703 | static ssize_t | 697 | static ssize_t pci_write_config(struct file *filp, struct kobject *kobj, |
| 704 | pci_write_config(struct file* filp, struct kobject *kobj, | 698 | struct bin_attribute *bin_attr, char *buf, |
| 705 | struct bin_attribute *bin_attr, | 699 | loff_t off, size_t count) |
| 706 | char *buf, loff_t off, size_t count) | ||
| 707 | { | 700 | { |
| 708 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 701 | struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device, |
| 702 | kobj)); | ||
| 709 | unsigned int size = count; | 703 | unsigned int size = count; |
| 710 | loff_t init_off = off; | 704 | loff_t init_off = off; |
| 711 | u8 *data = (u8*) buf; | 705 | u8 *data = (u8 *) buf; |
| 712 | 706 | ||
| 713 | if (off > dev->cfg_size) | 707 | if (off > dev->cfg_size) |
| 714 | return 0; | 708 | return 0; |
| @@ -728,10 +722,10 @@ pci_write_config(struct file* filp, struct kobject *kobj, | |||
| 728 | if ((off & 3) && size > 2) { | 722 | if ((off & 3) && size > 2) { |
| 729 | u16 val = data[off - init_off]; | 723 | u16 val = data[off - init_off]; |
| 730 | val |= (u16) data[off - init_off + 1] << 8; | 724 | val |= (u16) data[off - init_off + 1] << 8; |
| 731 | pci_user_write_config_word(dev, off, val); | 725 | pci_user_write_config_word(dev, off, val); |
| 732 | off += 2; | 726 | off += 2; |
| 733 | size -= 2; | 727 | size -= 2; |
| 734 | } | 728 | } |
| 735 | 729 | ||
| 736 | while (size > 3) { | 730 | while (size > 3) { |
| 737 | u32 val = data[off - init_off]; | 731 | u32 val = data[off - init_off]; |
| @@ -762,10 +756,9 @@ pci_write_config(struct file* filp, struct kobject *kobj, | |||
| 762 | return count; | 756 | return count; |
| 763 | } | 757 | } |
| 764 | 758 | ||
| 765 | static ssize_t | 759 | static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj, |
| 766 | read_vpd_attr(struct file *filp, struct kobject *kobj, | 760 | struct bin_attribute *bin_attr, char *buf, |
| 767 | struct bin_attribute *bin_attr, | 761 | loff_t off, size_t count) |
| 768 | char *buf, loff_t off, size_t count) | ||
| 769 | { | 762 | { |
| 770 | struct pci_dev *dev = | 763 | struct pci_dev *dev = |
| 771 | to_pci_dev(container_of(kobj, struct device, kobj)); | 764 | to_pci_dev(container_of(kobj, struct device, kobj)); |
| @@ -778,10 +771,9 @@ read_vpd_attr(struct file *filp, struct kobject *kobj, | |||
| 778 | return pci_read_vpd(dev, off, count, buf); | 771 | return pci_read_vpd(dev, off, count, buf); |
| 779 | } | 772 | } |
| 780 | 773 | ||
| 781 | static ssize_t | 774 | static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj, |
| 782 | write_vpd_attr(struct file *filp, struct kobject *kobj, | 775 | struct bin_attribute *bin_attr, char *buf, |
| 783 | struct bin_attribute *bin_attr, | 776 | loff_t off, size_t count) |
| 784 | char *buf, loff_t off, size_t count) | ||
| 785 | { | 777 | { |
| 786 | struct pci_dev *dev = | 778 | struct pci_dev *dev = |
| 787 | to_pci_dev(container_of(kobj, struct device, kobj)); | 779 | to_pci_dev(container_of(kobj, struct device, kobj)); |
| @@ -807,20 +799,18 @@ write_vpd_attr(struct file *filp, struct kobject *kobj, | |||
| 807 | * Reads 1, 2, or 4 bytes from legacy I/O port space using an arch specific | 799 | * Reads 1, 2, or 4 bytes from legacy I/O port space using an arch specific |
| 808 | * callback routine (pci_legacy_read). | 800 | * callback routine (pci_legacy_read). |
| 809 | */ | 801 | */ |
| 810 | static ssize_t | 802 | static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj, |
| 811 | pci_read_legacy_io(struct file *filp, struct kobject *kobj, | 803 | struct bin_attribute *bin_attr, char *buf, |
| 812 | struct bin_attribute *bin_attr, | 804 | loff_t off, size_t count) |
| 813 | char *buf, loff_t off, size_t count) | ||
| 814 | { | 805 | { |
| 815 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 806 | struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, |
| 816 | struct device, | ||
| 817 | kobj)); | 807 | kobj)); |
| 818 | 808 | ||
| 819 | /* Only support 1, 2 or 4 byte accesses */ | 809 | /* Only support 1, 2 or 4 byte accesses */ |
| 820 | if (count != 1 && count != 2 && count != 4) | 810 | if (count != 1 && count != 2 && count != 4) |
| 821 | return -EINVAL; | 811 | return -EINVAL; |
| 822 | 812 | ||
| 823 | return pci_legacy_read(bus, off, (u32 *)buf, count); | 813 | return pci_legacy_read(bus, off, (u32 *)buf, count); |
| 824 | } | 814 | } |
| 825 | 815 | ||
| 826 | /** | 816 | /** |
| @@ -835,19 +825,18 @@ pci_read_legacy_io(struct file *filp, struct kobject *kobj, | |||
| 835 | * Writes 1, 2, or 4 bytes from legacy I/O port space using an arch specific | 825 | * Writes 1, 2, or 4 bytes from legacy I/O port space using an arch specific |
| 836 | * callback routine (pci_legacy_write). | 826 | * callback routine (pci_legacy_write). |
| 837 | */ | 827 | */ |
| 838 | static ssize_t | 828 | static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj, |
| 839 | pci_write_legacy_io(struct file *filp, struct kobject *kobj, | 829 | struct bin_attribute *bin_attr, char *buf, |
| 840 | struct bin_attribute *bin_attr, | 830 | loff_t off, size_t count) |
| 841 | char *buf, loff_t off, size_t count) | ||
| 842 | { | 831 | { |
| 843 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 832 | struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, |
| 844 | struct device, | ||
| 845 | kobj)); | 833 | kobj)); |
| 846 | /* Only support 1, 2 or 4 byte accesses */ | ||
| 847 | if (count != 1 && count != 2 && count != 4) | ||
| 848 | return -EINVAL; | ||
| 849 | 834 | ||
| 850 | return pci_legacy_write(bus, off, *(u32 *)buf, count); | 835 | /* Only support 1, 2 or 4 byte accesses */ |
| 836 | if (count != 1 && count != 2 && count != 4) | ||
| 837 | return -EINVAL; | ||
| 838 | |||
| 839 | return pci_legacy_write(bus, off, *(u32 *)buf, count); | ||
| 851 | } | 840 | } |
| 852 | 841 | ||
| 853 | /** | 842 | /** |
| @@ -861,16 +850,14 @@ pci_write_legacy_io(struct file *filp, struct kobject *kobj, | |||
| 861 | * legacy memory space (first meg of bus space) into application virtual | 850 | * legacy memory space (first meg of bus space) into application virtual |
| 862 | * memory space. | 851 | * memory space. |
| 863 | */ | 852 | */ |
| 864 | static int | 853 | static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, |
| 865 | pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, | 854 | struct bin_attribute *attr, |
| 866 | struct bin_attribute *attr, | 855 | struct vm_area_struct *vma) |
| 867 | struct vm_area_struct *vma) | ||
| 868 | { | 856 | { |
| 869 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 857 | struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, |
| 870 | struct device, | ||
| 871 | kobj)); | 858 | kobj)); |
| 872 | 859 | ||
| 873 | return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem); | 860 | return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem); |
| 874 | } | 861 | } |
| 875 | 862 | ||
| 876 | /** | 863 | /** |
| @@ -884,16 +871,14 @@ pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, | |||
| 884 | * legacy IO space (first meg of bus space) into application virtual | 871 | * legacy IO space (first meg of bus space) into application virtual |
| 885 | * memory space. Returns -ENOSYS if the operation isn't supported | 872 | * memory space. Returns -ENOSYS if the operation isn't supported |
| 886 | */ | 873 | */ |
| 887 | static int | 874 | static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, |
| 888 | pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, | 875 | struct bin_attribute *attr, |
| 889 | struct bin_attribute *attr, | 876 | struct vm_area_struct *vma) |
| 890 | struct vm_area_struct *vma) | ||
| 891 | { | 877 | { |
| 892 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 878 | struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, |
| 893 | struct device, | ||
| 894 | kobj)); | 879 | kobj)); |
| 895 | 880 | ||
| 896 | return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io); | 881 | return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io); |
| 897 | } | 882 | } |
| 898 | 883 | ||
| 899 | /** | 884 | /** |
| @@ -903,10 +888,9 @@ pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, | |||
| 903 | * | 888 | * |
| 904 | * Stub implementation. Can be overridden by arch if necessary. | 889 | * Stub implementation. Can be overridden by arch if necessary. |
| 905 | */ | 890 | */ |
| 906 | void __weak | 891 | void __weak pci_adjust_legacy_attr(struct pci_bus *b, |
| 907 | pci_adjust_legacy_attr(struct pci_bus *b, enum pci_mmap_state mmap_type) | 892 | enum pci_mmap_state mmap_type) |
| 908 | { | 893 | { |
| 909 | return; | ||
| 910 | } | 894 | } |
| 911 | 895 | ||
| 912 | /** | 896 | /** |
| @@ -961,8 +945,7 @@ legacy_io_err: | |||
| 961 | kfree(b->legacy_io); | 945 | kfree(b->legacy_io); |
| 962 | b->legacy_io = NULL; | 946 | b->legacy_io = NULL; |
| 963 | kzalloc_err: | 947 | kzalloc_err: |
| 964 | printk(KERN_WARNING "pci: warning: could not create legacy I/O port " | 948 | printk(KERN_WARNING "pci: warning: could not create legacy I/O port and ISA memory resources to sysfs\n"); |
| 965 | "and ISA memory resources to sysfs\n"); | ||
| 966 | return; | 949 | return; |
| 967 | } | 950 | } |
| 968 | 951 | ||
| @@ -1005,9 +988,8 @@ int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma, | |||
| 1005 | * | 988 | * |
| 1006 | * Use the regular PCI mapping routines to map a PCI resource into userspace. | 989 | * Use the regular PCI mapping routines to map a PCI resource into userspace. |
| 1007 | */ | 990 | */ |
| 1008 | static int | 991 | static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, |
| 1009 | pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | 992 | struct vm_area_struct *vma, int write_combine) |
| 1010 | struct vm_area_struct *vma, int write_combine) | ||
| 1011 | { | 993 | { |
| 1012 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, | 994 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, |
| 1013 | struct device, kobj)); | 995 | struct device, kobj)); |
| @@ -1023,8 +1005,7 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
| 1023 | return -ENODEV; | 1005 | return -ENODEV; |
| 1024 | 1006 | ||
| 1025 | if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) { | 1007 | if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) { |
| 1026 | WARN(1, "process \"%s\" tried to map 0x%08lx bytes " | 1008 | WARN(1, "process \"%s\" tried to map 0x%08lx bytes at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", |
| 1027 | "at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", | ||
| 1028 | current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, | 1009 | current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, |
| 1029 | pci_name(pdev), i, | 1010 | pci_name(pdev), i, |
| 1030 | (u64)pci_resource_start(pdev, i), | 1011 | (u64)pci_resource_start(pdev, i), |
| @@ -1046,26 +1027,23 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
| 1046 | return pci_mmap_page_range(pdev, vma, mmap_type, write_combine); | 1027 | return pci_mmap_page_range(pdev, vma, mmap_type, write_combine); |
| 1047 | } | 1028 | } |
| 1048 | 1029 | ||
| 1049 | static int | 1030 | static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj, |
| 1050 | pci_mmap_resource_uc(struct file *filp, struct kobject *kobj, | 1031 | struct bin_attribute *attr, |
| 1051 | struct bin_attribute *attr, | 1032 | struct vm_area_struct *vma) |
| 1052 | struct vm_area_struct *vma) | ||
| 1053 | { | 1033 | { |
| 1054 | return pci_mmap_resource(kobj, attr, vma, 0); | 1034 | return pci_mmap_resource(kobj, attr, vma, 0); |
| 1055 | } | 1035 | } |
| 1056 | 1036 | ||
| 1057 | static int | 1037 | static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, |
| 1058 | pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, | 1038 | struct bin_attribute *attr, |
| 1059 | struct bin_attribute *attr, | 1039 | struct vm_area_struct *vma) |
| 1060 | struct vm_area_struct *vma) | ||
| 1061 | { | 1040 | { |
| 1062 | return pci_mmap_resource(kobj, attr, vma, 1); | 1041 | return pci_mmap_resource(kobj, attr, vma, 1); |
| 1063 | } | 1042 | } |
| 1064 | 1043 | ||
| 1065 | static ssize_t | 1044 | static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, |
| 1066 | pci_resource_io(struct file *filp, struct kobject *kobj, | 1045 | struct bin_attribute *attr, char *buf, |
| 1067 | struct bin_attribute *attr, char *buf, | 1046 | loff_t off, size_t count, bool write) |
| 1068 | loff_t off, size_t count, bool write) | ||
| 1069 | { | 1047 | { |
| 1070 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, | 1048 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, |
| 1071 | struct device, kobj)); | 1049 | struct device, kobj)); |
| @@ -1110,18 +1088,16 @@ pci_resource_io(struct file *filp, struct kobject *kobj, | |||
| 1110 | return -EINVAL; | 1088 | return -EINVAL; |
| 1111 | } | 1089 | } |
| 1112 | 1090 | ||
| 1113 | static ssize_t | 1091 | static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj, |
| 1114 | pci_read_resource_io(struct file *filp, struct kobject *kobj, | 1092 | struct bin_attribute *attr, char *buf, |
| 1115 | struct bin_attribute *attr, char *buf, | 1093 | loff_t off, size_t count) |
| 1116 | loff_t off, size_t count) | ||
| 1117 | { | 1094 | { |
| 1118 | return pci_resource_io(filp, kobj, attr, buf, off, count, false); | 1095 | return pci_resource_io(filp, kobj, attr, buf, off, count, false); |
| 1119 | } | 1096 | } |
| 1120 | 1097 | ||
| 1121 | static ssize_t | 1098 | static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj, |
| 1122 | pci_write_resource_io(struct file *filp, struct kobject *kobj, | 1099 | struct bin_attribute *attr, char *buf, |
| 1123 | struct bin_attribute *attr, char *buf, | 1100 | loff_t off, size_t count) |
| 1124 | loff_t off, size_t count) | ||
| 1125 | { | 1101 | { |
| 1126 | return pci_resource_io(filp, kobj, attr, buf, off, count, true); | 1102 | return pci_resource_io(filp, kobj, attr, buf, off, count, true); |
| 1127 | } | 1103 | } |
| @@ -1133,8 +1109,7 @@ pci_write_resource_io(struct file *filp, struct kobject *kobj, | |||
| 1133 | * If we created resource files for @pdev, remove them from sysfs and | 1109 | * If we created resource files for @pdev, remove them from sysfs and |
| 1134 | * free their resources. | 1110 | * free their resources. |
| 1135 | */ | 1111 | */ |
| 1136 | static void | 1112 | static void pci_remove_resource_files(struct pci_dev *pdev) |
| 1137 | pci_remove_resource_files(struct pci_dev *pdev) | ||
| 1138 | { | 1113 | { |
| 1139 | int i; | 1114 | int i; |
| 1140 | 1115 | ||
| @@ -1237,10 +1212,9 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; } | |||
| 1237 | * | 1212 | * |
| 1238 | * writing anything except 0 enables it | 1213 | * writing anything except 0 enables it |
| 1239 | */ | 1214 | */ |
| 1240 | static ssize_t | 1215 | static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj, |
| 1241 | pci_write_rom(struct file *filp, struct kobject *kobj, | 1216 | struct bin_attribute *bin_attr, char *buf, |
| 1242 | struct bin_attribute *bin_attr, | 1217 | loff_t off, size_t count) |
| 1243 | char *buf, loff_t off, size_t count) | ||
| 1244 | { | 1218 | { |
| 1245 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); | 1219 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); |
| 1246 | 1220 | ||
| @@ -1264,10 +1238,9 @@ pci_write_rom(struct file *filp, struct kobject *kobj, | |||
| 1264 | * Put @count bytes starting at @off into @buf from the ROM in the PCI | 1238 | * Put @count bytes starting at @off into @buf from the ROM in the PCI |
| 1265 | * device corresponding to @kobj. | 1239 | * device corresponding to @kobj. |
| 1266 | */ | 1240 | */ |
| 1267 | static ssize_t | 1241 | static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj, |
| 1268 | pci_read_rom(struct file *filp, struct kobject *kobj, | 1242 | struct bin_attribute *bin_attr, char *buf, |
| 1269 | struct bin_attribute *bin_attr, | 1243 | loff_t off, size_t count) |
| 1270 | char *buf, loff_t off, size_t count) | ||
| 1271 | { | 1244 | { |
| 1272 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); | 1245 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); |
| 1273 | void __iomem *rom; | 1246 | void __iomem *rom; |
| @@ -1313,9 +1286,8 @@ static struct bin_attribute pcie_config_attr = { | |||
| 1313 | .write = pci_write_config, | 1286 | .write = pci_write_config, |
| 1314 | }; | 1287 | }; |
| 1315 | 1288 | ||
| 1316 | static ssize_t reset_store(struct device *dev, | 1289 | static ssize_t reset_store(struct device *dev, struct device_attribute *attr, |
| 1317 | struct device_attribute *attr, const char *buf, | 1290 | const char *buf, size_t count) |
| 1318 | size_t count) | ||
| 1319 | { | 1291 | { |
| 1320 | struct pci_dev *pdev = to_pci_dev(dev); | 1292 | struct pci_dev *pdev = to_pci_dev(dev); |
| 1321 | unsigned long val; | 1293 | unsigned long val; |
| @@ -1382,7 +1354,7 @@ error: | |||
| 1382 | return retval; | 1354 | return retval; |
| 1383 | } | 1355 | } |
| 1384 | 1356 | ||
| 1385 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | 1357 | int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev) |
| 1386 | { | 1358 | { |
| 1387 | int retval; | 1359 | int retval; |
| 1388 | int rom_size = 0; | 1360 | int rom_size = 0; |
| @@ -1520,7 +1492,6 @@ static int __init pci_sysfs_init(void) | |||
| 1520 | 1492 | ||
| 1521 | return 0; | 1493 | return 0; |
| 1522 | } | 1494 | } |
| 1523 | |||
| 1524 | late_initcall(pci_sysfs_init); | 1495 | late_initcall(pci_sysfs_init); |
| 1525 | 1496 | ||
| 1526 | static struct attribute *pci_dev_dev_attrs[] = { | 1497 | static struct attribute *pci_dev_dev_attrs[] = { |
| @@ -1529,7 +1500,7 @@ static struct attribute *pci_dev_dev_attrs[] = { | |||
| 1529 | }; | 1500 | }; |
| 1530 | 1501 | ||
| 1531 | static umode_t pci_dev_attrs_are_visible(struct kobject *kobj, | 1502 | static umode_t pci_dev_attrs_are_visible(struct kobject *kobj, |
| 1532 | struct attribute *a, int n) | 1503 | struct attribute *a, int n) |
| 1533 | { | 1504 | { |
| 1534 | struct device *dev = container_of(kobj, struct device, kobj); | 1505 | struct device *dev = container_of(kobj, struct device, kobj); |
| 1535 | struct pci_dev *pdev = to_pci_dev(dev); | 1506 | struct pci_dev *pdev = to_pci_dev(dev); |
| @@ -1548,7 +1519,7 @@ static struct attribute *pci_dev_hp_attrs[] = { | |||
| 1548 | }; | 1519 | }; |
| 1549 | 1520 | ||
| 1550 | static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj, | 1521 | static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj, |
| 1551 | struct attribute *a, int n) | 1522 | struct attribute *a, int n) |
| 1552 | { | 1523 | { |
| 1553 | struct device *dev = container_of(kobj, struct device, kobj); | 1524 | struct device *dev = container_of(kobj, struct device, kobj); |
| 1554 | struct pci_dev *pdev = to_pci_dev(dev); | 1525 | struct pci_dev *pdev = to_pci_dev(dev); |
| @@ -1572,7 +1543,7 @@ static struct attribute *sriov_dev_attrs[] = { | |||
| 1572 | }; | 1543 | }; |
| 1573 | 1544 | ||
| 1574 | static umode_t sriov_attrs_are_visible(struct kobject *kobj, | 1545 | static umode_t sriov_attrs_are_visible(struct kobject *kobj, |
| 1575 | struct attribute *a, int n) | 1546 | struct attribute *a, int n) |
| 1576 | { | 1547 | { |
| 1577 | struct device *dev = container_of(kobj, struct device, kobj); | 1548 | struct device *dev = container_of(kobj, struct device, kobj); |
| 1578 | 1549 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 212c63d780e7..63a54a340863 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -114,7 +114,7 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus) | |||
| 114 | max = bus->busn_res.end; | 114 | max = bus->busn_res.end; |
| 115 | list_for_each_entry(tmp, &bus->children, node) { | 115 | list_for_each_entry(tmp, &bus->children, node) { |
| 116 | n = pci_bus_max_busnr(tmp); | 116 | n = pci_bus_max_busnr(tmp); |
| 117 | if(n > max) | 117 | if (n > max) |
| 118 | max = n; | 118 | max = n; |
| 119 | } | 119 | } |
| 120 | return max; | 120 | return max; |
| @@ -226,6 +226,7 @@ int pci_find_capability(struct pci_dev *dev, int cap) | |||
| 226 | 226 | ||
| 227 | return pos; | 227 | return pos; |
| 228 | } | 228 | } |
| 229 | EXPORT_SYMBOL(pci_find_capability); | ||
| 229 | 230 | ||
| 230 | /** | 231 | /** |
| 231 | * pci_bus_find_capability - query for devices' capabilities | 232 | * pci_bus_find_capability - query for devices' capabilities |
| @@ -253,6 +254,7 @@ int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap) | |||
| 253 | 254 | ||
| 254 | return pos; | 255 | return pos; |
| 255 | } | 256 | } |
| 257 | EXPORT_SYMBOL(pci_bus_find_capability); | ||
| 256 | 258 | ||
| 257 | /** | 259 | /** |
| 258 | * pci_find_next_ext_capability - Find an extended capability | 260 | * pci_find_next_ext_capability - Find an extended capability |
| @@ -403,8 +405,8 @@ EXPORT_SYMBOL_GPL(pci_find_ht_capability); | |||
| 403 | * For given resource region of given device, return the resource | 405 | * For given resource region of given device, return the resource |
| 404 | * region of parent bus the given region is contained in. | 406 | * region of parent bus the given region is contained in. |
| 405 | */ | 407 | */ |
| 406 | struct resource * | 408 | struct resource *pci_find_parent_resource(const struct pci_dev *dev, |
| 407 | pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) | 409 | struct resource *res) |
| 408 | { | 410 | { |
| 409 | const struct pci_bus *bus = dev->bus; | 411 | const struct pci_bus *bus = dev->bus; |
| 410 | struct resource *r; | 412 | struct resource *r; |
| @@ -436,6 +438,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) | |||
| 436 | } | 438 | } |
| 437 | return NULL; | 439 | return NULL; |
| 438 | } | 440 | } |
| 441 | EXPORT_SYMBOL(pci_find_parent_resource); | ||
| 439 | 442 | ||
| 440 | /** | 443 | /** |
| 441 | * pci_wait_for_pending - wait for @mask bit(s) to clear in status word @pos | 444 | * pci_wait_for_pending - wait for @mask bit(s) to clear in status word @pos |
| @@ -470,8 +473,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask) | |||
| 470 | * Restore the BAR values for a given device, so as to make it | 473 | * Restore the BAR values for a given device, so as to make it |
| 471 | * accessible by its driver. | 474 | * accessible by its driver. |
| 472 | */ | 475 | */ |
| 473 | static void | 476 | static void pci_restore_bars(struct pci_dev *dev) |
| 474 | pci_restore_bars(struct pci_dev *dev) | ||
| 475 | { | 477 | { |
| 476 | int i; | 478 | int i; |
| 477 | 479 | ||
| @@ -496,7 +498,7 @@ static inline bool platform_pci_power_manageable(struct pci_dev *dev) | |||
| 496 | } | 498 | } |
| 497 | 499 | ||
| 498 | static inline int platform_pci_set_power_state(struct pci_dev *dev, | 500 | static inline int platform_pci_set_power_state(struct pci_dev *dev, |
| 499 | pci_power_t t) | 501 | pci_power_t t) |
| 500 | { | 502 | { |
| 501 | return pci_platform_pm ? pci_platform_pm->set_state(dev, t) : -ENOSYS; | 503 | return pci_platform_pm ? pci_platform_pm->set_state(dev, t) : -ENOSYS; |
| 502 | } | 504 | } |
| @@ -553,8 +555,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
| 553 | */ | 555 | */ |
| 554 | if (state != PCI_D0 && dev->current_state <= PCI_D3cold | 556 | if (state != PCI_D0 && dev->current_state <= PCI_D3cold |
| 555 | && dev->current_state > state) { | 557 | && dev->current_state > state) { |
| 556 | dev_err(&dev->dev, "invalid power transition " | 558 | dev_err(&dev->dev, "invalid power transition (from state %d to %d)\n", |
| 557 | "(from state %d to %d)\n", dev->current_state, state); | 559 | dev->current_state, state); |
| 558 | return -EINVAL; | 560 | return -EINVAL; |
| 559 | } | 561 | } |
| 560 | 562 | ||
| @@ -601,8 +603,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
| 601 | pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); | 603 | pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); |
| 602 | dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); | 604 | dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); |
| 603 | if (dev->current_state != state && printk_ratelimit()) | 605 | if (dev->current_state != state && printk_ratelimit()) |
| 604 | dev_info(&dev->dev, "Refused to change power state, " | 606 | dev_info(&dev->dev, "Refused to change power state, currently in D%d\n", |
| 605 | "currently in D%d\n", dev->current_state); | 607 | dev->current_state); |
| 606 | 608 | ||
| 607 | /* | 609 | /* |
| 608 | * According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT | 610 | * According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT |
| @@ -846,6 +848,7 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
| 846 | 848 | ||
| 847 | return error; | 849 | return error; |
| 848 | } | 850 | } |
| 851 | EXPORT_SYMBOL(pci_set_power_state); | ||
| 849 | 852 | ||
| 850 | /** | 853 | /** |
| 851 | * pci_choose_state - Choose the power state of a PCI device | 854 | * pci_choose_state - Choose the power state of a PCI device |
| @@ -884,12 +887,10 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) | |||
| 884 | } | 887 | } |
| 885 | return PCI_D0; | 888 | return PCI_D0; |
| 886 | } | 889 | } |
| 887 | |||
| 888 | EXPORT_SYMBOL(pci_choose_state); | 890 | EXPORT_SYMBOL(pci_choose_state); |
| 889 | 891 | ||
| 890 | #define PCI_EXP_SAVE_REGS 7 | 892 | #define PCI_EXP_SAVE_REGS 7 |
| 891 | 893 | ||
| 892 | |||
| 893 | static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev, | 894 | static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev, |
| 894 | u16 cap, bool extended) | 895 | u16 cap, bool extended) |
| 895 | { | 896 | { |
| @@ -1001,8 +1002,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev) | |||
| 1001 | * pci_save_state - save the PCI configuration space of a device before suspending | 1002 | * pci_save_state - save the PCI configuration space of a device before suspending |
| 1002 | * @dev: - PCI device that we're dealing with | 1003 | * @dev: - PCI device that we're dealing with |
| 1003 | */ | 1004 | */ |
| 1004 | int | 1005 | int pci_save_state(struct pci_dev *dev) |
| 1005 | pci_save_state(struct pci_dev *dev) | ||
| 1006 | { | 1006 | { |
| 1007 | int i; | 1007 | int i; |
| 1008 | /* XXX: 100% dword access ok here? */ | 1008 | /* XXX: 100% dword access ok here? */ |
| @@ -1017,6 +1017,7 @@ pci_save_state(struct pci_dev *dev) | |||
| 1017 | return i; | 1017 | return i; |
| 1018 | return 0; | 1018 | return 0; |
| 1019 | } | 1019 | } |
| 1020 | EXPORT_SYMBOL(pci_save_state); | ||
| 1020 | 1021 | ||
| 1021 | static void pci_restore_config_dword(struct pci_dev *pdev, int offset, | 1022 | static void pci_restore_config_dword(struct pci_dev *pdev, int offset, |
| 1022 | u32 saved_val, int retry) | 1023 | u32 saved_val, int retry) |
| @@ -1028,8 +1029,8 @@ static void pci_restore_config_dword(struct pci_dev *pdev, int offset, | |||
| 1028 | return; | 1029 | return; |
| 1029 | 1030 | ||
| 1030 | for (;;) { | 1031 | for (;;) { |
| 1031 | dev_dbg(&pdev->dev, "restoring config space at offset " | 1032 | dev_dbg(&pdev->dev, "restoring config space at offset %#x (was %#x, writing %#x)\n", |
| 1032 | "%#x (was %#x, writing %#x)\n", offset, val, saved_val); | 1033 | offset, val, saved_val); |
| 1033 | pci_write_config_dword(pdev, offset, saved_val); | 1034 | pci_write_config_dword(pdev, offset, saved_val); |
| 1034 | if (retry-- <= 0) | 1035 | if (retry-- <= 0) |
| 1035 | return; | 1036 | return; |
| @@ -1087,6 +1088,7 @@ void pci_restore_state(struct pci_dev *dev) | |||
| 1087 | 1088 | ||
| 1088 | dev->state_saved = false; | 1089 | dev->state_saved = false; |
| 1089 | } | 1090 | } |
| 1091 | EXPORT_SYMBOL(pci_restore_state); | ||
| 1090 | 1092 | ||
| 1091 | struct pci_saved_state { | 1093 | struct pci_saved_state { |
| 1092 | u32 config_space[16]; | 1094 | u32 config_space[16]; |
| @@ -1231,6 +1233,7 @@ int pci_reenable_device(struct pci_dev *dev) | |||
| 1231 | return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); | 1233 | return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); |
| 1232 | return 0; | 1234 | return 0; |
| 1233 | } | 1235 | } |
| 1236 | EXPORT_SYMBOL(pci_reenable_device); | ||
| 1234 | 1237 | ||
| 1235 | static void pci_enable_bridge(struct pci_dev *dev) | 1238 | static void pci_enable_bridge(struct pci_dev *dev) |
| 1236 | { | 1239 | { |
| @@ -1305,6 +1308,7 @@ int pci_enable_device_io(struct pci_dev *dev) | |||
| 1305 | { | 1308 | { |
| 1306 | return pci_enable_device_flags(dev, IORESOURCE_IO); | 1309 | return pci_enable_device_flags(dev, IORESOURCE_IO); |
| 1307 | } | 1310 | } |
| 1311 | EXPORT_SYMBOL(pci_enable_device_io); | ||
| 1308 | 1312 | ||
| 1309 | /** | 1313 | /** |
| 1310 | * pci_enable_device_mem - Initialize a device for use with Memory space | 1314 | * pci_enable_device_mem - Initialize a device for use with Memory space |
| @@ -1318,6 +1322,7 @@ int pci_enable_device_mem(struct pci_dev *dev) | |||
| 1318 | { | 1322 | { |
| 1319 | return pci_enable_device_flags(dev, IORESOURCE_MEM); | 1323 | return pci_enable_device_flags(dev, IORESOURCE_MEM); |
| 1320 | } | 1324 | } |
| 1325 | EXPORT_SYMBOL(pci_enable_device_mem); | ||
| 1321 | 1326 | ||
| 1322 | /** | 1327 | /** |
| 1323 | * pci_enable_device - Initialize device before it's used by a driver. | 1328 | * pci_enable_device - Initialize device before it's used by a driver. |
| @@ -1334,6 +1339,7 @@ int pci_enable_device(struct pci_dev *dev) | |||
| 1334 | { | 1339 | { |
| 1335 | return pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO); | 1340 | return pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO); |
| 1336 | } | 1341 | } |
| 1342 | EXPORT_SYMBOL(pci_enable_device); | ||
| 1337 | 1343 | ||
| 1338 | /* | 1344 | /* |
| 1339 | * Managed PCI resources. This manages device on/off, intx/msi/msix | 1345 | * Managed PCI resources. This manages device on/off, intx/msi/msix |
| @@ -1416,6 +1422,7 @@ int pcim_enable_device(struct pci_dev *pdev) | |||
| 1416 | } | 1422 | } |
| 1417 | return rc; | 1423 | return rc; |
| 1418 | } | 1424 | } |
| 1425 | EXPORT_SYMBOL(pcim_enable_device); | ||
| 1419 | 1426 | ||
| 1420 | /** | 1427 | /** |
| 1421 | * pcim_pin_device - Pin managed PCI device | 1428 | * pcim_pin_device - Pin managed PCI device |
| @@ -1434,6 +1441,7 @@ void pcim_pin_device(struct pci_dev *pdev) | |||
| 1434 | if (dr) | 1441 | if (dr) |
| 1435 | dr->pinned = 1; | 1442 | dr->pinned = 1; |
| 1436 | } | 1443 | } |
| 1444 | EXPORT_SYMBOL(pcim_pin_device); | ||
| 1437 | 1445 | ||
| 1438 | /* | 1446 | /* |
| 1439 | * pcibios_add_device - provide arch specific hooks when adding device dev | 1447 | * pcibios_add_device - provide arch specific hooks when adding device dev |
| @@ -1443,7 +1451,7 @@ void pcim_pin_device(struct pci_dev *pdev) | |||
| 1443 | * devices are added. This is the default implementation. Architecture | 1451 | * devices are added. This is the default implementation. Architecture |
| 1444 | * implementations can override this. | 1452 | * implementations can override this. |
| 1445 | */ | 1453 | */ |
| 1446 | int __weak pcibios_add_device (struct pci_dev *dev) | 1454 | int __weak pcibios_add_device(struct pci_dev *dev) |
| 1447 | { | 1455 | { |
| 1448 | return 0; | 1456 | return 0; |
| 1449 | } | 1457 | } |
| @@ -1515,8 +1523,7 @@ void pci_disable_enabled_device(struct pci_dev *dev) | |||
| 1515 | * Note we don't actually disable the device until all callers of | 1523 | * Note we don't actually disable the device until all callers of |
| 1516 | * pci_enable_device() have called pci_disable_device(). | 1524 | * pci_enable_device() have called pci_disable_device(). |
| 1517 | */ | 1525 | */ |
| 1518 | void | 1526 | void pci_disable_device(struct pci_dev *dev) |
| 1519 | pci_disable_device(struct pci_dev *dev) | ||
| 1520 | { | 1527 | { |
| 1521 | struct pci_devres *dr; | 1528 | struct pci_devres *dr; |
| 1522 | 1529 | ||
| @@ -1534,6 +1541,7 @@ pci_disable_device(struct pci_dev *dev) | |||
| 1534 | 1541 | ||
| 1535 | dev->is_busmaster = 0; | 1542 | dev->is_busmaster = 0; |
| 1536 | } | 1543 | } |
| 1544 | EXPORT_SYMBOL(pci_disable_device); | ||
| 1537 | 1545 | ||
| 1538 | /** | 1546 | /** |
| 1539 | * pcibios_set_pcie_reset_state - set reset state for device dev | 1547 | * pcibios_set_pcie_reset_state - set reset state for device dev |
| @@ -1562,6 +1570,7 @@ int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state) | |||
| 1562 | { | 1570 | { |
| 1563 | return pcibios_set_pcie_reset_state(dev, state); | 1571 | return pcibios_set_pcie_reset_state(dev, state); |
| 1564 | } | 1572 | } |
| 1573 | EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); | ||
| 1565 | 1574 | ||
| 1566 | /** | 1575 | /** |
| 1567 | * pci_check_pme_status - Check if given device has generated PME. | 1576 | * pci_check_pme_status - Check if given device has generated PME. |
| @@ -1641,6 +1650,7 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state) | |||
| 1641 | 1650 | ||
| 1642 | return !!(dev->pme_support & (1 << state)); | 1651 | return !!(dev->pme_support & (1 << state)); |
| 1643 | } | 1652 | } |
| 1653 | EXPORT_SYMBOL(pci_pme_capable); | ||
| 1644 | 1654 | ||
| 1645 | static void pci_pme_list_scan(struct work_struct *work) | 1655 | static void pci_pme_list_scan(struct work_struct *work) |
| 1646 | { | 1656 | { |
| @@ -1745,6 +1755,7 @@ void pci_pme_active(struct pci_dev *dev, bool enable) | |||
| 1745 | 1755 | ||
| 1746 | dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); | 1756 | dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); |
| 1747 | } | 1757 | } |
| 1758 | EXPORT_SYMBOL(pci_pme_active); | ||
| 1748 | 1759 | ||
| 1749 | /** | 1760 | /** |
| 1750 | * __pci_enable_wake - enable PCI device as wakeup event source | 1761 | * __pci_enable_wake - enable PCI device as wakeup event source |
| @@ -1830,6 +1841,7 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable) | |||
| 1830 | pci_enable_wake(dev, PCI_D3cold, enable) : | 1841 | pci_enable_wake(dev, PCI_D3cold, enable) : |
| 1831 | pci_enable_wake(dev, PCI_D3hot, enable); | 1842 | pci_enable_wake(dev, PCI_D3hot, enable); |
| 1832 | } | 1843 | } |
| 1844 | EXPORT_SYMBOL(pci_wake_from_d3); | ||
| 1833 | 1845 | ||
| 1834 | /** | 1846 | /** |
| 1835 | * pci_target_state - find an appropriate low power state for a given PCI dev | 1847 | * pci_target_state - find an appropriate low power state for a given PCI dev |
| @@ -1908,6 +1920,7 @@ int pci_prepare_to_sleep(struct pci_dev *dev) | |||
| 1908 | 1920 | ||
| 1909 | return error; | 1921 | return error; |
| 1910 | } | 1922 | } |
| 1923 | EXPORT_SYMBOL(pci_prepare_to_sleep); | ||
| 1911 | 1924 | ||
| 1912 | /** | 1925 | /** |
| 1913 | * pci_back_from_sleep - turn PCI device on during system-wide transition into working state | 1926 | * pci_back_from_sleep - turn PCI device on during system-wide transition into working state |
| @@ -1920,6 +1933,7 @@ int pci_back_from_sleep(struct pci_dev *dev) | |||
| 1920 | pci_enable_wake(dev, PCI_D0, false); | 1933 | pci_enable_wake(dev, PCI_D0, false); |
| 1921 | return pci_set_power_state(dev, PCI_D0); | 1934 | return pci_set_power_state(dev, PCI_D0); |
| 1922 | } | 1935 | } |
| 1936 | EXPORT_SYMBOL(pci_back_from_sleep); | ||
| 1923 | 1937 | ||
| 1924 | /** | 1938 | /** |
| 1925 | * pci_finish_runtime_suspend - Carry out PCI-specific part of runtime suspend. | 1939 | * pci_finish_runtime_suspend - Carry out PCI-specific part of runtime suspend. |
| @@ -2415,8 +2429,7 @@ u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin) | |||
| 2415 | return (((pin - 1) + slot) % 4) + 1; | 2429 | return (((pin - 1) + slot) % 4) + 1; |
| 2416 | } | 2430 | } |
| 2417 | 2431 | ||
| 2418 | int | 2432 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge) |
| 2419 | pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge) | ||
| 2420 | { | 2433 | { |
| 2421 | u8 pin; | 2434 | u8 pin; |
| 2422 | 2435 | ||
| @@ -2478,6 +2491,7 @@ void pci_release_region(struct pci_dev *pdev, int bar) | |||
| 2478 | if (dr) | 2491 | if (dr) |
| 2479 | dr->region_mask &= ~(1 << bar); | 2492 | dr->region_mask &= ~(1 << bar); |
| 2480 | } | 2493 | } |
| 2494 | EXPORT_SYMBOL(pci_release_region); | ||
| 2481 | 2495 | ||
| 2482 | /** | 2496 | /** |
| 2483 | * __pci_request_region - Reserved PCI I/O and memory resource | 2497 | * __pci_request_region - Reserved PCI I/O and memory resource |
| @@ -2498,8 +2512,8 @@ void pci_release_region(struct pci_dev *pdev, int bar) | |||
| 2498 | * Returns 0 on success, or %EBUSY on error. A warning | 2512 | * Returns 0 on success, or %EBUSY on error. A warning |
| 2499 | * message is also printed on failure. | 2513 | * message is also printed on failure. |
| 2500 | */ | 2514 | */ |
| 2501 | static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name, | 2515 | static int __pci_request_region(struct pci_dev *pdev, int bar, |
| 2502 | int exclusive) | 2516 | const char *res_name, int exclusive) |
| 2503 | { | 2517 | { |
| 2504 | struct pci_devres *dr; | 2518 | struct pci_devres *dr; |
| 2505 | 2519 | ||
| @@ -2510,8 +2524,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n | |||
| 2510 | if (!request_region(pci_resource_start(pdev, bar), | 2524 | if (!request_region(pci_resource_start(pdev, bar), |
| 2511 | pci_resource_len(pdev, bar), res_name)) | 2525 | pci_resource_len(pdev, bar), res_name)) |
| 2512 | goto err_out; | 2526 | goto err_out; |
| 2513 | } | 2527 | } else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) { |
| 2514 | else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) { | ||
| 2515 | if (!__request_mem_region(pci_resource_start(pdev, bar), | 2528 | if (!__request_mem_region(pci_resource_start(pdev, bar), |
| 2516 | pci_resource_len(pdev, bar), res_name, | 2529 | pci_resource_len(pdev, bar), res_name, |
| 2517 | exclusive)) | 2530 | exclusive)) |
| @@ -2548,6 +2561,7 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) | |||
| 2548 | { | 2561 | { |
| 2549 | return __pci_request_region(pdev, bar, res_name, 0); | 2562 | return __pci_request_region(pdev, bar, res_name, 0); |
| 2550 | } | 2563 | } |
| 2564 | EXPORT_SYMBOL(pci_request_region); | ||
| 2551 | 2565 | ||
| 2552 | /** | 2566 | /** |
| 2553 | * pci_request_region_exclusive - Reserved PCI I/O and memory resource | 2567 | * pci_request_region_exclusive - Reserved PCI I/O and memory resource |
| @@ -2567,10 +2581,13 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) | |||
| 2567 | * explicitly not allowed to map the resource via /dev/mem or | 2581 | * explicitly not allowed to map the resource via /dev/mem or |
| 2568 | * sysfs. | 2582 | * sysfs. |
| 2569 | */ | 2583 | */ |
| 2570 | int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name) | 2584 | int pci_request_region_exclusive(struct pci_dev *pdev, int bar, |
| 2585 | const char *res_name) | ||
| 2571 | { | 2586 | { |
| 2572 | return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE); | 2587 | return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE); |
| 2573 | } | 2588 | } |
| 2589 | EXPORT_SYMBOL(pci_request_region_exclusive); | ||
| 2590 | |||
| 2574 | /** | 2591 | /** |
| 2575 | * pci_release_selected_regions - Release selected PCI I/O and memory resources | 2592 | * pci_release_selected_regions - Release selected PCI I/O and memory resources |
| 2576 | * @pdev: PCI device whose resources were previously reserved | 2593 | * @pdev: PCI device whose resources were previously reserved |
| @@ -2587,9 +2604,10 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars) | |||
| 2587 | if (bars & (1 << i)) | 2604 | if (bars & (1 << i)) |
| 2588 | pci_release_region(pdev, i); | 2605 | pci_release_region(pdev, i); |
| 2589 | } | 2606 | } |
| 2607 | EXPORT_SYMBOL(pci_release_selected_regions); | ||
| 2590 | 2608 | ||
| 2591 | static int __pci_request_selected_regions(struct pci_dev *pdev, int bars, | 2609 | static int __pci_request_selected_regions(struct pci_dev *pdev, int bars, |
| 2592 | const char *res_name, int excl) | 2610 | const char *res_name, int excl) |
| 2593 | { | 2611 | { |
| 2594 | int i; | 2612 | int i; |
| 2595 | 2613 | ||
| @@ -2600,7 +2618,7 @@ static int __pci_request_selected_regions(struct pci_dev *pdev, int bars, | |||
| 2600 | return 0; | 2618 | return 0; |
| 2601 | 2619 | ||
| 2602 | err_out: | 2620 | err_out: |
| 2603 | while(--i >= 0) | 2621 | while (--i >= 0) |
| 2604 | if (bars & (1 << i)) | 2622 | if (bars & (1 << i)) |
| 2605 | pci_release_region(pdev, i); | 2623 | pci_release_region(pdev, i); |
| 2606 | 2624 | ||
| @@ -2619,13 +2637,15 @@ int pci_request_selected_regions(struct pci_dev *pdev, int bars, | |||
| 2619 | { | 2637 | { |
| 2620 | return __pci_request_selected_regions(pdev, bars, res_name, 0); | 2638 | return __pci_request_selected_regions(pdev, bars, res_name, 0); |
| 2621 | } | 2639 | } |
| 2640 | EXPORT_SYMBOL(pci_request_selected_regions); | ||
| 2622 | 2641 | ||
| 2623 | int pci_request_selected_regions_exclusive(struct pci_dev *pdev, | 2642 | int pci_request_selected_regions_exclusive(struct pci_dev *pdev, int bars, |
| 2624 | int bars, const char *res_name) | 2643 | const char *res_name) |
| 2625 | { | 2644 | { |
| 2626 | return __pci_request_selected_regions(pdev, bars, res_name, | 2645 | return __pci_request_selected_regions(pdev, bars, res_name, |
| 2627 | IORESOURCE_EXCLUSIVE); | 2646 | IORESOURCE_EXCLUSIVE); |
| 2628 | } | 2647 | } |
| 2648 | EXPORT_SYMBOL(pci_request_selected_regions_exclusive); | ||
| 2629 | 2649 | ||
| 2630 | /** | 2650 | /** |
| 2631 | * pci_release_regions - Release reserved PCI I/O and memory resources | 2651 | * pci_release_regions - Release reserved PCI I/O and memory resources |
| @@ -2640,6 +2660,7 @@ void pci_release_regions(struct pci_dev *pdev) | |||
| 2640 | { | 2660 | { |
| 2641 | pci_release_selected_regions(pdev, (1 << 6) - 1); | 2661 | pci_release_selected_regions(pdev, (1 << 6) - 1); |
| 2642 | } | 2662 | } |
| 2663 | EXPORT_SYMBOL(pci_release_regions); | ||
| 2643 | 2664 | ||
| 2644 | /** | 2665 | /** |
| 2645 | * pci_request_regions - Reserved PCI I/O and memory resources | 2666 | * pci_request_regions - Reserved PCI I/O and memory resources |
| @@ -2658,6 +2679,7 @@ int pci_request_regions(struct pci_dev *pdev, const char *res_name) | |||
| 2658 | { | 2679 | { |
| 2659 | return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name); | 2680 | return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name); |
| 2660 | } | 2681 | } |
| 2682 | EXPORT_SYMBOL(pci_request_regions); | ||
| 2661 | 2683 | ||
| 2662 | /** | 2684 | /** |
| 2663 | * pci_request_regions_exclusive - Reserved PCI I/O and memory resources | 2685 | * pci_request_regions_exclusive - Reserved PCI I/O and memory resources |
| @@ -2680,6 +2702,7 @@ int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name) | |||
| 2680 | return pci_request_selected_regions_exclusive(pdev, | 2702 | return pci_request_selected_regions_exclusive(pdev, |
| 2681 | ((1 << 6) - 1), res_name); | 2703 | ((1 << 6) - 1), res_name); |
| 2682 | } | 2704 | } |
| 2705 | EXPORT_SYMBOL(pci_request_regions_exclusive); | ||
| 2683 | 2706 | ||
| 2684 | static void __pci_set_master(struct pci_dev *dev, bool enable) | 2707 | static void __pci_set_master(struct pci_dev *dev, bool enable) |
| 2685 | { | 2708 | { |
| @@ -2749,6 +2772,7 @@ void pci_set_master(struct pci_dev *dev) | |||
| 2749 | __pci_set_master(dev, true); | 2772 | __pci_set_master(dev, true); |
| 2750 | pcibios_set_master(dev); | 2773 | pcibios_set_master(dev); |
| 2751 | } | 2774 | } |
| 2775 | EXPORT_SYMBOL(pci_set_master); | ||
| 2752 | 2776 | ||
| 2753 | /** | 2777 | /** |
| 2754 | * pci_clear_master - disables bus-mastering for device dev | 2778 | * pci_clear_master - disables bus-mastering for device dev |
| @@ -2758,6 +2782,7 @@ void pci_clear_master(struct pci_dev *dev) | |||
| 2758 | { | 2782 | { |
| 2759 | __pci_set_master(dev, false); | 2783 | __pci_set_master(dev, false); |
| 2760 | } | 2784 | } |
| 2785 | EXPORT_SYMBOL(pci_clear_master); | ||
| 2761 | 2786 | ||
| 2762 | /** | 2787 | /** |
| 2763 | * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed | 2788 | * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed |
| @@ -2790,30 +2815,13 @@ int pci_set_cacheline_size(struct pci_dev *dev) | |||
| 2790 | if (cacheline_size == pci_cache_line_size) | 2815 | if (cacheline_size == pci_cache_line_size) |
| 2791 | return 0; | 2816 | return 0; |
| 2792 | 2817 | ||
| 2793 | dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not " | 2818 | dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not supported\n", |
| 2794 | "supported\n", pci_cache_line_size << 2); | 2819 | pci_cache_line_size << 2); |
| 2795 | 2820 | ||
| 2796 | return -EINVAL; | 2821 | return -EINVAL; |
| 2797 | } | 2822 | } |
| 2798 | EXPORT_SYMBOL_GPL(pci_set_cacheline_size); | 2823 | EXPORT_SYMBOL_GPL(pci_set_cacheline_size); |
| 2799 | 2824 | ||
| 2800 | #ifdef PCI_DISABLE_MWI | ||
| 2801 | int pci_set_mwi(struct pci_dev *dev) | ||
| 2802 | { | ||
| 2803 | return 0; | ||
| 2804 | } | ||
| 2805 | |||
| 2806 | int pci_try_set_mwi(struct pci_dev *dev) | ||
| 2807 | { | ||
| 2808 | return 0; | ||
| 2809 | } | ||
| 2810 | |||
| 2811 | void pci_clear_mwi(struct pci_dev *dev) | ||
| 2812 | { | ||
| 2813 | } | ||
| 2814 | |||
| 2815 | #else | ||
| 2816 | |||
| 2817 | /** | 2825 | /** |
| 2818 | * pci_set_mwi - enables memory-write-invalidate PCI transaction | 2826 | * pci_set_mwi - enables memory-write-invalidate PCI transaction |
| 2819 | * @dev: the PCI device for which MWI is enabled | 2827 | * @dev: the PCI device for which MWI is enabled |
| @@ -2822,9 +2830,11 @@ void pci_clear_mwi(struct pci_dev *dev) | |||
| 2822 | * | 2830 | * |
| 2823 | * RETURNS: An appropriate -ERRNO error value on error, or zero for success. | 2831 | * RETURNS: An appropriate -ERRNO error value on error, or zero for success. |
| 2824 | */ | 2832 | */ |
| 2825 | int | 2833 | int pci_set_mwi(struct pci_dev *dev) |
| 2826 | pci_set_mwi(struct pci_dev *dev) | ||
| 2827 | { | 2834 | { |
| 2835 | #ifdef PCI_DISABLE_MWI | ||
| 2836 | return 0; | ||
| 2837 | #else | ||
| 2828 | int rc; | 2838 | int rc; |
| 2829 | u16 cmd; | 2839 | u16 cmd; |
| 2830 | 2840 | ||
| @@ -2833,14 +2843,15 @@ pci_set_mwi(struct pci_dev *dev) | |||
| 2833 | return rc; | 2843 | return rc; |
| 2834 | 2844 | ||
| 2835 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 2845 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
| 2836 | if (! (cmd & PCI_COMMAND_INVALIDATE)) { | 2846 | if (!(cmd & PCI_COMMAND_INVALIDATE)) { |
| 2837 | dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n"); | 2847 | dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n"); |
| 2838 | cmd |= PCI_COMMAND_INVALIDATE; | 2848 | cmd |= PCI_COMMAND_INVALIDATE; |
| 2839 | pci_write_config_word(dev, PCI_COMMAND, cmd); | 2849 | pci_write_config_word(dev, PCI_COMMAND, cmd); |
| 2840 | } | 2850 | } |
| 2841 | |||
| 2842 | return 0; | 2851 | return 0; |
| 2852 | #endif | ||
| 2843 | } | 2853 | } |
| 2854 | EXPORT_SYMBOL(pci_set_mwi); | ||
| 2844 | 2855 | ||
| 2845 | /** | 2856 | /** |
| 2846 | * pci_try_set_mwi - enables memory-write-invalidate PCI transaction | 2857 | * pci_try_set_mwi - enables memory-write-invalidate PCI transaction |
| @@ -2853,9 +2864,13 @@ pci_set_mwi(struct pci_dev *dev) | |||
| 2853 | */ | 2864 | */ |
| 2854 | int pci_try_set_mwi(struct pci_dev *dev) | 2865 | int pci_try_set_mwi(struct pci_dev *dev) |
| 2855 | { | 2866 | { |
| 2856 | int rc = pci_set_mwi(dev); | 2867 | #ifdef PCI_DISABLE_MWI |
| 2857 | return rc; | 2868 | return 0; |
| 2869 | #else | ||
| 2870 | return pci_set_mwi(dev); | ||
| 2871 | #endif | ||
| 2858 | } | 2872 | } |
| 2873 | EXPORT_SYMBOL(pci_try_set_mwi); | ||
| 2859 | 2874 | ||
| 2860 | /** | 2875 | /** |
| 2861 | * pci_clear_mwi - disables Memory-Write-Invalidate for device dev | 2876 | * pci_clear_mwi - disables Memory-Write-Invalidate for device dev |
| @@ -2863,9 +2878,9 @@ int pci_try_set_mwi(struct pci_dev *dev) | |||
| 2863 | * | 2878 | * |
| 2864 | * Disables PCI Memory-Write-Invalidate transaction on the device | 2879 | * Disables PCI Memory-Write-Invalidate transaction on the device |
| 2865 | */ | 2880 | */ |
| 2866 | void | 2881 | void pci_clear_mwi(struct pci_dev *dev) |
| 2867 | pci_clear_mwi(struct pci_dev *dev) | ||
| 2868 | { | 2882 | { |
| 2883 | #ifndef PCI_DISABLE_MWI | ||
| 2869 | u16 cmd; | 2884 | u16 cmd; |
| 2870 | 2885 | ||
| 2871 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 2886 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
| @@ -2873,8 +2888,9 @@ pci_clear_mwi(struct pci_dev *dev) | |||
| 2873 | cmd &= ~PCI_COMMAND_INVALIDATE; | 2888 | cmd &= ~PCI_COMMAND_INVALIDATE; |
| 2874 | pci_write_config_word(dev, PCI_COMMAND, cmd); | 2889 | pci_write_config_word(dev, PCI_COMMAND, cmd); |
| 2875 | } | 2890 | } |
| 2891 | #endif | ||
| 2876 | } | 2892 | } |
| 2877 | #endif /* ! PCI_DISABLE_MWI */ | 2893 | EXPORT_SYMBOL(pci_clear_mwi); |
| 2878 | 2894 | ||
| 2879 | /** | 2895 | /** |
| 2880 | * pci_intx - enables/disables PCI INTx for device dev | 2896 | * pci_intx - enables/disables PCI INTx for device dev |
| @@ -2883,18 +2899,16 @@ pci_clear_mwi(struct pci_dev *dev) | |||
| 2883 | * | 2899 | * |
| 2884 | * Enables/disables PCI INTx for device dev | 2900 | * Enables/disables PCI INTx for device dev |
| 2885 | */ | 2901 | */ |
| 2886 | void | 2902 | void pci_intx(struct pci_dev *pdev, int enable) |
| 2887 | pci_intx(struct pci_dev *pdev, int enable) | ||
| 2888 | { | 2903 | { |
| 2889 | u16 pci_command, new; | 2904 | u16 pci_command, new; |
| 2890 | 2905 | ||
| 2891 | pci_read_config_word(pdev, PCI_COMMAND, &pci_command); | 2906 | pci_read_config_word(pdev, PCI_COMMAND, &pci_command); |
| 2892 | 2907 | ||
| 2893 | if (enable) { | 2908 | if (enable) |
| 2894 | new = pci_command & ~PCI_COMMAND_INTX_DISABLE; | 2909 | new = pci_command & ~PCI_COMMAND_INTX_DISABLE; |
| 2895 | } else { | 2910 | else |
| 2896 | new = pci_command | PCI_COMMAND_INTX_DISABLE; | 2911 | new = pci_command | PCI_COMMAND_INTX_DISABLE; |
| 2897 | } | ||
| 2898 | 2912 | ||
| 2899 | if (new != pci_command) { | 2913 | if (new != pci_command) { |
| 2900 | struct pci_devres *dr; | 2914 | struct pci_devres *dr; |
| @@ -2908,6 +2922,7 @@ pci_intx(struct pci_dev *pdev, int enable) | |||
| 2908 | } | 2922 | } |
| 2909 | } | 2923 | } |
| 2910 | } | 2924 | } |
| 2925 | EXPORT_SYMBOL_GPL(pci_intx); | ||
| 2911 | 2926 | ||
| 2912 | /** | 2927 | /** |
| 2913 | * pci_intx_mask_supported - probe for INTx masking support | 2928 | * pci_intx_mask_supported - probe for INTx masking support |
| @@ -2937,8 +2952,8 @@ bool pci_intx_mask_supported(struct pci_dev *dev) | |||
| 2937 | * go ahead and check it. | 2952 | * go ahead and check it. |
| 2938 | */ | 2953 | */ |
| 2939 | if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) { | 2954 | if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) { |
| 2940 | dev_err(&dev->dev, "Command register changed from " | 2955 | dev_err(&dev->dev, "Command register changed from 0x%x to 0x%x: driver or hardware bug?\n", |
| 2941 | "0x%x to 0x%x: driver or hardware bug?\n", orig, new); | 2956 | orig, new); |
| 2942 | } else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) { | 2957 | } else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) { |
| 2943 | mask_supported = true; | 2958 | mask_supported = true; |
| 2944 | pci_write_config_word(dev, PCI_COMMAND, orig); | 2959 | pci_write_config_word(dev, PCI_COMMAND, orig); |
| @@ -3124,8 +3139,7 @@ static int pci_af_flr(struct pci_dev *dev, int probe) | |||
| 3124 | if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP)) | 3139 | if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP)) |
| 3125 | goto clear; | 3140 | goto clear; |
| 3126 | 3141 | ||
| 3127 | dev_err(&dev->dev, "transaction is not cleared; " | 3142 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); |
| 3128 | "proceeding with reset anyway\n"); | ||
| 3129 | 3143 | ||
| 3130 | clear: | 3144 | clear: |
| 3131 | pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR); | 3145 | pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR); |
| @@ -4100,6 +4114,7 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags) | |||
| 4100 | bars |= (1 << i); | 4114 | bars |= (1 << i); |
| 4101 | return bars; | 4115 | return bars; |
| 4102 | } | 4116 | } |
| 4117 | EXPORT_SYMBOL(pci_select_bars); | ||
| 4103 | 4118 | ||
| 4104 | /** | 4119 | /** |
| 4105 | * pci_resource_bar - get position of the BAR associated with a resource | 4120 | * pci_resource_bar - get position of the BAR associated with a resource |
| @@ -4139,7 +4154,7 @@ void __init pci_register_set_vga_state(arch_set_vga_state_t func) | |||
| 4139 | } | 4154 | } |
| 4140 | 4155 | ||
| 4141 | static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, | 4156 | static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, |
| 4142 | unsigned int command_bits, u32 flags) | 4157 | unsigned int command_bits, u32 flags) |
| 4143 | { | 4158 | { |
| 4144 | if (arch_set_vga_state) | 4159 | if (arch_set_vga_state) |
| 4145 | return arch_set_vga_state(dev, decode, command_bits, | 4160 | return arch_set_vga_state(dev, decode, command_bits, |
| @@ -4251,11 +4266,10 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev) | |||
| 4251 | bus == dev->bus->number && | 4266 | bus == dev->bus->number && |
| 4252 | slot == PCI_SLOT(dev->devfn) && | 4267 | slot == PCI_SLOT(dev->devfn) && |
| 4253 | func == PCI_FUNC(dev->devfn)) { | 4268 | func == PCI_FUNC(dev->devfn)) { |
| 4254 | if (align_order == -1) { | 4269 | if (align_order == -1) |
| 4255 | align = PAGE_SIZE; | 4270 | align = PAGE_SIZE; |
| 4256 | } else { | 4271 | else |
| 4257 | align = 1 << align_order; | 4272 | align = 1 << align_order; |
| 4258 | } | ||
| 4259 | /* Found */ | 4273 | /* Found */ |
| 4260 | break; | 4274 | break; |
| 4261 | } | 4275 | } |
| @@ -4373,7 +4387,6 @@ static int __init pci_resource_alignment_sysfs_init(void) | |||
| 4373 | return bus_create_file(&pci_bus_type, | 4387 | return bus_create_file(&pci_bus_type, |
| 4374 | &bus_attr_resource_alignment); | 4388 | &bus_attr_resource_alignment); |
| 4375 | } | 4389 | } |
| 4376 | |||
| 4377 | late_initcall(pci_resource_alignment_sysfs_init); | 4390 | late_initcall(pci_resource_alignment_sysfs_init); |
| 4378 | 4391 | ||
| 4379 | static void pci_no_domains(void) | 4392 | static void pci_no_domains(void) |
| @@ -4452,41 +4465,3 @@ static int __init pci_setup(char *str) | |||
| 4452 | return 0; | 4465 | return 0; |
| 4453 | } | 4466 | } |
| 4454 | early_param("pci", pci_setup); | 4467 | early_param("pci", pci_setup); |
| 4455 | |||
| 4456 | EXPORT_SYMBOL(pci_reenable_device); | ||
| 4457 | EXPORT_SYMBOL(pci_enable_device_io); | ||
| 4458 | EXPORT_SYMBOL(pci_enable_device_mem); | ||
| 4459 | EXPORT_SYMBOL(pci_enable_device); | ||
| 4460 | EXPORT_SYMBOL(pcim_enable_device); | ||
| 4461 | EXPORT_SYMBOL(pcim_pin_device); | ||
| 4462 | EXPORT_SYMBOL(pci_disable_device); | ||
| 4463 | EXPORT_SYMBOL(pci_find_capability); | ||
| 4464 | EXPORT_SYMBOL(pci_bus_find_capability); | ||
| 4465 | EXPORT_SYMBOL(pci_release_regions); | ||
| 4466 | EXPORT_SYMBOL(pci_request_regions); | ||
| 4467 | EXPORT_SYMBOL(pci_request_regions_exclusive); | ||
| 4468 | EXPORT_SYMBOL(pci_release_region); | ||
| 4469 | EXPORT_SYMBOL(pci_request_region); | ||
| 4470 | EXPORT_SYMBOL(pci_request_region_exclusive); | ||
| 4471 | EXPORT_SYMBOL(pci_release_selected_regions); | ||
| 4472 | EXPORT_SYMBOL(pci_request_selected_regions); | ||
| 4473 | EXPORT_SYMBOL(pci_request_selected_regions_exclusive); | ||
| 4474 | EXPORT_SYMBOL(pci_set_master); | ||
| 4475 | EXPORT_SYMBOL(pci_clear_master); | ||
| 4476 | EXPORT_SYMBOL(pci_set_mwi); | ||
| 4477 | EXPORT_SYMBOL(pci_try_set_mwi); | ||
| 4478 | EXPORT_SYMBOL(pci_clear_mwi); | ||
| 4479 | EXPORT_SYMBOL_GPL(pci_intx); | ||
| 4480 | EXPORT_SYMBOL(pci_assign_resource); | ||
| 4481 | EXPORT_SYMBOL(pci_find_parent_resource); | ||
| 4482 | EXPORT_SYMBOL(pci_select_bars); | ||
| 4483 | |||
| 4484 | EXPORT_SYMBOL(pci_set_power_state); | ||
| 4485 | EXPORT_SYMBOL(pci_save_state); | ||
| 4486 | EXPORT_SYMBOL(pci_restore_state); | ||
| 4487 | EXPORT_SYMBOL(pci_pme_capable); | ||
| 4488 | EXPORT_SYMBOL(pci_pme_active); | ||
| 4489 | EXPORT_SYMBOL(pci_wake_from_d3); | ||
| 4490 | EXPORT_SYMBOL(pci_prepare_to_sleep); | ||
| 4491 | EXPORT_SYMBOL(pci_back_from_sleep); | ||
| 4492 | EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); | ||
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index 587e7e853107..182224acedbe 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c | |||
| @@ -397,16 +397,14 @@ static int aer_inject(struct aer_error_inj *einj) | |||
| 397 | if (!aer_mask_override && einj->cor_status && | 397 | if (!aer_mask_override && einj->cor_status && |
| 398 | !(einj->cor_status & ~cor_mask)) { | 398 | !(einj->cor_status & ~cor_mask)) { |
| 399 | ret = -EINVAL; | 399 | ret = -EINVAL; |
| 400 | printk(KERN_WARNING "The correctable error(s) is masked " | 400 | printk(KERN_WARNING "The correctable error(s) is masked by device\n"); |
| 401 | "by device\n"); | ||
| 402 | spin_unlock_irqrestore(&inject_lock, flags); | 401 | spin_unlock_irqrestore(&inject_lock, flags); |
| 403 | goto out_put; | 402 | goto out_put; |
| 404 | } | 403 | } |
| 405 | if (!aer_mask_override && einj->uncor_status && | 404 | if (!aer_mask_override && einj->uncor_status && |
| 406 | !(einj->uncor_status & ~uncor_mask)) { | 405 | !(einj->uncor_status & ~uncor_mask)) { |
| 407 | ret = -EINVAL; | 406 | ret = -EINVAL; |
| 408 | printk(KERN_WARNING "The uncorrectable error(s) is masked " | 407 | printk(KERN_WARNING "The uncorrectable error(s) is masked by device\n"); |
| 409 | "by device\n"); | ||
| 410 | spin_unlock_irqrestore(&inject_lock, flags); | 408 | spin_unlock_irqrestore(&inject_lock, flags); |
| 411 | goto out_put; | 409 | goto out_put; |
| 412 | } | 410 | } |
| @@ -464,8 +462,7 @@ static int aer_inject(struct aer_error_inj *einj) | |||
| 464 | goto out_put; | 462 | goto out_put; |
| 465 | } | 463 | } |
| 466 | aer_irq(-1, edev); | 464 | aer_irq(-1, edev); |
| 467 | } | 465 | } else |
| 468 | else | ||
| 469 | ret = -EINVAL; | 466 | ret = -EINVAL; |
| 470 | out_put: | 467 | out_put: |
| 471 | kfree(err_alloc); | 468 | kfree(err_alloc); |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index b2c8881da764..5653ea94547f 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
| @@ -542,8 +542,7 @@ static void aer_recover_work_func(struct work_struct *work); | |||
| 542 | #define AER_RECOVER_RING_ORDER 4 | 542 | #define AER_RECOVER_RING_ORDER 4 |
| 543 | #define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER) | 543 | #define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER) |
| 544 | 544 | ||
| 545 | struct aer_recover_entry | 545 | struct aer_recover_entry { |
| 546 | { | ||
| 547 | u8 bus; | 546 | u8 bus; |
| 548 | u8 devfn; | 547 | u8 devfn; |
| 549 | u16 domain; | 548 | u16 domain; |
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index 34ff7026440c..36ed31b52198 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
| @@ -172,9 +172,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
| 172 | int id = ((dev->bus->number << 8) | dev->devfn); | 172 | int id = ((dev->bus->number << 8) | dev->devfn); |
| 173 | 173 | ||
| 174 | if (!info->status) { | 174 | if (!info->status) { |
| 175 | dev_err(&dev->dev, | 175 | dev_err(&dev->dev, "PCIe Bus Error: severity=%s, type=Unaccessible, id=%04x(Unregistered Agent ID)\n", |
| 176 | "PCIe Bus Error: severity=%s, type=Unaccessible, " | ||
| 177 | "id=%04x(Unregistered Agent ID)\n", | ||
| 178 | aer_error_severity_string[info->severity], id); | 176 | aer_error_severity_string[info->severity], id); |
| 179 | goto out; | 177 | goto out; |
| 180 | } | 178 | } |
| @@ -182,13 +180,11 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
| 182 | layer = AER_GET_LAYER_ERROR(info->severity, info->status); | 180 | layer = AER_GET_LAYER_ERROR(info->severity, info->status); |
| 183 | agent = AER_GET_AGENT(info->severity, info->status); | 181 | agent = AER_GET_AGENT(info->severity, info->status); |
| 184 | 182 | ||
| 185 | dev_err(&dev->dev, | 183 | dev_err(&dev->dev, "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", |
| 186 | "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", | ||
| 187 | aer_error_severity_string[info->severity], | 184 | aer_error_severity_string[info->severity], |
| 188 | aer_error_layer[layer], id, aer_agent_string[agent]); | 185 | aer_error_layer[layer], id, aer_agent_string[agent]); |
| 189 | 186 | ||
| 190 | dev_err(&dev->dev, | 187 | dev_err(&dev->dev, " device [%04x:%04x] error status/mask=%08x/%08x\n", |
| 191 | " device [%04x:%04x] error status/mask=%08x/%08x\n", | ||
| 192 | dev->vendor, dev->device, | 188 | dev->vendor, dev->device, |
| 193 | info->status, info->mask); | 189 | info->status, info->mask); |
| 194 | 190 | ||
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c index bbc3bdd2b189..82e06a86cd77 100644 --- a/drivers/pci/pcie/pme.c +++ b/drivers/pci/pcie/pme.c | |||
| @@ -199,8 +199,7 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id) | |||
| 199 | * assuming that the PME was reported by a PCIe-PCI bridge that | 199 | * assuming that the PME was reported by a PCIe-PCI bridge that |
| 200 | * used devfn different from zero. | 200 | * used devfn different from zero. |
| 201 | */ | 201 | */ |
| 202 | dev_dbg(&port->dev, "PME interrupt generated for " | 202 | dev_dbg(&port->dev, "PME interrupt generated for non-existent device %02x:%02x.%d\n", |
| 203 | "non-existent device %02x:%02x.%d\n", | ||
| 204 | busnr, PCI_SLOT(devfn), PCI_FUNC(devfn)); | 203 | busnr, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
| 205 | found = pcie_pme_from_pci_bridge(bus, 0); | 204 | found = pcie_pme_from_pci_bridge(bus, 0); |
| 206 | } | 205 | } |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 0d8fdc48e642..80887eaa0668 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
| @@ -204,8 +204,8 @@ static int pcie_portdrv_probe(struct pci_dev *dev, | |||
| 204 | return -ENODEV; | 204 | return -ENODEV; |
| 205 | 205 | ||
| 206 | if (!dev->irq && dev->pin) { | 206 | if (!dev->irq && dev->pin) { |
| 207 | dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; " | 207 | dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; check vendor BIOS\n", |
| 208 | "check vendor BIOS\n", dev->vendor, dev->device); | 208 | dev->vendor, dev->device); |
| 209 | } | 209 | } |
| 210 | status = pcie_port_device_register(dev); | 210 | status = pcie_port_device_register(dev); |
| 211 | if (status) | 211 | if (status) |
| @@ -397,7 +397,7 @@ static struct pci_driver pcie_portdriver = { | |||
| 397 | static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d) | 397 | static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d) |
| 398 | { | 398 | { |
| 399 | pr_notice("%s detected: will not use MSI for PCIe PME signaling\n", | 399 | pr_notice("%s detected: will not use MSI for PCIe PME signaling\n", |
| 400 | d->ident); | 400 | d->ident); |
| 401 | pcie_pme_disable_msi(); | 401 | pcie_pme_disable_msi(); |
| 402 | return 0; | 402 | return 0; |
| 403 | } | 403 | } |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 2bbf5221afb3..e3cf8a2e6292 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -168,7 +168,7 @@ static inline unsigned long decode_bar(struct pci_dev *dev, u32 bar) | |||
| 168 | * Returns 1 if the BAR is 64-bit, or 0 if 32-bit. | 168 | * Returns 1 if the BAR is 64-bit, or 0 if 32-bit. |
| 169 | */ | 169 | */ |
| 170 | int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | 170 | int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, |
| 171 | struct resource *res, unsigned int pos) | 171 | struct resource *res, unsigned int pos) |
| 172 | { | 172 | { |
| 173 | u32 l, sz, mask; | 173 | u32 l, sz, mask; |
| 174 | u64 l64, sz64, mask64; | 174 | u64 l64, sz64, mask64; |
| @@ -433,8 +433,7 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
| 433 | limit |= ((unsigned long) mem_limit_hi) << 32; | 433 | limit |= ((unsigned long) mem_limit_hi) << 32; |
| 434 | #else | 434 | #else |
| 435 | if (mem_base_hi || mem_limit_hi) { | 435 | if (mem_base_hi || mem_limit_hi) { |
| 436 | dev_err(&dev->dev, "can't handle 64-bit " | 436 | dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n"); |
| 437 | "address space for bridge\n"); | ||
| 438 | return; | 437 | return; |
| 439 | } | 438 | } |
| 440 | #endif | 439 | #endif |
| @@ -604,7 +603,6 @@ static enum pci_bus_speed agp_speed(int agp3, int agpstat) | |||
| 604 | return agp_speeds[index]; | 603 | return agp_speeds[index]; |
| 605 | } | 604 | } |
| 606 | 605 | ||
| 607 | |||
| 608 | static void pci_set_bus_speed(struct pci_bus *bus) | 606 | static void pci_set_bus_speed(struct pci_bus *bus) |
| 609 | { | 607 | { |
| 610 | struct pci_dev *bridge = bus->self; | 608 | struct pci_dev *bridge = bus->self; |
| @@ -636,11 +634,10 @@ static void pci_set_bus_speed(struct pci_bus *bus) | |||
| 636 | } else if (status & PCI_X_SSTATUS_266MHZ) { | 634 | } else if (status & PCI_X_SSTATUS_266MHZ) { |
| 637 | max = PCI_SPEED_133MHz_PCIX_266; | 635 | max = PCI_SPEED_133MHz_PCIX_266; |
| 638 | } else if (status & PCI_X_SSTATUS_133MHZ) { | 636 | } else if (status & PCI_X_SSTATUS_133MHZ) { |
| 639 | if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) { | 637 | if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) |
| 640 | max = PCI_SPEED_133MHz_PCIX_ECC; | 638 | max = PCI_SPEED_133MHz_PCIX_ECC; |
| 641 | } else { | 639 | else |
| 642 | max = PCI_SPEED_133MHz_PCIX; | 640 | max = PCI_SPEED_133MHz_PCIX; |
| 643 | } | ||
| 644 | } else { | 641 | } else { |
| 645 | max = PCI_SPEED_66MHz_PCIX; | 642 | max = PCI_SPEED_66MHz_PCIX; |
| 646 | } | 643 | } |
| @@ -664,7 +661,6 @@ static void pci_set_bus_speed(struct pci_bus *bus) | |||
| 664 | } | 661 | } |
| 665 | } | 662 | } |
| 666 | 663 | ||
| 667 | |||
| 668 | static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, | 664 | static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, |
| 669 | struct pci_dev *bridge, int busnr) | 665 | struct pci_dev *bridge, int busnr) |
| 670 | { | 666 | { |
| @@ -729,7 +725,8 @@ add_dev: | |||
| 729 | return child; | 725 | return child; |
| 730 | } | 726 | } |
| 731 | 727 | ||
| 732 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) | 728 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
| 729 | int busnr) | ||
| 733 | { | 730 | { |
| 734 | struct pci_bus *child; | 731 | struct pci_bus *child; |
| 735 | 732 | ||
| @@ -741,6 +738,7 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int | |||
| 741 | } | 738 | } |
| 742 | return child; | 739 | return child; |
| 743 | } | 740 | } |
| 741 | EXPORT_SYMBOL(pci_add_new_bus); | ||
| 744 | 742 | ||
| 745 | /* | 743 | /* |
| 746 | * If it's a bridge, configure it and scan the bus behind it. | 744 | * If it's a bridge, configure it and scan the bus behind it. |
| @@ -887,7 +885,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
| 887 | * as cards with a PCI-to-PCI bridge can be | 885 | * as cards with a PCI-to-PCI bridge can be |
| 888 | * inserted later. | 886 | * inserted later. |
| 889 | */ | 887 | */ |
| 890 | for (i=0; i<CARDBUS_RESERVE_BUSNR; i++) { | 888 | for (i = 0; i < CARDBUS_RESERVE_BUSNR; i++) { |
| 891 | struct pci_bus *parent = bus; | 889 | struct pci_bus *parent = bus; |
| 892 | if (pci_find_bus(pci_domain_nr(bus), | 890 | if (pci_find_bus(pci_domain_nr(bus), |
| 893 | max+i+1)) | 891 | max+i+1)) |
| @@ -934,8 +932,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
| 934 | (child->number > bus->busn_res.end) || | 932 | (child->number > bus->busn_res.end) || |
| 935 | (child->number < bus->number) || | 933 | (child->number < bus->number) || |
| 936 | (child->busn_res.end < bus->number)) { | 934 | (child->busn_res.end < bus->number)) { |
| 937 | dev_info(&child->dev, "%pR %s " | 935 | dev_info(&child->dev, "%pR %s hidden behind%s bridge %s %pR\n", |
| 938 | "hidden behind%s bridge %s %pR\n", | ||
| 939 | &child->busn_res, | 936 | &child->busn_res, |
| 940 | (bus->number > child->busn_res.end && | 937 | (bus->number > child->busn_res.end && |
| 941 | bus->busn_res.end < child->number) ? | 938 | bus->busn_res.end < child->number) ? |
| @@ -952,6 +949,7 @@ out: | |||
| 952 | 949 | ||
| 953 | return max; | 950 | return max; |
| 954 | } | 951 | } |
| 952 | EXPORT_SYMBOL(pci_scan_bridge); | ||
| 955 | 953 | ||
| 956 | /* | 954 | /* |
| 957 | * Read interrupt line and base address registers. | 955 | * Read interrupt line and base address registers. |
| @@ -992,7 +990,6 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev) | |||
| 992 | pdev->is_hotplug_bridge = 1; | 990 | pdev->is_hotplug_bridge = 1; |
| 993 | } | 991 | } |
| 994 | 992 | ||
| 995 | |||
| 996 | /** | 993 | /** |
| 997 | * pci_ext_cfg_is_aliased - is ext config space just an alias of std config? | 994 | * pci_ext_cfg_is_aliased - is ext config space just an alias of std config? |
| 998 | * @dev: PCI device | 995 | * @dev: PCI device |
| @@ -1225,13 +1222,13 @@ int pci_setup_device(struct pci_dev *dev) | |||
| 1225 | break; | 1222 | break; |
| 1226 | 1223 | ||
| 1227 | default: /* unknown header */ | 1224 | default: /* unknown header */ |
| 1228 | dev_err(&dev->dev, "unknown header type %02x, " | 1225 | dev_err(&dev->dev, "unknown header type %02x, ignoring device\n", |
| 1229 | "ignoring device\n", dev->hdr_type); | 1226 | dev->hdr_type); |
| 1230 | return -EIO; | 1227 | return -EIO; |
| 1231 | 1228 | ||
| 1232 | bad: | 1229 | bad: |
| 1233 | dev_err(&dev->dev, "ignoring class %#08x (doesn't match header " | 1230 | dev_err(&dev->dev, "ignoring class %#08x (doesn't match header type %02x)\n", |
| 1234 | "type %02x)\n", dev->class, dev->hdr_type); | 1231 | dev->class, dev->hdr_type); |
| 1235 | dev->class = PCI_CLASS_NOT_DEFINED; | 1232 | dev->class = PCI_CLASS_NOT_DEFINED; |
| 1236 | } | 1233 | } |
| 1237 | 1234 | ||
| @@ -1283,7 +1280,7 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus) | |||
| 1283 | EXPORT_SYMBOL(pci_alloc_dev); | 1280 | EXPORT_SYMBOL(pci_alloc_dev); |
| 1284 | 1281 | ||
| 1285 | bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, | 1282 | bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, |
| 1286 | int crs_timeout) | 1283 | int crs_timeout) |
| 1287 | { | 1284 | { |
| 1288 | int delay = 1; | 1285 | int delay = 1; |
| 1289 | 1286 | ||
| @@ -1306,10 +1303,9 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, | |||
| 1306 | return false; | 1303 | return false; |
| 1307 | /* Card hasn't responded in 60 seconds? Must be stuck. */ | 1304 | /* Card hasn't responded in 60 seconds? Must be stuck. */ |
| 1308 | if (delay > crs_timeout) { | 1305 | if (delay > crs_timeout) { |
| 1309 | printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not " | 1306 | printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not responding\n", |
| 1310 | "responding\n", pci_domain_nr(bus), | 1307 | pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), |
| 1311 | bus->number, PCI_SLOT(devfn), | 1308 | PCI_FUNC(devfn)); |
| 1312 | PCI_FUNC(devfn)); | ||
| 1313 | return false; | 1309 | return false; |
| 1314 | } | 1310 | } |
| 1315 | } | 1311 | } |
| @@ -1519,6 +1515,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) | |||
| 1519 | 1515 | ||
| 1520 | return nr; | 1516 | return nr; |
| 1521 | } | 1517 | } |
| 1518 | EXPORT_SYMBOL(pci_scan_slot); | ||
| 1522 | 1519 | ||
| 1523 | static int pcie_find_smpss(struct pci_dev *dev, void *data) | 1520 | static int pcie_find_smpss(struct pci_dev *dev, void *data) |
| 1524 | { | 1521 | { |
| @@ -1613,9 +1610,7 @@ static void pcie_write_mrrs(struct pci_dev *dev) | |||
| 1613 | } | 1610 | } |
| 1614 | 1611 | ||
| 1615 | if (mrrs < 128) | 1612 | if (mrrs < 128) |
| 1616 | dev_err(&dev->dev, "MRRS was unable to be configured with a " | 1613 | 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"); |
| 1617 | "safe value. If problems are experienced, try running " | ||
| 1618 | "with pci=pcie_bus_safe.\n"); | ||
| 1619 | } | 1614 | } |
| 1620 | 1615 | ||
| 1621 | static void pcie_bus_detect_mps(struct pci_dev *dev) | 1616 | static void pcie_bus_detect_mps(struct pci_dev *dev) |
| @@ -1652,8 +1647,8 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data) | |||
| 1652 | pcie_write_mps(dev, mps); | 1647 | pcie_write_mps(dev, mps); |
| 1653 | pcie_write_mrrs(dev); | 1648 | pcie_write_mrrs(dev); |
| 1654 | 1649 | ||
| 1655 | dev_info(&dev->dev, "Max Payload Size set to %4d/%4d (was %4d), " | 1650 | dev_info(&dev->dev, "Max Payload Size set to %4d/%4d (was %4d), Max Read Rq %4d\n", |
| 1656 | "Max Read Rq %4d\n", pcie_get_mps(dev), 128 << dev->pcie_mpss, | 1651 | pcie_get_mps(dev), 128 << dev->pcie_mpss, |
| 1657 | orig_mps, pcie_get_readrq(dev)); | 1652 | orig_mps, pcie_get_readrq(dev)); |
| 1658 | 1653 | ||
| 1659 | return 0; | 1654 | return 0; |
| @@ -1716,7 +1711,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus) | |||
| 1716 | bus->is_added = 1; | 1711 | bus->is_added = 1; |
| 1717 | } | 1712 | } |
| 1718 | 1713 | ||
| 1719 | for (pass=0; pass < 2; pass++) | 1714 | for (pass = 0; pass < 2; pass++) |
| 1720 | list_for_each_entry(dev, &bus->devices, bus_list) { | 1715 | list_for_each_entry(dev, &bus->devices, bus_list) { |
| 1721 | if (pci_is_bridge(dev)) | 1716 | if (pci_is_bridge(dev)) |
| 1722 | max = pci_scan_bridge(bus, dev, max, pass); | 1717 | max = pci_scan_bridge(bus, dev, max, pass); |
| @@ -1732,6 +1727,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus) | |||
| 1732 | dev_dbg(&bus->dev, "bus scan returning with max=%02x\n", max); | 1727 | dev_dbg(&bus->dev, "bus scan returning with max=%02x\n", max); |
| 1733 | return max; | 1728 | return max; |
| 1734 | } | 1729 | } |
| 1730 | EXPORT_SYMBOL_GPL(pci_scan_child_bus); | ||
| 1735 | 1731 | ||
| 1736 | /** | 1732 | /** |
| 1737 | * pcibios_root_bridge_prepare - Platform-specific host bridge setup. | 1733 | * pcibios_root_bridge_prepare - Platform-specific host bridge setup. |
| @@ -2040,11 +2036,6 @@ unsigned int pci_rescan_bus(struct pci_bus *bus) | |||
| 2040 | } | 2036 | } |
| 2041 | EXPORT_SYMBOL_GPL(pci_rescan_bus); | 2037 | EXPORT_SYMBOL_GPL(pci_rescan_bus); |
| 2042 | 2038 | ||
| 2043 | EXPORT_SYMBOL(pci_add_new_bus); | ||
| 2044 | EXPORT_SYMBOL(pci_scan_slot); | ||
| 2045 | EXPORT_SYMBOL(pci_scan_bridge); | ||
| 2046 | EXPORT_SYMBOL_GPL(pci_scan_child_bus); | ||
| 2047 | |||
| 2048 | /* | 2039 | /* |
| 2049 | * pci_rescan_bus(), pci_rescan_bus_bridge_resize() and PCI device removal | 2040 | * pci_rescan_bus(), pci_rescan_bus_bridge_resize() and PCI device removal |
| 2050 | * routines should always be executed under this mutex. | 2041 | * routines should always be executed under this mutex. |
| @@ -2063,7 +2054,8 @@ void pci_unlock_rescan_remove(void) | |||
| 2063 | } | 2054 | } |
| 2064 | EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove); | 2055 | EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove); |
| 2065 | 2056 | ||
| 2066 | static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b) | 2057 | static int __init pci_sort_bf_cmp(const struct device *d_a, |
| 2058 | const struct device *d_b) | ||
| 2067 | { | 2059 | { |
| 2068 | const struct pci_dev *a = to_pci_dev(d_a); | 2060 | const struct pci_dev *a = to_pci_dev(d_a); |
| 2069 | const struct pci_dev *b = to_pci_dev(d_b); | 2061 | const struct pci_dev *b = to_pci_dev(d_b); |
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 46d1378f2e9e..3f155e78513f 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
| @@ -17,15 +17,14 @@ | |||
| 17 | 17 | ||
| 18 | static int proc_initialized; /* = 0 */ | 18 | static int proc_initialized; /* = 0 */ |
| 19 | 19 | ||
| 20 | static loff_t | 20 | static loff_t proc_bus_pci_lseek(struct file *file, loff_t off, int whence) |
| 21 | proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | ||
| 22 | { | 21 | { |
| 23 | struct pci_dev *dev = PDE_DATA(file_inode(file)); | 22 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
| 24 | return fixed_size_llseek(file, off, whence, dev->cfg_size); | 23 | return fixed_size_llseek(file, off, whence, dev->cfg_size); |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | static ssize_t | 26 | static ssize_t proc_bus_pci_read(struct file *file, char __user *buf, |
| 28 | proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 27 | size_t nbytes, loff_t *ppos) |
| 29 | { | 28 | { |
| 30 | struct pci_dev *dev = PDE_DATA(file_inode(file)); | 29 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
| 31 | unsigned int pos = *ppos; | 30 | unsigned int pos = *ppos; |
| @@ -108,8 +107,8 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp | |||
| 108 | return nbytes; | 107 | return nbytes; |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | static ssize_t | 110 | static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf, |
| 112 | proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) | 111 | size_t nbytes, loff_t *ppos) |
| 113 | { | 112 | { |
| 114 | struct inode *ino = file_inode(file); | 113 | struct inode *ino = file_inode(file); |
| 115 | struct pci_dev *dev = PDE_DATA(ino); | 114 | struct pci_dev *dev = PDE_DATA(ino); |
| @@ -413,7 +412,7 @@ int pci_proc_detach_device(struct pci_dev *dev) | |||
| 413 | return 0; | 412 | return 0; |
| 414 | } | 413 | } |
| 415 | 414 | ||
| 416 | int pci_proc_detach_bus(struct pci_bus* bus) | 415 | int pci_proc_detach_bus(struct pci_bus *bus) |
| 417 | { | 416 | { |
| 418 | proc_remove(bus->procdir); | 417 | proc_remove(bus->procdir); |
| 419 | return 0; | 418 | return 0; |
| @@ -423,6 +422,7 @@ static int proc_bus_pci_dev_open(struct inode *inode, struct file *file) | |||
| 423 | { | 422 | { |
| 424 | return seq_open(file, &proc_bus_pci_devices_op); | 423 | return seq_open(file, &proc_bus_pci_devices_op); |
| 425 | } | 424 | } |
| 425 | |||
| 426 | static const struct file_operations proc_bus_pci_dev_operations = { | 426 | static const struct file_operations proc_bus_pci_dev_operations = { |
| 427 | .owner = THIS_MODULE, | 427 | .owner = THIS_MODULE, |
| 428 | .open = proc_bus_pci_dev_open, | 428 | .open = proc_bus_pci_dev_open, |
| @@ -443,6 +443,4 @@ static int __init pci_proc_init(void) | |||
| 443 | 443 | ||
| 444 | return 0; | 444 | return 0; |
| 445 | } | 445 | } |
| 446 | |||
| 447 | device_initcall(pci_proc_init); | 446 | device_initcall(pci_proc_init); |
| 448 | |||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 92e68c7747f7..d0f69269eb6c 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -48,8 +48,8 @@ static void quirk_mellanox_tavor(struct pci_dev *dev) | |||
| 48 | { | 48 | { |
| 49 | dev->broken_parity_status = 1; /* This device gives false positives */ | 49 | dev->broken_parity_status = 1; /* This device gives false positives */ |
| 50 | } | 50 | } |
| 51 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor); | 51 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor); |
| 52 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor); | 52 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor); |
| 53 | 53 | ||
| 54 | /* Deal with broken BIOSes that neglect to enable passive release, | 54 | /* Deal with broken BIOSes that neglect to enable passive release, |
| 55 | which can cause problems in combination with the 82441FX/PPro MTRRs */ | 55 | which can cause problems in combination with the 82441FX/PPro MTRRs */ |
| @@ -82,7 +82,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_p | |||
| 82 | static void quirk_isa_dma_hangs(struct pci_dev *dev) | 82 | static void quirk_isa_dma_hangs(struct pci_dev *dev) |
| 83 | { | 83 | { |
| 84 | if (!isa_dma_bridge_buggy) { | 84 | if (!isa_dma_bridge_buggy) { |
| 85 | isa_dma_bridge_buggy=1; | 85 | isa_dma_bridge_buggy = 1; |
| 86 | dev_info(&dev->dev, "Activating ISA DMA hang workarounds\n"); | 86 | dev_info(&dev->dev, "Activating ISA DMA hang workarounds\n"); |
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| @@ -123,7 +123,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk | |||
| 123 | */ | 123 | */ |
| 124 | static void quirk_nopcipci(struct pci_dev *dev) | 124 | static void quirk_nopcipci(struct pci_dev *dev) |
| 125 | { | 125 | { |
| 126 | if ((pci_pci_problems & PCIPCI_FAIL)==0) { | 126 | if ((pci_pci_problems & PCIPCI_FAIL) == 0) { |
| 127 | dev_info(&dev->dev, "Disabling direct PCI/PCI transfers\n"); | 127 | dev_info(&dev->dev, "Disabling direct PCI/PCI transfers\n"); |
| 128 | pci_pci_problems |= PCIPCI_FAIL; | 128 | pci_pci_problems |= PCIPCI_FAIL; |
| 129 | } | 129 | } |
| @@ -148,7 +148,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8151_0, quirk_nopci | |||
| 148 | */ | 148 | */ |
| 149 | static void quirk_triton(struct pci_dev *dev) | 149 | static void quirk_triton(struct pci_dev *dev) |
| 150 | { | 150 | { |
| 151 | if ((pci_pci_problems&PCIPCI_TRITON)==0) { | 151 | if ((pci_pci_problems&PCIPCI_TRITON) == 0) { |
| 152 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); | 152 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); |
| 153 | pci_pci_problems |= PCIPCI_TRITON; | 153 | pci_pci_problems |= PCIPCI_TRITON; |
| 154 | } | 154 | } |
| @@ -163,8 +163,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82439TX, quirk_ | |||
| 163 | * Made according to a windows driver based patch by George E. Breese | 163 | * Made according to a windows driver based patch by George E. Breese |
| 164 | * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm | 164 | * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm |
| 165 | * and http://www.georgebreese.com/net/software/#PCI | 165 | * and http://www.georgebreese.com/net/software/#PCI |
| 166 | * 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 |
| 167 | * the info on which Mr Breese based his work. | 167 | * the info on which Mr Breese based his work. |
| 168 | * | 168 | * |
| 169 | * Updated based on further information from the site and also on | 169 | * Updated based on further information from the site and also on |
| 170 | * information provided by VIA | 170 | * information provided by VIA |
| @@ -177,14 +177,14 @@ static void quirk_vialatency(struct pci_dev *dev) | |||
| 177 | a buggy southbridge */ | 177 | a buggy southbridge */ |
| 178 | 178 | ||
| 179 | p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL); | 179 | p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL); |
| 180 | if (p!=NULL) { | 180 | if (p != NULL) { |
| 181 | /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */ | 181 | /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */ |
| 182 | /* Check for buggy part revisions */ | 182 | /* Check for buggy part revisions */ |
| 183 | if (p->revision < 0x40 || p->revision > 0x42) | 183 | if (p->revision < 0x40 || p->revision > 0x42) |
| 184 | goto exit; | 184 | goto exit; |
| 185 | } else { | 185 | } else { |
| 186 | p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL); | 186 | p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL); |
| 187 | if (p==NULL) /* No problem parts */ | 187 | if (p == NULL) /* No problem parts */ |
| 188 | goto exit; | 188 | goto exit; |
| 189 | /* Check for buggy part revisions */ | 189 | /* Check for buggy part revisions */ |
| 190 | if (p->revision < 0x10 || p->revision > 0x12) | 190 | if (p->revision < 0x10 || p->revision > 0x12) |
| @@ -227,7 +227,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_viala | |||
| 227 | */ | 227 | */ |
| 228 | static void quirk_viaetbf(struct pci_dev *dev) | 228 | static void quirk_viaetbf(struct pci_dev *dev) |
| 229 | { | 229 | { |
| 230 | if ((pci_pci_problems&PCIPCI_VIAETBF)==0) { | 230 | if ((pci_pci_problems&PCIPCI_VIAETBF) == 0) { |
| 231 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); | 231 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); |
| 232 | pci_pci_problems |= PCIPCI_VIAETBF; | 232 | pci_pci_problems |= PCIPCI_VIAETBF; |
| 233 | } | 233 | } |
| @@ -236,7 +236,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_via | |||
| 236 | 236 | ||
| 237 | static void quirk_vsfx(struct pci_dev *dev) | 237 | static void quirk_vsfx(struct pci_dev *dev) |
| 238 | { | 238 | { |
| 239 | if ((pci_pci_problems&PCIPCI_VSFX)==0) { | 239 | if ((pci_pci_problems&PCIPCI_VSFX) == 0) { |
| 240 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); | 240 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); |
| 241 | pci_pci_problems |= PCIPCI_VSFX; | 241 | pci_pci_problems |= PCIPCI_VSFX; |
| 242 | } | 242 | } |
| @@ -251,7 +251,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576, quirk_vsfx) | |||
| 251 | */ | 251 | */ |
| 252 | static void quirk_alimagik(struct pci_dev *dev) | 252 | static void quirk_alimagik(struct pci_dev *dev) |
| 253 | { | 253 | { |
| 254 | if ((pci_pci_problems&PCIPCI_ALIMAGIK)==0) { | 254 | if ((pci_pci_problems&PCIPCI_ALIMAGIK) == 0) { |
| 255 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); | 255 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); |
| 256 | pci_pci_problems |= PCIPCI_ALIMAGIK|PCIPCI_TRITON; | 256 | pci_pci_problems |= PCIPCI_ALIMAGIK|PCIPCI_TRITON; |
| 257 | } | 257 | } |
| @@ -265,7 +265,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1651, quirk_alimagi | |||
| 265 | */ | 265 | */ |
| 266 | static void quirk_natoma(struct pci_dev *dev) | 266 | static void quirk_natoma(struct pci_dev *dev) |
| 267 | { | 267 | { |
| 268 | if ((pci_pci_problems&PCIPCI_NATOMA)==0) { | 268 | if ((pci_pci_problems&PCIPCI_NATOMA) == 0) { |
| 269 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); | 269 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); |
| 270 | pci_pci_problems |= PCIPCI_NATOMA; | 270 | pci_pci_problems |= PCIPCI_NATOMA; |
| 271 | } | 271 | } |
| @@ -315,8 +315,7 @@ static void quirk_cs5536_vsa(struct pci_dev *dev) | |||
| 315 | if (pci_resource_len(dev, 0) != 8) { | 315 | if (pci_resource_len(dev, 0) != 8) { |
| 316 | struct resource *res = &dev->resource[0]; | 316 | struct resource *res = &dev->resource[0]; |
| 317 | res->end = res->start + 8 - 1; | 317 | res->end = res->start + 8 - 1; |
| 318 | dev_info(&dev->dev, "CS5536 ISA bridge bug detected " | 318 | dev_info(&dev->dev, "CS5536 ISA bridge bug detected (incorrect header); workaround applied\n"); |
| 319 | "(incorrect header); workaround applied.\n"); | ||
| 320 | } | 319 | } |
| 321 | } | 320 | } |
| 322 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa); | 321 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa); |
| @@ -400,7 +399,8 @@ static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int p | |||
| 400 | * let's get enough confirmation reports first. | 399 | * let's get enough confirmation reports first. |
| 401 | */ | 400 | */ |
| 402 | base &= -size; | 401 | base &= -size; |
| 403 | dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base, base + size - 1); | 402 | dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base, |
| 403 | base + size - 1); | ||
| 404 | } | 404 | } |
| 405 | 405 | ||
| 406 | static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable) | 406 | static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable) |
| @@ -425,7 +425,8 @@ static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int | |||
| 425 | * reserve it, but let's get enough confirmation reports first. | 425 | * reserve it, but let's get enough confirmation reports first. |
| 426 | */ | 426 | */ |
| 427 | base &= -size; | 427 | base &= -size; |
| 428 | dev_info(&dev->dev, "%s MMIO at %04x-%04x\n", name, base, base + size - 1); | 428 | dev_info(&dev->dev, "%s MMIO at %04x-%04x\n", name, base, |
| 429 | base + size - 1); | ||
| 429 | } | 430 | } |
| 430 | 431 | ||
| 431 | /* | 432 | /* |
| @@ -668,8 +669,7 @@ static void quirk_xio2000a(struct pci_dev *dev) | |||
| 668 | struct pci_dev *pdev; | 669 | struct pci_dev *pdev; |
| 669 | u16 command; | 670 | u16 command; |
| 670 | 671 | ||
| 671 | dev_warn(&dev->dev, "TI XIO2000a quirk detected; " | 672 | dev_warn(&dev->dev, "TI XIO2000a quirk detected; secondary bus fast back-to-back transfers disabled\n"); |
| 672 | "secondary bus fast back-to-back transfers disabled\n"); | ||
| 673 | list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) { | 673 | list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) { |
| 674 | pci_read_config_word(pdev, PCI_COMMAND, &command); | 674 | pci_read_config_word(pdev, PCI_COMMAND, &command); |
| 675 | if (command & PCI_COMMAND_FAST_BACK) | 675 | if (command & PCI_COMMAND_FAST_BACK) |
| @@ -703,7 +703,7 @@ static void quirk_via_ioapic(struct pci_dev *dev) | |||
| 703 | tmp == 0 ? "Disa" : "Ena"); | 703 | tmp == 0 ? "Disa" : "Ena"); |
| 704 | 704 | ||
| 705 | /* Offset 0x58: External APIC IRQ output control */ | 705 | /* Offset 0x58: External APIC IRQ output control */ |
| 706 | pci_write_config_byte (dev, 0x58, tmp); | 706 | pci_write_config_byte(dev, 0x58, tmp); |
| 707 | } | 707 | } |
| 708 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic); | 708 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic); |
| 709 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic); | 709 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic); |
| @@ -761,8 +761,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_ANY_ID, quirk_ioapic_rmw); | |||
| 761 | static void quirk_amd_8131_mmrbc(struct pci_dev *dev) | 761 | static void quirk_amd_8131_mmrbc(struct pci_dev *dev) |
| 762 | { | 762 | { |
| 763 | if (dev->subordinate && dev->revision <= 0x12) { | 763 | if (dev->subordinate && dev->revision <= 0x12) { |
| 764 | dev_info(&dev->dev, "AMD8131 rev %x detected; " | 764 | dev_info(&dev->dev, "AMD8131 rev %x detected; disabling PCI-X MMRBC\n", |
| 765 | "disabling PCI-X MMRBC\n", dev->revision); | 765 | dev->revision); |
| 766 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC; | 766 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC; |
| 767 | } | 767 | } |
| 768 | } | 768 | } |
| @@ -916,12 +916,12 @@ static void quirk_amd_ordering(struct pci_dev *dev) | |||
| 916 | { | 916 | { |
| 917 | u32 pcic; | 917 | u32 pcic; |
| 918 | pci_read_config_dword(dev, 0x4C, &pcic); | 918 | pci_read_config_dword(dev, 0x4C, &pcic); |
| 919 | if ((pcic&6)!=6) { | 919 | if ((pcic & 6) != 6) { |
| 920 | pcic |= 6; | 920 | pcic |= 6; |
| 921 | dev_warn(&dev->dev, "BIOS failed to enable PCI standards compliance; fixing this error\n"); | 921 | dev_warn(&dev->dev, "BIOS failed to enable PCI standards compliance; fixing this error\n"); |
| 922 | pci_write_config_dword(dev, 0x4C, pcic); | 922 | pci_write_config_dword(dev, 0x4C, pcic); |
| 923 | pci_read_config_dword(dev, 0x84, &pcic); | 923 | pci_read_config_dword(dev, 0x84, &pcic); |
| 924 | pcic |= (1<<23); /* Required in this mode */ | 924 | pcic |= (1 << 23); /* Required in this mode */ |
| 925 | pci_write_config_dword(dev, 0x84, pcic); | 925 | pci_write_config_dword(dev, 0x84, pcic); |
| 926 | } | 926 | } |
| 927 | } | 927 | } |
| @@ -937,7 +937,7 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C | |||
| 937 | */ | 937 | */ |
| 938 | static void quirk_dunord(struct pci_dev *dev) | 938 | static void quirk_dunord(struct pci_dev *dev) |
| 939 | { | 939 | { |
| 940 | struct resource *r = &dev->resource [1]; | 940 | struct resource *r = &dev->resource[1]; |
| 941 | 941 | ||
| 942 | r->flags |= IORESOURCE_UNSET; | 942 | r->flags |= IORESOURCE_UNSET; |
| 943 | r->start = 0; | 943 | r->start = 0; |
| @@ -967,11 +967,13 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA, 0x605, quirk_transparent_bridge) | |||
| 967 | static void quirk_mediagx_master(struct pci_dev *dev) | 967 | static void quirk_mediagx_master(struct pci_dev *dev) |
| 968 | { | 968 | { |
| 969 | u8 reg; | 969 | u8 reg; |
| 970 | |||
| 970 | pci_read_config_byte(dev, 0x41, ®); | 971 | pci_read_config_byte(dev, 0x41, ®); |
| 971 | if (reg & 2) { | 972 | if (reg & 2) { |
| 972 | reg &= ~2; | 973 | reg &= ~2; |
| 973 | dev_info(&dev->dev, "Fixup for MediaGX/Geode Slave Disconnect Boundary (0x41=0x%02x)\n", reg); | 974 | dev_info(&dev->dev, "Fixup for MediaGX/Geode Slave Disconnect Boundary (0x41=0x%02x)\n", |
| 974 | pci_write_config_byte(dev, 0x41, reg); | 975 | reg); |
| 976 | pci_write_config_byte(dev, 0x41, reg); | ||
| 975 | } | 977 | } |
| 976 | } | 978 | } |
| 977 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master); | 979 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master); |
| @@ -1120,7 +1122,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
| 1120 | { | 1122 | { |
| 1121 | if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { | 1123 | if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { |
| 1122 | if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) | 1124 | if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) |
| 1123 | switch(dev->subsystem_device) { | 1125 | switch (dev->subsystem_device) { |
| 1124 | case 0x8025: /* P4B-LX */ | 1126 | case 0x8025: /* P4B-LX */ |
| 1125 | case 0x8070: /* P4B */ | 1127 | case 0x8070: /* P4B */ |
| 1126 | case 0x8088: /* P4B533 */ | 1128 | case 0x8088: /* P4B533 */ |
| @@ -1128,14 +1130,14 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
| 1128 | asus_hides_smbus = 1; | 1130 | asus_hides_smbus = 1; |
| 1129 | } | 1131 | } |
| 1130 | else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) | 1132 | else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) |
| 1131 | switch(dev->subsystem_device) { | 1133 | switch (dev->subsystem_device) { |
| 1132 | case 0x80b1: /* P4GE-V */ | 1134 | case 0x80b1: /* P4GE-V */ |
| 1133 | case 0x80b2: /* P4PE */ | 1135 | case 0x80b2: /* P4PE */ |
| 1134 | case 0x8093: /* P4B533-V */ | 1136 | case 0x8093: /* P4B533-V */ |
| 1135 | asus_hides_smbus = 1; | 1137 | asus_hides_smbus = 1; |
| 1136 | } | 1138 | } |
| 1137 | else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB) | 1139 | else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB) |
| 1138 | switch(dev->subsystem_device) { | 1140 | switch (dev->subsystem_device) { |
| 1139 | case 0x8030: /* P4T533 */ | 1141 | case 0x8030: /* P4T533 */ |
| 1140 | asus_hides_smbus = 1; | 1142 | asus_hides_smbus = 1; |
| 1141 | } | 1143 | } |
| @@ -1175,7 +1177,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
| 1175 | } | 1177 | } |
| 1176 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) { | 1178 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) { |
| 1177 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | 1179 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) |
| 1178 | switch(dev->subsystem_device) { | 1180 | switch (dev->subsystem_device) { |
| 1179 | case 0x088C: /* HP Compaq nc8000 */ | 1181 | case 0x088C: /* HP Compaq nc8000 */ |
| 1180 | case 0x0890: /* HP Compaq nc6000 */ | 1182 | case 0x0890: /* HP Compaq nc6000 */ |
| 1181 | asus_hides_smbus = 1; | 1183 | asus_hides_smbus = 1; |
| @@ -1192,20 +1194,20 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
| 1192 | case 0x12bf: /* HP xw4100 */ | 1194 | case 0x12bf: /* HP xw4100 */ |
| 1193 | asus_hides_smbus = 1; | 1195 | asus_hides_smbus = 1; |
| 1194 | } | 1196 | } |
| 1195 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { | 1197 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { |
| 1196 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | 1198 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) |
| 1197 | switch(dev->subsystem_device) { | 1199 | switch (dev->subsystem_device) { |
| 1198 | case 0xC00C: /* Samsung P35 notebook */ | 1200 | case 0xC00C: /* Samsung P35 notebook */ |
| 1199 | asus_hides_smbus = 1; | 1201 | asus_hides_smbus = 1; |
| 1200 | } | 1202 | } |
| 1201 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) { | 1203 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) { |
| 1202 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | 1204 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) |
| 1203 | switch(dev->subsystem_device) { | 1205 | switch (dev->subsystem_device) { |
| 1204 | case 0x0058: /* Compaq Evo N620c */ | 1206 | case 0x0058: /* Compaq Evo N620c */ |
| 1205 | asus_hides_smbus = 1; | 1207 | asus_hides_smbus = 1; |
| 1206 | } | 1208 | } |
| 1207 | else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3) | 1209 | else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3) |
| 1208 | switch(dev->subsystem_device) { | 1210 | switch (dev->subsystem_device) { |
| 1209 | case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */ | 1211 | case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */ |
| 1210 | /* Motherboard doesn't have Host bridge | 1212 | /* Motherboard doesn't have Host bridge |
| 1211 | * subvendor/subdevice IDs, therefore checking | 1213 | * subvendor/subdevice IDs, therefore checking |
| @@ -1213,7 +1215,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
| 1213 | asus_hides_smbus = 1; | 1215 | asus_hides_smbus = 1; |
| 1214 | } | 1216 | } |
| 1215 | else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2) | 1217 | else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2) |
| 1216 | switch(dev->subsystem_device) { | 1218 | switch (dev->subsystem_device) { |
| 1217 | case 0x00b8: /* Compaq Evo D510 CMT */ | 1219 | case 0x00b8: /* Compaq Evo D510 CMT */ |
| 1218 | case 0x00b9: /* Compaq Evo D510 SFF */ | 1220 | case 0x00b9: /* Compaq Evo D510 SFF */ |
| 1219 | case 0x00ba: /* Compaq Evo D510 USDT */ | 1221 | case 0x00ba: /* Compaq Evo D510 USDT */ |
| @@ -1261,7 +1263,8 @@ static void asus_hides_smbus_lpc(struct pci_dev *dev) | |||
| 1261 | pci_write_config_word(dev, 0xF2, val & (~0x8)); | 1263 | pci_write_config_word(dev, 0xF2, val & (~0x8)); |
| 1262 | pci_read_config_word(dev, 0xF2, &val); | 1264 | pci_read_config_word(dev, 0xF2, &val); |
| 1263 | if (val & 0x8) | 1265 | if (val & 0x8) |
| 1264 | dev_info(&dev->dev, "i801 SMBus device continues to play 'hide and seek'! 0x%x\n", val); | 1266 | dev_info(&dev->dev, "i801 SMBus device continues to play 'hide and seek'! 0x%x\n", |
| 1267 | val); | ||
| 1265 | else | 1268 | else |
| 1266 | dev_info(&dev->dev, "Enabled i801 SMBus device\n"); | 1269 | dev_info(&dev->dev, "Enabled i801 SMBus device\n"); |
| 1267 | } | 1270 | } |
| @@ -1409,7 +1412,8 @@ static void asus_hides_ac97_lpc(struct pci_dev *dev) | |||
| 1409 | pci_write_config_byte(dev, 0x50, val & (~0xc0)); | 1412 | pci_write_config_byte(dev, 0x50, val & (~0xc0)); |
| 1410 | pci_read_config_byte(dev, 0x50, &val); | 1413 | pci_read_config_byte(dev, 0x50, &val); |
| 1411 | if (val & 0xc0) | 1414 | if (val & 0xc0) |
| 1412 | dev_info(&dev->dev, "Onboard AC97/MC97 devices continue to play 'hide and seek'! 0x%x\n", val); | 1415 | dev_info(&dev->dev, "Onboard AC97/MC97 devices continue to play 'hide and seek'! 0x%x\n", |
| 1416 | val); | ||
| 1413 | else | 1417 | else |
| 1414 | dev_info(&dev->dev, "Enabled onboard AC97/MC97 devices\n"); | 1418 | dev_info(&dev->dev, "Enabled onboard AC97/MC97 devices\n"); |
| 1415 | } | 1419 | } |
| @@ -1514,10 +1518,8 @@ static void quirk_alder_ioapic(struct pci_dev *pdev) | |||
| 1514 | 1518 | ||
| 1515 | /* The next five BARs all seem to be rubbish, so just clean | 1519 | /* The next five BARs all seem to be rubbish, so just clean |
| 1516 | * them out */ | 1520 | * them out */ |
| 1517 | for (i=1; i < 6; i++) { | 1521 | for (i = 1; i < 6; i++) |
| 1518 | memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); | 1522 | memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); |
| 1519 | } | ||
| 1520 | |||
| 1521 | } | 1523 | } |
| 1522 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); | 1524 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); |
| 1523 | #endif | 1525 | #endif |
| @@ -1552,7 +1554,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_pci | |||
| 1552 | * Some Intel PCI Express chipsets have trouble with downstream | 1554 | * Some Intel PCI Express chipsets have trouble with downstream |
| 1553 | * device power management. | 1555 | * device power management. |
| 1554 | */ | 1556 | */ |
| 1555 | static void quirk_intel_pcie_pm(struct pci_dev * dev) | 1557 | static void quirk_intel_pcie_pm(struct pci_dev *dev) |
| 1556 | { | 1558 | { |
| 1557 | pci_pm_d3_delay = 120; | 1559 | pci_pm_d3_delay = 120; |
| 1558 | dev->no_d1d2 = 1; | 1560 | dev->no_d1d2 = 1; |
| @@ -1721,8 +1723,8 @@ static void quirk_disable_amd_8111_boot_interrupt(struct pci_dev *dev) | |||
| 1721 | 1723 | ||
| 1722 | pci_read_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, &pci_config_word); | 1724 | pci_read_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, &pci_config_word); |
| 1723 | if (!pci_config_word) { | 1725 | if (!pci_config_word) { |
| 1724 | dev_info(&dev->dev, "boot interrupts on device [%04x:%04x] " | 1726 | dev_info(&dev->dev, "boot interrupts on device [%04x:%04x] already disabled\n", |
| 1725 | "already disabled\n", dev->vendor, dev->device); | 1727 | dev->vendor, dev->device); |
| 1726 | return; | 1728 | return; |
| 1727 | } | 1729 | } |
| 1728 | pci_write_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, 0); | 1730 | pci_write_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, 0); |
| @@ -1770,8 +1772,7 @@ static void quirk_plx_pci9050(struct pci_dev *dev) | |||
| 1770 | if (pci_resource_len(dev, bar) == 0x80 && | 1772 | if (pci_resource_len(dev, bar) == 0x80 && |
| 1771 | (pci_resource_start(dev, bar) & 0x80)) { | 1773 | (pci_resource_start(dev, bar) & 0x80)) { |
| 1772 | struct resource *r = &dev->resource[bar]; | 1774 | struct resource *r = &dev->resource[bar]; |
| 1773 | dev_info(&dev->dev, | 1775 | dev_info(&dev->dev, "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n", |
| 1774 | "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n", | ||
| 1775 | bar); | 1776 | bar); |
| 1776 | r->flags |= IORESOURCE_UNSET; | 1777 | r->flags |= IORESOURCE_UNSET; |
| 1777 | r->start = 0; | 1778 | r->start = 0; |
| @@ -1818,9 +1819,7 @@ static void quirk_netmos(struct pci_dev *dev) | |||
| 1818 | case PCI_DEVICE_ID_NETMOS_9845: | 1819 | case PCI_DEVICE_ID_NETMOS_9845: |
| 1819 | case PCI_DEVICE_ID_NETMOS_9855: | 1820 | case PCI_DEVICE_ID_NETMOS_9855: |
| 1820 | if (num_parallel) { | 1821 | if (num_parallel) { |
| 1821 | dev_info(&dev->dev, "Netmos %04x (%u parallel, " | 1822 | dev_info(&dev->dev, "Netmos %04x (%u parallel, %u serial); changing class SERIAL to OTHER (use parport_serial)\n", |
| 1822 | "%u serial); changing class SERIAL to OTHER " | ||
| 1823 | "(use parport_serial)\n", | ||
| 1824 | dev->device, num_parallel, num_serial); | 1823 | dev->device, num_parallel, num_serial); |
| 1825 | dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) | | 1824 | dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) | |
| 1826 | (dev->class & 0xff); | 1825 | (dev->class & 0xff); |
| @@ -1887,8 +1886,7 @@ static void quirk_e100_interrupt(struct pci_dev *dev) | |||
| 1887 | 1886 | ||
| 1888 | cmd_hi = readb(csr + 3); | 1887 | cmd_hi = readb(csr + 3); |
| 1889 | if (cmd_hi == 0) { | 1888 | if (cmd_hi == 0) { |
| 1890 | dev_warn(&dev->dev, "Firmware left e100 interrupts enabled; " | 1889 | dev_warn(&dev->dev, "Firmware left e100 interrupts enabled; disabling\n"); |
| 1891 | "disabling\n"); | ||
| 1892 | writeb(1, csr + 3); | 1890 | writeb(1, csr + 3); |
| 1893 | } | 1891 | } |
| 1894 | 1892 | ||
| @@ -1958,8 +1956,7 @@ static void quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev) | |||
| 1958 | if (pci_read_config_byte(dev, 0xf41, &b) == 0) { | 1956 | if (pci_read_config_byte(dev, 0xf41, &b) == 0) { |
| 1959 | if (!(b & 0x20)) { | 1957 | if (!(b & 0x20)) { |
| 1960 | pci_write_config_byte(dev, 0xf41, b | 0x20); | 1958 | pci_write_config_byte(dev, 0xf41, b | 0x20); |
| 1961 | dev_info(&dev->dev, | 1959 | dev_info(&dev->dev, "Linking AER extended capability\n"); |
| 1962 | "Linking AER extended capability\n"); | ||
| 1963 | } | 1960 | } |
| 1964 | } | 1961 | } |
| 1965 | } | 1962 | } |
| @@ -1997,8 +1994,7 @@ static void quirk_via_cx700_pci_parking_caching(struct pci_dev *dev) | |||
| 1997 | /* Turn off PCI Bus Parking */ | 1994 | /* Turn off PCI Bus Parking */ |
| 1998 | pci_write_config_byte(dev, 0x76, b ^ 0x40); | 1995 | pci_write_config_byte(dev, 0x76, b ^ 0x40); |
| 1999 | 1996 | ||
| 2000 | dev_info(&dev->dev, | 1997 | dev_info(&dev->dev, "Disabling VIA CX700 PCI parking\n"); |
| 2001 | "Disabling VIA CX700 PCI parking\n"); | ||
| 2002 | } | 1998 | } |
| 2003 | } | 1999 | } |
| 2004 | 2000 | ||
| @@ -2013,8 +2009,7 @@ static void quirk_via_cx700_pci_parking_caching(struct pci_dev *dev) | |||
| 2013 | /* Disable "Read FIFO Timer" */ | 2009 | /* Disable "Read FIFO Timer" */ |
| 2014 | pci_write_config_byte(dev, 0x77, 0x0); | 2010 | pci_write_config_byte(dev, 0x77, 0x0); |
| 2015 | 2011 | ||
| 2016 | dev_info(&dev->dev, | 2012 | dev_info(&dev->dev, "Disabling VIA CX700 PCI caching\n"); |
| 2017 | "Disabling VIA CX700 PCI caching\n"); | ||
| 2018 | } | 2013 | } |
| 2019 | } | 2014 | } |
| 2020 | } | 2015 | } |
| @@ -2149,8 +2144,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8380_0, quirk_disab | |||
| 2149 | static void quirk_disable_msi(struct pci_dev *dev) | 2144 | static void quirk_disable_msi(struct pci_dev *dev) |
| 2150 | { | 2145 | { |
| 2151 | if (dev->subordinate) { | 2146 | if (dev->subordinate) { |
| 2152 | dev_warn(&dev->dev, "MSI quirk detected; " | 2147 | dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n"); |
| 2153 | "subordinate MSI disabled\n"); | ||
| 2154 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; | 2148 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; |
| 2155 | } | 2149 | } |
| 2156 | } | 2150 | } |
| @@ -2189,8 +2183,7 @@ static int msi_ht_cap_enabled(struct pci_dev *dev) | |||
| 2189 | u8 flags; | 2183 | u8 flags; |
| 2190 | 2184 | ||
| 2191 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | 2185 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, |
| 2192 | &flags) == 0) | 2186 | &flags) == 0) { |
| 2193 | { | ||
| 2194 | dev_info(&dev->dev, "Found %s HT MSI Mapping\n", | 2187 | dev_info(&dev->dev, "Found %s HT MSI Mapping\n", |
| 2195 | flags & HT_MSI_FLAGS_ENABLE ? | 2188 | flags & HT_MSI_FLAGS_ENABLE ? |
| 2196 | "enabled" : "disabled"); | 2189 | "enabled" : "disabled"); |
| @@ -2207,8 +2200,7 @@ static int msi_ht_cap_enabled(struct pci_dev *dev) | |||
| 2207 | static void quirk_msi_ht_cap(struct pci_dev *dev) | 2200 | static void quirk_msi_ht_cap(struct pci_dev *dev) |
| 2208 | { | 2201 | { |
| 2209 | if (dev->subordinate && !msi_ht_cap_enabled(dev)) { | 2202 | if (dev->subordinate && !msi_ht_cap_enabled(dev)) { |
| 2210 | dev_warn(&dev->dev, "MSI quirk detected; " | 2203 | dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n"); |
| 2211 | "subordinate MSI disabled\n"); | ||
| 2212 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; | 2204 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; |
| 2213 | } | 2205 | } |
| 2214 | } | 2206 | } |
| @@ -2232,8 +2224,7 @@ static void quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) | |||
| 2232 | if (!pdev) | 2224 | if (!pdev) |
| 2233 | return; | 2225 | return; |
| 2234 | if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) { | 2226 | if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) { |
| 2235 | dev_warn(&dev->dev, "MSI quirk detected; " | 2227 | dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n"); |
| 2236 | "subordinate MSI disabled\n"); | ||
| 2237 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; | 2228 | dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; |
| 2238 | } | 2229 | } |
| 2239 | pci_dev_put(pdev); | 2230 | pci_dev_put(pdev); |
| @@ -2279,8 +2270,7 @@ static void nvenet_msi_disable(struct pci_dev *dev) | |||
| 2279 | if (board_name && | 2270 | if (board_name && |
| 2280 | (strstr(board_name, "P5N32-SLI PREMIUM") || | 2271 | (strstr(board_name, "P5N32-SLI PREMIUM") || |
| 2281 | strstr(board_name, "P5N32-E SLI"))) { | 2272 | strstr(board_name, "P5N32-E SLI"))) { |
| 2282 | dev_info(&dev->dev, | 2273 | dev_info(&dev->dev, "Disabling msi for MCP55 NIC on P5N32-SLI\n"); |
| 2283 | "Disabling msi for MCP55 NIC on P5N32-SLI\n"); | ||
| 2284 | dev->no_msi = 1; | 2274 | dev->no_msi = 1; |
| 2285 | } | 2275 | } |
| 2286 | } | 2276 | } |
| @@ -2489,8 +2479,7 @@ static void __nv_msi_ht_cap_quirk(struct pci_dev *dev, int all) | |||
| 2489 | */ | 2479 | */ |
| 2490 | host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); | 2480 | host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); |
| 2491 | if (host_bridge == NULL) { | 2481 | if (host_bridge == NULL) { |
| 2492 | dev_warn(&dev->dev, | 2482 | dev_warn(&dev->dev, "nv_msi_ht_cap_quirk didn't locate host bridge\n"); |
| 2493 | "nv_msi_ht_cap_quirk didn't locate host bridge\n"); | ||
| 2494 | return; | 2483 | return; |
| 2495 | } | 2484 | } |
| 2496 | 2485 | ||
| @@ -2817,8 +2806,7 @@ static void quirk_intel_mc_errata(struct pci_dev *dev) | |||
| 2817 | */ | 2806 | */ |
| 2818 | err = pci_read_config_word(dev, 0x48, &rcc); | 2807 | err = pci_read_config_word(dev, 0x48, &rcc); |
| 2819 | if (err) { | 2808 | if (err) { |
| 2820 | dev_err(&dev->dev, "Error attempting to read the read " | 2809 | dev_err(&dev->dev, "Error attempting to read the read completion coalescing register\n"); |
| 2821 | "completion coalescing register.\n"); | ||
| 2822 | return; | 2810 | return; |
| 2823 | } | 2811 | } |
| 2824 | 2812 | ||
| @@ -2829,13 +2817,11 @@ static void quirk_intel_mc_errata(struct pci_dev *dev) | |||
| 2829 | 2817 | ||
| 2830 | err = pci_write_config_word(dev, 0x48, rcc); | 2818 | err = pci_write_config_word(dev, 0x48, rcc); |
| 2831 | if (err) { | 2819 | if (err) { |
| 2832 | dev_err(&dev->dev, "Error attempting to write the read " | 2820 | dev_err(&dev->dev, "Error attempting to write the read completion coalescing register\n"); |
| 2833 | "completion coalescing register.\n"); | ||
| 2834 | return; | 2821 | return; |
| 2835 | } | 2822 | } |
| 2836 | 2823 | ||
| 2837 | pr_info_once("Read completion coalescing disabled due to hardware " | 2824 | pr_info_once("Read completion coalescing disabled due to hardware errata relating to 256B MPS\n"); |
| 2838 | "errata relating to 256B MPS.\n"); | ||
| 2839 | } | 2825 | } |
| 2840 | /* Intel 5000 series memory controllers and ports 2-7 */ | 2826 | /* Intel 5000 series memory controllers and ports 2-7 */ |
| 2841 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x25c0, quirk_intel_mc_errata); | 2827 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x25c0, quirk_intel_mc_errata); |
| @@ -2944,8 +2930,7 @@ static void disable_igfx_irq(struct pci_dev *dev) | |||
| 2944 | 2930 | ||
| 2945 | /* Check if any interrupt line is still enabled */ | 2931 | /* Check if any interrupt line is still enabled */ |
| 2946 | if (readl(regs + I915_DEIER_REG) != 0) { | 2932 | if (readl(regs + I915_DEIER_REG) != 0) { |
| 2947 | dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; " | 2933 | dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; disabling\n"); |
| 2948 | "disabling\n"); | ||
| 2949 | 2934 | ||
| 2950 | writel(0, regs + I915_DEIER_REG); | 2935 | writel(0, regs + I915_DEIER_REG); |
| 2951 | } | 2936 | } |
| @@ -3040,7 +3025,7 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | |||
| 3040 | { | 3025 | { |
| 3041 | struct pci_fixup *start, *end; | 3026 | struct pci_fixup *start, *end; |
| 3042 | 3027 | ||
| 3043 | switch(pass) { | 3028 | switch (pass) { |
| 3044 | case pci_fixup_early: | 3029 | case pci_fixup_early: |
| 3045 | start = __start_pci_fixups_early; | 3030 | start = __start_pci_fixups_early; |
| 3046 | end = __end_pci_fixups_early; | 3031 | end = __end_pci_fixups_early; |
| @@ -3112,8 +3097,8 @@ static int __init pci_apply_final_quirks(void) | |||
| 3112 | if (!tmp || cls == tmp) | 3097 | if (!tmp || cls == tmp) |
| 3113 | continue; | 3098 | continue; |
| 3114 | 3099 | ||
| 3115 | printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), " | 3100 | printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), using %u bytes\n", |
| 3116 | "using %u bytes\n", cls << 2, tmp << 2, | 3101 | cls << 2, tmp << 2, |
| 3117 | pci_dfl_cache_line_size << 2); | 3102 | pci_dfl_cache_line_size << 2); |
| 3118 | pci_cache_line_size = pci_dfl_cache_line_size; | 3103 | pci_cache_line_size = pci_dfl_cache_line_size; |
| 3119 | } | 3104 | } |
| @@ -3342,6 +3327,85 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe) | |||
| 3342 | return -ENOTTY; | 3327 | return -ENOTTY; |
| 3343 | } | 3328 | } |
| 3344 | 3329 | ||
| 3330 | static void quirk_dma_func0_alias(struct pci_dev *dev) | ||
| 3331 | { | ||
| 3332 | if (PCI_FUNC(dev->devfn) != 0) { | ||
| 3333 | dev->dma_alias_devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 0); | ||
| 3334 | dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN; | ||
| 3335 | } | ||
| 3336 | } | ||
| 3337 | |||
| 3338 | /* | ||
| 3339 | * https://bugzilla.redhat.com/show_bug.cgi?id=605888 | ||
| 3340 | * | ||
| 3341 | * Some Ricoh devices use function 0 as the PCIe requester ID for DMA. | ||
| 3342 | */ | ||
| 3343 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias); | ||
| 3344 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias); | ||
| 3345 | |||
| 3346 | static void quirk_dma_func1_alias(struct pci_dev *dev) | ||
| 3347 | { | ||
| 3348 | if (PCI_FUNC(dev->devfn) != 1) { | ||
| 3349 | dev->dma_alias_devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 1); | ||
| 3350 | dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN; | ||
| 3351 | } | ||
| 3352 | } | ||
| 3353 | |||
| 3354 | /* | ||
| 3355 | * Marvell 88SE9123 uses function 1 as the requester ID for DMA. In some | ||
| 3356 | * SKUs function 1 is present and is a legacy IDE controller, in other | ||
| 3357 | * SKUs this function is not present, making this a ghost requester. | ||
| 3358 | * https://bugzilla.kernel.org/show_bug.cgi?id=42679 | ||
| 3359 | */ | ||
| 3360 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, | ||
| 3361 | quirk_dma_func1_alias); | ||
| 3362 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ | ||
| 3363 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130, | ||
| 3364 | quirk_dma_func1_alias); | ||
| 3365 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c47 + c57 */ | ||
| 3366 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9172, | ||
| 3367 | quirk_dma_func1_alias); | ||
| 3368 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c59 */ | ||
| 3369 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x917a, | ||
| 3370 | quirk_dma_func1_alias); | ||
| 3371 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */ | ||
| 3372 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0, | ||
| 3373 | quirk_dma_func1_alias); | ||
| 3374 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */ | ||
| 3375 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230, | ||
| 3376 | quirk_dma_func1_alias); | ||
| 3377 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642, | ||
| 3378 | quirk_dma_func1_alias); | ||
| 3379 | /* https://bugs.gentoo.org/show_bug.cgi?id=497630 */ | ||
| 3380 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, | ||
| 3381 | PCI_DEVICE_ID_JMICRON_JMB388_ESD, | ||
| 3382 | quirk_dma_func1_alias); | ||
| 3383 | |||
| 3384 | /* | ||
| 3385 | * A few PCIe-to-PCI bridges fail to expose a PCIe capability, resulting in | ||
| 3386 | * using the wrong DMA alias for the device. Some of these devices can be | ||
| 3387 | * used as either forward or reverse bridges, so we need to test whether the | ||
| 3388 | * device is operating in the correct mode. We could probably apply this | ||
| 3389 | * quirk to PCI_ANY_ID, but for now we'll just use known offenders. The test | ||
| 3390 | * is for a non-root, non-PCIe bridge where the upstream device is PCIe and | ||
| 3391 | * is not a PCIe-to-PCI bridge, then @pdev is actually a PCIe-to-PCI bridge. | ||
| 3392 | */ | ||
| 3393 | static void quirk_use_pcie_bridge_dma_alias(struct pci_dev *pdev) | ||
| 3394 | { | ||
| 3395 | if (!pci_is_root_bus(pdev->bus) && | ||
| 3396 | pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE && | ||
| 3397 | !pci_is_pcie(pdev) && pci_is_pcie(pdev->bus->self) && | ||
| 3398 | pci_pcie_type(pdev->bus->self) != PCI_EXP_TYPE_PCI_BRIDGE) | ||
| 3399 | pdev->dev_flags |= PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS; | ||
| 3400 | } | ||
| 3401 | /* ASM1083/1085, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c46 */ | ||
| 3402 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ASMEDIA, 0x1080, | ||
| 3403 | quirk_use_pcie_bridge_dma_alias); | ||
| 3404 | /* Tundra 8113, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c43 */ | ||
| 3405 | DECLARE_PCI_FIXUP_HEADER(0x10e3, 0x8113, quirk_use_pcie_bridge_dma_alias); | ||
| 3406 | /* ITE 8892, https://bugzilla.kernel.org/show_bug.cgi?id=73551 */ | ||
| 3407 | DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias); | ||
| 3408 | |||
| 3345 | static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev) | 3409 | static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev) |
| 3346 | { | 3410 | { |
| 3347 | if (!PCI_FUNC(dev->devfn)) | 3411 | if (!PCI_FUNC(dev->devfn)) |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index c1839450d4d6..f955edb9bea7 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
| @@ -38,6 +38,7 @@ int pci_enable_rom(struct pci_dev *pdev) | |||
| 38 | pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr); | 38 | pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr); |
| 39 | return 0; | 39 | return 0; |
| 40 | } | 40 | } |
| 41 | EXPORT_SYMBOL_GPL(pci_enable_rom); | ||
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| 43 | * pci_disable_rom - disable ROM decoding for a PCI device | 44 | * pci_disable_rom - disable ROM decoding for a PCI device |
| @@ -53,6 +54,7 @@ void pci_disable_rom(struct pci_dev *pdev) | |||
| 53 | rom_addr &= ~PCI_ROM_ADDRESS_ENABLE; | 54 | rom_addr &= ~PCI_ROM_ADDRESS_ENABLE; |
| 54 | pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr); | 55 | pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr); |
| 55 | } | 56 | } |
| 57 | EXPORT_SYMBOL_GPL(pci_disable_rom); | ||
| 56 | 58 | ||
| 57 | /** | 59 | /** |
| 58 | * pci_get_rom_size - obtain the actual size of the ROM image | 60 | * pci_get_rom_size - obtain the actual size of the ROM image |
| @@ -135,7 +137,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
| 135 | } else { | 137 | } else { |
| 136 | /* assign the ROM an address if it doesn't have one */ | 138 | /* assign the ROM an address if it doesn't have one */ |
| 137 | if (res->parent == NULL && | 139 | if (res->parent == NULL && |
| 138 | pci_assign_resource(pdev,PCI_ROM_RESOURCE)) | 140 | pci_assign_resource(pdev, PCI_ROM_RESOURCE)) |
| 139 | return NULL; | 141 | return NULL; |
| 140 | start = pci_resource_start(pdev, PCI_ROM_RESOURCE); | 142 | start = pci_resource_start(pdev, PCI_ROM_RESOURCE); |
| 141 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | 143 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); |
| @@ -166,6 +168,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
| 166 | *size = pci_get_rom_size(pdev, rom, *size); | 168 | *size = pci_get_rom_size(pdev, rom, *size); |
| 167 | return rom; | 169 | return rom; |
| 168 | } | 170 | } |
| 171 | EXPORT_SYMBOL(pci_map_rom); | ||
| 169 | 172 | ||
| 170 | /** | 173 | /** |
| 171 | * pci_unmap_rom - unmap the ROM from kernel space | 174 | * pci_unmap_rom - unmap the ROM from kernel space |
| @@ -187,6 +190,7 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom) | |||
| 187 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) | 190 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) |
| 188 | pci_disable_rom(pdev); | 191 | pci_disable_rom(pdev); |
| 189 | } | 192 | } |
| 193 | EXPORT_SYMBOL(pci_unmap_rom); | ||
| 190 | 194 | ||
| 191 | /** | 195 | /** |
| 192 | * pci_cleanup_rom - free the ROM copy created by pci_map_rom_copy | 196 | * pci_cleanup_rom - free the ROM copy created by pci_map_rom_copy |
| @@ -199,7 +203,7 @@ void pci_cleanup_rom(struct pci_dev *pdev) | |||
| 199 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | 203 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; |
| 200 | 204 | ||
| 201 | if (res->flags & IORESOURCE_ROM_COPY) { | 205 | if (res->flags & IORESOURCE_ROM_COPY) { |
| 202 | kfree((void*)(unsigned long)res->start); | 206 | kfree((void *)(unsigned long)res->start); |
| 203 | res->flags |= IORESOURCE_UNSET; | 207 | res->flags |= IORESOURCE_UNSET; |
| 204 | res->flags &= ~IORESOURCE_ROM_COPY; | 208 | res->flags &= ~IORESOURCE_ROM_COPY; |
| 205 | res->start = 0; | 209 | res->start = 0; |
| @@ -222,9 +226,4 @@ void __iomem *pci_platform_rom(struct pci_dev *pdev, size_t *size) | |||
| 222 | 226 | ||
| 223 | return NULL; | 227 | return NULL; |
| 224 | } | 228 | } |
| 225 | |||
| 226 | EXPORT_SYMBOL(pci_map_rom); | ||
| 227 | EXPORT_SYMBOL(pci_unmap_rom); | ||
| 228 | EXPORT_SYMBOL_GPL(pci_enable_rom); | ||
| 229 | EXPORT_SYMBOL_GPL(pci_disable_rom); | ||
| 230 | EXPORT_SYMBOL(pci_platform_rom); | 229 | EXPORT_SYMBOL(pci_platform_rom); |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 8e495bda678f..827ad831f1dd 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
| @@ -17,14 +17,100 @@ DECLARE_RWSEM(pci_bus_sem); | |||
| 17 | EXPORT_SYMBOL_GPL(pci_bus_sem); | 17 | EXPORT_SYMBOL_GPL(pci_bus_sem); |
| 18 | 18 | ||
| 19 | /* | 19 | /* |
| 20 | * pci_for_each_dma_alias - Iterate over DMA aliases for a device | ||
| 21 | * @pdev: starting downstream device | ||
| 22 | * @fn: function to call for each alias | ||
| 23 | * @data: opaque data to pass to @fn | ||
| 24 | * | ||
| 25 | * Starting @pdev, walk up the bus calling @fn for each possible alias | ||
| 26 | * of @pdev at the root bus. | ||
| 27 | */ | ||
| 28 | int pci_for_each_dma_alias(struct pci_dev *pdev, | ||
| 29 | int (*fn)(struct pci_dev *pdev, | ||
| 30 | u16 alias, void *data), void *data) | ||
| 31 | { | ||
| 32 | struct pci_bus *bus; | ||
| 33 | int ret; | ||
| 34 | |||
| 35 | ret = fn(pdev, PCI_DEVID(pdev->bus->number, pdev->devfn), data); | ||
| 36 | if (ret) | ||
| 37 | return ret; | ||
| 38 | |||
| 39 | /* | ||
| 40 | * If the device is broken and uses an alias requester ID for | ||
| 41 | * DMA, iterate over that too. | ||
| 42 | */ | ||
| 43 | if (unlikely(pdev->dev_flags & PCI_DEV_FLAGS_DMA_ALIAS_DEVFN)) { | ||
| 44 | ret = fn(pdev, PCI_DEVID(pdev->bus->number, | ||
| 45 | pdev->dma_alias_devfn), data); | ||
| 46 | if (ret) | ||
| 47 | return ret; | ||
| 48 | } | ||
| 49 | |||
| 50 | for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) { | ||
| 51 | struct pci_dev *tmp; | ||
| 52 | |||
| 53 | /* Skip virtual buses */ | ||
| 54 | if (!bus->self) | ||
| 55 | continue; | ||
| 56 | |||
| 57 | tmp = bus->self; | ||
| 58 | |||
| 59 | /* | ||
| 60 | * PCIe-to-PCI/X bridges alias transactions from downstream | ||
| 61 | * devices using the subordinate bus number (PCI Express to | ||
| 62 | * PCI/PCI-X Bridge Spec, rev 1.0, sec 2.3). For all cases | ||
| 63 | * where the upstream bus is PCI/X we alias to the bridge | ||
| 64 | * (there are various conditions in the previous reference | ||
| 65 | * where the bridge may take ownership of transactions, even | ||
| 66 | * when the secondary interface is PCI-X). | ||
| 67 | */ | ||
| 68 | if (pci_is_pcie(tmp)) { | ||
| 69 | switch (pci_pcie_type(tmp)) { | ||
| 70 | case PCI_EXP_TYPE_ROOT_PORT: | ||
| 71 | case PCI_EXP_TYPE_UPSTREAM: | ||
| 72 | case PCI_EXP_TYPE_DOWNSTREAM: | ||
| 73 | continue; | ||
| 74 | case PCI_EXP_TYPE_PCI_BRIDGE: | ||
| 75 | ret = fn(tmp, | ||
| 76 | PCI_DEVID(tmp->subordinate->number, | ||
| 77 | PCI_DEVFN(0, 0)), data); | ||
| 78 | if (ret) | ||
| 79 | return ret; | ||
| 80 | continue; | ||
| 81 | case PCI_EXP_TYPE_PCIE_BRIDGE: | ||
| 82 | ret = fn(tmp, | ||
| 83 | PCI_DEVID(tmp->bus->number, | ||
| 84 | tmp->devfn), data); | ||
| 85 | if (ret) | ||
| 86 | return ret; | ||
| 87 | continue; | ||
| 88 | } | ||
| 89 | } else { | ||
| 90 | if (tmp->dev_flags & PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS) | ||
| 91 | ret = fn(tmp, | ||
| 92 | PCI_DEVID(tmp->subordinate->number, | ||
| 93 | PCI_DEVFN(0, 0)), data); | ||
| 94 | else | ||
| 95 | ret = fn(tmp, | ||
| 96 | PCI_DEVID(tmp->bus->number, | ||
| 97 | tmp->devfn), data); | ||
| 98 | if (ret) | ||
| 99 | return ret; | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | return ret; | ||
| 104 | } | ||
| 105 | |||
| 106 | /* | ||
| 20 | * find the upstream PCIe-to-PCI bridge of a PCI device | 107 | * find the upstream PCIe-to-PCI bridge of a PCI device |
| 21 | * if the device is PCIE, return NULL | 108 | * if the device is PCIE, return NULL |
| 22 | * if the device isn't connected to a PCIe bridge (that is its parent is a | 109 | * if the device isn't connected to a PCIe bridge (that is its parent is a |
| 23 | * legacy PCI bridge and the bridge is directly connected to bus 0), return its | 110 | * legacy PCI bridge and the bridge is directly connected to bus 0), return its |
| 24 | * parent | 111 | * parent |
| 25 | */ | 112 | */ |
| 26 | struct pci_dev * | 113 | struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev) |
| 27 | pci_find_upstream_pcie_bridge(struct pci_dev *pdev) | ||
| 28 | { | 114 | { |
| 29 | struct pci_dev *tmp = NULL; | 115 | struct pci_dev *tmp = NULL; |
| 30 | 116 | ||
| @@ -56,12 +142,12 @@ static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) | |||
| 56 | struct pci_bus *child; | 142 | struct pci_bus *child; |
| 57 | struct pci_bus *tmp; | 143 | struct pci_bus *tmp; |
| 58 | 144 | ||
| 59 | if(bus->number == busnr) | 145 | if (bus->number == busnr) |
| 60 | return bus; | 146 | return bus; |
| 61 | 147 | ||
| 62 | list_for_each_entry(tmp, &bus->children, node) { | 148 | list_for_each_entry(tmp, &bus->children, node) { |
| 63 | child = pci_do_find_bus(tmp, busnr); | 149 | child = pci_do_find_bus(tmp, busnr); |
| 64 | if(child) | 150 | if (child) |
| 65 | return child; | 151 | return child; |
| 66 | } | 152 | } |
| 67 | return NULL; | 153 | return NULL; |
| @@ -76,7 +162,7 @@ static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) | |||
| 76 | * in the global list of PCI buses. If the bus is found, a pointer to its | 162 | * in the global list of PCI buses. If the bus is found, a pointer to its |
| 77 | * data structure is returned. If no bus is found, %NULL is returned. | 163 | * data structure is returned. If no bus is found, %NULL is returned. |
| 78 | */ | 164 | */ |
| 79 | struct pci_bus * pci_find_bus(int domain, int busnr) | 165 | struct pci_bus *pci_find_bus(int domain, int busnr) |
| 80 | { | 166 | { |
| 81 | struct pci_bus *bus = NULL; | 167 | struct pci_bus *bus = NULL; |
| 82 | struct pci_bus *tmp_bus; | 168 | struct pci_bus *tmp_bus; |
| @@ -90,6 +176,7 @@ struct pci_bus * pci_find_bus(int domain, int busnr) | |||
| 90 | } | 176 | } |
| 91 | return NULL; | 177 | return NULL; |
| 92 | } | 178 | } |
| 179 | EXPORT_SYMBOL(pci_find_bus); | ||
| 93 | 180 | ||
| 94 | /** | 181 | /** |
| 95 | * pci_find_next_bus - begin or continue searching for a PCI bus | 182 | * pci_find_next_bus - begin or continue searching for a PCI bus |
| @@ -100,8 +187,7 @@ struct pci_bus * pci_find_bus(int domain, int busnr) | |||
| 100 | * @from is not %NULL, searches continue from next device on the | 187 | * @from is not %NULL, searches continue from next device on the |
| 101 | * global list. | 188 | * global list. |
| 102 | */ | 189 | */ |
| 103 | struct pci_bus * | 190 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from) |
| 104 | pci_find_next_bus(const struct pci_bus *from) | ||
| 105 | { | 191 | { |
| 106 | struct list_head *n; | 192 | struct list_head *n; |
| 107 | struct pci_bus *b = NULL; | 193 | struct pci_bus *b = NULL; |
| @@ -114,6 +200,7 @@ pci_find_next_bus(const struct pci_bus *from) | |||
| 114 | up_read(&pci_bus_sem); | 200 | up_read(&pci_bus_sem); |
| 115 | return b; | 201 | return b; |
| 116 | } | 202 | } |
| 203 | EXPORT_SYMBOL(pci_find_next_bus); | ||
| 117 | 204 | ||
| 118 | /** | 205 | /** |
| 119 | * pci_get_slot - locate PCI device for a given PCI slot | 206 | * pci_get_slot - locate PCI device for a given PCI slot |
| @@ -147,6 +234,7 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn) | |||
| 147 | up_read(&pci_bus_sem); | 234 | up_read(&pci_bus_sem); |
| 148 | return dev; | 235 | return dev; |
| 149 | } | 236 | } |
| 237 | EXPORT_SYMBOL(pci_get_slot); | ||
| 150 | 238 | ||
| 151 | /** | 239 | /** |
| 152 | * pci_get_domain_bus_and_slot - locate PCI device for a given PCI domain (segment), bus, and slot | 240 | * pci_get_domain_bus_and_slot - locate PCI device for a given PCI domain (segment), bus, and slot |
| @@ -251,6 +339,7 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | |||
| 251 | 339 | ||
| 252 | return pci_get_dev_by_id(&id, from); | 340 | return pci_get_dev_by_id(&id, from); |
| 253 | } | 341 | } |
| 342 | EXPORT_SYMBOL(pci_get_subsys); | ||
| 254 | 343 | ||
| 255 | /** | 344 | /** |
| 256 | * pci_get_device - begin or continue searching for a PCI device by vendor/device id | 345 | * pci_get_device - begin or continue searching for a PCI device by vendor/device id |
| @@ -266,11 +355,12 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | |||
| 266 | * from next device on the global list. The reference count for @from is | 355 | * from next device on the global list. The reference count for @from is |
| 267 | * always decremented if it is not %NULL. | 356 | * always decremented if it is not %NULL. |
| 268 | */ | 357 | */ |
| 269 | struct pci_dev * | 358 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, |
| 270 | pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from) | 359 | struct pci_dev *from) |
| 271 | { | 360 | { |
| 272 | return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); | 361 | return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); |
| 273 | } | 362 | } |
| 363 | EXPORT_SYMBOL(pci_get_device); | ||
| 274 | 364 | ||
| 275 | /** | 365 | /** |
| 276 | * pci_get_class - begin or continue searching for a PCI device by class | 366 | * pci_get_class - begin or continue searching for a PCI device by class |
| @@ -299,6 +389,7 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) | |||
| 299 | 389 | ||
| 300 | return pci_get_dev_by_id(&id, from); | 390 | return pci_get_dev_by_id(&id, from); |
| 301 | } | 391 | } |
| 392 | EXPORT_SYMBOL(pci_get_class); | ||
| 302 | 393 | ||
| 303 | /** | 394 | /** |
| 304 | * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. | 395 | * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. |
| @@ -328,12 +419,3 @@ int pci_dev_present(const struct pci_device_id *ids) | |||
| 328 | return 0; | 419 | return 0; |
| 329 | } | 420 | } |
| 330 | EXPORT_SYMBOL(pci_dev_present); | 421 | EXPORT_SYMBOL(pci_dev_present); |
| 331 | |||
| 332 | /* For boot time work */ | ||
| 333 | EXPORT_SYMBOL(pci_find_bus); | ||
| 334 | EXPORT_SYMBOL(pci_find_next_bus); | ||
| 335 | /* For everyone */ | ||
| 336 | EXPORT_SYMBOL(pci_get_device); | ||
| 337 | EXPORT_SYMBOL(pci_get_subsys); | ||
| 338 | EXPORT_SYMBOL(pci_get_slot); | ||
| 339 | EXPORT_SYMBOL(pci_get_class); | ||
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index fd9b545c3cf5..a5a63ecfb628 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
| @@ -68,7 +68,7 @@ static int add_to_list(struct list_head *head, | |||
| 68 | 68 | ||
| 69 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); | 69 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); |
| 70 | if (!tmp) { | 70 | if (!tmp) { |
| 71 | pr_warning("add_to_list: kmalloc() failed!\n"); | 71 | pr_warn("add_to_list: kmalloc() failed!\n"); |
| 72 | return -ENOMEM; | 72 | return -ENOMEM; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| @@ -148,8 +148,7 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head) | |||
| 148 | 148 | ||
| 149 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); | 149 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); |
| 150 | if (!tmp) | 150 | if (!tmp) |
| 151 | panic("pdev_sort_resources(): " | 151 | panic("pdev_sort_resources(): kmalloc() failed!\n"); |
| 152 | "kmalloc() failed!\n"); | ||
| 153 | tmp->res = r; | 152 | tmp->res = r; |
| 154 | tmp->dev = dev; | 153 | tmp->dev = dev; |
| 155 | 154 | ||
| @@ -736,7 +735,7 @@ static resource_size_t calculate_iosize(resource_size_t size, | |||
| 736 | { | 735 | { |
| 737 | if (size < min_size) | 736 | if (size < min_size) |
| 738 | size = min_size; | 737 | size = min_size; |
| 739 | if (old_size == 1 ) | 738 | if (old_size == 1) |
| 740 | old_size = 0; | 739 | old_size = 0; |
| 741 | /* To be fixed in 2.5: we should have sort of HAVE_ISA | 740 | /* To be fixed in 2.5: we should have sort of HAVE_ISA |
| 742 | flag in the struct pci_bus. */ | 741 | flag in the struct pci_bus. */ |
| @@ -757,7 +756,7 @@ static resource_size_t calculate_memsize(resource_size_t size, | |||
| 757 | { | 756 | { |
| 758 | if (size < min_size) | 757 | if (size < min_size) |
| 759 | size = min_size; | 758 | size = min_size; |
| 760 | if (old_size == 1 ) | 759 | if (old_size == 1) |
| 761 | old_size = 0; | 760 | old_size = 0; |
| 762 | if (size < old_size) | 761 | if (size < old_size) |
| 763 | size = old_size; | 762 | size = old_size; |
| @@ -859,9 +858,8 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, | |||
| 859 | resource_size(b_res), min_align); | 858 | resource_size(b_res), min_align); |
| 860 | if (!size0 && !size1) { | 859 | if (!size0 && !size1) { |
| 861 | if (b_res->start || b_res->end) | 860 | if (b_res->start || b_res->end) |
| 862 | dev_info(&bus->self->dev, "disabling bridge window " | 861 | dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n", |
| 863 | "%pR to %pR (unused)\n", b_res, | 862 | b_res, &bus->busn_res); |
| 864 | &bus->busn_res); | ||
| 865 | b_res->flags = 0; | 863 | b_res->flags = 0; |
| 866 | return; | 864 | return; |
| 867 | } | 865 | } |
| @@ -872,10 +870,9 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, | |||
| 872 | if (size1 > size0 && realloc_head) { | 870 | if (size1 > size0 && realloc_head) { |
| 873 | add_to_list(realloc_head, bus->self, b_res, size1-size0, | 871 | add_to_list(realloc_head, bus->self, b_res, size1-size0, |
| 874 | min_align); | 872 | min_align); |
| 875 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " | 873 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n", |
| 876 | "%pR to %pR add_size %llx\n", b_res, | 874 | b_res, &bus->busn_res, |
| 877 | &bus->busn_res, | 875 | (unsigned long long)size1-size0); |
| 878 | (unsigned long long)size1-size0); | ||
| 879 | } | 876 | } |
| 880 | } | 877 | } |
| 881 | 878 | ||
| @@ -974,9 +971,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, | |||
| 974 | if (order < 0) | 971 | if (order < 0) |
| 975 | order = 0; | 972 | order = 0; |
| 976 | if (order >= ARRAY_SIZE(aligns)) { | 973 | if (order >= ARRAY_SIZE(aligns)) { |
| 977 | dev_warn(&dev->dev, "disabling BAR %d: %pR " | 974 | dev_warn(&dev->dev, "disabling BAR %d: %pR (bad alignment %#llx)\n", |
| 978 | "(bad alignment %#llx)\n", i, r, | 975 | i, r, (unsigned long long) align); |
| 979 | (unsigned long long) align); | ||
| 980 | r->flags = 0; | 976 | r->flags = 0; |
| 981 | continue; | 977 | continue; |
| 982 | } | 978 | } |
| @@ -1003,9 +999,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, | |||
| 1003 | resource_size(b_res), min_align); | 999 | resource_size(b_res), min_align); |
| 1004 | if (!size0 && !size1) { | 1000 | if (!size0 && !size1) { |
| 1005 | if (b_res->start || b_res->end) | 1001 | if (b_res->start || b_res->end) |
| 1006 | dev_info(&bus->self->dev, "disabling bridge window " | 1002 | dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n", |
| 1007 | "%pR to %pR (unused)\n", b_res, | 1003 | b_res, &bus->busn_res); |
| 1008 | &bus->busn_res); | ||
| 1009 | b_res->flags = 0; | 1004 | b_res->flags = 0; |
| 1010 | return 0; | 1005 | return 0; |
| 1011 | } | 1006 | } |
| @@ -1014,9 +1009,9 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, | |||
| 1014 | b_res->flags |= IORESOURCE_STARTALIGN; | 1009 | b_res->flags |= IORESOURCE_STARTALIGN; |
| 1015 | if (size1 > size0 && realloc_head) { | 1010 | if (size1 > size0 && realloc_head) { |
| 1016 | add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align); | 1011 | add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align); |
| 1017 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " | 1012 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n", |
| 1018 | "%pR to %pR add_size %llx\n", b_res, | 1013 | b_res, &bus->busn_res, |
| 1019 | &bus->busn_res, (unsigned long long)size1-size0); | 1014 | (unsigned long long)size1-size0); |
| 1020 | } | 1015 | } |
| 1021 | return 0; | 1016 | return 0; |
| 1022 | } | 1017 | } |
| @@ -1274,8 +1269,8 @@ void __pci_bus_assign_resources(const struct pci_bus *bus, | |||
| 1274 | break; | 1269 | break; |
| 1275 | 1270 | ||
| 1276 | default: | 1271 | default: |
| 1277 | dev_info(&dev->dev, "not setting up bridge for bus " | 1272 | dev_info(&dev->dev, "not setting up bridge for bus %04x:%02x\n", |
| 1278 | "%04x:%02x\n", pci_domain_nr(b), b->number); | 1273 | pci_domain_nr(b), b->number); |
| 1279 | break; | 1274 | break; |
| 1280 | } | 1275 | } |
| 1281 | } | 1276 | } |
| @@ -1312,8 +1307,8 @@ static void __pci_bridge_assign_resources(const struct pci_dev *bridge, | |||
| 1312 | break; | 1307 | break; |
| 1313 | 1308 | ||
| 1314 | default: | 1309 | default: |
| 1315 | dev_info(&bridge->dev, "not setting up bridge for bus " | 1310 | dev_info(&bridge->dev, "not setting up bridge for bus %04x:%02x\n", |
| 1316 | "%04x:%02x\n", pci_domain_nr(b), b->number); | 1311 | pci_domain_nr(b), b->number); |
| 1317 | break; | 1312 | break; |
| 1318 | } | 1313 | } |
| 1319 | } | 1314 | } |
| @@ -1430,10 +1425,10 @@ static void pci_bus_dump_res(struct pci_bus *bus) | |||
| 1430 | 1425 | ||
| 1431 | pci_bus_for_each_resource(bus, res, i) { | 1426 | pci_bus_for_each_resource(bus, res, i) { |
| 1432 | if (!res || !res->end || !res->flags) | 1427 | if (!res || !res->end || !res->flags) |
| 1433 | continue; | 1428 | continue; |
| 1434 | 1429 | ||
| 1435 | dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res); | 1430 | dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res); |
| 1436 | } | 1431 | } |
| 1437 | } | 1432 | } |
| 1438 | 1433 | ||
| 1439 | static void pci_bus_dump_resources(struct pci_bus *bus) | 1434 | static void pci_bus_dump_resources(struct pci_bus *bus) |
| @@ -1458,7 +1453,7 @@ static int pci_bus_get_depth(struct pci_bus *bus) | |||
| 1458 | int depth = 0; | 1453 | int depth = 0; |
| 1459 | struct pci_bus *child_bus; | 1454 | struct pci_bus *child_bus; |
| 1460 | 1455 | ||
| 1461 | list_for_each_entry(child_bus, &bus->children, node){ | 1456 | list_for_each_entry(child_bus, &bus->children, node) { |
| 1462 | int ret; | 1457 | int ret; |
| 1463 | 1458 | ||
| 1464 | ret = pci_bus_get_depth(child_bus); | 1459 | ret = pci_bus_get_depth(child_bus); |
diff --git a/drivers/pci/setup-irq.c b/drivers/pci/setup-irq.c index dbc4ffcf42de..4e2d595d50ca 100644 --- a/drivers/pci/setup-irq.c +++ b/drivers/pci/setup-irq.c | |||
| @@ -22,10 +22,9 @@ void __weak pcibios_update_irq(struct pci_dev *dev, int irq) | |||
| 22 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | 22 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | static void | 25 | static void pdev_fixup_irq(struct pci_dev *dev, |
| 26 | pdev_fixup_irq(struct pci_dev *dev, | 26 | u8 (*swizzle)(struct pci_dev *, u8 *), |
| 27 | u8 (*swizzle)(struct pci_dev *, u8 *), | 27 | int (*map_irq)(const struct pci_dev *, u8, u8)) |
| 28 | int (*map_irq)(const struct pci_dev *, u8, u8)) | ||
| 29 | { | 28 | { |
| 30 | u8 pin, slot; | 29 | u8 pin, slot; |
| 31 | int irq = 0; | 30 | int irq = 0; |
| @@ -58,11 +57,11 @@ pdev_fixup_irq(struct pci_dev *dev, | |||
| 58 | pcibios_update_irq(dev, irq); | 57 | pcibios_update_irq(dev, irq); |
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | void | 60 | void pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *), |
| 62 | pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *), | 61 | int (*map_irq)(const struct pci_dev *, u8, u8)) |
| 63 | int (*map_irq)(const struct pci_dev *, u8, u8)) | ||
| 64 | { | 62 | { |
| 65 | struct pci_dev *dev = NULL; | 63 | struct pci_dev *dev = NULL; |
| 64 | |||
| 66 | for_each_pci_dev(dev) | 65 | for_each_pci_dev(dev) |
| 67 | pdev_fixup_irq(dev, swizzle, map_irq); | 66 | pdev_fixup_irq(dev, swizzle, map_irq); |
| 68 | } | 67 | } |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 33f9e32d94d0..caed1ce6facd 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
| @@ -96,8 +96,8 @@ void pci_update_resource(struct pci_dev *dev, int resno) | |||
| 96 | pci_write_config_dword(dev, reg + 4, new); | 96 | pci_write_config_dword(dev, reg + 4, new); |
| 97 | pci_read_config_dword(dev, reg + 4, &check); | 97 | pci_read_config_dword(dev, reg + 4, &check); |
| 98 | if (check != new) { | 98 | if (check != new) { |
| 99 | dev_err(&dev->dev, "BAR %d: error updating " | 99 | dev_err(&dev->dev, "BAR %d: error updating (high %#08x != %#08x)\n", |
| 100 | "(high %#08x != %#08x)\n", resno, new, check); | 100 | resno, new, check); |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | 103 | ||
| @@ -289,8 +289,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
| 289 | res->flags |= IORESOURCE_UNSET; | 289 | res->flags |= IORESOURCE_UNSET; |
| 290 | align = pci_resource_alignment(dev, res); | 290 | align = pci_resource_alignment(dev, res); |
| 291 | if (!align) { | 291 | if (!align) { |
| 292 | dev_info(&dev->dev, "BAR %d: can't assign %pR " | 292 | dev_info(&dev->dev, "BAR %d: can't assign %pR (bogus alignment)\n", |
| 293 | "(bogus alignment)\n", resno, res); | 293 | resno, res); |
| 294 | return -EINVAL; | 294 | return -EINVAL; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| @@ -314,6 +314,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
| 314 | } | 314 | } |
| 315 | return ret; | 315 | return ret; |
| 316 | } | 316 | } |
| 317 | EXPORT_SYMBOL(pci_assign_resource); | ||
| 317 | 318 | ||
| 318 | int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsize, | 319 | int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsize, |
| 319 | resource_size_t min_align) | 320 | resource_size_t min_align) |
| @@ -324,8 +325,8 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz | |||
| 324 | 325 | ||
| 325 | res->flags |= IORESOURCE_UNSET; | 326 | res->flags |= IORESOURCE_UNSET; |
| 326 | if (!res->parent) { | 327 | if (!res->parent) { |
| 327 | dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR " | 328 | dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n", |
| 328 | "\n", resno, res); | 329 | resno, res); |
| 329 | return -EINVAL; | 330 | return -EINVAL; |
| 330 | } | 331 | } |
| 331 | 332 | ||
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index 24750a1b39b6..b91c4da68365 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c | |||
| @@ -99,7 +99,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, | |||
| 99 | if (!dev) | 99 | if (!dev) |
| 100 | return -ENODEV; | 100 | return -ENODEV; |
| 101 | 101 | ||
| 102 | switch(len) { | 102 | switch (len) { |
| 103 | case 1: | 103 | case 1: |
| 104 | err = get_user(byte, (u8 __user *)buf); | 104 | err = get_user(byte, (u8 __user *)buf); |
| 105 | if (err) | 105 | if (err) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 71d9673c1b2c..466bcd111d85 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -164,13 +164,17 @@ enum pci_dev_flags { | |||
| 164 | /* INTX_DISABLE in PCI_COMMAND register disables MSI | 164 | /* INTX_DISABLE in PCI_COMMAND register disables MSI |
| 165 | * generation too. | 165 | * generation too. |
| 166 | */ | 166 | */ |
| 167 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, | 167 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) (1 << 0), |
| 168 | /* Device configuration is irrevocably lost if disabled into D3 */ | 168 | /* Device configuration is irrevocably lost if disabled into D3 */ |
| 169 | PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, | 169 | PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) (1 << 1), |
| 170 | /* Provide indication device is assigned by a Virtual Machine Manager */ | 170 | /* Provide indication device is assigned by a Virtual Machine Manager */ |
| 171 | PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, | 171 | PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) (1 << 2), |
| 172 | /* Flag for quirk use to store if quirk-specific ACS is enabled */ | 172 | /* Flag for quirk use to store if quirk-specific ACS is enabled */ |
| 173 | PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) 8, | 173 | PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) (1 << 3), |
| 174 | /* Flag to indicate the device uses dma_alias_devfn */ | ||
| 175 | PCI_DEV_FLAGS_DMA_ALIAS_DEVFN = (__force pci_dev_flags_t) (1 << 4), | ||
| 176 | /* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */ | ||
| 177 | PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5), | ||
| 174 | }; | 178 | }; |
| 175 | 179 | ||
| 176 | enum pci_irq_reroute_variant { | 180 | enum pci_irq_reroute_variant { |
| @@ -268,6 +272,7 @@ struct pci_dev { | |||
| 268 | u8 rom_base_reg; /* which config register controls the ROM */ | 272 | u8 rom_base_reg; /* which config register controls the ROM */ |
| 269 | u8 pin; /* which interrupt pin this device uses */ | 273 | u8 pin; /* which interrupt pin this device uses */ |
| 270 | u16 pcie_flags_reg; /* cached PCIe Capabilities Register */ | 274 | u16 pcie_flags_reg; /* cached PCIe Capabilities Register */ |
| 275 | u8 dma_alias_devfn;/* devfn of DMA alias, if any */ | ||
| 271 | 276 | ||
| 272 | struct pci_driver *driver; /* which driver has allocated this device */ | 277 | struct pci_driver *driver; /* which driver has allocated this device */ |
| 273 | u64 dma_mask; /* Mask of the bits of bus address this | 278 | u64 dma_mask; /* Mask of the bits of bus address this |
| @@ -1809,6 +1814,10 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev) | |||
| 1809 | } | 1814 | } |
| 1810 | #endif | 1815 | #endif |
| 1811 | 1816 | ||
| 1817 | int pci_for_each_dma_alias(struct pci_dev *pdev, | ||
| 1818 | int (*fn)(struct pci_dev *pdev, | ||
| 1819 | u16 alias, void *data), void *data); | ||
| 1820 | |||
| 1812 | /** | 1821 | /** |
| 1813 | * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device | 1822 | * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device |
| 1814 | * @pdev: the PCI device | 1823 | * @pdev: the PCI device |
