aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/tables
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
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')
-rw-r--r--drivers/acpi/tables/tbinstal.c12
-rw-r--r--drivers/acpi/tables/tbrsdt.c25
-rw-r--r--drivers/acpi/tables/tbxface.c3
-rw-r--r--drivers/acpi/tables/tbxfroot.c106
4 files changed, 75 insertions, 71 deletions
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 629b64c8193..2ad72f20455 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -251,6 +251,7 @@ acpi_tb_init_table_descriptor (
{
struct acpi_table_list *list_head;
struct acpi_table_desc *table_desc;
+ acpi_status status;
ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
@@ -263,6 +264,13 @@ acpi_tb_init_table_descriptor (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /* Get a new owner ID for the table */
+
+ status = acpi_ut_allocate_owner_id (&table_desc->owner_id);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
/* Install the table into the global data structure */
list_head = &acpi_gbl_table_lists[table_type];
@@ -325,8 +333,6 @@ acpi_tb_init_table_descriptor (
table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
table_desc->aml_length = (u32) (table_desc->length -
(u32) sizeof (struct acpi_table_header));
- table_desc->table_id = acpi_ut_allocate_owner_id (
- ACPI_OWNER_TYPE_TABLE);
table_desc->loaded_into_namespace = FALSE;
/*
@@ -339,7 +345,7 @@ acpi_tb_init_table_descriptor (
/* Return Data */
- table_info->table_id = table_desc->table_id;
+ table_info->owner_id = table_desc->owner_id;
table_info->installed_desc = table_desc;
return_ACPI_STATUS (AE_OK);
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index 13c6ddb2f54..069d498465d 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -96,32 +96,13 @@ acpi_tb_verify_rsdp (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /*
- * The signature and checksum must both be correct
- */
- if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
- /* Nope, BAD Signature */
-
- status = AE_BAD_SIGNATURE;
- goto cleanup;
- }
-
- /* Check the standard checksum */
+ /* Verify RSDP signature and checksum */
- if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
- status = AE_BAD_CHECKSUM;
+ status = acpi_tb_validate_rsdp (rsdp);
+ if (ACPI_FAILURE (status)) {
goto cleanup;
}
- /* Check extended checksum if table version >= 2 */
-
- if (rsdp->revision >= 2) {
- if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
- status = AE_BAD_CHECKSUM;
- goto cleanup;
- }
- }
-
/* The RSDP supplied is OK */
table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp);
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 0c0b9085dbe..ca2dbdd23ed 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -260,8 +260,7 @@ acpi_unload_table (
* "Scope" operator. Thus, we need to track ownership by an ID, not
* simply a position within the hierarchy
*/
- acpi_ns_delete_namespace_by_owner (table_desc->table_id);
-
+ acpi_ns_delete_namespace_by_owner (table_desc->owner_id);
table_desc = table_desc->next;
}
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index fe9c8317df4..abb4c934656 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -65,6 +65,51 @@ acpi_tb_scan_memory_for_rsdp (
/*******************************************************************************
*
+ * FUNCTION: acpi_tb_validate_rsdp
+ *
+ * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate the RSDP (ptr)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_validate_rsdp (
+ struct rsdp_descriptor *rsdp)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * The signature and checksum must both be correct
+ */
+ if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
+ /* Nope, BAD Signature */
+
+ return (AE_BAD_SIGNATURE);
+ }
+
+ /* Check the standard checksum */
+
+ if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
+ return (AE_BAD_CHECKSUM);
+ }
+
+ /* Check extended checksum if table version >= 2 */
+
+ if ((rsdp->revision >= 2) &&
+ (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
+ return (AE_BAD_CHECKSUM);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_tb_find_table
*
* PARAMETERS: Signature - String with ACPI table signature
@@ -218,19 +263,11 @@ acpi_get_firmware_table (
acpi_gbl_RSDP = address.pointer.logical;
}
- /* The signature and checksum must both be correct */
-
- if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
- sizeof (RSDP_SIG)-1) != 0) {
- /* Nope, BAD Signature */
+ /* The RDSP signature and checksum must both be correct */
- return_ACPI_STATUS (AE_BAD_SIGNATURE);
- }
-
- if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
- /* Nope, BAD Checksum */
-
- return_ACPI_STATUS (AE_BAD_CHECKSUM);
+ status = acpi_tb_validate_rsdp (acpi_gbl_RSDP);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
}
}
@@ -414,9 +451,9 @@ acpi_tb_scan_memory_for_rsdp (
u8 *start_address,
u32 length)
{
+ acpi_status status;
u8 *mem_rover;
u8 *end_address;
- u8 checksum;
ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp");
@@ -428,45 +465,25 @@ acpi_tb_scan_memory_for_rsdp (
for (mem_rover = start_address; mem_rover < end_address;
mem_rover += ACPI_RSDP_SCAN_STEP) {
- /* The signature and checksum must both be correct */
+ /* The RSDP signature and checksum must both be correct */
- if (ACPI_STRNCMP ((char *) mem_rover,
- RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) {
- /* No signature match, keep looking */
-
- continue;
- }
-
- /* Signature matches, check the appropriate checksum */
-
- if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) {
- /* ACPI version 1.0 */
-
- checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH);
- }
- else {
- /* Post ACPI 1.0, use extended_checksum */
-
- checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH);
- }
-
- if (checksum == 0) {
- /* Checksum valid, we have found a valid RSDP */
+ status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover));
+ if (ACPI_SUCCESS (status)) {
+ /* Sig and checksum valid, we have found a real RSDP */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at physical address %p\n", mem_rover));
return_PTR (mem_rover);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Found an RSDP at physical address %p, but it has a bad checksum\n",
- mem_rover));
+ /* No sig match or bad checksum, keep searching */
}
/* Searched entire block, no RSDP was found */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Searched entire block, no valid RSDP was found.\n"));
+ "Searched entire block from %p, valid RSDP was not found\n",
+ start_address));
return_PTR (NULL);
}
@@ -554,7 +571,7 @@ acpi_tb_find_rsdp (
acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) {
- /* Found it, return the physical address */
+ /* Return the physical address */
physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
@@ -583,7 +600,7 @@ acpi_tb_find_rsdp (
acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
- /* Found it, return the physical address */
+ /* Return the physical address */
physical_address =
ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
@@ -614,7 +631,7 @@ acpi_tb_find_rsdp (
ACPI_PHYSADDR_TO_PTR (physical_address),
ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) {
- /* Found it, return the physical address */
+ /* Return the physical address */
table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
return_ACPI_STATUS (AE_OK);
@@ -634,8 +651,9 @@ acpi_tb_find_rsdp (
}
}
- /* RSDP signature was not found */
+ /* A valid RSDP was not found */
+ ACPI_REPORT_ERROR (("No valid RSDP was found\n"));
return_ACPI_STATUS (AE_NOT_FOUND);
}