acutils.h revision 126372
167754Smsmith/******************************************************************************
267754Smsmith *
377424Smsmith * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4126372Snjl *       $Revision: 159 $
567754Smsmith *
667754Smsmith *****************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
12126372Snjl * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
1370243Smsmith * All rights reserved.
1467754Smsmith *
1567754Smsmith * 2. License
1667754Smsmith *
1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1867754Smsmith * rights.  You may have additional license terms from the party that provided
1967754Smsmith * you this software, covering your right to use that party's intellectual
2067754Smsmith * property rights.
2167754Smsmith *
2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2667754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2767754Smsmith * Code in any form, with the right to sublicense such rights; and
2867754Smsmith *
2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3067754Smsmith * license (with the right to sublicense), under only those claims of Intel
3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3467754Smsmith * license, and in no event shall the patent license extend to any additions
3567754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3667754Smsmith * is granted directly or by implication, estoppel or otherwise;
3767754Smsmith *
3867754Smsmith * The above copyright and patent license is granted only if the following
3967754Smsmith * conditions are met:
4067754Smsmith *
4167754Smsmith * 3. Conditions
4267754Smsmith *
4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4467754Smsmith * Redistribution of source code of any substantial portion of the Covered
4567754Smsmith * Code or modification with rights to further distribute source must include
4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4767754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5067754Smsmith * Code and the date of any change.  Licensee must include in that file the
5167754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5267754Smsmith * must include a prominent statement that the modification is derived,
5367754Smsmith * directly or indirectly, from Original Intel Code.
5467754Smsmith *
5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5667754Smsmith * Redistribution of source code of any substantial portion of the Covered
5767754Smsmith * Code or modification without rights to further distribute source must
5867754Smsmith * include the following Disclaimer and Export Compliance provision in the
5967754Smsmith * documentation and/or other materials provided with distribution.  In
6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6267754Smsmith * license from Licensee to its licensee is limited to the intellectual
6367754Smsmith * property embodied in the software Licensee provides to its licensee, and
6467754Smsmith * not to intellectual property embodied in modifications its licensee may
6567754Smsmith * make.
6667754Smsmith *
6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the
6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7067754Smsmith * provision in the documentation and/or other materials provided with the
7167754Smsmith * distribution.
7267754Smsmith *
7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7467754Smsmith * Intel Code.
7567754Smsmith *
7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7867754Smsmith * other dealings in products derived from or relating to the Covered Code
7967754Smsmith * without prior written authorization from Intel.
8067754Smsmith *
8167754Smsmith * 4. Disclaimer and Export Compliance
8267754Smsmith *
8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8467754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8967754Smsmith * PARTICULAR PURPOSE.
9067754Smsmith *
9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9867754Smsmith * LIMITED REMEDY.
9967754Smsmith *
10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10167754Smsmith * software or system incorporating such software without first obtaining any
10267754Smsmith * required license or other approval from the U. S. Department of Commerce or
10367754Smsmith * any other agency or department of the United States Government.  In the
10467754Smsmith * event Licensee exports any such software from the United States or
10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10667754Smsmith * ensure that the distribution and export/re-export of the software is in
10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11067754Smsmith * software, or service, directly or indirectly, to any country for which the
11167754Smsmith * United States government or any agency thereof requires an export license,
11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11367754Smsmith * such license, approval or letter.
11467754Smsmith *
11567754Smsmith *****************************************************************************/
11667754Smsmith
11777424Smsmith#ifndef _ACUTILS_H
11877424Smsmith#define _ACUTILS_H
11967754Smsmith
12067754Smsmith
12173561Smsmithtypedef
12273561SmsmithACPI_STATUS (*ACPI_PKG_CALLBACK) (
12373561Smsmith    UINT8                   ObjectType,
12473561Smsmith    ACPI_OPERAND_OBJECT     *SourceObject,
12573561Smsmith    ACPI_GENERIC_STATE      *State,
12673561Smsmith    void                    *Context);
12773561Smsmith
12873561Smsmith
12973561SmsmithACPI_STATUS
13077424SmsmithAcpiUtWalkPackageTree (
13173561Smsmith    ACPI_OPERAND_OBJECT     *SourceObject,
13273561Smsmith    void                    *TargetObject,
13373561Smsmith    ACPI_PKG_CALLBACK       WalkCallback,
13473561Smsmith    void                    *Context);
13573561Smsmith
13673561Smsmith
13773561Smsmithtypedef struct acpi_pkg_info
13873561Smsmith{
13973561Smsmith    UINT8                   *FreeSpace;
14091116Smsmith    ACPI_SIZE               Length;
14173561Smsmith    UINT32                  ObjectSpace;
14273561Smsmith    UINT32                  NumPackages;
143114237Snjl
14473561Smsmith} ACPI_PKG_INFO;
14573561Smsmith
14667754Smsmith#define REF_INCREMENT       (UINT16) 0
14767754Smsmith#define REF_DECREMENT       (UINT16) 1
14867754Smsmith#define REF_FORCE_DELETE    (UINT16) 2
14967754Smsmith
15077424Smsmith/* AcpiUtDumpBuffer */
15167754Smsmith
15267754Smsmith#define DB_BYTE_DISPLAY     1
15367754Smsmith#define DB_WORD_DISPLAY     2
15467754Smsmith#define DB_DWORD_DISPLAY    4
15567754Smsmith#define DB_QWORD_DISPLAY    8
15667754Smsmith
15767754Smsmith
15867754Smsmith/* Global initialization interfaces */
15967754Smsmith
16067754Smsmithvoid
16177424SmsmithAcpiUtInitGlobals (
16267754Smsmith    void);
16367754Smsmith
16467754Smsmithvoid
16577424SmsmithAcpiUtTerminate (
16667754Smsmith    void);
16767754Smsmith
16867754Smsmith
16967754Smsmith/*
17077424Smsmith * UtInit - miscellaneous initialization and shutdown
17167754Smsmith */
17267754Smsmith
17367754SmsmithACPI_STATUS
17477424SmsmithAcpiUtHardwareInitialize (
17567754Smsmith    void);
17667754Smsmith
17799679Siwasakivoid
17877424SmsmithAcpiUtSubsystemShutdown (
17967754Smsmith    void);
18067754Smsmith
18167754SmsmithACPI_STATUS
18277424SmsmithAcpiUtValidateFadt (
18367754Smsmith    void);
18467754Smsmith
18567754Smsmith/*
18677424Smsmith * UtGlobal - Global data structures and procedures
18767754Smsmith */
18867754Smsmith
189102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
19069746Smsmith
191114237Snjlchar *
19277424SmsmithAcpiUtGetMutexName (
19367754Smsmith    UINT32                  MutexId);
19467754Smsmith
195100966Siwasaki#endif
196100966Siwasaki
197114237Snjlchar *
19877424SmsmithAcpiUtGetTypeName (
19991116Smsmith    ACPI_OBJECT_TYPE        Type);
20067754Smsmith
201114237Snjlchar *
202123315SnjlAcpiUtGetNodeName (
203123315Snjl    void                    *Object);
204123315Snjl
205123315Snjlchar *
206123315SnjlAcpiUtGetDescriptorName (
207123315Snjl    void                    *Object);
208123315Snjl
209123315Snjlchar *
21099679SiwasakiAcpiUtGetObjectTypeName (
21199679Siwasaki    ACPI_OPERAND_OBJECT     *ObjDesc);
21299679Siwasaki
213114237Snjlchar *
21477424SmsmithAcpiUtGetRegionName (
21569746Smsmith    UINT8                   SpaceId);
21669746Smsmith
217114237Snjlchar *
21891116SmsmithAcpiUtGetEventName (
21991116Smsmith    UINT32                  EventId);
22069746Smsmith
22199679Siwasakichar
22282367SmsmithAcpiUtHexToAsciiChar (
22382367Smsmith    ACPI_INTEGER            Integer,
22482367Smsmith    UINT32                  Position);
22582367Smsmith
22667754SmsmithBOOLEAN
22777424SmsmithAcpiUtValidObjectType (
22891116Smsmith    ACPI_OBJECT_TYPE        Type);
22967754Smsmith
23067754SmsmithACPI_OWNER_ID
23177424SmsmithAcpiUtAllocateOwnerId (
23267754Smsmith    UINT32                  IdType);
23367754Smsmith
23467754Smsmith
23567754Smsmith/*
23677424Smsmith * UtClib - Local implementations of C library functions
23767754Smsmith */
23867754Smsmith
23971867Smsmith#ifndef ACPI_USE_SYSTEM_CLIBRARY
24071867Smsmith
241104470SiwasakiACPI_SIZE
24277424SmsmithAcpiUtStrlen (
243114237Snjl    const char              *String);
24467754Smsmith
245114237Snjlchar *
24677424SmsmithAcpiUtStrcpy (
247114237Snjl    char                    *DstString,
248114237Snjl    const char              *SrcString);
24967754Smsmith
250114237Snjlchar *
25177424SmsmithAcpiUtStrncpy (
252114237Snjl    char                    *DstString,
253114237Snjl    const char              *SrcString,
254104470Siwasaki    ACPI_SIZE               Count);
25567754Smsmith
25699679Siwasakiint
25777424SmsmithAcpiUtStrncmp (
258114237Snjl    const char              *String1,
259114237Snjl    const char              *String2,
260104470Siwasaki    ACPI_SIZE               Count);
26167754Smsmith
262104470Siwasakiint
26377424SmsmithAcpiUtStrcmp (
264114237Snjl    const char              *String1,
265114237Snjl    const char              *String2);
26667754Smsmith
267114237Snjlchar *
26877424SmsmithAcpiUtStrcat (
269114237Snjl    char                    *DstString,
270114237Snjl    const char              *SrcString);
27167754Smsmith
272114237Snjlchar *
27377424SmsmithAcpiUtStrncat (
274114237Snjl    char                    *DstString,
275114237Snjl    const char              *SrcString,
276104470Siwasaki    ACPI_SIZE               Count);
27767754Smsmith
27867754SmsmithUINT32
27977424SmsmithAcpiUtStrtoul (
280114237Snjl    const char              *String,
281114237Snjl    char                    **Terminator,
28277424Smsmith    UINT32                  Base);
28367754Smsmith
284114237Snjlchar *
28577424SmsmithAcpiUtStrstr (
286114237Snjl    char                    *String1,
287114237Snjl    char                    *String2);
28867754Smsmith
28967754Smsmithvoid *
29077424SmsmithAcpiUtMemcpy (
29167754Smsmith    void                    *Dest,
29267754Smsmith    const void              *Src,
293104470Siwasaki    ACPI_SIZE               Count);
29467754Smsmith
29567754Smsmithvoid *
29677424SmsmithAcpiUtMemset (
29767754Smsmith    void                    *Dest,
298114237Snjl    ACPI_NATIVE_UINT        Value,
299104470Siwasaki    ACPI_SIZE               Count);
30067754Smsmith
30199679Siwasakiint
30277424SmsmithAcpiUtToUpper (
30399679Siwasaki    int                     c);
30467754Smsmith
30599679Siwasakiint
30677424SmsmithAcpiUtToLower (
30799679Siwasaki    int                     c);
30867754Smsmith
30999679Siwasakiextern const UINT8 _acpi_ctype[];
31099679Siwasaki
31199679Siwasaki#define _ACPI_XA     0x00    /* extra alphabetic - not supported */
31299679Siwasaki#define _ACPI_XS     0x40    /* extra space */
31399679Siwasaki#define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
31499679Siwasaki#define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
31599679Siwasaki#define _ACPI_DI     0x04    /* '0'-'9' */
31699679Siwasaki#define _ACPI_LO     0x02    /* 'a'-'z' */
31799679Siwasaki#define _ACPI_PU     0x10    /* punctuation */
31899679Siwasaki#define _ACPI_SP     0x08    /* space */
31999679Siwasaki#define _ACPI_UP     0x01    /* 'A'-'Z' */
32099679Siwasaki#define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
32199679Siwasaki
32299679Siwasaki#define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
32399679Siwasaki#define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
32499679Siwasaki#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
32599679Siwasaki#define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
32699679Siwasaki#define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
327100966Siwasaki#define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
328100966Siwasaki#define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
329100966Siwasaki#define ACPI_IS_ASCII(c)  ((c) < 0x80)
33099679Siwasaki
33171867Smsmith#endif /* ACPI_USE_SYSTEM_CLIBRARY */
33267754Smsmith
33367754Smsmith/*
33477424Smsmith * UtCopy - Object construction and conversion interfaces
33567754Smsmith */
33667754Smsmith
33767754SmsmithACPI_STATUS
33877424SmsmithAcpiUtBuildSimpleObject(
33967754Smsmith    ACPI_OPERAND_OBJECT     *Obj,
34067754Smsmith    ACPI_OBJECT             *UserObj,
34167754Smsmith    UINT8                   *DataSpace,
34267754Smsmith    UINT32                  *BufferSpaceUsed);
34367754Smsmith
34467754SmsmithACPI_STATUS
34577424SmsmithAcpiUtBuildPackageObject (
34667754Smsmith    ACPI_OPERAND_OBJECT     *Obj,
34767754Smsmith    UINT8                   *Buffer,
34867754Smsmith    UINT32                  *SpaceUsed);
34967754Smsmith
35067754SmsmithACPI_STATUS
35199679SiwasakiAcpiUtCopyIelementToEelement (
35299679Siwasaki    UINT8                   ObjectType,
35399679Siwasaki    ACPI_OPERAND_OBJECT     *SourceObject,
35499679Siwasaki    ACPI_GENERIC_STATE      *State,
35599679Siwasaki    void                    *Context);
35699679Siwasaki
35799679SiwasakiACPI_STATUS
35899679SiwasakiAcpiUtCopyIelementToIelement (
35999679Siwasaki    UINT8                   ObjectType,
36099679Siwasaki    ACPI_OPERAND_OBJECT     *SourceObject,
36199679Siwasaki    ACPI_GENERIC_STATE      *State,
36299679Siwasaki    void                    *Context);
36399679Siwasaki
36499679SiwasakiACPI_STATUS
36577424SmsmithAcpiUtCopyIobjectToEobject (
36667754Smsmith    ACPI_OPERAND_OBJECT     *Obj,
36767754Smsmith    ACPI_BUFFER             *RetBuffer);
36867754Smsmith
36967754SmsmithACPI_STATUS
37077424SmsmithAcpiUtCopyEsimpleToIsimple(
37167754Smsmith    ACPI_OBJECT             *UserObj,
37284491Smsmith    ACPI_OPERAND_OBJECT     **ReturnObj);
37367754Smsmith
37467754SmsmithACPI_STATUS
37577424SmsmithAcpiUtCopyEobjectToIobject (
37667754Smsmith    ACPI_OBJECT             *Obj,
37784491Smsmith    ACPI_OPERAND_OBJECT     **InternalObj);
37867754Smsmith
37967754SmsmithACPI_STATUS
38077424SmsmithAcpiUtCopyISimpleToIsimple (
38167754Smsmith    ACPI_OPERAND_OBJECT     *SourceObj,
38267754Smsmith    ACPI_OPERAND_OBJECT     *DestObj);
38367754Smsmith
38467754SmsmithACPI_STATUS
38577424SmsmithAcpiUtCopyIpackageToIpackage (
38667754Smsmith    ACPI_OPERAND_OBJECT     *SourceObj,
38773561Smsmith    ACPI_OPERAND_OBJECT     *DestObj,
38873561Smsmith    ACPI_WALK_STATE         *WalkState);
38967754Smsmith
39091116SmsmithACPI_STATUS
39191116SmsmithAcpiUtCopySimpleObject (
39291116Smsmith    ACPI_OPERAND_OBJECT     *SourceDesc,
39391116Smsmith    ACPI_OPERAND_OBJECT     *DestDesc);
39467754Smsmith
39591116SmsmithACPI_STATUS
39691116SmsmithAcpiUtCopyIobjectToIobject (
39791116Smsmith    ACPI_OPERAND_OBJECT     *SourceDesc,
39891116Smsmith    ACPI_OPERAND_OBJECT     **DestDesc,
39991116Smsmith    ACPI_WALK_STATE         *WalkState);
40091116Smsmith
40191116Smsmith
40267754Smsmith/*
40377424Smsmith * UtCreate - Object creation
40467754Smsmith */
40567754Smsmith
40667754SmsmithACPI_STATUS
40777424SmsmithAcpiUtUpdateObjectReference (
40867754Smsmith    ACPI_OPERAND_OBJECT     *Object,
40967754Smsmith    UINT16                  Action);
41067754Smsmith
41167754Smsmith
41267754Smsmith/*
41377424Smsmith * UtDebug - Debug interfaces
41467754Smsmith */
41567754Smsmith
41683174Smsmithvoid
41783174SmsmithAcpiUtInitStackPtrTrace (
41867754Smsmith    void);
41967754Smsmith
42067754Smsmithvoid
42183174SmsmithAcpiUtTrackStackPtr (
42283174Smsmith    void);
42367754Smsmith
42467754Smsmithvoid
42583174SmsmithAcpiUtTrace (
42667754Smsmith    UINT32                  LineNumber,
42783174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo);
42867754Smsmith
42967754Smsmithvoid
43083174SmsmithAcpiUtTracePtr (
43167754Smsmith    UINT32                  LineNumber,
43283174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
43367754Smsmith    void                    *Pointer);
43467754Smsmith
43567754Smsmithvoid
43683174SmsmithAcpiUtTraceU32 (
43767754Smsmith    UINT32                  LineNumber,
43883174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
43967754Smsmith    UINT32                  Integer);
44067754Smsmith
44167754Smsmithvoid
44283174SmsmithAcpiUtTraceStr (
44367754Smsmith    UINT32                  LineNumber,
44483174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
445114237Snjl    char                    *String);
44667754Smsmith
44767754Smsmithvoid
44883174SmsmithAcpiUtExit (
44967754Smsmith    UINT32                  LineNumber,
45083174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo);
45167754Smsmith
45267754Smsmithvoid
45383174SmsmithAcpiUtStatusExit (
45467754Smsmith    UINT32                  LineNumber,
45583174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
45667754Smsmith    ACPI_STATUS             Status);
45767754Smsmith
45867754Smsmithvoid
45983174SmsmithAcpiUtValueExit (
46067754Smsmith    UINT32                  LineNumber,
46183174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
46271867Smsmith    ACPI_INTEGER            Value);
46367754Smsmith
46467754Smsmithvoid
46583174SmsmithAcpiUtPtrExit (
46667754Smsmith    UINT32                  LineNumber,
46783174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
46867754Smsmith    UINT8                   *Ptr);
46967754Smsmith
47067754Smsmithvoid
47183174SmsmithAcpiUtReportInfo (
472114237Snjl    char                    *ModuleName,
47367754Smsmith    UINT32                  LineNumber,
47467754Smsmith    UINT32                  ComponentId);
47567754Smsmith
47667754Smsmithvoid
47783174SmsmithAcpiUtReportError (
478114237Snjl    char                    *ModuleName,
47967754Smsmith    UINT32                  LineNumber,
48067754Smsmith    UINT32                  ComponentId);
48167754Smsmith
48267754Smsmithvoid
48383174SmsmithAcpiUtReportWarning (
484114237Snjl    char                    *ModuleName,
48567754Smsmith    UINT32                  LineNumber,
48667754Smsmith    UINT32                  ComponentId);
48767754Smsmith
48867754Smsmithvoid
48977424SmsmithAcpiUtDumpBuffer (
49067754Smsmith    UINT8                   *Buffer,
49167754Smsmith    UINT32                  Count,
49267754Smsmith    UINT32                  Display,
49367754Smsmith    UINT32                  componentId);
49467754Smsmith
49592388Smsmithvoid ACPI_INTERNAL_VAR_XFACE
49682367SmsmithAcpiUtDebugPrint (
49782367Smsmith    UINT32                  RequestedDebugLevel,
49882367Smsmith    UINT32                  LineNumber,
49983174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
50082367Smsmith    char                    *Format,
50185756Smsmith    ...) ACPI_PRINTF_LIKE_FUNC;
50267754Smsmith
50392388Smsmithvoid ACPI_INTERNAL_VAR_XFACE
50482367SmsmithAcpiUtDebugPrintRaw (
50582367Smsmith    UINT32                  RequestedDebugLevel,
50682367Smsmith    UINT32                  LineNumber,
50783174Smsmith    ACPI_DEBUG_PRINT_INFO   *DbgInfo,
50882367Smsmith    char                    *Format,
50985756Smsmith    ...) ACPI_PRINTF_LIKE_FUNC;
51082367Smsmith
51183174Smsmith
51267754Smsmith/*
51377424Smsmith * UtDelete - Object deletion
51467754Smsmith */
51567754Smsmith
51667754Smsmithvoid
51777424SmsmithAcpiUtDeleteInternalObj (
51867754Smsmith    ACPI_OPERAND_OBJECT     *Object);
51967754Smsmith
52067754Smsmithvoid
52177424SmsmithAcpiUtDeleteInternalPackageObject (
52267754Smsmith    ACPI_OPERAND_OBJECT     *Object);
52367754Smsmith
52467754Smsmithvoid
52577424SmsmithAcpiUtDeleteInternalSimpleObject (
52667754Smsmith    ACPI_OPERAND_OBJECT     *Object);
52767754Smsmith
52899679Siwasakivoid
52977424SmsmithAcpiUtDeleteInternalObjectList (
53067754Smsmith    ACPI_OPERAND_OBJECT     **ObjList);
53167754Smsmith
53267754Smsmith
53367754Smsmith/*
53477424Smsmith * UtEval - object evaluation
53567754Smsmith */
53667754Smsmith
53767754Smsmith/* Method name strings */
53867754Smsmith
53967754Smsmith#define METHOD_NAME__HID        "_HID"
54087031Smsmith#define METHOD_NAME__CID        "_CID"
54167754Smsmith#define METHOD_NAME__UID        "_UID"
54267754Smsmith#define METHOD_NAME__ADR        "_ADR"
54367754Smsmith#define METHOD_NAME__STA        "_STA"
54467754Smsmith#define METHOD_NAME__REG        "_REG"
54567754Smsmith#define METHOD_NAME__SEG        "_SEG"
54667754Smsmith#define METHOD_NAME__BBN        "_BBN"
54785756Smsmith#define METHOD_NAME__PRT        "_PRT"
548114237Snjl#define METHOD_NAME__CRS        "_CRS"
549114237Snjl#define METHOD_NAME__PRS        "_PRS"
55067754Smsmith
55167754Smsmith
55267754SmsmithACPI_STATUS
553114237SnjlAcpiUtEvaluateObject (
554114237Snjl    ACPI_NAMESPACE_NODE     *PrefixNode,
555114237Snjl    char                    *Path,
556114237Snjl    UINT32                  ExpectedReturnBtypes,
557114237Snjl    ACPI_OPERAND_OBJECT     **ReturnDesc);
558114237Snjl
559114237SnjlACPI_STATUS
56077424SmsmithAcpiUtEvaluateNumericObject (
561114237Snjl    char                    *ObjectName,
56267754Smsmith    ACPI_NAMESPACE_NODE     *DeviceNode,
56367754Smsmith    ACPI_INTEGER            *Address);
56467754Smsmith
56567754SmsmithACPI_STATUS
56677424SmsmithAcpiUtExecute_HID (
56767754Smsmith    ACPI_NAMESPACE_NODE     *DeviceNode,
56877424Smsmith    ACPI_DEVICE_ID          *Hid);
56967754Smsmith
57067754SmsmithACPI_STATUS
57187031SmsmithAcpiUtExecute_CID (
57287031Smsmith    ACPI_NAMESPACE_NODE     *DeviceNode,
573117521Snjl    ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
57487031Smsmith
57587031SmsmithACPI_STATUS
57677424SmsmithAcpiUtExecute_STA (
57767754Smsmith    ACPI_NAMESPACE_NODE     *DeviceNode,
57867754Smsmith    UINT32                  *StatusFlags);
57967754Smsmith
58067754SmsmithACPI_STATUS
58177424SmsmithAcpiUtExecute_UID (
58267754Smsmith    ACPI_NAMESPACE_NODE     *DeviceNode,
58377424Smsmith    ACPI_DEVICE_ID          *Uid);
58467754Smsmith
585126372SnjlACPI_STATUS
586126372SnjlAcpiUtExecute_Sxds (
587126372Snjl    ACPI_NAMESPACE_NODE     *DeviceNode,
588126372Snjl    UINT8                   *Highest);
58967754Smsmith
59067754Smsmith/*
59177424Smsmith * UtMutex - mutual exclusion interfaces
59267754Smsmith */
59367754Smsmith
59467754SmsmithACPI_STATUS
59577424SmsmithAcpiUtMutexInitialize (
59667754Smsmith    void);
59767754Smsmith
59867754Smsmithvoid
59977424SmsmithAcpiUtMutexTerminate (
60067754Smsmith    void);
60167754Smsmith
60267754SmsmithACPI_STATUS
60377424SmsmithAcpiUtCreateMutex (
60467754Smsmith    ACPI_MUTEX_HANDLE       MutexId);
60567754Smsmith
60667754SmsmithACPI_STATUS
60777424SmsmithAcpiUtDeleteMutex (
60867754Smsmith    ACPI_MUTEX_HANDLE       MutexId);
60967754Smsmith
61067754SmsmithACPI_STATUS
61177424SmsmithAcpiUtAcquireMutex (
61267754Smsmith    ACPI_MUTEX_HANDLE       MutexId);
61367754Smsmith
61467754SmsmithACPI_STATUS
61577424SmsmithAcpiUtReleaseMutex (
61667754Smsmith    ACPI_MUTEX_HANDLE       MutexId);
61767754Smsmith
61867754Smsmith
61967754Smsmith/*
62077424Smsmith * UtObject - internal object create/delete/cache routines
62167754Smsmith */
62267754Smsmith
62383174SmsmithACPI_OPERAND_OBJECT  *
62483174SmsmithAcpiUtCreateInternalObjectDbg (
625114237Snjl    char                    *ModuleName,
62683174Smsmith    UINT32                  LineNumber,
62783174Smsmith    UINT32                  ComponentId,
62891116Smsmith    ACPI_OBJECT_TYPE        Type);
62983174Smsmith
63067754Smsmithvoid *
63183174SmsmithAcpiUtAllocateObjectDescDbg (
632114237Snjl    char                    *ModuleName,
63367754Smsmith    UINT32                  LineNumber,
63467754Smsmith    UINT32                  ComponentId);
63567754Smsmith
63683174Smsmith#define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
63783174Smsmith#define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT)
63867754Smsmith
63967754Smsmithvoid
64077424SmsmithAcpiUtDeleteObjectDesc (
64167754Smsmith    ACPI_OPERAND_OBJECT     *Object);
64267754Smsmith
64367754SmsmithBOOLEAN
64477424SmsmithAcpiUtValidInternalObject (
64567754Smsmith    void                    *Object);
64667754Smsmith
647107325SiwasakiACPI_OPERAND_OBJECT *
648107325SiwasakiAcpiUtCreateBufferObject (
649107325Siwasaki    ACPI_SIZE               BufferSize);
65067754Smsmith
651107325Siwasaki
65267754Smsmith/*
65377424Smsmith * UtRefCnt - Object reference count management
65467754Smsmith */
65567754Smsmith
65667754Smsmithvoid
65777424SmsmithAcpiUtAddReference (
65867754Smsmith    ACPI_OPERAND_OBJECT     *Object);
65967754Smsmith
66067754Smsmithvoid
66177424SmsmithAcpiUtRemoveReference (
66267754Smsmith    ACPI_OPERAND_OBJECT     *Object);
66367754Smsmith
66467754Smsmith/*
66577424Smsmith * UtSize - Object size routines
66667754Smsmith */
66767754Smsmith
66867754SmsmithACPI_STATUS
66977424SmsmithAcpiUtGetSimpleObjectSize (
67067754Smsmith    ACPI_OPERAND_OBJECT     *Obj,
67191116Smsmith    ACPI_SIZE               *ObjLength);
67267754Smsmith
67367754SmsmithACPI_STATUS
67477424SmsmithAcpiUtGetPackageObjectSize (
67567754Smsmith    ACPI_OPERAND_OBJECT     *Obj,
67691116Smsmith    ACPI_SIZE               *ObjLength);
67767754Smsmith
67867754SmsmithACPI_STATUS
67977424SmsmithAcpiUtGetObjectSize(
68067754Smsmith    ACPI_OPERAND_OBJECT     *Obj,
68191116Smsmith    ACPI_SIZE               *ObjLength);
68267754Smsmith
68399679SiwasakiACPI_STATUS
68499679SiwasakiAcpiUtGetElementLength (
68599679Siwasaki    UINT8                   ObjectType,
68699679Siwasaki    ACPI_OPERAND_OBJECT     *SourceObject,
68799679Siwasaki    ACPI_GENERIC_STATE      *State,
68899679Siwasaki    void                    *Context);
68967754Smsmith
69099679Siwasaki
69167754Smsmith/*
69277424Smsmith * UtState - Generic state creation/cache routines
69367754Smsmith */
69467754Smsmith
69567754Smsmithvoid
69677424SmsmithAcpiUtPushGenericState (
69767754Smsmith    ACPI_GENERIC_STATE      **ListHead,
69867754Smsmith    ACPI_GENERIC_STATE      *State);
69967754Smsmith
70067754SmsmithACPI_GENERIC_STATE *
70177424SmsmithAcpiUtPopGenericState (
70267754Smsmith    ACPI_GENERIC_STATE      **ListHead);
70367754Smsmith
70467754Smsmith
70567754SmsmithACPI_GENERIC_STATE *
70677424SmsmithAcpiUtCreateGenericState (
70767754Smsmith    void);
70867754Smsmith
70987031SmsmithACPI_THREAD_STATE *
71087031SmsmithAcpiUtCreateThreadState (
71187031Smsmith    void);
71287031Smsmith
71367754SmsmithACPI_GENERIC_STATE *
71477424SmsmithAcpiUtCreateUpdateState (
71567754Smsmith    ACPI_OPERAND_OBJECT     *Object,
71667754Smsmith    UINT16                  Action);
71767754Smsmith
71873561SmsmithACPI_GENERIC_STATE *
71977424SmsmithAcpiUtCreatePkgState (
72073561Smsmith    void                    *InternalObject,
72173561Smsmith    void                    *ExternalObject,
72273561Smsmith    UINT16                  Index);
72373561Smsmith
72467754SmsmithACPI_STATUS
72577424SmsmithAcpiUtCreateUpdateStateAndPush (
72667754Smsmith    ACPI_OPERAND_OBJECT     *Object,
72767754Smsmith    UINT16                  Action,
72867754Smsmith    ACPI_GENERIC_STATE      **StateList);
72967754Smsmith
73073561SmsmithACPI_STATUS
73177424SmsmithAcpiUtCreatePkgStateAndPush (
73273561Smsmith    void                    *InternalObject,
73373561Smsmith    void                    *ExternalObject,
73473561Smsmith    UINT16                  Index,
73573561Smsmith    ACPI_GENERIC_STATE      **StateList);
73673561Smsmith
73767754SmsmithACPI_GENERIC_STATE *
73877424SmsmithAcpiUtCreateControlState (
73967754Smsmith    void);
74067754Smsmith
74167754Smsmithvoid
74277424SmsmithAcpiUtDeleteGenericState (
74367754Smsmith    ACPI_GENERIC_STATE      *State);
74467754Smsmith
74567754Smsmithvoid
74677424SmsmithAcpiUtDeleteGenericStateCache (
74767754Smsmith    void);
74867754Smsmith
74967754Smsmithvoid
75077424SmsmithAcpiUtDeleteObjectCache (
75167754Smsmith    void);
75267754Smsmith
75367754Smsmith/*
75484491Smsmith * utmisc
75567754Smsmith */
75667754Smsmith
757107325Siwasakivoid
758107325SiwasakiAcpiUtPrintString (
759107325Siwasaki    char                    *String,
760107325Siwasaki    UINT8                   MaxLength);
761107325Siwasaki
76284491SmsmithACPI_STATUS
76384491SmsmithAcpiUtDivide (
76484491Smsmith    ACPI_INTEGER            *InDividend,
76584491Smsmith    ACPI_INTEGER            *InDivisor,
76684491Smsmith    ACPI_INTEGER            *OutQuotient,
76784491Smsmith    ACPI_INTEGER            *OutRemainder);
76884491Smsmith
76984491SmsmithACPI_STATUS
77084491SmsmithAcpiUtShortDivide (
77184491Smsmith    ACPI_INTEGER            *InDividend,
77284491Smsmith    UINT32                  Divisor,
77384491Smsmith    ACPI_INTEGER            *OutQuotient,
77484491Smsmith    UINT32                  *OutRemainder);
77584491Smsmith
77667754SmsmithBOOLEAN
77777424SmsmithAcpiUtValidAcpiName (
77867754Smsmith    UINT32                  Name);
77967754Smsmith
78067754SmsmithBOOLEAN
78177424SmsmithAcpiUtValidAcpiCharacter (
782114237Snjl    char                    Character);
78367754Smsmith
78499679SiwasakiACPI_STATUS
78599679SiwasakiAcpiUtStrtoul64 (
786114237Snjl    char                    *String,
78799679Siwasaki    UINT32                  Base,
78899679Siwasaki    ACPI_INTEGER            *RetInteger);
78999679Siwasaki
790114237Snjlchar *
79177424SmsmithAcpiUtStrupr (
792114237Snjl    char                    *SrcString);
79377424Smsmith
79491116SmsmithUINT8 *
79591116SmsmithAcpiUtGetResourceEndTag (
79691116Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc);
79777424Smsmith
79891116SmsmithUINT8
79991116SmsmithAcpiUtGenerateChecksum (
80091116Smsmith    UINT8                   *Buffer,
80191116Smsmith    UINT32                  Length);
80291116Smsmith
80399679SiwasakiUINT32
80499679SiwasakiAcpiUtDwordByteSwap (
80599679Siwasaki    UINT32                  Value);
80699679Siwasaki
80799679Siwasakivoid
80899679SiwasakiAcpiUtSetIntegerWidth (
80999679Siwasaki    UINT8                   Revision);
81099679Siwasaki
811102550Siwasaki#ifdef ACPI_DEBUG_OUTPUT
81273561Smsmithvoid
81377424SmsmithAcpiUtDisplayInitPathname (
814114237Snjl    UINT8                   Type,
815114237Snjl    ACPI_NAMESPACE_NODE     *ObjHandle,
81673561Smsmith    char                    *Path);
81773561Smsmith
81873561Smsmith#endif
81973561Smsmith
82073561Smsmith
82167754Smsmith/*
82282367Smsmith * Utalloc - memory allocation and object caching
82367754Smsmith */
82467754Smsmith
82567754Smsmithvoid *
82682367SmsmithAcpiUtAcquireFromCache (
82782367Smsmith    UINT32                  ListId);
82882367Smsmith
82982367Smsmithvoid
83082367SmsmithAcpiUtReleaseToCache (
83182367Smsmith    UINT32                  ListId,
83282367Smsmith    void                    *Object);
83382367Smsmith
83482367Smsmithvoid
83582367SmsmithAcpiUtDeleteGenericCache (
83682367Smsmith    UINT32                  ListId);
83782367Smsmith
83891116SmsmithACPI_STATUS
83991116SmsmithAcpiUtValidateBuffer (
84091116Smsmith    ACPI_BUFFER             *Buffer);
84182367Smsmith
84291116SmsmithACPI_STATUS
84391116SmsmithAcpiUtInitializeBuffer (
84491116Smsmith    ACPI_BUFFER             *Buffer,
84591116Smsmith    ACPI_SIZE               RequiredLength);
84682367Smsmith
84791116Smsmith
84891116Smsmith/* Memory allocation functions */
84991116Smsmith
85082367Smsmithvoid *
85180062SmsmithAcpiUtAllocate (
85291116Smsmith    ACPI_SIZE               Size,
85367754Smsmith    UINT32                  Component,
854114237Snjl    char                    *Module,
85567754Smsmith    UINT32                  Line);
85667754Smsmith
85767754Smsmithvoid *
85880062SmsmithAcpiUtCallocate (
85991116Smsmith    ACPI_SIZE               Size,
86067754Smsmith    UINT32                  Component,
861114237Snjl    char                    *Module,
86267754Smsmith    UINT32                  Line);
86367754Smsmith
86491116Smsmith
86591116Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
86691116Smsmith
86791116Smsmithvoid *
86891116SmsmithAcpiUtAllocateAndTrack (
86991116Smsmith    ACPI_SIZE               Size,
87091116Smsmith    UINT32                  Component,
871114237Snjl    char                    *Module,
87291116Smsmith    UINT32                  Line);
87391116Smsmith
87491116Smsmithvoid *
87591116SmsmithAcpiUtCallocateAndTrack (
87691116Smsmith    ACPI_SIZE               Size,
87791116Smsmith    UINT32                  Component,
878114237Snjl    char                    *Module,
87991116Smsmith    UINT32                  Line);
88091116Smsmith
88167754Smsmithvoid
88291116SmsmithAcpiUtFreeAndTrack (
88367754Smsmith    void                    *Address,
88467754Smsmith    UINT32                  Component,
885114237Snjl    char                    *Module,
88667754Smsmith    UINT32                  Line);
88799679Siwasaki
88899679SiwasakiACPI_DEBUG_MEM_BLOCK *
88999679SiwasakiAcpiUtFindAllocation (
89099679Siwasaki    UINT32                  ListId,
89199679Siwasaki    void                    *Allocation);
89299679Siwasaki
89391116SmsmithACPI_STATUS
89491116SmsmithAcpiUtTrackAllocation (
89591116Smsmith    UINT32                  ListId,
89691116Smsmith    ACPI_DEBUG_MEM_BLOCK    *Address,
89791116Smsmith    ACPI_SIZE               Size,
89891116Smsmith    UINT8                   AllocType,
89991116Smsmith    UINT32                  Component,
900114237Snjl    char                    *Module,
90191116Smsmith    UINT32                  Line);
90267754Smsmith
90391116SmsmithACPI_STATUS
90491116SmsmithAcpiUtRemoveAllocation (
90591116Smsmith    UINT32                  ListId,
90691116Smsmith    ACPI_DEBUG_MEM_BLOCK    *Address,
90791116Smsmith    UINT32                  Component,
908114237Snjl    char                    *Module,
90991116Smsmith    UINT32                  Line);
91091116Smsmith
91167754Smsmithvoid
91277424SmsmithAcpiUtDumpAllocationInfo (
91367754Smsmith    void);
91467754Smsmith
91567754Smsmithvoid
91684491SmsmithAcpiUtDumpAllocations (
91767754Smsmith    UINT32                  Component,
918114237Snjl    char                    *Module);
91967754Smsmith#endif
92067754Smsmith
92167754Smsmith
92277424Smsmith#endif /* _ACUTILS_H */
923