.. | .. |
---|
3 | 3 | * |
---|
4 | 4 | * Module Name: tbxfload - Table load/unload external interfaces |
---|
5 | 5 | * |
---|
6 | | - * Copyright (C) 2000 - 2018, Intel Corp. |
---|
| 6 | + * Copyright (C) 2000 - 2020, Intel Corp. |
---|
7 | 7 | * |
---|
8 | 8 | *****************************************************************************/ |
---|
9 | 9 | |
---|
.. | .. |
---|
69 | 69 | "While loading namespace from ACPI tables")); |
---|
70 | 70 | } |
---|
71 | 71 | |
---|
72 | | - if (acpi_gbl_execute_tables_as_methods |
---|
73 | | - || !acpi_gbl_group_module_level_code) { |
---|
74 | | - /* |
---|
75 | | - * If the module-level code support is enabled, initialize the objects |
---|
76 | | - * in the namespace that remain uninitialized. This runs the executable |
---|
77 | | - * AML that may be part of the declaration of these name objects: |
---|
78 | | - * operation_regions, buffer_fields, Buffers, and Packages. |
---|
79 | | - * |
---|
80 | | - * Note: The module-level code is optional at this time, but will |
---|
81 | | - * become the default in the future. |
---|
82 | | - */ |
---|
83 | | - status = acpi_ns_initialize_objects(); |
---|
84 | | - if (ACPI_FAILURE(status)) { |
---|
85 | | - return_ACPI_STATUS(status); |
---|
86 | | - } |
---|
| 72 | + /* |
---|
| 73 | + * Initialize the objects in the namespace that remain uninitialized. |
---|
| 74 | + * This runs the executable AML that may be part of the declaration of |
---|
| 75 | + * these name objects: |
---|
| 76 | + * operation_regions, buffer_fields, Buffers, and Packages. |
---|
| 77 | + * |
---|
| 78 | + */ |
---|
| 79 | + status = acpi_ns_initialize_objects(); |
---|
| 80 | + if (ACPI_SUCCESS(status)) { |
---|
| 81 | + acpi_gbl_namespace_initialized = TRUE; |
---|
87 | 82 | } |
---|
88 | 83 | |
---|
89 | | - acpi_gbl_namespace_initialized = TRUE; |
---|
90 | 84 | return_ACPI_STATUS(status); |
---|
91 | 85 | } |
---|
92 | 86 | |
---|
.. | .. |
---|
124 | 118 | table = &acpi_gbl_root_table_list.tables[acpi_gbl_dsdt_index]; |
---|
125 | 119 | |
---|
126 | 120 | if (!acpi_gbl_root_table_list.current_table_count || |
---|
127 | | - !ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_DSDT) || |
---|
| 121 | + !ACPI_COMPARE_NAMESEG(table->signature.ascii, ACPI_SIG_DSDT) || |
---|
128 | 122 | ACPI_FAILURE(acpi_tb_validate_table(table))) { |
---|
129 | 123 | status = AE_NO_ACPI_TABLES; |
---|
130 | 124 | goto unlock_and_exit; |
---|
.. | .. |
---|
176 | 170 | table = &acpi_gbl_root_table_list.tables[i]; |
---|
177 | 171 | |
---|
178 | 172 | if (!table->address || |
---|
179 | | - (!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_SSDT) |
---|
180 | | - && !ACPI_COMPARE_NAME(table->signature.ascii, |
---|
181 | | - ACPI_SIG_PSDT) |
---|
182 | | - && !ACPI_COMPARE_NAME(table->signature.ascii, |
---|
183 | | - ACPI_SIG_OSDT)) |
---|
| 173 | + (!ACPI_COMPARE_NAMESEG |
---|
| 174 | + (table->signature.ascii, ACPI_SIG_SSDT) |
---|
| 175 | + && !ACPI_COMPARE_NAMESEG(table->signature.ascii, |
---|
| 176 | + ACPI_SIG_PSDT) |
---|
| 177 | + && !ACPI_COMPARE_NAMESEG(table->signature.ascii, |
---|
| 178 | + ACPI_SIG_OSDT)) |
---|
184 | 179 | || ACPI_FAILURE(acpi_tb_validate_table(table))) { |
---|
185 | 180 | continue; |
---|
186 | 181 | } |
---|
.. | .. |
---|
273 | 268 | * |
---|
274 | 269 | * PARAMETERS: table - Pointer to a buffer containing the ACPI |
---|
275 | 270 | * table to be loaded. |
---|
| 271 | + * table_idx - Pointer to a u32 for storing the table |
---|
| 272 | + * index, might be NULL |
---|
276 | 273 | * |
---|
277 | 274 | * RETURN: Status |
---|
278 | 275 | * |
---|
.. | .. |
---|
283 | 280 | * to ensure that the table is not deleted or unmapped. |
---|
284 | 281 | * |
---|
285 | 282 | ******************************************************************************/ |
---|
286 | | -acpi_status acpi_load_table(struct acpi_table_header *table) |
---|
| 283 | +acpi_status acpi_load_table(struct acpi_table_header *table, u32 *table_idx) |
---|
287 | 284 | { |
---|
288 | 285 | acpi_status status; |
---|
289 | 286 | u32 table_index; |
---|
.. | .. |
---|
302 | 299 | status = acpi_tb_install_and_load_table(ACPI_PTR_TO_PHYSADDR(table), |
---|
303 | 300 | ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, |
---|
304 | 301 | FALSE, &table_index); |
---|
| 302 | + if (table_idx) { |
---|
| 303 | + *table_idx = table_index; |
---|
| 304 | + } |
---|
| 305 | + |
---|
| 306 | + if (ACPI_SUCCESS(status)) { |
---|
| 307 | + |
---|
| 308 | + /* Complete the initialization/resolution of new objects */ |
---|
| 309 | + |
---|
| 310 | + acpi_ns_initialize_objects(); |
---|
| 311 | + } |
---|
| 312 | + |
---|
305 | 313 | return_ACPI_STATUS(status); |
---|
306 | 314 | } |
---|
307 | 315 | |
---|
.. | .. |
---|
370 | 378 | * only these types can contain AML and thus are the only types |
---|
371 | 379 | * that can create namespace objects. |
---|
372 | 380 | */ |
---|
373 | | - if (ACPI_COMPARE_NAME |
---|
| 381 | + if (ACPI_COMPARE_NAMESEG |
---|
374 | 382 | (acpi_gbl_root_table_list.tables[i].signature.ascii, |
---|
375 | 383 | ACPI_SIG_DSDT)) { |
---|
376 | 384 | status = AE_TYPE; |
---|
.. | .. |
---|
388 | 396 | } |
---|
389 | 397 | |
---|
390 | 398 | ACPI_EXPORT_SYMBOL(acpi_unload_parent_table) |
---|
| 399 | +/******************************************************************************* |
---|
| 400 | + * |
---|
| 401 | + * FUNCTION: acpi_unload_table |
---|
| 402 | + * |
---|
| 403 | + * PARAMETERS: table_index - Index as returned by acpi_load_table |
---|
| 404 | + * |
---|
| 405 | + * RETURN: Status |
---|
| 406 | + * |
---|
| 407 | + * DESCRIPTION: Via the table_index representing an SSDT or OEMx table, unloads |
---|
| 408 | + * the table and deletes all namespace objects associated with |
---|
| 409 | + * that table. Unloading of the DSDT is not allowed. |
---|
| 410 | + * Note: Mainly intended to support hotplug removal of SSDTs. |
---|
| 411 | + * |
---|
| 412 | + ******************************************************************************/ |
---|
| 413 | +acpi_status acpi_unload_table(u32 table_index) |
---|
| 414 | +{ |
---|
| 415 | + acpi_status status; |
---|
| 416 | + |
---|
| 417 | + ACPI_FUNCTION_TRACE(acpi_unload_table); |
---|
| 418 | + |
---|
| 419 | + if (table_index == 1) { |
---|
| 420 | + |
---|
| 421 | + /* table_index==1 means DSDT is the owner. DSDT cannot be unloaded */ |
---|
| 422 | + |
---|
| 423 | + return_ACPI_STATUS(AE_TYPE); |
---|
| 424 | + } |
---|
| 425 | + |
---|
| 426 | + status = acpi_tb_unload_table(table_index); |
---|
| 427 | + return_ACPI_STATUS(status); |
---|
| 428 | +} |
---|
| 429 | + |
---|
| 430 | +ACPI_EXPORT_SYMBOL(acpi_unload_table) |
---|