diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/actables.h | 17 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbfind.c | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbinstal.c | 299 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbutils.c | 11 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbxface.c | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbxfload.c | 6 |
6 files changed, 235 insertions, 108 deletions
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index 5fa4b2027697..c569eab774b1 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h | |||
@@ -72,14 +72,25 @@ acpi_tb_find_table(char *signature, | |||
72 | */ | 72 | */ |
73 | acpi_status acpi_tb_resize_root_table_list(void); | 73 | acpi_status acpi_tb_resize_root_table_list(void); |
74 | 74 | ||
75 | acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc); | 75 | acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc); |
76 | 76 | ||
77 | struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | 77 | void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc); |
78 | |||
79 | struct acpi_table_header *acpi_tb_override_table(struct acpi_table_header | ||
78 | *table_header, | 80 | *table_header, |
79 | struct acpi_table_desc | 81 | struct acpi_table_desc |
80 | *table_desc); | 82 | *table_desc); |
81 | 83 | ||
82 | acpi_status | 84 | acpi_status |
85 | acpi_tb_acquire_table(struct acpi_table_desc *table_desc, | ||
86 | struct acpi_table_header **table_ptr, | ||
87 | u32 *table_length, u8 *table_flags); | ||
88 | |||
89 | void | ||
90 | acpi_tb_release_table(struct acpi_table_header *table, | ||
91 | u32 table_length, u8 table_flags); | ||
92 | |||
93 | acpi_status | ||
83 | acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index); | 94 | acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index); |
84 | 95 | ||
85 | acpi_status | 96 | acpi_status |
@@ -87,7 +98,7 @@ acpi_tb_store_table(acpi_physical_address address, | |||
87 | struct acpi_table_header *table, | 98 | struct acpi_table_header *table, |
88 | u32 length, u8 flags, u32 *table_index); | 99 | u32 length, u8 flags, u32 *table_index); |
89 | 100 | ||
90 | void acpi_tb_delete_table(struct acpi_table_desc *table_desc); | 101 | void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc); |
91 | 102 | ||
92 | void acpi_tb_terminate(void); | 103 | void acpi_tb_terminate(void); |
93 | 104 | ||
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c index c12003947bd5..cb947700206c 100644 --- a/drivers/acpi/acpica/tbfind.c +++ b/drivers/acpi/acpica/tbfind.c | |||
@@ -99,8 +99,8 @@ acpi_tb_find_table(char *signature, | |||
99 | /* Table is not currently mapped, map it */ | 99 | /* Table is not currently mapped, map it */ |
100 | 100 | ||
101 | status = | 101 | status = |
102 | acpi_tb_verify_table(&acpi_gbl_root_table_list. | 102 | acpi_tb_validate_table(&acpi_gbl_root_table_list. |
103 | tables[i]); | 103 | tables[i]); |
104 | if (ACPI_FAILURE(status)) { | 104 | if (ACPI_FAILURE(status)) { |
105 | return_ACPI_STATUS(status); | 105 | return_ACPI_STATUS(status); |
106 | } | 106 | } |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 0040e19b6d14..93a99ef03425 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -49,49 +49,123 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME("tbinstal") | 50 | ACPI_MODULE_NAME("tbinstal") |
51 | 51 | ||
52 | /****************************************************************************** | 52 | /******************************************************************************* |
53 | * | 53 | * |
54 | * FUNCTION: acpi_tb_verify_table | 54 | * FUNCTION: acpi_tb_acquire_table |
55 | * | 55 | * |
56 | * PARAMETERS: table_desc - table | 56 | * PARAMETERS: table_desc - Table descriptor |
57 | * table_ptr - Where table is returned | ||
58 | * table_length - Where table length is returned | ||
59 | * table_flags - Where table allocation flags are returned | ||
57 | * | 60 | * |
58 | * RETURN: Status | 61 | * RETURN: Status |
59 | * | 62 | * |
60 | * DESCRIPTION: this function is called to verify and map table | 63 | * DESCRIPTION: Acquire a table. It can be used for tables not maintained in |
64 | * acpi_gbl_root_table_list. | ||
61 | * | 65 | * |
62 | *****************************************************************************/ | 66 | ******************************************************************************/ |
63 | acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) | 67 | acpi_status |
68 | acpi_tb_acquire_table(struct acpi_table_desc *table_desc, | ||
69 | struct acpi_table_header **table_ptr, | ||
70 | u32 *table_length, u8 *table_flags) | ||
64 | { | 71 | { |
65 | acpi_status status = AE_OK; | 72 | struct acpi_table_header *table = NULL; |
66 | 73 | ||
67 | ACPI_FUNCTION_TRACE(tb_verify_table); | 74 | switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { |
75 | case ACPI_TABLE_ORIGIN_MAPPED: | ||
68 | 76 | ||
69 | /* Map the table if necessary */ | 77 | table = |
78 | acpi_os_map_memory(table_desc->address, table_desc->length); | ||
79 | break; | ||
70 | 80 | ||
71 | if (!table_desc->pointer) { | 81 | case ACPI_TABLE_ORIGIN_ALLOCATED: |
72 | switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { | 82 | case ACPI_TABLE_ORIGIN_UNKNOWN: |
73 | case ACPI_TABLE_ORIGIN_MAPPED: | 83 | case ACPI_TABLE_ORIGIN_OVERRIDE: |
74 | 84 | ||
75 | table_desc->pointer = | 85 | table = |
76 | acpi_os_map_memory(table_desc->address, | 86 | ACPI_CAST_PTR(struct acpi_table_header, |
77 | table_desc->length); | 87 | table_desc->address); |
78 | break; | 88 | break; |
79 | 89 | ||
80 | case ACPI_TABLE_ORIGIN_ALLOCATED: | 90 | default: |
81 | case ACPI_TABLE_ORIGIN_UNKNOWN: | ||
82 | case ACPI_TABLE_ORIGIN_OVERRIDE: | ||
83 | 91 | ||
84 | table_desc->pointer = | 92 | break; |
85 | ACPI_CAST_PTR(struct acpi_table_header, | 93 | } |
86 | table_desc->address); | ||
87 | break; | ||
88 | 94 | ||
89 | default: | 95 | /* Table is not valid yet */ |
90 | 96 | ||
91 | break; | 97 | if (!table) { |
92 | } | 98 | return (AE_NO_MEMORY); |
99 | } | ||
100 | |||
101 | /* Fill the return values */ | ||
102 | |||
103 | *table_ptr = table; | ||
104 | *table_length = table_desc->length; | ||
105 | *table_flags = table_desc->flags; | ||
106 | |||
107 | return (AE_OK); | ||
108 | } | ||
109 | |||
110 | /******************************************************************************* | ||
111 | * | ||
112 | * FUNCTION: acpi_tb_release_table | ||
113 | * | ||
114 | * PARAMETERS: table - Pointer for the table | ||
115 | * table_length - Length for the table | ||
116 | * table_flags - Allocation flags for the table | ||
117 | * | ||
118 | * RETURN: None | ||
119 | * | ||
120 | * DESCRIPTION: Release a table. The reversal of acpi_tb_acquire_table(). | ||
121 | * | ||
122 | ******************************************************************************/ | ||
123 | |||
124 | void | ||
125 | acpi_tb_release_table(struct acpi_table_header *table, | ||
126 | u32 table_length, u8 table_flags) | ||
127 | { | ||
128 | switch (table_flags & ACPI_TABLE_ORIGIN_MASK) { | ||
129 | case ACPI_TABLE_ORIGIN_MAPPED: | ||
130 | |||
131 | acpi_os_unmap_memory(table, table_length); | ||
132 | break; | ||
133 | |||
134 | case ACPI_TABLE_ORIGIN_ALLOCATED: | ||
135 | case ACPI_TABLE_ORIGIN_UNKNOWN: | ||
136 | case ACPI_TABLE_ORIGIN_OVERRIDE: | ||
137 | default: | ||
138 | |||
139 | break; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | /****************************************************************************** | ||
144 | * | ||
145 | * FUNCTION: acpi_tb_validate_table | ||
146 | * | ||
147 | * PARAMETERS: table_desc - Table descriptor | ||
148 | * | ||
149 | * RETURN: Status | ||
150 | * | ||
151 | * DESCRIPTION: This function is called to validate (ensure Pointer is valid) | ||
152 | * and verify the table. | ||
153 | * | ||
154 | *****************************************************************************/ | ||
155 | |||
156 | acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc) | ||
157 | { | ||
158 | acpi_status status = AE_OK; | ||
159 | |||
160 | ACPI_FUNCTION_TRACE(tb_validate_table); | ||
161 | |||
162 | /* Validate the table if necessary */ | ||
93 | 163 | ||
94 | if (!table_desc->pointer) { | 164 | if (!table_desc->pointer) { |
165 | status = acpi_tb_acquire_table(table_desc, &table_desc->pointer, | ||
166 | &table_desc->length, | ||
167 | &table_desc->flags); | ||
168 | if (ACPI_FAILURE(status) || !table_desc->pointer) { | ||
95 | return_ACPI_STATUS(AE_NO_MEMORY); | 169 | return_ACPI_STATUS(AE_NO_MEMORY); |
96 | } | 170 | } |
97 | } | 171 | } |
@@ -106,6 +180,37 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) | |||
106 | 180 | ||
107 | /******************************************************************************* | 181 | /******************************************************************************* |
108 | * | 182 | * |
183 | * FUNCTION: acpi_tb_invalidate_table | ||
184 | * | ||
185 | * PARAMETERS: table_desc - Table descriptor | ||
186 | * | ||
187 | * RETURN: None | ||
188 | * | ||
189 | * DESCRIPTION: Invalidate one internal ACPI table, this is reversal of | ||
190 | * acpi_tb_validate_table(). | ||
191 | * | ||
192 | ******************************************************************************/ | ||
193 | |||
194 | void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc) | ||
195 | { | ||
196 | |||
197 | ACPI_FUNCTION_TRACE(tb_invalidate_table); | ||
198 | |||
199 | /* Table must be validated */ | ||
200 | |||
201 | if (!table_desc->pointer) { | ||
202 | return_VOID; | ||
203 | } | ||
204 | |||
205 | acpi_tb_release_table(table_desc->pointer, table_desc->length, | ||
206 | table_desc->flags); | ||
207 | table_desc->pointer = NULL; | ||
208 | |||
209 | return_VOID; | ||
210 | } | ||
211 | |||
212 | /******************************************************************************* | ||
213 | * | ||
109 | * FUNCTION: acpi_tb_add_table | 214 | * FUNCTION: acpi_tb_add_table |
110 | * | 215 | * |
111 | * PARAMETERS: table_desc - Table descriptor | 216 | * PARAMETERS: table_desc - Table descriptor |
@@ -124,11 +229,12 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) | |||
124 | { | 229 | { |
125 | u32 i; | 230 | u32 i; |
126 | acpi_status status = AE_OK; | 231 | acpi_status status = AE_OK; |
232 | struct acpi_table_header *final_table; | ||
127 | 233 | ||
128 | ACPI_FUNCTION_TRACE(tb_add_table); | 234 | ACPI_FUNCTION_TRACE(tb_add_table); |
129 | 235 | ||
130 | if (!table_desc->pointer) { | 236 | if (!table_desc->pointer) { |
131 | status = acpi_tb_verify_table(table_desc); | 237 | status = acpi_tb_validate_table(table_desc); |
132 | if (ACPI_FAILURE(status) || !table_desc->pointer) { | 238 | if (ACPI_FAILURE(status) || !table_desc->pointer) { |
133 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
134 | } | 240 | } |
@@ -166,8 +272,8 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) | |||
166 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { | 272 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { |
167 | if (!acpi_gbl_root_table_list.tables[i].pointer) { | 273 | if (!acpi_gbl_root_table_list.tables[i].pointer) { |
168 | status = | 274 | status = |
169 | acpi_tb_verify_table(&acpi_gbl_root_table_list. | 275 | acpi_tb_validate_table(&acpi_gbl_root_table_list. |
170 | tables[i]); | 276 | tables[i]); |
171 | if (ACPI_FAILURE(status) | 277 | if (ACPI_FAILURE(status) |
172 | || !acpi_gbl_root_table_list.tables[i].pointer) { | 278 | || !acpi_gbl_root_table_list.tables[i].pointer) { |
173 | continue; | 279 | continue; |
@@ -215,7 +321,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) | |||
215 | } else { | 321 | } else { |
216 | /* Table was unloaded, allow it to be reloaded */ | 322 | /* Table was unloaded, allow it to be reloaded */ |
217 | 323 | ||
218 | acpi_tb_delete_table(table_desc); | 324 | acpi_tb_uninstall_table(table_desc); |
219 | table_desc->pointer = | 325 | table_desc->pointer = |
220 | acpi_gbl_root_table_list.tables[i].pointer; | 326 | acpi_gbl_root_table_list.tables[i].pointer; |
221 | table_desc->address = | 327 | table_desc->address = |
@@ -229,9 +335,15 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) | |||
229 | * ACPI Table Override: | 335 | * ACPI Table Override: |
230 | * Allow the host to override dynamically loaded tables. | 336 | * Allow the host to override dynamically loaded tables. |
231 | * NOTE: the table is fully mapped at this point, and the mapping will | 337 | * NOTE: the table is fully mapped at this point, and the mapping will |
232 | * be deleted by tb_table_override if the table is actually overridden. | 338 | * be deleted by acpi_tb_override_table if the table is actually overridden. |
233 | */ | 339 | */ |
234 | (void)acpi_tb_table_override(table_desc->pointer, table_desc); | 340 | final_table = acpi_tb_override_table(table_desc->pointer, table_desc); |
341 | if (final_table) { | ||
342 | |||
343 | /* Ensure table descriptor is in "VALIDATED" state */ | ||
344 | |||
345 | table_desc->pointer = final_table; | ||
346 | } | ||
235 | 347 | ||
236 | /* Add the table to the global root table list */ | 348 | /* Add the table to the global root table list */ |
237 | 349 | ||
@@ -252,7 +364,7 @@ release: | |||
252 | 364 | ||
253 | /******************************************************************************* | 365 | /******************************************************************************* |
254 | * | 366 | * |
255 | * FUNCTION: acpi_tb_table_override | 367 | * FUNCTION: acpi_tb_override_table |
256 | * | 368 | * |
257 | * PARAMETERS: table_header - Header for the original table | 369 | * PARAMETERS: table_header - Header for the original table |
258 | * table_desc - Table descriptor initialized for the | 370 | * table_desc - Table descriptor initialized for the |
@@ -264,29 +376,35 @@ release: | |||
264 | * | 376 | * |
265 | * DESCRIPTION: Attempt table override by calling the OSL override functions. | 377 | * DESCRIPTION: Attempt table override by calling the OSL override functions. |
266 | * Note: If the table is overridden, then the entire new table | 378 | * Note: If the table is overridden, then the entire new table |
267 | * is mapped and returned by this function. | 379 | * is acquired and returned by this function. |
380 | * After invocation, the table descriptor is in a state that is | ||
381 | * "INSTALLED" but not "VALIDATED", thus the "Pointer" member is | ||
382 | * kept NULL. | ||
268 | * | 383 | * |
269 | ******************************************************************************/ | 384 | ******************************************************************************/ |
270 | 385 | ||
271 | struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | 386 | struct acpi_table_header *acpi_tb_override_table(struct acpi_table_header |
272 | *table_header, | 387 | *table_header, |
273 | struct acpi_table_desc | 388 | struct acpi_table_desc |
274 | *table_desc) | 389 | *table_desc) |
275 | { | 390 | { |
276 | acpi_status status; | 391 | acpi_status status; |
277 | struct acpi_table_header *new_table = NULL; | 392 | struct acpi_table_header *new_table; |
278 | acpi_physical_address new_address = 0; | 393 | u32 new_table_length; |
279 | u32 new_table_length = 0; | ||
280 | u8 new_flags; | 394 | u8 new_flags; |
281 | char *override_type; | 395 | char *override_type; |
396 | struct acpi_table_desc new_table_desc; | ||
397 | |||
398 | ACPI_MEMSET(&new_table_desc, 0, sizeof(struct acpi_table_desc)); | ||
282 | 399 | ||
283 | /* (1) Attempt logical override (returns a logical address) */ | 400 | /* (1) Attempt logical override (returns a logical address) */ |
284 | 401 | ||
285 | status = acpi_os_table_override(table_header, &new_table); | 402 | status = acpi_os_table_override(table_header, &new_table_desc.pointer); |
286 | if (ACPI_SUCCESS(status) && new_table) { | 403 | if (ACPI_SUCCESS(status) && new_table_desc.pointer) { |
287 | new_address = ACPI_PTR_TO_PHYSADDR(new_table); | 404 | new_table_desc.address = |
288 | new_table_length = new_table->length; | 405 | ACPI_PTR_TO_PHYSADDR(new_table_desc.pointer); |
289 | new_flags = ACPI_TABLE_ORIGIN_OVERRIDE; | 406 | new_table_desc.length = new_table_desc.pointer->length; |
407 | new_table_desc.flags = ACPI_TABLE_ORIGIN_OVERRIDE; | ||
290 | override_type = "Logical"; | 408 | override_type = "Logical"; |
291 | goto finish_override; | 409 | goto finish_override; |
292 | } | 410 | } |
@@ -294,25 +412,12 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | |||
294 | /* (2) Attempt physical override (returns a physical address) */ | 412 | /* (2) Attempt physical override (returns a physical address) */ |
295 | 413 | ||
296 | status = acpi_os_physical_table_override(table_header, | 414 | status = acpi_os_physical_table_override(table_header, |
297 | &new_address, | 415 | &new_table_desc.address, |
298 | &new_table_length); | 416 | &new_table_desc.length); |
299 | if (ACPI_SUCCESS(status) && new_address && new_table_length) { | 417 | if (ACPI_SUCCESS(status) && new_table_desc.address |
300 | 418 | && new_table_desc.length) { | |
301 | /* Map the entire new table */ | ||
302 | |||
303 | new_table = acpi_os_map_memory(new_address, new_table_length); | ||
304 | if (!new_table) { | ||
305 | ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, | ||
306 | "%4.4s " ACPI_PRINTF_UINT | ||
307 | " Attempted physical table override failed", | ||
308 | table_header->signature, | ||
309 | ACPI_FORMAT_TO_UINT(table_desc-> | ||
310 | address))); | ||
311 | return (NULL); | ||
312 | } | ||
313 | |||
314 | override_type = "Physical"; | 419 | override_type = "Physical"; |
315 | new_flags = ACPI_TABLE_ORIGIN_MAPPED; | 420 | new_table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; |
316 | goto finish_override; | 421 | goto finish_override; |
317 | } | 422 | } |
318 | 423 | ||
@@ -320,22 +425,36 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | |||
320 | 425 | ||
321 | finish_override: | 426 | finish_override: |
322 | 427 | ||
428 | /* | ||
429 | * Acquire the entire new table to indicate overridden. | ||
430 | * Note that this is required by the callers of this function. | ||
431 | */ | ||
432 | status = acpi_tb_acquire_table(&new_table_desc, &new_table, | ||
433 | &new_table_length, &new_flags); | ||
434 | if (ACPI_FAILURE(status)) { | ||
435 | ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, | ||
436 | "%4.4s " ACPI_PRINTF_UINT | ||
437 | " Attempted table override failed", | ||
438 | table_header->signature, | ||
439 | ACPI_FORMAT_TO_UINT(table_desc->address))); | ||
440 | return (NULL); | ||
441 | } | ||
442 | |||
323 | ACPI_INFO((AE_INFO, "%4.4s " ACPI_PRINTF_UINT | 443 | ACPI_INFO((AE_INFO, "%4.4s " ACPI_PRINTF_UINT |
324 | " %s table override, new table: " ACPI_PRINTF_UINT, | 444 | " %s table override, new table: " ACPI_PRINTF_UINT, |
325 | table_header->signature, | 445 | table_header->signature, |
326 | ACPI_FORMAT_TO_UINT(table_desc->address), | 446 | ACPI_FORMAT_TO_UINT(table_desc->address), |
327 | override_type, ACPI_FORMAT_TO_UINT(new_table))); | 447 | override_type, ACPI_FORMAT_TO_UINT(new_table_desc.address))); |
328 | 448 | ||
329 | /* We can now unmap/delete the original table (if fully mapped) */ | 449 | /* We can now uninstall the original table (if fully mapped) */ |
330 | 450 | ||
331 | acpi_tb_delete_table(table_desc); | 451 | acpi_tb_uninstall_table(table_desc); |
332 | 452 | ||
333 | /* Setup descriptor for the new table */ | 453 | /* Install the new table */ |
334 | 454 | ||
335 | table_desc->address = new_address; | 455 | table_desc->address = new_table_desc.address; |
336 | table_desc->pointer = new_table; | 456 | table_desc->length = new_table_desc.length; |
337 | table_desc->length = new_table_length; | 457 | table_desc->flags = new_table_desc.flags; |
338 | table_desc->flags = new_flags; | ||
339 | 458 | ||
340 | return (new_table); | 459 | return (new_table); |
341 | } | 460 | } |
@@ -458,9 +577,9 @@ acpi_tb_store_table(acpi_physical_address address, | |||
458 | 577 | ||
459 | /******************************************************************************* | 578 | /******************************************************************************* |
460 | * | 579 | * |
461 | * FUNCTION: acpi_tb_delete_table | 580 | * FUNCTION: acpi_tb_uninstall_table |
462 | * | 581 | * |
463 | * PARAMETERS: table_index - Table index | 582 | * PARAMETERS: table_desc - Table descriptor |
464 | * | 583 | * |
465 | * RETURN: None | 584 | * RETURN: None |
466 | * | 585 | * |
@@ -468,35 +587,27 @@ acpi_tb_store_table(acpi_physical_address address, | |||
468 | * | 587 | * |
469 | ******************************************************************************/ | 588 | ******************************************************************************/ |
470 | 589 | ||
471 | void acpi_tb_delete_table(struct acpi_table_desc *table_desc) | 590 | void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc) |
472 | { | 591 | { |
473 | 592 | ||
474 | /* Table must be mapped or allocated */ | 593 | ACPI_FUNCTION_TRACE(tb_uninstall_table); |
475 | |||
476 | if (!table_desc->pointer) { | ||
477 | return; | ||
478 | } | ||
479 | |||
480 | switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { | ||
481 | case ACPI_TABLE_ORIGIN_MAPPED: | ||
482 | |||
483 | acpi_os_unmap_memory(table_desc->pointer, table_desc->length); | ||
484 | break; | ||
485 | |||
486 | case ACPI_TABLE_ORIGIN_ALLOCATED: | ||
487 | 594 | ||
488 | ACPI_FREE(table_desc->pointer); | 595 | /* Table must be installed */ |
489 | table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL); | ||
490 | break; | ||
491 | 596 | ||
492 | /* Not mapped or allocated, there is nothing we can do */ | 597 | if (!table_desc->address) { |
598 | return_VOID; | ||
599 | } | ||
493 | 600 | ||
494 | default: | 601 | acpi_tb_invalidate_table(table_desc); |
495 | 602 | ||
496 | return; | 603 | if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) == |
604 | ACPI_TABLE_ORIGIN_ALLOCATED) { | ||
605 | ACPI_FREE(ACPI_CAST_PTR(void, table_desc->address)); | ||
497 | } | 606 | } |
498 | 607 | ||
499 | table_desc->pointer = NULL; | 608 | table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL); |
609 | |||
610 | return_VOID; | ||
500 | } | 611 | } |
501 | 612 | ||
502 | /******************************************************************************* | 613 | /******************************************************************************* |
@@ -522,7 +633,7 @@ void acpi_tb_terminate(void) | |||
522 | /* Delete the individual tables */ | 633 | /* Delete the individual tables */ |
523 | 634 | ||
524 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) { | 635 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) { |
525 | acpi_tb_delete_table(&acpi_gbl_root_table_list.tables[i]); | 636 | acpi_tb_uninstall_table(&acpi_gbl_root_table_list.tables[i]); |
526 | } | 637 | } |
527 | 638 | ||
528 | /* | 639 | /* |
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 9b6992d8578f..c61432fa4332 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
@@ -178,7 +178,7 @@ struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | ACPI_MEMCPY(new_table, table_desc->pointer, table_desc->length); | 180 | ACPI_MEMCPY(new_table, table_desc->pointer, table_desc->length); |
181 | acpi_tb_delete_table(table_desc); | 181 | acpi_tb_uninstall_table(table_desc); |
182 | table_desc->address = ACPI_PTR_TO_PHYSADDR(new_table); | 182 | table_desc->address = ACPI_PTR_TO_PHYSADDR(new_table); |
183 | table_desc->pointer = new_table; | 183 | table_desc->pointer = new_table; |
184 | table_desc->flags = ACPI_TABLE_ORIGIN_ALLOCATED; | 184 | table_desc->flags = ACPI_TABLE_ORIGIN_ALLOCATED; |
@@ -268,7 +268,7 @@ acpi_tb_install_table(acpi_physical_address address, | |||
268 | * fully mapped later (in verify table). In any case, we must | 268 | * fully mapped later (in verify table). In any case, we must |
269 | * unmap the header that was mapped above. | 269 | * unmap the header that was mapped above. |
270 | */ | 270 | */ |
271 | final_table = acpi_tb_table_override(table, table_desc); | 271 | final_table = acpi_tb_override_table(table, table_desc); |
272 | if (!final_table) { | 272 | if (!final_table) { |
273 | final_table = table; /* There was no override */ | 273 | final_table = table; /* There was no override */ |
274 | } | 274 | } |
@@ -290,7 +290,12 @@ acpi_tb_install_table(acpi_physical_address address, | |||
290 | * flag set and will not be deleted below. | 290 | * flag set and will not be deleted below. |
291 | */ | 291 | */ |
292 | if (final_table != table) { | 292 | if (final_table != table) { |
293 | acpi_tb_delete_table(table_desc); | 293 | /* |
294 | * Table is in "INSTALLED" state, the final_table pointer is not | ||
295 | * maintained in the root table list. | ||
296 | */ | ||
297 | acpi_tb_release_table(final_table, table_desc->length, | ||
298 | table_desc->flags); | ||
294 | } | 299 | } |
295 | 300 | ||
296 | unmap_and_exit: | 301 | unmap_and_exit: |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index 4debc1290d0a..ae3fe4d41137 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
@@ -346,7 +346,7 @@ acpi_get_table_with_size(char *signature, | |||
346 | } | 346 | } |
347 | 347 | ||
348 | status = | 348 | status = |
349 | acpi_tb_verify_table(&acpi_gbl_root_table_list.tables[i]); | 349 | acpi_tb_validate_table(&acpi_gbl_root_table_list.tables[i]); |
350 | if (ACPI_SUCCESS(status)) { | 350 | if (ACPI_SUCCESS(status)) { |
351 | *out_table = acpi_gbl_root_table_list.tables[i].pointer; | 351 | *out_table = acpi_gbl_root_table_list.tables[i].pointer; |
352 | *tbl_size = acpi_gbl_root_table_list.tables[i].length; | 352 | *tbl_size = acpi_gbl_root_table_list.tables[i].length; |
@@ -416,8 +416,8 @@ acpi_get_table_by_index(u32 table_index, struct acpi_table_header ** table) | |||
416 | /* Table is not mapped, map it */ | 416 | /* Table is not mapped, map it */ |
417 | 417 | ||
418 | status = | 418 | status = |
419 | acpi_tb_verify_table(&acpi_gbl_root_table_list. | 419 | acpi_tb_validate_table(&acpi_gbl_root_table_list. |
420 | tables[table_index]); | 420 | tables[table_index]); |
421 | if (ACPI_FAILURE(status)) { | 421 | if (ACPI_FAILURE(status)) { |
422 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | 422 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
423 | return_ACPI_STATUS(status); | 423 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index 0909420fc776..a2899b0cab23 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c | |||
@@ -117,7 +117,7 @@ static acpi_status acpi_tb_load_namespace(void) | |||
117 | tables[ACPI_TABLE_INDEX_DSDT].signature), | 117 | tables[ACPI_TABLE_INDEX_DSDT].signature), |
118 | ACPI_SIG_DSDT) | 118 | ACPI_SIG_DSDT) |
119 | || | 119 | || |
120 | ACPI_FAILURE(acpi_tb_verify_table | 120 | ACPI_FAILURE(acpi_tb_validate_table |
121 | (&acpi_gbl_root_table_list. | 121 | (&acpi_gbl_root_table_list. |
122 | tables[ACPI_TABLE_INDEX_DSDT]))) { | 122 | tables[ACPI_TABLE_INDEX_DSDT]))) { |
123 | status = AE_NO_ACPI_TABLES; | 123 | status = AE_NO_ACPI_TABLES; |
@@ -128,7 +128,7 @@ static acpi_status acpi_tb_load_namespace(void) | |||
128 | * Save the DSDT pointer for simple access. This is the mapped memory | 128 | * Save the DSDT pointer for simple access. This is the mapped memory |
129 | * address. We must take care here because the address of the .Tables | 129 | * address. We must take care here because the address of the .Tables |
130 | * array can change dynamically as tables are loaded at run-time. Note: | 130 | * array can change dynamically as tables are loaded at run-time. Note: |
131 | * .Pointer field is not validated until after call to acpi_tb_verify_table. | 131 | * .Pointer field is not validated until after call to acpi_tb_validate_table. |
132 | */ | 132 | */ |
133 | acpi_gbl_DSDT = | 133 | acpi_gbl_DSDT = |
134 | acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer; | 134 | acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer; |
@@ -174,7 +174,7 @@ static acpi_status acpi_tb_load_namespace(void) | |||
174 | (acpi_gbl_root_table_list.tables[i]. | 174 | (acpi_gbl_root_table_list.tables[i]. |
175 | signature), ACPI_SIG_PSDT)) | 175 | signature), ACPI_SIG_PSDT)) |
176 | || | 176 | || |
177 | ACPI_FAILURE(acpi_tb_verify_table | 177 | ACPI_FAILURE(acpi_tb_validate_table |
178 | (&acpi_gbl_root_table_list.tables[i]))) { | 178 | (&acpi_gbl_root_table_list.tables[i]))) { |
179 | continue; | 179 | continue; |
180 | } | 180 | } |