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