aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-09-23 19:58:08 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-09-23 19:58:08 -0400
commit3ba8b7c542cd06eafbd24f266a00623b89577d9d (patch)
tree4d14526d61ff258d0613fb5f93994228a13bfff0
parent4a10c2ac2f368583138b774ca41fac4207911983 (diff)
parent955f14b4ed0648da12f0a7011f94150b8982a5c2 (diff)
Merge branch 'pci/bjorn-osc' into next
* pci/bjorn-osc: PCI/ACPI: Decode _OSC bitmasks symbolically PCI/ACPI: Separate out _OSC "we don't support enough services" path PCI/ACPI: Separate out _OSC "PCIe port services disabled" path PCI/ACPI: Skip _OSC control tests if _OSC support call failed PCI/ACPI: Run _OSC only once for OSPM feature support PCI/ACPI: Split _OSC "support" and "control" flags into separate variables PCI/ACPI: Move _OSC stuff from acpi_pci_root_add() to negotiate_os_control() PCI/ACPI: Drop unnecessary _OSC existence tests PCI/ACPI: Name _OSC #defines more consistently ACPI: Write OSC_PCI_CONTROL_MASKS like OSC_PCI_SUPPORT_MASKS ACPI: Remove unused OSC_PCI_NATIVE_HOTPLUG ACPI: Tidy acpi_run_osc() declarations ACPI: Rename OSC_QUERY_TYPE to OSC_QUERY_DWORD ACPI: Write _OSC bit field definitions in hex
-rw-r--r--drivers/acpi/apei/apei-base.c6
-rw-r--r--drivers/acpi/bus.c18
-rw-r--r--drivers/acpi/pci_root.c246
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c2
-rw-r--r--drivers/pci/hotplug/shpchp.h2
-rw-r--r--include/linux/acpi.h81
6 files changed, 199 insertions, 156 deletions
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 46f80e2c92f7..6d2c49b86b7f 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -758,9 +758,9 @@ int apei_osc_setup(void)
758 .cap.pointer = capbuf, 758 .cap.pointer = capbuf,
759 }; 759 };
760 760
761 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; 761 capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE;
762 capbuf[OSC_SUPPORT_TYPE] = 1; 762 capbuf[OSC_SUPPORT_DWORD] = 1;
763 capbuf[OSC_CONTROL_TYPE] = 0; 763 capbuf[OSC_CONTROL_DWORD] = 0;
764 764
765 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) 765 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))
766 || ACPI_FAILURE(acpi_run_osc(handle, &context))) 766 || ACPI_FAILURE(acpi_run_osc(handle, &context)))
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index b587ec8257b2..fbcfaa682c15 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -255,7 +255,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
255 acpi_print_osc_error(handle, context, 255 acpi_print_osc_error(handle, context,
256 "_OSC invalid revision"); 256 "_OSC invalid revision");
257 if (errors & OSC_CAPABILITIES_MASK_ERROR) { 257 if (errors & OSC_CAPABILITIES_MASK_ERROR) {
258 if (((u32 *)context->cap.pointer)[OSC_QUERY_TYPE] 258 if (((u32 *)context->cap.pointer)[OSC_QUERY_DWORD]
259 & OSC_QUERY_ENABLE) 259 & OSC_QUERY_ENABLE)
260 goto out_success; 260 goto out_success;
261 status = AE_SUPPORT; 261 status = AE_SUPPORT;
@@ -295,30 +295,30 @@ static void acpi_bus_osc_support(void)
295 }; 295 };
296 acpi_handle handle; 296 acpi_handle handle;
297 297
298 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; 298 capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE;
299 capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ 299 capbuf[OSC_SUPPORT_DWORD] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */
300#if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ 300#if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\
301 defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) 301 defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE)
302 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; 302 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PAD_SUPPORT;
303#endif 303#endif
304 304
305#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) 305#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
306 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; 306 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
307#endif 307#endif
308 308
309#ifdef ACPI_HOTPLUG_OST 309#ifdef ACPI_HOTPLUG_OST
310 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_HOTPLUG_OST_SUPPORT; 310 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
311#endif 311#endif
312 312
313 if (!ghes_disable) 313 if (!ghes_disable)
314 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_APEI_SUPPORT; 314 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT;
315 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) 315 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
316 return; 316 return;
317 if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) { 317 if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) {
318 u32 *capbuf_ret = context.ret.pointer; 318 u32 *capbuf_ret = context.ret.pointer;
319 if (context.ret.length > OSC_SUPPORT_TYPE) 319 if (context.ret.length > OSC_SUPPORT_DWORD)
320 osc_sb_apei_support_acked = 320 osc_sb_apei_support_acked =
321 capbuf_ret[OSC_SUPPORT_TYPE] & OSC_SB_APEI_SUPPORT; 321 capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
322 kfree(context.ret.pointer); 322 kfree(context.ret.pointer);
323 } 323 }
324 /* do we need to check other returned cap? Sounds no */ 324 /* do we need to check other returned cap? Sounds no */
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index d3874f425653..924ad92852c1 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -49,10 +49,10 @@ static int acpi_pci_root_add(struct acpi_device *device,
49 const struct acpi_device_id *not_used); 49 const struct acpi_device_id *not_used);
50static void acpi_pci_root_remove(struct acpi_device *device); 50static void acpi_pci_root_remove(struct acpi_device *device);
51 51
52#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ 52#define ACPI_PCIE_REQ_SUPPORT (OSC_PCI_EXT_CONFIG_SUPPORT \
53 | OSC_ACTIVE_STATE_PWR_SUPPORT \ 53 | OSC_PCI_ASPM_SUPPORT \
54 | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \ 54 | OSC_PCI_CLOCK_PM_SUPPORT \
55 | OSC_MSI_SUPPORT) 55 | OSC_PCI_MSI_SUPPORT)
56 56
57static const struct acpi_device_id root_device_ids[] = { 57static const struct acpi_device_id root_device_ids[] = {
58 {"PNP0A03", 0}, 58 {"PNP0A03", 0},
@@ -127,6 +127,55 @@ static acpi_status try_get_root_bridge_busnr(acpi_handle handle,
127 return AE_OK; 127 return AE_OK;
128} 128}
129 129
130struct pci_osc_bit_struct {
131 u32 bit;
132 char *desc;
133};
134
135static struct pci_osc_bit_struct pci_osc_support_bit[] = {
136 { OSC_PCI_EXT_CONFIG_SUPPORT, "ExtendedConfig" },
137 { OSC_PCI_ASPM_SUPPORT, "ASPM" },
138 { OSC_PCI_CLOCK_PM_SUPPORT, "ClockPM" },
139 { OSC_PCI_SEGMENT_GROUPS_SUPPORT, "Segments" },
140 { OSC_PCI_MSI_SUPPORT, "MSI" },
141};
142
143static struct pci_osc_bit_struct pci_osc_control_bit[] = {
144 { OSC_PCI_EXPRESS_NATIVE_HP_CONTROL, "PCIeHotplug" },
145 { OSC_PCI_SHPC_NATIVE_HP_CONTROL, "SHPCHotplug" },
146 { OSC_PCI_EXPRESS_PME_CONTROL, "PME" },
147 { OSC_PCI_EXPRESS_AER_CONTROL, "AER" },
148 { OSC_PCI_EXPRESS_CAPABILITY_CONTROL, "PCIeCapability" },
149};
150
151static void decode_osc_bits(struct acpi_pci_root *root, char *msg, u32 word,
152 struct pci_osc_bit_struct *table, int size)
153{
154 char buf[80];
155 int i, len = 0;
156 struct pci_osc_bit_struct *entry;
157
158 buf[0] = '\0';
159 for (i = 0, entry = table; i < size; i++, entry++)
160 if (word & entry->bit)
161 len += snprintf(buf + len, sizeof(buf) - len, "%s%s",
162 len ? " " : "", entry->desc);
163
164 dev_info(&root->device->dev, "_OSC: %s [%s]\n", msg, buf);
165}
166
167static void decode_osc_support(struct acpi_pci_root *root, char *msg, u32 word)
168{
169 decode_osc_bits(root, msg, word, pci_osc_support_bit,
170 ARRAY_SIZE(pci_osc_support_bit));
171}
172
173static void decode_osc_control(struct acpi_pci_root *root, char *msg, u32 word)
174{
175 decode_osc_bits(root, msg, word, pci_osc_control_bit,
176 ARRAY_SIZE(pci_osc_control_bit));
177}
178
130static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766"; 179static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766";
131 180
132static acpi_status acpi_pci_run_osc(acpi_handle handle, 181static acpi_status acpi_pci_run_osc(acpi_handle handle,
@@ -158,14 +207,14 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root,
158 support &= OSC_PCI_SUPPORT_MASKS; 207 support &= OSC_PCI_SUPPORT_MASKS;
159 support |= root->osc_support_set; 208 support |= root->osc_support_set;
160 209
161 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; 210 capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE;
162 capbuf[OSC_SUPPORT_TYPE] = support; 211 capbuf[OSC_SUPPORT_DWORD] = support;
163 if (control) { 212 if (control) {
164 *control &= OSC_PCI_CONTROL_MASKS; 213 *control &= OSC_PCI_CONTROL_MASKS;
165 capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set; 214 capbuf[OSC_CONTROL_DWORD] = *control | root->osc_control_set;
166 } else { 215 } else {
167 /* Run _OSC query only with existing controls. */ 216 /* Run _OSC query only with existing controls. */
168 capbuf[OSC_CONTROL_TYPE] = root->osc_control_set; 217 capbuf[OSC_CONTROL_DWORD] = root->osc_control_set;
169 } 218 }
170 219
171 status = acpi_pci_run_osc(root->device->handle, capbuf, &result); 220 status = acpi_pci_run_osc(root->device->handle, capbuf, &result);
@@ -180,11 +229,7 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root,
180static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags) 229static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags)
181{ 230{
182 acpi_status status; 231 acpi_status status;
183 acpi_handle tmp;
184 232
185 status = acpi_get_handle(root->device->handle, "_OSC", &tmp);
186 if (ACPI_FAILURE(status))
187 return status;
188 mutex_lock(&osc_lock); 233 mutex_lock(&osc_lock);
189 status = acpi_pci_query_osc(root, flags, NULL); 234 status = acpi_pci_query_osc(root, flags, NULL);
190 mutex_unlock(&osc_lock); 235 mutex_unlock(&osc_lock);
@@ -316,9 +361,8 @@ EXPORT_SYMBOL_GPL(acpi_get_pci_dev);
316acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) 361acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req)
317{ 362{
318 struct acpi_pci_root *root; 363 struct acpi_pci_root *root;
319 acpi_status status; 364 acpi_status status = AE_OK;
320 u32 ctrl, capbuf[3]; 365 u32 ctrl, capbuf[3];
321 acpi_handle tmp;
322 366
323 if (!mask) 367 if (!mask)
324 return AE_BAD_PARAMETER; 368 return AE_BAD_PARAMETER;
@@ -331,10 +375,6 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req)
331 if (!root) 375 if (!root)
332 return AE_NOT_EXIST; 376 return AE_NOT_EXIST;
333 377
334 status = acpi_get_handle(handle, "_OSC", &tmp);
335 if (ACPI_FAILURE(status))
336 return status;
337
338 mutex_lock(&osc_lock); 378 mutex_lock(&osc_lock);
339 379
340 *mask = ctrl | root->osc_control_set; 380 *mask = ctrl | root->osc_control_set;
@@ -349,17 +389,21 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req)
349 goto out; 389 goto out;
350 if (ctrl == *mask) 390 if (ctrl == *mask)
351 break; 391 break;
392 decode_osc_control(root, "platform does not support",
393 ctrl & ~(*mask));
352 ctrl = *mask; 394 ctrl = *mask;
353 } 395 }
354 396
355 if ((ctrl & req) != req) { 397 if ((ctrl & req) != req) {
398 decode_osc_control(root, "not requesting control; platform does not support",
399 req & ~(ctrl));
356 status = AE_SUPPORT; 400 status = AE_SUPPORT;
357 goto out; 401 goto out;
358 } 402 }
359 403
360 capbuf[OSC_QUERY_TYPE] = 0; 404 capbuf[OSC_QUERY_DWORD] = 0;
361 capbuf[OSC_SUPPORT_TYPE] = root->osc_support_set; 405 capbuf[OSC_SUPPORT_DWORD] = root->osc_support_set;
362 capbuf[OSC_CONTROL_TYPE] = ctrl; 406 capbuf[OSC_CONTROL_DWORD] = ctrl;
363 status = acpi_pci_run_osc(handle, capbuf, mask); 407 status = acpi_pci_run_osc(handle, capbuf, mask);
364 if (ACPI_SUCCESS(status)) 408 if (ACPI_SUCCESS(status))
365 root->osc_control_set = *mask; 409 root->osc_control_set = *mask;
@@ -369,6 +413,87 @@ out:
369} 413}
370EXPORT_SYMBOL(acpi_pci_osc_control_set); 414EXPORT_SYMBOL(acpi_pci_osc_control_set);
371 415
416static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
417 int *clear_aspm)
418{
419 u32 support, control, requested;
420 acpi_status status;
421 struct acpi_device *device = root->device;
422 acpi_handle handle = device->handle;
423
424 /*
425 * All supported architectures that use ACPI have support for
426 * PCI domains, so we indicate this in _OSC support capabilities.
427 */
428 support = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
429 if (pci_ext_cfg_avail())
430 support |= OSC_PCI_EXT_CONFIG_SUPPORT;
431 if (pcie_aspm_support_enabled())
432 support |= OSC_PCI_ASPM_SUPPORT | OSC_PCI_CLOCK_PM_SUPPORT;
433 if (pci_msi_enabled())
434 support |= OSC_PCI_MSI_SUPPORT;
435
436 decode_osc_support(root, "OS supports", support);
437 status = acpi_pci_osc_support(root, support);
438 if (ACPI_FAILURE(status)) {
439 dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n",
440 acpi_format_exception(status));
441 *no_aspm = 1;
442 return;
443 }
444
445 if (pcie_ports_disabled) {
446 dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n");
447 return;
448 }
449
450 if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
451 decode_osc_support(root, "not requesting OS control; OS requires",
452 ACPI_PCIE_REQ_SUPPORT);
453 return;
454 }
455
456 control = OSC_PCI_EXPRESS_CAPABILITY_CONTROL
457 | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
458 | OSC_PCI_EXPRESS_PME_CONTROL;
459
460 if (pci_aer_available()) {
461 if (aer_acpi_firmware_first())
462 dev_info(&device->dev,
463 "PCIe AER handled by firmware\n");
464 else
465 control |= OSC_PCI_EXPRESS_AER_CONTROL;
466 }
467
468 requested = control;
469 status = acpi_pci_osc_control_set(handle, &control,
470 OSC_PCI_EXPRESS_CAPABILITY_CONTROL);
471 if (ACPI_SUCCESS(status)) {
472 decode_osc_control(root, "OS now controls", control);
473 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
474 /*
475 * We have ASPM control, but the FADT indicates
476 * that it's unsupported. Clear it.
477 */
478 *clear_aspm = 1;
479 }
480 } else {
481 decode_osc_control(root, "OS requested", requested);
482 decode_osc_control(root, "platform willing to grant", control);
483 dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n",
484 acpi_format_exception(status));
485
486 /*
487 * We want to disable ASPM here, but aspm_disabled
488 * needs to remain in its state from boot so that we
489 * properly handle PCIe 1.1 devices. So we set this
490 * flag here, to defer the action until after the ACPI
491 * root scan.
492 */
493 *no_aspm = 1;
494 }
495}
496
372static int acpi_pci_root_add(struct acpi_device *device, 497static int acpi_pci_root_add(struct acpi_device *device,
373 const struct acpi_device_id *not_used) 498 const struct acpi_device_id *not_used)
374{ 499{
@@ -376,9 +501,8 @@ static int acpi_pci_root_add(struct acpi_device *device,
376 acpi_status status; 501 acpi_status status;
377 int result; 502 int result;
378 struct acpi_pci_root *root; 503 struct acpi_pci_root *root;
379 u32 flags, base_flags;
380 acpi_handle handle = device->handle; 504 acpi_handle handle = device->handle;
381 bool no_aspm = false, clear_aspm = false; 505 int no_aspm = 0, clear_aspm = 0;
382 506
383 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); 507 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
384 if (!root) 508 if (!root)
@@ -431,81 +555,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
431 555
432 root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle); 556 root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle);
433 557
434 /* 558 negotiate_os_control(root, &no_aspm, &clear_aspm);
435 * All supported architectures that use ACPI have support for
436 * PCI domains, so we indicate this in _OSC support capabilities.
437 */
438 flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
439 acpi_pci_osc_support(root, flags);
440
441 if (pci_ext_cfg_avail())
442 flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
443 if (pcie_aspm_support_enabled()) {
444 flags |= OSC_ACTIVE_STATE_PWR_SUPPORT |
445 OSC_CLOCK_PWR_CAPABILITY_SUPPORT;
446 }
447 if (pci_msi_enabled())
448 flags |= OSC_MSI_SUPPORT;
449 if (flags != base_flags) {
450 status = acpi_pci_osc_support(root, flags);
451 if (ACPI_FAILURE(status)) {
452 dev_info(&device->dev, "ACPI _OSC support "
453 "notification failed, disabling PCIe ASPM\n");
454 no_aspm = true;
455 flags = base_flags;
456 }
457 }
458
459 if (!pcie_ports_disabled
460 && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
461 flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
462 | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
463 | OSC_PCI_EXPRESS_PME_CONTROL;
464
465 if (pci_aer_available()) {
466 if (aer_acpi_firmware_first())
467 dev_dbg(&device->dev,
468 "PCIe errors handled by BIOS.\n");
469 else
470 flags |= OSC_PCI_EXPRESS_AER_CONTROL;
471 }
472
473 dev_info(&device->dev,
474 "Requesting ACPI _OSC control (0x%02x)\n", flags);
475
476 status = acpi_pci_osc_control_set(handle, &flags,
477 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
478 if (ACPI_SUCCESS(status)) {
479 dev_info(&device->dev,
480 "ACPI _OSC control (0x%02x) granted\n", flags);
481 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
482 /*
483 * We have ASPM control, but the FADT indicates
484 * that it's unsupported. Clear it.
485 */
486 clear_aspm = true;
487 }
488 } else {
489 dev_info(&device->dev,
490 "ACPI _OSC request failed (%s), "
491 "returned control mask: 0x%02x\n",
492 acpi_format_exception(status), flags);
493 dev_info(&device->dev,
494 "ACPI _OSC control for PCIe not granted, disabling ASPM\n");
495 /*
496 * We want to disable ASPM here, but aspm_disabled
497 * needs to remain in its state from boot so that we
498 * properly handle PCIe 1.1 devices. So we set this
499 * flag here, to defer the action until after the ACPI
500 * root scan.
501 */
502 no_aspm = true;
503 }
504 } else {
505 dev_info(&device->dev,
506 "Unable to request _OSC control "
507 "(_OSC support mask: 0x%02x)\n", flags);
508 }
509 559
510 /* 560 /*
511 * TBD: Need PCI interface for enumeration/configuration of roots. 561 * TBD: Need PCI interface for enumeration/configuration of roots.
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index 2a47e82821da..f8140164ec0b 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -338,7 +338,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
338 acpi_handle chandle, handle; 338 acpi_handle chandle, handle;
339 struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; 339 struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };
340 340
341 flags &= OSC_SHPC_NATIVE_HP_CONTROL; 341 flags &= OSC_PCI_SHPC_NATIVE_HP_CONTROL;
342 if (!flags) { 342 if (!flags) {
343 err("Invalid flags %u specified!\n", flags); 343 err("Invalid flags %u specified!\n", flags);
344 return -EINVAL; 344 return -EINVAL;
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index e260f207a90e..d876e4b3c6a9 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -191,7 +191,7 @@ static inline const char *slot_name(struct slot *slot)
191#include <linux/pci-acpi.h> 191#include <linux/pci-acpi.h>
192static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev) 192static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev)
193{ 193{
194 u32 flags = OSC_SHPC_NATIVE_HP_CONTROL; 194 u32 flags = OSC_PCI_SHPC_NATIVE_HP_CONTROL;
195 return acpi_get_hp_hw_control_from_firmware(dev, flags); 195 return acpi_get_hp_hw_control_from_firmware(dev, flags);
196} 196}
197#else 197#else
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a5db4aeefa36..e2e52cf53224 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -294,58 +294,51 @@ void __init acpi_nvs_nosave_s3(void);
294#endif /* CONFIG_PM_SLEEP */ 294#endif /* CONFIG_PM_SLEEP */
295 295
296struct acpi_osc_context { 296struct acpi_osc_context {
297 char *uuid_str; /* uuid string */ 297 char *uuid_str; /* UUID string */
298 int rev; 298 int rev;
299 struct acpi_buffer cap; /* arg2/arg3 */ 299 struct acpi_buffer cap; /* list of DWORD capabilities */
300 struct acpi_buffer ret; /* free by caller if success */ 300 struct acpi_buffer ret; /* free by caller if success */
301}; 301};
302 302
303#define OSC_QUERY_TYPE 0
304#define OSC_SUPPORT_TYPE 1
305#define OSC_CONTROL_TYPE 2
306
307/* _OSC DW0 Definition */
308#define OSC_QUERY_ENABLE 1
309#define OSC_REQUEST_ERROR 2
310#define OSC_INVALID_UUID_ERROR 4
311#define OSC_INVALID_REVISION_ERROR 8
312#define OSC_CAPABILITIES_MASK_ERROR 16
313
314acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); 303acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
315 304
316/* platform-wide _OSC bits */ 305/* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */
317#define OSC_SB_PAD_SUPPORT 1 306#define OSC_QUERY_DWORD 0 /* DWORD 1 */
318#define OSC_SB_PPC_OST_SUPPORT 2 307#define OSC_SUPPORT_DWORD 1 /* DWORD 2 */
319#define OSC_SB_PR3_SUPPORT 4 308#define OSC_CONTROL_DWORD 2 /* DWORD 3 */
320#define OSC_SB_HOTPLUG_OST_SUPPORT 8 309
321#define OSC_SB_APEI_SUPPORT 16 310/* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */
311#define OSC_QUERY_ENABLE 0x00000001 /* input */
312#define OSC_REQUEST_ERROR 0x00000002 /* return */
313#define OSC_INVALID_UUID_ERROR 0x00000004 /* return */
314#define OSC_INVALID_REVISION_ERROR 0x00000008 /* return */
315#define OSC_CAPABILITIES_MASK_ERROR 0x00000010 /* return */
316
317/* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */
318#define OSC_SB_PAD_SUPPORT 0x00000001
319#define OSC_SB_PPC_OST_SUPPORT 0x00000002
320#define OSC_SB_PR3_SUPPORT 0x00000004
321#define OSC_SB_HOTPLUG_OST_SUPPORT 0x00000008
322#define OSC_SB_APEI_SUPPORT 0x00000010
323#define OSC_SB_CPC_SUPPORT 0x00000020
322 324
323extern bool osc_sb_apei_support_acked; 325extern bool osc_sb_apei_support_acked;
324 326
325/* PCI defined _OSC bits */ 327/* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */
326/* _OSC DW1 Definition (OS Support Fields) */ 328#define OSC_PCI_EXT_CONFIG_SUPPORT 0x00000001
327#define OSC_EXT_PCI_CONFIG_SUPPORT 1 329#define OSC_PCI_ASPM_SUPPORT 0x00000002
328#define OSC_ACTIVE_STATE_PWR_SUPPORT 2 330#define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004
329#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 331#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008
330#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 332#define OSC_PCI_MSI_SUPPORT 0x00000010
331#define OSC_MSI_SUPPORT 16 333#define OSC_PCI_SUPPORT_MASKS 0x0000001f
332#define OSC_PCI_SUPPORT_MASKS 0x1f 334
333 335/* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
334/* _OSC DW1 Definition (OS Control Fields) */ 336#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001
335#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 337#define OSC_PCI_SHPC_NATIVE_HP_CONTROL 0x00000002
336#define OSC_SHPC_NATIVE_HP_CONTROL 2 338#define OSC_PCI_EXPRESS_PME_CONTROL 0x00000004
337#define OSC_PCI_EXPRESS_PME_CONTROL 4 339#define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008
338#define OSC_PCI_EXPRESS_AER_CONTROL 8 340#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
339#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 341#define OSC_PCI_CONTROL_MASKS 0x0000001f
340
341#define OSC_PCI_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
342 OSC_SHPC_NATIVE_HP_CONTROL | \
343 OSC_PCI_EXPRESS_PME_CONTROL | \
344 OSC_PCI_EXPRESS_AER_CONTROL | \
345 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
346
347#define OSC_PCI_NATIVE_HOTPLUG (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
348 OSC_SHPC_NATIVE_HP_CONTROL)
349 342
350extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 343extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
351 u32 *mask, u32 req); 344 u32 *mask, u32 req);