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