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