diff options
Diffstat (limited to 'drivers/acpi/tables/tbxfroot.c')
-rw-r--r-- | drivers/acpi/tables/tbxfroot.c | 82 |
1 files changed, 45 insertions, 37 deletions
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index a62db6af83c9..da2648bbdbc0 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
48 | 46 | ||
@@ -75,6 +73,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
75 | * The signature and checksum must both be correct | 73 | * The signature and checksum must both be correct |
76 | */ | 74 | */ |
77 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { | 75 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { |
76 | |||
78 | /* Nope, BAD Signature */ | 77 | /* Nope, BAD Signature */ |
79 | 78 | ||
80 | return (AE_BAD_SIGNATURE); | 79 | return (AE_BAD_SIGNATURE); |
@@ -82,15 +81,14 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
82 | 81 | ||
83 | /* Check the standard checksum */ | 82 | /* Check the standard checksum */ |
84 | 83 | ||
85 | if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | 84 | if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { |
86 | return (AE_BAD_CHECKSUM); | 85 | return (AE_BAD_CHECKSUM); |
87 | } | 86 | } |
88 | 87 | ||
89 | /* Check extended checksum if table version >= 2 */ | 88 | /* Check extended checksum if table version >= 2 */ |
90 | 89 | ||
91 | if ((rsdp->revision >= 2) && | 90 | if ((rsdp->revision >= 2) && |
92 | (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != | 91 | (acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { |
93 | 0)) { | ||
94 | return (AE_BAD_CHECKSUM); | 92 | return (AE_BAD_CHECKSUM); |
95 | } | 93 | } |
96 | 94 | ||
@@ -121,7 +119,7 @@ acpi_tb_find_table(char *signature, | |||
121 | acpi_status status; | 119 | acpi_status status; |
122 | struct acpi_table_header *table; | 120 | struct acpi_table_header *table; |
123 | 121 | ||
124 | ACPI_FUNCTION_TRACE("tb_find_table"); | 122 | ACPI_FUNCTION_TRACE(tb_find_table); |
125 | 123 | ||
126 | /* Validate string lengths */ | 124 | /* Validate string lengths */ |
127 | 125 | ||
@@ -131,7 +129,7 @@ acpi_tb_find_table(char *signature, | |||
131 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); | 129 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
132 | } | 130 | } |
133 | 131 | ||
134 | if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) { | 132 | if (ACPI_COMPARE_NAME(signature, DSDT_SIG)) { |
135 | /* | 133 | /* |
136 | * The DSDT pointer is contained in the FADT, not the RSDT. | 134 | * The DSDT pointer is contained in the FADT, not the RSDT. |
137 | * This code should suffice, because the only code that would perform | 135 | * This code should suffice, because the only code that would perform |
@@ -156,10 +154,12 @@ acpi_tb_find_table(char *signature, | |||
156 | 154 | ||
157 | /* Check oem_id and oem_table_id */ | 155 | /* Check oem_id and oem_table_id */ |
158 | 156 | ||
159 | if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id, | 157 | if ((oem_id[0] && |
160 | sizeof(table->oem_id))) || | 158 | ACPI_STRNCMP(oem_id, table->oem_id, |
161 | (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id, | 159 | sizeof(table->oem_id))) || |
162 | sizeof(table->oem_table_id)))) { | 160 | (oem_table_id[0] && |
161 | ACPI_STRNCMP(oem_table_id, table->oem_table_id, | ||
162 | sizeof(table->oem_table_id)))) { | ||
163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); | 163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); |
164 | } | 164 | } |
165 | 165 | ||
@@ -203,7 +203,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
203 | u32 i; | 203 | u32 i; |
204 | u32 j; | 204 | u32 j; |
205 | 205 | ||
206 | ACPI_FUNCTION_TRACE("acpi_get_firmware_table"); | 206 | ACPI_FUNCTION_TRACE(acpi_get_firmware_table); |
207 | 207 | ||
208 | /* | 208 | /* |
209 | * Ensure that at least the table manager is initialized. We don't | 209 | * Ensure that at least the table manager is initialized. We don't |
@@ -217,6 +217,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
217 | /* Ensure that we have a RSDP */ | 217 | /* Ensure that we have a RSDP */ |
218 | 218 | ||
219 | if (!acpi_gbl_RSDP) { | 219 | if (!acpi_gbl_RSDP) { |
220 | |||
220 | /* Get the RSDP */ | 221 | /* Get the RSDP */ |
221 | 222 | ||
222 | status = acpi_os_get_root_pointer(flags, &address); | 223 | status = acpi_os_get_root_pointer(flags, &address); |
@@ -261,7 +262,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
261 | 262 | ||
262 | /* Get and validate the RSDT */ | 263 | /* Get and validate the RSDT */ |
263 | 264 | ||
264 | rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); | 265 | rsdt_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); |
265 | if (!rsdt_info) { | 266 | if (!rsdt_info) { |
266 | return_ACPI_STATUS(AE_NO_MEMORY); | 267 | return_ACPI_STATUS(AE_NO_MEMORY); |
267 | } | 268 | } |
@@ -278,13 +279,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
278 | 279 | ||
279 | /* Allocate a scratch table header and table descriptor */ | 280 | /* Allocate a scratch table header and table descriptor */ |
280 | 281 | ||
281 | header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); | 282 | header = ACPI_ALLOCATE(sizeof(struct acpi_table_header)); |
282 | if (!header) { | 283 | if (!header) { |
283 | status = AE_NO_MEMORY; | 284 | status = AE_NO_MEMORY; |
284 | goto cleanup; | 285 | goto cleanup; |
285 | } | 286 | } |
286 | 287 | ||
287 | table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); | 288 | table_info = ACPI_ALLOCATE(sizeof(struct acpi_table_desc)); |
288 | if (!table_info) { | 289 | if (!table_info) { |
289 | status = AE_NO_MEMORY; | 290 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 291 | goto cleanup; |
@@ -308,12 +309,12 @@ acpi_get_firmware_table(acpi_string signature, | |||
308 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 309 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
309 | address.pointer.value = | 310 | address.pointer.value = |
310 | (ACPI_CAST_PTR | 311 | (ACPI_CAST_PTR |
311 | (RSDT_DESCRIPTOR, | 312 | (struct rsdt_descriptor, |
312 | rsdt_info->pointer))->table_offset_entry[i]; | 313 | rsdt_info->pointer))->table_offset_entry[i]; |
313 | } else { | 314 | } else { |
314 | address.pointer.value = | 315 | address.pointer.value = |
315 | (ACPI_CAST_PTR | 316 | (ACPI_CAST_PTR |
316 | (XSDT_DESCRIPTOR, | 317 | (struct xsdt_descriptor, |
317 | rsdt_info->pointer))->table_offset_entry[i]; | 318 | rsdt_info->pointer))->table_offset_entry[i]; |
318 | } | 319 | } |
319 | 320 | ||
@@ -326,11 +327,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
326 | 327 | ||
327 | /* Compare table signatures and table instance */ | 328 | /* Compare table signatures and table instance */ |
328 | 329 | ||
329 | if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { | 330 | if (ACPI_COMPARE_NAME(header->signature, signature)) { |
331 | |||
330 | /* An instance of the table was found */ | 332 | /* An instance of the table was found */ |
331 | 333 | ||
332 | j++; | 334 | j++; |
333 | if (j >= instance) { | 335 | if (j >= instance) { |
336 | |||
334 | /* Found the correct instance, get the entire table */ | 337 | /* Found the correct instance, get the entire table */ |
335 | 338 | ||
336 | status = | 339 | status = |
@@ -355,23 +358,21 @@ acpi_get_firmware_table(acpi_string signature, | |||
355 | acpi_os_unmap_memory(rsdt_info->pointer, | 358 | acpi_os_unmap_memory(rsdt_info->pointer, |
356 | (acpi_size) rsdt_info->pointer->length); | 359 | (acpi_size) rsdt_info->pointer->length); |
357 | } | 360 | } |
358 | ACPI_MEM_FREE(rsdt_info); | 361 | ACPI_FREE(rsdt_info); |
359 | 362 | ||
360 | if (header) { | 363 | if (header) { |
361 | ACPI_MEM_FREE(header); | 364 | ACPI_FREE(header); |
362 | } | 365 | } |
363 | if (table_info) { | 366 | if (table_info) { |
364 | ACPI_MEM_FREE(table_info); | 367 | ACPI_FREE(table_info); |
365 | } | 368 | } |
366 | return_ACPI_STATUS(status); | 369 | return_ACPI_STATUS(status); |
367 | } | 370 | } |
368 | 371 | ||
369 | EXPORT_SYMBOL(acpi_get_firmware_table); | 372 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_table) |
370 | 373 | ||
371 | /* TBD: Move to a new file */ | 374 | /* TBD: Move to a new file */ |
372 | |||
373 | #if ACPI_MACHINE_WIDTH != 16 | 375 | #if ACPI_MACHINE_WIDTH != 16 |
374 | |||
375 | /******************************************************************************* | 376 | /******************************************************************************* |
376 | * | 377 | * |
377 | * FUNCTION: acpi_find_root_pointer | 378 | * FUNCTION: acpi_find_root_pointer |
@@ -384,13 +385,12 @@ EXPORT_SYMBOL(acpi_get_firmware_table); | |||
384 | * DESCRIPTION: Find the RSDP | 385 | * DESCRIPTION: Find the RSDP |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | 388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) |
389 | { | 389 | { |
390 | struct acpi_table_desc table_info; | 390 | struct acpi_table_desc table_info; |
391 | acpi_status status; | 391 | acpi_status status; |
392 | 392 | ||
393 | ACPI_FUNCTION_TRACE("acpi_find_root_pointer"); | 393 | ACPI_FUNCTION_TRACE(acpi_find_root_pointer); |
394 | 394 | ||
395 | /* Get the RSDP */ | 395 | /* Get the RSDP */ |
396 | 396 | ||
@@ -407,6 +407,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
407 | return_ACPI_STATUS(AE_OK); | 407 | return_ACPI_STATUS(AE_OK); |
408 | } | 408 | } |
409 | 409 | ||
410 | ACPI_EXPORT_SYMBOL(acpi_find_root_pointer) | ||
411 | |||
410 | /******************************************************************************* | 412 | /******************************************************************************* |
411 | * | 413 | * |
412 | * FUNCTION: acpi_tb_scan_memory_for_rsdp | 414 | * FUNCTION: acpi_tb_scan_memory_for_rsdp |
@@ -419,14 +421,13 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
419 | * DESCRIPTION: Search a block of memory for the RSDP signature | 421 | * DESCRIPTION: Search a block of memory for the RSDP signature |
420 | * | 422 | * |
421 | ******************************************************************************/ | 423 | ******************************************************************************/ |
422 | |||
423 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | 424 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) |
424 | { | 425 | { |
425 | acpi_status status; | 426 | acpi_status status; |
426 | u8 *mem_rover; | 427 | u8 *mem_rover; |
427 | u8 *end_address; | 428 | u8 *end_address; |
428 | 429 | ||
429 | ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp"); | 430 | ACPI_FUNCTION_TRACE(tb_scan_memory_for_rsdp); |
430 | 431 | ||
431 | end_address = start_address + length; | 432 | end_address = start_address + length; |
432 | 433 | ||
@@ -434,12 +435,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
434 | 435 | ||
435 | for (mem_rover = start_address; mem_rover < end_address; | 436 | for (mem_rover = start_address; mem_rover < end_address; |
436 | mem_rover += ACPI_RSDP_SCAN_STEP) { | 437 | mem_rover += ACPI_RSDP_SCAN_STEP) { |
438 | |||
437 | /* The RSDP signature and checksum must both be correct */ | 439 | /* The RSDP signature and checksum must both be correct */ |
438 | 440 | ||
439 | status = | 441 | status = |
440 | acpi_tb_validate_rsdp(ACPI_CAST_PTR | 442 | acpi_tb_validate_rsdp(ACPI_CAST_PTR |
441 | (struct rsdp_descriptor, mem_rover)); | 443 | (struct rsdp_descriptor, mem_rover)); |
442 | if (ACPI_SUCCESS(status)) { | 444 | if (ACPI_SUCCESS(status)) { |
445 | |||
443 | /* Sig and checksum valid, we have found a real RSDP */ | 446 | /* Sig and checksum valid, we have found a real RSDP */ |
444 | 447 | ||
445 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 448 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -469,10 +472,10 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
469 | * | 472 | * |
470 | * RETURN: Status, RSDP physical address | 473 | * RETURN: Status, RSDP physical address |
471 | * | 474 | * |
472 | * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor | 475 | * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor |
473 | * pointer structure. If it is found, set *RSDP to point to it. | 476 | * pointer structure. If it is found, set *RSDP to point to it. |
474 | * | 477 | * |
475 | * NOTE1: The RSDp must be either in the first 1_k of the Extended | 478 | * NOTE1: The RSDP must be either in the first 1_k of the Extended |
476 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) | 479 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) |
477 | * Only a 32-bit physical address is necessary. | 480 | * Only a 32-bit physical address is necessary. |
478 | * | 481 | * |
@@ -489,12 +492,13 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
489 | u32 physical_address; | 492 | u32 physical_address; |
490 | acpi_status status; | 493 | acpi_status status; |
491 | 494 | ||
492 | ACPI_FUNCTION_TRACE("tb_find_rsdp"); | 495 | ACPI_FUNCTION_TRACE(tb_find_rsdp); |
493 | 496 | ||
494 | /* | 497 | /* |
495 | * Scan supports either logical addressing or physical addressing | 498 | * Scan supports either logical addressing or physical addressing |
496 | */ | 499 | */ |
497 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 500 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
501 | |||
498 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ | 502 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
499 | 503 | ||
500 | status = acpi_os_map_memory((acpi_physical_address) | 504 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -521,7 +525,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
521 | 525 | ||
522 | if (physical_address > 0x400) { | 526 | if (physical_address > 0x400) { |
523 | /* | 527 | /* |
524 | * 1b) Search EBDA paragraphs (EBDa is required to be a | 528 | * 1b) Search EBDA paragraphs (EBDA is required to be a |
525 | * minimum of 1_k length) | 529 | * minimum of 1_k length) |
526 | */ | 530 | */ |
527 | status = acpi_os_map_memory((acpi_physical_address) | 531 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -542,10 +546,11 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
542 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); | 546 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); |
543 | 547 | ||
544 | if (mem_rover) { | 548 | if (mem_rover) { |
549 | |||
545 | /* Return the physical address */ | 550 | /* Return the physical address */ |
546 | 551 | ||
547 | physical_address += | 552 | physical_address += |
548 | ACPI_PTR_DIFF(mem_rover, table_ptr); | 553 | (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); |
549 | 554 | ||
550 | table_info->physical_address = | 555 | table_info->physical_address = |
551 | (acpi_physical_address) physical_address; | 556 | (acpi_physical_address) physical_address; |
@@ -576,11 +581,12 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
576 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | 581 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); |
577 | 582 | ||
578 | if (mem_rover) { | 583 | if (mem_rover) { |
584 | |||
579 | /* Return the physical address */ | 585 | /* Return the physical address */ |
580 | 586 | ||
581 | physical_address = | 587 | physical_address = (u32) |
582 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, | 588 | (ACPI_HI_RSDP_WINDOW_BASE + |
583 | table_ptr); | 589 | ACPI_PTR_DIFF(mem_rover, table_ptr)); |
584 | 590 | ||
585 | table_info->physical_address = | 591 | table_info->physical_address = |
586 | (acpi_physical_address) physical_address; | 592 | (acpi_physical_address) physical_address; |
@@ -601,7 +607,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
601 | 607 | ||
602 | if (physical_address > 0x400) { | 608 | if (physical_address > 0x400) { |
603 | /* | 609 | /* |
604 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of | 610 | * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of |
605 | * 1_k length) | 611 | * 1_k length) |
606 | */ | 612 | */ |
607 | mem_rover = | 613 | mem_rover = |
@@ -609,6 +615,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
609 | (physical_address), | 615 | (physical_address), |
610 | ACPI_EBDA_WINDOW_SIZE); | 616 | ACPI_EBDA_WINDOW_SIZE); |
611 | if (mem_rover) { | 617 | if (mem_rover) { |
618 | |||
612 | /* Return the physical address */ | 619 | /* Return the physical address */ |
613 | 620 | ||
614 | table_info->physical_address = | 621 | table_info->physical_address = |
@@ -624,6 +631,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
624 | (ACPI_HI_RSDP_WINDOW_BASE), | 631 | (ACPI_HI_RSDP_WINDOW_BASE), |
625 | ACPI_HI_RSDP_WINDOW_SIZE); | 632 | ACPI_HI_RSDP_WINDOW_SIZE); |
626 | if (mem_rover) { | 633 | if (mem_rover) { |
634 | |||
627 | /* Found it, return the physical address */ | 635 | /* Found it, return the physical address */ |
628 | 636 | ||
629 | table_info->physical_address = | 637 | table_info->physical_address = |