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     UINT32                  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 ACPI_STATUS
883 AcpiUtShortMultiply (
884     UINT64                  InMultiplicand,
885     UINT32                  Multiplier,
886     UINT64                  *Outproduct);
887 
888 ACPI_STATUS
889 AcpiUtShortShiftLeft (
890     UINT64                  Operand,
891     UINT32                  Count,
892     UINT64                  *OutResult);
893 
894 ACPI_STATUS
895 AcpiUtShortShiftRight (
896     UINT64                  Operand,
897     UINT32                  Count,
898     UINT64                  *OutResult);
899 
900 
901 /*
902  * utmisc
903  */
904 const ACPI_EXCEPTION_INFO *
905 AcpiUtValidateException (
906     ACPI_STATUS             Status);
907 
908 BOOLEAN
909 AcpiUtIsPciRootBridge (
910     char                    *Id);
911 
912 #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
913 BOOLEAN
914 AcpiUtIsAmlTable (
915     ACPI_TABLE_HEADER       *Table);
916 #endif
917 
918 ACPI_STATUS
919 AcpiUtWalkPackageTree (
920     ACPI_OPERAND_OBJECT     *SourceObject,
921     void                    *TargetObject,
922     ACPI_PKG_CALLBACK       WalkCallback,
923     void                    *Context);
924 
925 /* Values for Base above (16=Hex, 10=Decimal) */
926 
927 #define ACPI_ANY_BASE        0
928 
929 
930 UINT32
931 AcpiUtDwordByteSwap (
932     UINT32                  Value);
933 
934 void
935 AcpiUtSetIntegerWidth (
936     UINT8                   Revision);
937 
938 #ifdef ACPI_DEBUG_OUTPUT
939 void
940 AcpiUtDisplayInitPathname (
941     UINT8                   Type,
942     ACPI_NAMESPACE_NODE     *ObjHandle,
943     const char              *Path);
944 #endif
945 
946 
947 /*
948  * utownerid - Support for Table/Method Owner IDs
949  */
950 ACPI_STATUS
951 AcpiUtAllocateOwnerId (
952     ACPI_OWNER_ID           *OwnerId);
953 
954 void
955 AcpiUtReleaseOwnerId (
956     ACPI_OWNER_ID           *OwnerId);
957 
958 
959 /*
960  * utresrc
961  */
962 ACPI_STATUS
963 AcpiUtWalkAmlResources (
964     ACPI_WALK_STATE         *WalkState,
965     UINT8                   *Aml,
966     ACPI_SIZE               AmlLength,
967     ACPI_WALK_AML_CALLBACK  UserFunction,
968     void                    **Context);
969 
970 ACPI_STATUS
971 AcpiUtValidateResource (
972     ACPI_WALK_STATE         *WalkState,
973     void                    *Aml,
974     UINT8                   *ReturnIndex);
975 
976 UINT32
977 AcpiUtGetDescriptorLength (
978     void                    *Aml);
979 
980 UINT16
981 AcpiUtGetResourceLength (
982     void                    *Aml);
983 
984 UINT8
985 AcpiUtGetResourceHeaderLength (
986     void                    *Aml);
987 
988 UINT8
989 AcpiUtGetResourceType (
990     void                    *Aml);
991 
992 ACPI_STATUS
993 AcpiUtGetResourceEndTag (
994     ACPI_OPERAND_OBJECT     *ObjDesc,
995     UINT8                   **EndTag);
996 
997 
998 /*
999  * utstring - String and character utilities
1000  */
1001 void
1002 AcpiUtPrintString (
1003     char                    *String,
1004     UINT16                  MaxLength);
1005 
1006 #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
1007 void
1008 UtConvertBackslashes (
1009     char                    *Pathname);
1010 #endif
1011 
1012 void
1013 AcpiUtRepairName (
1014     char                    *Name);
1015 
1016 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
1017 BOOLEAN
1018 AcpiUtSafeStrcpy (
1019     char                    *Dest,
1020     ACPI_SIZE               DestSize,
1021     char                    *Source);
1022 
1023 BOOLEAN
1024 AcpiUtSafeStrcat (
1025     char                    *Dest,
1026     ACPI_SIZE               DestSize,
1027     char                    *Source);
1028 
1029 BOOLEAN
1030 AcpiUtSafeStrncat (
1031     char                    *Dest,
1032     ACPI_SIZE               DestSize,
1033     char                    *Source,
1034     ACPI_SIZE               MaxTransferLength);
1035 #endif
1036 
1037 
1038 /*
1039  * utmutex - mutex support
1040  */
1041 ACPI_STATUS
1042 AcpiUtMutexInitialize (
1043     void);
1044 
1045 void
1046 AcpiUtMutexTerminate (
1047     void);
1048 
1049 ACPI_STATUS
1050 AcpiUtAcquireMutex (
1051     ACPI_MUTEX_HANDLE       MutexId);
1052 
1053 ACPI_STATUS
1054 AcpiUtReleaseMutex (
1055     ACPI_MUTEX_HANDLE       MutexId);
1056 
1057 
1058 /*
1059  * utalloc - memory allocation and object caching
1060  */
1061 ACPI_STATUS
1062 AcpiUtCreateCaches (
1063     void);
1064 
1065 ACPI_STATUS
1066 AcpiUtDeleteCaches (
1067     void);
1068 
1069 ACPI_STATUS
1070 AcpiUtValidateBuffer (
1071     ACPI_BUFFER             *Buffer);
1072 
1073 ACPI_STATUS
1074 AcpiUtInitializeBuffer (
1075     ACPI_BUFFER             *Buffer,
1076     ACPI_SIZE               RequiredLength);
1077 
1078 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1079 void *
1080 AcpiUtAllocateAndTrack (
1081     ACPI_SIZE               Size,
1082     UINT32                  Component,
1083     const char              *Module,
1084     UINT32                  Line);
1085 
1086 void *
1087 AcpiUtAllocateZeroedAndTrack (
1088     ACPI_SIZE               Size,
1089     UINT32                  Component,
1090     const char              *Module,
1091     UINT32                  Line);
1092 
1093 void
1094 AcpiUtFreeAndTrack (
1095     void                    *Address,
1096     UINT32                  Component,
1097     const char              *Module,
1098     UINT32                  Line);
1099 
1100 void
1101 AcpiUtDumpAllocationInfo (
1102     void);
1103 
1104 void
1105 AcpiUtDumpAllocations (
1106     UINT32                  Component,
1107     const char              *Module);
1108 
1109 ACPI_STATUS
1110 AcpiUtCreateList (
1111     const char              *ListName,
1112     UINT16                  ObjectSize,
1113     ACPI_MEMORY_LIST        **ReturnCache);
1114 
1115 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1116 
1117 
1118 /*
1119  * utaddress - address range check
1120  */
1121 ACPI_STATUS
1122 AcpiUtAddAddressRange (
1123     ACPI_ADR_SPACE_TYPE     SpaceId,
1124     ACPI_PHYSICAL_ADDRESS   Address,
1125     UINT32                  Length,
1126     ACPI_NAMESPACE_NODE     *RegionNode);
1127 
1128 void
1129 AcpiUtRemoveAddressRange (
1130     ACPI_ADR_SPACE_TYPE     SpaceId,
1131     ACPI_NAMESPACE_NODE     *RegionNode);
1132 
1133 UINT32
1134 AcpiUtCheckAddressRange (
1135     ACPI_ADR_SPACE_TYPE     SpaceId,
1136     ACPI_PHYSICAL_ADDRESS   Address,
1137     UINT32                  Length,
1138     BOOLEAN                 Warn);
1139 
1140 void
1141 AcpiUtDeleteAddressLists (
1142     void);
1143 
1144 
1145 /*
1146  * utxferror - various error/warning output functions
1147  */
1148 void ACPI_INTERNAL_VAR_XFACE
1149 AcpiUtPredefinedWarning (
1150     const char              *ModuleName,
1151     UINT32                  LineNumber,
1152     char                    *Pathname,
1153     UINT8                   NodeFlags,
1154     const char              *Format,
1155     ...);
1156 
1157 void ACPI_INTERNAL_VAR_XFACE
1158 AcpiUtPredefinedInfo (
1159     const char              *ModuleName,
1160     UINT32                  LineNumber,
1161     char                    *Pathname,
1162     UINT8                   NodeFlags,
1163     const char              *Format,
1164     ...);
1165 
1166 void ACPI_INTERNAL_VAR_XFACE
1167 AcpiUtPredefinedBiosError (
1168     const char              *ModuleName,
1169     UINT32                  LineNumber,
1170     char                    *Pathname,
1171     UINT8                   NodeFlags,
1172     const char              *Format,
1173     ...);
1174 
1175 void
1176 AcpiUtNamespaceError (
1177     const char              *ModuleName,
1178     UINT32                  LineNumber,
1179     const char              *InternalName,
1180     ACPI_STATUS             LookupStatus);
1181 
1182 void
1183 AcpiUtMethodError (
1184     const char              *ModuleName,
1185     UINT32                  LineNumber,
1186     const char              *Message,
1187     ACPI_NAMESPACE_NODE     *Node,
1188     const char              *Path,
1189     ACPI_STATUS             LookupStatus);
1190 
1191 
1192 /*
1193  * Utility functions for ACPI names and IDs
1194  */
1195 const AH_PREDEFINED_NAME *
1196 AcpiAhMatchPredefinedName (
1197     char                    *Nameseg);
1198 
1199 const AH_DEVICE_ID *
1200 AcpiAhMatchHardwareId (
1201     char                    *Hid);
1202 
1203 const char *
1204 AcpiAhMatchUuid (
1205     UINT8                   *Data);
1206 
1207 
1208 /*
1209  * utuuid -- UUID support functions
1210  */
1211 #if (defined ACPI_ASL_COMPILER || defined ACPI_DISASSEMBLER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP || defined KLD_MODULE)
1212 void
1213 AcpiUtConvertStringToUuid (
1214     char                    *InString,
1215     UINT8                   *UuidBuffer);
1216 #endif
1217 
1218 #endif /* _ACUTILS_H */
1219