utglobal.c revision 80062
1/******************************************************************************
2 *
3 * Module Name: utglobal - Global variables for the ACPI subsystem
4 *              $Revision: 125 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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#define __UTGLOBAL_C__
118#define DEFINE_ACPI_GLOBALS
119
120#include "acpi.h"
121#include "acevents.h"
122#include "acnamesp.h"
123#include "acinterp.h"
124#include "amlcode.h"
125
126
127#define _COMPONENT          ACPI_UTILITIES
128        MODULE_NAME         ("utglobal")
129
130
131
132/******************************************************************************
133 *
134 * FUNCTION:    AcpiFormatException
135 *
136 * PARAMETERS:  Status       - The ACPI_STATUS code to be formatted
137 *
138 * RETURN:      A string containing the exception  text
139 *
140 * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
141 *
142 ******************************************************************************/
143
144const char *
145AcpiFormatException (
146    ACPI_STATUS             Status)
147{
148    char                    *Exception = "UNKNOWN_STATUS_CODE";
149    ACPI_STATUS             SubStatus;
150
151
152    SubStatus = (Status & ~AE_CODE_MASK);
153
154
155    switch (Status & AE_CODE_MASK)
156    {
157    case AE_CODE_ENVIRONMENTAL:
158
159        if (SubStatus <= AE_CODE_ENV_MAX)
160        {
161            Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
162        }
163        break;
164
165    case AE_CODE_PROGRAMMER:
166
167        if (SubStatus <= AE_CODE_PGM_MAX)
168        {
169            Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
170        }
171        break;
172
173    case AE_CODE_ACPI_TABLES:
174
175        if (SubStatus <= AE_CODE_TBL_MAX)
176        {
177            Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
178        }
179        break;
180
181    case AE_CODE_AML:
182
183        if (SubStatus <= AE_CODE_AML_MAX)
184        {
185            Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
186        }
187        break;
188
189    case AE_CODE_CONTROL:
190
191        if (SubStatus <= AE_CODE_CTRL_MAX)
192        {
193            Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
194        }
195        break;
196
197    default:
198        break;
199    }
200
201
202    return ((const char *) Exception);
203}
204
205
206/******************************************************************************
207 *
208 * Static global variable initialization.
209 *
210 ******************************************************************************/
211
212/*
213 * We want the debug switches statically initialized so they
214 * are already set when the debugger is entered.
215 */
216
217/* Debug switch - level and trace mask */
218
219#ifdef ACPI_DEBUG
220UINT32                      AcpiDbgLevel = DEBUG_DEFAULT;
221#else
222UINT32                      AcpiDbgLevel = NORMAL_DEFAULT;
223#endif
224
225/* Debug switch - layer (component) mask */
226
227UINT32                      AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
228UINT32                      AcpiGbl_NestingLevel = 0;
229
230
231/* Debugger globals */
232
233BOOLEAN                     AcpiGbl_DbTerminateThreads = FALSE;
234BOOLEAN                     AcpiGbl_MethodExecuting = FALSE;
235
236/* System flags */
237
238UINT32                      AcpiGbl_SystemFlags = 0;
239UINT32                      AcpiGbl_StartupFlags = 0;
240
241/* System starts unitialized! */
242BOOLEAN                     AcpiGbl_Shutdown = TRUE;
243
244
245UINT8                       AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
246
247
248/******************************************************************************
249 *
250 * Namespace globals
251 *
252 ******************************************************************************/
253
254
255/*
256 * Names built-in to the interpreter
257 *
258 * Initial values are currently supported only for types String and Number.
259 * To avoid type punning, both are specified as strings in this table.
260 *
261 * NOTES:
262 * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run
263 *    during the initialization sequence.
264 */
265
266PREDEFINED_NAMES            AcpiGbl_PreDefinedNames[] =
267{
268    {"_GPE",    INTERNAL_TYPE_DEF_ANY},
269    {"_PR_",    INTERNAL_TYPE_DEF_ANY},
270    {"_SB_",    ACPI_TYPE_DEVICE},
271    {"_SI_",    INTERNAL_TYPE_DEF_ANY},
272    {"_TZ_",    INTERNAL_TYPE_DEF_ANY},
273    {"_REV",    ACPI_TYPE_INTEGER, "2"},
274    {"_OS_",    ACPI_TYPE_STRING, ACPI_OS_NAME},
275    {"_GL_",    ACPI_TYPE_MUTEX, "0"},
276    {NULL,      ACPI_TYPE_ANY}           /* Table terminator */
277};
278
279
280/*
281 * Properties of the ACPI Object Types, both internal and external.
282 *
283 * Elements of AcpiNsProperties are bit significant
284 * and the table is indexed by values of ACPI_OBJECT_TYPE
285 */
286
287UINT8                       AcpiGbl_NsProperties[] =
288{
289    NSP_NORMAL,                 /* 00 Any              */
290    NSP_NORMAL,                 /* 01 Number           */
291    NSP_NORMAL,                 /* 02 String           */
292    NSP_NORMAL,                 /* 03 Buffer           */
293    NSP_LOCAL,                  /* 04 Package          */
294    NSP_NORMAL,                 /* 05 FieldUnit        */
295    NSP_NEWSCOPE | NSP_LOCAL,   /* 06 Device           */
296    NSP_LOCAL,                  /* 07 AcpiEvent        */
297    NSP_NEWSCOPE | NSP_LOCAL,   /* 08 Method           */
298    NSP_LOCAL,                  /* 09 Mutex            */
299    NSP_LOCAL,                  /* 10 Region           */
300    NSP_NEWSCOPE | NSP_LOCAL,   /* 11 Power            */
301    NSP_NEWSCOPE | NSP_LOCAL,   /* 12 Processor        */
302    NSP_NEWSCOPE | NSP_LOCAL,   /* 13 Thermal          */
303    NSP_NORMAL,                 /* 14 BufferField      */
304    NSP_NORMAL,                 /* 15 DdbHandle        */
305    NSP_NORMAL,                 /* 16 Debug Object     */
306    NSP_NORMAL,                 /* 17 DefField         */
307    NSP_NORMAL,                 /* 18 BankField        */
308    NSP_NORMAL,                 /* 19 IndexField       */
309    NSP_NORMAL,                 /* 20 Reference        */
310    NSP_NORMAL,                 /* 21 Alias            */
311    NSP_NORMAL,                 /* 22 Notify           */
312    NSP_NORMAL,                 /* 23 Address Handler  */
313    NSP_NEWSCOPE | NSP_LOCAL,   /* 24 Resource Desc    */
314    NSP_NEWSCOPE | NSP_LOCAL,   /* 25 Resource Field   */
315    NSP_NORMAL,                 /* 26 DefFieldDefn     */
316    NSP_NORMAL,                 /* 27 BankFieldDefn    */
317    NSP_NORMAL,                 /* 28 IndexFieldDefn   */
318    NSP_NORMAL,                 /* 29 If               */
319    NSP_NORMAL,                 /* 30 Else             */
320    NSP_NORMAL,                 /* 31 While            */
321    NSP_NEWSCOPE,               /* 32 Scope            */
322    NSP_LOCAL,                  /* 33 DefAny           */
323    NSP_NORMAL,                 /* 34 Extra            */
324    NSP_NORMAL                  /* 35 Invalid          */
325};
326
327
328/* Hex to ASCII conversion table */
329
330NATIVE_CHAR                 AcpiGbl_HexToAscii[] =
331                                {'0','1','2','3','4','5','6','7',
332                                '8','9','A','B','C','D','E','F'};
333
334
335/******************************************************************************
336 *
337 * Table globals
338 *
339 * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
340 * it is NOT an exhaustive list of all possible ACPI tables.  All ACPI tables
341 * that are not used by the subsystem are simply ignored.
342 *
343 ******************************************************************************/
344
345
346ACPI_TABLE_DESC             AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
347
348
349ACPI_TABLE_SUPPORT          AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] =
350{
351    /***********    Name,    Signature,  Signature size,    How many allowed?,   Supported?  Global typed pointer */
352
353    /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
354    /* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &AcpiGbl_DSDT},
355    /* FADT 2 */ {FADT_SIG,  FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &AcpiGbl_FADT},
356    /* FACS 3 */ {FACS_SIG,  FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      (void **) &AcpiGbl_FACS},
357    /* PSDT 4 */ {PSDT_SIG,  PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
358    /* SSDT 5 */ {SSDT_SIG,  SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK,      NULL},
359    /* XSDT 6 */ {XSDT_SIG,  XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE,   AE_OK,      NULL},
360};
361
362
363#ifdef ACPI_DEBUG
364
365/******************************************************************************
366 *
367 * Strings and procedures used for debug only
368 *
369 ******************************************************************************/
370
371NATIVE_CHAR                 *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n";
372
373
374/*****************************************************************************
375 *
376 * FUNCTION:    AcpiUtGetMutexName
377 *
378 * PARAMETERS:  None.
379 *
380 * RETURN:      Status
381 *
382 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
383 *
384 ****************************************************************************/
385
386NATIVE_CHAR *
387AcpiUtGetMutexName (
388    UINT32                  MutexId)
389{
390
391    if (MutexId > MAX_MTX)
392    {
393        return ("Invalid Mutex ID");
394    }
395
396    return (AcpiGbl_MutexNames[MutexId]);
397}
398
399
400/*
401 * Elements of AcpiGbl_NsTypeNames below must match
402 * one-to-one with values of ACPI_OBJECT_TYPE
403 *
404 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when
405 * stored in a table it really means that we have thus far seen no evidence to
406 * indicatewhat type is actually going to be stored for this entry.
407 */
408
409static NATIVE_CHAR          AcpiGbl_BadType[] = "UNDEFINED";
410#define TYPE_NAME_LENGTH    9                       /* Maximum length of each string */
411
412static NATIVE_CHAR          *AcpiGbl_NsTypeNames[] =    /* printable names of ACPI types */
413{
414    /* 00 */ "Untyped",
415    /* 01 */ "Integer",
416    /* 02 */ "String",
417    /* 03 */ "Buffer",
418    /* 04 */ "Package",
419    /* 05 */ "FieldUnit",
420    /* 06 */ "Device",
421    /* 07 */ "Event",
422    /* 08 */ "Method",
423    /* 09 */ "Mutex",
424    /* 10 */ "Region",
425    /* 11 */ "Power",
426    /* 12 */ "Processor",
427    /* 13 */ "Thermal",
428    /* 14 */ "BuffField",
429    /* 15 */ "DdbHandle",
430    /* 16 */ "DebugObj",
431    /* 17 */ "RegnField",
432    /* 18 */ "BankField",
433    /* 19 */ "IndxField",
434    /* 20 */ "Reference",
435    /* 21 */ "Alias",
436    /* 22 */ "Notify",
437    /* 23 */ "AddrHndlr",
438    /* 24 */ "RsrcDesc",
439    /* 25 */ "RsrcField",
440    /* 26 */ "RgnFldDfn",
441    /* 27 */ "BnkFldDfn",
442    /* 28 */ "IdxFldDfn",
443    /* 29 */ "If",
444    /* 30 */ "Else",
445    /* 31 */ "While",
446    /* 32 */ "Scope",
447    /* 33 */ "DefAny",
448    /* 34 */ "Extra",
449    /* 35 */ "Invalid"
450};
451
452
453/*****************************************************************************
454 *
455 * FUNCTION:    AcpiUtGetTypeName
456 *
457 * PARAMETERS:  None.
458 *
459 * RETURN:      Status
460 *
461 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
462 *
463 ****************************************************************************/
464
465NATIVE_CHAR *
466AcpiUtGetTypeName (
467    UINT32                  Type)
468{
469
470    if (Type > INTERNAL_TYPE_INVALID)
471    {
472        return (AcpiGbl_BadType);
473    }
474
475    return (AcpiGbl_NsTypeNames[Type]);
476}
477
478
479/* Region type decoding */
480
481NATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] =
482{
483    "SystemMemory",
484    "SystemIO",
485    "PCIConfig",
486    "EmbeddedControl",
487    "SMBus",
488    "CMOS",
489    "PCIBarTarget",
490};
491
492
493/*****************************************************************************
494 *
495 * FUNCTION:    AcpiUtGetRegionName
496 *
497 * PARAMETERS:  None.
498 *
499 * RETURN:      Status
500 *
501 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
502 *
503 ****************************************************************************/
504
505NATIVE_CHAR *
506AcpiUtGetRegionName (
507    UINT8                   SpaceId)
508{
509
510    if (SpaceId >= USER_REGION_BEGIN)
511    {
512        return ("UserDefinedRegion");
513    }
514
515    else if (SpaceId >= NUM_REGION_TYPES)
516    {
517        return ("InvalidSpaceID");
518    }
519
520    return (AcpiGbl_RegionTypes[SpaceId]);
521}
522
523
524/* Data used in keeping track of fields */
525
526NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] =
527{
528    "skip",
529    "?access?"
530};              /* FE = Field Element */
531
532
533NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] =
534{
535    "Error",
536    "MTR",
537    "MEQ",
538    "MLE",
539    "MLT",
540    "MGE",
541    "MGT"
542};
543
544
545/* Access type decoding */
546
547NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] =
548{
549    "AnyAcc",
550    "ByteAcc",
551    "WordAcc",
552    "DWordAcc",
553    "BlockAcc",
554    "SMBSendRecvAcc",
555    "SMBQuickAcc"
556};
557
558
559/* Update rule decoding */
560
561NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] =
562{
563    "Preserve",
564    "WriteAsOnes",
565    "WriteAsZeros"
566};
567
568#endif
569
570
571/*****************************************************************************
572 *
573 * FUNCTION:    AcpiUtValidObjectType
574 *
575 * PARAMETERS:  None.
576 *
577 * RETURN:      TRUE if valid object type
578 *
579 * DESCRIPTION: Validate an object type
580 *
581 ****************************************************************************/
582
583BOOLEAN
584AcpiUtValidObjectType (
585    UINT32                  Type)
586{
587
588    if (Type > ACPI_TYPE_MAX)
589    {
590        if ((Type < INTERNAL_TYPE_BEGIN) ||
591            (Type > INTERNAL_TYPE_MAX))
592        {
593            return (FALSE);
594        }
595    }
596
597    return (TRUE);
598}
599
600
601/****************************************************************************
602 *
603 * FUNCTION:    AcpiUtAllocateOwnerId
604 *
605 * PARAMETERS:  IdType          - Type of ID (method or table)
606 *
607 * DESCRIPTION: Allocate a table or method owner id
608 *
609 ***************************************************************************/
610
611ACPI_OWNER_ID
612AcpiUtAllocateOwnerId (
613    UINT32                  IdType)
614{
615    ACPI_OWNER_ID           OwnerId = 0xFFFF;
616
617
618    FUNCTION_TRACE ("UtAllocateOwnerId");
619
620
621    AcpiUtAcquireMutex (ACPI_MTX_CACHES);
622
623    switch (IdType)
624    {
625    case OWNER_TYPE_TABLE:
626
627        OwnerId = AcpiGbl_NextTableOwnerId;
628        AcpiGbl_NextTableOwnerId++;
629
630        if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID)
631        {
632            AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID;
633        }
634        break;
635
636
637    case OWNER_TYPE_METHOD:
638
639        OwnerId = AcpiGbl_NextMethodOwnerId;
640        AcpiGbl_NextMethodOwnerId++;
641
642        if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID)
643        {
644            AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID;
645        }
646        break;
647    }
648
649
650    AcpiUtReleaseMutex (ACPI_MTX_CACHES);
651
652    return_VALUE (OwnerId);
653}
654
655
656/****************************************************************************
657 *
658 * FUNCTION:    AcpiUtInitGlobals
659 *
660 * PARAMETERS:  none
661 *
662 * DESCRIPTION: Init library globals.  All globals that require specific
663 *              initialization should be initialized here!
664 *
665 ***************************************************************************/
666
667void
668AcpiUtInitGlobals (
669    void)
670{
671    UINT32                  i;
672
673
674    FUNCTION_TRACE ("UtInitGlobals");
675
676
677    /* ACPI table structure */
678
679    for (i = 0; i < NUM_ACPI_TABLES; i++)
680    {
681        AcpiGbl_AcpiTables[i].Prev          = &AcpiGbl_AcpiTables[i];
682        AcpiGbl_AcpiTables[i].Next          = &AcpiGbl_AcpiTables[i];
683        AcpiGbl_AcpiTables[i].Pointer       = NULL;
684        AcpiGbl_AcpiTables[i].Length        = 0;
685        AcpiGbl_AcpiTables[i].Allocation    = ACPI_MEM_NOT_ALLOCATED;
686        AcpiGbl_AcpiTables[i].Count         = 0;
687    }
688
689
690    /* Address Space handler array */
691
692    for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++)
693    {
694        AcpiGbl_AddressSpaces[i].Handler    = NULL;
695        AcpiGbl_AddressSpaces[i].Context    = NULL;
696    }
697
698    /* Mutex locked flags */
699
700    for (i = 0; i < NUM_MTX; i++)
701    {
702        AcpiGbl_AcpiMutexInfo[i].Mutex      = NULL;
703        AcpiGbl_AcpiMutexInfo[i].OwnerId    = ACPI_MUTEX_NOT_ACQUIRED;
704        AcpiGbl_AcpiMutexInfo[i].UseCount   = 0;
705    }
706
707    /* Global notify handlers */
708
709    AcpiGbl_SysNotify.Handler           = NULL;
710    AcpiGbl_DrvNotify.Handler           = NULL;
711
712    /* Global "typed" ACPI table pointers */
713
714    AcpiGbl_RSDP                        = NULL;
715    AcpiGbl_XSDT                        = NULL;
716    AcpiGbl_FACS                        = NULL;
717    AcpiGbl_FADT                        = NULL;
718    AcpiGbl_DSDT                        = NULL;
719
720
721    /* Global Lock support */
722
723    AcpiGbl_GlobalLockAcquired          = FALSE;
724    AcpiGbl_GlobalLockThreadCount       = 0;
725
726    /* Miscellaneous variables */
727
728    AcpiGbl_SystemFlags                 = 0;
729    AcpiGbl_StartupFlags                = 0;
730    AcpiGbl_RsdpOriginalLocation        = 0;
731    AcpiGbl_CmSingleStep                = FALSE;
732    AcpiGbl_DbTerminateThreads          = FALSE;
733    AcpiGbl_Shutdown                    = FALSE;
734    AcpiGbl_NsLookupCount               = 0;
735    AcpiGbl_PsFindCount                 = 0;
736    AcpiGbl_AcpiHardwarePresent         = TRUE;
737    AcpiGbl_NextTableOwnerId            = FIRST_TABLE_ID;
738    AcpiGbl_NextMethodOwnerId           = FIRST_METHOD_ID;
739    AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;
740
741    /* Cache of small "state" objects */
742
743    AcpiGbl_GenericStateCache           = NULL;
744    AcpiGbl_GenericStateCacheDepth      = 0;
745    AcpiGbl_StateCacheRequests          = 0;
746    AcpiGbl_StateCacheHits              = 0;
747
748    AcpiGbl_ParseCache                  = NULL;
749    AcpiGbl_ParseCacheDepth             = 0;
750    AcpiGbl_ParseCacheRequests          = 0;
751    AcpiGbl_ParseCacheHits              = 0;
752
753    AcpiGbl_ExtParseCache               = NULL;
754    AcpiGbl_ExtParseCacheDepth          = 0;
755    AcpiGbl_ExtParseCacheRequests       = 0;
756    AcpiGbl_ExtParseCacheHits           = 0;
757
758    AcpiGbl_ObjectCache                 = NULL;
759    AcpiGbl_ObjectCacheDepth            = 0;
760    AcpiGbl_ObjectCacheRequests         = 0;
761    AcpiGbl_ObjectCacheHits             = 0;
762
763    AcpiGbl_WalkStateCache              = NULL;
764    AcpiGbl_WalkStateCacheDepth         = 0;
765    AcpiGbl_WalkStateCacheRequests      = 0;
766    AcpiGbl_WalkStateCacheHits          = 0;
767
768    /* Hardware oriented */
769
770    AcpiGbl_Gpe0EnableRegisterSave      = NULL;
771    AcpiGbl_Gpe1EnableRegisterSave      = NULL;
772    AcpiGbl_OriginalMode                = SYS_MODE_UNKNOWN;   /*  original ACPI/legacy mode   */
773    AcpiGbl_GpeRegisters                = NULL;
774    AcpiGbl_GpeInfo                     = NULL;
775
776    /* Namespace */
777
778    AcpiGbl_RootNode                    = NULL;
779
780    AcpiGbl_RootNodeStruct.Name         = ACPI_ROOT_NAME;
781    AcpiGbl_RootNodeStruct.DataType     = ACPI_DESC_TYPE_NAMED;
782    AcpiGbl_RootNodeStruct.Type         = ACPI_TYPE_ANY;
783    AcpiGbl_RootNodeStruct.Child        = NULL;
784    AcpiGbl_RootNodeStruct.Peer         = NULL;
785    AcpiGbl_RootNodeStruct.Object       = NULL;
786    AcpiGbl_RootNodeStruct.Flags        = ANOBJ_END_OF_PEER_LIST;
787
788    /* Memory allocation metrics - compiled out in non-debug mode. */
789
790    INITIALIZE_ALLOCATION_METRICS();
791
792    return_VOID;
793}
794
795
796