Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'acpi-pci'

Merge the ACPI PCI topic branch depended on by the following material.

+85 -126
+1 -3
Documentation/admin-guide/kernel-parameters.txt
··· 50 50 CONFIG_ACPI_DEBUG must be enabled to produce any ACPI 51 51 debug output. Bits in debug_layer correspond to a 52 52 _COMPONENT in an ACPI source file, e.g., 53 - #define _COMPONENT ACPI_PCI_COMPONENT 53 + #define _COMPONENT ACPI_EVENTS 54 54 Bits in debug_level correspond to a level in 55 55 ACPI_DEBUG_PRINT statements, e.g., 56 56 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ... ··· 60 60 61 61 Enable processor driver info messages: 62 62 acpi.debug_layer=0x20000000 63 - Enable PCI/PCI interrupt routing info messages: 64 - acpi.debug_layer=0x400000 65 63 Enable AML "Debug" output, i.e., stores to the Debug 66 64 object while interpreting AML: 67 65 acpi.debug_layer=0xffffffff acpi.debug_level=0x2
-5
Documentation/firmware-guide/acpi/debug.rst
··· 54 54 ACPI_TOOLS 0x00002000 55 55 ACPI_SBS_COMPONENT 0x00100000 56 56 ACPI_FAN_COMPONENT 0x00200000 57 - ACPI_PCI_COMPONENT 0x00400000 58 57 ACPI_CONTAINER_COMPONENT 0x01000000 59 58 ACPI_SYSTEM_COMPONENT 0x02000000 60 59 ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 ··· 124 125 AML) during boot:: 125 126 126 127 acpi.debug_layer=0xffffffff acpi.debug_level=0x2 127 - 128 - Enable PCI and PCI interrupt routing debug messages:: 129 - 130 - acpi.debug_layer=0x400000 acpi.debug_level=0x4 131 128 132 129 Enable all ACPI hardware-related messages:: 133 130
+10 -24
drivers/acpi/pci_irq.c
··· 9 9 * Bjorn Helgaas <bjorn.helgaas@hp.com> 10 10 */ 11 11 12 + #define pr_fmt(fmt) "ACPI: PCI: " fmt 12 13 13 14 #include <linux/dmi.h> 14 15 #include <linux/kernel.h> ··· 22 21 #include <linux/acpi.h> 23 22 #include <linux/slab.h> 24 23 #include <linux/interrupt.h> 25 - 26 - #define PREFIX "ACPI: " 27 - 28 - #define _COMPONENT ACPI_PCI_COMPONENT 29 - ACPI_MODULE_NAME("pci_irq"); 30 24 31 25 struct acpi_prt_entry { 32 26 struct acpi_pci_id id; ··· 122 126 entry->pin == quirk->pin && 123 127 !strcmp(prt->source, quirk->source) && 124 128 strlen(prt->source) >= strlen(quirk->actual_source)) { 125 - printk(KERN_WARNING PREFIX "firmware reports " 129 + pr_warn("Firmware reports " 126 130 "%04x:%02x:%02x PCI INT %c connected to %s; " 127 131 "changing to %s\n", 128 132 entry->id.segment, entry->id.bus, ··· 187 191 * the IRQ value, which is hardwired to specific interrupt inputs on 188 192 * the interrupt controller. 189 193 */ 190 - 191 - ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, 192 - " %04x:%02x:%02x[%c] -> %s[%d]\n", 193 - entry->id.segment, entry->id.bus, 194 - entry->id.device, pin_name(entry->pin), 195 - prt->source, entry->index)); 194 + pr_debug("%04x:%02x:%02x[%c] -> %s[%d]\n", 195 + entry->id.segment, entry->id.bus, entry->id.device, 196 + pin_name(entry->pin), prt->source, entry->index); 196 197 197 198 *entry_ptr = entry; 198 199 ··· 300 307 #ifdef CONFIG_X86_IO_APIC 301 308 acpi_reroute_boot_interrupt(dev, entry); 302 309 #endif /* CONFIG_X86_IO_APIC */ 303 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %s[%c] _PRT entry\n", 304 - pci_name(dev), pin_name(pin))); 310 + dev_dbg(&dev->dev, "Found [%c] _PRT entry\n", pin_name(pin)); 305 311 return entry; 306 312 } 307 313 ··· 316 324 /* PC card has the same IRQ as its cardbridge */ 317 325 bridge_pin = bridge->pin; 318 326 if (!bridge_pin) { 319 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 320 - "No interrupt pin configured for device %s\n", 321 - pci_name(bridge))); 327 + dev_dbg(&bridge->dev, "No interrupt pin configured\n"); 322 328 return NULL; 323 329 } 324 330 pin = bridge_pin; ··· 324 334 325 335 ret = acpi_pci_irq_find_prt_entry(bridge, pin, &entry); 326 336 if (!ret && entry) { 327 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 328 - "Derived GSI for %s INT %c from %s\n", 329 - pci_name(dev), pin_name(orig_pin), 330 - pci_name(bridge))); 337 + dev_dbg(&dev->dev, "Derived GSI INT %c from %s\n", 338 + pin_name(orig_pin), pci_name(bridge)); 331 339 return entry; 332 340 } 333 341 ··· 401 413 402 414 pin = dev->pin; 403 415 if (!pin) { 404 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 405 - "No interrupt pin configured for device %s\n", 406 - pci_name(dev))); 416 + dev_dbg(&dev->dev, "No interrupt pin configured\n"); 407 417 return 0; 408 418 } 409 419
+74 -92
drivers/acpi/pci_link.c
··· 12 12 * for IRQ management (e.g. start()->_SRS). 13 13 */ 14 14 15 + #define pr_fmt(fmt) "ACPI: PCI: " fmt 16 + 15 17 #include <linux/syscore_ops.h> 16 18 #include <linux/kernel.h> 17 19 #include <linux/module.h> ··· 29 27 30 28 #include "internal.h" 31 29 32 - #define _COMPONENT ACPI_PCI_COMPONENT 33 - ACPI_MODULE_NAME("pci_link"); 34 30 #define ACPI_PCI_LINK_CLASS "pci_irq_routing" 35 31 #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" 36 32 #define ACPI_PCI_LINK_MAX_POSSIBLE 16 ··· 85 85 void *context) 86 86 { 87 87 struct acpi_pci_link *link = context; 88 + acpi_handle handle = link->device->handle; 88 89 u32 i; 89 90 90 91 switch (resource->type) { ··· 96 95 { 97 96 struct acpi_resource_irq *p = &resource->data.irq; 98 97 if (!p || !p->interrupt_count) { 99 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 100 - "Blank _PRS IRQ resource\n")); 98 + acpi_handle_debug(handle, 99 + "Blank _PRS IRQ resource\n"); 101 100 return AE_OK; 102 101 } 103 102 for (i = 0; 104 103 (i < p->interrupt_count 105 104 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { 106 105 if (!p->interrupts[i]) { 107 - printk(KERN_WARNING PREFIX 108 - "Invalid _PRS IRQ %d\n", 109 - p->interrupts[i]); 106 + acpi_handle_debug(handle, 107 + "Invalid _PRS IRQ %d\n", 108 + p->interrupts[i]); 110 109 continue; 111 110 } 112 111 link->irq.possible[i] = p->interrupts[i]; ··· 122 121 struct acpi_resource_extended_irq *p = 123 122 &resource->data.extended_irq; 124 123 if (!p || !p->interrupt_count) { 125 - printk(KERN_WARNING PREFIX 126 - "Blank _PRS EXT IRQ resource\n"); 124 + acpi_handle_debug(handle, 125 + "Blank _PRS EXT IRQ resource\n"); 127 126 return AE_OK; 128 127 } 129 128 for (i = 0; 130 129 (i < p->interrupt_count 131 130 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { 132 131 if (!p->interrupts[i]) { 133 - printk(KERN_WARNING PREFIX 134 - "Invalid _PRS IRQ %d\n", 135 - p->interrupts[i]); 132 + acpi_handle_debug(handle, 133 + "Invalid _PRS IRQ %d\n", 134 + p->interrupts[i]); 136 135 continue; 137 136 } 138 137 link->irq.possible[i] = p->interrupts[i]; ··· 144 143 break; 145 144 } 146 145 default: 147 - printk(KERN_ERR PREFIX "_PRS resource type 0x%x isn't an IRQ\n", 148 - resource->type); 146 + acpi_handle_debug(handle, "_PRS resource type 0x%x is not IRQ\n", 147 + resource->type); 149 148 return AE_OK; 150 149 } 151 150 ··· 154 153 155 154 static int acpi_pci_link_get_possible(struct acpi_pci_link *link) 156 155 { 156 + acpi_handle handle = link->device->handle; 157 157 acpi_status status; 158 158 159 - status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS, 159 + status = acpi_walk_resources(handle, METHOD_NAME__PRS, 160 160 acpi_pci_link_check_possible, link); 161 161 if (ACPI_FAILURE(status)) { 162 - acpi_handle_debug(link->device->handle, "_PRS not present or invalid"); 162 + acpi_handle_debug(handle, "_PRS not present or invalid"); 163 163 return 0; 164 164 } 165 165 166 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 167 - "Found %d possible IRQs\n", 168 - link->irq.possible_count)); 166 + acpi_handle_debug(handle, "Found %d possible IRQs\n", 167 + link->irq.possible_count); 169 168 170 169 return 0; 171 170 } ··· 187 186 * IRQ descriptors may have no IRQ# bits set, 188 187 * particularly those those w/ _STA disabled 189 188 */ 190 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 191 - "Blank _CRS IRQ resource\n")); 189 + pr_debug("Blank _CRS IRQ resource\n"); 192 190 return AE_OK; 193 191 } 194 192 *irq = p->interrupts[0]; ··· 202 202 * extended IRQ descriptors must 203 203 * return at least 1 IRQ 204 204 */ 205 - printk(KERN_WARNING PREFIX 206 - "Blank _CRS EXT IRQ resource\n"); 205 + pr_debug("Blank _CRS EXT IRQ resource\n"); 207 206 return AE_OK; 208 207 } 209 208 *irq = p->interrupts[0]; ··· 210 211 } 211 212 break; 212 213 default: 213 - printk(KERN_ERR PREFIX "_CRS resource type 0x%x isn't an IRQ\n", 214 - resource->type); 214 + pr_debug("_CRS resource type 0x%x is not IRQ\n", 215 + resource->type); 215 216 return AE_OK; 216 217 } 217 218 ··· 227 228 */ 228 229 static int acpi_pci_link_get_current(struct acpi_pci_link *link) 229 230 { 230 - int result = 0; 231 + acpi_handle handle = link->device->handle; 231 232 acpi_status status; 233 + int result = 0; 232 234 int irq = 0; 233 235 234 236 link->irq.active = 0; ··· 239 239 /* Query _STA, set link->device->status */ 240 240 result = acpi_bus_get_status(link->device); 241 241 if (result) { 242 - printk(KERN_ERR PREFIX "Unable to read status\n"); 242 + acpi_handle_err(handle, "Unable to read status\n"); 243 243 goto end; 244 244 } 245 245 246 246 if (!link->device->status.enabled) { 247 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n")); 247 + acpi_handle_debug(handle, "Link disabled\n"); 248 248 return 0; 249 249 } 250 250 } ··· 253 253 * Query and parse _CRS to get the current IRQ assignment. 254 254 */ 255 255 256 - status = acpi_walk_resources(link->device->handle, METHOD_NAME__CRS, 256 + status = acpi_walk_resources(handle, METHOD_NAME__CRS, 257 257 acpi_pci_link_check_current, &irq); 258 258 if (ACPI_FAILURE(status)) { 259 - ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); 259 + acpi_handle_warn(handle, "_CRS evaluation failed: %s\n", 260 + acpi_format_exception(status)); 260 261 result = -ENODEV; 261 262 goto end; 262 263 } 263 264 264 265 if (acpi_strict && !irq) { 265 - printk(KERN_ERR PREFIX "_CRS returned 0\n"); 266 + acpi_handle_err(handle, "_CRS returned 0\n"); 266 267 result = -ENODEV; 267 268 } 268 269 269 270 link->irq.active = irq; 270 271 271 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); 272 + acpi_handle_debug(handle, "Link at IRQ %d \n", link->irq.active); 272 273 273 274 end: 274 275 return result; ··· 277 276 278 277 static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) 279 278 { 280 - int result; 281 - acpi_status status; 282 279 struct { 283 280 struct acpi_resource res; 284 281 struct acpi_resource end; 285 282 } *resource; 286 283 struct acpi_buffer buffer = { 0, NULL }; 284 + acpi_handle handle = link->device->handle; 285 + acpi_status status; 286 + int result; 287 287 288 288 if (!irq) 289 289 return -EINVAL; ··· 331 329 /* ignore resource_source, it's optional */ 332 330 break; 333 331 default: 334 - printk(KERN_ERR PREFIX "Invalid Resource_type %d\n", link->irq.resource_type); 332 + acpi_handle_err(handle, "Invalid resource type %d\n", 333 + link->irq.resource_type); 335 334 result = -EINVAL; 336 335 goto end; 337 336 ··· 345 342 346 343 /* check for total failure */ 347 344 if (ACPI_FAILURE(status)) { 348 - ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS")); 345 + acpi_handle_warn(handle, "_SRS evaluation failed: %s", 346 + acpi_format_exception(status)); 349 347 result = -ENODEV; 350 348 goto end; 351 349 } ··· 354 350 /* Query _STA, set device->status */ 355 351 result = acpi_bus_get_status(link->device); 356 352 if (result) { 357 - printk(KERN_ERR PREFIX "Unable to read status\n"); 353 + acpi_handle_err(handle, "Unable to read status\n"); 358 354 goto end; 359 355 } 360 - if (!link->device->status.enabled) { 361 - printk(KERN_WARNING PREFIX 362 - "%s [%s] disabled and referenced, BIOS bug\n", 363 - acpi_device_name(link->device), 364 - acpi_device_bid(link->device)); 365 - } 356 + if (!link->device->status.enabled) 357 + acpi_handle_warn(handle, "Disabled and referenced, BIOS bug\n"); 366 358 367 359 /* Query _CRS, set link->irq.active */ 368 360 result = acpi_pci_link_get_current(link); ··· 375 375 * policy: when _CRS doesn't return what we just _SRS 376 376 * assume _SRS worked and override _CRS value. 377 377 */ 378 - printk(KERN_WARNING PREFIX 379 - "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", 380 - acpi_device_name(link->device), 381 - acpi_device_bid(link->device), link->irq.active, irq); 378 + acpi_handle_warn(handle, "BIOS reported IRQ %d, using IRQ %d\n", 379 + link->irq.active, irq); 382 380 link->irq.active = irq; 383 381 } 384 382 385 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); 383 + acpi_handle_debug(handle, "Set IRQ %d\n", link->irq.active); 386 384 387 385 end: 388 386 kfree(resource); ··· 529 531 530 532 static int acpi_pci_link_allocate(struct acpi_pci_link *link) 531 533 { 534 + acpi_handle handle = link->device->handle; 532 535 int irq; 533 536 int i; 534 537 ··· 552 553 */ 553 554 if (i == link->irq.possible_count) { 554 555 if (acpi_strict) 555 - printk(KERN_WARNING PREFIX "_CRS %d not found" 556 - " in _PRS\n", link->irq.active); 556 + acpi_handle_warn(handle, "_CRS %d not found in _PRS\n", 557 + link->irq.active); 557 558 link->irq.active = 0; 558 559 } 559 560 ··· 577 578 } 578 579 } 579 580 if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { 580 - printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " 581 - "Try pci=noacpi or acpi=off\n", 582 - acpi_device_name(link->device), 583 - acpi_device_bid(link->device)); 581 + acpi_handle_err(handle, 582 + "No IRQ available. Try pci=noacpi or acpi=off\n"); 584 583 return -ENODEV; 585 584 } 586 585 587 586 /* Attempt to enable the link device at this IRQ. */ 588 587 if (acpi_pci_link_set(link, irq)) { 589 - printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. " 590 - "Try pci=noacpi or acpi=off\n", 591 - acpi_device_name(link->device), 592 - acpi_device_bid(link->device)); 588 + acpi_handle_err(handle, 589 + "Unable to set IRQ. Try pci=noacpi or acpi=off\n"); 593 590 return -ENODEV; 594 591 } else { 595 592 if (link->irq.active < ACPI_MAX_ISA_IRQS) 596 593 acpi_isa_irq_penalty[link->irq.active] += 597 594 PIRQ_PENALTY_PCI_USING; 598 595 599 - pr_info("%s [%s] enabled at IRQ %d\n", 600 - acpi_device_name(link->device), 601 - acpi_device_bid(link->device), link->irq.active); 596 + acpi_handle_info(handle, "Enabled at IRQ %d\n", 597 + link->irq.active); 602 598 } 603 599 604 600 link->irq.initialized = 1; ··· 614 620 615 621 result = acpi_bus_get_device(handle, &device); 616 622 if (result) { 617 - printk(KERN_ERR PREFIX "Invalid link device\n"); 623 + acpi_handle_err(handle, "Invalid link device\n"); 618 624 return -1; 619 625 } 620 626 621 627 link = acpi_driver_data(device); 622 628 if (!link) { 623 - printk(KERN_ERR PREFIX "Invalid link context\n"); 629 + acpi_handle_err(handle, "Invalid link context\n"); 624 630 return -1; 625 631 } 626 632 627 633 /* TBD: Support multiple index (IRQ) entries per Link Device */ 628 634 if (index) { 629 - printk(KERN_ERR PREFIX "Invalid index %d\n", index); 635 + acpi_handle_err(handle, "Invalid index %d\n", index); 630 636 return -1; 631 637 } 632 638 ··· 638 644 639 645 if (!link->irq.active) { 640 646 mutex_unlock(&acpi_link_lock); 641 - printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); 647 + acpi_handle_err(handle, "Link active IRQ is 0!\n"); 642 648 return -1; 643 649 } 644 650 link->refcnt++; ··· 650 656 *polarity = link->irq.polarity; 651 657 if (name) 652 658 *name = acpi_device_bid(link->device); 653 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 654 - "Link %s is referenced\n", 655 - acpi_device_bid(link->device))); 659 + acpi_handle_debug(handle, "Link is referenced\n"); 656 660 return link->irq.active; 657 661 } 658 662 ··· 666 674 667 675 result = acpi_bus_get_device(handle, &device); 668 676 if (result) { 669 - printk(KERN_ERR PREFIX "Invalid link device\n"); 677 + acpi_handle_err(handle, "Invalid link device\n"); 670 678 return -1; 671 679 } 672 680 673 681 link = acpi_driver_data(device); 674 682 if (!link) { 675 - printk(KERN_ERR PREFIX "Invalid link context\n"); 683 + acpi_handle_err(handle, "Invalid link context\n"); 676 684 return -1; 677 685 } 678 686 679 687 mutex_lock(&acpi_link_lock); 680 688 if (!link->irq.initialized) { 681 689 mutex_unlock(&acpi_link_lock); 682 - printk(KERN_ERR PREFIX "Link isn't initialized\n"); 690 + acpi_handle_err(handle, "Link isn't initialized\n"); 683 691 return -1; 684 692 } 685 693 #ifdef FUTURE_USE ··· 694 702 */ 695 703 link->refcnt--; 696 704 #endif 697 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 698 - "Link %s is dereferenced\n", 699 - acpi_device_bid(link->device))); 705 + acpi_handle_debug(handle, "Link is dereferenced\n"); 700 706 701 707 if (link->refcnt == 0) 702 708 acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); ··· 710 720 static int acpi_pci_link_add(struct acpi_device *device, 711 721 const struct acpi_device_id *not_used) 712 722 { 713 - int result; 723 + acpi_handle handle = device->handle; 714 724 struct acpi_pci_link *link; 725 + int result; 715 726 int i; 716 - int found = 0; 717 727 718 728 link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); 719 729 if (!link) ··· 732 742 /* query and set link->irq.active */ 733 743 acpi_pci_link_get_current(link); 734 744 735 - printk(KERN_INFO PREFIX "%s [%s] (IRQs", acpi_device_name(device), 736 - acpi_device_bid(device)); 745 + pr_info("Interrupt link %s configured for IRQ %d\n", 746 + acpi_device_bid(device), link->irq.active); 747 + 737 748 for (i = 0; i < link->irq.possible_count; i++) { 738 - if (link->irq.active == link->irq.possible[i]) { 739 - printk(KERN_CONT " *%d", link->irq.possible[i]); 740 - found = 1; 741 - } else 742 - printk(KERN_CONT " %d", link->irq.possible[i]); 749 + if (link->irq.active != link->irq.possible[i]) 750 + acpi_handle_debug(handle, "Possible IRQ %d\n", 751 + link->irq.possible[i]); 743 752 } 744 753 745 - printk(KERN_CONT ")"); 746 - 747 - if (!found) 748 - printk(KERN_CONT " *%d", link->irq.active); 749 - 750 754 if (!link->device->status.enabled) 751 - printk(KERN_CONT ", disabled."); 752 - 753 - printk(KERN_CONT "\n"); 755 + pr_info("Interrupt link %s disabled\n", acpi_device_bid(device)); 754 756 755 757 list_add_tail(&link->list, &acpi_link_list); 756 758 757 759 end: 758 760 /* disable all links -- to be activated on use */ 759 - acpi_evaluate_object(device->handle, "_DIS", NULL, NULL); 761 + acpi_evaluate_object(handle, "_DIS", NULL, NULL); 760 762 mutex_unlock(&acpi_link_lock); 761 763 762 764 if (result)
-1
drivers/acpi/sysfs.c
··· 54 54 55 55 ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT), 56 56 ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT), 57 - ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT), 58 57 ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT), 59 58 ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT), 60 59 ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT),
-1
include/acpi/acpi_drivers.h
··· 17 17 */ 18 18 #define ACPI_SBS_COMPONENT 0x00100000 19 19 #define ACPI_FAN_COMPONENT 0x00200000 20 - #define ACPI_PCI_COMPONENT 0x00400000 21 20 #define ACPI_CONTAINER_COMPONENT 0x01000000 22 21 #define ACPI_SYSTEM_COMPONENT 0x02000000 23 22 #define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000