xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/acutils.h (revision 6c2abee2f5e73c3fc81c33da51ac610f8bf1117a)
1 /******************************************************************************
2  *
3  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
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.
20  *
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
27  *
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;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
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.
53  *
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.
65  *
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.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
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.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
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.
89  *
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.
98  *
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.
113  *
114  *****************************************************************************/
115 
116 #ifndef _ACUTILS_H
117 #define _ACUTILS_H
118 
119 
120 extern const UINT8                      AcpiGbl_ResourceAmlSizes[];
121 extern const UINT8                      AcpiGbl_ResourceAmlSerialBusSizes[];
122 
123 /* Strings used by the disassembler and debugger resource dump routines */
124 
125 #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
126 
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[];
145 extern const char                       *AcpiGbl_PpcDecode[];
146 extern const char                       *AcpiGbl_IorDecode[];
147 extern const char                       *AcpiGbl_DtsDecode[];
148 extern const char                       *AcpiGbl_CtDecode[];
149 extern const char                       *AcpiGbl_SbtDecode[];
150 extern const char                       *AcpiGbl_AmDecode[];
151 extern const char                       *AcpiGbl_SmDecode[];
152 extern const char                       *AcpiGbl_WmDecode[];
153 extern const char                       *AcpiGbl_CphDecode[];
154 extern const char                       *AcpiGbl_CpoDecode[];
155 extern const char                       *AcpiGbl_DpDecode[];
156 extern const char                       *AcpiGbl_EdDecode[];
157 extern const char                       *AcpiGbl_BpbDecode[];
158 extern const char                       *AcpiGbl_SbDecode[];
159 extern const char                       *AcpiGbl_FcDecode[];
160 extern const char                       *AcpiGbl_PtDecode[];
161 #endif
162 
163 /*
164  * For the iASL compiler case, the output is redirected to stderr so that
165  * any of the various ACPI errors and warnings do not appear in the output
166  * files, for either the compiler or disassembler portions of the tool.
167  */
168 #ifdef ACPI_ASL_COMPILER
169 
170 #include <stdio.h>
171 
172 #define ACPI_MSG_REDIRECT_BEGIN \
173     FILE                    *OutputFile = AcpiGbl_OutputFile; \
174     AcpiOsRedirectOutput (stderr);
175 
176 #define ACPI_MSG_REDIRECT_END \
177     AcpiOsRedirectOutput (OutputFile);
178 
179 #else
180 /*
181  * non-iASL case - no redirection, nothing to do
182  */
183 #define ACPI_MSG_REDIRECT_BEGIN
184 #define ACPI_MSG_REDIRECT_END
185 #endif
186 
187 /*
188  * Common error message prefixes
189  */
190 #ifndef ACPI_MSG_ERROR
191 #define ACPI_MSG_ERROR          "ACPI Error: "
192 #endif
193 #ifndef ACPI_MSG_EXCEPTION
194 #define ACPI_MSG_EXCEPTION      "ACPI Exception: "
195 #endif
196 #ifndef ACPI_MSG_WARNING
197 #define ACPI_MSG_WARNING        "ACPI Warning: "
198 #endif
199 #ifndef ACPI_MSG_INFO
200 #define ACPI_MSG_INFO           "ACPI: "
201 #endif
202 
203 #ifndef ACPI_MSG_BIOS_ERROR
204 #define ACPI_MSG_BIOS_ERROR     "ACPI BIOS Error (bug): "
205 #endif
206 #ifndef ACPI_MSG_BIOS_WARNING
207 #define ACPI_MSG_BIOS_WARNING   "ACPI BIOS Warning (bug): "
208 #endif
209 
210 /*
211  * Common message suffix
212  */
213 #define ACPI_MSG_SUFFIX \
214     AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
215 
216 
217 /* Types for Resource descriptor entries */
218 
219 #define ACPI_INVALID_RESOURCE           0
220 #define ACPI_FIXED_LENGTH               1
221 #define ACPI_VARIABLE_LENGTH            2
222 #define ACPI_SMALL_VARIABLE_LENGTH      3
223 
224 typedef
225 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
226     UINT8                   *Aml,
227     UINT32                  Length,
228     UINT32                  Offset,
229     UINT8                   ResourceIndex,
230     void                    **Context);
231 
232 typedef
233 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
234     UINT8                   ObjectType,
235     ACPI_OPERAND_OBJECT     *SourceObject,
236     ACPI_GENERIC_STATE      *State,
237     void                    *Context);
238 
239 typedef struct acpi_pkg_info
240 {
241     UINT8                   *FreeSpace;
242     ACPI_SIZE               Length;
243     UINT32                  ObjectSpace;
244     UINT32                  NumPackages;
245 
246 } ACPI_PKG_INFO;
247 
248 /* Object reference counts */
249 
250 #define REF_INCREMENT       (UINT16) 0
251 #define REF_DECREMENT       (UINT16) 1
252 
253 /* AcpiUtDumpBuffer */
254 
255 #define DB_BYTE_DISPLAY     1
256 #define DB_WORD_DISPLAY     2
257 #define DB_DWORD_DISPLAY    4
258 #define DB_QWORD_DISPLAY    8
259 
260 
261 /*
262  * utascii - ASCII utilities
263  */
264 BOOLEAN
265 AcpiUtValidNameseg (
266     char                    *Signature);
267 
268 BOOLEAN
269 AcpiUtValidNameChar (
270     char                    Character,
271     UINT32                  Position);
272 
273 void
274 AcpiUtCheckAndRepairAscii (
275     UINT8                   *Name,
276     char                    *RepairedName,
277     UINT32                  Count);
278 
279 
280 /*
281  * utnonansi - Non-ANSI C library functions
282  */
283 void
284 AcpiUtStrupr (
285     char                    *SrcString);
286 
287 void
288 AcpiUtStrlwr (
289     char                    *SrcString);
290 
291 int
292 AcpiUtStricmp (
293     char                    *String1,
294     char                    *String2);
295 
296 ACPI_STATUS
297 AcpiUtStrtoul64 (
298     char                    *String,
299     UINT32                  Base,
300     UINT32                  MaxIntegerByteWidth,
301     UINT64                  *RetInteger);
302 
303 /* Values for MaxIntegerByteWidth above */
304 
305 #define ACPI_MAX32_BYTE_WIDTH       4
306 #define ACPI_MAX64_BYTE_WIDTH       8
307 
308 
309 /*
310  * utglobal - Global data structures and procedures
311  */
312 ACPI_STATUS
313 AcpiUtInitGlobals (
314     void);
315 
316 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
317 
318 const char *
319 AcpiUtGetMutexName (
320     UINT32                  MutexId);
321 
322 const char *
323 AcpiUtGetNotifyName (
324     UINT32                  NotifyValue,
325     ACPI_OBJECT_TYPE        Type);
326 #endif
327 
328 const char *
329 AcpiUtGetTypeName (
330     ACPI_OBJECT_TYPE        Type);
331 
332 const char *
333 AcpiUtGetNodeName (
334     void                    *Object);
335 
336 const char *
337 AcpiUtGetDescriptorName (
338     void                    *Object);
339 
340 const char *
341 AcpiUtGetReferenceName (
342     ACPI_OPERAND_OBJECT     *Object);
343 
344 const char *
345 AcpiUtGetObjectTypeName (
346     ACPI_OPERAND_OBJECT     *ObjDesc);
347 
348 const char *
349 AcpiUtGetRegionName (
350     UINT8                   SpaceId);
351 
352 const char *
353 AcpiUtGetEventName (
354     UINT32                  EventId);
355 
356 char
357 AcpiUtHexToAsciiChar (
358     UINT64                  Integer,
359     UINT32                  Position);
360 
361 UINT8
362 AcpiUtAsciiCharToHex (
363     int                     HexChar);
364 
365 BOOLEAN
366 AcpiUtValidObjectType (
367     ACPI_OBJECT_TYPE        Type);
368 
369 
370 /*
371  * utinit - miscellaneous initialization and shutdown
372  */
373 ACPI_STATUS
374 AcpiUtHardwareInitialize (
375     void);
376 
377 void
378 AcpiUtSubsystemShutdown (
379     void);
380 
381 
382 /*
383  * utcopy - Object construction and conversion interfaces
384  */
385 ACPI_STATUS
386 AcpiUtBuildSimpleObject(
387     ACPI_OPERAND_OBJECT     *Obj,
388     ACPI_OBJECT             *UserObj,
389     UINT8                   *DataSpace,
390     UINT32                  *BufferSpaceUsed);
391 
392 ACPI_STATUS
393 AcpiUtBuildPackageObject (
394     ACPI_OPERAND_OBJECT     *Obj,
395     UINT8                   *Buffer,
396     UINT32                  *SpaceUsed);
397 
398 ACPI_STATUS
399 AcpiUtCopyIobjectToEobject (
400     ACPI_OPERAND_OBJECT     *Obj,
401     ACPI_BUFFER             *RetBuffer);
402 
403 ACPI_STATUS
404 AcpiUtCopyEobjectToIobject (
405     ACPI_OBJECT             *Obj,
406     ACPI_OPERAND_OBJECT     **InternalObj);
407 
408 ACPI_STATUS
409 AcpiUtCopyISimpleToIsimple (
410     ACPI_OPERAND_OBJECT     *SourceObj,
411     ACPI_OPERAND_OBJECT     *DestObj);
412 
413 ACPI_STATUS
414 AcpiUtCopyIobjectToIobject (
415     ACPI_OPERAND_OBJECT     *SourceDesc,
416     ACPI_OPERAND_OBJECT     **DestDesc,
417     ACPI_WALK_STATE         *WalkState);
418 
419 
420 /*
421  * utcreate - Object creation
422  */
423 ACPI_STATUS
424 AcpiUtUpdateObjectReference (
425     ACPI_OPERAND_OBJECT     *Object,
426     UINT16                  Action);
427 
428 
429 /*
430  * utdebug - Debug interfaces
431  */
432 void
433 AcpiUtInitStackPtrTrace (
434     void);
435 
436 void
437 AcpiUtTrackStackPtr (
438     void);
439 
440 void
441 AcpiUtTrace (
442     UINT32                  LineNumber,
443     const char              *FunctionName,
444     const char              *ModuleName,
445     UINT32                  ComponentId);
446 
447 void
448 AcpiUtTracePtr (
449     UINT32                  LineNumber,
450     const char              *FunctionName,
451     const char              *ModuleName,
452     UINT32                  ComponentId,
453     const void              *Pointer);
454 
455 void
456 AcpiUtTraceU32 (
457     UINT32                  LineNumber,
458     const char              *FunctionName,
459     const char              *ModuleName,
460     UINT32                  ComponentId,
461     UINT32                  Integer);
462 
463 void
464 AcpiUtTraceStr (
465     UINT32                  LineNumber,
466     const char              *FunctionName,
467     const char              *ModuleName,
468     UINT32                  ComponentId,
469     const char              *String);
470 
471 void
472 AcpiUtExit (
473     UINT32                  LineNumber,
474     const char              *FunctionName,
475     const char              *ModuleName,
476     UINT32                  ComponentId);
477 
478 void
479 AcpiUtStatusExit (
480     UINT32                  LineNumber,
481     const char              *FunctionName,
482     const char              *ModuleName,
483     UINT32                  ComponentId,
484     ACPI_STATUS             Status);
485 
486 void
487 AcpiUtValueExit (
488     UINT32                  LineNumber,
489     const char              *FunctionName,
490     const char              *ModuleName,
491     UINT32                  ComponentId,
492     UINT64                  Value);
493 
494 void
495 AcpiUtPtrExit (
496     UINT32                  LineNumber,
497     const char              *FunctionName,
498     const char              *ModuleName,
499     UINT32                  ComponentId,
500     UINT8                   *Ptr);
501 
502 void
503 AcpiUtStrExit (
504     UINT32                  LineNumber,
505     const char              *FunctionName,
506     const char              *ModuleName,
507     UINT32                  ComponentId,
508     const char              *String);
509 
510 void
511 AcpiUtDebugDumpBuffer (
512     UINT8                   *Buffer,
513     UINT32                  Count,
514     UINT32                  Display,
515     UINT32                  ComponentId);
516 
517 void
518 AcpiUtDumpBuffer (
519     UINT8                   *Buffer,
520     UINT32                  Count,
521     UINT32                  Display,
522     UINT32                  Offset);
523 
524 #ifdef ACPI_APPLICATION
525 void
526 AcpiUtDumpBufferToFile (
527     ACPI_FILE               File,
528     UINT8                   *Buffer,
529     UINT32                  Count,
530     UINT32                  Display,
531     UINT32                  BaseOffset);
532 #endif
533 
534 void
535 AcpiUtReportError (
536     char                    *ModuleName,
537     UINT32                  LineNumber);
538 
539 void
540 AcpiUtReportInfo (
541     char                    *ModuleName,
542     UINT32                  LineNumber);
543 
544 void
545 AcpiUtReportWarning (
546     char                    *ModuleName,
547     UINT32                  LineNumber);
548 
549 
550 /*
551  * utdelete - Object deletion and reference counts
552  */
553 void
554 AcpiUtAddReference (
555     ACPI_OPERAND_OBJECT     *Object);
556 
557 void
558 AcpiUtRemoveReference (
559     ACPI_OPERAND_OBJECT     *Object);
560 
561 void
562 AcpiUtDeleteInternalPackageObject (
563     ACPI_OPERAND_OBJECT     *Object);
564 
565 void
566 AcpiUtDeleteInternalSimpleObject (
567     ACPI_OPERAND_OBJECT     *Object);
568 
569 void
570 AcpiUtDeleteInternalObjectList (
571     ACPI_OPERAND_OBJECT     **ObjList);
572 
573 
574 /*
575  * uteval - object evaluation
576  */
577 ACPI_STATUS
578 AcpiUtEvaluateObject (
579     ACPI_NAMESPACE_NODE     *PrefixNode,
580     const char              *Path,
581     UINT32                  ExpectedReturnBtypes,
582     ACPI_OPERAND_OBJECT     **ReturnDesc);
583 
584 ACPI_STATUS
585 AcpiUtEvaluateNumericObject (
586     const char              *ObjectName,
587     ACPI_NAMESPACE_NODE     *DeviceNode,
588     UINT64                  *Value);
589 
590 ACPI_STATUS
591 AcpiUtExecute_STA (
592     ACPI_NAMESPACE_NODE     *DeviceNode,
593     UINT32                  *StatusFlags);
594 
595 ACPI_STATUS
596 AcpiUtExecutePowerMethods (
597     ACPI_NAMESPACE_NODE     *DeviceNode,
598     const char              **MethodNames,
599     UINT8                   MethodCount,
600     UINT8                   *OutValues);
601 
602 
603 /*
604  * utids - device ID support
605  */
606 ACPI_STATUS
607 AcpiUtExecute_HID (
608     ACPI_NAMESPACE_NODE     *DeviceNode,
609     ACPI_PNP_DEVICE_ID      **ReturnId);
610 
611 ACPI_STATUS
612 AcpiUtExecute_UID (
613     ACPI_NAMESPACE_NODE     *DeviceNode,
614     ACPI_PNP_DEVICE_ID      **ReturnId);
615 
616 ACPI_STATUS
617 AcpiUtExecute_CID (
618     ACPI_NAMESPACE_NODE     *DeviceNode,
619     ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
620 
621 ACPI_STATUS
622 AcpiUtExecute_CLS (
623     ACPI_NAMESPACE_NODE     *DeviceNode,
624     ACPI_PNP_DEVICE_ID      **ReturnId);
625 
626 
627 /*
628  * utlock - reader/writer locks
629  */
630 ACPI_STATUS
631 AcpiUtCreateRwLock (
632     ACPI_RW_LOCK            *Lock);
633 
634 void
635 AcpiUtDeleteRwLock (
636     ACPI_RW_LOCK            *Lock);
637 
638 ACPI_STATUS
639 AcpiUtAcquireReadLock (
640     ACPI_RW_LOCK            *Lock);
641 
642 ACPI_STATUS
643 AcpiUtReleaseReadLock (
644     ACPI_RW_LOCK            *Lock);
645 
646 ACPI_STATUS
647 AcpiUtAcquireWriteLock (
648     ACPI_RW_LOCK            *Lock);
649 
650 void
651 AcpiUtReleaseWriteLock (
652     ACPI_RW_LOCK            *Lock);
653 
654 
655 /*
656  * utobject - internal object create/delete/cache routines
657  */
658 ACPI_OPERAND_OBJECT  *
659 AcpiUtCreateInternalObjectDbg (
660     const char              *ModuleName,
661     UINT32                  LineNumber,
662     UINT32                  ComponentId,
663     ACPI_OBJECT_TYPE        Type);
664 
665 void *
666 AcpiUtAllocateObjectDescDbg (
667     const char              *ModuleName,
668     UINT32                  LineNumber,
669     UINT32                  ComponentId);
670 
671 #define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
672 #define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
673 
674 void
675 AcpiUtDeleteObjectDesc (
676     ACPI_OPERAND_OBJECT     *Object);
677 
678 BOOLEAN
679 AcpiUtValidInternalObject (
680     void                    *Object);
681 
682 ACPI_OPERAND_OBJECT *
683 AcpiUtCreatePackageObject (
684     UINT32                  Count);
685 
686 ACPI_OPERAND_OBJECT *
687 AcpiUtCreateIntegerObject (
688     UINT64                  Value);
689 
690 ACPI_OPERAND_OBJECT *
691 AcpiUtCreateBufferObject (
692     ACPI_SIZE               BufferSize);
693 
694 ACPI_OPERAND_OBJECT *
695 AcpiUtCreateStringObject (
696     ACPI_SIZE               StringSize);
697 
698 ACPI_STATUS
699 AcpiUtGetObjectSize(
700     ACPI_OPERAND_OBJECT     *Obj,
701     ACPI_SIZE               *ObjLength);
702 
703 
704 /*
705  * utosi - Support for the _OSI predefined control method
706  */
707 ACPI_STATUS
708 AcpiUtInitializeInterfaces (
709     void);
710 
711 ACPI_STATUS
712 AcpiUtInterfaceTerminate (
713     void);
714 
715 ACPI_STATUS
716 AcpiUtInstallInterface (
717     ACPI_STRING             InterfaceName);
718 
719 ACPI_STATUS
720 AcpiUtRemoveInterface (
721     ACPI_STRING             InterfaceName);
722 
723 ACPI_STATUS
724 AcpiUtUpdateInterfaces (
725     UINT8                   Action);
726 
727 ACPI_INTERFACE_INFO *
728 AcpiUtGetInterface (
729     ACPI_STRING             InterfaceName);
730 
731 ACPI_STATUS
732 AcpiUtOsiImplementation (
733     ACPI_WALK_STATE         *WalkState);
734 
735 
736 /*
737  * utpredef - support for predefined names
738  */
739 const ACPI_PREDEFINED_INFO *
740 AcpiUtGetNextPredefinedMethod (
741     const ACPI_PREDEFINED_INFO  *ThisName);
742 
743 const ACPI_PREDEFINED_INFO *
744 AcpiUtMatchPredefinedMethod (
745     char                        *Name);
746 
747 void
748 AcpiUtGetExpectedReturnTypes (
749     char                    *Buffer,
750     UINT32                  ExpectedBtypes);
751 
752 #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
753 const ACPI_PREDEFINED_INFO *
754 AcpiUtMatchResourceName (
755     char                        *Name);
756 
757 void
758 AcpiUtDisplayPredefinedMethod (
759     char                        *Buffer,
760     const ACPI_PREDEFINED_INFO  *ThisName,
761     BOOLEAN                     MultiLine);
762 
763 UINT32
764 AcpiUtGetResourceBitWidth (
765     char                    *Buffer,
766     UINT16                  Types);
767 #endif
768 
769 
770 /*
771  * utstate - Generic state creation/cache routines
772  */
773 void
774 AcpiUtPushGenericState (
775     ACPI_GENERIC_STATE      **ListHead,
776     ACPI_GENERIC_STATE      *State);
777 
778 ACPI_GENERIC_STATE *
779 AcpiUtPopGenericState (
780     ACPI_GENERIC_STATE      **ListHead);
781 
782 
783 ACPI_GENERIC_STATE *
784 AcpiUtCreateGenericState (
785     void);
786 
787 ACPI_THREAD_STATE *
788 AcpiUtCreateThreadState (
789     void);
790 
791 ACPI_GENERIC_STATE *
792 AcpiUtCreateUpdateState (
793     ACPI_OPERAND_OBJECT     *Object,
794     UINT16                  Action);
795 
796 ACPI_GENERIC_STATE *
797 AcpiUtCreatePkgState (
798     void                    *InternalObject,
799     void                    *ExternalObject,
800     UINT16                  Index);
801 
802 ACPI_STATUS
803 AcpiUtCreateUpdateStateAndPush (
804     ACPI_OPERAND_OBJECT     *Object,
805     UINT16                  Action,
806     ACPI_GENERIC_STATE      **StateList);
807 
808 ACPI_GENERIC_STATE *
809 AcpiUtCreateControlState (
810     void);
811 
812 void
813 AcpiUtDeleteGenericState (
814     ACPI_GENERIC_STATE      *State);
815 
816 
817 /*
818  * utmath
819  */
820 ACPI_STATUS
821 AcpiUtDivide (
822     UINT64                  InDividend,
823     UINT64                  InDivisor,
824     UINT64                  *OutQuotient,
825     UINT64                  *OutRemainder);
826 
827 ACPI_STATUS
828 AcpiUtShortDivide (
829     UINT64                  InDividend,
830     UINT32                  Divisor,
831     UINT64                  *OutQuotient,
832     UINT32                  *OutRemainder);
833 
834 
835 /*
836  * utmisc
837  */
838 const ACPI_EXCEPTION_INFO *
839 AcpiUtValidateException (
840     ACPI_STATUS             Status);
841 
842 BOOLEAN
843 AcpiUtIsPciRootBridge (
844     char                    *Id);
845 
846 #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
847 BOOLEAN
848 AcpiUtIsAmlTable (
849     ACPI_TABLE_HEADER       *Table);
850 #endif
851 
852 ACPI_STATUS
853 AcpiUtWalkPackageTree (
854     ACPI_OPERAND_OBJECT     *SourceObject,
855     void                    *TargetObject,
856     ACPI_PKG_CALLBACK       WalkCallback,
857     void                    *Context);
858 
859 /* Values for Base above (16=Hex, 10=Decimal) */
860 
861 #define ACPI_ANY_BASE        0
862 
863 
864 UINT32
865 AcpiUtDwordByteSwap (
866     UINT32                  Value);
867 
868 void
869 AcpiUtSetIntegerWidth (
870     UINT8                   Revision);
871 
872 #ifdef ACPI_DEBUG_OUTPUT
873 void
874 AcpiUtDisplayInitPathname (
875     UINT8                   Type,
876     ACPI_NAMESPACE_NODE     *ObjHandle,
877     const char              *Path);
878 #endif
879 
880 
881 /*
882  * utownerid - Support for Table/Method Owner IDs
883  */
884 ACPI_STATUS
885 AcpiUtAllocateOwnerId (
886     ACPI_OWNER_ID           *OwnerId);
887 
888 void
889 AcpiUtReleaseOwnerId (
890     ACPI_OWNER_ID           *OwnerId);
891 
892 
893 /*
894  * utresrc
895  */
896 ACPI_STATUS
897 AcpiUtWalkAmlResources (
898     ACPI_WALK_STATE         *WalkState,
899     UINT8                   *Aml,
900     ACPI_SIZE               AmlLength,
901     ACPI_WALK_AML_CALLBACK  UserFunction,
902     void                    **Context);
903 
904 ACPI_STATUS
905 AcpiUtValidateResource (
906     ACPI_WALK_STATE         *WalkState,
907     void                    *Aml,
908     UINT8                   *ReturnIndex);
909 
910 UINT32
911 AcpiUtGetDescriptorLength (
912     void                    *Aml);
913 
914 UINT16
915 AcpiUtGetResourceLength (
916     void                    *Aml);
917 
918 UINT8
919 AcpiUtGetResourceHeaderLength (
920     void                    *Aml);
921 
922 UINT8
923 AcpiUtGetResourceType (
924     void                    *Aml);
925 
926 ACPI_STATUS
927 AcpiUtGetResourceEndTag (
928     ACPI_OPERAND_OBJECT     *ObjDesc,
929     UINT8                   **EndTag);
930 
931 
932 /*
933  * utstring - String and character utilities
934  */
935 void
936 AcpiUtPrintString (
937     char                    *String,
938     UINT16                  MaxLength);
939 
940 #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
941 void
942 UtConvertBackslashes (
943     char                    *Pathname);
944 #endif
945 
946 void
947 AcpiUtRepairName (
948     char                    *Name);
949 
950 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
951 BOOLEAN
952 AcpiUtSafeStrcpy (
953     char                    *Dest,
954     ACPI_SIZE               DestSize,
955     char                    *Source);
956 
957 BOOLEAN
958 AcpiUtSafeStrcat (
959     char                    *Dest,
960     ACPI_SIZE               DestSize,
961     char                    *Source);
962 
963 BOOLEAN
964 AcpiUtSafeStrncat (
965     char                    *Dest,
966     ACPI_SIZE               DestSize,
967     char                    *Source,
968     ACPI_SIZE               MaxTransferLength);
969 #endif
970 
971 
972 /*
973  * utmutex - mutex support
974  */
975 ACPI_STATUS
976 AcpiUtMutexInitialize (
977     void);
978 
979 void
980 AcpiUtMutexTerminate (
981     void);
982 
983 ACPI_STATUS
984 AcpiUtAcquireMutex (
985     ACPI_MUTEX_HANDLE       MutexId);
986 
987 ACPI_STATUS
988 AcpiUtReleaseMutex (
989     ACPI_MUTEX_HANDLE       MutexId);
990 
991 
992 /*
993  * utalloc - memory allocation and object caching
994  */
995 ACPI_STATUS
996 AcpiUtCreateCaches (
997     void);
998 
999 ACPI_STATUS
1000 AcpiUtDeleteCaches (
1001     void);
1002 
1003 ACPI_STATUS
1004 AcpiUtValidateBuffer (
1005     ACPI_BUFFER             *Buffer);
1006 
1007 ACPI_STATUS
1008 AcpiUtInitializeBuffer (
1009     ACPI_BUFFER             *Buffer,
1010     ACPI_SIZE               RequiredLength);
1011 
1012 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1013 void *
1014 AcpiUtAllocateAndTrack (
1015     ACPI_SIZE               Size,
1016     UINT32                  Component,
1017     const char              *Module,
1018     UINT32                  Line);
1019 
1020 void *
1021 AcpiUtAllocateZeroedAndTrack (
1022     ACPI_SIZE               Size,
1023     UINT32                  Component,
1024     const char              *Module,
1025     UINT32                  Line);
1026 
1027 void
1028 AcpiUtFreeAndTrack (
1029     void                    *Address,
1030     UINT32                  Component,
1031     const char              *Module,
1032     UINT32                  Line);
1033 
1034 void
1035 AcpiUtDumpAllocationInfo (
1036     void);
1037 
1038 void
1039 AcpiUtDumpAllocations (
1040     UINT32                  Component,
1041     const char              *Module);
1042 
1043 ACPI_STATUS
1044 AcpiUtCreateList (
1045     const char              *ListName,
1046     UINT16                  ObjectSize,
1047     ACPI_MEMORY_LIST        **ReturnCache);
1048 
1049 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1050 
1051 
1052 /*
1053  * utaddress - address range check
1054  */
1055 ACPI_STATUS
1056 AcpiUtAddAddressRange (
1057     ACPI_ADR_SPACE_TYPE     SpaceId,
1058     ACPI_PHYSICAL_ADDRESS   Address,
1059     UINT32                  Length,
1060     ACPI_NAMESPACE_NODE     *RegionNode);
1061 
1062 void
1063 AcpiUtRemoveAddressRange (
1064     ACPI_ADR_SPACE_TYPE     SpaceId,
1065     ACPI_NAMESPACE_NODE     *RegionNode);
1066 
1067 UINT32
1068 AcpiUtCheckAddressRange (
1069     ACPI_ADR_SPACE_TYPE     SpaceId,
1070     ACPI_PHYSICAL_ADDRESS   Address,
1071     UINT32                  Length,
1072     BOOLEAN                 Warn);
1073 
1074 void
1075 AcpiUtDeleteAddressLists (
1076     void);
1077 
1078 
1079 /*
1080  * utxferror - various error/warning output functions
1081  */
1082 void ACPI_INTERNAL_VAR_XFACE
1083 AcpiUtPredefinedWarning (
1084     const char              *ModuleName,
1085     UINT32                  LineNumber,
1086     char                    *Pathname,
1087     UINT8                   NodeFlags,
1088     const char              *Format,
1089     ...);
1090 
1091 void ACPI_INTERNAL_VAR_XFACE
1092 AcpiUtPredefinedInfo (
1093     const char              *ModuleName,
1094     UINT32                  LineNumber,
1095     char                    *Pathname,
1096     UINT8                   NodeFlags,
1097     const char              *Format,
1098     ...);
1099 
1100 void ACPI_INTERNAL_VAR_XFACE
1101 AcpiUtPredefinedBiosError (
1102     const char              *ModuleName,
1103     UINT32                  LineNumber,
1104     char                    *Pathname,
1105     UINT8                   NodeFlags,
1106     const char              *Format,
1107     ...);
1108 
1109 void
1110 AcpiUtNamespaceError (
1111     const char              *ModuleName,
1112     UINT32                  LineNumber,
1113     const char              *InternalName,
1114     ACPI_STATUS             LookupStatus);
1115 
1116 void
1117 AcpiUtMethodError (
1118     const char              *ModuleName,
1119     UINT32                  LineNumber,
1120     const char              *Message,
1121     ACPI_NAMESPACE_NODE     *Node,
1122     const char              *Path,
1123     ACPI_STATUS             LookupStatus);
1124 
1125 
1126 /*
1127  * Utility functions for ACPI names and IDs
1128  */
1129 const AH_PREDEFINED_NAME *
1130 AcpiAhMatchPredefinedName (
1131     char                    *Nameseg);
1132 
1133 const AH_DEVICE_ID *
1134 AcpiAhMatchHardwareId (
1135     char                    *Hid);
1136 
1137 const char *
1138 AcpiAhMatchUuid (
1139     UINT8                   *Data);
1140 
1141 
1142 /*
1143  * utuuid -- UUID support functions
1144  */
1145 #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
1146 void
1147 AcpiUtConvertStringToUuid (
1148     char                    *InString,
1149     UINT8                   *UuidBuffer);
1150 #endif
1151 
1152 #endif /* _ACUTILS_H */
1153