aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_link.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/pci_link.c')
-rw-r--r--drivers/acpi/pci_link.c90
1 files changed, 41 insertions, 49 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 228bdb626502..415b2628fe85 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -116,17 +116,15 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
116 { 116 {
117 struct acpi_resource_irq *p = &resource->data.irq; 117 struct acpi_resource_irq *p = &resource->data.irq;
118 if (!p || !p->interrupt_count) { 118 if (!p || !p->interrupt_count) {
119 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 119 ACPI_WARNING((AE_INFO, "Blank IRQ resource"));
120 "Blank IRQ resource\n"));
121 return_ACPI_STATUS(AE_OK); 120 return_ACPI_STATUS(AE_OK);
122 } 121 }
123 for (i = 0; 122 for (i = 0;
124 (i < p->interrupt_count 123 (i < p->interrupt_count
125 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { 124 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
126 if (!p->interrupts[i]) { 125 if (!p->interrupts[i]) {
127 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 126 ACPI_WARNING((AE_INFO, "Invalid IRQ %d",
128 "Invalid IRQ %d\n", 127 p->interrupts[i]));
129 p->interrupts[i]));
130 continue; 128 continue;
131 } 129 }
132 link->irq.possible[i] = p->interrupts[i]; 130 link->irq.possible[i] = p->interrupts[i];
@@ -142,17 +140,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
142 struct acpi_resource_extended_irq *p = 140 struct acpi_resource_extended_irq *p =
143 &resource->data.extended_irq; 141 &resource->data.extended_irq;
144 if (!p || !p->interrupt_count) { 142 if (!p || !p->interrupt_count) {
145 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 143 ACPI_WARNING((AE_INFO,
146 "Blank EXT IRQ resource\n")); 144 "Blank EXT IRQ resource"));
147 return_ACPI_STATUS(AE_OK); 145 return_ACPI_STATUS(AE_OK);
148 } 146 }
149 for (i = 0; 147 for (i = 0;
150 (i < p->interrupt_count 148 (i < p->interrupt_count
151 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { 149 && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
152 if (!p->interrupts[i]) { 150 if (!p->interrupts[i]) {
153 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 151 ACPI_WARNING((AE_INFO, "Invalid IRQ %d",
154 "Invalid IRQ %d\n", 152 p->interrupts[i]));
155 p->interrupts[i]));
156 continue; 153 continue;
157 } 154 }
158 link->irq.possible[i] = p->interrupts[i]; 155 link->irq.possible[i] = p->interrupts[i];
@@ -164,8 +161,7 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
164 break; 161 break;
165 } 162 }
166 default: 163 default:
167 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 164 ACPI_ERROR((AE_INFO, "Resource is not an IRQ entry\n"));
168 "Resource is not an IRQ entry\n"));
169 return_ACPI_STATUS(AE_OK); 165 return_ACPI_STATUS(AE_OK);
170 } 166 }
171 167
@@ -184,7 +180,7 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
184 status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, 180 status = acpi_walk_resources(link->handle, METHOD_NAME__PRS,
185 acpi_pci_link_check_possible, link); 181 acpi_pci_link_check_possible, link);
186 if (ACPI_FAILURE(status)) { 182 if (ACPI_FAILURE(status)) {
187 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); 183 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS"));
188 return_VALUE(-ENODEV); 184 return_VALUE(-ENODEV);
189 } 185 }
190 186
@@ -227,8 +223,8 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
227 * extended IRQ descriptors must 223 * extended IRQ descriptors must
228 * return at least 1 IRQ 224 * return at least 1 IRQ
229 */ 225 */
230 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 226 ACPI_WARNING((AE_INFO,
231 "Blank EXT IRQ resource\n")); 227 "Blank EXT IRQ resource"));
232 return_ACPI_STATUS(AE_OK); 228 return_ACPI_STATUS(AE_OK);
233 } 229 }
234 *irq = p->interrupts[0]; 230 *irq = p->interrupts[0];
@@ -236,7 +232,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
236 } 232 }
237 break; 233 break;
238 default: 234 default:
239 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type)); 235 ACPI_ERROR((AE_INFO, "Resource %d isn't an IRQ", resource->type));
240 case ACPI_RESOURCE_TYPE_END_TAG: 236 case ACPI_RESOURCE_TYPE_END_TAG:
241 return_ACPI_STATUS(AE_OK); 237 return_ACPI_STATUS(AE_OK);
242 } 238 }
@@ -268,8 +264,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
268 /* Query _STA, set link->device->status */ 264 /* Query _STA, set link->device->status */
269 result = acpi_bus_get_status(link->device); 265 result = acpi_bus_get_status(link->device);
270 if (result) { 266 if (result) {
271 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 267 ACPI_ERROR((AE_INFO, "Unable to read status"));
272 "Unable to read status\n"));
273 goto end; 268 goto end;
274 } 269 }
275 270
@@ -286,13 +281,13 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
286 status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, 281 status = acpi_walk_resources(link->handle, METHOD_NAME__CRS,
287 acpi_pci_link_check_current, &irq); 282 acpi_pci_link_check_current, &irq);
288 if (ACPI_FAILURE(status)) { 283 if (ACPI_FAILURE(status)) {
289 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); 284 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS"));
290 result = -ENODEV; 285 result = -ENODEV;
291 goto end; 286 goto end;
292 } 287 }
293 288
294 if (acpi_strict && !irq) { 289 if (acpi_strict && !irq) {
295 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_CRS returned 0\n")); 290 ACPI_ERROR((AE_INFO, "_CRS returned 0"));
296 result = -ENODEV; 291 result = -ENODEV;
297 } 292 }
298 293
@@ -362,7 +357,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
362 /* ignore resource_source, it's optional */ 357 /* ignore resource_source, it's optional */
363 break; 358 break;
364 default: 359 default:
365 printk("ACPI BUG: resource_type %d\n", link->irq.resource_type); 360 ACPI_ERROR((AE_INFO, "Invalid Resource_type %d\n", link->irq.resource_type));
366 result = -EINVAL; 361 result = -EINVAL;
367 goto end; 362 goto end;
368 363
@@ -374,7 +369,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
374 369
375 /* check for total failure */ 370 /* check for total failure */
376 if (ACPI_FAILURE(status)) { 371 if (ACPI_FAILURE(status)) {
377 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n")); 372 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS"));
378 result = -ENODEV; 373 result = -ENODEV;
379 goto end; 374 goto end;
380 } 375 }
@@ -382,14 +377,14 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
382 /* Query _STA, set device->status */ 377 /* Query _STA, set device->status */
383 result = acpi_bus_get_status(link->device); 378 result = acpi_bus_get_status(link->device);
384 if (result) { 379 if (result) {
385 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); 380 ACPI_ERROR((AE_INFO, "Unable to read status"));
386 goto end; 381 goto end;
387 } 382 }
388 if (!link->device->status.enabled) { 383 if (!link->device->status.enabled) {
389 printk(KERN_WARNING PREFIX 384 ACPI_WARNING((AE_INFO,
390 "%s [%s] disabled and referenced, BIOS bug.\n", 385 "%s [%s] disabled and referenced, BIOS bug",
391 acpi_device_name(link->device), 386 acpi_device_name(link->device),
392 acpi_device_bid(link->device)); 387 acpi_device_bid(link->device)));
393 } 388 }
394 389
395 /* Query _CRS, set link->irq.active */ 390 /* Query _CRS, set link->irq.active */
@@ -407,10 +402,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
407 * policy: when _CRS doesn't return what we just _SRS 402 * policy: when _CRS doesn't return what we just _SRS
408 * assume _SRS worked and override _CRS value. 403 * assume _SRS worked and override _CRS value.
409 */ 404 */
410 printk(KERN_WARNING PREFIX 405 ACPI_WARNING((AE_INFO,
411 "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", 406 "%s [%s] BIOS reported IRQ %d, using IRQ %d",
412 acpi_device_name(link->device), 407 acpi_device_name(link->device),
413 acpi_device_bid(link->device), link->irq.active, irq); 408 acpi_device_bid(link->device), link->irq.active, irq));
414 link->irq.active = irq; 409 link->irq.active = irq;
415 } 410 }
416 411
@@ -501,8 +496,7 @@ int __init acpi_irq_penalty_init(void)
501 496
502 link = list_entry(node, struct acpi_pci_link, node); 497 link = list_entry(node, struct acpi_pci_link, node);
503 if (!link) { 498 if (!link) {
504 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 499 ACPI_ERROR((AE_INFO, "Invalid link context"));
505 "Invalid link context\n"));
506 continue; 500 continue;
507 } 501 }
508 502
@@ -561,8 +555,8 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
561 */ 555 */
562 if (i == link->irq.possible_count) { 556 if (i == link->irq.possible_count) {
563 if (acpi_strict) 557 if (acpi_strict)
564 printk(KERN_WARNING PREFIX "_CRS %d not found" 558 ACPI_WARNING((AE_INFO, "_CRS %d not found"
565 " in _PRS\n", link->irq.active); 559 " in _PRS", link->irq.active));
566 link->irq.active = 0; 560 link->irq.active = 0;
567 } 561 }
568 562
@@ -589,11 +583,10 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
589 583
590 /* Attempt to enable the link device at this IRQ. */ 584 /* Attempt to enable the link device at this IRQ. */
591 if (acpi_pci_link_set(link, irq)) { 585 if (acpi_pci_link_set(link, irq)) {
592 printk(PREFIX 586 ACPI_ERROR((AE_INFO, "Unable to set IRQ for %s [%s]. "
593 "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" 587 "Try pci=noacpi or acpi=off",
594 "Try pci=noacpi or acpi=off\n", 588 acpi_device_name(link->device),
595 acpi_device_name(link->device), 589 acpi_device_bid(link->device)));
596 acpi_device_bid(link->device));
597 return_VALUE(-ENODEV); 590 return_VALUE(-ENODEV);
598 } else { 591 } else {
599 acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; 592 acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
@@ -626,19 +619,19 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
626 619
627 result = acpi_bus_get_device(handle, &device); 620 result = acpi_bus_get_device(handle, &device);
628 if (result) { 621 if (result) {
629 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); 622 ACPI_ERROR((AE_INFO, "Invalid link device"));
630 return_VALUE(-1); 623 return_VALUE(-1);
631 } 624 }
632 625
633 link = (struct acpi_pci_link *)acpi_driver_data(device); 626 link = (struct acpi_pci_link *)acpi_driver_data(device);
634 if (!link) { 627 if (!link) {
635 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); 628 ACPI_ERROR((AE_INFO, "Invalid link context"));
636 return_VALUE(-1); 629 return_VALUE(-1);
637 } 630 }
638 631
639 /* TBD: Support multiple index (IRQ) entries per Link Device */ 632 /* TBD: Support multiple index (IRQ) entries per Link Device */
640 if (index) { 633 if (index) {
641 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid index %d\n", index)); 634 ACPI_ERROR((AE_INFO, "Invalid index %d", index));
642 return_VALUE(-1); 635 return_VALUE(-1);
643 } 636 }
644 637
@@ -650,7 +643,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
650 643
651 if (!link->irq.active) { 644 if (!link->irq.active) {
652 mutex_unlock(&acpi_link_lock); 645 mutex_unlock(&acpi_link_lock);
653 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); 646 ACPI_ERROR((AE_INFO, "Link active IRQ is 0!"));
654 return_VALUE(-1); 647 return_VALUE(-1);
655 } 648 }
656 link->refcnt++; 649 link->refcnt++;
@@ -682,20 +675,20 @@ int acpi_pci_link_free_irq(acpi_handle handle)
682 675
683 result = acpi_bus_get_device(handle, &device); 676 result = acpi_bus_get_device(handle, &device);
684 if (result) { 677 if (result) {
685 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); 678 ACPI_ERROR((AE_INFO, "Invalid link device"));
686 return_VALUE(-1); 679 return_VALUE(-1);
687 } 680 }
688 681
689 link = (struct acpi_pci_link *)acpi_driver_data(device); 682 link = (struct acpi_pci_link *)acpi_driver_data(device);
690 if (!link) { 683 if (!link) {
691 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); 684 ACPI_ERROR((AE_INFO, "Invalid link context"));
692 return_VALUE(-1); 685 return_VALUE(-1);
693 } 686 }
694 687
695 mutex_lock(&acpi_link_lock); 688 mutex_lock(&acpi_link_lock);
696 if (!link->irq.initialized) { 689 if (!link->irq.initialized) {
697 mutex_unlock(&acpi_link_lock); 690 mutex_unlock(&acpi_link_lock);
698 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); 691 ACPI_ERROR((AE_INFO, "Link isn't initialized"));
699 return_VALUE(-1); 692 return_VALUE(-1);
700 } 693 }
701#ifdef FUTURE_USE 694#ifdef FUTURE_USE
@@ -820,8 +813,7 @@ static int irqrouter_resume(struct sys_device *dev)
820 list_for_each(node, &acpi_link.entries) { 813 list_for_each(node, &acpi_link.entries) {
821 link = list_entry(node, struct acpi_pci_link, node); 814 link = list_entry(node, struct acpi_pci_link, node);
822 if (!link) { 815 if (!link) {
823 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 816 ACPI_ERROR((AE_INFO, "Invalid link context"));
824 "Invalid link context\n"));
825 continue; 817 continue;
826 } 818 }
827 acpi_pci_link_resume(link); 819 acpi_pci_link_resume(link);