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