xref: /linux/drivers/acpi/acpica/aclocal.h (revision 950a429cd21638b0c076d135ed279518b21f452b)
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 /*
882a80941SDavid E. Box  * Copyright (C) 2000 - 2015, 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 
5656a3d5e7SBob Moore #define AML_NUM_OPCODES                 0x82
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 
19275c8044fSLv Zheng #define ANOBJ_IS_EXTERNAL               0x08	/* iASL only: This object created via External() */
19375c8044fSLv Zheng #define ANOBJ_METHOD_NO_RETVAL          0x10	/* iASL only: Method has no return value */
19475c8044fSLv Zheng #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20	/* iASL only: Method has at least one return value */
19575c8044fSLv Zheng #define ANOBJ_IS_REFERENCED             0x80	/* iASL only: Object was referenced */
196e2f7a777SLen Brown 
197b9ee2043SBob Moore /* Internal ACPI table management - master table list */
198e2f7a777SLen Brown 
199b9ee2043SBob Moore struct acpi_table_list {
200b9ee2043SBob Moore 	struct acpi_table_desc *tables;	/* Table descriptor array */
201b9ee2043SBob Moore 	u32 current_table_count;	/* Tables currently in the array */
202b9ee2043SBob Moore 	u32 max_table_count;	/* Max tables array will hold */
203e2f7a777SLen Brown 	u8 flags;
204e2f7a777SLen Brown };
205e2f7a777SLen Brown 
206e2f7a777SLen Brown /* Flags for above */
207e2f7a777SLen Brown 
208e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)	/* ~ORIGIN_ALLOCATED */
209e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
210e2f7a777SLen Brown #define ACPI_ROOT_ALLOW_RESIZE          (2)
211e2f7a777SLen Brown 
212e2f7a777SLen Brown /* Predefined (fixed) table indexes */
213e2f7a777SLen Brown 
214e2f7a777SLen Brown #define ACPI_TABLE_INDEX_DSDT           (0)
215e2f7a777SLen Brown #define ACPI_TABLE_INDEX_FACS           (1)
216c04e1fb4SLv Zheng #define ACPI_TABLE_INDEX_X_FACS         (2)
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;
25875ec6e55SBob Moore 	u16 pin_number_index;
259e2f7a777SLen Brown 	u8 field_flags;
260e2f7a777SLen Brown 	u8 attribute;
261e2f7a777SLen Brown 	u8 field_type;
2629ce81784SBob Moore 	u8 access_length;
263e2f7a777SLen Brown };
264e2f7a777SLen Brown 
265e2f7a777SLen Brown typedef
266644ef74eSLv Zheng acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
267e2f7a777SLen Brown 
268e2f7a777SLen Brown /*
269e2f7a777SLen Brown  * Bitmapped ACPI types. Used internally only
270e2f7a777SLen Brown  */
271e2f7a777SLen Brown #define ACPI_BTYPE_ANY                  0x00000000
272e2f7a777SLen Brown #define ACPI_BTYPE_INTEGER              0x00000001
273e2f7a777SLen Brown #define ACPI_BTYPE_STRING               0x00000002
274e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER               0x00000004
275e2f7a777SLen Brown #define ACPI_BTYPE_PACKAGE              0x00000008
276e2f7a777SLen Brown #define ACPI_BTYPE_FIELD_UNIT           0x00000010
277e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE               0x00000020
278e2f7a777SLen Brown #define ACPI_BTYPE_EVENT                0x00000040
279e2f7a777SLen Brown #define ACPI_BTYPE_METHOD               0x00000080
280e2f7a777SLen Brown #define ACPI_BTYPE_MUTEX                0x00000100
281e2f7a777SLen Brown #define ACPI_BTYPE_REGION               0x00000200
282e2f7a777SLen Brown #define ACPI_BTYPE_POWER                0x00000400
283e2f7a777SLen Brown #define ACPI_BTYPE_PROCESSOR            0x00000800
284e2f7a777SLen Brown #define ACPI_BTYPE_THERMAL              0x00001000
285e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
286e2f7a777SLen Brown #define ACPI_BTYPE_DDB_HANDLE           0x00004000
287e2f7a777SLen Brown #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
288e2f7a777SLen Brown #define ACPI_BTYPE_REFERENCE            0x00010000
289e2f7a777SLen Brown #define ACPI_BTYPE_RESOURCE             0x00020000
290e2f7a777SLen Brown 
291e2f7a777SLen Brown #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
292e2f7a777SLen Brown 
293e2f7a777SLen Brown #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
294e2f7a777SLen Brown #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
295e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
296e2f7a777SLen Brown #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF	/* ARG or LOCAL */
297e2f7a777SLen Brown #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
298e2f7a777SLen Brown 
299c34c82bcSBob Moore #pragma pack(1)
300c34c82bcSBob Moore 
301e2f7a777SLen Brown /*
302e2f7a777SLen Brown  * Information structure for ACPI predefined names.
303e2f7a777SLen Brown  * Each entry in the table contains the following items:
304e2f7a777SLen Brown  *
305ba494beeSBob Moore  * name                 - The ACPI reserved name
306e2f7a777SLen Brown  * param_count          - Number of arguments to the method
307e2f7a777SLen Brown  * expected_return_btypes - Allowed type(s) for the return value
308e2f7a777SLen Brown  */
309e2f7a777SLen Brown struct acpi_name_info {
310e2f7a777SLen Brown 	char name[ACPI_NAME_SIZE];
311c34c82bcSBob Moore 	u16 argument_list;
312e2f7a777SLen Brown 	u8 expected_btypes;
313e2f7a777SLen Brown };
314e2f7a777SLen Brown 
315e2f7a777SLen Brown /*
316e2f7a777SLen Brown  * Secondary information structures for ACPI predefined objects that return
317e2f7a777SLen Brown  * package objects. This structure appears as the next entry in the table
318e2f7a777SLen Brown  * after the NAME_INFO structure above.
319e2f7a777SLen Brown  *
320e2f7a777SLen Brown  * The reason for this is to minimize the size of the predefined name table.
321e2f7a777SLen Brown  */
322e2f7a777SLen Brown 
323e2f7a777SLen Brown /*
324e2f7a777SLen Brown  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
3257fce7a4bSBob Moore  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
3267fce7a4bSBob Moore  * ACPI_PTYPE2_FIX_VAR
327e2f7a777SLen Brown  */
328e2f7a777SLen Brown struct acpi_package_info {
329e2f7a777SLen Brown 	u8 type;
330e2f7a777SLen Brown 	u8 object_type1;
331e2f7a777SLen Brown 	u8 count1;
332e2f7a777SLen Brown 	u8 object_type2;
333e2f7a777SLen Brown 	u8 count2;
334c34c82bcSBob Moore 	u16 reserved;
335e2f7a777SLen Brown };
336e2f7a777SLen Brown 
337e2f7a777SLen Brown /* Used for ACPI_PTYPE2_FIXED */
338e2f7a777SLen Brown 
339e2f7a777SLen Brown struct acpi_package_info2 {
340e2f7a777SLen Brown 	u8 type;
341e2f7a777SLen Brown 	u8 count;
342e2f7a777SLen Brown 	u8 object_type[4];
343c34c82bcSBob Moore 	u8 reserved;
344e2f7a777SLen Brown };
345e2f7a777SLen Brown 
346e2f7a777SLen Brown /* Used for ACPI_PTYPE1_OPTION */
347e2f7a777SLen Brown 
348e2f7a777SLen Brown struct acpi_package_info3 {
349e2f7a777SLen Brown 	u8 type;
350e2f7a777SLen Brown 	u8 count;
351e2f7a777SLen Brown 	u8 object_type[2];
352e2f7a777SLen Brown 	u8 tail_object_type;
353c34c82bcSBob Moore 	u16 reserved;
354e2f7a777SLen Brown };
355e2f7a777SLen Brown 
356e34a7813SBob Moore struct acpi_package_info4 {
357e34a7813SBob Moore 	u8 type;
358e34a7813SBob Moore 	u8 object_type1;
359e34a7813SBob Moore 	u8 count1;
360e34a7813SBob Moore 	u8 sub_object_types;
361e34a7813SBob Moore 	u8 pkg_count;
362e34a7813SBob Moore 	u16 reserved;
363e34a7813SBob Moore };
364e34a7813SBob Moore 
365e2f7a777SLen Brown union acpi_predefined_info {
366e2f7a777SLen Brown 	struct acpi_name_info info;
367e2f7a777SLen Brown 	struct acpi_package_info ret_info;
368e2f7a777SLen Brown 	struct acpi_package_info2 ret_info2;
369e2f7a777SLen Brown 	struct acpi_package_info3 ret_info3;
370e34a7813SBob Moore 	struct acpi_package_info4 ret_info4;
371e2f7a777SLen Brown };
372e2f7a777SLen Brown 
373c34c82bcSBob Moore /* Reset to default packing */
374c34c82bcSBob Moore 
375c34c82bcSBob Moore #pragma pack()
376c34c82bcSBob Moore 
377d5a36100SBob Moore /* Return object auto-repair info */
378d5a36100SBob Moore 
379d5a36100SBob Moore typedef acpi_status(*acpi_object_converter) (union acpi_operand_object
380d5a36100SBob Moore 					     *original_object,
381d5a36100SBob Moore 					     union acpi_operand_object
382d5a36100SBob Moore 					     **converted_object);
383d5a36100SBob Moore 
384d5a36100SBob Moore struct acpi_simple_repair_info {
385d5a36100SBob Moore 	char name[ACPI_NAME_SIZE];
386d5a36100SBob Moore 	u32 unexpected_btypes;
387d5a36100SBob Moore 	u32 package_index;
388d5a36100SBob Moore 	acpi_object_converter object_converter;
389d5a36100SBob Moore };
390d5a36100SBob Moore 
391e2f7a777SLen Brown /*
392e2f7a777SLen Brown  * Bitmapped return value types
393e2f7a777SLen Brown  * Note: the actual data types must be contiguous, a loop in nspredef.c
394e2f7a777SLen Brown  * depends on this.
395e2f7a777SLen Brown  */
396e2f7a777SLen Brown #define ACPI_RTYPE_ANY                  0x00
397e2f7a777SLen Brown #define ACPI_RTYPE_NONE                 0x01
398e2f7a777SLen Brown #define ACPI_RTYPE_INTEGER              0x02
399e2f7a777SLen Brown #define ACPI_RTYPE_STRING               0x04
400e2f7a777SLen Brown #define ACPI_RTYPE_BUFFER               0x08
401e2f7a777SLen Brown #define ACPI_RTYPE_PACKAGE              0x10
402e2f7a777SLen Brown #define ACPI_RTYPE_REFERENCE            0x20
403e2f7a777SLen Brown #define ACPI_RTYPE_ALL                  0x3F
404e2f7a777SLen Brown 
405e2f7a777SLen Brown #define ACPI_NUM_RTYPES                 5	/* Number of actual object types */
406e2f7a777SLen Brown 
407e2f7a777SLen Brown /*****************************************************************************
408e2f7a777SLen Brown  *
409e2f7a777SLen Brown  * Event typedefs and structs
410e2f7a777SLen Brown  *
411e2f7a777SLen Brown  ****************************************************************************/
412e2f7a777SLen Brown 
413a2fd4b4bSLv Zheng /* Dispatch info for each host-installed SCI handler */
414a2fd4b4bSLv Zheng 
415a2fd4b4bSLv Zheng struct acpi_sci_handler_info {
416a2fd4b4bSLv Zheng 	struct acpi_sci_handler_info *next;
417a2fd4b4bSLv Zheng 	acpi_sci_handler address;	/* Address of handler */
418a2fd4b4bSLv Zheng 	void *context;		/* Context to be passed to handler */
419a2fd4b4bSLv Zheng };
420a2fd4b4bSLv Zheng 
421e2f7a777SLen Brown /* Dispatch info for each GPE -- either a method or handler, cannot be both */
422e2f7a777SLen Brown 
4238b6cd8adSLin Ming struct acpi_gpe_handler_info {
4248b6cd8adSLin Ming 	acpi_gpe_handler address;	/* Address of handler, if any */
425e2f7a777SLen Brown 	void *context;		/* Context to be passed to handler */
426e2f7a777SLen Brown 	struct acpi_namespace_node *method_node;	/* Method node for this GPE level (saved) */
4273a37898dSLin Ming 	u8 original_flags;	/* Original (pre-handler) GPE info */
4283a37898dSLin Ming 	u8 originally_enabled;	/* True if GPE was originally enabled */
429e2f7a777SLen Brown };
430e2f7a777SLen Brown 
4315816b343SBob Moore /* Notify info for implicit notify, multiple device objects */
4325816b343SBob Moore 
4335816b343SBob Moore struct acpi_gpe_notify_info {
4345816b343SBob Moore 	struct acpi_namespace_node *device_node;	/* Device to be notified */
4355816b343SBob Moore 	struct acpi_gpe_notify_info *next;
4365816b343SBob Moore };
4375816b343SBob Moore 
43875c8044fSLv Zheng /*
43975c8044fSLv Zheng  * GPE dispatch info. At any time, the GPE can have at most one type
44075c8044fSLv Zheng  * of dispatch - Method, Handler, or Implicit Notify.
44175c8044fSLv Zheng  */
442e2f7a777SLen Brown union acpi_gpe_dispatch_info {
443e2f7a777SLen Brown 	struct acpi_namespace_node *method_node;	/* Method node for this GPE level */
4448b6cd8adSLin Ming 	struct acpi_gpe_handler_info *handler;  /* Installed GPE handler */
4455816b343SBob Moore 	struct acpi_gpe_notify_info *notify_list;	/* List of _PRW devices for implicit notifies */
446e2f7a777SLen Brown };
447e2f7a777SLen Brown 
448e2f7a777SLen Brown /*
449e2f7a777SLen Brown  * Information about a GPE, one per each GPE in an array.
450e2f7a777SLen Brown  * NOTE: Important to keep this struct as small as possible.
451e2f7a777SLen Brown  */
452e2f7a777SLen Brown struct acpi_gpe_event_info {
4535816b343SBob Moore 	union acpi_gpe_dispatch_info dispatch;	/* Either Method, Handler, or notify_list */
454e2f7a777SLen Brown 	struct acpi_gpe_register_info *register_info;	/* Backpointer to register info */
455e2f7a777SLen Brown 	u8 flags;		/* Misc info about this GPE */
456e2f7a777SLen Brown 	u8 gpe_number;		/* This GPE */
4570f849d2cSLin Ming 	u8 runtime_count;	/* References to a run GPE */
458e2f7a777SLen Brown };
459e2f7a777SLen Brown 
460e2f7a777SLen Brown /* Information about a GPE register pair, one per each status/enable pair in an array */
461e2f7a777SLen Brown 
462e2f7a777SLen Brown struct acpi_gpe_register_info {
463e2f7a777SLen Brown 	struct acpi_generic_address status_address;	/* Address of status reg */
464e2f7a777SLen Brown 	struct acpi_generic_address enable_address;	/* Address of enable reg */
4657505da4cSBob Moore 	u16 base_gpe_number;	/* Base GPE number for this register */
466e2f7a777SLen Brown 	u8 enable_for_wake;	/* GPEs to keep enabled when sleeping */
467e2f7a777SLen Brown 	u8 enable_for_run;	/* GPEs to keep enabled when running */
468c50f13c6SRafael J. Wysocki 	u8 enable_mask;		/* Current mask of enabled GPEs */
469e2f7a777SLen Brown };
470e2f7a777SLen Brown 
471e2f7a777SLen Brown /*
472e2f7a777SLen Brown  * Information about a GPE register block, one per each installed block --
473e2f7a777SLen Brown  * GPE0, GPE1, and one per each installed GPE Block Device.
474e2f7a777SLen Brown  */
475e2f7a777SLen Brown struct acpi_gpe_block_info {
476e2f7a777SLen Brown 	struct acpi_namespace_node *node;
477e2f7a777SLen Brown 	struct acpi_gpe_block_info *previous;
478e2f7a777SLen Brown 	struct acpi_gpe_block_info *next;
479e2f7a777SLen Brown 	struct acpi_gpe_xrupt_info *xrupt_block;	/* Backpointer to interrupt block */
480e2f7a777SLen Brown 	struct acpi_gpe_register_info *register_info;	/* One per GPE register pair */
481e2f7a777SLen Brown 	struct acpi_gpe_event_info *event_info;	/* One for each GPE */
4827505da4cSBob Moore 	u64 address;		/* Base address of the block */
483e2f7a777SLen Brown 	u32 register_count;	/* Number of register pairs in block */
4840f849d2cSLin Ming 	u16 gpe_count;		/* Number of individual GPEs in block */
4857505da4cSBob Moore 	u16 block_base_number;	/* Base GPE number for this block */
4867505da4cSBob Moore 	u8 space_id;
4873a37898dSLin Ming 	u8 initialized;		/* TRUE if this block is initialized */
488e2f7a777SLen Brown };
489e2f7a777SLen Brown 
490e2f7a777SLen Brown /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
491e2f7a777SLen Brown 
492e2f7a777SLen Brown struct acpi_gpe_xrupt_info {
493e2f7a777SLen Brown 	struct acpi_gpe_xrupt_info *previous;
494e2f7a777SLen Brown 	struct acpi_gpe_xrupt_info *next;
495e2f7a777SLen Brown 	struct acpi_gpe_block_info *gpe_block_list_head;	/* List of GPE blocks for this xrupt */
496e2f7a777SLen Brown 	u32 interrupt_number;	/* System interrupt number */
497e2f7a777SLen Brown };
498e2f7a777SLen Brown 
499e2f7a777SLen Brown struct acpi_gpe_walk_info {
500e2f7a777SLen Brown 	struct acpi_namespace_node *gpe_device;
501e2f7a777SLen Brown 	struct acpi_gpe_block_info *gpe_block;
502186c307fSBob Moore 	u16 count;
503186c307fSBob Moore 	acpi_owner_id owner_id;
504186c307fSBob Moore 	u8 execute_by_owner_id;
505e2f7a777SLen Brown };
506e2f7a777SLen Brown 
507e2f7a777SLen Brown struct acpi_gpe_device_info {
508e2f7a777SLen Brown 	u32 index;
509e2f7a777SLen Brown 	u32 next_block_base_index;
510e2f7a777SLen Brown 	acpi_status status;
511e2f7a777SLen Brown 	struct acpi_namespace_node *gpe_device;
512e2f7a777SLen Brown };
513e2f7a777SLen Brown 
5141f86e8c1SLv Zheng typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
5151f86e8c1SLv Zheng 					 gpe_xrupt_info,
5161f86e8c1SLv Zheng 					 struct acpi_gpe_block_info *gpe_block,
5171f86e8c1SLv Zheng 					 void *context);
518e2f7a777SLen Brown 
519e2f7a777SLen Brown /* Information about each particular fixed event */
520e2f7a777SLen Brown 
521e2f7a777SLen Brown struct acpi_fixed_event_handler {
522e2f7a777SLen Brown 	acpi_event_handler handler;	/* Address of handler. */
523e2f7a777SLen Brown 	void *context;		/* Context to be passed to handler */
524e2f7a777SLen Brown };
525e2f7a777SLen Brown 
526e2f7a777SLen Brown struct acpi_fixed_event_info {
527e2f7a777SLen Brown 	u8 status_register_id;
528e2f7a777SLen Brown 	u8 enable_register_id;
529e2f7a777SLen Brown 	u16 status_bit_mask;
530e2f7a777SLen Brown 	u16 enable_bit_mask;
531e2f7a777SLen Brown };
532e2f7a777SLen Brown 
533e2f7a777SLen Brown /* Information used during field processing */
534e2f7a777SLen Brown 
535e2f7a777SLen Brown struct acpi_field_info {
536e2f7a777SLen Brown 	u8 skip_field;
537e2f7a777SLen Brown 	u8 field_flag;
538e2f7a777SLen Brown 	u32 pkg_length;
539e2f7a777SLen Brown };
540e2f7a777SLen Brown 
541e2f7a777SLen Brown /*****************************************************************************
542e2f7a777SLen Brown  *
543e2f7a777SLen Brown  * Generic "state" object for stacks
544e2f7a777SLen Brown  *
545e2f7a777SLen Brown  ****************************************************************************/
546e2f7a777SLen Brown 
547e2f7a777SLen Brown #define ACPI_CONTROL_NORMAL                  0xC0
548e2f7a777SLen Brown #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
549e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
550e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
551e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
552e2f7a777SLen Brown 
553e2f7a777SLen Brown #define ACPI_STATE_COMMON \
554e2f7a777SLen Brown 	void                            *next; \
555e2f7a777SLen Brown 	u8                              descriptor_type; /* To differentiate various internal objs */\
556e2f7a777SLen Brown 	u8                              flags; \
557e2f7a777SLen Brown 	u16                             value; \
558e2f7a777SLen Brown 	u16                             state;
559e2f7a777SLen Brown 
560e2f7a777SLen Brown 	/* There are 2 bytes available here until the next natural alignment boundary */
561e2f7a777SLen Brown 
562e2f7a777SLen Brown struct acpi_common_state {
563e2f7a777SLen Brown ACPI_STATE_COMMON};
564e2f7a777SLen Brown 
565e2f7a777SLen Brown /*
566e2f7a777SLen Brown  * Update state - used to traverse complex objects such as packages
567e2f7a777SLen Brown  */
568e2f7a777SLen Brown struct acpi_update_state {
569e2f7a777SLen Brown 	ACPI_STATE_COMMON union acpi_operand_object *object;
570e2f7a777SLen Brown };
571e2f7a777SLen Brown 
572e2f7a777SLen Brown /*
573e2f7a777SLen Brown  * Pkg state - used to traverse nested package structures
574e2f7a777SLen Brown  */
575e2f7a777SLen Brown struct acpi_pkg_state {
576e2f7a777SLen Brown 	ACPI_STATE_COMMON u16 index;
577e2f7a777SLen Brown 	union acpi_operand_object *source_object;
578e2f7a777SLen Brown 	union acpi_operand_object *dest_object;
579e2f7a777SLen Brown 	struct acpi_walk_state *walk_state;
580e2f7a777SLen Brown 	void *this_target_obj;
581e2f7a777SLen Brown 	u32 num_packages;
582e2f7a777SLen Brown };
583e2f7a777SLen Brown 
584e2f7a777SLen Brown /*
585e2f7a777SLen Brown  * Control state - one per if/else and while constructs.
586e2f7a777SLen Brown  * Allows nesting of these constructs
587e2f7a777SLen Brown  */
588e2f7a777SLen Brown struct acpi_control_state {
589e2f7a777SLen Brown 	ACPI_STATE_COMMON u16 opcode;
590e2f7a777SLen Brown 	union acpi_parse_object *predicate_op;
591e2f7a777SLen Brown 	u8 *aml_predicate_start;	/* Start of if/while predicate */
592e2f7a777SLen Brown 	u8 *package_end;	/* End of if/while block */
593e2f7a777SLen Brown 	u32 loop_count;		/* While() loop counter */
594e2f7a777SLen Brown };
595e2f7a777SLen Brown 
596e2f7a777SLen Brown /*
597e2f7a777SLen Brown  * Scope state - current scope during namespace lookups
598e2f7a777SLen Brown  */
599e2f7a777SLen Brown struct acpi_scope_state {
600e2f7a777SLen Brown 	ACPI_STATE_COMMON struct acpi_namespace_node *node;
601e2f7a777SLen Brown };
602e2f7a777SLen Brown 
603e2f7a777SLen Brown struct acpi_pscope_state {
604e2f7a777SLen Brown 	ACPI_STATE_COMMON u32 arg_count;	/* Number of fixed arguments */
605e2f7a777SLen Brown 	union acpi_parse_object *op;	/* Current op being parsed */
606e2f7a777SLen Brown 	u8 *arg_end;		/* Current argument end */
607e2f7a777SLen Brown 	u8 *pkg_end;		/* Current package end */
608e2f7a777SLen Brown 	u32 arg_list;		/* Next argument to parse */
609e2f7a777SLen Brown };
610e2f7a777SLen Brown 
611e2f7a777SLen Brown /*
612e2f7a777SLen Brown  * Thread state - one per thread across multiple walk states. Multiple walk
613e2f7a777SLen Brown  * states are created when there are nested control methods executing.
614e2f7a777SLen Brown  */
615e2f7a777SLen Brown struct acpi_thread_state {
616e2f7a777SLen Brown 	ACPI_STATE_COMMON u8 current_sync_level;	/* Mutex Sync (nested acquire) level */
617e2f7a777SLen Brown 	struct acpi_walk_state *walk_state_list;	/* Head of list of walk_states for this thread */
618e2f7a777SLen Brown 	union acpi_operand_object *acquired_mutex_list;	/* List of all currently acquired mutexes */
619e2f7a777SLen Brown 	acpi_thread_id thread_id;	/* Running thread ID */
620e2f7a777SLen Brown };
621e2f7a777SLen Brown 
622e2f7a777SLen Brown /*
623e2f7a777SLen Brown  * Result values - used to accumulate the results of nested
624e2f7a777SLen Brown  * AML arguments
625e2f7a777SLen Brown  */
626e2f7a777SLen Brown struct acpi_result_values {
627e2f7a777SLen Brown 	ACPI_STATE_COMMON
628e2f7a777SLen Brown 	    union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
629e2f7a777SLen Brown };
630e2f7a777SLen Brown 
631e2f7a777SLen Brown typedef
632e2f7a777SLen Brown acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
633e2f7a777SLen Brown 				    union acpi_parse_object ** out_op);
634e2f7a777SLen Brown 
635e2f7a777SLen Brown typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
636e2f7a777SLen Brown 
63786ed4bc8SBob Moore /* Global handlers for AML Notifies */
63886ed4bc8SBob Moore 
63986ed4bc8SBob Moore struct acpi_global_notify_handler {
64086ed4bc8SBob Moore 	acpi_notify_handler handler;
64186ed4bc8SBob Moore 	void *context;
64286ed4bc8SBob Moore };
64386ed4bc8SBob Moore 
644e2f7a777SLen Brown /*
645e2f7a777SLen Brown  * Notify info - used to pass info to the deferred notify
646e2f7a777SLen Brown  * handler/dispatcher.
647e2f7a777SLen Brown  */
648e2f7a777SLen Brown struct acpi_notify_info {
64986ed4bc8SBob Moore 	ACPI_STATE_COMMON u8 handler_list_id;
65086ed4bc8SBob Moore 	struct acpi_namespace_node *node;
65186ed4bc8SBob Moore 	union acpi_operand_object *handler_list_head;
65286ed4bc8SBob Moore 	struct acpi_global_notify_handler *global;
653e2f7a777SLen Brown };
654e2f7a777SLen Brown 
655e2f7a777SLen Brown /* Generic state is union of structs above */
656e2f7a777SLen Brown 
657e2f7a777SLen Brown union acpi_generic_state {
658e2f7a777SLen Brown 	struct acpi_common_state common;
659e2f7a777SLen Brown 	struct acpi_control_state control;
660e2f7a777SLen Brown 	struct acpi_update_state update;
661e2f7a777SLen Brown 	struct acpi_scope_state scope;
662e2f7a777SLen Brown 	struct acpi_pscope_state parse_scope;
663e2f7a777SLen Brown 	struct acpi_pkg_state pkg;
664e2f7a777SLen Brown 	struct acpi_thread_state thread;
665e2f7a777SLen Brown 	struct acpi_result_values results;
666e2f7a777SLen Brown 	struct acpi_notify_info notify;
667e2f7a777SLen Brown };
668e2f7a777SLen Brown 
669e2f7a777SLen Brown /*****************************************************************************
670e2f7a777SLen Brown  *
671e2f7a777SLen Brown  * Interpreter typedefs and structs
672e2f7a777SLen Brown  *
673e2f7a777SLen Brown  ****************************************************************************/
674e2f7a777SLen Brown 
675644ef74eSLv Zheng typedef acpi_status(*acpi_execute_op) (struct acpi_walk_state * walk_state);
676e2f7a777SLen Brown 
677f654c0feSLin Ming /* Address Range info block */
678f654c0feSLin Ming 
679f654c0feSLin Ming struct acpi_address_range {
680f654c0feSLin Ming 	struct acpi_address_range *next;
681f654c0feSLin Ming 	struct acpi_namespace_node *region_node;
682f654c0feSLin Ming 	acpi_physical_address start_address;
683f654c0feSLin Ming 	acpi_physical_address end_address;
684f654c0feSLin Ming };
685f654c0feSLin Ming 
686e2f7a777SLen Brown /*****************************************************************************
687e2f7a777SLen Brown  *
688e2f7a777SLen Brown  * Parser typedefs and structs
689e2f7a777SLen Brown  *
690e2f7a777SLen Brown  ****************************************************************************/
691e2f7a777SLen Brown 
692e2f7a777SLen Brown /*
693e2f7a777SLen Brown  * AML opcode, name, and argument layout
694e2f7a777SLen Brown  */
695e2f7a777SLen Brown struct acpi_opcode_info {
696e2f7a777SLen Brown #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
697e2f7a777SLen Brown 	char *name;		/* Opcode name (disassembler/debug only) */
698e2f7a777SLen Brown #endif
699e2f7a777SLen Brown 	u32 parse_args;		/* Grammar/Parse time arguments */
700e2f7a777SLen Brown 	u32 runtime_args;	/* Interpret time arguments */
701e2f7a777SLen Brown 	u16 flags;		/* Misc flags */
702e2f7a777SLen Brown 	u8 object_type;		/* Corresponding internal object type */
703e2f7a777SLen Brown 	u8 class;		/* Opcode class */
704e2f7a777SLen Brown 	u8 type;		/* Opcode type */
705e2f7a777SLen Brown };
706e2f7a777SLen Brown 
70775c8044fSLv Zheng /* Value associated with the parse object */
7083e8214e5SLv Zheng 
709e2f7a777SLen Brown union acpi_parse_value {
7105df7e6cbSBob Moore 	u64 integer;		/* Integer constant (Up to 64 bits) */
711e2f7a777SLen Brown 	u32 size;		/* bytelist or field size */
712e2f7a777SLen Brown 	char *string;		/* NULL terminated string */
713e2f7a777SLen Brown 	u8 *buffer;		/* buffer or string */
714e2f7a777SLen Brown 	char *name;		/* NULL terminated string */
715e2f7a777SLen Brown 	union acpi_parse_object *arg;	/* arguments and contained ops */
716e2f7a777SLen Brown };
717e2f7a777SLen Brown 
718e2f7a777SLen Brown #ifdef ACPI_DISASSEMBLER
719e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
720e2f7a777SLen Brown #else
721e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a)
722e2f7a777SLen Brown #endif
723e2f7a777SLen Brown 
724e2f7a777SLen Brown #define ACPI_PARSE_COMMON \
725e2f7a777SLen Brown 	union acpi_parse_object         *parent;        /* Parent op */\
726e2f7a777SLen Brown 	u8                              descriptor_type; /* To differentiate various internal objs */\
727e2f7a777SLen Brown 	u8                              flags;          /* Type of Op */\
728e2f7a777SLen Brown 	u16                             aml_opcode;     /* AML opcode */\
729*950a429cSLv Zheng 	u8                              *aml;           /* Address of declaration in AML */\
730e2f7a777SLen Brown 	union acpi_parse_object         *next;          /* Next op */\
731e2f7a777SLen Brown 	struct acpi_namespace_node      *node;          /* For use by interpreter */\
732e2f7a777SLen Brown 	union acpi_parse_value          value;          /* Value or args associated with the opcode */\
733e2f7a777SLen Brown 	u8                              arg_list_length; /* Number of elements in the arg list */\
734e2f7a777SLen Brown 	ACPI_DISASM_ONLY_MEMBERS (\
735e2f7a777SLen Brown 	u8                              disasm_flags;   /* Used during AML disassembly */\
736e2f7a777SLen Brown 	u8                              disasm_opcode;  /* Subtype used for disassembly */\
7375f040fc7SBob Moore 	char                            *operator_symbol;/* Used for C-style operator name strings */\
738e2f7a777SLen Brown 	char                            aml_op_name[16])	/* Op name (debug only) */
739e2f7a777SLen Brown 
740be030a57SBob Moore /* Flags for disasm_flags field above */
741be030a57SBob Moore 
742be030a57SBob Moore #define ACPI_DASM_BUFFER                0x00	/* Buffer is a simple data buffer */
743be030a57SBob Moore #define ACPI_DASM_RESOURCE              0x01	/* Buffer is a Resource Descriptor */
744be030a57SBob Moore #define ACPI_DASM_STRING                0x02	/* Buffer is a ASCII string */
745be030a57SBob Moore #define ACPI_DASM_UNICODE               0x03	/* Buffer is a Unicode string */
746be030a57SBob Moore #define ACPI_DASM_PLD_METHOD            0x04	/* Buffer is a _PLD method bit-packed buffer */
74790da690bSBob Moore #define ACPI_DASM_UUID                  0x05	/* Buffer is a UUID/GUID */
74890da690bSBob Moore #define ACPI_DASM_EISAID                0x06	/* Integer is an EISAID */
74990da690bSBob Moore #define ACPI_DASM_MATCHOP               0x07	/* Parent opcode is a Match() operator */
75090da690bSBob Moore #define ACPI_DASM_LNOT_PREFIX           0x08	/* Start of a Lnot_equal (etc.) pair of opcodes */
75190da690bSBob Moore #define ACPI_DASM_LNOT_SUFFIX           0x09	/* End  of a Lnot_equal (etc.) pair of opcodes */
75290da690bSBob Moore #define ACPI_DASM_HID_STRING            0x0A	/* String is a _HID or _CID */
75390da690bSBob Moore #define ACPI_DASM_IGNORE                0x0B	/* Not used at this time */
754e2f7a777SLen Brown 
755e2f7a777SLen Brown /*
756e2f7a777SLen Brown  * Generic operation (for example:  If, While, Store)
757e2f7a777SLen Brown  */
758e2f7a777SLen Brown struct acpi_parse_obj_common {
759e2f7a777SLen Brown ACPI_PARSE_COMMON};
760e2f7a777SLen Brown 
761e2f7a777SLen Brown /*
762e2f7a777SLen Brown  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
763e2f7a777SLen Brown  * and bytelists.
764e2f7a777SLen Brown  */
765e2f7a777SLen Brown struct acpi_parse_obj_named {
766e2f7a777SLen Brown 	ACPI_PARSE_COMMON u8 *path;
767e2f7a777SLen Brown 	u8 *data;		/* AML body or bytelist data */
768e2f7a777SLen Brown 	u32 length;		/* AML length */
769e2f7a777SLen Brown 	u32 name;		/* 4-byte name or zero if no name */
770e2f7a777SLen Brown };
771e2f7a777SLen Brown 
772ba494beeSBob Moore /* This version is used by the iASL compiler only */
773e2f7a777SLen Brown 
774e2f7a777SLen Brown #define ACPI_MAX_PARSEOP_NAME   20
775e2f7a777SLen Brown 
776e2f7a777SLen Brown struct acpi_parse_obj_asl {
777e2f7a777SLen Brown 	ACPI_PARSE_COMMON union acpi_parse_object *child;
778e2f7a777SLen Brown 	union acpi_parse_object *parent_method;
779e2f7a777SLen Brown 	char *filename;
780e2f7a777SLen Brown 	char *external_name;
781e2f7a777SLen Brown 	char *namepath;
782e2f7a777SLen Brown 	char name_seg[4];
783e2f7a777SLen Brown 	u32 extra_value;
784e2f7a777SLen Brown 	u32 column;
785e2f7a777SLen Brown 	u32 line_number;
786e2f7a777SLen Brown 	u32 logical_line_number;
787e2f7a777SLen Brown 	u32 logical_byte_offset;
788e2f7a777SLen Brown 	u32 end_line;
789e2f7a777SLen Brown 	u32 end_logical_line;
790e2f7a777SLen Brown 	u32 acpi_btype;
791e2f7a777SLen Brown 	u32 aml_length;
792e2f7a777SLen Brown 	u32 aml_subtree_length;
793e2f7a777SLen Brown 	u32 final_aml_length;
794e2f7a777SLen Brown 	u32 final_aml_offset;
795e2f7a777SLen Brown 	u32 compile_flags;
796e2f7a777SLen Brown 	u16 parse_opcode;
797e2f7a777SLen Brown 	u8 aml_opcode_length;
798e2f7a777SLen Brown 	u8 aml_pkg_len_bytes;
799e2f7a777SLen Brown 	u8 extra;
800e2f7a777SLen Brown 	char parse_op_name[ACPI_MAX_PARSEOP_NAME];
801e2f7a777SLen Brown };
802e2f7a777SLen Brown 
803e2f7a777SLen Brown union acpi_parse_object {
804e2f7a777SLen Brown 	struct acpi_parse_obj_common common;
805e2f7a777SLen Brown 	struct acpi_parse_obj_named named;
806e2f7a777SLen Brown 	struct acpi_parse_obj_asl asl;
807e2f7a777SLen Brown };
808e2f7a777SLen Brown 
809e2f7a777SLen Brown /*
810e2f7a777SLen Brown  * Parse state - one state per parser invocation and each control
811e2f7a777SLen Brown  * method.
812e2f7a777SLen Brown  */
813e2f7a777SLen Brown struct acpi_parse_state {
814e2f7a777SLen Brown 	u8 *aml_start;		/* First AML byte */
815e2f7a777SLen Brown 	u8 *aml;		/* Next AML byte */
816e2f7a777SLen Brown 	u8 *aml_end;		/* (last + 1) AML byte */
817e2f7a777SLen Brown 	u8 *pkg_start;		/* Current package begin */
818e2f7a777SLen Brown 	u8 *pkg_end;		/* Current package end */
819e2f7a777SLen Brown 	union acpi_parse_object *start_op;	/* Root of parse tree */
820e2f7a777SLen Brown 	struct acpi_namespace_node *start_node;
821e2f7a777SLen Brown 	union acpi_generic_state *scope;	/* Current scope */
822e2f7a777SLen Brown 	union acpi_parse_object *start_scope;
823e2f7a777SLen Brown 	u32 aml_size;
824e2f7a777SLen Brown };
825e2f7a777SLen Brown 
826e2f7a777SLen Brown /* Parse object flags */
827e2f7a777SLen Brown 
828e2f7a777SLen Brown #define ACPI_PARSEOP_GENERIC            0x01
829e2f7a777SLen Brown #define ACPI_PARSEOP_NAMED              0x02
830e2f7a777SLen Brown #define ACPI_PARSEOP_DEFERRED           0x04
831e2f7a777SLen Brown #define ACPI_PARSEOP_BYTELIST           0x08
832e2f7a777SLen Brown #define ACPI_PARSEOP_IN_STACK           0x10
833e2f7a777SLen Brown #define ACPI_PARSEOP_TARGET             0x20
834e2f7a777SLen Brown #define ACPI_PARSEOP_IN_CACHE           0x80
835e2f7a777SLen Brown 
836e2f7a777SLen Brown /* Parse object disasm_flags */
837e2f7a777SLen Brown 
838e2f7a777SLen Brown #define ACPI_PARSEOP_IGNORE             0x01
839e2f7a777SLen Brown #define ACPI_PARSEOP_PARAMLIST          0x02
840e2f7a777SLen Brown #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
84140cdb368SBob Moore #define ACPI_PARSEOP_PREDEF_CHECKED     0x08
842e2f7a777SLen Brown #define ACPI_PARSEOP_SPECIAL            0x10
8435f040fc7SBob Moore #define ACPI_PARSEOP_COMPOUND           0x20
844f8c73f8aSBob Moore #define ACPI_PARSEOP_ASSIGNMENT         0x40
845e2f7a777SLen Brown 
846e2f7a777SLen Brown /*****************************************************************************
847e2f7a777SLen Brown  *
848e2f7a777SLen Brown  * Hardware (ACPI registers) and PNP
849e2f7a777SLen Brown  *
850e2f7a777SLen Brown  ****************************************************************************/
851e2f7a777SLen Brown 
852e2f7a777SLen Brown struct acpi_bit_register_info {
853e2f7a777SLen Brown 	u8 parent_register;
854e2f7a777SLen Brown 	u8 bit_position;
855e2f7a777SLen Brown 	u16 access_bit_mask;
856e2f7a777SLen Brown };
857e2f7a777SLen Brown 
858e2f7a777SLen Brown /*
859e2f7a777SLen Brown  * Some ACPI registers have bits that must be ignored -- meaning that they
860e2f7a777SLen Brown  * must be preserved.
861e2f7a777SLen Brown  */
862e2f7a777SLen Brown #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800	/* Bit 11 */
86320869dcfSBob Moore 
864c3dd25f4SLin Ming /* Write-only bits must be zeroed by software */
865c3dd25f4SLin Ming 
866c3dd25f4SLin Ming #define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004	/* Bits 13, 2 */
867c3dd25f4SLin Ming 
86820869dcfSBob Moore /* For control registers, both ignored and reserved bits must be preserved */
86920869dcfSBob Moore 
870975b3c47SLin Ming /*
871b1cd843bSBob Moore  * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
872b1cd843bSBob Moore  * ACPI specification to be a "preserved" bit - "OSPM always preserves this
873b1cd843bSBob Moore  * bit position", section 4.7.3.2.1. However, on some machines the OS must
874b1cd843bSBob Moore  * write a one to this bit after resume for the machine to work properly.
875b1cd843bSBob Moore  * To enable this, we no longer attempt to preserve this bit. No machines
876b1cd843bSBob Moore  * are known to fail if the bit is not preserved. (May 2009)
877975b3c47SLin Ming  */
878b1cd843bSBob Moore #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200	/* Bit 9 */
87920869dcfSBob Moore #define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8	/* Bits 14-15, 3-8 */
88020869dcfSBob Moore #define ACPI_PM1_CONTROL_PRESERVED_BITS \
88120869dcfSBob Moore 	       (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
88220869dcfSBob Moore 
88320869dcfSBob Moore #define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE	/* All except bit 0 */
884e2f7a777SLen Brown 
885e2f7a777SLen Brown /*
886e2f7a777SLen Brown  * Register IDs
887e2f7a777SLen Brown  * These are the full ACPI registers
888e2f7a777SLen Brown  */
889e2f7a777SLen Brown #define ACPI_REGISTER_PM1_STATUS                0x01
890e2f7a777SLen Brown #define ACPI_REGISTER_PM1_ENABLE                0x02
891e2f7a777SLen Brown #define ACPI_REGISTER_PM1_CONTROL               0x03
89232c9ef99SBob Moore #define ACPI_REGISTER_PM2_CONTROL               0x04
89332c9ef99SBob Moore #define ACPI_REGISTER_PM_TIMER                  0x05
89432c9ef99SBob Moore #define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
89532c9ef99SBob Moore #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
896e2f7a777SLen Brown 
897e2f7a777SLen Brown /* Masks used to access the bit_registers */
898e2f7a777SLen Brown 
899e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_STATUS               0x0001
900e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
901e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
902e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
903e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
904e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
905e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000	/* ACPI 3.0 */
906e2f7a777SLen Brown #define ACPI_BITMASK_WAKE_STATUS                0x8000
907e2f7a777SLen Brown 
908e2f7a777SLen Brown #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
909e2f7a777SLen Brown 	ACPI_BITMASK_TIMER_STATUS          | \
910e2f7a777SLen Brown 	ACPI_BITMASK_BUS_MASTER_STATUS     | \
911e2f7a777SLen Brown 	ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
912e2f7a777SLen Brown 	ACPI_BITMASK_POWER_BUTTON_STATUS   | \
913e2f7a777SLen Brown 	ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
914e2f7a777SLen Brown 	ACPI_BITMASK_RT_CLOCK_STATUS       | \
91549b3c1e0SColin Ian King 	ACPI_BITMASK_PCIEXP_WAKE_STATUS    | \
916e2f7a777SLen Brown 	ACPI_BITMASK_WAKE_STATUS)
917e2f7a777SLen Brown 
918e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_ENABLE               0x0001
919e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
920e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
921e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
922e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
923e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000	/* ACPI 3.0 */
924e2f7a777SLen Brown 
925e2f7a777SLen Brown #define ACPI_BITMASK_SCI_ENABLE                 0x0001
926e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
927e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
92882d79b86SBob Moore #define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
929e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
930e2f7a777SLen Brown 
931e2f7a777SLen Brown #define ACPI_BITMASK_ARB_DISABLE                0x0001
932e2f7a777SLen Brown 
933e2f7a777SLen Brown /* Raw bit position of each bit_register */
934e2f7a777SLen Brown 
935e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_STATUS           0x00
936e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
937e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
938e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
939e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
940e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
941e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E	/* ACPI 3.0 */
942e2f7a777SLen Brown #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
943e2f7a777SLen Brown 
944e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
945e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
946e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
947e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
948e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
949e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E	/* ACPI 3.0 */
950e2f7a777SLen Brown 
951e2f7a777SLen Brown #define ACPI_BITPOSITION_SCI_ENABLE             0x00
952e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
953e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
95482d79b86SBob Moore #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
955e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
956e2f7a777SLen Brown 
957e2f7a777SLen Brown #define ACPI_BITPOSITION_ARB_DISABLE            0x00
958e2f7a777SLen Brown 
9597f071903SBob Moore /* Structs and definitions for _OSI support and I/O port validation */
9607f071903SBob Moore 
9617f071903SBob Moore #define ACPI_ALWAYS_ILLEGAL             0x00
9627f071903SBob Moore 
9637f071903SBob Moore struct acpi_interface_info {
9647f071903SBob Moore 	char *name;
965b0ed7a91SLin Ming 	struct acpi_interface_info *next;
966b0ed7a91SLin Ming 	u8 flags;
9677f071903SBob Moore 	u8 value;
9687f071903SBob Moore };
9697f071903SBob Moore 
970b0ed7a91SLin Ming #define ACPI_OSI_INVALID                0x01
971b0ed7a91SLin Ming #define ACPI_OSI_DYNAMIC                0x02
9722cf9f5bcSLv Zheng #define ACPI_OSI_FEATURE                0x04
9732cf9f5bcSLv Zheng #define ACPI_OSI_DEFAULT_INVALID        0x08
9742cf9f5bcSLv Zheng #define ACPI_OSI_OPTIONAL_FEATURE       (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
975b0ed7a91SLin Ming 
9767f071903SBob Moore struct acpi_port_info {
9777f071903SBob Moore 	char *name;
9787f071903SBob Moore 	u16 start;
9797f071903SBob Moore 	u16 end;
9807f071903SBob Moore 	u8 osi_dependency;
9817f071903SBob Moore };
9827f071903SBob Moore 
983e2f7a777SLen Brown /*****************************************************************************
984e2f7a777SLen Brown  *
985e2f7a777SLen Brown  * Resource descriptors
986e2f7a777SLen Brown  *
987e2f7a777SLen Brown  ****************************************************************************/
988e2f7a777SLen Brown 
989e2f7a777SLen Brown /* resource_type values */
990e2f7a777SLen Brown 
991e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
992e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_IO_RANGE              1
993e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
994e2f7a777SLen Brown 
995e2f7a777SLen Brown /* Resource descriptor types and masks */
996e2f7a777SLen Brown 
997e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE                0x80
998e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL                0x00
999e2f7a777SLen Brown 
1000e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78	/* Bits 6:3 contain the type */
1001e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07	/* Bits 2:0 contain the length */
1002e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F	/* Bits 6:0 contain the type */
1003e2f7a777SLen Brown 
1004e2f7a777SLen Brown /*
1005e2f7a777SLen Brown  * Small resource descriptor "names" as defined by the ACPI specification.
1006e2f7a777SLen Brown  * Note: Bits 2:0 are used for the descriptor length
1007e2f7a777SLen Brown  */
1008e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IRQ                  0x20
1009e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_DMA                  0x28
1010e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1011e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1012e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IO                   0x40
1013e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1014e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_FIXED_DMA            0x50
1015e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1016e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1017e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1018e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1019e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_TAG              0x78
1020e2f7a777SLen Brown 
1021e2f7a777SLen Brown /*
1022e2f7a777SLen Brown  * Large resource descriptor "names" as defined by the ACPI specification.
1023e2f7a777SLen Brown  * Note: includes the Large Descriptor bit in bit[7]
1024e2f7a777SLen Brown  */
1025e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1026e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1027e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1028e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1029e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1030e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1031e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1032e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1033e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1034e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1035e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1036e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_GPIO                 0x8C
1037e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
1038e0fe0a8dSLin Ming #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
1039e2f7a777SLen Brown 
1040e2f7a777SLen Brown /*****************************************************************************
1041e2f7a777SLen Brown  *
1042e2f7a777SLen Brown  * Miscellaneous
1043e2f7a777SLen Brown  *
1044e2f7a777SLen Brown  ****************************************************************************/
1045e2f7a777SLen Brown 
1046e2f7a777SLen Brown #define ACPI_ASCII_ZERO                 0x30
1047e2f7a777SLen Brown 
1048e2f7a777SLen Brown /*****************************************************************************
1049e2f7a777SLen Brown  *
105056324c10SLv Zheng  * Disassembler
105156324c10SLv Zheng  *
105256324c10SLv Zheng  ****************************************************************************/
105356324c10SLv Zheng 
105456324c10SLv Zheng struct acpi_external_list {
105556324c10SLv Zheng 	char *path;
105656324c10SLv Zheng 	char *internal_path;
105756324c10SLv Zheng 	struct acpi_external_list *next;
105856324c10SLv Zheng 	u32 value;
105956324c10SLv Zheng 	u16 length;
10605af2b635SBob Moore 	u16 flags;
106156324c10SLv Zheng 	u8 type;
106256324c10SLv Zheng };
106356324c10SLv Zheng 
106456324c10SLv Zheng /* Values for Flags field above */
106556324c10SLv Zheng 
10665af2b635SBob Moore #define ACPI_EXT_RESOLVED_REFERENCE         0x01	/* Object was resolved during cross ref */
10675af2b635SBob Moore #define ACPI_EXT_ORIGIN_FROM_FILE           0x02	/* External came from a file */
10685af2b635SBob Moore #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04	/* Deallocate internal path on completion */
10695af2b635SBob Moore #define ACPI_EXT_EXTERNAL_EMITTED           0x08	/* External() statement has been emitted */
107056324c10SLv Zheng 
107156324c10SLv Zheng struct acpi_external_file {
107256324c10SLv Zheng 	char *path;
107356324c10SLv Zheng 	struct acpi_external_file *next;
107456324c10SLv Zheng };
107556324c10SLv Zheng 
107656324c10SLv Zheng /*****************************************************************************
107756324c10SLv Zheng  *
1078e2f7a777SLen Brown  * Debugger
1079e2f7a777SLen Brown  *
1080e2f7a777SLen Brown  ****************************************************************************/
1081e2f7a777SLen Brown 
1082e2f7a777SLen Brown struct acpi_db_method_info {
1083be030a57SBob Moore 	acpi_handle method;
1084e2f7a777SLen Brown 	acpi_handle main_thread_gate;
1085e2f7a777SLen Brown 	acpi_handle thread_complete_gate;
1086f540fadfSLv Zheng 	acpi_handle info_gate;
108728eb3fcfSLin Ming 	acpi_thread_id *threads;
1088e2f7a777SLen Brown 	u32 num_threads;
1089e2f7a777SLen Brown 	u32 num_created;
1090e2f7a777SLen Brown 	u32 num_completed;
1091e2f7a777SLen Brown 
1092e2f7a777SLen Brown 	char *name;
1093e2f7a777SLen Brown 	u32 flags;
1094e2f7a777SLen Brown 	u32 num_loops;
109573424473SBob Moore 	char pathname[ACPI_DB_LINE_BUFFER_SIZE];
1096e2f7a777SLen Brown 	char **args;
1097f540fadfSLv Zheng 	acpi_object_type *types;
1098e2f7a777SLen Brown 
1099e2f7a777SLen Brown 	/*
1100e2f7a777SLen Brown 	 * Arguments to be passed to method for the command
1101e2f7a777SLen Brown 	 * Threads -
1102e2f7a777SLen Brown 	 *   the Number of threads, ID of current thread and
1103e2f7a777SLen Brown 	 *   Index of current thread inside all them created.
1104e2f7a777SLen Brown 	 */
1105e2f7a777SLen Brown 	char init_args;
1106e2f7a777SLen Brown 	char *arguments[4];
1107e2f7a777SLen Brown 	char num_threads_str[11];
1108e2f7a777SLen Brown 	char id_of_thread_str[11];
1109e2f7a777SLen Brown 	char index_of_thread_str[11];
1110e2f7a777SLen Brown };
1111e2f7a777SLen Brown 
1112e2f7a777SLen Brown struct acpi_integrity_info {
1113e2f7a777SLen Brown 	u32 nodes;
1114e2f7a777SLen Brown 	u32 objects;
1115e2f7a777SLen Brown };
1116e2f7a777SLen Brown 
11171b673f23STomasz Nowicki #define ACPI_DB_DISABLE_OUTPUT          0x00
1118e2f7a777SLen Brown #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1119e2f7a777SLen Brown #define ACPI_DB_CONSOLE_OUTPUT          0x02
1120e2f7a777SLen Brown #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1121e2f7a777SLen Brown 
1122e2f7a777SLen Brown /*****************************************************************************
1123e2f7a777SLen Brown  *
1124e2f7a777SLen Brown  * Debug
1125e2f7a777SLen Brown  *
1126e2f7a777SLen Brown  ****************************************************************************/
1127e2f7a777SLen Brown 
1128e2f7a777SLen Brown /* Entry for a memory allocation (debug only) */
1129e2f7a777SLen Brown 
1130e2f7a777SLen Brown #define ACPI_MEM_MALLOC                 0
1131e2f7a777SLen Brown #define ACPI_MEM_CALLOC                 1
1132e2f7a777SLen Brown #define ACPI_MAX_MODULE_NAME            16
1133e2f7a777SLen Brown 
1134e2f7a777SLen Brown #define ACPI_COMMON_DEBUG_MEM_HEADER \
1135e2f7a777SLen Brown 	struct acpi_debug_mem_block     *previous; \
1136e2f7a777SLen Brown 	struct acpi_debug_mem_block     *next; \
1137e2f7a777SLen Brown 	u32                             size; \
1138e2f7a777SLen Brown 	u32                             component; \
1139e2f7a777SLen Brown 	u32                             line; \
1140e2f7a777SLen Brown 	char                            module[ACPI_MAX_MODULE_NAME]; \
1141e2f7a777SLen Brown 	u8                              alloc_type;
1142e2f7a777SLen Brown 
1143e2f7a777SLen Brown struct acpi_debug_mem_header {
1144e2f7a777SLen Brown ACPI_COMMON_DEBUG_MEM_HEADER};
1145e2f7a777SLen Brown 
1146e2f7a777SLen Brown struct acpi_debug_mem_block {
1147e2f7a777SLen Brown 	ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
1148e2f7a777SLen Brown };
1149e2f7a777SLen Brown 
1150e2f7a777SLen Brown #define ACPI_MEM_LIST_GLOBAL            0
1151e2f7a777SLen Brown #define ACPI_MEM_LIST_NSNODE            1
1152e2f7a777SLen Brown #define ACPI_MEM_LIST_MAX               1
1153e2f7a777SLen Brown #define ACPI_NUM_MEM_LISTS              2
1154e2f7a777SLen Brown 
115540cdb368SBob Moore /*****************************************************************************
115640cdb368SBob Moore  *
115740cdb368SBob Moore  * Info/help support
115840cdb368SBob Moore  *
115940cdb368SBob Moore  ****************************************************************************/
116040cdb368SBob Moore 
116140cdb368SBob Moore struct ah_predefined_name {
116240cdb368SBob Moore 	char *name;
116340cdb368SBob Moore 	char *description;
116440cdb368SBob Moore #ifndef ACPI_ASL_COMPILER
116540cdb368SBob Moore 	char *action;
116640cdb368SBob Moore #endif
116740cdb368SBob Moore };
116840cdb368SBob Moore 
1169b944b29cSBob Moore struct ah_device_id {
1170b944b29cSBob Moore 	char *name;
1171b944b29cSBob Moore 	char *description;
1172b944b29cSBob Moore };
1173b944b29cSBob Moore 
117473bbca04SBob Moore struct ah_uuid {
117573bbca04SBob Moore 	char *description;
117673bbca04SBob Moore 	char *string;
117773bbca04SBob Moore };
117873bbca04SBob Moore 
11790bb346ccSBob Moore struct ah_table {
11800bb346ccSBob Moore 	char *signature;
11810bb346ccSBob Moore 	char *description;
11820bb346ccSBob Moore };
11830bb346ccSBob Moore 
1184e2f7a777SLen Brown #endif				/* __ACLOCAL_H__ */
1185