xref: /minix3/minix/drivers/power/acpi/include/acutils.h (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /******************************************************************************
2*433d6423SLionel Sambuc  *
3*433d6423SLionel Sambuc  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4*433d6423SLionel Sambuc  *
5*433d6423SLionel Sambuc  *****************************************************************************/
6*433d6423SLionel Sambuc 
7*433d6423SLionel Sambuc /******************************************************************************
8*433d6423SLionel Sambuc  *
9*433d6423SLionel Sambuc  * 1. Copyright Notice
10*433d6423SLionel Sambuc  *
11*433d6423SLionel Sambuc  * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12*433d6423SLionel Sambuc  * All rights reserved.
13*433d6423SLionel Sambuc  *
14*433d6423SLionel Sambuc  * 2. License
15*433d6423SLionel Sambuc  *
16*433d6423SLionel Sambuc  * 2.1. This is your license from Intel Corp. under its intellectual property
17*433d6423SLionel Sambuc  * rights.  You may have additional license terms from the party that provided
18*433d6423SLionel Sambuc  * you this software, covering your right to use that party's intellectual
19*433d6423SLionel Sambuc  * property rights.
20*433d6423SLionel Sambuc  *
21*433d6423SLionel Sambuc  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*433d6423SLionel Sambuc  * copy of the source code appearing in this file ("Covered Code") an
23*433d6423SLionel Sambuc  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*433d6423SLionel Sambuc  * base code distributed originally by Intel ("Original Intel Code") to copy,
25*433d6423SLionel Sambuc  * make derivatives, distribute, use and display any portion of the Covered
26*433d6423SLionel Sambuc  * Code in any form, with the right to sublicense such rights; and
27*433d6423SLionel Sambuc  *
28*433d6423SLionel Sambuc  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29*433d6423SLionel Sambuc  * license (with the right to sublicense), under only those claims of Intel
30*433d6423SLionel Sambuc  * patents that are infringed by the Original Intel Code, to make, use, sell,
31*433d6423SLionel Sambuc  * offer to sell, and import the Covered Code and derivative works thereof
32*433d6423SLionel Sambuc  * solely to the minimum extent necessary to exercise the above copyright
33*433d6423SLionel Sambuc  * license, and in no event shall the patent license extend to any additions
34*433d6423SLionel Sambuc  * to or modifications of the Original Intel Code.  No other license or right
35*433d6423SLionel Sambuc  * is granted directly or by implication, estoppel or otherwise;
36*433d6423SLionel Sambuc  *
37*433d6423SLionel Sambuc  * The above copyright and patent license is granted only if the following
38*433d6423SLionel Sambuc  * conditions are met:
39*433d6423SLionel Sambuc  *
40*433d6423SLionel Sambuc  * 3. Conditions
41*433d6423SLionel Sambuc  *
42*433d6423SLionel Sambuc  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43*433d6423SLionel Sambuc  * Redistribution of source code of any substantial portion of the Covered
44*433d6423SLionel Sambuc  * Code or modification with rights to further distribute source must include
45*433d6423SLionel Sambuc  * the above Copyright Notice, the above License, this list of Conditions,
46*433d6423SLionel Sambuc  * and the following Disclaimer and Export Compliance provision.  In addition,
47*433d6423SLionel Sambuc  * Licensee must cause all Covered Code to which Licensee contributes to
48*433d6423SLionel Sambuc  * contain a file documenting the changes Licensee made to create that Covered
49*433d6423SLionel Sambuc  * Code and the date of any change.  Licensee must include in that file the
50*433d6423SLionel Sambuc  * documentation of any changes made by any predecessor Licensee.  Licensee
51*433d6423SLionel Sambuc  * must include a prominent statement that the modification is derived,
52*433d6423SLionel Sambuc  * directly or indirectly, from Original Intel Code.
53*433d6423SLionel Sambuc  *
54*433d6423SLionel Sambuc  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55*433d6423SLionel Sambuc  * Redistribution of source code of any substantial portion of the Covered
56*433d6423SLionel Sambuc  * Code or modification without rights to further distribute source must
57*433d6423SLionel Sambuc  * include the following Disclaimer and Export Compliance provision in the
58*433d6423SLionel Sambuc  * documentation and/or other materials provided with distribution.  In
59*433d6423SLionel Sambuc  * addition, Licensee may not authorize further sublicense of source of any
60*433d6423SLionel Sambuc  * portion of the Covered Code, and must include terms to the effect that the
61*433d6423SLionel Sambuc  * license from Licensee to its licensee is limited to the intellectual
62*433d6423SLionel Sambuc  * property embodied in the software Licensee provides to its licensee, and
63*433d6423SLionel Sambuc  * not to intellectual property embodied in modifications its licensee may
64*433d6423SLionel Sambuc  * make.
65*433d6423SLionel Sambuc  *
66*433d6423SLionel Sambuc  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67*433d6423SLionel Sambuc  * substantial portion of the Covered Code or modification must reproduce the
68*433d6423SLionel Sambuc  * above Copyright Notice, and the following Disclaimer and Export Compliance
69*433d6423SLionel Sambuc  * provision in the documentation and/or other materials provided with the
70*433d6423SLionel Sambuc  * distribution.
71*433d6423SLionel Sambuc  *
72*433d6423SLionel Sambuc  * 3.4. Intel retains all right, title, and interest in and to the Original
73*433d6423SLionel Sambuc  * Intel Code.
74*433d6423SLionel Sambuc  *
75*433d6423SLionel Sambuc  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76*433d6423SLionel Sambuc  * Intel shall be used in advertising or otherwise to promote the sale, use or
77*433d6423SLionel Sambuc  * other dealings in products derived from or relating to the Covered Code
78*433d6423SLionel Sambuc  * without prior written authorization from Intel.
79*433d6423SLionel Sambuc  *
80*433d6423SLionel Sambuc  * 4. Disclaimer and Export Compliance
81*433d6423SLionel Sambuc  *
82*433d6423SLionel Sambuc  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83*433d6423SLionel Sambuc  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84*433d6423SLionel Sambuc  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85*433d6423SLionel Sambuc  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86*433d6423SLionel Sambuc  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87*433d6423SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88*433d6423SLionel Sambuc  * PARTICULAR PURPOSE.
89*433d6423SLionel Sambuc  *
90*433d6423SLionel Sambuc  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91*433d6423SLionel Sambuc  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92*433d6423SLionel Sambuc  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93*433d6423SLionel Sambuc  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94*433d6423SLionel Sambuc  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95*433d6423SLionel Sambuc  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96*433d6423SLionel Sambuc  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97*433d6423SLionel Sambuc  * LIMITED REMEDY.
98*433d6423SLionel Sambuc  *
99*433d6423SLionel Sambuc  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100*433d6423SLionel Sambuc  * software or system incorporating such software without first obtaining any
101*433d6423SLionel Sambuc  * required license or other approval from the U. S. Department of Commerce or
102*433d6423SLionel Sambuc  * any other agency or department of the United States Government.  In the
103*433d6423SLionel Sambuc  * event Licensee exports any such software from the United States or
104*433d6423SLionel Sambuc  * re-exports any such software from a foreign destination, Licensee shall
105*433d6423SLionel Sambuc  * ensure that the distribution and export/re-export of the software is in
106*433d6423SLionel Sambuc  * compliance with all laws, regulations, orders, or other restrictions of the
107*433d6423SLionel Sambuc  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108*433d6423SLionel Sambuc  * any of its subsidiaries will export/re-export any technical data, process,
109*433d6423SLionel Sambuc  * software, or service, directly or indirectly, to any country for which the
110*433d6423SLionel Sambuc  * United States government or any agency thereof requires an export license,
111*433d6423SLionel Sambuc  * other governmental approval, or letter of assurance, without first obtaining
112*433d6423SLionel Sambuc  * such license, approval or letter.
113*433d6423SLionel Sambuc  *
114*433d6423SLionel Sambuc  *****************************************************************************/
115*433d6423SLionel Sambuc 
116*433d6423SLionel Sambuc #ifndef _ACUTILS_H
117*433d6423SLionel Sambuc #define _ACUTILS_H
118*433d6423SLionel Sambuc 
119*433d6423SLionel Sambuc 
120*433d6423SLionel Sambuc extern const UINT8                      AcpiGbl_ResourceAmlSizes[];
121*433d6423SLionel Sambuc 
122*433d6423SLionel Sambuc /* Strings used by the disassembler and debugger resource dump routines */
123*433d6423SLionel Sambuc 
124*433d6423SLionel Sambuc #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
125*433d6423SLionel Sambuc 
126*433d6423SLionel Sambuc extern const char                       *AcpiGbl_BmDecode[];
127*433d6423SLionel Sambuc extern const char                       *AcpiGbl_ConfigDecode[];
128*433d6423SLionel Sambuc extern const char                       *AcpiGbl_ConsumeDecode[];
129*433d6423SLionel Sambuc extern const char                       *AcpiGbl_DecDecode[];
130*433d6423SLionel Sambuc extern const char                       *AcpiGbl_HeDecode[];
131*433d6423SLionel Sambuc extern const char                       *AcpiGbl_IoDecode[];
132*433d6423SLionel Sambuc extern const char                       *AcpiGbl_LlDecode[];
133*433d6423SLionel Sambuc extern const char                       *AcpiGbl_MaxDecode[];
134*433d6423SLionel Sambuc extern const char                       *AcpiGbl_MemDecode[];
135*433d6423SLionel Sambuc extern const char                       *AcpiGbl_MinDecode[];
136*433d6423SLionel Sambuc extern const char                       *AcpiGbl_MtpDecode[];
137*433d6423SLionel Sambuc extern const char                       *AcpiGbl_RngDecode[];
138*433d6423SLionel Sambuc extern const char                       *AcpiGbl_RwDecode[];
139*433d6423SLionel Sambuc extern const char                       *AcpiGbl_ShrDecode[];
140*433d6423SLionel Sambuc extern const char                       *AcpiGbl_SizDecode[];
141*433d6423SLionel Sambuc extern const char                       *AcpiGbl_TrsDecode[];
142*433d6423SLionel Sambuc extern const char                       *AcpiGbl_TtpDecode[];
143*433d6423SLionel Sambuc extern const char                       *AcpiGbl_TypDecode[];
144*433d6423SLionel Sambuc #endif
145*433d6423SLionel Sambuc 
146*433d6423SLionel Sambuc /* Types for Resource descriptor entries */
147*433d6423SLionel Sambuc 
148*433d6423SLionel Sambuc #define ACPI_INVALID_RESOURCE           0
149*433d6423SLionel Sambuc #define ACPI_FIXED_LENGTH               1
150*433d6423SLionel Sambuc #define ACPI_VARIABLE_LENGTH            2
151*433d6423SLionel Sambuc #define ACPI_SMALL_VARIABLE_LENGTH      3
152*433d6423SLionel Sambuc 
153*433d6423SLionel Sambuc typedef
154*433d6423SLionel Sambuc ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
155*433d6423SLionel Sambuc     UINT8                   *Aml,
156*433d6423SLionel Sambuc     UINT32                  Length,
157*433d6423SLionel Sambuc     UINT32                  Offset,
158*433d6423SLionel Sambuc     UINT8                   ResourceIndex,
159*433d6423SLionel Sambuc     void                    *Context);
160*433d6423SLionel Sambuc 
161*433d6423SLionel Sambuc typedef
162*433d6423SLionel Sambuc ACPI_STATUS (*ACPI_PKG_CALLBACK) (
163*433d6423SLionel Sambuc     UINT8                   ObjectType,
164*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *SourceObject,
165*433d6423SLionel Sambuc     ACPI_GENERIC_STATE      *State,
166*433d6423SLionel Sambuc     void                    *Context);
167*433d6423SLionel Sambuc 
168*433d6423SLionel Sambuc typedef struct acpi_pkg_info
169*433d6423SLionel Sambuc {
170*433d6423SLionel Sambuc     UINT8                   *FreeSpace;
171*433d6423SLionel Sambuc     ACPI_SIZE               Length;
172*433d6423SLionel Sambuc     UINT32                  ObjectSpace;
173*433d6423SLionel Sambuc     UINT32                  NumPackages;
174*433d6423SLionel Sambuc 
175*433d6423SLionel Sambuc } ACPI_PKG_INFO;
176*433d6423SLionel Sambuc 
177*433d6423SLionel Sambuc #define REF_INCREMENT       (UINT16) 0
178*433d6423SLionel Sambuc #define REF_DECREMENT       (UINT16) 1
179*433d6423SLionel Sambuc #define REF_FORCE_DELETE    (UINT16) 2
180*433d6423SLionel Sambuc 
181*433d6423SLionel Sambuc /* AcpiUtDumpBuffer */
182*433d6423SLionel Sambuc 
183*433d6423SLionel Sambuc #define DB_BYTE_DISPLAY     1
184*433d6423SLionel Sambuc #define DB_WORD_DISPLAY     2
185*433d6423SLionel Sambuc #define DB_DWORD_DISPLAY    4
186*433d6423SLionel Sambuc #define DB_QWORD_DISPLAY    8
187*433d6423SLionel Sambuc 
188*433d6423SLionel Sambuc 
189*433d6423SLionel Sambuc /*
190*433d6423SLionel Sambuc  * utglobal - Global data structures and procedures
191*433d6423SLionel Sambuc  */
192*433d6423SLionel Sambuc ACPI_STATUS
193*433d6423SLionel Sambuc AcpiUtInitGlobals (
194*433d6423SLionel Sambuc     void);
195*433d6423SLionel Sambuc 
196*433d6423SLionel Sambuc #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
197*433d6423SLionel Sambuc 
198*433d6423SLionel Sambuc char *
199*433d6423SLionel Sambuc AcpiUtGetMutexName (
200*433d6423SLionel Sambuc     UINT32                  MutexId);
201*433d6423SLionel Sambuc 
202*433d6423SLionel Sambuc const char *
203*433d6423SLionel Sambuc AcpiUtGetNotifyName (
204*433d6423SLionel Sambuc     UINT32                  NotifyValue);
205*433d6423SLionel Sambuc 
206*433d6423SLionel Sambuc #endif
207*433d6423SLionel Sambuc 
208*433d6423SLionel Sambuc char *
209*433d6423SLionel Sambuc AcpiUtGetTypeName (
210*433d6423SLionel Sambuc     ACPI_OBJECT_TYPE        Type);
211*433d6423SLionel Sambuc 
212*433d6423SLionel Sambuc char *
213*433d6423SLionel Sambuc AcpiUtGetNodeName (
214*433d6423SLionel Sambuc     void                    *Object);
215*433d6423SLionel Sambuc 
216*433d6423SLionel Sambuc char *
217*433d6423SLionel Sambuc AcpiUtGetDescriptorName (
218*433d6423SLionel Sambuc     void                    *Object);
219*433d6423SLionel Sambuc 
220*433d6423SLionel Sambuc const char *
221*433d6423SLionel Sambuc AcpiUtGetReferenceName (
222*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object);
223*433d6423SLionel Sambuc 
224*433d6423SLionel Sambuc char *
225*433d6423SLionel Sambuc AcpiUtGetObjectTypeName (
226*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *ObjDesc);
227*433d6423SLionel Sambuc 
228*433d6423SLionel Sambuc char *
229*433d6423SLionel Sambuc AcpiUtGetRegionName (
230*433d6423SLionel Sambuc     UINT8                   SpaceId);
231*433d6423SLionel Sambuc 
232*433d6423SLionel Sambuc char *
233*433d6423SLionel Sambuc AcpiUtGetEventName (
234*433d6423SLionel Sambuc     UINT32                  EventId);
235*433d6423SLionel Sambuc 
236*433d6423SLionel Sambuc char
237*433d6423SLionel Sambuc AcpiUtHexToAsciiChar (
238*433d6423SLionel Sambuc     UINT64                  Integer,
239*433d6423SLionel Sambuc     UINT32                  Position);
240*433d6423SLionel Sambuc 
241*433d6423SLionel Sambuc BOOLEAN
242*433d6423SLionel Sambuc AcpiUtValidObjectType (
243*433d6423SLionel Sambuc     ACPI_OBJECT_TYPE        Type);
244*433d6423SLionel Sambuc 
245*433d6423SLionel Sambuc 
246*433d6423SLionel Sambuc /*
247*433d6423SLionel Sambuc  * utinit - miscellaneous initialization and shutdown
248*433d6423SLionel Sambuc  */
249*433d6423SLionel Sambuc ACPI_STATUS
250*433d6423SLionel Sambuc AcpiUtHardwareInitialize (
251*433d6423SLionel Sambuc     void);
252*433d6423SLionel Sambuc 
253*433d6423SLionel Sambuc void
254*433d6423SLionel Sambuc AcpiUtSubsystemShutdown (
255*433d6423SLionel Sambuc     void);
256*433d6423SLionel Sambuc 
257*433d6423SLionel Sambuc 
258*433d6423SLionel Sambuc /*
259*433d6423SLionel Sambuc  * utclib - Local implementations of C library functions
260*433d6423SLionel Sambuc  */
261*433d6423SLionel Sambuc #ifndef ACPI_USE_SYSTEM_CLIBRARY
262*433d6423SLionel Sambuc 
263*433d6423SLionel Sambuc ACPI_SIZE
264*433d6423SLionel Sambuc AcpiUtStrlen (
265*433d6423SLionel Sambuc     const char              *String);
266*433d6423SLionel Sambuc 
267*433d6423SLionel Sambuc char *
268*433d6423SLionel Sambuc AcpiUtStrcpy (
269*433d6423SLionel Sambuc     char                    *DstString,
270*433d6423SLionel Sambuc     const char              *SrcString);
271*433d6423SLionel Sambuc 
272*433d6423SLionel Sambuc char *
273*433d6423SLionel Sambuc AcpiUtStrncpy (
274*433d6423SLionel Sambuc     char                    *DstString,
275*433d6423SLionel Sambuc     const char              *SrcString,
276*433d6423SLionel Sambuc     ACPI_SIZE               Count);
277*433d6423SLionel Sambuc 
278*433d6423SLionel Sambuc int
279*433d6423SLionel Sambuc AcpiUtMemcmp (
280*433d6423SLionel Sambuc     const char              *Buffer1,
281*433d6423SLionel Sambuc     const char              *Buffer2,
282*433d6423SLionel Sambuc     ACPI_SIZE               Count);
283*433d6423SLionel Sambuc 
284*433d6423SLionel Sambuc int
285*433d6423SLionel Sambuc AcpiUtStrncmp (
286*433d6423SLionel Sambuc     const char              *String1,
287*433d6423SLionel Sambuc     const char              *String2,
288*433d6423SLionel Sambuc     ACPI_SIZE               Count);
289*433d6423SLionel Sambuc 
290*433d6423SLionel Sambuc int
291*433d6423SLionel Sambuc AcpiUtStrcmp (
292*433d6423SLionel Sambuc     const char              *String1,
293*433d6423SLionel Sambuc     const char              *String2);
294*433d6423SLionel Sambuc 
295*433d6423SLionel Sambuc char *
296*433d6423SLionel Sambuc AcpiUtStrcat (
297*433d6423SLionel Sambuc     char                    *DstString,
298*433d6423SLionel Sambuc     const char              *SrcString);
299*433d6423SLionel Sambuc 
300*433d6423SLionel Sambuc char *
301*433d6423SLionel Sambuc AcpiUtStrncat (
302*433d6423SLionel Sambuc     char                    *DstString,
303*433d6423SLionel Sambuc     const char              *SrcString,
304*433d6423SLionel Sambuc     ACPI_SIZE               Count);
305*433d6423SLionel Sambuc 
306*433d6423SLionel Sambuc UINT32
307*433d6423SLionel Sambuc AcpiUtStrtoul (
308*433d6423SLionel Sambuc     const char              *String,
309*433d6423SLionel Sambuc     char                    **Terminator,
310*433d6423SLionel Sambuc     UINT32                  Base);
311*433d6423SLionel Sambuc 
312*433d6423SLionel Sambuc char *
313*433d6423SLionel Sambuc AcpiUtStrstr (
314*433d6423SLionel Sambuc     char                    *String1,
315*433d6423SLionel Sambuc     char                    *String2);
316*433d6423SLionel Sambuc 
317*433d6423SLionel Sambuc void *
318*433d6423SLionel Sambuc AcpiUtMemcpy (
319*433d6423SLionel Sambuc     void                    *Dest,
320*433d6423SLionel Sambuc     const void              *Src,
321*433d6423SLionel Sambuc     ACPI_SIZE               Count);
322*433d6423SLionel Sambuc 
323*433d6423SLionel Sambuc void *
324*433d6423SLionel Sambuc AcpiUtMemset (
325*433d6423SLionel Sambuc     void                    *Dest,
326*433d6423SLionel Sambuc     UINT8                   Value,
327*433d6423SLionel Sambuc     ACPI_SIZE               Count);
328*433d6423SLionel Sambuc 
329*433d6423SLionel Sambuc int
330*433d6423SLionel Sambuc AcpiUtToUpper (
331*433d6423SLionel Sambuc     int                     c);
332*433d6423SLionel Sambuc 
333*433d6423SLionel Sambuc int
334*433d6423SLionel Sambuc AcpiUtToLower (
335*433d6423SLionel Sambuc     int                     c);
336*433d6423SLionel Sambuc 
337*433d6423SLionel Sambuc extern const UINT8 _acpi_ctype[];
338*433d6423SLionel Sambuc 
339*433d6423SLionel Sambuc #define _ACPI_XA     0x00    /* extra alphabetic - not supported */
340*433d6423SLionel Sambuc #define _ACPI_XS     0x40    /* extra space */
341*433d6423SLionel Sambuc #define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
342*433d6423SLionel Sambuc #define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
343*433d6423SLionel Sambuc #define _ACPI_DI     0x04    /* '0'-'9' */
344*433d6423SLionel Sambuc #define _ACPI_LO     0x02    /* 'a'-'z' */
345*433d6423SLionel Sambuc #define _ACPI_PU     0x10    /* punctuation */
346*433d6423SLionel Sambuc #define _ACPI_SP     0x08    /* space */
347*433d6423SLionel Sambuc #define _ACPI_UP     0x01    /* 'A'-'Z' */
348*433d6423SLionel Sambuc #define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
349*433d6423SLionel Sambuc 
350*433d6423SLionel Sambuc #define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
351*433d6423SLionel Sambuc #define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
352*433d6423SLionel Sambuc #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
353*433d6423SLionel Sambuc #define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
354*433d6423SLionel Sambuc #define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
355*433d6423SLionel Sambuc #define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
356*433d6423SLionel Sambuc #define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
357*433d6423SLionel Sambuc 
358*433d6423SLionel Sambuc #endif /* !ACPI_USE_SYSTEM_CLIBRARY */
359*433d6423SLionel Sambuc 
360*433d6423SLionel Sambuc #define ACPI_IS_ASCII(c)  ((c) < 0x80)
361*433d6423SLionel Sambuc 
362*433d6423SLionel Sambuc 
363*433d6423SLionel Sambuc /*
364*433d6423SLionel Sambuc  * utcopy - Object construction and conversion interfaces
365*433d6423SLionel Sambuc  */
366*433d6423SLionel Sambuc ACPI_STATUS
367*433d6423SLionel Sambuc AcpiUtBuildSimpleObject(
368*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Obj,
369*433d6423SLionel Sambuc     ACPI_OBJECT             *UserObj,
370*433d6423SLionel Sambuc     UINT8                   *DataSpace,
371*433d6423SLionel Sambuc     UINT32                  *BufferSpaceUsed);
372*433d6423SLionel Sambuc 
373*433d6423SLionel Sambuc ACPI_STATUS
374*433d6423SLionel Sambuc AcpiUtBuildPackageObject (
375*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Obj,
376*433d6423SLionel Sambuc     UINT8                   *Buffer,
377*433d6423SLionel Sambuc     UINT32                  *SpaceUsed);
378*433d6423SLionel Sambuc 
379*433d6423SLionel Sambuc ACPI_STATUS
380*433d6423SLionel Sambuc AcpiUtCopyIobjectToEobject (
381*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Obj,
382*433d6423SLionel Sambuc     ACPI_BUFFER             *RetBuffer);
383*433d6423SLionel Sambuc 
384*433d6423SLionel Sambuc ACPI_STATUS
385*433d6423SLionel Sambuc AcpiUtCopyEobjectToIobject (
386*433d6423SLionel Sambuc     ACPI_OBJECT             *Obj,
387*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     **InternalObj);
388*433d6423SLionel Sambuc 
389*433d6423SLionel Sambuc ACPI_STATUS
390*433d6423SLionel Sambuc AcpiUtCopyISimpleToIsimple (
391*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *SourceObj,
392*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *DestObj);
393*433d6423SLionel Sambuc 
394*433d6423SLionel Sambuc ACPI_STATUS
395*433d6423SLionel Sambuc AcpiUtCopyIobjectToIobject (
396*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *SourceDesc,
397*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     **DestDesc,
398*433d6423SLionel Sambuc     ACPI_WALK_STATE         *WalkState);
399*433d6423SLionel Sambuc 
400*433d6423SLionel Sambuc 
401*433d6423SLionel Sambuc /*
402*433d6423SLionel Sambuc  * utcreate - Object creation
403*433d6423SLionel Sambuc  */
404*433d6423SLionel Sambuc ACPI_STATUS
405*433d6423SLionel Sambuc AcpiUtUpdateObjectReference (
406*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object,
407*433d6423SLionel Sambuc     UINT16                  Action);
408*433d6423SLionel Sambuc 
409*433d6423SLionel Sambuc 
410*433d6423SLionel Sambuc /*
411*433d6423SLionel Sambuc  * utdebug - Debug interfaces
412*433d6423SLionel Sambuc  */
413*433d6423SLionel Sambuc void
414*433d6423SLionel Sambuc AcpiUtInitStackPtrTrace (
415*433d6423SLionel Sambuc     void);
416*433d6423SLionel Sambuc 
417*433d6423SLionel Sambuc void
418*433d6423SLionel Sambuc AcpiUtTrackStackPtr (
419*433d6423SLionel Sambuc     void);
420*433d6423SLionel Sambuc 
421*433d6423SLionel Sambuc void
422*433d6423SLionel Sambuc AcpiUtTrace (
423*433d6423SLionel Sambuc     UINT32                  LineNumber,
424*433d6423SLionel Sambuc     const char              *FunctionName,
425*433d6423SLionel Sambuc     const char              *ModuleName,
426*433d6423SLionel Sambuc     UINT32                  ComponentId);
427*433d6423SLionel Sambuc 
428*433d6423SLionel Sambuc void
429*433d6423SLionel Sambuc AcpiUtTracePtr (
430*433d6423SLionel Sambuc     UINT32                  LineNumber,
431*433d6423SLionel Sambuc     const char              *FunctionName,
432*433d6423SLionel Sambuc     const char              *ModuleName,
433*433d6423SLionel Sambuc     UINT32                  ComponentId,
434*433d6423SLionel Sambuc     void                    *Pointer);
435*433d6423SLionel Sambuc 
436*433d6423SLionel Sambuc void
437*433d6423SLionel Sambuc AcpiUtTraceU32 (
438*433d6423SLionel Sambuc     UINT32                  LineNumber,
439*433d6423SLionel Sambuc     const char              *FunctionName,
440*433d6423SLionel Sambuc     const char              *ModuleName,
441*433d6423SLionel Sambuc     UINT32                  ComponentId,
442*433d6423SLionel Sambuc     UINT32                  Integer);
443*433d6423SLionel Sambuc 
444*433d6423SLionel Sambuc void
445*433d6423SLionel Sambuc AcpiUtTraceStr (
446*433d6423SLionel Sambuc     UINT32                  LineNumber,
447*433d6423SLionel Sambuc     const char              *FunctionName,
448*433d6423SLionel Sambuc     const char              *ModuleName,
449*433d6423SLionel Sambuc     UINT32                  ComponentId,
450*433d6423SLionel Sambuc     char                    *String);
451*433d6423SLionel Sambuc 
452*433d6423SLionel Sambuc void
453*433d6423SLionel Sambuc AcpiUtExit (
454*433d6423SLionel Sambuc     UINT32                  LineNumber,
455*433d6423SLionel Sambuc     const char              *FunctionName,
456*433d6423SLionel Sambuc     const char              *ModuleName,
457*433d6423SLionel Sambuc     UINT32                  ComponentId);
458*433d6423SLionel Sambuc 
459*433d6423SLionel Sambuc void
460*433d6423SLionel Sambuc AcpiUtStatusExit (
461*433d6423SLionel Sambuc     UINT32                  LineNumber,
462*433d6423SLionel Sambuc     const char              *FunctionName,
463*433d6423SLionel Sambuc     const char              *ModuleName,
464*433d6423SLionel Sambuc     UINT32                  ComponentId,
465*433d6423SLionel Sambuc     ACPI_STATUS             Status);
466*433d6423SLionel Sambuc 
467*433d6423SLionel Sambuc void
468*433d6423SLionel Sambuc AcpiUtValueExit (
469*433d6423SLionel Sambuc     UINT32                  LineNumber,
470*433d6423SLionel Sambuc     const char              *FunctionName,
471*433d6423SLionel Sambuc     const char              *ModuleName,
472*433d6423SLionel Sambuc     UINT32                  ComponentId,
473*433d6423SLionel Sambuc     UINT64                  Value);
474*433d6423SLionel Sambuc 
475*433d6423SLionel Sambuc void
476*433d6423SLionel Sambuc AcpiUtPtrExit (
477*433d6423SLionel Sambuc     UINT32                  LineNumber,
478*433d6423SLionel Sambuc     const char              *FunctionName,
479*433d6423SLionel Sambuc     const char              *ModuleName,
480*433d6423SLionel Sambuc     UINT32                  ComponentId,
481*433d6423SLionel Sambuc     UINT8                   *Ptr);
482*433d6423SLionel Sambuc 
483*433d6423SLionel Sambuc void
484*433d6423SLionel Sambuc AcpiUtDumpBuffer (
485*433d6423SLionel Sambuc     UINT8                   *Buffer,
486*433d6423SLionel Sambuc     UINT32                  Count,
487*433d6423SLionel Sambuc     UINT32                  Display,
488*433d6423SLionel Sambuc     UINT32                  componentId);
489*433d6423SLionel Sambuc 
490*433d6423SLionel Sambuc void
491*433d6423SLionel Sambuc AcpiUtDumpBuffer2 (
492*433d6423SLionel Sambuc     UINT8                   *Buffer,
493*433d6423SLionel Sambuc     UINT32                  Count,
494*433d6423SLionel Sambuc     UINT32                  Display);
495*433d6423SLionel Sambuc 
496*433d6423SLionel Sambuc void
497*433d6423SLionel Sambuc AcpiUtReportError (
498*433d6423SLionel Sambuc     char                    *ModuleName,
499*433d6423SLionel Sambuc     UINT32                  LineNumber);
500*433d6423SLionel Sambuc 
501*433d6423SLionel Sambuc void
502*433d6423SLionel Sambuc AcpiUtReportInfo (
503*433d6423SLionel Sambuc     char                    *ModuleName,
504*433d6423SLionel Sambuc     UINT32                  LineNumber);
505*433d6423SLionel Sambuc 
506*433d6423SLionel Sambuc void
507*433d6423SLionel Sambuc AcpiUtReportWarning (
508*433d6423SLionel Sambuc     char                    *ModuleName,
509*433d6423SLionel Sambuc     UINT32                  LineNumber);
510*433d6423SLionel Sambuc 
511*433d6423SLionel Sambuc /*
512*433d6423SLionel Sambuc  * utdelete - Object deletion and reference counts
513*433d6423SLionel Sambuc  */
514*433d6423SLionel Sambuc void
515*433d6423SLionel Sambuc AcpiUtAddReference (
516*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object);
517*433d6423SLionel Sambuc 
518*433d6423SLionel Sambuc void
519*433d6423SLionel Sambuc AcpiUtRemoveReference (
520*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object);
521*433d6423SLionel Sambuc 
522*433d6423SLionel Sambuc void
523*433d6423SLionel Sambuc AcpiUtDeleteInternalPackageObject (
524*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object);
525*433d6423SLionel Sambuc 
526*433d6423SLionel Sambuc void
527*433d6423SLionel Sambuc AcpiUtDeleteInternalSimpleObject (
528*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object);
529*433d6423SLionel Sambuc 
530*433d6423SLionel Sambuc void
531*433d6423SLionel Sambuc AcpiUtDeleteInternalObjectList (
532*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     **ObjList);
533*433d6423SLionel Sambuc 
534*433d6423SLionel Sambuc 
535*433d6423SLionel Sambuc /*
536*433d6423SLionel Sambuc  * uteval - object evaluation
537*433d6423SLionel Sambuc  */
538*433d6423SLionel Sambuc ACPI_STATUS
539*433d6423SLionel Sambuc AcpiUtOsiImplementation (
540*433d6423SLionel Sambuc     ACPI_WALK_STATE         *WalkState);
541*433d6423SLionel Sambuc 
542*433d6423SLionel Sambuc ACPI_STATUS
543*433d6423SLionel Sambuc AcpiUtEvaluateObject (
544*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *PrefixNode,
545*433d6423SLionel Sambuc     char                    *Path,
546*433d6423SLionel Sambuc     UINT32                  ExpectedReturnBtypes,
547*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     **ReturnDesc);
548*433d6423SLionel Sambuc 
549*433d6423SLionel Sambuc ACPI_STATUS
550*433d6423SLionel Sambuc AcpiUtEvaluateNumericObject (
551*433d6423SLionel Sambuc     char                    *ObjectName,
552*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *DeviceNode,
553*433d6423SLionel Sambuc     UINT64                  *Value);
554*433d6423SLionel Sambuc 
555*433d6423SLionel Sambuc ACPI_STATUS
556*433d6423SLionel Sambuc AcpiUtExecute_STA (
557*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *DeviceNode,
558*433d6423SLionel Sambuc     UINT32                  *StatusFlags);
559*433d6423SLionel Sambuc 
560*433d6423SLionel Sambuc ACPI_STATUS
561*433d6423SLionel Sambuc AcpiUtExecutePowerMethods (
562*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *DeviceNode,
563*433d6423SLionel Sambuc     const char              **MethodNames,
564*433d6423SLionel Sambuc     UINT8                   MethodCount,
565*433d6423SLionel Sambuc     UINT8                   *OutValues);
566*433d6423SLionel Sambuc 
567*433d6423SLionel Sambuc 
568*433d6423SLionel Sambuc /*
569*433d6423SLionel Sambuc  * utids - device ID support
570*433d6423SLionel Sambuc  */
571*433d6423SLionel Sambuc ACPI_STATUS
572*433d6423SLionel Sambuc AcpiUtExecute_HID (
573*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *DeviceNode,
574*433d6423SLionel Sambuc     ACPI_DEVICE_ID          **ReturnId);
575*433d6423SLionel Sambuc 
576*433d6423SLionel Sambuc ACPI_STATUS
577*433d6423SLionel Sambuc AcpiUtExecute_UID (
578*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *DeviceNode,
579*433d6423SLionel Sambuc     ACPI_DEVICE_ID          **ReturnId);
580*433d6423SLionel Sambuc 
581*433d6423SLionel Sambuc ACPI_STATUS
582*433d6423SLionel Sambuc AcpiUtExecute_CID (
583*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *DeviceNode,
584*433d6423SLionel Sambuc     ACPI_DEVICE_ID_LIST     **ReturnCidList);
585*433d6423SLionel Sambuc 
586*433d6423SLionel Sambuc 
587*433d6423SLionel Sambuc /*
588*433d6423SLionel Sambuc  * utlock - reader/writer locks
589*433d6423SLionel Sambuc  */
590*433d6423SLionel Sambuc ACPI_STATUS
591*433d6423SLionel Sambuc AcpiUtCreateRwLock (
592*433d6423SLionel Sambuc     ACPI_RW_LOCK            *Lock);
593*433d6423SLionel Sambuc 
594*433d6423SLionel Sambuc void
595*433d6423SLionel Sambuc AcpiUtDeleteRwLock (
596*433d6423SLionel Sambuc     ACPI_RW_LOCK            *Lock);
597*433d6423SLionel Sambuc 
598*433d6423SLionel Sambuc ACPI_STATUS
599*433d6423SLionel Sambuc AcpiUtAcquireReadLock (
600*433d6423SLionel Sambuc     ACPI_RW_LOCK            *Lock);
601*433d6423SLionel Sambuc 
602*433d6423SLionel Sambuc ACPI_STATUS
603*433d6423SLionel Sambuc AcpiUtReleaseReadLock (
604*433d6423SLionel Sambuc     ACPI_RW_LOCK            *Lock);
605*433d6423SLionel Sambuc 
606*433d6423SLionel Sambuc ACPI_STATUS
607*433d6423SLionel Sambuc AcpiUtAcquireWriteLock (
608*433d6423SLionel Sambuc     ACPI_RW_LOCK            *Lock);
609*433d6423SLionel Sambuc 
610*433d6423SLionel Sambuc void
611*433d6423SLionel Sambuc AcpiUtReleaseWriteLock (
612*433d6423SLionel Sambuc     ACPI_RW_LOCK            *Lock);
613*433d6423SLionel Sambuc 
614*433d6423SLionel Sambuc 
615*433d6423SLionel Sambuc /*
616*433d6423SLionel Sambuc  * utobject - internal object create/delete/cache routines
617*433d6423SLionel Sambuc  */
618*433d6423SLionel Sambuc ACPI_OPERAND_OBJECT  *
619*433d6423SLionel Sambuc AcpiUtCreateInternalObjectDbg (
620*433d6423SLionel Sambuc     const char              *ModuleName,
621*433d6423SLionel Sambuc     UINT32                  LineNumber,
622*433d6423SLionel Sambuc     UINT32                  ComponentId,
623*433d6423SLionel Sambuc     ACPI_OBJECT_TYPE        Type);
624*433d6423SLionel Sambuc 
625*433d6423SLionel Sambuc void *
626*433d6423SLionel Sambuc AcpiUtAllocateObjectDescDbg (
627*433d6423SLionel Sambuc     const char              *ModuleName,
628*433d6423SLionel Sambuc     UINT32                  LineNumber,
629*433d6423SLionel Sambuc     UINT32                  ComponentId);
630*433d6423SLionel Sambuc 
631*433d6423SLionel Sambuc #define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
632*433d6423SLionel Sambuc #define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
633*433d6423SLionel Sambuc 
634*433d6423SLionel Sambuc void
635*433d6423SLionel Sambuc AcpiUtDeleteObjectDesc (
636*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object);
637*433d6423SLionel Sambuc 
638*433d6423SLionel Sambuc BOOLEAN
639*433d6423SLionel Sambuc AcpiUtValidInternalObject (
640*433d6423SLionel Sambuc     void                    *Object);
641*433d6423SLionel Sambuc 
642*433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *
643*433d6423SLionel Sambuc AcpiUtCreatePackageObject (
644*433d6423SLionel Sambuc     UINT32                  Count);
645*433d6423SLionel Sambuc 
646*433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *
647*433d6423SLionel Sambuc AcpiUtCreateIntegerObject (
648*433d6423SLionel Sambuc     UINT64                  Value);
649*433d6423SLionel Sambuc 
650*433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *
651*433d6423SLionel Sambuc AcpiUtCreateBufferObject (
652*433d6423SLionel Sambuc     ACPI_SIZE               BufferSize);
653*433d6423SLionel Sambuc 
654*433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *
655*433d6423SLionel Sambuc AcpiUtCreateStringObject (
656*433d6423SLionel Sambuc     ACPI_SIZE               StringSize);
657*433d6423SLionel Sambuc 
658*433d6423SLionel Sambuc ACPI_STATUS
659*433d6423SLionel Sambuc AcpiUtGetObjectSize(
660*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Obj,
661*433d6423SLionel Sambuc     ACPI_SIZE               *ObjLength);
662*433d6423SLionel Sambuc 
663*433d6423SLionel Sambuc 
664*433d6423SLionel Sambuc /*
665*433d6423SLionel Sambuc  * utstate - Generic state creation/cache routines
666*433d6423SLionel Sambuc  */
667*433d6423SLionel Sambuc void
668*433d6423SLionel Sambuc AcpiUtPushGenericState (
669*433d6423SLionel Sambuc     ACPI_GENERIC_STATE      **ListHead,
670*433d6423SLionel Sambuc     ACPI_GENERIC_STATE      *State);
671*433d6423SLionel Sambuc 
672*433d6423SLionel Sambuc ACPI_GENERIC_STATE *
673*433d6423SLionel Sambuc AcpiUtPopGenericState (
674*433d6423SLionel Sambuc     ACPI_GENERIC_STATE      **ListHead);
675*433d6423SLionel Sambuc 
676*433d6423SLionel Sambuc 
677*433d6423SLionel Sambuc ACPI_GENERIC_STATE *
678*433d6423SLionel Sambuc AcpiUtCreateGenericState (
679*433d6423SLionel Sambuc     void);
680*433d6423SLionel Sambuc 
681*433d6423SLionel Sambuc ACPI_THREAD_STATE *
682*433d6423SLionel Sambuc AcpiUtCreateThreadState (
683*433d6423SLionel Sambuc     void);
684*433d6423SLionel Sambuc 
685*433d6423SLionel Sambuc ACPI_GENERIC_STATE *
686*433d6423SLionel Sambuc AcpiUtCreateUpdateState (
687*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object,
688*433d6423SLionel Sambuc     UINT16                  Action);
689*433d6423SLionel Sambuc 
690*433d6423SLionel Sambuc ACPI_GENERIC_STATE *
691*433d6423SLionel Sambuc AcpiUtCreatePkgState (
692*433d6423SLionel Sambuc     void                    *InternalObject,
693*433d6423SLionel Sambuc     void                    *ExternalObject,
694*433d6423SLionel Sambuc     UINT16                  Index);
695*433d6423SLionel Sambuc 
696*433d6423SLionel Sambuc ACPI_STATUS
697*433d6423SLionel Sambuc AcpiUtCreateUpdateStateAndPush (
698*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *Object,
699*433d6423SLionel Sambuc     UINT16                  Action,
700*433d6423SLionel Sambuc     ACPI_GENERIC_STATE      **StateList);
701*433d6423SLionel Sambuc 
702*433d6423SLionel Sambuc ACPI_STATUS
703*433d6423SLionel Sambuc AcpiUtCreatePkgStateAndPush (
704*433d6423SLionel Sambuc     void                    *InternalObject,
705*433d6423SLionel Sambuc     void                    *ExternalObject,
706*433d6423SLionel Sambuc     UINT16                  Index,
707*433d6423SLionel Sambuc     ACPI_GENERIC_STATE      **StateList);
708*433d6423SLionel Sambuc 
709*433d6423SLionel Sambuc ACPI_GENERIC_STATE *
710*433d6423SLionel Sambuc AcpiUtCreateControlState (
711*433d6423SLionel Sambuc     void);
712*433d6423SLionel Sambuc 
713*433d6423SLionel Sambuc void
714*433d6423SLionel Sambuc AcpiUtDeleteGenericState (
715*433d6423SLionel Sambuc     ACPI_GENERIC_STATE      *State);
716*433d6423SLionel Sambuc 
717*433d6423SLionel Sambuc 
718*433d6423SLionel Sambuc /*
719*433d6423SLionel Sambuc  * utmath
720*433d6423SLionel Sambuc  */
721*433d6423SLionel Sambuc ACPI_STATUS
722*433d6423SLionel Sambuc AcpiUtDivide (
723*433d6423SLionel Sambuc     UINT64                  InDividend,
724*433d6423SLionel Sambuc     UINT64                  InDivisor,
725*433d6423SLionel Sambuc     UINT64                  *OutQuotient,
726*433d6423SLionel Sambuc     UINT64                  *OutRemainder);
727*433d6423SLionel Sambuc 
728*433d6423SLionel Sambuc ACPI_STATUS
729*433d6423SLionel Sambuc AcpiUtShortDivide (
730*433d6423SLionel Sambuc     UINT64                  InDividend,
731*433d6423SLionel Sambuc     UINT32                  Divisor,
732*433d6423SLionel Sambuc     UINT64                  *OutQuotient,
733*433d6423SLionel Sambuc     UINT32                  *OutRemainder);
734*433d6423SLionel Sambuc 
735*433d6423SLionel Sambuc /*
736*433d6423SLionel Sambuc  * utmisc
737*433d6423SLionel Sambuc  */
738*433d6423SLionel Sambuc const char *
739*433d6423SLionel Sambuc AcpiUtValidateException (
740*433d6423SLionel Sambuc     ACPI_STATUS             Status);
741*433d6423SLionel Sambuc 
742*433d6423SLionel Sambuc BOOLEAN
743*433d6423SLionel Sambuc AcpiUtIsPciRootBridge (
744*433d6423SLionel Sambuc     char                    *Id);
745*433d6423SLionel Sambuc 
746*433d6423SLionel Sambuc BOOLEAN
747*433d6423SLionel Sambuc AcpiUtIsAmlTable (
748*433d6423SLionel Sambuc     ACPI_TABLE_HEADER       *Table);
749*433d6423SLionel Sambuc 
750*433d6423SLionel Sambuc ACPI_STATUS
751*433d6423SLionel Sambuc AcpiUtAllocateOwnerId (
752*433d6423SLionel Sambuc     ACPI_OWNER_ID           *OwnerId);
753*433d6423SLionel Sambuc 
754*433d6423SLionel Sambuc void
755*433d6423SLionel Sambuc AcpiUtReleaseOwnerId (
756*433d6423SLionel Sambuc     ACPI_OWNER_ID           *OwnerId);
757*433d6423SLionel Sambuc 
758*433d6423SLionel Sambuc ACPI_STATUS
759*433d6423SLionel Sambuc AcpiUtWalkPackageTree (
760*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *SourceObject,
761*433d6423SLionel Sambuc     void                    *TargetObject,
762*433d6423SLionel Sambuc     ACPI_PKG_CALLBACK       WalkCallback,
763*433d6423SLionel Sambuc     void                    *Context);
764*433d6423SLionel Sambuc 
765*433d6423SLionel Sambuc void
766*433d6423SLionel Sambuc AcpiUtStrupr (
767*433d6423SLionel Sambuc     char                    *SrcString);
768*433d6423SLionel Sambuc 
769*433d6423SLionel Sambuc void
770*433d6423SLionel Sambuc AcpiUtStrlwr (
771*433d6423SLionel Sambuc     char                    *SrcString);
772*433d6423SLionel Sambuc 
773*433d6423SLionel Sambuc void
774*433d6423SLionel Sambuc AcpiUtPrintString (
775*433d6423SLionel Sambuc     char                    *String,
776*433d6423SLionel Sambuc     UINT8                   MaxLength);
777*433d6423SLionel Sambuc 
778*433d6423SLionel Sambuc BOOLEAN
779*433d6423SLionel Sambuc AcpiUtValidAcpiName (
780*433d6423SLionel Sambuc     UINT32                  Name);
781*433d6423SLionel Sambuc 
782*433d6423SLionel Sambuc void
783*433d6423SLionel Sambuc AcpiUtRepairName (
784*433d6423SLionel Sambuc     char                    *Name);
785*433d6423SLionel Sambuc 
786*433d6423SLionel Sambuc BOOLEAN
787*433d6423SLionel Sambuc AcpiUtValidAcpiChar (
788*433d6423SLionel Sambuc     char                    Character,
789*433d6423SLionel Sambuc     UINT32                  Position);
790*433d6423SLionel Sambuc 
791*433d6423SLionel Sambuc ACPI_STATUS
792*433d6423SLionel Sambuc AcpiUtStrtoul64 (
793*433d6423SLionel Sambuc     char                    *String,
794*433d6423SLionel Sambuc     UINT32                  Base,
795*433d6423SLionel Sambuc     UINT64                  *RetInteger);
796*433d6423SLionel Sambuc 
797*433d6423SLionel Sambuc void ACPI_INTERNAL_VAR_XFACE
798*433d6423SLionel Sambuc AcpiUtPredefinedWarning (
799*433d6423SLionel Sambuc     const char              *ModuleName,
800*433d6423SLionel Sambuc     UINT32                  LineNumber,
801*433d6423SLionel Sambuc     char                    *Pathname,
802*433d6423SLionel Sambuc     UINT8                   NodeFlags,
803*433d6423SLionel Sambuc     const char              *Format,
804*433d6423SLionel Sambuc     ...);
805*433d6423SLionel Sambuc 
806*433d6423SLionel Sambuc void ACPI_INTERNAL_VAR_XFACE
807*433d6423SLionel Sambuc AcpiUtPredefinedInfo (
808*433d6423SLionel Sambuc     const char              *ModuleName,
809*433d6423SLionel Sambuc     UINT32                  LineNumber,
810*433d6423SLionel Sambuc     char                    *Pathname,
811*433d6423SLionel Sambuc     UINT8                   NodeFlags,
812*433d6423SLionel Sambuc     const char              *Format,
813*433d6423SLionel Sambuc     ...);
814*433d6423SLionel Sambuc 
815*433d6423SLionel Sambuc /* Values for Base above (16=Hex, 10=Decimal) */
816*433d6423SLionel Sambuc 
817*433d6423SLionel Sambuc #define ACPI_ANY_BASE        0
818*433d6423SLionel Sambuc 
819*433d6423SLionel Sambuc UINT32
820*433d6423SLionel Sambuc AcpiUtDwordByteSwap (
821*433d6423SLionel Sambuc     UINT32                  Value);
822*433d6423SLionel Sambuc 
823*433d6423SLionel Sambuc void
824*433d6423SLionel Sambuc AcpiUtSetIntegerWidth (
825*433d6423SLionel Sambuc     UINT8                   Revision);
826*433d6423SLionel Sambuc 
827*433d6423SLionel Sambuc #ifdef ACPI_DEBUG_OUTPUT
828*433d6423SLionel Sambuc void
829*433d6423SLionel Sambuc AcpiUtDisplayInitPathname (
830*433d6423SLionel Sambuc     UINT8                   Type,
831*433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE     *ObjHandle,
832*433d6423SLionel Sambuc     char                    *Path);
833*433d6423SLionel Sambuc #endif
834*433d6423SLionel Sambuc 
835*433d6423SLionel Sambuc 
836*433d6423SLionel Sambuc /*
837*433d6423SLionel Sambuc  * utresrc
838*433d6423SLionel Sambuc  */
839*433d6423SLionel Sambuc ACPI_STATUS
840*433d6423SLionel Sambuc AcpiUtWalkAmlResources (
841*433d6423SLionel Sambuc     UINT8                   *Aml,
842*433d6423SLionel Sambuc     ACPI_SIZE               AmlLength,
843*433d6423SLionel Sambuc     ACPI_WALK_AML_CALLBACK  UserFunction,
844*433d6423SLionel Sambuc     void                    *Context);
845*433d6423SLionel Sambuc 
846*433d6423SLionel Sambuc ACPI_STATUS
847*433d6423SLionel Sambuc AcpiUtValidateResource (
848*433d6423SLionel Sambuc     void                    *Aml,
849*433d6423SLionel Sambuc     UINT8                   *ReturnIndex);
850*433d6423SLionel Sambuc 
851*433d6423SLionel Sambuc UINT32
852*433d6423SLionel Sambuc AcpiUtGetDescriptorLength (
853*433d6423SLionel Sambuc     void                    *Aml);
854*433d6423SLionel Sambuc 
855*433d6423SLionel Sambuc UINT16
856*433d6423SLionel Sambuc AcpiUtGetResourceLength (
857*433d6423SLionel Sambuc     void                    *Aml);
858*433d6423SLionel Sambuc 
859*433d6423SLionel Sambuc UINT8
860*433d6423SLionel Sambuc AcpiUtGetResourceHeaderLength (
861*433d6423SLionel Sambuc     void                    *Aml);
862*433d6423SLionel Sambuc 
863*433d6423SLionel Sambuc UINT8
864*433d6423SLionel Sambuc AcpiUtGetResourceType (
865*433d6423SLionel Sambuc     void                    *Aml);
866*433d6423SLionel Sambuc 
867*433d6423SLionel Sambuc ACPI_STATUS
868*433d6423SLionel Sambuc AcpiUtGetResourceEndTag (
869*433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT     *ObjDesc,
870*433d6423SLionel Sambuc     UINT8                   **EndTag);
871*433d6423SLionel Sambuc 
872*433d6423SLionel Sambuc 
873*433d6423SLionel Sambuc /*
874*433d6423SLionel Sambuc  * utmutex - mutex support
875*433d6423SLionel Sambuc  */
876*433d6423SLionel Sambuc ACPI_STATUS
877*433d6423SLionel Sambuc AcpiUtMutexInitialize (
878*433d6423SLionel Sambuc     void);
879*433d6423SLionel Sambuc 
880*433d6423SLionel Sambuc void
881*433d6423SLionel Sambuc AcpiUtMutexTerminate (
882*433d6423SLionel Sambuc     void);
883*433d6423SLionel Sambuc 
884*433d6423SLionel Sambuc ACPI_STATUS
885*433d6423SLionel Sambuc AcpiUtAcquireMutex (
886*433d6423SLionel Sambuc     ACPI_MUTEX_HANDLE       MutexId);
887*433d6423SLionel Sambuc 
888*433d6423SLionel Sambuc ACPI_STATUS
889*433d6423SLionel Sambuc AcpiUtReleaseMutex (
890*433d6423SLionel Sambuc     ACPI_MUTEX_HANDLE       MutexId);
891*433d6423SLionel Sambuc 
892*433d6423SLionel Sambuc 
893*433d6423SLionel Sambuc /*
894*433d6423SLionel Sambuc  * utalloc - memory allocation and object caching
895*433d6423SLionel Sambuc  */
896*433d6423SLionel Sambuc ACPI_STATUS
897*433d6423SLionel Sambuc AcpiUtCreateCaches (
898*433d6423SLionel Sambuc     void);
899*433d6423SLionel Sambuc 
900*433d6423SLionel Sambuc ACPI_STATUS
901*433d6423SLionel Sambuc AcpiUtDeleteCaches (
902*433d6423SLionel Sambuc     void);
903*433d6423SLionel Sambuc 
904*433d6423SLionel Sambuc ACPI_STATUS
905*433d6423SLionel Sambuc AcpiUtValidateBuffer (
906*433d6423SLionel Sambuc     ACPI_BUFFER             *Buffer);
907*433d6423SLionel Sambuc 
908*433d6423SLionel Sambuc ACPI_STATUS
909*433d6423SLionel Sambuc AcpiUtInitializeBuffer (
910*433d6423SLionel Sambuc     ACPI_BUFFER             *Buffer,
911*433d6423SLionel Sambuc     ACPI_SIZE               RequiredLength);
912*433d6423SLionel Sambuc 
913*433d6423SLionel Sambuc void *
914*433d6423SLionel Sambuc AcpiUtAllocate (
915*433d6423SLionel Sambuc     ACPI_SIZE               Size,
916*433d6423SLionel Sambuc     UINT32                  Component,
917*433d6423SLionel Sambuc     const char              *Module,
918*433d6423SLionel Sambuc     UINT32                  Line);
919*433d6423SLionel Sambuc 
920*433d6423SLionel Sambuc void *
921*433d6423SLionel Sambuc AcpiUtAllocateZeroed (
922*433d6423SLionel Sambuc     ACPI_SIZE               Size,
923*433d6423SLionel Sambuc     UINT32                  Component,
924*433d6423SLionel Sambuc     const char              *Module,
925*433d6423SLionel Sambuc     UINT32                  Line);
926*433d6423SLionel Sambuc 
927*433d6423SLionel Sambuc #ifdef ACPI_DBG_TRACK_ALLOCATIONS
928*433d6423SLionel Sambuc void *
929*433d6423SLionel Sambuc AcpiUtAllocateAndTrack (
930*433d6423SLionel Sambuc     ACPI_SIZE               Size,
931*433d6423SLionel Sambuc     UINT32                  Component,
932*433d6423SLionel Sambuc     const char              *Module,
933*433d6423SLionel Sambuc     UINT32                  Line);
934*433d6423SLionel Sambuc 
935*433d6423SLionel Sambuc void *
936*433d6423SLionel Sambuc AcpiUtAllocateZeroedAndTrack (
937*433d6423SLionel Sambuc     ACPI_SIZE               Size,
938*433d6423SLionel Sambuc     UINT32                  Component,
939*433d6423SLionel Sambuc     const char              *Module,
940*433d6423SLionel Sambuc     UINT32                  Line);
941*433d6423SLionel Sambuc 
942*433d6423SLionel Sambuc void
943*433d6423SLionel Sambuc AcpiUtFreeAndTrack (
944*433d6423SLionel Sambuc     void                    *Address,
945*433d6423SLionel Sambuc     UINT32                  Component,
946*433d6423SLionel Sambuc     const char              *Module,
947*433d6423SLionel Sambuc     UINT32                  Line);
948*433d6423SLionel Sambuc 
949*433d6423SLionel Sambuc void
950*433d6423SLionel Sambuc AcpiUtDumpAllocationInfo (
951*433d6423SLionel Sambuc     void);
952*433d6423SLionel Sambuc 
953*433d6423SLionel Sambuc void
954*433d6423SLionel Sambuc AcpiUtDumpAllocations (
955*433d6423SLionel Sambuc     UINT32                  Component,
956*433d6423SLionel Sambuc     const char              *Module);
957*433d6423SLionel Sambuc 
958*433d6423SLionel Sambuc ACPI_STATUS
959*433d6423SLionel Sambuc AcpiUtCreateList (
960*433d6423SLionel Sambuc     char                    *ListName,
961*433d6423SLionel Sambuc     UINT16                  ObjectSize,
962*433d6423SLionel Sambuc     ACPI_MEMORY_LIST        **ReturnCache);
963*433d6423SLionel Sambuc 
964*433d6423SLionel Sambuc 
965*433d6423SLionel Sambuc #endif
966*433d6423SLionel Sambuc 
967*433d6423SLionel Sambuc #endif /* _ACUTILS_H */
968