Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Module Name: tbinstal - ACPI table installation and removal | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
75a44ce0 | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
1da177e4 LT |
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 | ||
1da177e4 | 44 | #include <acpi/acpi.h> |
f3d2e786 | 45 | #include <acpi/acnamesp.h> |
1da177e4 LT |
46 | #include <acpi/actables.h> |
47 | ||
1da177e4 | 48 | #define _COMPONENT ACPI_TABLES |
4be44fcd | 49 | ACPI_MODULE_NAME("tbinstal") |
1da177e4 | 50 | |
f3d2e786 | 51 | /****************************************************************************** |
1da177e4 | 52 | * |
f3d2e786 | 53 | * FUNCTION: acpi_tb_verify_table |
1da177e4 | 54 | * |
f3d2e786 | 55 | * PARAMETERS: table_desc - table |
1da177e4 LT |
56 | * |
57 | * RETURN: Status | |
58 | * | |
f3d2e786 | 59 | * DESCRIPTION: this function is called to verify and map table |
1da177e4 | 60 | * |
f3d2e786 BM |
61 | *****************************************************************************/ |
62 | acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) | |
1da177e4 | 63 | { |
428f2112 | 64 | acpi_status status = AE_OK; |
1da177e4 | 65 | |
f3d2e786 | 66 | ACPI_FUNCTION_TRACE(tb_verify_table); |
1da177e4 | 67 | |
f3d2e786 | 68 | /* Map the table if necessary */ |
44f6c012 | 69 | |
f3d2e786 | 70 | if (!table_desc->pointer) { |
428f2112 AS |
71 | if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) == |
72 | ACPI_TABLE_ORIGIN_MAPPED) { | |
73 | table_desc->pointer = | |
74 | acpi_os_map_memory(table_desc->address, | |
75 | table_desc->length); | |
76 | } | |
f3d2e786 BM |
77 | if (!table_desc->pointer) { |
78 | return_ACPI_STATUS(AE_NO_MEMORY); | |
1da177e4 | 79 | } |
f3d2e786 | 80 | } |
1da177e4 | 81 | |
f3d2e786 | 82 | /* FACS is the odd table, has no standard ACPI header and no checksum */ |
52fc0b02 | 83 | |
428f2112 | 84 | if (!ACPI_COMPARE_NAME(&table_desc->signature, ACPI_SIG_FACS)) { |
1da177e4 | 85 | |
428f2112 AS |
86 | /* Always calculate checksum, ignore bad checksum if requested */ |
87 | ||
88 | status = | |
89 | acpi_tb_verify_checksum(table_desc->pointer, | |
90 | table_desc->length); | |
91 | } | |
1da177e4 | 92 | |
c5fc42ac | 93 | return_ACPI_STATUS(status); |
1da177e4 LT |
94 | } |
95 | ||
1da177e4 LT |
96 | /******************************************************************************* |
97 | * | |
f3d2e786 | 98 | * FUNCTION: acpi_tb_add_table |
1da177e4 | 99 | * |
428f2112 | 100 | * PARAMETERS: table_desc - Table descriptor |
f3d2e786 | 101 | * table_index - Where the table index is returned |
1da177e4 LT |
102 | * |
103 | * RETURN: Status | |
104 | * | |
f3d2e786 | 105 | * DESCRIPTION: This function is called to add the ACPI table |
1da177e4 LT |
106 | * |
107 | ******************************************************************************/ | |
108 | ||
f3d2e786 | 109 | acpi_status |
67a119f9 | 110 | acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) |
1da177e4 | 111 | { |
67a119f9 BM |
112 | u32 i; |
113 | u32 length; | |
f3d2e786 | 114 | acpi_status status = AE_OK; |
1da177e4 | 115 | |
f3d2e786 | 116 | ACPI_FUNCTION_TRACE(tb_add_table); |
1da177e4 | 117 | |
428f2112 AS |
118 | if (!table_desc->pointer) { |
119 | status = acpi_tb_verify_table(table_desc); | |
120 | if (ACPI_FAILURE(status) || !table_desc->pointer) { | |
121 | return_ACPI_STATUS(status); | |
122 | } | |
123 | } | |
124 | ||
bc45b1d3 BM |
125 | /* |
126 | * Originally, we checked the table signature for "SSDT" or "PSDT" here. | |
127 | * Next, we added support for OEMx tables, signature "OEM". | |
128 | * Valid tables were encountered with a null signature, so we've just | |
129 | * given up on validating the signature, since it seems to be a waste | |
130 | * of code. The original code was removed (05/2008). | |
131 | */ | |
428f2112 | 132 | |
f3d2e786 | 133 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
1da177e4 | 134 | |
f3d2e786 BM |
135 | /* Check if table is already registered */ |
136 | ||
137 | for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { | |
138 | if (!acpi_gbl_root_table_list.tables[i].pointer) { | |
139 | status = | |
140 | acpi_tb_verify_table(&acpi_gbl_root_table_list. | |
141 | tables[i]); | |
142 | if (ACPI_FAILURE(status) | |
143 | || !acpi_gbl_root_table_list.tables[i].pointer) { | |
144 | continue; | |
145 | } | |
146 | } | |
147 | ||
428f2112 AS |
148 | length = ACPI_MIN(table_desc->length, |
149 | acpi_gbl_root_table_list.tables[i].length); | |
150 | if (ACPI_MEMCMP(table_desc->pointer, | |
151 | acpi_gbl_root_table_list.tables[i].pointer, | |
152 | length)) { | |
f3d2e786 BM |
153 | continue; |
154 | } | |
155 | ||
156 | /* Table is already registered */ | |
157 | ||
428f2112 | 158 | acpi_tb_delete_table(table_desc); |
f3d2e786 | 159 | *table_index = i; |
200cce6a | 160 | status = AE_ALREADY_EXISTS; |
f3d2e786 | 161 | goto release; |
1da177e4 LT |
162 | } |
163 | ||
0c9938cc | 164 | /* |
f3d2e786 | 165 | * Add the table to the global table list |
0c9938cc | 166 | */ |
428f2112 AS |
167 | status = acpi_tb_store_table(table_desc->address, table_desc->pointer, |
168 | table_desc->length, table_desc->flags, | |
169 | table_index); | |
4be44fcd | 170 | if (ACPI_FAILURE(status)) { |
f3d2e786 | 171 | goto release; |
0c9938cc RM |
172 | } |
173 | ||
428f2112 | 174 | acpi_tb_print_table_header(table_desc->address, table_desc->pointer); |
1da177e4 | 175 | |
f3d2e786 | 176 | release: |
4be44fcd LB |
177 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
178 | return_ACPI_STATUS(status); | |
1da177e4 LT |
179 | } |
180 | ||
1da177e4 LT |
181 | /******************************************************************************* |
182 | * | |
f3d2e786 | 183 | * FUNCTION: acpi_tb_resize_root_table_list |
1da177e4 | 184 | * |
f3d2e786 | 185 | * PARAMETERS: None |
1da177e4 LT |
186 | * |
187 | * RETURN: Status | |
188 | * | |
f3d2e786 | 189 | * DESCRIPTION: Expand the size of global table array |
1da177e4 LT |
190 | * |
191 | ******************************************************************************/ | |
192 | ||
f3d2e786 | 193 | acpi_status acpi_tb_resize_root_table_list(void) |
1da177e4 | 194 | { |
f3d2e786 | 195 | struct acpi_table_desc *tables; |
1da177e4 | 196 | |
f3d2e786 | 197 | ACPI_FUNCTION_TRACE(tb_resize_root_table_list); |
1da177e4 | 198 | |
f3d2e786 | 199 | /* allow_resize flag is a parameter to acpi_initialize_tables */ |
1da177e4 | 200 | |
c5fc42ac | 201 | if (!(acpi_gbl_root_table_list.flags & ACPI_ROOT_ALLOW_RESIZE)) { |
f3d2e786 BM |
202 | ACPI_ERROR((AE_INFO, |
203 | "Resize of Root Table Array is not allowed")); | |
204 | return_ACPI_STATUS(AE_SUPPORT); | |
1da177e4 LT |
205 | } |
206 | ||
f3d2e786 BM |
207 | /* Increase the Table Array size */ |
208 | ||
67a119f9 BM |
209 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. |
210 | size + ACPI_ROOT_TABLE_SIZE_INCREMENT) | |
f3d2e786 BM |
211 | * sizeof(struct acpi_table_desc)); |
212 | if (!tables) { | |
213 | ACPI_ERROR((AE_INFO, | |
214 | "Could not allocate new root table array")); | |
215 | return_ACPI_STATUS(AE_NO_MEMORY); | |
1da177e4 LT |
216 | } |
217 | ||
f3d2e786 BM |
218 | /* Copy and free the previous table array */ |
219 | ||
220 | if (acpi_gbl_root_table_list.tables) { | |
221 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, | |
67a119f9 | 222 | (acpi_size) acpi_gbl_root_table_list.size * |
f3d2e786 BM |
223 | sizeof(struct acpi_table_desc)); |
224 | ||
c5fc42ac | 225 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { |
f3d2e786 BM |
226 | ACPI_FREE(acpi_gbl_root_table_list.tables); |
227 | } | |
1da177e4 LT |
228 | } |
229 | ||
f3d2e786 BM |
230 | acpi_gbl_root_table_list.tables = tables; |
231 | acpi_gbl_root_table_list.size += ACPI_ROOT_TABLE_SIZE_INCREMENT; | |
c5fc42ac | 232 | acpi_gbl_root_table_list.flags |= (u8) ACPI_ROOT_ORIGIN_ALLOCATED; |
1da177e4 | 233 | |
f3d2e786 | 234 | return_ACPI_STATUS(AE_OK); |
1da177e4 LT |
235 | } |
236 | ||
1da177e4 LT |
237 | /******************************************************************************* |
238 | * | |
f3d2e786 | 239 | * FUNCTION: acpi_tb_store_table |
1da177e4 | 240 | * |
f3d2e786 BM |
241 | * PARAMETERS: Address - Table address |
242 | * Table - Table header | |
243 | * Length - Table length | |
244 | * Flags - flags | |
1da177e4 | 245 | * |
f3d2e786 | 246 | * RETURN: Status and table index. |
1da177e4 | 247 | * |
f3d2e786 | 248 | * DESCRIPTION: Add an ACPI table to the global table list |
1da177e4 LT |
249 | * |
250 | ******************************************************************************/ | |
251 | ||
252 | acpi_status | |
f3d2e786 BM |
253 | acpi_tb_store_table(acpi_physical_address address, |
254 | struct acpi_table_header *table, | |
67a119f9 | 255 | u32 length, u8 flags, u32 *table_index) |
1da177e4 | 256 | { |
f3d2e786 | 257 | acpi_status status = AE_OK; |
1da177e4 | 258 | |
f3d2e786 | 259 | /* Ensure that there is room for the table in the Root Table List */ |
f9f4601f | 260 | |
f3d2e786 BM |
261 | if (acpi_gbl_root_table_list.count >= acpi_gbl_root_table_list.size) { |
262 | status = acpi_tb_resize_root_table_list(); | |
263 | if (ACPI_FAILURE(status)) { | |
264 | return (status); | |
265 | } | |
f9f4601f RM |
266 | } |
267 | ||
f3d2e786 BM |
268 | /* Initialize added table */ |
269 | ||
270 | acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. | |
271 | address = address; | |
272 | acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. | |
273 | pointer = table; | |
274 | acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count].length = | |
275 | length; | |
276 | acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. | |
277 | owner_id = 0; | |
278 | acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count].flags = | |
279 | flags; | |
280 | ||
281 | ACPI_MOVE_32_TO_32(& | |
282 | (acpi_gbl_root_table_list. | |
283 | tables[acpi_gbl_root_table_list.count].signature), | |
284 | table->signature); | |
285 | ||
286 | *table_index = acpi_gbl_root_table_list.count; | |
287 | acpi_gbl_root_table_list.count++; | |
288 | return (status); | |
289 | } | |
1da177e4 | 290 | |
f3d2e786 BM |
291 | /******************************************************************************* |
292 | * | |
293 | * FUNCTION: acpi_tb_delete_table | |
294 | * | |
295 | * PARAMETERS: table_index - Table index | |
296 | * | |
297 | * RETURN: None | |
298 | * | |
299 | * DESCRIPTION: Delete one internal ACPI table | |
300 | * | |
301 | ******************************************************************************/ | |
1da177e4 | 302 | |
428f2112 | 303 | void acpi_tb_delete_table(struct acpi_table_desc *table_desc) |
f3d2e786 | 304 | { |
f3d2e786 | 305 | /* Table must be mapped or allocated */ |
f3d2e786 BM |
306 | if (!table_desc->pointer) { |
307 | return; | |
1da177e4 | 308 | } |
428f2112 AS |
309 | switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { |
310 | case ACPI_TABLE_ORIGIN_MAPPED: | |
311 | acpi_os_unmap_memory(table_desc->pointer, table_desc->length); | |
312 | break; | |
313 | case ACPI_TABLE_ORIGIN_ALLOCATED: | |
f3d2e786 | 314 | ACPI_FREE(table_desc->pointer); |
428f2112 AS |
315 | break; |
316 | default:; | |
1da177e4 LT |
317 | } |
318 | ||
f3d2e786 | 319 | table_desc->pointer = NULL; |
1da177e4 LT |
320 | } |
321 | ||
1da177e4 LT |
322 | /******************************************************************************* |
323 | * | |
f3d2e786 | 324 | * FUNCTION: acpi_tb_terminate |
1da177e4 | 325 | * |
f3d2e786 | 326 | * PARAMETERS: None |
1da177e4 | 327 | * |
f3d2e786 | 328 | * RETURN: None |
1da177e4 LT |
329 | * |
330 | * DESCRIPTION: Delete all internal ACPI tables | |
331 | * | |
332 | ******************************************************************************/ | |
333 | ||
f3d2e786 | 334 | void acpi_tb_terminate(void) |
1da177e4 | 335 | { |
67a119f9 | 336 | u32 i; |
f3d2e786 BM |
337 | |
338 | ACPI_FUNCTION_TRACE(tb_terminate); | |
339 | ||
340 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | |
341 | ||
342 | /* Delete the individual tables */ | |
343 | ||
344 | for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { | |
428f2112 | 345 | acpi_tb_delete_table(&acpi_gbl_root_table_list.tables[i]); |
f3d2e786 | 346 | } |
1da177e4 LT |
347 | |
348 | /* | |
f3d2e786 BM |
349 | * Delete the root table array if allocated locally. Array cannot be |
350 | * mapped, so we don't need to check for that flag. | |
1da177e4 | 351 | */ |
c5fc42ac | 352 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { |
f3d2e786 | 353 | ACPI_FREE(acpi_gbl_root_table_list.tables); |
1da177e4 | 354 | } |
f3d2e786 BM |
355 | |
356 | acpi_gbl_root_table_list.tables = NULL; | |
357 | acpi_gbl_root_table_list.flags = 0; | |
358 | acpi_gbl_root_table_list.count = 0; | |
359 | ||
360 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n")); | |
361 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | |
1da177e4 LT |
362 | } |
363 | ||
1da177e4 LT |
364 | /******************************************************************************* |
365 | * | |
f3d2e786 | 366 | * FUNCTION: acpi_tb_delete_namespace_by_owner |
1da177e4 | 367 | * |
f3d2e786 | 368 | * PARAMETERS: table_index - Table index |
1da177e4 | 369 | * |
f3d2e786 | 370 | * RETURN: None |
1da177e4 | 371 | * |
f3d2e786 | 372 | * DESCRIPTION: Delete all namespace objects created when this table was loaded. |
1da177e4 LT |
373 | * |
374 | ******************************************************************************/ | |
375 | ||
67a119f9 | 376 | void acpi_tb_delete_namespace_by_owner(u32 table_index) |
1da177e4 | 377 | { |
f3d2e786 | 378 | acpi_owner_id owner_id; |
1da177e4 | 379 | |
f3d2e786 BM |
380 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
381 | if (table_index < acpi_gbl_root_table_list.count) { | |
382 | owner_id = | |
383 | acpi_gbl_root_table_list.tables[table_index].owner_id; | |
384 | } else { | |
385 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | |
1da177e4 LT |
386 | return; |
387 | } | |
388 | ||
f3d2e786 BM |
389 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
390 | acpi_ns_delete_namespace_by_owner(owner_id); | |
391 | } | |
1da177e4 | 392 | |
f3d2e786 BM |
393 | /******************************************************************************* |
394 | * | |
395 | * FUNCTION: acpi_tb_allocate_owner_id | |
396 | * | |
397 | * PARAMETERS: table_index - Table index | |
398 | * | |
399 | * RETURN: Status | |
400 | * | |
401 | * DESCRIPTION: Allocates owner_id in table_desc | |
402 | * | |
403 | ******************************************************************************/ | |
1da177e4 | 404 | |
67a119f9 | 405 | acpi_status acpi_tb_allocate_owner_id(u32 table_index) |
f3d2e786 BM |
406 | { |
407 | acpi_status status = AE_BAD_PARAMETER; | |
1da177e4 | 408 | |
f3d2e786 | 409 | ACPI_FUNCTION_TRACE(tb_allocate_owner_id); |
1da177e4 | 410 | |
f3d2e786 BM |
411 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
412 | if (table_index < acpi_gbl_root_table_list.count) { | |
413 | status = acpi_ut_allocate_owner_id | |
414 | (&(acpi_gbl_root_table_list.tables[table_index].owner_id)); | |
1da177e4 LT |
415 | } |
416 | ||
4be44fcd | 417 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
f3d2e786 | 418 | return_ACPI_STATUS(status); |
1da177e4 LT |
419 | } |
420 | ||
1da177e4 LT |
421 | /******************************************************************************* |
422 | * | |
f3d2e786 | 423 | * FUNCTION: acpi_tb_release_owner_id |
1da177e4 | 424 | * |
f3d2e786 | 425 | * PARAMETERS: table_index - Table index |
1da177e4 | 426 | * |
f3d2e786 | 427 | * RETURN: Status |
1da177e4 | 428 | * |
f3d2e786 | 429 | * DESCRIPTION: Releases owner_id in table_desc |
1da177e4 LT |
430 | * |
431 | ******************************************************************************/ | |
432 | ||
67a119f9 | 433 | acpi_status acpi_tb_release_owner_id(u32 table_index) |
1da177e4 | 434 | { |
f3d2e786 | 435 | acpi_status status = AE_BAD_PARAMETER; |
1da177e4 | 436 | |
f3d2e786 | 437 | ACPI_FUNCTION_TRACE(tb_release_owner_id); |
1da177e4 | 438 | |
f3d2e786 BM |
439 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
440 | if (table_index < acpi_gbl_root_table_list.count) { | |
441 | acpi_ut_release_owner_id(& | |
442 | (acpi_gbl_root_table_list. | |
443 | tables[table_index].owner_id)); | |
444 | status = AE_OK; | |
1da177e4 LT |
445 | } |
446 | ||
f3d2e786 BM |
447 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
448 | return_ACPI_STATUS(status); | |
1da177e4 LT |
449 | } |
450 | ||
1da177e4 LT |
451 | /******************************************************************************* |
452 | * | |
f3d2e786 | 453 | * FUNCTION: acpi_tb_get_owner_id |
1da177e4 | 454 | * |
f3d2e786 BM |
455 | * PARAMETERS: table_index - Table index |
456 | * owner_id - Where the table owner_id is returned | |
1da177e4 | 457 | * |
f3d2e786 | 458 | * RETURN: Status |
1da177e4 | 459 | * |
f3d2e786 | 460 | * DESCRIPTION: returns owner_id for the ACPI table |
1da177e4 LT |
461 | * |
462 | ******************************************************************************/ | |
463 | ||
67a119f9 | 464 | acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id) |
1da177e4 | 465 | { |
f3d2e786 | 466 | acpi_status status = AE_BAD_PARAMETER; |
1da177e4 | 467 | |
f3d2e786 | 468 | ACPI_FUNCTION_TRACE(tb_get_owner_id); |
1da177e4 | 469 | |
f3d2e786 BM |
470 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
471 | if (table_index < acpi_gbl_root_table_list.count) { | |
472 | *owner_id = | |
473 | acpi_gbl_root_table_list.tables[table_index].owner_id; | |
474 | status = AE_OK; | |
1da177e4 LT |
475 | } |
476 | ||
f3d2e786 BM |
477 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
478 | return_ACPI_STATUS(status); | |
479 | } | |
1da177e4 | 480 | |
f3d2e786 BM |
481 | /******************************************************************************* |
482 | * | |
483 | * FUNCTION: acpi_tb_is_table_loaded | |
484 | * | |
485 | * PARAMETERS: table_index - Table index | |
486 | * | |
487 | * RETURN: Table Loaded Flag | |
488 | * | |
489 | ******************************************************************************/ | |
1da177e4 | 490 | |
67a119f9 | 491 | u8 acpi_tb_is_table_loaded(u32 table_index) |
f3d2e786 BM |
492 | { |
493 | u8 is_loaded = FALSE; | |
1da177e4 | 494 | |
f3d2e786 BM |
495 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
496 | if (table_index < acpi_gbl_root_table_list.count) { | |
497 | is_loaded = (u8) | |
498 | (acpi_gbl_root_table_list.tables[table_index]. | |
c5fc42ac | 499 | flags & ACPI_TABLE_IS_LOADED); |
1da177e4 LT |
500 | } |
501 | ||
f3d2e786 BM |
502 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
503 | return (is_loaded); | |
504 | } | |
f6dd9221 | 505 | |
f3d2e786 BM |
506 | /******************************************************************************* |
507 | * | |
508 | * FUNCTION: acpi_tb_set_table_loaded_flag | |
509 | * | |
510 | * PARAMETERS: table_index - Table index | |
511 | * is_loaded - TRUE if table is loaded, FALSE otherwise | |
512 | * | |
513 | * RETURN: None | |
514 | * | |
515 | * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE. | |
516 | * | |
517 | ******************************************************************************/ | |
1da177e4 | 518 | |
67a119f9 | 519 | void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded) |
f3d2e786 | 520 | { |
1da177e4 | 521 | |
f3d2e786 BM |
522 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
523 | if (table_index < acpi_gbl_root_table_list.count) { | |
524 | if (is_loaded) { | |
525 | acpi_gbl_root_table_list.tables[table_index].flags |= | |
c5fc42ac | 526 | ACPI_TABLE_IS_LOADED; |
f3d2e786 BM |
527 | } else { |
528 | acpi_gbl_root_table_list.tables[table_index].flags &= | |
c5fc42ac | 529 | ~ACPI_TABLE_IS_LOADED; |
f3d2e786 BM |
530 | } |
531 | } | |
1da177e4 | 532 | |
f3d2e786 | 533 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
1da177e4 | 534 | } |