]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - include/acpi/aclocal.h
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
[mirror_ubuntu-zesty-kernel.git] / include / acpi / aclocal.h
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 #define ACPI_MTX_EXECUTE 0
76 #define ACPI_MTX_INTERPRETER 1
77 #define ACPI_MTX_PARSER 2
78 #define ACPI_MTX_DISPATCHER 3
79 #define ACPI_MTX_TABLES 4
80 #define ACPI_MTX_OP_REGIONS 5
81 #define ACPI_MTX_NAMESPACE 6
82 #define ACPI_MTX_EVENTS 7
83 #define ACPI_MTX_HARDWARE 8
84 #define ACPI_MTX_CACHES 9
85 #define ACPI_MTX_MEMORY 10
86 #define ACPI_MTX_DEBUG_CMD_COMPLETE 11
87 #define ACPI_MTX_DEBUG_CMD_READY 12
88
89 #define MAX_MUTEX 12
90 #define NUM_MUTEX MAX_MUTEX+1
91
92
93 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
94 #ifdef DEFINE_ACPI_GLOBALS
95
96 /* Names for the mutexes used in the subsystem */
97
98 static char *acpi_gbl_mutex_names[] =
99 {
100 "ACPI_MTX_Execute",
101 "ACPI_MTX_Interpreter",
102 "ACPI_MTX_Parser",
103 "ACPI_MTX_Dispatcher",
104 "ACPI_MTX_Tables",
105 "ACPI_MTX_op_regions",
106 "ACPI_MTX_Namespace",
107 "ACPI_MTX_Events",
108 "ACPI_MTX_Hardware",
109 "ACPI_MTX_Caches",
110 "ACPI_MTX_Memory",
111 "ACPI_MTX_debug_cmd_complete",
112 "ACPI_MTX_debug_cmd_ready",
113 };
114
115 #endif
116 #endif
117
118
119 /* Table for the global mutexes */
120
121 struct acpi_mutex_info
122 {
123 acpi_mutex mutex;
124 u32 use_count;
125 u32 owner_id;
126 };
127
128 /* This owner ID means that the mutex is not in use (unlocked) */
129
130 #define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1)
131
132
133 /* Lock flag parameter for various interfaces */
134
135 #define ACPI_MTX_DO_NOT_LOCK 0
136 #define ACPI_MTX_LOCK 1
137
138
139 typedef u16 acpi_owner_id;
140 #define ACPI_OWNER_TYPE_TABLE 0x0
141 #define ACPI_OWNER_TYPE_METHOD 0x1
142 #define ACPI_FIRST_METHOD_ID 0x0001
143 #define ACPI_FIRST_TABLE_ID 0xF000
144
145
146 /* Field access granularities */
147
148 #define ACPI_FIELD_BYTE_GRANULARITY 1
149 #define ACPI_FIELD_WORD_GRANULARITY 2
150 #define ACPI_FIELD_DWORD_GRANULARITY 4
151 #define ACPI_FIELD_QWORD_GRANULARITY 8
152
153
154 /*****************************************************************************
155 *
156 * Namespace typedefs and structs
157 *
158 ****************************************************************************/
159
160 /* Operational modes of the AML interpreter/scanner */
161
162 typedef enum
163 {
164 ACPI_IMODE_LOAD_PASS1 = 0x01,
165 ACPI_IMODE_LOAD_PASS2 = 0x02,
166 ACPI_IMODE_EXECUTE = 0x0E
167
168 } acpi_interpreter_mode;
169
170
171 /*
172 * The Node describes a named object that appears in the AML
173 * An acpi_node is used to store Nodes.
174 *
175 * data_type is used to differentiate between internal descriptors, and MUST
176 * be the first byte in this structure.
177 */
178 union acpi_name_union
179 {
180 u32 integer;
181 char ascii[4];
182 };
183
184 struct acpi_namespace_node
185 {
186 u8 descriptor; /* Used to differentiate object descriptor types */
187 u8 type; /* Type associated with this name */
188 u16 owner_id;
189 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
190 union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
191 struct acpi_namespace_node *child; /* First child */
192 struct acpi_namespace_node *peer; /* Next peer*/
193 u16 reference_count; /* Current count of references and children */
194 u8 flags;
195 };
196
197
198 #define ACPI_ENTRY_NOT_FOUND NULL
199
200
201 /* Node flags */
202
203 #define ANOBJ_RESERVED 0x01
204 #define ANOBJ_END_OF_PEER_LIST 0x02
205 #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
206 #define ANOBJ_METHOD_ARG 0x08
207 #define ANOBJ_METHOD_LOCAL 0x10
208 #define ANOBJ_METHOD_NO_RETVAL 0x20
209 #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
210 #define ANOBJ_IS_BIT_OFFSET 0x80
211
212 /*
213 * ACPI Table Descriptor. One per ACPI table
214 */
215 struct acpi_table_desc
216 {
217 struct acpi_table_desc *prev;
218 struct acpi_table_desc *next;
219 struct acpi_table_desc *installed_desc;
220 struct acpi_table_header *pointer;
221 u8 *aml_start;
222 u64 physical_address;
223 u32 aml_length;
224 acpi_size length;
225 acpi_owner_id table_id;
226 u8 type;
227 u8 allocation;
228 u8 loaded_into_namespace;
229 };
230
231 struct acpi_table_list
232 {
233 struct acpi_table_desc *next;
234 u32 count;
235 };
236
237
238 struct acpi_find_context
239 {
240 char *search_for;
241 acpi_handle *list;
242 u32 *count;
243 };
244
245
246 struct acpi_ns_search_data
247 {
248 struct acpi_namespace_node *node;
249 };
250
251
252 /*
253 * Predefined Namespace items
254 */
255 struct acpi_predefined_names
256 {
257 char *name;
258 u8 type;
259 char *val;
260 };
261
262
263 /* Object types used during package copies */
264
265
266 #define ACPI_COPY_TYPE_SIMPLE 0
267 #define ACPI_COPY_TYPE_PACKAGE 1
268
269 /* Info structure used to convert external<->internal namestrings */
270
271 struct acpi_namestring_info
272 {
273 char *external_name;
274 char *next_external_char;
275 char *internal_name;
276 u32 length;
277 u32 num_segments;
278 u32 num_carats;
279 u8 fully_qualified;
280 };
281
282
283 /* Field creation info */
284
285 struct acpi_create_field_info
286 {
287 struct acpi_namespace_node *region_node;
288 struct acpi_namespace_node *field_node;
289 struct acpi_namespace_node *register_node;
290 struct acpi_namespace_node *data_register_node;
291 u32 bank_value;
292 u32 field_bit_position;
293 u32 field_bit_length;
294 u8 field_flags;
295 u8 attribute;
296 u8 field_type;
297 };
298
299
300 /*****************************************************************************
301 *
302 * Event typedefs and structs
303 *
304 ****************************************************************************/
305
306 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
307
308 struct acpi_handler_info
309 {
310 acpi_event_handler address; /* Address of handler, if any */
311 void *context; /* Context to be passed to handler */
312 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
313 };
314
315 union acpi_gpe_dispatch_info
316 {
317 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
318 struct acpi_handler_info *handler;
319 };
320
321 /*
322 * Information about a GPE, one per each GPE in an array.
323 * NOTE: Important to keep this struct as small as possible.
324 */
325 struct acpi_gpe_event_info
326 {
327 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
328 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
329 u8 flags; /* Misc info about this GPE */
330 u8 register_bit; /* This GPE bit within the register */
331 };
332
333 /* Information about a GPE register pair, one per each status/enable pair in an array */
334
335 struct acpi_gpe_register_info
336 {
337 struct acpi_generic_address status_address; /* Address of status reg */
338 struct acpi_generic_address enable_address; /* Address of enable reg */
339 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
340 u8 enable_for_run; /* GPEs to keep enabled when running */
341 u8 base_gpe_number; /* Base GPE number for this register */
342 };
343
344 /*
345 * Information about a GPE register block, one per each installed block --
346 * GPE0, GPE1, and one per each installed GPE Block Device.
347 */
348 struct acpi_gpe_block_info
349 {
350 struct acpi_namespace_node *node;
351 struct acpi_gpe_block_info *previous;
352 struct acpi_gpe_block_info *next;
353 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
354 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
355 struct acpi_gpe_event_info *event_info; /* One for each GPE */
356 struct acpi_generic_address block_address; /* Base address of the block */
357 u32 register_count; /* Number of register pairs in block */
358 u8 block_base_number;/* Base GPE number for this block */
359 };
360
361 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
362
363 struct acpi_gpe_xrupt_info
364 {
365 struct acpi_gpe_xrupt_info *previous;
366 struct acpi_gpe_xrupt_info *next;
367 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
368 u32 interrupt_number; /* System interrupt number */
369 };
370
371
372 struct acpi_gpe_walk_info
373 {
374 struct acpi_namespace_node *gpe_device;
375 struct acpi_gpe_block_info *gpe_block;
376 };
377
378
379 typedef acpi_status (*ACPI_GPE_CALLBACK) (
380 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
381 struct acpi_gpe_block_info *gpe_block);
382
383
384 /* Information about each particular fixed event */
385
386 struct acpi_fixed_event_handler
387 {
388 acpi_event_handler handler; /* Address of handler. */
389 void *context; /* Context to be passed to handler */
390 };
391
392 struct acpi_fixed_event_info
393 {
394 u8 status_register_id;
395 u8 enable_register_id;
396 u16 status_bit_mask;
397 u16 enable_bit_mask;
398 };
399
400 /* Information used during field processing */
401
402 struct acpi_field_info
403 {
404 u8 skip_field;
405 u8 field_flag;
406 u32 pkg_length;
407 };
408
409
410 /*****************************************************************************
411 *
412 * Generic "state" object for stacks
413 *
414 ****************************************************************************/
415
416 #define ACPI_CONTROL_NORMAL 0xC0
417 #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
418 #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
419 #define ACPI_CONTROL_PREDICATE_FALSE 0xC3
420 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4
421
422
423 /* Forward declarations */
424
425 struct acpi_walk_state ;
426 struct acpi_obj_mutex;
427 union acpi_parse_object ;
428
429
430 #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
431 u8 data_type; /* To differentiate various internal objs */\
432 u8 flags; \
433 u16 value; \
434 u16 state; \
435 u16 reserved; \
436 void *next; \
437
438 struct acpi_common_state
439 {
440 ACPI_STATE_COMMON
441 };
442
443
444 /*
445 * Update state - used to traverse complex objects such as packages
446 */
447 struct acpi_update_state
448 {
449 ACPI_STATE_COMMON
450 union acpi_operand_object *object;
451 };
452
453
454 /*
455 * Pkg state - used to traverse nested package structures
456 */
457 struct acpi_pkg_state
458 {
459 ACPI_STATE_COMMON
460 union acpi_operand_object *source_object;
461 union acpi_operand_object *dest_object;
462 struct acpi_walk_state *walk_state;
463 void *this_target_obj;
464 u32 num_packages;
465 u16 index;
466 };
467
468
469 /*
470 * Control state - one per if/else and while constructs.
471 * Allows nesting of these constructs
472 */
473 struct acpi_control_state
474 {
475 ACPI_STATE_COMMON
476 union acpi_parse_object *predicate_op;
477 u8 *aml_predicate_start; /* Start of if/while predicate */
478 u8 *package_end; /* End of if/while block */
479 u16 opcode;
480 };
481
482
483 /*
484 * Scope state - current scope during namespace lookups
485 */
486 struct acpi_scope_state
487 {
488 ACPI_STATE_COMMON
489 struct acpi_namespace_node *node;
490 };
491
492
493 struct acpi_pscope_state
494 {
495 ACPI_STATE_COMMON
496 union acpi_parse_object *op; /* Current op being parsed */
497 u8 *arg_end; /* Current argument end */
498 u8 *pkg_end; /* Current package end */
499 u32 arg_list; /* Next argument to parse */
500 u32 arg_count; /* Number of fixed arguments */
501 };
502
503
504 /*
505 * Thread state - one per thread across multiple walk states. Multiple walk
506 * states are created when there are nested control methods executing.
507 */
508 struct acpi_thread_state
509 {
510 ACPI_STATE_COMMON
511 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
512 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
513 u32 thread_id; /* Running thread ID */
514 u8 current_sync_level; /* Mutex Sync (nested acquire) level */
515 };
516
517
518 /*
519 * Result values - used to accumulate the results of nested
520 * AML arguments
521 */
522 struct acpi_result_values
523 {
524 ACPI_STATE_COMMON
525 union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS];
526 u8 num_results;
527 u8 last_insert;
528 };
529
530
531 typedef
532 acpi_status (*acpi_parse_downwards) (
533 struct acpi_walk_state *walk_state,
534 union acpi_parse_object **out_op);
535
536 typedef
537 acpi_status (*acpi_parse_upwards) (
538 struct acpi_walk_state *walk_state);
539
540
541 /*
542 * Notify info - used to pass info to the deferred notify
543 * handler/dispatcher.
544 */
545 struct acpi_notify_info
546 {
547 ACPI_STATE_COMMON
548 struct acpi_namespace_node *node;
549 union acpi_operand_object *handler_obj;
550 };
551
552
553 /* Generic state is union of structs above */
554
555 union acpi_generic_state
556 {
557 struct acpi_common_state common;
558 struct acpi_control_state control;
559 struct acpi_update_state update;
560 struct acpi_scope_state scope;
561 struct acpi_pscope_state parse_scope;
562 struct acpi_pkg_state pkg;
563 struct acpi_thread_state thread;
564 struct acpi_result_values results;
565 struct acpi_notify_info notify;
566 };
567
568
569 /*****************************************************************************
570 *
571 * Interpreter typedefs and structs
572 *
573 ****************************************************************************/
574
575 typedef
576 acpi_status (*ACPI_EXECUTE_OP) (
577 struct acpi_walk_state *walk_state);
578
579
580 /*****************************************************************************
581 *
582 * Parser typedefs and structs
583 *
584 ****************************************************************************/
585
586 /*
587 * AML opcode, name, and argument layout
588 */
589 struct acpi_opcode_info
590 {
591 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
592 char *name; /* Opcode name (disassembler/debug only) */
593 #endif
594 u32 parse_args; /* Grammar/Parse time arguments */
595 u32 runtime_args; /* Interpret time arguments */
596 u32 flags; /* Misc flags */
597 u8 object_type; /* Corresponding internal object type */
598 u8 class; /* Opcode class */
599 u8 type; /* Opcode type */
600 };
601
602 union acpi_parse_value
603 {
604 acpi_integer integer; /* Integer constant (Up to 64 bits) */
605 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
606 u32 size; /* bytelist or field size */
607 char *string; /* NULL terminated string */
608 u8 *buffer; /* buffer or string */
609 char *name; /* NULL terminated string */
610 union acpi_parse_object *arg; /* arguments and contained ops */
611 };
612
613 #define ACPI_PARSE_COMMON \
614 u8 data_type; /* To differentiate various internal objs */\
615 u8 flags; /* Type of Op */\
616 u16 aml_opcode; /* AML opcode */\
617 u32 aml_offset; /* Offset of declaration in AML */\
618 union acpi_parse_object *parent; /* Parent op */\
619 union acpi_parse_object *next; /* Next op */\
620 ACPI_DISASM_ONLY_MEMBERS (\
621 u8 disasm_flags; /* Used during AML disassembly */\
622 u8 disasm_opcode; /* Subtype used for disassembly */\
623 char aml_op_name[16]) /* Op name (debug only) */\
624 /* NON-DEBUG members below: */\
625 struct acpi_namespace_node *node; /* For use by interpreter */\
626 union acpi_parse_value value; /* Value or args associated with the opcode */\
627
628
629 #define ACPI_DASM_BUFFER 0x00
630 #define ACPI_DASM_RESOURCE 0x01
631 #define ACPI_DASM_STRING 0x02
632 #define ACPI_DASM_UNICODE 0x03
633 #define ACPI_DASM_EISAID 0x04
634 #define ACPI_DASM_MATCHOP 0x05
635
636 /*
637 * generic operation (for example: If, While, Store)
638 */
639 struct acpi_parse_obj_common
640 {
641 ACPI_PARSE_COMMON
642 };
643
644
645 /*
646 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
647 * and bytelists.
648 */
649 struct acpi_parse_obj_named
650 {
651 ACPI_PARSE_COMMON
652 u8 *path;
653 u8 *data; /* AML body or bytelist data */
654 u32 length; /* AML length */
655 u32 name; /* 4-byte name or zero if no name */
656 };
657
658
659 /* The parse node is the fundamental element of the parse tree */
660
661 struct acpi_parse_obj_asl
662 {
663 ACPI_PARSE_COMMON
664 union acpi_parse_object *child;
665 union acpi_parse_object *parent_method;
666 char *filename;
667 char *external_name;
668 char *namepath;
669 char name_seg[4];
670 u32 extra_value;
671 u32 column;
672 u32 line_number;
673 u32 logical_line_number;
674 u32 logical_byte_offset;
675 u32 end_line;
676 u32 end_logical_line;
677 u32 acpi_btype;
678 u32 aml_length;
679 u32 aml_subtree_length;
680 u32 final_aml_length;
681 u32 final_aml_offset;
682 u32 compile_flags;
683 u16 parse_opcode;
684 u8 aml_opcode_length;
685 u8 aml_pkg_len_bytes;
686 u8 extra;
687 char parse_op_name[12];
688 };
689
690 union acpi_parse_object
691 {
692 struct acpi_parse_obj_common common;
693 struct acpi_parse_obj_named named;
694 struct acpi_parse_obj_asl asl;
695 };
696
697
698 /*
699 * Parse state - one state per parser invocation and each control
700 * method.
701 */
702 struct acpi_parse_state
703 {
704 u32 aml_size;
705 u8 *aml_start; /* First AML byte */
706 u8 *aml; /* Next AML byte */
707 u8 *aml_end; /* (last + 1) AML byte */
708 u8 *pkg_start; /* Current package begin */
709 u8 *pkg_end; /* Current package end */
710 union acpi_parse_object *start_op; /* Root of parse tree */
711 struct acpi_namespace_node *start_node;
712 union acpi_generic_state *scope; /* Current scope */
713 union acpi_parse_object *start_scope;
714 };
715
716
717 /* Parse object flags */
718
719 #define ACPI_PARSEOP_GENERIC 0x01
720 #define ACPI_PARSEOP_NAMED 0x02
721 #define ACPI_PARSEOP_DEFERRED 0x04
722 #define ACPI_PARSEOP_BYTELIST 0x08
723 #define ACPI_PARSEOP_IN_CACHE 0x80
724
725 /* Parse object disasm_flags */
726
727 #define ACPI_PARSEOP_IGNORE 0x01
728 #define ACPI_PARSEOP_PARAMLIST 0x02
729 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
730 #define ACPI_PARSEOP_SPECIAL 0x10
731
732
733 /*****************************************************************************
734 *
735 * Hardware (ACPI registers) and PNP
736 *
737 ****************************************************************************/
738
739 #define PCI_ROOT_HID_STRING "PNP0A03"
740 #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
741
742 struct acpi_bit_register_info
743 {
744 u8 parent_register;
745 u8 bit_position;
746 u16 access_bit_mask;
747 };
748
749
750 /*
751 * Register IDs
752 * These are the full ACPI registers
753 */
754 #define ACPI_REGISTER_PM1_STATUS 0x01
755 #define ACPI_REGISTER_PM1_ENABLE 0x02
756 #define ACPI_REGISTER_PM1_CONTROL 0x03
757 #define ACPI_REGISTER_PM1A_CONTROL 0x04
758 #define ACPI_REGISTER_PM1B_CONTROL 0x05
759 #define ACPI_REGISTER_PM2_CONTROL 0x06
760 #define ACPI_REGISTER_PM_TIMER 0x07
761 #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
762 #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
763
764
765 /* Masks used to access the bit_registers */
766
767 #define ACPI_BITMASK_TIMER_STATUS 0x0001
768 #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
769 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
770 #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
771 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
772 #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
773 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
774 #define ACPI_BITMASK_WAKE_STATUS 0x8000
775
776 #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
777 ACPI_BITMASK_BUS_MASTER_STATUS | \
778 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
779 ACPI_BITMASK_POWER_BUTTON_STATUS | \
780 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
781 ACPI_BITMASK_RT_CLOCK_STATUS | \
782 ACPI_BITMASK_WAKE_STATUS)
783
784 #define ACPI_BITMASK_TIMER_ENABLE 0x0001
785 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
786 #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
787 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
788 #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
789 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
790
791 #define ACPI_BITMASK_SCI_ENABLE 0x0001
792 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
793 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
794 #define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
795 #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
796
797 #define ACPI_BITMASK_ARB_DISABLE 0x0001
798
799
800 /* Raw bit position of each bit_register */
801
802 #define ACPI_BITPOSITION_TIMER_STATUS 0x00
803 #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
804 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
805 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
806 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
807 #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
808 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
809 #define ACPI_BITPOSITION_WAKE_STATUS 0x0F
810
811 #define ACPI_BITPOSITION_TIMER_ENABLE 0x00
812 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
813 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
814 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
815 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
816 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
817
818 #define ACPI_BITPOSITION_SCI_ENABLE 0x00
819 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
820 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
821 #define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
822 #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
823
824 #define ACPI_BITPOSITION_ARB_DISABLE 0x00
825
826
827 /*****************************************************************************
828 *
829 * Resource descriptors
830 *
831 ****************************************************************************/
832
833 /* resource_type values */
834
835 #define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
836 #define ACPI_RESOURCE_TYPE_IO_RANGE 1
837 #define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
838
839 /* Resource descriptor types and masks */
840
841 #define ACPI_RDESC_TYPE_LARGE 0x80
842 #define ACPI_RDESC_TYPE_SMALL 0x00
843
844 #define ACPI_RDESC_TYPE_MASK 0x80
845 #define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
846
847
848 /*
849 * Small resource descriptor types
850 * Note: The 3 length bits (2:0) must be zero
851 */
852 #define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
853 #define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
854 #define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
855 #define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
856 #define ACPI_RDESC_TYPE_IO_PORT 0x40
857 #define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
858 #define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
859 #define ACPI_RDESC_TYPE_END_TAG 0x78
860
861 /*
862 * Large resource descriptor types
863 */
864 #define ACPI_RDESC_TYPE_MEMORY_24 0x81
865 #define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
866 #define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
867 #define ACPI_RDESC_TYPE_MEMORY_32 0x85
868 #define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
869 #define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
870 #define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
871 #define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
872 #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
873 #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B
874
875
876 /*****************************************************************************
877 *
878 * Miscellaneous
879 *
880 ****************************************************************************/
881
882 #define ACPI_ASCII_ZERO 0x30
883
884
885 /*****************************************************************************
886 *
887 * Debugger
888 *
889 ****************************************************************************/
890
891 struct acpi_db_method_info
892 {
893 acpi_handle thread_gate;
894 char *name;
895 char **args;
896 u32 flags;
897 u32 num_loops;
898 char pathname[128];
899 };
900
901 struct acpi_integrity_info
902 {
903 u32 nodes;
904 u32 objects;
905 };
906
907
908 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
909 #define ACPI_DB_CONSOLE_OUTPUT 0x02
910 #define ACPI_DB_DUPLICATE_OUTPUT 0x03
911
912
913 /*****************************************************************************
914 *
915 * Debug
916 *
917 ****************************************************************************/
918
919 struct acpi_debug_print_info
920 {
921 u32 component_id;
922 char *proc_name;
923 char *module_name;
924 };
925
926
927 /* Entry for a memory allocation (debug only) */
928
929 #define ACPI_MEM_MALLOC 0
930 #define ACPI_MEM_CALLOC 1
931 #define ACPI_MAX_MODULE_NAME 16
932
933 #define ACPI_COMMON_DEBUG_MEM_HEADER \
934 struct acpi_debug_mem_block *previous; \
935 struct acpi_debug_mem_block *next; \
936 u32 size; \
937 u32 component; \
938 u32 line; \
939 char module[ACPI_MAX_MODULE_NAME]; \
940 u8 alloc_type;
941
942 struct acpi_debug_mem_header
943 {
944 ACPI_COMMON_DEBUG_MEM_HEADER
945 };
946
947 struct acpi_debug_mem_block
948 {
949 ACPI_COMMON_DEBUG_MEM_HEADER
950 u64 user_space;
951 };
952
953
954 #define ACPI_MEM_LIST_GLOBAL 0
955 #define ACPI_MEM_LIST_NSNODE 1
956 #define ACPI_MEM_LIST_MAX 1
957 #define ACPI_NUM_MEM_LISTS 2
958
959
960 struct acpi_memory_list
961 {
962 char *list_name;
963 void *list_head;
964 u16 object_size;
965 u16 max_depth;
966 u16 current_depth;
967 u16 link_offset;
968
969 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
970
971 /* Statistics for debug memory tracking only */
972
973 u32 total_allocated;
974 u32 total_freed;
975 u32 current_total_size;
976 u32 requests;
977 u32 hits;
978 #endif
979 };
980
981 #endif /* __ACLOCAL_H__ */