xref: /linux/drivers/acpi/acpica/aclocal.h (revision be030a576854238250d70135644cde6a0ba34b0d)
1e2f7a777SLen Brown /******************************************************************************
2e2f7a777SLen Brown  *
3e2f7a777SLen Brown  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4e2f7a777SLen Brown  *
5e2f7a777SLen Brown  *****************************************************************************/
6e2f7a777SLen Brown 
7e2f7a777SLen Brown /*
877848130SBob Moore  * Copyright (C) 2000 - 2012, Intel Corp.
9e2f7a777SLen Brown  * All rights reserved.
10e2f7a777SLen Brown  *
11e2f7a777SLen Brown  * Redistribution and use in source and binary forms, with or without
12e2f7a777SLen Brown  * modification, are permitted provided that the following conditions
13e2f7a777SLen Brown  * are met:
14e2f7a777SLen Brown  * 1. Redistributions of source code must retain the above copyright
15e2f7a777SLen Brown  *    notice, this list of conditions, and the following disclaimer,
16e2f7a777SLen Brown  *    without modification.
17e2f7a777SLen Brown  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18e2f7a777SLen Brown  *    substantially similar to the "NO WARRANTY" disclaimer below
19e2f7a777SLen Brown  *    ("Disclaimer") and any redistribution must be conditioned upon
20e2f7a777SLen Brown  *    including a substantially similar Disclaimer requirement for further
21e2f7a777SLen Brown  *    binary redistribution.
22e2f7a777SLen Brown  * 3. Neither the names of the above-listed copyright holders nor the names
23e2f7a777SLen Brown  *    of any contributors may be used to endorse or promote products derived
24e2f7a777SLen Brown  *    from this software without specific prior written permission.
25e2f7a777SLen Brown  *
26e2f7a777SLen Brown  * Alternatively, this software may be distributed under the terms of the
27e2f7a777SLen Brown  * GNU General Public License ("GPL") version 2 as published by the Free
28e2f7a777SLen Brown  * Software Foundation.
29e2f7a777SLen Brown  *
30e2f7a777SLen Brown  * NO WARRANTY
31e2f7a777SLen Brown  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32e2f7a777SLen Brown  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33e2f7a777SLen Brown  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34e2f7a777SLen Brown  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35e2f7a777SLen Brown  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36e2f7a777SLen Brown  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37e2f7a777SLen Brown  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38e2f7a777SLen Brown  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39e2f7a777SLen Brown  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40e2f7a777SLen Brown  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41e2f7a777SLen Brown  * POSSIBILITY OF SUCH DAMAGES.
42e2f7a777SLen Brown  */
43e2f7a777SLen Brown 
44e2f7a777SLen Brown #ifndef __ACLOCAL_H__
45e2f7a777SLen Brown #define __ACLOCAL_H__
46e2f7a777SLen Brown 
47e2f7a777SLen Brown /* acpisrc:struct_defs -- for acpisrc conversion */
48e2f7a777SLen Brown 
49e2f7a777SLen Brown #define ACPI_SERIALIZED                 0xFF
50e2f7a777SLen Brown 
51e2f7a777SLen Brown typedef u32 acpi_mutex_handle;
52e2f7a777SLen Brown #define ACPI_GLOBAL_LOCK                (acpi_semaphore) (-1)
53e2f7a777SLen Brown 
54e2f7a777SLen Brown /* Total number of aml opcodes defined */
55e2f7a777SLen Brown 
569ce81784SBob Moore #define AML_NUM_OPCODES                 0x81
57e2f7a777SLen Brown 
58e2f7a777SLen Brown /* Forward declarations */
59e2f7a777SLen Brown 
60e2f7a777SLen Brown struct acpi_walk_state;
61e2f7a777SLen Brown struct acpi_obj_mutex;
62e2f7a777SLen Brown union acpi_parse_object;
63e2f7a777SLen Brown 
64e2f7a777SLen Brown /*****************************************************************************
65e2f7a777SLen Brown  *
66e2f7a777SLen Brown  * Mutex typedefs and structs
67e2f7a777SLen Brown  *
68e2f7a777SLen Brown  ****************************************************************************/
69e2f7a777SLen Brown 
70e2f7a777SLen Brown /*
71e2f7a777SLen Brown  * Predefined handles for the mutex objects used within the subsystem
72e2f7a777SLen Brown  * All mutex objects are automatically created by acpi_ut_mutex_initialize.
73e2f7a777SLen Brown  *
74e2f7a777SLen Brown  * The acquire/release ordering protocol is implied via this list. Mutexes
75e2f7a777SLen Brown  * with a lower value must be acquired before mutexes with a higher value.
76e2f7a777SLen Brown  *
77e2f7a777SLen Brown  * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
78e2f7a777SLen Brown  * table below also!
79e2f7a777SLen Brown  */
80e2f7a777SLen Brown #define ACPI_MTX_INTERPRETER            0	/* AML Interpreter, main lock */
81e2f7a777SLen Brown #define ACPI_MTX_NAMESPACE              1	/* ACPI Namespace */
82e2f7a777SLen Brown #define ACPI_MTX_TABLES                 2	/* Data for ACPI tables */
83e2f7a777SLen Brown #define ACPI_MTX_EVENTS                 3	/* Data for ACPI events */
84e2f7a777SLen Brown #define ACPI_MTX_CACHES                 4	/* Internal caches, general purposes */
85e2f7a777SLen Brown #define ACPI_MTX_MEMORY                 5	/* Debug memory tracking lists */
86e2f7a777SLen Brown #define ACPI_MTX_DEBUG_CMD_COMPLETE     6	/* AML debugger */
87e2f7a777SLen Brown #define ACPI_MTX_DEBUG_CMD_READY        7	/* AML debugger */
88e2f7a777SLen Brown 
89e2f7a777SLen Brown #define ACPI_MAX_MUTEX                  7
90e2f7a777SLen Brown #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
91e2f7a777SLen Brown 
928a335a23SBob Moore /* Lock structure for reader/writer interfaces */
938a335a23SBob Moore 
948a335a23SBob Moore struct acpi_rw_lock {
958a335a23SBob Moore 	acpi_mutex writer_mutex;
968a335a23SBob Moore 	acpi_mutex reader_mutex;
978a335a23SBob Moore 	u32 num_readers;
988a335a23SBob Moore };
998a335a23SBob Moore 
100e2f7a777SLen Brown /*
101e2f7a777SLen Brown  * Predefined handles for spinlocks used within the subsystem.
102e2f7a777SLen Brown  * These spinlocks are created by acpi_ut_mutex_initialize
103e2f7a777SLen Brown  */
104e2f7a777SLen Brown #define ACPI_LOCK_GPES                  0
105e2f7a777SLen Brown #define ACPI_LOCK_HARDWARE              1
106e2f7a777SLen Brown 
107e2f7a777SLen Brown #define ACPI_MAX_LOCK                   1
108e2f7a777SLen Brown #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
109e2f7a777SLen Brown 
110e2f7a777SLen Brown /* This Thread ID means that the mutex is not in use (unlocked) */
111e2f7a777SLen Brown 
112e2f7a777SLen Brown #define ACPI_MUTEX_NOT_ACQUIRED         (acpi_thread_id) 0
113e2f7a777SLen Brown 
114e2f7a777SLen Brown /* Table for the global mutexes */
115e2f7a777SLen Brown 
116e2f7a777SLen Brown struct acpi_mutex_info {
117e2f7a777SLen Brown 	acpi_mutex mutex;
118e2f7a777SLen Brown 	u32 use_count;
119e2f7a777SLen Brown 	acpi_thread_id thread_id;
120e2f7a777SLen Brown };
121e2f7a777SLen Brown 
122e2f7a777SLen Brown /* Lock flag parameter for various interfaces */
123e2f7a777SLen Brown 
124e2f7a777SLen Brown #define ACPI_MTX_DO_NOT_LOCK            0
125e2f7a777SLen Brown #define ACPI_MTX_LOCK                   1
126e2f7a777SLen Brown 
127e2f7a777SLen Brown /* Field access granularities */
128e2f7a777SLen Brown 
129e2f7a777SLen Brown #define ACPI_FIELD_BYTE_GRANULARITY     1
130e2f7a777SLen Brown #define ACPI_FIELD_WORD_GRANULARITY     2
131e2f7a777SLen Brown #define ACPI_FIELD_DWORD_GRANULARITY    4
132e2f7a777SLen Brown #define ACPI_FIELD_QWORD_GRANULARITY    8
133e2f7a777SLen Brown 
134e2f7a777SLen Brown #define ACPI_ENTRY_NOT_FOUND            NULL
135e2f7a777SLen Brown 
136e2f7a777SLen Brown /*****************************************************************************
137e2f7a777SLen Brown  *
138e2f7a777SLen Brown  * Namespace typedefs and structs
139e2f7a777SLen Brown  *
140e2f7a777SLen Brown  ****************************************************************************/
141e2f7a777SLen Brown 
142e2f7a777SLen Brown /* Operational modes of the AML interpreter/scanner */
143e2f7a777SLen Brown 
144e2f7a777SLen Brown typedef enum {
145e2f7a777SLen Brown 	ACPI_IMODE_LOAD_PASS1 = 0x01,
146e2f7a777SLen Brown 	ACPI_IMODE_LOAD_PASS2 = 0x02,
147e2f7a777SLen Brown 	ACPI_IMODE_EXECUTE = 0x03
148e2f7a777SLen Brown } acpi_interpreter_mode;
149e2f7a777SLen Brown 
150e2f7a777SLen Brown /*
151e2f7a777SLen Brown  * The Namespace Node describes a named object that appears in the AML.
152e2f7a777SLen Brown  * descriptor_type is used to differentiate between internal descriptors.
153e2f7a777SLen Brown  *
154e2f7a777SLen Brown  * The node is optimized for both 32-bit and 64-bit platforms:
155e2f7a777SLen Brown  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
156e2f7a777SLen Brown  *
157e2f7a777SLen Brown  * Note: The descriptor_type and Type fields must appear in the identical
158e2f7a777SLen Brown  * position in both the struct acpi_namespace_node and union acpi_operand_object
159e2f7a777SLen Brown  * structures.
160e2f7a777SLen Brown  */
161e2f7a777SLen Brown struct acpi_namespace_node {
162e2f7a777SLen Brown 	union acpi_operand_object *object;	/* Interpreter object */
163e2f7a777SLen Brown 	u8 descriptor_type;	/* Differentiate object descriptor types */
164e2f7a777SLen Brown 	u8 type;		/* ACPI Type associated with this name */
165e2f7a777SLen Brown 	u8 flags;		/* Miscellaneous flags */
166e2f7a777SLen Brown 	acpi_owner_id owner_id;	/* Node creator */
167e2f7a777SLen Brown 	union acpi_name_union name;	/* ACPI Name, always 4 chars per ACPI spec */
168c45b5c09SAlexey Starikovskiy 	struct acpi_namespace_node *parent;	/* Parent node */
169e2f7a777SLen Brown 	struct acpi_namespace_node *child;	/* First child */
170c45b5c09SAlexey Starikovskiy 	struct acpi_namespace_node *peer;	/* First peer */
171e2f7a777SLen Brown 
172e2f7a777SLen Brown 	/*
173e2f7a777SLen Brown 	 * The following fields are used by the ASL compiler and disassembler only
174e2f7a777SLen Brown 	 */
175e2f7a777SLen Brown #ifdef ACPI_LARGE_NAMESPACE_NODE
176e2f7a777SLen Brown 	union acpi_parse_object *op;
177e2f7a777SLen Brown 	u32 value;
178e2f7a777SLen Brown 	u32 length;
179e2f7a777SLen Brown #endif
180e2f7a777SLen Brown };
181e2f7a777SLen Brown 
182e2f7a777SLen Brown /* Namespace Node flags */
183e2f7a777SLen Brown 
184c45b5c09SAlexey Starikovskiy #define ANOBJ_RESERVED                  0x01	/* Available for use */
185e2f7a777SLen Brown #define ANOBJ_TEMPORARY                 0x02	/* Node is create by a method and is temporary */
186e2f7a777SLen Brown #define ANOBJ_METHOD_ARG                0x04	/* Node is a method argument */
187e2f7a777SLen Brown #define ANOBJ_METHOD_LOCAL              0x08	/* Node is a method local */
188e2f7a777SLen Brown #define ANOBJ_SUBTREE_HAS_INI           0x10	/* Used to optimize device initialization */
189e2f7a777SLen Brown #define ANOBJ_EVALUATED                 0x20	/* Set on first evaluation of node */
190b2f7ddcfSLin Ming #define ANOBJ_ALLOCATED_BUFFER          0x40	/* Method AML buffer is dynamic (install_method) */
191e2f7a777SLen Brown 
192e2f7a777SLen Brown #define ANOBJ_IS_EXTERNAL               0x08	/* i_aSL only: This object created via External() */
193e2f7a777SLen Brown #define ANOBJ_METHOD_NO_RETVAL          0x10	/* i_aSL only: Method has no return value */
194e2f7a777SLen Brown #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20	/* i_aSL only: Method has at least one return value */
195e2f7a777SLen Brown #define ANOBJ_IS_BIT_OFFSET             0x40	/* i_aSL only: Reference is a bit offset */
196e2f7a777SLen Brown #define ANOBJ_IS_REFERENCED             0x80	/* i_aSL only: Object was referenced */
197e2f7a777SLen Brown 
198b9ee2043SBob Moore /* Internal ACPI table management - master table list */
199e2f7a777SLen Brown 
200b9ee2043SBob Moore struct acpi_table_list {
201b9ee2043SBob Moore 	struct acpi_table_desc *tables;	/* Table descriptor array */
202b9ee2043SBob Moore 	u32 current_table_count;	/* Tables currently in the array */
203b9ee2043SBob Moore 	u32 max_table_count;	/* Max tables array will hold */
204e2f7a777SLen Brown 	u8 flags;
205e2f7a777SLen Brown };
206e2f7a777SLen Brown 
207e2f7a777SLen Brown /* Flags for above */
208e2f7a777SLen Brown 
209e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)	/* ~ORIGIN_ALLOCATED */
210e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
211e2f7a777SLen Brown #define ACPI_ROOT_ALLOW_RESIZE          (2)
212e2f7a777SLen Brown 
213e2f7a777SLen Brown /* Predefined (fixed) table indexes */
214e2f7a777SLen Brown 
215e2f7a777SLen Brown #define ACPI_TABLE_INDEX_DSDT           (0)
216e2f7a777SLen Brown #define ACPI_TABLE_INDEX_FACS           (1)
217e2f7a777SLen Brown 
218e2f7a777SLen Brown struct acpi_find_context {
219e2f7a777SLen Brown 	char *search_for;
220e2f7a777SLen Brown 	acpi_handle *list;
221e2f7a777SLen Brown 	u32 *count;
222e2f7a777SLen Brown };
223e2f7a777SLen Brown 
224e2f7a777SLen Brown struct acpi_ns_search_data {
225e2f7a777SLen Brown 	struct acpi_namespace_node *node;
226e2f7a777SLen Brown };
227e2f7a777SLen Brown 
228e2f7a777SLen Brown /* Object types used during package copies */
229e2f7a777SLen Brown 
230e2f7a777SLen Brown #define ACPI_COPY_TYPE_SIMPLE           0
231e2f7a777SLen Brown #define ACPI_COPY_TYPE_PACKAGE          1
232e2f7a777SLen Brown 
233e2f7a777SLen Brown /* Info structure used to convert external<->internal namestrings */
234e2f7a777SLen Brown 
235e2f7a777SLen Brown struct acpi_namestring_info {
236e2f7a777SLen Brown 	const char *external_name;
237e2f7a777SLen Brown 	const char *next_external_char;
238e2f7a777SLen Brown 	char *internal_name;
239e2f7a777SLen Brown 	u32 length;
240e2f7a777SLen Brown 	u32 num_segments;
241e2f7a777SLen Brown 	u32 num_carats;
242e2f7a777SLen Brown 	u8 fully_qualified;
243e2f7a777SLen Brown };
244e2f7a777SLen Brown 
245e2f7a777SLen Brown /* Field creation info */
246e2f7a777SLen Brown 
247e2f7a777SLen Brown struct acpi_create_field_info {
248e2f7a777SLen Brown 	struct acpi_namespace_node *region_node;
249e2f7a777SLen Brown 	struct acpi_namespace_node *field_node;
250e2f7a777SLen Brown 	struct acpi_namespace_node *register_node;
251e2f7a777SLen Brown 	struct acpi_namespace_node *data_register_node;
2529ce81784SBob Moore 	struct acpi_namespace_node *connection_node;
2539ce81784SBob Moore 	u8 *resource_buffer;
254e2f7a777SLen Brown 	u32 bank_value;
255e2f7a777SLen Brown 	u32 field_bit_position;
256e2f7a777SLen Brown 	u32 field_bit_length;
2579ce81784SBob Moore 	u16 resource_length;
258e2f7a777SLen Brown 	u8 field_flags;
259e2f7a777SLen Brown 	u8 attribute;
260e2f7a777SLen Brown 	u8 field_type;
2619ce81784SBob Moore 	u8 access_length;
262e2f7a777SLen Brown };
263e2f7a777SLen Brown 
264e2f7a777SLen Brown typedef
265e2f7a777SLen Brown acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
266e2f7a777SLen Brown 
267e2f7a777SLen Brown /*
268e2f7a777SLen Brown  * Bitmapped ACPI types.  Used internally only
269e2f7a777SLen Brown  */
270e2f7a777SLen Brown #define ACPI_BTYPE_ANY                  0x00000000
271e2f7a777SLen Brown #define ACPI_BTYPE_INTEGER              0x00000001
272e2f7a777SLen Brown #define ACPI_BTYPE_STRING               0x00000002
273e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER               0x00000004
274e2f7a777SLen Brown #define ACPI_BTYPE_PACKAGE              0x00000008
275e2f7a777SLen Brown #define ACPI_BTYPE_FIELD_UNIT           0x00000010
276e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE               0x00000020
277e2f7a777SLen Brown #define ACPI_BTYPE_EVENT                0x00000040
278e2f7a777SLen Brown #define ACPI_BTYPE_METHOD               0x00000080
279e2f7a777SLen Brown #define ACPI_BTYPE_MUTEX                0x00000100
280e2f7a777SLen Brown #define ACPI_BTYPE_REGION               0x00000200
281e2f7a777SLen Brown #define ACPI_BTYPE_POWER                0x00000400
282e2f7a777SLen Brown #define ACPI_BTYPE_PROCESSOR            0x00000800
283e2f7a777SLen Brown #define ACPI_BTYPE_THERMAL              0x00001000
284e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
285e2f7a777SLen Brown #define ACPI_BTYPE_DDB_HANDLE           0x00004000
286e2f7a777SLen Brown #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
287e2f7a777SLen Brown #define ACPI_BTYPE_REFERENCE            0x00010000
288e2f7a777SLen Brown #define ACPI_BTYPE_RESOURCE             0x00020000
289e2f7a777SLen Brown 
290e2f7a777SLen Brown #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
291e2f7a777SLen Brown 
292e2f7a777SLen Brown #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
293e2f7a777SLen Brown #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
294e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
295e2f7a777SLen Brown #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF	/* ARG or LOCAL */
296e2f7a777SLen Brown #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
297e2f7a777SLen Brown 
298e2f7a777SLen Brown /*
299e2f7a777SLen Brown  * Information structure for ACPI predefined names.
300e2f7a777SLen Brown  * Each entry in the table contains the following items:
301e2f7a777SLen Brown  *
302ba494beeSBob Moore  * name                 - The ACPI reserved name
303e2f7a777SLen Brown  * param_count          - Number of arguments to the method
304e2f7a777SLen Brown  * expected_return_btypes - Allowed type(s) for the return value
305e2f7a777SLen Brown  */
306e2f7a777SLen Brown struct acpi_name_info {
307e2f7a777SLen Brown 	char name[ACPI_NAME_SIZE];
308e2f7a777SLen Brown 	u8 param_count;
309e2f7a777SLen Brown 	u8 expected_btypes;
310e2f7a777SLen Brown };
311e2f7a777SLen Brown 
312e2f7a777SLen Brown /*
313e2f7a777SLen Brown  * Secondary information structures for ACPI predefined objects that return
314e2f7a777SLen Brown  * package objects. This structure appears as the next entry in the table
315e2f7a777SLen Brown  * after the NAME_INFO structure above.
316e2f7a777SLen Brown  *
317e2f7a777SLen Brown  * The reason for this is to minimize the size of the predefined name table.
318e2f7a777SLen Brown  */
319e2f7a777SLen Brown 
320e2f7a777SLen Brown /*
321e2f7a777SLen Brown  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
3227fce7a4bSBob Moore  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
3237fce7a4bSBob Moore  * ACPI_PTYPE2_FIX_VAR
324e2f7a777SLen Brown  */
325e2f7a777SLen Brown struct acpi_package_info {
326e2f7a777SLen Brown 	u8 type;
327e2f7a777SLen Brown 	u8 object_type1;
328e2f7a777SLen Brown 	u8 count1;
329e2f7a777SLen Brown 	u8 object_type2;
330e2f7a777SLen Brown 	u8 count2;
331e2f7a777SLen Brown 	u8 reserved;
332e2f7a777SLen Brown };
333e2f7a777SLen Brown 
334e2f7a777SLen Brown /* Used for ACPI_PTYPE2_FIXED */
335e2f7a777SLen Brown 
336e2f7a777SLen Brown struct acpi_package_info2 {
337e2f7a777SLen Brown 	u8 type;
338e2f7a777SLen Brown 	u8 count;
339e2f7a777SLen Brown 	u8 object_type[4];
340e2f7a777SLen Brown };
341e2f7a777SLen Brown 
342e2f7a777SLen Brown /* Used for ACPI_PTYPE1_OPTION */
343e2f7a777SLen Brown 
344e2f7a777SLen Brown struct acpi_package_info3 {
345e2f7a777SLen Brown 	u8 type;
346e2f7a777SLen Brown 	u8 count;
347e2f7a777SLen Brown 	u8 object_type[2];
348e2f7a777SLen Brown 	u8 tail_object_type;
349e2f7a777SLen Brown 	u8 reserved;
350e2f7a777SLen Brown };
351e2f7a777SLen Brown 
352e2f7a777SLen Brown union acpi_predefined_info {
353e2f7a777SLen Brown 	struct acpi_name_info info;
354e2f7a777SLen Brown 	struct acpi_package_info ret_info;
355e2f7a777SLen Brown 	struct acpi_package_info2 ret_info2;
356e2f7a777SLen Brown 	struct acpi_package_info3 ret_info3;
357e2f7a777SLen Brown };
358e2f7a777SLen Brown 
3590444e8f6SBob Moore /* Data block used during object validation */
3600444e8f6SBob Moore 
3610444e8f6SBob Moore struct acpi_predefined_data {
3620444e8f6SBob Moore 	char *pathname;
3630444e8f6SBob Moore 	const union acpi_predefined_info *predefined;
364091f4d71SBob Moore 	union acpi_operand_object *parent_package;
3658f9c9127SFenghua Yu 	struct acpi_namespace_node *node;
3660444e8f6SBob Moore 	u32 flags;
3670444e8f6SBob Moore 	u8 node_flags;
3680444e8f6SBob Moore };
3690444e8f6SBob Moore 
3700444e8f6SBob Moore /* Defines for Flags field above */
3710444e8f6SBob Moore 
3720444e8f6SBob Moore #define ACPI_OBJECT_REPAIRED    1
3736a99b1c9SBob Moore #define ACPI_OBJECT_WRAPPED     2
3740444e8f6SBob Moore 
375e2f7a777SLen Brown /*
376e2f7a777SLen Brown  * Bitmapped return value types
377e2f7a777SLen Brown  * Note: the actual data types must be contiguous, a loop in nspredef.c
378e2f7a777SLen Brown  * depends on this.
379e2f7a777SLen Brown  */
380e2f7a777SLen Brown #define ACPI_RTYPE_ANY                  0x00
381e2f7a777SLen Brown #define ACPI_RTYPE_NONE                 0x01
382e2f7a777SLen Brown #define ACPI_RTYPE_INTEGER              0x02
383e2f7a777SLen Brown #define ACPI_RTYPE_STRING               0x04
384e2f7a777SLen Brown #define ACPI_RTYPE_BUFFER               0x08
385e2f7a777SLen Brown #define ACPI_RTYPE_PACKAGE              0x10
386e2f7a777SLen Brown #define ACPI_RTYPE_REFERENCE            0x20
387e2f7a777SLen Brown #define ACPI_RTYPE_ALL                  0x3F
388e2f7a777SLen Brown 
389e2f7a777SLen Brown #define ACPI_NUM_RTYPES                 5	/* Number of actual object types */
390e2f7a777SLen Brown 
391e2f7a777SLen Brown /*****************************************************************************
392e2f7a777SLen Brown  *
393e2f7a777SLen Brown  * Event typedefs and structs
394e2f7a777SLen Brown  *
395e2f7a777SLen Brown  ****************************************************************************/
396e2f7a777SLen Brown 
397e2f7a777SLen Brown /* Dispatch info for each GPE -- either a method or handler, cannot be both */
398e2f7a777SLen Brown 
3998b6cd8adSLin Ming struct acpi_gpe_handler_info {
4008b6cd8adSLin Ming 	acpi_gpe_handler address;	/* Address of handler, if any */
401e2f7a777SLen Brown 	void *context;		/* Context to be passed to handler */
402e2f7a777SLen Brown 	struct acpi_namespace_node *method_node;	/* Method node for this GPE level (saved) */
4033a37898dSLin Ming 	u8 original_flags;      /* Original (pre-handler) GPE info */
4043a37898dSLin Ming 	u8 originally_enabled;  /* True if GPE was originally enabled */
405e2f7a777SLen Brown };
406e2f7a777SLen Brown 
4075816b343SBob Moore /* Notify info for implicit notify, multiple device objects */
4085816b343SBob Moore 
4095816b343SBob Moore struct acpi_gpe_notify_info {
4105816b343SBob Moore 	struct acpi_namespace_node *device_node;	/* Device to be notified */
4115816b343SBob Moore 	struct acpi_gpe_notify_info *next;
4125816b343SBob Moore };
4135816b343SBob Moore 
414981858bdSRafael J. Wysocki struct acpi_gpe_notify_object {
415981858bdSRafael J. Wysocki 	struct acpi_namespace_node *node;
416981858bdSRafael J. Wysocki 	struct acpi_gpe_notify_object *next;
417981858bdSRafael J. Wysocki };
418981858bdSRafael J. Wysocki 
419e2f7a777SLen Brown union acpi_gpe_dispatch_info {
420e2f7a777SLen Brown 	struct acpi_namespace_node *method_node;	/* Method node for this GPE level */
4218b6cd8adSLin Ming 	struct acpi_gpe_handler_info *handler;  /* Installed GPE handler */
4225816b343SBob Moore 	struct acpi_gpe_notify_info *notify_list;	/* List of _PRW devices for implicit notifies */
423e2f7a777SLen Brown };
424e2f7a777SLen Brown 
425e2f7a777SLen Brown /*
426e2f7a777SLen Brown  * Information about a GPE, one per each GPE in an array.
427e2f7a777SLen Brown  * NOTE: Important to keep this struct as small as possible.
428e2f7a777SLen Brown  */
429e2f7a777SLen Brown struct acpi_gpe_event_info {
4305816b343SBob Moore 	union acpi_gpe_dispatch_info dispatch;	/* Either Method, Handler, or notify_list */
431e2f7a777SLen Brown 	struct acpi_gpe_register_info *register_info;	/* Backpointer to register info */
432e2f7a777SLen Brown 	u8 flags;		/* Misc info about this GPE */
433e2f7a777SLen Brown 	u8 gpe_number;		/* This GPE */
4340f849d2cSLin Ming 	u8 runtime_count;	/* References to a run GPE */
435e2f7a777SLen Brown };
436e2f7a777SLen Brown 
437e2f7a777SLen Brown /* Information about a GPE register pair, one per each status/enable pair in an array */
438e2f7a777SLen Brown 
439e2f7a777SLen Brown struct acpi_gpe_register_info {
440e2f7a777SLen Brown 	struct acpi_generic_address status_address;	/* Address of status reg */
441e2f7a777SLen Brown 	struct acpi_generic_address enable_address;	/* Address of enable reg */
442e2f7a777SLen Brown 	u8 enable_for_wake;	/* GPEs to keep enabled when sleeping */
443e2f7a777SLen Brown 	u8 enable_for_run;	/* GPEs to keep enabled when running */
444e2f7a777SLen Brown 	u8 base_gpe_number;	/* Base GPE number for this register */
445e2f7a777SLen Brown };
446e2f7a777SLen Brown 
447e2f7a777SLen Brown /*
448e2f7a777SLen Brown  * Information about a GPE register block, one per each installed block --
449e2f7a777SLen Brown  * GPE0, GPE1, and one per each installed GPE Block Device.
450e2f7a777SLen Brown  */
451e2f7a777SLen Brown struct acpi_gpe_block_info {
452e2f7a777SLen Brown 	struct acpi_namespace_node *node;
453e2f7a777SLen Brown 	struct acpi_gpe_block_info *previous;
454e2f7a777SLen Brown 	struct acpi_gpe_block_info *next;
455e2f7a777SLen Brown 	struct acpi_gpe_xrupt_info *xrupt_block;	/* Backpointer to interrupt block */
456e2f7a777SLen Brown 	struct acpi_gpe_register_info *register_info;	/* One per GPE register pair */
457e2f7a777SLen Brown 	struct acpi_gpe_event_info *event_info;	/* One for each GPE */
458e2f7a777SLen Brown 	struct acpi_generic_address block_address;	/* Base address of the block */
459e2f7a777SLen Brown 	u32 register_count;	/* Number of register pairs in block */
4600f849d2cSLin Ming 	u16 gpe_count;		/* Number of individual GPEs in block */
461e2f7a777SLen Brown 	u8 block_base_number;	/* Base GPE number for this block */
4623a37898dSLin Ming 	u8 initialized;         /* TRUE if this block is initialized */
463e2f7a777SLen Brown };
464e2f7a777SLen Brown 
465e2f7a777SLen Brown /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
466e2f7a777SLen Brown 
467e2f7a777SLen Brown struct acpi_gpe_xrupt_info {
468e2f7a777SLen Brown 	struct acpi_gpe_xrupt_info *previous;
469e2f7a777SLen Brown 	struct acpi_gpe_xrupt_info *next;
470e2f7a777SLen Brown 	struct acpi_gpe_block_info *gpe_block_list_head;	/* List of GPE blocks for this xrupt */
471e2f7a777SLen Brown 	u32 interrupt_number;	/* System interrupt number */
472e2f7a777SLen Brown };
473e2f7a777SLen Brown 
474e2f7a777SLen Brown struct acpi_gpe_walk_info {
475e2f7a777SLen Brown 	struct acpi_namespace_node *gpe_device;
476e2f7a777SLen Brown 	struct acpi_gpe_block_info *gpe_block;
477186c307fSBob Moore 	u16 count;
478186c307fSBob Moore 	acpi_owner_id owner_id;
479186c307fSBob Moore 	u8 execute_by_owner_id;
480e2f7a777SLen Brown };
481e2f7a777SLen Brown 
482e2f7a777SLen Brown struct acpi_gpe_device_info {
483e2f7a777SLen Brown 	u32 index;
484e2f7a777SLen Brown 	u32 next_block_base_index;
485e2f7a777SLen Brown 	acpi_status status;
486e2f7a777SLen Brown 	struct acpi_namespace_node *gpe_device;
487e2f7a777SLen Brown };
488e2f7a777SLen Brown 
489e2f7a777SLen Brown typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info,
490e2f7a777SLen Brown 		struct acpi_gpe_block_info *gpe_block, void *context);
491e2f7a777SLen Brown 
492e2f7a777SLen Brown /* Information about each particular fixed event */
493e2f7a777SLen Brown 
494e2f7a777SLen Brown struct acpi_fixed_event_handler {
495e2f7a777SLen Brown 	acpi_event_handler handler;	/* Address of handler. */
496e2f7a777SLen Brown 	void *context;		/* Context to be passed to handler */
497e2f7a777SLen Brown };
498e2f7a777SLen Brown 
499e2f7a777SLen Brown struct acpi_fixed_event_info {
500e2f7a777SLen Brown 	u8 status_register_id;
501e2f7a777SLen Brown 	u8 enable_register_id;
502e2f7a777SLen Brown 	u16 status_bit_mask;
503e2f7a777SLen Brown 	u16 enable_bit_mask;
504e2f7a777SLen Brown };
505e2f7a777SLen Brown 
506e2f7a777SLen Brown /* Information used during field processing */
507e2f7a777SLen Brown 
508e2f7a777SLen Brown struct acpi_field_info {
509e2f7a777SLen Brown 	u8 skip_field;
510e2f7a777SLen Brown 	u8 field_flag;
511e2f7a777SLen Brown 	u32 pkg_length;
512e2f7a777SLen Brown };
513e2f7a777SLen Brown 
514e2f7a777SLen Brown /*****************************************************************************
515e2f7a777SLen Brown  *
516e2f7a777SLen Brown  * Generic "state" object for stacks
517e2f7a777SLen Brown  *
518e2f7a777SLen Brown  ****************************************************************************/
519e2f7a777SLen Brown 
520e2f7a777SLen Brown #define ACPI_CONTROL_NORMAL                  0xC0
521e2f7a777SLen Brown #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
522e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
523e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
524e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
525e2f7a777SLen Brown 
526e2f7a777SLen Brown #define ACPI_STATE_COMMON \
527e2f7a777SLen Brown 	void                            *next; \
528e2f7a777SLen Brown 	u8                              descriptor_type; /* To differentiate various internal objs */\
529e2f7a777SLen Brown 	u8                              flags; \
530e2f7a777SLen Brown 	u16                             value; \
531e2f7a777SLen Brown 	u16                             state;
532e2f7a777SLen Brown 
533e2f7a777SLen Brown 	/* There are 2 bytes available here until the next natural alignment boundary */
534e2f7a777SLen Brown 
535e2f7a777SLen Brown struct acpi_common_state {
536e2f7a777SLen Brown ACPI_STATE_COMMON};
537e2f7a777SLen Brown 
538e2f7a777SLen Brown /*
539e2f7a777SLen Brown  * Update state - used to traverse complex objects such as packages
540e2f7a777SLen Brown  */
541e2f7a777SLen Brown struct acpi_update_state {
542e2f7a777SLen Brown 	ACPI_STATE_COMMON union acpi_operand_object *object;
543e2f7a777SLen Brown };
544e2f7a777SLen Brown 
545e2f7a777SLen Brown /*
546e2f7a777SLen Brown  * Pkg state - used to traverse nested package structures
547e2f7a777SLen Brown  */
548e2f7a777SLen Brown struct acpi_pkg_state {
549e2f7a777SLen Brown 	ACPI_STATE_COMMON u16 index;
550e2f7a777SLen Brown 	union acpi_operand_object *source_object;
551e2f7a777SLen Brown 	union acpi_operand_object *dest_object;
552e2f7a777SLen Brown 	struct acpi_walk_state *walk_state;
553e2f7a777SLen Brown 	void *this_target_obj;
554e2f7a777SLen Brown 	u32 num_packages;
555e2f7a777SLen Brown };
556e2f7a777SLen Brown 
557e2f7a777SLen Brown /*
558e2f7a777SLen Brown  * Control state - one per if/else and while constructs.
559e2f7a777SLen Brown  * Allows nesting of these constructs
560e2f7a777SLen Brown  */
561e2f7a777SLen Brown struct acpi_control_state {
562e2f7a777SLen Brown 	ACPI_STATE_COMMON u16 opcode;
563e2f7a777SLen Brown 	union acpi_parse_object *predicate_op;
564e2f7a777SLen Brown 	u8 *aml_predicate_start;	/* Start of if/while predicate */
565e2f7a777SLen Brown 	u8 *package_end;	/* End of if/while block */
566e2f7a777SLen Brown 	u32 loop_count;		/* While() loop counter */
567e2f7a777SLen Brown };
568e2f7a777SLen Brown 
569e2f7a777SLen Brown /*
570e2f7a777SLen Brown  * Scope state - current scope during namespace lookups
571e2f7a777SLen Brown  */
572e2f7a777SLen Brown struct acpi_scope_state {
573e2f7a777SLen Brown 	ACPI_STATE_COMMON struct acpi_namespace_node *node;
574e2f7a777SLen Brown };
575e2f7a777SLen Brown 
576e2f7a777SLen Brown struct acpi_pscope_state {
577e2f7a777SLen Brown 	ACPI_STATE_COMMON u32 arg_count;	/* Number of fixed arguments */
578e2f7a777SLen Brown 	union acpi_parse_object *op;	/* Current op being parsed */
579e2f7a777SLen Brown 	u8 *arg_end;		/* Current argument end */
580e2f7a777SLen Brown 	u8 *pkg_end;		/* Current package end */
581e2f7a777SLen Brown 	u32 arg_list;		/* Next argument to parse */
582e2f7a777SLen Brown };
583e2f7a777SLen Brown 
584e2f7a777SLen Brown /*
585e2f7a777SLen Brown  * Thread state - one per thread across multiple walk states.  Multiple walk
586e2f7a777SLen Brown  * states are created when there are nested control methods executing.
587e2f7a777SLen Brown  */
588e2f7a777SLen Brown struct acpi_thread_state {
589e2f7a777SLen Brown 	ACPI_STATE_COMMON u8 current_sync_level;	/* Mutex Sync (nested acquire) level */
590e2f7a777SLen Brown 	struct acpi_walk_state *walk_state_list;	/* Head of list of walk_states for this thread */
591e2f7a777SLen Brown 	union acpi_operand_object *acquired_mutex_list;	/* List of all currently acquired mutexes */
592e2f7a777SLen Brown 	acpi_thread_id thread_id;	/* Running thread ID */
593e2f7a777SLen Brown };
594e2f7a777SLen Brown 
595e2f7a777SLen Brown /*
596e2f7a777SLen Brown  * Result values - used to accumulate the results of nested
597e2f7a777SLen Brown  * AML arguments
598e2f7a777SLen Brown  */
599e2f7a777SLen Brown struct acpi_result_values {
600e2f7a777SLen Brown 	ACPI_STATE_COMMON
601e2f7a777SLen Brown 	    union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
602e2f7a777SLen Brown };
603e2f7a777SLen Brown 
604e2f7a777SLen Brown typedef
605e2f7a777SLen Brown acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
606e2f7a777SLen Brown 				    union acpi_parse_object ** out_op);
607e2f7a777SLen Brown 
608e2f7a777SLen Brown typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
609e2f7a777SLen Brown 
61086ed4bc8SBob Moore /* Global handlers for AML Notifies */
61186ed4bc8SBob Moore 
61286ed4bc8SBob Moore struct acpi_global_notify_handler {
61386ed4bc8SBob Moore 	acpi_notify_handler handler;
61486ed4bc8SBob Moore 	void *context;
61586ed4bc8SBob Moore };
61686ed4bc8SBob Moore 
617e2f7a777SLen Brown /*
618e2f7a777SLen Brown  * Notify info - used to pass info to the deferred notify
619e2f7a777SLen Brown  * handler/dispatcher.
620e2f7a777SLen Brown  */
621e2f7a777SLen Brown struct acpi_notify_info {
62286ed4bc8SBob Moore 	ACPI_STATE_COMMON u8 handler_list_id;
62386ed4bc8SBob Moore 	struct acpi_namespace_node *node;
62486ed4bc8SBob Moore 	union acpi_operand_object *handler_list_head;
62586ed4bc8SBob Moore 	struct acpi_global_notify_handler *global;
626e2f7a777SLen Brown };
627e2f7a777SLen Brown 
628e2f7a777SLen Brown /* Generic state is union of structs above */
629e2f7a777SLen Brown 
630e2f7a777SLen Brown union acpi_generic_state {
631e2f7a777SLen Brown 	struct acpi_common_state common;
632e2f7a777SLen Brown 	struct acpi_control_state control;
633e2f7a777SLen Brown 	struct acpi_update_state update;
634e2f7a777SLen Brown 	struct acpi_scope_state scope;
635e2f7a777SLen Brown 	struct acpi_pscope_state parse_scope;
636e2f7a777SLen Brown 	struct acpi_pkg_state pkg;
637e2f7a777SLen Brown 	struct acpi_thread_state thread;
638e2f7a777SLen Brown 	struct acpi_result_values results;
639e2f7a777SLen Brown 	struct acpi_notify_info notify;
640e2f7a777SLen Brown };
641e2f7a777SLen Brown 
642e2f7a777SLen Brown /*****************************************************************************
643e2f7a777SLen Brown  *
644e2f7a777SLen Brown  * Interpreter typedefs and structs
645e2f7a777SLen Brown  *
646e2f7a777SLen Brown  ****************************************************************************/
647e2f7a777SLen Brown 
648e2f7a777SLen Brown typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
649e2f7a777SLen Brown 
650f654c0feSLin Ming /* Address Range info block */
651f654c0feSLin Ming 
652f654c0feSLin Ming struct acpi_address_range {
653f654c0feSLin Ming 	struct acpi_address_range *next;
654f654c0feSLin Ming 	struct acpi_namespace_node *region_node;
655f654c0feSLin Ming 	acpi_physical_address start_address;
656f654c0feSLin Ming 	acpi_physical_address end_address;
657f654c0feSLin Ming };
658f654c0feSLin Ming 
659e2f7a777SLen Brown /*****************************************************************************
660e2f7a777SLen Brown  *
661e2f7a777SLen Brown  * Parser typedefs and structs
662e2f7a777SLen Brown  *
663e2f7a777SLen Brown  ****************************************************************************/
664e2f7a777SLen Brown 
665e2f7a777SLen Brown /*
666e2f7a777SLen Brown  * AML opcode, name, and argument layout
667e2f7a777SLen Brown  */
668e2f7a777SLen Brown struct acpi_opcode_info {
669e2f7a777SLen Brown #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
670e2f7a777SLen Brown 	char *name;		/* Opcode name (disassembler/debug only) */
671e2f7a777SLen Brown #endif
672e2f7a777SLen Brown 	u32 parse_args;		/* Grammar/Parse time arguments */
673e2f7a777SLen Brown 	u32 runtime_args;	/* Interpret time arguments */
674e2f7a777SLen Brown 	u16 flags;		/* Misc flags */
675e2f7a777SLen Brown 	u8 object_type;		/* Corresponding internal object type */
676e2f7a777SLen Brown 	u8 class;		/* Opcode class */
677e2f7a777SLen Brown 	u8 type;		/* Opcode type */
678e2f7a777SLen Brown };
679e2f7a777SLen Brown 
680e2f7a777SLen Brown union acpi_parse_value {
6815df7e6cbSBob Moore 	u64 integer;		/* Integer constant (Up to 64 bits) */
682e2f7a777SLen Brown 	u32 size;		/* bytelist or field size */
683e2f7a777SLen Brown 	char *string;		/* NULL terminated string */
684e2f7a777SLen Brown 	u8 *buffer;		/* buffer or string */
685e2f7a777SLen Brown 	char *name;		/* NULL terminated string */
686e2f7a777SLen Brown 	union acpi_parse_object *arg;	/* arguments and contained ops */
687e2f7a777SLen Brown };
688e2f7a777SLen Brown 
689e2f7a777SLen Brown #ifdef ACPI_DISASSEMBLER
690e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
691e2f7a777SLen Brown #else
692e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a)
693e2f7a777SLen Brown #endif
694e2f7a777SLen Brown 
695e2f7a777SLen Brown #define ACPI_PARSE_COMMON \
696e2f7a777SLen Brown 	union acpi_parse_object         *parent;        /* Parent op */\
697e2f7a777SLen Brown 	u8                              descriptor_type; /* To differentiate various internal objs */\
698e2f7a777SLen Brown 	u8                              flags;          /* Type of Op */\
699e2f7a777SLen Brown 	u16                             aml_opcode;     /* AML opcode */\
700e2f7a777SLen Brown 	u32                             aml_offset;     /* Offset of declaration in AML */\
701e2f7a777SLen Brown 	union acpi_parse_object         *next;          /* Next op */\
702e2f7a777SLen Brown 	struct acpi_namespace_node      *node;          /* For use by interpreter */\
703e2f7a777SLen Brown 	union acpi_parse_value          value;          /* Value or args associated with the opcode */\
704e2f7a777SLen Brown 	u8                              arg_list_length; /* Number of elements in the arg list */\
705e2f7a777SLen Brown 	ACPI_DISASM_ONLY_MEMBERS (\
706e2f7a777SLen Brown 	u8                              disasm_flags;   /* Used during AML disassembly */\
707e2f7a777SLen Brown 	u8                              disasm_opcode;  /* Subtype used for disassembly */\
708e2f7a777SLen Brown 	char                            aml_op_name[16])	/* Op name (debug only) */
709e2f7a777SLen Brown 
710*be030a57SBob Moore /* Flags for disasm_flags field above */
711*be030a57SBob Moore 
712*be030a57SBob Moore #define ACPI_DASM_BUFFER                0x00	/* Buffer is a simple data buffer */
713*be030a57SBob Moore #define ACPI_DASM_RESOURCE              0x01	/* Buffer is a Resource Descriptor */
714*be030a57SBob Moore #define ACPI_DASM_STRING                0x02	/* Buffer is a ASCII string */
715*be030a57SBob Moore #define ACPI_DASM_UNICODE               0x03	/* Buffer is a Unicode string */
716*be030a57SBob Moore #define ACPI_DASM_PLD_METHOD            0x04	/* Buffer is a _PLD method bit-packed buffer */
717*be030a57SBob Moore #define ACPI_DASM_EISAID                0x05	/* Integer is an EISAID */
718*be030a57SBob Moore #define ACPI_DASM_MATCHOP               0x06	/* Parent opcode is a Match() operator */
719*be030a57SBob Moore #define ACPI_DASM_LNOT_PREFIX           0x07	/* Start of a Lnot_equal (etc.) pair of opcodes */
720*be030a57SBob Moore #define ACPI_DASM_LNOT_SUFFIX           0x08	/* End  of a Lnot_equal (etc.) pair of opcodes */
721*be030a57SBob Moore #define ACPI_DASM_IGNORE                0x09	/* Not used at this time */
722e2f7a777SLen Brown 
723e2f7a777SLen Brown /*
724e2f7a777SLen Brown  * Generic operation (for example:  If, While, Store)
725e2f7a777SLen Brown  */
726e2f7a777SLen Brown struct acpi_parse_obj_common {
727e2f7a777SLen Brown ACPI_PARSE_COMMON};
728e2f7a777SLen Brown 
729e2f7a777SLen Brown /*
730e2f7a777SLen Brown  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
731e2f7a777SLen Brown  * and bytelists.
732e2f7a777SLen Brown  */
733e2f7a777SLen Brown struct acpi_parse_obj_named {
734e2f7a777SLen Brown 	ACPI_PARSE_COMMON u8 *path;
735e2f7a777SLen Brown 	u8 *data;		/* AML body or bytelist data */
736e2f7a777SLen Brown 	u32 length;		/* AML length */
737e2f7a777SLen Brown 	u32 name;		/* 4-byte name or zero if no name */
738e2f7a777SLen Brown };
739e2f7a777SLen Brown 
740ba494beeSBob Moore /* This version is used by the iASL compiler only */
741e2f7a777SLen Brown 
742e2f7a777SLen Brown #define ACPI_MAX_PARSEOP_NAME   20
743e2f7a777SLen Brown 
744e2f7a777SLen Brown struct acpi_parse_obj_asl {
745e2f7a777SLen Brown 	ACPI_PARSE_COMMON union acpi_parse_object *child;
746e2f7a777SLen Brown 	union acpi_parse_object *parent_method;
747e2f7a777SLen Brown 	char *filename;
748e2f7a777SLen Brown 	char *external_name;
749e2f7a777SLen Brown 	char *namepath;
750e2f7a777SLen Brown 	char name_seg[4];
751e2f7a777SLen Brown 	u32 extra_value;
752e2f7a777SLen Brown 	u32 column;
753e2f7a777SLen Brown 	u32 line_number;
754e2f7a777SLen Brown 	u32 logical_line_number;
755e2f7a777SLen Brown 	u32 logical_byte_offset;
756e2f7a777SLen Brown 	u32 end_line;
757e2f7a777SLen Brown 	u32 end_logical_line;
758e2f7a777SLen Brown 	u32 acpi_btype;
759e2f7a777SLen Brown 	u32 aml_length;
760e2f7a777SLen Brown 	u32 aml_subtree_length;
761e2f7a777SLen Brown 	u32 final_aml_length;
762e2f7a777SLen Brown 	u32 final_aml_offset;
763e2f7a777SLen Brown 	u32 compile_flags;
764e2f7a777SLen Brown 	u16 parse_opcode;
765e2f7a777SLen Brown 	u8 aml_opcode_length;
766e2f7a777SLen Brown 	u8 aml_pkg_len_bytes;
767e2f7a777SLen Brown 	u8 extra;
768e2f7a777SLen Brown 	char parse_op_name[ACPI_MAX_PARSEOP_NAME];
769e2f7a777SLen Brown };
770e2f7a777SLen Brown 
771e2f7a777SLen Brown union acpi_parse_object {
772e2f7a777SLen Brown 	struct acpi_parse_obj_common common;
773e2f7a777SLen Brown 	struct acpi_parse_obj_named named;
774e2f7a777SLen Brown 	struct acpi_parse_obj_asl asl;
775e2f7a777SLen Brown };
776e2f7a777SLen Brown 
777e2f7a777SLen Brown /*
778e2f7a777SLen Brown  * Parse state - one state per parser invocation and each control
779e2f7a777SLen Brown  * method.
780e2f7a777SLen Brown  */
781e2f7a777SLen Brown struct acpi_parse_state {
782e2f7a777SLen Brown 	u8 *aml_start;		/* First AML byte */
783e2f7a777SLen Brown 	u8 *aml;		/* Next AML byte */
784e2f7a777SLen Brown 	u8 *aml_end;		/* (last + 1) AML byte */
785e2f7a777SLen Brown 	u8 *pkg_start;		/* Current package begin */
786e2f7a777SLen Brown 	u8 *pkg_end;		/* Current package end */
787e2f7a777SLen Brown 	union acpi_parse_object *start_op;	/* Root of parse tree */
788e2f7a777SLen Brown 	struct acpi_namespace_node *start_node;
789e2f7a777SLen Brown 	union acpi_generic_state *scope;	/* Current scope */
790e2f7a777SLen Brown 	union acpi_parse_object *start_scope;
791e2f7a777SLen Brown 	u32 aml_size;
792e2f7a777SLen Brown };
793e2f7a777SLen Brown 
794e2f7a777SLen Brown /* Parse object flags */
795e2f7a777SLen Brown 
796e2f7a777SLen Brown #define ACPI_PARSEOP_GENERIC            0x01
797e2f7a777SLen Brown #define ACPI_PARSEOP_NAMED              0x02
798e2f7a777SLen Brown #define ACPI_PARSEOP_DEFERRED           0x04
799e2f7a777SLen Brown #define ACPI_PARSEOP_BYTELIST           0x08
800e2f7a777SLen Brown #define ACPI_PARSEOP_IN_STACK           0x10
801e2f7a777SLen Brown #define ACPI_PARSEOP_TARGET             0x20
802e2f7a777SLen Brown #define ACPI_PARSEOP_IN_CACHE           0x80
803e2f7a777SLen Brown 
804e2f7a777SLen Brown /* Parse object disasm_flags */
805e2f7a777SLen Brown 
806e2f7a777SLen Brown #define ACPI_PARSEOP_IGNORE             0x01
807e2f7a777SLen Brown #define ACPI_PARSEOP_PARAMLIST          0x02
808e2f7a777SLen Brown #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
80940cdb368SBob Moore #define ACPI_PARSEOP_PREDEF_CHECKED     0x08
810e2f7a777SLen Brown #define ACPI_PARSEOP_SPECIAL            0x10
811e2f7a777SLen Brown 
812e2f7a777SLen Brown /*****************************************************************************
813e2f7a777SLen Brown  *
814e2f7a777SLen Brown  * Hardware (ACPI registers) and PNP
815e2f7a777SLen Brown  *
816e2f7a777SLen Brown  ****************************************************************************/
817e2f7a777SLen Brown 
818e2f7a777SLen Brown struct acpi_bit_register_info {
819e2f7a777SLen Brown 	u8 parent_register;
820e2f7a777SLen Brown 	u8 bit_position;
821e2f7a777SLen Brown 	u16 access_bit_mask;
822e2f7a777SLen Brown };
823e2f7a777SLen Brown 
824e2f7a777SLen Brown /*
825e2f7a777SLen Brown  * Some ACPI registers have bits that must be ignored -- meaning that they
826e2f7a777SLen Brown  * must be preserved.
827e2f7a777SLen Brown  */
828e2f7a777SLen Brown #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800	/* Bit 11 */
82920869dcfSBob Moore 
830c3dd25f4SLin Ming /* Write-only bits must be zeroed by software */
831c3dd25f4SLin Ming 
832c3dd25f4SLin Ming #define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004	/* Bits 13, 2 */
833c3dd25f4SLin Ming 
83420869dcfSBob Moore /* For control registers, both ignored and reserved bits must be preserved */
83520869dcfSBob Moore 
836975b3c47SLin Ming /*
837b1cd843bSBob Moore  * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
838b1cd843bSBob Moore  * ACPI specification to be a "preserved" bit - "OSPM always preserves this
839b1cd843bSBob Moore  * bit position", section 4.7.3.2.1. However, on some machines the OS must
840b1cd843bSBob Moore  * write a one to this bit after resume for the machine to work properly.
841b1cd843bSBob Moore  * To enable this, we no longer attempt to preserve this bit. No machines
842b1cd843bSBob Moore  * are known to fail if the bit is not preserved. (May 2009)
843975b3c47SLin Ming  */
844b1cd843bSBob Moore #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200	/* Bit 9 */
84520869dcfSBob Moore #define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8	/* Bits 14-15, 3-8 */
84620869dcfSBob Moore #define ACPI_PM1_CONTROL_PRESERVED_BITS \
84720869dcfSBob Moore 	       (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
84820869dcfSBob Moore 
84920869dcfSBob Moore #define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE	/* All except bit 0 */
850e2f7a777SLen Brown 
851e2f7a777SLen Brown /*
852e2f7a777SLen Brown  * Register IDs
853e2f7a777SLen Brown  * These are the full ACPI registers
854e2f7a777SLen Brown  */
855e2f7a777SLen Brown #define ACPI_REGISTER_PM1_STATUS                0x01
856e2f7a777SLen Brown #define ACPI_REGISTER_PM1_ENABLE                0x02
857e2f7a777SLen Brown #define ACPI_REGISTER_PM1_CONTROL               0x03
85832c9ef99SBob Moore #define ACPI_REGISTER_PM2_CONTROL               0x04
85932c9ef99SBob Moore #define ACPI_REGISTER_PM_TIMER                  0x05
86032c9ef99SBob Moore #define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
86132c9ef99SBob Moore #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
862e2f7a777SLen Brown 
863e2f7a777SLen Brown /* Masks used to access the bit_registers */
864e2f7a777SLen Brown 
865e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_STATUS               0x0001
866e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
867e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
868e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
869e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
870e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
871e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000	/* ACPI 3.0 */
872e2f7a777SLen Brown #define ACPI_BITMASK_WAKE_STATUS                0x8000
873e2f7a777SLen Brown 
874e2f7a777SLen Brown #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
875e2f7a777SLen Brown 	ACPI_BITMASK_TIMER_STATUS          | \
876e2f7a777SLen Brown 	ACPI_BITMASK_BUS_MASTER_STATUS     | \
877e2f7a777SLen Brown 	ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
878e2f7a777SLen Brown 	ACPI_BITMASK_POWER_BUTTON_STATUS   | \
879e2f7a777SLen Brown 	ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
880e2f7a777SLen Brown 	ACPI_BITMASK_RT_CLOCK_STATUS       | \
88149b3c1e0SColin Ian King 	ACPI_BITMASK_PCIEXP_WAKE_STATUS    | \
882e2f7a777SLen Brown 	ACPI_BITMASK_WAKE_STATUS)
883e2f7a777SLen Brown 
884e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_ENABLE               0x0001
885e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
886e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
887e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
888e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
889e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000	/* ACPI 3.0 */
890e2f7a777SLen Brown 
891e2f7a777SLen Brown #define ACPI_BITMASK_SCI_ENABLE                 0x0001
892e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
893e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
89482d79b86SBob Moore #define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
895e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
896e2f7a777SLen Brown 
897e2f7a777SLen Brown #define ACPI_BITMASK_ARB_DISABLE                0x0001
898e2f7a777SLen Brown 
899e2f7a777SLen Brown /* Raw bit position of each bit_register */
900e2f7a777SLen Brown 
901e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_STATUS           0x00
902e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
903e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
904e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
905e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
906e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
907e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E	/* ACPI 3.0 */
908e2f7a777SLen Brown #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
909e2f7a777SLen Brown 
910e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
911e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
912e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
913e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
914e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
915e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E	/* ACPI 3.0 */
916e2f7a777SLen Brown 
917e2f7a777SLen Brown #define ACPI_BITPOSITION_SCI_ENABLE             0x00
918e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
919e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
92082d79b86SBob Moore #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
921e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
922e2f7a777SLen Brown 
923e2f7a777SLen Brown #define ACPI_BITPOSITION_ARB_DISABLE            0x00
924e2f7a777SLen Brown 
9257f071903SBob Moore /* Structs and definitions for _OSI support and I/O port validation */
9267f071903SBob Moore 
9277f071903SBob Moore #define ACPI_OSI_WIN_2000               0x01
9287f071903SBob Moore #define ACPI_OSI_WIN_XP                 0x02
9297f071903SBob Moore #define ACPI_OSI_WIN_XP_SP1             0x03
9307f071903SBob Moore #define ACPI_OSI_WINSRV_2003            0x04
9317f071903SBob Moore #define ACPI_OSI_WIN_XP_SP2             0x05
9327f071903SBob Moore #define ACPI_OSI_WINSRV_2003_SP1        0x06
9337f071903SBob Moore #define ACPI_OSI_WIN_VISTA              0x07
934eb752552SBob Moore #define ACPI_OSI_WINSRV_2008            0x08
935eb752552SBob Moore #define ACPI_OSI_WIN_VISTA_SP1          0x09
93623ebbf07SBob Moore #define ACPI_OSI_WIN_VISTA_SP2          0x0A
93723ebbf07SBob Moore #define ACPI_OSI_WIN_7                  0x0B
938a57f7f91SBob Moore #define ACPI_OSI_WIN_8                  0x0C
9397f071903SBob Moore 
9407f071903SBob Moore #define ACPI_ALWAYS_ILLEGAL             0x00
9417f071903SBob Moore 
9427f071903SBob Moore struct acpi_interface_info {
9437f071903SBob Moore 	char *name;
944b0ed7a91SLin Ming 	struct acpi_interface_info *next;
945b0ed7a91SLin Ming 	u8 flags;
9467f071903SBob Moore 	u8 value;
9477f071903SBob Moore };
9487f071903SBob Moore 
949b0ed7a91SLin Ming #define ACPI_OSI_INVALID                0x01
950b0ed7a91SLin Ming #define ACPI_OSI_DYNAMIC                0x02
951b0ed7a91SLin Ming 
9527f071903SBob Moore struct acpi_port_info {
9537f071903SBob Moore 	char *name;
9547f071903SBob Moore 	u16 start;
9557f071903SBob Moore 	u16 end;
9567f071903SBob Moore 	u8 osi_dependency;
9577f071903SBob Moore };
9587f071903SBob Moore 
959e2f7a777SLen Brown /*****************************************************************************
960e2f7a777SLen Brown  *
961e2f7a777SLen Brown  * Resource descriptors
962e2f7a777SLen Brown  *
963e2f7a777SLen Brown  ****************************************************************************/
964e2f7a777SLen Brown 
965e2f7a777SLen Brown /* resource_type values */
966e2f7a777SLen Brown 
967e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
968e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_IO_RANGE              1
969e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
970e2f7a777SLen Brown 
971e2f7a777SLen Brown /* Resource descriptor types and masks */
972e2f7a777SLen Brown 
973e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE                0x80
974e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL                0x00
975e2f7a777SLen Brown 
976e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78	/* Bits 6:3 contain the type */
977e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07	/* Bits 2:0 contain the length */
978e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F	/* Bits 6:0 contain the type */
979e2f7a777SLen Brown 
980e2f7a777SLen Brown /*
981e2f7a777SLen Brown  * Small resource descriptor "names" as defined by the ACPI specification.
982e2f7a777SLen Brown  * Note: Bits 2:0 are used for the descriptor length
983e2f7a777SLen Brown  */
984e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IRQ                  0x20
985e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_DMA                  0x28
986e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
987e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
988e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IO                   0x40
989e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
990e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_FIXED_DMA            0x50
991e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
992e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
993e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
994e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
995e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_TAG              0x78
996e2f7a777SLen Brown 
997e2f7a777SLen Brown /*
998e2f7a777SLen Brown  * Large resource descriptor "names" as defined by the ACPI specification.
999e2f7a777SLen Brown  * Note: includes the Large Descriptor bit in bit[7]
1000e2f7a777SLen Brown  */
1001e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1002e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1003e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1004e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1005e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1006e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1007e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1008e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1009e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1010e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1011e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1012e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_GPIO                 0x8C
1013e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
1014e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
1015e2f7a777SLen Brown 
1016e2f7a777SLen Brown /*****************************************************************************
1017e2f7a777SLen Brown  *
1018e2f7a777SLen Brown  * Miscellaneous
1019e2f7a777SLen Brown  *
1020e2f7a777SLen Brown  ****************************************************************************/
1021e2f7a777SLen Brown 
1022e2f7a777SLen Brown #define ACPI_ASCII_ZERO                 0x30
1023e2f7a777SLen Brown 
1024e2f7a777SLen Brown /*****************************************************************************
1025e2f7a777SLen Brown  *
1026e2f7a777SLen Brown  * Debugger
1027e2f7a777SLen Brown  *
1028e2f7a777SLen Brown  ****************************************************************************/
1029e2f7a777SLen Brown 
1030e2f7a777SLen Brown struct acpi_db_method_info {
1031*be030a57SBob Moore 	acpi_handle method;
1032e2f7a777SLen Brown 	acpi_handle main_thread_gate;
1033e2f7a777SLen Brown 	acpi_handle thread_complete_gate;
103428eb3fcfSLin Ming 	acpi_thread_id *threads;
1035e2f7a777SLen Brown 	u32 num_threads;
1036e2f7a777SLen Brown 	u32 num_created;
1037e2f7a777SLen Brown 	u32 num_completed;
1038e2f7a777SLen Brown 
1039e2f7a777SLen Brown 	char *name;
1040e2f7a777SLen Brown 	u32 flags;
1041e2f7a777SLen Brown 	u32 num_loops;
1042e2f7a777SLen Brown 	char pathname[128];
1043e2f7a777SLen Brown 	char **args;
1044e2f7a777SLen Brown 
1045e2f7a777SLen Brown 	/*
1046e2f7a777SLen Brown 	 * Arguments to be passed to method for the command
1047e2f7a777SLen Brown 	 * Threads -
1048e2f7a777SLen Brown 	 *   the Number of threads, ID of current thread and
1049e2f7a777SLen Brown 	 *   Index of current thread inside all them created.
1050e2f7a777SLen Brown 	 */
1051e2f7a777SLen Brown 	char init_args;
1052e2f7a777SLen Brown 	char *arguments[4];
1053e2f7a777SLen Brown 	char num_threads_str[11];
1054e2f7a777SLen Brown 	char id_of_thread_str[11];
1055e2f7a777SLen Brown 	char index_of_thread_str[11];
1056e2f7a777SLen Brown };
1057e2f7a777SLen Brown 
1058e2f7a777SLen Brown struct acpi_integrity_info {
1059e2f7a777SLen Brown 	u32 nodes;
1060e2f7a777SLen Brown 	u32 objects;
1061e2f7a777SLen Brown };
1062e2f7a777SLen Brown 
1063e2f7a777SLen Brown #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1064e2f7a777SLen Brown #define ACPI_DB_CONSOLE_OUTPUT          0x02
1065e2f7a777SLen Brown #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1066e2f7a777SLen Brown 
1067e2f7a777SLen Brown /*****************************************************************************
1068e2f7a777SLen Brown  *
1069e2f7a777SLen Brown  * Debug
1070e2f7a777SLen Brown  *
1071e2f7a777SLen Brown  ****************************************************************************/
1072e2f7a777SLen Brown 
1073e2f7a777SLen Brown /* Entry for a memory allocation (debug only) */
1074e2f7a777SLen Brown 
1075e2f7a777SLen Brown #define ACPI_MEM_MALLOC                 0
1076e2f7a777SLen Brown #define ACPI_MEM_CALLOC                 1
1077e2f7a777SLen Brown #define ACPI_MAX_MODULE_NAME            16
1078e2f7a777SLen Brown 
1079e2f7a777SLen Brown #define ACPI_COMMON_DEBUG_MEM_HEADER \
1080e2f7a777SLen Brown 	struct acpi_debug_mem_block     *previous; \
1081e2f7a777SLen Brown 	struct acpi_debug_mem_block     *next; \
1082e2f7a777SLen Brown 	u32                             size; \
1083e2f7a777SLen Brown 	u32                             component; \
1084e2f7a777SLen Brown 	u32                             line; \
1085e2f7a777SLen Brown 	char                            module[ACPI_MAX_MODULE_NAME]; \
1086e2f7a777SLen Brown 	u8                              alloc_type;
1087e2f7a777SLen Brown 
1088e2f7a777SLen Brown struct acpi_debug_mem_header {
1089e2f7a777SLen Brown ACPI_COMMON_DEBUG_MEM_HEADER};
1090e2f7a777SLen Brown 
1091e2f7a777SLen Brown struct acpi_debug_mem_block {
1092e2f7a777SLen Brown 	ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
1093e2f7a777SLen Brown };
1094e2f7a777SLen Brown 
1095e2f7a777SLen Brown #define ACPI_MEM_LIST_GLOBAL            0
1096e2f7a777SLen Brown #define ACPI_MEM_LIST_NSNODE            1
1097e2f7a777SLen Brown #define ACPI_MEM_LIST_MAX               1
1098e2f7a777SLen Brown #define ACPI_NUM_MEM_LISTS              2
1099e2f7a777SLen Brown 
110040cdb368SBob Moore /*****************************************************************************
110140cdb368SBob Moore  *
110240cdb368SBob Moore  * Info/help support
110340cdb368SBob Moore  *
110440cdb368SBob Moore  ****************************************************************************/
110540cdb368SBob Moore 
110640cdb368SBob Moore struct ah_predefined_name {
110740cdb368SBob Moore 	char *name;
110840cdb368SBob Moore 	char *description;
110940cdb368SBob Moore #ifndef ACPI_ASL_COMPILER
111040cdb368SBob Moore 	char *action;
111140cdb368SBob Moore #endif
111240cdb368SBob Moore };
111340cdb368SBob Moore 
1114e2f7a777SLen Brown #endif				/* __ACLOCAL_H__ */
1115