blob: 492d02761bb7b34a8d2291c2508eb786a98869c8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Name: aclocal.h - Internal data types used across the ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
Len Brown75a44ce2008-04-23 23:00:13 -04008 * Copyright (C) 2000 - 2008, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACLOCAL_H__
45#define __ACLOCAL_H__
46
Bob Moore616861242006-03-17 16:44:00 -050047/* acpisrc:struct_defs -- for acpisrc conversion */
48
Bob Moore967440e32006-06-23 17:04:00 -040049#define ACPI_SERIALIZED 0xFF
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Len Brown4be44fc2005-08-05 00:44:28 -040051typedef u32 acpi_mutex_handle;
Bob Mooref3d2e782007-02-02 19:48:18 +030052#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
54/* Total number of aml opcodes defined */
55
56#define AML_NUM_OPCODES 0x7F
57
Robert Mooref9f46012005-07-08 00:00:00 -040058/* Forward declarations */
59
Len Brown4be44fc2005-08-05 00:44:28 -040060struct acpi_walk_state;
Robert Mooref9f46012005-07-08 00:00:00 -040061struct acpi_obj_mutex;
Len Brown4be44fc2005-08-05 00:44:28 -040062union acpi_parse_object;
Robert Mooref9f46012005-07-08 00:00:00 -040063
Linus Torvalds1da177e2005-04-16 15:20:36 -070064/*****************************************************************************
65 *
66 * Mutex typedefs and structs
67 *
68 ****************************************************************************/
69
Linus Torvalds1da177e2005-04-16 15:20:36 -070070/*
71 * Predefined handles for the mutex objects used within the subsystem
72 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
73 *
Bob Moore4c90ece2006-06-08 16:29:00 -040074 * The acquire/release ordering protocol is implied via this list. Mutexes
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 * with a lower value must be acquired before mutexes with a higher value.
76 *
Bob Moore4c90ece2006-06-08 16:29:00 -040077 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
78 * table below also!
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 */
Bob Moore4c90ece2006-06-08 16:29:00 -040080#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
Bob Mooref3d2e782007-02-02 19:48:18 +030081#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
82#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
Bob Moore967440e32006-06-23 17:04:00 -040083#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
84#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
85#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
86#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
87#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
Linus Torvalds1da177e2005-04-16 15:20:36 -070088
Bob Moore967440e32006-06-23 17:04:00 -040089#define ACPI_MAX_MUTEX 7
Bob Moore4c90ece2006-06-08 16:29:00 -040090#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
Linus Torvalds1da177e2005-04-16 15:20:36 -070092#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
93#ifdef DEFINE_ACPI_GLOBALS
94
Bob Moore4c90ece2006-06-08 16:29:00 -040095/* Debug names for the mutexes above */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096
Bob Moore4c90ece2006-06-08 16:29:00 -040097static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 "ACPI_MTX_Interpreter",
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 "ACPI_MTX_Namespace",
Vegard Nossum47c00d22008-06-20 13:56:56 +0200100 "ACPI_MTX_Tables",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 "ACPI_MTX_Events",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 "ACPI_MTX_Caches",
103 "ACPI_MTX_Memory",
Bob Moore967440e32006-06-23 17:04:00 -0400104 "ACPI_MTX_CommandComplete",
105 "ACPI_MTX_CommandReady"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106};
107
108#endif
109#endif
110
Bob Moore4c90ece2006-06-08 16:29:00 -0400111/*
112 * Predefined handles for spinlocks used within the subsystem.
113 * These spinlocks are created by acpi_ut_mutex_initialize
114 */
115#define ACPI_LOCK_GPES 0
116#define ACPI_LOCK_HARDWARE 1
117
118#define ACPI_MAX_LOCK 1
119#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
120
Robert Mooref9f46012005-07-08 00:00:00 -0400121/* This Thread ID means that the mutex is not in use (unlocked) */
122
Len Brownab8aa062006-07-07 20:11:07 -0400123#define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0
Robert Mooref9f46012005-07-08 00:00:00 -0400124
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125/* Table for the global mutexes */
126
Len Brown4be44fc2005-08-05 00:44:28 -0400127struct acpi_mutex_info {
128 acpi_mutex mutex;
129 u32 use_count;
Bob Moore83135242006-10-03 00:00:00 -0400130 acpi_thread_id thread_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131};
132
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133/* Lock flag parameter for various interfaces */
134
135#define ACPI_MTX_DO_NOT_LOCK 0
136#define ACPI_MTX_LOCK 1
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138/* Field access granularities */
139
140#define ACPI_FIELD_BYTE_GRANULARITY 1
141#define ACPI_FIELD_WORD_GRANULARITY 2
142#define ACPI_FIELD_DWORD_GRANULARITY 4
143#define ACPI_FIELD_QWORD_GRANULARITY 8
144
Bob Moore616861242006-03-17 16:44:00 -0500145#define ACPI_ENTRY_NOT_FOUND NULL
146
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147/*****************************************************************************
148 *
149 * Namespace typedefs and structs
150 *
151 ****************************************************************************/
152
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153/* Operational modes of the AML interpreter/scanner */
154
Len Brown4be44fc2005-08-05 00:44:28 -0400155typedef enum {
156 ACPI_IMODE_LOAD_PASS1 = 0x01,
157 ACPI_IMODE_LOAD_PASS2 = 0x02,
Bob Mooreec3153f2007-02-02 19:48:21 +0300158 ACPI_IMODE_EXECUTE = 0x03
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159} acpi_interpreter_mode;
160
Bob Moore616861242006-03-17 16:44:00 -0500161/*
162 * The Namespace Node describes a named object that appears in the AML.
163 * descriptor_type is used to differentiate between internal descriptors.
164 *
165 * The node is optimized for both 32-bit and 64-bit platforms:
166 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
Bob Moore793c2382006-03-31 00:00:00 -0500167 *
168 * Note: The descriptor_type and Type fields must appear in the identical
169 * position in both the struct acpi_namespace_node and union acpi_operand_object
170 * structures.
Bob Moore616861242006-03-17 16:44:00 -0500171 */
Len Brown4be44fc2005-08-05 00:44:28 -0400172struct acpi_namespace_node {
Bob Moore616861242006-03-17 16:44:00 -0500173 union acpi_operand_object *object; /* Interpreter object */
174 u8 descriptor_type; /* Differentiate object descriptor types */
Bob Moore793c2382006-03-31 00:00:00 -0500175 u8 type; /* ACPI Type associated with this name */
Bob Moore616861242006-03-17 16:44:00 -0500176 u8 flags; /* Miscellaneous flags */
177 acpi_owner_id owner_id; /* Node creator */
Len Brown4be44fc2005-08-05 00:44:28 -0400178 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
Len Brown4be44fc2005-08-05 00:44:28 -0400179 struct acpi_namespace_node *child; /* First child */
Bob Moore616861242006-03-17 16:44:00 -0500180 struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
Robert Mooref9f46012005-07-08 00:00:00 -0400181
Bob Moore793c2382006-03-31 00:00:00 -0500182 /*
183 * The following fields are used by the ASL compiler and disassembler only
184 */
Bob Moore83135242006-10-03 00:00:00 -0400185#ifdef ACPI_LARGE_NAMESPACE_NODE
Len Brown4be44fc2005-08-05 00:44:28 -0400186 union acpi_parse_object *op;
Bob Moore616861242006-03-17 16:44:00 -0500187 u32 value;
Bob Moore793c2382006-03-31 00:00:00 -0500188 u32 length;
Robert Mooref9f46012005-07-08 00:00:00 -0400189#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190};
191
Bob Moore616861242006-03-17 16:44:00 -0500192/* Namespace Node flags */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193
Bob Moore616861242006-03-17 16:44:00 -0500194#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
Bob Moored1fdda832007-02-02 19:48:21 +0300195#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
Bob Moore616861242006-03-17 16:44:00 -0500196#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
197#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
Bob Mooreb229cf92006-04-21 17:15:00 -0400198#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
Bob Mooree8707b32008-09-28 15:26:17 +0800199#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
Bob Mooreb229cf92006-04-21 17:15:00 -0400200
Bob Moore958dd242006-05-12 17:12:00 -0400201#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */
202#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */
203#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */
204#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */
205#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206
Bob Moorec5fc42a2007-02-02 19:48:19 +0300207/* One internal RSDT for table management */
208
Bob Mooref3d2e782007-02-02 19:48:18 +0300209struct acpi_internal_rsdt {
210 struct acpi_table_desc *tables;
Len Brown4be44fc2005-08-05 00:44:28 -0400211 u32 count;
Bob Mooref3d2e782007-02-02 19:48:18 +0300212 u32 size;
213 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214};
215
Bob Moorec5fc42a2007-02-02 19:48:19 +0300216/* Flags for above */
Bob Mooref3d2e782007-02-02 19:48:18 +0300217
Bob Moorec5fc42a2007-02-02 19:48:19 +0300218#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
219#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
220#define ACPI_ROOT_ALLOW_RESIZE (2)
Bob Mooref3d2e782007-02-02 19:48:18 +0300221
222/* Predefined (fixed) table indexes */
223
224#define ACPI_TABLE_INDEX_DSDT (0)
225#define ACPI_TABLE_INDEX_FACS (1)
226
Len Brown4be44fc2005-08-05 00:44:28 -0400227struct acpi_find_context {
228 char *search_for;
229 acpi_handle *list;
230 u32 *count;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231};
232
Len Brown4be44fc2005-08-05 00:44:28 -0400233struct acpi_ns_search_data {
234 struct acpi_namespace_node *node;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235};
236
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237/* Object types used during package copies */
238
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239#define ACPI_COPY_TYPE_SIMPLE 0
240#define ACPI_COPY_TYPE_PACKAGE 1
241
242/* Info structure used to convert external<->internal namestrings */
243
Len Brown4be44fc2005-08-05 00:44:28 -0400244struct acpi_namestring_info {
Bob Moore4b8ed632008-06-10 13:55:53 +0800245 const char *external_name;
246 const char *next_external_char;
Len Brown4be44fc2005-08-05 00:44:28 -0400247 char *internal_name;
248 u32 length;
249 u32 num_segments;
250 u32 num_carats;
251 u8 fully_qualified;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252};
253
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254/* Field creation info */
255
Len Brown4be44fc2005-08-05 00:44:28 -0400256struct acpi_create_field_info {
257 struct acpi_namespace_node *region_node;
258 struct acpi_namespace_node *field_node;
259 struct acpi_namespace_node *register_node;
260 struct acpi_namespace_node *data_register_node;
261 u32 bank_value;
262 u32 field_bit_position;
263 u32 field_bit_length;
264 u8 field_flags;
265 u8 attribute;
266 u8 field_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267};
268
Bob Moore616861242006-03-17 16:44:00 -0500269typedef
270acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
271
Bob Mooredefba1d2005-12-16 17:05:00 -0500272/*
273 * Bitmapped ACPI types. Used internally only
274 */
275#define ACPI_BTYPE_ANY 0x00000000
276#define ACPI_BTYPE_INTEGER 0x00000001
277#define ACPI_BTYPE_STRING 0x00000002
278#define ACPI_BTYPE_BUFFER 0x00000004
279#define ACPI_BTYPE_PACKAGE 0x00000008
280#define ACPI_BTYPE_FIELD_UNIT 0x00000010
281#define ACPI_BTYPE_DEVICE 0x00000020
282#define ACPI_BTYPE_EVENT 0x00000040
283#define ACPI_BTYPE_METHOD 0x00000080
284#define ACPI_BTYPE_MUTEX 0x00000100
285#define ACPI_BTYPE_REGION 0x00000200
286#define ACPI_BTYPE_POWER 0x00000400
287#define ACPI_BTYPE_PROCESSOR 0x00000800
288#define ACPI_BTYPE_THERMAL 0x00001000
289#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
290#define ACPI_BTYPE_DDB_HANDLE 0x00004000
291#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
292#define ACPI_BTYPE_REFERENCE 0x00010000
293#define ACPI_BTYPE_RESOURCE 0x00020000
294
295#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
296
297#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
298#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
299#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
300#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
301#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
302
Bob Mooree8707b32008-09-28 15:26:17 +0800303/*
304 * Information structure for ACPI predefined names.
305 * Each entry in the table contains the following items:
306 *
307 * Name - The ACPI reserved name
308 * param_count - Number of arguments to the method
309 * expected_return_btypes - Allowed type(s) for the return value
310 */
311struct acpi_name_info {
312 char name[ACPI_NAME_SIZE];
313 u8 param_count;
314 u8 expected_btypes;
315};
316
317/*
318 * Secondary information structures for ACPI predefined objects that return
319 * package objects. This structure appears as the next entry in the table
320 * after the NAME_INFO structure above.
321 *
322 * The reason for this is to minimize the size of the predefined name table.
323 */
324
325/*
326 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
327 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
328 */
329struct acpi_package_info {
330 u8 type;
331 u8 object_type1;
332 u8 count1;
333 u8 object_type2;
334 u8 count2;
335 u8 reserved;
336};
337
338/* Used for ACPI_PTYPE2_FIXED */
339
340struct acpi_package_info2 {
341 u8 type;
342 u8 count;
343 u8 object_type[4];
344};
345
346/* Used for ACPI_PTYPE1_OPTION */
347
348struct acpi_package_info3 {
349 u8 type;
350 u8 count;
351 u8 object_type[2];
352 u8 tail_object_type;
353 u8 reserved;
354};
355
356union acpi_predefined_info {
357 struct acpi_name_info info;
358 struct acpi_package_info ret_info;
359 struct acpi_package_info2 ret_info2;
360 struct acpi_package_info3 ret_info3;
361};
362
363/*
364 * Bitmapped return value types
365 * Note: the actual data types must be contiguous, a loop in nspredef.c
366 * depends on this.
367 */
368#define ACPI_RTYPE_ANY 0x00
369#define ACPI_RTYPE_NONE 0x01
370#define ACPI_RTYPE_INTEGER 0x02
371#define ACPI_RTYPE_STRING 0x04
372#define ACPI_RTYPE_BUFFER 0x08
373#define ACPI_RTYPE_PACKAGE 0x10
374#define ACPI_RTYPE_REFERENCE 0x20
375#define ACPI_RTYPE_ALL 0x3F
376
377#define ACPI_NUM_RTYPES 5 /* Number of actual object types */
378
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379/*****************************************************************************
380 *
381 * Event typedefs and structs
382 *
383 ****************************************************************************/
384
385/* Dispatch info for each GPE -- either a method or handler, cannot be both */
386
Len Brown4be44fc2005-08-05 00:44:28 -0400387struct acpi_handler_info {
388 acpi_event_handler address; /* Address of handler, if any */
389 void *context; /* Context to be passed to handler */
390 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391};
392
Len Brown4be44fc2005-08-05 00:44:28 -0400393union acpi_gpe_dispatch_info {
394 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
395 struct acpi_handler_info *handler;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396};
397
398/*
399 * Information about a GPE, one per each GPE in an array.
400 * NOTE: Important to keep this struct as small as possible.
401 */
Len Brown4be44fc2005-08-05 00:44:28 -0400402struct acpi_gpe_event_info {
403 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
404 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
405 u8 flags; /* Misc info about this GPE */
Alexey Starikovskiy69874162007-02-02 19:48:19 +0300406 u8 gpe_number; /* This GPE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407};
408
409/* Information about a GPE register pair, one per each status/enable pair in an array */
410
Len Brown4be44fc2005-08-05 00:44:28 -0400411struct acpi_gpe_register_info {
412 struct acpi_generic_address status_address; /* Address of status reg */
413 struct acpi_generic_address enable_address; /* Address of enable reg */
414 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
415 u8 enable_for_run; /* GPEs to keep enabled when running */
416 u8 base_gpe_number; /* Base GPE number for this register */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417};
418
419/*
420 * Information about a GPE register block, one per each installed block --
421 * GPE0, GPE1, and one per each installed GPE Block Device.
422 */
Len Brown4be44fc2005-08-05 00:44:28 -0400423struct acpi_gpe_block_info {
424 struct acpi_namespace_node *node;
425 struct acpi_gpe_block_info *previous;
426 struct acpi_gpe_block_info *next;
427 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
428 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
429 struct acpi_gpe_event_info *event_info; /* One for each GPE */
430 struct acpi_generic_address block_address; /* Base address of the block */
431 u32 register_count; /* Number of register pairs in block */
432 u8 block_base_number; /* Base GPE number for this block */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433};
434
435/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
436
Len Brown4be44fc2005-08-05 00:44:28 -0400437struct acpi_gpe_xrupt_info {
438 struct acpi_gpe_xrupt_info *previous;
439 struct acpi_gpe_xrupt_info *next;
440 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
441 u32 interrupt_number; /* System interrupt number */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442};
443
Len Brown4be44fc2005-08-05 00:44:28 -0400444struct acpi_gpe_walk_info {
445 struct acpi_namespace_node *gpe_device;
446 struct acpi_gpe_block_info *gpe_block;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447};
448
Bob Mooree97d6bf2008-12-30 09:45:17 +0800449struct acpi_gpe_device_info {
450 u32 index;
451 u32 next_block_base_index;
452 acpi_status status;
453 struct acpi_namespace_node *gpe_device;
454};
455
456typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info,
457 struct acpi_gpe_block_info *gpe_block, void *context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458
459/* Information about each particular fixed event */
460
Len Brown4be44fc2005-08-05 00:44:28 -0400461struct acpi_fixed_event_handler {
462 acpi_event_handler handler; /* Address of handler. */
463 void *context; /* Context to be passed to handler */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464};
465
Len Brown4be44fc2005-08-05 00:44:28 -0400466struct acpi_fixed_event_info {
467 u8 status_register_id;
468 u8 enable_register_id;
469 u16 status_bit_mask;
470 u16 enable_bit_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471};
472
473/* Information used during field processing */
474
Len Brown4be44fc2005-08-05 00:44:28 -0400475struct acpi_field_info {
476 u8 skip_field;
477 u8 field_flag;
478 u32 pkg_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479};
480
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481/*****************************************************************************
482 *
483 * Generic "state" object for stacks
484 *
485 ****************************************************************************/
486
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487#define ACPI_CONTROL_NORMAL 0xC0
488#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
489#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
490#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
491#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
492
Bob Moore616861242006-03-17 16:44:00 -0500493#define ACPI_STATE_COMMON \
494 void *next; \
495 u8 descriptor_type; /* To differentiate various internal objs */\
496 u8 flags; \
497 u16 value; \
498 u16 state;
499
500 /* There are 2 bytes available here until the next natural alignment boundary */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501
Len Brown4be44fc2005-08-05 00:44:28 -0400502struct acpi_common_state {
503ACPI_STATE_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504
505/*
506 * Update state - used to traverse complex objects such as packages
507 */
Len Brown4be44fc2005-08-05 00:44:28 -0400508struct acpi_update_state {
509 ACPI_STATE_COMMON union acpi_operand_object *object;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510};
511
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512/*
513 * Pkg state - used to traverse nested package structures
514 */
Len Brown4be44fc2005-08-05 00:44:28 -0400515struct acpi_pkg_state {
Bob Moore616861242006-03-17 16:44:00 -0500516 ACPI_STATE_COMMON u16 index;
517 union acpi_operand_object *source_object;
Len Brown4be44fc2005-08-05 00:44:28 -0400518 union acpi_operand_object *dest_object;
519 struct acpi_walk_state *walk_state;
520 void *this_target_obj;
521 u32 num_packages;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522};
523
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524/*
525 * Control state - one per if/else and while constructs.
526 * Allows nesting of these constructs
527 */
Len Brown4be44fc2005-08-05 00:44:28 -0400528struct acpi_control_state {
Bob Moore616861242006-03-17 16:44:00 -0500529 ACPI_STATE_COMMON u16 opcode;
530 union acpi_parse_object *predicate_op;
Len Brown4be44fc2005-08-05 00:44:28 -0400531 u8 *aml_predicate_start; /* Start of if/while predicate */
532 u8 *package_end; /* End of if/while block */
Bob Moorefc374452008-11-12 15:15:29 +0800533 u32 loop_count; /* While() loop counter */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534};
535
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536/*
537 * Scope state - current scope during namespace lookups
538 */
Len Brown4be44fc2005-08-05 00:44:28 -0400539struct acpi_scope_state {
540 ACPI_STATE_COMMON struct acpi_namespace_node *node;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541};
542
Len Brown4be44fc2005-08-05 00:44:28 -0400543struct acpi_pscope_state {
Bob Moore793c2382006-03-31 00:00:00 -0500544 ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
Bob Moore616861242006-03-17 16:44:00 -0500545 union acpi_parse_object *op; /* Current op being parsed */
Len Brown4be44fc2005-08-05 00:44:28 -0400546 u8 *arg_end; /* Current argument end */
547 u8 *pkg_end; /* Current package end */
548 u32 arg_list; /* Next argument to parse */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549};
550
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551/*
552 * Thread state - one per thread across multiple walk states. Multiple walk
553 * states are created when there are nested control methods executing.
554 */
Len Brown4be44fc2005-08-05 00:44:28 -0400555struct acpi_thread_state {
Bob Moore616861242006-03-17 16:44:00 -0500556 ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
557 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
Len Brown4be44fc2005-08-05 00:44:28 -0400558 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
Bob Moore83135242006-10-03 00:00:00 -0400559 acpi_thread_id thread_id; /* Running thread ID */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560};
561
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562/*
563 * Result values - used to accumulate the results of nested
564 * AML arguments
565 */
Len Brown4be44fc2005-08-05 00:44:28 -0400566struct acpi_result_values {
Bob Moore773069d2008-04-10 19:06:36 +0400567 ACPI_STATE_COMMON
568 union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569};
570
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571typedef
Len Brown4be44fc2005-08-05 00:44:28 -0400572acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
573 union acpi_parse_object ** out_op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574
Len Brown4be44fc2005-08-05 00:44:28 -0400575typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576
577/*
578 * Notify info - used to pass info to the deferred notify
579 * handler/dispatcher.
580 */
Len Brown4be44fc2005-08-05 00:44:28 -0400581struct acpi_notify_info {
582 ACPI_STATE_COMMON struct acpi_namespace_node *node;
583 union acpi_operand_object *handler_obj;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584};
585
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586/* Generic state is union of structs above */
587
Len Brown4be44fc2005-08-05 00:44:28 -0400588union acpi_generic_state {
589 struct acpi_common_state common;
590 struct acpi_control_state control;
591 struct acpi_update_state update;
592 struct acpi_scope_state scope;
593 struct acpi_pscope_state parse_scope;
594 struct acpi_pkg_state pkg;
595 struct acpi_thread_state thread;
596 struct acpi_result_values results;
597 struct acpi_notify_info notify;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598};
599
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600/*****************************************************************************
601 *
602 * Interpreter typedefs and structs
603 *
604 ****************************************************************************/
605
Len Brown4be44fc2005-08-05 00:44:28 -0400606typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607
608/*****************************************************************************
609 *
610 * Parser typedefs and structs
611 *
612 ****************************************************************************/
613
614/*
615 * AML opcode, name, and argument layout
616 */
Len Brown4be44fc2005-08-05 00:44:28 -0400617struct acpi_opcode_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
Len Brown4be44fc2005-08-05 00:44:28 -0400619 char *name; /* Opcode name (disassembler/debug only) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620#endif
Len Brown4be44fc2005-08-05 00:44:28 -0400621 u32 parse_args; /* Grammar/Parse time arguments */
622 u32 runtime_args; /* Interpret time arguments */
Bob Moore616861242006-03-17 16:44:00 -0500623 u16 flags; /* Misc flags */
Len Brown4be44fc2005-08-05 00:44:28 -0400624 u8 object_type; /* Corresponding internal object type */
625 u8 class; /* Opcode class */
626 u8 type; /* Opcode type */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627};
628
Len Brown4be44fc2005-08-05 00:44:28 -0400629union acpi_parse_value {
630 acpi_integer integer; /* Integer constant (Up to 64 bits) */
631 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
632 u32 size; /* bytelist or field size */
633 char *string; /* NULL terminated string */
634 u8 *buffer; /* buffer or string */
635 char *name; /* NULL terminated string */
636 union acpi_parse_object *arg; /* arguments and contained ops */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637};
638
Bob Moore50df4d82008-12-31 03:01:23 +0800639#ifdef ACPI_DISASSEMBLER
640#define ACPI_DISASM_ONLY_MEMBERS(a) a;
641#else
642#define ACPI_DISASM_ONLY_MEMBERS(a)
643#endif
644
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645#define ACPI_PARSE_COMMON \
Bob Moore616861242006-03-17 16:44:00 -0500646 union acpi_parse_object *parent; /* Parent op */\
647 u8 descriptor_type; /* To differentiate various internal objs */\
648 u8 flags; /* Type of Op */\
649 u16 aml_opcode; /* AML opcode */\
650 u32 aml_offset; /* Offset of declaration in AML */\
651 union acpi_parse_object *next; /* Next op */\
652 struct acpi_namespace_node *node; /* For use by interpreter */\
653 union acpi_parse_value value; /* Value or args associated with the opcode */\
Bob Moore4e3156b2008-04-10 19:06:37 +0400654 u8 arg_list_length; /* Number of elements in the arg list */\
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 ACPI_DISASM_ONLY_MEMBERS (\
Bob Moore616861242006-03-17 16:44:00 -0500656 u8 disasm_flags; /* Used during AML disassembly */\
657 u8 disasm_opcode; /* Subtype used for disassembly */\
658 char aml_op_name[16]) /* Op name (debug only) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659
Bob Moore616861242006-03-17 16:44:00 -0500660#define ACPI_DASM_BUFFER 0x00
661#define ACPI_DASM_RESOURCE 0x01
662#define ACPI_DASM_STRING 0x02
663#define ACPI_DASM_UNICODE 0x03
664#define ACPI_DASM_EISAID 0x04
665#define ACPI_DASM_MATCHOP 0x05
Bob Moore958dd242006-05-12 17:12:00 -0400666#define ACPI_DASM_LNOT_PREFIX 0x06
667#define ACPI_DASM_LNOT_SUFFIX 0x07
668#define ACPI_DASM_IGNORE 0x08
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669
670/*
Bob Moore616861242006-03-17 16:44:00 -0500671 * Generic operation (for example: If, While, Store)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 */
Len Brown4be44fc2005-08-05 00:44:28 -0400673struct acpi_parse_obj_common {
674ACPI_PARSE_COMMON};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675
676/*
677 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
678 * and bytelists.
679 */
Len Brown4be44fc2005-08-05 00:44:28 -0400680struct acpi_parse_obj_named {
Len Brownfd350942007-05-09 23:34:35 -0400681 ACPI_PARSE_COMMON u8 *path;
Len Brown4be44fc2005-08-05 00:44:28 -0400682 u8 *data; /* AML body or bytelist data */
683 u32 length; /* AML length */
684 u32 name; /* 4-byte name or zero if no name */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685};
686
Bob Moore958dd242006-05-12 17:12:00 -0400687/* This version is used by the i_aSL compiler only */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688
Bob Moorec51a4de2005-11-17 13:07:00 -0500689#define ACPI_MAX_PARSEOP_NAME 20
690
Len Brown4be44fc2005-08-05 00:44:28 -0400691struct acpi_parse_obj_asl {
692 ACPI_PARSE_COMMON union acpi_parse_object *child;
693 union acpi_parse_object *parent_method;
694 char *filename;
695 char *external_name;
696 char *namepath;
697 char name_seg[4];
698 u32 extra_value;
699 u32 column;
700 u32 line_number;
701 u32 logical_line_number;
702 u32 logical_byte_offset;
703 u32 end_line;
704 u32 end_logical_line;
705 u32 acpi_btype;
706 u32 aml_length;
707 u32 aml_subtree_length;
708 u32 final_aml_length;
709 u32 final_aml_offset;
710 u32 compile_flags;
711 u16 parse_opcode;
712 u8 aml_opcode_length;
713 u8 aml_pkg_len_bytes;
714 u8 extra;
Bob Moorec51a4de2005-11-17 13:07:00 -0500715 char parse_op_name[ACPI_MAX_PARSEOP_NAME];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716};
717
Len Brown4be44fc2005-08-05 00:44:28 -0400718union acpi_parse_object {
719 struct acpi_parse_obj_common common;
720 struct acpi_parse_obj_named named;
721 struct acpi_parse_obj_asl asl;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722};
723
Linus Torvalds1da177e2005-04-16 15:20:36 -0700724/*
725 * Parse state - one state per parser invocation and each control
726 * method.
727 */
Len Brown4be44fc2005-08-05 00:44:28 -0400728struct acpi_parse_state {
Len Brown4be44fc2005-08-05 00:44:28 -0400729 u8 *aml_start; /* First AML byte */
730 u8 *aml; /* Next AML byte */
731 u8 *aml_end; /* (last + 1) AML byte */
732 u8 *pkg_start; /* Current package begin */
733 u8 *pkg_end; /* Current package end */
734 union acpi_parse_object *start_op; /* Root of parse tree */
735 struct acpi_namespace_node *start_node;
736 union acpi_generic_state *scope; /* Current scope */
737 union acpi_parse_object *start_scope;
Bob Moore616861242006-03-17 16:44:00 -0500738 u32 aml_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739};
740
Linus Torvalds1da177e2005-04-16 15:20:36 -0700741/* Parse object flags */
742
Bob Moore616861242006-03-17 16:44:00 -0500743#define ACPI_PARSEOP_GENERIC 0x01
744#define ACPI_PARSEOP_NAMED 0x02
745#define ACPI_PARSEOP_DEFERRED 0x04
746#define ACPI_PARSEOP_BYTELIST 0x08
Bob Moore4e3156b2008-04-10 19:06:37 +0400747#define ACPI_PARSEOP_IN_STACK 0x10
748#define ACPI_PARSEOP_TARGET 0x20
Bob Moore616861242006-03-17 16:44:00 -0500749#define ACPI_PARSEOP_IN_CACHE 0x80
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750
751/* Parse object disasm_flags */
752
Bob Moore616861242006-03-17 16:44:00 -0500753#define ACPI_PARSEOP_IGNORE 0x01
754#define ACPI_PARSEOP_PARAMLIST 0x02
755#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
756#define ACPI_PARSEOP_SPECIAL 0x10
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757
Linus Torvalds1da177e2005-04-16 15:20:36 -0700758/*****************************************************************************
759 *
760 * Hardware (ACPI registers) and PNP
761 *
762 ****************************************************************************/
763
Len Brown4be44fc2005-08-05 00:44:28 -0400764struct acpi_bit_register_info {
765 u8 parent_register;
766 u8 bit_position;
767 u16 access_bit_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768};
769
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770/*
Bob Moore967440e32006-06-23 17:04:00 -0400771 * Some ACPI registers have bits that must be ignored -- meaning that they
772 * must be preserved.
773 */
774#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
Linus Torvalds53a5fbd2006-10-10 17:14:44 -0700775#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200 /* Bit 9 (whatever) */
Bob Moore967440e32006-06-23 17:04:00 -0400776
777/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778 * Register IDs
779 * These are the full ACPI registers
780 */
781#define ACPI_REGISTER_PM1_STATUS 0x01
782#define ACPI_REGISTER_PM1_ENABLE 0x02
783#define ACPI_REGISTER_PM1_CONTROL 0x03
784#define ACPI_REGISTER_PM1A_CONTROL 0x04
785#define ACPI_REGISTER_PM1B_CONTROL 0x05
786#define ACPI_REGISTER_PM2_CONTROL 0x06
787#define ACPI_REGISTER_PM_TIMER 0x07
788#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
789#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
790
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791/* Masks used to access the bit_registers */
792
793#define ACPI_BITMASK_TIMER_STATUS 0x0001
794#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
795#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
796#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
797#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
798#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
Len Brown4be44fc2005-08-05 00:44:28 -0400799#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800#define ACPI_BITMASK_WAKE_STATUS 0x8000
801
Bob Moore616861242006-03-17 16:44:00 -0500802#define ACPI_BITMASK_ALL_FIXED_STATUS (\
803 ACPI_BITMASK_TIMER_STATUS | \
804 ACPI_BITMASK_BUS_MASTER_STATUS | \
805 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
806 ACPI_BITMASK_POWER_BUTTON_STATUS | \
807 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
808 ACPI_BITMASK_RT_CLOCK_STATUS | \
809 ACPI_BITMASK_WAKE_STATUS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810
811#define ACPI_BITMASK_TIMER_ENABLE 0x0001
812#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
813#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
814#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
815#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
Len Brown4be44fc2005-08-05 00:44:28 -0400816#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817
818#define ACPI_BITMASK_SCI_ENABLE 0x0001
819#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
820#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
821#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
822#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
823
824#define ACPI_BITMASK_ARB_DISABLE 0x0001
825
Linus Torvalds1da177e2005-04-16 15:20:36 -0700826/* Raw bit position of each bit_register */
827
828#define ACPI_BITPOSITION_TIMER_STATUS 0x00
829#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
830#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
831#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
832#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
833#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
Len Brown4be44fc2005-08-05 00:44:28 -0400834#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
836
837#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
838#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
839#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
840#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
841#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
Len Brown4be44fc2005-08-05 00:44:28 -0400842#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843
844#define ACPI_BITPOSITION_SCI_ENABLE 0x00
845#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
846#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
847#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
848#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
849
850#define ACPI_BITPOSITION_ARB_DISABLE 0x00
851
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852/*****************************************************************************
853 *
854 * Resource descriptors
855 *
856 ****************************************************************************/
857
Linus Torvalds1da177e2005-04-16 15:20:36 -0700858/* resource_type values */
859
Bob Moore50eca3e2005-09-30 19:03:00 -0400860#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
861#define ACPI_ADDRESS_TYPE_IO_RANGE 1
862#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863
864/* Resource descriptor types and masks */
865
Bob Moore50eca3e2005-09-30 19:03:00 -0400866#define ACPI_RESOURCE_NAME_LARGE 0x80
867#define ACPI_RESOURCE_NAME_SMALL 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700868
Bob Moore50eca3e2005-09-30 19:03:00 -0400869#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
870#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
871#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700872
873/*
Bob Moore50eca3e2005-09-30 19:03:00 -0400874 * Small resource descriptor "names" as defined by the ACPI specification.
Robert Moorebda663d2005-09-16 16:51:15 -0400875 * Note: Bits 2:0 are used for the descriptor length
Linus Torvalds1da177e2005-04-16 15:20:36 -0700876 */
Bob Moore50eca3e2005-09-30 19:03:00 -0400877#define ACPI_RESOURCE_NAME_IRQ 0x20
878#define ACPI_RESOURCE_NAME_DMA 0x28
879#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
880#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
881#define ACPI_RESOURCE_NAME_IO 0x40
882#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
883#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
884#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
885#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
886#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
887#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
888#define ACPI_RESOURCE_NAME_END_TAG 0x78
Linus Torvalds1da177e2005-04-16 15:20:36 -0700889
890/*
Bob Moore50eca3e2005-09-30 19:03:00 -0400891 * Large resource descriptor "names" as defined by the ACPI specification.
892 * Note: includes the Large Descriptor bit in bit[7]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700893 */
Bob Moore50eca3e2005-09-30 19:03:00 -0400894#define ACPI_RESOURCE_NAME_MEMORY24 0x81
895#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
896#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
897#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
898#define ACPI_RESOURCE_NAME_MEMORY32 0x85
899#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
900#define ACPI_RESOURCE_NAME_ADDRESS32 0x87
901#define ACPI_RESOURCE_NAME_ADDRESS16 0x88
902#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
903#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
904#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
905#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
Linus Torvalds1da177e2005-04-16 15:20:36 -0700906
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907/*****************************************************************************
908 *
909 * Miscellaneous
910 *
911 ****************************************************************************/
912
Bob Moore616861242006-03-17 16:44:00 -0500913#define ACPI_ASCII_ZERO 0x30
Linus Torvalds1da177e2005-04-16 15:20:36 -0700914
Linus Torvalds1da177e2005-04-16 15:20:36 -0700915/*****************************************************************************
916 *
917 * Debugger
918 *
919 ****************************************************************************/
920
Len Brown4be44fc2005-08-05 00:44:28 -0400921struct acpi_db_method_info {
Bob Moore2e23f852007-02-02 19:48:23 +0300922 acpi_handle main_thread_gate;
923 acpi_handle thread_complete_gate;
924 u32 *threads;
925 u32 num_threads;
926 u32 num_created;
927 u32 num_completed;
928
Len Brown4be44fc2005-08-05 00:44:28 -0400929 char *name;
Len Brown4be44fc2005-08-05 00:44:28 -0400930 u32 flags;
931 u32 num_loops;
932 char pathname[128];
Bob Moore2e23f852007-02-02 19:48:23 +0300933 char **args;
934
935 /*
936 * Arguments to be passed to method for the command
937 * Threads -
938 * the Number of threads, ID of current thread and
939 * Index of current thread inside all them created.
940 */
941 char init_args;
942 char *arguments[4];
943 char num_threads_str[11];
944 char id_of_thread_str[11];
945 char index_of_thread_str[11];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700946};
947
Len Brown4be44fc2005-08-05 00:44:28 -0400948struct acpi_integrity_info {
949 u32 nodes;
950 u32 objects;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700951};
952
Bob Moore616861242006-03-17 16:44:00 -0500953#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
954#define ACPI_DB_CONSOLE_OUTPUT 0x02
955#define ACPI_DB_DUPLICATE_OUTPUT 0x03
Linus Torvalds1da177e2005-04-16 15:20:36 -0700956
Linus Torvalds1da177e2005-04-16 15:20:36 -0700957/*****************************************************************************
958 *
959 * Debug
960 *
961 ****************************************************************************/
962
Linus Torvalds1da177e2005-04-16 15:20:36 -0700963/* Entry for a memory allocation (debug only) */
964
Bob Moore616861242006-03-17 16:44:00 -0500965#define ACPI_MEM_MALLOC 0
966#define ACPI_MEM_CALLOC 1
967#define ACPI_MAX_MODULE_NAME 16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700968
969#define ACPI_COMMON_DEBUG_MEM_HEADER \
Bob Moore616861242006-03-17 16:44:00 -0500970 struct acpi_debug_mem_block *previous; \
971 struct acpi_debug_mem_block *next; \
972 u32 size; \
973 u32 component; \
974 u32 line; \
975 char module[ACPI_MAX_MODULE_NAME]; \
976 u8 alloc_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700977
Len Brown4be44fc2005-08-05 00:44:28 -0400978struct acpi_debug_mem_header {
979ACPI_COMMON_DEBUG_MEM_HEADER};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700980
Len Brown4be44fc2005-08-05 00:44:28 -0400981struct acpi_debug_mem_block {
982 ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700983};
984
Linus Torvalds1da177e2005-04-16 15:20:36 -0700985#define ACPI_MEM_LIST_GLOBAL 0
986#define ACPI_MEM_LIST_NSNODE 1
Robert Moore73459f72005-06-24 00:00:00 -0400987#define ACPI_MEM_LIST_MAX 1
988#define ACPI_NUM_MEM_LISTS 2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700989
Len Brown4be44fc2005-08-05 00:44:28 -0400990#endif /* __ACLOCAL_H__ */