aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-09-05 17:07:45 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-09-23 19:40:47 -0400
commit955f14b4ed0648da12f0a7011f94150b8982a5c2 (patch)
tree4d14526d61ff258d0613fb5f93994228a13bfff0 /drivers/acpi
parentde18966228ed4b42393ecbe83ba20ff3db78bfdc (diff)
PCI/ACPI: Decode _OSC bitmasks symbolically
This updates _OSC-related messages to be more human-readable. We now always show the features we declare support for (this was previously invisible) as well as the features we are granted control of. Typical changes: -acpi PNP0A08:00: Requesting ACPI _OSC control (0x1d) -acpi PNP0A08:00: ACPI _OSC control (0x1d) granted +acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI] +acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME AER PCIeCapability] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/pci_root.c84
1 files changed, 67 insertions, 17 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 65aefcf78552..924ad92852c1 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -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,
@@ -340,10 +389,14 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req)
340 goto out; 389 goto out;
341 if (ctrl == *mask) 390 if (ctrl == *mask)
342 break; 391 break;
392 decode_osc_control(root, "platform does not support",
393 ctrl & ~(*mask));
343 ctrl = *mask; 394 ctrl = *mask;
344 } 395 }
345 396
346 if ((ctrl & req) != req) { 397 if ((ctrl & req) != req) {
398 decode_osc_control(root, "not requesting control; platform does not support",
399 req & ~(ctrl));
347 status = AE_SUPPORT; 400 status = AE_SUPPORT;
348 goto out; 401 goto out;
349 } 402 }
@@ -363,7 +416,7 @@ EXPORT_SYMBOL(acpi_pci_osc_control_set);
363static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, 416static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
364 int *clear_aspm) 417 int *clear_aspm)
365{ 418{
366 u32 support, control; 419 u32 support, control, requested;
367 acpi_status status; 420 acpi_status status;
368 struct acpi_device *device = root->device; 421 struct acpi_device *device = root->device;
369 acpi_handle handle = device->handle; 422 acpi_handle handle = device->handle;
@@ -379,6 +432,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
379 support |= OSC_PCI_ASPM_SUPPORT | OSC_PCI_CLOCK_PM_SUPPORT; 432 support |= OSC_PCI_ASPM_SUPPORT | OSC_PCI_CLOCK_PM_SUPPORT;
380 if (pci_msi_enabled()) 433 if (pci_msi_enabled())
381 support |= OSC_PCI_MSI_SUPPORT; 434 support |= OSC_PCI_MSI_SUPPORT;
435
436 decode_osc_support(root, "OS supports", support);
382 status = acpi_pci_osc_support(root, support); 437 status = acpi_pci_osc_support(root, support);
383 if (ACPI_FAILURE(status)) { 438 if (ACPI_FAILURE(status)) {
384 dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", 439 dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n",
@@ -393,8 +448,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
393 } 448 }
394 449
395 if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) { 450 if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
396 dev_info(&device->dev, "Not requesting _OSC control (we support %#02x but %#02x are required)\n", 451 decode_osc_support(root, "not requesting OS control; OS requires",
397 support, ACPI_PCIE_REQ_SUPPORT); 452 ACPI_PCIE_REQ_SUPPORT);
398 return; 453 return;
399 } 454 }
400 455
@@ -404,21 +459,17 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
404 459
405 if (pci_aer_available()) { 460 if (pci_aer_available()) {
406 if (aer_acpi_firmware_first()) 461 if (aer_acpi_firmware_first())
407 dev_dbg(&device->dev, 462 dev_info(&device->dev,
408 "PCIe errors handled by BIOS.\n"); 463 "PCIe AER handled by firmware\n");
409 else 464 else
410 control |= OSC_PCI_EXPRESS_AER_CONTROL; 465 control |= OSC_PCI_EXPRESS_AER_CONTROL;
411 } 466 }
412 467
413 dev_info(&device->dev, 468 requested = control;
414 "Requesting ACPI _OSC control (0x%02x)\n", control);
415
416 status = acpi_pci_osc_control_set(handle, &control, 469 status = acpi_pci_osc_control_set(handle, &control,
417 OSC_PCI_EXPRESS_CAPABILITY_CONTROL); 470 OSC_PCI_EXPRESS_CAPABILITY_CONTROL);
418 if (ACPI_SUCCESS(status)) { 471 if (ACPI_SUCCESS(status)) {
419 dev_info(&device->dev, 472 decode_osc_control(root, "OS now controls", control);
420 "ACPI _OSC control (0x%02x) granted\n",
421 control);
422 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { 473 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
423 /* 474 /*
424 * We have ASPM control, but the FADT indicates 475 * We have ASPM control, but the FADT indicates
@@ -427,12 +478,11 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
427 *clear_aspm = 1; 478 *clear_aspm = 1;
428 } 479 }
429 } else { 480 } else {
430 dev_info(&device->dev, 481 decode_osc_control(root, "OS requested", requested);
431 "ACPI _OSC request failed (%s), " 482 decode_osc_control(root, "platform willing to grant", control);
432 "returned control mask: 0x%02x\n", 483 dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n",
433 acpi_format_exception(status), control); 484 acpi_format_exception(status));
434 dev_info(&device->dev, 485
435 "ACPI _OSC control for PCIe not granted, disabling ASPM\n");
436 /* 486 /*
437 * We want to disable ASPM here, but aspm_disabled 487 * We want to disable ASPM here, but aspm_disabled
438 * needs to remain in its state from boot so that we 488 * needs to remain in its state from boot so that we