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