xref: /titanic_44/usr/src/uts/intel/io/acpica/tables/tbinstal.c (revision 2d6b5ea734bb47d251c82670646fde46af15fd69)
1 /******************************************************************************
2  *
3  * Module Name: tbinstal - ACPI table installation and removal
4  *              $Revision: 1.94 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 
118 #define __TBINSTAL_C__
119 
120 #include "acpi.h"
121 #include "acnamesp.h"
122 #include "actables.h"
123 
124 
125 #define _COMPONENT          ACPI_TABLES
126         ACPI_MODULE_NAME    ("tbinstal")
127 
128 
129 /******************************************************************************
130  *
131  * FUNCTION:    AcpiTbVerifyTable
132  *
133  * PARAMETERS:  TableDesc           - table
134  *
135  * RETURN:      Status
136  *
137  * DESCRIPTION: this function is called to verify and map table
138  *
139  *****************************************************************************/
140 
141 ACPI_STATUS
142 AcpiTbVerifyTable (
143     ACPI_TABLE_DESC         *TableDesc)
144 {
145     ACPI_STATUS             Status = AE_OK;
146 
147 
148     ACPI_FUNCTION_TRACE (TbVerifyTable);
149 
150 
151     /* Map the table if necessary */
152 
153     if (!TableDesc->Pointer)
154     {
155         if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
156             ACPI_TABLE_ORIGIN_MAPPED)
157         {
158             TableDesc->Pointer = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length);
159         }
160 
161         if (!TableDesc->Pointer)
162         {
163             return_ACPI_STATUS (AE_NO_MEMORY);
164         }
165     }
166 
167     /* FACS is the odd table, has no standard ACPI header and no checksum */
168 
169     if (!ACPI_COMPARE_NAME (&TableDesc->Signature, ACPI_SIG_FACS))
170     {
171         /* Always calculate checksum, ignore bad checksum if requested */
172 
173         Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
174     }
175 
176     return_ACPI_STATUS (Status);
177 }
178 
179 
180 /*******************************************************************************
181  *
182  * FUNCTION:    AcpiTbAddTable
183  *
184  * PARAMETERS:  TableDesc           - Table descriptor
185  *              TableIndex          - Where the table index is returned
186  *
187  * RETURN:      Status
188  *
189  * DESCRIPTION: This function is called to add the ACPI table
190  *
191  ******************************************************************************/
192 
193 ACPI_STATUS
194 AcpiTbAddTable (
195     ACPI_TABLE_DESC         *TableDesc,
196     UINT32                  *TableIndex)
197 {
198     UINT32                  i;
199     ACPI_STATUS             Status = AE_OK;
200 
201 
202     ACPI_FUNCTION_TRACE (TbAddTable);
203 
204 
205     if (!TableDesc->Pointer)
206     {
207         Status = AcpiTbVerifyTable (TableDesc);
208         if (ACPI_FAILURE (Status) || !TableDesc->Pointer)
209         {
210             return_ACPI_STATUS (Status);
211         }
212     }
213 
214     /*
215      * Originally, we checked the table signature for "SSDT" or "PSDT" here.
216      * Next, we added support for OEMx tables, signature "OEM".
217      * Valid tables were encountered with a null signature, so we've just
218      * given up on validating the signature, since it seems to be a waste
219      * of code. The original code was removed (05/2008).
220      */
221 
222     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
223 
224     /* Check if table is already registered */
225 
226     for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
227     {
228         if (!AcpiGbl_RootTableList.Tables[i].Pointer)
229         {
230             Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
231             if (ACPI_FAILURE (Status) || !AcpiGbl_RootTableList.Tables[i].Pointer)
232             {
233                 continue;
234             }
235         }
236 
237         /*
238          * Check for a table match on the entire table length,
239          * not just the header.
240          */
241         if (TableDesc->Length != AcpiGbl_RootTableList.Tables[i].Length)
242         {
243             continue;
244         }
245 
246         if (ACPI_MEMCMP (TableDesc->Pointer,
247                 AcpiGbl_RootTableList.Tables[i].Pointer,
248                 AcpiGbl_RootTableList.Tables[i].Length))
249         {
250             continue;
251         }
252 
253         /*
254          * Note: the current mechanism does not unregister a table if it is
255          * dynamically unloaded. The related namespace entries are deleted,
256          * but the table remains in the root table list.
257          *
258          * The assumption here is that the number of different tables that
259          * will be loaded is actually small, and there is minimal overhead
260          * in just keeping the table in case it is needed again.
261          *
262          * If this assumption changes in the future (perhaps on large
263          * machines with many table load/unload operations), tables will
264          * need to be unregistered when they are unloaded, and slots in the
265          * root table list should be reused when empty.
266          */
267 
268         /*
269          * Table is already registered.
270          * We can delete the table that was passed as a parameter.
271          */
272         AcpiTbDeleteTable (TableDesc);
273         *TableIndex = i;
274 
275         if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED)
276         {
277             /* Table is still loaded, this is an error */
278 
279             Status = AE_ALREADY_EXISTS;
280             goto Release;
281         }
282         else
283         {
284             /* Table was unloaded, allow it to be reloaded */
285 
286             TableDesc->Pointer = AcpiGbl_RootTableList.Tables[i].Pointer;
287             TableDesc->Address = AcpiGbl_RootTableList.Tables[i].Address;
288             Status = AE_OK;
289             goto PrintHeader;
290         }
291     }
292 
293     /* Add the table to the global root table list */
294 
295     Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer,
296                 TableDesc->Length, TableDesc->Flags, TableIndex);
297     if (ACPI_FAILURE (Status))
298     {
299         goto Release;
300     }
301 
302 PrintHeader:
303     AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
304 
305 Release:
306     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
307     return_ACPI_STATUS (Status);
308 }
309 
310 
311 /*******************************************************************************
312  *
313  * FUNCTION:    AcpiTbResizeRootTableList
314  *
315  * PARAMETERS:  None
316  *
317  * RETURN:      Status
318  *
319  * DESCRIPTION: Expand the size of global table array
320  *
321  ******************************************************************************/
322 
323 ACPI_STATUS
324 AcpiTbResizeRootTableList (
325     void)
326 {
327     ACPI_TABLE_DESC         *Tables;
328 
329 
330     ACPI_FUNCTION_TRACE (TbResizeRootTableList);
331 
332 
333     /* AllowResize flag is a parameter to AcpiInitializeTables */
334 
335     if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
336     {
337         ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
338         return_ACPI_STATUS (AE_SUPPORT);
339     }
340 
341     /* Increase the Table Array size */
342 
343     Tables = ACPI_ALLOCATE_ZEROED (
344         ((ACPI_SIZE) AcpiGbl_RootTableList.Size + ACPI_ROOT_TABLE_SIZE_INCREMENT)
345         * sizeof (ACPI_TABLE_DESC));
346     if (!Tables)
347     {
348         ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
349         return_ACPI_STATUS (AE_NO_MEMORY);
350     }
351 
352     /* Copy and free the previous table array */
353 
354     if (AcpiGbl_RootTableList.Tables)
355     {
356         ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
357             (ACPI_SIZE) AcpiGbl_RootTableList.Size * sizeof (ACPI_TABLE_DESC));
358 
359         if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
360         {
361             ACPI_FREE (AcpiGbl_RootTableList.Tables);
362         }
363     }
364 
365     AcpiGbl_RootTableList.Tables = Tables;
366     AcpiGbl_RootTableList.Size += ACPI_ROOT_TABLE_SIZE_INCREMENT;
367     AcpiGbl_RootTableList.Flags |= (UINT8) ACPI_ROOT_ORIGIN_ALLOCATED;
368 
369     return_ACPI_STATUS (AE_OK);
370 }
371 
372 
373 /*******************************************************************************
374  *
375  * FUNCTION:    AcpiTbStoreTable
376  *
377  * PARAMETERS:  Address             - Table address
378  *              Table               - Table header
379  *              Length              - Table length
380  *              Flags               - flags
381  *
382  * RETURN:      Status and table index.
383  *
384  * DESCRIPTION: Add an ACPI table to the global table list
385  *
386  ******************************************************************************/
387 
388 ACPI_STATUS
389 AcpiTbStoreTable (
390     ACPI_PHYSICAL_ADDRESS   Address,
391     ACPI_TABLE_HEADER       *Table,
392     UINT32                  Length,
393     UINT8                   Flags,
394     UINT32                  *TableIndex)
395 {
396     ACPI_STATUS             Status = AE_OK;
397 
398 
399     /* Ensure that there is room for the table in the Root Table List */
400 
401     if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
402     {
403         Status = AcpiTbResizeRootTableList();
404         if (ACPI_FAILURE (Status))
405         {
406             return (Status);
407         }
408     }
409 
410     /* Initialize added table */
411 
412     AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address = Address;
413     AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Pointer = Table;
414     AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Length = Length;
415     AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].OwnerId = 0;
416     AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Flags = Flags;
417 
418     ACPI_MOVE_32_TO_32 (
419         &(AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Signature),
420         Table->Signature);
421 
422     *TableIndex = AcpiGbl_RootTableList.Count;
423     AcpiGbl_RootTableList.Count++;
424     return (Status);
425 }
426 
427 
428 /*******************************************************************************
429  *
430  * FUNCTION:    AcpiTbDeleteTable
431  *
432  * PARAMETERS:  TableIndex          - Table index
433  *
434  * RETURN:      None
435  *
436  * DESCRIPTION: Delete one internal ACPI table
437  *
438  ******************************************************************************/
439 
440 void
441 AcpiTbDeleteTable (
442     ACPI_TABLE_DESC         *TableDesc)
443 {
444 
445     /* Table must be mapped or allocated */
446 
447     if (!TableDesc->Pointer)
448     {
449         return;
450     }
451 
452     switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
453     {
454     case ACPI_TABLE_ORIGIN_MAPPED:
455         AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
456         break;
457 
458     case ACPI_TABLE_ORIGIN_ALLOCATED:
459         ACPI_FREE (TableDesc->Pointer);
460         break;
461 
462     default:
463         break;
464     }
465 
466     TableDesc->Pointer = NULL;
467 }
468 
469 
470 /*******************************************************************************
471  *
472  * FUNCTION:    AcpiTbTerminate
473  *
474  * PARAMETERS:  None
475  *
476  * RETURN:      None
477  *
478  * DESCRIPTION: Delete all internal ACPI tables
479  *
480  ******************************************************************************/
481 
482 void
483 AcpiTbTerminate (
484     void)
485 {
486     UINT32                  i;
487 
488 
489     ACPI_FUNCTION_TRACE (TbTerminate);
490 
491 
492     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
493 
494     /* Delete the individual tables */
495 
496     for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
497     {
498         AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
499     }
500 
501     /*
502      * Delete the root table array if allocated locally. Array cannot be
503      * mapped, so we don't need to check for that flag.
504      */
505     if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
506     {
507         ACPI_FREE (AcpiGbl_RootTableList.Tables);
508     }
509 
510     AcpiGbl_RootTableList.Tables = NULL;
511     AcpiGbl_RootTableList.Flags = 0;
512     AcpiGbl_RootTableList.Count = 0;
513 
514     ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
515     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
516 }
517 
518 
519 /*******************************************************************************
520  *
521  * FUNCTION:    AcpiTbDeleteNamespaceByOwner
522  *
523  * PARAMETERS:  TableIndex          - Table index
524  *
525  * RETURN:      None
526  *
527  * DESCRIPTION: Delete all namespace objects created when this table was loaded.
528  *
529  ******************************************************************************/
530 
531 void
532 AcpiTbDeleteNamespaceByOwner (
533     UINT32                  TableIndex)
534 {
535     ACPI_OWNER_ID           OwnerId;
536 
537 
538     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
539     if (TableIndex < AcpiGbl_RootTableList.Count)
540     {
541         OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
542     }
543     else
544     {
545         (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
546         return;
547     }
548 
549     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
550     AcpiNsDeleteNamespaceByOwner (OwnerId);
551 }
552 
553 
554 /*******************************************************************************
555  *
556  * FUNCTION:    AcpiTbAllocateOwnerId
557  *
558  * PARAMETERS:  TableIndex          - Table index
559  *
560  * RETURN:      Status
561  *
562  * DESCRIPTION: Allocates OwnerId in TableDesc
563  *
564  ******************************************************************************/
565 
566 ACPI_STATUS
567 AcpiTbAllocateOwnerId (
568     UINT32                  TableIndex)
569 {
570     ACPI_STATUS             Status = AE_BAD_PARAMETER;
571 
572 
573     ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
574 
575 
576     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
577     if (TableIndex < AcpiGbl_RootTableList.Count)
578     {
579         Status = AcpiUtAllocateOwnerId
580                     (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
581     }
582 
583     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
584     return_ACPI_STATUS (Status);
585 }
586 
587 
588 /*******************************************************************************
589  *
590  * FUNCTION:    AcpiTbReleaseOwnerId
591  *
592  * PARAMETERS:  TableIndex          - Table index
593  *
594  * RETURN:      Status
595  *
596  * DESCRIPTION: Releases OwnerId in TableDesc
597  *
598  ******************************************************************************/
599 
600 ACPI_STATUS
601 AcpiTbReleaseOwnerId (
602     UINT32                  TableIndex)
603 {
604     ACPI_STATUS             Status = AE_BAD_PARAMETER;
605 
606 
607     ACPI_FUNCTION_TRACE (TbReleaseOwnerId);
608 
609 
610     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
611     if (TableIndex < AcpiGbl_RootTableList.Count)
612     {
613         AcpiUtReleaseOwnerId (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
614         Status = AE_OK;
615     }
616 
617     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
618     return_ACPI_STATUS (Status);
619 }
620 
621 
622 /*******************************************************************************
623  *
624  * FUNCTION:    AcpiTbGetOwnerId
625  *
626  * PARAMETERS:  TableIndex          - Table index
627  *              OwnerId             - Where the table OwnerId is returned
628  *
629  * RETURN:      Status
630  *
631  * DESCRIPTION: returns OwnerId for the ACPI table
632  *
633  ******************************************************************************/
634 
635 ACPI_STATUS
636 AcpiTbGetOwnerId (
637     UINT32                  TableIndex,
638     ACPI_OWNER_ID           *OwnerId)
639 {
640     ACPI_STATUS             Status = AE_BAD_PARAMETER;
641 
642 
643     ACPI_FUNCTION_TRACE (TbGetOwnerId);
644 
645 
646     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
647     if (TableIndex < AcpiGbl_RootTableList.Count)
648     {
649         *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
650         Status = AE_OK;
651     }
652 
653     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
654     return_ACPI_STATUS (Status);
655 }
656 
657 
658 /*******************************************************************************
659  *
660  * FUNCTION:    AcpiTbIsTableLoaded
661  *
662  * PARAMETERS:  TableIndex          - Table index
663  *
664  * RETURN:      Table Loaded Flag
665  *
666  ******************************************************************************/
667 
668 BOOLEAN
669 AcpiTbIsTableLoaded (
670     UINT32                  TableIndex)
671 {
672     BOOLEAN                 IsLoaded = FALSE;
673 
674 
675     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
676     if (TableIndex < AcpiGbl_RootTableList.Count)
677     {
678         IsLoaded = (BOOLEAN)
679             (AcpiGbl_RootTableList.Tables[TableIndex].Flags & ACPI_TABLE_IS_LOADED);
680     }
681 
682     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
683     return (IsLoaded);
684 }
685 
686 
687 /*******************************************************************************
688  *
689  * FUNCTION:    AcpiTbSetTableLoadedFlag
690  *
691  * PARAMETERS:  TableIndex          - Table index
692  *              IsLoaded            - TRUE if table is loaded, FALSE otherwise
693  *
694  * RETURN:      None
695  *
696  * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE.
697  *
698  ******************************************************************************/
699 
700 void
701 AcpiTbSetTableLoadedFlag (
702     UINT32                  TableIndex,
703     BOOLEAN                 IsLoaded)
704 {
705 
706     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
707     if (TableIndex < AcpiGbl_RootTableList.Count)
708     {
709         if (IsLoaded)
710         {
711             AcpiGbl_RootTableList.Tables[TableIndex].Flags |= ACPI_TABLE_IS_LOADED;
712         }
713         else
714         {
715             AcpiGbl_RootTableList.Tables[TableIndex].Flags &= ~ACPI_TABLE_IS_LOADED;
716         }
717     }
718 
719     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
720 }
721 
722