diff options
| author | Rafael J. Wysocki <rjw@sisk.pl> | 2010-08-20 19:51:44 -0400 |
|---|---|---|
| committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-08-24 16:43:15 -0400 |
| commit | 79dd9182db2072d63ccf160bb9a3463b1c952723 (patch) | |
| tree | 89069b3803a4e07924c6fd4414bbd2a771a432e9 | |
| parent | f1a7bfaf6bb9cb195577e674c0ab2fd0a55d9014 (diff) | |
PCI: PCIe: Introduce commad line switch for disabling port services
Introduce kernel command line switch pcie_ports= allowing one to
disable all of the native PCIe port services, so that PCIe ports
are treated like PCI-to-PCI bridges.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
| -rw-r--r-- | Documentation/kernel-parameters.txt | 4 | ||||
| -rw-r--r-- | drivers/pci/pcie/portdrv.h | 2 | ||||
| -rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 3 | ||||
| -rw-r--r-- | drivers/pci/pcie/portdrv_pci.c | 15 |
4 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 873b68090098..b9008fc3a53d 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -2042,6 +2042,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 2042 | force Enable ASPM even on devices that claim not to support it. | 2042 | force Enable ASPM even on devices that claim not to support it. |
| 2043 | WARNING: Forcing ASPM on may cause system lockups. | 2043 | WARNING: Forcing ASPM on may cause system lockups. |
| 2044 | 2044 | ||
| 2045 | pcie_ports= [PCIE] PCIe ports handling: | ||
| 2046 | compat Treat PCIe ports as PCI-to-PCI bridges, disable the PCIe | ||
| 2047 | ports driver. | ||
| 2048 | |||
| 2045 | pcie_pme= [PCIE,PM] Native PCIe PME signaling options: | 2049 | pcie_pme= [PCIE,PM] Native PCIe PME signaling options: |
| 2046 | Format: {auto|force}[,nomsi] | 2050 | Format: {auto|force}[,nomsi] |
| 2047 | auto Use native PCIe PME signaling if the BIOS allows the | 2051 | auto Use native PCIe PME signaling if the BIOS allows the |
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h index 813a5c3427b6..966f6e9761c8 100644 --- a/drivers/pci/pcie/portdrv.h +++ b/drivers/pci/pcie/portdrv.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | 20 | ||
| 21 | #define get_descriptor_id(type, service) (((type - 4) << 4) | service) | 21 | #define get_descriptor_id(type, service) (((type - 4) << 4) | service) |
| 22 | 22 | ||
| 23 | extern bool pcie_ports_disabled; | ||
| 24 | |||
| 23 | extern struct bus_type pcie_port_bus_type; | 25 | extern struct bus_type pcie_port_bus_type; |
| 24 | extern int pcie_port_device_register(struct pci_dev *dev); | 26 | extern int pcie_port_device_register(struct pci_dev *dev); |
| 25 | #ifdef CONFIG_PM | 27 | #ifdef CONFIG_PM |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index e73effbe402c..2bf2fe510e15 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
| @@ -494,6 +494,9 @@ static void pcie_port_shutdown_service(struct device *dev) {} | |||
| 494 | */ | 494 | */ |
| 495 | int pcie_port_service_register(struct pcie_port_service_driver *new) | 495 | int pcie_port_service_register(struct pcie_port_service_driver *new) |
| 496 | { | 496 | { |
| 497 | if (pcie_ports_disabled) | ||
| 498 | return -ENODEV; | ||
| 499 | |||
| 497 | new->driver.name = (char *)new->name; | 500 | new->driver.name = (char *)new->name; |
| 498 | new->driver.bus = &pcie_port_bus_type; | 501 | new->driver.bus = &pcie_port_bus_type; |
| 499 | new->driver.probe = pcie_port_probe_service; | 502 | new->driver.probe = pcie_port_probe_service; |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 3debed25e46b..a04392da6ce1 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
| @@ -29,6 +29,18 @@ MODULE_AUTHOR(DRIVER_AUTHOR); | |||
| 29 | MODULE_DESCRIPTION(DRIVER_DESC); | 29 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
| 31 | 31 | ||
| 32 | /* If this switch is set, PCIe port native services should not be enabled. */ | ||
| 33 | bool pcie_ports_disabled; | ||
| 34 | |||
| 35 | static int __init pcie_port_setup(char *str) | ||
| 36 | { | ||
| 37 | if (!strncmp(str, "compat", 6)) | ||
| 38 | pcie_ports_disabled = true; | ||
| 39 | |||
| 40 | return 1; | ||
| 41 | } | ||
| 42 | __setup("pcie_ports=", pcie_port_setup); | ||
| 43 | |||
| 32 | /* global data */ | 44 | /* global data */ |
| 33 | 45 | ||
| 34 | static int pcie_portdrv_restore_config(struct pci_dev *dev) | 46 | static int pcie_portdrv_restore_config(struct pci_dev *dev) |
| @@ -301,6 +313,9 @@ static int __init pcie_portdrv_init(void) | |||
| 301 | { | 313 | { |
| 302 | int retval; | 314 | int retval; |
| 303 | 315 | ||
| 316 | if (pcie_ports_disabled) | ||
| 317 | return -EACCES; | ||
| 318 | |||
| 304 | dmi_check_system(pcie_portdrv_dmi_table); | 319 | dmi_check_system(pcie_portdrv_dmi_table); |
| 305 | 320 | ||
| 306 | retval = pcie_port_bus_register(); | 321 | retval = pcie_port_bus_register(); |
