aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-07-29 18:15:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-30 00:51:39 -0400
commit0c9938cc75057c0fca1af55a55dcfc2842436695 (patch)
treed18e809bf9e3811f20c609b6515d4d1b8520cfbc /drivers/acpi/tables
parentdd8f39bbf5154cdbfd698fc70c66faba33eafa44 (diff)
[ACPI] ACPICA 20050729 from Bob Moore
Implemented support to ignore an attempt to install/load a particular ACPI table more than once. Apparently there exists BIOS code that repeatedly attempts to load the same SSDT upon certain events. Thanks to Venkatesh Pallipadi. Restructured the main interface to the AML parser in order to correctly handle all exceptional conditions. This will prevent leakage of the OwnerId resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on some machines. Thanks to Alexey Starikovskiy. Support for "module level code" has been disabled in this version due to a number of issues that have appeared on various machines. The support can be enabled by defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When the issues are fully resolved, the code will be enabled by default again. Modified the internal functions for debug print support to define the FunctionName parameter as a (const char *) for compatibility with compiler built-in macros such as __FUNCTION__, etc. Linted the entire ACPICA source tree for both 32-bit and 64-bit. Signed-off-by: Robert Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables')
-rw-r--r--drivers/acpi/tables/tbinstal.c22
-rw-r--r--drivers/acpi/tables/tbutils.c67
-rw-r--r--drivers/acpi/tables/tbxface.c14
-rw-r--r--drivers/acpi/tables/tbxfroot.c4
4 files changed, 96 insertions, 11 deletions
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 2ad72f204551..698799901f55 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -124,9 +124,7 @@ acpi_tb_match_signature (
124 * 124 *
125 * RETURN: Status 125 * RETURN: Status
126 * 126 *
127 * DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must 127 * DESCRIPTION: Install the table into the global data structures.
128 * already be loaded and validated.
129 * Install the table into the global data structs.
130 * 128 *
131 ******************************************************************************/ 129 ******************************************************************************/
132 130
@@ -136,6 +134,7 @@ acpi_tb_install_table (
136{ 134{
137 acpi_status status; 135 acpi_status status;
138 136
137
139 ACPI_FUNCTION_TRACE ("tb_install_table"); 138 ACPI_FUNCTION_TRACE ("tb_install_table");
140 139
141 140
@@ -143,22 +142,33 @@ acpi_tb_install_table (
143 142
144 status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); 143 status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
145 if (ACPI_FAILURE (status)) { 144 if (ACPI_FAILURE (status)) {
146 ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n", 145 ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n",
147 table_info->pointer->signature, acpi_format_exception (status))); 146 acpi_format_exception (status)));
148 return_ACPI_STATUS (status); 147 return_ACPI_STATUS (status);
149 } 148 }
150 149
150 /*
151 * Ignore a table that is already installed. For example, some BIOS
152 * ASL code will repeatedly attempt to load the same SSDT.
153 */
154 status = acpi_tb_is_table_installed (table_info);
155 if (ACPI_FAILURE (status)) {
156 goto unlock_and_exit;
157 }
158
151 /* Install the table into the global data structure */ 159 /* Install the table into the global data structure */
152 160
153 status = acpi_tb_init_table_descriptor (table_info->type, table_info); 161 status = acpi_tb_init_table_descriptor (table_info->type, table_info);
154 if (ACPI_FAILURE (status)) { 162 if (ACPI_FAILURE (status)) {
155 ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n", 163 ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n",
156 table_info->pointer->signature, acpi_format_exception (status))); 164 table_info->pointer->signature, acpi_format_exception (status)));
157 } 165 }
158 166
159 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", 167 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
160 acpi_gbl_table_data[table_info->type].name, table_info->pointer)); 168 acpi_gbl_table_data[table_info->type].name, table_info->pointer));
161 169
170
171unlock_and_exit:
162 (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); 172 (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
163 return_ACPI_STATUS (status); 173 return_ACPI_STATUS (status);
164} 174}
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index e69d01d443d2..6fc1e36e6042 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -61,6 +61,67 @@ acpi_tb_handle_to_object (
61 61
62/******************************************************************************* 62/*******************************************************************************
63 * 63 *
64 * FUNCTION: acpi_tb_is_table_installed
65 *
66 * PARAMETERS: new_table_desc - Descriptor for new table being installed
67 *
68 * RETURN: Status - AE_ALREADY_EXISTS if the table is already installed
69 *
70 * DESCRIPTION: Determine if an ACPI table is already installed
71 *
72 * MUTEX: Table data structures should be locked
73 *
74 ******************************************************************************/
75
76acpi_status
77acpi_tb_is_table_installed (
78 struct acpi_table_desc *new_table_desc)
79{
80 struct acpi_table_desc *table_desc;
81
82
83 ACPI_FUNCTION_TRACE ("tb_is_table_installed");
84
85
86 /* Get the list descriptor and first table descriptor */
87
88 table_desc = acpi_gbl_table_lists[new_table_desc->type].next;
89
90 /* Examine all installed tables of this type */
91
92 while (table_desc) {
93 /* Compare Revision and oem_table_id */
94
95 if ((table_desc->loaded_into_namespace) &&
96 (table_desc->pointer->revision ==
97 new_table_desc->pointer->revision) &&
98 (!ACPI_MEMCMP (table_desc->pointer->oem_table_id,
99 new_table_desc->pointer->oem_table_id, 8))) {
100 /* This table is already installed */
101
102 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
103 "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n",
104 new_table_desc->pointer->signature,
105 new_table_desc->pointer->revision,
106 new_table_desc->pointer->oem_table_id));
107
108 new_table_desc->owner_id = table_desc->owner_id;
109 new_table_desc->installed_desc = table_desc;
110
111 return_ACPI_STATUS (AE_ALREADY_EXISTS);
112 }
113
114 /* Get next table on the list */
115
116 table_desc = table_desc->next;
117 }
118
119 return_ACPI_STATUS (AE_OK);
120}
121
122
123/*******************************************************************************
124 *
64 * FUNCTION: acpi_tb_validate_table_header 125 * FUNCTION: acpi_tb_validate_table_header
65 * 126 *
66 * PARAMETERS: table_header - Logical pointer to the table 127 * PARAMETERS: table_header - Logical pointer to the table
@@ -157,7 +218,7 @@ acpi_tb_verify_table_checksum (
157 218
158 /* Compute the checksum on the table */ 219 /* Compute the checksum on the table */
159 220
160 checksum = acpi_tb_checksum (table_header, table_header->length); 221 checksum = acpi_tb_generate_checksum (table_header, table_header->length);
161 222
162 /* Return the appropriate exception */ 223 /* Return the appropriate exception */
163 224
@@ -175,7 +236,7 @@ acpi_tb_verify_table_checksum (
175 236
176/******************************************************************************* 237/*******************************************************************************
177 * 238 *
178 * FUNCTION: acpi_tb_checksum 239 * FUNCTION: acpi_tb_generate_checksum
179 * 240 *
180 * PARAMETERS: Buffer - Buffer to checksum 241 * PARAMETERS: Buffer - Buffer to checksum
181 * Length - Size of the buffer 242 * Length - Size of the buffer
@@ -187,7 +248,7 @@ acpi_tb_verify_table_checksum (
187 ******************************************************************************/ 248 ******************************************************************************/
188 249
189u8 250u8
190acpi_tb_checksum ( 251acpi_tb_generate_checksum (
191 void *buffer, 252 void *buffer,
192 u32 length) 253 u32 length)
193{ 254{
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index ca2dbdd23ed3..e18a05d1b9b3 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -182,10 +182,23 @@ acpi_load_table (
182 return_ACPI_STATUS (status); 182 return_ACPI_STATUS (status);
183 } 183 }
184 184
185 /* Check signature for a valid table type */
186
187 status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL);
188 if (ACPI_FAILURE (status)) {
189 return_ACPI_STATUS (status);
190 }
191
185 /* Install the new table into the local data structures */ 192 /* Install the new table into the local data structures */
186 193
187 status = acpi_tb_install_table (&table_info); 194 status = acpi_tb_install_table (&table_info);
188 if (ACPI_FAILURE (status)) { 195 if (ACPI_FAILURE (status)) {
196 if (status == AE_ALREADY_EXISTS) {
197 /* Table already exists, no error */
198
199 status = AE_OK;
200 }
201
189 /* Free table allocated by acpi_tb_get_table_body */ 202 /* Free table allocated by acpi_tb_get_table_body */
190 203
191 acpi_tb_delete_single_table (&table_info); 204 acpi_tb_delete_single_table (&table_info);
@@ -261,6 +274,7 @@ acpi_unload_table (
261 * simply a position within the hierarchy 274 * simply a position within the hierarchy
262 */ 275 */
263 acpi_ns_delete_namespace_by_owner (table_desc->owner_id); 276 acpi_ns_delete_namespace_by_owner (table_desc->owner_id);
277 acpi_ut_release_owner_id (&table_desc->owner_id);
264 table_desc = table_desc->next; 278 table_desc = table_desc->next;
265 } 279 }
266 280
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index abb4c9346560..87dccdda9ae2 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -93,14 +93,14 @@ acpi_tb_validate_rsdp (
93 93
94 /* Check the standard checksum */ 94 /* Check the standard checksum */
95 95
96 if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { 96 if (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
97 return (AE_BAD_CHECKSUM); 97 return (AE_BAD_CHECKSUM);
98 } 98 }
99 99
100 /* Check extended checksum if table version >= 2 */ 100 /* Check extended checksum if table version >= 2 */
101 101
102 if ((rsdp->revision >= 2) && 102 if ((rsdp->revision >= 2) &&
103 (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { 103 (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
104 return (AE_BAD_CHECKSUM); 104 return (AE_BAD_CHECKSUM);
105 } 105 }
106 106