diff options
author | Bob Moore <robert.moore@intel.com> | 2014-04-04 00:39:34 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-20 16:59:39 -0400 |
commit | c418ce19030f8cd9304b4e97c8e0dd580a81ace5 (patch) | |
tree | 9e207efd52fa276a4dac66268f380d2b7047522a /drivers | |
parent | ed6f1d44dae8a4eec42a74acae95cc177ee2e1ad (diff) |
ACPICA: Table Manager: Split tbinstal.c into two files.
New file is tbdata.c -- management functions for ACPICA table
manager data structures.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/acpica/Makefile | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/actables.h | 29 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbdata.c | 723 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbinstal.c | 738 |
4 files changed, 771 insertions, 720 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index b7ed86a20427..8bb43f06e11f 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -135,6 +135,7 @@ acpi-y += \ | |||
135 | rsxface.o | 135 | rsxface.o |
136 | 136 | ||
137 | acpi-y += \ | 137 | acpi-y += \ |
138 | tbdata.o \ | ||
138 | tbfadt.o \ | 139 | tbfadt.o \ |
139 | tbfind.o \ | 140 | tbfind.o \ |
140 | tbinstal.o \ | 141 | tbinstal.o \ |
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index ade430c6004f..bda9a7eb50c1 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h | |||
@@ -54,6 +54,26 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp); | |||
54 | u8 *acpi_tb_scan_memory_for_rsdp(u8 *start_address, u32 length); | 54 | u8 *acpi_tb_scan_memory_for_rsdp(u8 *start_address, u32 length); |
55 | 55 | ||
56 | /* | 56 | /* |
57 | * tbdata - table data structure management | ||
58 | */ | ||
59 | acpi_status acpi_tb_get_next_root_index(u32 *table_index); | ||
60 | |||
61 | void | ||
62 | acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc, | ||
63 | acpi_physical_address address, | ||
64 | u8 flags, struct acpi_table_header *table); | ||
65 | |||
66 | acpi_status | ||
67 | acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc, | ||
68 | acpi_physical_address address, u8 flags); | ||
69 | |||
70 | void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc); | ||
71 | |||
72 | u8 acpi_tb_is_table_loaded(u32 table_index); | ||
73 | |||
74 | void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded); | ||
75 | |||
76 | /* | ||
57 | * tbfadt - FADT parse/convert/validate | 77 | * tbfadt - FADT parse/convert/validate |
58 | */ | 78 | */ |
59 | void acpi_tb_parse_fadt(u32 table_index); | 79 | void acpi_tb_parse_fadt(u32 table_index); |
@@ -112,10 +132,6 @@ acpi_status acpi_tb_release_owner_id(u32 table_index); | |||
112 | 132 | ||
113 | acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id); | 133 | acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id); |
114 | 134 | ||
115 | u8 acpi_tb_is_table_loaded(u32 table_index); | ||
116 | |||
117 | void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded); | ||
118 | |||
119 | /* | 135 | /* |
120 | * tbutils - table manager utilities | 136 | * tbutils - table manager utilities |
121 | */ | 137 | */ |
@@ -137,11 +153,6 @@ void acpi_tb_check_dsdt_header(void); | |||
137 | struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index); | 153 | struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index); |
138 | 154 | ||
139 | void | 155 | void |
140 | acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc, | ||
141 | acpi_physical_address address, | ||
142 | u8 flags, struct acpi_table_header *table); | ||
143 | |||
144 | void | ||
145 | acpi_tb_install_table_with_override(u32 table_index, | 156 | acpi_tb_install_table_with_override(u32 table_index, |
146 | struct acpi_table_desc *new_table_desc, | 157 | struct acpi_table_desc *new_table_desc, |
147 | u8 override); | 158 | u8 override); |
diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c new file mode 100644 index 000000000000..cbe29944dc97 --- /dev/null +++ b/drivers/acpi/acpica/tbdata.c | |||
@@ -0,0 +1,723 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: tbdata - Table manager data structure functions | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2014, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | #include "actables.h" | ||
48 | |||
49 | #define _COMPONENT ACPI_TABLES | ||
50 | ACPI_MODULE_NAME("tbdata") | ||
51 | |||
52 | /******************************************************************************* | ||
53 | * | ||
54 | * FUNCTION: acpi_tb_init_table_descriptor | ||
55 | * | ||
56 | * PARAMETERS: table_desc - Table descriptor | ||
57 | * address - Physical address of the table | ||
58 | * flags - Allocation flags of the table | ||
59 | * table - Pointer to the table | ||
60 | * | ||
61 | * RETURN: None | ||
62 | * | ||
63 | * DESCRIPTION: Initialize a new table descriptor | ||
64 | * | ||
65 | ******************************************************************************/ | ||
66 | void | ||
67 | acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc, | ||
68 | acpi_physical_address address, | ||
69 | u8 flags, struct acpi_table_header *table) | ||
70 | { | ||
71 | |||
72 | /* | ||
73 | * Initialize the table descriptor. Set the pointer to NULL, since the | ||
74 | * table is not fully mapped at this time. | ||
75 | */ | ||
76 | ACPI_MEMSET(table_desc, 0, sizeof(struct acpi_table_desc)); | ||
77 | table_desc->address = address; | ||
78 | table_desc->length = table->length; | ||
79 | table_desc->flags = flags; | ||
80 | ACPI_MOVE_32_TO_32(table_desc->signature.ascii, table->signature); | ||
81 | } | ||
82 | |||
83 | /******************************************************************************* | ||
84 | * | ||
85 | * FUNCTION: acpi_tb_acquire_table | ||
86 | * | ||
87 | * PARAMETERS: table_desc - Table descriptor | ||
88 | * table_ptr - Where table is returned | ||
89 | * table_length - Where table length is returned | ||
90 | * table_flags - Where table allocation flags are returned | ||
91 | * | ||
92 | * RETURN: Status | ||
93 | * | ||
94 | * DESCRIPTION: Acquire an ACPI table. It can be used for tables not | ||
95 | * maintained in the acpi_gbl_root_table_list. | ||
96 | * | ||
97 | ******************************************************************************/ | ||
98 | |||
99 | acpi_status | ||
100 | acpi_tb_acquire_table(struct acpi_table_desc *table_desc, | ||
101 | struct acpi_table_header **table_ptr, | ||
102 | u32 *table_length, u8 *table_flags) | ||
103 | { | ||
104 | struct acpi_table_header *table = NULL; | ||
105 | |||
106 | switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { | ||
107 | case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: | ||
108 | |||
109 | table = | ||
110 | acpi_os_map_memory(table_desc->address, table_desc->length); | ||
111 | break; | ||
112 | |||
113 | case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: | ||
114 | case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: | ||
115 | |||
116 | table = | ||
117 | ACPI_CAST_PTR(struct acpi_table_header, | ||
118 | table_desc->address); | ||
119 | break; | ||
120 | |||
121 | default: | ||
122 | |||
123 | break; | ||
124 | } | ||
125 | |||
126 | /* Table is not valid yet */ | ||
127 | |||
128 | if (!table) { | ||
129 | return (AE_NO_MEMORY); | ||
130 | } | ||
131 | |||
132 | /* Fill the return values */ | ||
133 | |||
134 | *table_ptr = table; | ||
135 | *table_length = table_desc->length; | ||
136 | *table_flags = table_desc->flags; | ||
137 | return (AE_OK); | ||
138 | } | ||
139 | |||
140 | /******************************************************************************* | ||
141 | * | ||
142 | * FUNCTION: acpi_tb_release_table | ||
143 | * | ||
144 | * PARAMETERS: table - Pointer for the table | ||
145 | * table_length - Length for the table | ||
146 | * table_flags - Allocation flags for the table | ||
147 | * | ||
148 | * RETURN: None | ||
149 | * | ||
150 | * DESCRIPTION: Release a table. The inverse of acpi_tb_acquire_table(). | ||
151 | * | ||
152 | ******************************************************************************/ | ||
153 | |||
154 | void | ||
155 | acpi_tb_release_table(struct acpi_table_header *table, | ||
156 | u32 table_length, u8 table_flags) | ||
157 | { | ||
158 | |||
159 | switch (table_flags & ACPI_TABLE_ORIGIN_MASK) { | ||
160 | case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: | ||
161 | |||
162 | acpi_os_unmap_memory(table, table_length); | ||
163 | break; | ||
164 | |||
165 | case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: | ||
166 | case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: | ||
167 | default: | ||
168 | |||
169 | break; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | /******************************************************************************* | ||
174 | * | ||
175 | * FUNCTION: acpi_tb_acquire_temp_table | ||
176 | * | ||
177 | * PARAMETERS: table_desc - Table descriptor to be acquired | ||
178 | * address - Address of the table | ||
179 | * flags - Allocation flags of the table | ||
180 | * | ||
181 | * RETURN: Status | ||
182 | * | ||
183 | * DESCRIPTION: This function validates the table header to obtain the length | ||
184 | * of a table and fills the table descriptor to make its state as | ||
185 | * "INSTALLED". Such a table descriptor is only used for verified | ||
186 | * installation. | ||
187 | * | ||
188 | ******************************************************************************/ | ||
189 | |||
190 | acpi_status | ||
191 | acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc, | ||
192 | acpi_physical_address address, u8 flags) | ||
193 | { | ||
194 | struct acpi_table_header *table_header; | ||
195 | |||
196 | switch (flags & ACPI_TABLE_ORIGIN_MASK) { | ||
197 | case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: | ||
198 | |||
199 | /* Get the length of the full table from the header */ | ||
200 | |||
201 | table_header = | ||
202 | acpi_os_map_memory(address, | ||
203 | sizeof(struct acpi_table_header)); | ||
204 | if (!table_header) { | ||
205 | return (AE_NO_MEMORY); | ||
206 | } | ||
207 | |||
208 | acpi_tb_init_table_descriptor(table_desc, address, flags, | ||
209 | table_header); | ||
210 | acpi_os_unmap_memory(table_header, | ||
211 | sizeof(struct acpi_table_header)); | ||
212 | return (AE_OK); | ||
213 | |||
214 | case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: | ||
215 | case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: | ||
216 | |||
217 | table_header = ACPI_CAST_PTR(struct acpi_table_header, address); | ||
218 | if (!table_header) { | ||
219 | return (AE_NO_MEMORY); | ||
220 | } | ||
221 | |||
222 | acpi_tb_init_table_descriptor(table_desc, address, flags, | ||
223 | table_header); | ||
224 | return (AE_OK); | ||
225 | |||
226 | default: | ||
227 | |||
228 | break; | ||
229 | } | ||
230 | |||
231 | /* Table is not valid yet */ | ||
232 | |||
233 | return (AE_NO_MEMORY); | ||
234 | } | ||
235 | |||
236 | /******************************************************************************* | ||
237 | * | ||
238 | * FUNCTION: acpi_tb_release_temp_table | ||
239 | * | ||
240 | * PARAMETERS: table_desc - Table descriptor to be released | ||
241 | * | ||
242 | * RETURN: Status | ||
243 | * | ||
244 | * DESCRIPTION: The inverse of acpi_tb_acquire_temp_table(). | ||
245 | * | ||
246 | *****************************************************************************/ | ||
247 | |||
248 | void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc) | ||
249 | { | ||
250 | |||
251 | /* | ||
252 | * Note that the .Address is maintained by the callers of | ||
253 | * acpi_tb_acquire_temp_table(), thus do not invoke acpi_tb_uninstall_table() | ||
254 | * where .Address will be freed. | ||
255 | */ | ||
256 | acpi_tb_invalidate_table(table_desc); | ||
257 | } | ||
258 | |||
259 | /****************************************************************************** | ||
260 | * | ||
261 | * FUNCTION: acpi_tb_validate_table | ||
262 | * | ||
263 | * PARAMETERS: table_desc - Table descriptor | ||
264 | * | ||
265 | * RETURN: Status | ||
266 | * | ||
267 | * DESCRIPTION: This function is called to validate the table, the returned | ||
268 | * table descriptor is in "VALIDATED" state. | ||
269 | * | ||
270 | *****************************************************************************/ | ||
271 | |||
272 | acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc) | ||
273 | { | ||
274 | acpi_status status = AE_OK; | ||
275 | |||
276 | ACPI_FUNCTION_TRACE(tb_validate_table); | ||
277 | |||
278 | /* Validate the table if necessary */ | ||
279 | |||
280 | if (!table_desc->pointer) { | ||
281 | status = acpi_tb_acquire_table(table_desc, &table_desc->pointer, | ||
282 | &table_desc->length, | ||
283 | &table_desc->flags); | ||
284 | if (!table_desc->pointer) { | ||
285 | status = AE_NO_MEMORY; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | |||
292 | /******************************************************************************* | ||
293 | * | ||
294 | * FUNCTION: acpi_tb_invalidate_table | ||
295 | * | ||
296 | * PARAMETERS: table_desc - Table descriptor | ||
297 | * | ||
298 | * RETURN: None | ||
299 | * | ||
300 | * DESCRIPTION: Invalidate one internal ACPI table, this is the inverse of | ||
301 | * acpi_tb_validate_table(). | ||
302 | * | ||
303 | ******************************************************************************/ | ||
304 | |||
305 | void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc) | ||
306 | { | ||
307 | |||
308 | ACPI_FUNCTION_TRACE(tb_invalidate_table); | ||
309 | |||
310 | /* Table must be validated */ | ||
311 | |||
312 | if (!table_desc->pointer) { | ||
313 | return_VOID; | ||
314 | } | ||
315 | |||
316 | acpi_tb_release_table(table_desc->pointer, table_desc->length, | ||
317 | table_desc->flags); | ||
318 | table_desc->pointer = NULL; | ||
319 | |||
320 | return_VOID; | ||
321 | } | ||
322 | |||
323 | /****************************************************************************** | ||
324 | * | ||
325 | * FUNCTION: acpi_tb_verify_table | ||
326 | * | ||
327 | * PARAMETERS: table_desc - Table descriptor | ||
328 | * signature - Table signature to verify | ||
329 | * | ||
330 | * RETURN: Status | ||
331 | * | ||
332 | * DESCRIPTION: This function is called to validate and verify the table, the | ||
333 | * returned table descriptor is in "VALIDATED" state. | ||
334 | * | ||
335 | *****************************************************************************/ | ||
336 | |||
337 | acpi_status | ||
338 | acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature) | ||
339 | { | ||
340 | acpi_status status = AE_OK; | ||
341 | |||
342 | ACPI_FUNCTION_TRACE(tb_verify_table); | ||
343 | |||
344 | /* Validate the table */ | ||
345 | |||
346 | status = acpi_tb_validate_table(table_desc); | ||
347 | if (ACPI_FAILURE(status)) { | ||
348 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
349 | } | ||
350 | |||
351 | /* If a particular signature is expected (DSDT/FACS), it must match */ | ||
352 | |||
353 | if (signature && !ACPI_COMPARE_NAME(&table_desc->signature, signature)) { | ||
354 | ACPI_BIOS_ERROR((AE_INFO, | ||
355 | "Invalid signature 0x%X for ACPI table, expected [%s]", | ||
356 | table_desc->signature.integer, signature)); | ||
357 | status = AE_BAD_SIGNATURE; | ||
358 | goto invalidate_and_exit; | ||
359 | } | ||
360 | |||
361 | /* Verify the checksum */ | ||
362 | |||
363 | status = | ||
364 | acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); | ||
365 | if (ACPI_FAILURE(status)) { | ||
366 | ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, | ||
367 | "%4.4s " ACPI_PRINTF_UINT | ||
368 | " Attempted table install failed", | ||
369 | acpi_ut_valid_acpi_name(table_desc->signature. | ||
370 | ascii) ? table_desc-> | ||
371 | signature.ascii : "????", | ||
372 | ACPI_FORMAT_TO_UINT(table_desc->address))); | ||
373 | goto invalidate_and_exit; | ||
374 | } | ||
375 | |||
376 | return_ACPI_STATUS(AE_OK); | ||
377 | |||
378 | invalidate_and_exit: | ||
379 | acpi_tb_invalidate_table(table_desc); | ||
380 | return_ACPI_STATUS(status); | ||
381 | } | ||
382 | |||
383 | /******************************************************************************* | ||
384 | * | ||
385 | * FUNCTION: acpi_tb_resize_root_table_list | ||
386 | * | ||
387 | * PARAMETERS: None | ||
388 | * | ||
389 | * RETURN: Status | ||
390 | * | ||
391 | * DESCRIPTION: Expand the size of global table array | ||
392 | * | ||
393 | ******************************************************************************/ | ||
394 | |||
395 | acpi_status acpi_tb_resize_root_table_list(void) | ||
396 | { | ||
397 | struct acpi_table_desc *tables; | ||
398 | u32 table_count; | ||
399 | |||
400 | ACPI_FUNCTION_TRACE(tb_resize_root_table_list); | ||
401 | |||
402 | /* allow_resize flag is a parameter to acpi_initialize_tables */ | ||
403 | |||
404 | if (!(acpi_gbl_root_table_list.flags & ACPI_ROOT_ALLOW_RESIZE)) { | ||
405 | ACPI_ERROR((AE_INFO, | ||
406 | "Resize of Root Table Array is not allowed")); | ||
407 | return_ACPI_STATUS(AE_SUPPORT); | ||
408 | } | ||
409 | |||
410 | /* Increase the Table Array size */ | ||
411 | |||
412 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | ||
413 | table_count = acpi_gbl_root_table_list.max_table_count; | ||
414 | } else { | ||
415 | table_count = acpi_gbl_root_table_list.current_table_count; | ||
416 | } | ||
417 | |||
418 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count + | ||
419 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * | ||
420 | sizeof(struct acpi_table_desc)); | ||
421 | if (!tables) { | ||
422 | ACPI_ERROR((AE_INFO, | ||
423 | "Could not allocate new root table array")); | ||
424 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
425 | } | ||
426 | |||
427 | /* Copy and free the previous table array */ | ||
428 | |||
429 | if (acpi_gbl_root_table_list.tables) { | ||
430 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, | ||
431 | (acpi_size) table_count * | ||
432 | sizeof(struct acpi_table_desc)); | ||
433 | |||
434 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | ||
435 | ACPI_FREE(acpi_gbl_root_table_list.tables); | ||
436 | } | ||
437 | } | ||
438 | |||
439 | acpi_gbl_root_table_list.tables = tables; | ||
440 | acpi_gbl_root_table_list.max_table_count = | ||
441 | table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT; | ||
442 | acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED; | ||
443 | |||
444 | return_ACPI_STATUS(AE_OK); | ||
445 | } | ||
446 | |||
447 | /******************************************************************************* | ||
448 | * | ||
449 | * FUNCTION: acpi_tb_get_next_root_index | ||
450 | * | ||
451 | * PARAMETERS: table_index - Where table index is returned | ||
452 | * | ||
453 | * RETURN: Status and table index. | ||
454 | * | ||
455 | * DESCRIPTION: Allocate a new ACPI table entry to the global table list | ||
456 | * | ||
457 | ******************************************************************************/ | ||
458 | |||
459 | acpi_status acpi_tb_get_next_root_index(u32 *table_index) | ||
460 | { | ||
461 | acpi_status status; | ||
462 | |||
463 | /* Ensure that there is room for the table in the Root Table List */ | ||
464 | |||
465 | if (acpi_gbl_root_table_list.current_table_count >= | ||
466 | acpi_gbl_root_table_list.max_table_count) { | ||
467 | status = acpi_tb_resize_root_table_list(); | ||
468 | if (ACPI_FAILURE(status)) { | ||
469 | return (status); | ||
470 | } | ||
471 | } | ||
472 | |||
473 | *table_index = acpi_gbl_root_table_list.current_table_count; | ||
474 | acpi_gbl_root_table_list.current_table_count++; | ||
475 | return (AE_OK); | ||
476 | } | ||
477 | |||
478 | /******************************************************************************* | ||
479 | * | ||
480 | * FUNCTION: acpi_tb_terminate | ||
481 | * | ||
482 | * PARAMETERS: None | ||
483 | * | ||
484 | * RETURN: None | ||
485 | * | ||
486 | * DESCRIPTION: Delete all internal ACPI tables | ||
487 | * | ||
488 | ******************************************************************************/ | ||
489 | |||
490 | void acpi_tb_terminate(void) | ||
491 | { | ||
492 | u32 i; | ||
493 | |||
494 | ACPI_FUNCTION_TRACE(tb_terminate); | ||
495 | |||
496 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
497 | |||
498 | /* Delete the individual tables */ | ||
499 | |||
500 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) { | ||
501 | acpi_tb_uninstall_table(&acpi_gbl_root_table_list.tables[i]); | ||
502 | } | ||
503 | |||
504 | /* | ||
505 | * Delete the root table array if allocated locally. Array cannot be | ||
506 | * mapped, so we don't need to check for that flag. | ||
507 | */ | ||
508 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | ||
509 | ACPI_FREE(acpi_gbl_root_table_list.tables); | ||
510 | } | ||
511 | |||
512 | acpi_gbl_root_table_list.tables = NULL; | ||
513 | acpi_gbl_root_table_list.flags = 0; | ||
514 | acpi_gbl_root_table_list.current_table_count = 0; | ||
515 | |||
516 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n")); | ||
517 | |||
518 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
519 | return_VOID; | ||
520 | } | ||
521 | |||
522 | /******************************************************************************* | ||
523 | * | ||
524 | * FUNCTION: acpi_tb_delete_namespace_by_owner | ||
525 | * | ||
526 | * PARAMETERS: table_index - Table index | ||
527 | * | ||
528 | * RETURN: Status | ||
529 | * | ||
530 | * DESCRIPTION: Delete all namespace objects created when this table was loaded. | ||
531 | * | ||
532 | ******************************************************************************/ | ||
533 | |||
534 | acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index) | ||
535 | { | ||
536 | acpi_owner_id owner_id; | ||
537 | acpi_status status; | ||
538 | |||
539 | ACPI_FUNCTION_TRACE(tb_delete_namespace_by_owner); | ||
540 | |||
541 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
542 | if (ACPI_FAILURE(status)) { | ||
543 | return_ACPI_STATUS(status); | ||
544 | } | ||
545 | |||
546 | if (table_index >= acpi_gbl_root_table_list.current_table_count) { | ||
547 | |||
548 | /* The table index does not exist */ | ||
549 | |||
550 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
551 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
552 | } | ||
553 | |||
554 | /* Get the owner ID for this table, used to delete namespace nodes */ | ||
555 | |||
556 | owner_id = acpi_gbl_root_table_list.tables[table_index].owner_id; | ||
557 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
558 | |||
559 | /* | ||
560 | * Need to acquire the namespace writer lock to prevent interference | ||
561 | * with any concurrent namespace walks. The interpreter must be | ||
562 | * released during the deletion since the acquisition of the deletion | ||
563 | * lock may block, and also since the execution of a namespace walk | ||
564 | * must be allowed to use the interpreter. | ||
565 | */ | ||
566 | (void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); | ||
567 | status = acpi_ut_acquire_write_lock(&acpi_gbl_namespace_rw_lock); | ||
568 | |||
569 | acpi_ns_delete_namespace_by_owner(owner_id); | ||
570 | if (ACPI_FAILURE(status)) { | ||
571 | return_ACPI_STATUS(status); | ||
572 | } | ||
573 | |||
574 | acpi_ut_release_write_lock(&acpi_gbl_namespace_rw_lock); | ||
575 | |||
576 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); | ||
577 | return_ACPI_STATUS(status); | ||
578 | } | ||
579 | |||
580 | /******************************************************************************* | ||
581 | * | ||
582 | * FUNCTION: acpi_tb_allocate_owner_id | ||
583 | * | ||
584 | * PARAMETERS: table_index - Table index | ||
585 | * | ||
586 | * RETURN: Status | ||
587 | * | ||
588 | * DESCRIPTION: Allocates owner_id in table_desc | ||
589 | * | ||
590 | ******************************************************************************/ | ||
591 | |||
592 | acpi_status acpi_tb_allocate_owner_id(u32 table_index) | ||
593 | { | ||
594 | acpi_status status = AE_BAD_PARAMETER; | ||
595 | |||
596 | ACPI_FUNCTION_TRACE(tb_allocate_owner_id); | ||
597 | |||
598 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
599 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
600 | status = | ||
601 | acpi_ut_allocate_owner_id(& | ||
602 | (acpi_gbl_root_table_list. | ||
603 | tables[table_index].owner_id)); | ||
604 | } | ||
605 | |||
606 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
607 | return_ACPI_STATUS(status); | ||
608 | } | ||
609 | |||
610 | /******************************************************************************* | ||
611 | * | ||
612 | * FUNCTION: acpi_tb_release_owner_id | ||
613 | * | ||
614 | * PARAMETERS: table_index - Table index | ||
615 | * | ||
616 | * RETURN: Status | ||
617 | * | ||
618 | * DESCRIPTION: Releases owner_id in table_desc | ||
619 | * | ||
620 | ******************************************************************************/ | ||
621 | |||
622 | acpi_status acpi_tb_release_owner_id(u32 table_index) | ||
623 | { | ||
624 | acpi_status status = AE_BAD_PARAMETER; | ||
625 | |||
626 | ACPI_FUNCTION_TRACE(tb_release_owner_id); | ||
627 | |||
628 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
629 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
630 | acpi_ut_release_owner_id(& | ||
631 | (acpi_gbl_root_table_list. | ||
632 | tables[table_index].owner_id)); | ||
633 | status = AE_OK; | ||
634 | } | ||
635 | |||
636 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
637 | return_ACPI_STATUS(status); | ||
638 | } | ||
639 | |||
640 | /******************************************************************************* | ||
641 | * | ||
642 | * FUNCTION: acpi_tb_get_owner_id | ||
643 | * | ||
644 | * PARAMETERS: table_index - Table index | ||
645 | * owner_id - Where the table owner_id is returned | ||
646 | * | ||
647 | * RETURN: Status | ||
648 | * | ||
649 | * DESCRIPTION: returns owner_id for the ACPI table | ||
650 | * | ||
651 | ******************************************************************************/ | ||
652 | |||
653 | acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id * owner_id) | ||
654 | { | ||
655 | acpi_status status = AE_BAD_PARAMETER; | ||
656 | |||
657 | ACPI_FUNCTION_TRACE(tb_get_owner_id); | ||
658 | |||
659 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
660 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
661 | *owner_id = | ||
662 | acpi_gbl_root_table_list.tables[table_index].owner_id; | ||
663 | status = AE_OK; | ||
664 | } | ||
665 | |||
666 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
667 | return_ACPI_STATUS(status); | ||
668 | } | ||
669 | |||
670 | /******************************************************************************* | ||
671 | * | ||
672 | * FUNCTION: acpi_tb_is_table_loaded | ||
673 | * | ||
674 | * PARAMETERS: table_index - Index into the root table | ||
675 | * | ||
676 | * RETURN: Table Loaded Flag | ||
677 | * | ||
678 | ******************************************************************************/ | ||
679 | |||
680 | u8 acpi_tb_is_table_loaded(u32 table_index) | ||
681 | { | ||
682 | u8 is_loaded = FALSE; | ||
683 | |||
684 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
685 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
686 | is_loaded = (u8) | ||
687 | (acpi_gbl_root_table_list.tables[table_index].flags & | ||
688 | ACPI_TABLE_IS_LOADED); | ||
689 | } | ||
690 | |||
691 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
692 | return (is_loaded); | ||
693 | } | ||
694 | |||
695 | /******************************************************************************* | ||
696 | * | ||
697 | * FUNCTION: acpi_tb_set_table_loaded_flag | ||
698 | * | ||
699 | * PARAMETERS: table_index - Table index | ||
700 | * is_loaded - TRUE if table is loaded, FALSE otherwise | ||
701 | * | ||
702 | * RETURN: None | ||
703 | * | ||
704 | * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE. | ||
705 | * | ||
706 | ******************************************************************************/ | ||
707 | |||
708 | void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded) | ||
709 | { | ||
710 | |||
711 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
712 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
713 | if (is_loaded) { | ||
714 | acpi_gbl_root_table_list.tables[table_index].flags |= | ||
715 | ACPI_TABLE_IS_LOADED; | ||
716 | } else { | ||
717 | acpi_gbl_root_table_list.tables[table_index].flags &= | ||
718 | ~ACPI_TABLE_IS_LOADED; | ||
719 | } | ||
720 | } | ||
721 | |||
722 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
723 | } | ||
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 50a6f229633c..d4d6029fef44 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -43,355 +43,57 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | ||
47 | #include "actables.h" | 46 | #include "actables.h" |
48 | 47 | ||
49 | #define _COMPONENT ACPI_TABLES | 48 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME("tbinstal") | 49 | ACPI_MODULE_NAME("tbinstal") |
51 | 50 | ||
52 | /* Local prototypes */ | 51 | /* Local prototypes */ |
53 | static acpi_status | ||
54 | acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc, | ||
55 | acpi_physical_address address, u8 flags); | ||
56 | |||
57 | static void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc); | ||
58 | |||
59 | static acpi_status acpi_tb_get_root_table_entry(u32 *table_index); | ||
60 | |||
61 | static u8 | 52 | static u8 |
62 | acpi_tb_is_equivalent_table(struct acpi_table_desc *table_desc, | 53 | acpi_tb_compare_tables(struct acpi_table_desc *table_desc, u32 table_index); |
63 | u32 table_index); | ||
64 | |||
65 | /******************************************************************************* | ||
66 | * | ||
67 | * FUNCTION: acpi_tb_acquire_table | ||
68 | * | ||
69 | * PARAMETERS: table_desc - Table descriptor | ||
70 | * table_ptr - Where table is returned | ||
71 | * table_length - Where table length is returned | ||
72 | * table_flags - Where table allocation flags are returned | ||
73 | * | ||
74 | * RETURN: Status | ||
75 | * | ||
76 | * DESCRIPTION: Acquire an ACPI table. It can be used for tables not | ||
77 | * maintained in the acpi_gbl_root_table_list. | ||
78 | * | ||
79 | ******************************************************************************/ | ||
80 | |||
81 | acpi_status | ||
82 | acpi_tb_acquire_table(struct acpi_table_desc *table_desc, | ||
83 | struct acpi_table_header **table_ptr, | ||
84 | u32 *table_length, u8 *table_flags) | ||
85 | { | ||
86 | struct acpi_table_header *table = NULL; | ||
87 | |||
88 | switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { | ||
89 | case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: | ||
90 | |||
91 | table = | ||
92 | acpi_os_map_memory(table_desc->address, table_desc->length); | ||
93 | break; | ||
94 | |||
95 | case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: | ||
96 | case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: | ||
97 | |||
98 | table = | ||
99 | ACPI_CAST_PTR(struct acpi_table_header, | ||
100 | table_desc->address); | ||
101 | break; | ||
102 | |||
103 | default: | ||
104 | |||
105 | break; | ||
106 | } | ||
107 | |||
108 | /* Table is not valid yet */ | ||
109 | |||
110 | if (!table) { | ||
111 | return (AE_NO_MEMORY); | ||
112 | } | ||
113 | |||
114 | /* Fill the return values */ | ||
115 | |||
116 | *table_ptr = table; | ||
117 | *table_length = table_desc->length; | ||
118 | *table_flags = table_desc->flags; | ||
119 | return (AE_OK); | ||
120 | } | ||
121 | |||
122 | /******************************************************************************* | ||
123 | * | ||
124 | * FUNCTION: acpi_tb_release_table | ||
125 | * | ||
126 | * PARAMETERS: table - Pointer for the table | ||
127 | * table_length - Length for the table | ||
128 | * table_flags - Allocation flags for the table | ||
129 | * | ||
130 | * RETURN: None | ||
131 | * | ||
132 | * DESCRIPTION: Release a table. The inverse of acpi_tb_acquire_table(). | ||
133 | * | ||
134 | ******************************************************************************/ | ||
135 | |||
136 | void | ||
137 | acpi_tb_release_table(struct acpi_table_header *table, | ||
138 | u32 table_length, u8 table_flags) | ||
139 | { | ||
140 | |||
141 | switch (table_flags & ACPI_TABLE_ORIGIN_MASK) { | ||
142 | case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: | ||
143 | |||
144 | acpi_os_unmap_memory(table, table_length); | ||
145 | break; | ||
146 | |||
147 | case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: | ||
148 | case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: | ||
149 | default: | ||
150 | |||
151 | break; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | /****************************************************************************** | ||
156 | * | ||
157 | * FUNCTION: acpi_tb_validate_table | ||
158 | * | ||
159 | * PARAMETERS: table_desc - Table descriptor | ||
160 | * | ||
161 | * RETURN: Status | ||
162 | * | ||
163 | * DESCRIPTION: This function is called to validate the table, the returned | ||
164 | * table descriptor is in "VALIDATED" state. | ||
165 | * | ||
166 | *****************************************************************************/ | ||
167 | |||
168 | acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc) | ||
169 | { | ||
170 | acpi_status status = AE_OK; | ||
171 | |||
172 | ACPI_FUNCTION_TRACE(tb_validate_table); | ||
173 | |||
174 | /* Validate the table if necessary */ | ||
175 | |||
176 | if (!table_desc->pointer) { | ||
177 | status = acpi_tb_acquire_table(table_desc, &table_desc->pointer, | ||
178 | &table_desc->length, | ||
179 | &table_desc->flags); | ||
180 | if (!table_desc->pointer) { | ||
181 | status = AE_NO_MEMORY; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | return_ACPI_STATUS(status); | ||
186 | } | ||
187 | 54 | ||
188 | /******************************************************************************* | 55 | /******************************************************************************* |
189 | * | 56 | * |
190 | * FUNCTION: acpi_tb_invalidate_table | 57 | * FUNCTION: acpi_tb_compare_tables |
191 | * | 58 | * |
192 | * PARAMETERS: table_desc - Table descriptor | 59 | * PARAMETERS: table_desc - Table 1 descriptor to be compared |
60 | * table_index - Index of table 2 to be compared | ||
193 | * | 61 | * |
194 | * RETURN: None | 62 | * RETURN: TRUE if both tables are identical. |
195 | * | 63 | * |
196 | * DESCRIPTION: Invalidate one internal ACPI table, this is the inverse of | 64 | * DESCRIPTION: This function compares a table with another table that has |
197 | * acpi_tb_validate_table(). | 65 | * already been installed in the root table list. |
198 | * | 66 | * |
199 | ******************************************************************************/ | 67 | ******************************************************************************/ |
200 | 68 | ||
201 | void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc) | 69 | static u8 |
202 | { | 70 | acpi_tb_compare_tables(struct acpi_table_desc *table_desc, u32 table_index) |
203 | |||
204 | ACPI_FUNCTION_TRACE(tb_invalidate_table); | ||
205 | |||
206 | /* Table must be validated */ | ||
207 | |||
208 | if (!table_desc->pointer) { | ||
209 | return_VOID; | ||
210 | } | ||
211 | |||
212 | acpi_tb_release_table(table_desc->pointer, table_desc->length, | ||
213 | table_desc->flags); | ||
214 | table_desc->pointer = NULL; | ||
215 | |||
216 | return_VOID; | ||
217 | } | ||
218 | |||
219 | /****************************************************************************** | ||
220 | * | ||
221 | * FUNCTION: acpi_tb_verify_table | ||
222 | * | ||
223 | * PARAMETERS: table_desc - Table descriptor | ||
224 | * signature - Table signature to verify | ||
225 | * | ||
226 | * RETURN: Status | ||
227 | * | ||
228 | * DESCRIPTION: This function is called to validate and verify the table, the | ||
229 | * returned table descriptor is in "VALIDATED" state. | ||
230 | * | ||
231 | *****************************************************************************/ | ||
232 | |||
233 | acpi_status | ||
234 | acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature) | ||
235 | { | 71 | { |
236 | acpi_status status = AE_OK; | 72 | acpi_status status = AE_OK; |
237 | 73 | u8 is_identical; | |
238 | ACPI_FUNCTION_TRACE(tb_verify_table); | 74 | struct acpi_table_header *table; |
239 | 75 | u32 table_length; | |
240 | /* Validate the table */ | 76 | u8 table_flags; |
241 | |||
242 | status = acpi_tb_validate_table(table_desc); | ||
243 | if (ACPI_FAILURE(status)) { | ||
244 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
245 | } | ||
246 | |||
247 | /* If a particular signature is expected (DSDT/FACS), it must match */ | ||
248 | |||
249 | if (signature && !ACPI_COMPARE_NAME(&table_desc->signature, signature)) { | ||
250 | ACPI_BIOS_ERROR((AE_INFO, | ||
251 | "Invalid signature 0x%X for ACPI table, expected [%s]", | ||
252 | table_desc->signature.integer, signature)); | ||
253 | status = AE_BAD_SIGNATURE; | ||
254 | goto invalidate_and_exit; | ||
255 | } | ||
256 | |||
257 | /* Verify the checksum */ | ||
258 | 77 | ||
259 | status = | 78 | status = |
260 | acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); | 79 | acpi_tb_acquire_table(&acpi_gbl_root_table_list.tables[table_index], |
80 | &table, &table_length, &table_flags); | ||
261 | if (ACPI_FAILURE(status)) { | 81 | if (ACPI_FAILURE(status)) { |
262 | ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, | 82 | return (FALSE); |
263 | "%4.4s " ACPI_PRINTF_UINT | ||
264 | " Attempted table install failed", | ||
265 | acpi_ut_valid_acpi_name(table_desc->signature. | ||
266 | ascii) ? table_desc-> | ||
267 | signature.ascii : "????", | ||
268 | ACPI_FORMAT_TO_UINT(table_desc->address))); | ||
269 | goto invalidate_and_exit; | ||
270 | } | 83 | } |
271 | 84 | ||
272 | return_ACPI_STATUS(AE_OK); | ||
273 | |||
274 | invalidate_and_exit: | ||
275 | acpi_tb_invalidate_table(table_desc); | ||
276 | return_ACPI_STATUS(status); | ||
277 | } | ||
278 | |||
279 | /******************************************************************************* | ||
280 | * | ||
281 | * FUNCTION: acpi_tb_init_table_descriptor | ||
282 | * | ||
283 | * PARAMETERS: table_desc - Table descriptor | ||
284 | * address - Physical address of the table | ||
285 | * flags - Allocation flags of the table | ||
286 | * table - Pointer to the table | ||
287 | * | ||
288 | * RETURN: None | ||
289 | * | ||
290 | * DESCRIPTION: Initialize a new table descriptor | ||
291 | * | ||
292 | ******************************************************************************/ | ||
293 | |||
294 | void | ||
295 | acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc, | ||
296 | acpi_physical_address address, | ||
297 | u8 flags, struct acpi_table_header *table) | ||
298 | { | ||
299 | |||
300 | /* | 85 | /* |
301 | * Initialize the table descriptor. Set the pointer to NULL, since the | 86 | * Check for a table match on the entire table length, |
302 | * table is not fully mapped at this time. | 87 | * not just the header. |
303 | */ | 88 | */ |
304 | ACPI_MEMSET(table_desc, 0, sizeof(struct acpi_table_desc)); | 89 | is_identical = (u8)((table_desc->length != table_length || |
305 | table_desc->address = address; | 90 | ACPI_MEMCMP(table_desc->pointer, table, |
306 | table_desc->length = table->length; | 91 | table_length)) ? FALSE : TRUE); |
307 | table_desc->flags = flags; | ||
308 | ACPI_MOVE_32_TO_32(table_desc->signature.ascii, table->signature); | ||
309 | } | ||
310 | |||
311 | /******************************************************************************* | ||
312 | * | ||
313 | * FUNCTION: acpi_tb_acquire_temp_table | ||
314 | * | ||
315 | * PARAMETERS: table_desc - Table descriptor to be acquired | ||
316 | * address - Address of the table | ||
317 | * flags - Allocation flags of the table | ||
318 | * | ||
319 | * RETURN: Status | ||
320 | * | ||
321 | * DESCRIPTION: This function validates the table header to obtain the length | ||
322 | * of a table and fills the table descriptor to make its state as | ||
323 | * "INSTALLED". Such a table descriptor is only used for verified | ||
324 | * installation. | ||
325 | * | ||
326 | ******************************************************************************/ | ||
327 | |||
328 | static acpi_status | ||
329 | acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc, | ||
330 | acpi_physical_address address, u8 flags) | ||
331 | { | ||
332 | struct acpi_table_header *table_header; | ||
333 | |||
334 | switch (flags & ACPI_TABLE_ORIGIN_MASK) { | ||
335 | case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: | ||
336 | |||
337 | /* Get the length of the full table from the header */ | ||
338 | |||
339 | table_header = | ||
340 | acpi_os_map_memory(address, | ||
341 | sizeof(struct acpi_table_header)); | ||
342 | if (!table_header) { | ||
343 | return (AE_NO_MEMORY); | ||
344 | } | ||
345 | |||
346 | acpi_tb_init_table_descriptor(table_desc, address, flags, | ||
347 | table_header); | ||
348 | acpi_os_unmap_memory(table_header, | ||
349 | sizeof(struct acpi_table_header)); | ||
350 | return (AE_OK); | ||
351 | |||
352 | case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: | ||
353 | case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: | ||
354 | 92 | ||
355 | table_header = ACPI_CAST_PTR(struct acpi_table_header, address); | 93 | /* Release the acquired table */ |
356 | if (!table_header) { | ||
357 | return (AE_NO_MEMORY); | ||
358 | } | ||
359 | |||
360 | acpi_tb_init_table_descriptor(table_desc, address, flags, | ||
361 | table_header); | ||
362 | return (AE_OK); | ||
363 | |||
364 | default: | ||
365 | |||
366 | break; | ||
367 | } | ||
368 | |||
369 | /* Table is not valid yet */ | ||
370 | |||
371 | return (AE_NO_MEMORY); | ||
372 | } | ||
373 | |||
374 | /******************************************************************************* | ||
375 | * | ||
376 | * FUNCTION: acpi_tb_release_temp_table | ||
377 | * | ||
378 | * PARAMETERS: table_desc - Table descriptor to be released | ||
379 | * | ||
380 | * RETURN: Status | ||
381 | * | ||
382 | * DESCRIPTION: The inverse of acpi_tb_acquire_temp_table(). | ||
383 | * | ||
384 | ******************************************************************************/ | ||
385 | |||
386 | static void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc) | ||
387 | { | ||
388 | 94 | ||
389 | /* | 95 | acpi_tb_release_table(table, table_length, table_flags); |
390 | * Note that the .Address is maintained by the callers of | 96 | return (is_identical); |
391 | * acpi_tb_acquire_temp_table(), thus do not invoke acpi_tb_uninstall_table() | ||
392 | * where .Address will be freed. | ||
393 | */ | ||
394 | acpi_tb_invalidate_table(table_desc); | ||
395 | } | 97 | } |
396 | 98 | ||
397 | /******************************************************************************* | 99 | /******************************************************************************* |
@@ -509,50 +211,6 @@ release_and_exit: | |||
509 | 211 | ||
510 | /******************************************************************************* | 212 | /******************************************************************************* |
511 | * | 213 | * |
512 | * FUNCTION: acpi_tb_is_equivalent_table | ||
513 | * | ||
514 | * PARAMETERS: table_desc - Table 1 descriptor to be compared | ||
515 | * table_index - Index of table 2 to be compared | ||
516 | * | ||
517 | * RETURN: TRUE if 2 tables are equivalent | ||
518 | * | ||
519 | * DESCRIPTION: This function is called to compare a table with what have | ||
520 | * already been installed in the root table list. | ||
521 | * | ||
522 | ******************************************************************************/ | ||
523 | |||
524 | static u8 | ||
525 | acpi_tb_is_equivalent_table(struct acpi_table_desc *table_desc, u32 table_index) | ||
526 | { | ||
527 | acpi_status status = AE_OK; | ||
528 | u8 is_equivalent; | ||
529 | struct acpi_table_header *table; | ||
530 | u32 table_length; | ||
531 | u8 table_flags; | ||
532 | |||
533 | status = | ||
534 | acpi_tb_acquire_table(&acpi_gbl_root_table_list.tables[table_index], | ||
535 | &table, &table_length, &table_flags); | ||
536 | if (ACPI_FAILURE(status)) { | ||
537 | return (FALSE); | ||
538 | } | ||
539 | |||
540 | /* | ||
541 | * Check for a table match on the entire table length, | ||
542 | * not just the header. | ||
543 | */ | ||
544 | is_equivalent = (u8)((table_desc->length != table_length || | ||
545 | ACPI_MEMCMP(table_desc->pointer, table, | ||
546 | table_length)) ? FALSE : TRUE); | ||
547 | |||
548 | /* Release the acquired table */ | ||
549 | |||
550 | acpi_tb_release_table(table, table_length, table_flags); | ||
551 | return (is_equivalent); | ||
552 | } | ||
553 | |||
554 | /******************************************************************************* | ||
555 | * | ||
556 | * FUNCTION: acpi_tb_install_standard_table | 214 | * FUNCTION: acpi_tb_install_standard_table |
557 | * | 215 | * |
558 | * PARAMETERS: address - Address of the table (might be a virtual | 216 | * PARAMETERS: address - Address of the table (might be a virtual |
@@ -652,7 +310,7 @@ acpi_tb_install_standard_table(acpi_physical_address address, | |||
652 | * Check for a table match on the entire table length, | 310 | * Check for a table match on the entire table length, |
653 | * not just the header. | 311 | * not just the header. |
654 | */ | 312 | */ |
655 | if (!acpi_tb_is_equivalent_table(&new_table_desc, i)) { | 313 | if (!acpi_tb_compare_tables(&new_table_desc, i)) { |
656 | continue; | 314 | continue; |
657 | } | 315 | } |
658 | 316 | ||
@@ -696,7 +354,7 @@ acpi_tb_install_standard_table(acpi_physical_address address, | |||
696 | 354 | ||
697 | /* Add the table to the global root table list */ | 355 | /* Add the table to the global root table list */ |
698 | 356 | ||
699 | status = acpi_tb_get_root_table_entry(&i); | 357 | status = acpi_tb_get_next_root_index(&i); |
700 | if (ACPI_FAILURE(status)) { | 358 | if (ACPI_FAILURE(status)) { |
701 | goto release_and_exit; | 359 | goto release_and_exit; |
702 | } | 360 | } |
@@ -797,101 +455,6 @@ finish_override: | |||
797 | 455 | ||
798 | /******************************************************************************* | 456 | /******************************************************************************* |
799 | * | 457 | * |
800 | * FUNCTION: acpi_tb_resize_root_table_list | ||
801 | * | ||
802 | * PARAMETERS: None | ||
803 | * | ||
804 | * RETURN: Status | ||
805 | * | ||
806 | * DESCRIPTION: Expand the size of global table array | ||
807 | * | ||
808 | ******************************************************************************/ | ||
809 | |||
810 | acpi_status acpi_tb_resize_root_table_list(void) | ||
811 | { | ||
812 | struct acpi_table_desc *tables; | ||
813 | u32 table_count; | ||
814 | |||
815 | ACPI_FUNCTION_TRACE(tb_resize_root_table_list); | ||
816 | |||
817 | /* allow_resize flag is a parameter to acpi_initialize_tables */ | ||
818 | |||
819 | if (!(acpi_gbl_root_table_list.flags & ACPI_ROOT_ALLOW_RESIZE)) { | ||
820 | ACPI_ERROR((AE_INFO, | ||
821 | "Resize of Root Table Array is not allowed")); | ||
822 | return_ACPI_STATUS(AE_SUPPORT); | ||
823 | } | ||
824 | |||
825 | /* Increase the Table Array size */ | ||
826 | |||
827 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | ||
828 | table_count = acpi_gbl_root_table_list.max_table_count; | ||
829 | } else { | ||
830 | table_count = acpi_gbl_root_table_list.current_table_count; | ||
831 | } | ||
832 | |||
833 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count + | ||
834 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * | ||
835 | sizeof(struct acpi_table_desc)); | ||
836 | if (!tables) { | ||
837 | ACPI_ERROR((AE_INFO, | ||
838 | "Could not allocate new root table array")); | ||
839 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
840 | } | ||
841 | |||
842 | /* Copy and free the previous table array */ | ||
843 | |||
844 | if (acpi_gbl_root_table_list.tables) { | ||
845 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, | ||
846 | (acpi_size) table_count * | ||
847 | sizeof(struct acpi_table_desc)); | ||
848 | |||
849 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | ||
850 | ACPI_FREE(acpi_gbl_root_table_list.tables); | ||
851 | } | ||
852 | } | ||
853 | |||
854 | acpi_gbl_root_table_list.tables = tables; | ||
855 | acpi_gbl_root_table_list.max_table_count = | ||
856 | table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT; | ||
857 | acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED; | ||
858 | |||
859 | return_ACPI_STATUS(AE_OK); | ||
860 | } | ||
861 | |||
862 | /******************************************************************************* | ||
863 | * | ||
864 | * FUNCTION: acpi_tb_get_root_table_entry | ||
865 | * | ||
866 | * PARAMETERS: table_index - Where table index is returned | ||
867 | * | ||
868 | * RETURN: Status and table index. | ||
869 | * | ||
870 | * DESCRIPTION: Allocate a new ACPI table entry to the global table list | ||
871 | * | ||
872 | ******************************************************************************/ | ||
873 | |||
874 | static acpi_status acpi_tb_get_root_table_entry(u32 *table_index) | ||
875 | { | ||
876 | acpi_status status; | ||
877 | |||
878 | /* Ensure that there is room for the table in the Root Table List */ | ||
879 | |||
880 | if (acpi_gbl_root_table_list.current_table_count >= | ||
881 | acpi_gbl_root_table_list.max_table_count) { | ||
882 | status = acpi_tb_resize_root_table_list(); | ||
883 | if (ACPI_FAILURE(status)) { | ||
884 | return (status); | ||
885 | } | ||
886 | } | ||
887 | |||
888 | *table_index = acpi_gbl_root_table_list.current_table_count; | ||
889 | acpi_gbl_root_table_list.current_table_count++; | ||
890 | return (AE_OK); | ||
891 | } | ||
892 | |||
893 | /******************************************************************************* | ||
894 | * | ||
895 | * FUNCTION: acpi_tb_store_table | 458 | * FUNCTION: acpi_tb_store_table |
896 | * | 459 | * |
897 | * PARAMETERS: address - Table address | 460 | * PARAMETERS: address - Table address |
@@ -914,7 +477,7 @@ acpi_tb_store_table(acpi_physical_address address, | |||
914 | acpi_status status; | 477 | acpi_status status; |
915 | struct acpi_table_desc *table_desc; | 478 | struct acpi_table_desc *table_desc; |
916 | 479 | ||
917 | status = acpi_tb_get_root_table_entry(table_index); | 480 | status = acpi_tb_get_next_root_index(table_index); |
918 | if (ACPI_FAILURE(status)) { | 481 | if (ACPI_FAILURE(status)) { |
919 | return (status); | 482 | return (status); |
920 | } | 483 | } |
@@ -960,250 +523,3 @@ void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc) | |||
960 | table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL); | 523 | table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL); |
961 | return_VOID; | 524 | return_VOID; |
962 | } | 525 | } |
963 | |||
964 | /******************************************************************************* | ||
965 | * | ||
966 | * FUNCTION: acpi_tb_terminate | ||
967 | * | ||
968 | * PARAMETERS: None | ||
969 | * | ||
970 | * RETURN: None | ||
971 | * | ||
972 | * DESCRIPTION: Delete all internal ACPI tables | ||
973 | * | ||
974 | ******************************************************************************/ | ||
975 | |||
976 | void acpi_tb_terminate(void) | ||
977 | { | ||
978 | u32 i; | ||
979 | |||
980 | ACPI_FUNCTION_TRACE(tb_terminate); | ||
981 | |||
982 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
983 | |||
984 | /* Delete the individual tables */ | ||
985 | |||
986 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) { | ||
987 | acpi_tb_uninstall_table(&acpi_gbl_root_table_list.tables[i]); | ||
988 | } | ||
989 | |||
990 | /* | ||
991 | * Delete the root table array if allocated locally. Array cannot be | ||
992 | * mapped, so we don't need to check for that flag. | ||
993 | */ | ||
994 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | ||
995 | ACPI_FREE(acpi_gbl_root_table_list.tables); | ||
996 | } | ||
997 | |||
998 | acpi_gbl_root_table_list.tables = NULL; | ||
999 | acpi_gbl_root_table_list.flags = 0; | ||
1000 | acpi_gbl_root_table_list.current_table_count = 0; | ||
1001 | |||
1002 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n")); | ||
1003 | |||
1004 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1005 | return_VOID; | ||
1006 | } | ||
1007 | |||
1008 | /******************************************************************************* | ||
1009 | * | ||
1010 | * FUNCTION: acpi_tb_delete_namespace_by_owner | ||
1011 | * | ||
1012 | * PARAMETERS: table_index - Table index | ||
1013 | * | ||
1014 | * RETURN: Status | ||
1015 | * | ||
1016 | * DESCRIPTION: Delete all namespace objects created when this table was loaded. | ||
1017 | * | ||
1018 | ******************************************************************************/ | ||
1019 | |||
1020 | acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index) | ||
1021 | { | ||
1022 | acpi_owner_id owner_id; | ||
1023 | acpi_status status; | ||
1024 | |||
1025 | ACPI_FUNCTION_TRACE(tb_delete_namespace_by_owner); | ||
1026 | |||
1027 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
1028 | if (ACPI_FAILURE(status)) { | ||
1029 | return_ACPI_STATUS(status); | ||
1030 | } | ||
1031 | |||
1032 | if (table_index >= acpi_gbl_root_table_list.current_table_count) { | ||
1033 | |||
1034 | /* The table index does not exist */ | ||
1035 | |||
1036 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1037 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
1038 | } | ||
1039 | |||
1040 | /* Get the owner ID for this table, used to delete namespace nodes */ | ||
1041 | |||
1042 | owner_id = acpi_gbl_root_table_list.tables[table_index].owner_id; | ||
1043 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1044 | |||
1045 | /* | ||
1046 | * Need to acquire the namespace writer lock to prevent interference | ||
1047 | * with any concurrent namespace walks. The interpreter must be | ||
1048 | * released during the deletion since the acquisition of the deletion | ||
1049 | * lock may block, and also since the execution of a namespace walk | ||
1050 | * must be allowed to use the interpreter. | ||
1051 | */ | ||
1052 | (void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); | ||
1053 | status = acpi_ut_acquire_write_lock(&acpi_gbl_namespace_rw_lock); | ||
1054 | |||
1055 | acpi_ns_delete_namespace_by_owner(owner_id); | ||
1056 | if (ACPI_FAILURE(status)) { | ||
1057 | return_ACPI_STATUS(status); | ||
1058 | } | ||
1059 | |||
1060 | acpi_ut_release_write_lock(&acpi_gbl_namespace_rw_lock); | ||
1061 | |||
1062 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); | ||
1063 | return_ACPI_STATUS(status); | ||
1064 | } | ||
1065 | |||
1066 | /******************************************************************************* | ||
1067 | * | ||
1068 | * FUNCTION: acpi_tb_allocate_owner_id | ||
1069 | * | ||
1070 | * PARAMETERS: table_index - Table index | ||
1071 | * | ||
1072 | * RETURN: Status | ||
1073 | * | ||
1074 | * DESCRIPTION: Allocates owner_id in table_desc | ||
1075 | * | ||
1076 | ******************************************************************************/ | ||
1077 | |||
1078 | acpi_status acpi_tb_allocate_owner_id(u32 table_index) | ||
1079 | { | ||
1080 | acpi_status status = AE_BAD_PARAMETER; | ||
1081 | |||
1082 | ACPI_FUNCTION_TRACE(tb_allocate_owner_id); | ||
1083 | |||
1084 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
1085 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
1086 | status = | ||
1087 | acpi_ut_allocate_owner_id(& | ||
1088 | (acpi_gbl_root_table_list. | ||
1089 | tables[table_index].owner_id)); | ||
1090 | } | ||
1091 | |||
1092 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1093 | return_ACPI_STATUS(status); | ||
1094 | } | ||
1095 | |||
1096 | /******************************************************************************* | ||
1097 | * | ||
1098 | * FUNCTION: acpi_tb_release_owner_id | ||
1099 | * | ||
1100 | * PARAMETERS: table_index - Table index | ||
1101 | * | ||
1102 | * RETURN: Status | ||
1103 | * | ||
1104 | * DESCRIPTION: Releases owner_id in table_desc | ||
1105 | * | ||
1106 | ******************************************************************************/ | ||
1107 | |||
1108 | acpi_status acpi_tb_release_owner_id(u32 table_index) | ||
1109 | { | ||
1110 | acpi_status status = AE_BAD_PARAMETER; | ||
1111 | |||
1112 | ACPI_FUNCTION_TRACE(tb_release_owner_id); | ||
1113 | |||
1114 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
1115 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
1116 | acpi_ut_release_owner_id(& | ||
1117 | (acpi_gbl_root_table_list. | ||
1118 | tables[table_index].owner_id)); | ||
1119 | status = AE_OK; | ||
1120 | } | ||
1121 | |||
1122 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1123 | return_ACPI_STATUS(status); | ||
1124 | } | ||
1125 | |||
1126 | /******************************************************************************* | ||
1127 | * | ||
1128 | * FUNCTION: acpi_tb_get_owner_id | ||
1129 | * | ||
1130 | * PARAMETERS: table_index - Table index | ||
1131 | * owner_id - Where the table owner_id is returned | ||
1132 | * | ||
1133 | * RETURN: Status | ||
1134 | * | ||
1135 | * DESCRIPTION: returns owner_id for the ACPI table | ||
1136 | * | ||
1137 | ******************************************************************************/ | ||
1138 | |||
1139 | acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id * owner_id) | ||
1140 | { | ||
1141 | acpi_status status = AE_BAD_PARAMETER; | ||
1142 | |||
1143 | ACPI_FUNCTION_TRACE(tb_get_owner_id); | ||
1144 | |||
1145 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
1146 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
1147 | *owner_id = | ||
1148 | acpi_gbl_root_table_list.tables[table_index].owner_id; | ||
1149 | status = AE_OK; | ||
1150 | } | ||
1151 | |||
1152 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1153 | return_ACPI_STATUS(status); | ||
1154 | } | ||
1155 | |||
1156 | /******************************************************************************* | ||
1157 | * | ||
1158 | * FUNCTION: acpi_tb_is_table_loaded | ||
1159 | * | ||
1160 | * PARAMETERS: table_index - Index into the root table | ||
1161 | * | ||
1162 | * RETURN: Table Loaded Flag | ||
1163 | * | ||
1164 | ******************************************************************************/ | ||
1165 | |||
1166 | u8 acpi_tb_is_table_loaded(u32 table_index) | ||
1167 | { | ||
1168 | u8 is_loaded = FALSE; | ||
1169 | |||
1170 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
1171 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
1172 | is_loaded = (u8) | ||
1173 | (acpi_gbl_root_table_list.tables[table_index].flags & | ||
1174 | ACPI_TABLE_IS_LOADED); | ||
1175 | } | ||
1176 | |||
1177 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1178 | return (is_loaded); | ||
1179 | } | ||
1180 | |||
1181 | /******************************************************************************* | ||
1182 | * | ||
1183 | * FUNCTION: acpi_tb_set_table_loaded_flag | ||
1184 | * | ||
1185 | * PARAMETERS: table_index - Table index | ||
1186 | * is_loaded - TRUE if table is loaded, FALSE otherwise | ||
1187 | * | ||
1188 | * RETURN: None | ||
1189 | * | ||
1190 | * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE. | ||
1191 | * | ||
1192 | ******************************************************************************/ | ||
1193 | |||
1194 | void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded) | ||
1195 | { | ||
1196 | |||
1197 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
1198 | if (table_index < acpi_gbl_root_table_list.current_table_count) { | ||
1199 | if (is_loaded) { | ||
1200 | acpi_gbl_root_table_list.tables[table_index].flags |= | ||
1201 | ACPI_TABLE_IS_LOADED; | ||
1202 | } else { | ||
1203 | acpi_gbl_root_table_list.tables[table_index].flags &= | ||
1204 | ~ACPI_TABLE_IS_LOADED; | ||
1205 | } | ||
1206 | } | ||
1207 | |||
1208 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
1209 | } | ||