tbinstal.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /******************************************************************************
  2. *
  3. * Module Name: tbinstal - ACPI table installation and removal
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2011, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #include <acpi/acpi.h>
  43. #include "accommon.h"
  44. #include "acnamesp.h"
  45. #include "actables.h"
  46. #define _COMPONENT ACPI_TABLES
  47. ACPI_MODULE_NAME("tbinstal")
  48. /******************************************************************************
  49. *
  50. * FUNCTION: acpi_tb_verify_table
  51. *
  52. * PARAMETERS: table_desc - table
  53. *
  54. * RETURN: Status
  55. *
  56. * DESCRIPTION: this function is called to verify and map table
  57. *
  58. *****************************************************************************/
  59. acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc)
  60. {
  61. acpi_status status = AE_OK;
  62. ACPI_FUNCTION_TRACE(tb_verify_table);
  63. /* Map the table if necessary */
  64. if (!table_desc->pointer) {
  65. if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) ==
  66. ACPI_TABLE_ORIGIN_MAPPED) {
  67. table_desc->pointer =
  68. acpi_os_map_memory(table_desc->address,
  69. table_desc->length);
  70. }
  71. if (!table_desc->pointer) {
  72. return_ACPI_STATUS(AE_NO_MEMORY);
  73. }
  74. }
  75. /* FACS is the odd table, has no standard ACPI header and no checksum */
  76. if (!ACPI_COMPARE_NAME(&table_desc->signature, ACPI_SIG_FACS)) {
  77. /* Always calculate checksum, ignore bad checksum if requested */
  78. status =
  79. acpi_tb_verify_checksum(table_desc->pointer,
  80. table_desc->length);
  81. }
  82. return_ACPI_STATUS(status);
  83. }
  84. /*******************************************************************************
  85. *
  86. * FUNCTION: acpi_tb_add_table
  87. *
  88. * PARAMETERS: table_desc - Table descriptor
  89. * table_index - Where the table index is returned
  90. *
  91. * RETURN: Status
  92. *
  93. * DESCRIPTION: This function is called to add an ACPI table. It is used to
  94. * dynamically load tables via the Load and load_table AML
  95. * operators.
  96. *
  97. ******************************************************************************/
  98. acpi_status
  99. acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
  100. {
  101. u32 i;
  102. acpi_status status = AE_OK;
  103. struct acpi_table_header *override_table = NULL;
  104. ACPI_FUNCTION_TRACE(tb_add_table);
  105. if (!table_desc->pointer) {
  106. status = acpi_tb_verify_table(table_desc);
  107. if (ACPI_FAILURE(status) || !table_desc->pointer) {
  108. return_ACPI_STATUS(status);
  109. }
  110. }
  111. /*
  112. * Validate the incoming table signature.
  113. *
  114. * 1) Originally, we checked the table signature for "SSDT" or "PSDT".
  115. * 2) We added support for OEMx tables, signature "OEM".
  116. * 3) Valid tables were encountered with a null signature, so we just
  117. * gave up on validating the signature, (05/2008).
  118. * 4) We encountered non-AML tables such as the MADT, which caused
  119. * interpreter errors and kernel faults. So now, we once again allow
  120. * only "SSDT", "OEMx", and now, also a null signature. (05/2011).
  121. */
  122. if ((table_desc->pointer->signature[0] != 0x00) &&
  123. (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT))
  124. && (ACPI_STRNCMP(table_desc->pointer->signature, "OEM", 3))) {
  125. ACPI_ERROR((AE_INFO,
  126. "Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx",
  127. acpi_ut_valid_acpi_name(*(u32 *)table_desc->
  128. pointer->
  129. signature) ? table_desc->
  130. pointer->signature : "????",
  131. *(u32 *)table_desc->pointer->signature));
  132. return_ACPI_STATUS(AE_BAD_SIGNATURE);
  133. }
  134. (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  135. /* Check if table is already registered */
  136. for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
  137. if (!acpi_gbl_root_table_list.tables[i].pointer) {
  138. status =
  139. acpi_tb_verify_table(&acpi_gbl_root_table_list.
  140. tables[i]);
  141. if (ACPI_FAILURE(status)
  142. || !acpi_gbl_root_table_list.tables[i].pointer) {
  143. continue;
  144. }
  145. }
  146. /*
  147. * Check for a table match on the entire table length,
  148. * not just the header.
  149. */
  150. if (table_desc->length !=
  151. acpi_gbl_root_table_list.tables[i].length) {
  152. continue;
  153. }
  154. if (ACPI_MEMCMP(table_desc->pointer,
  155. acpi_gbl_root_table_list.tables[i].pointer,
  156. acpi_gbl_root_table_list.tables[i].length)) {
  157. continue;
  158. }
  159. /*
  160. * Note: the current mechanism does not unregister a table if it is
  161. * dynamically unloaded. The related namespace entries are deleted,
  162. * but the table remains in the root table list.
  163. *
  164. * The assumption here is that the number of different tables that
  165. * will be loaded is actually small, and there is minimal overhead
  166. * in just keeping the table in case it is needed again.
  167. *
  168. * If this assumption changes in the future (perhaps on large
  169. * machines with many table load/unload operations), tables will
  170. * need to be unregistered when they are unloaded, and slots in the
  171. * root table list should be reused when empty.
  172. */
  173. /*
  174. * Table is already registered.
  175. * We can delete the table that was passed as a parameter.
  176. */
  177. acpi_tb_delete_table(table_desc);
  178. *table_index = i;
  179. if (acpi_gbl_root_table_list.tables[i].
  180. flags & ACPI_TABLE_IS_LOADED) {
  181. /* Table is still loaded, this is an error */
  182. status = AE_ALREADY_EXISTS;
  183. goto release;
  184. } else {
  185. /* Table was unloaded, allow it to be reloaded */
  186. table_desc->pointer =
  187. acpi_gbl_root_table_list.tables[i].pointer;
  188. table_desc->address =
  189. acpi_gbl_root_table_list.tables[i].address;
  190. status = AE_OK;
  191. goto print_header;
  192. }
  193. }
  194. /*
  195. * ACPI Table Override:
  196. * Allow the host to override dynamically loaded tables.
  197. */
  198. status = acpi_os_table_override(table_desc->pointer, &override_table);
  199. if (ACPI_SUCCESS(status) && override_table) {
  200. ACPI_INFO((AE_INFO,
  201. "%4.4s @ 0x%p Table override, replaced with:",
  202. table_desc->pointer->signature,
  203. ACPI_CAST_PTR(void, table_desc->address)));
  204. /* We can delete the table that was passed as a parameter */
  205. acpi_tb_delete_table(table_desc);
  206. /* Setup descriptor for the new table */
  207. table_desc->address = ACPI_PTR_TO_PHYSADDR(override_table);
  208. table_desc->pointer = override_table;
  209. table_desc->length = override_table->length;
  210. table_desc->flags = ACPI_TABLE_ORIGIN_OVERRIDE;
  211. }
  212. /* Add the table to the global root table list */
  213. status = acpi_tb_store_table(table_desc->address, table_desc->pointer,
  214. table_desc->length, table_desc->flags,
  215. table_index);
  216. if (ACPI_FAILURE(status)) {
  217. goto release;
  218. }
  219. print_header:
  220. acpi_tb_print_table_header(table_desc->address, table_desc->pointer);
  221. release:
  222. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  223. return_ACPI_STATUS(status);
  224. }
  225. /*******************************************************************************
  226. *
  227. * FUNCTION: acpi_tb_resize_root_table_list
  228. *
  229. * PARAMETERS: None
  230. *
  231. * RETURN: Status
  232. *
  233. * DESCRIPTION: Expand the size of global table array
  234. *
  235. ******************************************************************************/
  236. acpi_status acpi_tb_resize_root_table_list(void)
  237. {
  238. struct acpi_table_desc *tables;
  239. ACPI_FUNCTION_TRACE(tb_resize_root_table_list);
  240. /* allow_resize flag is a parameter to acpi_initialize_tables */
  241. if (!(acpi_gbl_root_table_list.flags & ACPI_ROOT_ALLOW_RESIZE)) {
  242. ACPI_ERROR((AE_INFO,
  243. "Resize of Root Table Array is not allowed"));
  244. return_ACPI_STATUS(AE_SUPPORT);
  245. }
  246. /* Increase the Table Array size */
  247. tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list.
  248. max_table_count +
  249. ACPI_ROOT_TABLE_SIZE_INCREMENT) *
  250. sizeof(struct acpi_table_desc));
  251. if (!tables) {
  252. ACPI_ERROR((AE_INFO,
  253. "Could not allocate new root table array"));
  254. return_ACPI_STATUS(AE_NO_MEMORY);
  255. }
  256. /* Copy and free the previous table array */
  257. if (acpi_gbl_root_table_list.tables) {
  258. ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables,
  259. (acpi_size) acpi_gbl_root_table_list.
  260. max_table_count * sizeof(struct acpi_table_desc));
  261. if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
  262. ACPI_FREE(acpi_gbl_root_table_list.tables);
  263. }
  264. }
  265. acpi_gbl_root_table_list.tables = tables;
  266. acpi_gbl_root_table_list.max_table_count +=
  267. ACPI_ROOT_TABLE_SIZE_INCREMENT;
  268. acpi_gbl_root_table_list.flags |= (u8)ACPI_ROOT_ORIGIN_ALLOCATED;
  269. return_ACPI_STATUS(AE_OK);
  270. }
  271. /*******************************************************************************
  272. *
  273. * FUNCTION: acpi_tb_store_table
  274. *
  275. * PARAMETERS: Address - Table address
  276. * Table - Table header
  277. * Length - Table length
  278. * Flags - flags
  279. *
  280. * RETURN: Status and table index.
  281. *
  282. * DESCRIPTION: Add an ACPI table to the global table list
  283. *
  284. ******************************************************************************/
  285. acpi_status
  286. acpi_tb_store_table(acpi_physical_address address,
  287. struct acpi_table_header *table,
  288. u32 length, u8 flags, u32 *table_index)
  289. {
  290. acpi_status status;
  291. struct acpi_table_desc *new_table;
  292. /* Ensure that there is room for the table in the Root Table List */
  293. if (acpi_gbl_root_table_list.current_table_count >=
  294. acpi_gbl_root_table_list.max_table_count) {
  295. status = acpi_tb_resize_root_table_list();
  296. if (ACPI_FAILURE(status)) {
  297. return (status);
  298. }
  299. }
  300. new_table =
  301. &acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.
  302. current_table_count];
  303. /* Initialize added table */
  304. new_table->address = address;
  305. new_table->pointer = table;
  306. new_table->length = length;
  307. new_table->owner_id = 0;
  308. new_table->flags = flags;
  309. ACPI_MOVE_32_TO_32(&new_table->signature, table->signature);
  310. *table_index = acpi_gbl_root_table_list.current_table_count;
  311. acpi_gbl_root_table_list.current_table_count++;
  312. return (AE_OK);
  313. }
  314. /*******************************************************************************
  315. *
  316. * FUNCTION: acpi_tb_delete_table
  317. *
  318. * PARAMETERS: table_index - Table index
  319. *
  320. * RETURN: None
  321. *
  322. * DESCRIPTION: Delete one internal ACPI table
  323. *
  324. ******************************************************************************/
  325. void acpi_tb_delete_table(struct acpi_table_desc *table_desc)
  326. {
  327. /* Table must be mapped or allocated */
  328. if (!table_desc->pointer) {
  329. return;
  330. }
  331. switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) {
  332. case ACPI_TABLE_ORIGIN_MAPPED:
  333. acpi_os_unmap_memory(table_desc->pointer, table_desc->length);
  334. break;
  335. case ACPI_TABLE_ORIGIN_ALLOCATED:
  336. ACPI_FREE(table_desc->pointer);
  337. break;
  338. default:;
  339. }
  340. table_desc->pointer = NULL;
  341. }
  342. /*******************************************************************************
  343. *
  344. * FUNCTION: acpi_tb_terminate
  345. *
  346. * PARAMETERS: None
  347. *
  348. * RETURN: None
  349. *
  350. * DESCRIPTION: Delete all internal ACPI tables
  351. *
  352. ******************************************************************************/
  353. void acpi_tb_terminate(void)
  354. {
  355. u32 i;
  356. ACPI_FUNCTION_TRACE(tb_terminate);
  357. (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  358. /* Delete the individual tables */
  359. for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) {
  360. acpi_tb_delete_table(&acpi_gbl_root_table_list.tables[i]);
  361. }
  362. /*
  363. * Delete the root table array if allocated locally. Array cannot be
  364. * mapped, so we don't need to check for that flag.
  365. */
  366. if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
  367. ACPI_FREE(acpi_gbl_root_table_list.tables);
  368. }
  369. acpi_gbl_root_table_list.tables = NULL;
  370. acpi_gbl_root_table_list.flags = 0;
  371. acpi_gbl_root_table_list.current_table_count = 0;
  372. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
  373. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  374. }
  375. /*******************************************************************************
  376. *
  377. * FUNCTION: acpi_tb_delete_namespace_by_owner
  378. *
  379. * PARAMETERS: table_index - Table index
  380. *
  381. * RETURN: Status
  382. *
  383. * DESCRIPTION: Delete all namespace objects created when this table was loaded.
  384. *
  385. ******************************************************************************/
  386. acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index)
  387. {
  388. acpi_owner_id owner_id;
  389. acpi_status status;
  390. ACPI_FUNCTION_TRACE(tb_delete_namespace_by_owner);
  391. status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  392. if (ACPI_FAILURE(status)) {
  393. return_ACPI_STATUS(status);
  394. }
  395. if (table_index >= acpi_gbl_root_table_list.current_table_count) {
  396. /* The table index does not exist */
  397. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  398. return_ACPI_STATUS(AE_NOT_EXIST);
  399. }
  400. /* Get the owner ID for this table, used to delete namespace nodes */
  401. owner_id = acpi_gbl_root_table_list.tables[table_index].owner_id;
  402. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  403. /*
  404. * Need to acquire the namespace writer lock to prevent interference
  405. * with any concurrent namespace walks. The interpreter must be
  406. * released during the deletion since the acquisition of the deletion
  407. * lock may block, and also since the execution of a namespace walk
  408. * must be allowed to use the interpreter.
  409. */
  410. (void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
  411. status = acpi_ut_acquire_write_lock(&acpi_gbl_namespace_rw_lock);
  412. acpi_ns_delete_namespace_by_owner(owner_id);
  413. if (ACPI_FAILURE(status)) {
  414. return_ACPI_STATUS(status);
  415. }
  416. acpi_ut_release_write_lock(&acpi_gbl_namespace_rw_lock);
  417. status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
  418. return_ACPI_STATUS(status);
  419. }
  420. /*******************************************************************************
  421. *
  422. * FUNCTION: acpi_tb_allocate_owner_id
  423. *
  424. * PARAMETERS: table_index - Table index
  425. *
  426. * RETURN: Status
  427. *
  428. * DESCRIPTION: Allocates owner_id in table_desc
  429. *
  430. ******************************************************************************/
  431. acpi_status acpi_tb_allocate_owner_id(u32 table_index)
  432. {
  433. acpi_status status = AE_BAD_PARAMETER;
  434. ACPI_FUNCTION_TRACE(tb_allocate_owner_id);
  435. (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  436. if (table_index < acpi_gbl_root_table_list.current_table_count) {
  437. status = acpi_ut_allocate_owner_id
  438. (&(acpi_gbl_root_table_list.tables[table_index].owner_id));
  439. }
  440. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  441. return_ACPI_STATUS(status);
  442. }
  443. /*******************************************************************************
  444. *
  445. * FUNCTION: acpi_tb_release_owner_id
  446. *
  447. * PARAMETERS: table_index - Table index
  448. *
  449. * RETURN: Status
  450. *
  451. * DESCRIPTION: Releases owner_id in table_desc
  452. *
  453. ******************************************************************************/
  454. acpi_status acpi_tb_release_owner_id(u32 table_index)
  455. {
  456. acpi_status status = AE_BAD_PARAMETER;
  457. ACPI_FUNCTION_TRACE(tb_release_owner_id);
  458. (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  459. if (table_index < acpi_gbl_root_table_list.current_table_count) {
  460. acpi_ut_release_owner_id(&
  461. (acpi_gbl_root_table_list.
  462. tables[table_index].owner_id));
  463. status = AE_OK;
  464. }
  465. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  466. return_ACPI_STATUS(status);
  467. }
  468. /*******************************************************************************
  469. *
  470. * FUNCTION: acpi_tb_get_owner_id
  471. *
  472. * PARAMETERS: table_index - Table index
  473. * owner_id - Where the table owner_id is returned
  474. *
  475. * RETURN: Status
  476. *
  477. * DESCRIPTION: returns owner_id for the ACPI table
  478. *
  479. ******************************************************************************/
  480. acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id)
  481. {
  482. acpi_status status = AE_BAD_PARAMETER;
  483. ACPI_FUNCTION_TRACE(tb_get_owner_id);
  484. (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  485. if (table_index < acpi_gbl_root_table_list.current_table_count) {
  486. *owner_id =
  487. acpi_gbl_root_table_list.tables[table_index].owner_id;
  488. status = AE_OK;
  489. }
  490. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  491. return_ACPI_STATUS(status);
  492. }
  493. /*******************************************************************************
  494. *
  495. * FUNCTION: acpi_tb_is_table_loaded
  496. *
  497. * PARAMETERS: table_index - Table index
  498. *
  499. * RETURN: Table Loaded Flag
  500. *
  501. ******************************************************************************/
  502. u8 acpi_tb_is_table_loaded(u32 table_index)
  503. {
  504. u8 is_loaded = FALSE;
  505. (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  506. if (table_index < acpi_gbl_root_table_list.current_table_count) {
  507. is_loaded = (u8)
  508. (acpi_gbl_root_table_list.tables[table_index].flags &
  509. ACPI_TABLE_IS_LOADED);
  510. }
  511. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  512. return (is_loaded);
  513. }
  514. /*******************************************************************************
  515. *
  516. * FUNCTION: acpi_tb_set_table_loaded_flag
  517. *
  518. * PARAMETERS: table_index - Table index
  519. * is_loaded - TRUE if table is loaded, FALSE otherwise
  520. *
  521. * RETURN: None
  522. *
  523. * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE.
  524. *
  525. ******************************************************************************/
  526. void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded)
  527. {
  528. (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
  529. if (table_index < acpi_gbl_root_table_list.current_table_count) {
  530. if (is_loaded) {
  531. acpi_gbl_root_table_list.tables[table_index].flags |=
  532. ACPI_TABLE_IS_LOADED;
  533. } else {
  534. acpi_gbl_root_table_list.tables[table_index].flags &=
  535. ~ACPI_TABLE_IS_LOADED;
  536. }
  537. }
  538. (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  539. }