1 /******************************************************************************
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2005, 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,
128 typedef struct acpi_pkg_info
137 #define REF_INCREMENT (UINT16) 0
138 #define REF_DECREMENT (UINT16) 1
139 #define REF_FORCE_DELETE (UINT16) 2
141 /* AcpiUtDumpBuffer */
143 #define DB_BYTE_DISPLAY 1
144 #define DB_WORD_DISPLAY 2
145 #define DB_DWORD_DISPLAY 4
146 #define DB_QWORD_DISPLAY 8
150 * utglobal - Global data structures and procedures
156 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
166 ACPI_OBJECT_TYPE Type);
173 AcpiUtGetDescriptorName (
177 AcpiUtGetObjectTypeName (
178 ACPI_OPERAND_OBJECT *ObjDesc);
181 AcpiUtGetRegionName (
189 AcpiUtHexToAsciiChar (
190 ACPI_INTEGER Integer,
194 AcpiUtValidObjectType (
195 ACPI_OBJECT_TYPE Type);
199 * utinit - miscellaneous initialization and shutdown
202 AcpiUtHardwareInitialize (
206 AcpiUtSubsystemShutdown (
215 * utclib - Local implementations of C library functions
217 #ifndef ACPI_USE_SYSTEM_CLIBRARY
226 const char *SrcString);
231 const char *SrcString,
249 const char *String2);
254 const char *SrcString);
259 const char *SrcString,
282 ACPI_NATIVE_UINT Value,
293 extern const UINT8 _acpi_ctype[];
295 #define _ACPI_XA 0x00 /* extra alphabetic - not supported */
296 #define _ACPI_XS 0x40 /* extra space */
297 #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
298 #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
299 #define _ACPI_DI 0x04 /* '0'-'9' */
300 #define _ACPI_LO 0x02 /* 'a'-'z' */
301 #define _ACPI_PU 0x10 /* punctuation */
302 #define _ACPI_SP 0x08 /* space */
303 #define _ACPI_UP 0x01 /* 'A'-'Z' */
304 #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
306 #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
307 #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
308 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
309 #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
310 #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
311 #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
312 #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
314 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
318 * utcopy - Object construction and conversion interfaces
321 AcpiUtBuildSimpleObject(
322 ACPI_OPERAND_OBJECT *Obj,
323 ACPI_OBJECT *UserObj,
325 UINT32 *BufferSpaceUsed);
328 AcpiUtBuildPackageObject (
329 ACPI_OPERAND_OBJECT *Obj,
334 AcpiUtCopyIobjectToEobject (
335 ACPI_OPERAND_OBJECT *Obj,
336 ACPI_BUFFER *RetBuffer);
339 AcpiUtCopyEobjectToIobject (
341 ACPI_OPERAND_OBJECT **InternalObj);
344 AcpiUtCopyISimpleToIsimple (
345 ACPI_OPERAND_OBJECT *SourceObj,
346 ACPI_OPERAND_OBJECT *DestObj);
349 AcpiUtCopyIobjectToIobject (
350 ACPI_OPERAND_OBJECT *SourceDesc,
351 ACPI_OPERAND_OBJECT **DestDesc,
352 ACPI_WALK_STATE *WalkState);
356 * utcreate - Object creation
359 AcpiUtUpdateObjectReference (
360 ACPI_OPERAND_OBJECT *Object,
365 * utdebug - Debug interfaces
368 AcpiUtInitStackPtrTrace (
372 AcpiUtTrackStackPtr (
378 const char *FunctionName,
385 const char *FunctionName,
393 const char *FunctionName,
401 const char *FunctionName,
409 const char *FunctionName,
416 const char *FunctionName,
424 const char *FunctionName,
432 const char *FunctionName,
450 AcpiUtReportWarning (
462 void ACPI_INTERNAL_VAR_XFACE
464 UINT32 RequestedDebugLevel,
466 const char *FunctionName,
470 ...) ACPI_PRINTF_LIKE_FUNC;
472 void ACPI_INTERNAL_VAR_XFACE
473 AcpiUtDebugPrintRaw (
474 UINT32 RequestedDebugLevel,
476 const char *FunctionName,
480 ...) ACPI_PRINTF_LIKE_FUNC;
484 * utdelete - Object deletion and reference counts
488 ACPI_OPERAND_OBJECT *Object);
491 AcpiUtRemoveReference (
492 ACPI_OPERAND_OBJECT *Object);
495 AcpiUtDeleteInternalPackageObject (
496 ACPI_OPERAND_OBJECT *Object);
499 AcpiUtDeleteInternalSimpleObject (
500 ACPI_OPERAND_OBJECT *Object);
503 AcpiUtDeleteInternalObjectList (
504 ACPI_OPERAND_OBJECT **ObjList);
508 * uteval - object evaluation
511 AcpiUtOsiImplementation (
512 ACPI_WALK_STATE *WalkState);
515 AcpiUtEvaluateObject (
516 ACPI_NAMESPACE_NODE *PrefixNode,
518 UINT32 ExpectedReturnBtypes,
519 ACPI_OPERAND_OBJECT **ReturnDesc);
522 AcpiUtEvaluateNumericObject (
524 ACPI_NAMESPACE_NODE *DeviceNode,
525 ACPI_INTEGER *Address);
529 ACPI_NAMESPACE_NODE *DeviceNode,
530 ACPI_DEVICE_ID *Hid);
534 ACPI_NAMESPACE_NODE *DeviceNode,
535 ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
539 ACPI_NAMESPACE_NODE *DeviceNode,
540 UINT32 *StatusFlags);
544 ACPI_NAMESPACE_NODE *DeviceNode,
545 ACPI_DEVICE_ID *Uid);
549 ACPI_NAMESPACE_NODE *DeviceNode,
554 * utobject - internal object create/delete/cache routines
556 ACPI_OPERAND_OBJECT *
557 AcpiUtCreateInternalObjectDbg (
561 ACPI_OBJECT_TYPE Type);
564 AcpiUtAllocateObjectDescDbg (
569 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
570 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
573 AcpiUtDeleteObjectDesc (
574 ACPI_OPERAND_OBJECT *Object);
577 AcpiUtValidInternalObject (
580 ACPI_OPERAND_OBJECT *
581 AcpiUtCreateBufferObject (
582 ACPI_SIZE BufferSize);
584 ACPI_OPERAND_OBJECT *
585 AcpiUtCreateStringObject (
586 ACPI_SIZE StringSize);
590 ACPI_OPERAND_OBJECT *Obj,
591 ACPI_SIZE *ObjLength);
595 * utstate - Generic state creation/cache routines
598 AcpiUtPushGenericState (
599 ACPI_GENERIC_STATE **ListHead,
600 ACPI_GENERIC_STATE *State);
603 AcpiUtPopGenericState (
604 ACPI_GENERIC_STATE **ListHead);
608 AcpiUtCreateGenericState (
612 AcpiUtCreateThreadState (
616 AcpiUtCreateUpdateState (
617 ACPI_OPERAND_OBJECT *Object,
621 AcpiUtCreatePkgState (
622 void *InternalObject,
623 void *ExternalObject,
627 AcpiUtCreateUpdateStateAndPush (
628 ACPI_OPERAND_OBJECT *Object,
630 ACPI_GENERIC_STATE **StateList);
633 AcpiUtCreatePkgStateAndPush (
634 void *InternalObject,
635 void *ExternalObject,
637 ACPI_GENERIC_STATE **StateList);
640 AcpiUtCreateControlState (
644 AcpiUtDeleteGenericState (
645 ACPI_GENERIC_STATE *State);
653 ACPI_INTEGER InDividend,
654 ACPI_INTEGER InDivisor,
655 ACPI_INTEGER *OutQuotient,
656 ACPI_INTEGER *OutRemainder);
660 ACPI_INTEGER InDividend,
662 ACPI_INTEGER *OutQuotient,
663 UINT32 *OutRemainder);
669 AcpiUtAllocateOwnerId (
670 ACPI_OWNER_ID *OwnerId);
673 AcpiUtReleaseOwnerId (
674 ACPI_OWNER_ID *OwnerId);
677 AcpiUtWalkPackageTree (
678 ACPI_OPERAND_OBJECT *SourceObject,
680 ACPI_PKG_CALLBACK WalkCallback,
693 AcpiUtValidAcpiName (
697 AcpiUtValidAcpiCharacter (
704 ACPI_INTEGER *RetInteger);
706 /* Values for Base above (16=Hex, 10=Decimal) */
708 #define ACPI_ANY_BASE 0
711 AcpiUtGetDescriptorLength (
715 AcpiUtGetResourceLength (
719 AcpiUtGetResourceType (
723 AcpiUtGetResourceEndTag (
724 ACPI_OPERAND_OBJECT *ObjDesc);
727 AcpiUtGenerateChecksum (
732 AcpiUtDwordByteSwap (
736 AcpiUtSetIntegerWidth (
739 #ifdef ACPI_DEBUG_OUTPUT
741 AcpiUtDisplayInitPathname (
743 ACPI_NAMESPACE_NODE *ObjHandle,
750 * utmutex - mutex support
753 AcpiUtMutexInitialize (
757 AcpiUtMutexTerminate (
762 ACPI_MUTEX_HANDLE MutexId);
766 ACPI_MUTEX_HANDLE MutexId);
770 * utalloc - memory allocation and object caching
781 AcpiUtValidateBuffer (
782 ACPI_BUFFER *Buffer);
785 AcpiUtInitializeBuffer (
787 ACPI_SIZE RequiredLength);
803 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
805 AcpiUtAllocateAndTrack (
812 AcpiUtCallocateAndTrack (
826 AcpiUtDumpAllocationInfo (
830 AcpiUtDumpAllocations (
835 #endif /* _ACUTILS_H */