diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
| commit | 026477c1141b67e98e3bd8bdedb7d4b88a3ecd09 (patch) | |
| tree | 2624a44924c625c367f3cebf937853b9da2de282 /drivers/acpi/pci_link.c | |
| parent | 9f2fa466383ce100b90fe52cb4489d7a26bf72a9 (diff) | |
| parent | 29454dde27d8e340bb1987bad9aa504af7081eba (diff) | |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'drivers/acpi/pci_link.c')
| -rw-r--r-- | drivers/acpi/pci_link.c | 189 |
1 files changed, 83 insertions, 106 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 228bdb626502..1badce27a83f 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -107,26 +107,23 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | |||
| 107 | struct acpi_pci_link *link = (struct acpi_pci_link *)context; | 107 | struct acpi_pci_link *link = (struct acpi_pci_link *)context; |
| 108 | u32 i = 0; | 108 | u32 i = 0; |
| 109 | 109 | ||
| 110 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); | ||
| 111 | 110 | ||
| 112 | switch (resource->type) { | 111 | switch (resource->type) { |
| 113 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 112 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
| 114 | return_ACPI_STATUS(AE_OK); | 113 | return AE_OK; |
| 115 | case ACPI_RESOURCE_TYPE_IRQ: | 114 | case ACPI_RESOURCE_TYPE_IRQ: |
| 116 | { | 115 | { |
| 117 | struct acpi_resource_irq *p = &resource->data.irq; | 116 | struct acpi_resource_irq *p = &resource->data.irq; |
| 118 | if (!p || !p->interrupt_count) { | 117 | if (!p || !p->interrupt_count) { |
| 119 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 118 | printk(KERN_WARNING PREFIX "Blank IRQ resource\n"); |
| 120 | "Blank IRQ resource\n")); | 119 | return AE_OK; |
| 121 | return_ACPI_STATUS(AE_OK); | ||
| 122 | } | 120 | } |
| 123 | for (i = 0; | 121 | for (i = 0; |
| 124 | (i < p->interrupt_count | 122 | (i < p->interrupt_count |
| 125 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { | 123 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { |
| 126 | if (!p->interrupts[i]) { | 124 | if (!p->interrupts[i]) { |
| 127 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 125 | printk(KERN_WARNING PREFIX "Invalid IRQ %d\n", |
| 128 | "Invalid IRQ %d\n", | 126 | p->interrupts[i]); |
| 129 | p->interrupts[i])); | ||
| 130 | continue; | 127 | continue; |
| 131 | } | 128 | } |
| 132 | link->irq.possible[i] = p->interrupts[i]; | 129 | link->irq.possible[i] = p->interrupts[i]; |
| @@ -142,17 +139,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | |||
| 142 | struct acpi_resource_extended_irq *p = | 139 | struct acpi_resource_extended_irq *p = |
| 143 | &resource->data.extended_irq; | 140 | &resource->data.extended_irq; |
| 144 | if (!p || !p->interrupt_count) { | 141 | if (!p || !p->interrupt_count) { |
| 145 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 142 | printk(KERN_WARNING PREFIX |
| 146 | "Blank EXT IRQ resource\n")); | 143 | "Blank EXT IRQ resource\n"); |
| 147 | return_ACPI_STATUS(AE_OK); | 144 | return AE_OK; |
| 148 | } | 145 | } |
| 149 | for (i = 0; | 146 | for (i = 0; |
| 150 | (i < p->interrupt_count | 147 | (i < p->interrupt_count |
| 151 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { | 148 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { |
| 152 | if (!p->interrupts[i]) { | 149 | if (!p->interrupts[i]) { |
| 153 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 150 | printk(KERN_WARNING PREFIX "Invalid IRQ %d\n", |
| 154 | "Invalid IRQ %d\n", | 151 | p->interrupts[i]); |
| 155 | p->interrupts[i])); | ||
| 156 | continue; | 152 | continue; |
| 157 | } | 153 | } |
| 158 | link->irq.possible[i] = p->interrupts[i]; | 154 | link->irq.possible[i] = p->interrupts[i]; |
| @@ -164,35 +160,33 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | |||
| 164 | break; | 160 | break; |
| 165 | } | 161 | } |
| 166 | default: | 162 | default: |
| 167 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 163 | printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n"); |
| 168 | "Resource is not an IRQ entry\n")); | 164 | return AE_OK; |
| 169 | return_ACPI_STATUS(AE_OK); | ||
| 170 | } | 165 | } |
| 171 | 166 | ||
| 172 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 167 | return AE_CTRL_TERMINATE; |
| 173 | } | 168 | } |
| 174 | 169 | ||
| 175 | static int acpi_pci_link_get_possible(struct acpi_pci_link *link) | 170 | static int acpi_pci_link_get_possible(struct acpi_pci_link *link) |
| 176 | { | 171 | { |
| 177 | acpi_status status; | 172 | acpi_status status; |
| 178 | 173 | ||
| 179 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible"); | ||
| 180 | 174 | ||
| 181 | if (!link) | 175 | if (!link) |
| 182 | return_VALUE(-EINVAL); | 176 | return -EINVAL; |
| 183 | 177 | ||
| 184 | status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, | 178 | status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, |
| 185 | acpi_pci_link_check_possible, link); | 179 | acpi_pci_link_check_possible, link); |
| 186 | if (ACPI_FAILURE(status)) { | 180 | if (ACPI_FAILURE(status)) { |
| 187 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); | 181 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); |
| 188 | return_VALUE(-ENODEV); | 182 | return -ENODEV; |
| 189 | } | 183 | } |
| 190 | 184 | ||
| 191 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 185 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 192 | "Found %d possible IRQs\n", | 186 | "Found %d possible IRQs\n", |
| 193 | link->irq.possible_count)); | 187 | link->irq.possible_count)); |
| 194 | 188 | ||
| 195 | return_VALUE(0); | 189 | return 0; |
| 196 | } | 190 | } |
| 197 | 191 | ||
| 198 | static acpi_status | 192 | static acpi_status |
| @@ -200,7 +194,6 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | |||
| 200 | { | 194 | { |
| 201 | int *irq = (int *)context; | 195 | int *irq = (int *)context; |
| 202 | 196 | ||
| 203 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); | ||
| 204 | 197 | ||
| 205 | switch (resource->type) { | 198 | switch (resource->type) { |
| 206 | case ACPI_RESOURCE_TYPE_IRQ: | 199 | case ACPI_RESOURCE_TYPE_IRQ: |
| @@ -213,7 +206,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | |||
| 213 | */ | 206 | */ |
| 214 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 207 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 215 | "Blank IRQ resource\n")); | 208 | "Blank IRQ resource\n")); |
| 216 | return_ACPI_STATUS(AE_OK); | 209 | return AE_OK; |
| 217 | } | 210 | } |
| 218 | *irq = p->interrupts[0]; | 211 | *irq = p->interrupts[0]; |
| 219 | break; | 212 | break; |
| @@ -227,20 +220,20 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | |||
| 227 | * extended IRQ descriptors must | 220 | * extended IRQ descriptors must |
| 228 | * return at least 1 IRQ | 221 | * return at least 1 IRQ |
| 229 | */ | 222 | */ |
| 230 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 223 | printk(KERN_WARNING PREFIX |
| 231 | "Blank EXT IRQ resource\n")); | 224 | "Blank EXT IRQ resource\n"); |
| 232 | return_ACPI_STATUS(AE_OK); | 225 | return AE_OK; |
| 233 | } | 226 | } |
| 234 | *irq = p->interrupts[0]; | 227 | *irq = p->interrupts[0]; |
| 235 | break; | 228 | break; |
| 236 | } | 229 | } |
| 237 | break; | 230 | break; |
| 238 | default: | 231 | default: |
| 239 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type)); | 232 | printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type); |
| 240 | case ACPI_RESOURCE_TYPE_END_TAG: | 233 | case ACPI_RESOURCE_TYPE_END_TAG: |
| 241 | return_ACPI_STATUS(AE_OK); | 234 | return AE_OK; |
| 242 | } | 235 | } |
| 243 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 236 | return AE_CTRL_TERMINATE; |
| 244 | } | 237 | } |
| 245 | 238 | ||
| 246 | /* | 239 | /* |
| @@ -256,10 +249,9 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) | |||
| 256 | acpi_status status = AE_OK; | 249 | acpi_status status = AE_OK; |
| 257 | int irq = 0; | 250 | int irq = 0; |
| 258 | 251 | ||
| 259 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_current"); | ||
| 260 | 252 | ||
| 261 | if (!link || !link->handle) | 253 | if (!link || !link->handle) |
| 262 | return_VALUE(-EINVAL); | 254 | return -EINVAL; |
| 263 | 255 | ||
| 264 | link->irq.active = 0; | 256 | link->irq.active = 0; |
| 265 | 257 | ||
| @@ -268,14 +260,13 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) | |||
| 268 | /* Query _STA, set link->device->status */ | 260 | /* Query _STA, set link->device->status */ |
| 269 | result = acpi_bus_get_status(link->device); | 261 | result = acpi_bus_get_status(link->device); |
| 270 | if (result) { | 262 | if (result) { |
| 271 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 263 | printk(KERN_ERR PREFIX "Unable to read status\n"); |
| 272 | "Unable to read status\n")); | ||
| 273 | goto end; | 264 | goto end; |
| 274 | } | 265 | } |
| 275 | 266 | ||
| 276 | if (!link->device->status.enabled) { | 267 | if (!link->device->status.enabled) { |
| 277 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n")); | 268 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n")); |
| 278 | return_VALUE(0); | 269 | return 0; |
| 279 | } | 270 | } |
| 280 | } | 271 | } |
| 281 | 272 | ||
| @@ -286,13 +277,13 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) | |||
| 286 | status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, | 277 | status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, |
| 287 | acpi_pci_link_check_current, &irq); | 278 | acpi_pci_link_check_current, &irq); |
| 288 | if (ACPI_FAILURE(status)) { | 279 | if (ACPI_FAILURE(status)) { |
| 289 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); | 280 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); |
| 290 | result = -ENODEV; | 281 | result = -ENODEV; |
| 291 | goto end; | 282 | goto end; |
| 292 | } | 283 | } |
| 293 | 284 | ||
| 294 | if (acpi_strict && !irq) { | 285 | if (acpi_strict && !irq) { |
| 295 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_CRS returned 0\n")); | 286 | printk(KERN_ERR PREFIX "_CRS returned 0\n"); |
| 296 | result = -ENODEV; | 287 | result = -ENODEV; |
| 297 | } | 288 | } |
| 298 | 289 | ||
| @@ -301,7 +292,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) | |||
| 301 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); | 292 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); |
| 302 | 293 | ||
| 303 | end: | 294 | end: |
| 304 | return_VALUE(result); | 295 | return result; |
| 305 | } | 296 | } |
| 306 | 297 | ||
| 307 | static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | 298 | static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) |
| @@ -314,14 +305,13 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 314 | } *resource; | 305 | } *resource; |
| 315 | struct acpi_buffer buffer = { 0, NULL }; | 306 | struct acpi_buffer buffer = { 0, NULL }; |
| 316 | 307 | ||
| 317 | ACPI_FUNCTION_TRACE("acpi_pci_link_set"); | ||
| 318 | 308 | ||
| 319 | if (!link || !irq) | 309 | if (!link || !irq) |
| 320 | return_VALUE(-EINVAL); | 310 | return -EINVAL; |
| 321 | 311 | ||
| 322 | resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC); | 312 | resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC); |
| 323 | if (!resource) | 313 | if (!resource) |
| 324 | return_VALUE(-ENOMEM); | 314 | return -ENOMEM; |
| 325 | 315 | ||
| 326 | memset(resource, 0, sizeof(*resource) + 1); | 316 | memset(resource, 0, sizeof(*resource) + 1); |
| 327 | buffer.length = sizeof(*resource) + 1; | 317 | buffer.length = sizeof(*resource) + 1; |
| @@ -362,7 +352,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 362 | /* ignore resource_source, it's optional */ | 352 | /* ignore resource_source, it's optional */ |
| 363 | break; | 353 | break; |
| 364 | default: | 354 | default: |
| 365 | printk("ACPI BUG: resource_type %d\n", link->irq.resource_type); | 355 | printk(KERN_ERR PREFIX "Invalid Resource_type %d\n", link->irq.resource_type); |
| 366 | result = -EINVAL; | 356 | result = -EINVAL; |
| 367 | goto end; | 357 | goto end; |
| 368 | 358 | ||
| @@ -374,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 374 | 364 | ||
| 375 | /* check for total failure */ | 365 | /* check for total failure */ |
| 376 | if (ACPI_FAILURE(status)) { | 366 | if (ACPI_FAILURE(status)) { |
| 377 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n")); | 367 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS")); |
| 378 | result = -ENODEV; | 368 | result = -ENODEV; |
| 379 | goto end; | 369 | goto end; |
| 380 | } | 370 | } |
| @@ -382,14 +372,14 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 382 | /* Query _STA, set device->status */ | 372 | /* Query _STA, set device->status */ |
| 383 | result = acpi_bus_get_status(link->device); | 373 | result = acpi_bus_get_status(link->device); |
| 384 | if (result) { | 374 | if (result) { |
| 385 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); | 375 | printk(KERN_ERR PREFIX "Unable to read status\n"); |
| 386 | goto end; | 376 | goto end; |
| 387 | } | 377 | } |
| 388 | if (!link->device->status.enabled) { | 378 | if (!link->device->status.enabled) { |
| 389 | printk(KERN_WARNING PREFIX | 379 | printk(KERN_WARNING PREFIX |
| 390 | "%s [%s] disabled and referenced, BIOS bug.\n", | 380 | "%s [%s] disabled and referenced, BIOS bug\n", |
| 391 | acpi_device_name(link->device), | 381 | acpi_device_name(link->device), |
| 392 | acpi_device_bid(link->device)); | 382 | acpi_device_bid(link->device)); |
| 393 | } | 383 | } |
| 394 | 384 | ||
| 395 | /* Query _CRS, set link->irq.active */ | 385 | /* Query _CRS, set link->irq.active */ |
| @@ -408,9 +398,9 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 408 | * assume _SRS worked and override _CRS value. | 398 | * assume _SRS worked and override _CRS value. |
| 409 | */ | 399 | */ |
| 410 | printk(KERN_WARNING PREFIX | 400 | printk(KERN_WARNING PREFIX |
| 411 | "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", | 401 | "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", |
| 412 | acpi_device_name(link->device), | 402 | acpi_device_name(link->device), |
| 413 | acpi_device_bid(link->device), link->irq.active, irq); | 403 | acpi_device_bid(link->device), link->irq.active, irq); |
| 414 | link->irq.active = irq; | 404 | link->irq.active = irq; |
| 415 | } | 405 | } |
| 416 | 406 | ||
| @@ -418,7 +408,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
| 418 | 408 | ||
| 419 | end: | 409 | end: |
| 420 | kfree(resource); | 410 | kfree(resource); |
| 421 | return_VALUE(result); | 411 | return result; |
| 422 | } | 412 | } |
| 423 | 413 | ||
| 424 | /* -------------------------------------------------------------------------- | 414 | /* -------------------------------------------------------------------------- |
| @@ -492,7 +482,6 @@ int __init acpi_irq_penalty_init(void) | |||
| 492 | struct acpi_pci_link *link = NULL; | 482 | struct acpi_pci_link *link = NULL; |
| 493 | int i = 0; | 483 | int i = 0; |
| 494 | 484 | ||
| 495 | ACPI_FUNCTION_TRACE("acpi_irq_penalty_init"); | ||
| 496 | 485 | ||
| 497 | /* | 486 | /* |
| 498 | * Update penalties to facilitate IRQ balancing. | 487 | * Update penalties to facilitate IRQ balancing. |
| @@ -501,8 +490,7 @@ int __init acpi_irq_penalty_init(void) | |||
| 501 | 490 | ||
| 502 | link = list_entry(node, struct acpi_pci_link, node); | 491 | link = list_entry(node, struct acpi_pci_link, node); |
| 503 | if (!link) { | 492 | if (!link) { |
| 504 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 493 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
| 505 | "Invalid link context\n")); | ||
| 506 | continue; | 494 | continue; |
| 507 | } | 495 | } |
| 508 | 496 | ||
| @@ -530,7 +518,7 @@ int __init acpi_irq_penalty_init(void) | |||
| 530 | /* Add a penalty for the SCI */ | 518 | /* Add a penalty for the SCI */ |
| 531 | acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING; | 519 | acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING; |
| 532 | 520 | ||
| 533 | return_VALUE(0); | 521 | return 0; |
| 534 | } | 522 | } |
| 535 | 523 | ||
| 536 | static int acpi_irq_balance; /* 0: static, 1: balance */ | 524 | static int acpi_irq_balance; /* 0: static, 1: balance */ |
| @@ -540,13 +528,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
| 540 | int irq; | 528 | int irq; |
| 541 | int i; | 529 | int i; |
| 542 | 530 | ||
| 543 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); | ||
| 544 | 531 | ||
| 545 | if (link->irq.initialized) { | 532 | if (link->irq.initialized) { |
| 546 | if (link->refcnt == 0) | 533 | if (link->refcnt == 0) |
| 547 | /* This means the link is disabled but initialized */ | 534 | /* This means the link is disabled but initialized */ |
| 548 | acpi_pci_link_set(link, link->irq.active); | 535 | acpi_pci_link_set(link, link->irq.active); |
| 549 | return_VALUE(0); | 536 | return 0; |
| 550 | } | 537 | } |
| 551 | 538 | ||
| 552 | /* | 539 | /* |
| @@ -562,7 +549,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
| 562 | if (i == link->irq.possible_count) { | 549 | if (i == link->irq.possible_count) { |
| 563 | if (acpi_strict) | 550 | if (acpi_strict) |
| 564 | printk(KERN_WARNING PREFIX "_CRS %d not found" | 551 | printk(KERN_WARNING PREFIX "_CRS %d not found" |
| 565 | " in _PRS\n", link->irq.active); | 552 | " in _PRS\n", link->irq.active); |
| 566 | link->irq.active = 0; | 553 | link->irq.active = 0; |
| 567 | } | 554 | } |
| 568 | 555 | ||
| @@ -589,12 +576,11 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
| 589 | 576 | ||
| 590 | /* Attempt to enable the link device at this IRQ. */ | 577 | /* Attempt to enable the link device at this IRQ. */ |
| 591 | if (acpi_pci_link_set(link, irq)) { | 578 | if (acpi_pci_link_set(link, irq)) { |
| 592 | printk(PREFIX | 579 | printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. " |
| 593 | "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" | 580 | "Try pci=noacpi or acpi=off\n", |
| 594 | "Try pci=noacpi or acpi=off\n", | 581 | acpi_device_name(link->device), |
| 595 | acpi_device_name(link->device), | 582 | acpi_device_bid(link->device)); |
| 596 | acpi_device_bid(link->device)); | 583 | return -ENODEV; |
| 597 | return_VALUE(-ENODEV); | ||
| 598 | } else { | 584 | } else { |
| 599 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; | 585 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; |
| 600 | printk(PREFIX "%s [%s] enabled at IRQ %d\n", | 586 | printk(PREFIX "%s [%s] enabled at IRQ %d\n", |
| @@ -604,7 +590,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
| 604 | 590 | ||
| 605 | link->irq.initialized = 1; | 591 | link->irq.initialized = 1; |
| 606 | 592 | ||
| 607 | return_VALUE(0); | 593 | return 0; |
| 608 | } | 594 | } |
| 609 | 595 | ||
| 610 | /* | 596 | /* |
| @@ -622,36 +608,35 @@ acpi_pci_link_allocate_irq(acpi_handle handle, | |||
| 622 | struct acpi_device *device = NULL; | 608 | struct acpi_device *device = NULL; |
| 623 | struct acpi_pci_link *link = NULL; | 609 | struct acpi_pci_link *link = NULL; |
| 624 | 610 | ||
| 625 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); | ||
| 626 | 611 | ||
| 627 | result = acpi_bus_get_device(handle, &device); | 612 | result = acpi_bus_get_device(handle, &device); |
| 628 | if (result) { | 613 | if (result) { |
| 629 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); | 614 | printk(KERN_ERR PREFIX "Invalid link device\n"); |
| 630 | return_VALUE(-1); | 615 | return -1; |
| 631 | } | 616 | } |
| 632 | 617 | ||
| 633 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 618 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
| 634 | if (!link) { | 619 | if (!link) { |
| 635 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 620 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
| 636 | return_VALUE(-1); | 621 | return -1; |
| 637 | } | 622 | } |
| 638 | 623 | ||
| 639 | /* TBD: Support multiple index (IRQ) entries per Link Device */ | 624 | /* TBD: Support multiple index (IRQ) entries per Link Device */ |
| 640 | if (index) { | 625 | if (index) { |
| 641 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid index %d\n", index)); | 626 | printk(KERN_ERR PREFIX "Invalid index %d\n", index); |
| 642 | return_VALUE(-1); | 627 | return -1; |
| 643 | } | 628 | } |
| 644 | 629 | ||
| 645 | mutex_lock(&acpi_link_lock); | 630 | mutex_lock(&acpi_link_lock); |
| 646 | if (acpi_pci_link_allocate(link)) { | 631 | if (acpi_pci_link_allocate(link)) { |
| 647 | mutex_unlock(&acpi_link_lock); | 632 | mutex_unlock(&acpi_link_lock); |
| 648 | return_VALUE(-1); | 633 | return -1; |
| 649 | } | 634 | } |
| 650 | 635 | ||
| 651 | if (!link->irq.active) { | 636 | if (!link->irq.active) { |
| 652 | mutex_unlock(&acpi_link_lock); | 637 | mutex_unlock(&acpi_link_lock); |
| 653 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); | 638 | printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); |
| 654 | return_VALUE(-1); | 639 | return -1; |
| 655 | } | 640 | } |
| 656 | link->refcnt++; | 641 | link->refcnt++; |
| 657 | mutex_unlock(&acpi_link_lock); | 642 | mutex_unlock(&acpi_link_lock); |
| @@ -665,7 +650,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle, | |||
| 665 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 650 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 666 | "Link %s is referenced\n", | 651 | "Link %s is referenced\n", |
| 667 | acpi_device_bid(link->device))); | 652 | acpi_device_bid(link->device))); |
| 668 | return_VALUE(link->irq.active); | 653 | return (link->irq.active); |
| 669 | } | 654 | } |
| 670 | 655 | ||
| 671 | /* | 656 | /* |
| @@ -678,25 +663,24 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
| 678 | struct acpi_pci_link *link = NULL; | 663 | struct acpi_pci_link *link = NULL; |
| 679 | acpi_status result; | 664 | acpi_status result; |
| 680 | 665 | ||
| 681 | ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); | ||
| 682 | 666 | ||
| 683 | result = acpi_bus_get_device(handle, &device); | 667 | result = acpi_bus_get_device(handle, &device); |
| 684 | if (result) { | 668 | if (result) { |
| 685 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); | 669 | printk(KERN_ERR PREFIX "Invalid link device\n"); |
| 686 | return_VALUE(-1); | 670 | return -1; |
| 687 | } | 671 | } |
| 688 | 672 | ||
| 689 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 673 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
| 690 | if (!link) { | 674 | if (!link) { |
| 691 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 675 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
| 692 | return_VALUE(-1); | 676 | return -1; |
| 693 | } | 677 | } |
| 694 | 678 | ||
| 695 | mutex_lock(&acpi_link_lock); | 679 | mutex_lock(&acpi_link_lock); |
| 696 | if (!link->irq.initialized) { | 680 | if (!link->irq.initialized) { |
| 697 | mutex_unlock(&acpi_link_lock); | 681 | mutex_unlock(&acpi_link_lock); |
| 698 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); | 682 | printk(KERN_ERR PREFIX "Link isn't initialized\n"); |
| 699 | return_VALUE(-1); | 683 | return -1; |
| 700 | } | 684 | } |
| 701 | #ifdef FUTURE_USE | 685 | #ifdef FUTURE_USE |
| 702 | /* | 686 | /* |
| @@ -718,7 +702,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
| 718 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 702 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
| 719 | } | 703 | } |
| 720 | mutex_unlock(&acpi_link_lock); | 704 | mutex_unlock(&acpi_link_lock); |
| 721 | return_VALUE(link->irq.active); | 705 | return (link->irq.active); |
| 722 | } | 706 | } |
| 723 | 707 | ||
| 724 | /* -------------------------------------------------------------------------- | 708 | /* -------------------------------------------------------------------------- |
| @@ -732,14 +716,13 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
| 732 | int i = 0; | 716 | int i = 0; |
| 733 | int found = 0; | 717 | int found = 0; |
| 734 | 718 | ||
| 735 | ACPI_FUNCTION_TRACE("acpi_pci_link_add"); | ||
| 736 | 719 | ||
| 737 | if (!device) | 720 | if (!device) |
| 738 | return_VALUE(-EINVAL); | 721 | return -EINVAL; |
| 739 | 722 | ||
| 740 | link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); | 723 | link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); |
| 741 | if (!link) | 724 | if (!link) |
| 742 | return_VALUE(-ENOMEM); | 725 | return -ENOMEM; |
| 743 | memset(link, 0, sizeof(struct acpi_pci_link)); | 726 | memset(link, 0, sizeof(struct acpi_pci_link)); |
| 744 | 727 | ||
| 745 | link->device = device; | 728 | link->device = device; |
| @@ -788,17 +771,16 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
| 788 | if (result) | 771 | if (result) |
| 789 | kfree(link); | 772 | kfree(link); |
| 790 | 773 | ||
| 791 | return_VALUE(result); | 774 | return result; |
| 792 | } | 775 | } |
| 793 | 776 | ||
| 794 | static int acpi_pci_link_resume(struct acpi_pci_link *link) | 777 | static int acpi_pci_link_resume(struct acpi_pci_link *link) |
| 795 | { | 778 | { |
| 796 | ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); | ||
| 797 | 779 | ||
| 798 | if (link->refcnt && link->irq.active && link->irq.initialized) | 780 | if (link->refcnt && link->irq.active && link->irq.initialized) |
| 799 | return_VALUE(acpi_pci_link_set(link, link->irq.active)); | 781 | return (acpi_pci_link_set(link, link->irq.active)); |
| 800 | else | 782 | else |
| 801 | return_VALUE(0); | 783 | return 0; |
| 802 | } | 784 | } |
| 803 | 785 | ||
| 804 | /* | 786 | /* |
| @@ -811,7 +793,6 @@ static int irqrouter_resume(struct sys_device *dev) | |||
| 811 | struct list_head *node = NULL; | 793 | struct list_head *node = NULL; |
| 812 | struct acpi_pci_link *link = NULL; | 794 | struct acpi_pci_link *link = NULL; |
| 813 | 795 | ||
| 814 | ACPI_FUNCTION_TRACE("irqrouter_resume"); | ||
| 815 | 796 | ||
| 816 | /* Make sure SCI is enabled again (Apple firmware bug?) */ | 797 | /* Make sure SCI is enabled again (Apple firmware bug?) */ |
| 817 | acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); | 798 | acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); |
| @@ -820,24 +801,22 @@ static int irqrouter_resume(struct sys_device *dev) | |||
| 820 | list_for_each(node, &acpi_link.entries) { | 801 | list_for_each(node, &acpi_link.entries) { |
| 821 | link = list_entry(node, struct acpi_pci_link, node); | 802 | link = list_entry(node, struct acpi_pci_link, node); |
| 822 | if (!link) { | 803 | if (!link) { |
| 823 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 804 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
| 824 | "Invalid link context\n")); | ||
| 825 | continue; | 805 | continue; |
| 826 | } | 806 | } |
| 827 | acpi_pci_link_resume(link); | 807 | acpi_pci_link_resume(link); |
| 828 | } | 808 | } |
| 829 | acpi_in_resume = 0; | 809 | acpi_in_resume = 0; |
| 830 | return_VALUE(0); | 810 | return 0; |
| 831 | } | 811 | } |
| 832 | 812 | ||
| 833 | static int acpi_pci_link_remove(struct acpi_device *device, int type) | 813 | static int acpi_pci_link_remove(struct acpi_device *device, int type) |
| 834 | { | 814 | { |
| 835 | struct acpi_pci_link *link = NULL; | 815 | struct acpi_pci_link *link = NULL; |
| 836 | 816 | ||
| 837 | ACPI_FUNCTION_TRACE("acpi_pci_link_remove"); | ||
| 838 | 817 | ||
| 839 | if (!device || !acpi_driver_data(device)) | 818 | if (!device || !acpi_driver_data(device)) |
| 840 | return_VALUE(-EINVAL); | 819 | return -EINVAL; |
| 841 | 820 | ||
| 842 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 821 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
| 843 | 822 | ||
| @@ -847,7 +826,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) | |||
| 847 | 826 | ||
| 848 | kfree(link); | 827 | kfree(link); |
| 849 | 828 | ||
| 850 | return_VALUE(0); | 829 | return 0; |
| 851 | } | 830 | } |
| 852 | 831 | ||
| 853 | /* | 832 | /* |
| @@ -953,34 +932,32 @@ static int __init irqrouter_init_sysfs(void) | |||
| 953 | { | 932 | { |
| 954 | int error; | 933 | int error; |
| 955 | 934 | ||
| 956 | ACPI_FUNCTION_TRACE("irqrouter_init_sysfs"); | ||
| 957 | 935 | ||
| 958 | if (acpi_disabled || acpi_noirq) | 936 | if (acpi_disabled || acpi_noirq) |
| 959 | return_VALUE(0); | 937 | return 0; |
| 960 | 938 | ||
| 961 | error = sysdev_class_register(&irqrouter_sysdev_class); | 939 | error = sysdev_class_register(&irqrouter_sysdev_class); |
| 962 | if (!error) | 940 | if (!error) |
| 963 | error = sysdev_register(&device_irqrouter); | 941 | error = sysdev_register(&device_irqrouter); |
| 964 | 942 | ||
| 965 | return_VALUE(error); | 943 | return error; |
| 966 | } | 944 | } |
| 967 | 945 | ||
| 968 | device_initcall(irqrouter_init_sysfs); | 946 | device_initcall(irqrouter_init_sysfs); |
| 969 | 947 | ||
| 970 | static int __init acpi_pci_link_init(void) | 948 | static int __init acpi_pci_link_init(void) |
| 971 | { | 949 | { |
| 972 | ACPI_FUNCTION_TRACE("acpi_pci_link_init"); | ||
| 973 | 950 | ||
| 974 | if (acpi_noirq) | 951 | if (acpi_noirq) |
| 975 | return_VALUE(0); | 952 | return 0; |
| 976 | 953 | ||
| 977 | acpi_link.count = 0; | 954 | acpi_link.count = 0; |
| 978 | INIT_LIST_HEAD(&acpi_link.entries); | 955 | INIT_LIST_HEAD(&acpi_link.entries); |
| 979 | 956 | ||
| 980 | if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) | 957 | if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) |
| 981 | return_VALUE(-ENODEV); | 958 | return -ENODEV; |
| 982 | 959 | ||
| 983 | return_VALUE(0); | 960 | return 0; |
| 984 | } | 961 | } |
| 985 | 962 | ||
| 986 | subsys_initcall(acpi_pci_link_init); | 963 | subsys_initcall(acpi_pci_link_init); |
