1 /******************************************************************************
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2004, 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,
129 AcpiUtWalkPackageTree (
130 ACPI_OPERAND_OBJECT *SourceObject,
132 ACPI_PKG_CALLBACK WalkCallback,
135 typedef struct acpi_pkg_info
144 #define REF_INCREMENT (UINT16) 0
145 #define REF_DECREMENT (UINT16) 1
146 #define REF_FORCE_DELETE (UINT16) 2
148 /* AcpiUtDumpBuffer */
150 #define DB_BYTE_DISPLAY 1
151 #define DB_WORD_DISPLAY 2
152 #define DB_DWORD_DISPLAY 4
153 #define DB_QWORD_DISPLAY 8
156 /* Global initialization interfaces */
168 * UtInit - miscellaneous initialization and shutdown
172 AcpiUtHardwareInitialize (
176 AcpiUtSubsystemShutdown (
184 * UtGlobal - Global data structures and procedures
187 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
197 ACPI_OBJECT_TYPE Type);
204 AcpiUtGetDescriptorName (
208 AcpiUtGetObjectTypeName (
209 ACPI_OPERAND_OBJECT *ObjDesc);
212 AcpiUtGetRegionName (
220 AcpiUtHexToAsciiChar (
221 ACPI_INTEGER Integer,
225 AcpiUtValidObjectType (
226 ACPI_OBJECT_TYPE Type);
229 AcpiUtAllocateOwnerId (
234 * UtClib - Local implementations of C library functions
237 #ifndef ACPI_USE_SYSTEM_CLIBRARY
246 const char *SrcString);
251 const char *SrcString,
269 const char *String2);
274 const char *SrcString);
279 const char *SrcString,
302 ACPI_NATIVE_UINT Value,
313 extern const UINT8 _acpi_ctype[];
315 #define _ACPI_XA 0x00 /* extra alphabetic - not supported */
316 #define _ACPI_XS 0x40 /* extra space */
317 #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
318 #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
319 #define _ACPI_DI 0x04 /* '0'-'9' */
320 #define _ACPI_LO 0x02 /* 'a'-'z' */
321 #define _ACPI_PU 0x10 /* punctuation */
322 #define _ACPI_SP 0x08 /* space */
323 #define _ACPI_UP 0x01 /* 'A'-'Z' */
324 #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
326 #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
327 #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
328 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
329 #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
330 #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
331 #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
332 #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
333 #define ACPI_IS_ASCII(c) ((c) < 0x80)
335 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
338 * UtCopy - Object construction and conversion interfaces
342 AcpiUtBuildSimpleObject(
343 ACPI_OPERAND_OBJECT *Obj,
344 ACPI_OBJECT *UserObj,
346 UINT32 *BufferSpaceUsed);
349 AcpiUtBuildPackageObject (
350 ACPI_OPERAND_OBJECT *Obj,
355 AcpiUtCopyIelementToEelement (
357 ACPI_OPERAND_OBJECT *SourceObject,
358 ACPI_GENERIC_STATE *State,
362 AcpiUtCopyIelementToIelement (
364 ACPI_OPERAND_OBJECT *SourceObject,
365 ACPI_GENERIC_STATE *State,
369 AcpiUtCopyIobjectToEobject (
370 ACPI_OPERAND_OBJECT *Obj,
371 ACPI_BUFFER *RetBuffer);
374 AcpiUtCopyEsimpleToIsimple(
375 ACPI_OBJECT *UserObj,
376 ACPI_OPERAND_OBJECT **ReturnObj);
379 AcpiUtCopyEobjectToIobject (
381 ACPI_OPERAND_OBJECT **InternalObj);
384 AcpiUtCopyISimpleToIsimple (
385 ACPI_OPERAND_OBJECT *SourceObj,
386 ACPI_OPERAND_OBJECT *DestObj);
389 AcpiUtCopyIpackageToIpackage (
390 ACPI_OPERAND_OBJECT *SourceObj,
391 ACPI_OPERAND_OBJECT *DestObj,
392 ACPI_WALK_STATE *WalkState);
395 AcpiUtCopySimpleObject (
396 ACPI_OPERAND_OBJECT *SourceDesc,
397 ACPI_OPERAND_OBJECT *DestDesc);
400 AcpiUtCopyIobjectToIobject (
401 ACPI_OPERAND_OBJECT *SourceDesc,
402 ACPI_OPERAND_OBJECT **DestDesc,
403 ACPI_WALK_STATE *WalkState);
407 * UtCreate - Object creation
411 AcpiUtUpdateObjectReference (
412 ACPI_OPERAND_OBJECT *Object,
417 * UtDebug - Debug interfaces
421 AcpiUtInitStackPtrTrace (
425 AcpiUtTrackStackPtr (
431 ACPI_DEBUG_PRINT_INFO *DbgInfo);
436 ACPI_DEBUG_PRINT_INFO *DbgInfo,
442 ACPI_DEBUG_PRINT_INFO *DbgInfo,
448 ACPI_DEBUG_PRINT_INFO *DbgInfo,
454 ACPI_DEBUG_PRINT_INFO *DbgInfo);
459 ACPI_DEBUG_PRINT_INFO *DbgInfo,
465 ACPI_DEBUG_PRINT_INFO *DbgInfo,
471 ACPI_DEBUG_PRINT_INFO *DbgInfo,
487 AcpiUtReportWarning (
499 void ACPI_INTERNAL_VAR_XFACE
501 UINT32 RequestedDebugLevel,
503 ACPI_DEBUG_PRINT_INFO *DbgInfo,
505 ...) ACPI_PRINTF_LIKE_FUNC;
507 void ACPI_INTERNAL_VAR_XFACE
508 AcpiUtDebugPrintRaw (
509 UINT32 RequestedDebugLevel,
511 ACPI_DEBUG_PRINT_INFO *DbgInfo,
513 ...) ACPI_PRINTF_LIKE_FUNC;
517 * UtDelete - Object deletion
521 AcpiUtDeleteInternalObj (
522 ACPI_OPERAND_OBJECT *Object);
525 AcpiUtDeleteInternalPackageObject (
526 ACPI_OPERAND_OBJECT *Object);
529 AcpiUtDeleteInternalSimpleObject (
530 ACPI_OPERAND_OBJECT *Object);
533 AcpiUtDeleteInternalObjectList (
534 ACPI_OPERAND_OBJECT **ObjList);
538 * UtEval - object evaluation
541 /* Method name strings */
543 #define METHOD_NAME__HID "_HID"
544 #define METHOD_NAME__CID "_CID"
545 #define METHOD_NAME__UID "_UID"
546 #define METHOD_NAME__ADR "_ADR"
547 #define METHOD_NAME__STA "_STA"
548 #define METHOD_NAME__REG "_REG"
549 #define METHOD_NAME__SEG "_SEG"
550 #define METHOD_NAME__BBN "_BBN"
551 #define METHOD_NAME__PRT "_PRT"
552 #define METHOD_NAME__CRS "_CRS"
553 #define METHOD_NAME__PRS "_PRS"
554 #define METHOD_NAME__PRW "_PRW"
558 AcpiUtOsiImplementation (
559 ACPI_WALK_STATE *WalkState);
562 AcpiUtEvaluateObject (
563 ACPI_NAMESPACE_NODE *PrefixNode,
565 UINT32 ExpectedReturnBtypes,
566 ACPI_OPERAND_OBJECT **ReturnDesc);
569 AcpiUtEvaluateNumericObject (
571 ACPI_NAMESPACE_NODE *DeviceNode,
572 ACPI_INTEGER *Address);
576 ACPI_NAMESPACE_NODE *DeviceNode,
577 ACPI_DEVICE_ID *Hid);
581 ACPI_NAMESPACE_NODE *DeviceNode,
582 ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
586 ACPI_NAMESPACE_NODE *DeviceNode,
587 UINT32 *StatusFlags);
591 ACPI_NAMESPACE_NODE *DeviceNode,
592 ACPI_DEVICE_ID *Uid);
596 ACPI_NAMESPACE_NODE *DeviceNode,
600 * UtMutex - mutual exclusion interfaces
604 AcpiUtMutexInitialize (
608 AcpiUtMutexTerminate (
613 ACPI_MUTEX_HANDLE MutexId);
617 ACPI_MUTEX_HANDLE MutexId);
621 ACPI_MUTEX_HANDLE MutexId);
625 ACPI_MUTEX_HANDLE MutexId);
629 * UtObject - internal object create/delete/cache routines
632 ACPI_OPERAND_OBJECT *
633 AcpiUtCreateInternalObjectDbg (
637 ACPI_OBJECT_TYPE Type);
640 AcpiUtAllocateObjectDescDbg (
645 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
646 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT)
649 AcpiUtDeleteObjectDesc (
650 ACPI_OPERAND_OBJECT *Object);
653 AcpiUtValidInternalObject (
656 ACPI_OPERAND_OBJECT *
657 AcpiUtCreateBufferObject (
658 ACPI_SIZE BufferSize);
660 ACPI_OPERAND_OBJECT *
661 AcpiUtCreateStringObject (
662 ACPI_SIZE StringSize);
666 * UtRefCnt - Object reference count management
671 ACPI_OPERAND_OBJECT *Object);
674 AcpiUtRemoveReference (
675 ACPI_OPERAND_OBJECT *Object);
678 * UtSize - Object size routines
682 AcpiUtGetSimpleObjectSize (
683 ACPI_OPERAND_OBJECT *Obj,
684 ACPI_SIZE *ObjLength);
687 AcpiUtGetPackageObjectSize (
688 ACPI_OPERAND_OBJECT *Obj,
689 ACPI_SIZE *ObjLength);
693 ACPI_OPERAND_OBJECT *Obj,
694 ACPI_SIZE *ObjLength);
697 AcpiUtGetElementLength (
699 ACPI_OPERAND_OBJECT *SourceObject,
700 ACPI_GENERIC_STATE *State,
705 * UtState - Generic state creation/cache routines
709 AcpiUtPushGenericState (
710 ACPI_GENERIC_STATE **ListHead,
711 ACPI_GENERIC_STATE *State);
714 AcpiUtPopGenericState (
715 ACPI_GENERIC_STATE **ListHead);
719 AcpiUtCreateGenericState (
723 AcpiUtCreateThreadState (
727 AcpiUtCreateUpdateState (
728 ACPI_OPERAND_OBJECT *Object,
732 AcpiUtCreatePkgState (
733 void *InternalObject,
734 void *ExternalObject,
738 AcpiUtCreateUpdateStateAndPush (
739 ACPI_OPERAND_OBJECT *Object,
741 ACPI_GENERIC_STATE **StateList);
744 AcpiUtCreatePkgStateAndPush (
745 void *InternalObject,
746 void *ExternalObject,
748 ACPI_GENERIC_STATE **StateList);
751 AcpiUtCreateControlState (
755 AcpiUtDeleteGenericState (
756 ACPI_GENERIC_STATE *State);
759 AcpiUtDeleteGenericStateCache (
763 AcpiUtDeleteObjectCache (
777 ACPI_INTEGER InDividend,
778 ACPI_INTEGER InDivisor,
779 ACPI_INTEGER *OutQuotient,
780 ACPI_INTEGER *OutRemainder);
784 ACPI_INTEGER InDividend,
786 ACPI_INTEGER *OutQuotient,
787 UINT32 *OutRemainder);
790 AcpiUtValidAcpiName (
794 AcpiUtValidAcpiCharacter (
801 ACPI_INTEGER *RetInteger);
803 /* Values for Base above (16=Hex, 10=Decimal) */
805 #define ACPI_ANY_BASE 0
812 AcpiUtGetResourceEndTag (
813 ACPI_OPERAND_OBJECT *ObjDesc);
816 AcpiUtGenerateChecksum (
821 AcpiUtDwordByteSwap (
825 AcpiUtSetIntegerWidth (
828 #ifdef ACPI_DEBUG_OUTPUT
830 AcpiUtDisplayInitPathname (
832 ACPI_NAMESPACE_NODE *ObjHandle,
839 * Utalloc - memory allocation and object caching
843 AcpiUtAcquireFromCache (
847 AcpiUtReleaseToCache (
852 AcpiUtDeleteGenericCache (
856 AcpiUtValidateBuffer (
857 ACPI_BUFFER *Buffer);
860 AcpiUtInitializeBuffer (
862 ACPI_SIZE RequiredLength);
865 /* Memory allocation functions */
882 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
885 AcpiUtAllocateAndTrack (
892 AcpiUtCallocateAndTrack (
905 ACPI_DEBUG_MEM_BLOCK *
906 AcpiUtFindAllocation (
911 AcpiUtTrackAllocation (
913 ACPI_DEBUG_MEM_BLOCK *Address,
921 AcpiUtRemoveAllocation (
923 ACPI_DEBUG_MEM_BLOCK *Address,
929 AcpiUtDumpAllocationInfo (
933 AcpiUtDumpAllocations (
939 #endif /* _ACUTILS_H */