1 /******************************************************************************
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13 * All rights reserved.
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
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
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;
38 * The above copyright and patent license is granted only if the following
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.
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
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
73 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
81 * 4. Disclaimer and Export Compliance
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
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
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.
115 *****************************************************************************/
121 extern const UINT8 AcpiGbl_ResourceAmlSizes[];
123 /* Strings used by the disassembler and debugger resource dump routines */
125 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
127 extern const char *AcpiGbl_BmDecode[];
128 extern const char *AcpiGbl_ConfigDecode[];
129 extern const char *AcpiGbl_ConsumeDecode[];
130 extern const char *AcpiGbl_DecDecode[];
131 extern const char *AcpiGbl_HeDecode[];
132 extern const char *AcpiGbl_IoDecode[];
133 extern const char *AcpiGbl_LlDecode[];
134 extern const char *AcpiGbl_MaxDecode[];
135 extern const char *AcpiGbl_MemDecode[];
136 extern const char *AcpiGbl_MinDecode[];
137 extern const char *AcpiGbl_MtpDecode[];
138 extern const char *AcpiGbl_RngDecode[];
139 extern const char *AcpiGbl_RwDecode[];
140 extern const char *AcpiGbl_ShrDecode[];
141 extern const char *AcpiGbl_SizDecode[];
142 extern const char *AcpiGbl_TrsDecode[];
143 extern const char *AcpiGbl_TtpDecode[];
144 extern const char *AcpiGbl_TypDecode[];
147 /* Types for Resource descriptor entries */
149 #define ACPI_INVALID_RESOURCE 0
150 #define ACPI_FIXED_LENGTH 1
151 #define ACPI_VARIABLE_LENGTH 2
152 #define ACPI_SMALL_VARIABLE_LENGTH 3
155 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
163 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
165 ACPI_OPERAND_OBJECT *SourceObject,
166 ACPI_GENERIC_STATE *State,
169 typedef struct acpi_pkg_info
178 #define REF_INCREMENT (UINT16) 0
179 #define REF_DECREMENT (UINT16) 1
180 #define REF_FORCE_DELETE (UINT16) 2
182 /* AcpiUtDumpBuffer */
184 #define DB_BYTE_DISPLAY 1
185 #define DB_WORD_DISPLAY 2
186 #define DB_DWORD_DISPLAY 4
187 #define DB_QWORD_DISPLAY 8
191 * utglobal - Global data structures and procedures
197 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
207 ACPI_OBJECT_TYPE Type);
214 AcpiUtGetDescriptorName (
218 AcpiUtGetObjectTypeName (
219 ACPI_OPERAND_OBJECT *ObjDesc);
222 AcpiUtGetRegionName (
230 AcpiUtHexToAsciiChar (
231 ACPI_INTEGER Integer,
235 AcpiUtValidObjectType (
236 ACPI_OBJECT_TYPE Type);
240 * utinit - miscellaneous initialization and shutdown
243 AcpiUtHardwareInitialize (
247 AcpiUtSubsystemShutdown (
252 * utclib - Local implementations of C library functions
254 #ifndef ACPI_USE_SYSTEM_CLIBRARY
263 const char *SrcString);
268 const char *SrcString,
286 const char *String2);
291 const char *SrcString);
296 const char *SrcString,
319 ACPI_NATIVE_UINT Value,
330 extern const UINT8 _acpi_ctype[];
332 #define _ACPI_XA 0x00 /* extra alphabetic - not supported */
333 #define _ACPI_XS 0x40 /* extra space */
334 #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
335 #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
336 #define _ACPI_DI 0x04 /* '0'-'9' */
337 #define _ACPI_LO 0x02 /* 'a'-'z' */
338 #define _ACPI_PU 0x10 /* punctuation */
339 #define _ACPI_SP 0x08 /* space */
340 #define _ACPI_UP 0x01 /* 'A'-'Z' */
341 #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
343 #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
344 #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
345 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
346 #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
347 #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
348 #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
349 #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
351 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
355 * utcopy - Object construction and conversion interfaces
358 AcpiUtBuildSimpleObject(
359 ACPI_OPERAND_OBJECT *Obj,
360 ACPI_OBJECT *UserObj,
362 UINT32 *BufferSpaceUsed);
365 AcpiUtBuildPackageObject (
366 ACPI_OPERAND_OBJECT *Obj,
371 AcpiUtCopyIobjectToEobject (
372 ACPI_OPERAND_OBJECT *Obj,
373 ACPI_BUFFER *RetBuffer);
376 AcpiUtCopyEobjectToIobject (
378 ACPI_OPERAND_OBJECT **InternalObj);
381 AcpiUtCopyISimpleToIsimple (
382 ACPI_OPERAND_OBJECT *SourceObj,
383 ACPI_OPERAND_OBJECT *DestObj);
386 AcpiUtCopyIobjectToIobject (
387 ACPI_OPERAND_OBJECT *SourceDesc,
388 ACPI_OPERAND_OBJECT **DestDesc,
389 ACPI_WALK_STATE *WalkState);
393 * utcreate - Object creation
396 AcpiUtUpdateObjectReference (
397 ACPI_OPERAND_OBJECT *Object,
402 * utdebug - Debug interfaces
405 AcpiUtInitStackPtrTrace (
409 AcpiUtTrackStackPtr (
415 const char *FunctionName,
422 const char *FunctionName,
430 const char *FunctionName,
438 const char *FunctionName,
446 const char *FunctionName,
453 const char *FunctionName,
461 const char *FunctionName,
469 const char *FunctionName,
498 AcpiUtReportWarning (
502 /* Error and message reporting interfaces */
504 void ACPI_INTERNAL_VAR_XFACE
506 UINT32 RequestedDebugLevel,
508 const char *FunctionName,
512 ...) ACPI_PRINTF_LIKE(6);
514 void ACPI_INTERNAL_VAR_XFACE
515 AcpiUtDebugPrintRaw (
516 UINT32 RequestedDebugLevel,
518 const char *FunctionName,
522 ...) ACPI_PRINTF_LIKE(6);
524 void ACPI_INTERNAL_VAR_XFACE
529 ...) ACPI_PRINTF_LIKE(3);
531 void ACPI_INTERNAL_VAR_XFACE
537 ...) ACPI_PRINTF_LIKE(4);
539 void ACPI_INTERNAL_VAR_XFACE
544 ...) ACPI_PRINTF_LIKE(3);
546 void ACPI_INTERNAL_VAR_XFACE
551 ...) ACPI_PRINTF_LIKE(3);
555 * utdelete - Object deletion and reference counts
559 ACPI_OPERAND_OBJECT *Object);
562 AcpiUtRemoveReference (
563 ACPI_OPERAND_OBJECT *Object);
566 AcpiUtDeleteInternalPackageObject (
567 ACPI_OPERAND_OBJECT *Object);
570 AcpiUtDeleteInternalSimpleObject (
571 ACPI_OPERAND_OBJECT *Object);
574 AcpiUtDeleteInternalObjectList (
575 ACPI_OPERAND_OBJECT **ObjList);
579 * uteval - object evaluation
582 AcpiUtOsiImplementation (
583 ACPI_WALK_STATE *WalkState);
586 AcpiUtEvaluateObject (
587 ACPI_NAMESPACE_NODE *PrefixNode,
589 UINT32 ExpectedReturnBtypes,
590 ACPI_OPERAND_OBJECT **ReturnDesc);
593 AcpiUtEvaluateNumericObject (
595 ACPI_NAMESPACE_NODE *DeviceNode,
596 ACPI_INTEGER *Address);
600 ACPI_NAMESPACE_NODE *DeviceNode,
601 ACPI_DEVICE_ID *Hid);
605 ACPI_NAMESPACE_NODE *DeviceNode,
606 ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
610 ACPI_NAMESPACE_NODE *DeviceNode,
611 UINT32 *StatusFlags);
615 ACPI_NAMESPACE_NODE *DeviceNode,
616 ACPI_DEVICE_ID *Uid);
620 ACPI_NAMESPACE_NODE *DeviceNode,
625 * utobject - internal object create/delete/cache routines
627 ACPI_OPERAND_OBJECT *
628 AcpiUtCreateInternalObjectDbg (
632 ACPI_OBJECT_TYPE Type);
635 AcpiUtAllocateObjectDescDbg (
640 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
641 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
644 AcpiUtDeleteObjectDesc (
645 ACPI_OPERAND_OBJECT *Object);
648 AcpiUtValidInternalObject (
651 ACPI_OPERAND_OBJECT *
652 AcpiUtCreateBufferObject (
653 ACPI_SIZE BufferSize);
655 ACPI_OPERAND_OBJECT *
656 AcpiUtCreateStringObject (
657 ACPI_SIZE StringSize);
661 ACPI_OPERAND_OBJECT *Obj,
662 ACPI_SIZE *ObjLength);
666 * utstate - Generic state creation/cache routines
669 AcpiUtPushGenericState (
670 ACPI_GENERIC_STATE **ListHead,
671 ACPI_GENERIC_STATE *State);
674 AcpiUtPopGenericState (
675 ACPI_GENERIC_STATE **ListHead);
679 AcpiUtCreateGenericState (
683 AcpiUtCreateThreadState (
687 AcpiUtCreateUpdateState (
688 ACPI_OPERAND_OBJECT *Object,
692 AcpiUtCreatePkgState (
693 void *InternalObject,
694 void *ExternalObject,
698 AcpiUtCreateUpdateStateAndPush (
699 ACPI_OPERAND_OBJECT *Object,
701 ACPI_GENERIC_STATE **StateList);
704 AcpiUtCreatePkgStateAndPush (
705 void *InternalObject,
706 void *ExternalObject,
708 ACPI_GENERIC_STATE **StateList);
711 AcpiUtCreateControlState (
715 AcpiUtDeleteGenericState (
716 ACPI_GENERIC_STATE *State);
724 ACPI_INTEGER InDividend,
725 ACPI_INTEGER InDivisor,
726 ACPI_INTEGER *OutQuotient,
727 ACPI_INTEGER *OutRemainder);
731 ACPI_INTEGER InDividend,
733 ACPI_INTEGER *OutQuotient,
734 UINT32 *OutRemainder);
740 AcpiUtValidateException (
745 ACPI_TABLE_HEADER *Table);
748 AcpiUtAllocateOwnerId (
749 ACPI_OWNER_ID *OwnerId);
752 AcpiUtReleaseOwnerId (
753 ACPI_OWNER_ID *OwnerId);
756 AcpiUtWalkPackageTree (
757 ACPI_OPERAND_OBJECT *SourceObject,
759 ACPI_PKG_CALLBACK WalkCallback,
772 AcpiUtValidAcpiName (
780 AcpiUtValidAcpiChar (
782 ACPI_NATIVE_UINT Position);
788 ACPI_INTEGER *RetInteger);
790 /* Values for Base above (16=Hex, 10=Decimal) */
792 #define ACPI_ANY_BASE 0
795 AcpiUtDwordByteSwap (
799 AcpiUtSetIntegerWidth (
802 #ifdef ACPI_DEBUG_OUTPUT
804 AcpiUtDisplayInitPathname (
806 ACPI_NAMESPACE_NODE *ObjHandle,
815 AcpiUtWalkAmlResources (
818 ACPI_WALK_AML_CALLBACK UserFunction,
822 AcpiUtValidateResource (
827 AcpiUtGetDescriptorLength (
831 AcpiUtGetResourceLength (
835 AcpiUtGetResourceHeaderLength (
839 AcpiUtGetResourceType (
843 AcpiUtGetResourceEndTag (
844 ACPI_OPERAND_OBJECT *ObjDesc,
849 * utmutex - mutex support
852 AcpiUtMutexInitialize (
856 AcpiUtMutexTerminate (
861 ACPI_MUTEX_HANDLE MutexId);
865 ACPI_MUTEX_HANDLE MutexId);
869 * utalloc - memory allocation and object caching
880 AcpiUtValidateBuffer (
881 ACPI_BUFFER *Buffer);
884 AcpiUtInitializeBuffer (
886 ACPI_SIZE RequiredLength);
896 AcpiUtAllocateZeroed (
902 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
904 AcpiUtAllocateAndTrack (
911 AcpiUtAllocateZeroedAndTrack (
925 AcpiUtDumpAllocationInfo (
929 AcpiUtDumpAllocations (
937 ACPI_MEMORY_LIST **ReturnCache);
942 #endif /* _ACUTILS_H */