ACPICA: Miscellaneous table manager updates and optimizations
[deliverable/linux.git] / drivers / acpi / tables / tbxface.c
CommitLineData
1da177e4
LT
1/******************************************************************************
2 *
3 * Module Name: tbxface - Public interfaces to the ACPI subsystem
4 * ACPI table oriented interfaces
5 *
6 *****************************************************************************/
7
8/*
4a90c7e8 9 * Copyright (C) 2000 - 2006, R. Byron Moore
1da177e4
LT
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
1da177e4
LT
45#include <acpi/acpi.h>
46#include <acpi/acnamesp.h>
47#include <acpi/actables.h>
48
1da177e4 49#define _COMPONENT ACPI_TABLES
4be44fcd 50ACPI_MODULE_NAME("tbxface")
1da177e4 51
f3d2e786
BM
52/* Local prototypes */
53static acpi_status acpi_tb_load_namespace(void);
54
77389e12
BM
55/*******************************************************************************
56 *
57 * FUNCTION: acpi_allocate_root_table
58 *
59 * PARAMETERS: initial_table_count - Size of initial_table_array, in number of
60 * struct acpi_table_desc structures
61 *
62 * RETURN: Status
63 *
64 * DESCRIPTION: Allocate a root table array. Used by i_aSL compiler and
65 * acpi_initialize_tables.
66 *
67 ******************************************************************************/
68
69acpi_status acpi_allocate_root_table(u32 initial_table_count)
70{
71
72 acpi_gbl_root_table_list.size = initial_table_count;
73 acpi_gbl_root_table_list.flags = ACPI_ROOT_ALLOW_RESIZE;
74
75 return (acpi_tb_resize_root_table_list());
76}
77
1da177e4
LT
78/*******************************************************************************
79 *
f3d2e786 80 * FUNCTION: acpi_initialize_tables
1da177e4 81 *
f3d2e786
BM
82 * PARAMETERS: initial_table_array - Pointer to an array of pre-allocated
83 * struct acpi_table_desc structures. If NULL, the
84 * array is dynamically allocated.
85 * initial_table_count - Size of initial_table_array, in number of
86 * struct acpi_table_desc structures
87 * allow_realloc - Flag to tell Table Manager if resize of
88 * pre-allocated array is allowed. Ignored
89 * if initial_table_array is NULL.
1da177e4
LT
90 *
91 * RETURN: Status
92 *
f3d2e786
BM
93 * DESCRIPTION: Initialize the table manager, get the RSDP and RSDT/XSDT.
94 *
95 * NOTE: Allows static allocation of the initial table array in order
96 * to avoid the use of dynamic memory in confined environments
97 * such as the kernel boot sequence where it may not be available.
98 *
99 * If the host OS memory managers are initialized, use NULL for
100 * initial_table_array, and the table will be dynamically allocated.
1da177e4
LT
101 *
102 ******************************************************************************/
f3d2e786 103
ad71860a 104acpi_status __init
77389e12 105acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
f3d2e786 106 u32 initial_table_count, u8 allow_resize)
1da177e4 107{
c5fc42ac 108 acpi_physical_address rsdp_address;
4be44fcd 109 acpi_status status;
1da177e4 110
f3d2e786 111 ACPI_FUNCTION_TRACE(acpi_initialize_tables);
1da177e4 112
f3d2e786
BM
113 /*
114 * Set up the Root Table Array
115 * Allocate the table array if requested
116 */
117 if (!initial_table_array) {
77389e12 118 status = acpi_allocate_root_table(initial_table_count);
f3d2e786
BM
119 if (ACPI_FAILURE(status)) {
120 return_ACPI_STATUS(status);
121 }
122 } else {
123 /* Root Table Array has been statically allocated by the host */
124
a4bbb810 125 ACPI_MEMSET(initial_table_array, 0,
c5fc42ac 126 initial_table_count *
a4bbb810 127 sizeof(struct acpi_table_desc));
c5fc42ac 128
f3d2e786
BM
129 acpi_gbl_root_table_list.tables = initial_table_array;
130 acpi_gbl_root_table_list.size = initial_table_count;
c5fc42ac 131 acpi_gbl_root_table_list.flags = ACPI_ROOT_ORIGIN_UNKNOWN;
f3d2e786 132 if (allow_resize) {
c5fc42ac
BM
133 acpi_gbl_root_table_list.flags |=
134 ACPI_ROOT_ALLOW_RESIZE;
f3d2e786 135 }
1da177e4
LT
136 }
137
c5fc42ac 138 /* Get the address of the RSDP */
1da177e4 139
c5fc42ac
BM
140 rsdp_address = acpi_os_get_root_pointer();
141 if (!rsdp_address) {
f3d2e786
BM
142 return_ACPI_STATUS(AE_NOT_FOUND);
143 }
1da177e4 144
f3d2e786
BM
145 /*
146 * Get the root table (RSDT or XSDT) and extract all entries to the local
147 * Root Table Array. This array contains the information of the RSDT/XSDT
148 * in a common, more useable format.
149 */
c5fc42ac
BM
150 status =
151 acpi_tb_parse_root_table(rsdp_address, ACPI_TABLE_ORIGIN_MAPPED);
f3d2e786
BM
152 return_ACPI_STATUS(status);
153}
1da177e4 154
f3d2e786
BM
155/*******************************************************************************
156 *
157 * FUNCTION: acpi_reallocate_root_table
158 *
159 * PARAMETERS: None
160 *
161 * RETURN: Status
162 *
163 * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the
164 * root list from the previously provided scratch area. Should
165 * be called once dynamic memory allocation is available in the
166 * kernel
167 *
168 ******************************************************************************/
169acpi_status acpi_reallocate_root_table(void)
170{
171 struct acpi_table_desc *tables;
172 acpi_size new_size;
173
174 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table);
175
176 /*
177 * Only reallocate the root table if the host provided a static buffer
178 * for the table array in the call to acpi_initialize_tables.
179 */
c5fc42ac 180 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
f3d2e786 181 return_ACPI_STATUS(AE_SUPPORT);
1da177e4
LT
182 }
183
f3d2e786
BM
184 new_size =
185 (acpi_gbl_root_table_list.count +
186 ACPI_ROOT_TABLE_SIZE_INCREMENT) * sizeof(struct acpi_table_desc);
1da177e4 187
f3d2e786 188 /* Create new array and copy the old array */
1da177e4 189
f3d2e786
BM
190 tables = ACPI_ALLOCATE_ZEROED(new_size);
191 if (!tables) {
192 return_ACPI_STATUS(AE_NO_MEMORY);
1da177e4
LT
193 }
194
f3d2e786 195 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, new_size);
1da177e4 196
f3d2e786
BM
197 acpi_gbl_root_table_list.size = acpi_gbl_root_table_list.count;
198 acpi_gbl_root_table_list.tables = tables;
199 acpi_gbl_root_table_list.flags =
c5fc42ac 200 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
8313524a 201
f3d2e786
BM
202 return_ACPI_STATUS(AE_OK);
203}
1da177e4
LT
204/*******************************************************************************
205 *
206 * FUNCTION: acpi_load_table
207 *
208 * PARAMETERS: table_ptr - pointer to a buffer containing the entire
209 * table to be loaded
210 *
211 * RETURN: Status
212 *
213 * DESCRIPTION: This function is called to load a table from the caller's
f6dd9221
BM
214 * buffer. The buffer must contain an entire ACPI Table including
215 * a valid header. The header fields will be verified, and if it
1da177e4
LT
216 * is determined that the table is invalid, the call will fail.
217 *
218 ******************************************************************************/
4be44fcd 219acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
1da177e4 220{
4be44fcd 221 acpi_status status;
f3d2e786 222 acpi_native_uint table_index;
428f2112
AS
223 struct acpi_table_desc table_desc;
224
225 if (!table_ptr)
226 return AE_BAD_PARAMETER;
227
228 ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc));
229 table_desc.pointer = table_ptr;
230 table_desc.length = table_ptr->length;
231 table_desc.flags = ACPI_TABLE_ORIGIN_UNKNOWN;
1da177e4 232
f3d2e786
BM
233 /*
234 * Install the new table into the local data structures
235 */
428f2112 236 status = acpi_tb_add_table(&table_desc, &table_index);
4be44fcd 237 if (ACPI_FAILURE(status)) {
428f2112 238 return status;
0c9938cc 239 }
f3d2e786 240 status = acpi_ns_load_table(table_index, acpi_gbl_root_node);
428f2112 241 return status;
f3d2e786 242}
0c9938cc 243
f3d2e786 244ACPI_EXPORT_SYMBOL(acpi_load_table)
52fc0b02 245
f3d2e786
BM
246/******************************************************************************
247 *
248 * FUNCTION: acpi_get_table_header
249 *
250 * PARAMETERS: Signature - ACPI signature of needed table
251 * Instance - Which instance (for SSDTs)
428f2112 252 * out_table_header - The pointer to the table header to fill
f3d2e786
BM
253 *
254 * RETURN: Status and pointer to mapped table header
255 *
256 * DESCRIPTION: Finds an ACPI table header.
257 *
258 * NOTE: Caller is responsible in unmapping the header with
259 * acpi_os_unmap_memory
260 *
261 *****************************************************************************/
262acpi_status
263acpi_get_table_header(char *signature,
264 acpi_native_uint instance,
428f2112 265 struct acpi_table_header *out_table_header)
f3d2e786
BM
266{
267 acpi_native_uint i;
268 acpi_native_uint j;
428f2112 269 struct acpi_table_header *header;
0c9938cc 270
c5fc42ac
BM
271 /* Parameter validation */
272
273 if (!signature || !out_table_header) {
274 return (AE_BAD_PARAMETER);
275 }
276
f3d2e786
BM
277 /*
278 * Walk the root table list
279 */
280 for (i = 0, j = 0; i < acpi_gbl_root_table_list.count; i++) {
281 if (!ACPI_COMPARE_NAME
282 (&(acpi_gbl_root_table_list.tables[i].signature),
283 signature)) {
284 continue;
0c9938cc
RM
285 }
286
f3d2e786
BM
287 if (++j < instance) {
288 continue;
289 }
1da177e4 290
428f2112
AS
291 if (!acpi_gbl_root_table_list.tables[i].pointer) {
292 if ((acpi_gbl_root_table_list.tables[i].
293 flags & ACPI_TABLE_ORIGIN_MASK) ==
294 ACPI_TABLE_ORIGIN_MAPPED) {
295 header =
296 acpi_os_map_memory(acpi_gbl_root_table_list.
297 tables[i].address,
298 sizeof(struct
299 acpi_table_header));
300 if (!header) {
301 return AE_NO_MEMORY;
302 }
303 ACPI_MEMCPY(out_table_header, header,
304 sizeof(struct acpi_table_header));
305 acpi_os_unmap_memory(header,
306 sizeof(struct
307 acpi_table_header));
308 } else {
309 return AE_NOT_FOUND;
310 }
311 } else {
312 ACPI_MEMCPY(out_table_header,
313 acpi_gbl_root_table_list.tables[i].pointer,
314 sizeof(struct acpi_table_header));
f3d2e786 315 }
f3d2e786 316 return (AE_OK);
1da177e4
LT
317 }
318
f3d2e786 319 return (AE_NOT_FOUND);
1da177e4
LT
320}
321
f3d2e786 322ACPI_EXPORT_SYMBOL(acpi_get_table_header)
8313524a 323
f3d2e786
BM
324
325/******************************************************************************
0f0fe1a0
JK
326 *
327 * FUNCTION: acpi_unload_table_id
328 *
f3d2e786 329 * PARAMETERS: id - Owner ID of the table to be removed.
0f0fe1a0
JK
330 *
331 * RETURN: Status
332 *
333 * DESCRIPTION: This routine is used to force the unload of a table (by id)
334 *
335 ******************************************************************************/
f3d2e786 336acpi_status acpi_unload_table_id(acpi_owner_id id)
0f0fe1a0 337{
f3d2e786
BM
338 int i;
339 acpi_status status = AE_NOT_EXIST;
0f0fe1a0
JK
340
341 ACPI_FUNCTION_TRACE(acpi_unload_table);
342
0f0fe1a0 343 /* Find table from the requested type list */
f3d2e786
BM
344 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) {
345 if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
346 continue;
347 }
348 /*
349 * Delete all namespace objects owned by this table. Note that these
350 * objects can appear anywhere in the namespace by virtue of the AML
351 * "Scope" operator. Thus, we need to track ownership by an ID, not
352 * simply a position within the hierarchy
353 */
354 acpi_tb_delete_namespace_by_owner(i);
355 acpi_tb_release_owner_id(i);
356 acpi_tb_set_table_loaded_flag(i, FALSE);
357 }
358 return_ACPI_STATUS(status);
0f0fe1a0
JK
359}
360
361ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
362
1da177e4
LT
363/*******************************************************************************
364 *
f3d2e786 365 * FUNCTION: acpi_get_table
1da177e4 366 *
f3d2e786
BM
367 * PARAMETERS: Signature - ACPI signature of needed table
368 * Instance - Which instance (for SSDTs)
369 * out_table - Where the pointer to the table is returned
1da177e4 370 *
f3d2e786 371 * RETURN: Status and pointer to table
1da177e4 372 *
f3d2e786 373 * DESCRIPTION: Finds and verifies an ACPI table.
1da177e4 374 *
f3d2e786
BM
375 *****************************************************************************/
376acpi_status
377acpi_get_table(char *signature,
378 acpi_native_uint instance, struct acpi_table_header ** out_table)
1da177e4 379{
f3d2e786
BM
380 acpi_native_uint i;
381 acpi_native_uint j;
382 acpi_status status;
1da177e4 383
c5fc42ac
BM
384 /* Parameter validation */
385
386 if (!signature || !out_table) {
387 return (AE_BAD_PARAMETER);
388 }
389
f3d2e786
BM
390 /*
391 * Walk the root table list
392 */
393 for (i = 0, j = 0; i < acpi_gbl_root_table_list.count; i++) {
394 if (!ACPI_COMPARE_NAME
395 (&(acpi_gbl_root_table_list.tables[i].signature),
396 signature)) {
397 continue;
398 }
1da177e4 399
f3d2e786
BM
400 if (++j < instance) {
401 continue;
402 }
1da177e4 403
f3d2e786
BM
404 status =
405 acpi_tb_verify_table(&acpi_gbl_root_table_list.tables[i]);
406 if (ACPI_SUCCESS(status)) {
407 *out_table = acpi_gbl_root_table_list.tables[i].pointer;
408 }
f6dd9221 409
ad71860a
AS
410 if (!acpi_gbl_permanent_mmap) {
411 acpi_gbl_root_table_list.tables[i].pointer = 0;
412 }
413
f3d2e786 414 return (status);
1da177e4
LT
415 }
416
f3d2e786 417 return (AE_NOT_FOUND);
1da177e4
LT
418}
419
f3d2e786 420ACPI_EXPORT_SYMBOL(acpi_get_table)
8313524a 421
1da177e4
LT
422/*******************************************************************************
423 *
f3d2e786 424 * FUNCTION: acpi_get_table_by_index
1da177e4 425 *
f3d2e786
BM
426 * PARAMETERS: table_index - Table index
427 * Table - Where the pointer to the table is returned
1da177e4 428 *
f3d2e786 429 * RETURN: Status and pointer to the table
1da177e4 430 *
f3d2e786 431 * DESCRIPTION: Obtain a table by an index into the global table list.
1da177e4
LT
432 *
433 ******************************************************************************/
1da177e4 434acpi_status
f3d2e786
BM
435acpi_get_table_by_index(acpi_native_uint table_index,
436 struct acpi_table_header ** table)
1da177e4 437{
4be44fcd 438 acpi_status status;
1da177e4 439
f3d2e786 440 ACPI_FUNCTION_TRACE(acpi_get_table_by_index);
1da177e4 441
c5fc42ac
BM
442 /* Parameter validation */
443
444 if (!table) {
445 return_ACPI_STATUS(AE_BAD_PARAMETER);
446 }
447
f3d2e786 448 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
1da177e4 449
f3d2e786 450 /* Validate index */
1da177e4 451
f3d2e786
BM
452 if (table_index >= acpi_gbl_root_table_list.count) {
453 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
4be44fcd 454 return_ACPI_STATUS(AE_BAD_PARAMETER);
1da177e4
LT
455 }
456
f3d2e786 457 if (!acpi_gbl_root_table_list.tables[table_index].pointer) {
1da177e4 458
f3d2e786 459 /* Table is not mapped, map it */
1da177e4 460
f3d2e786
BM
461 status =
462 acpi_tb_verify_table(&acpi_gbl_root_table_list.
463 tables[table_index]);
464 if (ACPI_FAILURE(status)) {
465 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
466 return_ACPI_STATUS(status);
467 }
1da177e4
LT
468 }
469
f3d2e786
BM
470 *table = acpi_gbl_root_table_list.tables[table_index].pointer;
471 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
472 return_ACPI_STATUS(AE_OK);
1da177e4
LT
473}
474
f3d2e786 475ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)
1da177e4
LT
476
477/*******************************************************************************
478 *
f3d2e786 479 * FUNCTION: acpi_tb_load_namespace
1da177e4 480 *
f3d2e786 481 * PARAMETERS: None
1da177e4
LT
482 *
483 * RETURN: Status
484 *
f3d2e786
BM
485 * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
486 * the RSDT/XSDT.
1da177e4
LT
487 *
488 ******************************************************************************/
f3d2e786 489static acpi_status acpi_tb_load_namespace(void)
1da177e4 490{
4be44fcd 491 acpi_status status;
f3d2e786
BM
492 struct acpi_table_header *table;
493 acpi_native_uint i;
1da177e4 494
f3d2e786 495 ACPI_FUNCTION_TRACE(tb_load_namespace);
1da177e4 496
f3d2e786 497 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
1da177e4 498
f3d2e786
BM
499 /*
500 * Load the namespace. The DSDT is required, but any SSDT and PSDT tables
501 * are optional.
502 */
503 if (!acpi_gbl_root_table_list.count ||
504 !ACPI_COMPARE_NAME(&
505 (acpi_gbl_root_table_list.
506 tables[ACPI_TABLE_INDEX_DSDT].signature),
507 ACPI_SIG_DSDT)
508 ||
509 ACPI_FAILURE(acpi_tb_verify_table
510 (&acpi_gbl_root_table_list.
511 tables[ACPI_TABLE_INDEX_DSDT]))) {
512 status = AE_NO_ACPI_TABLES;
513 goto unlock_and_exit;
1da177e4
LT
514 }
515
f3d2e786
BM
516 /*
517 * Find DSDT table
518 */
519 status =
520 acpi_os_table_override(acpi_gbl_root_table_list.
521 tables[ACPI_TABLE_INDEX_DSDT].pointer,
522 &table);
523 if (ACPI_SUCCESS(status) && table) {
524 /*
525 * DSDT table has been found
526 */
527 acpi_tb_delete_table(ACPI_TABLE_INDEX_DSDT);
528 acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer =
529 table;
530 acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].length =
531 table->length;
532 acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].flags =
533 ACPI_TABLE_ORIGIN_UNKNOWN;
534
535 ACPI_INFO((AE_INFO, "Table DSDT replaced by host OS"));
536 acpi_tb_print_table_header(0, table);
1da177e4
LT
537 }
538
f3d2e786
BM
539 status =
540 acpi_tb_verify_table(&acpi_gbl_root_table_list.
541 tables[ACPI_TABLE_INDEX_DSDT]);
542 if (ACPI_FAILURE(status)) {
543
544 /* A valid DSDT is required */
1da177e4 545
f3d2e786
BM
546 status = AE_NO_ACPI_TABLES;
547 goto unlock_and_exit;
1da177e4
LT
548 }
549
f3d2e786 550 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
1da177e4 551
f3d2e786
BM
552 /*
553 * Load and parse tables.
554 */
555 status = acpi_ns_load_table(ACPI_TABLE_INDEX_DSDT, acpi_gbl_root_node);
4be44fcd
LB
556 if (ACPI_FAILURE(status)) {
557 return_ACPI_STATUS(status);
1da177e4
LT
558 }
559
560 /*
f3d2e786 561 * Load any SSDT or PSDT tables. Note: Loop leaves tables locked
1da177e4 562 */
f3d2e786
BM
563 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
564 for (i = 0; i < acpi_gbl_root_table_list.count; ++i) {
565 if ((!ACPI_COMPARE_NAME
566 (&(acpi_gbl_root_table_list.tables[i].signature),
567 ACPI_SIG_SSDT)
568 &&
569 !ACPI_COMPARE_NAME(&
570 (acpi_gbl_root_table_list.tables[i].
571 signature), ACPI_SIG_PSDT))
572 ||
573 ACPI_FAILURE(acpi_tb_verify_table
574 (&acpi_gbl_root_table_list.tables[i]))) {
575 continue;
576 }
577
578 /* Ignore errors while loading tables, get as many as possible */
579
580 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
581 (void)acpi_ns_load_table(i, acpi_gbl_root_node);
582 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
1da177e4
LT
583 }
584
f3d2e786 585 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
1da177e4 586
f3d2e786
BM
587 unlock_and_exit:
588 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
589 return_ACPI_STATUS(status);
590}
52fc0b02 591
f3d2e786
BM
592/*******************************************************************************
593 *
594 * FUNCTION: acpi_load_tables
595 *
596 * PARAMETERS: None
597 *
598 * RETURN: Status
599 *
600 * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
601 *
602 ******************************************************************************/
44f6c012 603
f3d2e786
BM
604acpi_status acpi_load_tables(void)
605{
606 acpi_status status;
1da177e4 607
f3d2e786 608 ACPI_FUNCTION_TRACE(acpi_load_tables);
1da177e4 609
f3d2e786
BM
610 /*
611 * Load the namespace from the tables
612 */
613 status = acpi_tb_load_namespace();
4be44fcd 614 if (ACPI_FAILURE(status)) {
f3d2e786
BM
615 ACPI_EXCEPTION((AE_INFO, status,
616 "While loading namespace from ACPI tables"));
1da177e4
LT
617 }
618
f3d2e786 619 return_ACPI_STATUS(status);
1da177e4 620}
1da177e4 621
f3d2e786 622ACPI_EXPORT_SYMBOL(acpi_load_tables)
This page took 0.180041 seconds and 5 git commands to generate.