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