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