aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-08-20 19:51:44 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-08-24 16:43:15 -0400
commit79dd9182db2072d63ccf160bb9a3463b1c952723 (patch)
tree89069b3803a4e07924c6fd4414bbd2a771a432e9 /drivers
parentf1a7bfaf6bb9cb195577e674c0ab2fd0a55d9014 (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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pcie/portdrv.h2
-rw-r--r--drivers/pci/pcie/portdrv_core.c3
-rw-r--r--drivers/pci/pcie/portdrv_pci.c15
3 files changed, 20 insertions, 0 deletions
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
23extern bool pcie_ports_disabled;
24
23extern struct bus_type pcie_port_bus_type; 25extern struct bus_type pcie_port_bus_type;
24extern int pcie_port_device_register(struct pci_dev *dev); 26extern 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 */
495int pcie_port_service_register(struct pcie_port_service_driver *new) 495int 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);
29MODULE_DESCRIPTION(DRIVER_DESC); 29MODULE_DESCRIPTION(DRIVER_DESC);
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
31 31
32/* If this switch is set, PCIe port native services should not be enabled. */
33bool pcie_ports_disabled;
34
35static 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
34static int pcie_portdrv_restore_config(struct pci_dev *dev) 46static 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();