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