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