aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbxfroot.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-07-08 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-14 00:42:23 -0400
commitf9f4601f331aa1226d7a798a01950efbb388f07f (patch)
tree62e079a9275749d16a4a0da56a427be201e15d27 /drivers/acpi/tables/tbxfroot.c
parent4c3ffbd79529b680b3c3ef2b6f42f0c89c694ec5 (diff)
ACPICA 20050708 from Bob Moore <robert.moore@intel.com>
The use of the CPU stack in the debug version of the subsystem has been considerably reduced. Previously, a debug structure was declared in every function that used the debug macros. This structure has been removed in favor of declaring the individual elements as parameters to the debug functions. This reduces the cumulative stack use during nested execution of ACPI function calls at the cost of a small increase in the code size of the debug version of the subsystem. With assistance from Alexey Starikovskiy and Len Brown. Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-dependent headers to define a macro that will return the current function name at runtime (such as __FUNCTION__ or _func_, etc.) The function name is used by the debug trace output. If ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent header, the function name is saved on the CPU stack (one pointer per function.) This mechanism is used because apparently there exists no standard ANSI-C defined macro that that returns the function name. Alexey Starikovskiy redesigned and reimplemented the "Owner ID" mechanism used to track namespace objects created/deleted by ACPI tables and control method execution. A bitmap is now used to allocate and free the IDs, thus solving the wraparound problem present in the previous implementation. The size of the namespace node descriptor was reduced by 2 bytes as a result. Removed the UINT32_BIT and UINT16_BIT types that were used for the bitfield flag definitions within the headers for the predefined ACPI tables. These have been replaced by UINT8_BIT in order to increase the code portability of the subsystem. If the use of UINT8 remains a problem, we may be forced to eliminate bitfields entirely because of a lack of portability. Alexey Starikovksiy enhanced the performance of acpi_ut_update_object_reference. This is a frequently used function and this improvement increases the performance of the entire subsystem. Alexey Starikovskiy fixed several possible memory leaks and the inverse - premature object deletion. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables/tbxfroot.c')
-rw-r--r--drivers/acpi/tables/tbxfroot.c106
1 files changed, 62 insertions, 44 deletions
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index fe9c8317df46..abb4c9346560 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -65,6 +65,51 @@ acpi_tb_scan_memory_for_rsdp (
65 65
66/******************************************************************************* 66/*******************************************************************************
67 * 67 *
68 * FUNCTION: acpi_tb_validate_rsdp
69 *
70 * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
71 *
72 * RETURN: Status
73 *
74 * DESCRIPTION: Validate the RSDP (ptr)
75 *
76 ******************************************************************************/
77
78acpi_status
79acpi_tb_validate_rsdp (
80 struct rsdp_descriptor *rsdp)
81{
82 ACPI_FUNCTION_ENTRY ();
83
84
85 /*
86 * The signature and checksum must both be correct
87 */
88 if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
89 /* Nope, BAD Signature */
90
91 return (AE_BAD_SIGNATURE);
92 }
93
94 /* Check the standard checksum */
95
96 if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
97 return (AE_BAD_CHECKSUM);
98 }
99
100 /* Check extended checksum if table version >= 2 */
101
102 if ((rsdp->revision >= 2) &&
103 (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
104 return (AE_BAD_CHECKSUM);
105 }
106
107 return (AE_OK);
108}
109
110
111/*******************************************************************************
112 *
68 * FUNCTION: acpi_tb_find_table 113 * FUNCTION: acpi_tb_find_table
69 * 114 *
70 * PARAMETERS: Signature - String with ACPI table signature 115 * PARAMETERS: Signature - String with ACPI table signature
@@ -218,19 +263,11 @@ acpi_get_firmware_table (
218 acpi_gbl_RSDP = address.pointer.logical; 263 acpi_gbl_RSDP = address.pointer.logical;
219 } 264 }
220 265
221 /* The signature and checksum must both be correct */ 266 /* The RDSP signature and checksum must both be correct */
222
223 if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
224 sizeof (RSDP_SIG)-1) != 0) {
225 /* Nope, BAD Signature */
226 267
227 return_ACPI_STATUS (AE_BAD_SIGNATURE); 268 status = acpi_tb_validate_rsdp (acpi_gbl_RSDP);
228 } 269 if (ACPI_FAILURE (status)) {
229 270 return_ACPI_STATUS (status);
230 if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
231 /* Nope, BAD Checksum */
232
233 return_ACPI_STATUS (AE_BAD_CHECKSUM);
234 } 271 }
235 } 272 }
236 273
@@ -414,9 +451,9 @@ acpi_tb_scan_memory_for_rsdp (
414 u8 *start_address, 451 u8 *start_address,
415 u32 length) 452 u32 length)
416{ 453{
454 acpi_status status;
417 u8 *mem_rover; 455 u8 *mem_rover;
418 u8 *end_address; 456 u8 *end_address;
419 u8 checksum;
420 457
421 458
422 ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp"); 459 ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp");
@@ -428,45 +465,25 @@ acpi_tb_scan_memory_for_rsdp (
428 465
429 for (mem_rover = start_address; mem_rover < end_address; 466 for (mem_rover = start_address; mem_rover < end_address;
430 mem_rover += ACPI_RSDP_SCAN_STEP) { 467 mem_rover += ACPI_RSDP_SCAN_STEP) {
431 /* The signature and checksum must both be correct */ 468 /* The RSDP signature and checksum must both be correct */
432 469
433 if (ACPI_STRNCMP ((char *) mem_rover, 470 status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover));
434 RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) { 471 if (ACPI_SUCCESS (status)) {
435 /* No signature match, keep looking */ 472 /* Sig and checksum valid, we have found a real RSDP */
436
437 continue;
438 }
439
440 /* Signature matches, check the appropriate checksum */
441
442 if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) {
443 /* ACPI version 1.0 */
444
445 checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH);
446 }
447 else {
448 /* Post ACPI 1.0, use extended_checksum */
449
450 checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH);
451 }
452
453 if (checksum == 0) {
454 /* Checksum valid, we have found a valid RSDP */
455 473
456 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 474 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
457 "RSDP located at physical address %p\n", mem_rover)); 475 "RSDP located at physical address %p\n", mem_rover));
458 return_PTR (mem_rover); 476 return_PTR (mem_rover);
459 } 477 }
460 478
461 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 479 /* No sig match or bad checksum, keep searching */
462 "Found an RSDP at physical address %p, but it has a bad checksum\n",
463 mem_rover));
464 } 480 }
465 481
466 /* Searched entire block, no RSDP was found */ 482 /* Searched entire block, no RSDP was found */
467 483
468 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 484 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
469 "Searched entire block, no valid RSDP was found.\n")); 485 "Searched entire block from %p, valid RSDP was not found\n",
486 start_address));
470 return_PTR (NULL); 487 return_PTR (NULL);
471} 488}
472 489
@@ -554,7 +571,7 @@ acpi_tb_find_rsdp (
554 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); 571 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
555 572
556 if (mem_rover) { 573 if (mem_rover) {
557 /* Found it, return the physical address */ 574 /* Return the physical address */
558 575
559 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); 576 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
560 577
@@ -583,7 +600,7 @@ acpi_tb_find_rsdp (
583 acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); 600 acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
584 601
585 if (mem_rover) { 602 if (mem_rover) {
586 /* Found it, return the physical address */ 603 /* Return the physical address */
587 604
588 physical_address = 605 physical_address =
589 ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); 606 ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
@@ -614,7 +631,7 @@ acpi_tb_find_rsdp (
614 ACPI_PHYSADDR_TO_PTR (physical_address), 631 ACPI_PHYSADDR_TO_PTR (physical_address),
615 ACPI_EBDA_WINDOW_SIZE); 632 ACPI_EBDA_WINDOW_SIZE);
616 if (mem_rover) { 633 if (mem_rover) {
617 /* Found it, return the physical address */ 634 /* Return the physical address */
618 635
619 table_info->physical_address = ACPI_TO_INTEGER (mem_rover); 636 table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
620 return_ACPI_STATUS (AE_OK); 637 return_ACPI_STATUS (AE_OK);
@@ -634,8 +651,9 @@ acpi_tb_find_rsdp (
634 } 651 }
635 } 652 }
636 653
637 /* RSDP signature was not found */ 654 /* A valid RSDP was not found */
638 655
656 ACPI_REPORT_ERROR (("No valid RSDP was found\n"));
639 return_ACPI_STATUS (AE_NOT_FOUND); 657 return_ACPI_STATUS (AE_NOT_FOUND);
640} 658}
641 659