diff options
Diffstat (limited to 'drivers/acpi/tables/tbget.c')
| -rw-r--r-- | drivers/acpi/tables/tbget.c | 65 |
1 files changed, 25 insertions, 40 deletions
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 09b4ee6dfd60..99eacceff563 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
| @@ -78,7 +78,7 @@ acpi_tb_get_table(struct acpi_pointer *address, | |||
| 78 | acpi_status status; | 78 | acpi_status status; |
| 79 | struct acpi_table_header header; | 79 | struct acpi_table_header header; |
| 80 | 80 | ||
| 81 | ACPI_FUNCTION_TRACE("tb_get_table"); | 81 | ACPI_FUNCTION_TRACE(tb_get_table); |
| 82 | 82 | ||
| 83 | /* Get the header in order to get signature and table size */ | 83 | /* Get the header in order to get signature and table size */ |
| 84 | 84 | ||
| @@ -124,7 +124,7 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
| 124 | acpi_status status = AE_OK; | 124 | acpi_status status = AE_OK; |
| 125 | struct acpi_table_header *header = NULL; | 125 | struct acpi_table_header *header = NULL; |
| 126 | 126 | ||
| 127 | ACPI_FUNCTION_TRACE("tb_get_table_header"); | 127 | ACPI_FUNCTION_TRACE(tb_get_table_header); |
| 128 | 128 | ||
| 129 | /* | 129 | /* |
| 130 | * Flags contains the current processor mode (Virtual or Physical | 130 | * Flags contains the current processor mode (Virtual or Physical |
| @@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
| 148 | sizeof(struct acpi_table_header), | 148 | sizeof(struct acpi_table_header), |
| 149 | (void *)&header); | 149 | (void *)&header); |
| 150 | if (ACPI_FAILURE(status)) { | 150 | if (ACPI_FAILURE(status)) { |
| 151 | ACPI_ERROR((AE_INFO, | ||
| 152 | "Could not map memory at %8.8X%8.8X for table header", | ||
| 153 | ACPI_FORMAT_UINT64(address->pointer. | ||
| 154 | physical))); | ||
| 151 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
| 152 | } | 156 | } |
| 153 | 157 | ||
| @@ -198,7 +202,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
| 198 | { | 202 | { |
| 199 | acpi_status status; | 203 | acpi_status status; |
| 200 | 204 | ||
| 201 | ACPI_FUNCTION_TRACE("tb_get_table_body"); | 205 | ACPI_FUNCTION_TRACE(tb_get_table_body); |
| 202 | 206 | ||
| 203 | if (!table_info || !address) { | 207 | if (!table_info || !address) { |
| 204 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 208 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| @@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
| 208 | 212 | ||
| 209 | status = acpi_tb_table_override(header, table_info); | 213 | status = acpi_tb_table_override(header, table_info); |
| 210 | if (ACPI_SUCCESS(status)) { | 214 | if (ACPI_SUCCESS(status)) { |
| 215 | |||
| 211 | /* Table was overridden by the host OS */ | 216 | /* Table was overridden by the host OS */ |
| 212 | 217 | ||
| 213 | return_ACPI_STATUS(status); | 218 | return_ACPI_STATUS(status); |
| @@ -241,7 +246,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
| 241 | acpi_status status; | 246 | acpi_status status; |
| 242 | struct acpi_pointer address; | 247 | struct acpi_pointer address; |
| 243 | 248 | ||
| 244 | ACPI_FUNCTION_TRACE("tb_table_override"); | 249 | ACPI_FUNCTION_TRACE(tb_table_override); |
| 245 | 250 | ||
| 246 | /* | 251 | /* |
| 247 | * The OSL will examine the header and decide whether to override this | 252 | * The OSL will examine the header and decide whether to override this |
| @@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
| 250 | */ | 255 | */ |
| 251 | status = acpi_os_table_override(header, &new_table); | 256 | status = acpi_os_table_override(header, &new_table); |
| 252 | if (ACPI_FAILURE(status)) { | 257 | if (ACPI_FAILURE(status)) { |
| 258 | |||
| 253 | /* Some severe error from the OSL, but we basically ignore it */ | 259 | /* Some severe error from the OSL, but we basically ignore it */ |
| 254 | 260 | ||
| 255 | ACPI_EXCEPTION((AE_INFO, status, | 261 | ACPI_EXCEPTION((AE_INFO, status, |
| @@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
| 258 | } | 264 | } |
| 259 | 265 | ||
| 260 | if (!new_table) { | 266 | if (!new_table) { |
| 267 | |||
| 261 | /* No table override */ | 268 | /* No table override */ |
| 262 | 269 | ||
| 263 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | 270 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
| @@ -311,7 +318,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
| 311 | u8 allocation; | 318 | u8 allocation; |
| 312 | acpi_status status = AE_OK; | 319 | acpi_status status = AE_OK; |
| 313 | 320 | ||
| 314 | ACPI_FUNCTION_TRACE("tb_get_this_table"); | 321 | ACPI_FUNCTION_TRACE(tb_get_this_table); |
| 315 | 322 | ||
| 316 | /* | 323 | /* |
| 317 | * Flags contains the current processor mode (Virtual or Physical | 324 | * Flags contains the current processor mode (Virtual or Physical |
| @@ -323,7 +330,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
| 323 | 330 | ||
| 324 | /* Pointer matches processor mode, copy the table to a new buffer */ | 331 | /* Pointer matches processor mode, copy the table to a new buffer */ |
| 325 | 332 | ||
| 326 | full_table = ACPI_MEM_ALLOCATE(header->length); | 333 | full_table = ACPI_ALLOCATE(header->length); |
| 327 | if (!full_table) { | 334 | if (!full_table) { |
| 328 | ACPI_ERROR((AE_INFO, | 335 | ACPI_ERROR((AE_INFO, |
| 329 | "Could not allocate table memory for [%4.4s] length %X", | 336 | "Could not allocate table memory for [%4.4s] length %X", |
| @@ -376,11 +383,12 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
| 376 | * Validate checksum for _most_ tables, | 383 | * Validate checksum for _most_ tables, |
| 377 | * even the ones whose signature we don't recognize | 384 | * even the ones whose signature we don't recognize |
| 378 | */ | 385 | */ |
| 379 | if (table_info->type != ACPI_TABLE_FACS) { | 386 | if (table_info->type != ACPI_TABLE_ID_FACS) { |
| 380 | status = acpi_tb_verify_table_checksum(full_table); | 387 | status = acpi_tb_verify_table_checksum(full_table); |
| 381 | 388 | ||
| 382 | #if (!ACPI_CHECKSUM_ABORT) | 389 | #if (!ACPI_CHECKSUM_ABORT) |
| 383 | if (ACPI_FAILURE(status)) { | 390 | if (ACPI_FAILURE(status)) { |
| 391 | |||
| 384 | /* Ignore the error if configuration says so */ | 392 | /* Ignore the error if configuration says so */ |
| 385 | 393 | ||
| 386 | status = AE_OK; | 394 | status = AE_OK; |
| @@ -409,7 +417,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
| 409 | * | 417 | * |
| 410 | * PARAMETERS: table_type - one of the defined table types | 418 | * PARAMETERS: table_type - one of the defined table types |
| 411 | * Instance - Which table of this type | 419 | * Instance - Which table of this type |
| 412 | * table_ptr_loc - pointer to location to place the pointer for | 420 | * return_table - pointer to location to place the pointer for |
| 413 | * return | 421 | * return |
| 414 | * | 422 | * |
| 415 | * RETURN: Status | 423 | * RETURN: Status |
| @@ -420,57 +428,34 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
| 420 | 428 | ||
| 421 | acpi_status | 429 | acpi_status |
| 422 | acpi_tb_get_table_ptr(acpi_table_type table_type, | 430 | acpi_tb_get_table_ptr(acpi_table_type table_type, |
| 423 | u32 instance, struct acpi_table_header **table_ptr_loc) | 431 | u32 instance, struct acpi_table_header **return_table) |
| 424 | { | 432 | { |
| 425 | struct acpi_table_desc *table_desc; | 433 | struct acpi_table_desc *table_desc; |
| 426 | u32 i; | 434 | u32 i; |
| 427 | 435 | ||
| 428 | ACPI_FUNCTION_TRACE("tb_get_table_ptr"); | 436 | ACPI_FUNCTION_TRACE(tb_get_table_ptr); |
| 429 | |||
| 430 | if (!acpi_gbl_DSDT) { | ||
| 431 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
| 432 | } | ||
| 433 | 437 | ||
| 434 | if (table_type > ACPI_TABLE_MAX) { | 438 | if (table_type > ACPI_TABLE_ID_MAX) { |
| 435 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 439 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 436 | } | 440 | } |
| 437 | 441 | ||
| 438 | /* | 442 | /* Check for instance out of range of the current table count */ |
| 439 | * For all table types (Single/Multiple), the first | ||
| 440 | * instance is always in the list head. | ||
| 441 | */ | ||
| 442 | if (instance == 1) { | ||
| 443 | /* Get the first */ | ||
| 444 | |||
| 445 | *table_ptr_loc = NULL; | ||
| 446 | if (acpi_gbl_table_lists[table_type].next) { | ||
| 447 | *table_ptr_loc = | ||
| 448 | acpi_gbl_table_lists[table_type].next->pointer; | ||
| 449 | } | ||
| 450 | return_ACPI_STATUS(AE_OK); | ||
| 451 | } | ||
| 452 | |||
| 453 | /* Check for instance out of range */ | ||
| 454 | 443 | ||
| 455 | if (instance > acpi_gbl_table_lists[table_type].count) { | 444 | if (instance > acpi_gbl_table_lists[table_type].count) { |
| 456 | return_ACPI_STATUS(AE_NOT_EXIST); | 445 | return_ACPI_STATUS(AE_NOT_EXIST); |
| 457 | } | 446 | } |
| 458 | 447 | ||
| 459 | /* Walk the list to get the desired table | 448 | /* |
| 460 | * Since the if (Instance == 1) check above checked for the | 449 | * Walk the list to get the desired table |
| 461 | * first table, setting table_desc equal to the .Next member | 450 | * Note: Instance is one-based |
| 462 | * is actually pointing to the second table. Therefore, we | ||
| 463 | * need to walk from the 2nd table until we reach the Instance | ||
| 464 | * that the user is looking for and return its table pointer. | ||
| 465 | */ | 451 | */ |
| 466 | table_desc = acpi_gbl_table_lists[table_type].next; | 452 | table_desc = acpi_gbl_table_lists[table_type].next; |
| 467 | for (i = 2; i < instance; i++) { | 453 | for (i = 1; i < instance; i++) { |
| 468 | table_desc = table_desc->next; | 454 | table_desc = table_desc->next; |
| 469 | } | 455 | } |
| 470 | 456 | ||
| 471 | /* We are now pointing to the requested table's descriptor */ | 457 | /* We are now pointing to the requested table's descriptor */ |
| 472 | 458 | ||
| 473 | *table_ptr_loc = table_desc->pointer; | 459 | *return_table = table_desc->pointer; |
| 474 | |||
| 475 | return_ACPI_STATUS(AE_OK); | 460 | return_ACPI_STATUS(AE_OK); |
| 476 | } | 461 | } |
