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