diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/acpi |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/acpi')
36 files changed, 13816 insertions, 0 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h new file mode 100644 index 000000000000..2b41e47b7d80 --- /dev/null +++ b/include/acpi/acconfig.h | |||
@@ -0,0 +1,217 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acconfig.h - Global configuration constants | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 _ACCONFIG_H | ||
45 | #define _ACCONFIG_H | ||
46 | |||
47 | |||
48 | /****************************************************************************** | ||
49 | * | ||
50 | * Configuration options | ||
51 | * | ||
52 | *****************************************************************************/ | ||
53 | |||
54 | /* | ||
55 | * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the | ||
56 | * ACPI subsystem. This includes the DEBUG_PRINT output | ||
57 | * statements. When disabled, all DEBUG_PRINT | ||
58 | * statements are compiled out. | ||
59 | * | ||
60 | * ACPI_APPLICATION - Use this switch if the subsystem is going to be run | ||
61 | * at the application level. | ||
62 | * | ||
63 | */ | ||
64 | |||
65 | /* Version string */ | ||
66 | |||
67 | #define ACPI_CA_VERSION 0x20050309 | ||
68 | |||
69 | /* | ||
70 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | ||
71 | * but there is a large base of ASL/AML code in existing machines that check | ||
72 | * for the string below. The use of this string usually guarantees that | ||
73 | * the ASL will execute down the most tested code path. Also, there is some | ||
74 | * code that will not execute the _OSI method unless _OS matches the string | ||
75 | * below. Therefore, change this string at your own risk. | ||
76 | */ | ||
77 | #define ACPI_OS_NAME "Microsoft Windows NT" | ||
78 | |||
79 | /* Maximum objects in the various object caches */ | ||
80 | |||
81 | #define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */ | ||
82 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ | ||
83 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ | ||
84 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ | ||
85 | #define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ | ||
86 | |||
87 | /* | ||
88 | * Should the subystem abort the loading of an ACPI table if the | ||
89 | * table checksum is incorrect? | ||
90 | */ | ||
91 | #define ACPI_CHECKSUM_ABORT FALSE | ||
92 | |||
93 | |||
94 | /****************************************************************************** | ||
95 | * | ||
96 | * Subsystem Constants | ||
97 | * | ||
98 | *****************************************************************************/ | ||
99 | |||
100 | /* Version of ACPI supported */ | ||
101 | |||
102 | #define ACPI_CA_SUPPORT_LEVEL 3 | ||
103 | |||
104 | /* String size constants */ | ||
105 | |||
106 | #define ACPI_MAX_STRING_LENGTH 512 | ||
107 | #define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ | ||
108 | |||
109 | /* Maximum count for a semaphore object */ | ||
110 | |||
111 | #define ACPI_MAX_SEMAPHORE_COUNT 256 | ||
112 | |||
113 | /* Max reference count (for debug only) */ | ||
114 | |||
115 | #define ACPI_MAX_REFERENCE_COUNT 0x400 | ||
116 | |||
117 | /* Size of cached memory mapping for system memory operation region */ | ||
118 | |||
119 | #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 | ||
120 | |||
121 | |||
122 | /****************************************************************************** | ||
123 | * | ||
124 | * ACPI Specification constants (Do not change unless the specification changes) | ||
125 | * | ||
126 | *****************************************************************************/ | ||
127 | |||
128 | /* Number of distinct GPE register blocks and register width */ | ||
129 | |||
130 | #define ACPI_MAX_GPE_BLOCKS 2 | ||
131 | #define ACPI_GPE_REGISTER_WIDTH 8 | ||
132 | |||
133 | /* | ||
134 | * Method info (in WALK_STATE), containing local variables and argumetns | ||
135 | */ | ||
136 | #define ACPI_METHOD_NUM_LOCALS 8 | ||
137 | #define ACPI_METHOD_MAX_LOCAL 7 | ||
138 | |||
139 | #define ACPI_METHOD_NUM_ARGS 7 | ||
140 | #define ACPI_METHOD_MAX_ARG 6 | ||
141 | |||
142 | /* Maximum length of resulting string when converting from a buffer */ | ||
143 | |||
144 | #define ACPI_MAX_STRING_CONVERSION 200 | ||
145 | |||
146 | /* Length of _HID, _UID, and _CID values */ | ||
147 | |||
148 | #define ACPI_DEVICE_ID_LENGTH 0x09 | ||
149 | #define ACPI_MAX_CID_LENGTH 48 | ||
150 | |||
151 | /* | ||
152 | * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG | ||
153 | */ | ||
154 | #define ACPI_OBJ_NUM_OPERANDS 8 | ||
155 | #define ACPI_OBJ_MAX_OPERAND 7 | ||
156 | |||
157 | /* Names within the namespace are 4 bytes long */ | ||
158 | |||
159 | #define ACPI_NAME_SIZE 4 | ||
160 | #define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ | ||
161 | #define ACPI_PATH_SEPARATOR '.' | ||
162 | |||
163 | /* Constants used in searching for the RSDP in low memory */ | ||
164 | |||
165 | #define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ | ||
166 | #define ACPI_EBDA_PTR_LENGTH 2 | ||
167 | #define ACPI_EBDA_WINDOW_SIZE 1024 | ||
168 | #define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ | ||
169 | #define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 | ||
170 | #define ACPI_RSDP_SCAN_STEP 16 | ||
171 | |||
172 | /* Operation regions */ | ||
173 | |||
174 | #define ACPI_NUM_PREDEFINED_REGIONS 8 | ||
175 | #define ACPI_USER_REGION_BEGIN 0x80 | ||
176 | |||
177 | /* Maximum space_ids for Operation Regions */ | ||
178 | |||
179 | #define ACPI_MAX_ADDRESS_SPACE 255 | ||
180 | |||
181 | /* Array sizes. Used for range checking also */ | ||
182 | |||
183 | #define ACPI_NUM_ACCESS_TYPES 6 | ||
184 | #define ACPI_NUM_UPDATE_RULES 3 | ||
185 | #define ACPI_NUM_LOCK_RULES 2 | ||
186 | #define ACPI_NUM_MATCH_OPS 6 | ||
187 | #define ACPI_NUM_OPCODES 256 | ||
188 | #define ACPI_NUM_FIELD_NAMES 2 | ||
189 | |||
190 | /* RSDP checksums */ | ||
191 | |||
192 | #define ACPI_RSDP_CHECKSUM_LENGTH 20 | ||
193 | #define ACPI_RSDP_XCHECKSUM_LENGTH 36 | ||
194 | |||
195 | /* SMBus bidirectional buffer size */ | ||
196 | |||
197 | #define ACPI_SMBUS_BUFFER_SIZE 34 | ||
198 | |||
199 | /* Number of strings associated with the _OSI reserved method */ | ||
200 | |||
201 | #define ACPI_NUM_OSI_STRINGS 10 | ||
202 | |||
203 | |||
204 | /****************************************************************************** | ||
205 | * | ||
206 | * ACPI AML Debugger | ||
207 | * | ||
208 | *****************************************************************************/ | ||
209 | |||
210 | #define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ | ||
211 | |||
212 | #define ACPI_DEBUGGER_COMMAND_PROMPT '-' | ||
213 | #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' | ||
214 | |||
215 | |||
216 | #endif /* _ACCONFIG_H */ | ||
217 | |||
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h new file mode 100644 index 000000000000..223b2a506e49 --- /dev/null +++ b/include/acpi/acdebug.h | |||
@@ -0,0 +1,472 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acdebug.h - ACPI/AML debugger | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACDEBUG_H__ | ||
45 | #define __ACDEBUG_H__ | ||
46 | |||
47 | |||
48 | #define ACPI_DEBUG_BUFFER_SIZE 4196 | ||
49 | |||
50 | struct command_info | ||
51 | { | ||
52 | char *name; /* Command Name */ | ||
53 | u8 min_args; /* Minimum arguments required */ | ||
54 | }; | ||
55 | |||
56 | |||
57 | struct argument_info | ||
58 | { | ||
59 | char *name; /* Argument Name */ | ||
60 | }; | ||
61 | |||
62 | |||
63 | #define PARAM_LIST(pl) pl | ||
64 | |||
65 | #define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) | ||
66 | |||
67 | #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ | ||
68 | acpi_os_printf PARAM_LIST(fp);} | ||
69 | |||
70 | #define EX_NO_SINGLE_STEP 1 | ||
71 | #define EX_SINGLE_STEP 2 | ||
72 | |||
73 | |||
74 | /* Prototypes */ | ||
75 | |||
76 | |||
77 | /* | ||
78 | * dbxface - external debugger interfaces | ||
79 | */ | ||
80 | |||
81 | acpi_status | ||
82 | acpi_db_initialize ( | ||
83 | void); | ||
84 | |||
85 | void | ||
86 | acpi_db_terminate ( | ||
87 | void); | ||
88 | |||
89 | acpi_status | ||
90 | acpi_db_single_step ( | ||
91 | struct acpi_walk_state *walk_state, | ||
92 | union acpi_parse_object *op, | ||
93 | u32 op_type); | ||
94 | |||
95 | acpi_status | ||
96 | acpi_db_start_command ( | ||
97 | struct acpi_walk_state *walk_state, | ||
98 | union acpi_parse_object *op); | ||
99 | |||
100 | void | ||
101 | acpi_db_method_end ( | ||
102 | struct acpi_walk_state *walk_state); | ||
103 | |||
104 | |||
105 | /* | ||
106 | * dbcmds - debug commands and output routines | ||
107 | */ | ||
108 | |||
109 | acpi_status | ||
110 | acpi_db_disassemble_method ( | ||
111 | char *name); | ||
112 | |||
113 | void | ||
114 | acpi_db_display_table_info ( | ||
115 | char *table_arg); | ||
116 | |||
117 | void | ||
118 | acpi_db_unload_acpi_table ( | ||
119 | char *table_arg, | ||
120 | char *instance_arg); | ||
121 | |||
122 | void | ||
123 | acpi_db_set_method_breakpoint ( | ||
124 | char *location, | ||
125 | struct acpi_walk_state *walk_state, | ||
126 | union acpi_parse_object *op); | ||
127 | |||
128 | void | ||
129 | acpi_db_set_method_call_breakpoint ( | ||
130 | union acpi_parse_object *op); | ||
131 | |||
132 | void | ||
133 | acpi_db_disassemble_aml ( | ||
134 | char *statements, | ||
135 | union acpi_parse_object *op); | ||
136 | |||
137 | void | ||
138 | acpi_db_dump_namespace ( | ||
139 | char *start_arg, | ||
140 | char *depth_arg); | ||
141 | |||
142 | void | ||
143 | acpi_db_dump_namespace_by_owner ( | ||
144 | char *owner_arg, | ||
145 | char *depth_arg); | ||
146 | |||
147 | void | ||
148 | acpi_db_send_notify ( | ||
149 | char *name, | ||
150 | u32 value); | ||
151 | |||
152 | void | ||
153 | acpi_db_set_method_data ( | ||
154 | char *type_arg, | ||
155 | char *index_arg, | ||
156 | char *value_arg); | ||
157 | |||
158 | acpi_status | ||
159 | acpi_db_display_objects ( | ||
160 | char *obj_type_arg, | ||
161 | char *display_count_arg); | ||
162 | |||
163 | acpi_status | ||
164 | acpi_db_find_name_in_namespace ( | ||
165 | char *name_arg); | ||
166 | |||
167 | void | ||
168 | acpi_db_set_scope ( | ||
169 | char *name); | ||
170 | |||
171 | acpi_status | ||
172 | acpi_db_sleep ( | ||
173 | char *object_arg); | ||
174 | |||
175 | void | ||
176 | acpi_db_find_references ( | ||
177 | char *object_arg); | ||
178 | |||
179 | void | ||
180 | acpi_db_display_locks (void); | ||
181 | |||
182 | |||
183 | void | ||
184 | acpi_db_display_resources ( | ||
185 | char *object_arg); | ||
186 | |||
187 | void | ||
188 | acpi_db_display_gpes (void); | ||
189 | |||
190 | void | ||
191 | acpi_db_check_integrity ( | ||
192 | void); | ||
193 | |||
194 | acpi_status | ||
195 | acpi_db_integrity_walk ( | ||
196 | acpi_handle obj_handle, | ||
197 | u32 nesting_level, | ||
198 | void *context, | ||
199 | void **return_value); | ||
200 | |||
201 | acpi_status | ||
202 | acpi_db_walk_and_match_name ( | ||
203 | acpi_handle obj_handle, | ||
204 | u32 nesting_level, | ||
205 | void *context, | ||
206 | void **return_value); | ||
207 | |||
208 | acpi_status | ||
209 | acpi_db_walk_for_references ( | ||
210 | acpi_handle obj_handle, | ||
211 | u32 nesting_level, | ||
212 | void *context, | ||
213 | void **return_value); | ||
214 | |||
215 | acpi_status | ||
216 | acpi_db_walk_for_specific_objects ( | ||
217 | acpi_handle obj_handle, | ||
218 | u32 nesting_level, | ||
219 | void *context, | ||
220 | void **return_value); | ||
221 | |||
222 | void | ||
223 | acpi_db_generate_gpe ( | ||
224 | char *gpe_arg, | ||
225 | char *block_arg); | ||
226 | |||
227 | /* | ||
228 | * dbdisply - debug display commands | ||
229 | */ | ||
230 | |||
231 | void | ||
232 | acpi_db_display_method_info ( | ||
233 | union acpi_parse_object *op); | ||
234 | |||
235 | void | ||
236 | acpi_db_decode_and_display_object ( | ||
237 | char *target, | ||
238 | char *output_type); | ||
239 | |||
240 | void | ||
241 | acpi_db_display_result_object ( | ||
242 | union acpi_operand_object *obj_desc, | ||
243 | struct acpi_walk_state *walk_state); | ||
244 | |||
245 | acpi_status | ||
246 | acpi_db_display_all_methods ( | ||
247 | char *display_count_arg); | ||
248 | |||
249 | void | ||
250 | acpi_db_display_arguments ( | ||
251 | void); | ||
252 | |||
253 | void | ||
254 | acpi_db_display_locals ( | ||
255 | void); | ||
256 | |||
257 | void | ||
258 | acpi_db_display_results ( | ||
259 | void); | ||
260 | |||
261 | void | ||
262 | acpi_db_display_calling_tree ( | ||
263 | void); | ||
264 | |||
265 | void | ||
266 | acpi_db_display_object_type ( | ||
267 | char *object_arg); | ||
268 | |||
269 | void | ||
270 | acpi_db_display_argument_object ( | ||
271 | union acpi_operand_object *obj_desc, | ||
272 | struct acpi_walk_state *walk_state); | ||
273 | |||
274 | void | ||
275 | acpi_db_dump_parser_descriptor ( | ||
276 | union acpi_parse_object *op); | ||
277 | |||
278 | void * | ||
279 | acpi_db_get_pointer ( | ||
280 | void *target); | ||
281 | |||
282 | |||
283 | /* | ||
284 | * dbexec - debugger control method execution | ||
285 | */ | ||
286 | |||
287 | void | ||
288 | acpi_db_execute ( | ||
289 | char *name, | ||
290 | char **args, | ||
291 | u32 flags); | ||
292 | |||
293 | void | ||
294 | acpi_db_create_execution_threads ( | ||
295 | char *num_threads_arg, | ||
296 | char *num_loops_arg, | ||
297 | char *method_name_arg); | ||
298 | |||
299 | acpi_status | ||
300 | acpi_db_execute_method ( | ||
301 | struct acpi_db_method_info *info, | ||
302 | struct acpi_buffer *return_obj); | ||
303 | |||
304 | void | ||
305 | acpi_db_execute_setup ( | ||
306 | struct acpi_db_method_info *info); | ||
307 | |||
308 | u32 | ||
309 | acpi_db_get_outstanding_allocations ( | ||
310 | void); | ||
311 | |||
312 | void ACPI_SYSTEM_XFACE | ||
313 | acpi_db_method_thread ( | ||
314 | void *context); | ||
315 | |||
316 | acpi_status | ||
317 | acpi_db_execution_walk ( | ||
318 | acpi_handle obj_handle, | ||
319 | u32 nesting_level, | ||
320 | void *context, | ||
321 | void **return_value); | ||
322 | |||
323 | |||
324 | /* | ||
325 | * dbfileio - Debugger file I/O commands | ||
326 | */ | ||
327 | |||
328 | acpi_object_type | ||
329 | acpi_db_match_argument ( | ||
330 | char *user_argument, | ||
331 | struct argument_info *arguments); | ||
332 | |||
333 | acpi_status | ||
334 | ae_local_load_table ( | ||
335 | struct acpi_table_header *table_ptr); | ||
336 | |||
337 | void | ||
338 | acpi_db_close_debug_file ( | ||
339 | void); | ||
340 | |||
341 | void | ||
342 | acpi_db_open_debug_file ( | ||
343 | char *name); | ||
344 | |||
345 | acpi_status | ||
346 | acpi_db_load_acpi_table ( | ||
347 | char *filename); | ||
348 | |||
349 | acpi_status | ||
350 | acpi_db_get_table_from_file ( | ||
351 | char *filename, | ||
352 | struct acpi_table_header **table); | ||
353 | |||
354 | acpi_status | ||
355 | acpi_db_read_table_from_file ( | ||
356 | char *filename, | ||
357 | struct acpi_table_header **table); | ||
358 | |||
359 | /* | ||
360 | * dbhistry - debugger HISTORY command | ||
361 | */ | ||
362 | |||
363 | void | ||
364 | acpi_db_add_to_history ( | ||
365 | char *command_line); | ||
366 | |||
367 | void | ||
368 | acpi_db_display_history (void); | ||
369 | |||
370 | char * | ||
371 | acpi_db_get_from_history ( | ||
372 | char *command_num_arg); | ||
373 | |||
374 | |||
375 | /* | ||
376 | * dbinput - user front-end to the AML debugger | ||
377 | */ | ||
378 | |||
379 | acpi_status | ||
380 | acpi_db_command_dispatch ( | ||
381 | char *input_buffer, | ||
382 | struct acpi_walk_state *walk_state, | ||
383 | union acpi_parse_object *op); | ||
384 | |||
385 | void ACPI_SYSTEM_XFACE | ||
386 | acpi_db_execute_thread ( | ||
387 | void *context); | ||
388 | |||
389 | void | ||
390 | acpi_db_display_help ( | ||
391 | char *help_type); | ||
392 | |||
393 | char * | ||
394 | acpi_db_get_next_token ( | ||
395 | char *string, | ||
396 | char **next); | ||
397 | |||
398 | u32 | ||
399 | acpi_db_get_line ( | ||
400 | char *input_buffer); | ||
401 | |||
402 | u32 | ||
403 | acpi_db_match_command ( | ||
404 | char *user_command); | ||
405 | |||
406 | void | ||
407 | acpi_db_single_thread ( | ||
408 | void); | ||
409 | |||
410 | |||
411 | /* | ||
412 | * dbstats - Generation and display of ACPI table statistics | ||
413 | */ | ||
414 | |||
415 | void | ||
416 | acpi_db_generate_statistics ( | ||
417 | union acpi_parse_object *root, | ||
418 | u8 is_method); | ||
419 | |||
420 | |||
421 | acpi_status | ||
422 | acpi_db_display_statistics ( | ||
423 | char *type_arg); | ||
424 | |||
425 | acpi_status | ||
426 | acpi_db_classify_one_object ( | ||
427 | acpi_handle obj_handle, | ||
428 | u32 nesting_level, | ||
429 | void *context, | ||
430 | void **return_value); | ||
431 | |||
432 | void | ||
433 | acpi_db_count_namespace_objects ( | ||
434 | void); | ||
435 | |||
436 | void | ||
437 | acpi_db_enumerate_object ( | ||
438 | union acpi_operand_object *obj_desc); | ||
439 | |||
440 | |||
441 | /* | ||
442 | * dbutils - AML debugger utilities | ||
443 | */ | ||
444 | |||
445 | void | ||
446 | acpi_db_set_output_destination ( | ||
447 | u32 where); | ||
448 | |||
449 | void | ||
450 | acpi_db_dump_buffer ( | ||
451 | u32 address); | ||
452 | |||
453 | void | ||
454 | acpi_db_dump_object ( | ||
455 | union acpi_object *obj_desc, | ||
456 | u32 level); | ||
457 | |||
458 | void | ||
459 | acpi_db_prep_namestring ( | ||
460 | char *name); | ||
461 | |||
462 | |||
463 | acpi_status | ||
464 | acpi_db_second_pass_parse ( | ||
465 | union acpi_parse_object *root); | ||
466 | |||
467 | struct acpi_namespace_node * | ||
468 | acpi_db_local_ns_lookup ( | ||
469 | char *name); | ||
470 | |||
471 | |||
472 | #endif /* __ACDEBUG_H__ */ | ||
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h new file mode 100644 index 000000000000..26d907eae6fe --- /dev/null +++ b/include/acpi/acdisasm.h | |||
@@ -0,0 +1,428 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acdisasm.h - AML disassembler | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACDISASM_H__ | ||
45 | #define __ACDISASM_H__ | ||
46 | |||
47 | #include "amlresrc.h" | ||
48 | |||
49 | |||
50 | #define BLOCK_NONE 0 | ||
51 | #define BLOCK_PAREN 1 | ||
52 | #define BLOCK_BRACE 2 | ||
53 | #define BLOCK_COMMA_LIST 4 | ||
54 | |||
55 | struct acpi_external_list | ||
56 | { | ||
57 | char *path; | ||
58 | struct acpi_external_list *next; | ||
59 | }; | ||
60 | |||
61 | extern struct acpi_external_list *acpi_gbl_external_list; | ||
62 | extern const char *acpi_gbl_io_decode[2]; | ||
63 | extern const char *acpi_gbl_word_decode[4]; | ||
64 | extern const char *acpi_gbl_consume_decode[2]; | ||
65 | extern const char *acpi_gbl_min_decode[2]; | ||
66 | extern const char *acpi_gbl_max_decode[2]; | ||
67 | extern const char *acpi_gbl_DECdecode[2]; | ||
68 | extern const char *acpi_gbl_RNGdecode[4]; | ||
69 | extern const char *acpi_gbl_MEMdecode[4]; | ||
70 | extern const char *acpi_gbl_RWdecode[2]; | ||
71 | extern const char *acpi_gbl_irq_decode[2]; | ||
72 | extern const char *acpi_gbl_HEdecode[2]; | ||
73 | extern const char *acpi_gbl_LLdecode[2]; | ||
74 | extern const char *acpi_gbl_SHRdecode[2]; | ||
75 | extern const char *acpi_gbl_TYPdecode[4]; | ||
76 | extern const char *acpi_gbl_BMdecode[2]; | ||
77 | extern const char *acpi_gbl_SIZdecode[4]; | ||
78 | extern const char *acpi_gbl_TTPdecode[2]; | ||
79 | extern const char *acpi_gbl_MTPdecode[4]; | ||
80 | extern const char *acpi_gbl_TRSdecode[2]; | ||
81 | |||
82 | |||
83 | extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; | ||
84 | extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; | ||
85 | extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; | ||
86 | extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; | ||
87 | |||
88 | |||
89 | struct acpi_op_walk_info | ||
90 | { | ||
91 | u32 level; | ||
92 | u32 bit_offset; | ||
93 | }; | ||
94 | |||
95 | typedef | ||
96 | acpi_status (*asl_walk_callback) ( | ||
97 | union acpi_parse_object *op, | ||
98 | u32 level, | ||
99 | void *context); | ||
100 | |||
101 | |||
102 | /* | ||
103 | * dmwalk | ||
104 | */ | ||
105 | |||
106 | void | ||
107 | acpi_dm_walk_parse_tree ( | ||
108 | union acpi_parse_object *op, | ||
109 | asl_walk_callback descending_callback, | ||
110 | asl_walk_callback ascending_callback, | ||
111 | void *context); | ||
112 | |||
113 | acpi_status | ||
114 | acpi_dm_descending_op ( | ||
115 | union acpi_parse_object *op, | ||
116 | u32 level, | ||
117 | void *context); | ||
118 | |||
119 | acpi_status | ||
120 | acpi_dm_ascending_op ( | ||
121 | union acpi_parse_object *op, | ||
122 | u32 level, | ||
123 | void *context); | ||
124 | |||
125 | |||
126 | /* | ||
127 | * dmopcode | ||
128 | */ | ||
129 | |||
130 | void | ||
131 | acpi_dm_validate_name ( | ||
132 | char *name, | ||
133 | union acpi_parse_object *op); | ||
134 | |||
135 | u32 | ||
136 | acpi_dm_dump_name ( | ||
137 | char *name); | ||
138 | |||
139 | void | ||
140 | acpi_dm_unicode ( | ||
141 | union acpi_parse_object *op); | ||
142 | |||
143 | void | ||
144 | acpi_dm_disassemble ( | ||
145 | struct acpi_walk_state *walk_state, | ||
146 | union acpi_parse_object *origin, | ||
147 | u32 num_opcodes); | ||
148 | |||
149 | void | ||
150 | acpi_dm_namestring ( | ||
151 | char *name); | ||
152 | |||
153 | void | ||
154 | acpi_dm_display_path ( | ||
155 | union acpi_parse_object *op); | ||
156 | |||
157 | void | ||
158 | acpi_dm_disassemble_one_op ( | ||
159 | struct acpi_walk_state *walk_state, | ||
160 | struct acpi_op_walk_info *info, | ||
161 | union acpi_parse_object *op); | ||
162 | |||
163 | void | ||
164 | acpi_dm_decode_internal_object ( | ||
165 | union acpi_operand_object *obj_desc); | ||
166 | |||
167 | u32 | ||
168 | acpi_dm_block_type ( | ||
169 | union acpi_parse_object *op); | ||
170 | |||
171 | u32 | ||
172 | acpi_dm_list_type ( | ||
173 | union acpi_parse_object *op); | ||
174 | |||
175 | acpi_status | ||
176 | acpi_ps_display_object_pathname ( | ||
177 | struct acpi_walk_state *walk_state, | ||
178 | union acpi_parse_object *op); | ||
179 | |||
180 | void | ||
181 | acpi_dm_method_flags ( | ||
182 | union acpi_parse_object *op); | ||
183 | |||
184 | void | ||
185 | acpi_dm_field_flags ( | ||
186 | union acpi_parse_object *op); | ||
187 | |||
188 | void | ||
189 | acpi_dm_address_space ( | ||
190 | u8 space_id); | ||
191 | |||
192 | void | ||
193 | acpi_dm_region_flags ( | ||
194 | union acpi_parse_object *op); | ||
195 | |||
196 | void | ||
197 | acpi_dm_match_op ( | ||
198 | union acpi_parse_object *op); | ||
199 | |||
200 | void | ||
201 | acpi_dm_match_keyword ( | ||
202 | union acpi_parse_object *op); | ||
203 | |||
204 | u8 | ||
205 | acpi_dm_comma_if_list_member ( | ||
206 | union acpi_parse_object *op); | ||
207 | |||
208 | void | ||
209 | acpi_dm_comma_if_field_member ( | ||
210 | union acpi_parse_object *op); | ||
211 | |||
212 | |||
213 | /* | ||
214 | * dmobject | ||
215 | */ | ||
216 | |||
217 | void | ||
218 | acpi_dm_decode_node ( | ||
219 | struct acpi_namespace_node *node); | ||
220 | |||
221 | void | ||
222 | acpi_dm_display_internal_object ( | ||
223 | union acpi_operand_object *obj_desc, | ||
224 | struct acpi_walk_state *walk_state); | ||
225 | |||
226 | void | ||
227 | acpi_dm_display_arguments ( | ||
228 | struct acpi_walk_state *walk_state); | ||
229 | |||
230 | void | ||
231 | acpi_dm_display_locals ( | ||
232 | struct acpi_walk_state *walk_state); | ||
233 | |||
234 | void | ||
235 | acpi_dm_dump_method_info ( | ||
236 | acpi_status status, | ||
237 | struct acpi_walk_state *walk_state, | ||
238 | union acpi_parse_object *op); | ||
239 | |||
240 | |||
241 | /* | ||
242 | * dmbuffer | ||
243 | */ | ||
244 | |||
245 | void | ||
246 | acpi_is_eisa_id ( | ||
247 | union acpi_parse_object *op); | ||
248 | |||
249 | void | ||
250 | acpi_dm_eisa_id ( | ||
251 | u32 encoded_id); | ||
252 | |||
253 | u8 | ||
254 | acpi_dm_is_unicode_buffer ( | ||
255 | union acpi_parse_object *op); | ||
256 | |||
257 | u8 | ||
258 | acpi_dm_is_string_buffer ( | ||
259 | union acpi_parse_object *op); | ||
260 | |||
261 | |||
262 | /* | ||
263 | * dmresrc | ||
264 | */ | ||
265 | |||
266 | void | ||
267 | acpi_dm_disasm_byte_list ( | ||
268 | u32 level, | ||
269 | u8 *byte_data, | ||
270 | u32 byte_count); | ||
271 | |||
272 | void | ||
273 | acpi_dm_byte_list ( | ||
274 | struct acpi_op_walk_info *info, | ||
275 | union acpi_parse_object *op); | ||
276 | |||
277 | void | ||
278 | acpi_dm_resource_descriptor ( | ||
279 | struct acpi_op_walk_info *info, | ||
280 | u8 *byte_data, | ||
281 | u32 byte_count); | ||
282 | |||
283 | u8 | ||
284 | acpi_dm_is_resource_descriptor ( | ||
285 | union acpi_parse_object *op); | ||
286 | |||
287 | void | ||
288 | acpi_dm_indent ( | ||
289 | u32 level); | ||
290 | |||
291 | void | ||
292 | acpi_dm_bit_list ( | ||
293 | u16 mask); | ||
294 | |||
295 | void | ||
296 | acpi_dm_decode_attribute ( | ||
297 | u8 attribute); | ||
298 | |||
299 | /* | ||
300 | * dmresrcl | ||
301 | */ | ||
302 | |||
303 | void | ||
304 | acpi_dm_io_flags ( | ||
305 | u8 flags); | ||
306 | |||
307 | void | ||
308 | acpi_dm_memory_flags ( | ||
309 | u8 flags, | ||
310 | u8 specific_flags); | ||
311 | |||
312 | void | ||
313 | acpi_dm_word_descriptor ( | ||
314 | struct asl_word_address_desc *resource, | ||
315 | u32 length, | ||
316 | u32 level); | ||
317 | |||
318 | void | ||
319 | acpi_dm_dword_descriptor ( | ||
320 | struct asl_dword_address_desc *resource, | ||
321 | u32 length, | ||
322 | u32 level); | ||
323 | |||
324 | void | ||
325 | acpi_dm_extended_descriptor ( | ||
326 | struct asl_extended_address_desc *resource, | ||
327 | u32 length, | ||
328 | u32 level); | ||
329 | |||
330 | void | ||
331 | acpi_dm_qword_descriptor ( | ||
332 | struct asl_qword_address_desc *resource, | ||
333 | u32 length, | ||
334 | u32 level); | ||
335 | |||
336 | void | ||
337 | acpi_dm_memory24_descriptor ( | ||
338 | struct asl_memory_24_desc *resource, | ||
339 | u32 length, | ||
340 | u32 level); | ||
341 | |||
342 | void | ||
343 | acpi_dm_memory32_descriptor ( | ||
344 | struct asl_memory_32_desc *resource, | ||
345 | u32 length, | ||
346 | u32 level); | ||
347 | |||
348 | void | ||
349 | acpi_dm_fixed_mem32_descriptor ( | ||
350 | struct asl_fixed_memory_32_desc *resource, | ||
351 | u32 length, | ||
352 | u32 level); | ||
353 | |||
354 | void | ||
355 | acpi_dm_generic_register_descriptor ( | ||
356 | struct asl_general_register_desc *resource, | ||
357 | u32 length, | ||
358 | u32 level); | ||
359 | |||
360 | void | ||
361 | acpi_dm_interrupt_descriptor ( | ||
362 | struct asl_extended_xrupt_desc *resource, | ||
363 | u32 length, | ||
364 | u32 level); | ||
365 | |||
366 | void | ||
367 | acpi_dm_vendor_large_descriptor ( | ||
368 | struct asl_large_vendor_desc *resource, | ||
369 | u32 length, | ||
370 | u32 level); | ||
371 | |||
372 | |||
373 | /* | ||
374 | * dmresrcs | ||
375 | */ | ||
376 | |||
377 | void | ||
378 | acpi_dm_irq_descriptor ( | ||
379 | struct asl_irq_format_desc *resource, | ||
380 | u32 length, | ||
381 | u32 level); | ||
382 | |||
383 | void | ||
384 | acpi_dm_dma_descriptor ( | ||
385 | struct asl_dma_format_desc *resource, | ||
386 | u32 length, | ||
387 | u32 level); | ||
388 | |||
389 | void | ||
390 | acpi_dm_io_descriptor ( | ||
391 | struct asl_io_port_desc *resource, | ||
392 | u32 length, | ||
393 | u32 level); | ||
394 | |||
395 | void | ||
396 | acpi_dm_fixed_io_descriptor ( | ||
397 | struct asl_fixed_io_port_desc *resource, | ||
398 | u32 length, | ||
399 | u32 level); | ||
400 | |||
401 | void | ||
402 | acpi_dm_start_dependent_descriptor ( | ||
403 | struct asl_start_dependent_desc *resource, | ||
404 | u32 length, | ||
405 | u32 level); | ||
406 | |||
407 | void | ||
408 | acpi_dm_end_dependent_descriptor ( | ||
409 | struct asl_start_dependent_desc *resource, | ||
410 | u32 length, | ||
411 | u32 level); | ||
412 | |||
413 | void | ||
414 | acpi_dm_vendor_small_descriptor ( | ||
415 | struct asl_small_vendor_desc *resource, | ||
416 | u32 length, | ||
417 | u32 level); | ||
418 | |||
419 | |||
420 | /* | ||
421 | * dmutils | ||
422 | */ | ||
423 | |||
424 | void | ||
425 | acpi_dm_add_to_external_list ( | ||
426 | char *path); | ||
427 | |||
428 | #endif /* __ACDISASM_H__ */ | ||
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h new file mode 100644 index 000000000000..237d63433581 --- /dev/null +++ b/include/acpi/acdispat.h | |||
@@ -0,0 +1,532 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acdispat.h - dispatcher (parser to interpreter interface) | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 | |||
45 | #ifndef _ACDISPAT_H_ | ||
46 | #define _ACDISPAT_H_ | ||
47 | |||
48 | |||
49 | #define NAMEOF_LOCAL_NTE "__L0" | ||
50 | #define NAMEOF_ARG_NTE "__A0" | ||
51 | |||
52 | |||
53 | /* Common interfaces */ | ||
54 | |||
55 | acpi_status | ||
56 | acpi_ds_obj_stack_push ( | ||
57 | void *object, | ||
58 | struct acpi_walk_state *walk_state); | ||
59 | |||
60 | acpi_status | ||
61 | acpi_ds_obj_stack_pop ( | ||
62 | u32 pop_count, | ||
63 | struct acpi_walk_state *walk_state); | ||
64 | |||
65 | #ifdef ACPI_FUTURE_USAGE | ||
66 | void * | ||
67 | acpi_ds_obj_stack_get_value ( | ||
68 | u32 index, | ||
69 | struct acpi_walk_state *walk_state); | ||
70 | #endif | ||
71 | |||
72 | acpi_status | ||
73 | acpi_ds_obj_stack_pop_object ( | ||
74 | union acpi_operand_object **object, | ||
75 | struct acpi_walk_state *walk_state); | ||
76 | |||
77 | |||
78 | /* dsopcode - support for late evaluation */ | ||
79 | |||
80 | acpi_status | ||
81 | acpi_ds_execute_arguments ( | ||
82 | struct acpi_namespace_node *node, | ||
83 | struct acpi_namespace_node *scope_node, | ||
84 | u32 aml_length, | ||
85 | u8 *aml_start); | ||
86 | |||
87 | acpi_status | ||
88 | acpi_ds_get_buffer_field_arguments ( | ||
89 | union acpi_operand_object *obj_desc); | ||
90 | |||
91 | acpi_status | ||
92 | acpi_ds_get_region_arguments ( | ||
93 | union acpi_operand_object *rgn_desc); | ||
94 | |||
95 | acpi_status | ||
96 | acpi_ds_get_buffer_arguments ( | ||
97 | union acpi_operand_object *obj_desc); | ||
98 | |||
99 | acpi_status | ||
100 | acpi_ds_get_package_arguments ( | ||
101 | union acpi_operand_object *obj_desc); | ||
102 | |||
103 | acpi_status | ||
104 | acpi_ds_init_buffer_field ( | ||
105 | u16 aml_opcode, | ||
106 | union acpi_operand_object *obj_desc, | ||
107 | union acpi_operand_object *buffer_desc, | ||
108 | union acpi_operand_object *offset_desc, | ||
109 | union acpi_operand_object *length_desc, | ||
110 | union acpi_operand_object *result_desc); | ||
111 | |||
112 | acpi_status | ||
113 | acpi_ds_eval_buffer_field_operands ( | ||
114 | struct acpi_walk_state *walk_state, | ||
115 | union acpi_parse_object *op); | ||
116 | |||
117 | acpi_status | ||
118 | acpi_ds_eval_region_operands ( | ||
119 | struct acpi_walk_state *walk_state, | ||
120 | union acpi_parse_object *op); | ||
121 | |||
122 | acpi_status | ||
123 | acpi_ds_eval_data_object_operands ( | ||
124 | struct acpi_walk_state *walk_state, | ||
125 | union acpi_parse_object *op, | ||
126 | union acpi_operand_object *obj_desc); | ||
127 | |||
128 | acpi_status | ||
129 | acpi_ds_initialize_region ( | ||
130 | acpi_handle obj_handle); | ||
131 | |||
132 | |||
133 | /* dsctrl - Parser/Interpreter interface, control stack routines */ | ||
134 | |||
135 | |||
136 | acpi_status | ||
137 | acpi_ds_exec_begin_control_op ( | ||
138 | struct acpi_walk_state *walk_state, | ||
139 | union acpi_parse_object *op); | ||
140 | |||
141 | acpi_status | ||
142 | acpi_ds_exec_end_control_op ( | ||
143 | struct acpi_walk_state *walk_state, | ||
144 | union acpi_parse_object *op); | ||
145 | |||
146 | |||
147 | /* dsexec - Parser/Interpreter interface, method execution callbacks */ | ||
148 | |||
149 | |||
150 | acpi_status | ||
151 | acpi_ds_get_predicate_value ( | ||
152 | struct acpi_walk_state *walk_state, | ||
153 | union acpi_operand_object *result_obj); | ||
154 | |||
155 | acpi_status | ||
156 | acpi_ds_exec_begin_op ( | ||
157 | struct acpi_walk_state *walk_state, | ||
158 | union acpi_parse_object **out_op); | ||
159 | |||
160 | acpi_status | ||
161 | acpi_ds_exec_end_op ( | ||
162 | struct acpi_walk_state *state); | ||
163 | |||
164 | |||
165 | /* dsfield - Parser/Interpreter interface for AML fields */ | ||
166 | |||
167 | acpi_status | ||
168 | acpi_ds_get_field_names ( | ||
169 | struct acpi_create_field_info *info, | ||
170 | struct acpi_walk_state *walk_state, | ||
171 | union acpi_parse_object *arg); | ||
172 | |||
173 | acpi_status | ||
174 | acpi_ds_create_field ( | ||
175 | union acpi_parse_object *op, | ||
176 | struct acpi_namespace_node *region_node, | ||
177 | struct acpi_walk_state *walk_state); | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ds_create_bank_field ( | ||
181 | union acpi_parse_object *op, | ||
182 | struct acpi_namespace_node *region_node, | ||
183 | struct acpi_walk_state *walk_state); | ||
184 | |||
185 | acpi_status | ||
186 | acpi_ds_create_index_field ( | ||
187 | union acpi_parse_object *op, | ||
188 | struct acpi_namespace_node *region_node, | ||
189 | struct acpi_walk_state *walk_state); | ||
190 | |||
191 | acpi_status | ||
192 | acpi_ds_create_buffer_field ( | ||
193 | union acpi_parse_object *op, | ||
194 | struct acpi_walk_state *walk_state); | ||
195 | |||
196 | acpi_status | ||
197 | acpi_ds_init_field_objects ( | ||
198 | union acpi_parse_object *op, | ||
199 | struct acpi_walk_state *walk_state); | ||
200 | |||
201 | |||
202 | /* dsload - Parser/Interpreter interface, namespace load callbacks */ | ||
203 | |||
204 | acpi_status | ||
205 | acpi_ds_load1_begin_op ( | ||
206 | struct acpi_walk_state *walk_state, | ||
207 | union acpi_parse_object **out_op); | ||
208 | |||
209 | acpi_status | ||
210 | acpi_ds_load1_end_op ( | ||
211 | struct acpi_walk_state *walk_state); | ||
212 | |||
213 | acpi_status | ||
214 | acpi_ds_load2_begin_op ( | ||
215 | struct acpi_walk_state *walk_state, | ||
216 | union acpi_parse_object **out_op); | ||
217 | |||
218 | acpi_status | ||
219 | acpi_ds_load2_end_op ( | ||
220 | struct acpi_walk_state *walk_state); | ||
221 | |||
222 | acpi_status | ||
223 | acpi_ds_init_callbacks ( | ||
224 | struct acpi_walk_state *walk_state, | ||
225 | u32 pass_number); | ||
226 | |||
227 | |||
228 | /* dsmthdat - method data (locals/args) */ | ||
229 | |||
230 | |||
231 | acpi_status | ||
232 | acpi_ds_store_object_to_local ( | ||
233 | u16 opcode, | ||
234 | u32 index, | ||
235 | union acpi_operand_object *src_desc, | ||
236 | struct acpi_walk_state *walk_state); | ||
237 | |||
238 | acpi_status | ||
239 | acpi_ds_method_data_get_entry ( | ||
240 | u16 opcode, | ||
241 | u32 index, | ||
242 | struct acpi_walk_state *walk_state, | ||
243 | union acpi_operand_object ***node); | ||
244 | |||
245 | void | ||
246 | acpi_ds_method_data_delete_all ( | ||
247 | struct acpi_walk_state *walk_state); | ||
248 | |||
249 | u8 | ||
250 | acpi_ds_is_method_value ( | ||
251 | union acpi_operand_object *obj_desc); | ||
252 | |||
253 | #ifdef ACPI_FUTURE_USAGE | ||
254 | acpi_object_type | ||
255 | acpi_ds_method_data_get_type ( | ||
256 | u16 opcode, | ||
257 | u32 index, | ||
258 | struct acpi_walk_state *walk_state); | ||
259 | #endif | ||
260 | |||
261 | acpi_status | ||
262 | acpi_ds_method_data_get_value ( | ||
263 | u16 opcode, | ||
264 | u32 index, | ||
265 | struct acpi_walk_state *walk_state, | ||
266 | union acpi_operand_object **dest_desc); | ||
267 | |||
268 | void | ||
269 | acpi_ds_method_data_delete_value ( | ||
270 | u16 opcode, | ||
271 | u32 index, | ||
272 | struct acpi_walk_state *walk_state); | ||
273 | |||
274 | acpi_status | ||
275 | acpi_ds_method_data_init_args ( | ||
276 | union acpi_operand_object **params, | ||
277 | u32 max_param_count, | ||
278 | struct acpi_walk_state *walk_state); | ||
279 | |||
280 | acpi_status | ||
281 | acpi_ds_method_data_get_node ( | ||
282 | u16 opcode, | ||
283 | u32 index, | ||
284 | struct acpi_walk_state *walk_state, | ||
285 | struct acpi_namespace_node **node); | ||
286 | |||
287 | void | ||
288 | acpi_ds_method_data_init ( | ||
289 | struct acpi_walk_state *walk_state); | ||
290 | |||
291 | acpi_status | ||
292 | acpi_ds_method_data_set_value ( | ||
293 | u16 opcode, | ||
294 | u32 index, | ||
295 | union acpi_operand_object *object, | ||
296 | struct acpi_walk_state *walk_state); | ||
297 | |||
298 | |||
299 | /* dsmethod - Parser/Interpreter interface - control method parsing */ | ||
300 | |||
301 | acpi_status | ||
302 | acpi_ds_parse_method ( | ||
303 | acpi_handle obj_handle); | ||
304 | |||
305 | acpi_status | ||
306 | acpi_ds_call_control_method ( | ||
307 | struct acpi_thread_state *thread, | ||
308 | struct acpi_walk_state *walk_state, | ||
309 | union acpi_parse_object *op); | ||
310 | |||
311 | acpi_status | ||
312 | acpi_ds_restart_control_method ( | ||
313 | struct acpi_walk_state *walk_state, | ||
314 | union acpi_operand_object *return_desc); | ||
315 | |||
316 | acpi_status | ||
317 | acpi_ds_terminate_control_method ( | ||
318 | struct acpi_walk_state *walk_state); | ||
319 | |||
320 | acpi_status | ||
321 | acpi_ds_begin_method_execution ( | ||
322 | struct acpi_namespace_node *method_node, | ||
323 | union acpi_operand_object *obj_desc, | ||
324 | struct acpi_namespace_node *calling_method_node); | ||
325 | |||
326 | |||
327 | /* dsobj - Parser/Interpreter interface - object initialization and conversion */ | ||
328 | |||
329 | acpi_status | ||
330 | acpi_ds_init_one_object ( | ||
331 | acpi_handle obj_handle, | ||
332 | u32 level, | ||
333 | void *context, | ||
334 | void **return_value); | ||
335 | |||
336 | acpi_status | ||
337 | acpi_ds_initialize_objects ( | ||
338 | struct acpi_table_desc *table_desc, | ||
339 | struct acpi_namespace_node *start_node); | ||
340 | |||
341 | acpi_status | ||
342 | acpi_ds_build_internal_buffer_obj ( | ||
343 | struct acpi_walk_state *walk_state, | ||
344 | union acpi_parse_object *op, | ||
345 | u32 buffer_length, | ||
346 | union acpi_operand_object **obj_desc_ptr); | ||
347 | |||
348 | acpi_status | ||
349 | acpi_ds_build_internal_package_obj ( | ||
350 | struct acpi_walk_state *walk_state, | ||
351 | union acpi_parse_object *op, | ||
352 | u32 package_length, | ||
353 | union acpi_operand_object **obj_desc); | ||
354 | |||
355 | acpi_status | ||
356 | acpi_ds_build_internal_object ( | ||
357 | struct acpi_walk_state *walk_state, | ||
358 | union acpi_parse_object *op, | ||
359 | union acpi_operand_object **obj_desc_ptr); | ||
360 | |||
361 | acpi_status | ||
362 | acpi_ds_init_object_from_op ( | ||
363 | struct acpi_walk_state *walk_state, | ||
364 | union acpi_parse_object *op, | ||
365 | u16 opcode, | ||
366 | union acpi_operand_object **obj_desc); | ||
367 | |||
368 | acpi_status | ||
369 | acpi_ds_create_node ( | ||
370 | struct acpi_walk_state *walk_state, | ||
371 | struct acpi_namespace_node *node, | ||
372 | union acpi_parse_object *op); | ||
373 | |||
374 | |||
375 | /* dsutils - Parser/Interpreter interface utility routines */ | ||
376 | |||
377 | void | ||
378 | acpi_ds_clear_implicit_return ( | ||
379 | struct acpi_walk_state *walk_state); | ||
380 | |||
381 | u8 | ||
382 | acpi_ds_do_implicit_return ( | ||
383 | union acpi_operand_object *return_desc, | ||
384 | struct acpi_walk_state *walk_state, | ||
385 | u8 add_reference); | ||
386 | |||
387 | u8 | ||
388 | acpi_ds_is_result_used ( | ||
389 | union acpi_parse_object *op, | ||
390 | struct acpi_walk_state *walk_state); | ||
391 | |||
392 | void | ||
393 | acpi_ds_delete_result_if_not_used ( | ||
394 | union acpi_parse_object *op, | ||
395 | union acpi_operand_object *result_obj, | ||
396 | struct acpi_walk_state *walk_state); | ||
397 | |||
398 | acpi_status | ||
399 | acpi_ds_create_operand ( | ||
400 | struct acpi_walk_state *walk_state, | ||
401 | union acpi_parse_object *arg, | ||
402 | u32 args_remaining); | ||
403 | |||
404 | acpi_status | ||
405 | acpi_ds_create_operands ( | ||
406 | struct acpi_walk_state *walk_state, | ||
407 | union acpi_parse_object *first_arg); | ||
408 | |||
409 | acpi_status | ||
410 | acpi_ds_resolve_operands ( | ||
411 | struct acpi_walk_state *walk_state); | ||
412 | |||
413 | void | ||
414 | acpi_ds_clear_operands ( | ||
415 | struct acpi_walk_state *walk_state); | ||
416 | |||
417 | |||
418 | /* | ||
419 | * dswscope - Scope Stack manipulation | ||
420 | */ | ||
421 | |||
422 | acpi_status | ||
423 | acpi_ds_scope_stack_push ( | ||
424 | struct acpi_namespace_node *node, | ||
425 | acpi_object_type type, | ||
426 | struct acpi_walk_state *walk_state); | ||
427 | |||
428 | |||
429 | acpi_status | ||
430 | acpi_ds_scope_stack_pop ( | ||
431 | struct acpi_walk_state *walk_state); | ||
432 | |||
433 | void | ||
434 | acpi_ds_scope_stack_clear ( | ||
435 | struct acpi_walk_state *walk_state); | ||
436 | |||
437 | |||
438 | /* dswstate - parser WALK_STATE management routines */ | ||
439 | |||
440 | struct acpi_walk_state * | ||
441 | acpi_ds_create_walk_state ( | ||
442 | acpi_owner_id owner_id, | ||
443 | union acpi_parse_object *origin, | ||
444 | union acpi_operand_object *mth_desc, | ||
445 | struct acpi_thread_state *thread); | ||
446 | |||
447 | acpi_status | ||
448 | acpi_ds_init_aml_walk ( | ||
449 | struct acpi_walk_state *walk_state, | ||
450 | union acpi_parse_object *op, | ||
451 | struct acpi_namespace_node *method_node, | ||
452 | u8 *aml_start, | ||
453 | u32 aml_length, | ||
454 | struct acpi_parameter_info *info, | ||
455 | u32 pass_number); | ||
456 | |||
457 | #ifdef ACPI_FUTURE_USAGE | ||
458 | acpi_status | ||
459 | acpi_ds_obj_stack_delete_all ( | ||
460 | struct acpi_walk_state *walk_state); | ||
461 | #endif | ||
462 | |||
463 | acpi_status | ||
464 | acpi_ds_obj_stack_pop_and_delete ( | ||
465 | u32 pop_count, | ||
466 | struct acpi_walk_state *walk_state); | ||
467 | |||
468 | void | ||
469 | acpi_ds_delete_walk_state ( | ||
470 | struct acpi_walk_state *walk_state); | ||
471 | |||
472 | struct acpi_walk_state * | ||
473 | acpi_ds_pop_walk_state ( | ||
474 | struct acpi_thread_state *thread); | ||
475 | |||
476 | void | ||
477 | acpi_ds_push_walk_state ( | ||
478 | struct acpi_walk_state *walk_state, | ||
479 | struct acpi_thread_state *thread); | ||
480 | |||
481 | acpi_status | ||
482 | acpi_ds_result_stack_pop ( | ||
483 | struct acpi_walk_state *walk_state); | ||
484 | |||
485 | acpi_status | ||
486 | acpi_ds_result_stack_push ( | ||
487 | struct acpi_walk_state *walk_state); | ||
488 | |||
489 | acpi_status | ||
490 | acpi_ds_result_stack_clear ( | ||
491 | struct acpi_walk_state *walk_state); | ||
492 | |||
493 | struct acpi_walk_state * | ||
494 | acpi_ds_get_current_walk_state ( | ||
495 | struct acpi_thread_state *thread); | ||
496 | |||
497 | #ifdef ACPI_ENABLE_OBJECT_CACHE | ||
498 | void | ||
499 | acpi_ds_delete_walk_state_cache ( | ||
500 | void); | ||
501 | #endif | ||
502 | |||
503 | #ifdef ACPI_FUTURE_USAGE | ||
504 | acpi_status | ||
505 | acpi_ds_result_insert ( | ||
506 | void *object, | ||
507 | u32 index, | ||
508 | struct acpi_walk_state *walk_state); | ||
509 | |||
510 | acpi_status | ||
511 | acpi_ds_result_remove ( | ||
512 | union acpi_operand_object **object, | ||
513 | u32 index, | ||
514 | struct acpi_walk_state *walk_state); | ||
515 | #endif | ||
516 | |||
517 | acpi_status | ||
518 | acpi_ds_result_pop ( | ||
519 | union acpi_operand_object **object, | ||
520 | struct acpi_walk_state *walk_state); | ||
521 | |||
522 | acpi_status | ||
523 | acpi_ds_result_push ( | ||
524 | union acpi_operand_object *object, | ||
525 | struct acpi_walk_state *walk_state); | ||
526 | |||
527 | acpi_status | ||
528 | acpi_ds_result_pop_from_bottom ( | ||
529 | union acpi_operand_object **object, | ||
530 | struct acpi_walk_state *walk_state); | ||
531 | |||
532 | #endif /* _ACDISPAT_H_ */ | ||
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h new file mode 100644 index 000000000000..2dec083ba1cd --- /dev/null +++ b/include/acpi/acevents.h | |||
@@ -0,0 +1,320 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acevents.h - Event subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACEVENTS_H__ | ||
45 | #define __ACEVENTS_H__ | ||
46 | |||
47 | |||
48 | acpi_status | ||
49 | acpi_ev_initialize_events ( | ||
50 | void); | ||
51 | |||
52 | acpi_status | ||
53 | acpi_ev_install_xrupt_handlers ( | ||
54 | void); | ||
55 | |||
56 | |||
57 | /* | ||
58 | * Evfixed - Fixed event handling | ||
59 | */ | ||
60 | |||
61 | acpi_status | ||
62 | acpi_ev_fixed_event_initialize ( | ||
63 | void); | ||
64 | |||
65 | u32 | ||
66 | acpi_ev_fixed_event_detect ( | ||
67 | void); | ||
68 | |||
69 | u32 | ||
70 | acpi_ev_fixed_event_dispatch ( | ||
71 | u32 event); | ||
72 | |||
73 | |||
74 | /* | ||
75 | * Evmisc | ||
76 | */ | ||
77 | |||
78 | u8 | ||
79 | acpi_ev_is_notify_object ( | ||
80 | struct acpi_namespace_node *node); | ||
81 | |||
82 | acpi_status | ||
83 | acpi_ev_acquire_global_lock( | ||
84 | u16 timeout); | ||
85 | |||
86 | acpi_status | ||
87 | acpi_ev_release_global_lock( | ||
88 | void); | ||
89 | |||
90 | acpi_status | ||
91 | acpi_ev_init_global_lock_handler ( | ||
92 | void); | ||
93 | |||
94 | u32 | ||
95 | acpi_ev_get_gpe_number_index ( | ||
96 | u32 gpe_number); | ||
97 | |||
98 | acpi_status | ||
99 | acpi_ev_queue_notify_request ( | ||
100 | struct acpi_namespace_node *node, | ||
101 | u32 notify_value); | ||
102 | |||
103 | void ACPI_SYSTEM_XFACE | ||
104 | acpi_ev_notify_dispatch ( | ||
105 | void *context); | ||
106 | |||
107 | |||
108 | /* | ||
109 | * Evgpe - GPE handling and dispatch | ||
110 | */ | ||
111 | |||
112 | acpi_status | ||
113 | acpi_ev_walk_gpe_list ( | ||
114 | ACPI_GPE_CALLBACK gpe_walk_callback, | ||
115 | u32 flags); | ||
116 | |||
117 | u8 | ||
118 | acpi_ev_valid_gpe_event ( | ||
119 | struct acpi_gpe_event_info *gpe_event_info); | ||
120 | |||
121 | acpi_status | ||
122 | acpi_ev_update_gpe_enable_masks ( | ||
123 | struct acpi_gpe_event_info *gpe_event_info, | ||
124 | u8 type); | ||
125 | |||
126 | acpi_status | ||
127 | acpi_ev_enable_gpe ( | ||
128 | struct acpi_gpe_event_info *gpe_event_info, | ||
129 | u8 write_to_hardware); | ||
130 | |||
131 | acpi_status | ||
132 | acpi_ev_disable_gpe ( | ||
133 | struct acpi_gpe_event_info *gpe_event_info); | ||
134 | |||
135 | struct acpi_gpe_event_info * | ||
136 | acpi_ev_get_gpe_event_info ( | ||
137 | acpi_handle gpe_device, | ||
138 | u32 gpe_number); | ||
139 | |||
140 | acpi_status | ||
141 | acpi_ev_gpe_initialize ( | ||
142 | void); | ||
143 | |||
144 | acpi_status | ||
145 | acpi_ev_create_gpe_block ( | ||
146 | struct acpi_namespace_node *gpe_device, | ||
147 | struct acpi_generic_address *gpe_block_address, | ||
148 | u32 register_count, | ||
149 | u8 gpe_block_base_number, | ||
150 | u32 interrupt_level, | ||
151 | struct acpi_gpe_block_info **return_gpe_block); | ||
152 | |||
153 | acpi_status | ||
154 | acpi_ev_delete_gpe_block ( | ||
155 | struct acpi_gpe_block_info *gpe_block); | ||
156 | |||
157 | acpi_status | ||
158 | acpi_ev_delete_gpe_handlers ( | ||
159 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
160 | struct acpi_gpe_block_info *gpe_block); | ||
161 | |||
162 | u32 | ||
163 | acpi_ev_gpe_dispatch ( | ||
164 | struct acpi_gpe_event_info *gpe_event_info, | ||
165 | u32 gpe_number); | ||
166 | |||
167 | u32 | ||
168 | acpi_ev_gpe_detect ( | ||
169 | struct acpi_gpe_xrupt_info *gpe_xrupt_list); | ||
170 | |||
171 | acpi_status | ||
172 | acpi_ev_set_gpe_type ( | ||
173 | struct acpi_gpe_event_info *gpe_event_info, | ||
174 | u8 type); | ||
175 | |||
176 | acpi_status | ||
177 | acpi_ev_check_for_wake_only_gpe ( | ||
178 | struct acpi_gpe_event_info *gpe_event_info); | ||
179 | |||
180 | /* | ||
181 | * Evregion - Address Space handling | ||
182 | */ | ||
183 | |||
184 | acpi_status | ||
185 | acpi_ev_install_region_handlers ( | ||
186 | void); | ||
187 | |||
188 | acpi_status | ||
189 | acpi_ev_initialize_op_regions ( | ||
190 | void); | ||
191 | |||
192 | acpi_status | ||
193 | acpi_ev_address_space_dispatch ( | ||
194 | union acpi_operand_object *region_obj, | ||
195 | u32 function, | ||
196 | acpi_physical_address address, | ||
197 | u32 bit_width, | ||
198 | void *value); | ||
199 | |||
200 | acpi_status | ||
201 | acpi_ev_install_handler ( | ||
202 | acpi_handle obj_handle, | ||
203 | u32 level, | ||
204 | void *context, | ||
205 | void **return_value); | ||
206 | |||
207 | acpi_status | ||
208 | acpi_ev_attach_region ( | ||
209 | union acpi_operand_object *handler_obj, | ||
210 | union acpi_operand_object *region_obj, | ||
211 | u8 acpi_ns_is_locked); | ||
212 | |||
213 | void | ||
214 | acpi_ev_detach_region ( | ||
215 | union acpi_operand_object *region_obj, | ||
216 | u8 acpi_ns_is_locked); | ||
217 | |||
218 | acpi_status | ||
219 | acpi_ev_install_space_handler ( | ||
220 | struct acpi_namespace_node *node, | ||
221 | acpi_adr_space_type space_id, | ||
222 | acpi_adr_space_handler handler, | ||
223 | acpi_adr_space_setup setup, | ||
224 | void *context); | ||
225 | |||
226 | acpi_status | ||
227 | acpi_ev_execute_reg_methods ( | ||
228 | struct acpi_namespace_node *node, | ||
229 | acpi_adr_space_type space_id); | ||
230 | |||
231 | acpi_status | ||
232 | acpi_ev_execute_reg_method ( | ||
233 | union acpi_operand_object *region_obj, | ||
234 | u32 function); | ||
235 | |||
236 | acpi_status | ||
237 | acpi_ev_reg_run ( | ||
238 | acpi_handle obj_handle, | ||
239 | u32 level, | ||
240 | void *context, | ||
241 | void **return_value); | ||
242 | |||
243 | /* | ||
244 | * Evregini - Region initialization and setup | ||
245 | */ | ||
246 | |||
247 | acpi_status | ||
248 | acpi_ev_system_memory_region_setup ( | ||
249 | acpi_handle handle, | ||
250 | u32 function, | ||
251 | void *handler_context, | ||
252 | void **region_context); | ||
253 | |||
254 | acpi_status | ||
255 | acpi_ev_io_space_region_setup ( | ||
256 | acpi_handle handle, | ||
257 | u32 function, | ||
258 | void *handler_context, | ||
259 | void **region_context); | ||
260 | |||
261 | acpi_status | ||
262 | acpi_ev_pci_config_region_setup ( | ||
263 | acpi_handle handle, | ||
264 | u32 function, | ||
265 | void *handler_context, | ||
266 | void **region_context); | ||
267 | |||
268 | acpi_status | ||
269 | acpi_ev_cmos_region_setup ( | ||
270 | acpi_handle handle, | ||
271 | u32 function, | ||
272 | void *handler_context, | ||
273 | void **region_context); | ||
274 | |||
275 | acpi_status | ||
276 | acpi_ev_pci_bar_region_setup ( | ||
277 | acpi_handle handle, | ||
278 | u32 function, | ||
279 | void *handler_context, | ||
280 | void **region_context); | ||
281 | |||
282 | acpi_status | ||
283 | acpi_ev_default_region_setup ( | ||
284 | acpi_handle handle, | ||
285 | u32 function, | ||
286 | void *handler_context, | ||
287 | void **region_context); | ||
288 | |||
289 | acpi_status | ||
290 | acpi_ev_initialize_region ( | ||
291 | union acpi_operand_object *region_obj, | ||
292 | u8 acpi_ns_locked); | ||
293 | |||
294 | |||
295 | /* | ||
296 | * Evsci - SCI (System Control Interrupt) handling/dispatch | ||
297 | */ | ||
298 | |||
299 | u32 ACPI_SYSTEM_XFACE | ||
300 | acpi_ev_gpe_xrupt_handler ( | ||
301 | void *context); | ||
302 | |||
303 | u32 | ||
304 | acpi_ev_install_sci_handler ( | ||
305 | void); | ||
306 | |||
307 | acpi_status | ||
308 | acpi_ev_remove_sci_handler ( | ||
309 | void); | ||
310 | |||
311 | u32 | ||
312 | acpi_ev_initialize_sCI ( | ||
313 | u32 program_sCI); | ||
314 | |||
315 | void | ||
316 | acpi_ev_terminate ( | ||
317 | void); | ||
318 | |||
319 | |||
320 | #endif /* __ACEVENTS_H__ */ | ||
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h new file mode 100644 index 000000000000..53f8b50fac1a --- /dev/null +++ b/include/acpi/acexcep.h | |||
@@ -0,0 +1,308 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acexcep.h - Exception codes returned by the ACPI subsystem | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACEXCEP_H__ | ||
45 | #define __ACEXCEP_H__ | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Exceptions returned by external ACPI interfaces | ||
50 | */ | ||
51 | |||
52 | #define AE_CODE_ENVIRONMENTAL 0x0000 | ||
53 | #define AE_CODE_PROGRAMMER 0x1000 | ||
54 | #define AE_CODE_ACPI_TABLES 0x2000 | ||
55 | #define AE_CODE_AML 0x3000 | ||
56 | #define AE_CODE_CONTROL 0x4000 | ||
57 | #define AE_CODE_MASK 0xF000 | ||
58 | |||
59 | |||
60 | #define ACPI_SUCCESS(a) (!(a)) | ||
61 | #define ACPI_FAILURE(a) (a) | ||
62 | |||
63 | |||
64 | #define AE_OK (acpi_status) 0x0000 | ||
65 | |||
66 | /* | ||
67 | * Environmental exceptions | ||
68 | */ | ||
69 | #define AE_ERROR (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL) | ||
70 | #define AE_NO_ACPI_TABLES (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL) | ||
71 | #define AE_NO_NAMESPACE (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL) | ||
72 | #define AE_NO_MEMORY (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL) | ||
73 | #define AE_NOT_FOUND (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL) | ||
74 | #define AE_NOT_EXIST (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL) | ||
75 | #define AE_ALREADY_EXISTS (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL) | ||
76 | #define AE_TYPE (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL) | ||
77 | #define AE_NULL_OBJECT (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL) | ||
78 | #define AE_NULL_ENTRY (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL) | ||
79 | #define AE_BUFFER_OVERFLOW (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL) | ||
80 | #define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL) | ||
81 | #define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL) | ||
82 | #define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL) | ||
83 | #define AE_VERSION_MISMATCH (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL) | ||
84 | #define AE_SUPPORT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL) | ||
85 | #define AE_SHARE (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL) | ||
86 | #define AE_LIMIT (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL) | ||
87 | #define AE_TIME (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL) | ||
88 | #define AE_UNKNOWN_STATUS (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL) | ||
89 | #define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL) | ||
90 | #define AE_RELEASE_DEADLOCK (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL) | ||
91 | #define AE_NOT_ACQUIRED (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) | ||
92 | #define AE_ALREADY_ACQUIRED (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) | ||
93 | #define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) | ||
94 | #define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) | ||
95 | #define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) | ||
96 | #define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) | ||
97 | #define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL) | ||
98 | #define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL) | ||
99 | |||
100 | #define AE_CODE_ENV_MAX 0x001E | ||
101 | |||
102 | /* | ||
103 | * Programmer exceptions | ||
104 | */ | ||
105 | #define AE_BAD_PARAMETER (acpi_status) (0x0001 | AE_CODE_PROGRAMMER) | ||
106 | #define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER) | ||
107 | #define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER) | ||
108 | #define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER) | ||
109 | #define AE_BAD_ADDRESS (acpi_status) (0x0005 | AE_CODE_PROGRAMMER) | ||
110 | #define AE_ALIGNMENT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) | ||
111 | #define AE_BAD_HEX_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) | ||
112 | #define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) | ||
113 | #define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0009 | AE_CODE_PROGRAMMER) | ||
114 | |||
115 | #define AE_CODE_PGM_MAX 0x0009 | ||
116 | |||
117 | |||
118 | /* | ||
119 | * Acpi table exceptions | ||
120 | */ | ||
121 | #define AE_BAD_SIGNATURE (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES) | ||
122 | #define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES) | ||
123 | #define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES) | ||
124 | #define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES) | ||
125 | #define AE_TABLE_NOT_SUPPORTED (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES) | ||
126 | #define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES) | ||
127 | |||
128 | #define AE_CODE_TBL_MAX 0x0006 | ||
129 | |||
130 | |||
131 | /* | ||
132 | * AML exceptions. These are caused by problems with | ||
133 | * the actual AML byte stream | ||
134 | */ | ||
135 | #define AE_AML_ERROR (acpi_status) (0x0001 | AE_CODE_AML) | ||
136 | #define AE_AML_PARSE (acpi_status) (0x0002 | AE_CODE_AML) | ||
137 | #define AE_AML_BAD_OPCODE (acpi_status) (0x0003 | AE_CODE_AML) | ||
138 | #define AE_AML_NO_OPERAND (acpi_status) (0x0004 | AE_CODE_AML) | ||
139 | #define AE_AML_OPERAND_TYPE (acpi_status) (0x0005 | AE_CODE_AML) | ||
140 | #define AE_AML_OPERAND_VALUE (acpi_status) (0x0006 | AE_CODE_AML) | ||
141 | #define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0007 | AE_CODE_AML) | ||
142 | #define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0008 | AE_CODE_AML) | ||
143 | #define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0009 | AE_CODE_AML) | ||
144 | #define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x000A | AE_CODE_AML) | ||
145 | #define AE_AML_REGION_LIMIT (acpi_status) (0x000B | AE_CODE_AML) | ||
146 | #define AE_AML_BUFFER_LIMIT (acpi_status) (0x000C | AE_CODE_AML) | ||
147 | #define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000D | AE_CODE_AML) | ||
148 | #define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000E | AE_CODE_AML) | ||
149 | #define AE_AML_BAD_NAME (acpi_status) (0x000F | AE_CODE_AML) | ||
150 | #define AE_AML_NAME_NOT_FOUND (acpi_status) (0x0010 | AE_CODE_AML) | ||
151 | #define AE_AML_INTERNAL (acpi_status) (0x0011 | AE_CODE_AML) | ||
152 | #define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0012 | AE_CODE_AML) | ||
153 | #define AE_AML_STRING_LIMIT (acpi_status) (0x0013 | AE_CODE_AML) | ||
154 | #define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0014 | AE_CODE_AML) | ||
155 | #define AE_AML_METHOD_LIMIT (acpi_status) (0x0015 | AE_CODE_AML) | ||
156 | #define AE_AML_NOT_OWNER (acpi_status) (0x0016 | AE_CODE_AML) | ||
157 | #define AE_AML_MUTEX_ORDER (acpi_status) (0x0017 | AE_CODE_AML) | ||
158 | #define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0018 | AE_CODE_AML) | ||
159 | #define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0019 | AE_CODE_AML) | ||
160 | #define AE_AML_INVALID_INDEX (acpi_status) (0x001A | AE_CODE_AML) | ||
161 | #define AE_AML_REGISTER_LIMIT (acpi_status) (0x001B | AE_CODE_AML) | ||
162 | #define AE_AML_NO_WHILE (acpi_status) (0x001C | AE_CODE_AML) | ||
163 | #define AE_AML_ALIGNMENT (acpi_status) (0x001D | AE_CODE_AML) | ||
164 | #define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001E | AE_CODE_AML) | ||
165 | #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) | ||
166 | #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) | ||
167 | #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) | ||
168 | |||
169 | #define AE_CODE_AML_MAX 0x0021 | ||
170 | |||
171 | /* | ||
172 | * Internal exceptions used for control | ||
173 | */ | ||
174 | #define AE_CTRL_RETURN_VALUE (acpi_status) (0x0001 | AE_CODE_CONTROL) | ||
175 | #define AE_CTRL_PENDING (acpi_status) (0x0002 | AE_CODE_CONTROL) | ||
176 | #define AE_CTRL_TERMINATE (acpi_status) (0x0003 | AE_CODE_CONTROL) | ||
177 | #define AE_CTRL_TRUE (acpi_status) (0x0004 | AE_CODE_CONTROL) | ||
178 | #define AE_CTRL_FALSE (acpi_status) (0x0005 | AE_CODE_CONTROL) | ||
179 | #define AE_CTRL_DEPTH (acpi_status) (0x0006 | AE_CODE_CONTROL) | ||
180 | #define AE_CTRL_END (acpi_status) (0x0007 | AE_CODE_CONTROL) | ||
181 | #define AE_CTRL_TRANSFER (acpi_status) (0x0008 | AE_CODE_CONTROL) | ||
182 | #define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL) | ||
183 | #define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL) | ||
184 | #define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL) | ||
185 | |||
186 | #define AE_CODE_CTRL_MAX 0x000B | ||
187 | |||
188 | |||
189 | #ifdef DEFINE_ACPI_GLOBALS | ||
190 | |||
191 | /* | ||
192 | * String versions of the exception codes above | ||
193 | * These strings must match the corresponding defines exactly | ||
194 | */ | ||
195 | char const *acpi_gbl_exception_names_env[] = | ||
196 | { | ||
197 | "AE_OK", | ||
198 | "AE_ERROR", | ||
199 | "AE_NO_ACPI_TABLES", | ||
200 | "AE_NO_NAMESPACE", | ||
201 | "AE_NO_MEMORY", | ||
202 | "AE_NOT_FOUND", | ||
203 | "AE_NOT_EXIST", | ||
204 | "AE_ALREADY_EXISTS", | ||
205 | "AE_TYPE", | ||
206 | "AE_NULL_OBJECT", | ||
207 | "AE_NULL_ENTRY", | ||
208 | "AE_BUFFER_OVERFLOW", | ||
209 | "AE_STACK_OVERFLOW", | ||
210 | "AE_STACK_UNDERFLOW", | ||
211 | "AE_NOT_IMPLEMENTED", | ||
212 | "AE_VERSION_MISMATCH", | ||
213 | "AE_SUPPORT", | ||
214 | "AE_SHARE", | ||
215 | "AE_LIMIT", | ||
216 | "AE_TIME", | ||
217 | "AE_UNKNOWN_STATUS", | ||
218 | "AE_ACQUIRE_DEADLOCK", | ||
219 | "AE_RELEASE_DEADLOCK", | ||
220 | "AE_NOT_ACQUIRED", | ||
221 | "AE_ALREADY_ACQUIRED", | ||
222 | "AE_NO_HARDWARE_RESPONSE", | ||
223 | "AE_NO_GLOBAL_LOCK", | ||
224 | "AE_LOGICAL_ADDRESS", | ||
225 | "AE_ABORT_METHOD", | ||
226 | "AE_SAME_HANDLER", | ||
227 | "AE_WAKE_ONLY_GPE" | ||
228 | }; | ||
229 | |||
230 | char const *acpi_gbl_exception_names_pgm[] = | ||
231 | { | ||
232 | "AE_BAD_PARAMETER", | ||
233 | "AE_BAD_CHARACTER", | ||
234 | "AE_BAD_PATHNAME", | ||
235 | "AE_BAD_DATA", | ||
236 | "AE_BAD_ADDRESS", | ||
237 | "AE_ALIGNMENT", | ||
238 | "AE_BAD_HEX_CONSTANT", | ||
239 | "AE_BAD_OCTAL_CONSTANT", | ||
240 | "AE_BAD_DECIMAL_CONSTANT" | ||
241 | }; | ||
242 | |||
243 | char const *acpi_gbl_exception_names_tbl[] = | ||
244 | { | ||
245 | "AE_BAD_SIGNATURE", | ||
246 | "AE_BAD_HEADER", | ||
247 | "AE_BAD_CHECKSUM", | ||
248 | "AE_BAD_VALUE", | ||
249 | "AE_TABLE_NOT_SUPPORTED", | ||
250 | "AE_INVALID_TABLE_LENGTH" | ||
251 | }; | ||
252 | |||
253 | char const *acpi_gbl_exception_names_aml[] = | ||
254 | { | ||
255 | "AE_AML_ERROR", | ||
256 | "AE_AML_PARSE", | ||
257 | "AE_AML_BAD_OPCODE", | ||
258 | "AE_AML_NO_OPERAND", | ||
259 | "AE_AML_OPERAND_TYPE", | ||
260 | "AE_AML_OPERAND_VALUE", | ||
261 | "AE_AML_UNINITIALIZED_LOCAL", | ||
262 | "AE_AML_UNINITIALIZED_ARG", | ||
263 | "AE_AML_UNINITIALIZED_ELEMENT", | ||
264 | "AE_AML_NUMERIC_OVERFLOW", | ||
265 | "AE_AML_REGION_LIMIT", | ||
266 | "AE_AML_BUFFER_LIMIT", | ||
267 | "AE_AML_PACKAGE_LIMIT", | ||
268 | "AE_AML_DIVIDE_BY_ZERO", | ||
269 | "AE_AML_BAD_NAME", | ||
270 | "AE_AML_NAME_NOT_FOUND", | ||
271 | "AE_AML_INTERNAL", | ||
272 | "AE_AML_INVALID_SPACE_ID", | ||
273 | "AE_AML_STRING_LIMIT", | ||
274 | "AE_AML_NO_RETURN_VALUE", | ||
275 | "AE_AML_METHOD_LIMIT", | ||
276 | "AE_AML_NOT_OWNER", | ||
277 | "AE_AML_MUTEX_ORDER", | ||
278 | "AE_AML_MUTEX_NOT_ACQUIRED", | ||
279 | "AE_AML_INVALID_RESOURCE_TYPE", | ||
280 | "AE_AML_INVALID_INDEX", | ||
281 | "AE_AML_REGISTER_LIMIT", | ||
282 | "AE_AML_NO_WHILE", | ||
283 | "AE_AML_ALIGNMENT", | ||
284 | "AE_AML_NO_RESOURCE_END_TAG", | ||
285 | "AE_AML_BAD_RESOURCE_VALUE", | ||
286 | "AE_AML_CIRCULAR_REFERENCE", | ||
287 | "AE_AML_BAD_RESOURCE_LENGTH" | ||
288 | }; | ||
289 | |||
290 | char const *acpi_gbl_exception_names_ctrl[] = | ||
291 | { | ||
292 | "AE_CTRL_RETURN_VALUE", | ||
293 | "AE_CTRL_PENDING", | ||
294 | "AE_CTRL_TERMINATE", | ||
295 | "AE_CTRL_TRUE", | ||
296 | "AE_CTRL_FALSE", | ||
297 | "AE_CTRL_DEPTH", | ||
298 | "AE_CTRL_END", | ||
299 | "AE_CTRL_TRANSFER", | ||
300 | "AE_CTRL_BREAK", | ||
301 | "AE_CTRL_CONTINUE", | ||
302 | "AE_CTRL_SKIP" | ||
303 | }; | ||
304 | |||
305 | #endif /* ACPI GLOBALS */ | ||
306 | |||
307 | |||
308 | #endif /* __ACEXCEP_H__ */ | ||
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h new file mode 100644 index 000000000000..c7f387a972cb --- /dev/null +++ b/include/acpi/acglobal.h | |||
@@ -0,0 +1,357 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acglobal.h - Declarations for global variables | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACGLOBAL_H__ | ||
45 | #define __ACGLOBAL_H__ | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Ensure that the globals are actually defined and initialized only once. | ||
50 | * | ||
51 | * The use of these macros allows a single list of globals (here) in order | ||
52 | * to simplify maintenance of the code. | ||
53 | */ | ||
54 | #ifdef DEFINE_ACPI_GLOBALS | ||
55 | #define ACPI_EXTERN | ||
56 | #define ACPI_INIT_GLOBAL(a,b) a=b | ||
57 | #else | ||
58 | #define ACPI_EXTERN extern | ||
59 | #define ACPI_INIT_GLOBAL(a,b) a | ||
60 | #endif | ||
61 | |||
62 | /* | ||
63 | * Keep local copies of these FADT-based registers. NOTE: These globals | ||
64 | * are first in this file for alignment reasons on 64-bit systems. | ||
65 | */ | ||
66 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; | ||
67 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; | ||
68 | |||
69 | |||
70 | /***************************************************************************** | ||
71 | * | ||
72 | * Debug support | ||
73 | * | ||
74 | ****************************************************************************/ | ||
75 | |||
76 | /* Runtime configuration of debug print levels */ | ||
77 | |||
78 | extern u32 acpi_dbg_level; | ||
79 | extern u32 acpi_dbg_layer; | ||
80 | |||
81 | /* Procedure nesting level for debug output */ | ||
82 | |||
83 | extern u32 acpi_gbl_nesting_level; | ||
84 | |||
85 | |||
86 | /***************************************************************************** | ||
87 | * | ||
88 | * Runtime configuration (static defaults that can be overriden at runtime) | ||
89 | * | ||
90 | ****************************************************************************/ | ||
91 | |||
92 | /* | ||
93 | * Enable "slack" in the AML interpreter? Default is FALSE, and the | ||
94 | * interpreter strictly follows the ACPI specification. Setting to TRUE | ||
95 | * allows the interpreter to forgive certain bad AML constructs. Currently: | ||
96 | * 1) Allow "implicit return" of last value in a control method | ||
97 | * 2) Allow access beyond end of operation region | ||
98 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) | ||
99 | * 4) Allow ANY object type to be a source operand for the Store() operator | ||
100 | */ | ||
101 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE); | ||
102 | |||
103 | /* | ||
104 | * Automatically serialize ALL control methods? Default is FALSE, meaning | ||
105 | * to use the Serialized/not_serialized method flags on a per method basis. | ||
106 | * Only change this if the ASL code is poorly written and cannot handle | ||
107 | * reentrancy even though methods are marked "not_serialized". | ||
108 | */ | ||
109 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_all_methods_serialized, FALSE); | ||
110 | |||
111 | /* | ||
112 | * Create the predefined _OSI method in the namespace? Default is TRUE | ||
113 | * because ACPI CA is fully compatible with other ACPI implementations. | ||
114 | * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. | ||
115 | */ | ||
116 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_create_osi_method, TRUE); | ||
117 | |||
118 | /* | ||
119 | * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and | ||
120 | * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only | ||
121 | * be enabled just before going to sleep. | ||
122 | */ | ||
123 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE); | ||
124 | |||
125 | |||
126 | /***************************************************************************** | ||
127 | * | ||
128 | * ACPI Table globals | ||
129 | * | ||
130 | ****************************************************************************/ | ||
131 | |||
132 | /* | ||
133 | * Table pointers. | ||
134 | * Although these pointers are somewhat redundant with the global acpi_table, | ||
135 | * they are convenient because they are typed pointers. | ||
136 | * | ||
137 | * These tables are single-table only; meaning that there can be at most one | ||
138 | * of each in the system. Each global points to the actual table. | ||
139 | */ | ||
140 | ACPI_EXTERN u32 acpi_gbl_table_flags; | ||
141 | ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; | ||
142 | ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; | ||
143 | ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; | ||
144 | ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; | ||
145 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; | ||
146 | ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; | ||
147 | ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; | ||
148 | /* | ||
149 | * Since there may be multiple SSDTs and PSDTS, a single pointer is not | ||
150 | * sufficient; Therefore, there isn't one! | ||
151 | */ | ||
152 | |||
153 | |||
154 | /* | ||
155 | * Handle both ACPI 1.0 and ACPI 2.0 Integer widths | ||
156 | * If we are running a method that exists in a 32-bit ACPI table. | ||
157 | * Use only 32 bits of the Integer for conversion. | ||
158 | */ | ||
159 | ACPI_EXTERN u8 acpi_gbl_integer_bit_width; | ||
160 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; | ||
161 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | ||
162 | |||
163 | /* | ||
164 | * ACPI Table info arrays | ||
165 | */ | ||
166 | extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; | ||
167 | extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; | ||
168 | |||
169 | /* | ||
170 | * Predefined mutex objects. This array contains the | ||
171 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. | ||
172 | * (The table maps local handles to the real OS handles) | ||
173 | */ | ||
174 | ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; | ||
175 | |||
176 | |||
177 | /***************************************************************************** | ||
178 | * | ||
179 | * Miscellaneous globals | ||
180 | * | ||
181 | ****************************************************************************/ | ||
182 | |||
183 | |||
184 | ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS]; | ||
185 | ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; | ||
186 | ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; | ||
187 | ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; | ||
188 | ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; | ||
189 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; | ||
190 | ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; | ||
191 | |||
192 | ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; | ||
193 | ACPI_EXTERN u32 acpi_gbl_original_mode; | ||
194 | ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; | ||
195 | ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; | ||
196 | ACPI_EXTERN u32 acpi_gbl_ps_find_count; | ||
197 | ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; | ||
198 | ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; | ||
199 | ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; | ||
200 | ACPI_EXTERN u16 acpi_gbl_global_lock_handle; | ||
201 | ACPI_EXTERN u8 acpi_gbl_debugger_configuration; | ||
202 | ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; | ||
203 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; | ||
204 | ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; | ||
205 | ACPI_EXTERN u8 acpi_gbl_global_lock_present; | ||
206 | ACPI_EXTERN u8 acpi_gbl_events_initialized; | ||
207 | ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; | ||
208 | |||
209 | extern u8 acpi_gbl_shutdown; | ||
210 | extern u32 acpi_gbl_startup_flags; | ||
211 | extern const u8 acpi_gbl_decode_to8bit[8]; | ||
212 | extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; | ||
213 | extern const char *acpi_gbl_highest_dstate_names[4]; | ||
214 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; | ||
215 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | ||
216 | extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; | ||
217 | |||
218 | |||
219 | /***************************************************************************** | ||
220 | * | ||
221 | * Namespace globals | ||
222 | * | ||
223 | ****************************************************************************/ | ||
224 | |||
225 | #define NUM_NS_TYPES ACPI_TYPE_INVALID+1 | ||
226 | |||
227 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) | ||
228 | #define NUM_PREDEFINED_NAMES 10 | ||
229 | #else | ||
230 | #define NUM_PREDEFINED_NAMES 9 | ||
231 | #endif | ||
232 | |||
233 | ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; | ||
234 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; | ||
235 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; | ||
236 | |||
237 | extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; | ||
238 | extern const struct acpi_predefined_names acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; | ||
239 | |||
240 | #ifdef ACPI_DEBUG_OUTPUT | ||
241 | ACPI_EXTERN u32 acpi_gbl_current_node_count; | ||
242 | ACPI_EXTERN u32 acpi_gbl_current_node_size; | ||
243 | ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; | ||
244 | ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer; | ||
245 | ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer; | ||
246 | ACPI_EXTERN u32 acpi_gbl_deepest_nesting; | ||
247 | #endif | ||
248 | |||
249 | /***************************************************************************** | ||
250 | * | ||
251 | * Interpreter globals | ||
252 | * | ||
253 | ****************************************************************************/ | ||
254 | |||
255 | |||
256 | ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; | ||
257 | |||
258 | /* Control method single step flag */ | ||
259 | |||
260 | ACPI_EXTERN u8 acpi_gbl_cm_single_step; | ||
261 | |||
262 | |||
263 | /***************************************************************************** | ||
264 | * | ||
265 | * Parser globals | ||
266 | * | ||
267 | ****************************************************************************/ | ||
268 | |||
269 | ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; | ||
270 | |||
271 | /***************************************************************************** | ||
272 | * | ||
273 | * Hardware globals | ||
274 | * | ||
275 | ****************************************************************************/ | ||
276 | |||
277 | extern struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; | ||
278 | ACPI_EXTERN u8 acpi_gbl_sleep_type_a; | ||
279 | ACPI_EXTERN u8 acpi_gbl_sleep_type_b; | ||
280 | |||
281 | |||
282 | /***************************************************************************** | ||
283 | * | ||
284 | * Event and GPE globals | ||
285 | * | ||
286 | ****************************************************************************/ | ||
287 | |||
288 | extern struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; | ||
289 | ACPI_EXTERN struct acpi_fixed_event_handler acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; | ||
290 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | ||
291 | ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | ||
292 | ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; | ||
293 | |||
294 | |||
295 | /***************************************************************************** | ||
296 | * | ||
297 | * Debugger globals | ||
298 | * | ||
299 | ****************************************************************************/ | ||
300 | |||
301 | |||
302 | ACPI_EXTERN u8 acpi_gbl_db_output_flags; | ||
303 | |||
304 | #ifdef ACPI_DISASSEMBLER | ||
305 | |||
306 | ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; | ||
307 | ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; | ||
308 | #endif | ||
309 | |||
310 | |||
311 | #ifdef ACPI_DEBUGGER | ||
312 | |||
313 | extern u8 acpi_gbl_method_executing; | ||
314 | extern u8 acpi_gbl_abort_method; | ||
315 | extern u8 acpi_gbl_db_terminate_threads; | ||
316 | |||
317 | ACPI_EXTERN int optind; | ||
318 | ACPI_EXTERN char *optarg; | ||
319 | |||
320 | ACPI_EXTERN u8 acpi_gbl_db_opt_tables; | ||
321 | ACPI_EXTERN u8 acpi_gbl_db_opt_stats; | ||
322 | ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; | ||
323 | |||
324 | |||
325 | ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; | ||
326 | ACPI_EXTERN char acpi_gbl_db_line_buf[80]; | ||
327 | ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; | ||
328 | ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; | ||
329 | ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; | ||
330 | ACPI_EXTERN u8 acpi_gbl_db_output_to_file; | ||
331 | ACPI_EXTERN char *acpi_gbl_db_buffer; | ||
332 | ACPI_EXTERN char *acpi_gbl_db_filename; | ||
333 | ACPI_EXTERN u32 acpi_gbl_db_debug_level; | ||
334 | ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; | ||
335 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; | ||
336 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; | ||
337 | |||
338 | /* | ||
339 | * Statistic globals | ||
340 | */ | ||
341 | ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX+1]; | ||
342 | ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX+1]; | ||
343 | ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; | ||
344 | ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; | ||
345 | ACPI_EXTERN u32 acpi_gbl_num_nodes; | ||
346 | ACPI_EXTERN u32 acpi_gbl_num_objects; | ||
347 | |||
348 | |||
349 | ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; | ||
350 | ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; | ||
351 | ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; | ||
352 | ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; | ||
353 | |||
354 | #endif /* ACPI_DEBUGGER */ | ||
355 | |||
356 | |||
357 | #endif /* __ACGLOBAL_H__ */ | ||
diff --git a/include/acpi/achware.h b/include/acpi/achware.h new file mode 100644 index 000000000000..28ad1398c159 --- /dev/null +++ b/include/acpi/achware.h | |||
@@ -0,0 +1,182 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: achware.h -- hardware specific interfaces | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACHWARE_H__ | ||
45 | #define __ACHWARE_H__ | ||
46 | |||
47 | |||
48 | /* PM Timer ticks per second (HZ) */ | ||
49 | #define PM_TIMER_FREQUENCY 3579545 | ||
50 | |||
51 | |||
52 | /* Prototypes */ | ||
53 | |||
54 | |||
55 | acpi_status | ||
56 | acpi_hw_initialize ( | ||
57 | void); | ||
58 | |||
59 | acpi_status | ||
60 | acpi_hw_shutdown ( | ||
61 | void); | ||
62 | |||
63 | acpi_status | ||
64 | acpi_hw_initialize_system_info ( | ||
65 | void); | ||
66 | |||
67 | acpi_status | ||
68 | acpi_hw_set_mode ( | ||
69 | u32 mode); | ||
70 | |||
71 | u32 | ||
72 | acpi_hw_get_mode ( | ||
73 | void); | ||
74 | |||
75 | u32 | ||
76 | acpi_hw_get_mode_capabilities ( | ||
77 | void); | ||
78 | |||
79 | /* Register I/O Prototypes */ | ||
80 | |||
81 | struct acpi_bit_register_info * | ||
82 | acpi_hw_get_bit_register_info ( | ||
83 | u32 register_id); | ||
84 | |||
85 | acpi_status | ||
86 | acpi_hw_register_read ( | ||
87 | u8 use_lock, | ||
88 | u32 register_id, | ||
89 | u32 *return_value); | ||
90 | |||
91 | acpi_status | ||
92 | acpi_hw_register_write ( | ||
93 | u8 use_lock, | ||
94 | u32 register_id, | ||
95 | u32 value); | ||
96 | |||
97 | acpi_status | ||
98 | acpi_hw_low_level_read ( | ||
99 | u32 width, | ||
100 | u32 *value, | ||
101 | struct acpi_generic_address *reg); | ||
102 | |||
103 | acpi_status | ||
104 | acpi_hw_low_level_write ( | ||
105 | u32 width, | ||
106 | u32 value, | ||
107 | struct acpi_generic_address *reg); | ||
108 | |||
109 | acpi_status | ||
110 | acpi_hw_clear_acpi_status ( | ||
111 | u32 flags); | ||
112 | |||
113 | |||
114 | /* GPE support */ | ||
115 | |||
116 | acpi_status | ||
117 | acpi_hw_write_gpe_enable_reg ( | ||
118 | struct acpi_gpe_event_info *gpe_event_info); | ||
119 | |||
120 | acpi_status | ||
121 | acpi_hw_disable_gpe_block ( | ||
122 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
123 | struct acpi_gpe_block_info *gpe_block); | ||
124 | |||
125 | acpi_status | ||
126 | acpi_hw_clear_gpe ( | ||
127 | struct acpi_gpe_event_info *gpe_event_info); | ||
128 | |||
129 | acpi_status | ||
130 | acpi_hw_clear_gpe_block ( | ||
131 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
132 | struct acpi_gpe_block_info *gpe_block); | ||
133 | |||
134 | #ifdef ACPI_FUTURE_USAGE | ||
135 | acpi_status | ||
136 | acpi_hw_get_gpe_status ( | ||
137 | struct acpi_gpe_event_info *gpe_event_info, | ||
138 | acpi_event_status *event_status); | ||
139 | #endif | ||
140 | |||
141 | acpi_status | ||
142 | acpi_hw_disable_all_gpes ( | ||
143 | u32 flags); | ||
144 | |||
145 | acpi_status | ||
146 | acpi_hw_enable_all_runtime_gpes ( | ||
147 | u32 flags); | ||
148 | |||
149 | acpi_status | ||
150 | acpi_hw_enable_all_wakeup_gpes ( | ||
151 | u32 flags); | ||
152 | |||
153 | acpi_status | ||
154 | acpi_hw_enable_runtime_gpe_block ( | ||
155 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
156 | struct acpi_gpe_block_info *gpe_block); | ||
157 | |||
158 | acpi_status | ||
159 | acpi_hw_enable_wakeup_gpe_block ( | ||
160 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
161 | struct acpi_gpe_block_info *gpe_block); | ||
162 | |||
163 | |||
164 | /* ACPI Timer prototypes */ | ||
165 | |||
166 | #ifdef ACPI_FUTURE_USAGE | ||
167 | acpi_status | ||
168 | acpi_get_timer_resolution ( | ||
169 | u32 *resolution); | ||
170 | |||
171 | acpi_status | ||
172 | acpi_get_timer ( | ||
173 | u32 *ticks); | ||
174 | |||
175 | acpi_status | ||
176 | acpi_get_timer_duration ( | ||
177 | u32 start_ticks, | ||
178 | u32 end_ticks, | ||
179 | u32 *time_elapsed); | ||
180 | #endif /* ACPI_FUTURE_USAGE */ | ||
181 | |||
182 | #endif /* __ACHWARE_H__ */ | ||
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h new file mode 100644 index 000000000000..c5301f5ffaf4 --- /dev/null +++ b/include/acpi/acinterp.h | |||
@@ -0,0 +1,765 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acinterp.h - Interpreter subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACINTERP_H__ | ||
45 | #define __ACINTERP_H__ | ||
46 | |||
47 | |||
48 | #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) | ||
49 | |||
50 | |||
51 | acpi_status | ||
52 | acpi_ex_resolve_operands ( | ||
53 | u16 opcode, | ||
54 | union acpi_operand_object **stack_ptr, | ||
55 | struct acpi_walk_state *walk_state); | ||
56 | |||
57 | acpi_status | ||
58 | acpi_ex_check_object_type ( | ||
59 | acpi_object_type type_needed, | ||
60 | acpi_object_type this_type, | ||
61 | void *object); | ||
62 | |||
63 | /* | ||
64 | * exxface - External interpreter interfaces | ||
65 | */ | ||
66 | |||
67 | acpi_status | ||
68 | acpi_ex_load_table ( | ||
69 | acpi_table_type table_id); | ||
70 | |||
71 | acpi_status | ||
72 | acpi_ex_execute_method ( | ||
73 | struct acpi_namespace_node *method_node, | ||
74 | union acpi_operand_object **params, | ||
75 | union acpi_operand_object **return_obj_desc); | ||
76 | |||
77 | |||
78 | /* | ||
79 | * exconvrt - object conversion | ||
80 | */ | ||
81 | |||
82 | acpi_status | ||
83 | acpi_ex_convert_to_integer ( | ||
84 | union acpi_operand_object *obj_desc, | ||
85 | union acpi_operand_object **result_desc, | ||
86 | u32 flags); | ||
87 | |||
88 | acpi_status | ||
89 | acpi_ex_convert_to_buffer ( | ||
90 | union acpi_operand_object *obj_desc, | ||
91 | union acpi_operand_object **result_desc); | ||
92 | |||
93 | acpi_status | ||
94 | acpi_ex_convert_to_string ( | ||
95 | union acpi_operand_object *obj_desc, | ||
96 | union acpi_operand_object **result_desc, | ||
97 | u32 type); | ||
98 | |||
99 | /* Types for ->String conversion */ | ||
100 | |||
101 | #define ACPI_EXPLICIT_BYTE_COPY 0x00000000 | ||
102 | #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001 | ||
103 | #define ACPI_IMPLICIT_CONVERT_HEX 0x00000002 | ||
104 | #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 | ||
105 | |||
106 | acpi_status | ||
107 | acpi_ex_convert_to_target_type ( | ||
108 | acpi_object_type destination_type, | ||
109 | union acpi_operand_object *source_desc, | ||
110 | union acpi_operand_object **result_desc, | ||
111 | struct acpi_walk_state *walk_state); | ||
112 | |||
113 | u32 | ||
114 | acpi_ex_convert_to_ascii ( | ||
115 | acpi_integer integer, | ||
116 | u16 base, | ||
117 | u8 *string, | ||
118 | u8 max_length); | ||
119 | |||
120 | /* | ||
121 | * exfield - ACPI AML (p-code) execution - field manipulation | ||
122 | */ | ||
123 | |||
124 | acpi_status | ||
125 | acpi_ex_common_buffer_setup ( | ||
126 | union acpi_operand_object *obj_desc, | ||
127 | u32 buffer_length, | ||
128 | u32 *datum_count); | ||
129 | |||
130 | acpi_status | ||
131 | acpi_ex_extract_from_field ( | ||
132 | union acpi_operand_object *obj_desc, | ||
133 | void *buffer, | ||
134 | u32 buffer_length); | ||
135 | |||
136 | acpi_status | ||
137 | acpi_ex_insert_into_field ( | ||
138 | union acpi_operand_object *obj_desc, | ||
139 | void *buffer, | ||
140 | u32 buffer_length); | ||
141 | |||
142 | acpi_status | ||
143 | acpi_ex_setup_region ( | ||
144 | union acpi_operand_object *obj_desc, | ||
145 | u32 field_datum_byte_offset); | ||
146 | |||
147 | acpi_status | ||
148 | acpi_ex_access_region ( | ||
149 | union acpi_operand_object *obj_desc, | ||
150 | u32 field_datum_byte_offset, | ||
151 | acpi_integer *value, | ||
152 | u32 read_write); | ||
153 | |||
154 | u8 | ||
155 | acpi_ex_register_overflow ( | ||
156 | union acpi_operand_object *obj_desc, | ||
157 | acpi_integer value); | ||
158 | |||
159 | acpi_status | ||
160 | acpi_ex_field_datum_io ( | ||
161 | union acpi_operand_object *obj_desc, | ||
162 | u32 field_datum_byte_offset, | ||
163 | acpi_integer *value, | ||
164 | u32 read_write); | ||
165 | |||
166 | acpi_status | ||
167 | acpi_ex_write_with_update_rule ( | ||
168 | union acpi_operand_object *obj_desc, | ||
169 | acpi_integer mask, | ||
170 | acpi_integer field_value, | ||
171 | u32 field_datum_byte_offset); | ||
172 | |||
173 | void | ||
174 | acpi_ex_get_buffer_datum( | ||
175 | acpi_integer *datum, | ||
176 | void *buffer, | ||
177 | u32 buffer_length, | ||
178 | u32 byte_granularity, | ||
179 | u32 buffer_offset); | ||
180 | |||
181 | void | ||
182 | acpi_ex_set_buffer_datum ( | ||
183 | acpi_integer merged_datum, | ||
184 | void *buffer, | ||
185 | u32 buffer_length, | ||
186 | u32 byte_granularity, | ||
187 | u32 buffer_offset); | ||
188 | |||
189 | acpi_status | ||
190 | acpi_ex_read_data_from_field ( | ||
191 | struct acpi_walk_state *walk_state, | ||
192 | union acpi_operand_object *obj_desc, | ||
193 | union acpi_operand_object **ret_buffer_desc); | ||
194 | |||
195 | acpi_status | ||
196 | acpi_ex_write_data_to_field ( | ||
197 | union acpi_operand_object *source_desc, | ||
198 | union acpi_operand_object *obj_desc, | ||
199 | union acpi_operand_object **result_desc); | ||
200 | |||
201 | /* | ||
202 | * exmisc - ACPI AML (p-code) execution - specific opcodes | ||
203 | */ | ||
204 | |||
205 | acpi_status | ||
206 | acpi_ex_opcode_3A_0T_0R ( | ||
207 | struct acpi_walk_state *walk_state); | ||
208 | |||
209 | acpi_status | ||
210 | acpi_ex_opcode_3A_1T_1R ( | ||
211 | struct acpi_walk_state *walk_state); | ||
212 | |||
213 | acpi_status | ||
214 | acpi_ex_opcode_6A_0T_1R ( | ||
215 | struct acpi_walk_state *walk_state); | ||
216 | |||
217 | u8 | ||
218 | acpi_ex_do_match ( | ||
219 | u32 match_op, | ||
220 | union acpi_operand_object *package_obj, | ||
221 | union acpi_operand_object *match_obj); | ||
222 | |||
223 | acpi_status | ||
224 | acpi_ex_get_object_reference ( | ||
225 | union acpi_operand_object *obj_desc, | ||
226 | union acpi_operand_object **return_desc, | ||
227 | struct acpi_walk_state *walk_state); | ||
228 | |||
229 | acpi_status | ||
230 | acpi_ex_resolve_multiple ( | ||
231 | struct acpi_walk_state *walk_state, | ||
232 | union acpi_operand_object *operand, | ||
233 | acpi_object_type *return_type, | ||
234 | union acpi_operand_object **return_desc); | ||
235 | |||
236 | acpi_status | ||
237 | acpi_ex_concat_template ( | ||
238 | union acpi_operand_object *obj_desc, | ||
239 | union acpi_operand_object *obj_desc2, | ||
240 | union acpi_operand_object **actual_return_desc, | ||
241 | struct acpi_walk_state *walk_state); | ||
242 | |||
243 | acpi_status | ||
244 | acpi_ex_do_concatenate ( | ||
245 | union acpi_operand_object *obj_desc, | ||
246 | union acpi_operand_object *obj_desc2, | ||
247 | union acpi_operand_object **actual_return_desc, | ||
248 | struct acpi_walk_state *walk_state); | ||
249 | |||
250 | acpi_status | ||
251 | acpi_ex_do_logical_numeric_op ( | ||
252 | u16 opcode, | ||
253 | acpi_integer integer0, | ||
254 | acpi_integer integer1, | ||
255 | u8 *logical_result); | ||
256 | |||
257 | acpi_status | ||
258 | acpi_ex_do_logical_op ( | ||
259 | u16 opcode, | ||
260 | union acpi_operand_object *operand0, | ||
261 | union acpi_operand_object *operand1, | ||
262 | u8 *logical_result); | ||
263 | |||
264 | acpi_integer | ||
265 | acpi_ex_do_math_op ( | ||
266 | u16 opcode, | ||
267 | acpi_integer operand0, | ||
268 | acpi_integer operand1); | ||
269 | |||
270 | acpi_status | ||
271 | acpi_ex_create_mutex ( | ||
272 | struct acpi_walk_state *walk_state); | ||
273 | |||
274 | acpi_status | ||
275 | acpi_ex_create_processor ( | ||
276 | struct acpi_walk_state *walk_state); | ||
277 | |||
278 | acpi_status | ||
279 | acpi_ex_create_power_resource ( | ||
280 | struct acpi_walk_state *walk_state); | ||
281 | |||
282 | acpi_status | ||
283 | acpi_ex_create_region ( | ||
284 | u8 *aml_start, | ||
285 | u32 aml_length, | ||
286 | u8 region_space, | ||
287 | struct acpi_walk_state *walk_state); | ||
288 | |||
289 | acpi_status | ||
290 | acpi_ex_create_table_region ( | ||
291 | struct acpi_walk_state *walk_state); | ||
292 | |||
293 | acpi_status | ||
294 | acpi_ex_create_event ( | ||
295 | struct acpi_walk_state *walk_state); | ||
296 | |||
297 | acpi_status | ||
298 | acpi_ex_create_alias ( | ||
299 | struct acpi_walk_state *walk_state); | ||
300 | |||
301 | acpi_status | ||
302 | acpi_ex_create_method ( | ||
303 | u8 *aml_start, | ||
304 | u32 aml_length, | ||
305 | struct acpi_walk_state *walk_state); | ||
306 | |||
307 | |||
308 | /* | ||
309 | * exconfig - dynamic table load/unload | ||
310 | */ | ||
311 | |||
312 | acpi_status | ||
313 | acpi_ex_add_table ( | ||
314 | struct acpi_table_header *table, | ||
315 | struct acpi_namespace_node *parent_node, | ||
316 | union acpi_operand_object **ddb_handle); | ||
317 | |||
318 | acpi_status | ||
319 | acpi_ex_load_op ( | ||
320 | union acpi_operand_object *obj_desc, | ||
321 | union acpi_operand_object *target, | ||
322 | struct acpi_walk_state *walk_state); | ||
323 | |||
324 | acpi_status | ||
325 | acpi_ex_load_table_op ( | ||
326 | struct acpi_walk_state *walk_state, | ||
327 | union acpi_operand_object **return_desc); | ||
328 | |||
329 | acpi_status | ||
330 | acpi_ex_unload_table ( | ||
331 | union acpi_operand_object *ddb_handle); | ||
332 | |||
333 | |||
334 | /* | ||
335 | * exmutex - mutex support | ||
336 | */ | ||
337 | |||
338 | acpi_status | ||
339 | acpi_ex_acquire_mutex ( | ||
340 | union acpi_operand_object *time_desc, | ||
341 | union acpi_operand_object *obj_desc, | ||
342 | struct acpi_walk_state *walk_state); | ||
343 | |||
344 | acpi_status | ||
345 | acpi_ex_release_mutex ( | ||
346 | union acpi_operand_object *obj_desc, | ||
347 | struct acpi_walk_state *walk_state); | ||
348 | |||
349 | void | ||
350 | acpi_ex_release_all_mutexes ( | ||
351 | struct acpi_thread_state *thread); | ||
352 | |||
353 | void | ||
354 | acpi_ex_unlink_mutex ( | ||
355 | union acpi_operand_object *obj_desc); | ||
356 | |||
357 | void | ||
358 | acpi_ex_link_mutex ( | ||
359 | union acpi_operand_object *obj_desc, | ||
360 | struct acpi_thread_state *thread); | ||
361 | |||
362 | /* | ||
363 | * exprep - ACPI AML (p-code) execution - prep utilities | ||
364 | */ | ||
365 | |||
366 | acpi_status | ||
367 | acpi_ex_prep_common_field_object ( | ||
368 | union acpi_operand_object *obj_desc, | ||
369 | u8 field_flags, | ||
370 | u8 field_attribute, | ||
371 | u32 field_bit_position, | ||
372 | u32 field_bit_length); | ||
373 | |||
374 | acpi_status | ||
375 | acpi_ex_prep_field_value ( | ||
376 | struct acpi_create_field_info *info); | ||
377 | |||
378 | /* | ||
379 | * exsystem - Interface to OS services | ||
380 | */ | ||
381 | |||
382 | acpi_status | ||
383 | acpi_ex_system_do_notify_op ( | ||
384 | union acpi_operand_object *value, | ||
385 | union acpi_operand_object *obj_desc); | ||
386 | |||
387 | acpi_status | ||
388 | acpi_ex_system_do_suspend( | ||
389 | acpi_integer time); | ||
390 | |||
391 | acpi_status | ||
392 | acpi_ex_system_do_stall ( | ||
393 | u32 time); | ||
394 | |||
395 | acpi_status | ||
396 | acpi_ex_system_acquire_mutex( | ||
397 | union acpi_operand_object *time, | ||
398 | union acpi_operand_object *obj_desc); | ||
399 | |||
400 | acpi_status | ||
401 | acpi_ex_system_release_mutex( | ||
402 | union acpi_operand_object *obj_desc); | ||
403 | |||
404 | acpi_status | ||
405 | acpi_ex_system_signal_event( | ||
406 | union acpi_operand_object *obj_desc); | ||
407 | |||
408 | acpi_status | ||
409 | acpi_ex_system_wait_event( | ||
410 | union acpi_operand_object *time, | ||
411 | union acpi_operand_object *obj_desc); | ||
412 | |||
413 | acpi_status | ||
414 | acpi_ex_system_reset_event( | ||
415 | union acpi_operand_object *obj_desc); | ||
416 | |||
417 | acpi_status | ||
418 | acpi_ex_system_wait_semaphore ( | ||
419 | acpi_handle semaphore, | ||
420 | u16 timeout); | ||
421 | |||
422 | |||
423 | /* | ||
424 | * exmonadic - ACPI AML (p-code) execution, monadic operators | ||
425 | */ | ||
426 | |||
427 | acpi_status | ||
428 | acpi_ex_opcode_0A_0T_1R ( | ||
429 | struct acpi_walk_state *walk_state); | ||
430 | |||
431 | acpi_status | ||
432 | acpi_ex_opcode_1A_0T_0R ( | ||
433 | struct acpi_walk_state *walk_state); | ||
434 | |||
435 | acpi_status | ||
436 | acpi_ex_opcode_1A_0T_1R ( | ||
437 | struct acpi_walk_state *walk_state); | ||
438 | |||
439 | acpi_status | ||
440 | acpi_ex_opcode_1A_1T_1R ( | ||
441 | struct acpi_walk_state *walk_state); | ||
442 | |||
443 | acpi_status | ||
444 | acpi_ex_opcode_1A_1T_0R ( | ||
445 | struct acpi_walk_state *walk_state); | ||
446 | |||
447 | /* | ||
448 | * exdyadic - ACPI AML (p-code) execution, dyadic operators | ||
449 | */ | ||
450 | |||
451 | acpi_status | ||
452 | acpi_ex_opcode_2A_0T_0R ( | ||
453 | struct acpi_walk_state *walk_state); | ||
454 | |||
455 | acpi_status | ||
456 | acpi_ex_opcode_2A_0T_1R ( | ||
457 | struct acpi_walk_state *walk_state); | ||
458 | |||
459 | acpi_status | ||
460 | acpi_ex_opcode_2A_1T_1R ( | ||
461 | struct acpi_walk_state *walk_state); | ||
462 | |||
463 | acpi_status | ||
464 | acpi_ex_opcode_2A_2T_1R ( | ||
465 | struct acpi_walk_state *walk_state); | ||
466 | |||
467 | |||
468 | /* | ||
469 | * exresolv - Object resolution and get value functions | ||
470 | */ | ||
471 | |||
472 | acpi_status | ||
473 | acpi_ex_resolve_to_value ( | ||
474 | union acpi_operand_object **stack_ptr, | ||
475 | struct acpi_walk_state *walk_state); | ||
476 | |||
477 | acpi_status | ||
478 | acpi_ex_resolve_node_to_value ( | ||
479 | struct acpi_namespace_node **stack_ptr, | ||
480 | struct acpi_walk_state *walk_state); | ||
481 | |||
482 | acpi_status | ||
483 | acpi_ex_resolve_object_to_value ( | ||
484 | union acpi_operand_object **stack_ptr, | ||
485 | struct acpi_walk_state *walk_state); | ||
486 | |||
487 | |||
488 | /* | ||
489 | * exdump - Interpreter debug output routines | ||
490 | */ | ||
491 | |||
492 | void | ||
493 | acpi_ex_dump_operand ( | ||
494 | union acpi_operand_object *obj_desc, | ||
495 | u32 depth); | ||
496 | |||
497 | void | ||
498 | acpi_ex_dump_operands ( | ||
499 | union acpi_operand_object **operands, | ||
500 | acpi_interpreter_mode interpreter_mode, | ||
501 | char *ident, | ||
502 | u32 num_levels, | ||
503 | char *note, | ||
504 | char *module_name, | ||
505 | u32 line_number); | ||
506 | |||
507 | #ifdef ACPI_FUTURE_USAGE | ||
508 | void | ||
509 | acpi_ex_dump_object_descriptor ( | ||
510 | union acpi_operand_object *object, | ||
511 | u32 flags); | ||
512 | |||
513 | void | ||
514 | acpi_ex_dump_node ( | ||
515 | struct acpi_namespace_node *node, | ||
516 | u32 flags); | ||
517 | |||
518 | void | ||
519 | acpi_ex_out_string ( | ||
520 | char *title, | ||
521 | char *value); | ||
522 | |||
523 | void | ||
524 | acpi_ex_out_pointer ( | ||
525 | char *title, | ||
526 | void *value); | ||
527 | |||
528 | void | ||
529 | acpi_ex_out_integer ( | ||
530 | char *title, | ||
531 | u32 value); | ||
532 | |||
533 | void | ||
534 | acpi_ex_out_address ( | ||
535 | char *title, | ||
536 | acpi_physical_address value); | ||
537 | #endif /* ACPI_FUTURE_USAGE */ | ||
538 | |||
539 | /* | ||
540 | * exnames - interpreter/scanner name load/execute | ||
541 | */ | ||
542 | |||
543 | char * | ||
544 | acpi_ex_allocate_name_string ( | ||
545 | u32 prefix_count, | ||
546 | u32 num_name_segs); | ||
547 | |||
548 | u32 | ||
549 | acpi_ex_good_char ( | ||
550 | u32 character); | ||
551 | |||
552 | acpi_status | ||
553 | acpi_ex_name_segment ( | ||
554 | u8 **in_aml_address, | ||
555 | char *name_string); | ||
556 | |||
557 | acpi_status | ||
558 | acpi_ex_get_name_string ( | ||
559 | acpi_object_type data_type, | ||
560 | u8 *in_aml_address, | ||
561 | char **out_name_string, | ||
562 | u32 *out_name_length); | ||
563 | |||
564 | acpi_status | ||
565 | acpi_ex_do_name ( | ||
566 | acpi_object_type data_type, | ||
567 | acpi_interpreter_mode load_exec_mode); | ||
568 | |||
569 | |||
570 | /* | ||
571 | * exstore - Object store support | ||
572 | */ | ||
573 | |||
574 | acpi_status | ||
575 | acpi_ex_store ( | ||
576 | union acpi_operand_object *val_desc, | ||
577 | union acpi_operand_object *dest_desc, | ||
578 | struct acpi_walk_state *walk_state); | ||
579 | |||
580 | acpi_status | ||
581 | acpi_ex_store_object_to_index ( | ||
582 | union acpi_operand_object *val_desc, | ||
583 | union acpi_operand_object *dest_desc, | ||
584 | struct acpi_walk_state *walk_state); | ||
585 | |||
586 | acpi_status | ||
587 | acpi_ex_store_object_to_node ( | ||
588 | union acpi_operand_object *source_desc, | ||
589 | struct acpi_namespace_node *node, | ||
590 | struct acpi_walk_state *walk_state, | ||
591 | u8 implicit_conversion); | ||
592 | |||
593 | #define ACPI_IMPLICIT_CONVERSION TRUE | ||
594 | #define ACPI_NO_IMPLICIT_CONVERSION FALSE | ||
595 | |||
596 | /* | ||
597 | * exstoren | ||
598 | */ | ||
599 | |||
600 | acpi_status | ||
601 | acpi_ex_resolve_object ( | ||
602 | union acpi_operand_object **source_desc_ptr, | ||
603 | acpi_object_type target_type, | ||
604 | struct acpi_walk_state *walk_state); | ||
605 | |||
606 | acpi_status | ||
607 | acpi_ex_store_object_to_object ( | ||
608 | union acpi_operand_object *source_desc, | ||
609 | union acpi_operand_object *dest_desc, | ||
610 | union acpi_operand_object **new_desc, | ||
611 | struct acpi_walk_state *walk_state); | ||
612 | |||
613 | |||
614 | /* | ||
615 | * excopy - object copy | ||
616 | */ | ||
617 | |||
618 | acpi_status | ||
619 | acpi_ex_store_buffer_to_buffer ( | ||
620 | union acpi_operand_object *source_desc, | ||
621 | union acpi_operand_object *target_desc); | ||
622 | |||
623 | acpi_status | ||
624 | acpi_ex_store_string_to_string ( | ||
625 | union acpi_operand_object *source_desc, | ||
626 | union acpi_operand_object *target_desc); | ||
627 | |||
628 | acpi_status | ||
629 | acpi_ex_copy_integer_to_index_field ( | ||
630 | union acpi_operand_object *source_desc, | ||
631 | union acpi_operand_object *target_desc); | ||
632 | |||
633 | acpi_status | ||
634 | acpi_ex_copy_integer_to_bank_field ( | ||
635 | union acpi_operand_object *source_desc, | ||
636 | union acpi_operand_object *target_desc); | ||
637 | |||
638 | acpi_status | ||
639 | acpi_ex_copy_data_to_named_field ( | ||
640 | union acpi_operand_object *source_desc, | ||
641 | struct acpi_namespace_node *node); | ||
642 | |||
643 | acpi_status | ||
644 | acpi_ex_copy_integer_to_buffer_field ( | ||
645 | union acpi_operand_object *source_desc, | ||
646 | union acpi_operand_object *target_desc); | ||
647 | |||
648 | /* | ||
649 | * exutils - interpreter/scanner utilities | ||
650 | */ | ||
651 | |||
652 | acpi_status | ||
653 | acpi_ex_enter_interpreter ( | ||
654 | void); | ||
655 | |||
656 | void | ||
657 | acpi_ex_exit_interpreter ( | ||
658 | void); | ||
659 | |||
660 | void | ||
661 | acpi_ex_truncate_for32bit_table ( | ||
662 | union acpi_operand_object *obj_desc); | ||
663 | |||
664 | u8 | ||
665 | acpi_ex_acquire_global_lock ( | ||
666 | u32 rule); | ||
667 | |||
668 | void | ||
669 | acpi_ex_release_global_lock ( | ||
670 | u8 locked); | ||
671 | |||
672 | u32 | ||
673 | acpi_ex_digits_needed ( | ||
674 | acpi_integer value, | ||
675 | u32 base); | ||
676 | |||
677 | void | ||
678 | acpi_ex_eisa_id_to_string ( | ||
679 | u32 numeric_id, | ||
680 | char *out_string); | ||
681 | |||
682 | void | ||
683 | acpi_ex_unsigned_integer_to_string ( | ||
684 | acpi_integer value, | ||
685 | char *out_string); | ||
686 | |||
687 | |||
688 | /* | ||
689 | * exregion - default op_region handlers | ||
690 | */ | ||
691 | |||
692 | acpi_status | ||
693 | acpi_ex_system_memory_space_handler ( | ||
694 | u32 function, | ||
695 | acpi_physical_address address, | ||
696 | u32 bit_width, | ||
697 | acpi_integer *value, | ||
698 | void *handler_context, | ||
699 | void *region_context); | ||
700 | |||
701 | acpi_status | ||
702 | acpi_ex_system_io_space_handler ( | ||
703 | u32 function, | ||
704 | acpi_physical_address address, | ||
705 | u32 bit_width, | ||
706 | acpi_integer *value, | ||
707 | void *handler_context, | ||
708 | void *region_context); | ||
709 | |||
710 | acpi_status | ||
711 | acpi_ex_pci_config_space_handler ( | ||
712 | u32 function, | ||
713 | acpi_physical_address address, | ||
714 | u32 bit_width, | ||
715 | acpi_integer *value, | ||
716 | void *handler_context, | ||
717 | void *region_context); | ||
718 | |||
719 | acpi_status | ||
720 | acpi_ex_cmos_space_handler ( | ||
721 | u32 function, | ||
722 | acpi_physical_address address, | ||
723 | u32 bit_width, | ||
724 | acpi_integer *value, | ||
725 | void *handler_context, | ||
726 | void *region_context); | ||
727 | |||
728 | acpi_status | ||
729 | acpi_ex_pci_bar_space_handler ( | ||
730 | u32 function, | ||
731 | acpi_physical_address address, | ||
732 | u32 bit_width, | ||
733 | acpi_integer *value, | ||
734 | void *handler_context, | ||
735 | void *region_context); | ||
736 | |||
737 | acpi_status | ||
738 | acpi_ex_embedded_controller_space_handler ( | ||
739 | u32 function, | ||
740 | acpi_physical_address address, | ||
741 | u32 bit_width, | ||
742 | acpi_integer *value, | ||
743 | void *handler_context, | ||
744 | void *region_context); | ||
745 | |||
746 | acpi_status | ||
747 | acpi_ex_sm_bus_space_handler ( | ||
748 | u32 function, | ||
749 | acpi_physical_address address, | ||
750 | u32 bit_width, | ||
751 | acpi_integer *value, | ||
752 | void *handler_context, | ||
753 | void *region_context); | ||
754 | |||
755 | |||
756 | acpi_status | ||
757 | acpi_ex_data_table_space_handler ( | ||
758 | u32 function, | ||
759 | acpi_physical_address address, | ||
760 | u32 bit_width, | ||
761 | acpi_integer *value, | ||
762 | void *handler_context, | ||
763 | void *region_context); | ||
764 | |||
765 | #endif /* __INTERP_H__ */ | ||
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h new file mode 100644 index 000000000000..01d3b4bc0c85 --- /dev/null +++ b/include/acpi/aclocal.h | |||
@@ -0,0 +1,994 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: aclocal.h - Internal data types used across the ACPI subsystem | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 | |||
47 | |||
48 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ | ||
49 | |||
50 | typedef void * acpi_mutex; | ||
51 | typedef u32 acpi_mutex_handle; | ||
52 | |||
53 | |||
54 | /* Total number of aml opcodes defined */ | ||
55 | |||
56 | #define AML_NUM_OPCODES 0x7F | ||
57 | |||
58 | |||
59 | /***************************************************************************** | ||
60 | * | ||
61 | * Mutex typedefs and structs | ||
62 | * | ||
63 | ****************************************************************************/ | ||
64 | |||
65 | |||
66 | /* | ||
67 | * Predefined handles for the mutex objects used within the subsystem | ||
68 | * All mutex objects are automatically created by acpi_ut_mutex_initialize. | ||
69 | * | ||
70 | * The acquire/release ordering protocol is implied via this list. Mutexes | ||
71 | * with a lower value must be acquired before mutexes with a higher value. | ||
72 | * | ||
73 | * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! | ||
74 | */ | ||
75 | |||
76 | #define ACPI_MTX_EXECUTE 0 | ||
77 | #define ACPI_MTX_INTERPRETER 1 | ||
78 | #define ACPI_MTX_PARSER 2 | ||
79 | #define ACPI_MTX_DISPATCHER 3 | ||
80 | #define ACPI_MTX_TABLES 4 | ||
81 | #define ACPI_MTX_OP_REGIONS 5 | ||
82 | #define ACPI_MTX_NAMESPACE 6 | ||
83 | #define ACPI_MTX_EVENTS 7 | ||
84 | #define ACPI_MTX_HARDWARE 8 | ||
85 | #define ACPI_MTX_CACHES 9 | ||
86 | #define ACPI_MTX_MEMORY 10 | ||
87 | #define ACPI_MTX_DEBUG_CMD_COMPLETE 11 | ||
88 | #define ACPI_MTX_DEBUG_CMD_READY 12 | ||
89 | |||
90 | #define MAX_MUTEX 12 | ||
91 | #define NUM_MUTEX MAX_MUTEX+1 | ||
92 | |||
93 | |||
94 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
95 | #ifdef DEFINE_ACPI_GLOBALS | ||
96 | |||
97 | /* Names for the mutexes used in the subsystem */ | ||
98 | |||
99 | static char *acpi_gbl_mutex_names[] = | ||
100 | { | ||
101 | "ACPI_MTX_Execute", | ||
102 | "ACPI_MTX_Interpreter", | ||
103 | "ACPI_MTX_Parser", | ||
104 | "ACPI_MTX_Dispatcher", | ||
105 | "ACPI_MTX_Tables", | ||
106 | "ACPI_MTX_op_regions", | ||
107 | "ACPI_MTX_Namespace", | ||
108 | "ACPI_MTX_Events", | ||
109 | "ACPI_MTX_Hardware", | ||
110 | "ACPI_MTX_Caches", | ||
111 | "ACPI_MTX_Memory", | ||
112 | "ACPI_MTX_debug_cmd_complete", | ||
113 | "ACPI_MTX_debug_cmd_ready", | ||
114 | }; | ||
115 | |||
116 | #endif | ||
117 | #endif | ||
118 | |||
119 | |||
120 | /* Table for the global mutexes */ | ||
121 | |||
122 | struct acpi_mutex_info | ||
123 | { | ||
124 | acpi_mutex mutex; | ||
125 | u32 use_count; | ||
126 | u32 owner_id; | ||
127 | }; | ||
128 | |||
129 | /* This owner ID means that the mutex is not in use (unlocked) */ | ||
130 | |||
131 | #define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1) | ||
132 | |||
133 | |||
134 | /* Lock flag parameter for various interfaces */ | ||
135 | |||
136 | #define ACPI_MTX_DO_NOT_LOCK 0 | ||
137 | #define ACPI_MTX_LOCK 1 | ||
138 | |||
139 | |||
140 | typedef u16 acpi_owner_id; | ||
141 | #define ACPI_OWNER_TYPE_TABLE 0x0 | ||
142 | #define ACPI_OWNER_TYPE_METHOD 0x1 | ||
143 | #define ACPI_FIRST_METHOD_ID 0x0001 | ||
144 | #define ACPI_FIRST_TABLE_ID 0xF000 | ||
145 | |||
146 | |||
147 | /* Field access granularities */ | ||
148 | |||
149 | #define ACPI_FIELD_BYTE_GRANULARITY 1 | ||
150 | #define ACPI_FIELD_WORD_GRANULARITY 2 | ||
151 | #define ACPI_FIELD_DWORD_GRANULARITY 4 | ||
152 | #define ACPI_FIELD_QWORD_GRANULARITY 8 | ||
153 | |||
154 | /***************************************************************************** | ||
155 | * | ||
156 | * Namespace typedefs and structs | ||
157 | * | ||
158 | ****************************************************************************/ | ||
159 | |||
160 | |||
161 | /* Operational modes of the AML interpreter/scanner */ | ||
162 | |||
163 | typedef enum | ||
164 | { | ||
165 | ACPI_IMODE_LOAD_PASS1 = 0x01, | ||
166 | ACPI_IMODE_LOAD_PASS2 = 0x02, | ||
167 | ACPI_IMODE_EXECUTE = 0x0E | ||
168 | |||
169 | } acpi_interpreter_mode; | ||
170 | |||
171 | |||
172 | /* | ||
173 | * The Node describes a named object that appears in the AML | ||
174 | * An acpi_node is used to store Nodes. | ||
175 | * | ||
176 | * data_type is used to differentiate between internal descriptors, and MUST | ||
177 | * be the first byte in this structure. | ||
178 | */ | ||
179 | |||
180 | union acpi_name_union | ||
181 | { | ||
182 | u32 integer; | ||
183 | char ascii[4]; | ||
184 | }; | ||
185 | |||
186 | struct acpi_namespace_node | ||
187 | { | ||
188 | u8 descriptor; /* Used to differentiate object descriptor types */ | ||
189 | u8 type; /* Type associated with this name */ | ||
190 | u16 owner_id; | ||
191 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ | ||
192 | union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ | ||
193 | struct acpi_namespace_node *child; /* First child */ | ||
194 | struct acpi_namespace_node *peer; /* Next peer*/ | ||
195 | u16 reference_count; /* Current count of references and children */ | ||
196 | u8 flags; | ||
197 | }; | ||
198 | |||
199 | |||
200 | #define ACPI_ENTRY_NOT_FOUND NULL | ||
201 | |||
202 | |||
203 | /* Node flags */ | ||
204 | |||
205 | #define ANOBJ_RESERVED 0x01 | ||
206 | #define ANOBJ_END_OF_PEER_LIST 0x02 | ||
207 | #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ | ||
208 | #define ANOBJ_METHOD_ARG 0x08 | ||
209 | #define ANOBJ_METHOD_LOCAL 0x10 | ||
210 | #define ANOBJ_METHOD_NO_RETVAL 0x20 | ||
211 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 | ||
212 | #define ANOBJ_IS_BIT_OFFSET 0x80 | ||
213 | |||
214 | /* | ||
215 | * ACPI Table Descriptor. One per ACPI table | ||
216 | */ | ||
217 | struct acpi_table_desc | ||
218 | { | ||
219 | struct acpi_table_desc *prev; | ||
220 | struct acpi_table_desc *next; | ||
221 | struct acpi_table_desc *installed_desc; | ||
222 | struct acpi_table_header *pointer; | ||
223 | u8 *aml_start; | ||
224 | u64 physical_address; | ||
225 | u32 aml_length; | ||
226 | acpi_size length; | ||
227 | acpi_owner_id table_id; | ||
228 | u8 type; | ||
229 | u8 allocation; | ||
230 | u8 loaded_into_namespace; | ||
231 | }; | ||
232 | |||
233 | struct acpi_table_list | ||
234 | { | ||
235 | struct acpi_table_desc *next; | ||
236 | u32 count; | ||
237 | }; | ||
238 | |||
239 | |||
240 | struct acpi_find_context | ||
241 | { | ||
242 | char *search_for; | ||
243 | acpi_handle *list; | ||
244 | u32 *count; | ||
245 | }; | ||
246 | |||
247 | |||
248 | struct acpi_ns_search_data | ||
249 | { | ||
250 | struct acpi_namespace_node *node; | ||
251 | }; | ||
252 | |||
253 | |||
254 | /* | ||
255 | * Predefined Namespace items | ||
256 | */ | ||
257 | struct acpi_predefined_names | ||
258 | { | ||
259 | char *name; | ||
260 | u8 type; | ||
261 | char *val; | ||
262 | }; | ||
263 | |||
264 | |||
265 | /* Object types used during package copies */ | ||
266 | |||
267 | |||
268 | #define ACPI_COPY_TYPE_SIMPLE 0 | ||
269 | #define ACPI_COPY_TYPE_PACKAGE 1 | ||
270 | |||
271 | /* Info structure used to convert external<->internal namestrings */ | ||
272 | |||
273 | struct acpi_namestring_info | ||
274 | { | ||
275 | char *external_name; | ||
276 | char *next_external_char; | ||
277 | char *internal_name; | ||
278 | u32 length; | ||
279 | u32 num_segments; | ||
280 | u32 num_carats; | ||
281 | u8 fully_qualified; | ||
282 | }; | ||
283 | |||
284 | |||
285 | /* Field creation info */ | ||
286 | |||
287 | struct acpi_create_field_info | ||
288 | { | ||
289 | struct acpi_namespace_node *region_node; | ||
290 | struct acpi_namespace_node *field_node; | ||
291 | struct acpi_namespace_node *register_node; | ||
292 | struct acpi_namespace_node *data_register_node; | ||
293 | u32 bank_value; | ||
294 | u32 field_bit_position; | ||
295 | u32 field_bit_length; | ||
296 | u8 field_flags; | ||
297 | u8 attribute; | ||
298 | u8 field_type; | ||
299 | }; | ||
300 | |||
301 | |||
302 | /***************************************************************************** | ||
303 | * | ||
304 | * Event typedefs and structs | ||
305 | * | ||
306 | ****************************************************************************/ | ||
307 | |||
308 | /* Dispatch info for each GPE -- either a method or handler, cannot be both */ | ||
309 | |||
310 | struct acpi_handler_info | ||
311 | { | ||
312 | acpi_event_handler address; /* Address of handler, if any */ | ||
313 | void *context; /* Context to be passed to handler */ | ||
314 | struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ | ||
315 | }; | ||
316 | |||
317 | union acpi_gpe_dispatch_info | ||
318 | { | ||
319 | struct acpi_namespace_node *method_node; /* Method node for this GPE level */ | ||
320 | struct acpi_handler_info *handler; | ||
321 | }; | ||
322 | |||
323 | /* | ||
324 | * Information about a GPE, one per each GPE in an array. | ||
325 | * NOTE: Important to keep this struct as small as possible. | ||
326 | */ | ||
327 | struct acpi_gpe_event_info | ||
328 | { | ||
329 | union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ | ||
330 | struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ | ||
331 | u8 flags; /* Misc info about this GPE */ | ||
332 | u8 register_bit; /* This GPE bit within the register */ | ||
333 | }; | ||
334 | |||
335 | /* Information about a GPE register pair, one per each status/enable pair in an array */ | ||
336 | |||
337 | struct acpi_gpe_register_info | ||
338 | { | ||
339 | struct acpi_generic_address status_address; /* Address of status reg */ | ||
340 | struct acpi_generic_address enable_address; /* Address of enable reg */ | ||
341 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ | ||
342 | u8 enable_for_run; /* GPEs to keep enabled when running */ | ||
343 | u8 base_gpe_number; /* Base GPE number for this register */ | ||
344 | }; | ||
345 | |||
346 | /* | ||
347 | * Information about a GPE register block, one per each installed block -- | ||
348 | * GPE0, GPE1, and one per each installed GPE Block Device. | ||
349 | */ | ||
350 | struct acpi_gpe_block_info | ||
351 | { | ||
352 | struct acpi_namespace_node *node; | ||
353 | struct acpi_gpe_block_info *previous; | ||
354 | struct acpi_gpe_block_info *next; | ||
355 | struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ | ||
356 | struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ | ||
357 | struct acpi_gpe_event_info *event_info; /* One for each GPE */ | ||
358 | struct acpi_generic_address block_address; /* Base address of the block */ | ||
359 | u32 register_count; /* Number of register pairs in block */ | ||
360 | u8 block_base_number;/* Base GPE number for this block */ | ||
361 | }; | ||
362 | |||
363 | /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ | ||
364 | |||
365 | struct acpi_gpe_xrupt_info | ||
366 | { | ||
367 | struct acpi_gpe_xrupt_info *previous; | ||
368 | struct acpi_gpe_xrupt_info *next; | ||
369 | struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ | ||
370 | u32 interrupt_level; /* System interrupt level */ | ||
371 | }; | ||
372 | |||
373 | |||
374 | struct acpi_gpe_walk_info | ||
375 | { | ||
376 | struct acpi_namespace_node *gpe_device; | ||
377 | struct acpi_gpe_block_info *gpe_block; | ||
378 | }; | ||
379 | |||
380 | |||
381 | typedef acpi_status (*ACPI_GPE_CALLBACK) ( | ||
382 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
383 | struct acpi_gpe_block_info *gpe_block); | ||
384 | |||
385 | |||
386 | /* Information about each particular fixed event */ | ||
387 | |||
388 | struct acpi_fixed_event_handler | ||
389 | { | ||
390 | acpi_event_handler handler; /* Address of handler. */ | ||
391 | void *context; /* Context to be passed to handler */ | ||
392 | }; | ||
393 | |||
394 | struct acpi_fixed_event_info | ||
395 | { | ||
396 | u8 status_register_id; | ||
397 | u8 enable_register_id; | ||
398 | u16 status_bit_mask; | ||
399 | u16 enable_bit_mask; | ||
400 | }; | ||
401 | |||
402 | /* Information used during field processing */ | ||
403 | |||
404 | struct acpi_field_info | ||
405 | { | ||
406 | u8 skip_field; | ||
407 | u8 field_flag; | ||
408 | u32 pkg_length; | ||
409 | }; | ||
410 | |||
411 | |||
412 | /***************************************************************************** | ||
413 | * | ||
414 | * Generic "state" object for stacks | ||
415 | * | ||
416 | ****************************************************************************/ | ||
417 | |||
418 | |||
419 | #define ACPI_CONTROL_NORMAL 0xC0 | ||
420 | #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 | ||
421 | #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 | ||
422 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 | ||
423 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 | ||
424 | |||
425 | |||
426 | /* Forward declarations */ | ||
427 | struct acpi_walk_state ; | ||
428 | struct acpi_obj_mutex; | ||
429 | union acpi_parse_object ; | ||
430 | |||
431 | |||
432 | #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ | ||
433 | u8 data_type; /* To differentiate various internal objs */\ | ||
434 | u8 flags; \ | ||
435 | u16 value; \ | ||
436 | u16 state; \ | ||
437 | u16 reserved; \ | ||
438 | void *next; \ | ||
439 | |||
440 | struct acpi_common_state | ||
441 | { | ||
442 | ACPI_STATE_COMMON | ||
443 | }; | ||
444 | |||
445 | |||
446 | /* | ||
447 | * Update state - used to traverse complex objects such as packages | ||
448 | */ | ||
449 | struct acpi_update_state | ||
450 | { | ||
451 | ACPI_STATE_COMMON | ||
452 | union acpi_operand_object *object; | ||
453 | }; | ||
454 | |||
455 | |||
456 | /* | ||
457 | * Pkg state - used to traverse nested package structures | ||
458 | */ | ||
459 | struct acpi_pkg_state | ||
460 | { | ||
461 | ACPI_STATE_COMMON | ||
462 | union acpi_operand_object *source_object; | ||
463 | union acpi_operand_object *dest_object; | ||
464 | struct acpi_walk_state *walk_state; | ||
465 | void *this_target_obj; | ||
466 | u32 num_packages; | ||
467 | u16 index; | ||
468 | }; | ||
469 | |||
470 | |||
471 | /* | ||
472 | * Control state - one per if/else and while constructs. | ||
473 | * Allows nesting of these constructs | ||
474 | */ | ||
475 | struct acpi_control_state | ||
476 | { | ||
477 | ACPI_STATE_COMMON | ||
478 | union acpi_parse_object *predicate_op; | ||
479 | u8 *aml_predicate_start; /* Start of if/while predicate */ | ||
480 | u8 *package_end; /* End of if/while block */ | ||
481 | u16 opcode; | ||
482 | }; | ||
483 | |||
484 | |||
485 | /* | ||
486 | * Scope state - current scope during namespace lookups | ||
487 | */ | ||
488 | struct acpi_scope_state | ||
489 | { | ||
490 | ACPI_STATE_COMMON | ||
491 | struct acpi_namespace_node *node; | ||
492 | }; | ||
493 | |||
494 | |||
495 | struct acpi_pscope_state | ||
496 | { | ||
497 | ACPI_STATE_COMMON | ||
498 | union acpi_parse_object *op; /* Current op being parsed */ | ||
499 | u8 *arg_end; /* Current argument end */ | ||
500 | u8 *pkg_end; /* Current package end */ | ||
501 | u32 arg_list; /* Next argument to parse */ | ||
502 | u32 arg_count; /* Number of fixed arguments */ | ||
503 | }; | ||
504 | |||
505 | |||
506 | /* | ||
507 | * Thread state - one per thread across multiple walk states. Multiple walk | ||
508 | * states are created when there are nested control methods executing. | ||
509 | */ | ||
510 | struct acpi_thread_state | ||
511 | { | ||
512 | ACPI_STATE_COMMON | ||
513 | struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | ||
514 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ | ||
515 | u32 thread_id; /* Running thread ID */ | ||
516 | u8 current_sync_level; /* Mutex Sync (nested acquire) level */ | ||
517 | }; | ||
518 | |||
519 | |||
520 | /* | ||
521 | * Result values - used to accumulate the results of nested | ||
522 | * AML arguments | ||
523 | */ | ||
524 | struct acpi_result_values | ||
525 | { | ||
526 | ACPI_STATE_COMMON | ||
527 | union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS]; | ||
528 | u8 num_results; | ||
529 | u8 last_insert; | ||
530 | }; | ||
531 | |||
532 | |||
533 | typedef | ||
534 | acpi_status (*acpi_parse_downwards) ( | ||
535 | struct acpi_walk_state *walk_state, | ||
536 | union acpi_parse_object **out_op); | ||
537 | |||
538 | typedef | ||
539 | acpi_status (*acpi_parse_upwards) ( | ||
540 | struct acpi_walk_state *walk_state); | ||
541 | |||
542 | |||
543 | /* | ||
544 | * Notify info - used to pass info to the deferred notify | ||
545 | * handler/dispatcher. | ||
546 | */ | ||
547 | struct acpi_notify_info | ||
548 | { | ||
549 | ACPI_STATE_COMMON | ||
550 | struct acpi_namespace_node *node; | ||
551 | union acpi_operand_object *handler_obj; | ||
552 | }; | ||
553 | |||
554 | |||
555 | /* Generic state is union of structs above */ | ||
556 | |||
557 | union acpi_generic_state | ||
558 | { | ||
559 | struct acpi_common_state common; | ||
560 | struct acpi_control_state control; | ||
561 | struct acpi_update_state update; | ||
562 | struct acpi_scope_state scope; | ||
563 | struct acpi_pscope_state parse_scope; | ||
564 | struct acpi_pkg_state pkg; | ||
565 | struct acpi_thread_state thread; | ||
566 | struct acpi_result_values results; | ||
567 | struct acpi_notify_info notify; | ||
568 | }; | ||
569 | |||
570 | |||
571 | /***************************************************************************** | ||
572 | * | ||
573 | * Interpreter typedefs and structs | ||
574 | * | ||
575 | ****************************************************************************/ | ||
576 | |||
577 | typedef | ||
578 | acpi_status (*ACPI_EXECUTE_OP) ( | ||
579 | struct acpi_walk_state *walk_state); | ||
580 | |||
581 | |||
582 | /***************************************************************************** | ||
583 | * | ||
584 | * Parser typedefs and structs | ||
585 | * | ||
586 | ****************************************************************************/ | ||
587 | |||
588 | /* | ||
589 | * AML opcode, name, and argument layout | ||
590 | */ | ||
591 | struct acpi_opcode_info | ||
592 | { | ||
593 | #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) | ||
594 | char *name; /* Opcode name (disassembler/debug only) */ | ||
595 | #endif | ||
596 | u32 parse_args; /* Grammar/Parse time arguments */ | ||
597 | u32 runtime_args; /* Interpret time arguments */ | ||
598 | u32 flags; /* Misc flags */ | ||
599 | u8 object_type; /* Corresponding internal object type */ | ||
600 | u8 class; /* Opcode class */ | ||
601 | u8 type; /* Opcode type */ | ||
602 | }; | ||
603 | |||
604 | |||
605 | union acpi_parse_value | ||
606 | { | ||
607 | acpi_integer integer; /* Integer constant (Up to 64 bits) */ | ||
608 | struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ | ||
609 | u32 size; /* bytelist or field size */ | ||
610 | char *string; /* NULL terminated string */ | ||
611 | u8 *buffer; /* buffer or string */ | ||
612 | char *name; /* NULL terminated string */ | ||
613 | union acpi_parse_object *arg; /* arguments and contained ops */ | ||
614 | }; | ||
615 | |||
616 | |||
617 | #define ACPI_PARSE_COMMON \ | ||
618 | u8 data_type; /* To differentiate various internal objs */\ | ||
619 | u8 flags; /* Type of Op */\ | ||
620 | u16 aml_opcode; /* AML opcode */\ | ||
621 | u32 aml_offset; /* Offset of declaration in AML */\ | ||
622 | union acpi_parse_object *parent; /* Parent op */\ | ||
623 | union acpi_parse_object *next; /* Next op */\ | ||
624 | ACPI_DISASM_ONLY_MEMBERS (\ | ||
625 | u8 disasm_flags; /* Used during AML disassembly */\ | ||
626 | u8 disasm_opcode; /* Subtype used for disassembly */\ | ||
627 | char aml_op_name[16]) /* Op name (debug only) */\ | ||
628 | /* NON-DEBUG members below: */\ | ||
629 | struct acpi_namespace_node *node; /* For use by interpreter */\ | ||
630 | union acpi_parse_value value; /* Value or args associated with the opcode */\ | ||
631 | |||
632 | |||
633 | #define ACPI_DASM_BUFFER 0x00 | ||
634 | #define ACPI_DASM_RESOURCE 0x01 | ||
635 | #define ACPI_DASM_STRING 0x02 | ||
636 | #define ACPI_DASM_UNICODE 0x03 | ||
637 | #define ACPI_DASM_EISAID 0x04 | ||
638 | #define ACPI_DASM_MATCHOP 0x05 | ||
639 | |||
640 | /* | ||
641 | * generic operation (for example: If, While, Store) | ||
642 | */ | ||
643 | struct acpi_parse_obj_common | ||
644 | { | ||
645 | ACPI_PARSE_COMMON | ||
646 | }; | ||
647 | |||
648 | |||
649 | /* | ||
650 | * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), | ||
651 | * and bytelists. | ||
652 | */ | ||
653 | struct acpi_parse_obj_named | ||
654 | { | ||
655 | ACPI_PARSE_COMMON | ||
656 | u8 *path; | ||
657 | u8 *data; /* AML body or bytelist data */ | ||
658 | u32 length; /* AML length */ | ||
659 | u32 name; /* 4-byte name or zero if no name */ | ||
660 | }; | ||
661 | |||
662 | |||
663 | /* The parse node is the fundamental element of the parse tree */ | ||
664 | |||
665 | struct acpi_parse_obj_asl | ||
666 | { | ||
667 | ACPI_PARSE_COMMON | ||
668 | union acpi_parse_object *child; | ||
669 | union acpi_parse_object *parent_method; | ||
670 | char *filename; | ||
671 | char *external_name; | ||
672 | char *namepath; | ||
673 | char name_seg[4]; | ||
674 | u32 extra_value; | ||
675 | u32 column; | ||
676 | u32 line_number; | ||
677 | u32 logical_line_number; | ||
678 | u32 logical_byte_offset; | ||
679 | u32 end_line; | ||
680 | u32 end_logical_line; | ||
681 | u32 acpi_btype; | ||
682 | u32 aml_length; | ||
683 | u32 aml_subtree_length; | ||
684 | u32 final_aml_length; | ||
685 | u32 final_aml_offset; | ||
686 | u32 compile_flags; | ||
687 | u16 parse_opcode; | ||
688 | u8 aml_opcode_length; | ||
689 | u8 aml_pkg_len_bytes; | ||
690 | u8 extra; | ||
691 | char parse_op_name[12]; | ||
692 | }; | ||
693 | |||
694 | |||
695 | union acpi_parse_object | ||
696 | { | ||
697 | struct acpi_parse_obj_common common; | ||
698 | struct acpi_parse_obj_named named; | ||
699 | struct acpi_parse_obj_asl asl; | ||
700 | }; | ||
701 | |||
702 | |||
703 | /* | ||
704 | * Parse state - one state per parser invocation and each control | ||
705 | * method. | ||
706 | */ | ||
707 | struct acpi_parse_state | ||
708 | { | ||
709 | u32 aml_size; | ||
710 | u8 *aml_start; /* First AML byte */ | ||
711 | u8 *aml; /* Next AML byte */ | ||
712 | u8 *aml_end; /* (last + 1) AML byte */ | ||
713 | u8 *pkg_start; /* Current package begin */ | ||
714 | u8 *pkg_end; /* Current package end */ | ||
715 | union acpi_parse_object *start_op; /* Root of parse tree */ | ||
716 | struct acpi_namespace_node *start_node; | ||
717 | union acpi_generic_state *scope; /* Current scope */ | ||
718 | union acpi_parse_object *start_scope; | ||
719 | }; | ||
720 | |||
721 | |||
722 | /* Parse object flags */ | ||
723 | |||
724 | #define ACPI_PARSEOP_GENERIC 0x01 | ||
725 | #define ACPI_PARSEOP_NAMED 0x02 | ||
726 | #define ACPI_PARSEOP_DEFERRED 0x04 | ||
727 | #define ACPI_PARSEOP_BYTELIST 0x08 | ||
728 | #define ACPI_PARSEOP_IN_CACHE 0x80 | ||
729 | |||
730 | /* Parse object disasm_flags */ | ||
731 | |||
732 | #define ACPI_PARSEOP_IGNORE 0x01 | ||
733 | #define ACPI_PARSEOP_PARAMLIST 0x02 | ||
734 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 | ||
735 | #define ACPI_PARSEOP_SPECIAL 0x10 | ||
736 | |||
737 | |||
738 | /***************************************************************************** | ||
739 | * | ||
740 | * Hardware (ACPI registers) and PNP | ||
741 | * | ||
742 | ****************************************************************************/ | ||
743 | |||
744 | #define PCI_ROOT_HID_STRING "PNP0A03" | ||
745 | |||
746 | struct acpi_bit_register_info | ||
747 | { | ||
748 | u8 parent_register; | ||
749 | u8 bit_position; | ||
750 | u16 access_bit_mask; | ||
751 | }; | ||
752 | |||
753 | |||
754 | /* | ||
755 | * Register IDs | ||
756 | * These are the full ACPI registers | ||
757 | */ | ||
758 | #define ACPI_REGISTER_PM1_STATUS 0x01 | ||
759 | #define ACPI_REGISTER_PM1_ENABLE 0x02 | ||
760 | #define ACPI_REGISTER_PM1_CONTROL 0x03 | ||
761 | #define ACPI_REGISTER_PM1A_CONTROL 0x04 | ||
762 | #define ACPI_REGISTER_PM1B_CONTROL 0x05 | ||
763 | #define ACPI_REGISTER_PM2_CONTROL 0x06 | ||
764 | #define ACPI_REGISTER_PM_TIMER 0x07 | ||
765 | #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 | ||
766 | #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 | ||
767 | |||
768 | |||
769 | /* Masks used to access the bit_registers */ | ||
770 | |||
771 | #define ACPI_BITMASK_TIMER_STATUS 0x0001 | ||
772 | #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 | ||
773 | #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 | ||
774 | #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 | ||
775 | #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 | ||
776 | #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 | ||
777 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ | ||
778 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 | ||
779 | |||
780 | #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ | ||
781 | ACPI_BITMASK_BUS_MASTER_STATUS | \ | ||
782 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ | ||
783 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | ||
784 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | ||
785 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | ||
786 | ACPI_BITMASK_WAKE_STATUS) | ||
787 | |||
788 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | ||
789 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 | ||
790 | #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 | ||
791 | #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 | ||
792 | #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 | ||
793 | #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ | ||
794 | |||
795 | #define ACPI_BITMASK_SCI_ENABLE 0x0001 | ||
796 | #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 | ||
797 | #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 | ||
798 | #define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00 | ||
799 | #define ACPI_BITMASK_SLEEP_ENABLE 0x2000 | ||
800 | |||
801 | #define ACPI_BITMASK_ARB_DISABLE 0x0001 | ||
802 | |||
803 | |||
804 | /* Raw bit position of each bit_register */ | ||
805 | |||
806 | #define ACPI_BITPOSITION_TIMER_STATUS 0x00 | ||
807 | #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 | ||
808 | #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 | ||
809 | #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 | ||
810 | #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 | ||
811 | #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A | ||
812 | #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ | ||
813 | #define ACPI_BITPOSITION_WAKE_STATUS 0x0F | ||
814 | |||
815 | #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 | ||
816 | #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 | ||
817 | #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 | ||
818 | #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 | ||
819 | #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A | ||
820 | #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ | ||
821 | |||
822 | #define ACPI_BITPOSITION_SCI_ENABLE 0x00 | ||
823 | #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 | ||
824 | #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 | ||
825 | #define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A | ||
826 | #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D | ||
827 | |||
828 | #define ACPI_BITPOSITION_ARB_DISABLE 0x00 | ||
829 | |||
830 | |||
831 | /***************************************************************************** | ||
832 | * | ||
833 | * Resource descriptors | ||
834 | * | ||
835 | ****************************************************************************/ | ||
836 | |||
837 | |||
838 | /* resource_type values */ | ||
839 | |||
840 | #define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 | ||
841 | #define ACPI_RESOURCE_TYPE_IO_RANGE 1 | ||
842 | #define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 | ||
843 | |||
844 | /* Resource descriptor types and masks */ | ||
845 | |||
846 | #define ACPI_RDESC_TYPE_LARGE 0x80 | ||
847 | #define ACPI_RDESC_TYPE_SMALL 0x00 | ||
848 | |||
849 | #define ACPI_RDESC_TYPE_MASK 0x80 | ||
850 | #define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ | ||
851 | |||
852 | |||
853 | /* | ||
854 | * Small resource descriptor types | ||
855 | * Note: The 3 length bits (2:0) must be zero | ||
856 | */ | ||
857 | #define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 | ||
858 | #define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 | ||
859 | #define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 | ||
860 | #define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 | ||
861 | #define ACPI_RDESC_TYPE_IO_PORT 0x40 | ||
862 | #define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 | ||
863 | #define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 | ||
864 | #define ACPI_RDESC_TYPE_END_TAG 0x78 | ||
865 | |||
866 | /* | ||
867 | * Large resource descriptor types | ||
868 | */ | ||
869 | #define ACPI_RDESC_TYPE_MEMORY_24 0x81 | ||
870 | #define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82 | ||
871 | #define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 | ||
872 | #define ACPI_RDESC_TYPE_MEMORY_32 0x85 | ||
873 | #define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 | ||
874 | #define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 | ||
875 | #define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 | ||
876 | #define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 | ||
877 | #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A | ||
878 | #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B | ||
879 | |||
880 | |||
881 | /***************************************************************************** | ||
882 | * | ||
883 | * Miscellaneous | ||
884 | * | ||
885 | ****************************************************************************/ | ||
886 | |||
887 | #define ACPI_ASCII_ZERO 0x30 | ||
888 | |||
889 | |||
890 | /***************************************************************************** | ||
891 | * | ||
892 | * Debugger | ||
893 | * | ||
894 | ****************************************************************************/ | ||
895 | |||
896 | struct acpi_db_method_info | ||
897 | { | ||
898 | acpi_handle thread_gate; | ||
899 | char *name; | ||
900 | char **args; | ||
901 | u32 flags; | ||
902 | u32 num_loops; | ||
903 | char pathname[128]; | ||
904 | }; | ||
905 | |||
906 | struct acpi_integrity_info | ||
907 | { | ||
908 | u32 nodes; | ||
909 | u32 objects; | ||
910 | }; | ||
911 | |||
912 | |||
913 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 | ||
914 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 | ||
915 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 | ||
916 | |||
917 | |||
918 | /***************************************************************************** | ||
919 | * | ||
920 | * Debug | ||
921 | * | ||
922 | ****************************************************************************/ | ||
923 | |||
924 | struct acpi_debug_print_info | ||
925 | { | ||
926 | u32 component_id; | ||
927 | char *proc_name; | ||
928 | char *module_name; | ||
929 | }; | ||
930 | |||
931 | |||
932 | /* Entry for a memory allocation (debug only) */ | ||
933 | |||
934 | #define ACPI_MEM_MALLOC 0 | ||
935 | #define ACPI_MEM_CALLOC 1 | ||
936 | #define ACPI_MAX_MODULE_NAME 16 | ||
937 | |||
938 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ | ||
939 | struct acpi_debug_mem_block *previous; \ | ||
940 | struct acpi_debug_mem_block *next; \ | ||
941 | u32 size; \ | ||
942 | u32 component; \ | ||
943 | u32 line; \ | ||
944 | char module[ACPI_MAX_MODULE_NAME]; \ | ||
945 | u8 alloc_type; | ||
946 | |||
947 | struct acpi_debug_mem_header | ||
948 | { | ||
949 | ACPI_COMMON_DEBUG_MEM_HEADER | ||
950 | }; | ||
951 | |||
952 | struct acpi_debug_mem_block | ||
953 | { | ||
954 | ACPI_COMMON_DEBUG_MEM_HEADER | ||
955 | u64 user_space; | ||
956 | }; | ||
957 | |||
958 | |||
959 | #define ACPI_MEM_LIST_GLOBAL 0 | ||
960 | #define ACPI_MEM_LIST_NSNODE 1 | ||
961 | |||
962 | #define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 | ||
963 | #define ACPI_MEM_LIST_STATE 2 | ||
964 | #define ACPI_MEM_LIST_PSNODE 3 | ||
965 | #define ACPI_MEM_LIST_PSNODE_EXT 4 | ||
966 | #define ACPI_MEM_LIST_OPERAND 5 | ||
967 | #define ACPI_MEM_LIST_WALK 6 | ||
968 | #define ACPI_MEM_LIST_MAX 6 | ||
969 | #define ACPI_NUM_MEM_LISTS 7 | ||
970 | |||
971 | |||
972 | struct acpi_memory_list | ||
973 | { | ||
974 | void *list_head; | ||
975 | u16 link_offset; | ||
976 | u16 max_cache_depth; | ||
977 | u16 cache_depth; | ||
978 | u16 object_size; | ||
979 | |||
980 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
981 | |||
982 | /* Statistics for debug memory tracking only */ | ||
983 | |||
984 | u32 total_allocated; | ||
985 | u32 total_freed; | ||
986 | u32 current_total_size; | ||
987 | u32 cache_requests; | ||
988 | u32 cache_hits; | ||
989 | char *list_name; | ||
990 | #endif | ||
991 | }; | ||
992 | |||
993 | |||
994 | #endif /* __ACLOCAL_H__ */ | ||
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h new file mode 100644 index 000000000000..fcaced16b16f --- /dev/null +++ b/include/acpi/acmacros.h | |||
@@ -0,0 +1,678 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acmacros.h - C macros for the entire subsystem. | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACMACROS_H__ | ||
45 | #define __ACMACROS_H__ | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Data manipulation macros | ||
50 | */ | ||
51 | #define ACPI_LOWORD(l) ((u16)(u32)(l)) | ||
52 | #define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) | ||
53 | #define ACPI_LOBYTE(l) ((u8)(u16)(l)) | ||
54 | #define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) | ||
55 | |||
56 | #define ACPI_SET_BIT(target,bit) ((target) |= (bit)) | ||
57 | #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) | ||
58 | #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) | ||
59 | |||
60 | |||
61 | #if ACPI_MACHINE_WIDTH == 16 | ||
62 | |||
63 | /* | ||
64 | * For 16-bit addresses, we have to assume that the upper 32 bits | ||
65 | * are zero. | ||
66 | */ | ||
67 | #define ACPI_LODWORD(l) ((u32)(l)) | ||
68 | #define ACPI_HIDWORD(l) ((u32)(0)) | ||
69 | |||
70 | #define ACPI_GET_ADDRESS(a) ((a).lo) | ||
71 | #define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(u32)(b);} | ||
72 | #define ACPI_VALID_ADDRESS(a) ((a).hi | (a).lo) | ||
73 | |||
74 | #else | ||
75 | #ifdef ACPI_NO_INTEGER64_SUPPORT | ||
76 | /* | ||
77 | * acpi_integer is 32-bits, no 64-bit support on this platform | ||
78 | */ | ||
79 | #define ACPI_LODWORD(l) ((u32)(l)) | ||
80 | #define ACPI_HIDWORD(l) ((u32)(0)) | ||
81 | |||
82 | #define ACPI_GET_ADDRESS(a) (a) | ||
83 | #define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) | ||
84 | #define ACPI_VALID_ADDRESS(a) (a) | ||
85 | |||
86 | #else | ||
87 | |||
88 | /* | ||
89 | * Full 64-bit address/integer on both 32-bit and 64-bit platforms | ||
90 | */ | ||
91 | #define ACPI_LODWORD(l) ((u32)(u64)(l)) | ||
92 | #define ACPI_HIDWORD(l) ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi)) | ||
93 | |||
94 | #define ACPI_GET_ADDRESS(a) (a) | ||
95 | #define ACPI_STORE_ADDRESS(a,b) ((a)=(acpi_physical_address)(b)) | ||
96 | #define ACPI_VALID_ADDRESS(a) (a) | ||
97 | #endif | ||
98 | #endif | ||
99 | |||
100 | /* | ||
101 | * printf() format helpers | ||
102 | */ | ||
103 | |||
104 | /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ | ||
105 | |||
106 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) | ||
107 | |||
108 | /* | ||
109 | * Extract a byte of data using a pointer. Any more than a byte and we | ||
110 | * get into potential aligment issues -- see the STORE macros below | ||
111 | */ | ||
112 | #define ACPI_GET8(addr) (*(u8*)(addr)) | ||
113 | |||
114 | /* Pointer arithmetic */ | ||
115 | |||
116 | #define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (acpi_native_uint)(b)) | ||
117 | #define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b)) | ||
118 | |||
119 | /* Pointer/Integer type conversions */ | ||
120 | |||
121 | #define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(acpi_native_uint)i) | ||
122 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) | ||
123 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) | ||
124 | #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) | ||
125 | |||
126 | #define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) | ||
127 | #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) | ||
128 | |||
129 | #if ACPI_MACHINE_WIDTH == 16 | ||
130 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) | ||
131 | #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) | ||
132 | #define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i) | ||
133 | #else | ||
134 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) | ||
135 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) | ||
136 | #endif | ||
137 | |||
138 | /* | ||
139 | * Macros for moving data around to/from buffers that are possibly unaligned. | ||
140 | * If the hardware supports the transfer of unaligned data, just do the store. | ||
141 | * Otherwise, we have to move one byte at a time. | ||
142 | */ | ||
143 | #ifdef ACPI_BIG_ENDIAN | ||
144 | /* | ||
145 | * Macros for big-endian machines | ||
146 | */ | ||
147 | |||
148 | /* This macro sets a buffer index, starting from the end of the buffer */ | ||
149 | |||
150 | #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran))) | ||
151 | |||
152 | /* These macros reverse the bytes during the move, converting little-endian to big endian */ | ||
153 | |||
154 | /* Big Endian <== Little Endian */ | ||
155 | /* Hi...Lo Lo...Hi */ | ||
156 | /* 16-bit source, 16/32/64 destination */ | ||
157 | |||
158 | #define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ | ||
159 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} | ||
160 | |||
161 | #define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\ | ||
162 | ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ | ||
163 | ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} | ||
164 | |||
165 | #define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ | ||
166 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | ||
167 | ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} | ||
168 | |||
169 | /* 32-bit source, 16/32/64 destination */ | ||
170 | |||
171 | #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
172 | |||
173 | #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ | ||
174 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ | ||
175 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ | ||
176 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} | ||
177 | |||
178 | #define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ | ||
179 | ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ | ||
180 | ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ | ||
181 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | ||
182 | ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} | ||
183 | |||
184 | /* 64-bit source, 16/32/64 destination */ | ||
185 | |||
186 | #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
187 | |||
188 | #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ | ||
189 | |||
190 | #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ | ||
191 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ | ||
192 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\ | ||
193 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\ | ||
194 | (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ | ||
195 | (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ | ||
196 | (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | ||
197 | (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} | ||
198 | #else | ||
199 | /* | ||
200 | * Macros for little-endian machines | ||
201 | */ | ||
202 | |||
203 | /* This macro sets a buffer index, starting from the beginning of the buffer */ | ||
204 | |||
205 | #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) | ||
206 | |||
207 | #ifdef ACPI_MISALIGNED_TRANSFERS | ||
208 | |||
209 | /* The hardware supports unaligned transfers, just do the little-endian move */ | ||
210 | |||
211 | #if ACPI_MACHINE_WIDTH == 16 | ||
212 | |||
213 | /* No 64-bit integers */ | ||
214 | /* 16-bit source, 16/32/64 destination */ | ||
215 | |||
216 | #define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) | ||
217 | #define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) | ||
218 | #define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s) | ||
219 | |||
220 | /* 32-bit source, 16/32/64 destination */ | ||
221 | |||
222 | #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
223 | #define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) | ||
224 | #define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) | ||
225 | |||
226 | /* 64-bit source, 16/32/64 destination */ | ||
227 | |||
228 | #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
229 | #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ | ||
230 | #define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) | ||
231 | |||
232 | #else | ||
233 | /* 16-bit source, 16/32/64 destination */ | ||
234 | |||
235 | #define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) | ||
236 | #define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) | ||
237 | #define ACPI_MOVE_16_TO_64(d,s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s) | ||
238 | |||
239 | /* 32-bit source, 16/32/64 destination */ | ||
240 | |||
241 | #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
242 | #define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) | ||
243 | #define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) | ||
244 | |||
245 | /* 64-bit source, 16/32/64 destination */ | ||
246 | |||
247 | #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
248 | #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ | ||
249 | #define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) | ||
250 | #endif | ||
251 | |||
252 | #else | ||
253 | /* | ||
254 | * The hardware does not support unaligned transfers. We must move the | ||
255 | * data one byte at a time. These macros work whether the source or | ||
256 | * the destination (or both) is/are unaligned. (Little-endian move) | ||
257 | */ | ||
258 | |||
259 | /* 16-bit source, 16/32/64 destination */ | ||
260 | |||
261 | #define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | ||
262 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];} | ||
263 | |||
264 | #define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} | ||
265 | #define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} | ||
266 | |||
267 | /* 32-bit source, 16/32/64 destination */ | ||
268 | |||
269 | #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
270 | |||
271 | #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | ||
272 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ | ||
273 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ | ||
274 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];} | ||
275 | |||
276 | #define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);} | ||
277 | |||
278 | /* 64-bit source, 16/32/64 destination */ | ||
279 | |||
280 | #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ | ||
281 | #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ | ||
282 | #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | ||
283 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ | ||
284 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ | ||
285 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\ | ||
286 | (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\ | ||
287 | (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\ | ||
288 | (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\ | ||
289 | (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];} | ||
290 | #endif | ||
291 | #endif | ||
292 | |||
293 | /* Macros based on machine integer width */ | ||
294 | |||
295 | #if ACPI_MACHINE_WIDTH == 16 | ||
296 | #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) | ||
297 | |||
298 | #elif ACPI_MACHINE_WIDTH == 32 | ||
299 | #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) | ||
300 | |||
301 | #elif ACPI_MACHINE_WIDTH == 64 | ||
302 | #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s) | ||
303 | |||
304 | #else | ||
305 | #error unknown ACPI_MACHINE_WIDTH | ||
306 | #endif | ||
307 | |||
308 | |||
309 | /* | ||
310 | * Fast power-of-two math macros for non-optimized compilers | ||
311 | */ | ||
312 | #define _ACPI_DIV(value,power_of2) ((u32) ((value) >> (power_of2))) | ||
313 | #define _ACPI_MUL(value,power_of2) ((u32) ((value) << (power_of2))) | ||
314 | #define _ACPI_MOD(value,divisor) ((u32) ((value) & ((divisor) -1))) | ||
315 | |||
316 | #define ACPI_DIV_2(a) _ACPI_DIV(a,1) | ||
317 | #define ACPI_MUL_2(a) _ACPI_MUL(a,1) | ||
318 | #define ACPI_MOD_2(a) _ACPI_MOD(a,2) | ||
319 | |||
320 | #define ACPI_DIV_4(a) _ACPI_DIV(a,2) | ||
321 | #define ACPI_MUL_4(a) _ACPI_MUL(a,2) | ||
322 | #define ACPI_MOD_4(a) _ACPI_MOD(a,4) | ||
323 | |||
324 | #define ACPI_DIV_8(a) _ACPI_DIV(a,3) | ||
325 | #define ACPI_MUL_8(a) _ACPI_MUL(a,3) | ||
326 | #define ACPI_MOD_8(a) _ACPI_MOD(a,8) | ||
327 | |||
328 | #define ACPI_DIV_16(a) _ACPI_DIV(a,4) | ||
329 | #define ACPI_MUL_16(a) _ACPI_MUL(a,4) | ||
330 | #define ACPI_MOD_16(a) _ACPI_MOD(a,16) | ||
331 | |||
332 | |||
333 | /* | ||
334 | * Rounding macros (Power of two boundaries only) | ||
335 | */ | ||
336 | #define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & (~(((acpi_native_uint) boundary)-1))) | ||
337 | #define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + (((acpi_native_uint) boundary)-1)) & (~(((acpi_native_uint) boundary)-1))) | ||
338 | |||
339 | #define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) | ||
340 | #define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) | ||
341 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) | ||
342 | |||
343 | #define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4) | ||
344 | #define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) | ||
345 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) | ||
346 | |||
347 | |||
348 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) | ||
349 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) | ||
350 | |||
351 | #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) | ||
352 | |||
353 | /* Generic (non-power-of-two) rounding */ | ||
354 | |||
355 | #define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) | ||
356 | |||
357 | /* | ||
358 | * Bitmask creation | ||
359 | * Bit positions start at zero. | ||
360 | * MASK_BITS_ABOVE creates a mask starting AT the position and above | ||
361 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position | ||
362 | */ | ||
363 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) | ||
364 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) | ||
365 | |||
366 | #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) | ||
367 | |||
368 | |||
369 | /* Bitfields within ACPI registers */ | ||
370 | |||
371 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) | ||
372 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | ||
373 | |||
374 | /* | ||
375 | * An struct acpi_namespace_node * can appear in some contexts, | ||
376 | * where a pointer to an union acpi_operand_object can also | ||
377 | * appear. This macro is used to distinguish them. | ||
378 | * | ||
379 | * The "Descriptor" field is the first field in both structures. | ||
380 | */ | ||
381 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) | ||
382 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) | ||
383 | |||
384 | |||
385 | /* Macro to test the object type */ | ||
386 | |||
387 | #define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) | ||
388 | |||
389 | /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ | ||
390 | |||
391 | #define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) | ||
392 | |||
393 | /* | ||
394 | * Macros for the master AML opcode table | ||
395 | */ | ||
396 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) | ||
397 | #define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type} | ||
398 | #else | ||
399 | #define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type} | ||
400 | #endif | ||
401 | |||
402 | #ifdef ACPI_DISASSEMBLER | ||
403 | #define ACPI_DISASM_ONLY_MEMBERS(a) a; | ||
404 | #else | ||
405 | #define ACPI_DISASM_ONLY_MEMBERS(a) | ||
406 | #endif | ||
407 | |||
408 | #define ARG_TYPE_WIDTH 5 | ||
409 | #define ARG_1(x) ((u32)(x)) | ||
410 | #define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH)) | ||
411 | #define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH)) | ||
412 | #define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH)) | ||
413 | #define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH)) | ||
414 | #define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) | ||
415 | |||
416 | #define ARGI_LIST1(a) (ARG_1(a)) | ||
417 | #define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) | ||
418 | #define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) | ||
419 | #define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) | ||
420 | #define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) | ||
421 | #define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) | ||
422 | |||
423 | #define ARGP_LIST1(a) (ARG_1(a)) | ||
424 | #define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) | ||
425 | #define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) | ||
426 | #define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) | ||
427 | #define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) | ||
428 | #define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) | ||
429 | |||
430 | #define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) | ||
431 | #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) | ||
432 | |||
433 | |||
434 | /* | ||
435 | * Reporting macros that are never compiled out | ||
436 | */ | ||
437 | #define ACPI_PARAM_LIST(pl) pl | ||
438 | |||
439 | /* | ||
440 | * Error reporting. These versions add callers module and line#. Since | ||
441 | * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only | ||
442 | * use it in debug mode. | ||
443 | */ | ||
444 | #ifdef ACPI_DEBUG_OUTPUT | ||
445 | |||
446 | #define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \ | ||
447 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
448 | #define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \ | ||
449 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
450 | #define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ | ||
451 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
452 | #define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); | ||
453 | |||
454 | #define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); | ||
455 | |||
456 | #else | ||
457 | |||
458 | #define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \ | ||
459 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
460 | #define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \ | ||
461 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
462 | #define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \ | ||
463 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
464 | #define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e); | ||
465 | |||
466 | #define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e); | ||
467 | |||
468 | #endif | ||
469 | |||
470 | /* Error reporting. These versions pass thru the module and line# */ | ||
471 | |||
472 | #define _ACPI_REPORT_INFO(a,b,c,fp) {acpi_ut_report_info(a,b,c); \ | ||
473 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
474 | #define _ACPI_REPORT_ERROR(a,b,c,fp) {acpi_ut_report_error(a,b,c); \ | ||
475 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
476 | #define _ACPI_REPORT_WARNING(a,b,c,fp) {acpi_ut_report_warning(a,b,c); \ | ||
477 | acpi_os_printf ACPI_PARAM_LIST(fp);} | ||
478 | |||
479 | /* | ||
480 | * Debug macros that are conditionally compiled | ||
481 | */ | ||
482 | #ifdef ACPI_DEBUG_OUTPUT | ||
483 | |||
484 | #define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; | ||
485 | |||
486 | /* | ||
487 | * Function entry tracing. | ||
488 | * The first parameter should be the procedure name as a quoted string. This is declared | ||
489 | * as a local string ("_proc_name) so that it can be also used by the function exit macros below. | ||
490 | */ | ||
491 | #define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _debug_info; \ | ||
492 | _debug_info.component_id = _COMPONENT; \ | ||
493 | _debug_info.proc_name = a; \ | ||
494 | _debug_info.module_name = _THIS_MODULE; | ||
495 | |||
496 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ | ||
497 | acpi_ut_trace(__LINE__,&_debug_info) | ||
498 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ | ||
499 | acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b) | ||
500 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ | ||
501 | acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b) | ||
502 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ | ||
503 | acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b) | ||
504 | |||
505 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() | ||
506 | |||
507 | /* | ||
508 | * Function exit tracing. | ||
509 | * WARNING: These macros include a return statement. This is usually considered | ||
510 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | ||
511 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | ||
512 | * so that "_proc_name" is defined. | ||
513 | */ | ||
514 | #ifdef ACPI_USE_DO_WHILE_0 | ||
515 | #define ACPI_DO_WHILE0(a) do a while(0) | ||
516 | #else | ||
517 | #define ACPI_DO_WHILE0(a) a | ||
518 | #endif | ||
519 | |||
520 | #define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;}) | ||
521 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));}) | ||
522 | #define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));}) | ||
523 | #define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));}) | ||
524 | |||
525 | /* Conditional execution */ | ||
526 | |||
527 | #define ACPI_DEBUG_EXEC(a) a | ||
528 | #define ACPI_NORMAL_EXEC(a) | ||
529 | |||
530 | #define ACPI_DEBUG_DEFINE(a) a; | ||
531 | #define ACPI_DEBUG_ONLY_MEMBERS(a) a; | ||
532 | #define _VERBOSE_STRUCTURES | ||
533 | |||
534 | |||
535 | /* Stack and buffer dumping */ | ||
536 | |||
537 | #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) | ||
538 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) | ||
539 | |||
540 | |||
541 | #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) | ||
542 | |||
543 | #ifdef ACPI_FUTURE_USAGE | ||
544 | #define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b) | ||
545 | #endif | ||
546 | |||
547 | #define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) | ||
548 | #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) | ||
549 | #define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) | ||
550 | #define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a)) | ||
551 | |||
552 | |||
553 | /* | ||
554 | * Generate INT3 on ACPI_ERROR (Debug only!) | ||
555 | */ | ||
556 | #define ACPI_ERROR_BREAK | ||
557 | #ifdef ACPI_ERROR_BREAK | ||
558 | #define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \ | ||
559 | acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n") | ||
560 | #else | ||
561 | #define ACPI_BREAK_ON_ERROR(lvl) | ||
562 | #endif | ||
563 | |||
564 | /* | ||
565 | * Master debug print macros | ||
566 | * Print iff: | ||
567 | * 1) Debug print for the current component is enabled | ||
568 | * 2) Debug error level or trace level for the print statement is enabled | ||
569 | */ | ||
570 | #define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print ACPI_PARAM_LIST(pl) | ||
571 | #define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl) | ||
572 | |||
573 | |||
574 | #else | ||
575 | /* | ||
576 | * This is the non-debug case -- make everything go away, | ||
577 | * leaving no executable debug code! | ||
578 | */ | ||
579 | #define ACPI_MODULE_NAME(name) | ||
580 | #define _THIS_MODULE "" | ||
581 | |||
582 | #define ACPI_DEBUG_EXEC(a) | ||
583 | #define ACPI_NORMAL_EXEC(a) a; | ||
584 | |||
585 | #define ACPI_DEBUG_DEFINE(a) | ||
586 | #define ACPI_DEBUG_ONLY_MEMBERS(a) | ||
587 | #define ACPI_FUNCTION_NAME(a) | ||
588 | #define ACPI_FUNCTION_TRACE(a) | ||
589 | #define ACPI_FUNCTION_TRACE_PTR(a,b) | ||
590 | #define ACPI_FUNCTION_TRACE_U32(a,b) | ||
591 | #define ACPI_FUNCTION_TRACE_STR(a,b) | ||
592 | #define ACPI_FUNCTION_EXIT | ||
593 | #define ACPI_FUNCTION_STATUS_EXIT(s) | ||
594 | #define ACPI_FUNCTION_VALUE_EXIT(s) | ||
595 | #define ACPI_FUNCTION_ENTRY() | ||
596 | #define ACPI_DUMP_STACK_ENTRY(a) | ||
597 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) | ||
598 | #define ACPI_DUMP_ENTRY(a,b) | ||
599 | |||
600 | #ifdef ACPI_FUTURE_USAGE | ||
601 | #define ACPI_DUMP_TABLES(a,b) | ||
602 | #endif | ||
603 | |||
604 | #define ACPI_DUMP_PATHNAME(a,b,c,d) | ||
605 | #define ACPI_DUMP_RESOURCE_LIST(a) | ||
606 | #define ACPI_DUMP_BUFFER(a,b) | ||
607 | #define ACPI_DEBUG_PRINT(pl) | ||
608 | #define ACPI_DEBUG_PRINT_RAW(pl) | ||
609 | #define ACPI_BREAK_MSG(a) | ||
610 | |||
611 | #define return_VOID return | ||
612 | #define return_ACPI_STATUS(s) return(s) | ||
613 | #define return_VALUE(s) return(s) | ||
614 | #define return_PTR(s) return(s) | ||
615 | |||
616 | #endif | ||
617 | |||
618 | /* | ||
619 | * Some code only gets executed when the debugger is built in. | ||
620 | * Note that this is entirely independent of whether the | ||
621 | * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. | ||
622 | */ | ||
623 | #ifdef ACPI_DEBUGGER | ||
624 | #define ACPI_DEBUGGER_EXEC(a) a | ||
625 | #else | ||
626 | #define ACPI_DEBUGGER_EXEC(a) | ||
627 | #endif | ||
628 | |||
629 | |||
630 | /* | ||
631 | * For 16-bit code, we want to shrink some things even though | ||
632 | * we are using ACPI_DEBUG_OUTPUT to get the debug output | ||
633 | */ | ||
634 | #if ACPI_MACHINE_WIDTH == 16 | ||
635 | #undef ACPI_DEBUG_ONLY_MEMBERS | ||
636 | #undef _VERBOSE_STRUCTURES | ||
637 | #define ACPI_DEBUG_ONLY_MEMBERS(a) | ||
638 | #endif | ||
639 | |||
640 | |||
641 | #ifdef ACPI_DEBUG_OUTPUT | ||
642 | /* | ||
643 | * 1) Set name to blanks | ||
644 | * 2) Copy the object name | ||
645 | */ | ||
646 | #define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\ | ||
647 | ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name)) | ||
648 | #else | ||
649 | |||
650 | #define ACPI_ADD_OBJECT_NAME(a,b) | ||
651 | #endif | ||
652 | |||
653 | |||
654 | /* | ||
655 | * Memory allocation tracking (DEBUG ONLY) | ||
656 | */ | ||
657 | #ifndef ACPI_DBG_TRACK_ALLOCATIONS | ||
658 | |||
659 | /* Memory allocation */ | ||
660 | |||
661 | #define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) | ||
662 | #define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) | ||
663 | #define ACPI_MEM_FREE(a) acpi_os_free(a) | ||
664 | #define ACPI_MEM_TRACKING(a) | ||
665 | |||
666 | |||
667 | #else | ||
668 | |||
669 | /* Memory allocation */ | ||
670 | |||
671 | #define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) | ||
672 | #define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) | ||
673 | #define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__) | ||
674 | #define ACPI_MEM_TRACKING(a) a | ||
675 | |||
676 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | ||
677 | |||
678 | #endif /* ACMACROS_H */ | ||
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h new file mode 100644 index 000000000000..8b3cdc3566b1 --- /dev/null +++ b/include/acpi/acnamesp.h | |||
@@ -0,0 +1,515 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acnamesp.h - Namespace subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACNAMESP_H__ | ||
45 | #define __ACNAMESP_H__ | ||
46 | |||
47 | |||
48 | /* To search the entire name space, pass this as search_base */ | ||
49 | |||
50 | #define ACPI_NS_ALL ((acpi_handle)0) | ||
51 | |||
52 | /* | ||
53 | * Elements of acpi_ns_properties are bit significant | ||
54 | * and should be one-to-one with values of acpi_object_type | ||
55 | */ | ||
56 | #define ACPI_NS_NORMAL 0 | ||
57 | #define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ | ||
58 | #define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ | ||
59 | |||
60 | |||
61 | /* Definitions of the predefined namespace names */ | ||
62 | |||
63 | #define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ | ||
64 | #define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ | ||
65 | #define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ | ||
66 | |||
67 | #define ACPI_NS_ROOT_PATH "\\" | ||
68 | #define ACPI_NS_SYSTEM_BUS "_SB_" | ||
69 | |||
70 | |||
71 | /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ | ||
72 | |||
73 | #define ACPI_NS_NO_UPSEARCH 0 | ||
74 | #define ACPI_NS_SEARCH_PARENT 0x01 | ||
75 | #define ACPI_NS_DONT_OPEN_SCOPE 0x02 | ||
76 | #define ACPI_NS_NO_PEER_SEARCH 0x04 | ||
77 | #define ACPI_NS_ERROR_IF_FOUND 0x08 | ||
78 | |||
79 | #define ACPI_NS_WALK_UNLOCK TRUE | ||
80 | #define ACPI_NS_WALK_NO_UNLOCK FALSE | ||
81 | |||
82 | |||
83 | acpi_status | ||
84 | acpi_ns_load_namespace ( | ||
85 | void); | ||
86 | |||
87 | acpi_status | ||
88 | acpi_ns_initialize_objects ( | ||
89 | void); | ||
90 | |||
91 | acpi_status | ||
92 | acpi_ns_initialize_devices ( | ||
93 | void); | ||
94 | |||
95 | |||
96 | /* Namespace init - nsxfinit */ | ||
97 | |||
98 | acpi_status | ||
99 | acpi_ns_init_one_device ( | ||
100 | acpi_handle obj_handle, | ||
101 | u32 nesting_level, | ||
102 | void *context, | ||
103 | void **return_value); | ||
104 | |||
105 | acpi_status | ||
106 | acpi_ns_init_one_object ( | ||
107 | acpi_handle obj_handle, | ||
108 | u32 level, | ||
109 | void *context, | ||
110 | void **return_value); | ||
111 | |||
112 | |||
113 | acpi_status | ||
114 | acpi_ns_walk_namespace ( | ||
115 | acpi_object_type type, | ||
116 | acpi_handle start_object, | ||
117 | u32 max_depth, | ||
118 | u8 unlock_before_callback, | ||
119 | acpi_walk_callback user_function, | ||
120 | void *context, | ||
121 | void **return_value); | ||
122 | |||
123 | struct acpi_namespace_node * | ||
124 | acpi_ns_get_next_node ( | ||
125 | acpi_object_type type, | ||
126 | struct acpi_namespace_node *parent, | ||
127 | struct acpi_namespace_node *child); | ||
128 | |||
129 | void | ||
130 | acpi_ns_delete_namespace_by_owner ( | ||
131 | u16 table_id); | ||
132 | |||
133 | |||
134 | /* Namespace loading - nsload */ | ||
135 | |||
136 | acpi_status | ||
137 | acpi_ns_one_complete_parse ( | ||
138 | u32 pass_number, | ||
139 | struct acpi_table_desc *table_desc); | ||
140 | |||
141 | acpi_status | ||
142 | acpi_ns_parse_table ( | ||
143 | struct acpi_table_desc *table_desc, | ||
144 | struct acpi_namespace_node *scope); | ||
145 | |||
146 | acpi_status | ||
147 | acpi_ns_load_table ( | ||
148 | struct acpi_table_desc *table_desc, | ||
149 | struct acpi_namespace_node *node); | ||
150 | |||
151 | acpi_status | ||
152 | acpi_ns_load_table_by_type ( | ||
153 | acpi_table_type table_type); | ||
154 | |||
155 | |||
156 | /* | ||
157 | * Top-level namespace access - nsaccess | ||
158 | */ | ||
159 | |||
160 | acpi_status | ||
161 | acpi_ns_root_initialize ( | ||
162 | void); | ||
163 | |||
164 | acpi_status | ||
165 | acpi_ns_lookup ( | ||
166 | union acpi_generic_state *scope_info, | ||
167 | char *name, | ||
168 | acpi_object_type type, | ||
169 | acpi_interpreter_mode interpreter_mode, | ||
170 | u32 flags, | ||
171 | struct acpi_walk_state *walk_state, | ||
172 | struct acpi_namespace_node **ret_node); | ||
173 | |||
174 | |||
175 | /* | ||
176 | * Named object allocation/deallocation - nsalloc | ||
177 | */ | ||
178 | |||
179 | struct acpi_namespace_node * | ||
180 | acpi_ns_create_node ( | ||
181 | u32 name); | ||
182 | |||
183 | void | ||
184 | acpi_ns_delete_node ( | ||
185 | struct acpi_namespace_node *node); | ||
186 | |||
187 | void | ||
188 | acpi_ns_delete_namespace_subtree ( | ||
189 | struct acpi_namespace_node *parent_handle); | ||
190 | |||
191 | void | ||
192 | acpi_ns_detach_object ( | ||
193 | struct acpi_namespace_node *node); | ||
194 | |||
195 | void | ||
196 | acpi_ns_delete_children ( | ||
197 | struct acpi_namespace_node *parent); | ||
198 | |||
199 | int | ||
200 | acpi_ns_compare_names ( | ||
201 | char *name1, | ||
202 | char *name2); | ||
203 | |||
204 | void | ||
205 | acpi_ns_remove_reference ( | ||
206 | struct acpi_namespace_node *node); | ||
207 | |||
208 | |||
209 | /* | ||
210 | * Namespace modification - nsmodify | ||
211 | */ | ||
212 | |||
213 | #ifdef ACPI_FUTURE_USAGE | ||
214 | acpi_status | ||
215 | acpi_ns_unload_namespace ( | ||
216 | acpi_handle handle); | ||
217 | |||
218 | acpi_status | ||
219 | acpi_ns_delete_subtree ( | ||
220 | acpi_handle start_handle); | ||
221 | #endif | ||
222 | |||
223 | |||
224 | /* | ||
225 | * Namespace dump/print utilities - nsdump | ||
226 | */ | ||
227 | |||
228 | #ifdef ACPI_FUTURE_USAGE | ||
229 | void | ||
230 | acpi_ns_dump_tables ( | ||
231 | acpi_handle search_base, | ||
232 | u32 max_depth); | ||
233 | #endif | ||
234 | |||
235 | void | ||
236 | acpi_ns_dump_entry ( | ||
237 | acpi_handle handle, | ||
238 | u32 debug_level); | ||
239 | |||
240 | void | ||
241 | acpi_ns_dump_pathname ( | ||
242 | acpi_handle handle, | ||
243 | char *msg, | ||
244 | u32 level, | ||
245 | u32 component); | ||
246 | |||
247 | void | ||
248 | acpi_ns_print_pathname ( | ||
249 | u32 num_segments, | ||
250 | char *pathname); | ||
251 | |||
252 | #ifdef ACPI_FUTURE_USAGE | ||
253 | acpi_status | ||
254 | acpi_ns_dump_one_device ( | ||
255 | acpi_handle obj_handle, | ||
256 | u32 level, | ||
257 | void *context, | ||
258 | void **return_value); | ||
259 | |||
260 | void | ||
261 | acpi_ns_dump_root_devices ( | ||
262 | void); | ||
263 | #endif /* ACPI_FUTURE_USAGE */ | ||
264 | |||
265 | acpi_status | ||
266 | acpi_ns_dump_one_object ( | ||
267 | acpi_handle obj_handle, | ||
268 | u32 level, | ||
269 | void *context, | ||
270 | void **return_value); | ||
271 | |||
272 | #ifdef ACPI_FUTURE_USAGE | ||
273 | void | ||
274 | acpi_ns_dump_objects ( | ||
275 | acpi_object_type type, | ||
276 | u8 display_type, | ||
277 | u32 max_depth, | ||
278 | u32 ownder_id, | ||
279 | acpi_handle start_handle); | ||
280 | #endif | ||
281 | |||
282 | |||
283 | /* | ||
284 | * Namespace evaluation functions - nseval | ||
285 | */ | ||
286 | |||
287 | acpi_status | ||
288 | acpi_ns_evaluate_by_handle ( | ||
289 | struct acpi_parameter_info *info); | ||
290 | |||
291 | acpi_status | ||
292 | acpi_ns_evaluate_by_name ( | ||
293 | char *pathname, | ||
294 | struct acpi_parameter_info *info); | ||
295 | |||
296 | acpi_status | ||
297 | acpi_ns_evaluate_relative ( | ||
298 | char *pathname, | ||
299 | struct acpi_parameter_info *info); | ||
300 | |||
301 | acpi_status | ||
302 | acpi_ns_execute_control_method ( | ||
303 | struct acpi_parameter_info *info); | ||
304 | |||
305 | acpi_status | ||
306 | acpi_ns_get_object_value ( | ||
307 | struct acpi_parameter_info *info); | ||
308 | |||
309 | |||
310 | /* | ||
311 | * Parent/Child/Peer utility functions | ||
312 | */ | ||
313 | |||
314 | #ifdef ACPI_FUTURE_USAGE | ||
315 | acpi_name | ||
316 | acpi_ns_find_parent_name ( | ||
317 | struct acpi_namespace_node *node_to_search); | ||
318 | #endif | ||
319 | |||
320 | |||
321 | /* | ||
322 | * Name and Scope manipulation - nsnames | ||
323 | */ | ||
324 | |||
325 | u32 | ||
326 | acpi_ns_opens_scope ( | ||
327 | acpi_object_type type); | ||
328 | |||
329 | void | ||
330 | acpi_ns_build_external_path ( | ||
331 | struct acpi_namespace_node *node, | ||
332 | acpi_size size, | ||
333 | char *name_buffer); | ||
334 | |||
335 | char * | ||
336 | acpi_ns_get_external_pathname ( | ||
337 | struct acpi_namespace_node *node); | ||
338 | |||
339 | char * | ||
340 | acpi_ns_name_of_current_scope ( | ||
341 | struct acpi_walk_state *walk_state); | ||
342 | |||
343 | acpi_status | ||
344 | acpi_ns_handle_to_pathname ( | ||
345 | acpi_handle target_handle, | ||
346 | struct acpi_buffer *buffer); | ||
347 | |||
348 | u8 | ||
349 | acpi_ns_pattern_match ( | ||
350 | struct acpi_namespace_node *obj_node, | ||
351 | char *search_for); | ||
352 | |||
353 | acpi_status | ||
354 | acpi_ns_get_node_by_path ( | ||
355 | char *external_pathname, | ||
356 | struct acpi_namespace_node *in_prefix_node, | ||
357 | u32 flags, | ||
358 | struct acpi_namespace_node **out_node); | ||
359 | |||
360 | acpi_size | ||
361 | acpi_ns_get_pathname_length ( | ||
362 | struct acpi_namespace_node *node); | ||
363 | |||
364 | |||
365 | /* | ||
366 | * Object management for namespace nodes - nsobject | ||
367 | */ | ||
368 | |||
369 | acpi_status | ||
370 | acpi_ns_attach_object ( | ||
371 | struct acpi_namespace_node *node, | ||
372 | union acpi_operand_object *object, | ||
373 | acpi_object_type type); | ||
374 | |||
375 | union acpi_operand_object * | ||
376 | acpi_ns_get_attached_object ( | ||
377 | struct acpi_namespace_node *node); | ||
378 | |||
379 | union acpi_operand_object * | ||
380 | acpi_ns_get_secondary_object ( | ||
381 | union acpi_operand_object *obj_desc); | ||
382 | |||
383 | acpi_status | ||
384 | acpi_ns_attach_data ( | ||
385 | struct acpi_namespace_node *node, | ||
386 | acpi_object_handler handler, | ||
387 | void *data); | ||
388 | |||
389 | acpi_status | ||
390 | acpi_ns_detach_data ( | ||
391 | struct acpi_namespace_node *node, | ||
392 | acpi_object_handler handler); | ||
393 | |||
394 | acpi_status | ||
395 | acpi_ns_get_attached_data ( | ||
396 | struct acpi_namespace_node *node, | ||
397 | acpi_object_handler handler, | ||
398 | void **data); | ||
399 | |||
400 | |||
401 | /* | ||
402 | * Namespace searching and entry - nssearch | ||
403 | */ | ||
404 | |||
405 | acpi_status | ||
406 | acpi_ns_search_and_enter ( | ||
407 | u32 entry_name, | ||
408 | struct acpi_walk_state *walk_state, | ||
409 | struct acpi_namespace_node *node, | ||
410 | acpi_interpreter_mode interpreter_mode, | ||
411 | acpi_object_type type, | ||
412 | u32 flags, | ||
413 | struct acpi_namespace_node **ret_node); | ||
414 | |||
415 | acpi_status | ||
416 | acpi_ns_search_node ( | ||
417 | u32 entry_name, | ||
418 | struct acpi_namespace_node *node, | ||
419 | acpi_object_type type, | ||
420 | struct acpi_namespace_node **ret_node); | ||
421 | |||
422 | void | ||
423 | acpi_ns_install_node ( | ||
424 | struct acpi_walk_state *walk_state, | ||
425 | struct acpi_namespace_node *parent_node, | ||
426 | struct acpi_namespace_node *node, | ||
427 | acpi_object_type type); | ||
428 | |||
429 | |||
430 | /* | ||
431 | * Utility functions - nsutils | ||
432 | */ | ||
433 | |||
434 | u8 | ||
435 | acpi_ns_valid_root_prefix ( | ||
436 | char prefix); | ||
437 | |||
438 | u8 | ||
439 | acpi_ns_valid_path_separator ( | ||
440 | char sep); | ||
441 | |||
442 | acpi_object_type | ||
443 | acpi_ns_get_type ( | ||
444 | struct acpi_namespace_node *node); | ||
445 | |||
446 | u32 | ||
447 | acpi_ns_local ( | ||
448 | acpi_object_type type); | ||
449 | |||
450 | void | ||
451 | acpi_ns_report_error ( | ||
452 | char *module_name, | ||
453 | u32 line_number, | ||
454 | u32 component_id, | ||
455 | char *internal_name, | ||
456 | acpi_status lookup_status); | ||
457 | |||
458 | void | ||
459 | acpi_ns_report_method_error ( | ||
460 | char *module_name, | ||
461 | u32 line_number, | ||
462 | u32 component_id, | ||
463 | char *message, | ||
464 | struct acpi_namespace_node *node, | ||
465 | char *path, | ||
466 | acpi_status lookup_status); | ||
467 | |||
468 | void | ||
469 | acpi_ns_print_node_pathname ( | ||
470 | struct acpi_namespace_node *node, | ||
471 | char *msg); | ||
472 | |||
473 | acpi_status | ||
474 | acpi_ns_build_internal_name ( | ||
475 | struct acpi_namestring_info *info); | ||
476 | |||
477 | void | ||
478 | acpi_ns_get_internal_name_length ( | ||
479 | struct acpi_namestring_info *info); | ||
480 | |||
481 | acpi_status | ||
482 | acpi_ns_internalize_name ( | ||
483 | char *dotted_name, | ||
484 | char **converted_name); | ||
485 | |||
486 | acpi_status | ||
487 | acpi_ns_externalize_name ( | ||
488 | u32 internal_name_length, | ||
489 | char *internal_name, | ||
490 | u32 *converted_name_length, | ||
491 | char **converted_name); | ||
492 | |||
493 | struct acpi_namespace_node * | ||
494 | acpi_ns_map_handle_to_node ( | ||
495 | acpi_handle handle); | ||
496 | |||
497 | acpi_handle | ||
498 | acpi_ns_convert_entry_to_handle( | ||
499 | struct acpi_namespace_node *node); | ||
500 | |||
501 | void | ||
502 | acpi_ns_terminate ( | ||
503 | void); | ||
504 | |||
505 | struct acpi_namespace_node * | ||
506 | acpi_ns_get_parent_node ( | ||
507 | struct acpi_namespace_node *node); | ||
508 | |||
509 | |||
510 | struct acpi_namespace_node * | ||
511 | acpi_ns_get_next_valid_node ( | ||
512 | struct acpi_namespace_node *node); | ||
513 | |||
514 | |||
515 | #endif /* __ACNAMESP_H__ */ | ||
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h new file mode 100644 index 000000000000..036023a940b2 --- /dev/null +++ b/include/acpi/acobject.h | |||
@@ -0,0 +1,501 @@ | |||
1 | |||
2 | /****************************************************************************** | ||
3 | * | ||
4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #ifndef _ACOBJECT_H | ||
46 | #define _ACOBJECT_H | ||
47 | |||
48 | |||
49 | /* | ||
50 | * The union acpi_operand_object is used to pass AML operands from the dispatcher | ||
51 | * to the interpreter, and to keep track of the various handlers such as | ||
52 | * address space handlers and notify handlers. The object is a constant | ||
53 | * size in order to allow it to be cached and reused. | ||
54 | */ | ||
55 | |||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * Common Descriptors | ||
59 | * | ||
60 | ******************************************************************************/ | ||
61 | |||
62 | /* | ||
63 | * Common area for all objects. | ||
64 | * | ||
65 | * data_type is used to differentiate between internal descriptors, and MUST | ||
66 | * be the first byte in this structure. | ||
67 | */ | ||
68 | #define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ | ||
69 | u8 descriptor; /* To differentiate various internal objs */\ | ||
70 | u8 type; /* acpi_object_type */\ | ||
71 | u16 reference_count; /* For object deletion management */\ | ||
72 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ | ||
73 | u8 flags; \ | ||
74 | |||
75 | /* Values for flag byte above */ | ||
76 | |||
77 | #define AOPOBJ_AML_CONSTANT 0x01 | ||
78 | #define AOPOBJ_STATIC_POINTER 0x02 | ||
79 | #define AOPOBJ_DATA_VALID 0x04 | ||
80 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 | ||
81 | #define AOPOBJ_SETUP_COMPLETE 0x10 | ||
82 | #define AOPOBJ_SINGLE_DATUM 0x20 | ||
83 | |||
84 | |||
85 | /* | ||
86 | * Common bitfield for the field objects | ||
87 | * "Field Datum" -- a datum from the actual field object | ||
88 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
89 | */ | ||
90 | #define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ | ||
91 | u8 field_flags; /* Access, update, and lock bits */\ | ||
92 | u8 attribute; /* From access_as keyword */\ | ||
93 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
94 | u32 bit_length; /* Length of field in bits */\ | ||
95 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
96 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
97 | u8 access_bit_width; /* Read/Write size in bits (8-64) */\ | ||
98 | u32 value; /* Value to store into the Bank or Index register */\ | ||
99 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
100 | |||
101 | |||
102 | /* | ||
103 | * Fields common to both Strings and Buffers | ||
104 | */ | ||
105 | #define ACPI_COMMON_BUFFER_INFO \ | ||
106 | u32 length; | ||
107 | |||
108 | |||
109 | /* | ||
110 | * Common fields for objects that support ASL notifications | ||
111 | */ | ||
112 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
113 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
114 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
115 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
116 | |||
117 | |||
118 | /****************************************************************************** | ||
119 | * | ||
120 | * Basic data types | ||
121 | * | ||
122 | *****************************************************************************/ | ||
123 | |||
124 | struct acpi_object_common | ||
125 | { | ||
126 | ACPI_OBJECT_COMMON_HEADER | ||
127 | }; | ||
128 | |||
129 | |||
130 | struct acpi_object_integer | ||
131 | { | ||
132 | ACPI_OBJECT_COMMON_HEADER | ||
133 | acpi_integer value; | ||
134 | }; | ||
135 | |||
136 | /* | ||
137 | * Note: The String and Buffer object must be identical through the Pointer | ||
138 | * element. There is code that depends on this. | ||
139 | */ | ||
140 | struct acpi_object_string /* Null terminated, ASCII characters only */ | ||
141 | { | ||
142 | ACPI_OBJECT_COMMON_HEADER | ||
143 | ACPI_COMMON_BUFFER_INFO | ||
144 | char *pointer; /* String in AML stream or allocated string */ | ||
145 | }; | ||
146 | |||
147 | |||
148 | struct acpi_object_buffer | ||
149 | { | ||
150 | ACPI_OBJECT_COMMON_HEADER | ||
151 | ACPI_COMMON_BUFFER_INFO | ||
152 | u8 *pointer; /* Buffer in AML stream or allocated buffer */ | ||
153 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
154 | u8 *aml_start; | ||
155 | u32 aml_length; | ||
156 | }; | ||
157 | |||
158 | |||
159 | struct acpi_object_package | ||
160 | { | ||
161 | ACPI_OBJECT_COMMON_HEADER | ||
162 | |||
163 | u32 count; /* # of elements in package */ | ||
164 | u32 aml_length; | ||
165 | u8 *aml_start; | ||
166 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
167 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ | ||
168 | }; | ||
169 | |||
170 | |||
171 | /****************************************************************************** | ||
172 | * | ||
173 | * Complex data types | ||
174 | * | ||
175 | *****************************************************************************/ | ||
176 | |||
177 | struct acpi_object_event | ||
178 | { | ||
179 | ACPI_OBJECT_COMMON_HEADER | ||
180 | void *semaphore; | ||
181 | }; | ||
182 | |||
183 | |||
184 | #define ACPI_INFINITE_CONCURRENCY 0xFF | ||
185 | |||
186 | typedef | ||
187 | acpi_status (*ACPI_INTERNAL_METHOD) ( | ||
188 | struct acpi_walk_state *walk_state); | ||
189 | |||
190 | struct acpi_object_method | ||
191 | { | ||
192 | ACPI_OBJECT_COMMON_HEADER | ||
193 | u8 method_flags; | ||
194 | u8 param_count; | ||
195 | u32 aml_length; | ||
196 | void *semaphore; | ||
197 | u8 *aml_start; | ||
198 | ACPI_INTERNAL_METHOD implementation; | ||
199 | u8 concurrency; | ||
200 | u8 thread_count; | ||
201 | acpi_owner_id owning_id; | ||
202 | }; | ||
203 | |||
204 | |||
205 | struct acpi_object_mutex | ||
206 | { | ||
207 | ACPI_OBJECT_COMMON_HEADER | ||
208 | u8 sync_level; /* 0-15, specified in Mutex() call */ | ||
209 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ | ||
210 | struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ | ||
211 | void *semaphore; /* Actual OS synchronization object */ | ||
212 | union acpi_operand_object *prev; /* Link for list of acquired mutexes */ | ||
213 | union acpi_operand_object *next; /* Link for list of acquired mutexes */ | ||
214 | struct acpi_namespace_node *node; /* Containing namespace node */ | ||
215 | u8 original_sync_level; /* Owner's original sync level (0-15) */ | ||
216 | }; | ||
217 | |||
218 | |||
219 | struct acpi_object_region | ||
220 | { | ||
221 | ACPI_OBJECT_COMMON_HEADER | ||
222 | |||
223 | u8 space_id; | ||
224 | union acpi_operand_object *handler; /* Handler for region access */ | ||
225 | struct acpi_namespace_node *node; /* Containing namespace node */ | ||
226 | union acpi_operand_object *next; | ||
227 | u32 length; | ||
228 | acpi_physical_address address; | ||
229 | }; | ||
230 | |||
231 | |||
232 | /****************************************************************************** | ||
233 | * | ||
234 | * Objects that can be notified. All share a common notify_info area. | ||
235 | * | ||
236 | *****************************************************************************/ | ||
237 | |||
238 | struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ | ||
239 | { | ||
240 | ACPI_OBJECT_COMMON_HEADER | ||
241 | ACPI_COMMON_NOTIFY_INFO | ||
242 | }; | ||
243 | |||
244 | |||
245 | struct acpi_object_device | ||
246 | { | ||
247 | ACPI_OBJECT_COMMON_HEADER | ||
248 | ACPI_COMMON_NOTIFY_INFO | ||
249 | struct acpi_gpe_block_info *gpe_block; | ||
250 | }; | ||
251 | |||
252 | |||
253 | struct acpi_object_power_resource | ||
254 | { | ||
255 | ACPI_OBJECT_COMMON_HEADER | ||
256 | ACPI_COMMON_NOTIFY_INFO | ||
257 | u32 system_level; | ||
258 | u32 resource_order; | ||
259 | }; | ||
260 | |||
261 | |||
262 | struct acpi_object_processor | ||
263 | { | ||
264 | ACPI_OBJECT_COMMON_HEADER | ||
265 | ACPI_COMMON_NOTIFY_INFO | ||
266 | u32 proc_id; | ||
267 | u32 length; | ||
268 | acpi_io_address address; | ||
269 | }; | ||
270 | |||
271 | |||
272 | struct acpi_object_thermal_zone | ||
273 | { | ||
274 | ACPI_OBJECT_COMMON_HEADER | ||
275 | ACPI_COMMON_NOTIFY_INFO | ||
276 | }; | ||
277 | |||
278 | |||
279 | /****************************************************************************** | ||
280 | * | ||
281 | * Fields. All share a common header/info field. | ||
282 | * | ||
283 | *****************************************************************************/ | ||
284 | |||
285 | struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | ||
286 | { | ||
287 | ACPI_OBJECT_COMMON_HEADER | ||
288 | ACPI_COMMON_FIELD_INFO | ||
289 | union acpi_operand_object *region_obj; /* Containing Operation Region object */ | ||
290 | /* (REGION/BANK fields only) */ | ||
291 | }; | ||
292 | |||
293 | |||
294 | struct acpi_object_region_field | ||
295 | { | ||
296 | ACPI_OBJECT_COMMON_HEADER | ||
297 | ACPI_COMMON_FIELD_INFO | ||
298 | union acpi_operand_object *region_obj; /* Containing op_region object */ | ||
299 | }; | ||
300 | |||
301 | |||
302 | struct acpi_object_bank_field | ||
303 | { | ||
304 | ACPI_OBJECT_COMMON_HEADER | ||
305 | ACPI_COMMON_FIELD_INFO | ||
306 | union acpi_operand_object *region_obj; /* Containing op_region object */ | ||
307 | union acpi_operand_object *bank_obj; /* bank_select Register object */ | ||
308 | }; | ||
309 | |||
310 | |||
311 | struct acpi_object_index_field | ||
312 | { | ||
313 | ACPI_OBJECT_COMMON_HEADER | ||
314 | ACPI_COMMON_FIELD_INFO | ||
315 | |||
316 | /* | ||
317 | * No "region_obj" pointer needed since the Index and Data registers | ||
318 | * are each field definitions unto themselves. | ||
319 | */ | ||
320 | union acpi_operand_object *index_obj; /* Index register */ | ||
321 | union acpi_operand_object *data_obj; /* Data register */ | ||
322 | }; | ||
323 | |||
324 | |||
325 | /* The buffer_field is different in that it is part of a Buffer, not an op_region */ | ||
326 | |||
327 | struct acpi_object_buffer_field | ||
328 | { | ||
329 | ACPI_OBJECT_COMMON_HEADER | ||
330 | ACPI_COMMON_FIELD_INFO | ||
331 | union acpi_operand_object *buffer_obj; /* Containing Buffer object */ | ||
332 | }; | ||
333 | |||
334 | |||
335 | /****************************************************************************** | ||
336 | * | ||
337 | * Objects for handlers | ||
338 | * | ||
339 | *****************************************************************************/ | ||
340 | |||
341 | struct acpi_object_notify_handler | ||
342 | { | ||
343 | ACPI_OBJECT_COMMON_HEADER | ||
344 | struct acpi_namespace_node *node; /* Parent device */ | ||
345 | acpi_notify_handler handler; | ||
346 | void *context; | ||
347 | }; | ||
348 | |||
349 | |||
350 | /* Flags for address handler */ | ||
351 | |||
352 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 | ||
353 | |||
354 | |||
355 | struct acpi_object_addr_handler | ||
356 | { | ||
357 | ACPI_OBJECT_COMMON_HEADER | ||
358 | u8 space_id; | ||
359 | u16 hflags; | ||
360 | acpi_adr_space_handler handler; | ||
361 | struct acpi_namespace_node *node; /* Parent device */ | ||
362 | void *context; | ||
363 | acpi_adr_space_setup setup; | ||
364 | union acpi_operand_object *region_list; /* regions using this handler */ | ||
365 | union acpi_operand_object *next; | ||
366 | }; | ||
367 | |||
368 | |||
369 | /****************************************************************************** | ||
370 | * | ||
371 | * Special internal objects | ||
372 | * | ||
373 | *****************************************************************************/ | ||
374 | |||
375 | /* | ||
376 | * The Reference object type is used for these opcodes: | ||
377 | * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op | ||
378 | */ | ||
379 | struct acpi_object_reference | ||
380 | { | ||
381 | ACPI_OBJECT_COMMON_HEADER | ||
382 | u8 target_type; /* Used for index_op */ | ||
383 | u16 opcode; | ||
384 | u32 offset; /* Used for arg_op, local_op, and index_op */ | ||
385 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ | ||
386 | struct acpi_namespace_node *node; | ||
387 | union acpi_operand_object **where; | ||
388 | }; | ||
389 | |||
390 | |||
391 | /* | ||
392 | * Extra object is used as additional storage for types that | ||
393 | * have AML code in their declarations (term_args) that must be | ||
394 | * evaluated at run time. | ||
395 | * | ||
396 | * Currently: Region and field_unit types | ||
397 | */ | ||
398 | struct acpi_object_extra | ||
399 | { | ||
400 | ACPI_OBJECT_COMMON_HEADER | ||
401 | u8 byte_fill1; | ||
402 | u16 word_fill1; | ||
403 | u32 aml_length; | ||
404 | u8 *aml_start; | ||
405 | struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ | ||
406 | void *region_context; /* Region-specific data */ | ||
407 | }; | ||
408 | |||
409 | |||
410 | /* Additional data that can be attached to namespace nodes */ | ||
411 | |||
412 | struct acpi_object_data | ||
413 | { | ||
414 | ACPI_OBJECT_COMMON_HEADER | ||
415 | acpi_object_handler handler; | ||
416 | void *pointer; | ||
417 | }; | ||
418 | |||
419 | |||
420 | /* Structure used when objects are cached for reuse */ | ||
421 | |||
422 | struct acpi_object_cache_list | ||
423 | { | ||
424 | ACPI_OBJECT_COMMON_HEADER | ||
425 | union acpi_operand_object *next; /* Link for object cache and internal lists*/ | ||
426 | }; | ||
427 | |||
428 | |||
429 | /****************************************************************************** | ||
430 | * | ||
431 | * union acpi_operand_object Descriptor - a giant union of all of the above | ||
432 | * | ||
433 | *****************************************************************************/ | ||
434 | |||
435 | union acpi_operand_object | ||
436 | { | ||
437 | struct acpi_object_common common; | ||
438 | struct acpi_object_integer integer; | ||
439 | struct acpi_object_string string; | ||
440 | struct acpi_object_buffer buffer; | ||
441 | struct acpi_object_package package; | ||
442 | struct acpi_object_event event; | ||
443 | struct acpi_object_method method; | ||
444 | struct acpi_object_mutex mutex; | ||
445 | struct acpi_object_region region; | ||
446 | struct acpi_object_notify_common common_notify; | ||
447 | struct acpi_object_device device; | ||
448 | struct acpi_object_power_resource power_resource; | ||
449 | struct acpi_object_processor processor; | ||
450 | struct acpi_object_thermal_zone thermal_zone; | ||
451 | struct acpi_object_field_common common_field; | ||
452 | struct acpi_object_region_field field; | ||
453 | struct acpi_object_buffer_field buffer_field; | ||
454 | struct acpi_object_bank_field bank_field; | ||
455 | struct acpi_object_index_field index_field; | ||
456 | struct acpi_object_notify_handler notify; | ||
457 | struct acpi_object_addr_handler address_space; | ||
458 | struct acpi_object_reference reference; | ||
459 | struct acpi_object_extra extra; | ||
460 | struct acpi_object_data data; | ||
461 | struct acpi_object_cache_list cache; | ||
462 | }; | ||
463 | |||
464 | |||
465 | /****************************************************************************** | ||
466 | * | ||
467 | * union acpi_descriptor - objects that share a common descriptor identifier | ||
468 | * | ||
469 | *****************************************************************************/ | ||
470 | |||
471 | |||
472 | /* Object descriptor types */ | ||
473 | |||
474 | #define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ | ||
475 | #define ACPI_DESC_TYPE_STATE 0x02 | ||
476 | #define ACPI_DESC_TYPE_STATE_UPDATE 0x03 | ||
477 | #define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 | ||
478 | #define ACPI_DESC_TYPE_STATE_CONTROL 0x05 | ||
479 | #define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06 | ||
480 | #define ACPI_DESC_TYPE_STATE_PSCOPE 0x07 | ||
481 | #define ACPI_DESC_TYPE_STATE_WSCOPE 0x08 | ||
482 | #define ACPI_DESC_TYPE_STATE_RESULT 0x09 | ||
483 | #define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A | ||
484 | #define ACPI_DESC_TYPE_STATE_THREAD 0x0B | ||
485 | #define ACPI_DESC_TYPE_WALK 0x0C | ||
486 | #define ACPI_DESC_TYPE_PARSER 0x0D | ||
487 | #define ACPI_DESC_TYPE_OPERAND 0x0E | ||
488 | #define ACPI_DESC_TYPE_NAMED 0x0F | ||
489 | #define ACPI_DESC_TYPE_MAX 0x0F | ||
490 | |||
491 | |||
492 | union acpi_descriptor | ||
493 | { | ||
494 | u8 descriptor_id; /* To differentiate various internal objs */\ | ||
495 | union acpi_operand_object object; | ||
496 | struct acpi_namespace_node node; | ||
497 | union acpi_parse_object op; | ||
498 | }; | ||
499 | |||
500 | |||
501 | #endif /* _ACOBJECT_H */ | ||
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h new file mode 100644 index 000000000000..2fbe180fee6b --- /dev/null +++ b/include/acpi/acoutput.h | |||
@@ -0,0 +1,185 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acoutput.h -- debug output | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACOUTPUT_H__ | ||
45 | #define __ACOUTPUT_H__ | ||
46 | |||
47 | /* | ||
48 | * Debug levels and component IDs. These are used to control the | ||
49 | * granularity of the output of the DEBUG_PRINT macro -- on a per- | ||
50 | * component basis and a per-exception-type basis. | ||
51 | */ | ||
52 | |||
53 | /* Component IDs are used in the global "debug_layer" */ | ||
54 | |||
55 | #define ACPI_UTILITIES 0x00000001 | ||
56 | #define ACPI_HARDWARE 0x00000002 | ||
57 | #define ACPI_EVENTS 0x00000004 | ||
58 | #define ACPI_TABLES 0x00000008 | ||
59 | #define ACPI_NAMESPACE 0x00000010 | ||
60 | #define ACPI_PARSER 0x00000020 | ||
61 | #define ACPI_DISPATCHER 0x00000040 | ||
62 | #define ACPI_EXECUTER 0x00000080 | ||
63 | #define ACPI_RESOURCES 0x00000100 | ||
64 | #define ACPI_CA_DEBUGGER 0x00000200 | ||
65 | #define ACPI_OS_SERVICES 0x00000400 | ||
66 | #define ACPI_CA_DISASSEMBLER 0x00000800 | ||
67 | |||
68 | /* Component IDs for ACPI tools and utilities */ | ||
69 | |||
70 | #define ACPI_COMPILER 0x00001000 | ||
71 | #define ACPI_TOOLS 0x00002000 | ||
72 | |||
73 | #define ACPI_ALL_COMPONENTS 0x00003FFF | ||
74 | #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) | ||
75 | |||
76 | |||
77 | /* Component IDs reserved for ACPI drivers */ | ||
78 | |||
79 | #define ACPI_ALL_DRIVERS 0xFFFF0000 | ||
80 | |||
81 | |||
82 | /* | ||
83 | * Raw debug output levels, do not use these in the DEBUG_PRINT macros | ||
84 | */ | ||
85 | #define ACPI_LV_ERROR 0x00000001 | ||
86 | #define ACPI_LV_WARN 0x00000002 | ||
87 | #define ACPI_LV_INIT 0x00000004 | ||
88 | #define ACPI_LV_DEBUG_OBJECT 0x00000008 | ||
89 | #define ACPI_LV_INFO 0x00000010 | ||
90 | #define ACPI_LV_ALL_EXCEPTIONS 0x0000001F | ||
91 | |||
92 | /* Trace verbosity level 1 [Standard Trace Level] */ | ||
93 | |||
94 | #define ACPI_LV_INIT_NAMES 0x00000020 | ||
95 | #define ACPI_LV_PARSE 0x00000040 | ||
96 | #define ACPI_LV_LOAD 0x00000080 | ||
97 | #define ACPI_LV_DISPATCH 0x00000100 | ||
98 | #define ACPI_LV_EXEC 0x00000200 | ||
99 | #define ACPI_LV_NAMES 0x00000400 | ||
100 | #define ACPI_LV_OPREGION 0x00000800 | ||
101 | #define ACPI_LV_BFIELD 0x00001000 | ||
102 | #define ACPI_LV_TABLES 0x00002000 | ||
103 | #define ACPI_LV_VALUES 0x00004000 | ||
104 | #define ACPI_LV_OBJECTS 0x00008000 | ||
105 | #define ACPI_LV_RESOURCES 0x00010000 | ||
106 | #define ACPI_LV_USER_REQUESTS 0x00020000 | ||
107 | #define ACPI_LV_PACKAGE 0x00040000 | ||
108 | #define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS | ||
109 | |||
110 | /* Trace verbosity level 2 [Function tracing and memory allocation] */ | ||
111 | |||
112 | #define ACPI_LV_ALLOCATIONS 0x00100000 | ||
113 | #define ACPI_LV_FUNCTIONS 0x00200000 | ||
114 | #define ACPI_LV_OPTIMIZATIONS 0x00400000 | ||
115 | #define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 | ||
116 | #define ACPI_LV_ALL ACPI_LV_VERBOSITY2 | ||
117 | |||
118 | /* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ | ||
119 | |||
120 | #define ACPI_LV_MUTEX 0x01000000 | ||
121 | #define ACPI_LV_THREADS 0x02000000 | ||
122 | #define ACPI_LV_IO 0x04000000 | ||
123 | #define ACPI_LV_INTERRUPTS 0x08000000 | ||
124 | #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 | ||
125 | |||
126 | /* Exceptionally verbose output -- also used in the global "debug_level" */ | ||
127 | |||
128 | #define ACPI_LV_AML_DISASSEMBLE 0x10000000 | ||
129 | #define ACPI_LV_VERBOSE_INFO 0x20000000 | ||
130 | #define ACPI_LV_FULL_TABLES 0x40000000 | ||
131 | #define ACPI_LV_EVENTS 0x80000000 | ||
132 | |||
133 | #define ACPI_LV_VERBOSE 0xF0000000 | ||
134 | |||
135 | |||
136 | /* | ||
137 | * Debug level macros that are used in the DEBUG_PRINT macros | ||
138 | */ | ||
139 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_debug_info | ||
140 | |||
141 | /* Exception level -- used in the global "debug_level" */ | ||
142 | |||
143 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) | ||
144 | #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) | ||
145 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) | ||
146 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) | ||
147 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) | ||
148 | #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) | ||
149 | |||
150 | |||
151 | /* Trace level -- also used in the global "debug_level" */ | ||
152 | |||
153 | #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) | ||
154 | #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) | ||
155 | #define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) | ||
156 | #define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) | ||
157 | #define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) | ||
158 | #define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) | ||
159 | #define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) | ||
160 | #define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) | ||
161 | #define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) | ||
162 | #define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) | ||
163 | #define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) | ||
164 | #define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) | ||
165 | #define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) | ||
166 | #define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) | ||
167 | #define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) | ||
168 | #define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) | ||
169 | #define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) | ||
170 | #define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) | ||
171 | #define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) | ||
172 | #define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) | ||
173 | #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) | ||
174 | |||
175 | #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) | ||
176 | |||
177 | |||
178 | /* Defaults for debug_level, debug and normal */ | ||
179 | |||
180 | #define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) | ||
181 | #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) | ||
182 | #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) | ||
183 | |||
184 | |||
185 | #endif /* __ACOUTPUT_H__ */ | ||
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h new file mode 100644 index 000000000000..c0395ef2b0d0 --- /dev/null +++ b/include/acpi/acparser.h | |||
@@ -0,0 +1,351 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: acparser.h - AML Parser subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 | |||
45 | #ifndef __ACPARSER_H__ | ||
46 | #define __ACPARSER_H__ | ||
47 | |||
48 | |||
49 | #define OP_HAS_RETURN_VALUE 1 | ||
50 | |||
51 | /* variable # arguments */ | ||
52 | |||
53 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX | ||
54 | |||
55 | |||
56 | #define ACPI_PARSE_DELETE_TREE 0x0001 | ||
57 | #define ACPI_PARSE_NO_TREE_DELETE 0x0000 | ||
58 | #define ACPI_PARSE_TREE_MASK 0x0001 | ||
59 | |||
60 | #define ACPI_PARSE_LOAD_PASS1 0x0010 | ||
61 | #define ACPI_PARSE_LOAD_PASS2 0x0020 | ||
62 | #define ACPI_PARSE_EXECUTE 0x0030 | ||
63 | #define ACPI_PARSE_MODE_MASK 0x0030 | ||
64 | |||
65 | #define ACPI_PARSE_DEFERRED_OP 0x0100 | ||
66 | |||
67 | /* Parser external interfaces */ | ||
68 | |||
69 | acpi_status | ||
70 | acpi_psx_load_table ( | ||
71 | u8 *pcode_addr, | ||
72 | u32 pcode_length); | ||
73 | |||
74 | acpi_status | ||
75 | acpi_psx_execute ( | ||
76 | struct acpi_parameter_info *info); | ||
77 | |||
78 | |||
79 | /****************************************************************************** | ||
80 | * | ||
81 | * Parser interfaces | ||
82 | * | ||
83 | *****************************************************************************/ | ||
84 | |||
85 | |||
86 | /* psargs - Parse AML opcode arguments */ | ||
87 | |||
88 | u8 * | ||
89 | acpi_ps_get_next_package_end ( | ||
90 | struct acpi_parse_state *parser_state); | ||
91 | |||
92 | u32 | ||
93 | acpi_ps_get_next_package_length ( | ||
94 | struct acpi_parse_state *parser_state); | ||
95 | |||
96 | char * | ||
97 | acpi_ps_get_next_namestring ( | ||
98 | struct acpi_parse_state *parser_state); | ||
99 | |||
100 | void | ||
101 | acpi_ps_get_next_simple_arg ( | ||
102 | struct acpi_parse_state *parser_state, | ||
103 | u32 arg_type, | ||
104 | union acpi_parse_object *arg); | ||
105 | |||
106 | acpi_status | ||
107 | acpi_ps_get_next_namepath ( | ||
108 | struct acpi_walk_state *walk_state, | ||
109 | struct acpi_parse_state *parser_state, | ||
110 | union acpi_parse_object *arg, | ||
111 | u8 method_call); | ||
112 | |||
113 | union acpi_parse_object * | ||
114 | acpi_ps_get_next_field ( | ||
115 | struct acpi_parse_state *parser_state); | ||
116 | |||
117 | acpi_status | ||
118 | acpi_ps_get_next_arg ( | ||
119 | struct acpi_walk_state *walk_state, | ||
120 | struct acpi_parse_state *parser_state, | ||
121 | u32 arg_type, | ||
122 | union acpi_parse_object **return_arg); | ||
123 | |||
124 | |||
125 | /* psfind */ | ||
126 | |||
127 | union acpi_parse_object * | ||
128 | acpi_ps_find_name ( | ||
129 | union acpi_parse_object *scope, | ||
130 | u32 name, | ||
131 | u32 opcode); | ||
132 | |||
133 | union acpi_parse_object* | ||
134 | acpi_ps_get_parent ( | ||
135 | union acpi_parse_object *op); | ||
136 | |||
137 | |||
138 | /* psopcode - AML Opcode information */ | ||
139 | |||
140 | const struct acpi_opcode_info * | ||
141 | acpi_ps_get_opcode_info ( | ||
142 | u16 opcode); | ||
143 | |||
144 | char * | ||
145 | acpi_ps_get_opcode_name ( | ||
146 | u16 opcode); | ||
147 | |||
148 | |||
149 | /* psparse - top level parsing routines */ | ||
150 | |||
151 | u32 | ||
152 | acpi_ps_get_opcode_size ( | ||
153 | u32 opcode); | ||
154 | |||
155 | void | ||
156 | acpi_ps_complete_this_op ( | ||
157 | struct acpi_walk_state *walk_state, | ||
158 | union acpi_parse_object *op); | ||
159 | |||
160 | acpi_status | ||
161 | acpi_ps_next_parse_state ( | ||
162 | struct acpi_walk_state *walk_state, | ||
163 | union acpi_parse_object *op, | ||
164 | acpi_status callback_status); | ||
165 | |||
166 | acpi_status | ||
167 | acpi_ps_find_object ( | ||
168 | struct acpi_walk_state *walk_state, | ||
169 | union acpi_parse_object **out_op); | ||
170 | |||
171 | void | ||
172 | acpi_ps_delete_parse_tree ( | ||
173 | union acpi_parse_object *root); | ||
174 | |||
175 | acpi_status | ||
176 | acpi_ps_parse_loop ( | ||
177 | struct acpi_walk_state *walk_state); | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ps_parse_aml ( | ||
181 | struct acpi_walk_state *walk_state); | ||
182 | |||
183 | acpi_status | ||
184 | acpi_ps_parse_table ( | ||
185 | u8 *aml, | ||
186 | u32 aml_size, | ||
187 | acpi_parse_downwards descending_callback, | ||
188 | acpi_parse_upwards ascending_callback, | ||
189 | union acpi_parse_object **root_object); | ||
190 | |||
191 | u16 | ||
192 | acpi_ps_peek_opcode ( | ||
193 | struct acpi_parse_state *state); | ||
194 | |||
195 | |||
196 | /* psscope - Scope stack management routines */ | ||
197 | |||
198 | |||
199 | acpi_status | ||
200 | acpi_ps_init_scope ( | ||
201 | struct acpi_parse_state *parser_state, | ||
202 | union acpi_parse_object *root); | ||
203 | |||
204 | union acpi_parse_object * | ||
205 | acpi_ps_get_parent_scope ( | ||
206 | struct acpi_parse_state *state); | ||
207 | |||
208 | u8 | ||
209 | acpi_ps_has_completed_scope ( | ||
210 | struct acpi_parse_state *parser_state); | ||
211 | |||
212 | void | ||
213 | acpi_ps_pop_scope ( | ||
214 | struct acpi_parse_state *parser_state, | ||
215 | union acpi_parse_object **op, | ||
216 | u32 *arg_list, | ||
217 | u32 *arg_count); | ||
218 | |||
219 | acpi_status | ||
220 | acpi_ps_push_scope ( | ||
221 | struct acpi_parse_state *parser_state, | ||
222 | union acpi_parse_object *op, | ||
223 | u32 remaining_args, | ||
224 | u32 arg_count); | ||
225 | |||
226 | void | ||
227 | acpi_ps_cleanup_scope ( | ||
228 | struct acpi_parse_state *state); | ||
229 | |||
230 | |||
231 | /* pstree - parse tree manipulation routines */ | ||
232 | |||
233 | void | ||
234 | acpi_ps_append_arg( | ||
235 | union acpi_parse_object *op, | ||
236 | union acpi_parse_object *arg); | ||
237 | |||
238 | union acpi_parse_object* | ||
239 | acpi_ps_find ( | ||
240 | union acpi_parse_object *scope, | ||
241 | char *path, | ||
242 | u16 opcode, | ||
243 | u32 create); | ||
244 | |||
245 | union acpi_parse_object * | ||
246 | acpi_ps_get_arg( | ||
247 | union acpi_parse_object *op, | ||
248 | u32 argn); | ||
249 | |||
250 | #ifdef ACPI_FUTURE_USAGE | ||
251 | union acpi_parse_object * | ||
252 | acpi_ps_get_child ( | ||
253 | union acpi_parse_object *op); | ||
254 | |||
255 | union acpi_parse_object * | ||
256 | acpi_ps_get_depth_next ( | ||
257 | union acpi_parse_object *origin, | ||
258 | union acpi_parse_object *op); | ||
259 | #endif /* ACPI_FUTURE_USAGE */ | ||
260 | |||
261 | |||
262 | /* pswalk - parse tree walk routines */ | ||
263 | |||
264 | acpi_status | ||
265 | acpi_ps_walk_parsed_aml ( | ||
266 | union acpi_parse_object *start_op, | ||
267 | union acpi_parse_object *end_op, | ||
268 | union acpi_operand_object *mth_desc, | ||
269 | struct acpi_namespace_node *start_node, | ||
270 | union acpi_operand_object **params, | ||
271 | union acpi_operand_object **caller_return_desc, | ||
272 | acpi_owner_id owner_id, | ||
273 | acpi_parse_downwards descending_callback, | ||
274 | acpi_parse_upwards ascending_callback); | ||
275 | |||
276 | acpi_status | ||
277 | acpi_ps_get_next_walk_op ( | ||
278 | struct acpi_walk_state *walk_state, | ||
279 | union acpi_parse_object *op, | ||
280 | acpi_parse_upwards ascending_callback); | ||
281 | |||
282 | acpi_status | ||
283 | acpi_ps_delete_completed_op ( | ||
284 | struct acpi_walk_state *walk_state); | ||
285 | |||
286 | |||
287 | /* psutils - parser utilities */ | ||
288 | |||
289 | union acpi_parse_object * | ||
290 | acpi_ps_create_scope_op ( | ||
291 | void); | ||
292 | |||
293 | void | ||
294 | acpi_ps_init_op ( | ||
295 | union acpi_parse_object *op, | ||
296 | u16 opcode); | ||
297 | |||
298 | union acpi_parse_object * | ||
299 | acpi_ps_alloc_op ( | ||
300 | u16 opcode); | ||
301 | |||
302 | void | ||
303 | acpi_ps_free_op ( | ||
304 | union acpi_parse_object *op); | ||
305 | |||
306 | #ifdef ACPI_ENABLE_OBJECT_CACHE | ||
307 | void | ||
308 | acpi_ps_delete_parse_cache ( | ||
309 | void); | ||
310 | #endif | ||
311 | |||
312 | u8 | ||
313 | acpi_ps_is_leading_char ( | ||
314 | u32 c); | ||
315 | |||
316 | u8 | ||
317 | acpi_ps_is_prefix_char ( | ||
318 | u32 c); | ||
319 | |||
320 | #ifdef ACPI_FUTURE_USAGE | ||
321 | u32 | ||
322 | acpi_ps_get_name( | ||
323 | union acpi_parse_object *op); | ||
324 | #endif | ||
325 | |||
326 | void | ||
327 | acpi_ps_set_name( | ||
328 | union acpi_parse_object *op, | ||
329 | u32 name); | ||
330 | |||
331 | |||
332 | /* psdump - display parser tree */ | ||
333 | |||
334 | u32 | ||
335 | acpi_ps_sprint_path ( | ||
336 | char *buffer_start, | ||
337 | u32 buffer_size, | ||
338 | union acpi_parse_object *op); | ||
339 | |||
340 | u32 | ||
341 | acpi_ps_sprint_op ( | ||
342 | char *buffer_start, | ||
343 | u32 buffer_size, | ||
344 | union acpi_parse_object *op); | ||
345 | |||
346 | void | ||
347 | acpi_ps_show ( | ||
348 | union acpi_parse_object *op); | ||
349 | |||
350 | |||
351 | #endif /* __ACPARSER_H__ */ | ||
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h new file mode 100644 index 000000000000..ad53252dd42d --- /dev/null +++ b/include/acpi/acpi.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acpi.h - Master include file, Publics and external data. | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACPI_H__ | ||
45 | #define __ACPI_H__ | ||
46 | |||
47 | /* | ||
48 | * Common includes for all ACPI driver files | ||
49 | * We put them here because we don't want to duplicate them | ||
50 | * in the rest of the source code again and again. | ||
51 | */ | ||
52 | #include "acconfig.h" /* Configuration constants */ | ||
53 | #include "platform/acenv.h" /* Target environment specific items */ | ||
54 | #include "actypes.h" /* Fundamental common data types */ | ||
55 | #include "acexcep.h" /* ACPI exception codes */ | ||
56 | #include "acmacros.h" /* C macros */ | ||
57 | #include "actbl.h" /* ACPI table definitions */ | ||
58 | #include "aclocal.h" /* Internal data types */ | ||
59 | #include "acoutput.h" /* Error output and Debug macros */ | ||
60 | #include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer*/ | ||
61 | #include "acpixf.h" /* ACPI core subsystem external interfaces */ | ||
62 | #include "acobject.h" /* ACPI internal object */ | ||
63 | #include "acstruct.h" /* Common structures */ | ||
64 | #include "acglobal.h" /* All global variables */ | ||
65 | #include "achware.h" /* Hardware defines and interfaces */ | ||
66 | #include "acutils.h" /* Utility interfaces */ | ||
67 | |||
68 | |||
69 | #endif /* __ACPI_H__ */ | ||
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h new file mode 100644 index 000000000000..c627bc408a6b --- /dev/null +++ b/include/acpi/acpi_bus.h | |||
@@ -0,0 +1,341 @@ | |||
1 | /* | ||
2 | * acpi_bus.h - ACPI Bus Driver ($Revision: 22 $) | ||
3 | * | ||
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | ||
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
6 | * | ||
7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or (at | ||
12 | * your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
22 | * | ||
23 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
24 | */ | ||
25 | |||
26 | #ifndef __ACPI_BUS_H__ | ||
27 | #define __ACPI_BUS_H__ | ||
28 | |||
29 | #include <linux/kobject.h> | ||
30 | |||
31 | #include <acpi/acpi.h> | ||
32 | |||
33 | #define PREFIX "ACPI: " | ||
34 | |||
35 | /* TBD: Make dynamic */ | ||
36 | #define ACPI_MAX_HANDLES 10 | ||
37 | struct acpi_handle_list { | ||
38 | u32 count; | ||
39 | acpi_handle handles[ACPI_MAX_HANDLES]; | ||
40 | }; | ||
41 | |||
42 | |||
43 | /* acpi_utils.h */ | ||
44 | acpi_status | ||
45 | acpi_extract_package ( | ||
46 | union acpi_object *package, | ||
47 | struct acpi_buffer *format, | ||
48 | struct acpi_buffer *buffer); | ||
49 | acpi_status | ||
50 | acpi_evaluate_integer ( | ||
51 | acpi_handle handle, | ||
52 | acpi_string pathname, | ||
53 | struct acpi_object_list *arguments, | ||
54 | unsigned long *data); | ||
55 | acpi_status | ||
56 | acpi_evaluate_reference ( | ||
57 | acpi_handle handle, | ||
58 | acpi_string pathname, | ||
59 | struct acpi_object_list *arguments, | ||
60 | struct acpi_handle_list *list); | ||
61 | |||
62 | |||
63 | #ifdef CONFIG_ACPI_BUS | ||
64 | |||
65 | #include <linux/proc_fs.h> | ||
66 | |||
67 | #define ACPI_BUS_FILE_ROOT "acpi" | ||
68 | extern struct proc_dir_entry *acpi_root_dir; | ||
69 | extern FADT_DESCRIPTOR acpi_fadt; | ||
70 | |||
71 | enum acpi_bus_removal_type { | ||
72 | ACPI_BUS_REMOVAL_NORMAL = 0, | ||
73 | ACPI_BUS_REMOVAL_EJECT, | ||
74 | ACPI_BUS_REMOVAL_SUPRISE, | ||
75 | ACPI_BUS_REMOVAL_TYPE_COUNT | ||
76 | }; | ||
77 | |||
78 | enum acpi_bus_device_type { | ||
79 | ACPI_BUS_TYPE_DEVICE = 0, | ||
80 | ACPI_BUS_TYPE_POWER, | ||
81 | ACPI_BUS_TYPE_PROCESSOR, | ||
82 | ACPI_BUS_TYPE_THERMAL, | ||
83 | ACPI_BUS_TYPE_SYSTEM, | ||
84 | ACPI_BUS_TYPE_POWER_BUTTON, | ||
85 | ACPI_BUS_TYPE_SLEEP_BUTTON, | ||
86 | ACPI_BUS_DEVICE_TYPE_COUNT | ||
87 | }; | ||
88 | |||
89 | struct acpi_driver; | ||
90 | struct acpi_device; | ||
91 | |||
92 | |||
93 | /* | ||
94 | * ACPI Driver | ||
95 | * ----------- | ||
96 | */ | ||
97 | |||
98 | typedef int (*acpi_op_add) (struct acpi_device *device); | ||
99 | typedef int (*acpi_op_remove) (struct acpi_device *device, int type); | ||
100 | typedef int (*acpi_op_lock) (struct acpi_device *device, int type); | ||
101 | typedef int (*acpi_op_start) (struct acpi_device *device); | ||
102 | typedef int (*acpi_op_stop) (struct acpi_device *device, int type); | ||
103 | typedef int (*acpi_op_suspend) (struct acpi_device *device, int state); | ||
104 | typedef int (*acpi_op_resume) (struct acpi_device *device, int state); | ||
105 | typedef int (*acpi_op_scan) (struct acpi_device *device); | ||
106 | typedef int (*acpi_op_bind) (struct acpi_device *device); | ||
107 | typedef int (*acpi_op_unbind) (struct acpi_device *device); | ||
108 | typedef int (*acpi_op_match) (struct acpi_device *device, | ||
109 | struct acpi_driver *driver); | ||
110 | |||
111 | struct acpi_device_ops { | ||
112 | acpi_op_add add; | ||
113 | acpi_op_remove remove; | ||
114 | acpi_op_lock lock; | ||
115 | acpi_op_start start; | ||
116 | acpi_op_stop stop; | ||
117 | acpi_op_suspend suspend; | ||
118 | acpi_op_resume resume; | ||
119 | acpi_op_scan scan; | ||
120 | acpi_op_bind bind; | ||
121 | acpi_op_unbind unbind; | ||
122 | acpi_op_match match; | ||
123 | }; | ||
124 | |||
125 | struct acpi_driver { | ||
126 | struct list_head node; | ||
127 | char name[80]; | ||
128 | char class[80]; | ||
129 | atomic_t references; | ||
130 | char *ids; /* Supported Hardware IDs */ | ||
131 | struct acpi_device_ops ops; | ||
132 | }; | ||
133 | |||
134 | /* | ||
135 | * ACPI Device | ||
136 | * ----------- | ||
137 | */ | ||
138 | |||
139 | /* Status (_STA) */ | ||
140 | |||
141 | struct acpi_device_status { | ||
142 | u32 present:1; | ||
143 | u32 enabled:1; | ||
144 | u32 show_in_ui:1; | ||
145 | u32 functional:1; | ||
146 | u32 battery_present:1; | ||
147 | u32 reserved:27; | ||
148 | }; | ||
149 | |||
150 | |||
151 | /* Flags */ | ||
152 | |||
153 | struct acpi_device_flags { | ||
154 | u32 dynamic_status:1; | ||
155 | u32 hardware_id:1; | ||
156 | u32 compatible_ids:1; | ||
157 | u32 bus_address:1; | ||
158 | u32 unique_id:1; | ||
159 | u32 removable:1; | ||
160 | u32 ejectable:1; | ||
161 | u32 lockable:1; | ||
162 | u32 suprise_removal_ok:1; | ||
163 | u32 power_manageable:1; | ||
164 | u32 performance_manageable:1; | ||
165 | u32 wake_capable:1; /* Wakeup(_PRW) supported? */ | ||
166 | u32 reserved:20; | ||
167 | }; | ||
168 | |||
169 | |||
170 | /* File System */ | ||
171 | |||
172 | struct acpi_device_dir { | ||
173 | struct proc_dir_entry *entry; | ||
174 | }; | ||
175 | |||
176 | #define acpi_device_dir(d) ((d)->dir.entry) | ||
177 | |||
178 | |||
179 | /* Plug and Play */ | ||
180 | |||
181 | typedef char acpi_bus_id[5]; | ||
182 | typedef unsigned long acpi_bus_address; | ||
183 | typedef char acpi_hardware_id[9]; | ||
184 | typedef char acpi_unique_id[9]; | ||
185 | typedef char acpi_device_name[40]; | ||
186 | typedef char acpi_device_class[20]; | ||
187 | |||
188 | struct acpi_device_pnp { | ||
189 | acpi_bus_id bus_id; /* Object name */ | ||
190 | acpi_bus_address bus_address; /* _ADR */ | ||
191 | acpi_hardware_id hardware_id; /* _HID */ | ||
192 | struct acpi_compatible_id_list *cid_list; /* _CIDs */ | ||
193 | acpi_unique_id unique_id; /* _UID */ | ||
194 | acpi_device_name device_name; /* Driver-determined */ | ||
195 | acpi_device_class device_class; /* " */ | ||
196 | }; | ||
197 | |||
198 | #define acpi_device_bid(d) ((d)->pnp.bus_id) | ||
199 | #define acpi_device_adr(d) ((d)->pnp.bus_address) | ||
200 | #define acpi_device_hid(d) ((d)->pnp.hardware_id) | ||
201 | #define acpi_device_uid(d) ((d)->pnp.unique_id) | ||
202 | #define acpi_device_name(d) ((d)->pnp.device_name) | ||
203 | #define acpi_device_class(d) ((d)->pnp.device_class) | ||
204 | |||
205 | |||
206 | /* Power Management */ | ||
207 | |||
208 | struct acpi_device_power_flags { | ||
209 | u32 explicit_get:1; /* _PSC present? */ | ||
210 | u32 power_resources:1; /* Power resources */ | ||
211 | u32 inrush_current:1; /* Serialize Dx->D0 */ | ||
212 | u32 power_removed:1; /* Optimize Dx->D0 */ | ||
213 | u32 reserved:28; | ||
214 | }; | ||
215 | |||
216 | struct acpi_device_power_state { | ||
217 | struct { | ||
218 | u8 valid:1; | ||
219 | u8 explicit_set:1; /* _PSx present? */ | ||
220 | u8 reserved:6; | ||
221 | } flags; | ||
222 | int power; /* % Power (compared to D0) */ | ||
223 | int latency; /* Dx->D0 time (microseconds) */ | ||
224 | struct acpi_handle_list resources; /* Power resources referenced */ | ||
225 | }; | ||
226 | |||
227 | struct acpi_device_power { | ||
228 | int state; /* Current state */ | ||
229 | struct acpi_device_power_flags flags; | ||
230 | struct acpi_device_power_state states[4]; /* Power states (D0-D3) */ | ||
231 | }; | ||
232 | |||
233 | |||
234 | /* Performance Management */ | ||
235 | |||
236 | struct acpi_device_perf_flags { | ||
237 | u8 reserved:8; | ||
238 | }; | ||
239 | |||
240 | struct acpi_device_perf_state { | ||
241 | struct { | ||
242 | u8 valid:1; | ||
243 | u8 reserved:7; | ||
244 | } flags; | ||
245 | u8 power; /* % Power (compared to P0) */ | ||
246 | u8 performance; /* % Performance ( " ) */ | ||
247 | int latency; /* Px->P0 time (microseconds) */ | ||
248 | }; | ||
249 | |||
250 | struct acpi_device_perf { | ||
251 | int state; | ||
252 | struct acpi_device_perf_flags flags; | ||
253 | int state_count; | ||
254 | struct acpi_device_perf_state *states; | ||
255 | }; | ||
256 | |||
257 | /* Wakeup Management */ | ||
258 | struct acpi_device_wakeup_flags { | ||
259 | u8 valid:1; /* Can successfully enable wakeup? */ | ||
260 | u8 run_wake:1; /* Run-Wake GPE devices */ | ||
261 | }; | ||
262 | |||
263 | struct acpi_device_wakeup_state { | ||
264 | u8 enabled:1; | ||
265 | u8 active:1; | ||
266 | }; | ||
267 | |||
268 | struct acpi_device_wakeup { | ||
269 | acpi_handle gpe_device; | ||
270 | acpi_integer gpe_number;; | ||
271 | acpi_integer sleep_state; | ||
272 | struct acpi_handle_list resources; | ||
273 | struct acpi_device_wakeup_state state; | ||
274 | struct acpi_device_wakeup_flags flags; | ||
275 | }; | ||
276 | |||
277 | /* Device */ | ||
278 | |||
279 | struct acpi_device { | ||
280 | acpi_handle handle; | ||
281 | struct acpi_device *parent; | ||
282 | struct list_head children; | ||
283 | struct list_head node; | ||
284 | struct list_head wakeup_list; | ||
285 | struct list_head g_list; | ||
286 | struct acpi_device_status status; | ||
287 | struct acpi_device_flags flags; | ||
288 | struct acpi_device_pnp pnp; | ||
289 | struct acpi_device_power power; | ||
290 | struct acpi_device_wakeup wakeup; | ||
291 | struct acpi_device_perf performance; | ||
292 | struct acpi_device_dir dir; | ||
293 | struct acpi_device_ops ops; | ||
294 | struct acpi_driver *driver; | ||
295 | void *driver_data; | ||
296 | struct kobject kobj; | ||
297 | }; | ||
298 | |||
299 | #define acpi_driver_data(d) ((d)->driver_data) | ||
300 | |||
301 | |||
302 | /* | ||
303 | * Events | ||
304 | * ------ | ||
305 | */ | ||
306 | |||
307 | struct acpi_bus_event { | ||
308 | struct list_head node; | ||
309 | acpi_device_class device_class; | ||
310 | acpi_bus_id bus_id; | ||
311 | u32 type; | ||
312 | u32 data; | ||
313 | }; | ||
314 | |||
315 | extern struct subsystem acpi_subsys; | ||
316 | |||
317 | /* | ||
318 | * External Functions | ||
319 | */ | ||
320 | |||
321 | int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); | ||
322 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); | ||
323 | int acpi_bus_get_status (struct acpi_device *device); | ||
324 | int acpi_bus_get_power (acpi_handle handle, int *state); | ||
325 | int acpi_bus_set_power (acpi_handle handle, int state); | ||
326 | int acpi_bus_generate_event (struct acpi_device *device, u8 type, int data); | ||
327 | int acpi_bus_receive_event (struct acpi_bus_event *event); | ||
328 | int acpi_bus_register_driver (struct acpi_driver *driver); | ||
329 | int acpi_bus_unregister_driver (struct acpi_driver *driver); | ||
330 | int acpi_bus_scan (struct acpi_device *start); | ||
331 | int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, | ||
332 | acpi_handle handle, int type); | ||
333 | |||
334 | |||
335 | int acpi_match_ids (struct acpi_device *device, char *ids); | ||
336 | int acpi_create_dir(struct acpi_device *); | ||
337 | void acpi_remove_dir(struct acpi_device *); | ||
338 | |||
339 | #endif /*CONFIG_ACPI_BUS*/ | ||
340 | |||
341 | #endif /*__ACPI_BUS_H__*/ | ||
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h new file mode 100644 index 000000000000..c62e92ec43b2 --- /dev/null +++ b/include/acpi/acpi_drivers.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * acpi_drivers.h ($Revision: 31 $) | ||
3 | * | ||
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | ||
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
6 | * | ||
7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or (at | ||
12 | * your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
22 | * | ||
23 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
24 | */ | ||
25 | |||
26 | #ifndef __ACPI_DRIVERS_H__ | ||
27 | #define __ACPI_DRIVERS_H__ | ||
28 | |||
29 | #include <linux/acpi.h> | ||
30 | #include <acpi/acpi_bus.h> | ||
31 | |||
32 | |||
33 | #define ACPI_MAX_STRING 80 | ||
34 | |||
35 | #define ACPI_BUS_COMPONENT 0x00010000 | ||
36 | #define ACPI_SYSTEM_COMPONENT 0x02000000 | ||
37 | |||
38 | /* _HID definitions */ | ||
39 | |||
40 | #define ACPI_POWER_HID "ACPI_PWR" | ||
41 | #define ACPI_PROCESSOR_HID "ACPI_CPU" | ||
42 | #define ACPI_SYSTEM_HID "ACPI_SYS" | ||
43 | #define ACPI_THERMAL_HID "ACPI_THM" | ||
44 | #define ACPI_BUTTON_HID_POWERF "ACPI_FPB" | ||
45 | #define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" | ||
46 | |||
47 | |||
48 | /* -------------------------------------------------------------------------- | ||
49 | PCI | ||
50 | -------------------------------------------------------------------------- */ | ||
51 | |||
52 | #ifdef CONFIG_ACPI_PCI | ||
53 | |||
54 | #define ACPI_PCI_COMPONENT 0x00400000 | ||
55 | |||
56 | /* ACPI PCI Interrupt Link (pci_link.c) */ | ||
57 | |||
58 | int acpi_irq_penalty_init (void); | ||
59 | int acpi_pci_link_get_irq (acpi_handle handle, int index, int *edge_level, | ||
60 | int *active_high_low, char **name); | ||
61 | |||
62 | /* ACPI PCI Interrupt Routing (pci_irq.c) */ | ||
63 | |||
64 | int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus); | ||
65 | void acpi_pci_irq_del_prt (int segment, int bus); | ||
66 | |||
67 | /* ACPI PCI Device Binding (pci_bind.c) */ | ||
68 | |||
69 | struct pci_bus; | ||
70 | |||
71 | int acpi_pci_bind (struct acpi_device *device); | ||
72 | int acpi_pci_unbind (struct acpi_device *device); | ||
73 | int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus); | ||
74 | |||
75 | /* Arch-defined function to add a bus to the system */ | ||
76 | |||
77 | struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus); | ||
78 | |||
79 | #endif /*CONFIG_ACPI_PCI*/ | ||
80 | |||
81 | |||
82 | /* -------------------------------------------------------------------------- | ||
83 | Power Resource | ||
84 | -------------------------------------------------------------------------- */ | ||
85 | |||
86 | #ifdef CONFIG_ACPI_POWER | ||
87 | int acpi_enable_wakeup_device_power (struct acpi_device *dev); | ||
88 | int acpi_disable_wakeup_device_power (struct acpi_device *dev); | ||
89 | int acpi_power_get_inferred_state (struct acpi_device *device); | ||
90 | int acpi_power_transition (struct acpi_device *device, int state); | ||
91 | #endif | ||
92 | |||
93 | |||
94 | /* -------------------------------------------------------------------------- | ||
95 | Embedded Controller | ||
96 | -------------------------------------------------------------------------- */ | ||
97 | #ifdef CONFIG_ACPI_EC | ||
98 | int acpi_ec_ecdt_probe (void); | ||
99 | #endif | ||
100 | |||
101 | /* -------------------------------------------------------------------------- | ||
102 | Processor | ||
103 | -------------------------------------------------------------------------- */ | ||
104 | |||
105 | #define ACPI_PROCESSOR_LIMIT_NONE 0x00 | ||
106 | #define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01 | ||
107 | #define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02 | ||
108 | |||
109 | int acpi_processor_set_thermal_limit(acpi_handle handle, int type); | ||
110 | |||
111 | |||
112 | #endif /*__ACPI_DRIVERS_H__*/ | ||
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h new file mode 100644 index 000000000000..857c8072eb1e --- /dev/null +++ b/include/acpi/acpiosxf.h | |||
@@ -0,0 +1,389 @@ | |||
1 | |||
2 | /****************************************************************************** | ||
3 | * | ||
4 | * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These | ||
5 | * interfaces must be implemented by OSL to interface the | ||
6 | * ACPI components to the host operating system. | ||
7 | * | ||
8 | *****************************************************************************/ | ||
9 | |||
10 | |||
11 | /* | ||
12 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
13 | * All rights reserved. | ||
14 | * | ||
15 | * Redistribution and use in source and binary forms, with or without | ||
16 | * modification, are permitted provided that the following conditions | ||
17 | * are met: | ||
18 | * 1. Redistributions of source code must retain the above copyright | ||
19 | * notice, this list of conditions, and the following disclaimer, | ||
20 | * without modification. | ||
21 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
22 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
23 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
24 | * including a substantially similar Disclaimer requirement for further | ||
25 | * binary redistribution. | ||
26 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
27 | * of any contributors may be used to endorse or promote products derived | ||
28 | * from this software without specific prior written permission. | ||
29 | * | ||
30 | * Alternatively, this software may be distributed under the terms of the | ||
31 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
32 | * Software Foundation. | ||
33 | * | ||
34 | * NO WARRANTY | ||
35 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
36 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
37 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
38 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
39 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
40 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
41 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
42 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
43 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
44 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
45 | * POSSIBILITY OF SUCH DAMAGES. | ||
46 | */ | ||
47 | |||
48 | #ifndef __ACPIOSXF_H__ | ||
49 | #define __ACPIOSXF_H__ | ||
50 | |||
51 | #include "platform/acenv.h" | ||
52 | #include "actypes.h" | ||
53 | |||
54 | |||
55 | /* Priorities for acpi_os_queue_for_execution */ | ||
56 | |||
57 | #define OSD_PRIORITY_GPE 1 | ||
58 | #define OSD_PRIORITY_HIGH 2 | ||
59 | #define OSD_PRIORITY_MED 3 | ||
60 | #define OSD_PRIORITY_LO 4 | ||
61 | |||
62 | #define ACPI_NO_UNIT_LIMIT ((u32) -1) | ||
63 | #define ACPI_MUTEX_SEM 1 | ||
64 | |||
65 | |||
66 | /* Functions for acpi_os_signal */ | ||
67 | |||
68 | #define ACPI_SIGNAL_FATAL 0 | ||
69 | #define ACPI_SIGNAL_BREAKPOINT 1 | ||
70 | |||
71 | struct acpi_signal_fatal_info | ||
72 | { | ||
73 | u32 type; | ||
74 | u32 code; | ||
75 | u32 argument; | ||
76 | }; | ||
77 | |||
78 | |||
79 | /* | ||
80 | * OSL Initialization and shutdown primitives | ||
81 | */ | ||
82 | |||
83 | acpi_status | ||
84 | acpi_os_initialize ( | ||
85 | void); | ||
86 | |||
87 | acpi_status | ||
88 | acpi_os_terminate ( | ||
89 | void); | ||
90 | |||
91 | |||
92 | /* | ||
93 | * ACPI Table interfaces | ||
94 | */ | ||
95 | |||
96 | acpi_status | ||
97 | acpi_os_get_root_pointer ( | ||
98 | u32 flags, | ||
99 | struct acpi_pointer *address); | ||
100 | |||
101 | acpi_status | ||
102 | acpi_os_predefined_override ( | ||
103 | const struct acpi_predefined_names *init_val, | ||
104 | acpi_string *new_val); | ||
105 | |||
106 | acpi_status | ||
107 | acpi_os_table_override ( | ||
108 | struct acpi_table_header *existing_table, | ||
109 | struct acpi_table_header **new_table); | ||
110 | |||
111 | |||
112 | /* | ||
113 | * Synchronization primitives | ||
114 | */ | ||
115 | |||
116 | acpi_status | ||
117 | acpi_os_create_semaphore ( | ||
118 | u32 max_units, | ||
119 | u32 initial_units, | ||
120 | acpi_handle *out_handle); | ||
121 | |||
122 | acpi_status | ||
123 | acpi_os_delete_semaphore ( | ||
124 | acpi_handle handle); | ||
125 | |||
126 | acpi_status | ||
127 | acpi_os_wait_semaphore ( | ||
128 | acpi_handle handle, | ||
129 | u32 units, | ||
130 | u16 timeout); | ||
131 | |||
132 | acpi_status | ||
133 | acpi_os_signal_semaphore ( | ||
134 | acpi_handle handle, | ||
135 | u32 units); | ||
136 | |||
137 | acpi_status | ||
138 | acpi_os_create_lock ( | ||
139 | acpi_handle *out_handle); | ||
140 | |||
141 | void | ||
142 | acpi_os_delete_lock ( | ||
143 | acpi_handle handle); | ||
144 | |||
145 | void | ||
146 | acpi_os_acquire_lock ( | ||
147 | acpi_handle handle, | ||
148 | u32 flags); | ||
149 | |||
150 | void | ||
151 | acpi_os_release_lock ( | ||
152 | acpi_handle handle, | ||
153 | u32 flags); | ||
154 | |||
155 | |||
156 | /* | ||
157 | * Memory allocation and mapping | ||
158 | */ | ||
159 | |||
160 | void * | ||
161 | acpi_os_allocate ( | ||
162 | acpi_size size); | ||
163 | |||
164 | void | ||
165 | acpi_os_free ( | ||
166 | void * memory); | ||
167 | |||
168 | acpi_status | ||
169 | acpi_os_map_memory ( | ||
170 | acpi_physical_address physical_address, | ||
171 | acpi_size size, | ||
172 | void __iomem **logical_address); | ||
173 | |||
174 | void | ||
175 | acpi_os_unmap_memory ( | ||
176 | void __iomem *logical_address, | ||
177 | acpi_size size); | ||
178 | |||
179 | #ifdef ACPI_FUTURE_USAGE | ||
180 | acpi_status | ||
181 | acpi_os_get_physical_address ( | ||
182 | void *logical_address, | ||
183 | acpi_physical_address *physical_address); | ||
184 | #endif | ||
185 | |||
186 | |||
187 | /* | ||
188 | * Interrupt handlers | ||
189 | */ | ||
190 | |||
191 | acpi_status | ||
192 | acpi_os_install_interrupt_handler ( | ||
193 | u32 gsi, | ||
194 | acpi_osd_handler service_routine, | ||
195 | void *context); | ||
196 | |||
197 | acpi_status | ||
198 | acpi_os_remove_interrupt_handler ( | ||
199 | u32 gsi, | ||
200 | acpi_osd_handler service_routine); | ||
201 | |||
202 | |||
203 | /* | ||
204 | * Threads and Scheduling | ||
205 | */ | ||
206 | |||
207 | u32 | ||
208 | acpi_os_get_thread_id ( | ||
209 | void); | ||
210 | |||
211 | acpi_status | ||
212 | acpi_os_queue_for_execution ( | ||
213 | u32 priority, | ||
214 | acpi_osd_exec_callback function, | ||
215 | void *context); | ||
216 | |||
217 | void | ||
218 | acpi_os_wait_events_complete( | ||
219 | void * context); | ||
220 | |||
221 | void | ||
222 | acpi_os_wait_events_complete ( | ||
223 | void *context); | ||
224 | |||
225 | void | ||
226 | acpi_os_sleep ( | ||
227 | acpi_integer milliseconds); | ||
228 | |||
229 | void | ||
230 | acpi_os_stall ( | ||
231 | u32 microseconds); | ||
232 | |||
233 | |||
234 | /* | ||
235 | * Platform and hardware-independent I/O interfaces | ||
236 | */ | ||
237 | |||
238 | acpi_status | ||
239 | acpi_os_read_port ( | ||
240 | acpi_io_address address, | ||
241 | u32 *value, | ||
242 | u32 width); | ||
243 | |||
244 | acpi_status | ||
245 | acpi_os_write_port ( | ||
246 | acpi_io_address address, | ||
247 | u32 value, | ||
248 | u32 width); | ||
249 | |||
250 | |||
251 | /* | ||
252 | * Platform and hardware-independent physical memory interfaces | ||
253 | */ | ||
254 | |||
255 | acpi_status | ||
256 | acpi_os_read_memory ( | ||
257 | acpi_physical_address address, | ||
258 | u32 *value, | ||
259 | u32 width); | ||
260 | |||
261 | acpi_status | ||
262 | acpi_os_write_memory ( | ||
263 | acpi_physical_address address, | ||
264 | u32 value, | ||
265 | u32 width); | ||
266 | |||
267 | |||
268 | /* | ||
269 | * Platform and hardware-independent PCI configuration space access | ||
270 | * Note: Can't use "Register" as a parameter, changed to "Reg" -- | ||
271 | * certain compilers complain. | ||
272 | */ | ||
273 | |||
274 | acpi_status | ||
275 | acpi_os_read_pci_configuration ( | ||
276 | struct acpi_pci_id *pci_id, | ||
277 | u32 reg, | ||
278 | void *value, | ||
279 | u32 width); | ||
280 | |||
281 | acpi_status | ||
282 | acpi_os_write_pci_configuration ( | ||
283 | struct acpi_pci_id *pci_id, | ||
284 | u32 reg, | ||
285 | acpi_integer value, | ||
286 | u32 width); | ||
287 | |||
288 | /* | ||
289 | * Interim function needed for PCI IRQ routing | ||
290 | */ | ||
291 | |||
292 | void | ||
293 | acpi_os_derive_pci_id( | ||
294 | acpi_handle rhandle, | ||
295 | acpi_handle chandle, | ||
296 | struct acpi_pci_id **pci_id); | ||
297 | |||
298 | /* | ||
299 | * Miscellaneous | ||
300 | */ | ||
301 | |||
302 | u8 | ||
303 | acpi_os_readable ( | ||
304 | void *pointer, | ||
305 | acpi_size length); | ||
306 | |||
307 | #ifdef ACPI_FUTURE_USAGE | ||
308 | u8 | ||
309 | acpi_os_writable ( | ||
310 | void *pointer, | ||
311 | acpi_size length); | ||
312 | #endif | ||
313 | |||
314 | u64 | ||
315 | acpi_os_get_timer ( | ||
316 | void); | ||
317 | |||
318 | acpi_status | ||
319 | acpi_os_signal ( | ||
320 | u32 function, | ||
321 | void *info); | ||
322 | |||
323 | /* | ||
324 | * Debug print routines | ||
325 | */ | ||
326 | |||
327 | void ACPI_INTERNAL_VAR_XFACE | ||
328 | acpi_os_printf ( | ||
329 | const char *format, | ||
330 | ...); | ||
331 | |||
332 | void | ||
333 | acpi_os_vprintf ( | ||
334 | const char *format, | ||
335 | va_list args); | ||
336 | |||
337 | void | ||
338 | acpi_os_redirect_output ( | ||
339 | void *destination); | ||
340 | |||
341 | |||
342 | /* | ||
343 | * Debug input | ||
344 | */ | ||
345 | |||
346 | #ifdef ACPI_FUTURE_USAGE | ||
347 | u32 | ||
348 | acpi_os_get_line ( | ||
349 | char *buffer); | ||
350 | #endif | ||
351 | |||
352 | |||
353 | /* | ||
354 | * Directory manipulation | ||
355 | */ | ||
356 | |||
357 | void * | ||
358 | acpi_os_open_directory ( | ||
359 | char *pathname, | ||
360 | char *wildcard_spec, | ||
361 | char requested_file_type); | ||
362 | |||
363 | /* requeste_file_type values */ | ||
364 | |||
365 | #define REQUEST_FILE_ONLY 0 | ||
366 | #define REQUEST_DIR_ONLY 1 | ||
367 | |||
368 | |||
369 | char * | ||
370 | acpi_os_get_next_filename ( | ||
371 | void *dir_handle); | ||
372 | |||
373 | void | ||
374 | acpi_os_close_directory ( | ||
375 | void *dir_handle); | ||
376 | |||
377 | /* | ||
378 | * Debug | ||
379 | */ | ||
380 | |||
381 | void | ||
382 | acpi_os_dbg_assert( | ||
383 | void *failed_assertion, | ||
384 | void *file_name, | ||
385 | u32 line_number, | ||
386 | char *message); | ||
387 | |||
388 | |||
389 | #endif /* __ACPIOSXF_H__ */ | ||
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h new file mode 100644 index 000000000000..00d78b79652e --- /dev/null +++ b/include/acpi/acpixf.h | |||
@@ -0,0 +1,497 @@ | |||
1 | |||
2 | /****************************************************************************** | ||
3 | * | ||
4 | * Name: acpixf.h - External interfaces to the ACPI subsystem | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | |||
46 | #ifndef __ACXFACE_H__ | ||
47 | #define __ACXFACE_H__ | ||
48 | |||
49 | #include "actypes.h" | ||
50 | #include "actbl.h" | ||
51 | |||
52 | |||
53 | /* | ||
54 | * Global interfaces | ||
55 | */ | ||
56 | |||
57 | acpi_status | ||
58 | acpi_initialize_subsystem ( | ||
59 | void); | ||
60 | |||
61 | acpi_status | ||
62 | acpi_enable_subsystem ( | ||
63 | u32 flags); | ||
64 | |||
65 | acpi_status | ||
66 | acpi_initialize_objects ( | ||
67 | u32 flags); | ||
68 | |||
69 | acpi_status | ||
70 | acpi_terminate ( | ||
71 | void); | ||
72 | |||
73 | #ifdef ACPI_FUTURE_USAGE | ||
74 | acpi_status | ||
75 | acpi_subsystem_status ( | ||
76 | void); | ||
77 | #endif | ||
78 | |||
79 | acpi_status | ||
80 | acpi_enable ( | ||
81 | void); | ||
82 | |||
83 | acpi_status | ||
84 | acpi_disable ( | ||
85 | void); | ||
86 | |||
87 | #ifdef ACPI_FUTURE_USAGE | ||
88 | acpi_status | ||
89 | acpi_get_system_info ( | ||
90 | struct acpi_buffer *ret_buffer); | ||
91 | #endif | ||
92 | |||
93 | const char * | ||
94 | acpi_format_exception ( | ||
95 | acpi_status exception); | ||
96 | |||
97 | acpi_status | ||
98 | acpi_purge_cached_objects ( | ||
99 | void); | ||
100 | |||
101 | #ifdef ACPI_FUTURE_USAGE | ||
102 | acpi_status | ||
103 | acpi_install_initialization_handler ( | ||
104 | acpi_init_handler handler, | ||
105 | u32 function); | ||
106 | #endif | ||
107 | |||
108 | /* | ||
109 | * ACPI Memory manager | ||
110 | */ | ||
111 | |||
112 | void * | ||
113 | acpi_allocate ( | ||
114 | u32 size); | ||
115 | |||
116 | void * | ||
117 | acpi_callocate ( | ||
118 | u32 size); | ||
119 | |||
120 | void | ||
121 | acpi_free ( | ||
122 | void *address); | ||
123 | |||
124 | |||
125 | /* | ||
126 | * ACPI table manipulation interfaces | ||
127 | */ | ||
128 | |||
129 | acpi_status | ||
130 | acpi_find_root_pointer ( | ||
131 | u32 flags, | ||
132 | struct acpi_pointer *rsdp_address); | ||
133 | |||
134 | acpi_status | ||
135 | acpi_load_tables ( | ||
136 | void); | ||
137 | |||
138 | #ifdef ACPI_FUTURE_USAGE | ||
139 | acpi_status | ||
140 | acpi_load_table ( | ||
141 | struct acpi_table_header *table_ptr); | ||
142 | |||
143 | acpi_status | ||
144 | acpi_unload_table ( | ||
145 | acpi_table_type table_type); | ||
146 | |||
147 | acpi_status | ||
148 | acpi_get_table_header ( | ||
149 | acpi_table_type table_type, | ||
150 | u32 instance, | ||
151 | struct acpi_table_header *out_table_header); | ||
152 | #endif /* ACPI_FUTURE_USAGE */ | ||
153 | |||
154 | acpi_status | ||
155 | acpi_get_table ( | ||
156 | acpi_table_type table_type, | ||
157 | u32 instance, | ||
158 | struct acpi_buffer *ret_buffer); | ||
159 | |||
160 | acpi_status | ||
161 | acpi_get_firmware_table ( | ||
162 | acpi_string signature, | ||
163 | u32 instance, | ||
164 | u32 flags, | ||
165 | struct acpi_table_header **table_pointer); | ||
166 | |||
167 | |||
168 | /* | ||
169 | * Namespace and name interfaces | ||
170 | */ | ||
171 | |||
172 | acpi_status | ||
173 | acpi_walk_namespace ( | ||
174 | acpi_object_type type, | ||
175 | acpi_handle start_object, | ||
176 | u32 max_depth, | ||
177 | acpi_walk_callback user_function, | ||
178 | void *context, | ||
179 | void **return_value); | ||
180 | |||
181 | acpi_status | ||
182 | acpi_get_devices ( | ||
183 | char *HID, | ||
184 | acpi_walk_callback user_function, | ||
185 | void *context, | ||
186 | void **return_value); | ||
187 | |||
188 | acpi_status | ||
189 | acpi_get_name ( | ||
190 | acpi_handle handle, | ||
191 | u32 name_type, | ||
192 | struct acpi_buffer *ret_path_ptr); | ||
193 | |||
194 | acpi_status | ||
195 | acpi_get_handle ( | ||
196 | acpi_handle parent, | ||
197 | acpi_string pathname, | ||
198 | acpi_handle *ret_handle); | ||
199 | |||
200 | acpi_status | ||
201 | acpi_attach_data ( | ||
202 | acpi_handle obj_handle, | ||
203 | acpi_object_handler handler, | ||
204 | void *data); | ||
205 | |||
206 | acpi_status | ||
207 | acpi_detach_data ( | ||
208 | acpi_handle obj_handle, | ||
209 | acpi_object_handler handler); | ||
210 | |||
211 | acpi_status | ||
212 | acpi_get_data ( | ||
213 | acpi_handle obj_handle, | ||
214 | acpi_object_handler handler, | ||
215 | void **data); | ||
216 | |||
217 | |||
218 | /* | ||
219 | * Object manipulation and enumeration | ||
220 | */ | ||
221 | |||
222 | acpi_status | ||
223 | acpi_evaluate_object ( | ||
224 | acpi_handle object, | ||
225 | acpi_string pathname, | ||
226 | struct acpi_object_list *parameter_objects, | ||
227 | struct acpi_buffer *return_object_buffer); | ||
228 | |||
229 | #ifdef ACPI_FUTURE_USAGE | ||
230 | acpi_status | ||
231 | acpi_evaluate_object_typed ( | ||
232 | acpi_handle object, | ||
233 | acpi_string pathname, | ||
234 | struct acpi_object_list *external_params, | ||
235 | struct acpi_buffer *return_buffer, | ||
236 | acpi_object_type return_type); | ||
237 | #endif | ||
238 | |||
239 | acpi_status | ||
240 | acpi_get_object_info ( | ||
241 | acpi_handle handle, | ||
242 | struct acpi_buffer *return_buffer); | ||
243 | |||
244 | acpi_status | ||
245 | acpi_get_next_object ( | ||
246 | acpi_object_type type, | ||
247 | acpi_handle parent, | ||
248 | acpi_handle child, | ||
249 | acpi_handle *out_handle); | ||
250 | |||
251 | acpi_status | ||
252 | acpi_get_type ( | ||
253 | acpi_handle object, | ||
254 | acpi_object_type *out_type); | ||
255 | |||
256 | acpi_status | ||
257 | acpi_get_parent ( | ||
258 | acpi_handle object, | ||
259 | acpi_handle *out_handle); | ||
260 | |||
261 | |||
262 | /* | ||
263 | * Event handler interfaces | ||
264 | */ | ||
265 | |||
266 | acpi_status | ||
267 | acpi_install_fixed_event_handler ( | ||
268 | u32 acpi_event, | ||
269 | acpi_event_handler handler, | ||
270 | void *context); | ||
271 | |||
272 | acpi_status | ||
273 | acpi_remove_fixed_event_handler ( | ||
274 | u32 acpi_event, | ||
275 | acpi_event_handler handler); | ||
276 | |||
277 | acpi_status | ||
278 | acpi_install_notify_handler ( | ||
279 | acpi_handle device, | ||
280 | u32 handler_type, | ||
281 | acpi_notify_handler handler, | ||
282 | void *context); | ||
283 | |||
284 | acpi_status | ||
285 | acpi_remove_notify_handler ( | ||
286 | acpi_handle device, | ||
287 | u32 handler_type, | ||
288 | acpi_notify_handler handler); | ||
289 | |||
290 | acpi_status | ||
291 | acpi_install_address_space_handler ( | ||
292 | acpi_handle device, | ||
293 | acpi_adr_space_type space_id, | ||
294 | acpi_adr_space_handler handler, | ||
295 | acpi_adr_space_setup setup, | ||
296 | void *context); | ||
297 | |||
298 | acpi_status | ||
299 | acpi_remove_address_space_handler ( | ||
300 | acpi_handle device, | ||
301 | acpi_adr_space_type space_id, | ||
302 | acpi_adr_space_handler handler); | ||
303 | |||
304 | acpi_status | ||
305 | acpi_install_gpe_handler ( | ||
306 | acpi_handle gpe_device, | ||
307 | u32 gpe_number, | ||
308 | u32 type, | ||
309 | acpi_event_handler address, | ||
310 | void *context); | ||
311 | |||
312 | #ifdef ACPI_FUTURE_USAGE | ||
313 | acpi_status | ||
314 | acpi_install_exception_handler ( | ||
315 | acpi_exception_handler handler); | ||
316 | #endif | ||
317 | |||
318 | |||
319 | /* | ||
320 | * Event interfaces | ||
321 | */ | ||
322 | |||
323 | acpi_status | ||
324 | acpi_acquire_global_lock ( | ||
325 | u16 timeout, | ||
326 | u32 *handle); | ||
327 | |||
328 | acpi_status | ||
329 | acpi_release_global_lock ( | ||
330 | u32 handle); | ||
331 | |||
332 | acpi_status | ||
333 | acpi_remove_gpe_handler ( | ||
334 | acpi_handle gpe_device, | ||
335 | u32 gpe_number, | ||
336 | acpi_event_handler address); | ||
337 | |||
338 | acpi_status | ||
339 | acpi_enable_event ( | ||
340 | u32 event, | ||
341 | u32 flags); | ||
342 | |||
343 | acpi_status | ||
344 | acpi_disable_event ( | ||
345 | u32 event, | ||
346 | u32 flags); | ||
347 | |||
348 | acpi_status | ||
349 | acpi_clear_event ( | ||
350 | u32 event); | ||
351 | |||
352 | #ifdef ACPI_FUTURE_USAGE | ||
353 | acpi_status | ||
354 | acpi_get_event_status ( | ||
355 | u32 event, | ||
356 | acpi_event_status *event_status); | ||
357 | #endif /* ACPI_FUTURE_USAGE */ | ||
358 | |||
359 | acpi_status | ||
360 | acpi_set_gpe_type ( | ||
361 | acpi_handle gpe_device, | ||
362 | u32 gpe_number, | ||
363 | u8 type); | ||
364 | |||
365 | acpi_status | ||
366 | acpi_enable_gpe ( | ||
367 | acpi_handle gpe_device, | ||
368 | u32 gpe_number, | ||
369 | u32 flags); | ||
370 | |||
371 | acpi_status | ||
372 | acpi_disable_gpe ( | ||
373 | acpi_handle gpe_device, | ||
374 | u32 gpe_number, | ||
375 | u32 flags); | ||
376 | |||
377 | acpi_status | ||
378 | acpi_clear_gpe ( | ||
379 | acpi_handle gpe_device, | ||
380 | u32 gpe_number, | ||
381 | u32 flags); | ||
382 | |||
383 | #ifdef ACPI_FUTURE_USAGE | ||
384 | acpi_status | ||
385 | acpi_get_gpe_status ( | ||
386 | acpi_handle gpe_device, | ||
387 | u32 gpe_number, | ||
388 | u32 flags, | ||
389 | acpi_event_status *event_status); | ||
390 | #endif /* ACPI_FUTURE_USAGE */ | ||
391 | |||
392 | acpi_status | ||
393 | acpi_install_gpe_block ( | ||
394 | acpi_handle gpe_device, | ||
395 | struct acpi_generic_address *gpe_block_address, | ||
396 | u32 register_count, | ||
397 | u32 interrupt_level); | ||
398 | |||
399 | acpi_status | ||
400 | acpi_remove_gpe_block ( | ||
401 | acpi_handle gpe_device); | ||
402 | |||
403 | |||
404 | /* | ||
405 | * Resource interfaces | ||
406 | */ | ||
407 | |||
408 | typedef | ||
409 | acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) ( | ||
410 | struct acpi_resource *resource, | ||
411 | void *context); | ||
412 | |||
413 | |||
414 | acpi_status | ||
415 | acpi_get_current_resources( | ||
416 | acpi_handle device_handle, | ||
417 | struct acpi_buffer *ret_buffer); | ||
418 | |||
419 | #ifdef ACPI_FUTURE_USAGE | ||
420 | acpi_status | ||
421 | acpi_get_possible_resources( | ||
422 | acpi_handle device_handle, | ||
423 | struct acpi_buffer *ret_buffer); | ||
424 | #endif | ||
425 | |||
426 | acpi_status | ||
427 | acpi_walk_resources ( | ||
428 | acpi_handle device_handle, | ||
429 | char *path, | ||
430 | ACPI_WALK_RESOURCE_CALLBACK user_function, | ||
431 | void *context); | ||
432 | |||
433 | acpi_status | ||
434 | acpi_set_current_resources ( | ||
435 | acpi_handle device_handle, | ||
436 | struct acpi_buffer *in_buffer); | ||
437 | |||
438 | acpi_status | ||
439 | acpi_get_irq_routing_table ( | ||
440 | acpi_handle bus_device_handle, | ||
441 | struct acpi_buffer *ret_buffer); | ||
442 | |||
443 | acpi_status | ||
444 | acpi_resource_to_address64 ( | ||
445 | struct acpi_resource *resource, | ||
446 | struct acpi_resource_address64 *out); | ||
447 | |||
448 | /* | ||
449 | * Hardware (ACPI device) interfaces | ||
450 | */ | ||
451 | |||
452 | acpi_status | ||
453 | acpi_get_register ( | ||
454 | u32 register_id, | ||
455 | u32 *return_value, | ||
456 | u32 flags); | ||
457 | |||
458 | acpi_status | ||
459 | acpi_set_register ( | ||
460 | u32 register_id, | ||
461 | u32 value, | ||
462 | u32 flags); | ||
463 | |||
464 | acpi_status | ||
465 | acpi_set_firmware_waking_vector ( | ||
466 | acpi_physical_address physical_address); | ||
467 | |||
468 | #ifdef ACPI_FUTURE_USAGE | ||
469 | acpi_status | ||
470 | acpi_get_firmware_waking_vector ( | ||
471 | acpi_physical_address *physical_address); | ||
472 | #endif | ||
473 | |||
474 | acpi_status | ||
475 | acpi_get_sleep_type_data ( | ||
476 | u8 sleep_state, | ||
477 | u8 *slp_typ_a, | ||
478 | u8 *slp_typ_b); | ||
479 | |||
480 | acpi_status | ||
481 | acpi_enter_sleep_state_prep ( | ||
482 | u8 sleep_state); | ||
483 | |||
484 | acpi_status asmlinkage | ||
485 | acpi_enter_sleep_state ( | ||
486 | u8 sleep_state); | ||
487 | |||
488 | acpi_status asmlinkage | ||
489 | acpi_enter_sleep_state_s4bios ( | ||
490 | void); | ||
491 | |||
492 | acpi_status | ||
493 | acpi_leave_sleep_state ( | ||
494 | u8 sleep_state); | ||
495 | |||
496 | |||
497 | #endif /* __ACXFACE_H__ */ | ||
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h new file mode 100644 index 000000000000..93c55ff5c237 --- /dev/null +++ b/include/acpi/acresrc.h | |||
@@ -0,0 +1,395 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acresrc.h - Resource Manager function prototypes | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACRESRC_H__ | ||
45 | #define __ACRESRC_H__ | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Function prototypes called from Acpi* APIs | ||
50 | */ | ||
51 | |||
52 | acpi_status | ||
53 | acpi_rs_get_prt_method_data ( | ||
54 | acpi_handle handle, | ||
55 | struct acpi_buffer *ret_buffer); | ||
56 | |||
57 | |||
58 | acpi_status | ||
59 | acpi_rs_get_crs_method_data ( | ||
60 | acpi_handle handle, | ||
61 | struct acpi_buffer *ret_buffer); | ||
62 | |||
63 | #ifdef ACPI_FUTURE_USAGE | ||
64 | acpi_status | ||
65 | acpi_rs_get_prs_method_data ( | ||
66 | acpi_handle handle, | ||
67 | struct acpi_buffer *ret_buffer); | ||
68 | #endif | ||
69 | |||
70 | acpi_status | ||
71 | acpi_rs_get_method_data ( | ||
72 | acpi_handle handle, | ||
73 | char *path, | ||
74 | struct acpi_buffer *ret_buffer); | ||
75 | |||
76 | acpi_status | ||
77 | acpi_rs_set_srs_method_data ( | ||
78 | acpi_handle handle, | ||
79 | struct acpi_buffer *ret_buffer); | ||
80 | |||
81 | acpi_status | ||
82 | acpi_rs_create_resource_list ( | ||
83 | union acpi_operand_object *byte_stream_buffer, | ||
84 | struct acpi_buffer *output_buffer); | ||
85 | |||
86 | acpi_status | ||
87 | acpi_rs_create_byte_stream ( | ||
88 | struct acpi_resource *linked_list_buffer, | ||
89 | struct acpi_buffer *output_buffer); | ||
90 | |||
91 | acpi_status | ||
92 | acpi_rs_create_pci_routing_table ( | ||
93 | union acpi_operand_object *package_object, | ||
94 | struct acpi_buffer *output_buffer); | ||
95 | |||
96 | |||
97 | /* | ||
98 | * Function prototypes called from acpi_rs_create* | ||
99 | */ | ||
100 | #ifdef ACPI_FUTURE_USAGE | ||
101 | void | ||
102 | acpi_rs_dump_irq ( | ||
103 | union acpi_resource_data *data); | ||
104 | |||
105 | void | ||
106 | acpi_rs_dump_address16 ( | ||
107 | union acpi_resource_data *data); | ||
108 | |||
109 | void | ||
110 | acpi_rs_dump_address32 ( | ||
111 | union acpi_resource_data *data); | ||
112 | |||
113 | void | ||
114 | acpi_rs_dump_address64 ( | ||
115 | union acpi_resource_data *data); | ||
116 | |||
117 | void | ||
118 | acpi_rs_dump_dma ( | ||
119 | union acpi_resource_data *data); | ||
120 | |||
121 | void | ||
122 | acpi_rs_dump_io ( | ||
123 | union acpi_resource_data *data); | ||
124 | |||
125 | void | ||
126 | acpi_rs_dump_extended_irq ( | ||
127 | union acpi_resource_data *data); | ||
128 | |||
129 | void | ||
130 | acpi_rs_dump_fixed_io ( | ||
131 | union acpi_resource_data *data); | ||
132 | |||
133 | void | ||
134 | acpi_rs_dump_fixed_memory32 ( | ||
135 | union acpi_resource_data *data); | ||
136 | |||
137 | void | ||
138 | acpi_rs_dump_memory24 ( | ||
139 | union acpi_resource_data *data); | ||
140 | |||
141 | void | ||
142 | acpi_rs_dump_memory32 ( | ||
143 | union acpi_resource_data *data); | ||
144 | |||
145 | void | ||
146 | acpi_rs_dump_start_depend_fns ( | ||
147 | union acpi_resource_data *data); | ||
148 | |||
149 | void | ||
150 | acpi_rs_dump_vendor_specific ( | ||
151 | union acpi_resource_data *data); | ||
152 | |||
153 | void | ||
154 | acpi_rs_dump_resource_list ( | ||
155 | struct acpi_resource *resource); | ||
156 | |||
157 | void | ||
158 | acpi_rs_dump_irq_list ( | ||
159 | u8 *route_table); | ||
160 | #endif /* ACPI_FUTURE_USAGE */ | ||
161 | |||
162 | acpi_status | ||
163 | acpi_rs_get_byte_stream_start ( | ||
164 | u8 *byte_stream_buffer, | ||
165 | u8 **byte_stream_start, | ||
166 | u32 *size); | ||
167 | |||
168 | acpi_status | ||
169 | acpi_rs_get_list_length ( | ||
170 | u8 *byte_stream_buffer, | ||
171 | u32 byte_stream_buffer_length, | ||
172 | acpi_size *size_needed); | ||
173 | |||
174 | acpi_status | ||
175 | acpi_rs_get_byte_stream_length ( | ||
176 | struct acpi_resource *linked_list_buffer, | ||
177 | acpi_size *size_needed); | ||
178 | |||
179 | acpi_status | ||
180 | acpi_rs_get_pci_routing_table_length ( | ||
181 | union acpi_operand_object *package_object, | ||
182 | acpi_size *buffer_size_needed); | ||
183 | |||
184 | acpi_status | ||
185 | acpi_rs_byte_stream_to_list ( | ||
186 | u8 *byte_stream_buffer, | ||
187 | u32 byte_stream_buffer_length, | ||
188 | u8 *output_buffer); | ||
189 | |||
190 | acpi_status | ||
191 | acpi_rs_list_to_byte_stream ( | ||
192 | struct acpi_resource *linked_list, | ||
193 | acpi_size byte_stream_size_needed, | ||
194 | u8 *output_buffer); | ||
195 | |||
196 | acpi_status | ||
197 | acpi_rs_io_resource ( | ||
198 | u8 *byte_stream_buffer, | ||
199 | acpi_size *bytes_consumed, | ||
200 | u8 **output_buffer, | ||
201 | acpi_size *structure_size); | ||
202 | |||
203 | acpi_status | ||
204 | acpi_rs_fixed_io_resource ( | ||
205 | u8 *byte_stream_buffer, | ||
206 | acpi_size *bytes_consumed, | ||
207 | u8 **output_buffer, | ||
208 | acpi_size *structure_size); | ||
209 | |||
210 | acpi_status | ||
211 | acpi_rs_io_stream ( | ||
212 | struct acpi_resource *linked_list, | ||
213 | u8 **output_buffer, | ||
214 | acpi_size *bytes_consumed); | ||
215 | |||
216 | acpi_status | ||
217 | acpi_rs_fixed_io_stream ( | ||
218 | struct acpi_resource *linked_list, | ||
219 | u8 **output_buffer, | ||
220 | acpi_size *bytes_consumed); | ||
221 | |||
222 | acpi_status | ||
223 | acpi_rs_irq_resource ( | ||
224 | u8 *byte_stream_buffer, | ||
225 | acpi_size *bytes_consumed, | ||
226 | u8 **output_buffer, | ||
227 | acpi_size *structure_size); | ||
228 | |||
229 | acpi_status | ||
230 | acpi_rs_irq_stream ( | ||
231 | struct acpi_resource *linked_list, | ||
232 | u8 **output_buffer, | ||
233 | acpi_size *bytes_consumed); | ||
234 | |||
235 | acpi_status | ||
236 | acpi_rs_dma_resource ( | ||
237 | u8 *byte_stream_buffer, | ||
238 | acpi_size *bytes_consumed, | ||
239 | u8 **output_buffer, | ||
240 | acpi_size *structure_size); | ||
241 | |||
242 | acpi_status | ||
243 | acpi_rs_dma_stream ( | ||
244 | struct acpi_resource *linked_list, | ||
245 | u8 **output_buffer, | ||
246 | acpi_size *bytes_consumed); | ||
247 | |||
248 | acpi_status | ||
249 | acpi_rs_address16_resource ( | ||
250 | u8 *byte_stream_buffer, | ||
251 | acpi_size *bytes_consumed, | ||
252 | u8 **output_buffer, | ||
253 | acpi_size *structure_size); | ||
254 | |||
255 | acpi_status | ||
256 | acpi_rs_address16_stream ( | ||
257 | struct acpi_resource *linked_list, | ||
258 | u8 **output_buffer, | ||
259 | acpi_size *bytes_consumed); | ||
260 | |||
261 | acpi_status | ||
262 | acpi_rs_address32_resource ( | ||
263 | u8 *byte_stream_buffer, | ||
264 | acpi_size *bytes_consumed, | ||
265 | u8 **output_buffer, | ||
266 | acpi_size *structure_size); | ||
267 | |||
268 | acpi_status | ||
269 | acpi_rs_address32_stream ( | ||
270 | struct acpi_resource *linked_list, | ||
271 | u8 **output_buffer, | ||
272 | acpi_size *bytes_consumed); | ||
273 | |||
274 | acpi_status | ||
275 | acpi_rs_address64_resource ( | ||
276 | u8 *byte_stream_buffer, | ||
277 | acpi_size *bytes_consumed, | ||
278 | u8 **output_buffer, | ||
279 | acpi_size *structure_size); | ||
280 | |||
281 | acpi_status | ||
282 | acpi_rs_address64_stream ( | ||
283 | struct acpi_resource *linked_list, | ||
284 | u8 **output_buffer, | ||
285 | acpi_size *bytes_consumed); | ||
286 | |||
287 | acpi_status | ||
288 | acpi_rs_start_depend_fns_resource ( | ||
289 | u8 *byte_stream_buffer, | ||
290 | acpi_size *bytes_consumed, | ||
291 | u8 **output_buffer, | ||
292 | acpi_size *structure_size); | ||
293 | |||
294 | acpi_status | ||
295 | acpi_rs_end_depend_fns_resource ( | ||
296 | u8 *byte_stream_buffer, | ||
297 | acpi_size *bytes_consumed, | ||
298 | u8 **output_buffer, | ||
299 | acpi_size *structure_size); | ||
300 | |||
301 | acpi_status | ||
302 | acpi_rs_start_depend_fns_stream ( | ||
303 | struct acpi_resource *linked_list, | ||
304 | u8 **output_buffer, | ||
305 | acpi_size *bytes_consumed); | ||
306 | |||
307 | acpi_status | ||
308 | acpi_rs_end_depend_fns_stream ( | ||
309 | struct acpi_resource *linked_list, | ||
310 | u8 **output_buffer, | ||
311 | acpi_size *bytes_consumed); | ||
312 | |||
313 | acpi_status | ||
314 | acpi_rs_memory24_resource ( | ||
315 | u8 *byte_stream_buffer, | ||
316 | acpi_size *bytes_consumed, | ||
317 | u8 **output_buffer, | ||
318 | acpi_size *structure_size); | ||
319 | |||
320 | acpi_status | ||
321 | acpi_rs_memory24_stream ( | ||
322 | struct acpi_resource *linked_list, | ||
323 | u8 **output_buffer, | ||
324 | acpi_size *bytes_consumed); | ||
325 | |||
326 | acpi_status | ||
327 | acpi_rs_memory32_range_resource ( | ||
328 | u8 *byte_stream_buffer, | ||
329 | acpi_size *bytes_consumed, | ||
330 | u8 **output_buffer, | ||
331 | acpi_size *structure_size); | ||
332 | |||
333 | acpi_status | ||
334 | acpi_rs_fixed_memory32_resource ( | ||
335 | u8 *byte_stream_buffer, | ||
336 | acpi_size *bytes_consumed, | ||
337 | u8 **output_buffer, | ||
338 | acpi_size *structure_size); | ||
339 | |||
340 | acpi_status | ||
341 | acpi_rs_memory32_range_stream ( | ||
342 | struct acpi_resource *linked_list, | ||
343 | u8 **output_buffer, | ||
344 | acpi_size *bytes_consumed); | ||
345 | |||
346 | acpi_status | ||
347 | acpi_rs_fixed_memory32_stream ( | ||
348 | struct acpi_resource *linked_list, | ||
349 | u8 **output_buffer, | ||
350 | acpi_size *bytes_consumed); | ||
351 | |||
352 | acpi_status | ||
353 | acpi_rs_extended_irq_resource ( | ||
354 | u8 *byte_stream_buffer, | ||
355 | acpi_size *bytes_consumed, | ||
356 | u8 **output_buffer, | ||
357 | acpi_size *structure_size); | ||
358 | |||
359 | acpi_status | ||
360 | acpi_rs_extended_irq_stream ( | ||
361 | struct acpi_resource *linked_list, | ||
362 | u8 **output_buffer, | ||
363 | acpi_size *bytes_consumed); | ||
364 | |||
365 | acpi_status | ||
366 | acpi_rs_end_tag_resource ( | ||
367 | u8 *byte_stream_buffer, | ||
368 | acpi_size *bytes_consumed, | ||
369 | u8 **output_buffer, | ||
370 | acpi_size *structure_size); | ||
371 | |||
372 | acpi_status | ||
373 | acpi_rs_end_tag_stream ( | ||
374 | struct acpi_resource *linked_list, | ||
375 | u8 **output_buffer, | ||
376 | acpi_size *bytes_consumed); | ||
377 | |||
378 | acpi_status | ||
379 | acpi_rs_vendor_resource ( | ||
380 | u8 *byte_stream_buffer, | ||
381 | acpi_size *bytes_consumed, | ||
382 | u8 **output_buffer, | ||
383 | acpi_size *structure_size); | ||
384 | |||
385 | acpi_status | ||
386 | acpi_rs_vendor_stream ( | ||
387 | struct acpi_resource *linked_list, | ||
388 | u8 **output_buffer, | ||
389 | acpi_size *bytes_consumed); | ||
390 | |||
391 | u8 | ||
392 | acpi_rs_get_resource_type ( | ||
393 | u8 resource_start_byte); | ||
394 | |||
395 | #endif /* __ACRESRC_H__ */ | ||
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h new file mode 100644 index 000000000000..c97843f6bcbc --- /dev/null +++ b/include/acpi/acstruct.h | |||
@@ -0,0 +1,223 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acstruct.h - Internal structs | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACSTRUCT_H__ | ||
45 | #define __ACSTRUCT_H__ | ||
46 | |||
47 | |||
48 | /***************************************************************************** | ||
49 | * | ||
50 | * Tree walking typedefs and structs | ||
51 | * | ||
52 | ****************************************************************************/ | ||
53 | |||
54 | |||
55 | /* | ||
56 | * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through | ||
57 | * the tree (for whatever reason), and for control method execution. | ||
58 | */ | ||
59 | |||
60 | #define ACPI_NEXT_OP_DOWNWARD 1 | ||
61 | #define ACPI_NEXT_OP_UPWARD 2 | ||
62 | |||
63 | #define ACPI_WALK_NON_METHOD 0 | ||
64 | #define ACPI_WALK_METHOD 1 | ||
65 | #define ACPI_WALK_METHOD_RESTART 2 | ||
66 | #define ACPI_WALK_CONST_REQUIRED 3 | ||
67 | #define ACPI_WALK_CONST_OPTIONAL 4 | ||
68 | |||
69 | struct acpi_walk_state | ||
70 | { | ||
71 | u8 data_type; /* To differentiate various internal objs MUST BE FIRST!*/\ | ||
72 | u8 walk_type; | ||
73 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | ||
74 | u8 last_predicate; /* Result of last predicate */ | ||
75 | u8 reserved; /* For alignment */ | ||
76 | u8 current_result; /* */ | ||
77 | u8 next_op_info; /* Info about next_op */ | ||
78 | u8 num_operands; /* Stack pointer for Operands[] array */ | ||
79 | u8 return_used; | ||
80 | u16 opcode; /* Current AML opcode */ | ||
81 | u8 scope_depth; | ||
82 | u8 reserved1; | ||
83 | u32 arg_count; /* push for fixed or var args */ | ||
84 | u32 aml_offset; | ||
85 | u32 arg_types; | ||
86 | u32 method_breakpoint; /* For single stepping */ | ||
87 | u32 user_breakpoint; /* User AML breakpoint */ | ||
88 | u32 parse_flags; | ||
89 | u32 prev_arg_types; | ||
90 | |||
91 | u8 *aml_last_while; | ||
92 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ | ||
93 | union acpi_operand_object **caller_return_desc; | ||
94 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ | ||
95 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ | ||
96 | struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ | ||
97 | union acpi_operand_object *implicit_return_obj; | ||
98 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
99 | struct acpi_namespace_node *method_call_node; /* Called method Node*/ | ||
100 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ | ||
101 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ | ||
102 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ | ||
103 | union acpi_parse_object *op; /* Current parser op */ | ||
104 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
105 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ | ||
106 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ | ||
107 | union acpi_operand_object **params; | ||
108 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
109 | union acpi_operand_object *result_obj; | ||
110 | union acpi_generic_state *results; /* Stack of accumulated results */ | ||
111 | union acpi_operand_object *return_desc; /* Return object, if any */ | ||
112 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ | ||
113 | |||
114 | union acpi_parse_object *prev_op; /* Last op that was processed */ | ||
115 | union acpi_parse_object *next_op; /* next op to be processed */ | ||
116 | acpi_parse_downwards descending_callback; | ||
117 | acpi_parse_upwards ascending_callback; | ||
118 | struct acpi_thread_state *thread; | ||
119 | struct acpi_walk_state *next; /* Next walk_state in list */ | ||
120 | }; | ||
121 | |||
122 | |||
123 | /* Info used by acpi_ps_init_objects */ | ||
124 | |||
125 | struct acpi_init_walk_info | ||
126 | { | ||
127 | u16 method_count; | ||
128 | u16 device_count; | ||
129 | u16 op_region_count; | ||
130 | u16 field_count; | ||
131 | u16 buffer_count; | ||
132 | u16 package_count; | ||
133 | u16 op_region_init; | ||
134 | u16 field_init; | ||
135 | u16 buffer_init; | ||
136 | u16 package_init; | ||
137 | u16 object_count; | ||
138 | struct acpi_table_desc *table_desc; | ||
139 | }; | ||
140 | |||
141 | |||
142 | /* Info used by acpi_ns_initialize_devices */ | ||
143 | |||
144 | struct acpi_device_walk_info | ||
145 | { | ||
146 | u16 device_count; | ||
147 | u16 num_STA; | ||
148 | u16 num_INI; | ||
149 | struct acpi_table_desc *table_desc; | ||
150 | }; | ||
151 | |||
152 | |||
153 | /* TBD: [Restructure] Merge with struct above */ | ||
154 | |||
155 | struct acpi_walk_info | ||
156 | { | ||
157 | u32 debug_level; | ||
158 | u32 owner_id; | ||
159 | u8 display_type; | ||
160 | }; | ||
161 | |||
162 | /* Display Types */ | ||
163 | |||
164 | #define ACPI_DISPLAY_SUMMARY 0 | ||
165 | #define ACPI_DISPLAY_OBJECTS 1 | ||
166 | |||
167 | struct acpi_get_devices_info | ||
168 | { | ||
169 | acpi_walk_callback user_function; | ||
170 | void *context; | ||
171 | char *hid; | ||
172 | }; | ||
173 | |||
174 | |||
175 | union acpi_aml_operands | ||
176 | { | ||
177 | union acpi_operand_object *operands[7]; | ||
178 | |||
179 | struct | ||
180 | { | ||
181 | struct acpi_object_integer *type; | ||
182 | struct acpi_object_integer *code; | ||
183 | struct acpi_object_integer *argument; | ||
184 | |||
185 | } fatal; | ||
186 | |||
187 | struct | ||
188 | { | ||
189 | union acpi_operand_object *source; | ||
190 | struct acpi_object_integer *index; | ||
191 | union acpi_operand_object *target; | ||
192 | |||
193 | } index; | ||
194 | |||
195 | struct | ||
196 | { | ||
197 | union acpi_operand_object *source; | ||
198 | struct acpi_object_integer *index; | ||
199 | struct acpi_object_integer *length; | ||
200 | union acpi_operand_object *target; | ||
201 | |||
202 | } mid; | ||
203 | }; | ||
204 | |||
205 | |||
206 | /* Internal method parameter list */ | ||
207 | |||
208 | struct acpi_parameter_info | ||
209 | { | ||
210 | struct acpi_namespace_node *node; | ||
211 | union acpi_operand_object **parameters; | ||
212 | union acpi_operand_object *return_object; | ||
213 | u8 parameter_type; | ||
214 | u8 return_object_type; | ||
215 | }; | ||
216 | |||
217 | /* Types for parameter_type above */ | ||
218 | |||
219 | #define ACPI_PARAM_ARGS 0 | ||
220 | #define ACPI_PARAM_GPE 1 | ||
221 | |||
222 | |||
223 | #endif | ||
diff --git a/include/acpi/actables.h b/include/acpi/actables.h new file mode 100644 index 000000000000..e8f5d4ffd452 --- /dev/null +++ b/include/acpi/actables.h | |||
@@ -0,0 +1,235 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: actables.h - ACPI table management | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACTABLES_H__ | ||
45 | #define __ACTABLES_H__ | ||
46 | |||
47 | |||
48 | /* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */ | ||
49 | |||
50 | #define SIZE_IN_HEADER 0 | ||
51 | |||
52 | |||
53 | #ifdef ACPI_FUTURE_USAGE | ||
54 | acpi_status | ||
55 | acpi_tb_handle_to_object ( | ||
56 | u16 table_id, | ||
57 | struct acpi_table_desc **table_desc); | ||
58 | #endif | ||
59 | |||
60 | /* | ||
61 | * tbconvrt - Table conversion routines | ||
62 | */ | ||
63 | |||
64 | acpi_status | ||
65 | acpi_tb_convert_to_xsdt ( | ||
66 | struct acpi_table_desc *table_info); | ||
67 | |||
68 | acpi_status | ||
69 | acpi_tb_convert_table_fadt ( | ||
70 | void); | ||
71 | |||
72 | acpi_status | ||
73 | acpi_tb_build_common_facs ( | ||
74 | struct acpi_table_desc *table_info); | ||
75 | |||
76 | u32 | ||
77 | acpi_tb_get_table_count ( | ||
78 | struct rsdp_descriptor *RSDP, | ||
79 | struct acpi_table_header *RSDT); | ||
80 | |||
81 | /* | ||
82 | * tbget - Table "get" routines | ||
83 | */ | ||
84 | |||
85 | acpi_status | ||
86 | acpi_tb_get_table ( | ||
87 | struct acpi_pointer *address, | ||
88 | struct acpi_table_desc *table_info); | ||
89 | |||
90 | acpi_status | ||
91 | acpi_tb_get_table_header ( | ||
92 | struct acpi_pointer *address, | ||
93 | struct acpi_table_header *return_header); | ||
94 | |||
95 | acpi_status | ||
96 | acpi_tb_get_table_body ( | ||
97 | struct acpi_pointer *address, | ||
98 | struct acpi_table_header *header, | ||
99 | struct acpi_table_desc *table_info); | ||
100 | |||
101 | acpi_status | ||
102 | acpi_tb_get_this_table ( | ||
103 | struct acpi_pointer *address, | ||
104 | struct acpi_table_header *header, | ||
105 | struct acpi_table_desc *table_info); | ||
106 | |||
107 | acpi_status | ||
108 | acpi_tb_table_override ( | ||
109 | struct acpi_table_header *header, | ||
110 | struct acpi_table_desc *table_info); | ||
111 | |||
112 | acpi_status | ||
113 | acpi_tb_get_table_ptr ( | ||
114 | acpi_table_type table_type, | ||
115 | u32 instance, | ||
116 | struct acpi_table_header **table_ptr_loc); | ||
117 | |||
118 | acpi_status | ||
119 | acpi_tb_verify_rsdp ( | ||
120 | struct acpi_pointer *address); | ||
121 | |||
122 | void | ||
123 | acpi_tb_get_rsdt_address ( | ||
124 | struct acpi_pointer *out_address); | ||
125 | |||
126 | acpi_status | ||
127 | acpi_tb_validate_rsdt ( | ||
128 | struct acpi_table_header *table_ptr); | ||
129 | |||
130 | acpi_status | ||
131 | acpi_tb_get_required_tables ( | ||
132 | void); | ||
133 | |||
134 | acpi_status | ||
135 | acpi_tb_get_primary_table ( | ||
136 | struct acpi_pointer *address, | ||
137 | struct acpi_table_desc *table_info); | ||
138 | |||
139 | acpi_status | ||
140 | acpi_tb_get_secondary_table ( | ||
141 | struct acpi_pointer *address, | ||
142 | acpi_string signature, | ||
143 | struct acpi_table_desc *table_info); | ||
144 | |||
145 | /* | ||
146 | * tbinstall - Table installation | ||
147 | */ | ||
148 | |||
149 | acpi_status | ||
150 | acpi_tb_install_table ( | ||
151 | struct acpi_table_desc *table_info); | ||
152 | |||
153 | acpi_status | ||
154 | acpi_tb_match_signature ( | ||
155 | char *signature, | ||
156 | struct acpi_table_desc *table_info, | ||
157 | u8 search_type); | ||
158 | |||
159 | acpi_status | ||
160 | acpi_tb_recognize_table ( | ||
161 | struct acpi_table_desc *table_info, | ||
162 | u8 search_type); | ||
163 | |||
164 | acpi_status | ||
165 | acpi_tb_init_table_descriptor ( | ||
166 | acpi_table_type table_type, | ||
167 | struct acpi_table_desc *table_info); | ||
168 | |||
169 | |||
170 | /* | ||
171 | * tbremove - Table removal and deletion | ||
172 | */ | ||
173 | |||
174 | void | ||
175 | acpi_tb_delete_all_tables ( | ||
176 | void); | ||
177 | |||
178 | void | ||
179 | acpi_tb_delete_tables_by_type ( | ||
180 | acpi_table_type type); | ||
181 | |||
182 | void | ||
183 | acpi_tb_delete_single_table ( | ||
184 | struct acpi_table_desc *table_desc); | ||
185 | |||
186 | struct acpi_table_desc * | ||
187 | acpi_tb_uninstall_table ( | ||
188 | struct acpi_table_desc *table_desc); | ||
189 | |||
190 | |||
191 | /* | ||
192 | * tbrsd - RSDP, RSDT utilities | ||
193 | */ | ||
194 | |||
195 | acpi_status | ||
196 | acpi_tb_get_table_rsdt ( | ||
197 | void); | ||
198 | |||
199 | u8 * | ||
200 | acpi_tb_scan_memory_for_rsdp ( | ||
201 | u8 *start_address, | ||
202 | u32 length); | ||
203 | |||
204 | acpi_status | ||
205 | acpi_tb_find_rsdp ( | ||
206 | struct acpi_table_desc *table_info, | ||
207 | u32 flags); | ||
208 | |||
209 | |||
210 | /* | ||
211 | * tbutils - common table utilities | ||
212 | */ | ||
213 | |||
214 | acpi_status | ||
215 | acpi_tb_find_table ( | ||
216 | char *signature, | ||
217 | char *oem_id, | ||
218 | char *oem_table_id, | ||
219 | struct acpi_table_header **table_ptr); | ||
220 | |||
221 | acpi_status | ||
222 | acpi_tb_verify_table_checksum ( | ||
223 | struct acpi_table_header *table_header); | ||
224 | |||
225 | u8 | ||
226 | acpi_tb_checksum ( | ||
227 | void *buffer, | ||
228 | u32 length); | ||
229 | |||
230 | acpi_status | ||
231 | acpi_tb_validate_table_header ( | ||
232 | struct acpi_table_header *table_header); | ||
233 | |||
234 | |||
235 | #endif /* __ACTABLES_H__ */ | ||
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h new file mode 100644 index 000000000000..7eee731112b1 --- /dev/null +++ b/include/acpi/actbl.h | |||
@@ -0,0 +1,354 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: actbl.h - Table data structures defined in ACPI specification | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACTBL_H__ | ||
45 | #define __ACTBL_H__ | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Values for description table header signatures | ||
50 | */ | ||
51 | #define RSDP_NAME "RSDP" | ||
52 | #define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ | ||
53 | #define APIC_SIG "APIC" /* Multiple APIC Description Table */ | ||
54 | #define DSDT_SIG "DSDT" /* Differentiated System Description Table */ | ||
55 | #define FADT_SIG "FACP" /* Fixed ACPI Description Table */ | ||
56 | #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ | ||
57 | #define PSDT_SIG "PSDT" /* Persistent System Description Table */ | ||
58 | #define RSDT_SIG "RSDT" /* Root System Description Table */ | ||
59 | #define XSDT_SIG "XSDT" /* Extended System Description Table */ | ||
60 | #define SSDT_SIG "SSDT" /* Secondary System Description Table */ | ||
61 | #define SBST_SIG "SBST" /* Smart Battery Specification Table */ | ||
62 | #define SPIC_SIG "SPIC" /* IOSAPIC table */ | ||
63 | #define BOOT_SIG "BOOT" /* Boot table */ | ||
64 | |||
65 | |||
66 | #define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ | ||
67 | |||
68 | |||
69 | /* | ||
70 | * Common table types. The base code can remain | ||
71 | * constant if the underlying tables are changed | ||
72 | */ | ||
73 | #define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2 | ||
74 | #define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2 | ||
75 | #define FACS_DESCRIPTOR struct facs_descriptor_rev2 | ||
76 | #define FADT_DESCRIPTOR struct fadt_descriptor_rev2 | ||
77 | |||
78 | |||
79 | #pragma pack(1) | ||
80 | |||
81 | /* | ||
82 | * ACPI Version-independent tables | ||
83 | * | ||
84 | * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) | ||
85 | * are in separate files. | ||
86 | */ | ||
87 | struct rsdp_descriptor /* Root System Descriptor Pointer */ | ||
88 | { | ||
89 | char signature [8]; /* ACPI signature, contains "RSD PTR " */ | ||
90 | u8 checksum; /* To make sum of struct == 0 */ | ||
91 | char oem_id [6]; /* OEM identification */ | ||
92 | u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */ | ||
93 | u32 rsdt_physical_address; /* 32-bit physical address of RSDT */ | ||
94 | u32 length; /* XSDT Length in bytes including hdr */ | ||
95 | u64 xsdt_physical_address; /* 64-bit physical address of XSDT */ | ||
96 | u8 extended_checksum; /* Checksum of entire table */ | ||
97 | char reserved [3]; /* Reserved field must be 0 */ | ||
98 | }; | ||
99 | |||
100 | |||
101 | struct acpi_common_facs /* Common FACS for internal use */ | ||
102 | { | ||
103 | u32 *global_lock; | ||
104 | u64 *firmware_waking_vector; | ||
105 | u8 vector_width; | ||
106 | }; | ||
107 | |||
108 | |||
109 | #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ | ||
110 | char signature [4]; /* ACPI signature (4 ASCII characters) */\ | ||
111 | u32 length; /* Length of table, in bytes, including header */\ | ||
112 | u8 revision; /* ACPI Specification minor version # */\ | ||
113 | u8 checksum; /* To make sum of entire table == 0 */\ | ||
114 | char oem_id [6]; /* OEM identification */\ | ||
115 | char oem_table_id [8]; /* OEM table identification */\ | ||
116 | u32 oem_revision; /* OEM revision number */\ | ||
117 | char asl_compiler_id [4]; /* ASL compiler vendor ID */\ | ||
118 | u32 asl_compiler_revision; /* ASL compiler revision number */ | ||
119 | |||
120 | |||
121 | struct acpi_table_header /* ACPI common table header */ | ||
122 | { | ||
123 | ACPI_TABLE_HEADER_DEF | ||
124 | }; | ||
125 | |||
126 | |||
127 | /* | ||
128 | * MADT values and structures | ||
129 | */ | ||
130 | |||
131 | /* Values for MADT PCATCompat */ | ||
132 | |||
133 | #define DUAL_PIC 0 | ||
134 | #define MULTIPLE_APIC 1 | ||
135 | |||
136 | |||
137 | /* Master MADT */ | ||
138 | |||
139 | struct multiple_apic_table | ||
140 | { | ||
141 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
142 | u32 local_apic_address; /* Physical address of local APIC */ | ||
143 | u32 PCATcompat : 1; /* A one indicates system also has dual 8259s */ | ||
144 | u32 reserved1 : 31; | ||
145 | }; | ||
146 | |||
147 | |||
148 | /* Values for Type in APIC_HEADER_DEF */ | ||
149 | |||
150 | #define APIC_PROCESSOR 0 | ||
151 | #define APIC_IO 1 | ||
152 | #define APIC_XRUPT_OVERRIDE 2 | ||
153 | #define APIC_NMI 3 | ||
154 | #define APIC_LOCAL_NMI 4 | ||
155 | #define APIC_ADDRESS_OVERRIDE 5 | ||
156 | #define APIC_IO_SAPIC 6 | ||
157 | #define APIC_LOCAL_SAPIC 7 | ||
158 | #define APIC_XRUPT_SOURCE 8 | ||
159 | #define APIC_RESERVED 9 /* 9 and greater are reserved */ | ||
160 | |||
161 | /* | ||
162 | * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) | ||
163 | */ | ||
164 | #define APIC_HEADER_DEF /* Common APIC sub-structure header */\ | ||
165 | u8 type; \ | ||
166 | u8 length; | ||
167 | |||
168 | struct apic_header | ||
169 | { | ||
170 | APIC_HEADER_DEF | ||
171 | }; | ||
172 | |||
173 | /* Values for MPS INTI flags */ | ||
174 | |||
175 | #define POLARITY_CONFORMS 0 | ||
176 | #define POLARITY_ACTIVE_HIGH 1 | ||
177 | #define POLARITY_RESERVED 2 | ||
178 | #define POLARITY_ACTIVE_LOW 3 | ||
179 | |||
180 | #define TRIGGER_CONFORMS 0 | ||
181 | #define TRIGGER_EDGE 1 | ||
182 | #define TRIGGER_RESERVED 2 | ||
183 | #define TRIGGER_LEVEL 3 | ||
184 | |||
185 | /* Common flag definitions */ | ||
186 | |||
187 | #define MPS_INTI_FLAGS \ | ||
188 | u16 polarity : 2; /* Polarity of APIC I/O input signals */\ | ||
189 | u16 trigger_mode : 2; /* Trigger mode of APIC input signals */\ | ||
190 | u16 reserved1 : 12; /* Reserved, must be zero */ | ||
191 | |||
192 | #define LOCAL_APIC_FLAGS \ | ||
193 | u32 processor_enabled: 1; /* Processor is usable if set */\ | ||
194 | u32 reserved2 : 31; /* Reserved, must be zero */ | ||
195 | |||
196 | /* Sub-structures for MADT */ | ||
197 | |||
198 | struct madt_processor_apic | ||
199 | { | ||
200 | APIC_HEADER_DEF | ||
201 | u8 processor_id; /* ACPI processor id */ | ||
202 | u8 local_apic_id; /* Processor's local APIC id */ | ||
203 | LOCAL_APIC_FLAGS | ||
204 | }; | ||
205 | |||
206 | struct madt_io_apic | ||
207 | { | ||
208 | APIC_HEADER_DEF | ||
209 | u8 io_apic_id; /* I/O APIC ID */ | ||
210 | u8 reserved; /* Reserved - must be zero */ | ||
211 | u32 address; /* APIC physical address */ | ||
212 | u32 interrupt; /* Global system interrupt where INTI | ||
213 | * lines start */ | ||
214 | }; | ||
215 | |||
216 | struct madt_interrupt_override | ||
217 | { | ||
218 | APIC_HEADER_DEF | ||
219 | u8 bus; /* 0 - ISA */ | ||
220 | u8 source; /* Interrupt source (IRQ) */ | ||
221 | u32 interrupt; /* Global system interrupt */ | ||
222 | MPS_INTI_FLAGS | ||
223 | }; | ||
224 | |||
225 | struct madt_nmi_source | ||
226 | { | ||
227 | APIC_HEADER_DEF | ||
228 | MPS_INTI_FLAGS | ||
229 | u32 interrupt; /* Global system interrupt */ | ||
230 | }; | ||
231 | |||
232 | struct madt_local_apic_nmi | ||
233 | { | ||
234 | APIC_HEADER_DEF | ||
235 | u8 processor_id; /* ACPI processor id */ | ||
236 | MPS_INTI_FLAGS | ||
237 | u8 lint; /* LINTn to which NMI is connected */ | ||
238 | }; | ||
239 | |||
240 | struct madt_address_override | ||
241 | { | ||
242 | APIC_HEADER_DEF | ||
243 | u16 reserved; /* Reserved - must be zero */ | ||
244 | u64 address; /* APIC physical address */ | ||
245 | }; | ||
246 | |||
247 | struct madt_io_sapic | ||
248 | { | ||
249 | APIC_HEADER_DEF | ||
250 | u8 io_sapic_id; /* I/O SAPIC ID */ | ||
251 | u8 reserved; /* Reserved - must be zero */ | ||
252 | u32 interrupt_base; /* Glocal interrupt for SAPIC start */ | ||
253 | u64 address; /* SAPIC physical address */ | ||
254 | }; | ||
255 | |||
256 | struct madt_local_sapic | ||
257 | { | ||
258 | APIC_HEADER_DEF | ||
259 | u8 processor_id; /* ACPI processor id */ | ||
260 | u8 local_sapic_id; /* SAPIC ID */ | ||
261 | u8 local_sapic_eid; /* SAPIC EID */ | ||
262 | u8 reserved [3]; /* Reserved - must be zero */ | ||
263 | LOCAL_APIC_FLAGS | ||
264 | u32 processor_uID; /* Numeric UID - ACPI 3.0 */ | ||
265 | char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ | ||
266 | }; | ||
267 | |||
268 | struct madt_interrupt_source | ||
269 | { | ||
270 | APIC_HEADER_DEF | ||
271 | MPS_INTI_FLAGS | ||
272 | u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ | ||
273 | u8 processor_id; /* Processor ID */ | ||
274 | u8 processor_eid; /* Processor EID */ | ||
275 | u8 io_sapic_vector; /* Vector value for PMI interrupts */ | ||
276 | u32 interrupt; /* Global system interrupt */ | ||
277 | u32 flags; /* Interrupt Source Flags */ | ||
278 | }; | ||
279 | |||
280 | |||
281 | /* | ||
282 | * Smart Battery | ||
283 | */ | ||
284 | struct smart_battery_table | ||
285 | { | ||
286 | ACPI_TABLE_HEADER_DEF | ||
287 | u32 warning_level; | ||
288 | u32 low_level; | ||
289 | u32 critical_level; | ||
290 | }; | ||
291 | |||
292 | |||
293 | #pragma pack() | ||
294 | |||
295 | |||
296 | /* | ||
297 | * ACPI Table information. We save the table address, length, | ||
298 | * and type of memory allocation (mapped or allocated) for each | ||
299 | * table for 1) when we exit, and 2) if a new table is installed | ||
300 | */ | ||
301 | #define ACPI_MEM_NOT_ALLOCATED 0 | ||
302 | #define ACPI_MEM_ALLOCATED 1 | ||
303 | #define ACPI_MEM_MAPPED 2 | ||
304 | |||
305 | /* Definitions for the Flags bitfield member of struct acpi_table_support */ | ||
306 | |||
307 | #define ACPI_TABLE_SINGLE 0x00 | ||
308 | #define ACPI_TABLE_MULTIPLE 0x01 | ||
309 | #define ACPI_TABLE_EXECUTABLE 0x02 | ||
310 | |||
311 | #define ACPI_TABLE_ROOT 0x00 | ||
312 | #define ACPI_TABLE_PRIMARY 0x10 | ||
313 | #define ACPI_TABLE_SECONDARY 0x20 | ||
314 | #define ACPI_TABLE_ALL 0x30 | ||
315 | #define ACPI_TABLE_TYPE_MASK 0x30 | ||
316 | |||
317 | /* Data about each known table type */ | ||
318 | |||
319 | struct acpi_table_support | ||
320 | { | ||
321 | char *name; | ||
322 | char *signature; | ||
323 | void **global_ptr; | ||
324 | u8 sig_length; | ||
325 | u8 flags; | ||
326 | }; | ||
327 | |||
328 | |||
329 | /* | ||
330 | * Get the ACPI version-specific tables | ||
331 | */ | ||
332 | #include "actbl1.h" /* Acpi 1.0 table definitions */ | ||
333 | #include "actbl2.h" /* Acpi 2.0 table definitions */ | ||
334 | |||
335 | extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, | ||
336 | * needed for certain workarounds */ | ||
337 | |||
338 | #pragma pack(1) | ||
339 | /* | ||
340 | * High performance timer | ||
341 | */ | ||
342 | struct hpet_table | ||
343 | { | ||
344 | ACPI_TABLE_HEADER_DEF | ||
345 | u32 hardware_id; | ||
346 | struct acpi_generic_address base_address; | ||
347 | u8 hpet_number; | ||
348 | u16 clock_tick; | ||
349 | u8 attributes; | ||
350 | }; | ||
351 | |||
352 | #pragma pack() | ||
353 | |||
354 | #endif /* __ACTBL_H__ */ | ||
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h new file mode 100644 index 000000000000..33de5f4d2ccc --- /dev/null +++ b/include/acpi/actbl1.h | |||
@@ -0,0 +1,136 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: actbl1.h - ACPI 1.0 tables | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACTBL1_H__ | ||
45 | #define __ACTBL1_H__ | ||
46 | |||
47 | #pragma pack(1) | ||
48 | |||
49 | /* | ||
50 | * ACPI 1.0 Root System Description Table (RSDT) | ||
51 | */ | ||
52 | struct rsdt_descriptor_rev1 | ||
53 | { | ||
54 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
55 | u32 table_offset_entry [1]; /* Array of pointers to other */ | ||
56 | /* ACPI tables */ | ||
57 | }; | ||
58 | |||
59 | |||
60 | /* | ||
61 | * ACPI 1.0 Firmware ACPI Control Structure (FACS) | ||
62 | */ | ||
63 | struct facs_descriptor_rev1 | ||
64 | { | ||
65 | char signature[4]; /* ACPI Signature */ | ||
66 | u32 length; /* Length of structure, in bytes */ | ||
67 | u32 hardware_signature; /* Hardware configuration signature */ | ||
68 | u32 firmware_waking_vector; /* ACPI OS waking vector */ | ||
69 | u32 global_lock; /* Global Lock */ | ||
70 | u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ | ||
71 | u32 reserved1 : 31; /* Must be 0 */ | ||
72 | u8 resverved3 [40]; /* Reserved - must be zero */ | ||
73 | }; | ||
74 | |||
75 | |||
76 | /* | ||
77 | * ACPI 1.0 Fixed ACPI Description Table (FADT) | ||
78 | */ | ||
79 | struct fadt_descriptor_rev1 | ||
80 | { | ||
81 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
82 | u32 firmware_ctrl; /* Physical address of FACS */ | ||
83 | u32 dsdt; /* Physical address of DSDT */ | ||
84 | u8 model; /* System Interrupt Model */ | ||
85 | u8 reserved1; /* Reserved */ | ||
86 | u16 sci_int; /* System vector of SCI interrupt */ | ||
87 | u32 smi_cmd; /* Port address of SMI command port */ | ||
88 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ | ||
89 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ | ||
90 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ | ||
91 | u8 reserved2; /* Reserved - must be zero */ | ||
92 | u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ | ||
93 | u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ | ||
94 | u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ | ||
95 | u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ | ||
96 | u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ | ||
97 | u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ | ||
98 | u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ | ||
99 | u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ | ||
100 | u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ | ||
101 | u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ | ||
102 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ | ||
103 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ | ||
104 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ | ||
105 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ | ||
106 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ | ||
107 | u8 reserved3; /* Reserved */ | ||
108 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ | ||
109 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ | ||
110 | u16 flush_size; /* Size of area read to flush caches */ | ||
111 | u16 flush_stride; /* Stride used in flushing caches */ | ||
112 | u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ | ||
113 | u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ | ||
114 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ | ||
115 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ | ||
116 | u8 century; /* Index to century in RTC CMOS RAM */ | ||
117 | u8 reserved4; /* Reserved */ | ||
118 | u8 reserved4a; /* Reserved */ | ||
119 | u8 reserved4b; /* Reserved */ | ||
120 | u32 wb_invd : 1; /* The wbinvd instruction works properly */ | ||
121 | u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ | ||
122 | u32 proc_c1 : 1; /* All processors support C1 state */ | ||
123 | u32 plvl2_up : 1; /* C2 state works on MP system */ | ||
124 | u32 pwr_button : 1; /* Power button is handled as a generic feature */ | ||
125 | u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ | ||
126 | u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ | ||
127 | u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ | ||
128 | u32 tmr_val_ext : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */ | ||
129 | u32 reserved5 : 23; /* Reserved - must be zero */ | ||
130 | }; | ||
131 | |||
132 | #pragma pack() | ||
133 | |||
134 | #endif /* __ACTBL1_H__ */ | ||
135 | |||
136 | |||
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h new file mode 100644 index 000000000000..e1729c967e05 --- /dev/null +++ b/include/acpi/actbl2.h | |||
@@ -0,0 +1,289 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: actbl2.h - ACPI Specification Revision 2.0 Tables | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACTBL2_H__ | ||
45 | #define __ACTBL2_H__ | ||
46 | |||
47 | /* | ||
48 | * Prefered Power Management Profiles | ||
49 | */ | ||
50 | #define PM_UNSPECIFIED 0 | ||
51 | #define PM_DESKTOP 1 | ||
52 | #define PM_MOBILE 2 | ||
53 | #define PM_WORKSTATION 3 | ||
54 | #define PM_ENTERPRISE_SERVER 4 | ||
55 | #define PM_SOHO_SERVER 5 | ||
56 | #define PM_APPLIANCE_PC 6 | ||
57 | |||
58 | /* | ||
59 | * ACPI Boot Arch Flags | ||
60 | */ | ||
61 | #define BAF_LEGACY_DEVICES 0x0001 | ||
62 | #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 | ||
63 | |||
64 | #define FADT2_REVISION_ID 3 | ||
65 | #define FADT2_MINUS_REVISION_ID 2 | ||
66 | |||
67 | |||
68 | #pragma pack(1) | ||
69 | |||
70 | /* | ||
71 | * ACPI 2.0 Root System Description Table (RSDT) | ||
72 | */ | ||
73 | struct rsdt_descriptor_rev2 | ||
74 | { | ||
75 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
76 | u32 table_offset_entry [1]; /* Array of pointers to */ | ||
77 | /* ACPI table headers */ | ||
78 | }; | ||
79 | |||
80 | |||
81 | /* | ||
82 | * ACPI 2.0 Extended System Description Table (XSDT) | ||
83 | */ | ||
84 | struct xsdt_descriptor_rev2 | ||
85 | { | ||
86 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
87 | u64 table_offset_entry [1]; /* Array of pointers to */ | ||
88 | /* ACPI table headers */ | ||
89 | }; | ||
90 | |||
91 | |||
92 | /* | ||
93 | * ACPI 2.0 Firmware ACPI Control Structure (FACS) | ||
94 | */ | ||
95 | struct facs_descriptor_rev2 | ||
96 | { | ||
97 | char signature[4]; /* ACPI signature */ | ||
98 | u32 length; /* Length of structure, in bytes */ | ||
99 | u32 hardware_signature; /* Hardware configuration signature */ | ||
100 | u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */ | ||
101 | u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ | ||
102 | u32 S4bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */ | ||
103 | u32 reserved1 : 31; /* Must be 0 */ | ||
104 | u64 xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */ | ||
105 | u8 version; /* Version of this table */ | ||
106 | u8 reserved3 [31]; /* Reserved - must be zero */ | ||
107 | }; | ||
108 | |||
109 | |||
110 | /* | ||
111 | * ACPI 2.0+ Generic Address Structure (GAS) | ||
112 | */ | ||
113 | struct acpi_generic_address | ||
114 | { | ||
115 | u8 address_space_id; /* Address space where struct or register exists. */ | ||
116 | u8 register_bit_width; /* Size in bits of given register */ | ||
117 | u8 register_bit_offset; /* Bit offset within the register */ | ||
118 | u8 access_width; /* Minimum Access size (ACPI 3.0) */ | ||
119 | u64 address; /* 64-bit address of struct or register */ | ||
120 | }; | ||
121 | |||
122 | |||
123 | #define FADT_REV2_COMMON \ | ||
124 | u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ | ||
125 | u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ | ||
126 | u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ | ||
127 | u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ | ||
128 | u16 sci_int; /* System vector of SCI interrupt */ \ | ||
129 | u32 smi_cmd; /* Port address of SMI command port */ \ | ||
130 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ | ||
131 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ | ||
132 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ | ||
133 | u8 pstate_cnt; /* Processor performance state control*/ \ | ||
134 | u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \ | ||
135 | u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \ | ||
136 | u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ | ||
137 | u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ | ||
138 | u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ | ||
139 | u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ | ||
140 | u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ | ||
141 | u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ | ||
142 | u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \ | ||
143 | u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \ | ||
144 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ | ||
145 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ | ||
146 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ | ||
147 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ | ||
148 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ | ||
149 | u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ | ||
150 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ | ||
151 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ | ||
152 | u16 flush_size; /* Number of flush strides that need to be read */ \ | ||
153 | u16 flush_stride; /* Processor's memory cache line width, in bytes */ \ | ||
154 | u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ | ||
155 | u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ | ||
156 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ | ||
157 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ | ||
158 | u8 century; /* Index to century in RTC CMOS RAM */ \ | ||
159 | u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ | ||
160 | |||
161 | /* | ||
162 | * ACPI 2.0+ Fixed ACPI Description Table (FADT) | ||
163 | */ | ||
164 | struct fadt_descriptor_rev2 | ||
165 | { | ||
166 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
167 | FADT_REV2_COMMON | ||
168 | u8 reserved2; /* Reserved */ | ||
169 | u32 wb_invd : 1; /* The wbinvd instruction works properly */ | ||
170 | u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ | ||
171 | u32 proc_c1 : 1; /* All processors support C1 state */ | ||
172 | u32 plvl2_up : 1; /* C2 state works on MP system */ | ||
173 | u32 pwr_button : 1; /* Power button is handled as a generic feature */ | ||
174 | u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ | ||
175 | u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ | ||
176 | u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ | ||
177 | u32 tmr_val_ext : 1; /* Indicates tmr_val is 32 bits 0=24-bits */ | ||
178 | u32 dock_cap : 1; /* Supports Docking */ | ||
179 | u32 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG */ | ||
180 | u32 sealed_case : 1; /* Indicates system has no internal expansion capabilities and case is sealed */ | ||
181 | u32 headless : 1; /* Indicates system does not have local video capabilities or local input devices */ | ||
182 | u32 cpu_sw_sleep : 1; /* Indicates to OSPM that a processor native instruction */ | ||
183 | /* must be executed after writing the SLP_TYPx register */ | ||
184 | /* ACPI 3.0 flag bits */ | ||
185 | |||
186 | u32 pci_exp_wak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */ | ||
187 | u32 use_platform_clock : 1; /* OSPM should use platform-provided timer */ | ||
188 | u32 S4rtc_sts_valid : 1; /* Contents of RTC_STS valid after S4 wake */ | ||
189 | u32 remote_power_on_capable : 1; /* System is compatible with remote power on */ | ||
190 | u32 force_apic_cluster_model : 1; /* All local APICs must use cluster model */ | ||
191 | u32 force_apic_physical_destination_mode : 1; /* all local x_aPICs must use physical dest mode */ | ||
192 | u32 reserved6 : 12;/* Reserved - must be zero */ | ||
193 | |||
194 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
195 | u8 reset_value; /* Value to write to the reset_register port to reset the system */ | ||
196 | u8 reserved7[3]; /* These three bytes must be zero */ | ||
197 | u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ | ||
198 | u64 Xdsdt; /* 64-bit physical address of DSDT */ | ||
199 | struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ | ||
200 | struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ | ||
201 | struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ | ||
202 | struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ | ||
203 | struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ | ||
204 | struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ | ||
205 | struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ | ||
206 | struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ | ||
207 | }; | ||
208 | |||
209 | |||
210 | /* "Down-revved" ACPI 2.0 FADT descriptor */ | ||
211 | |||
212 | struct fadt_descriptor_rev2_minus | ||
213 | { | ||
214 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
215 | FADT_REV2_COMMON | ||
216 | u8 reserved2; /* Reserved */ | ||
217 | u32 flags; | ||
218 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
219 | u8 reset_value; /* Value to write to the reset_register port to reset the system. */ | ||
220 | u8 reserved7[3]; /* These three bytes must be zero */ | ||
221 | }; | ||
222 | |||
223 | |||
224 | /* ECDT - Embedded Controller Boot Resources Table */ | ||
225 | |||
226 | struct ec_boot_resources | ||
227 | { | ||
228 | ACPI_TABLE_HEADER_DEF | ||
229 | struct acpi_generic_address ec_control; /* Address of EC command/status register */ | ||
230 | struct acpi_generic_address ec_data; /* Address of EC data register */ | ||
231 | u32 uid; /* Unique ID - must be same as the EC _UID method */ | ||
232 | u8 gpe_bit; /* The GPE for the EC */ | ||
233 | u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ | ||
234 | }; | ||
235 | |||
236 | |||
237 | /* SRAT - System Resource Affinity Table */ | ||
238 | |||
239 | struct static_resource_alloc | ||
240 | { | ||
241 | u8 type; | ||
242 | u8 length; | ||
243 | u8 proximity_domain_lo; | ||
244 | u8 apic_id; | ||
245 | u32 enabled :1; | ||
246 | u32 reserved3 :31; | ||
247 | u8 local_sapic_eid; | ||
248 | u8 proximity_domain_hi[3]; | ||
249 | u32 reserved4; | ||
250 | }; | ||
251 | |||
252 | struct memory_affinity | ||
253 | { | ||
254 | u8 type; | ||
255 | u8 length; | ||
256 | u32 proximity_domain; | ||
257 | u16 reserved3; | ||
258 | u64 base_address; | ||
259 | u64 address_length; | ||
260 | u32 reserved4; | ||
261 | u32 enabled :1; | ||
262 | u32 hot_pluggable :1; | ||
263 | u32 non_volatile :1; | ||
264 | u32 reserved5 :29; | ||
265 | u64 reserved6; | ||
266 | }; | ||
267 | |||
268 | struct system_resource_affinity | ||
269 | { | ||
270 | ACPI_TABLE_HEADER_DEF | ||
271 | u32 reserved1; /* Must be value '1' */ | ||
272 | u64 reserved2; | ||
273 | }; | ||
274 | |||
275 | |||
276 | /* SLIT - System Locality Distance Information Table */ | ||
277 | |||
278 | struct system_locality_info | ||
279 | { | ||
280 | ACPI_TABLE_HEADER_DEF | ||
281 | u64 locality_count; | ||
282 | u8 entry[1][1]; | ||
283 | }; | ||
284 | |||
285 | |||
286 | #pragma pack() | ||
287 | |||
288 | #endif /* __ACTBL2_H__ */ | ||
289 | |||
diff --git a/include/acpi/actbl71.h b/include/acpi/actbl71.h new file mode 100644 index 000000000000..7b4fb44261f3 --- /dev/null +++ b/include/acpi/actbl71.h | |||
@@ -0,0 +1,144 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71 | ||
4 | * This file includes tables specific to this | ||
5 | * specification revision. | ||
6 | * | ||
7 | *****************************************************************************/ | ||
8 | |||
9 | /* | ||
10 | * Copyright (C) 2000 - 2003, R. Byron Moore | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
25 | */ | ||
26 | |||
27 | #ifndef __ACTBL71_H__ | ||
28 | #define __ACTBL71_H__ | ||
29 | |||
30 | |||
31 | /* 0.71 FADT address_space data item bitmasks defines */ | ||
32 | /* If the associated bit is zero then it is in memory space else in io space */ | ||
33 | |||
34 | #define SMI_CMD_ADDRESS_SPACE 0x01 | ||
35 | #define PM1_BLK_ADDRESS_SPACE 0x02 | ||
36 | #define PM2_CNT_BLK_ADDRESS_SPACE 0x04 | ||
37 | #define PM_TMR_BLK_ADDRESS_SPACE 0x08 | ||
38 | #define GPE0_BLK_ADDRESS_SPACE 0x10 | ||
39 | #define GPE1_BLK_ADDRESS_SPACE 0x20 | ||
40 | |||
41 | /* Only for clarity in declarations */ | ||
42 | |||
43 | typedef u64 IO_ADDRESS; | ||
44 | |||
45 | |||
46 | #pragma pack(1) | ||
47 | struct /* Root System Descriptor Pointer */ | ||
48 | { | ||
49 | NATIVE_CHAR signature [8]; /* contains "RSD PTR " */ | ||
50 | u8 checksum; /* to make sum of struct == 0 */ | ||
51 | NATIVE_CHAR oem_id [6]; /* OEM identification */ | ||
52 | u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */ | ||
53 | u64 rsdt_physical_address; /* 64-bit physical address of RSDT */ | ||
54 | }; | ||
55 | |||
56 | |||
57 | /*****************************************/ | ||
58 | /* IA64 Extensions to ACPI Spec Rev 0.71 */ | ||
59 | /* for the Root System Description Table */ | ||
60 | /*****************************************/ | ||
61 | struct | ||
62 | { | ||
63 | struct acpi_table_header header; /* Table header */ | ||
64 | u32 reserved_pad; /* IA64 alignment, must be 0 */ | ||
65 | u64 table_offset_entry [1]; /* Array of pointers to other */ | ||
66 | /* tables' headers */ | ||
67 | }; | ||
68 | |||
69 | |||
70 | /*******************************************/ | ||
71 | /* IA64 Extensions to ACPI Spec Rev 0.71 */ | ||
72 | /* for the Firmware ACPI Control Structure */ | ||
73 | /*******************************************/ | ||
74 | struct | ||
75 | { | ||
76 | NATIVE_CHAR signature[4]; /* signature "FACS" */ | ||
77 | u32 length; /* length of structure, in bytes */ | ||
78 | u32 hardware_signature; /* hardware configuration signature */ | ||
79 | u32 reserved4; /* must be 0 */ | ||
80 | u64 firmware_waking_vector; /* ACPI OS waking vector */ | ||
81 | u64 global_lock; /* Global Lock */ | ||
82 | u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ | ||
83 | u32 reserved1 : 31; /* must be 0 */ | ||
84 | u8 reserved3 [28]; /* reserved - must be zero */ | ||
85 | }; | ||
86 | |||
87 | |||
88 | /******************************************/ | ||
89 | /* IA64 Extensions to ACPI Spec Rev 0.71 */ | ||
90 | /* for the Fixed ACPI Description Table */ | ||
91 | /******************************************/ | ||
92 | struct | ||
93 | { | ||
94 | struct acpi_table_header header; /* table header */ | ||
95 | u32 reserved_pad; /* IA64 alignment, must be 0 */ | ||
96 | u64 firmware_ctrl; /* 64-bit Physical address of FACS */ | ||
97 | u64 dsdt; /* 64-bit Physical address of DSDT */ | ||
98 | u8 model; /* System Interrupt Model */ | ||
99 | u8 address_space; /* Address Space Bitmask */ | ||
100 | u16 sci_int; /* System vector of SCI interrupt */ | ||
101 | u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */ | ||
102 | u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */ | ||
103 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ | ||
104 | u8 reserved2; /* reserved - must be zero */ | ||
105 | u64 smi_cmd; /* Port address of SMI command port */ | ||
106 | u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ | ||
107 | u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ | ||
108 | u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ | ||
109 | u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ | ||
110 | u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ | ||
111 | u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ | ||
112 | u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ | ||
113 | u64 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ | ||
114 | u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ | ||
115 | u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ | ||
116 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ | ||
117 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ | ||
118 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ | ||
119 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ | ||
120 | u8 gpe1_base; /* offset in gpe model where gpe1 events start */ | ||
121 | u8 reserved3; /* reserved */ | ||
122 | u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */ | ||
123 | u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ | ||
124 | u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */ | ||
125 | u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */ | ||
126 | u8 century; /* index to century in RTC CMOS RAM */ | ||
127 | u8 reserved4; /* reserved */ | ||
128 | u32 flush_cash : 1; /* PAL_FLUSH_CACHE is correctly supported */ | ||
129 | u32 reserved5 : 1; /* reserved - must be zero */ | ||
130 | u32 proc_c1 : 1; /* all processors support C1 state */ | ||
131 | u32 plvl2_up : 1; /* C2 state works on MP system */ | ||
132 | u32 pwr_button : 1; /* Power button is handled as a generic feature */ | ||
133 | u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ | ||
134 | u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ | ||
135 | u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ | ||
136 | u32 tmr_val_ext : 1; /* tmr_val is 32 bits */ | ||
137 | u32 dock_cap : 1; /* Supports Docking */ | ||
138 | u32 reserved6 : 22; /* reserved - must be zero */ | ||
139 | }; | ||
140 | |||
141 | #pragma pack() | ||
142 | |||
143 | #endif /* __ACTBL71_H__ */ | ||
144 | |||
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h new file mode 100644 index 000000000000..7acb550af3eb --- /dev/null +++ b/include/acpi/actypes.h | |||
@@ -0,0 +1,1304 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: actypes.h - Common data types for the entire ACPI subsystem | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACTYPES_H__ | ||
45 | #define __ACTYPES_H__ | ||
46 | |||
47 | /*! [Begin] no source code translation (keep the typedefs) */ | ||
48 | |||
49 | |||
50 | |||
51 | /* | ||
52 | * Data type ranges | ||
53 | * Note: These macros are designed to be compiler independent as well as | ||
54 | * working around problems that some 32-bit compilers have with 64-bit | ||
55 | * constants. | ||
56 | */ | ||
57 | #define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ | ||
58 | #define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ | ||
59 | #define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ | ||
60 | #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ | ||
61 | #define ACPI_ASCII_MAX 0x7F | ||
62 | |||
63 | |||
64 | #ifdef DEFINE_ALTERNATE_TYPES | ||
65 | /* | ||
66 | * Types used only in translated source, defined here to enable | ||
67 | * cross-platform compilation only. | ||
68 | */ | ||
69 | typedef int s32; | ||
70 | typedef unsigned char u8; | ||
71 | typedef unsigned short u16; | ||
72 | typedef unsigned int u32; | ||
73 | typedef COMPILER_DEPENDENT_UINT64 u64; | ||
74 | |||
75 | #endif | ||
76 | |||
77 | |||
78 | /* | ||
79 | * Data types - Fixed across all compilation models (16/32/64) | ||
80 | * | ||
81 | * BOOLEAN Logical Boolean. | ||
82 | * INT8 8-bit (1 byte) signed value | ||
83 | * UINT8 8-bit (1 byte) unsigned value | ||
84 | * INT16 16-bit (2 byte) signed value | ||
85 | * UINT16 16-bit (2 byte) unsigned value | ||
86 | * INT32 32-bit (4 byte) signed value | ||
87 | * UINT32 32-bit (4 byte) unsigned value | ||
88 | * INT64 64-bit (8 byte) signed value | ||
89 | * UINT64 64-bit (8 byte) unsigned value | ||
90 | * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value | ||
91 | * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value | ||
92 | */ | ||
93 | |||
94 | #ifndef ACPI_MACHINE_WIDTH | ||
95 | #error ACPI_MACHINE_WIDTH not defined | ||
96 | #endif | ||
97 | |||
98 | #if ACPI_MACHINE_WIDTH == 64 | ||
99 | |||
100 | /*! [Begin] no source code translation (keep the typedefs) */ | ||
101 | |||
102 | /* | ||
103 | * 64-bit type definitions | ||
104 | */ | ||
105 | typedef unsigned char UINT8; | ||
106 | typedef unsigned char BOOLEAN; | ||
107 | typedef unsigned short UINT16; | ||
108 | typedef int INT32; | ||
109 | typedef unsigned int UINT32; | ||
110 | typedef COMPILER_DEPENDENT_INT64 INT64; | ||
111 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | ||
112 | |||
113 | /*! [End] no source code translation !*/ | ||
114 | |||
115 | typedef s64 acpi_native_int; | ||
116 | typedef u64 acpi_native_uint; | ||
117 | |||
118 | typedef u64 acpi_table_ptr; | ||
119 | typedef u64 acpi_io_address; | ||
120 | typedef u64 acpi_physical_address; | ||
121 | typedef u64 acpi_size; | ||
122 | |||
123 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ | ||
124 | #define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ | ||
125 | #define ACPI_MAX_PTR ACPI_UINT64_MAX | ||
126 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX | ||
127 | |||
128 | |||
129 | #elif ACPI_MACHINE_WIDTH == 16 | ||
130 | |||
131 | /*! [Begin] no source code translation (keep the typedefs) */ | ||
132 | |||
133 | /* | ||
134 | * 16-bit type definitions | ||
135 | */ | ||
136 | typedef unsigned char UINT8; | ||
137 | typedef unsigned char BOOLEAN; | ||
138 | typedef unsigned int UINT16; | ||
139 | typedef long INT32; | ||
140 | typedef int INT16; | ||
141 | typedef unsigned long UINT32; | ||
142 | |||
143 | struct | ||
144 | { | ||
145 | UINT32 Lo; | ||
146 | UINT32 Hi; | ||
147 | }; | ||
148 | |||
149 | /*! [End] no source code translation !*/ | ||
150 | |||
151 | typedef u16 acpi_native_uint; | ||
152 | typedef s16 acpi_native_int; | ||
153 | |||
154 | typedef u32 acpi_table_ptr; | ||
155 | typedef u32 acpi_io_address; | ||
156 | typedef char *acpi_physical_address; | ||
157 | typedef u16 acpi_size; | ||
158 | |||
159 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 | ||
160 | #define ACPI_MISALIGNED_TRANSFERS | ||
161 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ | ||
162 | #define ACPI_MAX_PTR ACPI_UINT16_MAX | ||
163 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX | ||
164 | |||
165 | /* | ||
166 | * (16-bit only) internal integers must be 32-bits, so | ||
167 | * 64-bit integers cannot be supported | ||
168 | */ | ||
169 | #define ACPI_NO_INTEGER64_SUPPORT | ||
170 | |||
171 | |||
172 | #elif ACPI_MACHINE_WIDTH == 32 | ||
173 | |||
174 | /*! [Begin] no source code translation (keep the typedefs) */ | ||
175 | |||
176 | /* | ||
177 | * 32-bit type definitions (default) | ||
178 | */ | ||
179 | typedef unsigned char UINT8; | ||
180 | typedef unsigned char BOOLEAN; | ||
181 | typedef unsigned short UINT16; | ||
182 | typedef int INT32; | ||
183 | typedef unsigned int UINT32; | ||
184 | typedef COMPILER_DEPENDENT_INT64 INT64; | ||
185 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | ||
186 | |||
187 | /*! [End] no source code translation !*/ | ||
188 | |||
189 | typedef s32 acpi_native_int; | ||
190 | typedef u32 acpi_native_uint; | ||
191 | |||
192 | typedef u64 acpi_table_ptr; | ||
193 | typedef u32 acpi_io_address; | ||
194 | typedef u64 acpi_physical_address; | ||
195 | typedef u32 acpi_size; | ||
196 | |||
197 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | ||
198 | #define ACPI_MISALIGNED_TRANSFERS | ||
199 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | ||
200 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | ||
201 | |||
202 | #else | ||
203 | #error unknown ACPI_MACHINE_WIDTH | ||
204 | #endif | ||
205 | |||
206 | |||
207 | /* | ||
208 | * Miscellaneous common types | ||
209 | */ | ||
210 | typedef u16 UINT16_BIT; | ||
211 | typedef u32 UINT32_BIT; | ||
212 | typedef acpi_native_uint ACPI_PTRDIFF; | ||
213 | |||
214 | /* | ||
215 | * Pointer overlays to avoid lots of typecasting for | ||
216 | * code that accepts both physical and logical pointers. | ||
217 | */ | ||
218 | union acpi_pointers | ||
219 | { | ||
220 | acpi_physical_address physical; | ||
221 | void *logical; | ||
222 | acpi_table_ptr value; | ||
223 | }; | ||
224 | |||
225 | struct acpi_pointer | ||
226 | { | ||
227 | u32 pointer_type; | ||
228 | union acpi_pointers pointer; | ||
229 | }; | ||
230 | |||
231 | /* pointer_types for above */ | ||
232 | |||
233 | #define ACPI_PHYSICAL_POINTER 0x01 | ||
234 | #define ACPI_LOGICAL_POINTER 0x02 | ||
235 | |||
236 | /* Processor mode */ | ||
237 | |||
238 | #define ACPI_PHYSICAL_ADDRESSING 0x04 | ||
239 | #define ACPI_LOGICAL_ADDRESSING 0x08 | ||
240 | #define ACPI_MEMORY_MODE 0x0C | ||
241 | |||
242 | #define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER | ||
243 | #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER | ||
244 | #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER | ||
245 | |||
246 | |||
247 | /* | ||
248 | * Useful defines | ||
249 | */ | ||
250 | #ifdef FALSE | ||
251 | #undef FALSE | ||
252 | #endif | ||
253 | #define FALSE (1 == 0) | ||
254 | |||
255 | #ifdef TRUE | ||
256 | #undef TRUE | ||
257 | #endif | ||
258 | #define TRUE (1 == 1) | ||
259 | |||
260 | #ifndef NULL | ||
261 | #define NULL (void *) 0 | ||
262 | #endif | ||
263 | |||
264 | |||
265 | /* | ||
266 | * Local datatypes | ||
267 | */ | ||
268 | typedef u32 acpi_status; /* All ACPI Exceptions */ | ||
269 | typedef u32 acpi_name; /* 4-byte ACPI name */ | ||
270 | typedef char * acpi_string; /* Null terminated ASCII string */ | ||
271 | typedef void * acpi_handle; /* Actually a ptr to an Node */ | ||
272 | |||
273 | struct uint64_struct | ||
274 | { | ||
275 | u32 lo; | ||
276 | u32 hi; | ||
277 | }; | ||
278 | |||
279 | union uint64_overlay | ||
280 | { | ||
281 | u64 full; | ||
282 | struct uint64_struct part; | ||
283 | }; | ||
284 | |||
285 | struct uint32_struct | ||
286 | { | ||
287 | u32 lo; | ||
288 | u32 hi; | ||
289 | }; | ||
290 | |||
291 | |||
292 | /* | ||
293 | * Acpi integer width. In ACPI version 1, integers are | ||
294 | * 32 bits. In ACPI version 2, integers are 64 bits. | ||
295 | * Note that this pertains to the ACPI integer type only, not | ||
296 | * other integers used in the implementation of the ACPI CA | ||
297 | * subsystem. | ||
298 | */ | ||
299 | #ifdef ACPI_NO_INTEGER64_SUPPORT | ||
300 | |||
301 | /* 32-bit integers only, no 64-bit support */ | ||
302 | |||
303 | typedef u32 acpi_integer; | ||
304 | #define ACPI_INTEGER_MAX ACPI_UINT32_MAX | ||
305 | #define ACPI_INTEGER_BIT_SIZE 32 | ||
306 | #define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ | ||
307 | |||
308 | #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ | ||
309 | |||
310 | |||
311 | #else | ||
312 | |||
313 | /* 64-bit integers */ | ||
314 | |||
315 | typedef u64 acpi_integer; | ||
316 | #define ACPI_INTEGER_MAX ACPI_UINT64_MAX | ||
317 | #define ACPI_INTEGER_BIT_SIZE 64 | ||
318 | #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ | ||
319 | |||
320 | |||
321 | #if ACPI_MACHINE_WIDTH == 64 | ||
322 | #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ | ||
323 | #endif | ||
324 | #endif | ||
325 | |||
326 | #define ACPI_MAX64_DECIMAL_DIGITS 20 | ||
327 | #define ACPI_MAX32_DECIMAL_DIGITS 10 | ||
328 | #define ACPI_MAX16_DECIMAL_DIGITS 5 | ||
329 | #define ACPI_MAX8_DECIMAL_DIGITS 3 | ||
330 | |||
331 | /* | ||
332 | * Constants with special meanings | ||
333 | */ | ||
334 | #define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) | ||
335 | |||
336 | |||
337 | /* | ||
338 | * Initialization sequence | ||
339 | */ | ||
340 | #define ACPI_FULL_INITIALIZATION 0x00 | ||
341 | #define ACPI_NO_ADDRESS_SPACE_INIT 0x01 | ||
342 | #define ACPI_NO_HARDWARE_INIT 0x02 | ||
343 | #define ACPI_NO_EVENT_INIT 0x04 | ||
344 | #define ACPI_NO_HANDLER_INIT 0x08 | ||
345 | #define ACPI_NO_ACPI_ENABLE 0x10 | ||
346 | #define ACPI_NO_DEVICE_INIT 0x20 | ||
347 | #define ACPI_NO_OBJECT_INIT 0x40 | ||
348 | |||
349 | /* | ||
350 | * Initialization state | ||
351 | */ | ||
352 | #define ACPI_INITIALIZED_OK 0x01 | ||
353 | |||
354 | /* | ||
355 | * Power state values | ||
356 | */ | ||
357 | #define ACPI_STATE_UNKNOWN (u8) 0xFF | ||
358 | |||
359 | #define ACPI_STATE_S0 (u8) 0 | ||
360 | #define ACPI_STATE_S1 (u8) 1 | ||
361 | #define ACPI_STATE_S2 (u8) 2 | ||
362 | #define ACPI_STATE_S3 (u8) 3 | ||
363 | #define ACPI_STATE_S4 (u8) 4 | ||
364 | #define ACPI_STATE_S5 (u8) 5 | ||
365 | #define ACPI_S_STATES_MAX ACPI_STATE_S5 | ||
366 | #define ACPI_S_STATE_COUNT 6 | ||
367 | |||
368 | #define ACPI_STATE_D0 (u8) 0 | ||
369 | #define ACPI_STATE_D1 (u8) 1 | ||
370 | #define ACPI_STATE_D2 (u8) 2 | ||
371 | #define ACPI_STATE_D3 (u8) 3 | ||
372 | #define ACPI_D_STATES_MAX ACPI_STATE_D3 | ||
373 | #define ACPI_D_STATE_COUNT 4 | ||
374 | |||
375 | #define ACPI_STATE_C0 (u8) 0 | ||
376 | #define ACPI_STATE_C1 (u8) 1 | ||
377 | #define ACPI_STATE_C2 (u8) 2 | ||
378 | #define ACPI_STATE_C3 (u8) 3 | ||
379 | #define ACPI_C_STATES_MAX ACPI_STATE_C3 | ||
380 | #define ACPI_C_STATE_COUNT 4 | ||
381 | |||
382 | /* | ||
383 | * Sleep type invalid value | ||
384 | */ | ||
385 | #define ACPI_SLEEP_TYPE_MAX 0x7 | ||
386 | #define ACPI_SLEEP_TYPE_INVALID 0xFF | ||
387 | |||
388 | /* | ||
389 | * Standard notify values | ||
390 | */ | ||
391 | #define ACPI_NOTIFY_BUS_CHECK (u8) 0 | ||
392 | #define ACPI_NOTIFY_DEVICE_CHECK (u8) 1 | ||
393 | #define ACPI_NOTIFY_DEVICE_WAKE (u8) 2 | ||
394 | #define ACPI_NOTIFY_EJECT_REQUEST (u8) 3 | ||
395 | #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4 | ||
396 | #define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5 | ||
397 | #define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6 | ||
398 | #define ACPI_NOTIFY_POWER_FAULT (u8) 7 | ||
399 | |||
400 | /* | ||
401 | * Table types. These values are passed to the table related APIs | ||
402 | */ | ||
403 | typedef u32 acpi_table_type; | ||
404 | |||
405 | #define ACPI_TABLE_RSDP (acpi_table_type) 0 | ||
406 | #define ACPI_TABLE_DSDT (acpi_table_type) 1 | ||
407 | #define ACPI_TABLE_FADT (acpi_table_type) 2 | ||
408 | #define ACPI_TABLE_FACS (acpi_table_type) 3 | ||
409 | #define ACPI_TABLE_PSDT (acpi_table_type) 4 | ||
410 | #define ACPI_TABLE_SSDT (acpi_table_type) 5 | ||
411 | #define ACPI_TABLE_XSDT (acpi_table_type) 6 | ||
412 | #define ACPI_TABLE_MAX 6 | ||
413 | #define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1) | ||
414 | |||
415 | /* | ||
416 | * Types associated with ACPI names and objects. The first group of | ||
417 | * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition | ||
418 | * of the ACPI object_type() operator (See the ACPI Spec). Therefore, | ||
419 | * only add to the first group if the spec changes. | ||
420 | * | ||
421 | * NOTE: Types must be kept in sync with the global acpi_ns_properties | ||
422 | * and acpi_ns_type_names arrays. | ||
423 | */ | ||
424 | typedef u32 acpi_object_type; | ||
425 | |||
426 | #define ACPI_TYPE_ANY 0x00 | ||
427 | #define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ | ||
428 | #define ACPI_TYPE_STRING 0x02 | ||
429 | #define ACPI_TYPE_BUFFER 0x03 | ||
430 | #define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ | ||
431 | #define ACPI_TYPE_FIELD_UNIT 0x05 | ||
432 | #define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ | ||
433 | #define ACPI_TYPE_EVENT 0x07 | ||
434 | #define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ | ||
435 | #define ACPI_TYPE_MUTEX 0x09 | ||
436 | #define ACPI_TYPE_REGION 0x0A | ||
437 | #define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ | ||
438 | #define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ | ||
439 | #define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ | ||
440 | #define ACPI_TYPE_BUFFER_FIELD 0x0E | ||
441 | #define ACPI_TYPE_DDB_HANDLE 0x0F | ||
442 | #define ACPI_TYPE_DEBUG_OBJECT 0x10 | ||
443 | |||
444 | #define ACPI_TYPE_EXTERNAL_MAX 0x10 | ||
445 | |||
446 | /* | ||
447 | * These are object types that do not map directly to the ACPI | ||
448 | * object_type() operator. They are used for various internal purposes only. | ||
449 | * If new predefined ACPI_TYPEs are added (via the ACPI specification), these | ||
450 | * internal types must move upwards. (There is code that depends on these | ||
451 | * values being contiguous with the external types above.) | ||
452 | */ | ||
453 | #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 | ||
454 | #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 | ||
455 | #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 | ||
456 | #define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ | ||
457 | #define ACPI_TYPE_LOCAL_ALIAS 0x15 | ||
458 | #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 | ||
459 | #define ACPI_TYPE_LOCAL_NOTIFY 0x17 | ||
460 | #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 | ||
461 | #define ACPI_TYPE_LOCAL_RESOURCE 0x19 | ||
462 | #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A | ||
463 | #define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ | ||
464 | |||
465 | #define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ | ||
466 | |||
467 | /* | ||
468 | * These are special object types that never appear in | ||
469 | * a Namespace node, only in an union acpi_operand_object | ||
470 | */ | ||
471 | #define ACPI_TYPE_LOCAL_EXTRA 0x1C | ||
472 | #define ACPI_TYPE_LOCAL_DATA 0x1D | ||
473 | |||
474 | #define ACPI_TYPE_LOCAL_MAX 0x1D | ||
475 | |||
476 | /* All types above here are invalid */ | ||
477 | |||
478 | #define ACPI_TYPE_INVALID 0x1E | ||
479 | #define ACPI_TYPE_NOT_FOUND 0xFF | ||
480 | |||
481 | |||
482 | /* | ||
483 | * Bitmapped ACPI types. Used internally only | ||
484 | */ | ||
485 | #define ACPI_BTYPE_ANY 0x00000000 | ||
486 | #define ACPI_BTYPE_INTEGER 0x00000001 | ||
487 | #define ACPI_BTYPE_STRING 0x00000002 | ||
488 | #define ACPI_BTYPE_BUFFER 0x00000004 | ||
489 | #define ACPI_BTYPE_PACKAGE 0x00000008 | ||
490 | #define ACPI_BTYPE_FIELD_UNIT 0x00000010 | ||
491 | #define ACPI_BTYPE_DEVICE 0x00000020 | ||
492 | #define ACPI_BTYPE_EVENT 0x00000040 | ||
493 | #define ACPI_BTYPE_METHOD 0x00000080 | ||
494 | #define ACPI_BTYPE_MUTEX 0x00000100 | ||
495 | #define ACPI_BTYPE_REGION 0x00000200 | ||
496 | #define ACPI_BTYPE_POWER 0x00000400 | ||
497 | #define ACPI_BTYPE_PROCESSOR 0x00000800 | ||
498 | #define ACPI_BTYPE_THERMAL 0x00001000 | ||
499 | #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 | ||
500 | #define ACPI_BTYPE_DDB_HANDLE 0x00004000 | ||
501 | #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 | ||
502 | #define ACPI_BTYPE_REFERENCE 0x00010000 | ||
503 | #define ACPI_BTYPE_RESOURCE 0x00020000 | ||
504 | |||
505 | #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) | ||
506 | |||
507 | #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) | ||
508 | #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) | ||
509 | #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) | ||
510 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | ||
511 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | ||
512 | |||
513 | /* | ||
514 | * All I/O | ||
515 | */ | ||
516 | #define ACPI_READ 0 | ||
517 | #define ACPI_WRITE 1 | ||
518 | #define ACPI_IO_MASK 1 | ||
519 | |||
520 | /* | ||
521 | * Event Types: Fixed & General Purpose | ||
522 | */ | ||
523 | typedef u32 acpi_event_type; | ||
524 | |||
525 | /* | ||
526 | * Fixed events | ||
527 | */ | ||
528 | #define ACPI_EVENT_PMTIMER 0 | ||
529 | #define ACPI_EVENT_GLOBAL 1 | ||
530 | #define ACPI_EVENT_POWER_BUTTON 2 | ||
531 | #define ACPI_EVENT_SLEEP_BUTTON 3 | ||
532 | #define ACPI_EVENT_RTC 4 | ||
533 | #define ACPI_EVENT_MAX 4 | ||
534 | #define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 | ||
535 | |||
536 | /* | ||
537 | * Event Status - Per event | ||
538 | * ------------- | ||
539 | * The encoding of acpi_event_status is illustrated below. | ||
540 | * Note that a set bit (1) indicates the property is TRUE | ||
541 | * (e.g. if bit 0 is set then the event is enabled). | ||
542 | * +-------------+-+-+-+ | ||
543 | * | Bits 31:3 |2|1|0| | ||
544 | * +-------------+-+-+-+ | ||
545 | * | | | | | ||
546 | * | | | +- Enabled? | ||
547 | * | | +--- Enabled for wake? | ||
548 | * | +----- Set? | ||
549 | * +----------- <Reserved> | ||
550 | */ | ||
551 | typedef u32 acpi_event_status; | ||
552 | |||
553 | #define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 | ||
554 | #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 | ||
555 | #define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 | ||
556 | #define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 | ||
557 | |||
558 | /* | ||
559 | * General Purpose Events (GPE) | ||
560 | */ | ||
561 | #define ACPI_GPE_INVALID 0xFF | ||
562 | #define ACPI_GPE_MAX 0xFF | ||
563 | #define ACPI_NUM_GPE 256 | ||
564 | |||
565 | #define ACPI_GPE_ENABLE 0 | ||
566 | #define ACPI_GPE_DISABLE 1 | ||
567 | |||
568 | |||
569 | /* | ||
570 | * GPE info flags - Per GPE | ||
571 | * +-+-+-+---+---+-+ | ||
572 | * |7|6|5|4:3|2:1|0| | ||
573 | * +-+-+-+---+---+-+ | ||
574 | * | | | | | | | ||
575 | * | | | | | +--- Interrupt type: Edge or Level Triggered | ||
576 | * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime | ||
577 | * | | | +--- Type of dispatch -- to method, handler, or none | ||
578 | * | | +--- Enabled for runtime? | ||
579 | * | +--- Enabled for wake? | ||
580 | * +--- System state when GPE ocurred (running/waking) | ||
581 | */ | ||
582 | #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 | ||
583 | #define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01 | ||
584 | #define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00 | ||
585 | |||
586 | #define ACPI_GPE_TYPE_MASK (u8) 0x06 | ||
587 | #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 | ||
588 | #define ACPI_GPE_TYPE_WAKE (u8) 0x02 | ||
589 | #define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ | ||
590 | |||
591 | #define ACPI_GPE_DISPATCH_MASK (u8) 0x18 | ||
592 | #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 | ||
593 | #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 | ||
594 | #define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ | ||
595 | |||
596 | #define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20 | ||
597 | #define ACPI_GPE_RUN_ENABLED (u8) 0x20 | ||
598 | #define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ | ||
599 | |||
600 | #define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40 | ||
601 | #define ACPI_GPE_WAKE_ENABLED (u8) 0x40 | ||
602 | #define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ | ||
603 | |||
604 | #define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ | ||
605 | |||
606 | #define ACPI_GPE_SYSTEM_MASK (u8) 0x80 | ||
607 | #define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 | ||
608 | #define ACPI_GPE_SYSTEM_WAKING (u8) 0x00 | ||
609 | |||
610 | /* | ||
611 | * Flags for GPE and Lock interfaces | ||
612 | */ | ||
613 | #define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ | ||
614 | #define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ | ||
615 | |||
616 | #define ACPI_NOT_ISR 0x1 | ||
617 | #define ACPI_ISR 0x0 | ||
618 | |||
619 | |||
620 | /* Notify types */ | ||
621 | |||
622 | #define ACPI_SYSTEM_NOTIFY 0x1 | ||
623 | #define ACPI_DEVICE_NOTIFY 0x2 | ||
624 | #define ACPI_ALL_NOTIFY 0x3 | ||
625 | #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 | ||
626 | |||
627 | #define ACPI_MAX_SYS_NOTIFY 0x7f | ||
628 | |||
629 | |||
630 | /* Address Space (Operation Region) Types */ | ||
631 | |||
632 | typedef u8 acpi_adr_space_type; | ||
633 | |||
634 | #define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0 | ||
635 | #define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1 | ||
636 | #define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2 | ||
637 | #define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3 | ||
638 | #define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4 | ||
639 | #define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 | ||
640 | #define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 | ||
641 | #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 | ||
642 | #define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 | ||
643 | |||
644 | |||
645 | /* | ||
646 | * bit_register IDs | ||
647 | * These are bitfields defined within the full ACPI registers | ||
648 | */ | ||
649 | #define ACPI_BITREG_TIMER_STATUS 0x00 | ||
650 | #define ACPI_BITREG_BUS_MASTER_STATUS 0x01 | ||
651 | #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 | ||
652 | #define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 | ||
653 | #define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 | ||
654 | #define ACPI_BITREG_RT_CLOCK_STATUS 0x05 | ||
655 | #define ACPI_BITREG_WAKE_STATUS 0x06 | ||
656 | #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 | ||
657 | |||
658 | #define ACPI_BITREG_TIMER_ENABLE 0x08 | ||
659 | #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 | ||
660 | #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A | ||
661 | #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B | ||
662 | #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C | ||
663 | #define ACPI_BITREG_WAKE_ENABLE 0x0D | ||
664 | #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E | ||
665 | |||
666 | #define ACPI_BITREG_SCI_ENABLE 0x0F | ||
667 | #define ACPI_BITREG_BUS_MASTER_RLD 0x10 | ||
668 | #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11 | ||
669 | #define ACPI_BITREG_SLEEP_TYPE_A 0x12 | ||
670 | #define ACPI_BITREG_SLEEP_TYPE_B 0x13 | ||
671 | #define ACPI_BITREG_SLEEP_ENABLE 0x14 | ||
672 | |||
673 | #define ACPI_BITREG_ARB_DISABLE 0x15 | ||
674 | |||
675 | #define ACPI_BITREG_MAX 0x15 | ||
676 | #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 | ||
677 | |||
678 | |||
679 | /* | ||
680 | * External ACPI object definition | ||
681 | */ | ||
682 | union acpi_object | ||
683 | { | ||
684 | acpi_object_type type; /* See definition of acpi_ns_type for values */ | ||
685 | struct | ||
686 | { | ||
687 | acpi_object_type type; | ||
688 | acpi_integer value; /* The actual number */ | ||
689 | } integer; | ||
690 | |||
691 | struct | ||
692 | { | ||
693 | acpi_object_type type; | ||
694 | u32 length; /* # of bytes in string, excluding trailing null */ | ||
695 | char *pointer; /* points to the string value */ | ||
696 | } string; | ||
697 | |||
698 | struct | ||
699 | { | ||
700 | acpi_object_type type; | ||
701 | u32 length; /* # of bytes in buffer */ | ||
702 | u8 *pointer; /* points to the buffer */ | ||
703 | } buffer; | ||
704 | |||
705 | struct | ||
706 | { | ||
707 | acpi_object_type type; | ||
708 | u32 fill1; | ||
709 | acpi_handle handle; /* object reference */ | ||
710 | } reference; | ||
711 | |||
712 | struct | ||
713 | { | ||
714 | acpi_object_type type; | ||
715 | u32 count; /* # of elements in package */ | ||
716 | union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ | ||
717 | } package; | ||
718 | |||
719 | struct | ||
720 | { | ||
721 | acpi_object_type type; | ||
722 | u32 proc_id; | ||
723 | acpi_io_address pblk_address; | ||
724 | u32 pblk_length; | ||
725 | } processor; | ||
726 | |||
727 | struct | ||
728 | { | ||
729 | acpi_object_type type; | ||
730 | u32 system_level; | ||
731 | u32 resource_order; | ||
732 | } power_resource; | ||
733 | }; | ||
734 | |||
735 | |||
736 | /* | ||
737 | * List of objects, used as a parameter list for control method evaluation | ||
738 | */ | ||
739 | struct acpi_object_list | ||
740 | { | ||
741 | u32 count; | ||
742 | union acpi_object *pointer; | ||
743 | }; | ||
744 | |||
745 | |||
746 | /* | ||
747 | * Miscellaneous common Data Structures used by the interfaces | ||
748 | */ | ||
749 | #define ACPI_NO_BUFFER 0 | ||
750 | #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) | ||
751 | #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) | ||
752 | |||
753 | struct acpi_buffer | ||
754 | { | ||
755 | acpi_size length; /* Length in bytes of the buffer */ | ||
756 | void *pointer; /* pointer to buffer */ | ||
757 | }; | ||
758 | |||
759 | |||
760 | /* | ||
761 | * name_type for acpi_get_name | ||
762 | */ | ||
763 | #define ACPI_FULL_PATHNAME 0 | ||
764 | #define ACPI_SINGLE_NAME 1 | ||
765 | #define ACPI_NAME_TYPE_MAX 1 | ||
766 | |||
767 | |||
768 | /* | ||
769 | * Structure and flags for acpi_get_system_info | ||
770 | */ | ||
771 | #define ACPI_SYS_MODE_UNKNOWN 0x0000 | ||
772 | #define ACPI_SYS_MODE_ACPI 0x0001 | ||
773 | #define ACPI_SYS_MODE_LEGACY 0x0002 | ||
774 | #define ACPI_SYS_MODES_MASK 0x0003 | ||
775 | |||
776 | |||
777 | /* | ||
778 | * ACPI Table Info. One per ACPI table _type_ | ||
779 | */ | ||
780 | struct acpi_table_info | ||
781 | { | ||
782 | u32 count; | ||
783 | }; | ||
784 | |||
785 | |||
786 | /* | ||
787 | * System info returned by acpi_get_system_info() | ||
788 | */ | ||
789 | struct acpi_system_info | ||
790 | { | ||
791 | u32 acpi_ca_version; | ||
792 | u32 flags; | ||
793 | u32 timer_resolution; | ||
794 | u32 reserved1; | ||
795 | u32 reserved2; | ||
796 | u32 debug_level; | ||
797 | u32 debug_layer; | ||
798 | u32 num_table_types; | ||
799 | struct acpi_table_info table_info [NUM_ACPI_TABLE_TYPES]; | ||
800 | }; | ||
801 | |||
802 | |||
803 | /* | ||
804 | * Types specific to the OS service interfaces | ||
805 | */ | ||
806 | |||
807 | typedef u32 | ||
808 | (ACPI_SYSTEM_XFACE *acpi_osd_handler) ( | ||
809 | void *context); | ||
810 | |||
811 | typedef void | ||
812 | (ACPI_SYSTEM_XFACE *acpi_osd_exec_callback) ( | ||
813 | void *context); | ||
814 | |||
815 | /* | ||
816 | * Various handlers and callback procedures | ||
817 | */ | ||
818 | typedef | ||
819 | u32 (*acpi_event_handler) ( | ||
820 | void *context); | ||
821 | |||
822 | typedef | ||
823 | void (*acpi_notify_handler) ( | ||
824 | acpi_handle device, | ||
825 | u32 value, | ||
826 | void *context); | ||
827 | |||
828 | typedef | ||
829 | void (*acpi_object_handler) ( | ||
830 | acpi_handle object, | ||
831 | u32 function, | ||
832 | void *data); | ||
833 | |||
834 | typedef | ||
835 | acpi_status (*acpi_init_handler) ( | ||
836 | acpi_handle object, | ||
837 | u32 function); | ||
838 | |||
839 | #define ACPI_INIT_DEVICE_INI 1 | ||
840 | |||
841 | typedef | ||
842 | acpi_status (*acpi_exception_handler) ( | ||
843 | acpi_status aml_status, | ||
844 | acpi_name name, | ||
845 | u16 opcode, | ||
846 | u32 aml_offset, | ||
847 | void *context); | ||
848 | |||
849 | |||
850 | /* Address Spaces (For Operation Regions) */ | ||
851 | |||
852 | typedef | ||
853 | acpi_status (*acpi_adr_space_handler) ( | ||
854 | u32 function, | ||
855 | acpi_physical_address address, | ||
856 | u32 bit_width, | ||
857 | acpi_integer *value, | ||
858 | void *handler_context, | ||
859 | void *region_context); | ||
860 | |||
861 | #define ACPI_DEFAULT_HANDLER NULL | ||
862 | |||
863 | |||
864 | typedef | ||
865 | acpi_status (*acpi_adr_space_setup) ( | ||
866 | acpi_handle region_handle, | ||
867 | u32 function, | ||
868 | void *handler_context, | ||
869 | void **region_context); | ||
870 | |||
871 | #define ACPI_REGION_ACTIVATE 0 | ||
872 | #define ACPI_REGION_DEACTIVATE 1 | ||
873 | |||
874 | typedef | ||
875 | acpi_status (*acpi_walk_callback) ( | ||
876 | acpi_handle obj_handle, | ||
877 | u32 nesting_level, | ||
878 | void *context, | ||
879 | void **return_value); | ||
880 | |||
881 | |||
882 | /* Interrupt handler return values */ | ||
883 | |||
884 | #define ACPI_INTERRUPT_NOT_HANDLED 0x00 | ||
885 | #define ACPI_INTERRUPT_HANDLED 0x01 | ||
886 | |||
887 | |||
888 | /* Common string version of device HIDs and UIDs */ | ||
889 | |||
890 | struct acpi_device_id | ||
891 | { | ||
892 | char value[ACPI_DEVICE_ID_LENGTH]; | ||
893 | }; | ||
894 | |||
895 | /* Common string version of device CIDs */ | ||
896 | |||
897 | struct acpi_compatible_id | ||
898 | { | ||
899 | char value[ACPI_MAX_CID_LENGTH]; | ||
900 | }; | ||
901 | |||
902 | struct acpi_compatible_id_list | ||
903 | { | ||
904 | u32 count; | ||
905 | u32 size; | ||
906 | struct acpi_compatible_id id[1]; | ||
907 | }; | ||
908 | |||
909 | |||
910 | /* Structure and flags for acpi_get_object_info */ | ||
911 | |||
912 | #define ACPI_VALID_STA 0x0001 | ||
913 | #define ACPI_VALID_ADR 0x0002 | ||
914 | #define ACPI_VALID_HID 0x0004 | ||
915 | #define ACPI_VALID_UID 0x0008 | ||
916 | #define ACPI_VALID_CID 0x0010 | ||
917 | #define ACPI_VALID_SXDS 0x0020 | ||
918 | |||
919 | |||
920 | #define ACPI_COMMON_OBJ_INFO \ | ||
921 | acpi_object_type type; /* ACPI object type */ \ | ||
922 | acpi_name name /* ACPI object Name */ | ||
923 | |||
924 | |||
925 | struct acpi_obj_info_header | ||
926 | { | ||
927 | ACPI_COMMON_OBJ_INFO; | ||
928 | }; | ||
929 | |||
930 | |||
931 | /* Structure returned from Get Object Info */ | ||
932 | |||
933 | struct acpi_device_info | ||
934 | { | ||
935 | ACPI_COMMON_OBJ_INFO; | ||
936 | |||
937 | u32 valid; /* Indicates which fields below are valid */ | ||
938 | u32 current_status; /* _STA value */ | ||
939 | acpi_integer address; /* _ADR value if any */ | ||
940 | struct acpi_device_id hardware_id; /* _HID value if any */ | ||
941 | struct acpi_device_id unique_id; /* _UID value if any */ | ||
942 | u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ | ||
943 | struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ | ||
944 | }; | ||
945 | |||
946 | |||
947 | /* Context structs for address space handlers */ | ||
948 | |||
949 | struct acpi_pci_id | ||
950 | { | ||
951 | u16 segment; | ||
952 | u16 bus; | ||
953 | u16 device; | ||
954 | u16 function; | ||
955 | }; | ||
956 | |||
957 | |||
958 | struct acpi_mem_space_context | ||
959 | { | ||
960 | u32 length; | ||
961 | acpi_physical_address address; | ||
962 | acpi_physical_address mapped_physical_address; | ||
963 | u8 *mapped_logical_address; | ||
964 | acpi_size mapped_length; | ||
965 | }; | ||
966 | |||
967 | |||
968 | /* | ||
969 | * Definitions for Resource Attributes | ||
970 | */ | ||
971 | |||
972 | /* | ||
973 | * Memory Attributes | ||
974 | */ | ||
975 | #define ACPI_READ_ONLY_MEMORY (u8) 0x00 | ||
976 | #define ACPI_READ_WRITE_MEMORY (u8) 0x01 | ||
977 | |||
978 | #define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00 | ||
979 | #define ACPI_CACHABLE_MEMORY (u8) 0x01 | ||
980 | #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 | ||
981 | #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 | ||
982 | |||
983 | /* | ||
984 | * IO Attributes | ||
985 | * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. | ||
986 | * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. | ||
987 | */ | ||
988 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 | ||
989 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 | ||
990 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) | ||
991 | |||
992 | #define ACPI_SPARSE_TRANSLATION (u8) 0x03 | ||
993 | |||
994 | /* | ||
995 | * IO Port Descriptor Decode | ||
996 | */ | ||
997 | #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ | ||
998 | #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ | ||
999 | |||
1000 | /* | ||
1001 | * IRQ Attributes | ||
1002 | */ | ||
1003 | #define ACPI_EDGE_SENSITIVE (u8) 0x00 | ||
1004 | #define ACPI_LEVEL_SENSITIVE (u8) 0x01 | ||
1005 | |||
1006 | #define ACPI_ACTIVE_HIGH (u8) 0x00 | ||
1007 | #define ACPI_ACTIVE_LOW (u8) 0x01 | ||
1008 | |||
1009 | #define ACPI_EXCLUSIVE (u8) 0x00 | ||
1010 | #define ACPI_SHARED (u8) 0x01 | ||
1011 | |||
1012 | /* | ||
1013 | * DMA Attributes | ||
1014 | */ | ||
1015 | #define ACPI_COMPATIBILITY (u8) 0x00 | ||
1016 | #define ACPI_TYPE_A (u8) 0x01 | ||
1017 | #define ACPI_TYPE_B (u8) 0x02 | ||
1018 | #define ACPI_TYPE_F (u8) 0x03 | ||
1019 | |||
1020 | #define ACPI_NOT_BUS_MASTER (u8) 0x00 | ||
1021 | #define ACPI_BUS_MASTER (u8) 0x01 | ||
1022 | |||
1023 | #define ACPI_TRANSFER_8 (u8) 0x00 | ||
1024 | #define ACPI_TRANSFER_8_16 (u8) 0x01 | ||
1025 | #define ACPI_TRANSFER_16 (u8) 0x02 | ||
1026 | |||
1027 | /* | ||
1028 | * Start Dependent Functions Priority definitions | ||
1029 | */ | ||
1030 | #define ACPI_GOOD_CONFIGURATION (u8) 0x00 | ||
1031 | #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01 | ||
1032 | #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02 | ||
1033 | |||
1034 | /* | ||
1035 | * 16, 32 and 64-bit Address Descriptor resource types | ||
1036 | */ | ||
1037 | #define ACPI_MEMORY_RANGE (u8) 0x00 | ||
1038 | #define ACPI_IO_RANGE (u8) 0x01 | ||
1039 | #define ACPI_BUS_NUMBER_RANGE (u8) 0x02 | ||
1040 | |||
1041 | #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00 | ||
1042 | #define ACPI_ADDRESS_FIXED (u8) 0x01 | ||
1043 | |||
1044 | #define ACPI_POS_DECODE (u8) 0x00 | ||
1045 | #define ACPI_SUB_DECODE (u8) 0x01 | ||
1046 | |||
1047 | #define ACPI_PRODUCER (u8) 0x00 | ||
1048 | #define ACPI_CONSUMER (u8) 0x01 | ||
1049 | |||
1050 | |||
1051 | /* | ||
1052 | * Structures used to describe device resources | ||
1053 | */ | ||
1054 | struct acpi_resource_irq | ||
1055 | { | ||
1056 | u32 edge_level; | ||
1057 | u32 active_high_low; | ||
1058 | u32 shared_exclusive; | ||
1059 | u32 number_of_interrupts; | ||
1060 | u32 interrupts[1]; | ||
1061 | }; | ||
1062 | |||
1063 | struct acpi_resource_dma | ||
1064 | { | ||
1065 | u32 type; | ||
1066 | u32 bus_master; | ||
1067 | u32 transfer; | ||
1068 | u32 number_of_channels; | ||
1069 | u32 channels[1]; | ||
1070 | }; | ||
1071 | |||
1072 | struct acpi_resource_start_dpf | ||
1073 | { | ||
1074 | u32 compatibility_priority; | ||
1075 | u32 performance_robustness; | ||
1076 | }; | ||
1077 | |||
1078 | /* | ||
1079 | * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not | ||
1080 | * needed because it has no fields | ||
1081 | */ | ||
1082 | |||
1083 | struct acpi_resource_io | ||
1084 | { | ||
1085 | u32 io_decode; | ||
1086 | u32 min_base_address; | ||
1087 | u32 max_base_address; | ||
1088 | u32 alignment; | ||
1089 | u32 range_length; | ||
1090 | }; | ||
1091 | |||
1092 | struct acpi_resource_fixed_io | ||
1093 | { | ||
1094 | u32 base_address; | ||
1095 | u32 range_length; | ||
1096 | }; | ||
1097 | |||
1098 | struct acpi_resource_vendor | ||
1099 | { | ||
1100 | u32 length; | ||
1101 | u8 reserved[1]; | ||
1102 | }; | ||
1103 | |||
1104 | struct acpi_resource_end_tag | ||
1105 | { | ||
1106 | u8 checksum; | ||
1107 | }; | ||
1108 | |||
1109 | struct acpi_resource_mem24 | ||
1110 | { | ||
1111 | u32 read_write_attribute; | ||
1112 | u32 min_base_address; | ||
1113 | u32 max_base_address; | ||
1114 | u32 alignment; | ||
1115 | u32 range_length; | ||
1116 | }; | ||
1117 | |||
1118 | struct acpi_resource_mem32 | ||
1119 | { | ||
1120 | u32 read_write_attribute; | ||
1121 | u32 min_base_address; | ||
1122 | u32 max_base_address; | ||
1123 | u32 alignment; | ||
1124 | u32 range_length; | ||
1125 | }; | ||
1126 | |||
1127 | struct acpi_resource_fixed_mem32 | ||
1128 | { | ||
1129 | u32 read_write_attribute; | ||
1130 | u32 range_base_address; | ||
1131 | u32 range_length; | ||
1132 | }; | ||
1133 | |||
1134 | struct acpi_memory_attribute | ||
1135 | { | ||
1136 | u16 cache_attribute; | ||
1137 | u16 read_write_attribute; | ||
1138 | }; | ||
1139 | |||
1140 | struct acpi_io_attribute | ||
1141 | { | ||
1142 | u16 range_attribute; | ||
1143 | u16 translation_attribute; | ||
1144 | }; | ||
1145 | |||
1146 | struct acpi_bus_attribute | ||
1147 | { | ||
1148 | u16 reserved1; | ||
1149 | u16 reserved2; | ||
1150 | }; | ||
1151 | |||
1152 | union acpi_resource_attribute | ||
1153 | { | ||
1154 | struct acpi_memory_attribute memory; | ||
1155 | struct acpi_io_attribute io; | ||
1156 | struct acpi_bus_attribute bus; | ||
1157 | }; | ||
1158 | |||
1159 | struct acpi_resource_source | ||
1160 | { | ||
1161 | u32 index; | ||
1162 | u32 string_length; | ||
1163 | char *string_ptr; | ||
1164 | }; | ||
1165 | |||
1166 | struct acpi_resource_address16 | ||
1167 | { | ||
1168 | u32 resource_type; | ||
1169 | u32 producer_consumer; | ||
1170 | u32 decode; | ||
1171 | u32 min_address_fixed; | ||
1172 | u32 max_address_fixed; | ||
1173 | union acpi_resource_attribute attribute; | ||
1174 | u32 granularity; | ||
1175 | u32 min_address_range; | ||
1176 | u32 max_address_range; | ||
1177 | u32 address_translation_offset; | ||
1178 | u32 address_length; | ||
1179 | struct acpi_resource_source resource_source; | ||
1180 | }; | ||
1181 | |||
1182 | struct acpi_resource_address32 | ||
1183 | { | ||
1184 | u32 resource_type; | ||
1185 | u32 producer_consumer; | ||
1186 | u32 decode; | ||
1187 | u32 min_address_fixed; | ||
1188 | u32 max_address_fixed; | ||
1189 | union acpi_resource_attribute attribute; | ||
1190 | u32 granularity; | ||
1191 | u32 min_address_range; | ||
1192 | u32 max_address_range; | ||
1193 | u32 address_translation_offset; | ||
1194 | u32 address_length; | ||
1195 | struct acpi_resource_source resource_source; | ||
1196 | }; | ||
1197 | |||
1198 | struct acpi_resource_address64 | ||
1199 | { | ||
1200 | u32 resource_type; | ||
1201 | u32 producer_consumer; | ||
1202 | u32 decode; | ||
1203 | u32 min_address_fixed; | ||
1204 | u32 max_address_fixed; | ||
1205 | union acpi_resource_attribute attribute; | ||
1206 | u64 granularity; | ||
1207 | u64 min_address_range; | ||
1208 | u64 max_address_range; | ||
1209 | u64 address_translation_offset; | ||
1210 | u64 address_length; | ||
1211 | u64 type_specific_attributes; | ||
1212 | struct acpi_resource_source resource_source; | ||
1213 | }; | ||
1214 | |||
1215 | struct acpi_resource_ext_irq | ||
1216 | { | ||
1217 | u32 producer_consumer; | ||
1218 | u32 edge_level; | ||
1219 | u32 active_high_low; | ||
1220 | u32 shared_exclusive; | ||
1221 | u32 number_of_interrupts; | ||
1222 | struct acpi_resource_source resource_source; | ||
1223 | u32 interrupts[1]; | ||
1224 | }; | ||
1225 | |||
1226 | |||
1227 | /* ACPI_RESOURCE_TYPEs */ | ||
1228 | |||
1229 | #define ACPI_RSTYPE_IRQ 0 | ||
1230 | #define ACPI_RSTYPE_DMA 1 | ||
1231 | #define ACPI_RSTYPE_START_DPF 2 | ||
1232 | #define ACPI_RSTYPE_END_DPF 3 | ||
1233 | #define ACPI_RSTYPE_IO 4 | ||
1234 | #define ACPI_RSTYPE_FIXED_IO 5 | ||
1235 | #define ACPI_RSTYPE_VENDOR 6 | ||
1236 | #define ACPI_RSTYPE_END_TAG 7 | ||
1237 | #define ACPI_RSTYPE_MEM24 8 | ||
1238 | #define ACPI_RSTYPE_MEM32 9 | ||
1239 | #define ACPI_RSTYPE_FIXED_MEM32 10 | ||
1240 | #define ACPI_RSTYPE_ADDRESS16 11 | ||
1241 | #define ACPI_RSTYPE_ADDRESS32 12 | ||
1242 | #define ACPI_RSTYPE_ADDRESS64 13 | ||
1243 | #define ACPI_RSTYPE_EXT_IRQ 14 | ||
1244 | |||
1245 | typedef u32 acpi_resource_type; | ||
1246 | |||
1247 | union acpi_resource_data | ||
1248 | { | ||
1249 | struct acpi_resource_irq irq; | ||
1250 | struct acpi_resource_dma dma; | ||
1251 | struct acpi_resource_start_dpf start_dpf; | ||
1252 | struct acpi_resource_io io; | ||
1253 | struct acpi_resource_fixed_io fixed_io; | ||
1254 | struct acpi_resource_vendor vendor_specific; | ||
1255 | struct acpi_resource_end_tag end_tag; | ||
1256 | struct acpi_resource_mem24 memory24; | ||
1257 | struct acpi_resource_mem32 memory32; | ||
1258 | struct acpi_resource_fixed_mem32 fixed_memory32; | ||
1259 | struct acpi_resource_address16 address16; | ||
1260 | struct acpi_resource_address32 address32; | ||
1261 | struct acpi_resource_address64 address64; | ||
1262 | struct acpi_resource_ext_irq extended_irq; | ||
1263 | }; | ||
1264 | |||
1265 | struct acpi_resource | ||
1266 | { | ||
1267 | acpi_resource_type id; | ||
1268 | u32 length; | ||
1269 | union acpi_resource_data data; | ||
1270 | }; | ||
1271 | |||
1272 | #define ACPI_RESOURCE_LENGTH 12 | ||
1273 | #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ | ||
1274 | |||
1275 | #define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) | ||
1276 | |||
1277 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) | ||
1278 | |||
1279 | #ifdef ACPI_MISALIGNED_TRANSFERS | ||
1280 | #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) | ||
1281 | #else | ||
1282 | #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) | ||
1283 | #endif | ||
1284 | |||
1285 | /* | ||
1286 | * END: of definitions for Resource Attributes | ||
1287 | */ | ||
1288 | |||
1289 | |||
1290 | struct acpi_pci_routing_table | ||
1291 | { | ||
1292 | u32 length; | ||
1293 | u32 pin; | ||
1294 | acpi_integer address; /* here for 64-bit alignment */ | ||
1295 | u32 source_index; | ||
1296 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ | ||
1297 | }; | ||
1298 | |||
1299 | /* | ||
1300 | * END: of definitions for PCI Routing tables | ||
1301 | */ | ||
1302 | |||
1303 | |||
1304 | #endif /* __ACTYPES_H__ */ | ||
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h new file mode 100644 index 000000000000..0de26b8f1028 --- /dev/null +++ b/include/acpi/acutils.h | |||
@@ -0,0 +1,875 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 _ACUTILS_H | ||
45 | #define _ACUTILS_H | ||
46 | |||
47 | |||
48 | typedef | ||
49 | acpi_status (*acpi_pkg_callback) ( | ||
50 | u8 object_type, | ||
51 | union acpi_operand_object *source_object, | ||
52 | union acpi_generic_state *state, | ||
53 | void *context); | ||
54 | |||
55 | acpi_status | ||
56 | acpi_ut_walk_package_tree ( | ||
57 | union acpi_operand_object *source_object, | ||
58 | void *target_object, | ||
59 | acpi_pkg_callback walk_callback, | ||
60 | void *context); | ||
61 | |||
62 | struct acpi_pkg_info | ||
63 | { | ||
64 | u8 *free_space; | ||
65 | acpi_size length; | ||
66 | u32 object_space; | ||
67 | u32 num_packages; | ||
68 | }; | ||
69 | |||
70 | #define REF_INCREMENT (u16) 0 | ||
71 | #define REF_DECREMENT (u16) 1 | ||
72 | #define REF_FORCE_DELETE (u16) 2 | ||
73 | |||
74 | /* acpi_ut_dump_buffer */ | ||
75 | |||
76 | #define DB_BYTE_DISPLAY 1 | ||
77 | #define DB_WORD_DISPLAY 2 | ||
78 | #define DB_DWORD_DISPLAY 4 | ||
79 | #define DB_QWORD_DISPLAY 8 | ||
80 | |||
81 | |||
82 | /* Global initialization interfaces */ | ||
83 | |||
84 | void | ||
85 | acpi_ut_init_globals ( | ||
86 | void); | ||
87 | |||
88 | void | ||
89 | acpi_ut_terminate ( | ||
90 | void); | ||
91 | |||
92 | |||
93 | /* | ||
94 | * ut_init - miscellaneous initialization and shutdown | ||
95 | */ | ||
96 | |||
97 | acpi_status | ||
98 | acpi_ut_hardware_initialize ( | ||
99 | void); | ||
100 | |||
101 | void | ||
102 | acpi_ut_subsystem_shutdown ( | ||
103 | void); | ||
104 | |||
105 | acpi_status | ||
106 | acpi_ut_validate_fadt ( | ||
107 | void); | ||
108 | |||
109 | /* | ||
110 | * ut_global - Global data structures and procedures | ||
111 | */ | ||
112 | |||
113 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
114 | |||
115 | char * | ||
116 | acpi_ut_get_mutex_name ( | ||
117 | u32 mutex_id); | ||
118 | |||
119 | #endif | ||
120 | |||
121 | char * | ||
122 | acpi_ut_get_type_name ( | ||
123 | acpi_object_type type); | ||
124 | |||
125 | char * | ||
126 | acpi_ut_get_node_name ( | ||
127 | void *object); | ||
128 | |||
129 | char * | ||
130 | acpi_ut_get_descriptor_name ( | ||
131 | void *object); | ||
132 | |||
133 | char * | ||
134 | acpi_ut_get_object_type_name ( | ||
135 | union acpi_operand_object *obj_desc); | ||
136 | |||
137 | char * | ||
138 | acpi_ut_get_region_name ( | ||
139 | u8 space_id); | ||
140 | |||
141 | char * | ||
142 | acpi_ut_get_event_name ( | ||
143 | u32 event_id); | ||
144 | |||
145 | char | ||
146 | acpi_ut_hex_to_ascii_char ( | ||
147 | acpi_integer integer, | ||
148 | u32 position); | ||
149 | |||
150 | u8 | ||
151 | acpi_ut_valid_object_type ( | ||
152 | acpi_object_type type); | ||
153 | |||
154 | acpi_owner_id | ||
155 | acpi_ut_allocate_owner_id ( | ||
156 | u32 id_type); | ||
157 | |||
158 | |||
159 | /* | ||
160 | * ut_clib - Local implementations of C library functions | ||
161 | */ | ||
162 | |||
163 | #ifndef ACPI_USE_SYSTEM_CLIBRARY | ||
164 | |||
165 | acpi_size | ||
166 | acpi_ut_strlen ( | ||
167 | const char *string); | ||
168 | |||
169 | char * | ||
170 | acpi_ut_strcpy ( | ||
171 | char *dst_string, | ||
172 | const char *src_string); | ||
173 | |||
174 | char * | ||
175 | acpi_ut_strncpy ( | ||
176 | char *dst_string, | ||
177 | const char *src_string, | ||
178 | acpi_size count); | ||
179 | |||
180 | int | ||
181 | acpi_ut_memcmp ( | ||
182 | const char *buffer1, | ||
183 | const char *buffer2, | ||
184 | acpi_size count); | ||
185 | |||
186 | int | ||
187 | acpi_ut_strncmp ( | ||
188 | const char *string1, | ||
189 | const char *string2, | ||
190 | acpi_size count); | ||
191 | |||
192 | int | ||
193 | acpi_ut_strcmp ( | ||
194 | const char *string1, | ||
195 | const char *string2); | ||
196 | |||
197 | char * | ||
198 | acpi_ut_strcat ( | ||
199 | char *dst_string, | ||
200 | const char *src_string); | ||
201 | |||
202 | char * | ||
203 | acpi_ut_strncat ( | ||
204 | char *dst_string, | ||
205 | const char *src_string, | ||
206 | acpi_size count); | ||
207 | |||
208 | u32 | ||
209 | acpi_ut_strtoul ( | ||
210 | const char *string, | ||
211 | char **terminator, | ||
212 | u32 base); | ||
213 | |||
214 | char * | ||
215 | acpi_ut_strstr ( | ||
216 | char *string1, | ||
217 | char *string2); | ||
218 | |||
219 | void * | ||
220 | acpi_ut_memcpy ( | ||
221 | void *dest, | ||
222 | const void *src, | ||
223 | acpi_size count); | ||
224 | |||
225 | void * | ||
226 | acpi_ut_memset ( | ||
227 | void *dest, | ||
228 | acpi_native_uint value, | ||
229 | acpi_size count); | ||
230 | |||
231 | int | ||
232 | acpi_ut_to_upper ( | ||
233 | int c); | ||
234 | |||
235 | int | ||
236 | acpi_ut_to_lower ( | ||
237 | int c); | ||
238 | |||
239 | extern const u8 _acpi_ctype[]; | ||
240 | |||
241 | #define _ACPI_XA 0x00 /* extra alphabetic - not supported */ | ||
242 | #define _ACPI_XS 0x40 /* extra space */ | ||
243 | #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ | ||
244 | #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ | ||
245 | #define _ACPI_DI 0x04 /* '0'-'9' */ | ||
246 | #define _ACPI_LO 0x02 /* 'a'-'z' */ | ||
247 | #define _ACPI_PU 0x10 /* punctuation */ | ||
248 | #define _ACPI_SP 0x08 /* space */ | ||
249 | #define _ACPI_UP 0x01 /* 'A'-'Z' */ | ||
250 | #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ | ||
251 | |||
252 | #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) | ||
253 | #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) | ||
254 | #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) | ||
255 | #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) | ||
256 | #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) | ||
257 | #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) | ||
258 | #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) | ||
259 | #define ACPI_IS_ASCII(c) ((c) < 0x80) | ||
260 | |||
261 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ | ||
262 | |||
263 | /* | ||
264 | * ut_copy - Object construction and conversion interfaces | ||
265 | */ | ||
266 | |||
267 | acpi_status | ||
268 | acpi_ut_build_simple_object( | ||
269 | union acpi_operand_object *obj, | ||
270 | union acpi_object *user_obj, | ||
271 | u8 *data_space, | ||
272 | u32 *buffer_space_used); | ||
273 | |||
274 | acpi_status | ||
275 | acpi_ut_build_package_object ( | ||
276 | union acpi_operand_object *obj, | ||
277 | u8 *buffer, | ||
278 | u32 *space_used); | ||
279 | |||
280 | acpi_status | ||
281 | acpi_ut_copy_ielement_to_eelement ( | ||
282 | u8 object_type, | ||
283 | union acpi_operand_object *source_object, | ||
284 | union acpi_generic_state *state, | ||
285 | void *context); | ||
286 | |||
287 | acpi_status | ||
288 | acpi_ut_copy_ielement_to_ielement ( | ||
289 | u8 object_type, | ||
290 | union acpi_operand_object *source_object, | ||
291 | union acpi_generic_state *state, | ||
292 | void *context); | ||
293 | |||
294 | acpi_status | ||
295 | acpi_ut_copy_iobject_to_eobject ( | ||
296 | union acpi_operand_object *obj, | ||
297 | struct acpi_buffer *ret_buffer); | ||
298 | |||
299 | acpi_status | ||
300 | acpi_ut_copy_esimple_to_isimple( | ||
301 | union acpi_object *user_obj, | ||
302 | union acpi_operand_object **return_obj); | ||
303 | |||
304 | acpi_status | ||
305 | acpi_ut_copy_eobject_to_iobject ( | ||
306 | union acpi_object *obj, | ||
307 | union acpi_operand_object **internal_obj); | ||
308 | |||
309 | acpi_status | ||
310 | acpi_ut_copy_isimple_to_isimple ( | ||
311 | union acpi_operand_object *source_obj, | ||
312 | union acpi_operand_object *dest_obj); | ||
313 | |||
314 | acpi_status | ||
315 | acpi_ut_copy_ipackage_to_ipackage ( | ||
316 | union acpi_operand_object *source_obj, | ||
317 | union acpi_operand_object *dest_obj, | ||
318 | struct acpi_walk_state *walk_state); | ||
319 | |||
320 | acpi_status | ||
321 | acpi_ut_copy_simple_object ( | ||
322 | union acpi_operand_object *source_desc, | ||
323 | union acpi_operand_object *dest_desc); | ||
324 | |||
325 | acpi_status | ||
326 | acpi_ut_copy_iobject_to_iobject ( | ||
327 | union acpi_operand_object *source_desc, | ||
328 | union acpi_operand_object **dest_desc, | ||
329 | struct acpi_walk_state *walk_state); | ||
330 | |||
331 | |||
332 | /* | ||
333 | * ut_create - Object creation | ||
334 | */ | ||
335 | |||
336 | acpi_status | ||
337 | acpi_ut_update_object_reference ( | ||
338 | union acpi_operand_object *object, | ||
339 | u16 action); | ||
340 | |||
341 | |||
342 | /* | ||
343 | * ut_debug - Debug interfaces | ||
344 | */ | ||
345 | |||
346 | void | ||
347 | acpi_ut_init_stack_ptr_trace ( | ||
348 | void); | ||
349 | |||
350 | void | ||
351 | acpi_ut_track_stack_ptr ( | ||
352 | void); | ||
353 | |||
354 | void | ||
355 | acpi_ut_trace ( | ||
356 | u32 line_number, | ||
357 | struct acpi_debug_print_info *dbg_info); | ||
358 | |||
359 | void | ||
360 | acpi_ut_trace_ptr ( | ||
361 | u32 line_number, | ||
362 | struct acpi_debug_print_info *dbg_info, | ||
363 | void *pointer); | ||
364 | |||
365 | void | ||
366 | acpi_ut_trace_u32 ( | ||
367 | u32 line_number, | ||
368 | struct acpi_debug_print_info *dbg_info, | ||
369 | u32 integer); | ||
370 | |||
371 | void | ||
372 | acpi_ut_trace_str ( | ||
373 | u32 line_number, | ||
374 | struct acpi_debug_print_info *dbg_info, | ||
375 | char *string); | ||
376 | |||
377 | void | ||
378 | acpi_ut_exit ( | ||
379 | u32 line_number, | ||
380 | struct acpi_debug_print_info *dbg_info); | ||
381 | |||
382 | void | ||
383 | acpi_ut_status_exit ( | ||
384 | u32 line_number, | ||
385 | struct acpi_debug_print_info *dbg_info, | ||
386 | acpi_status status); | ||
387 | |||
388 | void | ||
389 | acpi_ut_value_exit ( | ||
390 | u32 line_number, | ||
391 | struct acpi_debug_print_info *dbg_info, | ||
392 | acpi_integer value); | ||
393 | |||
394 | void | ||
395 | acpi_ut_ptr_exit ( | ||
396 | u32 line_number, | ||
397 | struct acpi_debug_print_info *dbg_info, | ||
398 | u8 *ptr); | ||
399 | |||
400 | void | ||
401 | acpi_ut_report_info ( | ||
402 | char *module_name, | ||
403 | u32 line_number, | ||
404 | u32 component_id); | ||
405 | |||
406 | void | ||
407 | acpi_ut_report_error ( | ||
408 | char *module_name, | ||
409 | u32 line_number, | ||
410 | u32 component_id); | ||
411 | |||
412 | void | ||
413 | acpi_ut_report_warning ( | ||
414 | char *module_name, | ||
415 | u32 line_number, | ||
416 | u32 component_id); | ||
417 | |||
418 | void | ||
419 | acpi_ut_dump_buffer ( | ||
420 | u8 *buffer, | ||
421 | u32 count, | ||
422 | u32 display, | ||
423 | u32 component_id); | ||
424 | |||
425 | void ACPI_INTERNAL_VAR_XFACE | ||
426 | acpi_ut_debug_print ( | ||
427 | u32 requested_debug_level, | ||
428 | u32 line_number, | ||
429 | struct acpi_debug_print_info *dbg_info, | ||
430 | char *format, | ||
431 | ...) ACPI_PRINTF_LIKE_FUNC; | ||
432 | |||
433 | void ACPI_INTERNAL_VAR_XFACE | ||
434 | acpi_ut_debug_print_raw ( | ||
435 | u32 requested_debug_level, | ||
436 | u32 line_number, | ||
437 | struct acpi_debug_print_info *dbg_info, | ||
438 | char *format, | ||
439 | ...) ACPI_PRINTF_LIKE_FUNC; | ||
440 | |||
441 | |||
442 | /* | ||
443 | * ut_delete - Object deletion | ||
444 | */ | ||
445 | |||
446 | void | ||
447 | acpi_ut_delete_internal_obj ( | ||
448 | union acpi_operand_object *object); | ||
449 | |||
450 | void | ||
451 | acpi_ut_delete_internal_package_object ( | ||
452 | union acpi_operand_object *object); | ||
453 | |||
454 | void | ||
455 | acpi_ut_delete_internal_simple_object ( | ||
456 | union acpi_operand_object *object); | ||
457 | |||
458 | void | ||
459 | acpi_ut_delete_internal_object_list ( | ||
460 | union acpi_operand_object **obj_list); | ||
461 | |||
462 | |||
463 | /* | ||
464 | * ut_eval - object evaluation | ||
465 | */ | ||
466 | |||
467 | /* Method name strings */ | ||
468 | |||
469 | #define METHOD_NAME__HID "_HID" | ||
470 | #define METHOD_NAME__CID "_CID" | ||
471 | #define METHOD_NAME__UID "_UID" | ||
472 | #define METHOD_NAME__ADR "_ADR" | ||
473 | #define METHOD_NAME__STA "_STA" | ||
474 | #define METHOD_NAME__REG "_REG" | ||
475 | #define METHOD_NAME__SEG "_SEG" | ||
476 | #define METHOD_NAME__BBN "_BBN" | ||
477 | #define METHOD_NAME__PRT "_PRT" | ||
478 | #define METHOD_NAME__CRS "_CRS" | ||
479 | #define METHOD_NAME__PRS "_PRS" | ||
480 | #define METHOD_NAME__PRW "_PRW" | ||
481 | |||
482 | |||
483 | acpi_status | ||
484 | acpi_ut_osi_implementation ( | ||
485 | struct acpi_walk_state *walk_state); | ||
486 | |||
487 | acpi_status | ||
488 | acpi_ut_evaluate_object ( | ||
489 | struct acpi_namespace_node *prefix_node, | ||
490 | char *path, | ||
491 | u32 expected_return_btypes, | ||
492 | union acpi_operand_object **return_desc); | ||
493 | |||
494 | acpi_status | ||
495 | acpi_ut_evaluate_numeric_object ( | ||
496 | char *object_name, | ||
497 | struct acpi_namespace_node *device_node, | ||
498 | acpi_integer *address); | ||
499 | |||
500 | acpi_status | ||
501 | acpi_ut_execute_HID ( | ||
502 | struct acpi_namespace_node *device_node, | ||
503 | struct acpi_device_id *hid); | ||
504 | |||
505 | acpi_status | ||
506 | acpi_ut_execute_CID ( | ||
507 | struct acpi_namespace_node *device_node, | ||
508 | struct acpi_compatible_id_list **return_cid_list); | ||
509 | |||
510 | acpi_status | ||
511 | acpi_ut_execute_STA ( | ||
512 | struct acpi_namespace_node *device_node, | ||
513 | u32 *status_flags); | ||
514 | |||
515 | acpi_status | ||
516 | acpi_ut_execute_UID ( | ||
517 | struct acpi_namespace_node *device_node, | ||
518 | struct acpi_device_id *uid); | ||
519 | |||
520 | acpi_status | ||
521 | acpi_ut_execute_sxds ( | ||
522 | struct acpi_namespace_node *device_node, | ||
523 | u8 *highest); | ||
524 | |||
525 | /* | ||
526 | * ut_mutex - mutual exclusion interfaces | ||
527 | */ | ||
528 | |||
529 | acpi_status | ||
530 | acpi_ut_mutex_initialize ( | ||
531 | void); | ||
532 | |||
533 | void | ||
534 | acpi_ut_mutex_terminate ( | ||
535 | void); | ||
536 | |||
537 | acpi_status | ||
538 | acpi_ut_create_mutex ( | ||
539 | acpi_mutex_handle mutex_id); | ||
540 | |||
541 | acpi_status | ||
542 | acpi_ut_delete_mutex ( | ||
543 | acpi_mutex_handle mutex_id); | ||
544 | |||
545 | acpi_status | ||
546 | acpi_ut_acquire_mutex ( | ||
547 | acpi_mutex_handle mutex_id); | ||
548 | |||
549 | acpi_status | ||
550 | acpi_ut_release_mutex ( | ||
551 | acpi_mutex_handle mutex_id); | ||
552 | |||
553 | |||
554 | /* | ||
555 | * ut_object - internal object create/delete/cache routines | ||
556 | */ | ||
557 | |||
558 | union acpi_operand_object * | ||
559 | acpi_ut_create_internal_object_dbg ( | ||
560 | char *module_name, | ||
561 | u32 line_number, | ||
562 | u32 component_id, | ||
563 | acpi_object_type type); | ||
564 | |||
565 | void * | ||
566 | acpi_ut_allocate_object_desc_dbg ( | ||
567 | char *module_name, | ||
568 | u32 line_number, | ||
569 | u32 component_id); | ||
570 | |||
571 | #define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t) | ||
572 | #define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT) | ||
573 | |||
574 | void | ||
575 | acpi_ut_delete_object_desc ( | ||
576 | union acpi_operand_object *object); | ||
577 | |||
578 | u8 | ||
579 | acpi_ut_valid_internal_object ( | ||
580 | void *object); | ||
581 | |||
582 | union acpi_operand_object * | ||
583 | acpi_ut_create_buffer_object ( | ||
584 | acpi_size buffer_size); | ||
585 | |||
586 | union acpi_operand_object * | ||
587 | acpi_ut_create_string_object ( | ||
588 | acpi_size string_size); | ||
589 | |||
590 | |||
591 | /* | ||
592 | * ut_ref_cnt - Object reference count management | ||
593 | */ | ||
594 | |||
595 | void | ||
596 | acpi_ut_add_reference ( | ||
597 | union acpi_operand_object *object); | ||
598 | |||
599 | void | ||
600 | acpi_ut_remove_reference ( | ||
601 | union acpi_operand_object *object); | ||
602 | |||
603 | /* | ||
604 | * ut_size - Object size routines | ||
605 | */ | ||
606 | |||
607 | acpi_status | ||
608 | acpi_ut_get_simple_object_size ( | ||
609 | union acpi_operand_object *obj, | ||
610 | acpi_size *obj_length); | ||
611 | |||
612 | acpi_status | ||
613 | acpi_ut_get_package_object_size ( | ||
614 | union acpi_operand_object *obj, | ||
615 | acpi_size *obj_length); | ||
616 | |||
617 | acpi_status | ||
618 | acpi_ut_get_object_size( | ||
619 | union acpi_operand_object *obj, | ||
620 | acpi_size *obj_length); | ||
621 | |||
622 | acpi_status | ||
623 | acpi_ut_get_element_length ( | ||
624 | u8 object_type, | ||
625 | union acpi_operand_object *source_object, | ||
626 | union acpi_generic_state *state, | ||
627 | void *context); | ||
628 | |||
629 | |||
630 | /* | ||
631 | * ut_state - Generic state creation/cache routines | ||
632 | */ | ||
633 | |||
634 | void | ||
635 | acpi_ut_push_generic_state ( | ||
636 | union acpi_generic_state **list_head, | ||
637 | union acpi_generic_state *state); | ||
638 | |||
639 | union acpi_generic_state * | ||
640 | acpi_ut_pop_generic_state ( | ||
641 | union acpi_generic_state **list_head); | ||
642 | |||
643 | |||
644 | union acpi_generic_state * | ||
645 | acpi_ut_create_generic_state ( | ||
646 | void); | ||
647 | |||
648 | struct acpi_thread_state * | ||
649 | acpi_ut_create_thread_state ( | ||
650 | void); | ||
651 | |||
652 | union acpi_generic_state * | ||
653 | acpi_ut_create_update_state ( | ||
654 | union acpi_operand_object *object, | ||
655 | u16 action); | ||
656 | |||
657 | union acpi_generic_state * | ||
658 | acpi_ut_create_pkg_state ( | ||
659 | void *internal_object, | ||
660 | void *external_object, | ||
661 | u16 index); | ||
662 | |||
663 | acpi_status | ||
664 | acpi_ut_create_update_state_and_push ( | ||
665 | union acpi_operand_object *object, | ||
666 | u16 action, | ||
667 | union acpi_generic_state **state_list); | ||
668 | |||
669 | #ifdef ACPI_FUTURE_USAGE | ||
670 | acpi_status | ||
671 | acpi_ut_create_pkg_state_and_push ( | ||
672 | void *internal_object, | ||
673 | void *external_object, | ||
674 | u16 index, | ||
675 | union acpi_generic_state **state_list); | ||
676 | #endif | ||
677 | |||
678 | union acpi_generic_state * | ||
679 | acpi_ut_create_control_state ( | ||
680 | void); | ||
681 | |||
682 | void | ||
683 | acpi_ut_delete_generic_state ( | ||
684 | union acpi_generic_state *state); | ||
685 | |||
686 | #ifdef ACPI_ENABLE_OBJECT_CACHE | ||
687 | void | ||
688 | acpi_ut_delete_generic_state_cache ( | ||
689 | void); | ||
690 | |||
691 | void | ||
692 | acpi_ut_delete_object_cache ( | ||
693 | void); | ||
694 | #endif | ||
695 | |||
696 | /* | ||
697 | * utmisc | ||
698 | */ | ||
699 | |||
700 | void | ||
701 | acpi_ut_print_string ( | ||
702 | char *string, | ||
703 | u8 max_length); | ||
704 | |||
705 | acpi_status | ||
706 | acpi_ut_divide ( | ||
707 | acpi_integer in_dividend, | ||
708 | acpi_integer in_divisor, | ||
709 | acpi_integer *out_quotient, | ||
710 | acpi_integer *out_remainder); | ||
711 | |||
712 | acpi_status | ||
713 | acpi_ut_short_divide ( | ||
714 | acpi_integer in_dividend, | ||
715 | u32 divisor, | ||
716 | acpi_integer *out_quotient, | ||
717 | u32 *out_remainder); | ||
718 | |||
719 | u8 | ||
720 | acpi_ut_valid_acpi_name ( | ||
721 | u32 name); | ||
722 | |||
723 | u8 | ||
724 | acpi_ut_valid_acpi_character ( | ||
725 | char character); | ||
726 | |||
727 | acpi_status | ||
728 | acpi_ut_strtoul64 ( | ||
729 | char *string, | ||
730 | u32 base, | ||
731 | acpi_integer *ret_integer); | ||
732 | |||
733 | /* Values for Base above (16=Hex, 10=Decimal) */ | ||
734 | |||
735 | #define ACPI_ANY_BASE 0 | ||
736 | |||
737 | #ifdef ACPI_FUTURE_USAGE | ||
738 | char * | ||
739 | acpi_ut_strupr ( | ||
740 | char *src_string); | ||
741 | #endif | ||
742 | |||
743 | u8 * | ||
744 | acpi_ut_get_resource_end_tag ( | ||
745 | union acpi_operand_object *obj_desc); | ||
746 | |||
747 | u8 | ||
748 | acpi_ut_generate_checksum ( | ||
749 | u8 *buffer, | ||
750 | u32 length); | ||
751 | |||
752 | u32 | ||
753 | acpi_ut_dword_byte_swap ( | ||
754 | u32 value); | ||
755 | |||
756 | void | ||
757 | acpi_ut_set_integer_width ( | ||
758 | u8 revision); | ||
759 | |||
760 | #ifdef ACPI_DEBUG_OUTPUT | ||
761 | void | ||
762 | acpi_ut_display_init_pathname ( | ||
763 | u8 type, | ||
764 | struct acpi_namespace_node *obj_handle, | ||
765 | char *path); | ||
766 | |||
767 | #endif | ||
768 | |||
769 | |||
770 | /* | ||
771 | * Utalloc - memory allocation and object caching | ||
772 | */ | ||
773 | |||
774 | void * | ||
775 | acpi_ut_acquire_from_cache ( | ||
776 | u32 list_id); | ||
777 | |||
778 | void | ||
779 | acpi_ut_release_to_cache ( | ||
780 | u32 list_id, | ||
781 | void *object); | ||
782 | |||
783 | #ifdef ACPI_ENABLE_OBJECT_CACHE | ||
784 | void | ||
785 | acpi_ut_delete_generic_cache ( | ||
786 | u32 list_id); | ||
787 | #endif | ||
788 | |||
789 | acpi_status | ||
790 | acpi_ut_validate_buffer ( | ||
791 | struct acpi_buffer *buffer); | ||
792 | |||
793 | acpi_status | ||
794 | acpi_ut_initialize_buffer ( | ||
795 | struct acpi_buffer *buffer, | ||
796 | acpi_size required_length); | ||
797 | |||
798 | |||
799 | /* Memory allocation functions */ | ||
800 | |||
801 | void * | ||
802 | acpi_ut_allocate ( | ||
803 | acpi_size size, | ||
804 | u32 component, | ||
805 | char *module, | ||
806 | u32 line); | ||
807 | |||
808 | void * | ||
809 | acpi_ut_callocate ( | ||
810 | acpi_size size, | ||
811 | u32 component, | ||
812 | char *module, | ||
813 | u32 line); | ||
814 | |||
815 | |||
816 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
817 | |||
818 | void * | ||
819 | acpi_ut_allocate_and_track ( | ||
820 | acpi_size size, | ||
821 | u32 component, | ||
822 | char *module, | ||
823 | u32 line); | ||
824 | |||
825 | void * | ||
826 | acpi_ut_callocate_and_track ( | ||
827 | acpi_size size, | ||
828 | u32 component, | ||
829 | char *module, | ||
830 | u32 line); | ||
831 | |||
832 | void | ||
833 | acpi_ut_free_and_track ( | ||
834 | void *address, | ||
835 | u32 component, | ||
836 | char *module, | ||
837 | u32 line); | ||
838 | |||
839 | struct acpi_debug_mem_block * | ||
840 | acpi_ut_find_allocation ( | ||
841 | u32 list_id, | ||
842 | void *allocation); | ||
843 | |||
844 | acpi_status | ||
845 | acpi_ut_track_allocation ( | ||
846 | u32 list_id, | ||
847 | struct acpi_debug_mem_block *address, | ||
848 | acpi_size size, | ||
849 | u8 alloc_type, | ||
850 | u32 component, | ||
851 | char *module, | ||
852 | u32 line); | ||
853 | |||
854 | acpi_status | ||
855 | acpi_ut_remove_allocation ( | ||
856 | u32 list_id, | ||
857 | struct acpi_debug_mem_block *address, | ||
858 | u32 component, | ||
859 | char *module, | ||
860 | u32 line); | ||
861 | |||
862 | #ifdef ACPI_FUTURE_USAGE | ||
863 | void | ||
864 | acpi_ut_dump_allocation_info ( | ||
865 | void); | ||
866 | #endif | ||
867 | |||
868 | void | ||
869 | acpi_ut_dump_allocations ( | ||
870 | u32 component, | ||
871 | char *module); | ||
872 | #endif | ||
873 | |||
874 | |||
875 | #endif /* _ACUTILS_H */ | ||
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h new file mode 100644 index 000000000000..2ec538eac58e --- /dev/null +++ b/include/acpi/amlcode.h | |||
@@ -0,0 +1,518 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: amlcode.h - Definitions for AML, as included in "definition blocks" | ||
4 | * Declarations and definitions contained herein are derived | ||
5 | * directly from the ACPI specification. | ||
6 | * | ||
7 | *****************************************************************************/ | ||
8 | |||
9 | /* | ||
10 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
11 | * All rights reserved. | ||
12 | * | ||
13 | * Redistribution and use in source and binary forms, with or without | ||
14 | * modification, are permitted provided that the following conditions | ||
15 | * are met: | ||
16 | * 1. Redistributions of source code must retain the above copyright | ||
17 | * notice, this list of conditions, and the following disclaimer, | ||
18 | * without modification. | ||
19 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
20 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
21 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
22 | * including a substantially similar Disclaimer requirement for further | ||
23 | * binary redistribution. | ||
24 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
25 | * of any contributors may be used to endorse or promote products derived | ||
26 | * from this software without specific prior written permission. | ||
27 | * | ||
28 | * Alternatively, this software may be distributed under the terms of the | ||
29 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
30 | * Software Foundation. | ||
31 | * | ||
32 | * NO WARRANTY | ||
33 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
34 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
35 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
36 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
37 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
38 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
39 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
40 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
41 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
42 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
43 | * POSSIBILITY OF SUCH DAMAGES. | ||
44 | */ | ||
45 | |||
46 | #ifndef __AMLCODE_H__ | ||
47 | #define __AMLCODE_H__ | ||
48 | |||
49 | /* primary opcodes */ | ||
50 | |||
51 | #define AML_NULL_CHAR (u16) 0x00 | ||
52 | |||
53 | #define AML_ZERO_OP (u16) 0x00 | ||
54 | #define AML_ONE_OP (u16) 0x01 | ||
55 | #define AML_UNASSIGNED (u16) 0x02 | ||
56 | #define AML_ALIAS_OP (u16) 0x06 | ||
57 | #define AML_NAME_OP (u16) 0x08 | ||
58 | #define AML_BYTE_OP (u16) 0x0a | ||
59 | #define AML_WORD_OP (u16) 0x0b | ||
60 | #define AML_DWORD_OP (u16) 0x0c | ||
61 | #define AML_STRING_OP (u16) 0x0d | ||
62 | #define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */ | ||
63 | #define AML_SCOPE_OP (u16) 0x10 | ||
64 | #define AML_BUFFER_OP (u16) 0x11 | ||
65 | #define AML_PACKAGE_OP (u16) 0x12 | ||
66 | #define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */ | ||
67 | #define AML_METHOD_OP (u16) 0x14 | ||
68 | #define AML_DUAL_NAME_PREFIX (u16) 0x2e | ||
69 | #define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f | ||
70 | #define AML_NAME_CHAR_SUBSEQ (u16) 0x30 | ||
71 | #define AML_NAME_CHAR_FIRST (u16) 0x41 | ||
72 | #define AML_OP_PREFIX (u16) 0x5b | ||
73 | #define AML_ROOT_PREFIX (u16) 0x5c | ||
74 | #define AML_PARENT_PREFIX (u16) 0x5e | ||
75 | #define AML_LOCAL_OP (u16) 0x60 | ||
76 | #define AML_LOCAL0 (u16) 0x60 | ||
77 | #define AML_LOCAL1 (u16) 0x61 | ||
78 | #define AML_LOCAL2 (u16) 0x62 | ||
79 | #define AML_LOCAL3 (u16) 0x63 | ||
80 | #define AML_LOCAL4 (u16) 0x64 | ||
81 | #define AML_LOCAL5 (u16) 0x65 | ||
82 | #define AML_LOCAL6 (u16) 0x66 | ||
83 | #define AML_LOCAL7 (u16) 0x67 | ||
84 | #define AML_ARG_OP (u16) 0x68 | ||
85 | #define AML_ARG0 (u16) 0x68 | ||
86 | #define AML_ARG1 (u16) 0x69 | ||
87 | #define AML_ARG2 (u16) 0x6a | ||
88 | #define AML_ARG3 (u16) 0x6b | ||
89 | #define AML_ARG4 (u16) 0x6c | ||
90 | #define AML_ARG5 (u16) 0x6d | ||
91 | #define AML_ARG6 (u16) 0x6e | ||
92 | #define AML_STORE_OP (u16) 0x70 | ||
93 | #define AML_REF_OF_OP (u16) 0x71 | ||
94 | #define AML_ADD_OP (u16) 0x72 | ||
95 | #define AML_CONCAT_OP (u16) 0x73 | ||
96 | #define AML_SUBTRACT_OP (u16) 0x74 | ||
97 | #define AML_INCREMENT_OP (u16) 0x75 | ||
98 | #define AML_DECREMENT_OP (u16) 0x76 | ||
99 | #define AML_MULTIPLY_OP (u16) 0x77 | ||
100 | #define AML_DIVIDE_OP (u16) 0x78 | ||
101 | #define AML_SHIFT_LEFT_OP (u16) 0x79 | ||
102 | #define AML_SHIFT_RIGHT_OP (u16) 0x7a | ||
103 | #define AML_BIT_AND_OP (u16) 0x7b | ||
104 | #define AML_BIT_NAND_OP (u16) 0x7c | ||
105 | #define AML_BIT_OR_OP (u16) 0x7d | ||
106 | #define AML_BIT_NOR_OP (u16) 0x7e | ||
107 | #define AML_BIT_XOR_OP (u16) 0x7f | ||
108 | #define AML_BIT_NOT_OP (u16) 0x80 | ||
109 | #define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81 | ||
110 | #define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82 | ||
111 | #define AML_DEREF_OF_OP (u16) 0x83 | ||
112 | #define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */ | ||
113 | #define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */ | ||
114 | #define AML_NOTIFY_OP (u16) 0x86 | ||
115 | #define AML_SIZE_OF_OP (u16) 0x87 | ||
116 | #define AML_INDEX_OP (u16) 0x88 | ||
117 | #define AML_MATCH_OP (u16) 0x89 | ||
118 | #define AML_CREATE_DWORD_FIELD_OP (u16) 0x8a | ||
119 | #define AML_CREATE_WORD_FIELD_OP (u16) 0x8b | ||
120 | #define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c | ||
121 | #define AML_CREATE_BIT_FIELD_OP (u16) 0x8d | ||
122 | #define AML_TYPE_OP (u16) 0x8e | ||
123 | #define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ | ||
124 | #define AML_LAND_OP (u16) 0x90 | ||
125 | #define AML_LOR_OP (u16) 0x91 | ||
126 | #define AML_LNOT_OP (u16) 0x92 | ||
127 | #define AML_LEQUAL_OP (u16) 0x93 | ||
128 | #define AML_LGREATER_OP (u16) 0x94 | ||
129 | #define AML_LLESS_OP (u16) 0x95 | ||
130 | #define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */ | ||
131 | #define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */ | ||
132 | #define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */ | ||
133 | #define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */ | ||
134 | #define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */ | ||
135 | #define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */ | ||
136 | #define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */ | ||
137 | #define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */ | ||
138 | #define AML_IF_OP (u16) 0xa0 | ||
139 | #define AML_ELSE_OP (u16) 0xa1 | ||
140 | #define AML_WHILE_OP (u16) 0xa2 | ||
141 | #define AML_NOOP_OP (u16) 0xa3 | ||
142 | #define AML_RETURN_OP (u16) 0xa4 | ||
143 | #define AML_BREAK_OP (u16) 0xa5 | ||
144 | #define AML_BREAK_POINT_OP (u16) 0xcc | ||
145 | #define AML_ONES_OP (u16) 0xff | ||
146 | |||
147 | /* prefixed opcodes */ | ||
148 | |||
149 | #define AML_EXTOP (u16) 0x005b | ||
150 | |||
151 | |||
152 | #define AML_MUTEX_OP (u16) 0x5b01 | ||
153 | #define AML_EVENT_OP (u16) 0x5b02 | ||
154 | #define AML_SHIFT_RIGHT_BIT_OP (u16) 0x5b10 | ||
155 | #define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11 | ||
156 | #define AML_COND_REF_OF_OP (u16) 0x5b12 | ||
157 | #define AML_CREATE_FIELD_OP (u16) 0x5b13 | ||
158 | #define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */ | ||
159 | #define AML_LOAD_OP (u16) 0x5b20 | ||
160 | #define AML_STALL_OP (u16) 0x5b21 | ||
161 | #define AML_SLEEP_OP (u16) 0x5b22 | ||
162 | #define AML_ACQUIRE_OP (u16) 0x5b23 | ||
163 | #define AML_SIGNAL_OP (u16) 0x5b24 | ||
164 | #define AML_WAIT_OP (u16) 0x5b25 | ||
165 | #define AML_RESET_OP (u16) 0x5b26 | ||
166 | #define AML_RELEASE_OP (u16) 0x5b27 | ||
167 | #define AML_FROM_BCD_OP (u16) 0x5b28 | ||
168 | #define AML_TO_BCD_OP (u16) 0x5b29 | ||
169 | #define AML_UNLOAD_OP (u16) 0x5b2a | ||
170 | #define AML_REVISION_OP (u16) 0x5b30 | ||
171 | #define AML_DEBUG_OP (u16) 0x5b31 | ||
172 | #define AML_FATAL_OP (u16) 0x5b32 | ||
173 | #define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ | ||
174 | #define AML_REGION_OP (u16) 0x5b80 | ||
175 | #define AML_FIELD_OP (u16) 0x5b81 | ||
176 | #define AML_DEVICE_OP (u16) 0x5b82 | ||
177 | #define AML_PROCESSOR_OP (u16) 0x5b83 | ||
178 | #define AML_POWER_RES_OP (u16) 0x5b84 | ||
179 | #define AML_THERMAL_ZONE_OP (u16) 0x5b85 | ||
180 | #define AML_INDEX_FIELD_OP (u16) 0x5b86 | ||
181 | #define AML_BANK_FIELD_OP (u16) 0x5b87 | ||
182 | #define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ | ||
183 | |||
184 | |||
185 | /* Bogus opcodes (they are actually two separate opcodes) */ | ||
186 | |||
187 | #define AML_LGREATEREQUAL_OP (u16) 0x9295 | ||
188 | #define AML_LLESSEQUAL_OP (u16) 0x9294 | ||
189 | #define AML_LNOTEQUAL_OP (u16) 0x9293 | ||
190 | |||
191 | |||
192 | /* | ||
193 | * Internal opcodes | ||
194 | * Use only "Unknown" AML opcodes, don't attempt to use | ||
195 | * any valid ACPI ASCII values (A-Z, 0-9, '-') | ||
196 | */ | ||
197 | |||
198 | #define AML_INT_NAMEPATH_OP (u16) 0x002d | ||
199 | #define AML_INT_NAMEDFIELD_OP (u16) 0x0030 | ||
200 | #define AML_INT_RESERVEDFIELD_OP (u16) 0x0031 | ||
201 | #define AML_INT_ACCESSFIELD_OP (u16) 0x0032 | ||
202 | #define AML_INT_BYTELIST_OP (u16) 0x0033 | ||
203 | #define AML_INT_STATICSTRING_OP (u16) 0x0034 | ||
204 | #define AML_INT_METHODCALL_OP (u16) 0x0035 | ||
205 | #define AML_INT_RETURN_VALUE_OP (u16) 0x0036 | ||
206 | #define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037 | ||
207 | |||
208 | |||
209 | #define ARG_NONE 0x0 | ||
210 | |||
211 | /* | ||
212 | * Argument types for the AML Parser | ||
213 | * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments. | ||
214 | * There can be up to 31 unique argument types | ||
215 | * Zero is reserved as end-of-list indicator | ||
216 | */ | ||
217 | |||
218 | #define ARGP_BYTEDATA 0x01 | ||
219 | #define ARGP_BYTELIST 0x02 | ||
220 | #define ARGP_CHARLIST 0x03 | ||
221 | #define ARGP_DATAOBJ 0x04 | ||
222 | #define ARGP_DATAOBJLIST 0x05 | ||
223 | #define ARGP_DWORDDATA 0x06 | ||
224 | #define ARGP_FIELDLIST 0x07 | ||
225 | #define ARGP_NAME 0x08 | ||
226 | #define ARGP_NAMESTRING 0x09 | ||
227 | #define ARGP_OBJLIST 0x0A | ||
228 | #define ARGP_PKGLENGTH 0x0B | ||
229 | #define ARGP_SUPERNAME 0x0C | ||
230 | #define ARGP_TARGET 0x0D | ||
231 | #define ARGP_TERMARG 0x0E | ||
232 | #define ARGP_TERMLIST 0x0F | ||
233 | #define ARGP_WORDDATA 0x10 | ||
234 | #define ARGP_QWORDDATA 0x11 | ||
235 | #define ARGP_SIMPLENAME 0x12 | ||
236 | |||
237 | /* | ||
238 | * Resolved argument types for the AML Interpreter | ||
239 | * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments. | ||
240 | * There can be up to 31 unique argument types (0 is end-of-arg-list indicator) | ||
241 | * | ||
242 | * Note1: These values are completely independent from the ACPI_TYPEs | ||
243 | * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER | ||
244 | * | ||
245 | * Note2: If and when 5 bits becomes insufficient, it would probably be best | ||
246 | * to convert to a 6-byte array of argument types, allowing 8 bits per argument. | ||
247 | */ | ||
248 | |||
249 | /* Single, simple types */ | ||
250 | |||
251 | #define ARGI_ANYTYPE 0x01 /* Don't care */ | ||
252 | #define ARGI_PACKAGE 0x02 | ||
253 | #define ARGI_EVENT 0x03 | ||
254 | #define ARGI_MUTEX 0x04 | ||
255 | #define ARGI_DDBHANDLE 0x05 | ||
256 | |||
257 | /* Interchangeable types (via implicit conversion) */ | ||
258 | |||
259 | #define ARGI_INTEGER 0x06 | ||
260 | #define ARGI_STRING 0x07 | ||
261 | #define ARGI_BUFFER 0x08 | ||
262 | #define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ | ||
263 | #define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ | ||
264 | |||
265 | /* Reference objects */ | ||
266 | |||
267 | #define ARGI_INTEGER_REF 0x0B | ||
268 | #define ARGI_OBJECT_REF 0x0C | ||
269 | #define ARGI_DEVICE_REF 0x0D | ||
270 | #define ARGI_REFERENCE 0x0E | ||
271 | #define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ | ||
272 | #define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ | ||
273 | #define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ | ||
274 | |||
275 | /* Multiple/complex types */ | ||
276 | |||
277 | #define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator*/ | ||
278 | #define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ | ||
279 | #define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ | ||
280 | #define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */ | ||
281 | #define ARGI_DATAREFOBJ 0x16 | ||
282 | |||
283 | /* Note: types above can expand to 0x1F maximum */ | ||
284 | |||
285 | #define ARGI_INVALID_OPCODE 0xFFFFFFFF | ||
286 | |||
287 | |||
288 | /* | ||
289 | * hash offsets | ||
290 | */ | ||
291 | #define AML_EXTOP_HASH_OFFSET 22 | ||
292 | #define AML_LNOT_HASH_OFFSET 19 | ||
293 | |||
294 | |||
295 | /* | ||
296 | * opcode groups and types | ||
297 | */ | ||
298 | |||
299 | #define OPGRP_NAMED 0x01 | ||
300 | #define OPGRP_FIELD 0x02 | ||
301 | #define OPGRP_BYTELIST 0x04 | ||
302 | |||
303 | |||
304 | /* | ||
305 | * Opcode information | ||
306 | */ | ||
307 | |||
308 | /* Opcode flags */ | ||
309 | |||
310 | #define AML_LOGICAL 0x0001 | ||
311 | #define AML_LOGICAL_NUMERIC 0x0002 | ||
312 | #define AML_MATH 0x0004 | ||
313 | #define AML_CREATE 0x0008 | ||
314 | #define AML_FIELD 0x0010 | ||
315 | #define AML_DEFER 0x0020 | ||
316 | #define AML_NAMED 0x0040 | ||
317 | #define AML_NSNODE 0x0080 | ||
318 | #define AML_NSOPCODE 0x0100 | ||
319 | #define AML_NSOBJECT 0x0200 | ||
320 | #define AML_HAS_RETVAL 0x0400 | ||
321 | #define AML_HAS_TARGET 0x0800 | ||
322 | #define AML_HAS_ARGS 0x1000 | ||
323 | #define AML_CONSTANT 0x2000 | ||
324 | #define AML_NO_OPERAND_RESOLVE 0x4000 | ||
325 | |||
326 | /* Convenient flag groupings */ | ||
327 | |||
328 | #define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL | ||
329 | #define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ | ||
330 | #define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ | ||
331 | #define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET | ||
332 | #define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */ | ||
333 | #define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ | ||
334 | #define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ | ||
335 | #define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */ | ||
336 | #define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL | ||
337 | #define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS | ||
338 | #define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL | ||
339 | #define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL | ||
340 | |||
341 | |||
342 | /* | ||
343 | * The opcode Type is used in a dispatch table, do not change | ||
344 | * without updating the table. | ||
345 | */ | ||
346 | #define AML_TYPE_EXEC_0A_0T_1R 0x00 | ||
347 | #define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ | ||
348 | #define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ | ||
349 | #define AML_TYPE_EXEC_1A_1T_0R 0x03 | ||
350 | #define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ | ||
351 | #define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ | ||
352 | #define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ | ||
353 | #define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ | ||
354 | #define AML_TYPE_EXEC_2A_2T_1R 0x08 | ||
355 | #define AML_TYPE_EXEC_3A_0T_0R 0x09 | ||
356 | #define AML_TYPE_EXEC_3A_1T_1R 0x0A | ||
357 | #define AML_TYPE_EXEC_6A_0T_1R 0x0B | ||
358 | /* End of types used in dispatch table */ | ||
359 | |||
360 | #define AML_TYPE_LITERAL 0x0B | ||
361 | #define AML_TYPE_CONSTANT 0x0C | ||
362 | #define AML_TYPE_METHOD_ARGUMENT 0x0D | ||
363 | #define AML_TYPE_LOCAL_VARIABLE 0x0E | ||
364 | #define AML_TYPE_DATA_TERM 0x0F | ||
365 | |||
366 | /* Generic for an op that returns a value */ | ||
367 | |||
368 | #define AML_TYPE_METHOD_CALL 0x10 | ||
369 | |||
370 | /* Misc */ | ||
371 | |||
372 | #define AML_TYPE_CREATE_FIELD 0x11 | ||
373 | #define AML_TYPE_CREATE_OBJECT 0x12 | ||
374 | #define AML_TYPE_CONTROL 0x13 | ||
375 | #define AML_TYPE_NAMED_NO_OBJ 0x14 | ||
376 | #define AML_TYPE_NAMED_FIELD 0x15 | ||
377 | #define AML_TYPE_NAMED_SIMPLE 0x16 | ||
378 | #define AML_TYPE_NAMED_COMPLEX 0x17 | ||
379 | #define AML_TYPE_RETURN 0x18 | ||
380 | |||
381 | #define AML_TYPE_UNDEFINED 0x19 | ||
382 | #define AML_TYPE_BOGUS 0x1A | ||
383 | |||
384 | |||
385 | /* | ||
386 | * Opcode classes | ||
387 | */ | ||
388 | #define AML_CLASS_EXECUTE 0x00 | ||
389 | #define AML_CLASS_CREATE 0x01 | ||
390 | #define AML_CLASS_ARGUMENT 0x02 | ||
391 | #define AML_CLASS_NAMED_OBJECT 0x03 | ||
392 | #define AML_CLASS_CONTROL 0x04 | ||
393 | #define AML_CLASS_ASCII 0x05 | ||
394 | #define AML_CLASS_PREFIX 0x06 | ||
395 | #define AML_CLASS_INTERNAL 0x07 | ||
396 | #define AML_CLASS_RETURN_VALUE 0x08 | ||
397 | #define AML_CLASS_METHOD_CALL 0x09 | ||
398 | #define AML_CLASS_UNKNOWN 0x0A | ||
399 | |||
400 | |||
401 | /* Predefined Operation Region space_iDs */ | ||
402 | |||
403 | typedef enum | ||
404 | { | ||
405 | REGION_MEMORY = 0, | ||
406 | REGION_IO, | ||
407 | REGION_PCI_CONFIG, | ||
408 | REGION_EC, | ||
409 | REGION_SMBUS, | ||
410 | REGION_CMOS, | ||
411 | REGION_PCI_BAR, | ||
412 | REGION_DATA_TABLE, /* Internal use only */ | ||
413 | REGION_FIXED_HW = 0x7F | ||
414 | |||
415 | } AML_REGION_TYPES; | ||
416 | |||
417 | |||
418 | /* Comparison operation codes for match_op operator */ | ||
419 | |||
420 | typedef enum | ||
421 | { | ||
422 | MATCH_MTR = 0, | ||
423 | MATCH_MEQ = 1, | ||
424 | MATCH_MLE = 2, | ||
425 | MATCH_MLT = 3, | ||
426 | MATCH_MGE = 4, | ||
427 | MATCH_MGT = 5 | ||
428 | |||
429 | } AML_MATCH_OPERATOR; | ||
430 | |||
431 | #define MAX_MATCH_OPERATOR 5 | ||
432 | |||
433 | |||
434 | /* | ||
435 | * field_flags | ||
436 | * | ||
437 | * This byte is extracted from the AML and includes three separate | ||
438 | * pieces of information about the field: | ||
439 | * 1) The field access type | ||
440 | * 2) The field update rule | ||
441 | * 3) The lock rule for the field | ||
442 | * | ||
443 | * Bits 00 - 03 : access_type (any_acc, byte_acc, etc.) | ||
444 | * 04 : lock_rule (1 == Lock) | ||
445 | * 05 - 06 : update_rule | ||
446 | */ | ||
447 | #define AML_FIELD_ACCESS_TYPE_MASK 0x0F | ||
448 | #define AML_FIELD_LOCK_RULE_MASK 0x10 | ||
449 | #define AML_FIELD_UPDATE_RULE_MASK 0x60 | ||
450 | |||
451 | |||
452 | /* 1) Field Access Types */ | ||
453 | |||
454 | typedef enum | ||
455 | { | ||
456 | AML_FIELD_ACCESS_ANY = 0x00, | ||
457 | AML_FIELD_ACCESS_BYTE = 0x01, | ||
458 | AML_FIELD_ACCESS_WORD = 0x02, | ||
459 | AML_FIELD_ACCESS_DWORD = 0x03, | ||
460 | AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ | ||
461 | AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ | ||
462 | |||
463 | } AML_ACCESS_TYPE; | ||
464 | |||
465 | |||
466 | /* 2) Field Lock Rules */ | ||
467 | |||
468 | typedef enum | ||
469 | { | ||
470 | AML_FIELD_LOCK_NEVER = 0x00, | ||
471 | AML_FIELD_LOCK_ALWAYS = 0x10 | ||
472 | |||
473 | } AML_LOCK_RULE; | ||
474 | |||
475 | |||
476 | /* 3) Field Update Rules */ | ||
477 | |||
478 | typedef enum | ||
479 | { | ||
480 | AML_FIELD_UPDATE_PRESERVE = 0x00, | ||
481 | AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, | ||
482 | AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 | ||
483 | |||
484 | } AML_UPDATE_RULE; | ||
485 | |||
486 | |||
487 | /* | ||
488 | * Field Access Attributes. | ||
489 | * This byte is extracted from the AML via the | ||
490 | * access_as keyword | ||
491 | */ | ||
492 | typedef enum | ||
493 | { | ||
494 | AML_FIELD_ATTRIB_SMB_QUICK = 0x02, | ||
495 | AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, | ||
496 | AML_FIELD_ATTRIB_SMB_BYTE = 0x06, | ||
497 | AML_FIELD_ATTRIB_SMB_WORD = 0x08, | ||
498 | AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, | ||
499 | AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, | ||
500 | AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D | ||
501 | |||
502 | } AML_ACCESS_ATTRIBUTE; | ||
503 | |||
504 | |||
505 | /* Bit fields in method_flags byte */ | ||
506 | |||
507 | #define AML_METHOD_ARG_COUNT 0x07 | ||
508 | #define AML_METHOD_SERIALIZED 0x08 | ||
509 | #define AML_METHOD_SYNCH_LEVEL 0xF0 | ||
510 | |||
511 | /* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */ | ||
512 | |||
513 | #define AML_METHOD_INTERNAL_ONLY 0x01 | ||
514 | #define AML_METHOD_RESERVED1 0x02 | ||
515 | #define AML_METHOD_RESERVED2 0x04 | ||
516 | |||
517 | |||
518 | #endif /* __AMLCODE_H__ */ | ||
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h new file mode 100644 index 000000000000..b20ec303df07 --- /dev/null +++ b/include/acpi/amlresrc.h | |||
@@ -0,0 +1,353 @@ | |||
1 | |||
2 | /****************************************************************************** | ||
3 | * | ||
4 | * Module Name: amlresrc.h - AML resource descriptors | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | |||
46 | #ifndef __AMLRESRC_H | ||
47 | #define __AMLRESRC_H | ||
48 | |||
49 | |||
50 | #define ASL_RESNAME_ADDRESS "_ADR" | ||
51 | #define ASL_RESNAME_ALIGNMENT "_ALN" | ||
52 | #define ASL_RESNAME_ADDRESSSPACE "_ASI" | ||
53 | #define ASL_RESNAME_ACCESSSIZE "_ASZ" | ||
54 | #define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" | ||
55 | #define ASL_RESNAME_BASEADDRESS "_BAS" | ||
56 | #define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ | ||
57 | #define ASL_RESNAME_DECODE "_DEC" | ||
58 | #define ASL_RESNAME_DMA "_DMA" | ||
59 | #define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ | ||
60 | #define ASL_RESNAME_GRANULARITY "_GRA" | ||
61 | #define ASL_RESNAME_INTERRUPT "_INT" | ||
62 | #define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ | ||
63 | #define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ | ||
64 | #define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ | ||
65 | #define ASL_RESNAME_LENGTH "_LEN" | ||
66 | #define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ | ||
67 | #define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ | ||
68 | #define ASL_RESNAME_MAXADDR "_MAX" | ||
69 | #define ASL_RESNAME_MINADDR "_MIN" | ||
70 | #define ASL_RESNAME_MAXTYPE "_MAF" | ||
71 | #define ASL_RESNAME_MINTYPE "_MIF" | ||
72 | #define ASL_RESNAME_REGISTERBITOFFSET "_RBO" | ||
73 | #define ASL_RESNAME_REGISTERBITWIDTH "_RBW" | ||
74 | #define ASL_RESNAME_RANGETYPE "_RNG" | ||
75 | #define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ | ||
76 | #define ASL_RESNAME_TRANSLATION "_TRA" | ||
77 | #define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ | ||
78 | #define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ | ||
79 | #define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ | ||
80 | |||
81 | |||
82 | /* Default sizes for "small" resource descriptors */ | ||
83 | |||
84 | #define ASL_RDESC_IRQ_SIZE 0x02 | ||
85 | #define ASL_RDESC_DMA_SIZE 0x02 | ||
86 | #define ASL_RDESC_ST_DEPEND_SIZE 0x00 | ||
87 | #define ASL_RDESC_END_DEPEND_SIZE 0x00 | ||
88 | #define ASL_RDESC_IO_SIZE 0x07 | ||
89 | #define ASL_RDESC_FIXED_IO_SIZE 0x03 | ||
90 | #define ASL_RDESC_END_TAG_SIZE 0x01 | ||
91 | |||
92 | |||
93 | struct asl_resource_node | ||
94 | { | ||
95 | u32 buffer_length; | ||
96 | void *buffer; | ||
97 | struct asl_resource_node *next; | ||
98 | }; | ||
99 | |||
100 | |||
101 | /* | ||
102 | * Resource descriptors defined in the ACPI specification. | ||
103 | * | ||
104 | * Packing/alignment must be BYTE because these descriptors | ||
105 | * are used to overlay the AML byte stream. | ||
106 | */ | ||
107 | #pragma pack(1) | ||
108 | |||
109 | struct asl_irq_format_desc | ||
110 | { | ||
111 | u8 descriptor_type; | ||
112 | u16 irq_mask; | ||
113 | u8 flags; | ||
114 | }; | ||
115 | |||
116 | |||
117 | struct asl_irq_noflags_desc | ||
118 | { | ||
119 | u8 descriptor_type; | ||
120 | u16 irq_mask; | ||
121 | }; | ||
122 | |||
123 | |||
124 | struct asl_dma_format_desc | ||
125 | { | ||
126 | u8 descriptor_type; | ||
127 | u8 dma_channel_mask; | ||
128 | u8 flags; | ||
129 | }; | ||
130 | |||
131 | |||
132 | struct asl_start_dependent_desc | ||
133 | { | ||
134 | u8 descriptor_type; | ||
135 | u8 flags; | ||
136 | }; | ||
137 | |||
138 | |||
139 | struct asl_start_dependent_noprio_desc | ||
140 | { | ||
141 | u8 descriptor_type; | ||
142 | }; | ||
143 | |||
144 | |||
145 | struct asl_end_dependent_desc | ||
146 | { | ||
147 | u8 descriptor_type; | ||
148 | }; | ||
149 | |||
150 | |||
151 | struct asl_io_port_desc | ||
152 | { | ||
153 | u8 descriptor_type; | ||
154 | u8 information; | ||
155 | u16 address_min; | ||
156 | u16 address_max; | ||
157 | u8 alignment; | ||
158 | u8 length; | ||
159 | }; | ||
160 | |||
161 | |||
162 | struct asl_fixed_io_port_desc | ||
163 | { | ||
164 | u8 descriptor_type; | ||
165 | u16 base_address; | ||
166 | u8 length; | ||
167 | }; | ||
168 | |||
169 | |||
170 | struct asl_small_vendor_desc | ||
171 | { | ||
172 | u8 descriptor_type; | ||
173 | u8 vendor_defined[7]; | ||
174 | }; | ||
175 | |||
176 | |||
177 | struct asl_end_tag_desc | ||
178 | { | ||
179 | u8 descriptor_type; | ||
180 | u8 checksum; | ||
181 | }; | ||
182 | |||
183 | |||
184 | /* LARGE descriptors */ | ||
185 | |||
186 | struct asl_memory_24_desc | ||
187 | { | ||
188 | u8 descriptor_type; | ||
189 | u16 length; | ||
190 | u8 information; | ||
191 | u16 address_min; | ||
192 | u16 address_max; | ||
193 | u16 alignment; | ||
194 | u16 range_length; | ||
195 | }; | ||
196 | |||
197 | |||
198 | struct asl_large_vendor_desc | ||
199 | { | ||
200 | u8 descriptor_type; | ||
201 | u16 length; | ||
202 | u8 vendor_defined[1]; | ||
203 | }; | ||
204 | |||
205 | |||
206 | struct asl_memory_32_desc | ||
207 | { | ||
208 | u8 descriptor_type; | ||
209 | u16 length; | ||
210 | u8 information; | ||
211 | u32 address_min; | ||
212 | u32 address_max; | ||
213 | u32 alignment; | ||
214 | u32 range_length; | ||
215 | }; | ||
216 | |||
217 | |||
218 | struct asl_fixed_memory_32_desc | ||
219 | { | ||
220 | u8 descriptor_type; | ||
221 | u16 length; | ||
222 | u8 information; | ||
223 | u32 base_address; | ||
224 | u32 range_length; | ||
225 | }; | ||
226 | |||
227 | |||
228 | struct asl_extended_address_desc | ||
229 | { | ||
230 | u8 descriptor_type; | ||
231 | u16 length; | ||
232 | u8 resource_type; | ||
233 | u8 flags; | ||
234 | u8 specific_flags; | ||
235 | u8 revision_iD; | ||
236 | u8 reserved; | ||
237 | u64 granularity; | ||
238 | u64 address_min; | ||
239 | u64 address_max; | ||
240 | u64 translation_offset; | ||
241 | u64 address_length; | ||
242 | u64 type_specific_attributes; | ||
243 | u8 optional_fields[2]; /* Used for length calculation only */ | ||
244 | }; | ||
245 | |||
246 | #define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ | ||
247 | |||
248 | |||
249 | struct asl_qword_address_desc | ||
250 | { | ||
251 | u8 descriptor_type; | ||
252 | u16 length; | ||
253 | u8 resource_type; | ||
254 | u8 flags; | ||
255 | u8 specific_flags; | ||
256 | u64 granularity; | ||
257 | u64 address_min; | ||
258 | u64 address_max; | ||
259 | u64 translation_offset; | ||
260 | u64 address_length; | ||
261 | u8 optional_fields[2]; | ||
262 | }; | ||
263 | |||
264 | |||
265 | struct asl_dword_address_desc | ||
266 | { | ||
267 | u8 descriptor_type; | ||
268 | u16 length; | ||
269 | u8 resource_type; | ||
270 | u8 flags; | ||
271 | u8 specific_flags; | ||
272 | u32 granularity; | ||
273 | u32 address_min; | ||
274 | u32 address_max; | ||
275 | u32 translation_offset; | ||
276 | u32 address_length; | ||
277 | u8 optional_fields[2]; | ||
278 | }; | ||
279 | |||
280 | |||
281 | struct asl_word_address_desc | ||
282 | { | ||
283 | u8 descriptor_type; | ||
284 | u16 length; | ||
285 | u8 resource_type; | ||
286 | u8 flags; | ||
287 | u8 specific_flags; | ||
288 | u16 granularity; | ||
289 | u16 address_min; | ||
290 | u16 address_max; | ||
291 | u16 translation_offset; | ||
292 | u16 address_length; | ||
293 | u8 optional_fields[2]; | ||
294 | }; | ||
295 | |||
296 | |||
297 | struct asl_extended_xrupt_desc | ||
298 | { | ||
299 | u8 descriptor_type; | ||
300 | u16 length; | ||
301 | u8 flags; | ||
302 | u8 table_length; | ||
303 | u32 interrupt_number[1]; | ||
304 | /* res_source_index, res_source optional fields follow */ | ||
305 | }; | ||
306 | |||
307 | |||
308 | struct asl_general_register_desc | ||
309 | { | ||
310 | u8 descriptor_type; | ||
311 | u16 length; | ||
312 | u8 address_space_id; | ||
313 | u8 bit_width; | ||
314 | u8 bit_offset; | ||
315 | u8 access_size; /* ACPI 3.0, was Reserved */ | ||
316 | u64 address; | ||
317 | }; | ||
318 | |||
319 | /* restore default alignment */ | ||
320 | |||
321 | #pragma pack() | ||
322 | |||
323 | /* Union of all resource descriptors, so we can allocate the worst case */ | ||
324 | |||
325 | union asl_resource_desc | ||
326 | { | ||
327 | struct asl_irq_format_desc irq; | ||
328 | struct asl_dma_format_desc dma; | ||
329 | struct asl_start_dependent_desc std; | ||
330 | struct asl_end_dependent_desc end; | ||
331 | struct asl_io_port_desc iop; | ||
332 | struct asl_fixed_io_port_desc fio; | ||
333 | struct asl_small_vendor_desc smv; | ||
334 | struct asl_end_tag_desc et; | ||
335 | |||
336 | struct asl_memory_24_desc M24; | ||
337 | struct asl_large_vendor_desc lgv; | ||
338 | struct asl_memory_32_desc M32; | ||
339 | struct asl_fixed_memory_32_desc F32; | ||
340 | struct asl_qword_address_desc qas; | ||
341 | struct asl_dword_address_desc das; | ||
342 | struct asl_word_address_desc was; | ||
343 | struct asl_extended_address_desc eas; | ||
344 | struct asl_extended_xrupt_desc exx; | ||
345 | struct asl_general_register_desc grg; | ||
346 | u32 u32_item; | ||
347 | u16 u16_item; | ||
348 | u8 U8item; | ||
349 | }; | ||
350 | |||
351 | |||
352 | #endif | ||
353 | |||
diff --git a/include/acpi/container.h b/include/acpi/container.h new file mode 100644 index 000000000000..d716df04d9dc --- /dev/null +++ b/include/acpi/container.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __ACPI_CONTAINER_H | ||
2 | #define __ACPI_CONTAINER_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | |||
6 | struct acpi_container { | ||
7 | acpi_handle handle; | ||
8 | unsigned long sun; | ||
9 | int state; | ||
10 | }; | ||
11 | |||
12 | #endif /* __ACPI_CONTAINER_H */ | ||
13 | |||
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h new file mode 100644 index 000000000000..57bf9362335d --- /dev/null +++ b/include/acpi/platform/acenv.h | |||
@@ -0,0 +1,378 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acenv.h - Generation environment specific items | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACENV_H__ | ||
45 | #define __ACENV_H__ | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Configuration for ACPI tools and utilities | ||
50 | */ | ||
51 | |||
52 | #ifdef _ACPI_DUMP_APP | ||
53 | #ifndef MSDOS | ||
54 | #define ACPI_DEBUG_OUTPUT | ||
55 | #endif | ||
56 | #define ACPI_APPLICATION | ||
57 | #define ACPI_DISASSEMBLER | ||
58 | #define ACPI_NO_METHOD_EXECUTION | ||
59 | #define ACPI_USE_SYSTEM_CLIBRARY | ||
60 | #define ACPI_ENABLE_OBJECT_CACHE | ||
61 | #endif | ||
62 | |||
63 | #ifdef _ACPI_EXEC_APP | ||
64 | #undef DEBUGGER_THREADING | ||
65 | #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED | ||
66 | #define ACPI_DEBUG_OUTPUT | ||
67 | #define ACPI_APPLICATION | ||
68 | #define ACPI_DEBUGGER | ||
69 | #define ACPI_DISASSEMBLER | ||
70 | #define ACPI_USE_SYSTEM_CLIBRARY | ||
71 | #define ACPI_ENABLE_OBJECT_CACHE | ||
72 | #endif | ||
73 | |||
74 | #ifdef _ACPI_ASL_COMPILER | ||
75 | #define ACPI_DEBUG_OUTPUT | ||
76 | #define ACPI_APPLICATION | ||
77 | #define ACPI_DISASSEMBLER | ||
78 | #define ACPI_CONSTANT_EVAL_ONLY | ||
79 | #define ACPI_USE_SYSTEM_CLIBRARY | ||
80 | #define ACPI_ENABLE_OBJECT_CACHE | ||
81 | #endif | ||
82 | |||
83 | /* | ||
84 | * Environment configuration. The purpose of this file is to interface to the | ||
85 | * local generation environment. | ||
86 | * | ||
87 | * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. | ||
88 | * Otherwise, local versions of string/memory functions will be used. | ||
89 | * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and | ||
90 | * the standard header files may be used. | ||
91 | * | ||
92 | * The ACPI subsystem only uses low level C library functions that do not call | ||
93 | * operating system services and may therefore be inlined in the code. | ||
94 | * | ||
95 | * It may be necessary to tailor these include files to the target | ||
96 | * generation environment. | ||
97 | * | ||
98 | * | ||
99 | * Functions and constants used from each header: | ||
100 | * | ||
101 | * string.h: memcpy | ||
102 | * memset | ||
103 | * strcat | ||
104 | * strcmp | ||
105 | * strcpy | ||
106 | * strlen | ||
107 | * strncmp | ||
108 | * strncat | ||
109 | * strncpy | ||
110 | * | ||
111 | * stdlib.h: strtoul | ||
112 | * | ||
113 | * stdarg.h: va_list | ||
114 | * va_arg | ||
115 | * va_start | ||
116 | * va_end | ||
117 | * | ||
118 | */ | ||
119 | |||
120 | /*! [Begin] no source code translation */ | ||
121 | |||
122 | #if defined(__linux__) | ||
123 | #include "aclinux.h" | ||
124 | |||
125 | #elif defined(_AED_EFI) | ||
126 | #include "acefi.h" | ||
127 | |||
128 | #elif defined(WIN32) | ||
129 | #include "acwin.h" | ||
130 | |||
131 | #elif defined(WIN64) | ||
132 | #include "acwin64.h" | ||
133 | |||
134 | #elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ | ||
135 | #include "acdos16.h" | ||
136 | |||
137 | #elif defined(__FreeBSD__) | ||
138 | #include "acfreebsd.h" | ||
139 | |||
140 | #elif defined(__NetBSD__) | ||
141 | #include "acnetbsd.h" | ||
142 | |||
143 | #elif defined(MODESTO) | ||
144 | #include "acmodesto.h" | ||
145 | |||
146 | #elif defined(NETWARE) | ||
147 | #include "acnetware.h" | ||
148 | |||
149 | #else | ||
150 | |||
151 | /* All other environments */ | ||
152 | |||
153 | #define ACPI_USE_STANDARD_HEADERS | ||
154 | |||
155 | #define COMPILER_DEPENDENT_INT64 long long | ||
156 | #define COMPILER_DEPENDENT_UINT64 unsigned long long | ||
157 | |||
158 | /* | ||
159 | * This macro is used to tag functions as "printf-like" because | ||
160 | * some compilers can catch printf format string problems. MSVC | ||
161 | * doesn't, so this is proprocessed away. | ||
162 | */ | ||
163 | #define ACPI_PRINTF_LIKE_FUNC | ||
164 | |||
165 | #endif | ||
166 | |||
167 | /* | ||
168 | * Memory allocation tracking. Used only if | ||
169 | * 1) This is the debug version | ||
170 | * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) | ||
171 | */ | ||
172 | #ifdef ACPI_DEBUG_OUTPUT | ||
173 | #if ACPI_MACHINE_WIDTH != 16 | ||
174 | #define ACPI_DBG_TRACK_ALLOCATIONS | ||
175 | #endif | ||
176 | #endif | ||
177 | |||
178 | /*! [End] no source code translation !*/ | ||
179 | |||
180 | |||
181 | /* | ||
182 | * Debugger threading model | ||
183 | * Use single threaded if the entire subsystem is contained in an application | ||
184 | * Use multiple threaded when the subsystem is running in the kernel. | ||
185 | * | ||
186 | * By default the model is single threaded if ACPI_APPLICATION is set, | ||
187 | * multi-threaded if ACPI_APPLICATION is not set. | ||
188 | */ | ||
189 | #define DEBUGGER_SINGLE_THREADED 0 | ||
190 | #define DEBUGGER_MULTI_THREADED 1 | ||
191 | |||
192 | #ifndef DEBUGGER_THREADING | ||
193 | #ifdef ACPI_APPLICATION | ||
194 | #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED | ||
195 | |||
196 | #else | ||
197 | #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED | ||
198 | #endif | ||
199 | #endif /* !DEBUGGER_THREADING */ | ||
200 | |||
201 | /****************************************************************************** | ||
202 | * | ||
203 | * C library configuration | ||
204 | * | ||
205 | *****************************************************************************/ | ||
206 | |||
207 | #ifdef ACPI_USE_SYSTEM_CLIBRARY | ||
208 | /* | ||
209 | * Use the standard C library headers. | ||
210 | * We want to keep these to a minimum. | ||
211 | */ | ||
212 | |||
213 | #ifdef ACPI_USE_STANDARD_HEADERS | ||
214 | /* | ||
215 | * Use the standard headers from the standard locations | ||
216 | */ | ||
217 | #include <stdarg.h> | ||
218 | #include <stdlib.h> | ||
219 | #include <string.h> | ||
220 | #include <ctype.h> | ||
221 | |||
222 | #endif /* ACPI_USE_STANDARD_HEADERS */ | ||
223 | |||
224 | /* | ||
225 | * We will be linking to the standard Clib functions | ||
226 | */ | ||
227 | |||
228 | #define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) | ||
229 | #define ACPI_STRCHR(s1,c) strchr((s1), (c)) | ||
230 | |||
231 | #ifdef ACPI_FUTURE_USAGE | ||
232 | #define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s)) | ||
233 | #endif | ||
234 | |||
235 | #define ACPI_STRLEN(s) (acpi_size) strlen((s)) | ||
236 | #define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) | ||
237 | #define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n)) | ||
238 | #define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (acpi_size)(n)) | ||
239 | #define ACPI_STRCMP(d,s) strcmp((d), (s)) | ||
240 | #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) | ||
241 | #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) | ||
242 | #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) | ||
243 | #define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n)) | ||
244 | #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) | ||
245 | #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) | ||
246 | |||
247 | #define ACPI_TOUPPER toupper | ||
248 | #define ACPI_TOLOWER tolower | ||
249 | #define ACPI_IS_XDIGIT isxdigit | ||
250 | #define ACPI_IS_DIGIT isdigit | ||
251 | #define ACPI_IS_SPACE isspace | ||
252 | #define ACPI_IS_UPPER isupper | ||
253 | #define ACPI_IS_PRINT isprint | ||
254 | #define ACPI_IS_ALPHA isalpha | ||
255 | #define ACPI_IS_ASCII isascii | ||
256 | |||
257 | /****************************************************************************** | ||
258 | * | ||
259 | * Not using native C library, use local implementations | ||
260 | * | ||
261 | *****************************************************************************/ | ||
262 | #else | ||
263 | |||
264 | /* | ||
265 | * Use local definitions of C library macros and functions | ||
266 | * NOTE: The function implementations may not be as efficient | ||
267 | * as an inline or assembly code implementation provided by a | ||
268 | * native C library. | ||
269 | */ | ||
270 | |||
271 | #ifndef va_arg | ||
272 | |||
273 | #ifndef _VALIST | ||
274 | #define _VALIST | ||
275 | typedef char *va_list; | ||
276 | #endif /* _VALIST */ | ||
277 | |||
278 | /* | ||
279 | * Storage alignment properties | ||
280 | */ | ||
281 | |||
282 | #define _AUPBND (sizeof (acpi_native_int) - 1) | ||
283 | #define _ADNBND (sizeof (acpi_native_int) - 1) | ||
284 | |||
285 | /* | ||
286 | * Variable argument list macro definitions | ||
287 | */ | ||
288 | |||
289 | #define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) | ||
290 | #define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND)))) | ||
291 | #define va_end(ap) (void) 0 | ||
292 | #define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) | ||
293 | |||
294 | #endif /* va_arg */ | ||
295 | |||
296 | |||
297 | #define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) | ||
298 | #define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) | ||
299 | |||
300 | #ifdef ACPI_FUTURE_USAGE | ||
301 | #define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s)) | ||
302 | #endif | ||
303 | |||
304 | #define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s)) | ||
305 | #define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s)) | ||
306 | #define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n)) | ||
307 | #define ACPI_STRNCMP(d,s,n) acpi_ut_strncmp ((d), (s), (acpi_size)(n)) | ||
308 | #define ACPI_STRCMP(d,s) acpi_ut_strcmp ((d), (s)) | ||
309 | #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) | ||
310 | #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) | ||
311 | #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) | ||
312 | #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n)) | ||
313 | #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) | ||
314 | #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) | ||
315 | #define ACPI_TOUPPER acpi_ut_to_upper | ||
316 | #define ACPI_TOLOWER acpi_ut_to_lower | ||
317 | |||
318 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ | ||
319 | |||
320 | |||
321 | /****************************************************************************** | ||
322 | * | ||
323 | * Assembly code macros | ||
324 | * | ||
325 | *****************************************************************************/ | ||
326 | |||
327 | /* | ||
328 | * Handle platform- and compiler-specific assembly language differences. | ||
329 | * These should already have been defined by the platform includes above. | ||
330 | * | ||
331 | * Notes: | ||
332 | * 1) Interrupt 3 is used to break into a debugger | ||
333 | * 2) Interrupts are turned off during ACPI register setup | ||
334 | */ | ||
335 | |||
336 | /* Unrecognized compiler, use defaults */ | ||
337 | |||
338 | #ifndef ACPI_ASM_MACROS | ||
339 | |||
340 | /* | ||
341 | * Calling conventions: | ||
342 | * | ||
343 | * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) | ||
344 | * ACPI_EXTERNAL_XFACE - External ACPI interfaces | ||
345 | * ACPI_INTERNAL_XFACE - Internal ACPI interfaces | ||
346 | * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces | ||
347 | */ | ||
348 | #define ACPI_SYSTEM_XFACE | ||
349 | #define ACPI_EXTERNAL_XFACE | ||
350 | #define ACPI_INTERNAL_XFACE | ||
351 | #define ACPI_INTERNAL_VAR_XFACE | ||
352 | |||
353 | #define ACPI_ASM_MACROS | ||
354 | #define BREAKPOINT3 | ||
355 | #define ACPI_DISABLE_IRQS() | ||
356 | #define ACPI_ENABLE_IRQS() | ||
357 | #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq) | ||
358 | #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq) | ||
359 | |||
360 | #endif /* ACPI_ASM_MACROS */ | ||
361 | |||
362 | |||
363 | #ifdef ACPI_APPLICATION | ||
364 | |||
365 | /* Don't want software interrupts within a ring3 application */ | ||
366 | |||
367 | #undef BREAKPOINT3 | ||
368 | #define BREAKPOINT3 | ||
369 | #endif | ||
370 | |||
371 | |||
372 | /****************************************************************************** | ||
373 | * | ||
374 | * Compiler-specific information is contained in the compiler-specific | ||
375 | * headers. | ||
376 | * | ||
377 | *****************************************************************************/ | ||
378 | #endif /* __ACENV_H__ */ | ||
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h new file mode 100644 index 000000000000..91fda36b042b --- /dev/null +++ b/include/acpi/platform/acgcc.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acgcc.h - GCC specific defines, etc. | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACGCC_H__ | ||
45 | #define __ACGCC_H__ | ||
46 | |||
47 | /* This macro is used to tag functions as "printf-like" because | ||
48 | * some compilers (like GCC) can catch printf format string problems. | ||
49 | */ | ||
50 | #define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5))) | ||
51 | |||
52 | /* Some compilers complain about unused variables. Sometimes we don't want to | ||
53 | * use all the variables (most specifically for _THIS_MODULE). This allow us | ||
54 | * to to tell the compiler warning in a per-variable manner that a variable | ||
55 | * is unused. | ||
56 | */ | ||
57 | #define ACPI_UNUSED_VAR __attribute__ ((unused)) | ||
58 | |||
59 | #endif /* __ACGCC_H__ */ | ||
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h new file mode 100644 index 000000000000..a3de0db85694 --- /dev/null +++ b/include/acpi/platform/aclinux.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: aclinux.h - OS specific defines, etc. | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * 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 __ACLINUX_H__ | ||
45 | #define __ACLINUX_H__ | ||
46 | |||
47 | #define ACPI_USE_SYSTEM_CLIBRARY | ||
48 | #define ACPI_USE_DO_WHILE_0 | ||
49 | |||
50 | #ifdef __KERNEL__ | ||
51 | |||
52 | #include <linux/config.h> | ||
53 | #include <linux/string.h> | ||
54 | #include <linux/kernel.h> | ||
55 | #include <linux/ctype.h> | ||
56 | #include <asm/system.h> | ||
57 | #include <asm/atomic.h> | ||
58 | #include <asm/div64.h> | ||
59 | #include <asm/acpi.h> | ||
60 | |||
61 | #define strtoul simple_strtoul | ||
62 | |||
63 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG | ||
64 | |||
65 | #else /* !__KERNEL__ */ | ||
66 | |||
67 | #include <stdarg.h> | ||
68 | #include <string.h> | ||
69 | #include <stdlib.h> | ||
70 | #include <ctype.h> | ||
71 | #include <unistd.h> | ||
72 | |||
73 | #if defined(__ia64__) || defined(__x86_64__) | ||
74 | #define ACPI_MACHINE_WIDTH 64 | ||
75 | #define COMPILER_DEPENDENT_INT64 long | ||
76 | #define COMPILER_DEPENDENT_UINT64 unsigned long | ||
77 | #else | ||
78 | #define ACPI_MACHINE_WIDTH 32 | ||
79 | #define COMPILER_DEPENDENT_INT64 long long | ||
80 | #define COMPILER_DEPENDENT_UINT64 unsigned long long | ||
81 | #define ACPI_USE_NATIVE_DIVIDE | ||
82 | #endif | ||
83 | |||
84 | #define __cdecl | ||
85 | #define ACPI_FLUSH_CPU_CACHE() | ||
86 | #endif /* __KERNEL__ */ | ||
87 | |||
88 | /* Linux uses GCC */ | ||
89 | |||
90 | #include "acgcc.h" | ||
91 | |||
92 | #endif /* __ACLINUX_H__ */ | ||
diff --git a/include/acpi/processor.h b/include/acpi/processor.h new file mode 100644 index 000000000000..2f50a5bb0c78 --- /dev/null +++ b/include/acpi/processor.h | |||
@@ -0,0 +1,235 @@ | |||
1 | #ifndef __ACPI_PROCESSOR_H | ||
2 | #define __ACPI_PROCESSOR_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/config.h> | ||
6 | |||
7 | #define ACPI_PROCESSOR_BUSY_METRIC 10 | ||
8 | |||
9 | #define ACPI_PROCESSOR_MAX_POWER 8 | ||
10 | #define ACPI_PROCESSOR_MAX_C2_LATENCY 100 | ||
11 | #define ACPI_PROCESSOR_MAX_C3_LATENCY 1000 | ||
12 | |||
13 | #define ACPI_PROCESSOR_MAX_THROTTLING 16 | ||
14 | #define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */ | ||
15 | #define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4 | ||
16 | |||
17 | /* Power Management */ | ||
18 | |||
19 | struct acpi_processor_cx; | ||
20 | |||
21 | struct acpi_power_register { | ||
22 | u8 descriptor; | ||
23 | u16 length; | ||
24 | u8 space_id; | ||
25 | u8 bit_width; | ||
26 | u8 bit_offset; | ||
27 | u8 reserved; | ||
28 | u64 address; | ||
29 | } __attribute__ ((packed)); | ||
30 | |||
31 | |||
32 | struct acpi_processor_cx_policy { | ||
33 | u32 count; | ||
34 | struct acpi_processor_cx *state; | ||
35 | struct { | ||
36 | u32 time; | ||
37 | u32 ticks; | ||
38 | u32 count; | ||
39 | u32 bm; | ||
40 | } threshold; | ||
41 | }; | ||
42 | |||
43 | struct acpi_processor_cx { | ||
44 | u8 valid; | ||
45 | u8 type; | ||
46 | u32 address; | ||
47 | u32 latency; | ||
48 | u32 latency_ticks; | ||
49 | u32 power; | ||
50 | u32 usage; | ||
51 | struct acpi_processor_cx_policy promotion; | ||
52 | struct acpi_processor_cx_policy demotion; | ||
53 | }; | ||
54 | |||
55 | struct acpi_processor_power { | ||
56 | struct acpi_processor_cx *state; | ||
57 | unsigned long bm_check_timestamp; | ||
58 | u32 default_state; | ||
59 | u32 bm_activity; | ||
60 | int count; | ||
61 | struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; | ||
62 | }; | ||
63 | |||
64 | /* Performance Management */ | ||
65 | |||
66 | struct acpi_pct_register { | ||
67 | u8 descriptor; | ||
68 | u16 length; | ||
69 | u8 space_id; | ||
70 | u8 bit_width; | ||
71 | u8 bit_offset; | ||
72 | u8 reserved; | ||
73 | u64 address; | ||
74 | } __attribute__ ((packed)); | ||
75 | |||
76 | struct acpi_processor_px { | ||
77 | acpi_integer core_frequency; /* megahertz */ | ||
78 | acpi_integer power; /* milliWatts */ | ||
79 | acpi_integer transition_latency; /* microseconds */ | ||
80 | acpi_integer bus_master_latency; /* microseconds */ | ||
81 | acpi_integer control; /* control value */ | ||
82 | acpi_integer status; /* success indicator */ | ||
83 | }; | ||
84 | |||
85 | #define ACPI_PDC_REVISION_ID 0x1 | ||
86 | |||
87 | struct acpi_processor_performance { | ||
88 | unsigned int state; | ||
89 | unsigned int platform_limit; | ||
90 | struct acpi_pct_register control_register; | ||
91 | struct acpi_pct_register status_register; | ||
92 | unsigned int state_count; | ||
93 | struct acpi_processor_px *states; | ||
94 | |||
95 | /* the _PDC objects passed by the driver, if any */ | ||
96 | struct acpi_object_list *pdc; | ||
97 | }; | ||
98 | |||
99 | |||
100 | |||
101 | /* Throttling Control */ | ||
102 | |||
103 | struct acpi_processor_tx { | ||
104 | u16 power; | ||
105 | u16 performance; | ||
106 | }; | ||
107 | |||
108 | struct acpi_processor_throttling { | ||
109 | int state; | ||
110 | u32 address; | ||
111 | u8 duty_offset; | ||
112 | u8 duty_width; | ||
113 | int state_count; | ||
114 | struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING]; | ||
115 | }; | ||
116 | |||
117 | /* Limit Interface */ | ||
118 | |||
119 | struct acpi_processor_lx { | ||
120 | int px; /* performace state */ | ||
121 | int tx; /* throttle level */ | ||
122 | }; | ||
123 | |||
124 | struct acpi_processor_limit { | ||
125 | struct acpi_processor_lx state; /* current limit */ | ||
126 | struct acpi_processor_lx thermal; /* thermal limit */ | ||
127 | struct acpi_processor_lx user; /* user limit */ | ||
128 | }; | ||
129 | |||
130 | |||
131 | struct acpi_processor_flags { | ||
132 | u8 power:1; | ||
133 | u8 performance:1; | ||
134 | u8 throttling:1; | ||
135 | u8 limit:1; | ||
136 | u8 bm_control:1; | ||
137 | u8 bm_check:1; | ||
138 | u8 has_cst:1; | ||
139 | u8 power_setup_done:1; | ||
140 | }; | ||
141 | |||
142 | struct acpi_processor { | ||
143 | acpi_handle handle; | ||
144 | u32 acpi_id; | ||
145 | u32 id; | ||
146 | u32 pblk; | ||
147 | int performance_platform_limit; | ||
148 | struct acpi_processor_flags flags; | ||
149 | struct acpi_processor_power power; | ||
150 | struct acpi_processor_performance *performance; | ||
151 | struct acpi_processor_throttling throttling; | ||
152 | struct acpi_processor_limit limit; | ||
153 | }; | ||
154 | |||
155 | struct acpi_processor_errata { | ||
156 | u8 smp; | ||
157 | struct { | ||
158 | u8 throttle:1; | ||
159 | u8 fdma:1; | ||
160 | u8 reserved:6; | ||
161 | u32 bmisx; | ||
162 | } piix4; | ||
163 | }; | ||
164 | |||
165 | extern int acpi_processor_register_performance ( | ||
166 | struct acpi_processor_performance * performance, | ||
167 | unsigned int cpu); | ||
168 | extern void acpi_processor_unregister_performance ( | ||
169 | struct acpi_processor_performance * performance, | ||
170 | unsigned int cpu); | ||
171 | |||
172 | /* note: this locks both the calling module and the processor module | ||
173 | if a _PPC object exists, rmmod is disallowed then */ | ||
174 | int acpi_processor_notify_smm(struct module *calling_module); | ||
175 | |||
176 | |||
177 | |||
178 | /* for communication between multiple parts of the processor kernel module */ | ||
179 | extern struct acpi_processor *processors[NR_CPUS]; | ||
180 | extern struct acpi_processor_errata errata; | ||
181 | |||
182 | /* in processor_perflib.c */ | ||
183 | #ifdef CONFIG_CPU_FREQ | ||
184 | void acpi_processor_ppc_init(void); | ||
185 | void acpi_processor_ppc_exit(void); | ||
186 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr); | ||
187 | #else | ||
188 | static inline void acpi_processor_ppc_init(void) { return; } | ||
189 | static inline void acpi_processor_ppc_exit(void) { return; } | ||
190 | static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) { | ||
191 | static unsigned int printout = 1; | ||
192 | if (printout) { | ||
193 | printk(KERN_WARNING "Warning: Processor Platform Limit event detected, but not handled.\n"); | ||
194 | printk(KERN_WARNING "Consider compiling CPUfreq support into your kernel.\n"); | ||
195 | printout = 0; | ||
196 | } | ||
197 | return 0; | ||
198 | } | ||
199 | #endif /* CONFIG_CPU_FREQ */ | ||
200 | |||
201 | /* in processor_throttling.c */ | ||
202 | int acpi_processor_get_throttling_info (struct acpi_processor *pr); | ||
203 | int acpi_processor_set_throttling (struct acpi_processor *pr, int state); | ||
204 | ssize_t acpi_processor_write_throttling ( | ||
205 | struct file *file, | ||
206 | const char __user *buffer, | ||
207 | size_t count, | ||
208 | loff_t *data); | ||
209 | extern struct file_operations acpi_processor_throttling_fops; | ||
210 | |||
211 | /* in processor_idle.c */ | ||
212 | int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device); | ||
213 | int acpi_processor_cst_has_changed (struct acpi_processor *pr); | ||
214 | int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device); | ||
215 | |||
216 | |||
217 | /* in processor_thermal.c */ | ||
218 | int acpi_processor_get_limit_info (struct acpi_processor *pr); | ||
219 | ssize_t acpi_processor_write_limit ( | ||
220 | struct file *file, | ||
221 | const char __user *buffer, | ||
222 | size_t count, | ||
223 | loff_t *data); | ||
224 | extern struct file_operations acpi_processor_limit_fops; | ||
225 | |||
226 | #ifdef CONFIG_CPU_FREQ | ||
227 | void acpi_thermal_cpufreq_init(void); | ||
228 | void acpi_thermal_cpufreq_exit(void); | ||
229 | #else | ||
230 | static inline void acpi_thermal_cpufreq_init(void) { return; } | ||
231 | static inline void acpi_thermal_cpufreq_exit(void) { return; } | ||
232 | #endif | ||
233 | |||
234 | |||
235 | #endif | ||