Sync ACPICA with Intel's version 20170831.
[dragonfly.git] / sys / contrib / dev / acpica / source / include / acutils.h
blobb2cdf12b006b504a4717464cc384590552972b89
1 /******************************************************************************
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12 * All rights reserved.
14 * 2. License
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
19 * property rights.
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
38 * conditions are met:
40 * 3. Conditions
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
64 * make.
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
70 * distribution.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
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
88 * PARTICULAR PURPOSE.
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
97 * LIMITED REMEDY.
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 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #ifndef _ACUTILS_H
153 #define _ACUTILS_H
156 extern const UINT8 AcpiGbl_ResourceAmlSizes[];
157 extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[];
159 /* Strings used by the disassembler and debugger resource dump routines */
161 #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
163 extern const char *AcpiGbl_BmDecode[];
164 extern const char *AcpiGbl_ConfigDecode[];
165 extern const char *AcpiGbl_ConsumeDecode[];
166 extern const char *AcpiGbl_DecDecode[];
167 extern const char *AcpiGbl_HeDecode[];
168 extern const char *AcpiGbl_IoDecode[];
169 extern const char *AcpiGbl_LlDecode[];
170 extern const char *AcpiGbl_MaxDecode[];
171 extern const char *AcpiGbl_MemDecode[];
172 extern const char *AcpiGbl_MinDecode[];
173 extern const char *AcpiGbl_MtpDecode[];
174 extern const char *AcpiGbl_RngDecode[];
175 extern const char *AcpiGbl_RwDecode[];
176 extern const char *AcpiGbl_ShrDecode[];
177 extern const char *AcpiGbl_SizDecode[];
178 extern const char *AcpiGbl_TrsDecode[];
179 extern const char *AcpiGbl_TtpDecode[];
180 extern const char *AcpiGbl_TypDecode[];
181 extern const char *AcpiGbl_PpcDecode[];
182 extern const char *AcpiGbl_IorDecode[];
183 extern const char *AcpiGbl_DtsDecode[];
184 extern const char *AcpiGbl_CtDecode[];
185 extern const char *AcpiGbl_SbtDecode[];
186 extern const char *AcpiGbl_AmDecode[];
187 extern const char *AcpiGbl_SmDecode[];
188 extern const char *AcpiGbl_WmDecode[];
189 extern const char *AcpiGbl_CphDecode[];
190 extern const char *AcpiGbl_CpoDecode[];
191 extern const char *AcpiGbl_DpDecode[];
192 extern const char *AcpiGbl_EdDecode[];
193 extern const char *AcpiGbl_BpbDecode[];
194 extern const char *AcpiGbl_SbDecode[];
195 extern const char *AcpiGbl_FcDecode[];
196 extern const char *AcpiGbl_PtDecode[];
197 extern const char *AcpiGbl_PtypDecode[];
198 #endif
201 * For the iASL compiler case, the output is redirected to stderr so that
202 * any of the various ACPI errors and warnings do not appear in the output
203 * files, for either the compiler or disassembler portions of the tool.
205 #ifdef ACPI_ASL_COMPILER
207 #include <stdio.h>
209 #define ACPI_MSG_REDIRECT_BEGIN \
210 FILE *OutputFile = AcpiGbl_OutputFile; \
211 AcpiOsRedirectOutput (stderr);
213 #define ACPI_MSG_REDIRECT_END \
214 AcpiOsRedirectOutput (OutputFile);
216 #else
218 * non-iASL case - no redirection, nothing to do
220 #define ACPI_MSG_REDIRECT_BEGIN
221 #define ACPI_MSG_REDIRECT_END
222 #endif
225 * Common error message prefixes
227 #ifndef ACPI_MSG_ERROR
228 #define ACPI_MSG_ERROR "ACPI Error: "
229 #endif
230 #ifndef ACPI_MSG_EXCEPTION
231 #define ACPI_MSG_EXCEPTION "ACPI Exception: "
232 #endif
233 #ifndef ACPI_MSG_WARNING
234 #define ACPI_MSG_WARNING "ACPI Warning: "
235 #endif
236 #ifndef ACPI_MSG_INFO
237 #define ACPI_MSG_INFO "ACPI: "
238 #endif
240 #ifndef ACPI_MSG_BIOS_ERROR
241 #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
242 #endif
243 #ifndef ACPI_MSG_BIOS_WARNING
244 #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
245 #endif
248 * Common message suffix
250 #define ACPI_MSG_SUFFIX \
251 AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
253 /* Flags to indicate implicit or explicit string-to-integer conversion */
255 #define ACPI_IMPLICIT_CONVERSION TRUE
256 #define ACPI_NO_IMPLICIT_CONVERSION FALSE
258 /* Types for Resource descriptor entries */
260 #define ACPI_INVALID_RESOURCE 0
261 #define ACPI_FIXED_LENGTH 1
262 #define ACPI_VARIABLE_LENGTH 2
263 #define ACPI_SMALL_VARIABLE_LENGTH 3
265 typedef
266 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
267 UINT8 *Aml,
268 UINT32 Length,
269 UINT32 Offset,
270 UINT8 ResourceIndex,
271 void **Context);
273 typedef
274 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
275 UINT8 ObjectType,
276 ACPI_OPERAND_OBJECT *SourceObject,
277 ACPI_GENERIC_STATE *State,
278 void *Context);
280 typedef struct acpi_pkg_info
282 UINT8 *FreeSpace;
283 ACPI_SIZE Length;
284 UINT32 ObjectSpace;
285 UINT32 NumPackages;
287 } ACPI_PKG_INFO;
289 /* Object reference counts */
291 #define REF_INCREMENT (UINT16) 0
292 #define REF_DECREMENT (UINT16) 1
294 /* AcpiUtDumpBuffer */
296 #define DB_BYTE_DISPLAY 1
297 #define DB_WORD_DISPLAY 2
298 #define DB_DWORD_DISPLAY 4
299 #define DB_QWORD_DISPLAY 8
303 * utascii - ASCII utilities
305 BOOLEAN
306 AcpiUtValidNameseg (
307 char *Signature);
309 BOOLEAN
310 AcpiUtValidNameChar (
311 char Character,
312 UINT32 Position);
314 void
315 AcpiUtCheckAndRepairAscii (
316 UINT8 *Name,
317 char *RepairedName,
318 UINT32 Count);
322 * utnonansi - Non-ANSI C library functions
324 void
325 AcpiUtStrupr (
326 char *SrcString);
328 void
329 AcpiUtStrlwr (
330 char *SrcString);
333 AcpiUtStricmp (
334 char *String1,
335 char *String2);
339 * utstrsuppt - string-to-integer conversion support functions
341 ACPI_STATUS
342 AcpiUtConvertOctalString (
343 char *String,
344 UINT64 *ReturnValue);
346 ACPI_STATUS
347 AcpiUtConvertDecimalString (
348 char *String,
349 UINT64 *ReturnValuePtr);
351 ACPI_STATUS
352 AcpiUtConvertHexString (
353 char *String,
354 UINT64 *ReturnValuePtr);
356 char
357 AcpiUtRemoveWhitespace (
358 char **String);
360 char
361 AcpiUtRemoveLeadingZeros (
362 char **String);
364 BOOLEAN
365 AcpiUtDetectHexPrefix (
366 char **String);
368 BOOLEAN
369 AcpiUtDetectOctalPrefix (
370 char **String);
374 * utstrtoul64 - string-to-integer conversion functions
376 ACPI_STATUS
377 AcpiUtStrtoul64 (
378 char *String,
379 UINT64 *RetInteger);
381 UINT64
382 AcpiUtExplicitStrtoul64 (
383 char *String);
385 UINT64
386 AcpiUtImplicitStrtoul64 (
387 char *String);
391 * utglobal - Global data structures and procedures
393 ACPI_STATUS
394 AcpiUtInitGlobals (
395 void);
397 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
399 const char *
400 AcpiUtGetMutexName (
401 UINT32 MutexId);
403 const char *
404 AcpiUtGetNotifyName (
405 UINT32 NotifyValue,
406 ACPI_OBJECT_TYPE Type);
407 #endif
409 const char *
410 AcpiUtGetTypeName (
411 ACPI_OBJECT_TYPE Type);
413 const char *
414 AcpiUtGetNodeName (
415 void *Object);
417 const char *
418 AcpiUtGetDescriptorName (
419 void *Object);
421 const char *
422 AcpiUtGetReferenceName (
423 ACPI_OPERAND_OBJECT *Object);
425 const char *
426 AcpiUtGetObjectTypeName (
427 ACPI_OPERAND_OBJECT *ObjDesc);
429 const char *
430 AcpiUtGetRegionName (
431 UINT8 SpaceId);
433 const char *
434 AcpiUtGetEventName (
435 UINT32 EventId);
437 const char *
438 AcpiUtGetArgumentTypeName (
439 UINT32 ArgType);
441 char
442 AcpiUtHexToAsciiChar (
443 UINT64 Integer,
444 UINT32 Position);
446 ACPI_STATUS
447 AcpiUtAsciiToHexByte (
448 char *TwoAsciiChars,
449 UINT8 *ReturnByte);
451 UINT8
452 AcpiUtAsciiCharToHex (
453 int HexChar);
455 BOOLEAN
456 AcpiUtValidObjectType (
457 ACPI_OBJECT_TYPE Type);
461 * utinit - miscellaneous initialization and shutdown
463 ACPI_STATUS
464 AcpiUtHardwareInitialize (
465 void);
467 void
468 AcpiUtSubsystemShutdown (
469 void);
473 * utcopy - Object construction and conversion interfaces
475 ACPI_STATUS
476 AcpiUtBuildSimpleObject(
477 ACPI_OPERAND_OBJECT *Obj,
478 ACPI_OBJECT *UserObj,
479 UINT8 *DataSpace,
480 UINT32 *BufferSpaceUsed);
482 ACPI_STATUS
483 AcpiUtBuildPackageObject (
484 ACPI_OPERAND_OBJECT *Obj,
485 UINT8 *Buffer,
486 UINT32 *SpaceUsed);
488 ACPI_STATUS
489 AcpiUtCopyIobjectToEobject (
490 ACPI_OPERAND_OBJECT *Obj,
491 ACPI_BUFFER *RetBuffer);
493 ACPI_STATUS
494 AcpiUtCopyEobjectToIobject (
495 ACPI_OBJECT *Obj,
496 ACPI_OPERAND_OBJECT **InternalObj);
498 ACPI_STATUS
499 AcpiUtCopyISimpleToIsimple (
500 ACPI_OPERAND_OBJECT *SourceObj,
501 ACPI_OPERAND_OBJECT *DestObj);
503 ACPI_STATUS
504 AcpiUtCopyIobjectToIobject (
505 ACPI_OPERAND_OBJECT *SourceDesc,
506 ACPI_OPERAND_OBJECT **DestDesc,
507 ACPI_WALK_STATE *WalkState);
511 * utcreate - Object creation
513 ACPI_STATUS
514 AcpiUtUpdateObjectReference (
515 ACPI_OPERAND_OBJECT *Object,
516 UINT16 Action);
520 * utdebug - Debug interfaces
522 void
523 AcpiUtInitStackPtrTrace (
524 void);
526 void
527 AcpiUtTrackStackPtr (
528 void);
530 void
531 AcpiUtTrace (
532 UINT32 LineNumber,
533 const char *FunctionName,
534 const char *ModuleName,
535 UINT32 ComponentId);
537 void
538 AcpiUtTracePtr (
539 UINT32 LineNumber,
540 const char *FunctionName,
541 const char *ModuleName,
542 UINT32 ComponentId,
543 const void *Pointer);
545 void
546 AcpiUtTraceU32 (
547 UINT32 LineNumber,
548 const char *FunctionName,
549 const char *ModuleName,
550 UINT32 ComponentId,
551 UINT32 Integer);
553 void
554 AcpiUtTraceStr (
555 UINT32 LineNumber,
556 const char *FunctionName,
557 const char *ModuleName,
558 UINT32 ComponentId,
559 const char *String);
561 void
562 AcpiUtExit (
563 UINT32 LineNumber,
564 const char *FunctionName,
565 const char *ModuleName,
566 UINT32 ComponentId);
568 void
569 AcpiUtStatusExit (
570 UINT32 LineNumber,
571 const char *FunctionName,
572 const char *ModuleName,
573 UINT32 ComponentId,
574 ACPI_STATUS Status);
576 void
577 AcpiUtValueExit (
578 UINT32 LineNumber,
579 const char *FunctionName,
580 const char *ModuleName,
581 UINT32 ComponentId,
582 UINT64 Value);
584 void
585 AcpiUtPtrExit (
586 UINT32 LineNumber,
587 const char *FunctionName,
588 const char *ModuleName,
589 UINT32 ComponentId,
590 UINT8 *Ptr);
592 void
593 AcpiUtStrExit (
594 UINT32 LineNumber,
595 const char *FunctionName,
596 const char *ModuleName,
597 UINT32 ComponentId,
598 const char *String);
600 void
601 AcpiUtDebugDumpBuffer (
602 UINT8 *Buffer,
603 UINT32 Count,
604 UINT32 Display,
605 UINT32 ComponentId);
607 void
608 AcpiUtDumpBuffer (
609 UINT8 *Buffer,
610 UINT32 Count,
611 UINT32 Display,
612 UINT32 Offset);
614 #ifdef ACPI_APPLICATION
615 void
616 AcpiUtDumpBufferToFile (
617 ACPI_FILE File,
618 UINT8 *Buffer,
619 UINT32 Count,
620 UINT32 Display,
621 UINT32 BaseOffset);
622 #endif
624 void
625 AcpiUtReportError (
626 char *ModuleName,
627 UINT32 LineNumber);
629 void
630 AcpiUtReportInfo (
631 char *ModuleName,
632 UINT32 LineNumber);
634 void
635 AcpiUtReportWarning (
636 char *ModuleName,
637 UINT32 LineNumber);
641 * utdelete - Object deletion and reference counts
643 void
644 AcpiUtAddReference (
645 ACPI_OPERAND_OBJECT *Object);
647 void
648 AcpiUtRemoveReference (
649 ACPI_OPERAND_OBJECT *Object);
651 void
652 AcpiUtDeleteInternalPackageObject (
653 ACPI_OPERAND_OBJECT *Object);
655 void
656 AcpiUtDeleteInternalSimpleObject (
657 ACPI_OPERAND_OBJECT *Object);
659 void
660 AcpiUtDeleteInternalObjectList (
661 ACPI_OPERAND_OBJECT **ObjList);
665 * uteval - object evaluation
667 ACPI_STATUS
668 AcpiUtEvaluateObject (
669 ACPI_NAMESPACE_NODE *PrefixNode,
670 const char *Path,
671 UINT32 ExpectedReturnBtypes,
672 ACPI_OPERAND_OBJECT **ReturnDesc);
674 ACPI_STATUS
675 AcpiUtEvaluateNumericObject (
676 const char *ObjectName,
677 ACPI_NAMESPACE_NODE *DeviceNode,
678 UINT64 *Value);
680 ACPI_STATUS
681 AcpiUtExecute_STA (
682 ACPI_NAMESPACE_NODE *DeviceNode,
683 UINT32 *StatusFlags);
685 ACPI_STATUS
686 AcpiUtExecutePowerMethods (
687 ACPI_NAMESPACE_NODE *DeviceNode,
688 const char **MethodNames,
689 UINT8 MethodCount,
690 UINT8 *OutValues);
694 * utids - device ID support
696 ACPI_STATUS
697 AcpiUtExecute_HID (
698 ACPI_NAMESPACE_NODE *DeviceNode,
699 ACPI_PNP_DEVICE_ID **ReturnId);
701 ACPI_STATUS
702 AcpiUtExecute_UID (
703 ACPI_NAMESPACE_NODE *DeviceNode,
704 ACPI_PNP_DEVICE_ID **ReturnId);
706 ACPI_STATUS
707 AcpiUtExecute_CID (
708 ACPI_NAMESPACE_NODE *DeviceNode,
709 ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
711 ACPI_STATUS
712 AcpiUtExecute_CLS (
713 ACPI_NAMESPACE_NODE *DeviceNode,
714 ACPI_PNP_DEVICE_ID **ReturnId);
718 * utlock - reader/writer locks
720 ACPI_STATUS
721 AcpiUtCreateRwLock (
722 ACPI_RW_LOCK *Lock);
724 void
725 AcpiUtDeleteRwLock (
726 ACPI_RW_LOCK *Lock);
728 ACPI_STATUS
729 AcpiUtAcquireReadLock (
730 ACPI_RW_LOCK *Lock);
732 ACPI_STATUS
733 AcpiUtReleaseReadLock (
734 ACPI_RW_LOCK *Lock);
736 ACPI_STATUS
737 AcpiUtAcquireWriteLock (
738 ACPI_RW_LOCK *Lock);
740 void
741 AcpiUtReleaseWriteLock (
742 ACPI_RW_LOCK *Lock);
746 * utobject - internal object create/delete/cache routines
748 ACPI_OPERAND_OBJECT *
749 AcpiUtCreateInternalObjectDbg (
750 const char *ModuleName,
751 UINT32 LineNumber,
752 UINT32 ComponentId,
753 ACPI_OBJECT_TYPE Type);
755 void *
756 AcpiUtAllocateObjectDescDbg (
757 const char *ModuleName,
758 UINT32 LineNumber,
759 UINT32 ComponentId);
761 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
762 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
764 void
765 AcpiUtDeleteObjectDesc (
766 ACPI_OPERAND_OBJECT *Object);
768 BOOLEAN
769 AcpiUtValidInternalObject (
770 void *Object);
772 ACPI_OPERAND_OBJECT *
773 AcpiUtCreatePackageObject (
774 UINT32 Count);
776 ACPI_OPERAND_OBJECT *
777 AcpiUtCreateIntegerObject (
778 UINT64 Value);
780 ACPI_OPERAND_OBJECT *
781 AcpiUtCreateBufferObject (
782 ACPI_SIZE BufferSize);
784 ACPI_OPERAND_OBJECT *
785 AcpiUtCreateStringObject (
786 ACPI_SIZE StringSize);
788 ACPI_STATUS
789 AcpiUtGetObjectSize(
790 ACPI_OPERAND_OBJECT *Obj,
791 ACPI_SIZE *ObjLength);
795 * utosi - Support for the _OSI predefined control method
797 ACPI_STATUS
798 AcpiUtInitializeInterfaces (
799 void);
801 ACPI_STATUS
802 AcpiUtInterfaceTerminate (
803 void);
805 ACPI_STATUS
806 AcpiUtInstallInterface (
807 ACPI_STRING InterfaceName);
809 ACPI_STATUS
810 AcpiUtRemoveInterface (
811 ACPI_STRING InterfaceName);
813 ACPI_STATUS
814 AcpiUtUpdateInterfaces (
815 UINT8 Action);
817 ACPI_INTERFACE_INFO *
818 AcpiUtGetInterface (
819 ACPI_STRING InterfaceName);
821 ACPI_STATUS
822 AcpiUtOsiImplementation (
823 ACPI_WALK_STATE *WalkState);
827 * utpredef - support for predefined names
829 const ACPI_PREDEFINED_INFO *
830 AcpiUtGetNextPredefinedMethod (
831 const ACPI_PREDEFINED_INFO *ThisName);
833 const ACPI_PREDEFINED_INFO *
834 AcpiUtMatchPredefinedMethod (
835 char *Name);
837 void
838 AcpiUtGetExpectedReturnTypes (
839 char *Buffer,
840 UINT32 ExpectedBtypes);
842 #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
843 const ACPI_PREDEFINED_INFO *
844 AcpiUtMatchResourceName (
845 char *Name);
847 void
848 AcpiUtDisplayPredefinedMethod (
849 char *Buffer,
850 const ACPI_PREDEFINED_INFO *ThisName,
851 BOOLEAN MultiLine);
853 UINT32
854 AcpiUtGetResourceBitWidth (
855 char *Buffer,
856 UINT16 Types);
857 #endif
861 * utstate - Generic state creation/cache routines
863 void
864 AcpiUtPushGenericState (
865 ACPI_GENERIC_STATE **ListHead,
866 ACPI_GENERIC_STATE *State);
868 ACPI_GENERIC_STATE *
869 AcpiUtPopGenericState (
870 ACPI_GENERIC_STATE **ListHead);
873 ACPI_GENERIC_STATE *
874 AcpiUtCreateGenericState (
875 void);
877 ACPI_THREAD_STATE *
878 AcpiUtCreateThreadState (
879 void);
881 ACPI_GENERIC_STATE *
882 AcpiUtCreateUpdateState (
883 ACPI_OPERAND_OBJECT *Object,
884 UINT16 Action);
886 ACPI_GENERIC_STATE *
887 AcpiUtCreatePkgState (
888 void *InternalObject,
889 void *ExternalObject,
890 UINT32 Index);
892 ACPI_STATUS
893 AcpiUtCreateUpdateStateAndPush (
894 ACPI_OPERAND_OBJECT *Object,
895 UINT16 Action,
896 ACPI_GENERIC_STATE **StateList);
898 ACPI_GENERIC_STATE *
899 AcpiUtCreateControlState (
900 void);
902 void
903 AcpiUtDeleteGenericState (
904 ACPI_GENERIC_STATE *State);
908 * utmath
910 ACPI_STATUS
911 AcpiUtDivide (
912 UINT64 InDividend,
913 UINT64 InDivisor,
914 UINT64 *OutQuotient,
915 UINT64 *OutRemainder);
917 ACPI_STATUS
918 AcpiUtShortDivide (
919 UINT64 InDividend,
920 UINT32 Divisor,
921 UINT64 *OutQuotient,
922 UINT32 *OutRemainder);
924 ACPI_STATUS
925 AcpiUtShortMultiply (
926 UINT64 InMultiplicand,
927 UINT32 Multiplier,
928 UINT64 *Outproduct);
930 ACPI_STATUS
931 AcpiUtShortShiftLeft (
932 UINT64 Operand,
933 UINT32 Count,
934 UINT64 *OutResult);
936 ACPI_STATUS
937 AcpiUtShortShiftRight (
938 UINT64 Operand,
939 UINT32 Count,
940 UINT64 *OutResult);
944 * utmisc
946 const ACPI_EXCEPTION_INFO *
947 AcpiUtValidateException (
948 ACPI_STATUS Status);
950 BOOLEAN
951 AcpiUtIsPciRootBridge (
952 char *Id);
954 #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
955 BOOLEAN
956 AcpiUtIsAmlTable (
957 ACPI_TABLE_HEADER *Table);
958 #endif
960 ACPI_STATUS
961 AcpiUtWalkPackageTree (
962 ACPI_OPERAND_OBJECT *SourceObject,
963 void *TargetObject,
964 ACPI_PKG_CALLBACK WalkCallback,
965 void *Context);
967 /* Values for Base above (16=Hex, 10=Decimal) */
969 #define ACPI_ANY_BASE 0
972 UINT32
973 AcpiUtDwordByteSwap (
974 UINT32 Value);
976 void
977 AcpiUtSetIntegerWidth (
978 UINT8 Revision);
980 #ifdef ACPI_DEBUG_OUTPUT
981 void
982 AcpiUtDisplayInitPathname (
983 UINT8 Type,
984 ACPI_NAMESPACE_NODE *ObjHandle,
985 const char *Path);
986 #endif
990 * utownerid - Support for Table/Method Owner IDs
992 ACPI_STATUS
993 AcpiUtAllocateOwnerId (
994 ACPI_OWNER_ID *OwnerId);
996 void
997 AcpiUtReleaseOwnerId (
998 ACPI_OWNER_ID *OwnerId);
1002 * utresrc
1004 ACPI_STATUS
1005 AcpiUtWalkAmlResources (
1006 ACPI_WALK_STATE *WalkState,
1007 UINT8 *Aml,
1008 ACPI_SIZE AmlLength,
1009 ACPI_WALK_AML_CALLBACK UserFunction,
1010 void **Context);
1012 ACPI_STATUS
1013 AcpiUtValidateResource (
1014 ACPI_WALK_STATE *WalkState,
1015 void *Aml,
1016 UINT8 *ReturnIndex);
1018 UINT32
1019 AcpiUtGetDescriptorLength (
1020 void *Aml);
1022 UINT16
1023 AcpiUtGetResourceLength (
1024 void *Aml);
1026 UINT8
1027 AcpiUtGetResourceHeaderLength (
1028 void *Aml);
1030 UINT8
1031 AcpiUtGetResourceType (
1032 void *Aml);
1034 ACPI_STATUS
1035 AcpiUtGetResourceEndTag (
1036 ACPI_OPERAND_OBJECT *ObjDesc,
1037 UINT8 **EndTag);
1041 * utstring - String and character utilities
1043 void
1044 AcpiUtPrintString (
1045 char *String,
1046 UINT16 MaxLength);
1048 #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
1049 void
1050 UtConvertBackslashes (
1051 char *Pathname);
1052 #endif
1054 void
1055 AcpiUtRepairName (
1056 char *Name);
1058 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
1059 BOOLEAN
1060 AcpiUtSafeStrcpy (
1061 char *Dest,
1062 ACPI_SIZE DestSize,
1063 char *Source);
1065 BOOLEAN
1066 AcpiUtSafeStrcat (
1067 char *Dest,
1068 ACPI_SIZE DestSize,
1069 char *Source);
1071 BOOLEAN
1072 AcpiUtSafeStrncat (
1073 char *Dest,
1074 ACPI_SIZE DestSize,
1075 char *Source,
1076 ACPI_SIZE MaxTransferLength);
1077 #endif
1081 * utmutex - mutex support
1083 ACPI_STATUS
1084 AcpiUtMutexInitialize (
1085 void);
1087 void
1088 AcpiUtMutexTerminate (
1089 void);
1091 ACPI_STATUS
1092 AcpiUtAcquireMutex (
1093 ACPI_MUTEX_HANDLE MutexId);
1095 ACPI_STATUS
1096 AcpiUtReleaseMutex (
1097 ACPI_MUTEX_HANDLE MutexId);
1101 * utalloc - memory allocation and object caching
1103 ACPI_STATUS
1104 AcpiUtCreateCaches (
1105 void);
1107 ACPI_STATUS
1108 AcpiUtDeleteCaches (
1109 void);
1111 ACPI_STATUS
1112 AcpiUtValidateBuffer (
1113 ACPI_BUFFER *Buffer);
1115 ACPI_STATUS
1116 AcpiUtInitializeBuffer (
1117 ACPI_BUFFER *Buffer,
1118 ACPI_SIZE RequiredLength);
1120 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1121 void *
1122 AcpiUtAllocateAndTrack (
1123 ACPI_SIZE Size,
1124 UINT32 Component,
1125 const char *Module,
1126 UINT32 Line);
1128 void *
1129 AcpiUtAllocateZeroedAndTrack (
1130 ACPI_SIZE Size,
1131 UINT32 Component,
1132 const char *Module,
1133 UINT32 Line);
1135 void
1136 AcpiUtFreeAndTrack (
1137 void *Address,
1138 UINT32 Component,
1139 const char *Module,
1140 UINT32 Line);
1142 void
1143 AcpiUtDumpAllocationInfo (
1144 void);
1146 void
1147 AcpiUtDumpAllocations (
1148 UINT32 Component,
1149 const char *Module);
1151 ACPI_STATUS
1152 AcpiUtCreateList (
1153 const char *ListName,
1154 UINT16 ObjectSize,
1155 ACPI_MEMORY_LIST **ReturnCache);
1157 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1161 * utaddress - address range check
1163 ACPI_STATUS
1164 AcpiUtAddAddressRange (
1165 ACPI_ADR_SPACE_TYPE SpaceId,
1166 ACPI_PHYSICAL_ADDRESS Address,
1167 UINT32 Length,
1168 ACPI_NAMESPACE_NODE *RegionNode);
1170 void
1171 AcpiUtRemoveAddressRange (
1172 ACPI_ADR_SPACE_TYPE SpaceId,
1173 ACPI_NAMESPACE_NODE *RegionNode);
1175 UINT32
1176 AcpiUtCheckAddressRange (
1177 ACPI_ADR_SPACE_TYPE SpaceId,
1178 ACPI_PHYSICAL_ADDRESS Address,
1179 UINT32 Length,
1180 BOOLEAN Warn);
1182 void
1183 AcpiUtDeleteAddressLists (
1184 void);
1188 * utxferror - various error/warning output functions
1190 void ACPI_INTERNAL_VAR_XFACE
1191 AcpiUtPredefinedWarning (
1192 const char *ModuleName,
1193 UINT32 LineNumber,
1194 char *Pathname,
1195 UINT8 NodeFlags,
1196 const char *Format,
1197 ...);
1199 void ACPI_INTERNAL_VAR_XFACE
1200 AcpiUtPredefinedInfo (
1201 const char *ModuleName,
1202 UINT32 LineNumber,
1203 char *Pathname,
1204 UINT8 NodeFlags,
1205 const char *Format,
1206 ...);
1208 void ACPI_INTERNAL_VAR_XFACE
1209 AcpiUtPredefinedBiosError (
1210 const char *ModuleName,
1211 UINT32 LineNumber,
1212 char *Pathname,
1213 UINT8 NodeFlags,
1214 const char *Format,
1215 ...);
1217 void
1218 AcpiUtNamespaceError (
1219 const char *ModuleName,
1220 UINT32 LineNumber,
1221 const char *InternalName,
1222 ACPI_STATUS LookupStatus);
1224 void
1225 AcpiUtMethodError (
1226 const char *ModuleName,
1227 UINT32 LineNumber,
1228 const char *Message,
1229 ACPI_NAMESPACE_NODE *Node,
1230 const char *Path,
1231 ACPI_STATUS LookupStatus);
1235 * Utility functions for ACPI names and IDs
1237 const AH_PREDEFINED_NAME *
1238 AcpiAhMatchPredefinedName (
1239 char *Nameseg);
1241 const AH_DEVICE_ID *
1242 AcpiAhMatchHardwareId (
1243 char *Hid);
1245 const char *
1246 AcpiAhMatchUuid (
1247 UINT8 *Data);
1251 * utuuid -- UUID support functions
1253 #if (defined ACPI_ASL_COMPILER || defined ACPI_DISASSEMBLER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP || defined KLD_MODULE)
1254 void
1255 AcpiUtConvertStringToUuid (
1256 char *InString,
1257 UINT8 *UuidBuffer);
1258 #endif
1260 #endif /* _ACUTILS_H */