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