PCI changes for the v3.16 merge window (part 2):
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) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJTmfzfAAoJEFmIoMA60/r8/YUQAJMrbeoUqtc/DqDKVOxed1ZG itkQ2tDgdQAo9G0axerpQS82+j/3SUnaQ/5FaX4+vyu5DA/Po9grQjRrJO+ppNzH 31pbeWwz3mUvAVeBkFZAf93+mbdlwQ6EMpPFsX86AftGVS81xh9eUZGek2sm/v9t VLM2AcVDbj//Bu4+7oC8l/ws1GcG17dLgvlZydvN9O07aj7mEDWlh/6+fnTKiYXU OcOwWK/ey5npeedcBHlUmQkiM/DVc8R3pHHQCSc40DZJR7YHiGoQnMxpQ/KNBin+ 42ZcOT5gPYvdft+TX6kygYgsgO6NbIU2Vnl3LvO9vlv8nq4qsCz3lbpPEz0+xGiF W0oXWXw3VjdLUsSfwL30PGSYpQ8DbVs5jGl6vJXyDNzDiF36yvPCIOM69Y6gyvvM hKdSeleG6e+tYjeW1qdmGbrnSNj+zmt6muSY16U+lkeOifcWnMTtx8BYpxrjDC76 2lXCp47V05flRapU2ZU5ocR57uTLoEsLNx01yFbnI+50SEBUamEGuKT3YMROOQnm zUiwDONhRAVT55m8QwUHXbryOGmALwCL0Zvb1RG3QetnSyGiK4mWC59t0mWubf4X nlKSE0Buaxiy9UdBIKvMt1oFLV8s0kElac5Rl2K0I2CiIzX/zBRT65GvpNGrWrwo 91pap9RTTOHGpICGSewx =woH9 -----END PGP SIGNATURE----- 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 ...
This commit is contained in:
Коммит
7550cfab3d
|
@ -1,15 +1,7 @@
|
||||||
* Synopsys Designware PCIe interface
|
* Synopsys Designware PCIe interface
|
||||||
|
|
||||||
Required properties:
|
Required properties:
|
||||||
- compatible: should contain "snps,dw-pcie" to identify the
|
- compatible: should contain "snps,dw-pcie" to identify the core.
|
||||||
core, plus an identifier for the specific instance, such
|
|
||||||
as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie".
|
|
||||||
- reg: base addresses and lengths of the pcie controller,
|
|
||||||
the phy controller, additional register for the phy controller.
|
|
||||||
- interrupts: interrupt values for level interrupt,
|
|
||||||
pulse interrupt, special interrupt.
|
|
||||||
- clocks: from common clock binding: handle to pci clock.
|
|
||||||
- clock-names: from common clock binding: should be "pcie" and "pcie_bus".
|
|
||||||
- #address-cells: set to <3>
|
- #address-cells: set to <3>
|
||||||
- #size-cells: set to <2>
|
- #size-cells: set to <2>
|
||||||
- device_type: set to "pci"
|
- device_type: set to "pci"
|
||||||
|
@ -19,65 +11,11 @@ Required properties:
|
||||||
to define the mapping of the PCIe interface to interrupt
|
to define the mapping of the PCIe interface to interrupt
|
||||||
numbers.
|
numbers.
|
||||||
- num-lanes: number of lanes to use
|
- num-lanes: number of lanes to use
|
||||||
|
- clocks: Must contain an entry for each entry in clock-names.
|
||||||
|
See ../clocks/clock-bindings.txt for details.
|
||||||
|
- clock-names: Must include the following entries:
|
||||||
|
- "pcie"
|
||||||
|
- "pcie_bus"
|
||||||
|
|
||||||
Optional properties:
|
Optional properties:
|
||||||
- reset-gpio: gpio pin number of power good signal
|
- reset-gpio: gpio pin number of power good signal
|
||||||
|
|
||||||
Optional properties for fsl,imx6q-pcie
|
|
||||||
- power-on-gpio: gpio pin number of power-enable signal
|
|
||||||
- wake-up-gpio: gpio pin number of incoming wakeup signal
|
|
||||||
- disable-gpio: gpio pin number of outgoing rfkill/endpoint disable signal
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
SoC specific DT Entry:
|
|
||||||
|
|
||||||
pcie@290000 {
|
|
||||||
compatible = "samsung,exynos5440-pcie", "snps,dw-pcie";
|
|
||||||
reg = <0x290000 0x1000
|
|
||||||
0x270000 0x1000
|
|
||||||
0x271000 0x40>;
|
|
||||||
interrupts = <0 20 0>, <0 21 0>, <0 22 0>;
|
|
||||||
clocks = <&clock 28>, <&clock 27>;
|
|
||||||
clock-names = "pcie", "pcie_bus";
|
|
||||||
#address-cells = <3>;
|
|
||||||
#size-cells = <2>;
|
|
||||||
device_type = "pci";
|
|
||||||
ranges = <0x00000800 0 0x40000000 0x40000000 0 0x00001000 /* configuration space */
|
|
||||||
0x81000000 0 0 0x40001000 0 0x00010000 /* downstream I/O */
|
|
||||||
0x82000000 0 0x40011000 0x40011000 0 0x1ffef000>; /* non-prefetchable memory */
|
|
||||||
#interrupt-cells = <1>;
|
|
||||||
interrupt-map-mask = <0 0 0 0>;
|
|
||||||
interrupt-map = <0x0 0 &gic 53>;
|
|
||||||
num-lanes = <4>;
|
|
||||||
};
|
|
||||||
|
|
||||||
pcie@2a0000 {
|
|
||||||
compatible = "samsung,exynos5440-pcie", "snps,dw-pcie";
|
|
||||||
reg = <0x2a0000 0x1000
|
|
||||||
0x272000 0x1000
|
|
||||||
0x271040 0x40>;
|
|
||||||
interrupts = <0 23 0>, <0 24 0>, <0 25 0>;
|
|
||||||
clocks = <&clock 29>, <&clock 27>;
|
|
||||||
clock-names = "pcie", "pcie_bus";
|
|
||||||
#address-cells = <3>;
|
|
||||||
#size-cells = <2>;
|
|
||||||
device_type = "pci";
|
|
||||||
ranges = <0x00000800 0 0x60000000 0x60000000 0 0x00001000 /* configuration space */
|
|
||||||
0x81000000 0 0 0x60001000 0 0x00010000 /* downstream I/O */
|
|
||||||
0x82000000 0 0x60011000 0x60011000 0 0x1ffef000>; /* non-prefetchable memory */
|
|
||||||
#interrupt-cells = <1>;
|
|
||||||
interrupt-map-mask = <0 0 0 0>;
|
|
||||||
interrupt-map = <0x0 0 &gic 56>;
|
|
||||||
num-lanes = <4>;
|
|
||||||
};
|
|
||||||
|
|
||||||
Board specific DT Entry:
|
|
||||||
|
|
||||||
pcie@290000 {
|
|
||||||
reset-gpio = <&pin_ctrl 5 0>;
|
|
||||||
};
|
|
||||||
|
|
||||||
pcie@2a0000 {
|
|
||||||
reset-gpio = <&pin_ctrl 22 0>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
* Freescale i.MX6 PCIe interface
|
||||||
|
|
||||||
|
This PCIe host controller is based on the Synopsis Designware PCIe IP
|
||||||
|
and thus inherits all the common properties defined in designware-pcie.txt.
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible: "fsl,imx6q-pcie"
|
||||||
|
- reg: base addresse and length of the pcie controller
|
||||||
|
- interrupts: A list of interrupt outputs of the controller. Must contain an
|
||||||
|
entry for each entry in the interrupt-names property.
|
||||||
|
- interrupt-names: Must include the following entries:
|
||||||
|
- "msi": The interrupt that is asserted when an MSI is received
|
||||||
|
- clock-names: Must include the following additional entries:
|
||||||
|
- "pcie_phy"
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
pcie@0x01000000 {
|
||||||
|
compatible = "fsl,imx6q-pcie", "snps,dw-pcie";
|
||||||
|
reg = <0x01ffc000 0x4000>;
|
||||||
|
#address-cells = <3>;
|
||||||
|
#size-cells = <2>;
|
||||||
|
device_type = "pci";
|
||||||
|
ranges = <0x00000800 0 0x01f00000 0x01f00000 0 0x00080000
|
||||||
|
0x81000000 0 0 0x01f80000 0 0x00010000
|
||||||
|
0x82000000 0 0x01000000 0x01000000 0 0x00f00000>;
|
||||||
|
num-lanes = <1>;
|
||||||
|
interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
interrupt-names = "msi";
|
||||||
|
#interrupt-cells = <1>;
|
||||||
|
interrupt-map-mask = <0 0 0 0x7>;
|
||||||
|
interrupt-map = <0 0 0 1 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
<0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
<0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
<0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
clocks = <&clks 144>, <&clks 206>, <&clks 189>;
|
||||||
|
clock-names = "pcie", "pcie_bus", "pcie_phy";
|
||||||
|
};
|
|
@ -0,0 +1,65 @@
|
||||||
|
* Samsung Exynos 5440 PCIe interface
|
||||||
|
|
||||||
|
This PCIe host controller is based on the Synopsis Designware PCIe IP
|
||||||
|
and thus inherits all the common properties defined in designware-pcie.txt.
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible: "samsung,exynos5440-pcie"
|
||||||
|
- reg: base addresses and lengths of the pcie controller,
|
||||||
|
the phy controller, additional register for the phy controller.
|
||||||
|
- interrupts: A list of interrupt outputs for level interrupt,
|
||||||
|
pulse interrupt, special interrupt.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
SoC specific DT Entry:
|
||||||
|
|
||||||
|
pcie@290000 {
|
||||||
|
compatible = "samsung,exynos5440-pcie", "snps,dw-pcie";
|
||||||
|
reg = <0x290000 0x1000
|
||||||
|
0x270000 0x1000
|
||||||
|
0x271000 0x40>;
|
||||||
|
interrupts = <0 20 0>, <0 21 0>, <0 22 0>;
|
||||||
|
clocks = <&clock 28>, <&clock 27>;
|
||||||
|
clock-names = "pcie", "pcie_bus";
|
||||||
|
#address-cells = <3>;
|
||||||
|
#size-cells = <2>;
|
||||||
|
device_type = "pci";
|
||||||
|
ranges = <0x00000800 0 0x40000000 0x40000000 0 0x00001000 /* configuration space */
|
||||||
|
0x81000000 0 0 0x40001000 0 0x00010000 /* downstream I/O */
|
||||||
|
0x82000000 0 0x40011000 0x40011000 0 0x1ffef000>; /* non-prefetchable memory */
|
||||||
|
#interrupt-cells = <1>;
|
||||||
|
interrupt-map-mask = <0 0 0 0>;
|
||||||
|
interrupt-map = <0 0 0 0 &gic GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
num-lanes = <4>;
|
||||||
|
};
|
||||||
|
|
||||||
|
pcie@2a0000 {
|
||||||
|
compatible = "samsung,exynos5440-pcie", "snps,dw-pcie";
|
||||||
|
reg = <0x2a0000 0x1000
|
||||||
|
0x272000 0x1000
|
||||||
|
0x271040 0x40>;
|
||||||
|
interrupts = <0 23 0>, <0 24 0>, <0 25 0>;
|
||||||
|
clocks = <&clock 29>, <&clock 27>;
|
||||||
|
clock-names = "pcie", "pcie_bus";
|
||||||
|
#address-cells = <3>;
|
||||||
|
#size-cells = <2>;
|
||||||
|
device_type = "pci";
|
||||||
|
ranges = <0x00000800 0 0x60000000 0x60000000 0 0x00001000 /* configuration space */
|
||||||
|
0x81000000 0 0 0x60001000 0 0x00010000 /* downstream I/O */
|
||||||
|
0x82000000 0 0x60011000 0x60011000 0 0x1ffef000>; /* non-prefetchable memory */
|
||||||
|
#interrupt-cells = <1>;
|
||||||
|
interrupt-map-mask = <0 0 0 0>;
|
||||||
|
interrupt-map = <0 0 0 0 &gic GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
num-lanes = <4>;
|
||||||
|
};
|
||||||
|
|
||||||
|
Board specific DT Entry:
|
||||||
|
|
||||||
|
pcie@290000 {
|
||||||
|
reset-gpio = <&pin_ctrl 5 0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
pcie@2a0000 {
|
||||||
|
reset-gpio = <&pin_ctrl 22 0>;
|
||||||
|
};
|
|
@ -231,10 +231,7 @@ static int pci_vpd_pci22_wait(struct pci_dev *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time_after(jiffies, timeout)) {
|
if (time_after(jiffies, timeout)) {
|
||||||
dev_printk(KERN_DEBUG, &dev->dev,
|
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");
|
||||||
"vpd r/w failed. This is likely a firmware "
|
|
||||||
"bug on this device. Contact the card "
|
|
||||||
"vendor for a firmware update.");
|
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
if (fatal_signal_pending(current))
|
if (fatal_signal_pending(current))
|
||||||
|
|
|
@ -226,6 +226,7 @@ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
|
||||||
type_mask, alignf, alignf_data,
|
type_mask, alignf, alignf_data,
|
||||||
&pci_32_bit);
|
&pci_32_bit);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_bus_alloc_resource);
|
||||||
|
|
||||||
void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
|
void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
|
||||||
|
|
||||||
|
@ -253,6 +254,7 @@ void pci_bus_add_device(struct pci_dev *dev)
|
||||||
|
|
||||||
dev->is_added = 1;
|
dev->is_added = 1;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_bus_add_device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_bus_add_devices - start driver for PCI devices
|
* pci_bus_add_devices - start driver for PCI devices
|
||||||
|
@ -279,6 +281,7 @@ void pci_bus_add_devices(const struct pci_bus *bus)
|
||||||
pci_bus_add_devices(child);
|
pci_bus_add_devices(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_bus_add_devices);
|
||||||
|
|
||||||
/** pci_walk_bus - walk devices on/under bus, calling callback.
|
/** pci_walk_bus - walk devices on/under bus, calling callback.
|
||||||
* @top bus whose devices should be walked
|
* @top bus whose devices should be walked
|
||||||
|
@ -344,6 +347,3 @@ void pci_bus_put(struct pci_bus *bus)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(pci_bus_put);
|
EXPORT_SYMBOL(pci_bus_put);
|
||||||
|
|
||||||
EXPORT_SYMBOL(pci_bus_alloc_resource);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_bus_add_device);
|
|
||||||
EXPORT_SYMBOL(pci_bus_add_devices);
|
|
||||||
|
|
|
@ -545,7 +545,6 @@ static int __init add_pcie_port(struct pcie_port *pp,
|
||||||
pp->root_bus_nr = -1;
|
pp->root_bus_nr = -1;
|
||||||
pp->ops = &exynos_pcie_host_ops;
|
pp->ops = &exynos_pcie_host_ops;
|
||||||
|
|
||||||
spin_lock_init(&pp->conf_lock);
|
|
||||||
ret = dw_pcie_host_init(pp);
|
ret = dw_pcie_host_init(pp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to initialize host\n");
|
dev_err(&pdev->dev, "failed to initialize host\n");
|
||||||
|
|
|
@ -507,7 +507,6 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp,
|
||||||
pp->root_bus_nr = -1;
|
pp->root_bus_nr = -1;
|
||||||
pp->ops = &imx6_pcie_host_ops;
|
pp->ops = &imx6_pcie_host_ops;
|
||||||
|
|
||||||
spin_lock_init(&pp->conf_lock);
|
|
||||||
ret = dw_pcie_host_init(pp);
|
ret = dw_pcie_host_init(pp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to initialize host\n");
|
dev_err(&pdev->dev, "failed to initialize host\n");
|
||||||
|
|
|
@ -113,7 +113,6 @@ struct mvebu_pcie {
|
||||||
struct mvebu_pcie_port {
|
struct mvebu_pcie_port {
|
||||||
char *name;
|
char *name;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
spinlock_t conf_lock;
|
|
||||||
u32 port;
|
u32 port;
|
||||||
u32 lane;
|
u32 lane;
|
||||||
int devfn;
|
int devfn;
|
||||||
|
@ -329,9 +328,11 @@ static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port,
|
||||||
ret = mvebu_mbus_add_window_remap_by_id(target, attribute, base,
|
ret = mvebu_mbus_add_window_remap_by_id(target, attribute, base,
|
||||||
sz, remap);
|
sz, remap);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
phys_addr_t end = base + sz - 1;
|
||||||
|
|
||||||
dev_err(&port->pcie->pdev->dev,
|
dev_err(&port->pcie->pdev->dev,
|
||||||
"Could not create MBus window at 0x%x, size 0x%x: %d\n",
|
"Could not create MBus window at [mem %pa-%pa]: %d\n",
|
||||||
base, sz, ret);
|
&base, &end, ret);
|
||||||
mvebu_pcie_del_windows(port, base - size_mapped,
|
mvebu_pcie_del_windows(port, base - size_mapped,
|
||||||
size_mapped);
|
size_mapped);
|
||||||
return;
|
return;
|
||||||
|
@ -613,8 +614,8 @@ static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys)
|
||||||
return sys->private_data;
|
return sys->private_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mvebu_pcie_port *
|
static struct mvebu_pcie_port *mvebu_pcie_find_port(struct mvebu_pcie *pcie,
|
||||||
mvebu_pcie_find_port(struct mvebu_pcie *pcie, struct pci_bus *bus,
|
struct pci_bus *bus,
|
||||||
int devfn)
|
int devfn)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -638,7 +639,6 @@ static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
|
||||||
{
|
{
|
||||||
struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata);
|
struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata);
|
||||||
struct mvebu_pcie_port *port;
|
struct mvebu_pcie_port *port;
|
||||||
unsigned long flags;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
port = mvebu_pcie_find_port(pcie, bus, devfn);
|
port = mvebu_pcie_find_port(pcie, bus, devfn);
|
||||||
|
@ -664,10 +664,8 @@ static int mvebu_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
|
||||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||||
|
|
||||||
/* Access the real PCIe interface */
|
/* Access the real PCIe interface */
|
||||||
spin_lock_irqsave(&port->conf_lock, flags);
|
|
||||||
ret = mvebu_pcie_hw_wr_conf(port, bus, devfn,
|
ret = mvebu_pcie_hw_wr_conf(port, bus, devfn,
|
||||||
where, size, val);
|
where, size, val);
|
||||||
spin_unlock_irqrestore(&port->conf_lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -678,7 +676,6 @@ static int mvebu_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
|
||||||
{
|
{
|
||||||
struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata);
|
struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata);
|
||||||
struct mvebu_pcie_port *port;
|
struct mvebu_pcie_port *port;
|
||||||
unsigned long flags;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
port = mvebu_pcie_find_port(pcie, bus, devfn);
|
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,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Access the real PCIe interface */
|
/* Access the real PCIe interface */
|
||||||
spin_lock_irqsave(&port->conf_lock, flags);
|
|
||||||
ret = mvebu_pcie_hw_rd_conf(port, bus, devfn,
|
ret = mvebu_pcie_hw_rd_conf(port, bus, devfn,
|
||||||
where, size, val);
|
where, size, val);
|
||||||
spin_unlock_irqrestore(&port->conf_lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -839,7 +834,8 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
|
||||||
* found, maps it.
|
* found, maps it.
|
||||||
*/
|
*/
|
||||||
static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
|
static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
|
||||||
struct device_node *np, struct mvebu_pcie_port *port)
|
struct device_node *np,
|
||||||
|
struct mvebu_pcie_port *port)
|
||||||
{
|
{
|
||||||
struct resource regs;
|
struct resource regs;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -1060,7 +1056,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
|
||||||
mvebu_pcie_set_local_dev_nr(port, 1);
|
mvebu_pcie_set_local_dev_nr(port, 1);
|
||||||
|
|
||||||
port->dn = child;
|
port->dn = child;
|
||||||
spin_lock_init(&port->conf_lock);
|
|
||||||
mvebu_sw_pci_bridge_init(port);
|
mvebu_sw_pci_bridge_init(port);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -643,7 +643,6 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
|
||||||
int size, u32 *val)
|
int size, u32 *val)
|
||||||
{
|
{
|
||||||
struct pcie_port *pp = sys_to_pcie(bus->sysdata);
|
struct pcie_port *pp = sys_to_pcie(bus->sysdata);
|
||||||
unsigned long flags;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!pp) {
|
if (!pp) {
|
||||||
|
@ -656,13 +655,11 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
|
||||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&pp->conf_lock, flags);
|
|
||||||
if (bus->number != pp->root_bus_nr)
|
if (bus->number != pp->root_bus_nr)
|
||||||
ret = dw_pcie_rd_other_conf(pp, bus, devfn,
|
ret = dw_pcie_rd_other_conf(pp, bus, devfn,
|
||||||
where, size, val);
|
where, size, val);
|
||||||
else
|
else
|
||||||
ret = dw_pcie_rd_own_conf(pp, where, size, val);
|
ret = dw_pcie_rd_own_conf(pp, where, size, val);
|
||||||
spin_unlock_irqrestore(&pp->conf_lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -671,7 +668,6 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
|
||||||
int where, int size, u32 val)
|
int where, int size, u32 val)
|
||||||
{
|
{
|
||||||
struct pcie_port *pp = sys_to_pcie(bus->sysdata);
|
struct pcie_port *pp = sys_to_pcie(bus->sysdata);
|
||||||
unsigned long flags;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!pp) {
|
if (!pp) {
|
||||||
|
@ -682,13 +678,11 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
|
||||||
if (dw_pcie_valid_config(pp, bus, PCI_SLOT(devfn)) == 0)
|
if (dw_pcie_valid_config(pp, bus, PCI_SLOT(devfn)) == 0)
|
||||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||||
|
|
||||||
spin_lock_irqsave(&pp->conf_lock, flags);
|
|
||||||
if (bus->number != pp->root_bus_nr)
|
if (bus->number != pp->root_bus_nr)
|
||||||
ret = dw_pcie_wr_other_conf(pp, bus, devfn,
|
ret = dw_pcie_wr_other_conf(pp, bus, devfn,
|
||||||
where, size, val);
|
where, size, val);
|
||||||
else
|
else
|
||||||
ret = dw_pcie_wr_own_conf(pp, where, size, val);
|
ret = dw_pcie_wr_own_conf(pp, where, size, val);
|
||||||
spin_unlock_irqrestore(&pp->conf_lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ struct pcie_port {
|
||||||
void __iomem *va_cfg1_base;
|
void __iomem *va_cfg1_base;
|
||||||
u64 io_base;
|
u64 io_base;
|
||||||
u64 mem_base;
|
u64 mem_base;
|
||||||
spinlock_t conf_lock;
|
|
||||||
struct resource cfg;
|
struct resource cfg;
|
||||||
struct resource io;
|
struct resource io;
|
||||||
struct resource mem;
|
struct resource mem;
|
||||||
|
|
|
@ -277,9 +277,8 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
|
||||||
else if (size == 2)
|
else if (size == 2)
|
||||||
*val = (*val >> (8 * (where & 2))) & 0xffff;
|
*val = (*val >> (8 * (where & 2))) & 0xffff;
|
||||||
|
|
||||||
dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x "
|
dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n",
|
||||||
"where=0x%04x size=%d val=0x%08lx\n", bus->number,
|
bus->number, devfn, where, size, (unsigned long)*val);
|
||||||
devfn, where, size, (unsigned long)*val);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -302,9 +301,8 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
|
||||||
if (ret != PCIBIOS_SUCCESSFUL)
|
if (ret != PCIBIOS_SUCCESSFUL)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x "
|
dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n",
|
||||||
"where=0x%04x size=%d val=0x%08lx\n", bus->number,
|
bus->number, devfn, where, size, (unsigned long)val);
|
||||||
devfn, where, size, (unsigned long)val);
|
|
||||||
|
|
||||||
if (size == 1) {
|
if (size == 1) {
|
||||||
shift = 8 * (where & 3);
|
shift = 8 * (where & 3);
|
||||||
|
|
|
@ -63,10 +63,6 @@ MODULE_LICENSE("GPL");
|
||||||
MODULE_PARM_DESC(disable, "disable acpiphp driver");
|
MODULE_PARM_DESC(disable, "disable acpiphp driver");
|
||||||
module_param_named(disable, acpiphp_disabled, bool, 0444);
|
module_param_named(disable, acpiphp_disabled, bool, 0444);
|
||||||
|
|
||||||
/* export the attention callback registration methods */
|
|
||||||
EXPORT_SYMBOL_GPL(acpiphp_register_attention);
|
|
||||||
EXPORT_SYMBOL_GPL(acpiphp_unregister_attention);
|
|
||||||
|
|
||||||
static int enable_slot (struct hotplug_slot *slot);
|
static int enable_slot (struct hotplug_slot *slot);
|
||||||
static int disable_slot (struct hotplug_slot *slot);
|
static int disable_slot (struct hotplug_slot *slot);
|
||||||
static int set_attention_status (struct hotplug_slot *slot, u8 value);
|
static int set_attention_status (struct hotplug_slot *slot, u8 value);
|
||||||
|
@ -104,6 +100,7 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info)
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(acpiphp_register_attention);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,6 +121,7 @@ int acpiphp_unregister_attention(struct acpiphp_attention_info *info)
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(acpiphp_unregister_attention);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -351,11 +351,9 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
|
||||||
slot->slot = NULL;
|
slot->slot = NULL;
|
||||||
bridge->nr_slots--;
|
bridge->nr_slots--;
|
||||||
if (retval == -EBUSY)
|
if (retval == -EBUSY)
|
||||||
pr_warn("Slot %llu already registered by another "
|
pr_warn("Slot %llu already registered by another hotplug driver\n", sun);
|
||||||
"hotplug driver\n", sun);
|
|
||||||
else
|
else
|
||||||
pr_warn("acpiphp_register_hotplug_slot failed "
|
pr_warn("acpiphp_register_hotplug_slot failed (err code = 0x%x)\n", retval);
|
||||||
"(err code = 0x%x)\n", retval);
|
|
||||||
}
|
}
|
||||||
/* Even if the slot registration fails, we can still use it. */
|
/* Even if the slot registration fails, we can still use it. */
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,9 +56,9 @@ struct cpci_hp_controller_ops {
|
||||||
int (*enable_irq) (void);
|
int (*enable_irq) (void);
|
||||||
int (*disable_irq) (void);
|
int (*disable_irq) (void);
|
||||||
int (*check_irq) (void *dev_id);
|
int (*check_irq) (void *dev_id);
|
||||||
int (*hardware_test) (struct slot* slot, u32 value);
|
int (*hardware_test) (struct slot *slot, u32 value);
|
||||||
u8 (*get_power) (struct slot* slot);
|
u8 (*get_power) (struct slot *slot);
|
||||||
int (*set_power) (struct slot* slot, int value);
|
int (*set_power) (struct slot *slot, int value);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cpci_hp_controller {
|
struct cpci_hp_controller {
|
||||||
|
@ -89,13 +89,13 @@ int cpci_hp_stop(void);
|
||||||
u8 cpci_get_attention_status(struct slot *slot);
|
u8 cpci_get_attention_status(struct slot *slot);
|
||||||
u8 cpci_get_latch_status(struct slot *slot);
|
u8 cpci_get_latch_status(struct slot *slot);
|
||||||
u8 cpci_get_adapter_status(struct slot *slot);
|
u8 cpci_get_adapter_status(struct slot *slot);
|
||||||
u16 cpci_get_hs_csr(struct slot * slot);
|
u16 cpci_get_hs_csr(struct slot *slot);
|
||||||
int cpci_set_attention_status(struct slot *slot, int status);
|
int cpci_set_attention_status(struct slot *slot, int status);
|
||||||
int cpci_check_and_clear_ins(struct slot * slot);
|
int cpci_check_and_clear_ins(struct slot *slot);
|
||||||
int cpci_check_ext(struct slot * slot);
|
int cpci_check_ext(struct slot *slot);
|
||||||
int cpci_clear_ext(struct slot * slot);
|
int cpci_clear_ext(struct slot *slot);
|
||||||
int cpci_led_on(struct slot * slot);
|
int cpci_led_on(struct slot *slot);
|
||||||
int cpci_led_off(struct slot * slot);
|
int cpci_led_off(struct slot *slot);
|
||||||
int cpci_configure_slot(struct slot *slot);
|
int cpci_configure_slot(struct slot *slot);
|
||||||
int cpci_unconfigure_slot(struct slot *slot);
|
int cpci_unconfigure_slot(struct slot *slot);
|
||||||
|
|
||||||
|
|
|
@ -65,10 +65,10 @@ static int thread_finished;
|
||||||
static int enable_slot(struct hotplug_slot *slot);
|
static int enable_slot(struct hotplug_slot *slot);
|
||||||
static int disable_slot(struct hotplug_slot *slot);
|
static int disable_slot(struct hotplug_slot *slot);
|
||||||
static int set_attention_status(struct hotplug_slot *slot, u8 value);
|
static int set_attention_status(struct hotplug_slot *slot, u8 value);
|
||||||
static int get_power_status(struct hotplug_slot *slot, u8 * value);
|
static int get_power_status(struct hotplug_slot *slot, u8 *value);
|
||||||
static int get_attention_status(struct hotplug_slot *slot, u8 * value);
|
static int get_attention_status(struct hotplug_slot *slot, u8 *value);
|
||||||
static int get_adapter_status(struct hotplug_slot *slot, u8 * value);
|
static int get_adapter_status(struct hotplug_slot *slot, u8 *value);
|
||||||
static int get_latch_status(struct hotplug_slot *slot, u8 * value);
|
static int get_latch_status(struct hotplug_slot *slot, u8 *value);
|
||||||
|
|
||||||
static struct hotplug_slot_ops cpci_hotplug_slot_ops = {
|
static struct hotplug_slot_ops cpci_hotplug_slot_ops = {
|
||||||
.enable_slot = enable_slot,
|
.enable_slot = enable_slot,
|
||||||
|
@ -168,7 +168,7 @@ cpci_get_power_status(struct slot *slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
struct slot *slot = hotplug_slot->private;
|
struct slot *slot = hotplug_slot->private;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
struct slot *slot = hotplug_slot->private;
|
struct slot *slot = hotplug_slot->private;
|
||||||
|
|
||||||
|
@ -192,14 +192,14 @@ set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
*value = hotplug_slot->info->adapter_status;
|
*value = hotplug_slot->info->adapter_status;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
*value = hotplug_slot->info->latch_status;
|
*value = hotplug_slot->info->latch_status;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -299,6 +299,7 @@ error_slot:
|
||||||
error:
|
error:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cpci_hp_register_bus);
|
||||||
|
|
||||||
int
|
int
|
||||||
cpci_hp_unregister_bus(struct pci_bus *bus)
|
cpci_hp_unregister_bus(struct pci_bus *bus)
|
||||||
|
@ -329,6 +330,7 @@ cpci_hp_unregister_bus(struct pci_bus *bus)
|
||||||
up_write(&list_rwsem);
|
up_write(&list_rwsem);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus);
|
||||||
|
|
||||||
/* This is the interrupt mode interrupt handler */
|
/* This is the interrupt mode interrupt handler */
|
||||||
static irqreturn_t
|
static irqreturn_t
|
||||||
|
@ -360,7 +362,7 @@ static int
|
||||||
init_slots(int clear_ins)
|
init_slots(int clear_ins)
|
||||||
{
|
{
|
||||||
struct slot *slot;
|
struct slot *slot;
|
||||||
struct pci_dev* dev;
|
struct pci_dev *dev;
|
||||||
|
|
||||||
dbg("%s - enter", __func__);
|
dbg("%s - enter", __func__);
|
||||||
down_read(&list_rwsem);
|
down_read(&list_rwsem);
|
||||||
|
@ -614,6 +616,7 @@ cpci_hp_register_controller(struct cpci_hp_controller *new_controller)
|
||||||
controller = new_controller;
|
controller = new_controller;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cleanup_slots(void)
|
cleanup_slots(void)
|
||||||
|
@ -653,6 +656,7 @@ cpci_hp_unregister_controller(struct cpci_hp_controller *old_controller)
|
||||||
status = -ENODEV;
|
status = -ENODEV;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
|
||||||
|
|
||||||
int
|
int
|
||||||
cpci_hp_start(void)
|
cpci_hp_start(void)
|
||||||
|
@ -690,6 +694,7 @@ cpci_hp_start(void)
|
||||||
dbg("%s - exit", __func__);
|
dbg("%s - exit", __func__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cpci_hp_start);
|
||||||
|
|
||||||
int
|
int
|
||||||
cpci_hp_stop(void)
|
cpci_hp_stop(void)
|
||||||
|
@ -704,6 +709,7 @@ cpci_hp_stop(void)
|
||||||
cpci_stop_thread();
|
cpci_stop_thread();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cpci_hp_stop);
|
||||||
|
|
||||||
int __init
|
int __init
|
||||||
cpci_hotplug_init(int debug)
|
cpci_hotplug_init(int debug)
|
||||||
|
@ -721,10 +727,3 @@ cpci_hotplug_exit(void)
|
||||||
cpci_hp_stop();
|
cpci_hp_stop();
|
||||||
cpci_hp_unregister_controller(controller);
|
cpci_hp_unregister_controller(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
|
|
||||||
EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
|
|
||||||
EXPORT_SYMBOL_GPL(cpci_hp_register_bus);
|
|
||||||
EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus);
|
|
||||||
EXPORT_SYMBOL_GPL(cpci_hp_start);
|
|
||||||
EXPORT_SYMBOL_GPL(cpci_hp_stop);
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ extern int cpci_debug;
|
||||||
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
|
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
|
||||||
|
|
||||||
|
|
||||||
u8 cpci_get_attention_status(struct slot* slot)
|
u8 cpci_get_attention_status(struct slot *slot)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -66,7 +66,7 @@ u8 cpci_get_attention_status(struct slot* slot)
|
||||||
return hs_csr & 0x0008 ? 1 : 0;
|
return hs_csr & 0x0008 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpci_set_attention_status(struct slot* slot, int status)
|
int cpci_set_attention_status(struct slot *slot, int status)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -93,7 +93,7 @@ int cpci_set_attention_status(struct slot* slot, int status)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 cpci_get_hs_csr(struct slot* slot)
|
u16 cpci_get_hs_csr(struct slot *slot)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -111,7 +111,7 @@ u16 cpci_get_hs_csr(struct slot* slot)
|
||||||
return hs_csr;
|
return hs_csr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpci_check_and_clear_ins(struct slot* slot)
|
int cpci_check_and_clear_ins(struct slot *slot)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -140,7 +140,7 @@ int cpci_check_and_clear_ins(struct slot* slot)
|
||||||
return ins;
|
return ins;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpci_check_ext(struct slot* slot)
|
int cpci_check_ext(struct slot *slot)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -161,7 +161,7 @@ int cpci_check_ext(struct slot* slot)
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpci_clear_ext(struct slot* slot)
|
int cpci_clear_ext(struct slot *slot)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -187,7 +187,7 @@ int cpci_clear_ext(struct slot* slot)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpci_led_on(struct slot* slot)
|
int cpci_led_on(struct slot *slot)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -216,7 +216,7 @@ int cpci_led_on(struct slot* slot)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpci_led_off(struct slot* slot)
|
int cpci_led_off(struct slot *slot)
|
||||||
{
|
{
|
||||||
int hs_cap;
|
int hs_cap;
|
||||||
u16 hs_csr;
|
u16 hs_csr;
|
||||||
|
@ -303,7 +303,7 @@ int cpci_configure_slot(struct slot *slot)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpci_unconfigure_slot(struct slot* slot)
|
int cpci_unconfigure_slot(struct slot *slot)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev, *temp;
|
struct pci_dev *dev, *temp;
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ static struct cpci_hp_controller generic_hpc;
|
||||||
|
|
||||||
static int __init validate_parameters(void)
|
static int __init validate_parameters(void)
|
||||||
{
|
{
|
||||||
char* str;
|
char *str;
|
||||||
char* p;
|
char *p;
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
|
|
||||||
if(!bridge) {
|
if(!bridge) {
|
||||||
|
@ -142,8 +142,8 @@ static int query_enum(void)
|
||||||
static int __init cpcihp_generic_init(void)
|
static int __init cpcihp_generic_init(void)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
struct resource* r;
|
struct resource *r;
|
||||||
struct pci_dev* dev;
|
struct pci_dev *dev;
|
||||||
|
|
||||||
info(DRIVER_DESC " version: " DRIVER_VERSION);
|
info(DRIVER_DESC " version: " DRIVER_VERSION);
|
||||||
status = validate_parameters();
|
status = validate_parameters();
|
||||||
|
|
|
@ -295,7 +295,7 @@ static struct pci_driver zt5550_hc_driver = {
|
||||||
|
|
||||||
static int __init zt5550_init(void)
|
static int __init zt5550_init(void)
|
||||||
{
|
{
|
||||||
struct resource* r;
|
struct resource *r;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
info(DRIVER_DESC " version: " DRIVER_VERSION);
|
info(DRIVER_DESC " version: " DRIVER_VERSION);
|
||||||
|
|
|
@ -255,7 +255,7 @@ struct pci_func {
|
||||||
struct pci_resource *io_head;
|
struct pci_resource *io_head;
|
||||||
struct pci_resource *bus_head;
|
struct pci_resource *bus_head;
|
||||||
struct timer_list *p_task_event;
|
struct timer_list *p_task_event;
|
||||||
struct pci_dev* pci_dev;
|
struct pci_dev *pci_dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct slot {
|
struct slot {
|
||||||
|
@ -278,7 +278,7 @@ struct slot {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pci_resource {
|
struct pci_resource {
|
||||||
struct pci_resource * next;
|
struct pci_resource *next;
|
||||||
u32 base;
|
u32 base;
|
||||||
u32 length;
|
u32 length;
|
||||||
};
|
};
|
||||||
|
|
|
@ -94,7 +94,7 @@ static inline int is_slot66mhz(struct slot *slot)
|
||||||
*
|
*
|
||||||
* Returns pointer to the head of the SMBIOS tables (or %NULL).
|
* Returns pointer to the head of the SMBIOS tables (or %NULL).
|
||||||
*/
|
*/
|
||||||
static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end)
|
static void __iomem *detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end)
|
||||||
{
|
{
|
||||||
void __iomem *fp;
|
void __iomem *fp;
|
||||||
void __iomem *endp;
|
void __iomem *endp;
|
||||||
|
@ -131,7 +131,7 @@ static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *e
|
||||||
*
|
*
|
||||||
* For unexpected switch opens
|
* For unexpected switch opens
|
||||||
*/
|
*/
|
||||||
static int init_SERR(struct controller * ctrl)
|
static int init_SERR(struct controller *ctrl)
|
||||||
{
|
{
|
||||||
u32 tempdword;
|
u32 tempdword;
|
||||||
u32 number_of_slots;
|
u32 number_of_slots;
|
||||||
|
@ -291,7 +291,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
|
||||||
kfree(slot);
|
kfree(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ctrl_slot_cleanup (struct controller * ctrl)
|
static int ctrl_slot_cleanup (struct controller *ctrl)
|
||||||
{
|
{
|
||||||
struct slot *old_slot, *next_slot;
|
struct slot *old_slot, *next_slot;
|
||||||
|
|
||||||
|
@ -706,8 +706,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
|
||||||
hotplug_slot_info->adapter_status =
|
hotplug_slot_info->adapter_status =
|
||||||
get_presence_status(ctrl, slot);
|
get_presence_status(ctrl, slot);
|
||||||
|
|
||||||
dbg("registering bus %d, dev %d, number %d, "
|
dbg("registering bus %d, dev %d, number %d, ctrl->slot_device_offset %d, slot %d\n",
|
||||||
"ctrl->slot_device_offset %d, slot %d\n",
|
|
||||||
slot->bus, slot->device,
|
slot->bus, slot->device,
|
||||||
slot->number, ctrl->slot_device_offset,
|
slot->number, ctrl->slot_device_offset,
|
||||||
slot_number);
|
slot_number);
|
||||||
|
@ -837,8 +836,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
|
|
||||||
bus = pdev->subordinate;
|
bus = pdev->subordinate;
|
||||||
if (!bus) {
|
if (!bus) {
|
||||||
dev_notice(&pdev->dev, "the device is not a bridge, "
|
dev_notice(&pdev->dev, "the device is not a bridge, skipping\n");
|
||||||
"skipping\n");
|
|
||||||
rc = -ENODEV;
|
rc = -ENODEV;
|
||||||
goto err_disable_device;
|
goto err_disable_device;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include "cpqphp.h"
|
#include "cpqphp.h"
|
||||||
|
|
||||||
static u32 configure_new_device(struct controller* ctrl, struct pci_func *func,
|
static u32 configure_new_device(struct controller *ctrl, struct pci_func *func,
|
||||||
u8 behind_bridge, struct resource_lists *resources);
|
u8 behind_bridge, struct resource_lists *resources);
|
||||||
static int configure_new_function(struct controller* ctrl, struct pci_func *func,
|
static int configure_new_function(struct controller *ctrl, struct pci_func *func,
|
||||||
u8 behind_bridge, struct resource_lists *resources);
|
u8 behind_bridge, struct resource_lists *resources);
|
||||||
static void interrupt_event_handler(struct controller *ctrl);
|
static void interrupt_event_handler(struct controller *ctrl);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ static void long_delay(int delay)
|
||||||
|
|
||||||
/* FIXME: The following line needs to be somewhere else... */
|
/* FIXME: The following line needs to be somewhere else... */
|
||||||
#define WRONG_BUS_FREQUENCY 0x07
|
#define WRONG_BUS_FREQUENCY 0x07
|
||||||
static u8 handle_switch_change(u8 change, struct controller * ctrl)
|
static u8 handle_switch_change(u8 change, struct controller *ctrl)
|
||||||
{
|
{
|
||||||
int hp_slot;
|
int hp_slot;
|
||||||
u8 rc = 0;
|
u8 rc = 0;
|
||||||
|
@ -138,7 +138,7 @@ static struct slot *cpqhp_find_slot(struct controller *ctrl, u8 device)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static u8 handle_presence_change(u16 change, struct controller * ctrl)
|
static u8 handle_presence_change(u16 change, struct controller *ctrl)
|
||||||
{
|
{
|
||||||
int hp_slot;
|
int hp_slot;
|
||||||
u8 rc = 0;
|
u8 rc = 0;
|
||||||
|
@ -232,7 +232,7 @@ static u8 handle_presence_change(u16 change, struct controller * ctrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static u8 handle_power_fault(u8 change, struct controller * ctrl)
|
static u8 handle_power_fault(u8 change, struct controller *ctrl)
|
||||||
{
|
{
|
||||||
int hp_slot;
|
int hp_slot;
|
||||||
u8 rc = 0;
|
u8 rc = 0;
|
||||||
|
@ -997,7 +997,7 @@ struct pci_func *cpqhp_slot_create(u8 busnumber)
|
||||||
*
|
*
|
||||||
* Returns %0 if successful, !0 otherwise.
|
* Returns %0 if successful, !0 otherwise.
|
||||||
*/
|
*/
|
||||||
static int slot_remove(struct pci_func * old_slot)
|
static int slot_remove(struct pci_func *old_slot)
|
||||||
{
|
{
|
||||||
struct pci_func *next;
|
struct pci_func *next;
|
||||||
|
|
||||||
|
@ -1109,7 +1109,7 @@ struct pci_func *cpqhp_slot_find(u8 bus, u8 device, u8 index)
|
||||||
|
|
||||||
/* DJZ: I don't think is_bridge will work as is.
|
/* DJZ: I don't think is_bridge will work as is.
|
||||||
* FIXME */
|
* FIXME */
|
||||||
static int is_bridge(struct pci_func * func)
|
static int is_bridge(struct pci_func *func)
|
||||||
{
|
{
|
||||||
/* Check the header type */
|
/* Check the header type */
|
||||||
if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01)
|
if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01)
|
||||||
|
@ -1625,7 +1625,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
|
||||||
* @replace_flag: whether replacing or adding a new device
|
* @replace_flag: whether replacing or adding a new device
|
||||||
* @ctrl: target controller
|
* @ctrl: target controller
|
||||||
*/
|
*/
|
||||||
static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl)
|
static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controller *ctrl)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
u8 skip = 0;
|
u8 skip = 0;
|
||||||
|
@ -1742,7 +1742,7 @@ static void pushbutton_helper_thread(unsigned long data)
|
||||||
|
|
||||||
|
|
||||||
/* this is the main worker thread */
|
/* this is the main worker thread */
|
||||||
static int event_thread(void* data)
|
static int event_thread(void *data)
|
||||||
{
|
{
|
||||||
struct controller *ctrl;
|
struct controller *ctrl;
|
||||||
|
|
||||||
|
@ -1992,7 +1992,7 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func)
|
||||||
u16 temp_word;
|
u16 temp_word;
|
||||||
u32 tempdword;
|
u32 tempdword;
|
||||||
int rc;
|
int rc;
|
||||||
struct slot* p_slot;
|
struct slot *p_slot;
|
||||||
int physical_slot = 0;
|
int physical_slot = 0;
|
||||||
|
|
||||||
tempdword = 0;
|
tempdword = 0;
|
||||||
|
@ -2088,7 +2088,7 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
|
||||||
u8 replace_flag;
|
u8 replace_flag;
|
||||||
u32 rc = 0;
|
u32 rc = 0;
|
||||||
unsigned int devfn;
|
unsigned int devfn;
|
||||||
struct slot* p_slot;
|
struct slot *p_slot;
|
||||||
struct pci_bus *pci_bus = ctrl->pci_bus;
|
struct pci_bus *pci_bus = ctrl->pci_bus;
|
||||||
int physical_slot=0;
|
int physical_slot=0;
|
||||||
|
|
||||||
|
@ -2270,8 +2270,8 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num)
|
||||||
*
|
*
|
||||||
* Returns 0 if success.
|
* Returns 0 if success.
|
||||||
*/
|
*/
|
||||||
static u32 configure_new_device(struct controller * ctrl, struct pci_func * func,
|
static u32 configure_new_device(struct controller *ctrl, struct pci_func *func,
|
||||||
u8 behind_bridge, struct resource_lists * resources)
|
u8 behind_bridge, struct resource_lists *resources)
|
||||||
{
|
{
|
||||||
u8 temp_byte, function, max_functions, stop_it;
|
u8 temp_byte, function, max_functions, stop_it;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
|
@ -107,7 +107,7 @@ static spinlock_t int15_lock;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static u32 add_byte( u32 **p_buffer, u8 value, u32 *used, u32 *avail)
|
static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail)
|
||||||
{
|
{
|
||||||
u8 **tByte;
|
u8 **tByte;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ static u32 add_byte( u32 **p_buffer, u8 value, u32 *used, u32 *avail)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static u32 add_dword( u32 **p_buffer, u32 value, u32 *used, u32 *avail)
|
static u32 add_dword(u32 **p_buffer, u32 value, u32 *used, u32 *avail)
|
||||||
{
|
{
|
||||||
if ((*used + 4) > *avail)
|
if ((*used + 4) > *avail)
|
||||||
return(1);
|
return(1);
|
||||||
|
@ -267,12 +267,12 @@ static u32 store_HRT (void __iomem *rom_start)
|
||||||
ctrl = cpqhp_ctrl_list;
|
ctrl = cpqhp_ctrl_list;
|
||||||
|
|
||||||
/* The revision of this structure */
|
/* The revision of this structure */
|
||||||
rc = add_byte( &pFill, 1 + ctrl->push_flag, &usedbytes, &available);
|
rc = add_byte(&pFill, 1 + ctrl->push_flag, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* The number of controllers */
|
/* The number of controllers */
|
||||||
rc = add_byte( &pFill, 1, &usedbytes, &available);
|
rc = add_byte(&pFill, 1, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
|
@ -282,22 +282,22 @@ static u32 store_HRT (void __iomem *rom_start)
|
||||||
numCtrl++;
|
numCtrl++;
|
||||||
|
|
||||||
/* The bus number */
|
/* The bus number */
|
||||||
rc = add_byte( &pFill, ctrl->bus, &usedbytes, &available);
|
rc = add_byte(&pFill, ctrl->bus, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* The device Number */
|
/* The device Number */
|
||||||
rc = add_byte( &pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available);
|
rc = add_byte(&pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* The function Number */
|
/* The function Number */
|
||||||
rc = add_byte( &pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available);
|
rc = add_byte(&pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* Skip the number of available entries */
|
/* Skip the number of available entries */
|
||||||
rc = add_dword( &pFill, 0, &usedbytes, &available);
|
rc = add_dword(&pFill, 0, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
|
@ -311,12 +311,12 @@ static u32 store_HRT (void __iomem *rom_start)
|
||||||
loop ++;
|
loop ++;
|
||||||
|
|
||||||
/* base */
|
/* base */
|
||||||
rc = add_dword( &pFill, resNode->base, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* length */
|
/* length */
|
||||||
rc = add_dword( &pFill, resNode->length, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
|
@ -336,12 +336,12 @@ static u32 store_HRT (void __iomem *rom_start)
|
||||||
loop ++;
|
loop ++;
|
||||||
|
|
||||||
/* base */
|
/* base */
|
||||||
rc = add_dword( &pFill, resNode->base, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* length */
|
/* length */
|
||||||
rc = add_dword( &pFill, resNode->length, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
|
@ -361,12 +361,12 @@ static u32 store_HRT (void __iomem *rom_start)
|
||||||
loop ++;
|
loop ++;
|
||||||
|
|
||||||
/* base */
|
/* base */
|
||||||
rc = add_dword( &pFill, resNode->base, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* length */
|
/* length */
|
||||||
rc = add_dword( &pFill, resNode->length, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
|
@ -386,12 +386,12 @@ static u32 store_HRT (void __iomem *rom_start)
|
||||||
loop ++;
|
loop ++;
|
||||||
|
|
||||||
/* base */
|
/* base */
|
||||||
rc = add_dword( &pFill, resNode->base, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->base, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
/* length */
|
/* length */
|
||||||
rc = add_dword( &pFill, resNode->length, &usedbytes, &available);
|
rc = add_dword(&pFill, resNode->length, &usedbytes, &available);
|
||||||
if (rc)
|
if (rc)
|
||||||
return(rc);
|
return(rc);
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ static void __iomem *detect_HRT_floating_pointer(void __iomem *begin, void __iom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
|
int cpqhp_configure_device (struct controller *ctrl, struct pci_func *func)
|
||||||
{
|
{
|
||||||
struct pci_bus *child;
|
struct pci_bus *child;
|
||||||
int num;
|
int num;
|
||||||
|
@ -121,7 +121,7 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int cpqhp_unconfigure_device(struct pci_func* func)
|
int cpqhp_unconfigure_device(struct pci_func *func)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ int cpqhp_unconfigure_device(struct pci_func* func)
|
||||||
|
|
||||||
pci_lock_rescan_remove();
|
pci_lock_rescan_remove();
|
||||||
for (j=0; j<8 ; j++) {
|
for (j=0; j<8 ; j++) {
|
||||||
struct pci_dev* temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j));
|
struct pci_dev *temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j));
|
||||||
if (temp) {
|
if (temp) {
|
||||||
pci_dev_put(temp);
|
pci_dev_put(temp);
|
||||||
pci_stop_and_remove_bus_device(temp);
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 * dev_num)
|
static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 *dev_num)
|
||||||
{
|
{
|
||||||
u16 tdevice;
|
u16 tdevice;
|
||||||
u32 work;
|
u32 work;
|
||||||
|
@ -280,7 +280,7 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int cpqhp_get_bus_dev (struct controller *ctrl, u8 * bus_num, u8 * dev_num, u8 slot)
|
int cpqhp_get_bus_dev (struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot)
|
||||||
{
|
{
|
||||||
/* plain (bridges allowed) */
|
/* plain (bridges allowed) */
|
||||||
return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0);
|
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)
|
||||||
*
|
*
|
||||||
* returns 0 if success
|
* returns 0 if success
|
||||||
*/
|
*/
|
||||||
int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot)
|
int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot)
|
||||||
{
|
{
|
||||||
long rc;
|
long rc;
|
||||||
u8 class_code;
|
u8 class_code;
|
||||||
|
@ -549,7 +549,7 @@ int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot)
|
||||||
*
|
*
|
||||||
* returns 0 if success
|
* returns 0 if success
|
||||||
*/
|
*/
|
||||||
int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func * func)
|
int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func)
|
||||||
{
|
{
|
||||||
u8 cloop;
|
u8 cloop;
|
||||||
u8 header_type;
|
u8 header_type;
|
||||||
|
@ -686,7 +686,7 @@ int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func * func)
|
||||||
*
|
*
|
||||||
* returns 0 if success
|
* returns 0 if success
|
||||||
*/
|
*/
|
||||||
int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func * func)
|
int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func *func)
|
||||||
{
|
{
|
||||||
u8 cloop;
|
u8 cloop;
|
||||||
u8 header_type;
|
u8 header_type;
|
||||||
|
@ -949,7 +949,7 @@ int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func * func)
|
||||||
*
|
*
|
||||||
* returns 0 if success
|
* returns 0 if success
|
||||||
*/
|
*/
|
||||||
int cpqhp_configure_board(struct controller *ctrl, struct pci_func * func)
|
int cpqhp_configure_board(struct controller *ctrl, struct pci_func *func)
|
||||||
{
|
{
|
||||||
int cloop;
|
int cloop;
|
||||||
u8 header_type;
|
u8 header_type;
|
||||||
|
@ -1027,7 +1027,7 @@ int cpqhp_configure_board(struct controller *ctrl, struct pci_func * func)
|
||||||
*
|
*
|
||||||
* returns 0 if the board is the same nonzero otherwise
|
* returns 0 if the board is the same nonzero otherwise
|
||||||
*/
|
*/
|
||||||
int cpqhp_valid_replace(struct controller *ctrl, struct pci_func * func)
|
int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func)
|
||||||
{
|
{
|
||||||
u8 cloop;
|
u8 cloop;
|
||||||
u8 header_type;
|
u8 header_type;
|
||||||
|
@ -1419,7 +1419,7 @@ int cpqhp_find_available_resources(struct controller *ctrl, void __iomem *rom_st
|
||||||
*
|
*
|
||||||
* returns 0 if success
|
* returns 0 if success
|
||||||
*/
|
*/
|
||||||
int cpqhp_return_board_resources(struct pci_func * func, struct resource_lists * resources)
|
int cpqhp_return_board_resources(struct pci_func *func, struct resource_lists *resources)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct pci_resource *node;
|
struct pci_resource *node;
|
||||||
|
@ -1475,7 +1475,7 @@ int cpqhp_return_board_resources(struct pci_func * func, struct resource_lists *
|
||||||
*
|
*
|
||||||
* Puts node back in the resource list pointed to by head
|
* Puts node back in the resource list pointed to by head
|
||||||
*/
|
*/
|
||||||
void cpqhp_destroy_resource_list (struct resource_lists * resources)
|
void cpqhp_destroy_resource_list (struct resource_lists *resources)
|
||||||
{
|
{
|
||||||
struct pci_resource *res, *tres;
|
struct pci_resource *res, *tres;
|
||||||
|
|
||||||
|
@ -1522,7 +1522,7 @@ void cpqhp_destroy_resource_list (struct resource_lists * resources)
|
||||||
*
|
*
|
||||||
* Puts node back in the resource list pointed to by head
|
* Puts node back in the resource list pointed to by head
|
||||||
*/
|
*/
|
||||||
void cpqhp_destroy_board_resources (struct pci_func * func)
|
void cpqhp_destroy_board_resources (struct pci_func *func)
|
||||||
{
|
{
|
||||||
struct pci_resource *res, *tres;
|
struct pci_resource *res, *tres;
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ static int show_ctrl (struct controller *ctrl, char *buf)
|
||||||
|
|
||||||
static int show_dev (struct controller *ctrl, char *buf)
|
static int show_dev (struct controller *ctrl, char *buf)
|
||||||
{
|
{
|
||||||
char * out = buf;
|
char *out = buf;
|
||||||
int index;
|
int index;
|
||||||
struct pci_resource *res;
|
struct pci_resource *res;
|
||||||
struct pci_func *new_slot;
|
struct pci_func *new_slot;
|
||||||
|
|
|
@ -74,7 +74,7 @@ static inline int get_max_adapter_speed (struct hotplug_slot *hs, u8 *value)
|
||||||
static inline int get_cur_bus_info(struct slot **sl)
|
static inline int get_cur_bus_info(struct slot **sl)
|
||||||
{
|
{
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
struct slot * slot_cur = *sl;
|
struct slot *slot_cur = *sl;
|
||||||
|
|
||||||
debug("options = %x\n", slot_cur->ctrl->options);
|
debug("options = %x\n", slot_cur->ctrl->options);
|
||||||
debug("revision = %x\n", slot_cur->ctrl->revision);
|
debug("revision = %x\n", slot_cur->ctrl->revision);
|
||||||
|
@ -114,8 +114,8 @@ static inline int slot_update(struct slot **sl)
|
||||||
|
|
||||||
static int __init get_max_slots (void)
|
static int __init get_max_slots (void)
|
||||||
{
|
{
|
||||||
struct slot * slot_cur;
|
struct slot *slot_cur;
|
||||||
struct list_head * tmp;
|
struct list_head *tmp;
|
||||||
u8 slot_count = 0;
|
u8 slot_count = 0;
|
||||||
|
|
||||||
list_for_each(tmp, &ibmphp_slot_head) {
|
list_for_each(tmp, &ibmphp_slot_head) {
|
||||||
|
@ -280,7 +280,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
int rc = -ENODEV;
|
int rc = -ENODEV;
|
||||||
struct slot *pslot;
|
struct slot *pslot;
|
||||||
|
@ -311,7 +311,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
int rc = -ENODEV;
|
int rc = -ENODEV;
|
||||||
struct slot *pslot;
|
struct slot *pslot;
|
||||||
|
@ -338,7 +338,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
int rc = -ENODEV;
|
int rc = -ENODEV;
|
||||||
struct slot *pslot;
|
struct slot *pslot;
|
||||||
|
@ -364,7 +364,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 * value)
|
static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
int rc = -ENODEV;
|
int rc = -ENODEV;
|
||||||
struct slot *pslot;
|
struct slot *pslot;
|
||||||
|
@ -433,7 +433,7 @@ static int get_max_bus_speed(struct slot *slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 * value, u8 flag)
|
static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 *value, u8 flag)
|
||||||
{
|
{
|
||||||
int rc = -ENODEV;
|
int rc = -ENODEV;
|
||||||
struct slot *pslot;
|
struct slot *pslot;
|
||||||
|
@ -471,7 +471,7 @@ static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 * value
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_bus_name(struct hotplug_slot *hotplug_slot, char * value)
|
static int get_bus_name(struct hotplug_slot *hotplug_slot, char *value)
|
||||||
{
|
{
|
||||||
int rc = -ENODEV;
|
int rc = -ENODEV;
|
||||||
struct slot *pslot = NULL;
|
struct slot *pslot = NULL;
|
||||||
|
@ -671,7 +671,7 @@ static struct pci_func *ibm_slot_find(u8 busno, u8 device, u8 function)
|
||||||
{
|
{
|
||||||
struct pci_func *func_cur;
|
struct pci_func *func_cur;
|
||||||
struct slot *slot_cur;
|
struct slot *slot_cur;
|
||||||
struct list_head * tmp;
|
struct list_head *tmp;
|
||||||
list_for_each(tmp, &ibmphp_slot_head) {
|
list_for_each(tmp, &ibmphp_slot_head) {
|
||||||
slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
|
slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
|
||||||
if (slot_cur->func) {
|
if (slot_cur->func) {
|
||||||
|
@ -696,8 +696,8 @@ static struct pci_func *ibm_slot_find(u8 busno, u8 device, u8 function)
|
||||||
static void free_slots(void)
|
static void free_slots(void)
|
||||||
{
|
{
|
||||||
struct slot *slot_cur;
|
struct slot *slot_cur;
|
||||||
struct list_head * tmp;
|
struct list_head *tmp;
|
||||||
struct list_head * next;
|
struct list_head *next;
|
||||||
|
|
||||||
debug("%s -- enter\n", __func__);
|
debug("%s -- enter\n", __func__);
|
||||||
|
|
||||||
|
@ -825,10 +825,10 @@ static int ibm_configure_device(struct pci_func *func)
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
* Returns whether the bus is empty or not
|
* Returns whether the bus is empty or not
|
||||||
*******************************************************/
|
*******************************************************/
|
||||||
static int is_bus_empty(struct slot * slot_cur)
|
static int is_bus_empty(struct slot *slot_cur)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct slot * tmp_slot;
|
struct slot *tmp_slot;
|
||||||
u8 i = slot_cur->bus_on->slot_min;
|
u8 i = slot_cur->bus_on->slot_min;
|
||||||
|
|
||||||
while (i <= slot_cur->bus_on->slot_max) {
|
while (i <= slot_cur->bus_on->slot_max) {
|
||||||
|
@ -856,7 +856,7 @@ static int is_bus_empty(struct slot * slot_cur)
|
||||||
* Parameters: slot
|
* Parameters: slot
|
||||||
* Returns: bus is set (0) or error code
|
* Returns: bus is set (0) or error code
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
static int set_bus(struct slot * slot_cur)
|
static int set_bus(struct slot *slot_cur)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
u8 speed;
|
u8 speed;
|
||||||
|
@ -956,7 +956,7 @@ static int set_bus(struct slot * slot_cur)
|
||||||
static int check_limitations(struct slot *slot_cur)
|
static int check_limitations(struct slot *slot_cur)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
struct slot * tmp_slot;
|
struct slot *tmp_slot;
|
||||||
u8 count = 0;
|
u8 count = 0;
|
||||||
u8 limitation = 0;
|
u8 limitation = 0;
|
||||||
|
|
||||||
|
@ -1045,8 +1045,7 @@ static int enable_slot(struct hotplug_slot *hs)
|
||||||
rc = check_limitations(slot_cur);
|
rc = check_limitations(slot_cur);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
err("Adding this card exceeds the limitations of this bus.\n");
|
err("Adding this card exceeds the limitations of this bus.\n");
|
||||||
err("(i.e., >1 133MHz cards running on same bus, or "
|
err("(i.e., >1 133MHz cards running on same bus, or >2 66 PCI cards running on same bus.\n");
|
||||||
">2 66 PCI cards running on same bus.\n");
|
|
||||||
err("Try hot-adding into another bus\n");
|
err("Try hot-adding into another bus\n");
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto error_nopower;
|
goto error_nopower;
|
||||||
|
@ -1070,12 +1069,10 @@ static int enable_slot(struct hotplug_slot *hs)
|
||||||
!(SLOT_PWRGD(slot_cur->status)))
|
!(SLOT_PWRGD(slot_cur->status)))
|
||||||
err("power fault occurred trying to power up\n");
|
err("power fault occurred trying to power up\n");
|
||||||
else if (SLOT_BUS_SPEED(slot_cur->status)) {
|
else if (SLOT_BUS_SPEED(slot_cur->status)) {
|
||||||
err("bus speed mismatch occurred. please check "
|
err("bus speed mismatch occurred. please check current bus speed and card capability\n");
|
||||||
"current bus speed and card capability\n");
|
|
||||||
print_card_capability(slot_cur);
|
print_card_capability(slot_cur);
|
||||||
} else if (SLOT_BUS_MODE(slot_cur->ext_status)) {
|
} else if (SLOT_BUS_MODE(slot_cur->ext_status)) {
|
||||||
err("bus mode mismatch occurred. please check "
|
err("bus mode mismatch occurred. please check current bus mode and card capability\n");
|
||||||
"current bus mode and card capability\n");
|
|
||||||
print_card_capability(slot_cur);
|
print_card_capability(slot_cur);
|
||||||
}
|
}
|
||||||
ibmphp_update_slot_info(slot_cur);
|
ibmphp_update_slot_info(slot_cur);
|
||||||
|
@ -1098,8 +1095,7 @@ static int enable_slot(struct hotplug_slot *hs)
|
||||||
goto error_power;
|
goto error_power;
|
||||||
}
|
}
|
||||||
if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) {
|
if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) {
|
||||||
err("bus speed mismatch occurred. please check current bus "
|
err("bus speed mismatch occurred. please check current bus speed and card capability\n");
|
||||||
"speed and card capability\n");
|
|
||||||
print_card_capability(slot_cur);
|
print_card_capability(slot_cur);
|
||||||
goto error_power;
|
goto error_power;
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,7 +563,7 @@ static int first_slot_num (u8 slot_num, u8 first_slot, u8 var)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct opt_rio_lo * find_rxe_num (u8 slot_num)
|
static struct opt_rio_lo *find_rxe_num (u8 slot_num)
|
||||||
{
|
{
|
||||||
struct opt_rio_lo *opt_lo_ptr;
|
struct opt_rio_lo *opt_lo_ptr;
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ static struct opt_rio_lo * find_rxe_num (u8 slot_num)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct opt_rio * find_chassis_num (u8 slot_num)
|
static struct opt_rio *find_chassis_num (u8 slot_num)
|
||||||
{
|
{
|
||||||
struct opt_rio *opt_vg_ptr;
|
struct opt_rio *opt_vg_ptr;
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ static struct opt_rio * find_chassis_num (u8 slot_num)
|
||||||
static u8 calculate_first_slot (u8 slot_num)
|
static u8 calculate_first_slot (u8 slot_num)
|
||||||
{
|
{
|
||||||
u8 first_slot = 1;
|
u8 first_slot = 1;
|
||||||
struct slot * slot_cur;
|
struct slot *slot_cur;
|
||||||
|
|
||||||
list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) {
|
list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) {
|
||||||
if (slot_cur->ctrl) {
|
if (slot_cur->ctrl) {
|
||||||
|
@ -607,7 +607,7 @@ static u8 calculate_first_slot (u8 slot_num)
|
||||||
|
|
||||||
#define SLOT_NAME_SIZE 30
|
#define SLOT_NAME_SIZE 30
|
||||||
|
|
||||||
static char *create_file_name (struct slot * slot_cur)
|
static char *create_file_name (struct slot *slot_cur)
|
||||||
{
|
{
|
||||||
struct opt_rio *opt_vg_ptr = NULL;
|
struct opt_rio *opt_vg_ptr = NULL;
|
||||||
struct opt_rio_lo *opt_lo_ptr = NULL;
|
struct opt_rio_lo *opt_lo_ptr = NULL;
|
||||||
|
@ -1192,7 +1192,7 @@ int ibmphp_register_pci (void)
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
static int ibmphp_probe (struct pci_dev * dev, const struct pci_device_id *ids)
|
static int ibmphp_probe (struct pci_dev *dev, const struct pci_device_id *ids)
|
||||||
{
|
{
|
||||||
struct controller *ctrl;
|
struct controller *ctrl;
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,7 @@ static u8 hpc_readcmdtoindex (u8 cmd, u8 index)
|
||||||
*
|
*
|
||||||
* Return 0 or error codes
|
* Return 0 or error codes
|
||||||
*---------------------------------------------------------------------*/
|
*---------------------------------------------------------------------*/
|
||||||
int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
|
int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus)
|
||||||
{
|
{
|
||||||
void __iomem *wpg_bbar = NULL;
|
void __iomem *wpg_bbar = NULL;
|
||||||
struct controller *ctlr_ptr;
|
struct controller *ctlr_ptr;
|
||||||
|
@ -672,7 +672,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
|
||||||
*
|
*
|
||||||
* Action: issue a WRITE command to HPC
|
* Action: issue a WRITE command to HPC
|
||||||
*---------------------------------------------------------------------*/
|
*---------------------------------------------------------------------*/
|
||||||
int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
|
int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd)
|
||||||
{
|
{
|
||||||
void __iomem *wpg_bbar = NULL;
|
void __iomem *wpg_bbar = NULL;
|
||||||
struct controller *ctlr_ptr;
|
struct controller *ctlr_ptr;
|
||||||
|
@ -1102,7 +1102,7 @@ void __exit ibmphp_hpc_stop_poll_thread (void)
|
||||||
* Value:
|
* Value:
|
||||||
*---------------------------------------------------------------------*/
|
*---------------------------------------------------------------------*/
|
||||||
static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar,
|
static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar,
|
||||||
u8 * pstatus)
|
u8 *pstatus)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
u8 done = 0;
|
u8 done = 0;
|
||||||
|
|
|
@ -47,7 +47,7 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno);
|
||||||
* We also assign the same irq numbers for multi function devices.
|
* We also assign the same irq numbers for multi function devices.
|
||||||
* These are PIC mode, so shouldn't matter n.e.ways (hopefully)
|
* These are PIC mode, so shouldn't matter n.e.ways (hopefully)
|
||||||
*/
|
*/
|
||||||
static void assign_alt_irq (struct pci_func * cur_func, u8 class_code)
|
static void assign_alt_irq (struct pci_func *cur_func, u8 class_code)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
|
@ -137,8 +137,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
|
||||||
"Please choose another device.\n", cur_func->device);
|
"Please choose another device.\n", cur_func->device);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else if (class == PCI_CLASS_DISPLAY_VGA) {
|
} else if (class == PCI_CLASS_DISPLAY_VGA) {
|
||||||
err ("The device %x is not supported for hot plugging. "
|
err ("The device %x is not supported for hot plugging. Please choose another device.\n",
|
||||||
"Please choose another device.\n", cur_func->device);
|
cur_func->device);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
switch (hdr_type) {
|
switch (hdr_type) {
|
||||||
|
@ -179,8 +179,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
|
||||||
case PCI_HEADER_TYPE_MULTIBRIDGE:
|
case PCI_HEADER_TYPE_MULTIBRIDGE:
|
||||||
class >>= 8;
|
class >>= 8;
|
||||||
if (class != PCI_CLASS_BRIDGE_PCI) {
|
if (class != PCI_CLASS_BRIDGE_PCI) {
|
||||||
err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. "
|
err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n",
|
||||||
"Please insert another card.\n", cur_func->device);
|
cur_func->device);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
assign_alt_irq (cur_func, class_code);
|
assign_alt_irq (cur_func, class_code);
|
||||||
|
@ -247,8 +247,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)
|
||||||
class >>= 8;
|
class >>= 8;
|
||||||
debug ("class now is %x\n", class);
|
debug ("class now is %x\n", class);
|
||||||
if (class != PCI_CLASS_BRIDGE_PCI) {
|
if (class != PCI_CLASS_BRIDGE_PCI) {
|
||||||
err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. "
|
err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n",
|
||||||
"Please insert another card.\n", cur_func->device);
|
cur_func->device);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,7 +1073,7 @@ error:
|
||||||
* Input: bridge function
|
* Input: bridge function
|
||||||
* Output: amount of resources needed
|
* Output: amount of resources needed
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno)
|
static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno)
|
||||||
{
|
{
|
||||||
int count, len[6];
|
int count, len[6];
|
||||||
u16 vendor_id;
|
u16 vendor_id;
|
||||||
|
@ -1125,13 +1125,11 @@ static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno)
|
||||||
|
|
||||||
class >>= 8; /* to take revision out, class = class.subclass.prog i/f */
|
class >>= 8; /* to take revision out, class = class.subclass.prog i/f */
|
||||||
if (class == PCI_CLASS_NOT_DEFINED_VGA) {
|
if (class == PCI_CLASS_NOT_DEFINED_VGA) {
|
||||||
err ("The device %x is VGA compatible and as is not supported for hot plugging. "
|
err ("The device %x is VGA compatible and as is not supported for hot plugging. Please choose another device.\n", device);
|
||||||
"Please choose another device.\n", device);
|
|
||||||
amount->not_correct = 1;
|
amount->not_correct = 1;
|
||||||
return amount;
|
return amount;
|
||||||
} else if (class == PCI_CLASS_DISPLAY_VGA) {
|
} else if (class == PCI_CLASS_DISPLAY_VGA) {
|
||||||
err ("The device %x is not supported for hot plugging. "
|
err ("The device %x is not supported for hot plugging. Please choose another device.\n", device);
|
||||||
"Please choose another device.\n", device);
|
|
||||||
amount->not_correct = 1;
|
amount->not_correct = 1;
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
@ -1483,12 +1481,10 @@ static int unconfigure_boot_card (struct slot *slot_cur)
|
||||||
debug ("hdr_type %x, class %x\n", hdr_type, class);
|
debug ("hdr_type %x, class %x\n", hdr_type, class);
|
||||||
class >>= 8; /* to take revision out, class = class.subclass.prog i/f */
|
class >>= 8; /* to take revision out, class = class.subclass.prog i/f */
|
||||||
if (class == PCI_CLASS_NOT_DEFINED_VGA) {
|
if (class == PCI_CLASS_NOT_DEFINED_VGA) {
|
||||||
err ("The device %x function %x is VGA compatible and is not supported for hot removing. "
|
err ("The device %x function %x is VGA compatible and is not supported for hot removing. Please choose another device.\n", device, function);
|
||||||
"Please choose another device.\n", device, function);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else if (class == PCI_CLASS_DISPLAY_VGA) {
|
} else if (class == PCI_CLASS_DISPLAY_VGA) {
|
||||||
err ("The device %x function %x is not supported for hot removing. "
|
err ("The device %x function %x is not supported for hot removing. Please choose another device.\n", device, function);
|
||||||
"Please choose another device.\n", device, function);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1513,9 +1509,7 @@ static int unconfigure_boot_card (struct slot *slot_cur)
|
||||||
case PCI_HEADER_TYPE_BRIDGE:
|
case PCI_HEADER_TYPE_BRIDGE:
|
||||||
class >>= 8;
|
class >>= 8;
|
||||||
if (class != PCI_CLASS_BRIDGE_PCI) {
|
if (class != PCI_CLASS_BRIDGE_PCI) {
|
||||||
err ("This device %x function %x is not PCI-to-PCI bridge, "
|
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);
|
||||||
"and is not supported for hot-removing. "
|
|
||||||
"Please try another card.\n", device, function);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
rc = unconfigure_boot_bridge (busno, device, function);
|
rc = unconfigure_boot_bridge (busno, device, function);
|
||||||
|
@ -1529,9 +1523,7 @@ static int unconfigure_boot_card (struct slot *slot_cur)
|
||||||
case PCI_HEADER_TYPE_MULTIBRIDGE:
|
case PCI_HEADER_TYPE_MULTIBRIDGE:
|
||||||
class >>= 8;
|
class >>= 8;
|
||||||
if (class != PCI_CLASS_BRIDGE_PCI) {
|
if (class != PCI_CLASS_BRIDGE_PCI) {
|
||||||
err ("This device %x function %x is not PCI-to-PCI bridge, "
|
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);
|
||||||
"and is not supported for hot-removing. "
|
|
||||||
"Please try another card.\n", device, function);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
rc = unconfigure_boot_bridge (busno, device, function);
|
rc = unconfigure_boot_bridge (busno, device, function);
|
||||||
|
|
|
@ -46,9 +46,9 @@ static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8);
|
||||||
|
|
||||||
static LIST_HEAD(gbuses);
|
static LIST_HEAD(gbuses);
|
||||||
|
|
||||||
static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8 busno, int flag)
|
static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc *curr, u8 busno, int flag)
|
||||||
{
|
{
|
||||||
struct bus_node * newbus;
|
struct bus_node *newbus;
|
||||||
|
|
||||||
if (!(curr) && !(flag)) {
|
if (!(curr) && !(flag)) {
|
||||||
err ("NULL pointer passed\n");
|
err ("NULL pointer passed\n");
|
||||||
|
@ -69,7 +69,7 @@ static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8
|
||||||
return newbus;
|
return newbus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc * curr)
|
static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc *curr)
|
||||||
{
|
{
|
||||||
struct resource_node *rs;
|
struct resource_node *rs;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc * cur
|
||||||
|
|
||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
struct bus_node * newbus;
|
struct bus_node *newbus;
|
||||||
struct range_node *newrange;
|
struct range_node *newrange;
|
||||||
u8 num_ranges = 0;
|
u8 num_ranges = 0;
|
||||||
|
|
||||||
|
@ -789,8 +789,7 @@ int ibmphp_remove_resource (struct resource_node *res)
|
||||||
bus_cur = find_bus_wprev (res->busno, NULL, 0);
|
bus_cur = find_bus_wprev (res->busno, NULL, 0);
|
||||||
|
|
||||||
if (!bus_cur) {
|
if (!bus_cur) {
|
||||||
err ("cannot find corresponding bus of the io resource to remove "
|
err ("cannot find corresponding bus of the io resource to remove bailing out...\n");
|
||||||
"bailing out...\n");
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -934,9 +933,9 @@ int ibmphp_remove_resource (struct resource_node *res)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct range_node * find_range (struct bus_node *bus_cur, struct resource_node * res)
|
static struct range_node *find_range (struct bus_node *bus_cur, struct resource_node *res)
|
||||||
{
|
{
|
||||||
struct range_node * range = NULL;
|
struct range_node *range = NULL;
|
||||||
|
|
||||||
switch (res->type) {
|
switch (res->type) {
|
||||||
case IO:
|
case IO:
|
||||||
|
|
|
@ -59,14 +59,12 @@ static bool debug;
|
||||||
#define DRIVER_DESC "PCI Hot Plug PCI Core"
|
#define DRIVER_DESC "PCI Hot Plug PCI Core"
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
static LIST_HEAD(pci_hotplug_slot_list);
|
static LIST_HEAD(pci_hotplug_slot_list);
|
||||||
static DEFINE_MUTEX(pci_hp_mutex);
|
static DEFINE_MUTEX(pci_hp_mutex);
|
||||||
|
|
||||||
/* Weee, fun with macros... */
|
/* Weee, fun with macros... */
|
||||||
#define GET_STATUS(name,type) \
|
#define GET_STATUS(name, type) \
|
||||||
static int get_##name (struct hotplug_slot *slot, type *value) \
|
static int get_##name(struct hotplug_slot *slot, type *value) \
|
||||||
{ \
|
{ \
|
||||||
struct hotplug_slot_ops *ops = slot->ops; \
|
struct hotplug_slot_ops *ops = slot->ops; \
|
||||||
int retval = 0; \
|
int retval = 0; \
|
||||||
|
@ -92,10 +90,9 @@ static ssize_t power_read_file(struct pci_slot *slot, char *buf)
|
||||||
|
|
||||||
retval = get_power_status(slot->hotplug, &value);
|
retval = get_power_status(slot->hotplug, &value);
|
||||||
if (retval)
|
if (retval)
|
||||||
goto exit;
|
|
||||||
retval = sprintf (buf, "%d\n", value);
|
|
||||||
exit:
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
return sprintf(buf, "%d\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
|
static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
|
||||||
|
@ -106,9 +103,9 @@ static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
|
||||||
u8 power;
|
u8 power;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
lpower = simple_strtoul (buf, NULL, 10);
|
lpower = simple_strtoul(buf, NULL, 10);
|
||||||
power = (u8)(lpower & 0xff);
|
power = (u8)(lpower & 0xff);
|
||||||
dbg ("power = %d\n", power);
|
dbg("power = %d\n", power);
|
||||||
|
|
||||||
if (!try_module_get(slot->ops->owner)) {
|
if (!try_module_get(slot->ops->owner)) {
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
|
@ -126,7 +123,7 @@ static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
err ("Illegal value specified for power\n");
|
err("Illegal value specified for power\n");
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
}
|
}
|
||||||
module_put(slot->ops->owner);
|
module_put(slot->ops->owner);
|
||||||
|
@ -150,11 +147,9 @@ static ssize_t attention_read_file(struct pci_slot *slot, char *buf)
|
||||||
|
|
||||||
retval = get_attention_status(slot->hotplug, &value);
|
retval = get_attention_status(slot->hotplug, &value);
|
||||||
if (retval)
|
if (retval)
|
||||||
goto exit;
|
|
||||||
retval = sprintf(buf, "%d\n", value);
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
return sprintf(buf, "%d\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t attention_write_file(struct pci_slot *slot, const char *buf,
|
static ssize_t attention_write_file(struct pci_slot *slot, const char *buf,
|
||||||
|
@ -165,9 +160,9 @@ static ssize_t attention_write_file(struct pci_slot *slot, const char *buf,
|
||||||
u8 attention;
|
u8 attention;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
lattention = simple_strtoul (buf, NULL, 10);
|
lattention = simple_strtoul(buf, NULL, 10);
|
||||||
attention = (u8)(lattention & 0xff);
|
attention = (u8)(lattention & 0xff);
|
||||||
dbg (" - attention = %d\n", attention);
|
dbg(" - attention = %d\n", attention);
|
||||||
|
|
||||||
if (!try_module_get(ops->owner)) {
|
if (!try_module_get(ops->owner)) {
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
|
@ -196,11 +191,9 @@ static ssize_t latch_read_file(struct pci_slot *slot, char *buf)
|
||||||
|
|
||||||
retval = get_latch_status(slot->hotplug, &value);
|
retval = get_latch_status(slot->hotplug, &value);
|
||||||
if (retval)
|
if (retval)
|
||||||
goto exit;
|
|
||||||
retval = sprintf (buf, "%d\n", value);
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
return sprintf(buf, "%d\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pci_slot_attribute hotplug_slot_attr_latch = {
|
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)
|
||||||
|
|
||||||
retval = get_adapter_status(slot->hotplug, &value);
|
retval = get_adapter_status(slot->hotplug, &value);
|
||||||
if (retval)
|
if (retval)
|
||||||
goto exit;
|
|
||||||
retval = sprintf (buf, "%d\n", value);
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
return sprintf(buf, "%d\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pci_slot_attribute hotplug_slot_attr_presence = {
|
static struct pci_slot_attribute hotplug_slot_attr_presence = {
|
||||||
|
@ -237,7 +228,7 @@ static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf,
|
||||||
|
|
||||||
ltest = simple_strtoul (buf, NULL, 10);
|
ltest = simple_strtoul (buf, NULL, 10);
|
||||||
test = (u32)(ltest & 0xffffffff);
|
test = (u32)(ltest & 0xffffffff);
|
||||||
dbg ("test = %d\n", test);
|
dbg("test = %d\n", test);
|
||||||
|
|
||||||
if (!try_module_get(slot->ops->owner)) {
|
if (!try_module_get(slot->ops->owner)) {
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
|
@ -261,6 +252,7 @@ static struct pci_slot_attribute hotplug_slot_attr_test = {
|
||||||
static bool has_power_file(struct pci_slot *pci_slot)
|
static bool has_power_file(struct pci_slot *pci_slot)
|
||||||
{
|
{
|
||||||
struct hotplug_slot *slot = pci_slot->hotplug;
|
struct hotplug_slot *slot = pci_slot->hotplug;
|
||||||
|
|
||||||
if ((!slot) || (!slot->ops))
|
if ((!slot) || (!slot->ops))
|
||||||
return false;
|
return false;
|
||||||
if ((slot->ops->enable_slot) ||
|
if ((slot->ops->enable_slot) ||
|
||||||
|
@ -273,6 +265,7 @@ static bool has_power_file(struct pci_slot *pci_slot)
|
||||||
static bool has_attention_file(struct pci_slot *pci_slot)
|
static bool has_attention_file(struct pci_slot *pci_slot)
|
||||||
{
|
{
|
||||||
struct hotplug_slot *slot = pci_slot->hotplug;
|
struct hotplug_slot *slot = pci_slot->hotplug;
|
||||||
|
|
||||||
if ((!slot) || (!slot->ops))
|
if ((!slot) || (!slot->ops))
|
||||||
return false;
|
return false;
|
||||||
if ((slot->ops->set_attention_status) ||
|
if ((slot->ops->set_attention_status) ||
|
||||||
|
@ -284,6 +277,7 @@ static bool has_attention_file(struct pci_slot *pci_slot)
|
||||||
static bool has_latch_file(struct pci_slot *pci_slot)
|
static bool has_latch_file(struct pci_slot *pci_slot)
|
||||||
{
|
{
|
||||||
struct hotplug_slot *slot = pci_slot->hotplug;
|
struct hotplug_slot *slot = pci_slot->hotplug;
|
||||||
|
|
||||||
if ((!slot) || (!slot->ops))
|
if ((!slot) || (!slot->ops))
|
||||||
return false;
|
return false;
|
||||||
if (slot->ops->get_latch_status)
|
if (slot->ops->get_latch_status)
|
||||||
|
@ -294,6 +288,7 @@ static bool has_latch_file(struct pci_slot *pci_slot)
|
||||||
static bool has_adapter_file(struct pci_slot *pci_slot)
|
static bool has_adapter_file(struct pci_slot *pci_slot)
|
||||||
{
|
{
|
||||||
struct hotplug_slot *slot = pci_slot->hotplug;
|
struct hotplug_slot *slot = pci_slot->hotplug;
|
||||||
|
|
||||||
if ((!slot) || (!slot->ops))
|
if ((!slot) || (!slot->ops))
|
||||||
return false;
|
return false;
|
||||||
if (slot->ops->get_adapter_status)
|
if (slot->ops->get_adapter_status)
|
||||||
|
@ -304,6 +299,7 @@ static bool has_adapter_file(struct pci_slot *pci_slot)
|
||||||
static bool has_test_file(struct pci_slot *pci_slot)
|
static bool has_test_file(struct pci_slot *pci_slot)
|
||||||
{
|
{
|
||||||
struct hotplug_slot *slot = pci_slot->hotplug;
|
struct hotplug_slot *slot = pci_slot->hotplug;
|
||||||
|
|
||||||
if ((!slot) || (!slot->ops))
|
if ((!slot) || (!slot->ops))
|
||||||
return false;
|
return false;
|
||||||
if (slot->ops->hardware_test)
|
if (slot->ops->hardware_test)
|
||||||
|
@ -397,13 +393,13 @@ static void fs_remove_slot(struct pci_slot *slot)
|
||||||
pci_hp_remove_module_link(slot);
|
pci_hp_remove_module_link(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct hotplug_slot *get_slot_from_name (const char *name)
|
static struct hotplug_slot *get_slot_from_name(const char *name)
|
||||||
{
|
{
|
||||||
struct hotplug_slot *slot;
|
struct hotplug_slot *slot;
|
||||||
struct list_head *tmp;
|
struct list_head *tmp;
|
||||||
|
|
||||||
list_for_each (tmp, &pci_hotplug_slot_list) {
|
list_for_each(tmp, &pci_hotplug_slot_list) {
|
||||||
slot = list_entry (tmp, struct hotplug_slot, slot_list);
|
slot = list_entry(tmp, struct hotplug_slot, slot_list);
|
||||||
if (strcmp(hotplug_slot_name(slot), name) == 0)
|
if (strcmp(hotplug_slot_name(slot), name) == 0)
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
@ -436,8 +432,7 @@ int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus,
|
||||||
if ((slot->info == NULL) || (slot->ops == NULL))
|
if ((slot->info == NULL) || (slot->ops == NULL))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (slot->release == NULL) {
|
if (slot->release == NULL) {
|
||||||
dbg("Why are you trying to register a hotplug slot "
|
dbg("Why are you trying to register a hotplug slot without a proper release function?\n");
|
||||||
"without a proper release function?\n");
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,6 +463,7 @@ out:
|
||||||
mutex_unlock(&pci_hp_mutex);
|
mutex_unlock(&pci_hp_mutex);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(__pci_hp_register);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem
|
* pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem
|
||||||
|
@ -506,6 +502,7 @@ int pci_hp_deregister(struct hotplug_slot *hotplug)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_hp_deregister);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_hp_change_slot_info - changes the slot's information structure in the core
|
* 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,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);
|
||||||
|
|
||||||
static int __init pci_hotplug_init (void)
|
static int __init pci_hotplug_init(void)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = cpci_hotplug_init(debug);
|
result = cpci_hotplug_init(debug);
|
||||||
if (result) {
|
if (result) {
|
||||||
err ("cpci_hotplug_init with error %d\n", result);
|
err("cpci_hotplug_init with error %d\n", result);
|
||||||
goto err_cpci;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
|
info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
|
||||||
|
|
||||||
err_cpci:
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit pci_hotplug_exit (void)
|
static void __exit pci_hotplug_exit(void)
|
||||||
{
|
{
|
||||||
cpci_hotplug_exit();
|
cpci_hotplug_exit();
|
||||||
}
|
}
|
||||||
|
@ -557,7 +553,3 @@ MODULE_DESCRIPTION(DRIVER_DESC);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
module_param(debug, bool, 0644);
|
module_param(debug, bool, 0644);
|
||||||
MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
|
MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(__pci_hp_register);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_hp_deregister);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);
|
|
||||||
|
|
|
@ -266,8 +266,7 @@ static int pciehp_probe(struct pcie_device *dev)
|
||||||
rc = init_slot(ctrl);
|
rc = init_slot(ctrl);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
if (rc == -EBUSY)
|
if (rc == -EBUSY)
|
||||||
ctrl_warn(ctrl, "Slot already registered by another "
|
ctrl_warn(ctrl, "Slot already registered by another hotplug driver\n");
|
||||||
"hotplug driver\n");
|
|
||||||
else
|
else
|
||||||
ctrl_err(ctrl, "Slot initialization failed\n");
|
ctrl_err(ctrl, "Slot initialization failed\n");
|
||||||
goto err_out_release_ctlr;
|
goto err_out_release_ctlr;
|
||||||
|
@ -312,12 +311,12 @@ static void pciehp_remove(struct pcie_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
static int pciehp_suspend (struct pcie_device *dev)
|
static int pciehp_suspend(struct pcie_device *dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pciehp_resume (struct pcie_device *dev)
|
static int pciehp_resume(struct pcie_device *dev)
|
||||||
{
|
{
|
||||||
struct controller *ctrl;
|
struct controller *ctrl;
|
||||||
struct slot *slot;
|
struct slot *slot;
|
||||||
|
|
|
@ -175,7 +175,7 @@ void pciehp_handle_linkstate_change(struct slot *p_slot)
|
||||||
hotplug controller logic
|
hotplug controller logic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void set_slot_off(struct controller *ctrl, struct slot * pslot)
|
static void set_slot_off(struct controller *ctrl, struct slot *pslot)
|
||||||
{
|
{
|
||||||
/* turn off slot, turn on Amber LED, turn off Green LED if supported*/
|
/* turn off slot, turn on Amber LED, turn off Green LED if supported*/
|
||||||
if (POWER_CTRL(ctrl)) {
|
if (POWER_CTRL(ctrl)) {
|
||||||
|
@ -376,14 +376,12 @@ static void handle_button_press_event(struct slot *p_slot)
|
||||||
pciehp_get_power_status(p_slot, &getstatus);
|
pciehp_get_power_status(p_slot, &getstatus);
|
||||||
if (getstatus) {
|
if (getstatus) {
|
||||||
p_slot->state = BLINKINGOFF_STATE;
|
p_slot->state = BLINKINGOFF_STATE;
|
||||||
ctrl_info(ctrl,
|
ctrl_info(ctrl, "PCI slot #%s - powering off due to button press\n",
|
||||||
"PCI slot #%s - powering off due to button "
|
slot_name(p_slot));
|
||||||
"press.\n", slot_name(p_slot));
|
|
||||||
} else {
|
} else {
|
||||||
p_slot->state = BLINKINGON_STATE;
|
p_slot->state = BLINKINGON_STATE;
|
||||||
ctrl_info(ctrl,
|
ctrl_info(ctrl, "PCI slot #%s - powering on due to button press\n",
|
||||||
"PCI slot #%s - powering on due to button "
|
slot_name(p_slot));
|
||||||
"press.\n", slot_name(p_slot));
|
|
||||||
}
|
}
|
||||||
/* blink green LED and turn off amber */
|
/* blink green LED and turn off amber */
|
||||||
pciehp_green_led_blink(p_slot);
|
pciehp_green_led_blink(p_slot);
|
||||||
|
@ -404,8 +402,8 @@ static void handle_button_press_event(struct slot *p_slot)
|
||||||
else
|
else
|
||||||
pciehp_green_led_off(p_slot);
|
pciehp_green_led_off(p_slot);
|
||||||
pciehp_set_attention_status(p_slot, 0);
|
pciehp_set_attention_status(p_slot, 0);
|
||||||
ctrl_info(ctrl, "PCI slot #%s - action canceled "
|
ctrl_info(ctrl, "PCI slot #%s - action canceled due to button press\n",
|
||||||
"due to button press\n", slot_name(p_slot));
|
slot_name(p_slot));
|
||||||
p_slot->state = STATIC_STATE;
|
p_slot->state = STATIC_STATE;
|
||||||
break;
|
break;
|
||||||
case POWEROFF_STATE:
|
case POWEROFF_STATE:
|
||||||
|
|
|
@ -174,12 +174,10 @@ static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
|
||||||
* event even though it supports none of power
|
* event even though it supports none of power
|
||||||
* controller, attention led, power led and EMI.
|
* controller, attention led, power led and EMI.
|
||||||
*/
|
*/
|
||||||
ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to "
|
ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to wait for command completed event\n");
|
||||||
"wait for command completed event.\n");
|
|
||||||
ctrl->no_cmd_complete = 0;
|
ctrl->no_cmd_complete = 0;
|
||||||
} else {
|
} else {
|
||||||
ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe "
|
ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe the controller is broken\n");
|
||||||
"the controller is broken.\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +293,7 @@ int pciehp_check_link_status(struct controller *ctrl)
|
||||||
ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
|
ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
|
||||||
if ((lnk_status & PCI_EXP_LNKSTA_LT) ||
|
if ((lnk_status & PCI_EXP_LNKSTA_LT) ||
|
||||||
!(lnk_status & PCI_EXP_LNKSTA_NLW)) {
|
!(lnk_status & PCI_EXP_LNKSTA_NLW)) {
|
||||||
ctrl_err(ctrl, "Link Training Error occurs \n");
|
ctrl_err(ctrl, "Link Training Error occurs\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +412,7 @@ void pciehp_set_attention_status(struct slot *slot, u8 value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0 : /* turn off */
|
case 0: /* turn off */
|
||||||
slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF;
|
slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF;
|
||||||
break;
|
break;
|
||||||
case 1: /* turn on */
|
case 1: /* turn on */
|
||||||
|
@ -470,7 +468,7 @@ void pciehp_green_led_blink(struct slot *slot)
|
||||||
PCI_EXP_SLTCTL_PWR_IND_BLINK);
|
PCI_EXP_SLTCTL_PWR_IND_BLINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pciehp_power_on_slot(struct slot * slot)
|
int pciehp_power_on_slot(struct slot *slot)
|
||||||
{
|
{
|
||||||
struct controller *ctrl = slot->ctrl;
|
struct controller *ctrl = slot->ctrl;
|
||||||
struct pci_dev *pdev = ctrl_dev(ctrl);
|
struct pci_dev *pdev = ctrl_dev(ctrl);
|
||||||
|
@ -496,7 +494,7 @@ int pciehp_power_on_slot(struct slot * slot)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pciehp_power_off_slot(struct slot * slot)
|
void pciehp_power_off_slot(struct slot *slot)
|
||||||
{
|
{
|
||||||
struct controller *ctrl = slot->ctrl;
|
struct controller *ctrl = slot->ctrl;
|
||||||
|
|
||||||
|
@ -756,7 +754,7 @@ static inline void dbg_ctrl(struct controller *ctrl)
|
||||||
ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16);
|
ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FLAG(x,y) (((x) & (y)) ? '+' : '-')
|
#define FLAG(x, y) (((x) & (y)) ? '+' : '-')
|
||||||
|
|
||||||
struct controller *pcie_init(struct pcie_device *dev)
|
struct controller *pcie_init(struct pcie_device *dev)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,9 +46,8 @@ int pciehp_configure_device(struct slot *p_slot)
|
||||||
|
|
||||||
dev = pci_get_slot(parent, PCI_DEVFN(0, 0));
|
dev = pci_get_slot(parent, PCI_DEVFN(0, 0));
|
||||||
if (dev) {
|
if (dev) {
|
||||||
ctrl_err(ctrl, "Device %s already exists "
|
ctrl_err(ctrl, "Device %s already exists at %04x:%02x:00, cannot hot-add\n",
|
||||||
"at %04x:%02x:00, cannot hot-add\n", pci_name(dev),
|
pci_name(dev), pci_domain_nr(parent), parent->number);
|
||||||
pci_domain_nr(parent), parent->number);
|
|
||||||
pci_dev_put(dev);
|
pci_dev_put(dev);
|
||||||
ret = -EEXIST;
|
ret = -EEXIST;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -51,7 +51,7 @@ static LIST_HEAD(slot_list);
|
||||||
#define dbg(format, arg...) \
|
#define dbg(format, arg...) \
|
||||||
do { \
|
do { \
|
||||||
if (debug) \
|
if (debug) \
|
||||||
printk (KERN_DEBUG "%s: " format "\n", \
|
printk(KERN_DEBUG "%s: " format "\n", \
|
||||||
MY_NAME , ## arg); \
|
MY_NAME , ## arg); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
|
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
bool rpaphp_debug;
|
bool rpaphp_debug;
|
||||||
LIST_HEAD(rpaphp_slot_head);
|
LIST_HEAD(rpaphp_slot_head);
|
||||||
|
EXPORT_SYMBOL_GPL(rpaphp_slot_head);
|
||||||
|
|
||||||
#define DRIVER_VERSION "0.1"
|
#define DRIVER_VERSION "0.1"
|
||||||
#define DRIVER_AUTHOR "Linda Xie <lxie@us.ibm.com>"
|
#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)
|
||||||
* @hotplug_slot: slot to get status
|
* @hotplug_slot: slot to get status
|
||||||
* @value: pointer to store status
|
* @value: pointer to store status
|
||||||
*/
|
*/
|
||||||
static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
int retval, level;
|
int retval, level;
|
||||||
struct slot *slot = (struct slot *)hotplug_slot->private;
|
struct slot *slot = (struct slot *)hotplug_slot->private;
|
||||||
|
@ -104,14 +105,14 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
||||||
* @hotplug_slot: slot to get status
|
* @hotplug_slot: slot to get status
|
||||||
* @value: pointer to store status
|
* @value: pointer to store status
|
||||||
*/
|
*/
|
||||||
static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
struct slot *slot = (struct slot *)hotplug_slot->private;
|
struct slot *slot = (struct slot *)hotplug_slot->private;
|
||||||
*value = slot->hotplug_slot->info->attention_status;
|
*value = slot->hotplug_slot->info->attention_status;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
|
static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
||||||
{
|
{
|
||||||
struct slot *slot = (struct slot *)hotplug_slot->private;
|
struct slot *slot = (struct slot *)hotplug_slot->private;
|
||||||
int rc, state;
|
int rc, state;
|
||||||
|
@ -241,6 +242,7 @@ int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(rpaphp_get_drc_props);
|
||||||
|
|
||||||
static int is_php_type(char *drc_type)
|
static int is_php_type(char *drc_type)
|
||||||
{
|
{
|
||||||
|
@ -350,6 +352,7 @@ int rpaphp_add_slot(struct device_node *dn)
|
||||||
/* XXX FIXME: reports a failure only if last entry in loop failed */
|
/* XXX FIXME: reports a failure only if last entry in loop failed */
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(rpaphp_add_slot);
|
||||||
|
|
||||||
static void __exit cleanup_slots(void)
|
static void __exit cleanup_slots(void)
|
||||||
{
|
{
|
||||||
|
@ -443,7 +446,3 @@ struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
|
||||||
|
|
||||||
module_init(rpaphp_init);
|
module_init(rpaphp_init);
|
||||||
module_exit(rpaphp_exit);
|
module_exit(rpaphp_exit);
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(rpaphp_add_slot);
|
|
||||||
EXPORT_SYMBOL_GPL(rpaphp_slot_head);
|
|
||||||
EXPORT_SYMBOL_GPL(rpaphp_get_drc_props);
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct hotplug_slot * sn_hp_destroy(void)
|
static struct hotplug_slot *sn_hp_destroy(void)
|
||||||
{
|
{
|
||||||
struct slot *slot;
|
struct slot *slot;
|
||||||
struct pci_slot *pci_slot;
|
struct pci_slot *pci_slot;
|
||||||
|
@ -250,15 +250,13 @@ static int sn_slot_enable(struct hotplug_slot *bss_hotplug_slot,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc == PCI_L1_ERR) {
|
if (rc == PCI_L1_ERR) {
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "L1 failure %d with message: %s",
|
||||||
"L1 failure %d with message: %s",
|
|
||||||
resp.resp_sub_errno, resp.resp_l1_msg);
|
resp.resp_sub_errno, resp.resp_l1_msg);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "insert failed with error %d sub-error %d\n",
|
||||||
"insert failed with error %d sub-error %d\n",
|
|
||||||
rc, resp.resp_sub_errno);
|
rc, resp.resp_sub_errno);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -288,21 +286,18 @@ static int sn_slot_disable(struct hotplug_slot *bss_hotplug_slot,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_EMPTY_33MHZ)) {
|
if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_EMPTY_33MHZ)) {
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "Cannot remove last 33MHz card\n");
|
||||||
"Cannot remove last 33MHz card\n");
|
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_L1_ERR)) {
|
if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_L1_ERR)) {
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "L1 failure %d with message \n%s\n",
|
||||||
"L1 failure %d with message \n%s\n",
|
|
||||||
resp.resp_sub_errno, resp.resp_l1_msg);
|
resp.resp_sub_errno, resp.resp_l1_msg);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((action == PCI_REQ_SLOT_ELIGIBLE) && rc) {
|
if ((action == PCI_REQ_SLOT_ELIGIBLE) && rc) {
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "remove failed with error %d sub-error %d\n",
|
||||||
"remove failed with error %d sub-error %d\n",
|
|
||||||
rc, resp.resp_sub_errno);
|
rc, resp.resp_sub_errno);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -417,8 +412,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
|
||||||
phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion);
|
phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion);
|
||||||
|
|
||||||
if (acpi_bus_get_device(phandle, &pdevice)) {
|
if (acpi_bus_get_device(phandle, &pdevice)) {
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "no parent device, assuming NULL\n");
|
||||||
"no parent device, assuming NULL\n");
|
|
||||||
pdevice = NULL;
|
pdevice = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,10 +441,8 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
|
||||||
|
|
||||||
ret = acpi_bus_scan(chandle);
|
ret = acpi_bus_scan(chandle);
|
||||||
if (ACPI_FAILURE(ret)) {
|
if (ACPI_FAILURE(ret)) {
|
||||||
printk(KERN_ERR "%s: acpi_bus_scan "
|
printk(KERN_ERR "%s: acpi_bus_scan failed (0x%x) for slot %d func %d\n",
|
||||||
"failed (0x%x) for slot %d "
|
__func__, ret, (int)(adr>>16),
|
||||||
"func %d\n", __func__,
|
|
||||||
ret, (int)(adr>>16),
|
|
||||||
(int)(adr&0xffff));
|
(int)(adr&0xffff));
|
||||||
/* try to continue on */
|
/* try to continue on */
|
||||||
}
|
}
|
||||||
|
@ -471,11 +463,9 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
|
||||||
mutex_unlock(&sn_hotplug_mutex);
|
mutex_unlock(&sn_hotplug_mutex);
|
||||||
|
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "insert operation successful\n");
|
||||||
"insert operation successful\n");
|
|
||||||
else
|
else
|
||||||
dev_dbg(&slot->pci_bus->self->dev,
|
dev_dbg(&slot->pci_bus->self->dev, "insert operation failed rc = %d\n", rc);
|
||||||
"insert operation failed rc = %d\n", rc);
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -561,8 +551,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
|
||||||
acpi_status ret;
|
acpi_status ret;
|
||||||
ret = acpi_unload_table_id(ssdt_id);
|
ret = acpi_unload_table_id(ssdt_id);
|
||||||
if (ACPI_FAILURE(ret)) {
|
if (ACPI_FAILURE(ret)) {
|
||||||
printk(KERN_ERR "%s: acpi_unload_table_id "
|
printk(KERN_ERR "%s: acpi_unload_table_id failed (0x%x) for id %d\n",
|
||||||
"failed (0x%x) for id %d\n",
|
|
||||||
__func__, ret, ssdt_id);
|
__func__, ret, ssdt_id);
|
||||||
/* try to continue on */
|
/* try to continue on */
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ int shpchp_configure_device(struct slot *p_slot);
|
||||||
int shpchp_unconfigure_device(struct slot *p_slot);
|
int shpchp_unconfigure_device(struct slot *p_slot);
|
||||||
void cleanup_slots(struct controller *ctrl);
|
void cleanup_slots(struct controller *ctrl);
|
||||||
void shpchp_queue_pushbutton_work(struct work_struct *work);
|
void shpchp_queue_pushbutton_work(struct work_struct *work);
|
||||||
int shpc_init( struct controller *ctrl, struct pci_dev *pdev);
|
int shpc_init(struct controller *ctrl, struct pci_dev *pdev);
|
||||||
|
|
||||||
static inline const char *slot_name(struct slot *slot)
|
static inline const char *slot_name(struct slot *slot)
|
||||||
{
|
{
|
||||||
|
@ -295,7 +295,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
|
||||||
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set);
|
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set);
|
||||||
}
|
}
|
||||||
/* restore MiscII register */
|
/* restore MiscII register */
|
||||||
pci_read_config_dword( p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp );
|
pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp );
|
||||||
|
|
||||||
if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK)
|
if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK)
|
||||||
pcix_misc2_temp |= SERRFATALENABLE_MASK;
|
pcix_misc2_temp |= SERRFATALENABLE_MASK;
|
||||||
|
|
|
@ -143,8 +143,7 @@ static int init_slots(struct controller *ctrl)
|
||||||
snprintf(name, SLOT_NAME_SIZE, "%d", slot->number);
|
snprintf(name, SLOT_NAME_SIZE, "%d", slot->number);
|
||||||
hotplug_slot->ops = &shpchp_hotplug_slot_ops;
|
hotplug_slot->ops = &shpchp_hotplug_slot_ops;
|
||||||
|
|
||||||
ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x "
|
ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x hp_slot=%x sun=%x slot_device_offset=%x\n",
|
||||||
"hp_slot=%x sun=%x slot_device_offset=%x\n",
|
|
||||||
pci_domain_nr(ctrl->pci_dev->subordinate),
|
pci_domain_nr(ctrl->pci_dev->subordinate),
|
||||||
slot->bus, slot->device, slot->hp_slot, slot->number,
|
slot->bus, slot->device, slot->hp_slot, slot->number,
|
||||||
ctrl->slot_device_offset);
|
ctrl->slot_device_offset);
|
||||||
|
|
|
@ -162,7 +162,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
|
||||||
|
|
||||||
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
|
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
|
||||||
|
|
||||||
if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) {
|
if (!(p_slot->hpc_ops->query_power_fault(p_slot))) {
|
||||||
/*
|
/*
|
||||||
* Power fault Cleared
|
* Power fault Cleared
|
||||||
*/
|
*/
|
||||||
|
@ -196,8 +196,8 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
|
||||||
|
|
||||||
ctrl_dbg(ctrl, "Change speed to %d\n", speed);
|
ctrl_dbg(ctrl, "Change speed to %d\n", speed);
|
||||||
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
|
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
|
||||||
ctrl_err(ctrl, "%s: Issue of set bus speed mode command "
|
ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n",
|
||||||
"failed\n", __func__);
|
__func__);
|
||||||
return WRONG_BUS_FREQUENCY;
|
return WRONG_BUS_FREQUENCY;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -215,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
|
||||||
*/
|
*/
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (asp < bsp) {
|
if (asp < bsp) {
|
||||||
ctrl_err(ctrl, "Speed of bus %x and adapter %x "
|
ctrl_err(ctrl, "Speed of bus %x and adapter %x mismatch\n",
|
||||||
"mismatch\n", bsp, asp);
|
bsp, asp);
|
||||||
rc = WRONG_BUS_FREQUENCY;
|
rc = WRONG_BUS_FREQUENCY;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -250,8 +250,7 @@ static int board_added(struct slot *p_slot)
|
||||||
|
|
||||||
hp_slot = p_slot->device - ctrl->slot_device_offset;
|
hp_slot = p_slot->device - ctrl->slot_device_offset;
|
||||||
|
|
||||||
ctrl_dbg(ctrl,
|
ctrl_dbg(ctrl, "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n",
|
||||||
"%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n",
|
|
||||||
__func__, p_slot->device, ctrl->slot_device_offset, hp_slot);
|
__func__, p_slot->device, ctrl->slot_device_offset, hp_slot);
|
||||||
|
|
||||||
/* Power on slot without connecting to bus */
|
/* Power on slot without connecting to bus */
|
||||||
|
@ -263,8 +262,8 @@ static int board_added(struct slot *p_slot)
|
||||||
|
|
||||||
if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) {
|
if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) {
|
||||||
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) {
|
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) {
|
||||||
ctrl_err(ctrl, "%s: Issue of set bus speed mode command"
|
ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n",
|
||||||
" failed\n", __func__);
|
__func__);
|
||||||
return WRONG_BUS_FREQUENCY;
|
return WRONG_BUS_FREQUENCY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,8 +276,7 @@ static int board_added(struct slot *p_slot)
|
||||||
|
|
||||||
rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp);
|
rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
ctrl_err(ctrl, "Can't get adapter speed or "
|
ctrl_err(ctrl, "Can't get adapter speed or bus mode mismatch\n");
|
||||||
"bus mode mismatch\n");
|
|
||||||
return WRONG_BUS_FREQUENCY;
|
return WRONG_BUS_FREQUENCY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,8 +287,8 @@ static int board_added(struct slot *p_slot)
|
||||||
if (!list_empty(&ctrl->pci_dev->subordinate->devices))
|
if (!list_empty(&ctrl->pci_dev->subordinate->devices))
|
||||||
slots_not_empty = 1;
|
slots_not_empty = 1;
|
||||||
|
|
||||||
ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d,"
|
ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, max_bus_speed %d\n",
|
||||||
" max_bus_speed %d\n", __func__, slots_not_empty, asp,
|
__func__, slots_not_empty, asp,
|
||||||
bsp, msp);
|
bsp, msp);
|
||||||
|
|
||||||
rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp);
|
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)
|
||||||
p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
|
p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
|
||||||
if (getstatus) {
|
if (getstatus) {
|
||||||
p_slot->state = BLINKINGOFF_STATE;
|
p_slot->state = BLINKINGOFF_STATE;
|
||||||
ctrl_info(ctrl, "PCI slot #%s - powering off due to "
|
ctrl_info(ctrl, "PCI slot #%s - powering off due to button press\n",
|
||||||
"button press.\n", slot_name(p_slot));
|
slot_name(p_slot));
|
||||||
} else {
|
} else {
|
||||||
p_slot->state = BLINKINGON_STATE;
|
p_slot->state = BLINKINGON_STATE;
|
||||||
ctrl_info(ctrl, "PCI slot #%s - powering on due to "
|
ctrl_info(ctrl, "PCI slot #%s - powering on due to button press\n",
|
||||||
"button press.\n", slot_name(p_slot));
|
slot_name(p_slot));
|
||||||
}
|
}
|
||||||
/* blink green LED and turn off amber */
|
/* blink green LED and turn off amber */
|
||||||
p_slot->hpc_ops->green_led_blink(p_slot);
|
p_slot->hpc_ops->green_led_blink(p_slot);
|
||||||
|
@ -518,8 +516,8 @@ static void handle_button_press_event(struct slot *p_slot)
|
||||||
else
|
else
|
||||||
p_slot->hpc_ops->green_led_off(p_slot);
|
p_slot->hpc_ops->green_led_off(p_slot);
|
||||||
p_slot->hpc_ops->set_attention_status(p_slot, 0);
|
p_slot->hpc_ops->set_attention_status(p_slot, 0);
|
||||||
ctrl_info(ctrl, "PCI slot #%s - action canceled due to "
|
ctrl_info(ctrl, "PCI slot #%s - action canceled due to button press\n",
|
||||||
"button press\n", slot_name(p_slot));
|
slot_name(p_slot));
|
||||||
p_slot->state = STATIC_STATE;
|
p_slot->state = STATIC_STATE;
|
||||||
break;
|
break;
|
||||||
case POWEROFF_STATE:
|
case POWEROFF_STATE:
|
||||||
|
|
|
@ -341,8 +341,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
|
||||||
|
|
||||||
cmd_status = hpc_check_cmd_status(slot->ctrl);
|
cmd_status = hpc_check_cmd_status(slot->ctrl);
|
||||||
if (cmd_status) {
|
if (cmd_status) {
|
||||||
ctrl_err(ctrl,
|
ctrl_err(ctrl, "Failed to issued command 0x%x (error code = %d)\n",
|
||||||
"Failed to issued command 0x%x (error code = %d)\n",
|
|
||||||
cmd, cmd_status);
|
cmd, cmd_status);
|
||||||
retval = -EIO;
|
retval = -EIO;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +403,7 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hpc_get_power_status(struct slot * slot, u8 *status)
|
static int hpc_get_power_status(struct slot *slot, u8 *status)
|
||||||
{
|
{
|
||||||
struct controller *ctrl = slot->ctrl;
|
struct controller *ctrl = slot->ctrl;
|
||||||
u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
|
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)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hpc_query_power_fault(struct slot * slot)
|
static int hpc_query_power_fault(struct slot *slot)
|
||||||
{
|
{
|
||||||
struct controller *ctrl = slot->ctrl;
|
struct controller *ctrl = slot->ctrl;
|
||||||
u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
|
u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
|
||||||
|
@ -614,7 +613,7 @@ static void hpc_release_ctlr(struct controller *ctrl)
|
||||||
release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
|
release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hpc_power_on_slot(struct slot * slot)
|
static int hpc_power_on_slot(struct slot *slot)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -625,7 +624,7 @@ static int hpc_power_on_slot(struct slot * slot)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hpc_slot_enable(struct slot * slot)
|
static int hpc_slot_enable(struct slot *slot)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -638,7 +637,7 @@ static int hpc_slot_enable(struct slot * slot)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hpc_slot_disable(struct slot * slot)
|
static int hpc_slot_disable(struct slot *slot)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -720,7 +719,7 @@ static int shpc_get_cur_bus_speed(struct controller *ctrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
|
static int hpc_set_bus_speed_mode(struct slot *slot, enum pci_bus_speed value)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
struct controller *ctrl = slot->ctrl;
|
struct controller *ctrl = slot->ctrl;
|
||||||
|
@ -974,8 +973,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
|
||||||
for (i = 0; i < 9 + num_slots; i++) {
|
for (i = 0; i < 9 + num_slots; i++) {
|
||||||
rc = shpc_indirect_read(ctrl, i, &tempdword);
|
rc = shpc_indirect_read(ctrl, i, &tempdword);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
ctrl_err(ctrl,
|
ctrl_err(ctrl, "Cannot read creg (index = %d)\n",
|
||||||
"Cannot read creg (index = %d)\n", i);
|
i);
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword);
|
ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword);
|
||||||
|
@ -1060,10 +1059,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
|
||||||
/* Installs the interrupt handler */
|
/* Installs the interrupt handler */
|
||||||
rc = pci_enable_msi(pdev);
|
rc = pci_enable_msi(pdev);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
ctrl_info(ctrl,
|
ctrl_info(ctrl, "Can't get msi for the hotplug controller\n");
|
||||||
"Can't get msi for the hotplug controller\n");
|
ctrl_info(ctrl, "Use INTx for the hotplug controller\n");
|
||||||
ctrl_info(ctrl,
|
|
||||||
"Use INTx for the hotplug controller\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED,
|
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)
|
||||||
ctrl_dbg(ctrl, "request_irq %d (returns %d)\n",
|
ctrl_dbg(ctrl, "request_irq %d (returns %d)\n",
|
||||||
ctrl->pci_dev->irq, rc);
|
ctrl->pci_dev->irq, rc);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
ctrl_err(ctrl, "Can't get irq %d for the hotplug "
|
ctrl_err(ctrl, "Can't get irq %d for the hotplug controller\n",
|
||||||
"controller\n", ctrl->pci_dev->irq);
|
ctrl->pci_dev->irq);
|
||||||
goto abort_iounmap;
|
goto abort_iounmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ int shpchp_configure_device(struct slot *p_slot)
|
||||||
|
|
||||||
dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0));
|
dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0));
|
||||||
if (dev) {
|
if (dev) {
|
||||||
ctrl_err(ctrl, "Device %s already exists "
|
ctrl_err(ctrl, "Device %s already exists at %04x:%02x:%02x, cannot hot-add\n",
|
||||||
"at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev),
|
pci_name(dev), pci_domain_nr(parent),
|
||||||
pci_domain_nr(parent), p_slot->bus, p_slot->device);
|
p_slot->bus, p_slot->device);
|
||||||
pci_dev_put(dev);
|
pci_dev_put(dev);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
char * out = buf;
|
char *out = buf;
|
||||||
int index, busnr;
|
int index, busnr;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct pci_bus *bus;
|
struct pci_bus *bus;
|
||||||
|
|
|
@ -102,7 +102,7 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
|
||||||
spin_unlock_irqrestore(&ht_irq_lock, flags);
|
spin_unlock_irqrestore(&ht_irq_lock, flags);
|
||||||
|
|
||||||
max_irq = (data >> 16) & 0xff;
|
max_irq = (data >> 16) & 0xff;
|
||||||
if ( idx > max_irq)
|
if (idx > max_irq)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
|
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)
|
||||||
|
|
||||||
return irq;
|
return irq;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(__ht_create_irq);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ht_create_irq - create an irq and attach it to a device.
|
* 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)
|
||||||
{
|
{
|
||||||
return __ht_create_irq(dev, idx, NULL);
|
return __ht_create_irq(dev, idx, NULL);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(ht_create_irq);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ht_destroy_irq - destroy an irq created with ht_create_irq
|
* ht_destroy_irq - destroy an irq created with ht_create_irq
|
||||||
|
@ -165,7 +167,4 @@ void ht_destroy_irq(unsigned int irq)
|
||||||
|
|
||||||
kfree(cfg);
|
kfree(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(__ht_create_irq);
|
|
||||||
EXPORT_SYMBOL(ht_create_irq);
|
|
||||||
EXPORT_SYMBOL(ht_destroy_irq);
|
EXPORT_SYMBOL(ht_destroy_irq);
|
||||||
|
|
|
@ -413,7 +413,7 @@ static void free_msi_irqs(struct pci_dev *dev)
|
||||||
if (dev->msi_irq_groups) {
|
if (dev->msi_irq_groups) {
|
||||||
sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
|
sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
|
||||||
msi_attrs = dev->msi_irq_groups[0]->attrs;
|
msi_attrs = dev->msi_irq_groups[0]->attrs;
|
||||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
while (msi_attrs[count]) {
|
||||||
dev_attr = container_of(msi_attrs[count],
|
dev_attr = container_of(msi_attrs[count],
|
||||||
struct device_attribute, attr);
|
struct device_attribute, attr);
|
||||||
kfree(dev_attr->attr.name);
|
kfree(dev_attr->attr.name);
|
||||||
|
@ -980,8 +980,7 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec)
|
||||||
|
|
||||||
/* Check whether driver already requested for MSI irq */
|
/* Check whether driver already requested for MSI irq */
|
||||||
if (dev->msi_enabled) {
|
if (dev->msi_enabled) {
|
||||||
dev_info(&dev->dev, "can't enable MSI-X "
|
dev_info(&dev->dev, "can't enable MSI-X (MSI IRQ already assigned)\n");
|
||||||
"(MSI IRQ already assigned)\n");
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
status = msix_capability_init(dev, entries, nvec);
|
status = msix_capability_init(dev, entries, nvec);
|
||||||
|
|
|
@ -77,6 +77,7 @@ int pci_add_dynid(struct pci_driver *drv,
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_add_dynid);
|
||||||
|
|
||||||
static void pci_free_dynids(struct pci_driver *drv)
|
static void pci_free_dynids(struct pci_driver *drv)
|
||||||
{
|
{
|
||||||
|
@ -98,15 +99,15 @@ static void pci_free_dynids(struct pci_driver *drv)
|
||||||
*
|
*
|
||||||
* Allow PCI IDs to be added to an existing driver via sysfs.
|
* Allow PCI IDs to be added to an existing driver via sysfs.
|
||||||
*/
|
*/
|
||||||
static ssize_t
|
static ssize_t store_new_id(struct device_driver *driver, const char *buf,
|
||||||
store_new_id(struct device_driver *driver, const char *buf, size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
struct pci_driver *pdrv = to_pci_driver(driver);
|
struct pci_driver *pdrv = to_pci_driver(driver);
|
||||||
const struct pci_device_id *ids = pdrv->id_table;
|
const struct pci_device_id *ids = pdrv->id_table;
|
||||||
__u32 vendor, device, subvendor=PCI_ANY_ID,
|
__u32 vendor, device, subvendor = PCI_ANY_ID,
|
||||||
subdevice=PCI_ANY_ID, class=0, class_mask=0;
|
subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
|
||||||
unsigned long driver_data=0;
|
unsigned long driver_data = 0;
|
||||||
int fields=0;
|
int fields = 0;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
fields = sscanf(buf, "%x %x %x %x %x %x %lx",
|
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);
|
||||||
*
|
*
|
||||||
* Removes a dynamic pci device ID to this driver.
|
* Removes a dynamic pci device ID to this driver.
|
||||||
*/
|
*/
|
||||||
static ssize_t
|
static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
|
||||||
store_remove_id(struct device_driver *driver, const char *buf, size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
struct pci_dynid *dynid, *n;
|
struct pci_dynid *dynid, *n;
|
||||||
struct pci_driver *pdrv = to_pci_driver(driver);
|
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,
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_match_id);
|
||||||
|
|
||||||
static const struct pci_device_id pci_device_id_any = {
|
static const struct pci_device_id pci_device_id_any = {
|
||||||
.vendor = PCI_ANY_ID,
|
.vendor = PCI_ANY_ID,
|
||||||
|
@ -372,8 +374,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
|
||||||
* returns 0 on success, else error.
|
* returns 0 on success, else error.
|
||||||
* side-effect: pci_dev->driver is set to drv when drv claims pci_dev.
|
* side-effect: pci_dev->driver is set to drv when drv claims pci_dev.
|
||||||
*/
|
*/
|
||||||
static int
|
static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
|
||||||
__pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
|
|
||||||
{
|
{
|
||||||
const struct pci_device_id *id;
|
const struct pci_device_id *id;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
@ -390,7 +391,7 @@ __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_device_probe(struct device * dev)
|
static int pci_device_probe(struct device *dev)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
struct pci_driver *drv;
|
struct pci_driver *drv;
|
||||||
|
@ -406,10 +407,10 @@ static int pci_device_probe(struct device * dev)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_device_remove(struct device * dev)
|
static int pci_device_remove(struct device *dev)
|
||||||
{
|
{
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||||
struct pci_driver * drv = pci_dev->driver;
|
struct pci_driver *drv = pci_dev->driver;
|
||||||
|
|
||||||
if (drv) {
|
if (drv) {
|
||||||
if (drv->remove) {
|
if (drv->remove) {
|
||||||
|
@ -537,8 +538,8 @@ static int pci_pm_reenable_device(struct pci_dev *pci_dev)
|
||||||
|
|
||||||
static int pci_legacy_suspend(struct device *dev, pm_message_t state)
|
static int pci_legacy_suspend(struct device *dev, pm_message_t state)
|
||||||
{
|
{
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||||
struct pci_driver * drv = pci_dev->driver;
|
struct pci_driver *drv = pci_dev->driver;
|
||||||
|
|
||||||
if (drv && drv->suspend) {
|
if (drv && drv->suspend) {
|
||||||
pci_power_t prev = pci_dev->current_state;
|
pci_power_t prev = pci_dev->current_state;
|
||||||
|
@ -564,8 +565,8 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
|
||||||
|
|
||||||
static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
|
static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
|
||||||
{
|
{
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||||
struct pci_driver * drv = pci_dev->driver;
|
struct pci_driver *drv = pci_dev->driver;
|
||||||
|
|
||||||
if (drv && drv->suspend_late) {
|
if (drv && drv->suspend_late) {
|
||||||
pci_power_t prev = pci_dev->current_state;
|
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)
|
||||||
|
|
||||||
static int pci_legacy_resume_early(struct device *dev)
|
static int pci_legacy_resume_early(struct device *dev)
|
||||||
{
|
{
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||||
struct pci_driver * drv = pci_dev->driver;
|
struct pci_driver *drv = pci_dev->driver;
|
||||||
|
|
||||||
return drv && drv->resume_early ?
|
return drv && drv->resume_early ?
|
||||||
drv->resume_early(pci_dev) : 0;
|
drv->resume_early(pci_dev) : 0;
|
||||||
|
@ -604,8 +605,8 @@ static int pci_legacy_resume_early(struct device *dev)
|
||||||
|
|
||||||
static int pci_legacy_resume(struct device *dev)
|
static int pci_legacy_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||||
struct pci_driver * drv = pci_dev->driver;
|
struct pci_driver *drv = pci_dev->driver;
|
||||||
|
|
||||||
pci_fixup_device(pci_fixup_resume, pci_dev);
|
pci_fixup_device(pci_fixup_resume, pci_dev);
|
||||||
|
|
||||||
|
@ -1255,6 +1256,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner,
|
||||||
/* register with core */
|
/* register with core */
|
||||||
return driver_register(&drv->driver);
|
return driver_register(&drv->driver);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(__pci_register_driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_unregister_driver - unregister a pci driver
|
* pci_unregister_driver - unregister a pci driver
|
||||||
|
@ -1266,12 +1268,12 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner,
|
||||||
* driverless.
|
* driverless.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void pci_unregister_driver(struct pci_driver *drv)
|
||||||
pci_unregister_driver(struct pci_driver *drv)
|
|
||||||
{
|
{
|
||||||
driver_unregister(&drv->driver);
|
driver_unregister(&drv->driver);
|
||||||
pci_free_dynids(drv);
|
pci_free_dynids(drv);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_unregister_driver);
|
||||||
|
|
||||||
static struct pci_driver pci_compat_driver = {
|
static struct pci_driver pci_compat_driver = {
|
||||||
.name = "compat"
|
.name = "compat"
|
||||||
|
@ -1284,19 +1286,19 @@ static struct pci_driver pci_compat_driver = {
|
||||||
* Returns the appropriate pci_driver structure or %NULL if there is no
|
* Returns the appropriate pci_driver structure or %NULL if there is no
|
||||||
* registered driver for the device.
|
* registered driver for the device.
|
||||||
*/
|
*/
|
||||||
struct pci_driver *
|
struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
|
||||||
pci_dev_driver(const struct pci_dev *dev)
|
|
||||||
{
|
{
|
||||||
if (dev->driver)
|
if (dev->driver)
|
||||||
return dev->driver;
|
return dev->driver;
|
||||||
else {
|
else {
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<=PCI_ROM_RESOURCE; i++)
|
for (i = 0; i <= PCI_ROM_RESOURCE; i++)
|
||||||
if (dev->resource[i].flags & IORESOURCE_BUSY)
|
if (dev->resource[i].flags & IORESOURCE_BUSY)
|
||||||
return &pci_compat_driver;
|
return &pci_compat_driver;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_dev_driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_bus_match - Tell if a PCI device structure has a matching PCI device id structure
|
* 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)
|
||||||
get_device(&dev->dev);
|
get_device(&dev->dev);
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_dev_get);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_dev_put - release a use of the pci device structure
|
* pci_dev_put - release a use of the pci device structure
|
||||||
|
@ -1355,6 +1358,7 @@ void pci_dev_put(struct pci_dev *dev)
|
||||||
if (dev)
|
if (dev)
|
||||||
put_device(&dev->dev);
|
put_device(&dev->dev);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_dev_put);
|
||||||
|
|
||||||
static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
|
static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||||
{
|
{
|
||||||
|
@ -1400,19 +1404,10 @@ struct bus_type pci_bus_type = {
|
||||||
.drv_groups = pci_drv_groups,
|
.drv_groups = pci_drv_groups,
|
||||||
.pm = PCI_PM_OPS_PTR,
|
.pm = PCI_PM_OPS_PTR,
|
||||||
};
|
};
|
||||||
|
EXPORT_SYMBOL(pci_bus_type);
|
||||||
|
|
||||||
static int __init pci_driver_init(void)
|
static int __init pci_driver_init(void)
|
||||||
{
|
{
|
||||||
return bus_register(&pci_bus_type);
|
return bus_register(&pci_bus_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
postcore_initcall(pci_driver_init);
|
postcore_initcall(pci_driver_init);
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(pci_add_dynid);
|
|
||||||
EXPORT_SYMBOL(pci_match_id);
|
|
||||||
EXPORT_SYMBOL(__pci_register_driver);
|
|
||||||
EXPORT_SYMBOL(pci_unregister_driver);
|
|
||||||
EXPORT_SYMBOL(pci_dev_driver);
|
|
||||||
EXPORT_SYMBOL(pci_bus_type);
|
|
||||||
EXPORT_SYMBOL(pci_dev_get);
|
|
||||||
EXPORT_SYMBOL(pci_dev_put);
|
|
||||||
|
|
|
@ -40,8 +40,7 @@ enum smbios_attr_enum {
|
||||||
SMBIOS_ATTR_INSTANCE_SHOW,
|
SMBIOS_ATTR_INSTANCE_SHOW,
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t
|
static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
|
||||||
find_smbios_instance_string(struct pci_dev *pdev, char *buf,
|
|
||||||
enum smbios_attr_enum attribute)
|
enum smbios_attr_enum attribute)
|
||||||
{
|
{
|
||||||
const struct dmi_device *dmi;
|
const struct dmi_device *dmi;
|
||||||
|
@ -74,9 +73,8 @@ find_smbios_instance_string(struct pci_dev *pdev, char *buf,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static umode_t
|
static umode_t smbios_instance_string_exist(struct kobject *kobj,
|
||||||
smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
|
struct attribute *attr, int n)
|
||||||
int n)
|
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
|
@ -88,8 +86,8 @@ smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
|
||||||
S_IRUGO : 0;
|
S_IRUGO : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t smbioslabel_show(struct device *dev,
|
||||||
smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
pdev = to_pci_dev(dev);
|
pdev = to_pci_dev(dev);
|
||||||
|
@ -98,8 +96,7 @@ smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
SMBIOS_ATTR_LABEL_SHOW);
|
SMBIOS_ATTR_LABEL_SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t smbiosinstance_show(struct device *dev,
|
||||||
smbiosinstance_show(struct device *dev,
|
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
|
@ -130,26 +127,22 @@ static struct attribute_group smbios_attr_group = {
|
||||||
.is_visible = smbios_instance_string_exist,
|
.is_visible = smbios_instance_string_exist,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int pci_create_smbiosname_file(struct pci_dev *pdev)
|
||||||
pci_create_smbiosname_file(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group);
|
return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void pci_remove_smbiosname_file(struct pci_dev *pdev)
|
||||||
pci_remove_smbiosname_file(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
|
sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline int
|
static inline int pci_create_smbiosname_file(struct pci_dev *pdev)
|
||||||
pci_create_smbiosname_file(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void pci_remove_smbiosname_file(struct pci_dev *pdev)
|
||||||
pci_remove_smbiosname_file(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -175,8 +168,8 @@ static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
|
||||||
buf[len] = '\n';
|
buf[len] = '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int dsm_get_label(struct device *dev, char *buf,
|
||||||
dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
|
enum acpi_attr_enum attr)
|
||||||
{
|
{
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
union acpi_object *obj, *tmp;
|
union acpi_object *obj, *tmp;
|
||||||
|
@ -212,8 +205,7 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool device_has_dsm(struct device *dev)
|
||||||
device_has_dsm(struct device *dev)
|
|
||||||
{
|
{
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
|
|
||||||
|
@ -225,8 +217,8 @@ device_has_dsm(struct device *dev)
|
||||||
1 << DEVICE_LABEL_DSM);
|
1 << DEVICE_LABEL_DSM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static umode_t
|
static umode_t acpi_index_string_exist(struct kobject *kobj,
|
||||||
acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
|
struct attribute *attr, int n)
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
||||||
|
@ -238,14 +230,14 @@ acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t acpilabel_show(struct device *dev,
|
||||||
acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW);
|
return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t acpiindex_show(struct device *dev,
|
||||||
acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW);
|
return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW);
|
||||||
}
|
}
|
||||||
|
@ -271,33 +263,28 @@ static struct attribute_group acpi_attr_group = {
|
||||||
.is_visible = acpi_index_string_exist,
|
.is_visible = acpi_index_string_exist,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int pci_create_acpi_index_label_files(struct pci_dev *pdev)
|
||||||
pci_create_acpi_index_label_files(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group);
|
return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int pci_remove_acpi_index_label_files(struct pci_dev *pdev)
|
||||||
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group);
|
sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline int
|
static inline int pci_create_acpi_index_label_files(struct pci_dev *pdev)
|
||||||
pci_create_acpi_index_label_files(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int pci_remove_acpi_index_label_files(struct pci_dev *pdev)
|
||||||
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool device_has_dsm(struct device *dev)
|
||||||
device_has_dsm(struct device *dev)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ static int __init pci_stub_init(void)
|
||||||
p = ids;
|
p = ids;
|
||||||
while ((id = strsep(&p, ","))) {
|
while ((id = strsep(&p, ","))) {
|
||||||
unsigned int vendor, device, subvendor = PCI_ANY_ID,
|
unsigned int vendor, device, subvendor = PCI_ANY_ID,
|
||||||
subdevice = PCI_ANY_ID, class=0, class_mask=0;
|
subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
|
||||||
int fields;
|
int fields;
|
||||||
|
|
||||||
if (!strlen(id))
|
if (!strlen(id))
|
||||||
|
|
|
@ -41,8 +41,8 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf) \
|
||||||
{ \
|
{ \
|
||||||
struct pci_dev *pdev; \
|
struct pci_dev *pdev; \
|
||||||
\
|
\
|
||||||
pdev = to_pci_dev (dev); \
|
pdev = to_pci_dev(dev); \
|
||||||
return sprintf (buf, format_string, pdev->field); \
|
return sprintf(buf, format_string, pdev->field); \
|
||||||
} \
|
} \
|
||||||
static DEVICE_ATTR_RO(field)
|
static DEVICE_ATTR_RO(field)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ static ssize_t broken_parity_status_show(struct device *dev,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
return sprintf (buf, "%u\n", pdev->broken_parity_status);
|
return sprintf(buf, "%u\n", pdev->broken_parity_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t broken_parity_status_store(struct device *dev,
|
static ssize_t broken_parity_status_store(struct device *dev,
|
||||||
|
@ -77,10 +77,8 @@ static ssize_t broken_parity_status_store(struct device *dev,
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RW(broken_parity_status);
|
static DEVICE_ATTR_RW(broken_parity_status);
|
||||||
|
|
||||||
static ssize_t pci_dev_show_local_cpu(struct device *dev,
|
static ssize_t pci_dev_show_local_cpu(struct device *dev, int type,
|
||||||
int type,
|
struct device_attribute *attr, char *buf)
|
||||||
struct device_attribute *attr,
|
|
||||||
char *buf)
|
|
||||||
{
|
{
|
||||||
const struct cpumask *mask;
|
const struct cpumask *mask;
|
||||||
int len;
|
int len;
|
||||||
|
@ -117,8 +115,7 @@ static DEVICE_ATTR_RO(local_cpulist);
|
||||||
/*
|
/*
|
||||||
* PCI Bus Class Devices
|
* PCI Bus Class Devices
|
||||||
*/
|
*/
|
||||||
static ssize_t pci_bus_show_cpuaffinity(struct device *dev,
|
static ssize_t pci_bus_show_cpuaffinity(struct device *dev, int type,
|
||||||
int type,
|
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
|
@ -149,11 +146,11 @@ static ssize_t cpulistaffinity_show(struct device *dev,
|
||||||
static DEVICE_ATTR_RO(cpulistaffinity);
|
static DEVICE_ATTR_RO(cpulistaffinity);
|
||||||
|
|
||||||
/* show resources */
|
/* show resources */
|
||||||
static ssize_t
|
static ssize_t resource_show(struct device *dev, struct device_attribute *attr,
|
||||||
resource_show(struct device * dev, struct device_attribute *attr, char * buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev * pci_dev = to_pci_dev(dev);
|
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||||
char * str = buf;
|
char *str = buf;
|
||||||
int i;
|
int i;
|
||||||
int max;
|
int max;
|
||||||
resource_size_t start, end;
|
resource_size_t start, end;
|
||||||
|
@ -166,7 +163,7 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
|
||||||
for (i = 0; i < max; i++) {
|
for (i = 0; i < max; i++) {
|
||||||
struct resource *res = &pci_dev->resource[i];
|
struct resource *res = &pci_dev->resource[i];
|
||||||
pci_resource_to_user(pci_dev, i, res, &start, &end);
|
pci_resource_to_user(pci_dev, i, res, &start, &end);
|
||||||
str += sprintf(str,"0x%016llx 0x%016llx 0x%016llx\n",
|
str += sprintf(str, "0x%016llx 0x%016llx 0x%016llx\n",
|
||||||
(unsigned long long)start,
|
(unsigned long long)start,
|
||||||
(unsigned long long)end,
|
(unsigned long long)end,
|
||||||
(unsigned long long)res->flags);
|
(unsigned long long)res->flags);
|
||||||
|
@ -175,7 +172,8 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(resource);
|
static DEVICE_ATTR_RO(resource);
|
||||||
|
|
||||||
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pci_dev = to_pci_dev(dev);
|
struct pci_dev *pci_dev = to_pci_dev(dev);
|
||||||
|
|
||||||
|
@ -187,9 +185,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(modalias);
|
static DEVICE_ATTR_RO(modalias);
|
||||||
|
|
||||||
static ssize_t enabled_store(struct device *dev,
|
static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
|
||||||
struct device_attribute *attr, const char *buf,
|
const char *buf, size_t count)
|
||||||
size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
@ -213,56 +210,55 @@ static ssize_t enabled_store(struct device *dev,
|
||||||
return result < 0 ? result : count;
|
return result < 0 ? result : count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t enabled_show(struct device *dev,
|
static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
|
||||||
struct device_attribute *attr, char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
|
|
||||||
pdev = to_pci_dev (dev);
|
pdev = to_pci_dev(dev);
|
||||||
return sprintf (buf, "%u\n", atomic_read(&pdev->enable_cnt));
|
return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt));
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RW(enabled);
|
static DEVICE_ATTR_RW(enabled);
|
||||||
|
|
||||||
#ifdef CONFIG_NUMA
|
#ifdef CONFIG_NUMA
|
||||||
static ssize_t
|
static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr,
|
||||||
numa_node_show(struct device *dev, struct device_attribute *attr, char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf (buf, "%d\n", dev->numa_node);
|
return sprintf(buf, "%d\n", dev->numa_node);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(numa_node);
|
static DEVICE_ATTR_RO(numa_node);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t dma_mask_bits_show(struct device *dev,
|
||||||
dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
|
||||||
return sprintf (buf, "%d\n", fls64(pdev->dma_mask));
|
return sprintf(buf, "%d\n", fls64(pdev->dma_mask));
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(dma_mask_bits);
|
static DEVICE_ATTR_RO(dma_mask_bits);
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t consistent_dma_mask_bits_show(struct device *dev,
|
||||||
consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf (buf, "%d\n", fls64(dev->coherent_dma_mask));
|
return sprintf(buf, "%d\n", fls64(dev->coherent_dma_mask));
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(consistent_dma_mask_bits);
|
static DEVICE_ATTR_RO(consistent_dma_mask_bits);
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr,
|
||||||
msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
|
||||||
if (!pdev->subordinate)
|
if (!pdev->subordinate)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return sprintf (buf, "%u\n",
|
return sprintf(buf, "%u\n",
|
||||||
!(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI));
|
!(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
|
||||||
msi_bus_store(struct device *dev, struct device_attribute *attr,
|
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
@ -290,8 +286,8 @@ msi_bus_store(struct device *dev, struct device_attribute *attr,
|
||||||
!!val) {
|
!!val) {
|
||||||
pdev->subordinate->bus_flags ^= PCI_BUS_FLAGS_NO_MSI;
|
pdev->subordinate->bus_flags ^= PCI_BUS_FLAGS_NO_MSI;
|
||||||
|
|
||||||
dev_warn(&pdev->dev, "forced subordinate bus to%s support MSI,"
|
dev_warn(&pdev->dev, "forced subordinate bus to%s support MSI, bad things could happen\n",
|
||||||
" bad things could happen\n", val ? "" : " not");
|
val ? "" : " not");
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -331,9 +327,9 @@ const struct attribute_group *pci_bus_groups[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t dev_rescan_store(struct device *dev,
|
||||||
dev_rescan_store(struct device *dev, struct device_attribute *attr,
|
struct device_attribute *attr, const char *buf,
|
||||||
const char *buf, size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
@ -352,8 +348,7 @@ static struct device_attribute dev_rescan_attr = __ATTR(rescan,
|
||||||
(S_IWUSR|S_IWGRP),
|
(S_IWUSR|S_IWGRP),
|
||||||
NULL, dev_rescan_store);
|
NULL, dev_rescan_store);
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
|
||||||
remove_store(struct device *dev, struct device_attribute *attr,
|
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
@ -369,8 +364,8 @@ static struct device_attribute dev_remove_attr = __ATTR(remove,
|
||||||
(S_IWUSR|S_IWGRP),
|
(S_IWUSR|S_IWGRP),
|
||||||
NULL, remove_store);
|
NULL, remove_store);
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t dev_bus_rescan_store(struct device *dev,
|
||||||
dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
@ -412,7 +407,7 @@ static ssize_t d3cold_allowed_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
return sprintf (buf, "%u\n", pdev->d3cold_allowed);
|
return sprintf(buf, "%u\n", pdev->d3cold_allowed);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RW(d3cold_allowed);
|
static DEVICE_ATTR_RW(d3cold_allowed);
|
||||||
#endif
|
#endif
|
||||||
|
@ -607,8 +602,8 @@ const struct attribute_group *pcibus_groups[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr,
|
||||||
boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
struct pci_dev *vga_dev = vga_default_device();
|
struct pci_dev *vga_dev = vga_default_device();
|
||||||
|
@ -622,22 +617,21 @@ boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
}
|
}
|
||||||
static struct device_attribute vga_attr = __ATTR_RO(boot_vga);
|
static struct device_attribute vga_attr = __ATTR_RO(boot_vga);
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
|
||||||
pci_read_config(struct file *filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj));
|
struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device,
|
||||||
|
kobj));
|
||||||
unsigned int size = 64;
|
unsigned int size = 64;
|
||||||
loff_t init_off = off;
|
loff_t init_off = off;
|
||||||
u8 *data = (u8*) buf;
|
u8 *data = (u8 *) buf;
|
||||||
|
|
||||||
/* Several chips lock up trying to read undefined config space */
|
/* Several chips lock up trying to read undefined config space */
|
||||||
if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0) {
|
if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0)
|
||||||
size = dev->cfg_size;
|
size = dev->cfg_size;
|
||||||
} else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
|
else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
|
||||||
size = 128;
|
size = 128;
|
||||||
}
|
|
||||||
|
|
||||||
if (off > size)
|
if (off > size)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -700,15 +694,15 @@ pci_read_config(struct file *filp, struct kobject *kobj,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t pci_write_config(struct file *filp, struct kobject *kobj,
|
||||||
pci_write_config(struct file* filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj));
|
struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device,
|
||||||
|
kobj));
|
||||||
unsigned int size = count;
|
unsigned int size = count;
|
||||||
loff_t init_off = off;
|
loff_t init_off = off;
|
||||||
u8 *data = (u8*) buf;
|
u8 *data = (u8 *) buf;
|
||||||
|
|
||||||
if (off > dev->cfg_size)
|
if (off > dev->cfg_size)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -762,10 +756,9 @@ pci_write_config(struct file* filp, struct kobject *kobj,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj,
|
||||||
read_vpd_attr(struct file *filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *dev =
|
struct pci_dev *dev =
|
||||||
to_pci_dev(container_of(kobj, struct device, kobj));
|
to_pci_dev(container_of(kobj, struct device, kobj));
|
||||||
|
@ -778,10 +771,9 @@ read_vpd_attr(struct file *filp, struct kobject *kobj,
|
||||||
return pci_read_vpd(dev, off, count, buf);
|
return pci_read_vpd(dev, off, count, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj,
|
||||||
write_vpd_attr(struct file *filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *dev =
|
struct pci_dev *dev =
|
||||||
to_pci_dev(container_of(kobj, struct device, kobj));
|
to_pci_dev(container_of(kobj, struct device, kobj));
|
||||||
|
@ -807,13 +799,11 @@ write_vpd_attr(struct file *filp, struct kobject *kobj,
|
||||||
* Reads 1, 2, or 4 bytes from legacy I/O port space using an arch specific
|
* Reads 1, 2, or 4 bytes from legacy I/O port space using an arch specific
|
||||||
* callback routine (pci_legacy_read).
|
* callback routine (pci_legacy_read).
|
||||||
*/
|
*/
|
||||||
static ssize_t
|
static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj,
|
||||||
pci_read_legacy_io(struct file *filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_bus *bus = to_pci_bus(container_of(kobj,
|
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
|
||||||
struct device,
|
|
||||||
kobj));
|
kobj));
|
||||||
|
|
||||||
/* Only support 1, 2 or 4 byte accesses */
|
/* Only support 1, 2 or 4 byte accesses */
|
||||||
|
@ -835,14 +825,13 @@ pci_read_legacy_io(struct file *filp, struct kobject *kobj,
|
||||||
* Writes 1, 2, or 4 bytes from legacy I/O port space using an arch specific
|
* Writes 1, 2, or 4 bytes from legacy I/O port space using an arch specific
|
||||||
* callback routine (pci_legacy_write).
|
* callback routine (pci_legacy_write).
|
||||||
*/
|
*/
|
||||||
static ssize_t
|
static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj,
|
||||||
pci_write_legacy_io(struct file *filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_bus *bus = to_pci_bus(container_of(kobj,
|
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
|
||||||
struct device,
|
|
||||||
kobj));
|
kobj));
|
||||||
|
|
||||||
/* Only support 1, 2 or 4 byte accesses */
|
/* Only support 1, 2 or 4 byte accesses */
|
||||||
if (count != 1 && count != 2 && count != 4)
|
if (count != 1 && count != 2 && count != 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -861,13 +850,11 @@ pci_write_legacy_io(struct file *filp, struct kobject *kobj,
|
||||||
* legacy memory space (first meg of bus space) into application virtual
|
* legacy memory space (first meg of bus space) into application virtual
|
||||||
* memory space.
|
* memory space.
|
||||||
*/
|
*/
|
||||||
static int
|
static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
|
||||||
pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
|
|
||||||
struct bin_attribute *attr,
|
struct bin_attribute *attr,
|
||||||
struct vm_area_struct *vma)
|
struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
struct pci_bus *bus = to_pci_bus(container_of(kobj,
|
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
|
||||||
struct device,
|
|
||||||
kobj));
|
kobj));
|
||||||
|
|
||||||
return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem);
|
return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem);
|
||||||
|
@ -884,13 +871,11 @@ pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
|
||||||
* legacy IO space (first meg of bus space) into application virtual
|
* legacy IO space (first meg of bus space) into application virtual
|
||||||
* memory space. Returns -ENOSYS if the operation isn't supported
|
* memory space. Returns -ENOSYS if the operation isn't supported
|
||||||
*/
|
*/
|
||||||
static int
|
static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
|
||||||
pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
|
|
||||||
struct bin_attribute *attr,
|
struct bin_attribute *attr,
|
||||||
struct vm_area_struct *vma)
|
struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
struct pci_bus *bus = to_pci_bus(container_of(kobj,
|
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
|
||||||
struct device,
|
|
||||||
kobj));
|
kobj));
|
||||||
|
|
||||||
return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io);
|
return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io);
|
||||||
|
@ -903,10 +888,9 @@ pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
|
||||||
*
|
*
|
||||||
* Stub implementation. Can be overridden by arch if necessary.
|
* Stub implementation. Can be overridden by arch if necessary.
|
||||||
*/
|
*/
|
||||||
void __weak
|
void __weak pci_adjust_legacy_attr(struct pci_bus *b,
|
||||||
pci_adjust_legacy_attr(struct pci_bus *b, enum pci_mmap_state mmap_type)
|
enum pci_mmap_state mmap_type)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -961,8 +945,7 @@ legacy_io_err:
|
||||||
kfree(b->legacy_io);
|
kfree(b->legacy_io);
|
||||||
b->legacy_io = NULL;
|
b->legacy_io = NULL;
|
||||||
kzalloc_err:
|
kzalloc_err:
|
||||||
printk(KERN_WARNING "pci: warning: could not create legacy I/O port "
|
printk(KERN_WARNING "pci: warning: could not create legacy I/O port and ISA memory resources to sysfs\n");
|
||||||
"and ISA memory resources to sysfs\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,8 +988,7 @@ int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma,
|
||||||
*
|
*
|
||||||
* Use the regular PCI mapping routines to map a PCI resource into userspace.
|
* Use the regular PCI mapping routines to map a PCI resource into userspace.
|
||||||
*/
|
*/
|
||||||
static int
|
static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||||
pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
|
||||||
struct vm_area_struct *vma, int write_combine)
|
struct vm_area_struct *vma, int write_combine)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(container_of(kobj,
|
struct pci_dev *pdev = to_pci_dev(container_of(kobj,
|
||||||
|
@ -1023,8 +1005,7 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) {
|
if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) {
|
||||||
WARN(1, "process \"%s\" tried to map 0x%08lx bytes "
|
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",
|
||||||
"at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n",
|
|
||||||
current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff,
|
current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff,
|
||||||
pci_name(pdev), i,
|
pci_name(pdev), i,
|
||||||
(u64)pci_resource_start(pdev, i),
|
(u64)pci_resource_start(pdev, i),
|
||||||
|
@ -1046,24 +1027,21 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||||
return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
|
return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
|
||||||
pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
|
|
||||||
struct bin_attribute *attr,
|
struct bin_attribute *attr,
|
||||||
struct vm_area_struct *vma)
|
struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
return pci_mmap_resource(kobj, attr, vma, 0);
|
return pci_mmap_resource(kobj, attr, vma, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
|
||||||
pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
|
|
||||||
struct bin_attribute *attr,
|
struct bin_attribute *attr,
|
||||||
struct vm_area_struct *vma)
|
struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
return pci_mmap_resource(kobj, attr, vma, 1);
|
return pci_mmap_resource(kobj, attr, vma, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
|
||||||
pci_resource_io(struct file *filp, struct kobject *kobj,
|
|
||||||
struct bin_attribute *attr, char *buf,
|
struct bin_attribute *attr, char *buf,
|
||||||
loff_t off, size_t count, bool write)
|
loff_t off, size_t count, bool write)
|
||||||
{
|
{
|
||||||
|
@ -1110,16 +1088,14 @@ pci_resource_io(struct file *filp, struct kobject *kobj,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
|
||||||
pci_read_resource_io(struct file *filp, struct kobject *kobj,
|
|
||||||
struct bin_attribute *attr, char *buf,
|
struct bin_attribute *attr, char *buf,
|
||||||
loff_t off, size_t count)
|
loff_t off, size_t count)
|
||||||
{
|
{
|
||||||
return pci_resource_io(filp, kobj, attr, buf, off, count, false);
|
return pci_resource_io(filp, kobj, attr, buf, off, count, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj,
|
||||||
pci_write_resource_io(struct file *filp, struct kobject *kobj,
|
|
||||||
struct bin_attribute *attr, char *buf,
|
struct bin_attribute *attr, char *buf,
|
||||||
loff_t off, size_t count)
|
loff_t off, size_t count)
|
||||||
{
|
{
|
||||||
|
@ -1133,8 +1109,7 @@ pci_write_resource_io(struct file *filp, struct kobject *kobj,
|
||||||
* If we created resource files for @pdev, remove them from sysfs and
|
* If we created resource files for @pdev, remove them from sysfs and
|
||||||
* free their resources.
|
* free their resources.
|
||||||
*/
|
*/
|
||||||
static void
|
static void pci_remove_resource_files(struct pci_dev *pdev)
|
||||||
pci_remove_resource_files(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1237,10 +1212,9 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
|
||||||
*
|
*
|
||||||
* writing anything except 0 enables it
|
* writing anything except 0 enables it
|
||||||
*/
|
*/
|
||||||
static ssize_t
|
static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj,
|
||||||
pci_write_rom(struct file *filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
|
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
|
||||||
|
|
||||||
|
@ -1264,10 +1238,9 @@ pci_write_rom(struct file *filp, struct kobject *kobj,
|
||||||
* Put @count bytes starting at @off into @buf from the ROM in the PCI
|
* Put @count bytes starting at @off into @buf from the ROM in the PCI
|
||||||
* device corresponding to @kobj.
|
* device corresponding to @kobj.
|
||||||
*/
|
*/
|
||||||
static ssize_t
|
static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj,
|
||||||
pci_read_rom(struct file *filp, struct kobject *kobj,
|
struct bin_attribute *bin_attr, char *buf,
|
||||||
struct bin_attribute *bin_attr,
|
loff_t off, size_t count)
|
||||||
char *buf, loff_t off, size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
|
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
|
||||||
void __iomem *rom;
|
void __iomem *rom;
|
||||||
|
@ -1313,9 +1286,8 @@ static struct bin_attribute pcie_config_attr = {
|
||||||
.write = pci_write_config,
|
.write = pci_write_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t reset_store(struct device *dev,
|
static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
|
||||||
struct device_attribute *attr, const char *buf,
|
const char *buf, size_t count)
|
||||||
size_t count)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(dev);
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
@ -1382,7 +1354,7 @@ error:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
|
int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
int rom_size = 0;
|
int rom_size = 0;
|
||||||
|
@ -1520,7 +1492,6 @@ static int __init pci_sysfs_init(void)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
late_initcall(pci_sysfs_init);
|
late_initcall(pci_sysfs_init);
|
||||||
|
|
||||||
static struct attribute *pci_dev_dev_attrs[] = {
|
static struct attribute *pci_dev_dev_attrs[] = {
|
||||||
|
|
|
@ -114,7 +114,7 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
|
||||||
max = bus->busn_res.end;
|
max = bus->busn_res.end;
|
||||||
list_for_each_entry(tmp, &bus->children, node) {
|
list_for_each_entry(tmp, &bus->children, node) {
|
||||||
n = pci_bus_max_busnr(tmp);
|
n = pci_bus_max_busnr(tmp);
|
||||||
if(n > max)
|
if (n > max)
|
||||||
max = n;
|
max = n;
|
||||||
}
|
}
|
||||||
return max;
|
return max;
|
||||||
|
@ -226,6 +226,7 @@ int pci_find_capability(struct pci_dev *dev, int cap)
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_find_capability);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_bus_find_capability - query for devices' capabilities
|
* 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)
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_bus_find_capability);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_find_next_ext_capability - Find an extended capability
|
* pci_find_next_ext_capability - Find an extended capability
|
||||||
|
@ -403,8 +405,8 @@ EXPORT_SYMBOL_GPL(pci_find_ht_capability);
|
||||||
* For given resource region of given device, return the resource
|
* For given resource region of given device, return the resource
|
||||||
* region of parent bus the given region is contained in.
|
* region of parent bus the given region is contained in.
|
||||||
*/
|
*/
|
||||||
struct resource *
|
struct resource *pci_find_parent_resource(const struct pci_dev *dev,
|
||||||
pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
const struct pci_bus *bus = dev->bus;
|
const struct pci_bus *bus = dev->bus;
|
||||||
struct resource *r;
|
struct resource *r;
|
||||||
|
@ -436,6 +438,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_find_parent_resource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_wait_for_pending - wait for @mask bit(s) to clear in status word @pos
|
* 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)
|
||||||
* Restore the BAR values for a given device, so as to make it
|
* Restore the BAR values for a given device, so as to make it
|
||||||
* accessible by its driver.
|
* accessible by its driver.
|
||||||
*/
|
*/
|
||||||
static void
|
static void pci_restore_bars(struct pci_dev *dev)
|
||||||
pci_restore_bars(struct pci_dev *dev)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -553,8 +555,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
|
||||||
*/
|
*/
|
||||||
if (state != PCI_D0 && dev->current_state <= PCI_D3cold
|
if (state != PCI_D0 && dev->current_state <= PCI_D3cold
|
||||||
&& dev->current_state > state) {
|
&& dev->current_state > state) {
|
||||||
dev_err(&dev->dev, "invalid power transition "
|
dev_err(&dev->dev, "invalid power transition (from state %d to %d)\n",
|
||||||
"(from state %d to %d)\n", dev->current_state, state);
|
dev->current_state, state);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,8 +603,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
|
||||||
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
|
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
|
||||||
dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
|
dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
|
||||||
if (dev->current_state != state && printk_ratelimit())
|
if (dev->current_state != state && printk_ratelimit())
|
||||||
dev_info(&dev->dev, "Refused to change power state, "
|
dev_info(&dev->dev, "Refused to change power state, currently in D%d\n",
|
||||||
"currently in D%d\n", dev->current_state);
|
dev->current_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT
|
* 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)
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_set_power_state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_choose_state - Choose the power state of a PCI device
|
* 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)
|
||||||
}
|
}
|
||||||
return PCI_D0;
|
return PCI_D0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(pci_choose_state);
|
EXPORT_SYMBOL(pci_choose_state);
|
||||||
|
|
||||||
#define PCI_EXP_SAVE_REGS 7
|
#define PCI_EXP_SAVE_REGS 7
|
||||||
|
|
||||||
|
|
||||||
static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev,
|
static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev,
|
||||||
u16 cap, bool extended)
|
u16 cap, bool extended)
|
||||||
{
|
{
|
||||||
|
@ -1001,8 +1002,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
|
||||||
* pci_save_state - save the PCI configuration space of a device before suspending
|
* pci_save_state - save the PCI configuration space of a device before suspending
|
||||||
* @dev: - PCI device that we're dealing with
|
* @dev: - PCI device that we're dealing with
|
||||||
*/
|
*/
|
||||||
int
|
int pci_save_state(struct pci_dev *dev)
|
||||||
pci_save_state(struct pci_dev *dev)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
/* XXX: 100% dword access ok here? */
|
/* XXX: 100% dword access ok here? */
|
||||||
|
@ -1017,6 +1017,7 @@ pci_save_state(struct pci_dev *dev)
|
||||||
return i;
|
return i;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_save_state);
|
||||||
|
|
||||||
static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
|
static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
|
||||||
u32 saved_val, int retry)
|
u32 saved_val, int retry)
|
||||||
|
@ -1028,8 +1029,8 @@ static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
dev_dbg(&pdev->dev, "restoring config space at offset "
|
dev_dbg(&pdev->dev, "restoring config space at offset %#x (was %#x, writing %#x)\n",
|
||||||
"%#x (was %#x, writing %#x)\n", offset, val, saved_val);
|
offset, val, saved_val);
|
||||||
pci_write_config_dword(pdev, offset, saved_val);
|
pci_write_config_dword(pdev, offset, saved_val);
|
||||||
if (retry-- <= 0)
|
if (retry-- <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1087,6 +1088,7 @@ void pci_restore_state(struct pci_dev *dev)
|
||||||
|
|
||||||
dev->state_saved = false;
|
dev->state_saved = false;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_restore_state);
|
||||||
|
|
||||||
struct pci_saved_state {
|
struct pci_saved_state {
|
||||||
u32 config_space[16];
|
u32 config_space[16];
|
||||||
|
@ -1231,6 +1233,7 @@ int pci_reenable_device(struct pci_dev *dev)
|
||||||
return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1);
|
return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_reenable_device);
|
||||||
|
|
||||||
static void pci_enable_bridge(struct pci_dev *dev)
|
static void pci_enable_bridge(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
|
@ -1305,6 +1308,7 @@ int pci_enable_device_io(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
return pci_enable_device_flags(dev, IORESOURCE_IO);
|
return pci_enable_device_flags(dev, IORESOURCE_IO);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_enable_device_io);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_enable_device_mem - Initialize a device for use with Memory space
|
* 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)
|
||||||
{
|
{
|
||||||
return pci_enable_device_flags(dev, IORESOURCE_MEM);
|
return pci_enable_device_flags(dev, IORESOURCE_MEM);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_enable_device_mem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_enable_device - Initialize device before it's used by a driver.
|
* pci_enable_device - Initialize device before it's used by a driver.
|
||||||
|
@ -1334,6 +1339,7 @@ int pci_enable_device(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
return pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO);
|
return pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_enable_device);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Managed PCI resources. This manages device on/off, intx/msi/msix
|
* Managed PCI resources. This manages device on/off, intx/msi/msix
|
||||||
|
@ -1416,6 +1422,7 @@ int pcim_enable_device(struct pci_dev *pdev)
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pcim_enable_device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pcim_pin_device - Pin managed PCI device
|
* pcim_pin_device - Pin managed PCI device
|
||||||
|
@ -1434,6 +1441,7 @@ void pcim_pin_device(struct pci_dev *pdev)
|
||||||
if (dr)
|
if (dr)
|
||||||
dr->pinned = 1;
|
dr->pinned = 1;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pcim_pin_device);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pcibios_add_device - provide arch specific hooks when adding device dev
|
* pcibios_add_device - provide arch specific hooks when adding device dev
|
||||||
|
@ -1443,7 +1451,7 @@ void pcim_pin_device(struct pci_dev *pdev)
|
||||||
* devices are added. This is the default implementation. Architecture
|
* devices are added. This is the default implementation. Architecture
|
||||||
* implementations can override this.
|
* implementations can override this.
|
||||||
*/
|
*/
|
||||||
int __weak pcibios_add_device (struct pci_dev *dev)
|
int __weak pcibios_add_device(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1515,8 +1523,7 @@ void pci_disable_enabled_device(struct pci_dev *dev)
|
||||||
* Note we don't actually disable the device until all callers of
|
* Note we don't actually disable the device until all callers of
|
||||||
* pci_enable_device() have called pci_disable_device().
|
* pci_enable_device() have called pci_disable_device().
|
||||||
*/
|
*/
|
||||||
void
|
void pci_disable_device(struct pci_dev *dev)
|
||||||
pci_disable_device(struct pci_dev *dev)
|
|
||||||
{
|
{
|
||||||
struct pci_devres *dr;
|
struct pci_devres *dr;
|
||||||
|
|
||||||
|
@ -1534,6 +1541,7 @@ pci_disable_device(struct pci_dev *dev)
|
||||||
|
|
||||||
dev->is_busmaster = 0;
|
dev->is_busmaster = 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_disable_device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pcibios_set_pcie_reset_state - set reset state for device dev
|
* 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)
|
||||||
{
|
{
|
||||||
return pcibios_set_pcie_reset_state(dev, state);
|
return pcibios_set_pcie_reset_state(dev, state);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_check_pme_status - Check if given device has generated PME.
|
* 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)
|
||||||
|
|
||||||
return !!(dev->pme_support & (1 << state));
|
return !!(dev->pme_support & (1 << state));
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_pme_capable);
|
||||||
|
|
||||||
static void pci_pme_list_scan(struct work_struct *work)
|
static void pci_pme_list_scan(struct work_struct *work)
|
||||||
{
|
{
|
||||||
|
@ -1745,6 +1755,7 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
|
||||||
|
|
||||||
dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled");
|
dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_pme_active);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __pci_enable_wake - enable PCI device as wakeup event source
|
* __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)
|
||||||
pci_enable_wake(dev, PCI_D3cold, enable) :
|
pci_enable_wake(dev, PCI_D3cold, enable) :
|
||||||
pci_enable_wake(dev, PCI_D3hot, enable);
|
pci_enable_wake(dev, PCI_D3hot, enable);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_wake_from_d3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_target_state - find an appropriate low power state for a given PCI dev
|
* 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)
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_prepare_to_sleep);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_back_from_sleep - turn PCI device on during system-wide transition into working state
|
* 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)
|
||||||
pci_enable_wake(dev, PCI_D0, false);
|
pci_enable_wake(dev, PCI_D0, false);
|
||||||
return pci_set_power_state(dev, PCI_D0);
|
return pci_set_power_state(dev, PCI_D0);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_back_from_sleep);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_finish_runtime_suspend - Carry out PCI-specific part of runtime suspend.
|
* 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)
|
||||||
return (((pin - 1) + slot) % 4) + 1;
|
return (((pin - 1) + slot) % 4) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
|
||||||
pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
|
|
||||||
{
|
{
|
||||||
u8 pin;
|
u8 pin;
|
||||||
|
|
||||||
|
@ -2478,6 +2491,7 @@ void pci_release_region(struct pci_dev *pdev, int bar)
|
||||||
if (dr)
|
if (dr)
|
||||||
dr->region_mask &= ~(1 << bar);
|
dr->region_mask &= ~(1 << bar);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_release_region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __pci_request_region - Reserved PCI I/O and memory resource
|
* __pci_request_region - Reserved PCI I/O and memory resource
|
||||||
|
@ -2498,8 +2512,8 @@ void pci_release_region(struct pci_dev *pdev, int bar)
|
||||||
* Returns 0 on success, or %EBUSY on error. A warning
|
* Returns 0 on success, or %EBUSY on error. A warning
|
||||||
* message is also printed on failure.
|
* message is also printed on failure.
|
||||||
*/
|
*/
|
||||||
static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name,
|
static int __pci_request_region(struct pci_dev *pdev, int bar,
|
||||||
int exclusive)
|
const char *res_name, int exclusive)
|
||||||
{
|
{
|
||||||
struct pci_devres *dr;
|
struct pci_devres *dr;
|
||||||
|
|
||||||
|
@ -2510,8 +2524,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
|
||||||
if (!request_region(pci_resource_start(pdev, bar),
|
if (!request_region(pci_resource_start(pdev, bar),
|
||||||
pci_resource_len(pdev, bar), res_name))
|
pci_resource_len(pdev, bar), res_name))
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
} else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
|
||||||
else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
|
|
||||||
if (!__request_mem_region(pci_resource_start(pdev, bar),
|
if (!__request_mem_region(pci_resource_start(pdev, bar),
|
||||||
pci_resource_len(pdev, bar), res_name,
|
pci_resource_len(pdev, bar), res_name,
|
||||||
exclusive))
|
exclusive))
|
||||||
|
@ -2548,6 +2561,7 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
|
||||||
{
|
{
|
||||||
return __pci_request_region(pdev, bar, res_name, 0);
|
return __pci_request_region(pdev, bar, res_name, 0);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_request_region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_request_region_exclusive - Reserved PCI I/O and memory resource
|
* 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)
|
||||||
* explicitly not allowed to map the resource via /dev/mem or
|
* explicitly not allowed to map the resource via /dev/mem or
|
||||||
* sysfs.
|
* sysfs.
|
||||||
*/
|
*/
|
||||||
int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
|
int pci_request_region_exclusive(struct pci_dev *pdev, int bar,
|
||||||
|
const char *res_name)
|
||||||
{
|
{
|
||||||
return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
|
return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_request_region_exclusive);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_release_selected_regions - Release selected PCI I/O and memory resources
|
* pci_release_selected_regions - Release selected PCI I/O and memory resources
|
||||||
* @pdev: PCI device whose resources were previously reserved
|
* @pdev: PCI device whose resources were previously reserved
|
||||||
|
@ -2587,6 +2604,7 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars)
|
||||||
if (bars & (1 << i))
|
if (bars & (1 << i))
|
||||||
pci_release_region(pdev, i);
|
pci_release_region(pdev, i);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_release_selected_regions);
|
||||||
|
|
||||||
static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
|
static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
|
||||||
const char *res_name, int excl)
|
const char *res_name, int excl)
|
||||||
|
@ -2600,7 +2618,7 @@ static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
while(--i >= 0)
|
while (--i >= 0)
|
||||||
if (bars & (1 << i))
|
if (bars & (1 << i))
|
||||||
pci_release_region(pdev, i);
|
pci_release_region(pdev, i);
|
||||||
|
|
||||||
|
@ -2619,13 +2637,15 @@ int pci_request_selected_regions(struct pci_dev *pdev, int bars,
|
||||||
{
|
{
|
||||||
return __pci_request_selected_regions(pdev, bars, res_name, 0);
|
return __pci_request_selected_regions(pdev, bars, res_name, 0);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_request_selected_regions);
|
||||||
|
|
||||||
int pci_request_selected_regions_exclusive(struct pci_dev *pdev,
|
int pci_request_selected_regions_exclusive(struct pci_dev *pdev, int bars,
|
||||||
int bars, const char *res_name)
|
const char *res_name)
|
||||||
{
|
{
|
||||||
return __pci_request_selected_regions(pdev, bars, res_name,
|
return __pci_request_selected_regions(pdev, bars, res_name,
|
||||||
IORESOURCE_EXCLUSIVE);
|
IORESOURCE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_request_selected_regions_exclusive);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_release_regions - Release reserved PCI I/O and memory resources
|
* pci_release_regions - Release reserved PCI I/O and memory resources
|
||||||
|
@ -2640,6 +2660,7 @@ void pci_release_regions(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
pci_release_selected_regions(pdev, (1 << 6) - 1);
|
pci_release_selected_regions(pdev, (1 << 6) - 1);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_release_regions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_request_regions - Reserved PCI I/O and memory resources
|
* 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)
|
||||||
{
|
{
|
||||||
return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
|
return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_request_regions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_request_regions_exclusive - Reserved PCI I/O and memory resources
|
* 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)
|
||||||
return pci_request_selected_regions_exclusive(pdev,
|
return pci_request_selected_regions_exclusive(pdev,
|
||||||
((1 << 6) - 1), res_name);
|
((1 << 6) - 1), res_name);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_request_regions_exclusive);
|
||||||
|
|
||||||
static void __pci_set_master(struct pci_dev *dev, bool enable)
|
static void __pci_set_master(struct pci_dev *dev, bool enable)
|
||||||
{
|
{
|
||||||
|
@ -2749,6 +2772,7 @@ void pci_set_master(struct pci_dev *dev)
|
||||||
__pci_set_master(dev, true);
|
__pci_set_master(dev, true);
|
||||||
pcibios_set_master(dev);
|
pcibios_set_master(dev);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_set_master);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_clear_master - disables bus-mastering for device dev
|
* pci_clear_master - disables bus-mastering for device dev
|
||||||
|
@ -2758,6 +2782,7 @@ void pci_clear_master(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
__pci_set_master(dev, false);
|
__pci_set_master(dev, false);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_clear_master);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed
|
* 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)
|
||||||
if (cacheline_size == pci_cache_line_size)
|
if (cacheline_size == pci_cache_line_size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not "
|
dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not supported\n",
|
||||||
"supported\n", pci_cache_line_size << 2);
|
pci_cache_line_size << 2);
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pci_set_cacheline_size);
|
EXPORT_SYMBOL_GPL(pci_set_cacheline_size);
|
||||||
|
|
||||||
#ifdef PCI_DISABLE_MWI
|
|
||||||
int pci_set_mwi(struct pci_dev *dev)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pci_try_set_mwi(struct pci_dev *dev)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void pci_clear_mwi(struct pci_dev *dev)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_set_mwi - enables memory-write-invalidate PCI transaction
|
* pci_set_mwi - enables memory-write-invalidate PCI transaction
|
||||||
* @dev: the PCI device for which MWI is enabled
|
* @dev: the PCI device for which MWI is enabled
|
||||||
|
@ -2822,9 +2830,11 @@ void pci_clear_mwi(struct pci_dev *dev)
|
||||||
*
|
*
|
||||||
* RETURNS: An appropriate -ERRNO error value on error, or zero for success.
|
* RETURNS: An appropriate -ERRNO error value on error, or zero for success.
|
||||||
*/
|
*/
|
||||||
int
|
int pci_set_mwi(struct pci_dev *dev)
|
||||||
pci_set_mwi(struct pci_dev *dev)
|
|
||||||
{
|
{
|
||||||
|
#ifdef PCI_DISABLE_MWI
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
int rc;
|
int rc;
|
||||||
u16 cmd;
|
u16 cmd;
|
||||||
|
|
||||||
|
@ -2833,14 +2843,15 @@ pci_set_mwi(struct pci_dev *dev)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
||||||
if (! (cmd & PCI_COMMAND_INVALIDATE)) {
|
if (!(cmd & PCI_COMMAND_INVALIDATE)) {
|
||||||
dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n");
|
dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n");
|
||||||
cmd |= PCI_COMMAND_INVALIDATE;
|
cmd |= PCI_COMMAND_INVALIDATE;
|
||||||
pci_write_config_word(dev, PCI_COMMAND, cmd);
|
pci_write_config_word(dev, PCI_COMMAND, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_set_mwi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_try_set_mwi - enables memory-write-invalidate PCI transaction
|
* pci_try_set_mwi - enables memory-write-invalidate PCI transaction
|
||||||
|
@ -2853,9 +2864,13 @@ pci_set_mwi(struct pci_dev *dev)
|
||||||
*/
|
*/
|
||||||
int pci_try_set_mwi(struct pci_dev *dev)
|
int pci_try_set_mwi(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
int rc = pci_set_mwi(dev);
|
#ifdef PCI_DISABLE_MWI
|
||||||
return rc;
|
return 0;
|
||||||
|
#else
|
||||||
|
return pci_set_mwi(dev);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_try_set_mwi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_clear_mwi - disables Memory-Write-Invalidate for device dev
|
* pci_clear_mwi - disables Memory-Write-Invalidate for device dev
|
||||||
|
@ -2863,9 +2878,9 @@ int pci_try_set_mwi(struct pci_dev *dev)
|
||||||
*
|
*
|
||||||
* Disables PCI Memory-Write-Invalidate transaction on the device
|
* Disables PCI Memory-Write-Invalidate transaction on the device
|
||||||
*/
|
*/
|
||||||
void
|
void pci_clear_mwi(struct pci_dev *dev)
|
||||||
pci_clear_mwi(struct pci_dev *dev)
|
|
||||||
{
|
{
|
||||||
|
#ifndef PCI_DISABLE_MWI
|
||||||
u16 cmd;
|
u16 cmd;
|
||||||
|
|
||||||
pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
||||||
|
@ -2873,8 +2888,9 @@ pci_clear_mwi(struct pci_dev *dev)
|
||||||
cmd &= ~PCI_COMMAND_INVALIDATE;
|
cmd &= ~PCI_COMMAND_INVALIDATE;
|
||||||
pci_write_config_word(dev, PCI_COMMAND, cmd);
|
pci_write_config_word(dev, PCI_COMMAND, cmd);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* ! PCI_DISABLE_MWI */
|
EXPORT_SYMBOL(pci_clear_mwi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_intx - enables/disables PCI INTx for device dev
|
* pci_intx - enables/disables PCI INTx for device dev
|
||||||
|
@ -2883,18 +2899,16 @@ pci_clear_mwi(struct pci_dev *dev)
|
||||||
*
|
*
|
||||||
* Enables/disables PCI INTx for device dev
|
* Enables/disables PCI INTx for device dev
|
||||||
*/
|
*/
|
||||||
void
|
void pci_intx(struct pci_dev *pdev, int enable)
|
||||||
pci_intx(struct pci_dev *pdev, int enable)
|
|
||||||
{
|
{
|
||||||
u16 pci_command, new;
|
u16 pci_command, new;
|
||||||
|
|
||||||
pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
|
pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
|
||||||
|
|
||||||
if (enable) {
|
if (enable)
|
||||||
new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
|
new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
|
||||||
} else {
|
else
|
||||||
new = pci_command | PCI_COMMAND_INTX_DISABLE;
|
new = pci_command | PCI_COMMAND_INTX_DISABLE;
|
||||||
}
|
|
||||||
|
|
||||||
if (new != pci_command) {
|
if (new != pci_command) {
|
||||||
struct pci_devres *dr;
|
struct pci_devres *dr;
|
||||||
|
@ -2908,6 +2922,7 @@ pci_intx(struct pci_dev *pdev, int enable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_intx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_intx_mask_supported - probe for INTx masking support
|
* pci_intx_mask_supported - probe for INTx masking support
|
||||||
|
@ -2937,8 +2952,8 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
|
||||||
* go ahead and check it.
|
* go ahead and check it.
|
||||||
*/
|
*/
|
||||||
if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) {
|
if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) {
|
||||||
dev_err(&dev->dev, "Command register changed from "
|
dev_err(&dev->dev, "Command register changed from 0x%x to 0x%x: driver or hardware bug?\n",
|
||||||
"0x%x to 0x%x: driver or hardware bug?\n", orig, new);
|
orig, new);
|
||||||
} else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) {
|
} else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) {
|
||||||
mask_supported = true;
|
mask_supported = true;
|
||||||
pci_write_config_word(dev, PCI_COMMAND, orig);
|
pci_write_config_word(dev, PCI_COMMAND, orig);
|
||||||
|
@ -3124,8 +3139,7 @@ static int pci_af_flr(struct pci_dev *dev, int probe)
|
||||||
if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP))
|
if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP))
|
||||||
goto clear;
|
goto clear;
|
||||||
|
|
||||||
dev_err(&dev->dev, "transaction is not cleared; "
|
dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
|
||||||
"proceeding with reset anyway\n");
|
|
||||||
|
|
||||||
clear:
|
clear:
|
||||||
pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR);
|
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)
|
||||||
bars |= (1 << i);
|
bars |= (1 << i);
|
||||||
return bars;
|
return bars;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_select_bars);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_resource_bar - get position of the BAR associated with a resource
|
* pci_resource_bar - get position of the BAR associated with a resource
|
||||||
|
@ -4251,11 +4266,10 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
|
||||||
bus == dev->bus->number &&
|
bus == dev->bus->number &&
|
||||||
slot == PCI_SLOT(dev->devfn) &&
|
slot == PCI_SLOT(dev->devfn) &&
|
||||||
func == PCI_FUNC(dev->devfn)) {
|
func == PCI_FUNC(dev->devfn)) {
|
||||||
if (align_order == -1) {
|
if (align_order == -1)
|
||||||
align = PAGE_SIZE;
|
align = PAGE_SIZE;
|
||||||
} else {
|
else
|
||||||
align = 1 << align_order;
|
align = 1 << align_order;
|
||||||
}
|
|
||||||
/* Found */
|
/* Found */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4373,7 +4387,6 @@ static int __init pci_resource_alignment_sysfs_init(void)
|
||||||
return bus_create_file(&pci_bus_type,
|
return bus_create_file(&pci_bus_type,
|
||||||
&bus_attr_resource_alignment);
|
&bus_attr_resource_alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
late_initcall(pci_resource_alignment_sysfs_init);
|
late_initcall(pci_resource_alignment_sysfs_init);
|
||||||
|
|
||||||
static void pci_no_domains(void)
|
static void pci_no_domains(void)
|
||||||
|
@ -4452,41 +4465,3 @@ static int __init pci_setup(char *str)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
early_param("pci", pci_setup);
|
early_param("pci", pci_setup);
|
||||||
|
|
||||||
EXPORT_SYMBOL(pci_reenable_device);
|
|
||||||
EXPORT_SYMBOL(pci_enable_device_io);
|
|
||||||
EXPORT_SYMBOL(pci_enable_device_mem);
|
|
||||||
EXPORT_SYMBOL(pci_enable_device);
|
|
||||||
EXPORT_SYMBOL(pcim_enable_device);
|
|
||||||
EXPORT_SYMBOL(pcim_pin_device);
|
|
||||||
EXPORT_SYMBOL(pci_disable_device);
|
|
||||||
EXPORT_SYMBOL(pci_find_capability);
|
|
||||||
EXPORT_SYMBOL(pci_bus_find_capability);
|
|
||||||
EXPORT_SYMBOL(pci_release_regions);
|
|
||||||
EXPORT_SYMBOL(pci_request_regions);
|
|
||||||
EXPORT_SYMBOL(pci_request_regions_exclusive);
|
|
||||||
EXPORT_SYMBOL(pci_release_region);
|
|
||||||
EXPORT_SYMBOL(pci_request_region);
|
|
||||||
EXPORT_SYMBOL(pci_request_region_exclusive);
|
|
||||||
EXPORT_SYMBOL(pci_release_selected_regions);
|
|
||||||
EXPORT_SYMBOL(pci_request_selected_regions);
|
|
||||||
EXPORT_SYMBOL(pci_request_selected_regions_exclusive);
|
|
||||||
EXPORT_SYMBOL(pci_set_master);
|
|
||||||
EXPORT_SYMBOL(pci_clear_master);
|
|
||||||
EXPORT_SYMBOL(pci_set_mwi);
|
|
||||||
EXPORT_SYMBOL(pci_try_set_mwi);
|
|
||||||
EXPORT_SYMBOL(pci_clear_mwi);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_intx);
|
|
||||||
EXPORT_SYMBOL(pci_assign_resource);
|
|
||||||
EXPORT_SYMBOL(pci_find_parent_resource);
|
|
||||||
EXPORT_SYMBOL(pci_select_bars);
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(pci_set_power_state);
|
|
||||||
EXPORT_SYMBOL(pci_save_state);
|
|
||||||
EXPORT_SYMBOL(pci_restore_state);
|
|
||||||
EXPORT_SYMBOL(pci_pme_capable);
|
|
||||||
EXPORT_SYMBOL(pci_pme_active);
|
|
||||||
EXPORT_SYMBOL(pci_wake_from_d3);
|
|
||||||
EXPORT_SYMBOL(pci_prepare_to_sleep);
|
|
||||||
EXPORT_SYMBOL(pci_back_from_sleep);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
|
|
||||||
|
|
|
@ -397,16 +397,14 @@ static int aer_inject(struct aer_error_inj *einj)
|
||||||
if (!aer_mask_override && einj->cor_status &&
|
if (!aer_mask_override && einj->cor_status &&
|
||||||
!(einj->cor_status & ~cor_mask)) {
|
!(einj->cor_status & ~cor_mask)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
printk(KERN_WARNING "The correctable error(s) is masked "
|
printk(KERN_WARNING "The correctable error(s) is masked by device\n");
|
||||||
"by device\n");
|
|
||||||
spin_unlock_irqrestore(&inject_lock, flags);
|
spin_unlock_irqrestore(&inject_lock, flags);
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
if (!aer_mask_override && einj->uncor_status &&
|
if (!aer_mask_override && einj->uncor_status &&
|
||||||
!(einj->uncor_status & ~uncor_mask)) {
|
!(einj->uncor_status & ~uncor_mask)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
printk(KERN_WARNING "The uncorrectable error(s) is masked "
|
printk(KERN_WARNING "The uncorrectable error(s) is masked by device\n");
|
||||||
"by device\n");
|
|
||||||
spin_unlock_irqrestore(&inject_lock, flags);
|
spin_unlock_irqrestore(&inject_lock, flags);
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
|
@ -464,8 +462,7 @@ static int aer_inject(struct aer_error_inj *einj)
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
aer_irq(-1, edev);
|
aer_irq(-1, edev);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
out_put:
|
out_put:
|
||||||
kfree(err_alloc);
|
kfree(err_alloc);
|
||||||
|
|
|
@ -542,8 +542,7 @@ static void aer_recover_work_func(struct work_struct *work);
|
||||||
#define AER_RECOVER_RING_ORDER 4
|
#define AER_RECOVER_RING_ORDER 4
|
||||||
#define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER)
|
#define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER)
|
||||||
|
|
||||||
struct aer_recover_entry
|
struct aer_recover_entry {
|
||||||
{
|
|
||||||
u8 bus;
|
u8 bus;
|
||||||
u8 devfn;
|
u8 devfn;
|
||||||
u16 domain;
|
u16 domain;
|
||||||
|
|
|
@ -172,9 +172,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
|
||||||
int id = ((dev->bus->number << 8) | dev->devfn);
|
int id = ((dev->bus->number << 8) | dev->devfn);
|
||||||
|
|
||||||
if (!info->status) {
|
if (!info->status) {
|
||||||
dev_err(&dev->dev,
|
dev_err(&dev->dev, "PCIe Bus Error: severity=%s, type=Unaccessible, id=%04x(Unregistered Agent ID)\n",
|
||||||
"PCIe Bus Error: severity=%s, type=Unaccessible, "
|
|
||||||
"id=%04x(Unregistered Agent ID)\n",
|
|
||||||
aer_error_severity_string[info->severity], id);
|
aer_error_severity_string[info->severity], id);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -182,13 +180,11 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
|
||||||
layer = AER_GET_LAYER_ERROR(info->severity, info->status);
|
layer = AER_GET_LAYER_ERROR(info->severity, info->status);
|
||||||
agent = AER_GET_AGENT(info->severity, info->status);
|
agent = AER_GET_AGENT(info->severity, info->status);
|
||||||
|
|
||||||
dev_err(&dev->dev,
|
dev_err(&dev->dev, "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
|
||||||
"PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
|
|
||||||
aer_error_severity_string[info->severity],
|
aer_error_severity_string[info->severity],
|
||||||
aer_error_layer[layer], id, aer_agent_string[agent]);
|
aer_error_layer[layer], id, aer_agent_string[agent]);
|
||||||
|
|
||||||
dev_err(&dev->dev,
|
dev_err(&dev->dev, " device [%04x:%04x] error status/mask=%08x/%08x\n",
|
||||||
" device [%04x:%04x] error status/mask=%08x/%08x\n",
|
|
||||||
dev->vendor, dev->device,
|
dev->vendor, dev->device,
|
||||||
info->status, info->mask);
|
info->status, info->mask);
|
||||||
|
|
||||||
|
|
|
@ -199,8 +199,7 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id)
|
||||||
* assuming that the PME was reported by a PCIe-PCI bridge that
|
* assuming that the PME was reported by a PCIe-PCI bridge that
|
||||||
* used devfn different from zero.
|
* used devfn different from zero.
|
||||||
*/
|
*/
|
||||||
dev_dbg(&port->dev, "PME interrupt generated for "
|
dev_dbg(&port->dev, "PME interrupt generated for non-existent device %02x:%02x.%d\n",
|
||||||
"non-existent device %02x:%02x.%d\n",
|
|
||||||
busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
|
busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
|
||||||
found = pcie_pme_from_pci_bridge(bus, 0);
|
found = pcie_pme_from_pci_bridge(bus, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,8 +204,8 @@ static int pcie_portdrv_probe(struct pci_dev *dev,
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!dev->irq && dev->pin) {
|
if (!dev->irq && dev->pin) {
|
||||||
dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; "
|
dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; check vendor BIOS\n",
|
||||||
"check vendor BIOS\n", dev->vendor, dev->device);
|
dev->vendor, dev->device);
|
||||||
}
|
}
|
||||||
status = pcie_port_device_register(dev);
|
status = pcie_port_device_register(dev);
|
||||||
if (status)
|
if (status)
|
||||||
|
|
|
@ -433,8 +433,7 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child)
|
||||||
limit |= ((unsigned long) mem_limit_hi) << 32;
|
limit |= ((unsigned long) mem_limit_hi) << 32;
|
||||||
#else
|
#else
|
||||||
if (mem_base_hi || mem_limit_hi) {
|
if (mem_base_hi || mem_limit_hi) {
|
||||||
dev_err(&dev->dev, "can't handle 64-bit "
|
dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n");
|
||||||
"address space for bridge\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -604,7 +603,6 @@ static enum pci_bus_speed agp_speed(int agp3, int agpstat)
|
||||||
return agp_speeds[index];
|
return agp_speeds[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void pci_set_bus_speed(struct pci_bus *bus)
|
static void pci_set_bus_speed(struct pci_bus *bus)
|
||||||
{
|
{
|
||||||
struct pci_dev *bridge = bus->self;
|
struct pci_dev *bridge = bus->self;
|
||||||
|
@ -636,11 +634,10 @@ static void pci_set_bus_speed(struct pci_bus *bus)
|
||||||
} else if (status & PCI_X_SSTATUS_266MHZ) {
|
} else if (status & PCI_X_SSTATUS_266MHZ) {
|
||||||
max = PCI_SPEED_133MHz_PCIX_266;
|
max = PCI_SPEED_133MHz_PCIX_266;
|
||||||
} else if (status & PCI_X_SSTATUS_133MHZ) {
|
} else if (status & PCI_X_SSTATUS_133MHZ) {
|
||||||
if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) {
|
if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2)
|
||||||
max = PCI_SPEED_133MHz_PCIX_ECC;
|
max = PCI_SPEED_133MHz_PCIX_ECC;
|
||||||
} else {
|
else
|
||||||
max = PCI_SPEED_133MHz_PCIX;
|
max = PCI_SPEED_133MHz_PCIX;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
max = PCI_SPEED_66MHz_PCIX;
|
max = PCI_SPEED_66MHz_PCIX;
|
||||||
}
|
}
|
||||||
|
@ -664,7 +661,6 @@ static void pci_set_bus_speed(struct pci_bus *bus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
|
static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
|
||||||
struct pci_dev *bridge, int busnr)
|
struct pci_dev *bridge, int busnr)
|
||||||
{
|
{
|
||||||
|
@ -729,7 +725,8 @@ add_dev:
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr)
|
struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
|
||||||
|
int busnr)
|
||||||
{
|
{
|
||||||
struct pci_bus *child;
|
struct pci_bus *child;
|
||||||
|
|
||||||
|
@ -741,6 +738,7 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int
|
||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_add_new_bus);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's a bridge, configure it and scan the bus behind it.
|
* 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)
|
||||||
* as cards with a PCI-to-PCI bridge can be
|
* as cards with a PCI-to-PCI bridge can be
|
||||||
* inserted later.
|
* inserted later.
|
||||||
*/
|
*/
|
||||||
for (i=0; i<CARDBUS_RESERVE_BUSNR; i++) {
|
for (i = 0; i < CARDBUS_RESERVE_BUSNR; i++) {
|
||||||
struct pci_bus *parent = bus;
|
struct pci_bus *parent = bus;
|
||||||
if (pci_find_bus(pci_domain_nr(bus),
|
if (pci_find_bus(pci_domain_nr(bus),
|
||||||
max+i+1))
|
max+i+1))
|
||||||
|
@ -934,8 +932,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
|
||||||
(child->number > bus->busn_res.end) ||
|
(child->number > bus->busn_res.end) ||
|
||||||
(child->number < bus->number) ||
|
(child->number < bus->number) ||
|
||||||
(child->busn_res.end < bus->number)) {
|
(child->busn_res.end < bus->number)) {
|
||||||
dev_info(&child->dev, "%pR %s "
|
dev_info(&child->dev, "%pR %s hidden behind%s bridge %s %pR\n",
|
||||||
"hidden behind%s bridge %s %pR\n",
|
|
||||||
&child->busn_res,
|
&child->busn_res,
|
||||||
(bus->number > child->busn_res.end &&
|
(bus->number > child->busn_res.end &&
|
||||||
bus->busn_res.end < child->number) ?
|
bus->busn_res.end < child->number) ?
|
||||||
|
@ -952,6 +949,7 @@ out:
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_scan_bridge);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read interrupt line and base address registers.
|
* Read interrupt line and base address registers.
|
||||||
|
@ -992,7 +990,6 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
|
||||||
pdev->is_hotplug_bridge = 1;
|
pdev->is_hotplug_bridge = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_ext_cfg_is_aliased - is ext config space just an alias of std config?
|
* pci_ext_cfg_is_aliased - is ext config space just an alias of std config?
|
||||||
* @dev: PCI device
|
* @dev: PCI device
|
||||||
|
@ -1225,13 +1222,13 @@ int pci_setup_device(struct pci_dev *dev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* unknown header */
|
default: /* unknown header */
|
||||||
dev_err(&dev->dev, "unknown header type %02x, "
|
dev_err(&dev->dev, "unknown header type %02x, ignoring device\n",
|
||||||
"ignoring device\n", dev->hdr_type);
|
dev->hdr_type);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
dev_err(&dev->dev, "ignoring class %#08x (doesn't match header "
|
dev_err(&dev->dev, "ignoring class %#08x (doesn't match header type %02x)\n",
|
||||||
"type %02x)\n", dev->class, dev->hdr_type);
|
dev->class, dev->hdr_type);
|
||||||
dev->class = PCI_CLASS_NOT_DEFINED;
|
dev->class = PCI_CLASS_NOT_DEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1306,9 +1303,8 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
|
||||||
return false;
|
return false;
|
||||||
/* Card hasn't responded in 60 seconds? Must be stuck. */
|
/* Card hasn't responded in 60 seconds? Must be stuck. */
|
||||||
if (delay > crs_timeout) {
|
if (delay > crs_timeout) {
|
||||||
printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not "
|
printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not responding\n",
|
||||||
"responding\n", pci_domain_nr(bus),
|
pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
|
||||||
bus->number, PCI_SLOT(devfn),
|
|
||||||
PCI_FUNC(devfn));
|
PCI_FUNC(devfn));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1519,6 +1515,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
|
||||||
|
|
||||||
return nr;
|
return nr;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_scan_slot);
|
||||||
|
|
||||||
static int pcie_find_smpss(struct pci_dev *dev, void *data)
|
static int pcie_find_smpss(struct pci_dev *dev, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1613,9 +1610,7 @@ static void pcie_write_mrrs(struct pci_dev *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mrrs < 128)
|
if (mrrs < 128)
|
||||||
dev_err(&dev->dev, "MRRS was unable to be configured with a "
|
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");
|
||||||
"safe value. If problems are experienced, try running "
|
|
||||||
"with pci=pcie_bus_safe.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pcie_bus_detect_mps(struct pci_dev *dev)
|
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)
|
||||||
pcie_write_mps(dev, mps);
|
pcie_write_mps(dev, mps);
|
||||||
pcie_write_mrrs(dev);
|
pcie_write_mrrs(dev);
|
||||||
|
|
||||||
dev_info(&dev->dev, "Max Payload Size set to %4d/%4d (was %4d), "
|
dev_info(&dev->dev, "Max Payload Size set to %4d/%4d (was %4d), Max Read Rq %4d\n",
|
||||||
"Max Read Rq %4d\n", pcie_get_mps(dev), 128 << dev->pcie_mpss,
|
pcie_get_mps(dev), 128 << dev->pcie_mpss,
|
||||||
orig_mps, pcie_get_readrq(dev));
|
orig_mps, pcie_get_readrq(dev));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1716,7 +1711,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
|
||||||
bus->is_added = 1;
|
bus->is_added = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pass=0; pass < 2; pass++)
|
for (pass = 0; pass < 2; pass++)
|
||||||
list_for_each_entry(dev, &bus->devices, bus_list) {
|
list_for_each_entry(dev, &bus->devices, bus_list) {
|
||||||
if (pci_is_bridge(dev))
|
if (pci_is_bridge(dev))
|
||||||
max = pci_scan_bridge(bus, dev, max, pass);
|
max = pci_scan_bridge(bus, dev, max, pass);
|
||||||
|
@ -1732,6 +1727,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
|
||||||
dev_dbg(&bus->dev, "bus scan returning with max=%02x\n", max);
|
dev_dbg(&bus->dev, "bus scan returning with max=%02x\n", max);
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_scan_child_bus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pcibios_root_bridge_prepare - Platform-specific host bridge setup.
|
* pcibios_root_bridge_prepare - Platform-specific host bridge setup.
|
||||||
|
@ -2040,11 +2036,6 @@ unsigned int pci_rescan_bus(struct pci_bus *bus)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pci_rescan_bus);
|
EXPORT_SYMBOL_GPL(pci_rescan_bus);
|
||||||
|
|
||||||
EXPORT_SYMBOL(pci_add_new_bus);
|
|
||||||
EXPORT_SYMBOL(pci_scan_slot);
|
|
||||||
EXPORT_SYMBOL(pci_scan_bridge);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_scan_child_bus);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pci_rescan_bus(), pci_rescan_bus_bridge_resize() and PCI device removal
|
* pci_rescan_bus(), pci_rescan_bus_bridge_resize() and PCI device removal
|
||||||
* routines should always be executed under this mutex.
|
* routines should always be executed under this mutex.
|
||||||
|
@ -2063,7 +2054,8 @@ void pci_unlock_rescan_remove(void)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove);
|
EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove);
|
||||||
|
|
||||||
static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b)
|
static int __init pci_sort_bf_cmp(const struct device *d_a,
|
||||||
|
const struct device *d_b)
|
||||||
{
|
{
|
||||||
const struct pci_dev *a = to_pci_dev(d_a);
|
const struct pci_dev *a = to_pci_dev(d_a);
|
||||||
const struct pci_dev *b = to_pci_dev(d_b);
|
const struct pci_dev *b = to_pci_dev(d_b);
|
||||||
|
|
|
@ -17,15 +17,14 @@
|
||||||
|
|
||||||
static int proc_initialized; /* = 0 */
|
static int proc_initialized; /* = 0 */
|
||||||
|
|
||||||
static loff_t
|
static loff_t proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
|
||||||
proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *dev = PDE_DATA(file_inode(file));
|
struct pci_dev *dev = PDE_DATA(file_inode(file));
|
||||||
return fixed_size_llseek(file, off, whence, dev->cfg_size);
|
return fixed_size_llseek(file, off, whence, dev->cfg_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t proc_bus_pci_read(struct file *file, char __user *buf,
|
||||||
proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
|
size_t nbytes, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev = PDE_DATA(file_inode(file));
|
struct pci_dev *dev = PDE_DATA(file_inode(file));
|
||||||
unsigned int pos = *ppos;
|
unsigned int pos = *ppos;
|
||||||
|
@ -108,8 +107,8 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp
|
||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf,
|
||||||
proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos)
|
size_t nbytes, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct inode *ino = file_inode(file);
|
struct inode *ino = file_inode(file);
|
||||||
struct pci_dev *dev = PDE_DATA(ino);
|
struct pci_dev *dev = PDE_DATA(ino);
|
||||||
|
@ -413,7 +412,7 @@ int pci_proc_detach_device(struct pci_dev *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_proc_detach_bus(struct pci_bus* bus)
|
int pci_proc_detach_bus(struct pci_bus *bus)
|
||||||
{
|
{
|
||||||
proc_remove(bus->procdir);
|
proc_remove(bus->procdir);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -423,6 +422,7 @@ static int proc_bus_pci_dev_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return seq_open(file, &proc_bus_pci_devices_op);
|
return seq_open(file, &proc_bus_pci_devices_op);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations proc_bus_pci_dev_operations = {
|
static const struct file_operations proc_bus_pci_dev_operations = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = proc_bus_pci_dev_open,
|
.open = proc_bus_pci_dev_open,
|
||||||
|
@ -443,6 +443,4 @@ static int __init pci_proc_init(void)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_initcall(pci_proc_init);
|
device_initcall(pci_proc_init);
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ static void quirk_mellanox_tavor(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
dev->broken_parity_status = 1; /* This device gives false positives */
|
dev->broken_parity_status = 1; /* This device gives false positives */
|
||||||
}
|
}
|
||||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor);
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor);
|
||||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor);
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
|
||||||
|
|
||||||
/* Deal with broken BIOSes that neglect to enable passive release,
|
/* Deal with broken BIOSes that neglect to enable passive release,
|
||||||
which can cause problems in combination with the 82441FX/PPro MTRRs */
|
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
|
||||||
static void quirk_isa_dma_hangs(struct pci_dev *dev)
|
static void quirk_isa_dma_hangs(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if (!isa_dma_bridge_buggy) {
|
if (!isa_dma_bridge_buggy) {
|
||||||
isa_dma_bridge_buggy=1;
|
isa_dma_bridge_buggy = 1;
|
||||||
dev_info(&dev->dev, "Activating ISA DMA hang workarounds\n");
|
dev_info(&dev->dev, "Activating ISA DMA hang workarounds\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk
|
||||||
*/
|
*/
|
||||||
static void quirk_nopcipci(struct pci_dev *dev)
|
static void quirk_nopcipci(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if ((pci_pci_problems & PCIPCI_FAIL)==0) {
|
if ((pci_pci_problems & PCIPCI_FAIL) == 0) {
|
||||||
dev_info(&dev->dev, "Disabling direct PCI/PCI transfers\n");
|
dev_info(&dev->dev, "Disabling direct PCI/PCI transfers\n");
|
||||||
pci_pci_problems |= PCIPCI_FAIL;
|
pci_pci_problems |= PCIPCI_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8151_0, quirk_nopci
|
||||||
*/
|
*/
|
||||||
static void quirk_triton(struct pci_dev *dev)
|
static void quirk_triton(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if ((pci_pci_problems&PCIPCI_TRITON)==0) {
|
if ((pci_pci_problems&PCIPCI_TRITON) == 0) {
|
||||||
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
||||||
pci_pci_problems |= PCIPCI_TRITON;
|
pci_pci_problems |= PCIPCI_TRITON;
|
||||||
}
|
}
|
||||||
|
@ -177,14 +177,14 @@ static void quirk_vialatency(struct pci_dev *dev)
|
||||||
a buggy southbridge */
|
a buggy southbridge */
|
||||||
|
|
||||||
p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL);
|
p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL);
|
||||||
if (p!=NULL) {
|
if (p != NULL) {
|
||||||
/* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
|
/* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
|
||||||
/* Check for buggy part revisions */
|
/* Check for buggy part revisions */
|
||||||
if (p->revision < 0x40 || p->revision > 0x42)
|
if (p->revision < 0x40 || p->revision > 0x42)
|
||||||
goto exit;
|
goto exit;
|
||||||
} else {
|
} else {
|
||||||
p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL);
|
p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL);
|
||||||
if (p==NULL) /* No problem parts */
|
if (p == NULL) /* No problem parts */
|
||||||
goto exit;
|
goto exit;
|
||||||
/* Check for buggy part revisions */
|
/* Check for buggy part revisions */
|
||||||
if (p->revision < 0x10 || p->revision > 0x12)
|
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
|
||||||
*/
|
*/
|
||||||
static void quirk_viaetbf(struct pci_dev *dev)
|
static void quirk_viaetbf(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if ((pci_pci_problems&PCIPCI_VIAETBF)==0) {
|
if ((pci_pci_problems&PCIPCI_VIAETBF) == 0) {
|
||||||
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
||||||
pci_pci_problems |= PCIPCI_VIAETBF;
|
pci_pci_problems |= PCIPCI_VIAETBF;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_via
|
||||||
|
|
||||||
static void quirk_vsfx(struct pci_dev *dev)
|
static void quirk_vsfx(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if ((pci_pci_problems&PCIPCI_VSFX)==0) {
|
if ((pci_pci_problems&PCIPCI_VSFX) == 0) {
|
||||||
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
||||||
pci_pci_problems |= PCIPCI_VSFX;
|
pci_pci_problems |= PCIPCI_VSFX;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576, quirk_vsfx)
|
||||||
*/
|
*/
|
||||||
static void quirk_alimagik(struct pci_dev *dev)
|
static void quirk_alimagik(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if ((pci_pci_problems&PCIPCI_ALIMAGIK)==0) {
|
if ((pci_pci_problems&PCIPCI_ALIMAGIK) == 0) {
|
||||||
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
||||||
pci_pci_problems |= PCIPCI_ALIMAGIK|PCIPCI_TRITON;
|
pci_pci_problems |= PCIPCI_ALIMAGIK|PCIPCI_TRITON;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1651, quirk_alimagi
|
||||||
*/
|
*/
|
||||||
static void quirk_natoma(struct pci_dev *dev)
|
static void quirk_natoma(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if ((pci_pci_problems&PCIPCI_NATOMA)==0) {
|
if ((pci_pci_problems&PCIPCI_NATOMA) == 0) {
|
||||||
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
|
||||||
pci_pci_problems |= PCIPCI_NATOMA;
|
pci_pci_problems |= PCIPCI_NATOMA;
|
||||||
}
|
}
|
||||||
|
@ -315,8 +315,7 @@ static void quirk_cs5536_vsa(struct pci_dev *dev)
|
||||||
if (pci_resource_len(dev, 0) != 8) {
|
if (pci_resource_len(dev, 0) != 8) {
|
||||||
struct resource *res = &dev->resource[0];
|
struct resource *res = &dev->resource[0];
|
||||||
res->end = res->start + 8 - 1;
|
res->end = res->start + 8 - 1;
|
||||||
dev_info(&dev->dev, "CS5536 ISA bridge bug detected "
|
dev_info(&dev->dev, "CS5536 ISA bridge bug detected (incorrect header); workaround applied\n");
|
||||||
"(incorrect header); workaround applied.\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa);
|
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
|
||||||
* let's get enough confirmation reports first.
|
* let's get enough confirmation reports first.
|
||||||
*/
|
*/
|
||||||
base &= -size;
|
base &= -size;
|
||||||
dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base, base + size - 1);
|
dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base,
|
||||||
|
base + size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable)
|
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
|
||||||
* reserve it, but let's get enough confirmation reports first.
|
* reserve it, but let's get enough confirmation reports first.
|
||||||
*/
|
*/
|
||||||
base &= -size;
|
base &= -size;
|
||||||
dev_info(&dev->dev, "%s MMIO at %04x-%04x\n", name, base, base + size - 1);
|
dev_info(&dev->dev, "%s MMIO at %04x-%04x\n", name, base,
|
||||||
|
base + size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -668,8 +669,7 @@ static void quirk_xio2000a(struct pci_dev *dev)
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
u16 command;
|
u16 command;
|
||||||
|
|
||||||
dev_warn(&dev->dev, "TI XIO2000a quirk detected; "
|
dev_warn(&dev->dev, "TI XIO2000a quirk detected; secondary bus fast back-to-back transfers disabled\n");
|
||||||
"secondary bus fast back-to-back transfers disabled\n");
|
|
||||||
list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) {
|
list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) {
|
||||||
pci_read_config_word(pdev, PCI_COMMAND, &command);
|
pci_read_config_word(pdev, PCI_COMMAND, &command);
|
||||||
if (command & PCI_COMMAND_FAST_BACK)
|
if (command & PCI_COMMAND_FAST_BACK)
|
||||||
|
@ -703,7 +703,7 @@ static void quirk_via_ioapic(struct pci_dev *dev)
|
||||||
tmp == 0 ? "Disa" : "Ena");
|
tmp == 0 ? "Disa" : "Ena");
|
||||||
|
|
||||||
/* Offset 0x58: External APIC IRQ output control */
|
/* Offset 0x58: External APIC IRQ output control */
|
||||||
pci_write_config_byte (dev, 0x58, tmp);
|
pci_write_config_byte(dev, 0x58, tmp);
|
||||||
}
|
}
|
||||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic);
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic);
|
||||||
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic);
|
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);
|
||||||
static void quirk_amd_8131_mmrbc(struct pci_dev *dev)
|
static void quirk_amd_8131_mmrbc(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if (dev->subordinate && dev->revision <= 0x12) {
|
if (dev->subordinate && dev->revision <= 0x12) {
|
||||||
dev_info(&dev->dev, "AMD8131 rev %x detected; "
|
dev_info(&dev->dev, "AMD8131 rev %x detected; disabling PCI-X MMRBC\n",
|
||||||
"disabling PCI-X MMRBC\n", dev->revision);
|
dev->revision);
|
||||||
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC;
|
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -916,12 +916,12 @@ static void quirk_amd_ordering(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
u32 pcic;
|
u32 pcic;
|
||||||
pci_read_config_dword(dev, 0x4C, &pcic);
|
pci_read_config_dword(dev, 0x4C, &pcic);
|
||||||
if ((pcic&6)!=6) {
|
if ((pcic & 6) != 6) {
|
||||||
pcic |= 6;
|
pcic |= 6;
|
||||||
dev_warn(&dev->dev, "BIOS failed to enable PCI standards compliance; fixing this error\n");
|
dev_warn(&dev->dev, "BIOS failed to enable PCI standards compliance; fixing this error\n");
|
||||||
pci_write_config_dword(dev, 0x4C, pcic);
|
pci_write_config_dword(dev, 0x4C, pcic);
|
||||||
pci_read_config_dword(dev, 0x84, &pcic);
|
pci_read_config_dword(dev, 0x84, &pcic);
|
||||||
pcic |= (1<<23); /* Required in this mode */
|
pcic |= (1 << 23); /* Required in this mode */
|
||||||
pci_write_config_dword(dev, 0x84, pcic);
|
pci_write_config_dword(dev, 0x84, pcic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -937,7 +937,7 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C
|
||||||
*/
|
*/
|
||||||
static void quirk_dunord(struct pci_dev *dev)
|
static void quirk_dunord(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
struct resource *r = &dev->resource [1];
|
struct resource *r = &dev->resource[1];
|
||||||
|
|
||||||
r->flags |= IORESOURCE_UNSET;
|
r->flags |= IORESOURCE_UNSET;
|
||||||
r->start = 0;
|
r->start = 0;
|
||||||
|
@ -967,10 +967,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA, 0x605, quirk_transparent_bridge)
|
||||||
static void quirk_mediagx_master(struct pci_dev *dev)
|
static void quirk_mediagx_master(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
u8 reg;
|
u8 reg;
|
||||||
|
|
||||||
pci_read_config_byte(dev, 0x41, ®);
|
pci_read_config_byte(dev, 0x41, ®);
|
||||||
if (reg & 2) {
|
if (reg & 2) {
|
||||||
reg &= ~2;
|
reg &= ~2;
|
||||||
dev_info(&dev->dev, "Fixup for MediaGX/Geode Slave Disconnect Boundary (0x41=0x%02x)\n", reg);
|
dev_info(&dev->dev, "Fixup for MediaGX/Geode Slave Disconnect Boundary (0x41=0x%02x)\n",
|
||||||
|
reg);
|
||||||
pci_write_config_byte(dev, 0x41, reg);
|
pci_write_config_byte(dev, 0x41, reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1120,7 +1122,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) {
|
if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) {
|
||||||
if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB)
|
if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0x8025: /* P4B-LX */
|
case 0x8025: /* P4B-LX */
|
||||||
case 0x8070: /* P4B */
|
case 0x8070: /* P4B */
|
||||||
case 0x8088: /* P4B533 */
|
case 0x8088: /* P4B533 */
|
||||||
|
@ -1128,14 +1130,14 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
|
||||||
asus_hides_smbus = 1;
|
asus_hides_smbus = 1;
|
||||||
}
|
}
|
||||||
else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB)
|
else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0x80b1: /* P4GE-V */
|
case 0x80b1: /* P4GE-V */
|
||||||
case 0x80b2: /* P4PE */
|
case 0x80b2: /* P4PE */
|
||||||
case 0x8093: /* P4B533-V */
|
case 0x8093: /* P4B533-V */
|
||||||
asus_hides_smbus = 1;
|
asus_hides_smbus = 1;
|
||||||
}
|
}
|
||||||
else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB)
|
else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0x8030: /* P4T533 */
|
case 0x8030: /* P4T533 */
|
||||||
asus_hides_smbus = 1;
|
asus_hides_smbus = 1;
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1177,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
|
||||||
}
|
}
|
||||||
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
|
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
|
||||||
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
|
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0x088C: /* HP Compaq nc8000 */
|
case 0x088C: /* HP Compaq nc8000 */
|
||||||
case 0x0890: /* HP Compaq nc6000 */
|
case 0x0890: /* HP Compaq nc6000 */
|
||||||
asus_hides_smbus = 1;
|
asus_hides_smbus = 1;
|
||||||
|
@ -1194,18 +1196,18 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
|
||||||
}
|
}
|
||||||
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
|
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
|
||||||
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
|
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0xC00C: /* Samsung P35 notebook */
|
case 0xC00C: /* Samsung P35 notebook */
|
||||||
asus_hides_smbus = 1;
|
asus_hides_smbus = 1;
|
||||||
}
|
}
|
||||||
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) {
|
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) {
|
||||||
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
|
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0x0058: /* Compaq Evo N620c */
|
case 0x0058: /* Compaq Evo N620c */
|
||||||
asus_hides_smbus = 1;
|
asus_hides_smbus = 1;
|
||||||
}
|
}
|
||||||
else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3)
|
else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */
|
case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */
|
||||||
/* Motherboard doesn't have Host bridge
|
/* Motherboard doesn't have Host bridge
|
||||||
* subvendor/subdevice IDs, therefore checking
|
* subvendor/subdevice IDs, therefore checking
|
||||||
|
@ -1213,7 +1215,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
|
||||||
asus_hides_smbus = 1;
|
asus_hides_smbus = 1;
|
||||||
}
|
}
|
||||||
else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2)
|
else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2)
|
||||||
switch(dev->subsystem_device) {
|
switch (dev->subsystem_device) {
|
||||||
case 0x00b8: /* Compaq Evo D510 CMT */
|
case 0x00b8: /* Compaq Evo D510 CMT */
|
||||||
case 0x00b9: /* Compaq Evo D510 SFF */
|
case 0x00b9: /* Compaq Evo D510 SFF */
|
||||||
case 0x00ba: /* Compaq Evo D510 USDT */
|
case 0x00ba: /* Compaq Evo D510 USDT */
|
||||||
|
@ -1261,7 +1263,8 @@ static void asus_hides_smbus_lpc(struct pci_dev *dev)
|
||||||
pci_write_config_word(dev, 0xF2, val & (~0x8));
|
pci_write_config_word(dev, 0xF2, val & (~0x8));
|
||||||
pci_read_config_word(dev, 0xF2, &val);
|
pci_read_config_word(dev, 0xF2, &val);
|
||||||
if (val & 0x8)
|
if (val & 0x8)
|
||||||
dev_info(&dev->dev, "i801 SMBus device continues to play 'hide and seek'! 0x%x\n", val);
|
dev_info(&dev->dev, "i801 SMBus device continues to play 'hide and seek'! 0x%x\n",
|
||||||
|
val);
|
||||||
else
|
else
|
||||||
dev_info(&dev->dev, "Enabled i801 SMBus device\n");
|
dev_info(&dev->dev, "Enabled i801 SMBus device\n");
|
||||||
}
|
}
|
||||||
|
@ -1409,7 +1412,8 @@ static void asus_hides_ac97_lpc(struct pci_dev *dev)
|
||||||
pci_write_config_byte(dev, 0x50, val & (~0xc0));
|
pci_write_config_byte(dev, 0x50, val & (~0xc0));
|
||||||
pci_read_config_byte(dev, 0x50, &val);
|
pci_read_config_byte(dev, 0x50, &val);
|
||||||
if (val & 0xc0)
|
if (val & 0xc0)
|
||||||
dev_info(&dev->dev, "Onboard AC97/MC97 devices continue to play 'hide and seek'! 0x%x\n", val);
|
dev_info(&dev->dev, "Onboard AC97/MC97 devices continue to play 'hide and seek'! 0x%x\n",
|
||||||
|
val);
|
||||||
else
|
else
|
||||||
dev_info(&dev->dev, "Enabled onboard AC97/MC97 devices\n");
|
dev_info(&dev->dev, "Enabled onboard AC97/MC97 devices\n");
|
||||||
}
|
}
|
||||||
|
@ -1514,10 +1518,8 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)
|
||||||
|
|
||||||
/* The next five BARs all seem to be rubbish, so just clean
|
/* The next five BARs all seem to be rubbish, so just clean
|
||||||
* them out */
|
* them out */
|
||||||
for (i=1; i < 6; i++) {
|
for (i = 1; i < 6; i++)
|
||||||
memset(&pdev->resource[i], 0, sizeof(pdev->resource[i]));
|
memset(&pdev->resource[i], 0, sizeof(pdev->resource[i]));
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic);
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1552,7 +1554,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_pci
|
||||||
* Some Intel PCI Express chipsets have trouble with downstream
|
* Some Intel PCI Express chipsets have trouble with downstream
|
||||||
* device power management.
|
* device power management.
|
||||||
*/
|
*/
|
||||||
static void quirk_intel_pcie_pm(struct pci_dev * dev)
|
static void quirk_intel_pcie_pm(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
pci_pm_d3_delay = 120;
|
pci_pm_d3_delay = 120;
|
||||||
dev->no_d1d2 = 1;
|
dev->no_d1d2 = 1;
|
||||||
|
@ -1721,8 +1723,8 @@ static void quirk_disable_amd_8111_boot_interrupt(struct pci_dev *dev)
|
||||||
|
|
||||||
pci_read_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, &pci_config_word);
|
pci_read_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, &pci_config_word);
|
||||||
if (!pci_config_word) {
|
if (!pci_config_word) {
|
||||||
dev_info(&dev->dev, "boot interrupts on device [%04x:%04x] "
|
dev_info(&dev->dev, "boot interrupts on device [%04x:%04x] already disabled\n",
|
||||||
"already disabled\n", dev->vendor, dev->device);
|
dev->vendor, dev->device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pci_write_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, 0);
|
pci_write_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, 0);
|
||||||
|
@ -1770,8 +1772,7 @@ static void quirk_plx_pci9050(struct pci_dev *dev)
|
||||||
if (pci_resource_len(dev, bar) == 0x80 &&
|
if (pci_resource_len(dev, bar) == 0x80 &&
|
||||||
(pci_resource_start(dev, bar) & 0x80)) {
|
(pci_resource_start(dev, bar) & 0x80)) {
|
||||||
struct resource *r = &dev->resource[bar];
|
struct resource *r = &dev->resource[bar];
|
||||||
dev_info(&dev->dev,
|
dev_info(&dev->dev, "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n",
|
||||||
"Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n",
|
|
||||||
bar);
|
bar);
|
||||||
r->flags |= IORESOURCE_UNSET;
|
r->flags |= IORESOURCE_UNSET;
|
||||||
r->start = 0;
|
r->start = 0;
|
||||||
|
@ -1818,9 +1819,7 @@ static void quirk_netmos(struct pci_dev *dev)
|
||||||
case PCI_DEVICE_ID_NETMOS_9845:
|
case PCI_DEVICE_ID_NETMOS_9845:
|
||||||
case PCI_DEVICE_ID_NETMOS_9855:
|
case PCI_DEVICE_ID_NETMOS_9855:
|
||||||
if (num_parallel) {
|
if (num_parallel) {
|
||||||
dev_info(&dev->dev, "Netmos %04x (%u parallel, "
|
dev_info(&dev->dev, "Netmos %04x (%u parallel, %u serial); changing class SERIAL to OTHER (use parport_serial)\n",
|
||||||
"%u serial); changing class SERIAL to OTHER "
|
|
||||||
"(use parport_serial)\n",
|
|
||||||
dev->device, num_parallel, num_serial);
|
dev->device, num_parallel, num_serial);
|
||||||
dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) |
|
dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) |
|
||||||
(dev->class & 0xff);
|
(dev->class & 0xff);
|
||||||
|
@ -1887,8 +1886,7 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
|
||||||
|
|
||||||
cmd_hi = readb(csr + 3);
|
cmd_hi = readb(csr + 3);
|
||||||
if (cmd_hi == 0) {
|
if (cmd_hi == 0) {
|
||||||
dev_warn(&dev->dev, "Firmware left e100 interrupts enabled; "
|
dev_warn(&dev->dev, "Firmware left e100 interrupts enabled; disabling\n");
|
||||||
"disabling\n");
|
|
||||||
writeb(1, csr + 3);
|
writeb(1, csr + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1958,8 +1956,7 @@ static void quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev)
|
||||||
if (pci_read_config_byte(dev, 0xf41, &b) == 0) {
|
if (pci_read_config_byte(dev, 0xf41, &b) == 0) {
|
||||||
if (!(b & 0x20)) {
|
if (!(b & 0x20)) {
|
||||||
pci_write_config_byte(dev, 0xf41, b | 0x20);
|
pci_write_config_byte(dev, 0xf41, b | 0x20);
|
||||||
dev_info(&dev->dev,
|
dev_info(&dev->dev, "Linking AER extended capability\n");
|
||||||
"Linking AER extended capability\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1997,8 +1994,7 @@ static void quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
|
||||||
/* Turn off PCI Bus Parking */
|
/* Turn off PCI Bus Parking */
|
||||||
pci_write_config_byte(dev, 0x76, b ^ 0x40);
|
pci_write_config_byte(dev, 0x76, b ^ 0x40);
|
||||||
|
|
||||||
dev_info(&dev->dev,
|
dev_info(&dev->dev, "Disabling VIA CX700 PCI parking\n");
|
||||||
"Disabling VIA CX700 PCI parking\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2013,8 +2009,7 @@ static void quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
|
||||||
/* Disable "Read FIFO Timer" */
|
/* Disable "Read FIFO Timer" */
|
||||||
pci_write_config_byte(dev, 0x77, 0x0);
|
pci_write_config_byte(dev, 0x77, 0x0);
|
||||||
|
|
||||||
dev_info(&dev->dev,
|
dev_info(&dev->dev, "Disabling VIA CX700 PCI caching\n");
|
||||||
"Disabling VIA CX700 PCI caching\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2149,8 +2144,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8380_0, quirk_disab
|
||||||
static void quirk_disable_msi(struct pci_dev *dev)
|
static void quirk_disable_msi(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if (dev->subordinate) {
|
if (dev->subordinate) {
|
||||||
dev_warn(&dev->dev, "MSI quirk detected; "
|
dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n");
|
||||||
"subordinate MSI disabled\n");
|
|
||||||
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2189,8 +2183,7 @@ static int msi_ht_cap_enabled(struct pci_dev *dev)
|
||||||
u8 flags;
|
u8 flags;
|
||||||
|
|
||||||
if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
|
if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
|
||||||
&flags) == 0)
|
&flags) == 0) {
|
||||||
{
|
|
||||||
dev_info(&dev->dev, "Found %s HT MSI Mapping\n",
|
dev_info(&dev->dev, "Found %s HT MSI Mapping\n",
|
||||||
flags & HT_MSI_FLAGS_ENABLE ?
|
flags & HT_MSI_FLAGS_ENABLE ?
|
||||||
"enabled" : "disabled");
|
"enabled" : "disabled");
|
||||||
|
@ -2207,8 +2200,7 @@ static int msi_ht_cap_enabled(struct pci_dev *dev)
|
||||||
static void quirk_msi_ht_cap(struct pci_dev *dev)
|
static void quirk_msi_ht_cap(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if (dev->subordinate && !msi_ht_cap_enabled(dev)) {
|
if (dev->subordinate && !msi_ht_cap_enabled(dev)) {
|
||||||
dev_warn(&dev->dev, "MSI quirk detected; "
|
dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n");
|
||||||
"subordinate MSI disabled\n");
|
|
||||||
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2232,8 +2224,7 @@ static void quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
|
||||||
if (!pdev)
|
if (!pdev)
|
||||||
return;
|
return;
|
||||||
if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) {
|
if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) {
|
||||||
dev_warn(&dev->dev, "MSI quirk detected; "
|
dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n");
|
||||||
"subordinate MSI disabled\n");
|
|
||||||
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
||||||
}
|
}
|
||||||
pci_dev_put(pdev);
|
pci_dev_put(pdev);
|
||||||
|
@ -2279,8 +2270,7 @@ static void nvenet_msi_disable(struct pci_dev *dev)
|
||||||
if (board_name &&
|
if (board_name &&
|
||||||
(strstr(board_name, "P5N32-SLI PREMIUM") ||
|
(strstr(board_name, "P5N32-SLI PREMIUM") ||
|
||||||
strstr(board_name, "P5N32-E SLI"))) {
|
strstr(board_name, "P5N32-E SLI"))) {
|
||||||
dev_info(&dev->dev,
|
dev_info(&dev->dev, "Disabling msi for MCP55 NIC on P5N32-SLI\n");
|
||||||
"Disabling msi for MCP55 NIC on P5N32-SLI\n");
|
|
||||||
dev->no_msi = 1;
|
dev->no_msi = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2489,8 +2479,7 @@ static void __nv_msi_ht_cap_quirk(struct pci_dev *dev, int all)
|
||||||
*/
|
*/
|
||||||
host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
|
host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
|
||||||
if (host_bridge == NULL) {
|
if (host_bridge == NULL) {
|
||||||
dev_warn(&dev->dev,
|
dev_warn(&dev->dev, "nv_msi_ht_cap_quirk didn't locate host bridge\n");
|
||||||
"nv_msi_ht_cap_quirk didn't locate host bridge\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2817,8 +2806,7 @@ static void quirk_intel_mc_errata(struct pci_dev *dev)
|
||||||
*/
|
*/
|
||||||
err = pci_read_config_word(dev, 0x48, &rcc);
|
err = pci_read_config_word(dev, 0x48, &rcc);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&dev->dev, "Error attempting to read the read "
|
dev_err(&dev->dev, "Error attempting to read the read completion coalescing register\n");
|
||||||
"completion coalescing register.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2829,13 +2817,11 @@ static void quirk_intel_mc_errata(struct pci_dev *dev)
|
||||||
|
|
||||||
err = pci_write_config_word(dev, 0x48, rcc);
|
err = pci_write_config_word(dev, 0x48, rcc);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&dev->dev, "Error attempting to write the read "
|
dev_err(&dev->dev, "Error attempting to write the read completion coalescing register\n");
|
||||||
"completion coalescing register.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_info_once("Read completion coalescing disabled due to hardware "
|
pr_info_once("Read completion coalescing disabled due to hardware errata relating to 256B MPS\n");
|
||||||
"errata relating to 256B MPS.\n");
|
|
||||||
}
|
}
|
||||||
/* Intel 5000 series memory controllers and ports 2-7 */
|
/* Intel 5000 series memory controllers and ports 2-7 */
|
||||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x25c0, quirk_intel_mc_errata);
|
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)
|
||||||
|
|
||||||
/* Check if any interrupt line is still enabled */
|
/* Check if any interrupt line is still enabled */
|
||||||
if (readl(regs + I915_DEIER_REG) != 0) {
|
if (readl(regs + I915_DEIER_REG) != 0) {
|
||||||
dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; "
|
dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; disabling\n");
|
||||||
"disabling\n");
|
|
||||||
|
|
||||||
writel(0, regs + I915_DEIER_REG);
|
writel(0, regs + I915_DEIER_REG);
|
||||||
}
|
}
|
||||||
|
@ -3040,7 +3025,7 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
struct pci_fixup *start, *end;
|
struct pci_fixup *start, *end;
|
||||||
|
|
||||||
switch(pass) {
|
switch (pass) {
|
||||||
case pci_fixup_early:
|
case pci_fixup_early:
|
||||||
start = __start_pci_fixups_early;
|
start = __start_pci_fixups_early;
|
||||||
end = __end_pci_fixups_early;
|
end = __end_pci_fixups_early;
|
||||||
|
@ -3112,8 +3097,8 @@ static int __init pci_apply_final_quirks(void)
|
||||||
if (!tmp || cls == tmp)
|
if (!tmp || cls == tmp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), "
|
printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), using %u bytes\n",
|
||||||
"using %u bytes\n", cls << 2, tmp << 2,
|
cls << 2, tmp << 2,
|
||||||
pci_dfl_cache_line_size << 2);
|
pci_dfl_cache_line_size << 2);
|
||||||
pci_cache_line_size = pci_dfl_cache_line_size;
|
pci_cache_line_size = pci_dfl_cache_line_size;
|
||||||
}
|
}
|
||||||
|
@ -3342,6 +3327,85 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void quirk_dma_func0_alias(struct pci_dev *dev)
|
||||||
|
{
|
||||||
|
if (PCI_FUNC(dev->devfn) != 0) {
|
||||||
|
dev->dma_alias_devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 0);
|
||||||
|
dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* https://bugzilla.redhat.com/show_bug.cgi?id=605888
|
||||||
|
*
|
||||||
|
* Some Ricoh devices use function 0 as the PCIe requester ID for DMA.
|
||||||
|
*/
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias);
|
||||||
|
|
||||||
|
static void quirk_dma_func1_alias(struct pci_dev *dev)
|
||||||
|
{
|
||||||
|
if (PCI_FUNC(dev->devfn) != 1) {
|
||||||
|
dev->dma_alias_devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 1);
|
||||||
|
dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Marvell 88SE9123 uses function 1 as the requester ID for DMA. In some
|
||||||
|
* SKUs function 1 is present and is a legacy IDE controller, in other
|
||||||
|
* SKUs this function is not present, making this a ghost requester.
|
||||||
|
* https://bugzilla.kernel.org/show_bug.cgi?id=42679
|
||||||
|
*/
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c47 + c57 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9172,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c59 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x917a,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
/* https://bugs.gentoo.org/show_bug.cgi?id=497630 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON,
|
||||||
|
PCI_DEVICE_ID_JMICRON_JMB388_ESD,
|
||||||
|
quirk_dma_func1_alias);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A few PCIe-to-PCI bridges fail to expose a PCIe capability, resulting in
|
||||||
|
* using the wrong DMA alias for the device. Some of these devices can be
|
||||||
|
* used as either forward or reverse bridges, so we need to test whether the
|
||||||
|
* device is operating in the correct mode. We could probably apply this
|
||||||
|
* quirk to PCI_ANY_ID, but for now we'll just use known offenders. The test
|
||||||
|
* is for a non-root, non-PCIe bridge where the upstream device is PCIe and
|
||||||
|
* is not a PCIe-to-PCI bridge, then @pdev is actually a PCIe-to-PCI bridge.
|
||||||
|
*/
|
||||||
|
static void quirk_use_pcie_bridge_dma_alias(struct pci_dev *pdev)
|
||||||
|
{
|
||||||
|
if (!pci_is_root_bus(pdev->bus) &&
|
||||||
|
pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE &&
|
||||||
|
!pci_is_pcie(pdev) && pci_is_pcie(pdev->bus->self) &&
|
||||||
|
pci_pcie_type(pdev->bus->self) != PCI_EXP_TYPE_PCI_BRIDGE)
|
||||||
|
pdev->dev_flags |= PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS;
|
||||||
|
}
|
||||||
|
/* ASM1083/1085, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c46 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ASMEDIA, 0x1080,
|
||||||
|
quirk_use_pcie_bridge_dma_alias);
|
||||||
|
/* Tundra 8113, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c43 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(0x10e3, 0x8113, quirk_use_pcie_bridge_dma_alias);
|
||||||
|
/* ITE 8892, https://bugzilla.kernel.org/show_bug.cgi?id=73551 */
|
||||||
|
DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias);
|
||||||
|
|
||||||
static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
|
static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if (!PCI_FUNC(dev->devfn))
|
if (!PCI_FUNC(dev->devfn))
|
||||||
|
|
|
@ -38,6 +38,7 @@ int pci_enable_rom(struct pci_dev *pdev)
|
||||||
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
|
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_enable_rom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_disable_rom - disable ROM decoding for a PCI device
|
* pci_disable_rom - disable ROM decoding for a PCI device
|
||||||
|
@ -53,6 +54,7 @@ void pci_disable_rom(struct pci_dev *pdev)
|
||||||
rom_addr &= ~PCI_ROM_ADDRESS_ENABLE;
|
rom_addr &= ~PCI_ROM_ADDRESS_ENABLE;
|
||||||
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
|
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_disable_rom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_get_rom_size - obtain the actual size of the ROM image
|
* 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)
|
||||||
} else {
|
} else {
|
||||||
/* assign the ROM an address if it doesn't have one */
|
/* assign the ROM an address if it doesn't have one */
|
||||||
if (res->parent == NULL &&
|
if (res->parent == NULL &&
|
||||||
pci_assign_resource(pdev,PCI_ROM_RESOURCE))
|
pci_assign_resource(pdev, PCI_ROM_RESOURCE))
|
||||||
return NULL;
|
return NULL;
|
||||||
start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
|
start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
|
||||||
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
||||||
|
@ -166,6 +168,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
|
||||||
*size = pci_get_rom_size(pdev, rom, *size);
|
*size = pci_get_rom_size(pdev, rom, *size);
|
||||||
return rom;
|
return rom;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_map_rom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_unmap_rom - unmap the ROM from kernel space
|
* pci_unmap_rom - unmap the ROM from kernel space
|
||||||
|
@ -187,6 +190,7 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)
|
||||||
if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW)))
|
if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW)))
|
||||||
pci_disable_rom(pdev);
|
pci_disable_rom(pdev);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_unmap_rom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_cleanup_rom - free the ROM copy created by pci_map_rom_copy
|
* 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)
|
||||||
struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
|
struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
|
||||||
|
|
||||||
if (res->flags & IORESOURCE_ROM_COPY) {
|
if (res->flags & IORESOURCE_ROM_COPY) {
|
||||||
kfree((void*)(unsigned long)res->start);
|
kfree((void *)(unsigned long)res->start);
|
||||||
res->flags |= IORESOURCE_UNSET;
|
res->flags |= IORESOURCE_UNSET;
|
||||||
res->flags &= ~IORESOURCE_ROM_COPY;
|
res->flags &= ~IORESOURCE_ROM_COPY;
|
||||||
res->start = 0;
|
res->start = 0;
|
||||||
|
@ -222,9 +226,4 @@ void __iomem *pci_platform_rom(struct pci_dev *pdev, size_t *size)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(pci_map_rom);
|
|
||||||
EXPORT_SYMBOL(pci_unmap_rom);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_enable_rom);
|
|
||||||
EXPORT_SYMBOL_GPL(pci_disable_rom);
|
|
||||||
EXPORT_SYMBOL(pci_platform_rom);
|
EXPORT_SYMBOL(pci_platform_rom);
|
||||||
|
|
|
@ -16,6 +16,93 @@
|
||||||
DECLARE_RWSEM(pci_bus_sem);
|
DECLARE_RWSEM(pci_bus_sem);
|
||||||
EXPORT_SYMBOL_GPL(pci_bus_sem);
|
EXPORT_SYMBOL_GPL(pci_bus_sem);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* pci_for_each_dma_alias - Iterate over DMA aliases for a device
|
||||||
|
* @pdev: starting downstream device
|
||||||
|
* @fn: function to call for each alias
|
||||||
|
* @data: opaque data to pass to @fn
|
||||||
|
*
|
||||||
|
* Starting @pdev, walk up the bus calling @fn for each possible alias
|
||||||
|
* of @pdev at the root bus.
|
||||||
|
*/
|
||||||
|
int pci_for_each_dma_alias(struct pci_dev *pdev,
|
||||||
|
int (*fn)(struct pci_dev *pdev,
|
||||||
|
u16 alias, void *data), void *data)
|
||||||
|
{
|
||||||
|
struct pci_bus *bus;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = fn(pdev, PCI_DEVID(pdev->bus->number, pdev->devfn), data);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the device is broken and uses an alias requester ID for
|
||||||
|
* DMA, iterate over that too.
|
||||||
|
*/
|
||||||
|
if (unlikely(pdev->dev_flags & PCI_DEV_FLAGS_DMA_ALIAS_DEVFN)) {
|
||||||
|
ret = fn(pdev, PCI_DEVID(pdev->bus->number,
|
||||||
|
pdev->dma_alias_devfn), data);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) {
|
||||||
|
struct pci_dev *tmp;
|
||||||
|
|
||||||
|
/* Skip virtual buses */
|
||||||
|
if (!bus->self)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
tmp = bus->self;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PCIe-to-PCI/X bridges alias transactions from downstream
|
||||||
|
* devices using the subordinate bus number (PCI Express to
|
||||||
|
* PCI/PCI-X Bridge Spec, rev 1.0, sec 2.3). For all cases
|
||||||
|
* where the upstream bus is PCI/X we alias to the bridge
|
||||||
|
* (there are various conditions in the previous reference
|
||||||
|
* where the bridge may take ownership of transactions, even
|
||||||
|
* when the secondary interface is PCI-X).
|
||||||
|
*/
|
||||||
|
if (pci_is_pcie(tmp)) {
|
||||||
|
switch (pci_pcie_type(tmp)) {
|
||||||
|
case PCI_EXP_TYPE_ROOT_PORT:
|
||||||
|
case PCI_EXP_TYPE_UPSTREAM:
|
||||||
|
case PCI_EXP_TYPE_DOWNSTREAM:
|
||||||
|
continue;
|
||||||
|
case PCI_EXP_TYPE_PCI_BRIDGE:
|
||||||
|
ret = fn(tmp,
|
||||||
|
PCI_DEVID(tmp->subordinate->number,
|
||||||
|
PCI_DEVFN(0, 0)), data);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
continue;
|
||||||
|
case PCI_EXP_TYPE_PCIE_BRIDGE:
|
||||||
|
ret = fn(tmp,
|
||||||
|
PCI_DEVID(tmp->bus->number,
|
||||||
|
tmp->devfn), data);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tmp->dev_flags & PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS)
|
||||||
|
ret = fn(tmp,
|
||||||
|
PCI_DEVID(tmp->subordinate->number,
|
||||||
|
PCI_DEVFN(0, 0)), data);
|
||||||
|
else
|
||||||
|
ret = fn(tmp,
|
||||||
|
PCI_DEVID(tmp->bus->number,
|
||||||
|
tmp->devfn), data);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find the upstream PCIe-to-PCI bridge of a PCI device
|
* find the upstream PCIe-to-PCI bridge of a PCI device
|
||||||
* if the device is PCIE, return NULL
|
* if the device is PCIE, return NULL
|
||||||
|
@ -23,8 +110,7 @@ EXPORT_SYMBOL_GPL(pci_bus_sem);
|
||||||
* legacy PCI bridge and the bridge is directly connected to bus 0), return its
|
* legacy PCI bridge and the bridge is directly connected to bus 0), return its
|
||||||
* parent
|
* parent
|
||||||
*/
|
*/
|
||||||
struct pci_dev *
|
struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
|
||||||
pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
|
|
||||||
{
|
{
|
||||||
struct pci_dev *tmp = NULL;
|
struct pci_dev *tmp = NULL;
|
||||||
|
|
||||||
|
@ -56,12 +142,12 @@ static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
|
||||||
struct pci_bus *child;
|
struct pci_bus *child;
|
||||||
struct pci_bus *tmp;
|
struct pci_bus *tmp;
|
||||||
|
|
||||||
if(bus->number == busnr)
|
if (bus->number == busnr)
|
||||||
return bus;
|
return bus;
|
||||||
|
|
||||||
list_for_each_entry(tmp, &bus->children, node) {
|
list_for_each_entry(tmp, &bus->children, node) {
|
||||||
child = pci_do_find_bus(tmp, busnr);
|
child = pci_do_find_bus(tmp, busnr);
|
||||||
if(child)
|
if (child)
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -76,7 +162,7 @@ static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
|
||||||
* in the global list of PCI buses. If the bus is found, a pointer to its
|
* in the global list of PCI buses. If the bus is found, a pointer to its
|
||||||
* data structure is returned. If no bus is found, %NULL is returned.
|
* data structure is returned. If no bus is found, %NULL is returned.
|
||||||
*/
|
*/
|
||||||
struct pci_bus * pci_find_bus(int domain, int busnr)
|
struct pci_bus *pci_find_bus(int domain, int busnr)
|
||||||
{
|
{
|
||||||
struct pci_bus *bus = NULL;
|
struct pci_bus *bus = NULL;
|
||||||
struct pci_bus *tmp_bus;
|
struct pci_bus *tmp_bus;
|
||||||
|
@ -90,6 +176,7 @@ struct pci_bus * pci_find_bus(int domain, int busnr)
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_find_bus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_find_next_bus - begin or continue searching for a PCI bus
|
* 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)
|
||||||
* @from is not %NULL, searches continue from next device on the
|
* @from is not %NULL, searches continue from next device on the
|
||||||
* global list.
|
* global list.
|
||||||
*/
|
*/
|
||||||
struct pci_bus *
|
struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
|
||||||
pci_find_next_bus(const struct pci_bus *from)
|
|
||||||
{
|
{
|
||||||
struct list_head *n;
|
struct list_head *n;
|
||||||
struct pci_bus *b = NULL;
|
struct pci_bus *b = NULL;
|
||||||
|
@ -114,6 +200,7 @@ pci_find_next_bus(const struct pci_bus *from)
|
||||||
up_read(&pci_bus_sem);
|
up_read(&pci_bus_sem);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_find_next_bus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_get_slot - locate PCI device for a given PCI slot
|
* 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)
|
||||||
up_read(&pci_bus_sem);
|
up_read(&pci_bus_sem);
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_get_slot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_get_domain_bus_and_slot - locate PCI device for a given PCI domain (segment), bus, and slot
|
* 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,
|
||||||
|
|
||||||
return pci_get_dev_by_id(&id, from);
|
return pci_get_dev_by_id(&id, from);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_get_subsys);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_get_device - begin or continue searching for a PCI device by vendor/device id
|
* 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,
|
||||||
* from next device on the global list. The reference count for @from is
|
* from next device on the global list. The reference count for @from is
|
||||||
* always decremented if it is not %NULL.
|
* always decremented if it is not %NULL.
|
||||||
*/
|
*/
|
||||||
struct pci_dev *
|
struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
|
||||||
pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from)
|
struct pci_dev *from)
|
||||||
{
|
{
|
||||||
return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
|
return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_get_device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_get_class - begin or continue searching for a PCI device by class
|
* 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)
|
||||||
|
|
||||||
return pci_get_dev_by_id(&id, from);
|
return pci_get_dev_by_id(&id, from);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_get_class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_dev_present - Returns 1 if device matching the device list is present, 0 if not.
|
* 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)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(pci_dev_present);
|
EXPORT_SYMBOL(pci_dev_present);
|
||||||
|
|
||||||
/* For boot time work */
|
|
||||||
EXPORT_SYMBOL(pci_find_bus);
|
|
||||||
EXPORT_SYMBOL(pci_find_next_bus);
|
|
||||||
/* For everyone */
|
|
||||||
EXPORT_SYMBOL(pci_get_device);
|
|
||||||
EXPORT_SYMBOL(pci_get_subsys);
|
|
||||||
EXPORT_SYMBOL(pci_get_slot);
|
|
||||||
EXPORT_SYMBOL(pci_get_class);
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ static int add_to_list(struct list_head *head,
|
||||||
|
|
||||||
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
|
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
pr_warning("add_to_list: kmalloc() failed!\n");
|
pr_warn("add_to_list: kmalloc() failed!\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,8 +148,7 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
|
||||||
|
|
||||||
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
|
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
panic("pdev_sort_resources(): "
|
panic("pdev_sort_resources(): kmalloc() failed!\n");
|
||||||
"kmalloc() failed!\n");
|
|
||||||
tmp->res = r;
|
tmp->res = r;
|
||||||
tmp->dev = dev;
|
tmp->dev = dev;
|
||||||
|
|
||||||
|
@ -736,7 +735,7 @@ static resource_size_t calculate_iosize(resource_size_t size,
|
||||||
{
|
{
|
||||||
if (size < min_size)
|
if (size < min_size)
|
||||||
size = min_size;
|
size = min_size;
|
||||||
if (old_size == 1 )
|
if (old_size == 1)
|
||||||
old_size = 0;
|
old_size = 0;
|
||||||
/* To be fixed in 2.5: we should have sort of HAVE_ISA
|
/* To be fixed in 2.5: we should have sort of HAVE_ISA
|
||||||
flag in the struct pci_bus. */
|
flag in the struct pci_bus. */
|
||||||
|
@ -757,7 +756,7 @@ static resource_size_t calculate_memsize(resource_size_t size,
|
||||||
{
|
{
|
||||||
if (size < min_size)
|
if (size < min_size)
|
||||||
size = min_size;
|
size = min_size;
|
||||||
if (old_size == 1 )
|
if (old_size == 1)
|
||||||
old_size = 0;
|
old_size = 0;
|
||||||
if (size < old_size)
|
if (size < old_size)
|
||||||
size = old_size;
|
size = old_size;
|
||||||
|
@ -859,9 +858,8 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
|
||||||
resource_size(b_res), min_align);
|
resource_size(b_res), min_align);
|
||||||
if (!size0 && !size1) {
|
if (!size0 && !size1) {
|
||||||
if (b_res->start || b_res->end)
|
if (b_res->start || b_res->end)
|
||||||
dev_info(&bus->self->dev, "disabling bridge window "
|
dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n",
|
||||||
"%pR to %pR (unused)\n", b_res,
|
b_res, &bus->busn_res);
|
||||||
&bus->busn_res);
|
|
||||||
b_res->flags = 0;
|
b_res->flags = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -872,9 +870,8 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
|
||||||
if (size1 > size0 && realloc_head) {
|
if (size1 > size0 && realloc_head) {
|
||||||
add_to_list(realloc_head, bus->self, b_res, size1-size0,
|
add_to_list(realloc_head, bus->self, b_res, size1-size0,
|
||||||
min_align);
|
min_align);
|
||||||
dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window "
|
dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n",
|
||||||
"%pR to %pR add_size %llx\n", b_res,
|
b_res, &bus->busn_res,
|
||||||
&bus->busn_res,
|
|
||||||
(unsigned long long)size1-size0);
|
(unsigned long long)size1-size0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -974,9 +971,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
|
||||||
if (order < 0)
|
if (order < 0)
|
||||||
order = 0;
|
order = 0;
|
||||||
if (order >= ARRAY_SIZE(aligns)) {
|
if (order >= ARRAY_SIZE(aligns)) {
|
||||||
dev_warn(&dev->dev, "disabling BAR %d: %pR "
|
dev_warn(&dev->dev, "disabling BAR %d: %pR (bad alignment %#llx)\n",
|
||||||
"(bad alignment %#llx)\n", i, r,
|
i, r, (unsigned long long) align);
|
||||||
(unsigned long long) align);
|
|
||||||
r->flags = 0;
|
r->flags = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1003,9 +999,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
|
||||||
resource_size(b_res), min_align);
|
resource_size(b_res), min_align);
|
||||||
if (!size0 && !size1) {
|
if (!size0 && !size1) {
|
||||||
if (b_res->start || b_res->end)
|
if (b_res->start || b_res->end)
|
||||||
dev_info(&bus->self->dev, "disabling bridge window "
|
dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n",
|
||||||
"%pR to %pR (unused)\n", b_res,
|
b_res, &bus->busn_res);
|
||||||
&bus->busn_res);
|
|
||||||
b_res->flags = 0;
|
b_res->flags = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1014,9 +1009,9 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
|
||||||
b_res->flags |= IORESOURCE_STARTALIGN;
|
b_res->flags |= IORESOURCE_STARTALIGN;
|
||||||
if (size1 > size0 && realloc_head) {
|
if (size1 > size0 && realloc_head) {
|
||||||
add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align);
|
add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align);
|
||||||
dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window "
|
dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n",
|
||||||
"%pR to %pR add_size %llx\n", b_res,
|
b_res, &bus->busn_res,
|
||||||
&bus->busn_res, (unsigned long long)size1-size0);
|
(unsigned long long)size1-size0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1274,8 +1269,8 @@ void __pci_bus_assign_resources(const struct pci_bus *bus,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dev_info(&dev->dev, "not setting up bridge for bus "
|
dev_info(&dev->dev, "not setting up bridge for bus %04x:%02x\n",
|
||||||
"%04x:%02x\n", pci_domain_nr(b), b->number);
|
pci_domain_nr(b), b->number);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1312,8 +1307,8 @@ static void __pci_bridge_assign_resources(const struct pci_dev *bridge,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dev_info(&bridge->dev, "not setting up bridge for bus "
|
dev_info(&bridge->dev, "not setting up bridge for bus %04x:%02x\n",
|
||||||
"%04x:%02x\n", pci_domain_nr(b), b->number);
|
pci_domain_nr(b), b->number);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1458,7 +1453,7 @@ static int pci_bus_get_depth(struct pci_bus *bus)
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
struct pci_bus *child_bus;
|
struct pci_bus *child_bus;
|
||||||
|
|
||||||
list_for_each_entry(child_bus, &bus->children, node){
|
list_for_each_entry(child_bus, &bus->children, node) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pci_bus_get_depth(child_bus);
|
ret = pci_bus_get_depth(child_bus);
|
||||||
|
|
|
@ -22,8 +22,7 @@ void __weak pcibios_update_irq(struct pci_dev *dev, int irq)
|
||||||
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
|
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void pdev_fixup_irq(struct pci_dev *dev,
|
||||||
pdev_fixup_irq(struct pci_dev *dev,
|
|
||||||
u8 (*swizzle)(struct pci_dev *, u8 *),
|
u8 (*swizzle)(struct pci_dev *, u8 *),
|
||||||
int (*map_irq)(const struct pci_dev *, u8, u8))
|
int (*map_irq)(const struct pci_dev *, u8, u8))
|
||||||
{
|
{
|
||||||
|
@ -58,11 +57,11 @@ pdev_fixup_irq(struct pci_dev *dev,
|
||||||
pcibios_update_irq(dev, irq);
|
pcibios_update_irq(dev, irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *),
|
||||||
pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *),
|
|
||||||
int (*map_irq)(const struct pci_dev *, u8, u8))
|
int (*map_irq)(const struct pci_dev *, u8, u8))
|
||||||
{
|
{
|
||||||
struct pci_dev *dev = NULL;
|
struct pci_dev *dev = NULL;
|
||||||
|
|
||||||
for_each_pci_dev(dev)
|
for_each_pci_dev(dev)
|
||||||
pdev_fixup_irq(dev, swizzle, map_irq);
|
pdev_fixup_irq(dev, swizzle, map_irq);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,8 @@ void pci_update_resource(struct pci_dev *dev, int resno)
|
||||||
pci_write_config_dword(dev, reg + 4, new);
|
pci_write_config_dword(dev, reg + 4, new);
|
||||||
pci_read_config_dword(dev, reg + 4, &check);
|
pci_read_config_dword(dev, reg + 4, &check);
|
||||||
if (check != new) {
|
if (check != new) {
|
||||||
dev_err(&dev->dev, "BAR %d: error updating "
|
dev_err(&dev->dev, "BAR %d: error updating (high %#08x != %#08x)\n",
|
||||||
"(high %#08x != %#08x)\n", resno, new, check);
|
resno, new, check);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,8 +289,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
|
||||||
res->flags |= IORESOURCE_UNSET;
|
res->flags |= IORESOURCE_UNSET;
|
||||||
align = pci_resource_alignment(dev, res);
|
align = pci_resource_alignment(dev, res);
|
||||||
if (!align) {
|
if (!align) {
|
||||||
dev_info(&dev->dev, "BAR %d: can't assign %pR "
|
dev_info(&dev->dev, "BAR %d: can't assign %pR (bogus alignment)\n",
|
||||||
"(bogus alignment)\n", resno, res);
|
resno, res);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +314,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(pci_assign_resource);
|
||||||
|
|
||||||
int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsize,
|
int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsize,
|
||||||
resource_size_t min_align)
|
resource_size_t min_align)
|
||||||
|
@ -324,8 +325,8 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
|
||||||
|
|
||||||
res->flags |= IORESOURCE_UNSET;
|
res->flags |= IORESOURCE_UNSET;
|
||||||
if (!res->parent) {
|
if (!res->parent) {
|
||||||
dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR "
|
dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n",
|
||||||
"\n", resno, res);
|
resno, res);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
switch(len) {
|
switch (len) {
|
||||||
case 1:
|
case 1:
|
||||||
err = get_user(byte, (u8 __user *)buf);
|
err = get_user(byte, (u8 __user *)buf);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -164,13 +164,17 @@ enum pci_dev_flags {
|
||||||
/* INTX_DISABLE in PCI_COMMAND register disables MSI
|
/* INTX_DISABLE in PCI_COMMAND register disables MSI
|
||||||
* generation too.
|
* generation too.
|
||||||
*/
|
*/
|
||||||
PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
|
PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) (1 << 0),
|
||||||
/* Device configuration is irrevocably lost if disabled into D3 */
|
/* Device configuration is irrevocably lost if disabled into D3 */
|
||||||
PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
|
PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) (1 << 1),
|
||||||
/* Provide indication device is assigned by a Virtual Machine Manager */
|
/* Provide indication device is assigned by a Virtual Machine Manager */
|
||||||
PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
|
PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) (1 << 2),
|
||||||
/* Flag for quirk use to store if quirk-specific ACS is enabled */
|
/* Flag for quirk use to store if quirk-specific ACS is enabled */
|
||||||
PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) 8,
|
PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) (1 << 3),
|
||||||
|
/* Flag to indicate the device uses dma_alias_devfn */
|
||||||
|
PCI_DEV_FLAGS_DMA_ALIAS_DEVFN = (__force pci_dev_flags_t) (1 << 4),
|
||||||
|
/* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */
|
||||||
|
PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum pci_irq_reroute_variant {
|
enum pci_irq_reroute_variant {
|
||||||
|
@ -268,6 +272,7 @@ struct pci_dev {
|
||||||
u8 rom_base_reg; /* which config register controls the ROM */
|
u8 rom_base_reg; /* which config register controls the ROM */
|
||||||
u8 pin; /* which interrupt pin this device uses */
|
u8 pin; /* which interrupt pin this device uses */
|
||||||
u16 pcie_flags_reg; /* cached PCIe Capabilities Register */
|
u16 pcie_flags_reg; /* cached PCIe Capabilities Register */
|
||||||
|
u8 dma_alias_devfn;/* devfn of DMA alias, if any */
|
||||||
|
|
||||||
struct pci_driver *driver; /* which driver has allocated this device */
|
struct pci_driver *driver; /* which driver has allocated this device */
|
||||||
u64 dma_mask; /* Mask of the bits of bus address this
|
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)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int pci_for_each_dma_alias(struct pci_dev *pdev,
|
||||||
|
int (*fn)(struct pci_dev *pdev,
|
||||||
|
u16 alias, void *data), void *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
|
* pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
|
||||||
* @pdev: the PCI device
|
* @pdev: the PCI device
|
||||||
|
|
Загрузка…
Ссылка в новой задаче