167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Name: aclocal.h - Internal data types used across the ACPI subsystem
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7217365Sjkim/*
8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp.
970243Smsmith * All rights reserved.
1067754Smsmith *
11217365Sjkim * Redistribution and use in source and binary forms, with or without
12217365Sjkim * modification, are permitted provided that the following conditions
13217365Sjkim * are met:
14217365Sjkim * 1. Redistributions of source code must retain the above copyright
15217365Sjkim *    notice, this list of conditions, and the following disclaimer,
16217365Sjkim *    without modification.
17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20217365Sjkim *    including a substantially similar Disclaimer requirement for further
21217365Sjkim *    binary redistribution.
22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23217365Sjkim *    of any contributors may be used to endorse or promote products derived
24217365Sjkim *    from this software without specific prior written permission.
2567754Smsmith *
26217365Sjkim * Alternatively, this software may be distributed under the terms of the
27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28217365Sjkim * Software Foundation.
2967754Smsmith *
30217365Sjkim * NO WARRANTY
31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
42217365Sjkim */
4367754Smsmith
4467754Smsmith#ifndef __ACLOCAL_H__
4567754Smsmith#define __ACLOCAL_H__
4667754Smsmith
47193267Sjkim
48167802Sjkim/* acpisrc:StructDefs -- for acpisrc conversion */
4967754Smsmith
50167802Sjkim#define ACPI_SERIALIZED                 0xFF
5167754Smsmith
5277424Smsmithtypedef UINT32                          ACPI_MUTEX_HANDLE;
53167802Sjkim#define ACPI_GLOBAL_LOCK                (ACPI_SEMAPHORE) (-1)
5467754Smsmith
5599679Siwasaki/* Total number of aml opcodes defined */
5667754Smsmith
57281687Sjkim#define AML_NUM_OPCODES                 0x82
5867754Smsmith
5967754Smsmith
60151937Sjkim/* Forward declarations */
61151937Sjkim
62151937Sjkimstruct acpi_walk_state;
63151937Sjkimstruct acpi_obj_mutex;
64151937Sjkimunion acpi_parse_object;
65151937Sjkim
66151937Sjkim
6767754Smsmith/*****************************************************************************
6867754Smsmith *
6967754Smsmith * Mutex typedefs and structs
7067754Smsmith *
7167754Smsmith ****************************************************************************/
7267754Smsmith
7367754Smsmith
7467754Smsmith/*
7567754Smsmith * Predefined handles for the mutex objects used within the subsystem
7677424Smsmith * All mutex objects are automatically created by AcpiUtMutexInitialize.
7777424Smsmith *
78167802Sjkim * The acquire/release ordering protocol is implied via this list. Mutexes
7977424Smsmith * with a lower value must be acquired before mutexes with a higher value.
8077424Smsmith *
81167802Sjkim * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
82167802Sjkim * table below also!
8367754Smsmith */
84167802Sjkim#define ACPI_MTX_INTERPRETER            0   /* AML Interpreter, main lock */
85167802Sjkim#define ACPI_MTX_NAMESPACE              1   /* ACPI Namespace */
86167802Sjkim#define ACPI_MTX_TABLES                 2   /* Data for ACPI tables */
87167802Sjkim#define ACPI_MTX_EVENTS                 3   /* Data for ACPI events */
88167802Sjkim#define ACPI_MTX_CACHES                 4   /* Internal caches, general purposes */
89167802Sjkim#define ACPI_MTX_MEMORY                 5   /* Debug memory tracking lists */
9067754Smsmith
91306536Sjkim#define ACPI_MAX_MUTEX                  5
92306536Sjkim#define ACPI_NUM_MUTEX                  (ACPI_MAX_MUTEX+1)
9367754Smsmith
9467754Smsmith
95193267Sjkim/* Lock structure for reader/writer interfaces */
9667754Smsmith
97193267Sjkimtypedef struct acpi_rw_lock
98193267Sjkim{
99193267Sjkim    ACPI_MUTEX              WriterMutex;
100193267Sjkim    ACPI_MUTEX              ReaderMutex;
101193267Sjkim    UINT32                  NumReaders;
102193267Sjkim
103193267Sjkim} ACPI_RW_LOCK;
104193267Sjkim
105193267Sjkim
106167802Sjkim/*
107167802Sjkim * Predefined handles for spinlocks used within the subsystem.
108167802Sjkim * These spinlocks are created by AcpiUtMutexInitialize
109167802Sjkim */
110167802Sjkim#define ACPI_LOCK_GPES                  0
111167802Sjkim#define ACPI_LOCK_HARDWARE              1
112167802Sjkim
113167802Sjkim#define ACPI_MAX_LOCK                   1
114306536Sjkim#define ACPI_NUM_LOCK                   (ACPI_MAX_LOCK+1)
115167802Sjkim
116167802Sjkim
117151937Sjkim/* This Thread ID means that the mutex is not in use (unlocked) */
118151937Sjkim
119306536Sjkim#define ACPI_MUTEX_NOT_ACQUIRED         ((ACPI_THREAD_ID) -1)
120151937Sjkim
121306536Sjkim/* This Thread ID means an invalid thread ID */
122306536Sjkim
123306536Sjkim#ifdef ACPI_OS_INVALID_THREAD_ID
124306536Sjkim#define ACPI_INVALID_THREAD_ID          ACPI_OS_INVALID_THREAD_ID
125306536Sjkim#else
126306536Sjkim#define ACPI_INVALID_THREAD_ID          ((ACPI_THREAD_ID) 0xFFFFFFFF)
127306536Sjkim#endif
128306536Sjkim
12967754Smsmith/* Table for the global mutexes */
13067754Smsmith
131114237Snjltypedef struct acpi_mutex_info
13267754Smsmith{
133167802Sjkim    ACPI_MUTEX                      Mutex;
134167802Sjkim    UINT32                          UseCount;
135167802Sjkim    ACPI_THREAD_ID                  ThreadId;
13667754Smsmith
13767754Smsmith} ACPI_MUTEX_INFO;
13867754Smsmith
13967754Smsmith
14067754Smsmith/* Lock flag parameter for various interfaces */
14167754Smsmith
14277424Smsmith#define ACPI_MTX_DO_NOT_LOCK            0
14377424Smsmith#define ACPI_MTX_LOCK                   1
14467754Smsmith
14567754Smsmith
14677424Smsmith/* Field access granularities */
14777424Smsmith
14877424Smsmith#define ACPI_FIELD_BYTE_GRANULARITY     1
14977424Smsmith#define ACPI_FIELD_WORD_GRANULARITY     2
15077424Smsmith#define ACPI_FIELD_DWORD_GRANULARITY    4
15177424Smsmith#define ACPI_FIELD_QWORD_GRANULARITY    8
15277424Smsmith
153151937Sjkim
154167802Sjkim#define ACPI_ENTRY_NOT_FOUND            NULL
155167802Sjkim
156167802Sjkim
15767754Smsmith/*****************************************************************************
15867754Smsmith *
15967754Smsmith * Namespace typedefs and structs
16067754Smsmith *
16167754Smsmith ****************************************************************************/
16267754Smsmith
16367754Smsmith/* Operational modes of the AML interpreter/scanner */
16467754Smsmith
16567754Smsmithtypedef enum
16667754Smsmith{
167167802Sjkim    ACPI_IMODE_LOAD_PASS1           = 0x01,
168167802Sjkim    ACPI_IMODE_LOAD_PASS2           = 0x02,
169167802Sjkim    ACPI_IMODE_EXECUTE              = 0x03
17067754Smsmith
17191116Smsmith} ACPI_INTERPRETER_MODE;
17267754Smsmith
173114237Snjl
174167802Sjkim/*
175167802Sjkim * The Namespace Node describes a named object that appears in the AML.
176167802Sjkim * DescriptorType is used to differentiate between internal descriptors.
177167802Sjkim *
178167802Sjkim * The node is optimized for both 32-bit and 64-bit platforms:
179167802Sjkim * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
180167802Sjkim *
181167802Sjkim * Note: The DescriptorType and Type fields must appear in the identical
182167802Sjkim * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
183167802Sjkim * structures.
184167802Sjkim */
185114237Snjltypedef struct acpi_namespace_node
18667754Smsmith{
187167802Sjkim    union acpi_operand_object       *Object;        /* Interpreter object */
188167802Sjkim    UINT8                           DescriptorType; /* Differentiate object descriptor types */
189167802Sjkim    UINT8                           Type;           /* ACPI Type associated with this name */
190167802Sjkim    UINT8                           Flags;          /* Miscellaneous flags */
191167802Sjkim    ACPI_OWNER_ID                   OwnerId;        /* Node creator */
192167802Sjkim    ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
193209746Sjkim    struct acpi_namespace_node      *Parent;        /* Parent node */
194167802Sjkim    struct acpi_namespace_node      *Child;         /* First child */
195209746Sjkim    struct acpi_namespace_node      *Peer;          /* First peer */
19667754Smsmith
197167802Sjkim    /*
198167802Sjkim     * The following fields are used by the ASL compiler and disassembler only
199167802Sjkim     */
200167802Sjkim#ifdef ACPI_LARGE_NAMESPACE_NODE
201167802Sjkim    union acpi_parse_object         *Op;
202306536Sjkim    void                            *MethodLocals;
203306536Sjkim    void                            *MethodArgs;
204167802Sjkim    UINT32                          Value;
205167802Sjkim    UINT32                          Length;
206306536Sjkim    UINT8                           ArgCount;
207306536Sjkim
208151937Sjkim#endif
209151937Sjkim
21067754Smsmith} ACPI_NAMESPACE_NODE;
21167754Smsmith
21267754Smsmith
213167802Sjkim/* Namespace Node flags */
21467754Smsmith
215209746Sjkim#define ANOBJ_RESERVED                  0x01    /* Available for use */
216167802Sjkim#define ANOBJ_TEMPORARY                 0x02    /* Node is create by a method and is temporary */
217167802Sjkim#define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
218167802Sjkim#define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
219167802Sjkim#define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
220193267Sjkim#define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
221193267Sjkim#define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
22267754Smsmith
223167802Sjkim#define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
224167802Sjkim#define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
225167802Sjkim#define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
226167802Sjkim#define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
22767754Smsmith
22867754Smsmith
229207344Sjkim/* Internal ACPI table management - master table list */
230167802Sjkim
231207344Sjkimtypedef struct acpi_table_list
232117521Snjl{
233207344Sjkim    ACPI_TABLE_DESC                 *Tables;            /* Table descriptor array */
234207344Sjkim    UINT32                          CurrentTableCount;  /* Tables currently in the array */
235207344Sjkim    UINT32                          MaxTableCount;      /* Max tables array will hold */
236167802Sjkim    UINT8                           Flags;
23767754Smsmith
238207344Sjkim} ACPI_TABLE_LIST;
239117521Snjl
240167802Sjkim/* Flags for above */
241117521Snjl
242167802Sjkim#define ACPI_ROOT_ORIGIN_UNKNOWN        (0)     /* ~ORIGIN_ALLOCATED */
243167802Sjkim#define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
244167802Sjkim#define ACPI_ROOT_ALLOW_RESIZE          (2)
245167802Sjkim
246167802Sjkim
247306536Sjkim/* List to manage incoming ACPI tables */
248167802Sjkim
249306536Sjkimtypedef struct acpi_new_table_desc
250306536Sjkim{
251306536Sjkim    ACPI_TABLE_HEADER               *Table;
252306536Sjkim    struct acpi_new_table_desc      *Next;
253167802Sjkim
254306536Sjkim} ACPI_NEW_TABLE_DESC;
255167802Sjkim
256306536Sjkim
257306536Sjkim/* Predefined table indexes */
258306536Sjkim
259306536Sjkim#define ACPI_INVALID_TABLE_INDEX        (0xFFFFFFFF)
260306536Sjkim
261306536Sjkim
262114237Snjltypedef struct acpi_find_context
26367754Smsmith{
264167802Sjkim    char                            *SearchFor;
265167802Sjkim    ACPI_HANDLE                     *List;
266167802Sjkim    UINT32                          *Count;
26767754Smsmith
26891116Smsmith} ACPI_FIND_CONTEXT;
26967754Smsmith
27067754Smsmith
271114237Snjltypedef struct acpi_ns_search_data
27267754Smsmith{
273167802Sjkim    ACPI_NAMESPACE_NODE             *Node;
274114237Snjl
27591116Smsmith} ACPI_NS_SEARCH_DATA;
27667754Smsmith
27767754Smsmith
27877424Smsmith/* Object types used during package copies */
27977424Smsmith
28077424Smsmith#define ACPI_COPY_TYPE_SIMPLE           0
28177424Smsmith#define ACPI_COPY_TYPE_PACKAGE          1
28277424Smsmith
283167802Sjkim
28477424Smsmith/* Info structure used to convert external<->internal namestrings */
28577424Smsmith
28677424Smsmithtypedef struct acpi_namestring_info
28777424Smsmith{
288193267Sjkim    const char                      *ExternalName;
289193267Sjkim    const char                      *NextExternalChar;
290167802Sjkim    char                            *InternalName;
291167802Sjkim    UINT32                          Length;
292167802Sjkim    UINT32                          NumSegments;
293167802Sjkim    UINT32                          NumCarats;
294167802Sjkim    BOOLEAN                         FullyQualified;
29577424Smsmith
29677424Smsmith} ACPI_NAMESTRING_INFO;
29777424Smsmith
29877424Smsmith
29985756Smsmith/* Field creation info */
30085756Smsmith
301114237Snjltypedef struct acpi_create_field_info
30285756Smsmith{
303167802Sjkim    ACPI_NAMESPACE_NODE             *RegionNode;
304167802Sjkim    ACPI_NAMESPACE_NODE             *FieldNode;
305167802Sjkim    ACPI_NAMESPACE_NODE             *RegisterNode;
306167802Sjkim    ACPI_NAMESPACE_NODE             *DataRegisterNode;
307228110Sjkim    ACPI_NAMESPACE_NODE             *ConnectionNode;
308228110Sjkim    UINT8                           *ResourceBuffer;
309167802Sjkim    UINT32                          BankValue;
310167802Sjkim    UINT32                          FieldBitPosition;
311167802Sjkim    UINT32                          FieldBitLength;
312228110Sjkim    UINT16                          ResourceLength;
313281075Sdim    UINT16                          PinNumberIndex;
314167802Sjkim    UINT8                           FieldFlags;
315167802Sjkim    UINT8                           Attribute;
316167802Sjkim    UINT8                           FieldType;
317228110Sjkim    UINT8                           AccessLength;
31885756Smsmith
31985756Smsmith} ACPI_CREATE_FIELD_INFO;
32085756Smsmith
32185756Smsmith
322167802Sjkimtypedef
323167802SjkimACPI_STATUS (*ACPI_INTERNAL_METHOD) (
324167802Sjkim    struct acpi_walk_state          *WalkState);
325167802Sjkim
326167802Sjkim
327167802Sjkim/*
328241973Sjkim * Bitmapped ACPI types. Used internally only
329167802Sjkim */
330167802Sjkim#define ACPI_BTYPE_ANY                  0x00000000
331167802Sjkim#define ACPI_BTYPE_INTEGER              0x00000001
332167802Sjkim#define ACPI_BTYPE_STRING               0x00000002
333167802Sjkim#define ACPI_BTYPE_BUFFER               0x00000004
334167802Sjkim#define ACPI_BTYPE_PACKAGE              0x00000008
335167802Sjkim#define ACPI_BTYPE_FIELD_UNIT           0x00000010
336167802Sjkim#define ACPI_BTYPE_DEVICE               0x00000020
337167802Sjkim#define ACPI_BTYPE_EVENT                0x00000040
338167802Sjkim#define ACPI_BTYPE_METHOD               0x00000080
339167802Sjkim#define ACPI_BTYPE_MUTEX                0x00000100
340167802Sjkim#define ACPI_BTYPE_REGION               0x00000200
341167802Sjkim#define ACPI_BTYPE_POWER                0x00000400
342167802Sjkim#define ACPI_BTYPE_PROCESSOR            0x00000800
343167802Sjkim#define ACPI_BTYPE_THERMAL              0x00001000
344167802Sjkim#define ACPI_BTYPE_BUFFER_FIELD         0x00002000
345167802Sjkim#define ACPI_BTYPE_DDB_HANDLE           0x00004000
346167802Sjkim#define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
347306536Sjkim#define ACPI_BTYPE_REFERENCE_OBJECT     0x00010000 /* From Index(), RefOf(), etc (Type6Opcodes) */
348167802Sjkim#define ACPI_BTYPE_RESOURCE             0x00020000
349306536Sjkim#define ACPI_BTYPE_NAMED_REFERENCE      0x00040000 /* Generic unresolved Name or Namepath */
350167802Sjkim
351167802Sjkim#define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
352167802Sjkim
353167802Sjkim#define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
354306536Sjkim
355306536Sjkim    /* Used by Copy, DeRefOf, Store, Printf, Fprintf */
356306536Sjkim
357306536Sjkim#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)
358167802Sjkim#define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
359167802Sjkim#define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
360167802Sjkim#define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
361167802Sjkim
362249112Sjkim#pragma pack(1)
363167802Sjkim
364193267Sjkim/*
365193267Sjkim * Information structure for ACPI predefined names.
366193267Sjkim * Each entry in the table contains the following items:
367193267Sjkim *
368193267Sjkim * Name                 - The ACPI reserved name
369193267Sjkim * ParamCount           - Number of arguments to the method
370193267Sjkim * ExpectedReturnBtypes - Allowed type(s) for the return value
371193267Sjkim */
372193267Sjkimtypedef struct acpi_name_info
373193267Sjkim{
374193267Sjkim    char                        Name[ACPI_NAME_SIZE];
375249112Sjkim    UINT16                      ArgumentList;
376193267Sjkim    UINT8                       ExpectedBtypes;
377193267Sjkim
378193267Sjkim} ACPI_NAME_INFO;
379193267Sjkim
380193267Sjkim/*
381193267Sjkim * Secondary information structures for ACPI predefined objects that return
382193267Sjkim * package objects. This structure appears as the next entry in the table
383193267Sjkim * after the NAME_INFO structure above.
384193267Sjkim *
385193267Sjkim * The reason for this is to minimize the size of the predefined name table.
386193267Sjkim */
387193267Sjkim
388193267Sjkim/*
389193267Sjkim * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
390228110Sjkim * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
391228110Sjkim * ACPI_PTYPE2_FIX_VAR
392193267Sjkim */
393193267Sjkimtypedef struct acpi_package_info
394193267Sjkim{
395193267Sjkim    UINT8                       Type;
396193267Sjkim    UINT8                       ObjectType1;
397193267Sjkim    UINT8                       Count1;
398193267Sjkim    UINT8                       ObjectType2;
399193267Sjkim    UINT8                       Count2;
400249112Sjkim    UINT16                      Reserved;
401193267Sjkim
402193267Sjkim} ACPI_PACKAGE_INFO;
403193267Sjkim
404193267Sjkim/* Used for ACPI_PTYPE2_FIXED */
405193267Sjkim
406193267Sjkimtypedef struct acpi_package_info2
407193267Sjkim{
408193267Sjkim    UINT8                       Type;
409193267Sjkim    UINT8                       Count;
410193267Sjkim    UINT8                       ObjectType[4];
411249112Sjkim    UINT8                       Reserved;
412193267Sjkim
413193267Sjkim} ACPI_PACKAGE_INFO2;
414193267Sjkim
415193267Sjkim/* Used for ACPI_PTYPE1_OPTION */
416193267Sjkim
417193267Sjkimtypedef struct acpi_package_info3
418193267Sjkim{
419193267Sjkim    UINT8                       Type;
420193267Sjkim    UINT8                       Count;
421193267Sjkim    UINT8                       ObjectType[2];
422193267Sjkim    UINT8                       TailObjectType;
423249112Sjkim    UINT16                      Reserved;
424193267Sjkim
425193267Sjkim} ACPI_PACKAGE_INFO3;
426193267Sjkim
427284460Sjkimtypedef struct acpi_package_info4
428284460Sjkim{
429284460Sjkim    UINT8                       Type;
430284460Sjkim    UINT8                       ObjectType1;
431284460Sjkim    UINT8                       Count1;
432284460Sjkim    UINT8                       SubObjectTypes;
433284460Sjkim    UINT8                       PkgCount;
434284460Sjkim    UINT16                      Reserved;
435284460Sjkim
436284460Sjkim} ACPI_PACKAGE_INFO4;
437284460Sjkim
438193267Sjkimtypedef union acpi_predefined_info
439193267Sjkim{
440193267Sjkim    ACPI_NAME_INFO              Info;
441193267Sjkim    ACPI_PACKAGE_INFO           RetInfo;
442193267Sjkim    ACPI_PACKAGE_INFO2          RetInfo2;
443193267Sjkim    ACPI_PACKAGE_INFO3          RetInfo3;
444284460Sjkim    ACPI_PACKAGE_INFO4          RetInfo4;
445193267Sjkim
446193267Sjkim} ACPI_PREDEFINED_INFO;
447193267Sjkim
448249112Sjkim/* Reset to default packing */
449197104Sjkim
450249112Sjkim#pragma pack()
451249112Sjkim
452249112Sjkim
453246849Sjkim/* Return object auto-repair info */
454246849Sjkim
455246849Sjkimtypedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (
456306536Sjkim    struct acpi_namespace_node  *Scope,
457246849Sjkim    union acpi_operand_object   *OriginalObject,
458246849Sjkim    union acpi_operand_object   **ConvertedObject);
459246849Sjkim
460246849Sjkimtypedef struct acpi_simple_repair_info
461246849Sjkim{
462246849Sjkim    char                        Name[ACPI_NAME_SIZE];
463246849Sjkim    UINT32                      UnexpectedBtypes;
464246849Sjkim    UINT32                      PackageIndex;
465246849Sjkim    ACPI_OBJECT_CONVERTER       ObjectConverter;
466246849Sjkim
467246849Sjkim} ACPI_SIMPLE_REPAIR_INFO;
468246849Sjkim
469246849Sjkim
470193267Sjkim/*
471193267Sjkim * Bitmapped return value types
472193267Sjkim * Note: the actual data types must be contiguous, a loop in nspredef.c
473193267Sjkim * depends on this.
474193267Sjkim */
475193267Sjkim#define ACPI_RTYPE_ANY                  0x00
476193267Sjkim#define ACPI_RTYPE_NONE                 0x01
477193267Sjkim#define ACPI_RTYPE_INTEGER              0x02
478193267Sjkim#define ACPI_RTYPE_STRING               0x04
479193267Sjkim#define ACPI_RTYPE_BUFFER               0x08
480193267Sjkim#define ACPI_RTYPE_PACKAGE              0x10
481193267Sjkim#define ACPI_RTYPE_REFERENCE            0x20
482193267Sjkim#define ACPI_RTYPE_ALL                  0x3F
483193267Sjkim
484193267Sjkim#define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
485193267Sjkim
486193267Sjkim
487306536Sjkim/* Info for running the _REG methods */
488306536Sjkim
489306536Sjkimtypedef struct acpi_reg_walk_info
490306536Sjkim{
491306536Sjkim    ACPI_ADR_SPACE_TYPE     SpaceId;
492306536Sjkim    UINT32                  Function;
493306536Sjkim    UINT32                  RegRunCount;
494306536Sjkim
495306536Sjkim} ACPI_REG_WALK_INFO;
496306536Sjkim
497306536Sjkim
49867754Smsmith/*****************************************************************************
49967754Smsmith *
50067754Smsmith * Event typedefs and structs
50167754Smsmith *
50267754Smsmith ****************************************************************************/
50367754Smsmith
504254745Sjkim/* Dispatch info for each host-installed SCI handler */
505254745Sjkim
506254745Sjkimtypedef struct acpi_sci_handler_info
507254745Sjkim{
508254745Sjkim    struct acpi_sci_handler_info    *Next;
509254745Sjkim    ACPI_SCI_HANDLER                Address;        /* Address of handler */
510254745Sjkim    void                            *Context;       /* Context to be passed to handler */
511254745Sjkim
512254745Sjkim} ACPI_SCI_HANDLER_INFO;
513254745Sjkim
514129684Snjl/* Dispatch info for each GPE -- either a method or handler, cannot be both */
51567754Smsmith
516216471Sjkimtypedef struct acpi_gpe_handler_info
517129684Snjl{
518216471Sjkim    ACPI_GPE_HANDLER                Address;        /* Address of handler, if any */
519129684Snjl    void                            *Context;       /* Context to be passed to handler */
520129684Snjl    ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
521216471Sjkim    UINT8                           OriginalFlags;  /* Original (pre-handler) GPE info */
522216471Sjkim    BOOLEAN                         OriginallyEnabled; /* True if GPE was originally enabled */
523129684Snjl
524216471Sjkim} ACPI_GPE_HANDLER_INFO;
525129684Snjl
526237412Sjkim/* Notify info for implicit notify, multiple device objects */
527237412Sjkim
528237412Sjkimtypedef struct acpi_gpe_notify_info
529237412Sjkim{
530237412Sjkim    ACPI_NAMESPACE_NODE             *DeviceNode;    /* Device to be notified */
531237412Sjkim    struct acpi_gpe_notify_info     *Next;
532237412Sjkim
533237412Sjkim} ACPI_GPE_NOTIFY_INFO;
534237412Sjkim
535216471Sjkim/*
536216471Sjkim * GPE dispatch info. At any time, the GPE can have at most one type
537216471Sjkim * of dispatch - Method, Handler, or Implicit Notify.
538216471Sjkim */
539129684Snjltypedef union acpi_gpe_dispatch_info
540129684Snjl{
541129684Snjl    ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
542237412Sjkim    ACPI_GPE_HANDLER_INFO           *Handler;       /* Installed GPE handler */
543237412Sjkim    ACPI_GPE_NOTIFY_INFO            *NotifyList;    /* List of _PRW devices for implicit notifies */
544129684Snjl
545129684Snjl} ACPI_GPE_DISPATCH_INFO;
546129684Snjl
547129684Snjl/*
548129684Snjl * Information about a GPE, one per each GPE in an array.
549129684Snjl * NOTE: Important to keep this struct as small as possible.
550129684Snjl */
551114237Snjltypedef struct acpi_gpe_event_info
55291116Smsmith{
553237412Sjkim    union acpi_gpe_dispatch_info    Dispatch;       /* Either Method, Handler, or NotifyList */
554117521Snjl    struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
555129684Snjl    UINT8                           Flags;          /* Misc info about this GPE */
556167802Sjkim    UINT8                           GpeNumber;      /* This GPE */
557206117Sjkim    UINT8                           RuntimeCount;   /* References to a run GPE */
55867754Smsmith
559114237Snjl} ACPI_GPE_EVENT_INFO;
56067754Smsmith
561117521Snjl/* Information about a GPE register pair, one per each status/enable pair in an array */
56267754Smsmith
563114237Snjltypedef struct acpi_gpe_register_info
56467754Smsmith{
565114237Snjl    ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
566114237Snjl    ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
567281075Sdim    UINT16                          BaseGpeNumber;  /* Base GPE number for this register */
568129684Snjl    UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
569129684Snjl    UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
570281075Sdim    UINT8                           EnableMask;     /* Current mask of enabled GPEs */
57167754Smsmith
57291116Smsmith} ACPI_GPE_REGISTER_INFO;
57367754Smsmith
574117521Snjl/*
575117521Snjl * Information about a GPE register block, one per each installed block --
576117521Snjl * GPE0, GPE1, and one per each installed GPE Block Device.
577117521Snjl */
578114237Snjltypedef struct acpi_gpe_block_info
57967754Smsmith{
580129684Snjl    ACPI_NAMESPACE_NODE             *Node;
581114237Snjl    struct acpi_gpe_block_info      *Previous;
582114237Snjl    struct acpi_gpe_block_info      *Next;
583117521Snjl    struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
584117521Snjl    ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
585117521Snjl    ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
586281075Sdim    UINT64                          Address;        /* Base address of the block */
587117521Snjl    UINT32                          RegisterCount;  /* Number of register pairs in block */
588206117Sjkim    UINT16                          GpeCount;       /* Number of individual GPEs in block */
589281075Sdim    UINT16                          BlockBaseNumber;/* Base GPE number for this block */
590281075Sdim    UINT8                           SpaceId;
591216471Sjkim    BOOLEAN                         Initialized;    /* TRUE if this block is initialized */
59267754Smsmith
593114237Snjl} ACPI_GPE_BLOCK_INFO;
59467754Smsmith
595117521Snjl/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
59667754Smsmith
597117521Snjltypedef struct acpi_gpe_xrupt_info
598117521Snjl{
599117521Snjl    struct acpi_gpe_xrupt_info      *Previous;
600117521Snjl    struct acpi_gpe_xrupt_info      *Next;
601117521Snjl    ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
602151937Sjkim    UINT32                          InterruptNumber;    /* System interrupt number */
603117521Snjl
604117521Snjl} ACPI_GPE_XRUPT_INFO;
605117521Snjl
606128212Snjltypedef struct acpi_gpe_walk_info
607128212Snjl{
608128212Snjl    ACPI_NAMESPACE_NODE             *GpeDevice;
609128212Snjl    ACPI_GPE_BLOCK_INFO             *GpeBlock;
610207344Sjkim    UINT16                          Count;
611207344Sjkim    ACPI_OWNER_ID                   OwnerId;
612207344Sjkim    BOOLEAN                         ExecuteByOwnerId;
613128212Snjl
614128212Snjl} ACPI_GPE_WALK_INFO;
615128212Snjl
616193267Sjkimtypedef struct acpi_gpe_device_info
617193267Sjkim{
618193267Sjkim    UINT32                          Index;
619193267Sjkim    UINT32                          NextBlockBaseIndex;
620193267Sjkim    ACPI_STATUS                     Status;
621193267Sjkim    ACPI_NAMESPACE_NODE             *GpeDevice;
622128212Snjl
623193267Sjkim} ACPI_GPE_DEVICE_INFO;
624193267Sjkim
625117521Snjltypedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
626167802Sjkim    ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
627193267Sjkim    ACPI_GPE_BLOCK_INFO             *GpeBlock,
628193267Sjkim    void                            *Context);
629117521Snjl
630117521Snjl
63167754Smsmith/* Information about each particular fixed event */
63267754Smsmith
633114237Snjltypedef struct acpi_fixed_event_handler
63467754Smsmith{
635167802Sjkim    ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
636167802Sjkim    void                            *Context;       /* Context to be passed to handler */
63767754Smsmith
63891116Smsmith} ACPI_FIXED_EVENT_HANDLER;
63991116Smsmith
640114237Snjltypedef struct acpi_fixed_event_info
64191116Smsmith{
642167802Sjkim    UINT8                           StatusRegisterId;
643167802Sjkim    UINT8                           EnableRegisterId;
644167802Sjkim    UINT16                          StatusBitMask;
645167802Sjkim    UINT16                          EnableBitMask;
64691116Smsmith
64767754Smsmith} ACPI_FIXED_EVENT_INFO;
64867754Smsmith
64967754Smsmith/* Information used during field processing */
65067754Smsmith
651114237Snjltypedef struct acpi_field_info
65267754Smsmith{
653167802Sjkim    UINT8                           SkipField;
654167802Sjkim    UINT8                           FieldFlag;
655167802Sjkim    UINT32                          PkgLength;
65667754Smsmith
65767754Smsmith} ACPI_FIELD_INFO;
65867754Smsmith
65967754Smsmith
66067754Smsmith/*****************************************************************************
66167754Smsmith *
66267754Smsmith * Generic "state" object for stacks
66367754Smsmith *
66467754Smsmith ****************************************************************************/
66567754Smsmith
66691116Smsmith#define ACPI_CONTROL_NORMAL                  0xC0
66791116Smsmith#define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
66891116Smsmith#define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
66991116Smsmith#define ACPI_CONTROL_PREDICATE_FALSE         0xC3
67091116Smsmith#define ACPI_CONTROL_PREDICATE_TRUE          0xC4
67167754Smsmith
67267754Smsmith
673167802Sjkim#define ACPI_STATE_COMMON \
674167802Sjkim    void                            *Next; \
675167802Sjkim    UINT8                           DescriptorType; /* To differentiate various internal objs */\
676167802Sjkim    UINT8                           Flags; \
677167802Sjkim    UINT16                          Value; \
678167802Sjkim    UINT16                          State;
67967754Smsmith
680167802Sjkim    /* There are 2 bytes available here until the next natural alignment boundary */
681167802Sjkim
68267754Smsmithtypedef struct acpi_common_state
68367754Smsmith{
68467754Smsmith    ACPI_STATE_COMMON
68567754Smsmith} ACPI_COMMON_STATE;
68667754Smsmith
68767754Smsmith
68867754Smsmith/*
68967754Smsmith * Update state - used to traverse complex objects such as packages
69067754Smsmith */
69167754Smsmithtypedef struct acpi_update_state
69267754Smsmith{
69367754Smsmith    ACPI_STATE_COMMON
694167802Sjkim    union acpi_operand_object       *Object;
69567754Smsmith
69667754Smsmith} ACPI_UPDATE_STATE;
69767754Smsmith
69873561Smsmith
69967754Smsmith/*
70073561Smsmith * Pkg state - used to traverse nested package structures
70173561Smsmith */
70273561Smsmithtypedef struct acpi_pkg_state
70373561Smsmith{
70473561Smsmith    ACPI_STATE_COMMON
705167802Sjkim    UINT16                          Index;
706167802Sjkim    union acpi_operand_object       *SourceObject;
707167802Sjkim    union acpi_operand_object       *DestObject;
708167802Sjkim    struct acpi_walk_state          *WalkState;
709167802Sjkim    void                            *ThisTargetObj;
710167802Sjkim    UINT32                          NumPackages;
71173561Smsmith
71273561Smsmith} ACPI_PKG_STATE;
71373561Smsmith
71473561Smsmith
71573561Smsmith/*
71667754Smsmith * Control state - one per if/else and while constructs.
71767754Smsmith * Allows nesting of these constructs
71867754Smsmith */
71967754Smsmithtypedef struct acpi_control_state
72067754Smsmith{
72167754Smsmith    ACPI_STATE_COMMON
722167802Sjkim    UINT16                          Opcode;
723167802Sjkim    union acpi_parse_object         *PredicateOp;
724167802Sjkim    UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
725167802Sjkim    UINT8                           *PackageEnd;            /* End of if/while block */
726193267Sjkim    UINT32                          LoopCount;              /* While() loop counter */
72767754Smsmith
72867754Smsmith} ACPI_CONTROL_STATE;
72967754Smsmith
73067754Smsmith
73167754Smsmith/*
73267754Smsmith * Scope state - current scope during namespace lookups
73367754Smsmith */
73467754Smsmithtypedef struct acpi_scope_state
73567754Smsmith{
73667754Smsmith    ACPI_STATE_COMMON
737167802Sjkim    ACPI_NAMESPACE_NODE             *Node;
73867754Smsmith
73967754Smsmith} ACPI_SCOPE_STATE;
74067754Smsmith
74167754Smsmith
74267754Smsmithtypedef struct acpi_pscope_state
74367754Smsmith{
74467754Smsmith    ACPI_STATE_COMMON
745167802Sjkim    UINT32                          ArgCount;               /* Number of fixed arguments */
746167802Sjkim    union acpi_parse_object         *Op;                    /* Current op being parsed */
747167802Sjkim    UINT8                           *ArgEnd;                /* Current argument end */
748167802Sjkim    UINT8                           *PkgEnd;                /* Current package end */
749167802Sjkim    UINT32                          ArgList;                /* Next argument to parse */
75067754Smsmith
75167754Smsmith} ACPI_PSCOPE_STATE;
75267754Smsmith
75367754Smsmith
75469746Smsmith/*
755241973Sjkim * Thread state - one per thread across multiple walk states. Multiple walk
75687031Smsmith * states are created when there are nested control methods executing.
75787031Smsmith */
75887031Smsmithtypedef struct acpi_thread_state
75987031Smsmith{
76087031Smsmith    ACPI_STATE_COMMON
761167802Sjkim    UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
762167802Sjkim    struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
763167802Sjkim    union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
764167802Sjkim    ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
76587031Smsmith
76687031Smsmith} ACPI_THREAD_STATE;
76787031Smsmith
76887031Smsmith
76987031Smsmith/*
77069746Smsmith * Result values - used to accumulate the results of nested
77169746Smsmith * AML arguments
77269746Smsmith */
77369746Smsmithtypedef struct acpi_result_values
77469746Smsmith{
77569746Smsmith    ACPI_STATE_COMMON
776167802Sjkim    union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
77769746Smsmith
77869746Smsmith} ACPI_RESULT_VALUES;
77969746Smsmith
78069746Smsmith
78184491Smsmithtypedef
78284491SmsmithACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
783167802Sjkim    struct acpi_walk_state          *WalkState,
784167802Sjkim    union acpi_parse_object         **OutOp);
78584491Smsmith
78684491Smsmithtypedef
78784491SmsmithACPI_STATUS (*ACPI_PARSE_UPWARDS) (
788167802Sjkim    struct acpi_walk_state          *WalkState);
78984491Smsmith
79084491Smsmith
791234623Sjkim/* Global handlers for AML Notifies */
792234623Sjkim
793234623Sjkimtypedef struct acpi_global_notify_handler
794234623Sjkim{
795234623Sjkim    ACPI_NOTIFY_HANDLER             Handler;
796234623Sjkim    void                            *Context;
797234623Sjkim
798234623Sjkim} ACPI_GLOBAL_NOTIFY_HANDLER;
799234623Sjkim
80077424Smsmith/*
80177424Smsmith * Notify info - used to pass info to the deferred notify
80277424Smsmith * handler/dispatcher.
80377424Smsmith */
80477424Smsmithtypedef struct acpi_notify_info
80577424Smsmith{
80677424Smsmith    ACPI_STATE_COMMON
807234623Sjkim    UINT8                           HandlerListId;
808167802Sjkim    ACPI_NAMESPACE_NODE             *Node;
809234623Sjkim    union acpi_operand_object       *HandlerListHead;
810234623Sjkim    ACPI_GLOBAL_NOTIFY_HANDLER      *Global;
81177424Smsmith
81277424Smsmith} ACPI_NOTIFY_INFO;
81377424Smsmith
81477424Smsmith
81569746Smsmith/* Generic state is union of structs above */
81669746Smsmith
817114237Snjltypedef union acpi_generic_state
81867754Smsmith{
819167802Sjkim    ACPI_COMMON_STATE               Common;
820167802Sjkim    ACPI_CONTROL_STATE              Control;
821167802Sjkim    ACPI_UPDATE_STATE               Update;
822167802Sjkim    ACPI_SCOPE_STATE                Scope;
823167802Sjkim    ACPI_PSCOPE_STATE               ParseScope;
824167802Sjkim    ACPI_PKG_STATE                  Pkg;
825167802Sjkim    ACPI_THREAD_STATE               Thread;
826167802Sjkim    ACPI_RESULT_VALUES              Results;
827167802Sjkim    ACPI_NOTIFY_INFO                Notify;
82867754Smsmith
82967754Smsmith} ACPI_GENERIC_STATE;
83067754Smsmith
83167754Smsmith
83267754Smsmith/*****************************************************************************
83367754Smsmith *
83485756Smsmith * Interpreter typedefs and structs
83567754Smsmith *
83667754Smsmith ****************************************************************************/
83767754Smsmith
83885756Smsmithtypedef
83985756SmsmithACPI_STATUS (*ACPI_EXECUTE_OP) (
840167802Sjkim    struct acpi_walk_state          *WalkState);
84167754Smsmith
842229989Sjkim/* Address Range info block */
84367754Smsmith
844229989Sjkimtypedef struct acpi_address_range
845229989Sjkim{
846229989Sjkim    struct acpi_address_range   *Next;
847229989Sjkim    ACPI_NAMESPACE_NODE         *RegionNode;
848229989Sjkim    ACPI_PHYSICAL_ADDRESS       StartAddress;
849229989Sjkim    ACPI_PHYSICAL_ADDRESS       EndAddress;
850229989Sjkim
851229989Sjkim} ACPI_ADDRESS_RANGE;
852229989Sjkim
853229989Sjkim
85485756Smsmith/*****************************************************************************
85585756Smsmith *
85685756Smsmith * Parser typedefs and structs
85785756Smsmith *
85885756Smsmith ****************************************************************************/
85967754Smsmith
86083174Smsmith/*
86167754Smsmith * AML opcode, name, and argument layout
86267754Smsmith */
86367754Smsmithtypedef struct acpi_opcode_info
86467754Smsmith{
865102550Siwasaki#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
866167802Sjkim    char                            *Name;          /* Opcode name (disassembler/debug only) */
86787031Smsmith#endif
868167802Sjkim    UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
869167802Sjkim    UINT32                          RuntimeArgs;    /* Interpret time arguments */
870167802Sjkim    UINT16                          Flags;          /* Misc flags */
871167802Sjkim    UINT8                           ObjectType;     /* Corresponding internal object type */
872167802Sjkim    UINT8                           Class;          /* Opcode class */
873167802Sjkim    UINT8                           Type;           /* Opcode type */
87467754Smsmith
87567754Smsmith} ACPI_OPCODE_INFO;
87667754Smsmith
877228110Sjkim/* Structure for Resource Tag information */
878228110Sjkim
879228110Sjkimtypedef struct acpi_tag_info
880228110Sjkim{
881228110Sjkim    UINT32                          BitOffset;
882228110Sjkim    UINT32                          BitLength;
883228110Sjkim
884228110Sjkim} ACPI_TAG_INFO;
885228110Sjkim
886228110Sjkim/* Value associated with the parse object */
887228110Sjkim
888114237Snjltypedef union acpi_parse_value
88967754Smsmith{
890202771Sjkim    UINT64                          Integer;        /* Integer constant (Up to 64 bits) */
891167802Sjkim    UINT32                          Size;           /* bytelist or field size */
892167802Sjkim    char                            *String;        /* NULL terminated string */
893167802Sjkim    UINT8                           *Buffer;        /* buffer or string */
894167802Sjkim    char                            *Name;          /* NULL terminated string */
895167802Sjkim    union acpi_parse_object         *Arg;           /* arguments and contained ops */
896228110Sjkim    ACPI_TAG_INFO                   Tag;            /* Resource descriptor tag info  */
89767754Smsmith
89867754Smsmith} ACPI_PARSE_VALUE;
89967754Smsmith
900193267Sjkim
901306536Sjkim#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
902193267Sjkim#define ACPI_DISASM_ONLY_MEMBERS(a)     a;
903193267Sjkim#else
904193267Sjkim#define ACPI_DISASM_ONLY_MEMBERS(a)
905193267Sjkim#endif
906193267Sjkim
90767754Smsmith#define ACPI_PARSE_COMMON \
908167802Sjkim    union acpi_parse_object         *Parent;        /* Parent op */\
909167802Sjkim    UINT8                           DescriptorType; /* To differentiate various internal objs */\
910167802Sjkim    UINT8                           Flags;          /* Type of Op */\
911167802Sjkim    UINT16                          AmlOpcode;      /* AML opcode */\
912306536Sjkim    UINT8                           *Aml;           /* Address of declaration in AML */\
913167802Sjkim    union acpi_parse_object         *Next;          /* Next op */\
914167802Sjkim    ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
915167802Sjkim    ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
916167802Sjkim    UINT8                           ArgListLength;  /* Number of elements in the arg list */\
917100966Siwasaki    ACPI_DISASM_ONLY_MEMBERS (\
918167802Sjkim    UINT8                           DisasmFlags;    /* Used during AML disassembly */\
919167802Sjkim    UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
920281075Sdim    char                            *OperatorSymbol;/* Used for C-style operator name strings */\
921167802Sjkim    char                            AmlOpName[16])  /* Op name (debug only) */
92267754Smsmith
923114237Snjl
924239340Sjkim/* Flags for DisasmFlags field  above */
92567754Smsmith
926239340Sjkim#define ACPI_DASM_BUFFER                0x00        /* Buffer is a simple data buffer */
927239340Sjkim#define ACPI_DASM_RESOURCE              0x01        /* Buffer is a Resource Descriptor */
928239340Sjkim#define ACPI_DASM_STRING                0x02        /* Buffer is a ASCII string */
929239340Sjkim#define ACPI_DASM_UNICODE               0x03        /* Buffer is a Unicode string */
930239340Sjkim#define ACPI_DASM_PLD_METHOD            0x04        /* Buffer is a _PLD method bit-packed buffer */
931281075Sdim#define ACPI_DASM_UUID                  0x05        /* Buffer is a UUID/GUID */
932281075Sdim#define ACPI_DASM_EISAID                0x06        /* Integer is an EISAID */
933281075Sdim#define ACPI_DASM_MATCHOP               0x07        /* Parent opcode is a Match() operator */
934281075Sdim#define ACPI_DASM_LNOT_PREFIX           0x08        /* Start of a LNotEqual (etc.) pair of opcodes */
935281075Sdim#define ACPI_DASM_LNOT_SUFFIX           0x09        /* End  of a LNotEqual (etc.) pair of opcodes */
936281075Sdim#define ACPI_DASM_HID_STRING            0x0A        /* String is a _HID or _CID */
937281075Sdim#define ACPI_DASM_IGNORE                0x0B        /* Not used at this time */
938239340Sjkim
93967754Smsmith/*
940167802Sjkim * Generic operation (for example:  If, While, Store)
94167754Smsmith */
942114237Snjltypedef struct acpi_parse_obj_common
94367754Smsmith{
94467754Smsmith    ACPI_PARSE_COMMON
94599679Siwasaki} ACPI_PARSE_OBJ_COMMON;
94667754Smsmith
94767754Smsmith
94867754Smsmith/*
94967754Smsmith * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
95067754Smsmith * and bytelists.
95167754Smsmith */
952114237Snjltypedef struct acpi_parse_obj_named
95367754Smsmith{
95467754Smsmith    ACPI_PARSE_COMMON
955167802Sjkim    UINT8                           *Path;
956167802Sjkim    UINT8                           *Data;          /* AML body or bytelist data */
957167802Sjkim    UINT32                          Length;         /* AML length */
958167802Sjkim    UINT32                          Name;           /* 4-byte name or zero if no name */
95967754Smsmith
96099679Siwasaki} ACPI_PARSE_OBJ_NAMED;
96167754Smsmith
96267754Smsmith
963167802Sjkim/* This version is used by the iASL compiler only */
96499679Siwasaki
965167802Sjkim#define ACPI_MAX_PARSEOP_NAME   20
966167802Sjkim
967114237Snjltypedef struct acpi_parse_obj_asl
96899679Siwasaki{
96999679Siwasaki    ACPI_PARSE_COMMON
970167802Sjkim    union acpi_parse_object         *Child;
971167802Sjkim    union acpi_parse_object         *ParentMethod;
972167802Sjkim    char                            *Filename;
973167802Sjkim    char                            *ExternalName;
974167802Sjkim    char                            *Namepath;
975167802Sjkim    char                            NameSeg[4];
976167802Sjkim    UINT32                          ExtraValue;
977167802Sjkim    UINT32                          Column;
978167802Sjkim    UINT32                          LineNumber;
979167802Sjkim    UINT32                          LogicalLineNumber;
980167802Sjkim    UINT32                          LogicalByteOffset;
981167802Sjkim    UINT32                          EndLine;
982167802Sjkim    UINT32                          EndLogicalLine;
983167802Sjkim    UINT32                          AcpiBtype;
984167802Sjkim    UINT32                          AmlLength;
985167802Sjkim    UINT32                          AmlSubtreeLength;
986167802Sjkim    UINT32                          FinalAmlLength;
987167802Sjkim    UINT32                          FinalAmlOffset;
988167802Sjkim    UINT32                          CompileFlags;
989167802Sjkim    UINT16                          ParseOpcode;
990167802Sjkim    UINT8                           AmlOpcodeLength;
991167802Sjkim    UINT8                           AmlPkgLenBytes;
992167802Sjkim    UINT8                           Extra;
993167802Sjkim    char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
99499679Siwasaki
99599679Siwasaki} ACPI_PARSE_OBJ_ASL;
99699679Siwasaki
997114237Snjltypedef union acpi_parse_object
99899679Siwasaki{
999167802Sjkim    ACPI_PARSE_OBJ_COMMON           Common;
1000167802Sjkim    ACPI_PARSE_OBJ_NAMED            Named;
1001167802Sjkim    ACPI_PARSE_OBJ_ASL              Asl;
100299679Siwasaki
100399679Siwasaki} ACPI_PARSE_OBJECT;
100499679Siwasaki
100599679Siwasaki
100667754Smsmith/*
100767754Smsmith * Parse state - one state per parser invocation and each control
100867754Smsmith * method.
100967754Smsmith */
101067754Smsmithtypedef struct acpi_parse_state
101167754Smsmith{
1012167802Sjkim    UINT8                           *AmlStart;      /* First AML byte */
1013167802Sjkim    UINT8                           *Aml;           /* Next AML byte */
1014167802Sjkim    UINT8                           *AmlEnd;        /* (last + 1) AML byte */
1015167802Sjkim    UINT8                           *PkgStart;      /* Current package begin */
1016167802Sjkim    UINT8                           *PkgEnd;        /* Current package end */
1017167802Sjkim    union acpi_parse_object         *StartOp;       /* Root of parse tree */
1018167802Sjkim    struct acpi_namespace_node      *StartNode;
1019167802Sjkim    union acpi_generic_state        *Scope;         /* Current scope */
1020167802Sjkim    union acpi_parse_object         *StartScope;
1021167802Sjkim    UINT32                          AmlSize;
102267754Smsmith
102391116Smsmith} ACPI_PARSE_STATE;
102484491Smsmith
102584491Smsmith
102691116Smsmith/* Parse object flags */
102784491Smsmith
1028306536Sjkim#define ACPI_PARSEOP_GENERIC                0x01
1029306536Sjkim#define ACPI_PARSEOP_NAMED_OBJECT           0x02
1030306536Sjkim#define ACPI_PARSEOP_DEFERRED               0x04
1031306536Sjkim#define ACPI_PARSEOP_BYTELIST               0x08
1032306536Sjkim#define ACPI_PARSEOP_IN_STACK               0x10
1033306536Sjkim#define ACPI_PARSEOP_TARGET                 0x20
1034306536Sjkim#define ACPI_PARSEOP_IN_CACHE               0x80
103567754Smsmith
1036100966Siwasaki/* Parse object DisasmFlags */
103767754Smsmith
1038306536Sjkim#define ACPI_PARSEOP_IGNORE                 0x01
1039306536Sjkim#define ACPI_PARSEOP_PARAMETER_LIST         0x02
1040306536Sjkim#define ACPI_PARSEOP_EMPTY_TERMLIST         0x04
1041306536Sjkim#define ACPI_PARSEOP_PREDEFINED_CHECKED     0x08
1042306536Sjkim#define ACPI_PARSEOP_CLOSING_PAREN          0x10
1043306536Sjkim#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT    0x20
1044306536Sjkim#define ACPI_PARSEOP_ASSIGNMENT             0x40
1045306536Sjkim#define ACPI_PARSEOP_ELSEIF                 0x80
1046100966Siwasaki
1047100966Siwasaki
104867754Smsmith/*****************************************************************************
104967754Smsmith *
105091116Smsmith * Hardware (ACPI registers) and PNP
105167754Smsmith *
105267754Smsmith ****************************************************************************/
105367754Smsmith
1054114237Snjltypedef struct acpi_bit_register_info
105591116Smsmith{
1056167802Sjkim    UINT8                           ParentRegister;
1057167802Sjkim    UINT8                           BitPosition;
1058167802Sjkim    UINT16                          AccessBitMask;
105967754Smsmith
106091116Smsmith} ACPI_BIT_REGISTER_INFO;
106167754Smsmith
106267754Smsmith
106369450Smsmith/*
1064167802Sjkim * Some ACPI registers have bits that must be ignored -- meaning that they
1065167802Sjkim * must be preserved.
1066167802Sjkim */
1067167802Sjkim#define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
1068167802Sjkim
1069193267Sjkim/* Write-only bits must be zeroed by software */
1070167802Sjkim
1071193267Sjkim#define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004  /* Bits 13, 2 */
1072193267Sjkim
1073193267Sjkim/* For control registers, both ignored and reserved bits must be preserved */
1074193267Sjkim
1075167802Sjkim/*
1076193267Sjkim * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
1077193267Sjkim * ACPI specification to be a "preserved" bit - "OSPM always preserves this
1078193267Sjkim * bit position", section 4.7.3.2.1. However, on some machines the OS must
1079193267Sjkim * write a one to this bit after resume for the machine to work properly.
1080193267Sjkim * To enable this, we no longer attempt to preserve this bit. No machines
1081193267Sjkim * are known to fail if the bit is not preserved. (May 2009)
1082193267Sjkim */
1083193267Sjkim#define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200  /* Bit 9 */
1084193267Sjkim#define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8  /* Bits 14-15, 3-8 */
1085193267Sjkim#define ACPI_PM1_CONTROL_PRESERVED_BITS \
1086193267Sjkim         (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
1087193267Sjkim
1088193267Sjkim#define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE /* All except bit 0 */
1089193267Sjkim
1090193267Sjkim/*
109191116Smsmith * Register IDs
109291116Smsmith * These are the full ACPI registers
109369450Smsmith */
109491116Smsmith#define ACPI_REGISTER_PM1_STATUS                0x01
109591116Smsmith#define ACPI_REGISTER_PM1_ENABLE                0x02
109691116Smsmith#define ACPI_REGISTER_PM1_CONTROL               0x03
1097193267Sjkim#define ACPI_REGISTER_PM2_CONTROL               0x04
1098193267Sjkim#define ACPI_REGISTER_PM_TIMER                  0x05
1099193267Sjkim#define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
1100193267Sjkim#define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
110167754Smsmith
110267754Smsmith
110391116Smsmith/* Masks used to access the BitRegisters */
110467754Smsmith
110591116Smsmith#define ACPI_BITMASK_TIMER_STATUS               0x0001
110691116Smsmith#define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
110791116Smsmith#define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
110891116Smsmith#define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
110991116Smsmith#define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
111091116Smsmith#define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
1111151937Sjkim#define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
111291116Smsmith#define ACPI_BITMASK_WAKE_STATUS                0x8000
111367754Smsmith
1114167802Sjkim#define ACPI_BITMASK_ALL_FIXED_STATUS           (\
1115167802Sjkim    ACPI_BITMASK_TIMER_STATUS          | \
1116167802Sjkim    ACPI_BITMASK_BUS_MASTER_STATUS     | \
1117167802Sjkim    ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
1118167802Sjkim    ACPI_BITMASK_POWER_BUTTON_STATUS   | \
1119167802Sjkim    ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
1120167802Sjkim    ACPI_BITMASK_RT_CLOCK_STATUS       | \
1121213806Sjkim    ACPI_BITMASK_PCIEXP_WAKE_STATUS    | \
1122167802Sjkim    ACPI_BITMASK_WAKE_STATUS)
112367754Smsmith
112491116Smsmith#define ACPI_BITMASK_TIMER_ENABLE               0x0001
112591116Smsmith#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
112691116Smsmith#define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
112791116Smsmith#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
112891116Smsmith#define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
1129151937Sjkim#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
113067754Smsmith
113191116Smsmith#define ACPI_BITMASK_SCI_ENABLE                 0x0001
113291116Smsmith#define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
113391116Smsmith#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
1134193267Sjkim#define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
113591116Smsmith#define ACPI_BITMASK_SLEEP_ENABLE               0x2000
113667754Smsmith
113791116Smsmith#define ACPI_BITMASK_ARB_DISABLE                0x0001
113867754Smsmith
113967754Smsmith
114091116Smsmith/* Raw bit position of each BitRegister */
114167754Smsmith
114291116Smsmith#define ACPI_BITPOSITION_TIMER_STATUS           0x00
114391116Smsmith#define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
114491116Smsmith#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
114591116Smsmith#define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
114691116Smsmith#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
114791116Smsmith#define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
1148151937Sjkim#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
114991116Smsmith#define ACPI_BITPOSITION_WAKE_STATUS            0x0F
115067754Smsmith
115191116Smsmith#define ACPI_BITPOSITION_TIMER_ENABLE           0x00
115291116Smsmith#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
115391116Smsmith#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
115491116Smsmith#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
115591116Smsmith#define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
1156151937Sjkim#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
115767754Smsmith
115891116Smsmith#define ACPI_BITPOSITION_SCI_ENABLE             0x00
115991116Smsmith#define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
116091116Smsmith#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
1161193267Sjkim#define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
116291116Smsmith#define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
116367754Smsmith
116491116Smsmith#define ACPI_BITPOSITION_ARB_DISABLE            0x00
116567754Smsmith
116667754Smsmith
1167193267Sjkim/* Structs and definitions for _OSI support and I/O port validation */
1168193267Sjkim
1169193267Sjkim#define ACPI_ALWAYS_ILLEGAL             0x00
1170193267Sjkim
1171193267Sjkimtypedef struct acpi_interface_info
1172193267Sjkim{
1173210976Sjkim    char                        *Name;
1174210976Sjkim    struct acpi_interface_info  *Next;
1175210976Sjkim    UINT8                       Flags;
1176210976Sjkim    UINT8                       Value;
1177193267Sjkim
1178193267Sjkim} ACPI_INTERFACE_INFO;
1179193267Sjkim
1180210976Sjkim#define ACPI_OSI_INVALID                0x01
1181210976Sjkim#define ACPI_OSI_DYNAMIC                0x02
1182253690Sjkim#define ACPI_OSI_FEATURE                0x04
1183253690Sjkim#define ACPI_OSI_DEFAULT_INVALID        0x08
1184253690Sjkim#define ACPI_OSI_OPTIONAL_FEATURE       (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
1185210976Sjkim
1186193267Sjkimtypedef struct acpi_port_info
1187193267Sjkim{
1188193267Sjkim    char                    *Name;
1189193267Sjkim    UINT16                  Start;
1190193267Sjkim    UINT16                  End;
1191193267Sjkim    UINT8                   OsiDependency;
1192193267Sjkim
1193193267Sjkim} ACPI_PORT_INFO;
1194193267Sjkim
1195193267Sjkim
119677424Smsmith/*****************************************************************************
119777424Smsmith *
119877424Smsmith * Resource descriptors
119977424Smsmith *
120077424Smsmith ****************************************************************************/
120167754Smsmith
120277424Smsmith/* ResourceType values */
120367754Smsmith
1204151937Sjkim#define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
1205151937Sjkim#define ACPI_ADDRESS_TYPE_IO_RANGE              1
1206151937Sjkim#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
120767754Smsmith
120877424Smsmith/* Resource descriptor types and masks */
120967754Smsmith
1210151937Sjkim#define ACPI_RESOURCE_NAME_LARGE                0x80
1211151937Sjkim#define ACPI_RESOURCE_NAME_SMALL                0x00
121267754Smsmith
1213151937Sjkim#define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1214151937Sjkim#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1215151937Sjkim#define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
121667754Smsmith
121767754Smsmith
121877424Smsmith/*
1219151937Sjkim * Small resource descriptor "names" as defined by the ACPI specification.
1220151937Sjkim * Note: Bits 2:0 are used for the descriptor length
122177424Smsmith */
1222151937Sjkim#define ACPI_RESOURCE_NAME_IRQ                  0x20
1223151937Sjkim#define ACPI_RESOURCE_NAME_DMA                  0x28
1224151937Sjkim#define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1225151937Sjkim#define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1226151937Sjkim#define ACPI_RESOURCE_NAME_IO                   0x40
1227151937Sjkim#define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1228228110Sjkim#define ACPI_RESOURCE_NAME_FIXED_DMA            0x50
1229151937Sjkim#define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1230151937Sjkim#define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1231151937Sjkim#define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1232151937Sjkim#define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1233151937Sjkim#define ACPI_RESOURCE_NAME_END_TAG              0x78
123467754Smsmith
123577424Smsmith/*
1236151937Sjkim * Large resource descriptor "names" as defined by the ACPI specification.
1237151937Sjkim * Note: includes the Large Descriptor bit in bit[7]
123877424Smsmith */
1239151937Sjkim#define ACPI_RESOURCE_NAME_MEMORY24             0x81
1240151937Sjkim#define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1241151937Sjkim#define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1242151937Sjkim#define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1243151937Sjkim#define ACPI_RESOURCE_NAME_MEMORY32             0x85
1244151937Sjkim#define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1245151937Sjkim#define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1246151937Sjkim#define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1247151937Sjkim#define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1248151937Sjkim#define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1249151937Sjkim#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1250228110Sjkim#define ACPI_RESOURCE_NAME_GPIO                 0x8C
1251228110Sjkim#define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
1252228110Sjkim#define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
125377424Smsmith
125477424Smsmith
125567754Smsmith/*****************************************************************************
125667754Smsmith *
125782367Smsmith * Miscellaneous
125882367Smsmith *
125982367Smsmith ****************************************************************************/
126082367Smsmith
1261167802Sjkim#define ACPI_ASCII_ZERO                 0x30
126282367Smsmith
126399679Siwasaki
126482367Smsmith/*****************************************************************************
126582367Smsmith *
1266198237Sjkim * Disassembler
1267198237Sjkim *
1268198237Sjkim ****************************************************************************/
1269198237Sjkim
1270198237Sjkimtypedef struct acpi_external_list
1271198237Sjkim{
1272198237Sjkim    char                        *Path;
1273198237Sjkim    char                        *InternalPath;
1274198237Sjkim    struct acpi_external_list   *Next;
1275198237Sjkim    UINT32                      Value;
1276198237Sjkim    UINT16                      Length;
1277281075Sdim    UINT16                      Flags;
1278198237Sjkim    UINT8                       Type;
1279198237Sjkim
1280198237Sjkim} ACPI_EXTERNAL_LIST;
1281198237Sjkim
1282198237Sjkim/* Values for Flags field above */
1283198237Sjkim
1284281075Sdim#define ACPI_EXT_RESOLVED_REFERENCE         0x01    /* Object was resolved during cross ref */
1285281075Sdim#define ACPI_EXT_ORIGIN_FROM_FILE           0x02    /* External came from a file */
1286281075Sdim#define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04    /* Deallocate internal path on completion */
1287281075Sdim#define ACPI_EXT_EXTERNAL_EMITTED           0x08    /* External() statement has been emitted */
1288306536Sjkim#define ACPI_EXT_ORIGIN_FROM_OPCODE         0x10    /* External came from a External() opcode */
1289198237Sjkim
1290198237Sjkim
1291210976Sjkimtypedef struct acpi_external_file
1292210976Sjkim{
1293210976Sjkim    char                        *Path;
1294210976Sjkim    struct acpi_external_file   *Next;
1295210976Sjkim
1296210976Sjkim} ACPI_EXTERNAL_FILE;
1297210976Sjkim
1298210976Sjkim
1299198237Sjkim/*****************************************************************************
1300198237Sjkim *
130178986Smsmith * Debugger
130278986Smsmith *
130378986Smsmith ****************************************************************************/
130478986Smsmith
1305114237Snjltypedef struct acpi_db_method_info
130678986Smsmith{
1307239340Sjkim    ACPI_HANDLE                     Method;
1308167802Sjkim    ACPI_HANDLE                     MainThreadGate;
1309167802Sjkim    ACPI_HANDLE                     ThreadCompleteGate;
1310193267Sjkim    ACPI_HANDLE                     InfoGate;
1311212761Sjkim    ACPI_THREAD_ID                  *Threads;
1312167802Sjkim    UINT32                          NumThreads;
1313167802Sjkim    UINT32                          NumCreated;
1314167802Sjkim    UINT32                          NumCompleted;
131578986Smsmith
1316167802Sjkim    char                            *Name;
1317167802Sjkim    UINT32                          Flags;
1318167802Sjkim    UINT32                          NumLoops;
1319281075Sdim    char                            Pathname[ACPI_DB_LINE_BUFFER_SIZE];
1320167802Sjkim    char                            **Args;
1321222544Sjkim    ACPI_OBJECT_TYPE                *Types;
1322167802Sjkim
1323167802Sjkim    /*
1324167802Sjkim     * Arguments to be passed to method for the command
1325167802Sjkim     * Threads -
1326167802Sjkim     *   the Number of threads, ID of current thread and
1327167802Sjkim     *   Index of current thread inside all them created.
1328167802Sjkim     */
1329167802Sjkim    char                            InitArgs;
1330306536Sjkim#ifdef ACPI_DEBUGGER
1331222544Sjkim    ACPI_OBJECT_TYPE                ArgTypes[4];
1332306536Sjkim#endif
1333167802Sjkim    char                            *Arguments[4];
1334167802Sjkim    char                            NumThreadsStr[11];
1335167802Sjkim    char                            IdOfThreadStr[11];
1336167802Sjkim    char                            IndexOfThreadStr[11];
1337167802Sjkim
133891116Smsmith} ACPI_DB_METHOD_INFO;
133978986Smsmith
1340114237Snjltypedef struct acpi_integrity_info
1341114237Snjl{
1342167802Sjkim    UINT32                          Nodes;
1343167802Sjkim    UINT32                          Objects;
134478986Smsmith
1345114237Snjl} ACPI_INTEGRITY_INFO;
1346114237Snjl
1347114237Snjl
1348281075Sdim#define ACPI_DB_DISABLE_OUTPUT          0x00
1349167802Sjkim#define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1350167802Sjkim#define ACPI_DB_CONSOLE_OUTPUT          0x02
1351167802Sjkim#define ACPI_DB_DUPLICATE_OUTPUT        0x03
135291116Smsmith
135391116Smsmith
1354306536Sjkimtypedef struct acpi_object_info
1355306536Sjkim{
1356306536Sjkim    UINT32                  Types[ACPI_TOTAL_TYPES];
1357306536Sjkim
1358306536Sjkim} ACPI_OBJECT_INFO;
1359306536Sjkim
1360306536Sjkim
136178986Smsmith/*****************************************************************************
136278986Smsmith *
136367754Smsmith * Debug
136467754Smsmith *
136567754Smsmith ****************************************************************************/
136667754Smsmith
136767754Smsmith/* Entry for a memory allocation (debug only) */
136867754Smsmith
1369167802Sjkim#define ACPI_MEM_MALLOC                 0
1370167802Sjkim#define ACPI_MEM_CALLOC                 1
1371167802Sjkim#define ACPI_MAX_MODULE_NAME            16
137267754Smsmith
137382367Smsmith#define ACPI_COMMON_DEBUG_MEM_HEADER \
1374167802Sjkim    struct acpi_debug_mem_block     *Previous; \
1375167802Sjkim    struct acpi_debug_mem_block     *Next; \
1376167802Sjkim    UINT32                          Size; \
1377167802Sjkim    UINT32                          Component; \
1378167802Sjkim    UINT32                          Line; \
1379167802Sjkim    char                            Module[ACPI_MAX_MODULE_NAME]; \
1380167802Sjkim    UINT8                           AllocType;
138167754Smsmith
1382114237Snjltypedef struct acpi_debug_mem_header
138382367Smsmith{
138482367Smsmith    ACPI_COMMON_DEBUG_MEM_HEADER
138582367Smsmith
138682367Smsmith} ACPI_DEBUG_MEM_HEADER;
138782367Smsmith
1388114237Snjltypedef struct acpi_debug_mem_block
138982367Smsmith{
139082367Smsmith    ACPI_COMMON_DEBUG_MEM_HEADER
1391167802Sjkim    UINT64                          UserSpace;
139282367Smsmith
139382367Smsmith} ACPI_DEBUG_MEM_BLOCK;
139482367Smsmith
139582367Smsmith
139682367Smsmith#define ACPI_MEM_LIST_GLOBAL            0
139782367Smsmith#define ACPI_MEM_LIST_NSNODE            1
1398151937Sjkim#define ACPI_MEM_LIST_MAX               1
1399151937Sjkim#define ACPI_NUM_MEM_LISTS              2
140082367Smsmith
140182367Smsmith
1402237412Sjkim/*****************************************************************************
1403237412Sjkim *
1404237412Sjkim * Info/help support
1405237412Sjkim *
1406237412Sjkim ****************************************************************************/
1407237412Sjkim
1408237412Sjkimtypedef struct ah_predefined_name
1409237412Sjkim{
1410237412Sjkim    char            *Name;
1411237412Sjkim    char            *Description;
1412237412Sjkim#ifndef ACPI_ASL_COMPILER
1413237412Sjkim    char            *Action;
1414237412Sjkim#endif
1415237412Sjkim
1416237412Sjkim} AH_PREDEFINED_NAME;
1417237412Sjkim
1418281075Sdimtypedef struct ah_device_id
1419281075Sdim{
1420281075Sdim    char            *Name;
1421281075Sdim    char            *Description;
1422281075Sdim
1423281075Sdim} AH_DEVICE_ID;
1424281075Sdim
1425281075Sdimtypedef struct ah_uuid
1426281075Sdim{
1427281075Sdim    char            *Description;
1428281075Sdim    char            *String;
1429281075Sdim
1430281075Sdim} AH_UUID;
1431281075Sdim
1432284460Sjkimtypedef struct ah_table
1433284460Sjkim{
1434284460Sjkim    char                    *Signature;
1435284460Sjkim    char                    *Description;
1436284460Sjkim
1437284460Sjkim} AH_TABLE;
1438284460Sjkim
143967754Smsmith#endif /* __ACLOCAL_H__ */
1440