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