1 /******************************************************************************
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
120 extern const UINT8 AcpiGbl_ResourceAmlSizes[];
122 /* Strings used by the disassembler and debugger resource dump routines */
124 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
126 extern const char *AcpiGbl_BmDecode[];
127 extern const char *AcpiGbl_ConfigDecode[];
128 extern const char *AcpiGbl_ConsumeDecode[];
129 extern const char *AcpiGbl_DecDecode[];
130 extern const char *AcpiGbl_HeDecode[];
131 extern const char *AcpiGbl_IoDecode[];
132 extern const char *AcpiGbl_LlDecode[];
133 extern const char *AcpiGbl_MaxDecode[];
134 extern const char *AcpiGbl_MemDecode[];
135 extern const char *AcpiGbl_MinDecode[];
136 extern const char *AcpiGbl_MtpDecode[];
137 extern const char *AcpiGbl_RngDecode[];
138 extern const char *AcpiGbl_RwDecode[];
139 extern const char *AcpiGbl_ShrDecode[];
140 extern const char *AcpiGbl_SizDecode[];
141 extern const char *AcpiGbl_TrsDecode[];
142 extern const char *AcpiGbl_TtpDecode[];
143 extern const char *AcpiGbl_TypDecode[];
146 /* Types for Resource descriptor entries */
148 #define ACPI_INVALID_RESOURCE 0
149 #define ACPI_FIXED_LENGTH 1
150 #define ACPI_VARIABLE_LENGTH 2
151 #define ACPI_SMALL_VARIABLE_LENGTH 3
154 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
162 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
164 ACPI_OPERAND_OBJECT *SourceObject,
165 ACPI_GENERIC_STATE *State,
168 typedef struct acpi_pkg_info
177 #define REF_INCREMENT (UINT16) 0
178 #define REF_DECREMENT (UINT16) 1
179 #define REF_FORCE_DELETE (UINT16) 2
181 /* AcpiUtDumpBuffer */
183 #define DB_BYTE_DISPLAY 1
184 #define DB_WORD_DISPLAY 2
185 #define DB_DWORD_DISPLAY 4
186 #define DB_QWORD_DISPLAY 8
190 * utglobal - Global data structures and procedures
196 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
203 AcpiUtGetNotifyName (
210 ACPI_OBJECT_TYPE Type);
217 AcpiUtGetDescriptorName (
221 AcpiUtGetReferenceName (
222 ACPI_OPERAND_OBJECT *Object);
225 AcpiUtGetObjectTypeName (
226 ACPI_OPERAND_OBJECT *ObjDesc);
229 AcpiUtGetRegionName (
237 AcpiUtHexToAsciiChar (
242 AcpiUtValidObjectType (
243 ACPI_OBJECT_TYPE Type);
247 * utinit - miscellaneous initialization and shutdown
250 AcpiUtHardwareInitialize (
254 AcpiUtSubsystemShutdown (
259 * utclib - Local implementations of C library functions
261 #ifndef ACPI_USE_SYSTEM_CLIBRARY
270 const char *SrcString);
275 const char *SrcString,
293 const char *String2);
298 const char *SrcString);
303 const char *SrcString,
337 extern const UINT8 _acpi_ctype[];
339 #define _ACPI_XA 0x00 /* extra alphabetic - not supported */
340 #define _ACPI_XS 0x40 /* extra space */
341 #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
342 #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
343 #define _ACPI_DI 0x04 /* '0'-'9' */
344 #define _ACPI_LO 0x02 /* 'a'-'z' */
345 #define _ACPI_PU 0x10 /* punctuation */
346 #define _ACPI_SP 0x08 /* space */
347 #define _ACPI_UP 0x01 /* 'A'-'Z' */
348 #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
350 #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
351 #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
352 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
353 #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
354 #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
355 #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
356 #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
358 #endif /* !ACPI_USE_SYSTEM_CLIBRARY */
360 #define ACPI_IS_ASCII(c) ((c) < 0x80)
364 * utcopy - Object construction and conversion interfaces
367 AcpiUtBuildSimpleObject(
368 ACPI_OPERAND_OBJECT *Obj,
369 ACPI_OBJECT *UserObj,
371 UINT32 *BufferSpaceUsed);
374 AcpiUtBuildPackageObject (
375 ACPI_OPERAND_OBJECT *Obj,
380 AcpiUtCopyIobjectToEobject (
381 ACPI_OPERAND_OBJECT *Obj,
382 ACPI_BUFFER *RetBuffer);
385 AcpiUtCopyEobjectToIobject (
387 ACPI_OPERAND_OBJECT **InternalObj);
390 AcpiUtCopyISimpleToIsimple (
391 ACPI_OPERAND_OBJECT *SourceObj,
392 ACPI_OPERAND_OBJECT *DestObj);
395 AcpiUtCopyIobjectToIobject (
396 ACPI_OPERAND_OBJECT *SourceDesc,
397 ACPI_OPERAND_OBJECT **DestDesc,
398 ACPI_WALK_STATE *WalkState);
402 * utcreate - Object creation
405 AcpiUtUpdateObjectReference (
406 ACPI_OPERAND_OBJECT *Object,
411 * utdebug - Debug interfaces
414 AcpiUtInitStackPtrTrace (
418 AcpiUtTrackStackPtr (
424 const char *FunctionName,
425 const char *ModuleName,
431 const char *FunctionName,
432 const char *ModuleName,
439 const char *FunctionName,
440 const char *ModuleName,
447 const char *FunctionName,
448 const char *ModuleName,
455 const char *FunctionName,
456 const char *ModuleName,
462 const char *FunctionName,
463 const char *ModuleName,
470 const char *FunctionName,
471 const char *ModuleName,
478 const char *FunctionName,
479 const char *ModuleName,
507 AcpiUtReportWarning (
512 * utdelete - Object deletion and reference counts
516 ACPI_OPERAND_OBJECT *Object);
519 AcpiUtRemoveReference (
520 ACPI_OPERAND_OBJECT *Object);
523 AcpiUtDeleteInternalPackageObject (
524 ACPI_OPERAND_OBJECT *Object);
527 AcpiUtDeleteInternalSimpleObject (
528 ACPI_OPERAND_OBJECT *Object);
531 AcpiUtDeleteInternalObjectList (
532 ACPI_OPERAND_OBJECT **ObjList);
536 * uteval - object evaluation
539 AcpiUtEvaluateObject (
540 ACPI_NAMESPACE_NODE *PrefixNode,
542 UINT32 ExpectedReturnBtypes,
543 ACPI_OPERAND_OBJECT **ReturnDesc);
546 AcpiUtEvaluateNumericObject (
548 ACPI_NAMESPACE_NODE *DeviceNode,
553 ACPI_NAMESPACE_NODE *DeviceNode,
554 UINT32 *StatusFlags);
557 AcpiUtExecutePowerMethods (
558 ACPI_NAMESPACE_NODE *DeviceNode,
559 const char **MethodNames,
565 * utids - device ID support
569 ACPI_NAMESPACE_NODE *DeviceNode,
570 ACPI_DEVICE_ID **ReturnId);
574 ACPI_NAMESPACE_NODE *DeviceNode,
575 ACPI_DEVICE_ID **ReturnId);
579 ACPI_NAMESPACE_NODE *DeviceNode,
580 ACPI_DEVICE_ID_LIST **ReturnCidList);
584 * utlock - reader/writer locks
595 AcpiUtAcquireReadLock (
599 AcpiUtReleaseReadLock (
603 AcpiUtAcquireWriteLock (
607 AcpiUtReleaseWriteLock (
612 * utobject - internal object create/delete/cache routines
614 ACPI_OPERAND_OBJECT *
615 AcpiUtCreateInternalObjectDbg (
616 const char *ModuleName,
619 ACPI_OBJECT_TYPE Type);
622 AcpiUtAllocateObjectDescDbg (
623 const char *ModuleName,
627 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
628 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
631 AcpiUtDeleteObjectDesc (
632 ACPI_OPERAND_OBJECT *Object);
635 AcpiUtValidInternalObject (
638 ACPI_OPERAND_OBJECT *
639 AcpiUtCreatePackageObject (
642 ACPI_OPERAND_OBJECT *
643 AcpiUtCreateIntegerObject (
646 ACPI_OPERAND_OBJECT *
647 AcpiUtCreateBufferObject (
648 ACPI_SIZE BufferSize);
650 ACPI_OPERAND_OBJECT *
651 AcpiUtCreateStringObject (
652 ACPI_SIZE StringSize);
656 ACPI_OPERAND_OBJECT *Obj,
657 ACPI_SIZE *ObjLength);
661 * utosi - Support for the _OSI predefined control method
664 AcpiUtInitializeInterfaces (
668 AcpiUtInterfaceTerminate (
672 AcpiUtInstallInterface (
673 ACPI_STRING InterfaceName);
676 AcpiUtRemoveInterface (
677 ACPI_STRING InterfaceName);
679 ACPI_INTERFACE_INFO *
681 ACPI_STRING InterfaceName);
684 AcpiUtOsiImplementation (
685 ACPI_WALK_STATE *WalkState);
689 * utstate - Generic state creation/cache routines
692 AcpiUtPushGenericState (
693 ACPI_GENERIC_STATE **ListHead,
694 ACPI_GENERIC_STATE *State);
697 AcpiUtPopGenericState (
698 ACPI_GENERIC_STATE **ListHead);
702 AcpiUtCreateGenericState (
706 AcpiUtCreateThreadState (
710 AcpiUtCreateUpdateState (
711 ACPI_OPERAND_OBJECT *Object,
715 AcpiUtCreatePkgState (
716 void *InternalObject,
717 void *ExternalObject,
721 AcpiUtCreateUpdateStateAndPush (
722 ACPI_OPERAND_OBJECT *Object,
724 ACPI_GENERIC_STATE **StateList);
727 AcpiUtCreatePkgStateAndPush (
728 void *InternalObject,
729 void *ExternalObject,
731 ACPI_GENERIC_STATE **StateList);
734 AcpiUtCreateControlState (
738 AcpiUtDeleteGenericState (
739 ACPI_GENERIC_STATE *State);
750 UINT64 *OutRemainder);
757 UINT32 *OutRemainder);
763 AcpiUtValidateException (
767 AcpiUtIsPciRootBridge (
772 ACPI_TABLE_HEADER *Table);
775 AcpiUtAllocateOwnerId (
776 ACPI_OWNER_ID *OwnerId);
779 AcpiUtReleaseOwnerId (
780 ACPI_OWNER_ID *OwnerId);
783 AcpiUtWalkPackageTree (
784 ACPI_OPERAND_OBJECT *SourceObject,
786 ACPI_PKG_CALLBACK WalkCallback,
803 AcpiUtValidAcpiName (
811 AcpiUtValidAcpiChar (
821 /* Values for Base above (16=Hex, 10=Decimal) */
823 #define ACPI_ANY_BASE 0
826 AcpiUtDwordByteSwap (
830 AcpiUtSetIntegerWidth (
833 #ifdef ACPI_DEBUG_OUTPUT
835 AcpiUtDisplayInitPathname (
837 ACPI_NAMESPACE_NODE *ObjHandle,
846 AcpiUtWalkAmlResources (
849 ACPI_WALK_AML_CALLBACK UserFunction,
853 AcpiUtValidateResource (
858 AcpiUtGetDescriptorLength (
862 AcpiUtGetResourceLength (
866 AcpiUtGetResourceHeaderLength (
870 AcpiUtGetResourceType (
874 AcpiUtGetResourceEndTag (
875 ACPI_OPERAND_OBJECT *ObjDesc,
880 * utmutex - mutex support
883 AcpiUtMutexInitialize (
887 AcpiUtMutexTerminate (
892 ACPI_MUTEX_HANDLE MutexId);
896 ACPI_MUTEX_HANDLE MutexId);
900 * utalloc - memory allocation and object caching
911 AcpiUtValidateBuffer (
912 ACPI_BUFFER *Buffer);
915 AcpiUtInitializeBuffer (
917 ACPI_SIZE RequiredLength);
927 AcpiUtAllocateZeroed (
933 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
935 AcpiUtAllocateAndTrack (
942 AcpiUtAllocateZeroedAndTrack (
956 AcpiUtDumpAllocationInfo (
960 AcpiUtDumpAllocations (
968 ACPI_MEMORY_LIST **ReturnCache);
970 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
974 * utxferror - various error/warning output functions
976 void ACPI_INTERNAL_VAR_XFACE
977 AcpiUtPredefinedWarning (
978 const char *ModuleName,
985 void ACPI_INTERNAL_VAR_XFACE
986 AcpiUtPredefinedInfo (
987 const char *ModuleName,
995 AcpiUtNamespaceError (
996 const char *ModuleName,
998 const char *InternalName,
999 ACPI_STATUS LookupStatus);
1003 const char *ModuleName,
1005 const char *Message,
1006 ACPI_NAMESPACE_NODE *Node,
1008 ACPI_STATUS LookupStatus);
1010 #endif /* _ACUTILS_H */