1 /******************************************************************************
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2003, 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 *****************************************************************************/
122 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
124 ACPI_OPERAND_OBJECT *SourceObject,
125 ACPI_GENERIC_STATE *State,
130 AcpiUtWalkPackageTree (
131 ACPI_OPERAND_OBJECT *SourceObject,
133 ACPI_PKG_CALLBACK WalkCallback,
137 typedef struct acpi_pkg_info
146 #define REF_INCREMENT (UINT16) 0
147 #define REF_DECREMENT (UINT16) 1
148 #define REF_FORCE_DELETE (UINT16) 2
150 /* AcpiUtDumpBuffer */
152 #define DB_BYTE_DISPLAY 1
153 #define DB_WORD_DISPLAY 2
154 #define DB_DWORD_DISPLAY 4
155 #define DB_QWORD_DISPLAY 8
158 /* Global initialization interfaces */
170 * UtInit - miscellaneous initialization and shutdown
174 AcpiUtHardwareInitialize (
178 AcpiUtSubsystemShutdown (
186 * UtGlobal - Global data structures and procedures
189 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
199 ACPI_OBJECT_TYPE Type);
206 AcpiUtGetDescriptorName (
210 AcpiUtGetObjectTypeName (
211 ACPI_OPERAND_OBJECT *ObjDesc);
214 AcpiUtGetRegionName (
222 AcpiUtHexToAsciiChar (
223 ACPI_INTEGER Integer,
227 AcpiUtValidObjectType (
228 ACPI_OBJECT_TYPE Type);
231 AcpiUtAllocateOwnerId (
236 * UtClib - Local implementations of C library functions
239 #ifndef ACPI_USE_SYSTEM_CLIBRARY
248 const char *SrcString);
253 const char *SrcString,
265 const char *String2);
270 const char *SrcString);
275 const char *SrcString,
298 ACPI_NATIVE_UINT Value,
309 extern const UINT8 _acpi_ctype[];
311 #define _ACPI_XA 0x00 /* extra alphabetic - not supported */
312 #define _ACPI_XS 0x40 /* extra space */
313 #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
314 #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
315 #define _ACPI_DI 0x04 /* '0'-'9' */
316 #define _ACPI_LO 0x02 /* 'a'-'z' */
317 #define _ACPI_PU 0x10 /* punctuation */
318 #define _ACPI_SP 0x08 /* space */
319 #define _ACPI_UP 0x01 /* 'A'-'Z' */
320 #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
322 #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
323 #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
324 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
325 #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
326 #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
327 #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
328 #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
329 #define ACPI_IS_ASCII(c) ((c) < 0x80)
331 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
334 * UtCopy - Object construction and conversion interfaces
338 AcpiUtBuildSimpleObject(
339 ACPI_OPERAND_OBJECT *Obj,
340 ACPI_OBJECT *UserObj,
342 UINT32 *BufferSpaceUsed);
345 AcpiUtBuildPackageObject (
346 ACPI_OPERAND_OBJECT *Obj,
351 AcpiUtCopyIelementToEelement (
353 ACPI_OPERAND_OBJECT *SourceObject,
354 ACPI_GENERIC_STATE *State,
358 AcpiUtCopyIelementToIelement (
360 ACPI_OPERAND_OBJECT *SourceObject,
361 ACPI_GENERIC_STATE *State,
365 AcpiUtCopyIobjectToEobject (
366 ACPI_OPERAND_OBJECT *Obj,
367 ACPI_BUFFER *RetBuffer);
370 AcpiUtCopyEsimpleToIsimple(
371 ACPI_OBJECT *UserObj,
372 ACPI_OPERAND_OBJECT **ReturnObj);
375 AcpiUtCopyEobjectToIobject (
377 ACPI_OPERAND_OBJECT **InternalObj);
380 AcpiUtCopyISimpleToIsimple (
381 ACPI_OPERAND_OBJECT *SourceObj,
382 ACPI_OPERAND_OBJECT *DestObj);
385 AcpiUtCopyIpackageToIpackage (
386 ACPI_OPERAND_OBJECT *SourceObj,
387 ACPI_OPERAND_OBJECT *DestObj,
388 ACPI_WALK_STATE *WalkState);
391 AcpiUtCopySimpleObject (
392 ACPI_OPERAND_OBJECT *SourceDesc,
393 ACPI_OPERAND_OBJECT *DestDesc);
396 AcpiUtCopyIobjectToIobject (
397 ACPI_OPERAND_OBJECT *SourceDesc,
398 ACPI_OPERAND_OBJECT **DestDesc,
399 ACPI_WALK_STATE *WalkState);
403 * UtCreate - Object creation
407 AcpiUtUpdateObjectReference (
408 ACPI_OPERAND_OBJECT *Object,
413 * UtDebug - Debug interfaces
417 AcpiUtInitStackPtrTrace (
421 AcpiUtTrackStackPtr (
427 ACPI_DEBUG_PRINT_INFO *DbgInfo);
432 ACPI_DEBUG_PRINT_INFO *DbgInfo,
438 ACPI_DEBUG_PRINT_INFO *DbgInfo,
444 ACPI_DEBUG_PRINT_INFO *DbgInfo,
450 ACPI_DEBUG_PRINT_INFO *DbgInfo);
455 ACPI_DEBUG_PRINT_INFO *DbgInfo,
461 ACPI_DEBUG_PRINT_INFO *DbgInfo,
467 ACPI_DEBUG_PRINT_INFO *DbgInfo,
483 AcpiUtReportWarning (
495 void ACPI_INTERNAL_VAR_XFACE
497 UINT32 RequestedDebugLevel,
499 ACPI_DEBUG_PRINT_INFO *DbgInfo,
501 ...) ACPI_PRINTF_LIKE_FUNC;
503 void ACPI_INTERNAL_VAR_XFACE
504 AcpiUtDebugPrintRaw (
505 UINT32 RequestedDebugLevel,
507 ACPI_DEBUG_PRINT_INFO *DbgInfo,
509 ...) ACPI_PRINTF_LIKE_FUNC;
513 * UtDelete - Object deletion
517 AcpiUtDeleteInternalObj (
518 ACPI_OPERAND_OBJECT *Object);
521 AcpiUtDeleteInternalPackageObject (
522 ACPI_OPERAND_OBJECT *Object);
525 AcpiUtDeleteInternalSimpleObject (
526 ACPI_OPERAND_OBJECT *Object);
529 AcpiUtDeleteInternalObjectList (
530 ACPI_OPERAND_OBJECT **ObjList);
534 * UtEval - object evaluation
537 /* Method name strings */
539 #define METHOD_NAME__HID "_HID"
540 #define METHOD_NAME__CID "_CID"
541 #define METHOD_NAME__UID "_UID"
542 #define METHOD_NAME__ADR "_ADR"
543 #define METHOD_NAME__STA "_STA"
544 #define METHOD_NAME__REG "_REG"
545 #define METHOD_NAME__SEG "_SEG"
546 #define METHOD_NAME__BBN "_BBN"
547 #define METHOD_NAME__PRT "_PRT"
548 #define METHOD_NAME__CRS "_CRS"
549 #define METHOD_NAME__PRS "_PRS"
553 AcpiUtEvaluateObject (
554 ACPI_NAMESPACE_NODE *PrefixNode,
556 UINT32 ExpectedReturnBtypes,
557 ACPI_OPERAND_OBJECT **ReturnDesc);
560 AcpiUtEvaluateNumericObject (
562 ACPI_NAMESPACE_NODE *DeviceNode,
563 ACPI_INTEGER *Address);
567 ACPI_NAMESPACE_NODE *DeviceNode,
568 ACPI_DEVICE_ID *Hid);
572 ACPI_NAMESPACE_NODE *DeviceNode,
573 ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
577 ACPI_NAMESPACE_NODE *DeviceNode,
578 UINT32 *StatusFlags);
582 ACPI_NAMESPACE_NODE *DeviceNode,
583 ACPI_DEVICE_ID *Uid);
587 * UtMutex - mutual exclusion interfaces
591 AcpiUtMutexInitialize (
595 AcpiUtMutexTerminate (
600 ACPI_MUTEX_HANDLE MutexId);
604 ACPI_MUTEX_HANDLE MutexId);
608 ACPI_MUTEX_HANDLE MutexId);
612 ACPI_MUTEX_HANDLE MutexId);
616 * UtObject - internal object create/delete/cache routines
619 ACPI_OPERAND_OBJECT *
620 AcpiUtCreateInternalObjectDbg (
624 ACPI_OBJECT_TYPE Type);
627 AcpiUtAllocateObjectDescDbg (
632 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
633 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT)
636 AcpiUtDeleteObjectDesc (
637 ACPI_OPERAND_OBJECT *Object);
640 AcpiUtValidInternalObject (
643 ACPI_OPERAND_OBJECT *
644 AcpiUtCreateBufferObject (
645 ACPI_SIZE BufferSize);
649 * UtRefCnt - Object reference count management
654 ACPI_OPERAND_OBJECT *Object);
657 AcpiUtRemoveReference (
658 ACPI_OPERAND_OBJECT *Object);
661 * UtSize - Object size routines
665 AcpiUtGetSimpleObjectSize (
666 ACPI_OPERAND_OBJECT *Obj,
667 ACPI_SIZE *ObjLength);
670 AcpiUtGetPackageObjectSize (
671 ACPI_OPERAND_OBJECT *Obj,
672 ACPI_SIZE *ObjLength);
676 ACPI_OPERAND_OBJECT *Obj,
677 ACPI_SIZE *ObjLength);
680 AcpiUtGetElementLength (
682 ACPI_OPERAND_OBJECT *SourceObject,
683 ACPI_GENERIC_STATE *State,
688 * 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);
742 AcpiUtDeleteGenericStateCache (
746 AcpiUtDeleteObjectCache (
760 ACPI_INTEGER *InDividend,
761 ACPI_INTEGER *InDivisor,
762 ACPI_INTEGER *OutQuotient,
763 ACPI_INTEGER *OutRemainder);
767 ACPI_INTEGER *InDividend,
769 ACPI_INTEGER *OutQuotient,
770 UINT32 *OutRemainder);
773 AcpiUtValidAcpiName (
777 AcpiUtValidAcpiCharacter (
784 ACPI_INTEGER *RetInteger);
791 AcpiUtGetResourceEndTag (
792 ACPI_OPERAND_OBJECT *ObjDesc);
795 AcpiUtGenerateChecksum (
800 AcpiUtDwordByteSwap (
804 AcpiUtSetIntegerWidth (
807 #ifdef ACPI_DEBUG_OUTPUT
809 AcpiUtDisplayInitPathname (
811 ACPI_NAMESPACE_NODE *ObjHandle,
818 * Utalloc - memory allocation and object caching
822 AcpiUtAcquireFromCache (
826 AcpiUtReleaseToCache (
831 AcpiUtDeleteGenericCache (
835 AcpiUtValidateBuffer (
836 ACPI_BUFFER *Buffer);
839 AcpiUtInitializeBuffer (
841 ACPI_SIZE RequiredLength);
844 /* Memory allocation functions */
861 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
864 AcpiUtAllocateAndTrack (
871 AcpiUtCallocateAndTrack (
884 ACPI_DEBUG_MEM_BLOCK *
885 AcpiUtFindAllocation (
890 AcpiUtTrackAllocation (
892 ACPI_DEBUG_MEM_BLOCK *Address,
900 AcpiUtRemoveAllocation (
902 ACPI_DEBUG_MEM_BLOCK *Address,
908 AcpiUtDumpAllocationInfo (
912 AcpiUtDumpAllocations (
918 #endif /* _ACUTILS_H */