aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2018-03-09 12:21:30 -0500
committerBjorn Helgaas <helgaas@kernel.org>2018-03-30 18:26:58 -0400
commitd850882b726f6db01b0792151e72e69b234aa461 (patch)
tree98f978f5570c10d7c9e23106428e291181876679
parent842b447f0074b93e9f7db60039fdc72ec14bef9a (diff)
PCI/portdrv: Rename and reverse sense of pcie_ports_auto
The platform may restrict the OS's use of PCIe services, e.g., via the ACPI _OSC method. The user may use "pcie_ports=native" to force the port driver to use PCIe services even if the platform asked us not to. The "pcie_ports=native" parameter determines the setting of pcie_ports_auto. Rename this to pcie_ports_native and reverse the sense to simplify the code. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/pcie/portdrv.h2
-rw-r--r--drivers/pci/pcie/portdrv_core.c15
-rw-r--r--drivers/pci/pcie/portdrv_pci.c15
3 files changed, 12 insertions, 20 deletions
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index 62e28b5afa51..3e0058a5500f 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14 14
15extern bool pcie_ports_auto; 15extern bool pcie_ports_native;
16 16
17/* Service Type */ 17/* Service Type */
18#define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */ 18#define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 6ed67cbf6148..6890aea4a550 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -193,17 +193,10 @@ legacy_irq:
193static int get_port_device_capability(struct pci_dev *dev) 193static int get_port_device_capability(struct pci_dev *dev)
194{ 194{
195 struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); 195 struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
196 bool native;
197 int services = 0; 196 int services = 0;
198 197
199 /* 198 if (dev->is_hotplug_bridge &&
200 * If the user specified "pcie_ports=native", use the PCIe services 199 (pcie_ports_native || host->native_hotplug)) {
201 * regardless of whether the platform has given us permission. On
202 * ACPI systems, this means we ignore _OSC.
203 */
204 native = !pcie_ports_auto;
205
206 if (dev->is_hotplug_bridge && (native || host->native_hotplug)) {
207 services |= PCIE_PORT_SERVICE_HP; 200 services |= PCIE_PORT_SERVICE_HP;
208 201
209 /* 202 /*
@@ -215,7 +208,7 @@ static int get_port_device_capability(struct pci_dev *dev)
215 } 208 }
216 209
217 if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR) && 210 if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR) &&
218 pci_aer_available() && (native || host->native_aer)) { 211 pci_aer_available() && (pcie_ports_native || host->native_aer)) {
219 services |= PCIE_PORT_SERVICE_AER; 212 services |= PCIE_PORT_SERVICE_AER;
220 213
221 /* 214 /*
@@ -231,7 +224,7 @@ static int get_port_device_capability(struct pci_dev *dev)
231 * those yet. 224 * those yet.
232 */ 225 */
233 if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT && 226 if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT &&
234 (native || host->native_pme)) { 227 (pcie_ports_native || host->native_pme)) {
235 services |= PCIE_PORT_SERVICE_PME; 228 services |= PCIE_PORT_SERVICE_PME;
236 229
237 /* 230 /*
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 8b62192342ac..8e4260d25941 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -25,19 +25,18 @@
25bool pcie_ports_disabled; 25bool pcie_ports_disabled;
26 26
27/* 27/*
28 * If this switch is set, ACPI _OSC will be used to determine whether or not to 28 * If the user specified "pcie_ports=native", use the PCIe services regardless
29 * enable PCIe port native services. 29 * of whether the platform has given us permission. On ACPI systems, this
30 * means we ignore _OSC.
30 */ 31 */
31bool pcie_ports_auto = true; 32bool pcie_ports_native;
32 33
33static int __init pcie_port_setup(char *str) 34static int __init pcie_port_setup(char *str)
34{ 35{
35 if (!strncmp(str, "compat", 6)) { 36 if (!strncmp(str, "compat", 6))
36 pcie_ports_disabled = true; 37 pcie_ports_disabled = true;
37 } else if (!strncmp(str, "native", 6)) { 38 else if (!strncmp(str, "native", 6))
38 pcie_ports_disabled = false; 39 pcie_ports_native = true;
39 pcie_ports_auto = false;
40 }
41 40
42 return 1; 41 return 1;
43} 42}