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