aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h18
-rw-r--r--include/acpi/acdisasm.h173
-rw-r--r--include/acpi/acdispat.h6
-rw-r--r--include/acpi/acevents.h4
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acglobal.h29
-rw-r--r--include/acpi/aclocal.h284
-rw-r--r--include/acpi/acmacros.h81
-rw-r--r--include/acpi/acnamesp.h28
-rw-r--r--include/acpi/acobject.h188
-rw-r--r--include/acpi/acopcode.h2
-rw-r--r--include/acpi/acoutput.h10
-rw-r--r--include/acpi/acparser.h4
-rw-r--r--include/acpi/acpi_bus.h10
-rw-r--r--include/acpi/acpiosxf.h35
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/acresrc.h20
-rw-r--r--include/acpi/acstruct.h121
-rw-r--r--include/acpi/actables.h6
-rw-r--r--include/acpi/actbl.h400
-rw-r--r--include/acpi/actbl1.h639
-rw-r--r--include/acpi/actbl2.h230
-rw-r--r--include/acpi/actypes.h88
-rw-r--r--include/acpi/acutils.h95
-rw-r--r--include/acpi/amlcode.h6
-rw-r--r--include/acpi/amlresrc.h85
-rw-r--r--include/acpi/pdc_intel.h5
-rw-r--r--include/acpi/platform/acenv.h47
-rw-r--r--include/acpi/platform/aclinux.h23
-rw-r--r--include/acpi/processor.h27
-rw-r--r--include/asm-i386/apicdef.h1
-rw-r--r--include/asm-x86_64/acpi.h2
-rw-r--r--include/asm-x86_64/apicdef.h2
-rw-r--r--include/linux/cpufreq.h4
34 files changed, 1653 insertions, 1030 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index e27dc8f29972..b9beceb33141 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -63,7 +63,7 @@
63 63
64/* Current ACPICA subsystem version in YYYYMMDD format */ 64/* Current ACPICA subsystem version in YYYYMMDD format */
65 65
66#define ACPI_CA_VERSION 0x20060127 66#define ACPI_CA_VERSION 0x20060608
67 67
68/* 68/*
69 * OS name, used for the _OS object. The _OS object is essentially obsolete, 69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -81,6 +81,7 @@
81#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ 81#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
82#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ 82#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
83#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ 83#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
84#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
84 85
85/* 86/*
86 * Should the subsystem abort the loading of an ACPI table if the 87 * Should the subsystem abort the loading of an ACPI table if the
@@ -102,9 +103,9 @@
102 103
103#define ACPI_MAX_SEMAPHORE_COUNT 256 104#define ACPI_MAX_SEMAPHORE_COUNT 256
104 105
105/* Max reference count (for debug only) */ 106/* Maximum object reference count (detects object deletion issues) */
106 107
107#define ACPI_MAX_REFERENCE_COUNT 0x400 108#define ACPI_MAX_REFERENCE_COUNT 0x800
108 109
109/* Size of cached memory mapping for system memory operation region */ 110/* Size of cached memory mapping for system memory operation region */
110 111
@@ -171,12 +172,7 @@
171 172
172/* Array sizes. Used for range checking also */ 173/* Array sizes. Used for range checking also */
173 174
174#define ACPI_NUM_ACCESS_TYPES 6 175#define ACPI_MAX_MATCH_OPCODE 5
175#define ACPI_NUM_UPDATE_RULES 3
176#define ACPI_NUM_LOCK_RULES 2
177#define ACPI_NUM_MATCH_OPS 6
178#define ACPI_NUM_OPCODES 256
179#define ACPI_NUM_FIELD_NAMES 2
180 176
181/* RSDP checksums */ 177/* RSDP checksums */
182 178
@@ -187,10 +183,6 @@
187 183
188#define ACPI_SMBUS_BUFFER_SIZE 34 184#define ACPI_SMBUS_BUFFER_SIZE 34
189 185
190/* Number of strings associated with the _OSI reserved method */
191
192#define ACPI_NUM_OSI_STRINGS 10
193
194/****************************************************************************** 186/******************************************************************************
195 * 187 *
196 * ACPI AML Debugger 188 * ACPI AML Debugger
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index 11a8fe39cb04..9a7d6921f534 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -50,26 +50,72 @@
50#define BLOCK_PAREN 1 50#define BLOCK_PAREN 1
51#define BLOCK_BRACE 2 51#define BLOCK_BRACE 2
52#define BLOCK_COMMA_LIST 4 52#define BLOCK_COMMA_LIST 4
53#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD"
53 54
54struct acpi_external_list { 55struct acpi_external_list {
55 char *path; 56 char *path;
57 char *internal_path;
56 struct acpi_external_list *next; 58 struct acpi_external_list *next;
59 u32 value;
60 u16 length;
61 u8 type;
57}; 62};
58 63
59extern struct acpi_external_list *acpi_gbl_external_list; 64extern struct acpi_external_list *acpi_gbl_external_list;
60 65
61/* Strings used for decoding flags to ASL keywords */ 66typedef const struct acpi_dmtable_info {
67 u8 opcode;
68 u8 offset;
69 char *name;
70
71} acpi_dmtable_info;
72
73/*
74 * Values for Opcode above.
75 * Note: 0-7 must not change, used as a flag shift value
76 */
77#define ACPI_DMT_FLAG0 0
78#define ACPI_DMT_FLAG1 1
79#define ACPI_DMT_FLAG2 2
80#define ACPI_DMT_FLAG3 3
81#define ACPI_DMT_FLAG4 4
82#define ACPI_DMT_FLAG5 5
83#define ACPI_DMT_FLAG6 6
84#define ACPI_DMT_FLAG7 7
85#define ACPI_DMT_FLAGS0 8
86#define ACPI_DMT_FLAGS2 9
87#define ACPI_DMT_UINT8 10
88#define ACPI_DMT_UINT16 11
89#define ACPI_DMT_UINT24 12
90#define ACPI_DMT_UINT32 13
91#define ACPI_DMT_UINT56 14
92#define ACPI_DMT_UINT64 15
93#define ACPI_DMT_STRING 16
94#define ACPI_DMT_NAME4 17
95#define ACPI_DMT_NAME6 18
96#define ACPI_DMT_NAME8 19
97#define ACPI_DMT_CHKSUM 20
98#define ACPI_DMT_SPACEID 21
99#define ACPI_DMT_GAS 22
100#define ACPI_DMT_MADT 23
101#define ACPI_DMT_SRAT 24
102#define ACPI_DMT_EXIT 25
62 103
63extern const char *acpi_gbl_word_decode[4]; 104typedef
64extern const char *acpi_gbl_irq_decode[2]; 105void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table);
65extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; 106
66extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; 107struct acpi_dmtable_data {
67extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; 108 char *signature;
68extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; 109 struct acpi_dmtable_info *table_info;
110 ACPI_TABLE_HANDLER table_handler;
111};
69 112
70struct acpi_op_walk_info { 113struct acpi_op_walk_info {
71 u32 level; 114 u32 level;
115 u32 last_level;
116 u32 count;
72 u32 bit_offset; 117 u32 bit_offset;
118 u32 flags;
73 struct acpi_walk_state *walk_state; 119 struct acpi_walk_state *walk_state;
74}; 120};
75 121
@@ -77,6 +123,100 @@ typedef
77acpi_status(*asl_walk_callback) (union acpi_parse_object * op, 123acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
78 u32 level, void *context); 124 u32 level, void *context);
79 125
126struct acpi_resource_tag {
127 u32 bit_index;
128 char *tag;
129};
130
131/* Strings used for decoding flags to ASL keywords */
132
133extern const char *acpi_gbl_word_decode[];
134extern const char *acpi_gbl_irq_decode[];
135extern const char *acpi_gbl_lock_rule[];
136extern const char *acpi_gbl_access_types[];
137extern const char *acpi_gbl_update_rules[];
138extern const char *acpi_gbl_match_ops[];
139
140extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
141extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
142extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
143extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
144extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
145extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
146extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
147extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
148extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
149extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
150extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
151extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
152extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
153extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
154extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
155extern struct acpi_dmtable_info acpi_dm_table_info_header[];
156extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
157extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
158extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
159extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
160extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
161extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
162extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
163extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
164extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
165extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
166extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
167extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
168extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
169extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
170extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
171extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
172extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
173extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
174extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
175extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
176extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
177extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
178extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
179extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
180extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
181
182/*
183 * dmtable
184 */
185void acpi_dm_dump_data_table(struct acpi_table_header *table);
186
187void
188acpi_dm_dump_table(u32 table_length,
189 u32 table_offset,
190 void *table,
191 u32 sub_table_length, struct acpi_dmtable_info *info);
192
193void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
194
195void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
196
197/*
198 * dmtbdump
199 */
200void acpi_dm_dump_asf(struct acpi_table_header *table);
201
202void acpi_dm_dump_cpep(struct acpi_table_header *table);
203
204void acpi_dm_dump_fadt(struct acpi_table_header *table);
205
206void acpi_dm_dump_srat(struct acpi_table_header *table);
207
208void acpi_dm_dump_mcfg(struct acpi_table_header *table);
209
210void acpi_dm_dump_madt(struct acpi_table_header *table);
211
212u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
213
214void acpi_dm_dump_rsdt(struct acpi_table_header *table);
215
216void acpi_dm_dump_slit(struct acpi_table_header *table);
217
218void acpi_dm_dump_xsdt(struct acpi_table_header *table);
219
80/* 220/*
81 * dmwalk 221 * dmwalk
82 */ 222 */
@@ -84,6 +224,11 @@ void
84acpi_dm_disassemble(struct acpi_walk_state *walk_state, 224acpi_dm_disassemble(struct acpi_walk_state *walk_state,
85 union acpi_parse_object *origin, u32 num_opcodes); 225 union acpi_parse_object *origin, u32 num_opcodes);
86 226
227void
228acpi_dm_walk_parse_tree(union acpi_parse_object *op,
229 asl_walk_callback descending_callback,
230 asl_walk_callback ascending_callback, void *context);
231
87/* 232/*
88 * dmopcode 233 * dmopcode
89 */ 234 */
@@ -166,6 +311,7 @@ void acpi_dm_dump_integer64(u64 value, char *name);
166 311
167void 312void
168acpi_dm_resource_template(struct acpi_op_walk_info *info, 313acpi_dm_resource_template(struct acpi_op_walk_info *info,
314 union acpi_parse_object *op,
169 u8 * byte_data, u32 byte_count); 315 u8 * byte_data, u32 byte_count);
170 316
171u8 acpi_dm_is_resource_template(union acpi_parse_object *op); 317u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
@@ -176,6 +322,8 @@ void acpi_dm_bit_list(u16 mask);
176 322
177void acpi_dm_decode_attribute(u8 attribute); 323void acpi_dm_decode_attribute(u8 attribute);
178 324
325void acpi_dm_descriptor_name(void);
326
179/* 327/*
180 * dmresrcl 328 * dmresrcl
181 */ 329 */
@@ -248,6 +396,15 @@ acpi_dm_vendor_small_descriptor(union aml_resource *resource,
248/* 396/*
249 * dmutils 397 * dmutils
250 */ 398 */
251void acpi_dm_add_to_external_list(char *path); 399void acpi_dm_add_to_external_list(char *path, u8 type, u32 value);
400
401/*
402 * dmrestag
403 */
404void acpi_dm_find_resources(union acpi_parse_object *root);
405
406void
407acpi_dm_check_resource_reference(union acpi_parse_object *op,
408 struct acpi_walk_state *walk_state);
252 409
253#endif /* __ACDISASM_H__ */ 410#endif /* __ACDISASM_H__ */
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index c41a926ff317..288f84903af7 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -194,7 +194,9 @@ acpi_status
194acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, 194acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
195 union acpi_operand_object *return_desc); 195 union acpi_operand_object *return_desc);
196 196
197void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); 197void
198acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
199 struct acpi_walk_state *walk_state);
198 200
199acpi_status 201acpi_status
200acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, 202acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
@@ -302,7 +304,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
302 struct acpi_namespace_node *method_node, 304 struct acpi_namespace_node *method_node,
303 u8 * aml_start, 305 u8 * aml_start,
304 u32 aml_length, 306 u32 aml_length,
305 struct acpi_parameter_info *info, u8 pass_number); 307 struct acpi_evaluate_info *info, u8 pass_number);
306 308
307acpi_status 309acpi_status
308acpi_ds_obj_stack_pop_and_delete(u32 pop_count, 310acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index f2717be4fe0d..234142828e1a 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
93 */ 93 */
94u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); 94u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
95 95
96acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); 96acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback);
97 97
98acpi_status 98acpi_status
99acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, 99acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
@@ -138,7 +138,7 @@ acpi_status
138acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, 138acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
139 u32 function, 139 u32 function,
140 acpi_physical_address address, 140 acpi_physical_address address,
141 u32 bit_width, void *value); 141 u32 bit_width, acpi_integer * value);
142 142
143acpi_status 143acpi_status
144acpi_ev_attach_region(union acpi_operand_object *handler_obj, 144acpi_ev_attach_region(union acpi_operand_object *handler_obj,
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index dc768aa580e4..797ca1ea5214 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -160,8 +160,9 @@
160#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) 160#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML)
161#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) 161#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML)
162#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) 162#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML)
163#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0022 | AE_CODE_AML)
163 164
164#define AE_CODE_AML_MAX 0x0021 165#define AE_CODE_AML_MAX 0x0022
165 166
166/* 167/*
167 * Internal exceptions used for control 168 * Internal exceptions used for control
@@ -275,7 +276,8 @@ char const *acpi_gbl_exception_names_aml[] = {
275 "AE_AML_NO_RESOURCE_END_TAG", 276 "AE_AML_NO_RESOURCE_END_TAG",
276 "AE_AML_BAD_RESOURCE_VALUE", 277 "AE_AML_BAD_RESOURCE_VALUE",
277 "AE_AML_CIRCULAR_REFERENCE", 278 "AE_AML_CIRCULAR_REFERENCE",
278 "AE_AML_BAD_RESOURCE_LENGTH" 279 "AE_AML_BAD_RESOURCE_LENGTH",
280 "AE_AML_ILLEGAL_ADDRESS"
279}; 281};
280 282
281char const *acpi_gbl_exception_names_ctrl[] = { 283char const *acpi_gbl_exception_names_ctrl[] = {
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 734cc77bf2c7..14531d48f6b6 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -107,6 +107,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags;
107 * 3) Allow access to uninitialized locals/args (auto-init to integer 0) 107 * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
108 * 4) Allow ANY object type to be a source operand for the Store() operator 108 * 4) Allow ANY object type to be a source operand for the Store() operator
109 * 5) Allow unresolved references (invalid target name) in package objects 109 * 5) Allow unresolved references (invalid target name) in package objects
110 * 6) Enable warning messages for behavior that is not ACPI spec compliant
110 */ 111 */
111ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); 112ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
112 113
@@ -114,7 +115,7 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
114 * Automatically serialize ALL control methods? Default is FALSE, meaning 115 * Automatically serialize ALL control methods? Default is FALSE, meaning
115 * to use the Serialized/not_serialized method flags on a per method basis. 116 * to use the Serialized/not_serialized method flags on a per method basis.
116 * Only change this if the ASL code is poorly written and cannot handle 117 * Only change this if the ASL code is poorly written and cannot handle
117 * reentrancy even though methods are marked "not_serialized". 118 * reentrancy even though methods are marked "NotSerialized".
118 */ 119 */
119ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); 120ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
120 121
@@ -149,10 +150,10 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
149ACPI_EXTERN u32 acpi_gbl_table_flags; 150ACPI_EXTERN u32 acpi_gbl_table_flags;
150ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; 151ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
151ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; 152ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
152ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; 153ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT;
153ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; 154ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT;
154ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; 155ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
155ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; 156ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS;
156ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; 157ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
157/* 158/*
158 * Since there may be multiple SSDTs and PSDTs, a single pointer is not 159 * Since there may be multiple SSDTs and PSDTs, a single pointer is not
@@ -177,15 +178,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
177/* 178/*
178 * ACPI Table info arrays 179 * ACPI Table info arrays
179 */ 180 */
180extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; 181extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
181extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; 182extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
182 183
183/* 184/*
184 * Predefined mutex objects. This array contains the 185 * Predefined mutex objects. This array contains the
185 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. 186 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
186 * (The table maps local handles to the real OS handles) 187 * (The table maps local handles to the real OS handles)
187 */ 188 */
188ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; 189ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
189 190
190/***************************************************************************** 191/*****************************************************************************
191 * 192 *
@@ -203,6 +204,7 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
203 204
204/* Object caches */ 205/* Object caches */
205 206
207ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
206ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; 208ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
207ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; 209ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
208ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; 210ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
@@ -244,7 +246,6 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
244extern const char *acpi_gbl_highest_dstate_names[4]; 246extern const char *acpi_gbl_highest_dstate_names[4];
245extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 247extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
246extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; 248extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
247extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
248 249
249/***************************************************************************** 250/*****************************************************************************
250 * 251 *
@@ -291,14 +292,6 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step;
291 292
292/***************************************************************************** 293/*****************************************************************************
293 * 294 *
294 * Parser globals
295 *
296 ****************************************************************************/
297
298ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
299
300/*****************************************************************************
301 *
302 * Hardware globals 295 * Hardware globals
303 * 296 *
304 ****************************************************************************/ 297 ****************************************************************************/
@@ -321,7 +314,11 @@ ACPI_EXTERN struct acpi_fixed_event_handler
321ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; 314ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
322ACPI_EXTERN struct acpi_gpe_block_info 315ACPI_EXTERN struct acpi_gpe_block_info
323 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; 316 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
317
318/* Spinlocks */
319
324ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; 320ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
321ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock;
325 322
326/***************************************************************************** 323/*****************************************************************************
327 * 324 *
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 8361820d2970..1eeca7adca95 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -44,7 +44,10 @@
44#ifndef __ACLOCAL_H__ 44#ifndef __ACLOCAL_H__
45#define __ACLOCAL_H__ 45#define __ACLOCAL_H__
46 46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
47#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ 49#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
50#define ACPI_INFINITE_CONCURRENCY 0xFF
48 51
49typedef void *acpi_mutex; 52typedef void *acpi_mutex;
50typedef u32 acpi_mutex_handle; 53typedef u32 acpi_mutex_handle;
@@ -69,52 +72,55 @@ union acpi_parse_object;
69 * Predefined handles for the mutex objects used within the subsystem 72 * Predefined handles for the mutex objects used within the subsystem
70 * All mutex objects are automatically created by acpi_ut_mutex_initialize. 73 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
71 * 74 *
72 * The acquire/release ordering protocol is implied via this list. Mutexes 75 * The acquire/release ordering protocol is implied via this list. Mutexes
73 * with a lower value must be acquired before mutexes with a higher value. 76 * with a lower value must be acquired before mutexes with a higher value.
74 * 77 *
75 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! 78 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
79 * table below also!
76 */ 80 */
77#define ACPI_MTX_EXECUTE 0 81#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
78#define ACPI_MTX_INTERPRETER 1 82#define ACPI_MTX_CONTROL_METHOD 1 /* Control method termination [TBD: may no longer be necessary] */
79#define ACPI_MTX_PARSER 2 83#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
80#define ACPI_MTX_DISPATCHER 3 84#define ACPI_MTX_NAMESPACE 3 /* ACPI Namespace */
81#define ACPI_MTX_TABLES 4 85#define ACPI_MTX_EVENTS 4 /* Data for ACPI events */
82#define ACPI_MTX_OP_REGIONS 5 86#define ACPI_MTX_CACHES 5 /* Internal caches, general purposes */
83#define ACPI_MTX_NAMESPACE 6 87#define ACPI_MTX_MEMORY 6 /* Debug memory tracking lists */
84#define ACPI_MTX_EVENTS 7 88#define ACPI_MTX_DEBUG_CMD_COMPLETE 7 /* AML debugger */
85#define ACPI_MTX_HARDWARE 8 89#define ACPI_MTX_DEBUG_CMD_READY 8 /* AML debugger */
86#define ACPI_MTX_CACHES 9 90
87#define ACPI_MTX_MEMORY 10 91#define ACPI_MAX_MUTEX 8
88#define ACPI_MTX_DEBUG_CMD_COMPLETE 11 92#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
89#define ACPI_MTX_DEBUG_CMD_READY 12
90
91#define MAX_MUTEX 12
92#define NUM_MUTEX MAX_MUTEX+1
93 93
94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
95#ifdef DEFINE_ACPI_GLOBALS 95#ifdef DEFINE_ACPI_GLOBALS
96 96
97/* Names for the mutexes used in the subsystem */ 97/* Debug names for the mutexes above */
98 98
99static char *acpi_gbl_mutex_names[] = { 99static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
100 "ACPI_MTX_Execute",
101 "ACPI_MTX_Interpreter", 100 "ACPI_MTX_Interpreter",
102 "ACPI_MTX_Parser", 101 "ACPI_MTX_Method",
103 "ACPI_MTX_Dispatcher",
104 "ACPI_MTX_Tables", 102 "ACPI_MTX_Tables",
105 "ACPI_MTX_op_regions",
106 "ACPI_MTX_Namespace", 103 "ACPI_MTX_Namespace",
107 "ACPI_MTX_Events", 104 "ACPI_MTX_Events",
108 "ACPI_MTX_Hardware",
109 "ACPI_MTX_Caches", 105 "ACPI_MTX_Caches",
110 "ACPI_MTX_Memory", 106 "ACPI_MTX_Memory",
111 "ACPI_MTX_debug_cmd_complete", 107 "ACPI_MTX_DebugCmdComplete",
112 "ACPI_MTX_debug_cmd_ready", 108 "ACPI_MTX_DebugCmdReady"
113}; 109};
114 110
115#endif 111#endif
116#endif 112#endif
117 113
114/*
115 * Predefined handles for spinlocks used within the subsystem.
116 * These spinlocks are created by acpi_ut_mutex_initialize
117 */
118#define ACPI_LOCK_GPES 0
119#define ACPI_LOCK_HARDWARE 1
120
121#define ACPI_MAX_LOCK 1
122#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
123
118/* Owner IDs are used to track namespace nodes for selective deletion */ 124/* Owner IDs are used to track namespace nodes for selective deletion */
119 125
120typedef u8 acpi_owner_id; 126typedef u8 acpi_owner_id;
@@ -129,7 +135,7 @@ typedef u8 acpi_owner_id;
129struct acpi_mutex_info { 135struct acpi_mutex_info {
130 acpi_mutex mutex; 136 acpi_mutex mutex;
131 u32 use_count; 137 u32 use_count;
132 u32 thread_id; 138 acpi_thread_id thread_id;
133}; 139};
134 140
135/* Lock flag parameter for various interfaces */ 141/* Lock flag parameter for various interfaces */
@@ -144,6 +150,8 @@ struct acpi_mutex_info {
144#define ACPI_FIELD_DWORD_GRANULARITY 4 150#define ACPI_FIELD_DWORD_GRANULARITY 4
145#define ACPI_FIELD_QWORD_GRANULARITY 8 151#define ACPI_FIELD_QWORD_GRANULARITY 8
146 152
153#define ACPI_ENTRY_NOT_FOUND NULL
154
147/***************************************************************************** 155/*****************************************************************************
148 * 156 *
149 * Namespace typedefs and structs 157 * Namespace typedefs and structs
@@ -158,49 +166,55 @@ typedef enum {
158 ACPI_IMODE_EXECUTE = 0x0E 166 ACPI_IMODE_EXECUTE = 0x0E
159} acpi_interpreter_mode; 167} acpi_interpreter_mode;
160 168
161/*
162 * The Node describes a named object that appears in the AML
163 * An acpi_node is used to store Nodes.
164 *
165 * data_type is used to differentiate between internal descriptors, and MUST
166 * be the first byte in this structure.
167 */
168union acpi_name_union { 169union acpi_name_union {
169 u32 integer; 170 u32 integer;
170 char ascii[4]; 171 char ascii[4];
171}; 172};
172 173
174/*
175 * The Namespace Node describes a named object that appears in the AML.
176 * descriptor_type is used to differentiate between internal descriptors.
177 *
178 * The node is optimized for both 32-bit and 64-bit platforms:
179 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
180 *
181 * Note: The descriptor_type and Type fields must appear in the identical
182 * position in both the struct acpi_namespace_node and union acpi_operand_object
183 * structures.
184 */
173struct acpi_namespace_node { 185struct acpi_namespace_node {
174 u8 descriptor; /* Used to differentiate object descriptor types */ 186 union acpi_operand_object *object; /* Interpreter object */
175 u8 type; /* Type associated with this name */ 187 u8 descriptor_type; /* Differentiate object descriptor types */
176 u16 reference_count; /* Current count of references and children */ 188 u8 type; /* ACPI Type associated with this name */
189 u8 flags; /* Miscellaneous flags */
190 acpi_owner_id owner_id; /* Node creator */
177 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ 191 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
178 union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */
179 struct acpi_namespace_node *child; /* First child */ 192 struct acpi_namespace_node *child; /* First child */
180 struct acpi_namespace_node *peer; /* Next peer */ 193 struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
181 u8 owner_id; /* Who created this node */
182 u8 flags;
183
184 /* Fields used by the ASL compiler only */
185 194
186#ifdef ACPI_ASL_COMPILER 195 /*
187 u32 value; 196 * The following fields are used by the ASL compiler and disassembler only
197 */
198#ifdef ACPI_LARGE_NAMESPACE_NODE
188 union acpi_parse_object *op; 199 union acpi_parse_object *op;
200 u32 value;
201 u32 length;
189#endif 202#endif
190}; 203};
191 204
192#define ACPI_ENTRY_NOT_FOUND NULL 205/* Namespace Node flags */
193 206
194/* Node flags */ 207#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
208#define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */
209#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
210#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
211#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
195 212
196#define ANOBJ_RESERVED 0x01 213#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */
197#define ANOBJ_END_OF_PEER_LIST 0x02 214#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */
198#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ 215#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */
199#define ANOBJ_METHOD_ARG 0x08 216#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */
200#define ANOBJ_METHOD_LOCAL 0x10 217#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */
201#define ANOBJ_METHOD_NO_RETVAL 0x20
202#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
203#define ANOBJ_IS_BIT_OFFSET 0x80
204 218
205/* 219/*
206 * ACPI Table Descriptor. One per ACPI table 220 * ACPI Table Descriptor. One per ACPI table
@@ -212,8 +226,8 @@ struct acpi_table_desc {
212 struct acpi_table_header *pointer; 226 struct acpi_table_header *pointer;
213 u8 *aml_start; 227 u8 *aml_start;
214 u64 physical_address; 228 u64 physical_address;
215 u32 aml_length;
216 acpi_size length; 229 acpi_size length;
230 u32 aml_length;
217 acpi_owner_id owner_id; 231 acpi_owner_id owner_id;
218 u8 type; 232 u8 type;
219 u8 allocation; 233 u8 allocation;
@@ -276,6 +290,9 @@ struct acpi_create_field_info {
276 u8 field_type; 290 u8 field_type;
277}; 291};
278 292
293typedef
294acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
295
279/* 296/*
280 * Bitmapped ACPI types. Used internally only 297 * Bitmapped ACPI types. Used internally only
281 */ 298 */
@@ -377,7 +394,7 @@ struct acpi_gpe_walk_info {
377 struct acpi_gpe_block_info *gpe_block; 394 struct acpi_gpe_block_info *gpe_block;
378}; 395};
379 396
380typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * 397typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
381 gpe_xrupt_info, 398 gpe_xrupt_info,
382 struct acpi_gpe_block_info * 399 struct acpi_gpe_block_info *
383 gpe_block); 400 gpe_block);
@@ -416,13 +433,14 @@ struct acpi_field_info {
416#define ACPI_CONTROL_PREDICATE_FALSE 0xC3 433#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
417#define ACPI_CONTROL_PREDICATE_TRUE 0xC4 434#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
418 435
419#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ 436#define ACPI_STATE_COMMON \
420 u8 data_type; /* To differentiate various internal objs */\ 437 void *next; \
421 u8 flags; \ 438 u8 descriptor_type; /* To differentiate various internal objs */\
422 u16 value; \ 439 u8 flags; \
423 u16 state; \ 440 u16 value; \
424 u16 reserved; \ 441 u16 state;
425 void *next; 442
443 /* There are 2 bytes available here until the next natural alignment boundary */
426 444
427struct acpi_common_state { 445struct acpi_common_state {
428ACPI_STATE_COMMON}; 446ACPI_STATE_COMMON};
@@ -438,12 +456,12 @@ struct acpi_update_state {
438 * Pkg state - used to traverse nested package structures 456 * Pkg state - used to traverse nested package structures
439 */ 457 */
440struct acpi_pkg_state { 458struct acpi_pkg_state {
441 ACPI_STATE_COMMON union acpi_operand_object *source_object; 459 ACPI_STATE_COMMON u16 index;
460 union acpi_operand_object *source_object;
442 union acpi_operand_object *dest_object; 461 union acpi_operand_object *dest_object;
443 struct acpi_walk_state *walk_state; 462 struct acpi_walk_state *walk_state;
444 void *this_target_obj; 463 void *this_target_obj;
445 u32 num_packages; 464 u32 num_packages;
446 u16 index;
447}; 465};
448 466
449/* 467/*
@@ -451,10 +469,10 @@ struct acpi_pkg_state {
451 * Allows nesting of these constructs 469 * Allows nesting of these constructs
452 */ 470 */
453struct acpi_control_state { 471struct acpi_control_state {
454 ACPI_STATE_COMMON union acpi_parse_object *predicate_op; 472 ACPI_STATE_COMMON u16 opcode;
473 union acpi_parse_object *predicate_op;
455 u8 *aml_predicate_start; /* Start of if/while predicate */ 474 u8 *aml_predicate_start; /* Start of if/while predicate */
456 u8 *package_end; /* End of if/while block */ 475 u8 *package_end; /* End of if/while block */
457 u16 opcode;
458}; 476};
459 477
460/* 478/*
@@ -465,11 +483,11 @@ struct acpi_scope_state {
465}; 483};
466 484
467struct acpi_pscope_state { 485struct acpi_pscope_state {
468 ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */ 486 ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
487 union acpi_parse_object *op; /* Current op being parsed */
469 u8 *arg_end; /* Current argument end */ 488 u8 *arg_end; /* Current argument end */
470 u8 *pkg_end; /* Current package end */ 489 u8 *pkg_end; /* Current package end */
471 u32 arg_list; /* Next argument to parse */ 490 u32 arg_list; /* Next argument to parse */
472 u32 arg_count; /* Number of fixed arguments */
473}; 491};
474 492
475/* 493/*
@@ -477,10 +495,10 @@ struct acpi_pscope_state {
477 * states are created when there are nested control methods executing. 495 * states are created when there are nested control methods executing.
478 */ 496 */
479struct acpi_thread_state { 497struct acpi_thread_state {
480 ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ 498 ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
499 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
481 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ 500 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
482 u32 thread_id; /* Running thread ID */ 501 acpi_thread_id thread_id; /* Running thread ID */
483 u8 current_sync_level; /* Mutex Sync (nested acquire) level */
484}; 502};
485 503
486/* 504/*
@@ -488,10 +506,9 @@ struct acpi_thread_state {
488 * AML arguments 506 * AML arguments
489 */ 507 */
490struct acpi_result_values { 508struct acpi_result_values {
491 ACPI_STATE_COMMON 509 ACPI_STATE_COMMON u8 num_results;
492 union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
493 u8 num_results;
494 u8 last_insert; 510 u8 last_insert;
511 union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
495}; 512};
496 513
497typedef 514typedef
@@ -546,7 +563,7 @@ struct acpi_opcode_info {
546#endif 563#endif
547 u32 parse_args; /* Grammar/Parse time arguments */ 564 u32 parse_args; /* Grammar/Parse time arguments */
548 u32 runtime_args; /* Interpret time arguments */ 565 u32 runtime_args; /* Interpret time arguments */
549 u32 flags; /* Misc flags */ 566 u16 flags; /* Misc flags */
550 u8 object_type; /* Corresponding internal object type */ 567 u8 object_type; /* Corresponding internal object type */
551 u8 class; /* Opcode class */ 568 u8 class; /* Opcode class */
552 u8 type; /* Opcode type */ 569 u8 type; /* Opcode type */
@@ -563,29 +580,31 @@ union acpi_parse_value {
563}; 580};
564 581
565#define ACPI_PARSE_COMMON \ 582#define ACPI_PARSE_COMMON \
566 u8 data_type; /* To differentiate various internal objs */\ 583 union acpi_parse_object *parent; /* Parent op */\
567 u8 flags; /* Type of Op */\ 584 u8 descriptor_type; /* To differentiate various internal objs */\
568 u16 aml_opcode; /* AML opcode */\ 585 u8 flags; /* Type of Op */\
569 u32 aml_offset; /* Offset of declaration in AML */\ 586 u16 aml_opcode; /* AML opcode */\
570 union acpi_parse_object *parent; /* Parent op */\ 587 u32 aml_offset; /* Offset of declaration in AML */\
571 union acpi_parse_object *next; /* Next op */\ 588 union acpi_parse_object *next; /* Next op */\
589 struct acpi_namespace_node *node; /* For use by interpreter */\
590 union acpi_parse_value value; /* Value or args associated with the opcode */\
572 ACPI_DISASM_ONLY_MEMBERS (\ 591 ACPI_DISASM_ONLY_MEMBERS (\
573 u8 disasm_flags; /* Used during AML disassembly */\ 592 u8 disasm_flags; /* Used during AML disassembly */\
574 u8 disasm_opcode; /* Subtype used for disassembly */\ 593 u8 disasm_opcode; /* Subtype used for disassembly */\
575 char aml_op_name[16]) /* Op name (debug only) */\ 594 char aml_op_name[16]) /* Op name (debug only) */
576 /* NON-DEBUG members below: */\ 595
577 struct acpi_namespace_node *node; /* For use by interpreter */\ 596#define ACPI_DASM_BUFFER 0x00
578 union acpi_parse_value value; /* Value or args associated with the opcode */ 597#define ACPI_DASM_RESOURCE 0x01
579 598#define ACPI_DASM_STRING 0x02
580#define ACPI_DASM_BUFFER 0x00 599#define ACPI_DASM_UNICODE 0x03
581#define ACPI_DASM_RESOURCE 0x01 600#define ACPI_DASM_EISAID 0x04
582#define ACPI_DASM_STRING 0x02 601#define ACPI_DASM_MATCHOP 0x05
583#define ACPI_DASM_UNICODE 0x03 602#define ACPI_DASM_LNOT_PREFIX 0x06
584#define ACPI_DASM_EISAID 0x04 603#define ACPI_DASM_LNOT_SUFFIX 0x07
585#define ACPI_DASM_MATCHOP 0x05 604#define ACPI_DASM_IGNORE 0x08
586 605
587/* 606/*
588 * generic operation (for example: If, While, Store) 607 * Generic operation (for example: If, While, Store)
589 */ 608 */
590struct acpi_parse_obj_common { 609struct acpi_parse_obj_common {
591ACPI_PARSE_COMMON}; 610ACPI_PARSE_COMMON};
@@ -601,7 +620,7 @@ struct acpi_parse_obj_named {
601 u32 name; /* 4-byte name or zero if no name */ 620 u32 name; /* 4-byte name or zero if no name */
602}; 621};
603 622
604/* The parse node is the fundamental element of the parse tree */ 623/* This version is used by the i_aSL compiler only */
605 624
606#define ACPI_MAX_PARSEOP_NAME 20 625#define ACPI_MAX_PARSEOP_NAME 20
607 626
@@ -643,7 +662,6 @@ union acpi_parse_object {
643 * method. 662 * method.
644 */ 663 */
645struct acpi_parse_state { 664struct acpi_parse_state {
646 u32 aml_size;
647 u8 *aml_start; /* First AML byte */ 665 u8 *aml_start; /* First AML byte */
648 u8 *aml; /* Next AML byte */ 666 u8 *aml; /* Next AML byte */
649 u8 *aml_end; /* (last + 1) AML byte */ 667 u8 *aml_end; /* (last + 1) AML byte */
@@ -653,22 +671,23 @@ struct acpi_parse_state {
653 struct acpi_namespace_node *start_node; 671 struct acpi_namespace_node *start_node;
654 union acpi_generic_state *scope; /* Current scope */ 672 union acpi_generic_state *scope; /* Current scope */
655 union acpi_parse_object *start_scope; 673 union acpi_parse_object *start_scope;
674 u32 aml_size;
656}; 675};
657 676
658/* Parse object flags */ 677/* Parse object flags */
659 678
660#define ACPI_PARSEOP_GENERIC 0x01 679#define ACPI_PARSEOP_GENERIC 0x01
661#define ACPI_PARSEOP_NAMED 0x02 680#define ACPI_PARSEOP_NAMED 0x02
662#define ACPI_PARSEOP_DEFERRED 0x04 681#define ACPI_PARSEOP_DEFERRED 0x04
663#define ACPI_PARSEOP_BYTELIST 0x08 682#define ACPI_PARSEOP_BYTELIST 0x08
664#define ACPI_PARSEOP_IN_CACHE 0x80 683#define ACPI_PARSEOP_IN_CACHE 0x80
665 684
666/* Parse object disasm_flags */ 685/* Parse object disasm_flags */
667 686
668#define ACPI_PARSEOP_IGNORE 0x01 687#define ACPI_PARSEOP_IGNORE 0x01
669#define ACPI_PARSEOP_PARAMLIST 0x02 688#define ACPI_PARSEOP_PARAMLIST 0x02
670#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 689#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
671#define ACPI_PARSEOP_SPECIAL 0x10 690#define ACPI_PARSEOP_SPECIAL 0x10
672 691
673/***************************************************************************** 692/*****************************************************************************
674 * 693 *
@@ -676,8 +695,8 @@ struct acpi_parse_state {
676 * 695 *
677 ****************************************************************************/ 696 ****************************************************************************/
678 697
679#define PCI_ROOT_HID_STRING "PNP0A03" 698#define PCI_ROOT_HID_STRING "PNP0A03"
680#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" 699#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
681 700
682struct acpi_bit_register_info { 701struct acpi_bit_register_info {
683 u8 parent_register; 702 u8 parent_register;
@@ -710,13 +729,14 @@ struct acpi_bit_register_info {
710#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ 729#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
711#define ACPI_BITMASK_WAKE_STATUS 0x8000 730#define ACPI_BITMASK_WAKE_STATUS 0x8000
712 731
713#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ 732#define ACPI_BITMASK_ALL_FIXED_STATUS (\
714 ACPI_BITMASK_BUS_MASTER_STATUS | \ 733 ACPI_BITMASK_TIMER_STATUS | \
715 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ 734 ACPI_BITMASK_BUS_MASTER_STATUS | \
716 ACPI_BITMASK_POWER_BUTTON_STATUS | \ 735 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
717 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ 736 ACPI_BITMASK_POWER_BUTTON_STATUS | \
718 ACPI_BITMASK_RT_CLOCK_STATUS | \ 737 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
719 ACPI_BITMASK_WAKE_STATUS) 738 ACPI_BITMASK_RT_CLOCK_STATUS | \
739 ACPI_BITMASK_WAKE_STATUS)
720 740
721#define ACPI_BITMASK_TIMER_ENABLE 0x0001 741#define ACPI_BITMASK_TIMER_ENABLE 0x0001
722#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 742#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
@@ -820,7 +840,7 @@ struct acpi_bit_register_info {
820 * 840 *
821 ****************************************************************************/ 841 ****************************************************************************/
822 842
823#define ACPI_ASCII_ZERO 0x30 843#define ACPI_ASCII_ZERO 0x30
824 844
825/***************************************************************************** 845/*****************************************************************************
826 * 846 *
@@ -842,9 +862,9 @@ struct acpi_integrity_info {
842 u32 objects; 862 u32 objects;
843}; 863};
844 864
845#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 865#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
846#define ACPI_DB_CONSOLE_OUTPUT 0x02 866#define ACPI_DB_CONSOLE_OUTPUT 0x02
847#define ACPI_DB_DUPLICATE_OUTPUT 0x03 867#define ACPI_DB_DUPLICATE_OUTPUT 0x03
848 868
849/***************************************************************************** 869/*****************************************************************************
850 * 870 *
@@ -854,18 +874,18 @@ struct acpi_integrity_info {
854 874
855/* Entry for a memory allocation (debug only) */ 875/* Entry for a memory allocation (debug only) */
856 876
857#define ACPI_MEM_MALLOC 0 877#define ACPI_MEM_MALLOC 0
858#define ACPI_MEM_CALLOC 1 878#define ACPI_MEM_CALLOC 1
859#define ACPI_MAX_MODULE_NAME 16 879#define ACPI_MAX_MODULE_NAME 16
860 880
861#define ACPI_COMMON_DEBUG_MEM_HEADER \ 881#define ACPI_COMMON_DEBUG_MEM_HEADER \
862 struct acpi_debug_mem_block *previous; \ 882 struct acpi_debug_mem_block *previous; \
863 struct acpi_debug_mem_block *next; \ 883 struct acpi_debug_mem_block *next; \
864 u32 size; \ 884 u32 size; \
865 u32 component; \ 885 u32 component; \
866 u32 line; \ 886 u32 line; \
867 char module[ACPI_MAX_MODULE_NAME]; \ 887 char module[ACPI_MAX_MODULE_NAME]; \
868 u8 alloc_type; 888 u8 alloc_type;
869 889
870struct acpi_debug_mem_header { 890struct acpi_debug_mem_header {
871ACPI_COMMON_DEBUG_MEM_HEADER}; 891ACPI_COMMON_DEBUG_MEM_HEADER};
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index f2be2a881730..38f9aa4bef00 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -56,6 +56,10 @@
56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) 57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
58 58
59/* Size calculation */
60
61#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
62
59#if ACPI_MACHINE_WIDTH == 16 63#if ACPI_MACHINE_WIDTH == 16
60 64
61/* 65/*
@@ -99,7 +103,7 @@
99 * printf() format helpers 103 * printf() format helpers
100 */ 104 */
101 105
102/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ 106/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
103 107
104#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) 108#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)
105 109
@@ -130,7 +134,6 @@
130#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) 134#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i)
131#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) 135#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
132#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) 136#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
133#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
134 137
135#if ACPI_MACHINE_WIDTH == 16 138#if ACPI_MACHINE_WIDTH == 16
136#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) 139#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
@@ -141,6 +144,12 @@
141#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 144#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
142#endif 145#endif
143 146
147#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
148#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b)))
149#else
150#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE))
151#endif
152
144/* 153/*
145 * Macros for moving data around to/from buffers that are possibly unaligned. 154 * Macros for moving data around to/from buffers that are possibly unaligned.
146 * If the hardware supports the transfer of unaligned data, just do the store. 155 * If the hardware supports the transfer of unaligned data, just do the store.
@@ -341,29 +350,33 @@
341/* 350/*
342 * Rounding macros (Power of two boundaries only) 351 * Rounding macros (Power of two boundaries only)
343 */ 352 */
344#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ 353#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \
345 (~(((acpi_native_uint) boundary)-1))) 354 (~(((acpi_native_uint) boundary)-1)))
346 355
347#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ 356#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \
348 (((acpi_native_uint) boundary)-1)) & \ 357 (((acpi_native_uint) boundary)-1)) & \
349 (~(((acpi_native_uint) boundary)-1))) 358 (~(((acpi_native_uint) boundary)-1)))
350 359
351#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) 360/* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */
352#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) 361
353#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) 362#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4)
363#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8)
364#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint))
354 365
355#define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4) 366#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4)
356#define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) 367#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8)
357#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) 368#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_native_uint))
358 369
359#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) 370#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
360#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) 371#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
361 372
362#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) 373#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
363 374
364/* Generic (non-power-of-two) rounding */ 375/* Generic (non-power-of-two) rounding */
365 376
366#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) 377#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
378
379#define ACPI_IS_MISALIGNED(value) (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1))
367 380
368/* 381/*
369 * Bitmask creation 382 * Bitmask creation
@@ -371,10 +384,10 @@
371 * MASK_BITS_ABOVE creates a mask starting AT the position and above 384 * MASK_BITS_ABOVE creates a mask starting AT the position and above
372 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position 385 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
373 */ 386 */
374#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) 387#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
375#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) 388#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
376 389
377#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) 390#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
378 391
379/* Bitfields within ACPI registers */ 392/* Bitfields within ACPI registers */
380 393
@@ -396,8 +409,8 @@
396 * 409 *
397 * The "Descriptor" field is the first field in both structures. 410 * The "Descriptor" field is the first field in both structures.
398 */ 411 */
399#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) 412#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
400#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) 413#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
401 414
402/* Macro to test the object type */ 415/* Macro to test the object type */
403 416
@@ -486,7 +499,6 @@
486#define ACPI_ERROR(plist) 499#define ACPI_ERROR(plist)
487#define ACPI_ERROR_NAMESPACE(s,e) 500#define ACPI_ERROR_NAMESPACE(s,e)
488#define ACPI_ERROR_METHOD(s,n,p,e) 501#define ACPI_ERROR_METHOD(s,n,p,e)
489
490#endif 502#endif
491 503
492/* 504/*
@@ -514,12 +526,12 @@
514#define ACPI_GET_FUNCTION_NAME _acpi_function_name 526#define ACPI_GET_FUNCTION_NAME _acpi_function_name
515/* 527/*
516 * The Name parameter should be the procedure name as a quoted string. 528 * The Name parameter should be the procedure name as a quoted string.
517 * This is declared as a local string ("my_function_name") so that it can 529 * This is declared as a local string ("MyFunctionName") so that it can
518 * be also used by the function exit macros below. 530 * be also used by the function exit macros below.
519 * Note: (const char) is used to be compatible with the debug interfaces 531 * Note: (const char) is used to be compatible with the debug interfaces
520 * and macros such as __FUNCTION__. 532 * and macros such as __FUNCTION__.
521 */ 533 */
522#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; 534#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = #name;
523 535
524#else 536#else
525/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 537/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
@@ -528,13 +540,13 @@
528#endif 540#endif
529 541
530#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 542#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
531 acpi_ut_trace(ACPI_DEBUG_PARAMETERS) 543 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
532#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ 544#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
533 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) 545 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
534#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ 546#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
535 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) 547 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
536#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ 548#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
537 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) 549 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
538 550
539#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() 551#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
540 552
@@ -543,7 +555,7 @@
543 * WARNING: These macros include a return statement. This is usually considered 555 * WARNING: These macros include a return statement. This is usually considered
544 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 556 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
545 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 557 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
546 * so that "_acpi_function_name" is defined. 558 * so that "_AcpiFunctionName" is defined.
547 * 559 *
548 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining 560 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
549 * about these constructs. 561 * about these constructs.
@@ -654,6 +666,7 @@
654#define ACPI_DUMP_STACK_ENTRY(a) 666#define ACPI_DUMP_STACK_ENTRY(a)
655#define ACPI_DUMP_OPERANDS(a,b,c,d,e) 667#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
656#define ACPI_DUMP_ENTRY(a,b) 668#define ACPI_DUMP_ENTRY(a,b)
669#define ACPI_DUMP_TABLES(a,b)
657#define ACPI_DUMP_PATHNAME(a,b,c,d) 670#define ACPI_DUMP_PATHNAME(a,b,c,d)
658#define ACPI_DUMP_RESOURCE_LIST(a) 671#define ACPI_DUMP_RESOURCE_LIST(a)
659#define ACPI_DUMP_BUFFER(a,b) 672#define ACPI_DUMP_BUFFER(a,b)
@@ -709,19 +722,19 @@
709 722
710/* Memory allocation */ 723/* Memory allocation */
711 724
712#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) 725#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
713#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) 726#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
714#define ACPI_MEM_FREE(a) acpi_os_free(a) 727#define ACPI_FREE(a) acpi_os_free(a)
715#define ACPI_MEM_TRACKING(a) 728#define ACPI_MEM_TRACKING(a)
716 729
717#else 730#else
718 731
719/* Memory allocation */ 732/* Memory allocation */
720 733
721#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) 734#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
722#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) 735#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
723#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) 736#define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
724#define ACPI_MEM_TRACKING(a) a 737#define ACPI_MEM_TRACKING(a) a
725 738
726#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 739#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
727 740
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index b667a804fc8a..83b52f9f899a 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -63,6 +63,8 @@
63#define ACPI_NS_DONT_OPEN_SCOPE 0x02 63#define ACPI_NS_DONT_OPEN_SCOPE 0x02
64#define ACPI_NS_NO_PEER_SEARCH 0x04 64#define ACPI_NS_NO_PEER_SEARCH 0x04
65#define ACPI_NS_ERROR_IF_FOUND 0x08 65#define ACPI_NS_ERROR_IF_FOUND 0x08
66#define ACPI_NS_PREFIX_IS_SCOPE 0x10
67#define ACPI_NS_EXTERNAL 0x20
66 68
67#define ACPI_NS_WALK_UNLOCK TRUE 69#define ACPI_NS_WALK_UNLOCK TRUE
68#define ACPI_NS_WALK_NO_UNLOCK FALSE 70#define ACPI_NS_WALK_NO_UNLOCK FALSE
@@ -171,19 +173,17 @@ acpi_ns_dump_objects(acpi_object_type type,
171/* 173/*
172 * nseval - Namespace evaluation functions 174 * nseval - Namespace evaluation functions
173 */ 175 */
174acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info); 176acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
175
176acpi_status
177acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info);
178
179acpi_status
180acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info);
181 177
182/* 178/*
183 * nsnames - Name and Scope manipulation 179 * nsnames - Name and Scope manipulation
184 */ 180 */
185u32 acpi_ns_opens_scope(acpi_object_type type); 181u32 acpi_ns_opens_scope(acpi_object_type type);
186 182
183void
184acpi_ns_build_external_path(struct acpi_namespace_node *node,
185 acpi_size size, char *name_buffer);
186
187char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); 187char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
188 188
189char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); 189char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
@@ -196,9 +196,9 @@ u8
196acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); 196acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
197 197
198acpi_status 198acpi_status
199acpi_ns_get_node_by_path(char *external_pathname, 199acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
200 struct acpi_namespace_node *in_prefix_node, 200 char *external_pathname,
201 u32 flags, struct acpi_namespace_node **out_node); 201 u32 flags, struct acpi_namespace_node **out_node);
202 202
203acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); 203acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
204 204
@@ -241,10 +241,10 @@ acpi_ns_search_and_enter(u32 entry_name,
241 u32 flags, struct acpi_namespace_node **ret_node); 241 u32 flags, struct acpi_namespace_node **ret_node);
242 242
243acpi_status 243acpi_status
244acpi_ns_search_node(u32 entry_name, 244acpi_ns_search_one_scope(u32 entry_name,
245 struct acpi_namespace_node *node, 245 struct acpi_namespace_node *node,
246 acpi_object_type type, 246 acpi_object_type type,
247 struct acpi_namespace_node **ret_node); 247 struct acpi_namespace_node **ret_node);
248 248
249void 249void
250acpi_ns_install_node(struct acpi_walk_state *walk_state, 250acpi_ns_install_node(struct acpi_walk_state *walk_state,
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index d130cfed8d55..1747d94084d8 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -1,7 +1,7 @@
1 1
2/****************************************************************************** 2/******************************************************************************
3 * 3 *
4 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) 4 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
5 * 5 *
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
@@ -45,10 +45,12 @@
45#ifndef _ACOBJECT_H 45#ifndef _ACOBJECT_H
46#define _ACOBJECT_H 46#define _ACOBJECT_H
47 47
48/* acpisrc:struct_defs -- for acpisrc conversion */
49
48/* 50/*
49 * The union acpi_operand_object is used to pass AML operands from the dispatcher 51 * The union acpi_operand_object is used to pass AML operands from the dispatcher
50 * to the interpreter, and to keep track of the various handlers such as 52 * to the interpreter, and to keep track of the various handlers such as
51 * address space handlers and notify handlers. The object is a constant 53 * address space handlers and notify handlers. The object is a constant
52 * size in order to allow it to be cached and reused. 54 * size in order to allow it to be cached and reused.
53 */ 55 */
54 56
@@ -61,17 +63,25 @@
61/* 63/*
62 * Common area for all objects. 64 * Common area for all objects.
63 * 65 *
64 * data_type is used to differentiate between internal descriptors, and MUST 66 * descriptor_type is used to differentiate between internal descriptors, and
65 * be the first byte in this structure. 67 * must be in the same place across all descriptors
68 *
69 * Note: The descriptor_type and Type fields must appear in the identical
70 * position in both the struct acpi_namespace_node and union acpi_operand_object
71 * structures.
66 */ 72 */
67#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ 73#define ACPI_OBJECT_COMMON_HEADER \
68 u8 descriptor; /* To differentiate various internal objs */\ 74 union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
69 u8 type; /* acpi_object_type */\ 75 u8 descriptor_type; /* To differentiate various internal objs */\
70 u16 reference_count; /* For object deletion management */\ 76 u8 type; /* acpi_object_type */\
71 union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ 77 u16 reference_count; /* For object deletion management */\
72 u8 flags; 78 u8 flags;
73 79 /*
74/* Values for flag byte above */ 80 * Note: There are 3 bytes available here before the
81 * next natural alignment boundary (for both 32/64 cases)
82 */
83
84/* Values for Flag byte above */
75 85
76#define AOPOBJ_AML_CONSTANT 0x01 86#define AOPOBJ_AML_CONSTANT 0x01
77#define AOPOBJ_STATIC_POINTER 0x02 87#define AOPOBJ_STATIC_POINTER 0x02
@@ -79,36 +89,7 @@
79#define AOPOBJ_OBJECT_INITIALIZED 0x08 89#define AOPOBJ_OBJECT_INITIALIZED 0x08
80#define AOPOBJ_SETUP_COMPLETE 0x10 90#define AOPOBJ_SETUP_COMPLETE 0x10
81#define AOPOBJ_SINGLE_DATUM 0x20 91#define AOPOBJ_SINGLE_DATUM 0x20
82 92#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */
83/*
84 * Common bitfield for the field objects
85 * "Field Datum" -- a datum from the actual field object
86 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
87 */
88#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
89 u8 field_flags; /* Access, update, and lock bits */\
90 u8 attribute; /* From access_as keyword */\
91 u8 access_byte_width; /* Read/Write size in bytes */\
92 u32 bit_length; /* Length of field in bits */\
93 u32 base_byte_offset; /* Byte offset within containing object */\
94 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
95 u8 access_bit_width; /* Read/Write size in bits (8-64) */\
96 u32 value; /* Value to store into the Bank or Index register */\
97 struct acpi_namespace_node *node; /* Link back to parent node */
98
99/*
100 * Fields common to both Strings and Buffers
101 */
102#define ACPI_COMMON_BUFFER_INFO \
103 u32 length;
104
105/*
106 * Common fields for objects that support ASL notifications
107 */
108#define ACPI_COMMON_NOTIFY_INFO \
109 union acpi_operand_object *system_notify; /* Handler for system notifies */\
110 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
111 union acpi_operand_object *handler; /* Handler for Address space */
112 93
113/****************************************************************************** 94/******************************************************************************
114 * 95 *
@@ -125,25 +106,31 @@ struct acpi_object_integer {
125 106
126/* 107/*
127 * Note: The String and Buffer object must be identical through the Pointer 108 * Note: The String and Buffer object must be identical through the Pointer
128 * element. There is code that depends on this. 109 * and length elements. There is code that depends on this.
110 *
111 * Fields common to both Strings and Buffers
129 */ 112 */
113#define ACPI_COMMON_BUFFER_INFO(_type) \
114 _type *pointer; \
115 u32 length;
116
130struct acpi_object_string { /* Null terminated, ASCII characters only */ 117struct acpi_object_string { /* Null terminated, ASCII characters only */
131 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ 118 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */
132}; 119};
133 120
134struct acpi_object_buffer { 121struct acpi_object_buffer {
135 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ 122 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */
136 struct acpi_namespace_node *node; /* Link back to parent node */
137 u8 *aml_start;
138 u32 aml_length; 123 u32 aml_length;
124 u8 *aml_start;
125 struct acpi_namespace_node *node; /* Link back to parent node */
139}; 126};
140 127
141struct acpi_object_package { 128struct acpi_object_package {
142 ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ 129 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */
143 u32 aml_length;
144 u8 *aml_start;
145 struct acpi_namespace_node *node; /* Link back to parent node */
146 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ 130 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
131 u8 *aml_start;
132 u32 aml_length;
133 u32 count; /* # of elements in package */
147}; 134};
148 135
149/****************************************************************************** 136/******************************************************************************
@@ -156,23 +143,6 @@ struct acpi_object_event {
156 ACPI_OBJECT_COMMON_HEADER void *semaphore; 143 ACPI_OBJECT_COMMON_HEADER void *semaphore;
157}; 144};
158 145
159#define ACPI_INFINITE_CONCURRENCY 0xFF
160
161typedef
162acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
163
164struct acpi_object_method {
165 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
166 u8 param_count;
167 u32 aml_length;
168 void *semaphore;
169 u8 *aml_start;
170 ACPI_INTERNAL_METHOD implementation;
171 u8 concurrency;
172 u8 thread_count;
173 acpi_owner_id owner_id;
174};
175
176struct acpi_object_mutex { 146struct acpi_object_mutex {
177 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ 147 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
178 u16 acquisition_depth; /* Allow multiple Acquires, same thread */ 148 u16 acquisition_depth; /* Allow multiple Acquires, same thread */
@@ -186,11 +156,23 @@ struct acpi_object_mutex {
186 156
187struct acpi_object_region { 157struct acpi_object_region {
188 ACPI_OBJECT_COMMON_HEADER u8 space_id; 158 ACPI_OBJECT_COMMON_HEADER u8 space_id;
189 union acpi_operand_object *handler; /* Handler for region access */
190 struct acpi_namespace_node *node; /* Containing namespace node */ 159 struct acpi_namespace_node *node; /* Containing namespace node */
160 union acpi_operand_object *handler; /* Handler for region access */
191 union acpi_operand_object *next; 161 union acpi_operand_object *next;
192 u32 length;
193 acpi_physical_address address; 162 acpi_physical_address address;
163 u32 length;
164};
165
166struct acpi_object_method {
167 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
168 u8 param_count;
169 u8 concurrency;
170 void *semaphore;
171 u8 *aml_start;
172 ACPI_INTERNAL_METHOD implementation;
173 u32 aml_length;
174 u8 thread_count;
175 acpi_owner_id owner_id;
194}; 176};
195 177
196/****************************************************************************** 178/******************************************************************************
@@ -199,6 +181,14 @@ struct acpi_object_region {
199 * 181 *
200 *****************************************************************************/ 182 *****************************************************************************/
201 183
184/*
185 * Common fields for objects that support ASL notifications
186 */
187#define ACPI_COMMON_NOTIFY_INFO \
188 union acpi_operand_object *system_notify; /* Handler for system notifies */\
189 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
190 union acpi_operand_object *handler; /* Handler for Address space */
191
202struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ 192struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
203ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; 193ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
204 194
@@ -213,9 +203,9 @@ struct acpi_object_power_resource {
213}; 203};
214 204
215struct acpi_object_processor { 205struct acpi_object_processor {
216 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; 206 ACPI_OBJECT_COMMON_HEADER u8 proc_id;
217 u32 length; 207 u8 length;
218 acpi_io_address address; 208 ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
219}; 209};
220 210
221struct acpi_object_thermal_zone { 211struct acpi_object_thermal_zone {
@@ -227,9 +217,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
227 * 217 *
228 *****************************************************************************/ 218 *****************************************************************************/
229 219
220/*
221 * Common bitfield for the field objects
222 * "Field Datum" -- a datum from the actual field object
223 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
224 */
225#define ACPI_COMMON_FIELD_INFO \
226 u8 field_flags; /* Access, update, and lock bits */\
227 u8 attribute; /* From access_as keyword */\
228 u8 access_byte_width; /* Read/Write size in bytes */\
229 struct acpi_namespace_node *node; /* Link back to parent node */\
230 u32 bit_length; /* Length of field in bits */\
231 u32 base_byte_offset; /* Byte offset within containing object */\
232 u32 value; /* Value to store into the Bank or Index register */\
233 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
234 u8 access_bit_width; /* Read/Write size in bits (8-64) */
235
230struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ 236struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
231 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ 237 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
232 /* (REGION/BANK fields only) */
233}; 238};
234 239
235struct acpi_object_region_field { 240struct acpi_object_region_field {
@@ -244,7 +249,7 @@ struct acpi_object_bank_field {
244struct acpi_object_index_field { 249struct acpi_object_index_field {
245 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO 250 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
246 /* 251 /*
247 * No "region_obj" pointer needed since the Index and Data registers 252 * No "RegionObj" pointer needed since the Index and Data registers
248 * are each field definitions unto themselves. 253 * are each field definitions unto themselves.
249 */ 254 */
250 union acpi_operand_object *index_obj; /* Index register */ 255 union acpi_operand_object *index_obj; /* Index register */
@@ -269,13 +274,9 @@ struct acpi_object_notify_handler {
269 void *context; 274 void *context;
270}; 275};
271 276
272/* Flags for address handler */
273
274#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
275
276struct acpi_object_addr_handler { 277struct acpi_object_addr_handler {
277 ACPI_OBJECT_COMMON_HEADER u8 space_id; 278 ACPI_OBJECT_COMMON_HEADER u8 space_id;
278 u16 hflags; 279 u8 handler_flags;
279 acpi_adr_space_handler handler; 280 acpi_adr_space_handler handler;
280 struct acpi_namespace_node *node; /* Parent device */ 281 struct acpi_namespace_node *node; /* Parent device */
281 void *context; 282 void *context;
@@ -284,6 +285,10 @@ struct acpi_object_addr_handler {
284 union acpi_operand_object *next; 285 union acpi_operand_object *next;
285}; 286};
286 287
288/* Flags for address handler (handler_flags) */
289
290#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
291
287/****************************************************************************** 292/******************************************************************************
288 * 293 *
289 * Special internal objects 294 * Special internal objects
@@ -297,10 +302,10 @@ struct acpi_object_addr_handler {
297struct acpi_object_reference { 302struct acpi_object_reference {
298 ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ 303 ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */
299 u16 opcode; 304 u16 opcode;
300 u32 offset; /* Used for arg_op, local_op, and index_op */ 305 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
301 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
302 struct acpi_namespace_node *node; 306 struct acpi_namespace_node *node;
303 union acpi_operand_object **where; 307 union acpi_operand_object **where;
308 u32 offset; /* Used for arg_op, local_op, and index_op */
304}; 309};
305 310
306/* 311/*
@@ -311,12 +316,10 @@ struct acpi_object_reference {
311 * Currently: Region and field_unit types 316 * Currently: Region and field_unit types
312 */ 317 */
313struct acpi_object_extra { 318struct acpi_object_extra {
314 ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; 319 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
315 u16 word_fill1;
316 u32 aml_length;
317 u8 *aml_start;
318 struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
319 void *region_context; /* Region-specific data */ 320 void *region_context; /* Region-specific data */
321 u8 *aml_start;
322 u32 aml_length;
320}; 323};
321 324
322/* Additional data that can be attached to namespace nodes */ 325/* Additional data that can be attached to namespace nodes */
@@ -391,8 +394,13 @@ union acpi_operand_object {
391#define ACPI_DESC_TYPE_NAMED 0x0F 394#define ACPI_DESC_TYPE_NAMED 0x0F
392#define ACPI_DESC_TYPE_MAX 0x0F 395#define ACPI_DESC_TYPE_MAX 0x0F
393 396
397struct acpi_common_descriptor {
398 void *common_pointer;
399 u8 descriptor_type; /* To differentiate various internal objs */
400};
401
394union acpi_descriptor { 402union acpi_descriptor {
395 u8 descriptor_id; /* To differentiate various internal objs */ 403 struct acpi_common_descriptor common;
396 union acpi_operand_object object; 404 union acpi_operand_object object;
397 struct acpi_namespace_node node; 405 struct acpi_namespace_node node;
398 union acpi_parse_object op; 406 union acpi_parse_object op;
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
index e6d78bd9e90a..7659a46bc432 100644
--- a/include/acpi/acopcode.h
+++ b/include/acpi/acopcode.h
@@ -94,7 +94,7 @@
94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) 94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) 95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
96#define ARGP_CONTINUE_OP ARG_NONE 96#define ARGP_CONTINUE_OP ARG_NONE
97#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) 97#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
98#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) 98#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
99#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) 99#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
100#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) 100#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 7785d481dc3e..8d5039d0b430 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -50,7 +50,7 @@
50 * component basis and a per-exception-type basis. 50 * component basis and a per-exception-type basis.
51 */ 51 */
52 52
53/* Component IDs are used in the global "debug_layer" */ 53/* Component IDs are used in the global "DebugLayer" */
54 54
55#define ACPI_UTILITIES 0x00000001 55#define ACPI_UTILITIES 0x00000001
56#define ACPI_HARDWARE 0x00000002 56#define ACPI_HARDWARE 0x00000002
@@ -121,7 +121,7 @@
121#define ACPI_LV_INTERRUPTS 0x08000000 121#define ACPI_LV_INTERRUPTS 0x08000000
122#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 122#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2
123 123
124/* Exceptionally verbose output -- also used in the global "debug_level" */ 124/* Exceptionally verbose output -- also used in the global "DebugLevel" */
125 125
126#define ACPI_LV_AML_DISASSEMBLE 0x10000000 126#define ACPI_LV_AML_DISASSEMBLE 0x10000000
127#define ACPI_LV_VERBOSE_INFO 0x20000000 127#define ACPI_LV_VERBOSE_INFO 0x20000000
@@ -135,7 +135,7 @@
135 */ 135 */
136#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS 136#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
137 137
138/* Exception level -- used in the global "debug_level" */ 138/* Exception level -- used in the global "DebugLevel" */
139 139
140#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 140#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
141#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 141#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
@@ -144,13 +144,13 @@
144 144
145/* 145/*
146 * These two levels are essentially obsolete, all instances in the 146 * These two levels are essentially obsolete, all instances in the
147 * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING 147 * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING
148 * (Kept here because some drivers may still use them) 148 * (Kept here because some drivers may still use them)
149 */ 149 */
150#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) 150#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
151#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) 151#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
152 152
153/* Trace level -- also used in the global "debug_level" */ 153/* Trace level -- also used in the global "DebugLevel" */
154 154
155#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 155#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
156#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) 156#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index 5a1ff484af33..9d49d3c41cd9 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -46,7 +46,7 @@
46 46
47#define OP_HAS_RETURN_VALUE 1 47#define OP_HAS_RETURN_VALUE 1
48 48
49/* variable # arguments */ 49/* Variable number of arguments. This field must be 32 bits */
50 50
51#define ACPI_VAR_ARGS ACPI_UINT32_MAX 51#define ACPI_VAR_ARGS ACPI_UINT32_MAX
52 52
@@ -71,7 +71,7 @@
71/* 71/*
72 * psxface - Parser external interfaces 72 * psxface - Parser external interfaces
73 */ 73 */
74acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info); 74acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info);
75 75
76/* 76/*
77 * psargs - Parse AML opcode arguments 77 * psargs - Parse AML opcode arguments
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 6dca3d542080..a2b3e390a503 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -26,7 +26,7 @@
26#ifndef __ACPI_BUS_H__ 26#ifndef __ACPI_BUS_H__
27#define __ACPI_BUS_H__ 27#define __ACPI_BUS_H__
28 28
29#include <linux/kobject.h> 29#include <linux/device.h>
30 30
31#include <acpi/acpi.h> 31#include <acpi/acpi.h>
32 32
@@ -59,7 +59,7 @@ acpi_evaluate_reference(acpi_handle handle,
59 59
60#define ACPI_BUS_FILE_ROOT "acpi" 60#define ACPI_BUS_FILE_ROOT "acpi"
61extern struct proc_dir_entry *acpi_root_dir; 61extern struct proc_dir_entry *acpi_root_dir;
62extern FADT_DESCRIPTOR acpi_fadt; 62extern struct fadt_descriptor acpi_fadt;
63 63
64enum acpi_bus_removal_type { 64enum acpi_bus_removal_type {
65 ACPI_BUS_REMOVAL_NORMAL = 0, 65 ACPI_BUS_REMOVAL_NORMAL = 0,
@@ -169,7 +169,8 @@ struct acpi_device_flags {
169 u32 power_manageable:1; 169 u32 power_manageable:1;
170 u32 performance_manageable:1; 170 u32 performance_manageable:1;
171 u32 wake_capable:1; /* Wakeup(_PRW) supported? */ 171 u32 wake_capable:1; /* Wakeup(_PRW) supported? */
172 u32 reserved:20; 172 u32 force_power_state:1;
173 u32 reserved:19;
173}; 174};
174 175
175/* File System */ 176/* File System */
@@ -296,6 +297,7 @@ struct acpi_device {
296 struct acpi_driver *driver; 297 struct acpi_driver *driver;
297 void *driver_data; 298 void *driver_data;
298 struct kobject kobj; 299 struct kobject kobj;
300 struct device dev;
299}; 301};
300 302
301#define acpi_driver_data(d) ((d)->driver_data) 303#define acpi_driver_data(d) ((d)->driver_data)
@@ -327,7 +329,7 @@ int acpi_bus_set_power(acpi_handle handle, int state);
327int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); 329int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data);
328int acpi_bus_receive_event(struct acpi_bus_event *event); 330int acpi_bus_receive_event(struct acpi_bus_event *event);
329int acpi_bus_register_driver(struct acpi_driver *driver); 331int acpi_bus_register_driver(struct acpi_driver *driver);
330int acpi_bus_unregister_driver(struct acpi_driver *driver); 332void acpi_bus_unregister_driver(struct acpi_driver *driver);
331int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, 333int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
332 acpi_handle handle, int type); 334 acpi_handle handle, int type);
333int acpi_bus_trim(struct acpi_device *start, int rmdevice); 335int acpi_bus_trim(struct acpi_device *start, int rmdevice);
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 970e9a6372c3..8f473c83b7c4 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -50,12 +50,16 @@
50#include "platform/acenv.h" 50#include "platform/acenv.h"
51#include "actypes.h" 51#include "actypes.h"
52 52
53/* Priorities for acpi_os_queue_for_execution */ 53/* Types for acpi_os_execute */
54 54
55#define OSD_PRIORITY_GPE 1 55typedef enum {
56#define OSD_PRIORITY_HIGH 2 56 OSL_GLOBAL_LOCK_HANDLER,
57#define OSD_PRIORITY_MED 3 57 OSL_NOTIFY_HANDLER,
58#define OSD_PRIORITY_LO 4 58 OSL_GPE_HANDLER,
59 OSL_DEBUGGER_THREAD,
60 OSL_EC_POLL_HANDLER,
61 OSL_EC_BURST_HANDLER
62} acpi_execute_type;
59 63
60#define ACPI_NO_UNIT_LIMIT ((u32) -1) 64#define ACPI_NO_UNIT_LIMIT ((u32) -1)
61#define ACPI_MUTEX_SEM 1 65#define ACPI_MUTEX_SEM 1
@@ -161,13 +165,11 @@ acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine);
161/* 165/*
162 * Threads and Scheduling 166 * Threads and Scheduling
163 */ 167 */
164u32 acpi_os_get_thread_id(void); 168acpi_thread_id acpi_os_get_thread_id(void);
165 169
166acpi_status 170acpi_status
167acpi_os_queue_for_execution(u32 priority, 171acpi_os_execute(acpi_execute_type type,
168 acpi_osd_exec_callback function, void *context); 172 acpi_osd_exec_callback function, void *context);
169
170void acpi_os_wait_events_complete(void *context);
171 173
172void acpi_os_wait_events_complete(void *context); 174void acpi_os_wait_events_complete(void *context);
173 175
@@ -214,6 +216,12 @@ acpi_os_derive_pci_id(acpi_handle rhandle,
214/* 216/*
215 * Miscellaneous 217 * Miscellaneous
216 */ 218 */
219acpi_status acpi_os_validate_interface(char *interface);
220
221acpi_status
222acpi_os_validate_address(u8 space_id,
223 acpi_physical_address address, acpi_size length);
224
217u8 acpi_os_readable(void *pointer, acpi_size length); 225u8 acpi_os_readable(void *pointer, acpi_size length);
218 226
219#ifdef ACPI_FUTURE_USAGE 227#ifdef ACPI_FUTURE_USAGE
@@ -255,11 +263,4 @@ char *acpi_os_get_next_filename(void *dir_handle);
255 263
256void acpi_os_close_directory(void *dir_handle); 264void acpi_os_close_directory(void *dir_handle);
257 265
258/*
259 * Debug
260 */
261void
262acpi_os_dbg_assert(void *failed_assertion,
263 void *file_name, u32 line_number, char *message);
264
265#endif /* __ACPIOSXF_H__ */ 266#endif /* __ACPIOSXF_H__ */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 66cf2ecef57a..049e9aa1b867 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device);
268 * Resource interfaces 268 * Resource interfaces
269 */ 269 */
270typedef 270typedef
271acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, 271acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
272 void *context); 272 void *context);
273 273
274acpi_status 274acpi_status
@@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle,
290acpi_status 290acpi_status
291acpi_walk_resources(acpi_handle device_handle, 291acpi_walk_resources(acpi_handle device_handle,
292 char *name, 292 char *name,
293 ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); 293 acpi_walk_resource_callback user_function, void *context);
294 294
295acpi_status 295acpi_status
296acpi_set_current_resources(acpi_handle device_handle, 296acpi_set_current_resources(acpi_handle device_handle,
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index fa02e8083381..ad11fc13fbef 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -164,23 +164,26 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
164/* 164/*
165 * rsutils 165 * rsutils
166 */ 166 */
167
167acpi_status 168acpi_status
168acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 169acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
170 struct acpi_buffer *ret_buffer);
169 171
170acpi_status 172acpi_status
171acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 173acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
174 struct acpi_buffer *ret_buffer);
172 175
173#ifdef ACPI_FUTURE_USAGE
174acpi_status 176acpi_status
175acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 177acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
176#endif /* ACPI_FUTURE_USAGE */ 178 struct acpi_buffer *ret_buffer);
177 179
178acpi_status 180acpi_status
179acpi_rs_get_method_data(acpi_handle handle, 181acpi_rs_get_method_data(acpi_handle handle,
180 char *path, struct acpi_buffer *ret_buffer); 182 char *path, struct acpi_buffer *ret_buffer);
181 183
182acpi_status 184acpi_status
183acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 185acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
186 struct acpi_buffer *ret_buffer);
184 187
185/* 188/*
186 * rscalc 189 * rscalc
@@ -198,8 +201,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
198 acpi_size * buffer_size_needed); 201 acpi_size * buffer_size_needed);
199 202
200acpi_status 203acpi_status
201acpi_rs_convert_aml_to_resources(u8 * aml_buffer, 204acpi_rs_convert_aml_to_resources(u8 * aml,
202 u32 aml_buffer_length, u8 * output_buffer); 205 u32 length,
206 u32 offset, u8 resource_index, void **context);
203 207
204acpi_status 208acpi_status
205acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, 209acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index d8c1c2cdac0c..5e8095f0f78f 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -44,6 +44,8 @@
44#ifndef __ACSTRUCT_H__ 44#ifndef __ACSTRUCT_H__
45#define __ACSTRUCT_H__ 45#define __ACSTRUCT_H__
46 46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
47/***************************************************************************** 49/*****************************************************************************
48 * 50 *
49 * Tree walking typedefs and structs 51 * Tree walking typedefs and structs
@@ -51,67 +53,76 @@
51 ****************************************************************************/ 53 ****************************************************************************/
52 54
53/* 55/*
54 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through 56 * Walk state - current state of a parse tree walk. Used for both a leisurely
55 * the tree (for whatever reason), and for control method execution. 57 * stroll through the tree (for whatever reason), and for control method
58 * execution.
56 */ 59 */
57#define ACPI_NEXT_OP_DOWNWARD 1 60#define ACPI_NEXT_OP_DOWNWARD 1
58#define ACPI_NEXT_OP_UPWARD 2 61#define ACPI_NEXT_OP_UPWARD 2
59 62
63/*
64 * Groups of definitions for walk_type used for different implementations of
65 * walkers (never simultaneously) - flags for interpreter:
66 */
60#define ACPI_WALK_NON_METHOD 0 67#define ACPI_WALK_NON_METHOD 0
61#define ACPI_WALK_METHOD 1 68#define ACPI_WALK_METHOD 0x01
62#define ACPI_WALK_METHOD_RESTART 2 69#define ACPI_WALK_METHOD_RESTART 0x02
63#define ACPI_WALK_CONST_REQUIRED 3 70
64#define ACPI_WALK_CONST_OPTIONAL 4 71/* Flags for i_aSL compiler only */
72
73#define ACPI_WALK_CONST_REQUIRED 0x10
74#define ACPI_WALK_CONST_OPTIONAL 0x20
65 75
66struct acpi_walk_state { 76struct acpi_walk_state {
67 u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ 77 struct acpi_walk_state *next; /* Next walk_state in list */
78 u8 descriptor_type; /* To differentiate various internal objs */
68 u8 walk_type; 79 u8 walk_type;
69 acpi_owner_id owner_id; /* Owner of objects created during the walk */ 80 u16 opcode; /* Current AML opcode */
70 u8 last_predicate; /* Result of last predicate */
71 u8 current_result; /* */
72 u8 next_op_info; /* Info about next_op */ 81 u8 next_op_info; /* Info about next_op */
73 u8 num_operands; /* Stack pointer for Operands[] array */ 82 u8 num_operands; /* Stack pointer for Operands[] array */
83 acpi_owner_id owner_id; /* Owner of objects created during the walk */
84 u8 last_predicate; /* Result of last predicate */
85 u8 current_result;
74 u8 return_used; 86 u8 return_used;
75 u16 opcode; /* Current AML opcode */
76 u8 scope_depth; 87 u8 scope_depth;
77 u8 pass_number; /* Parse pass during table load */ 88 u8 pass_number; /* Parse pass during table load */
78 u32 arg_count; /* push for fixed or var args */
79 u32 aml_offset; 89 u32 aml_offset;
80 u32 arg_types; 90 u32 arg_types;
81 u32 method_breakpoint; /* For single stepping */ 91 u32 method_breakpoint; /* For single stepping */
82 u32 user_breakpoint; /* User AML breakpoint */ 92 u32 user_breakpoint; /* User AML breakpoint */
83 u32 parse_flags; 93 u32 parse_flags;
94
95 struct acpi_parse_state parser_state; /* Current state of parser */
84 u32 prev_arg_types; 96 u32 prev_arg_types;
97 u32 arg_count; /* push for fixed or var args */
85 98
86 u8 *aml_last_while;
87 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ 99 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
100 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
101 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
102 union acpi_operand_object **params;
103
104 u8 *aml_last_while;
88 union acpi_operand_object **caller_return_desc; 105 union acpi_operand_object **caller_return_desc;
89 union acpi_generic_state *control_state; /* List of control states (nested IFs) */ 106 union acpi_generic_state *control_state; /* List of control states (nested IFs) */
90 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ 107 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
91 struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ 108 struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */
92 union acpi_operand_object *implicit_return_obj; 109 union acpi_operand_object *implicit_return_obj;
93 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
94 struct acpi_namespace_node *method_call_node; /* Called method Node */ 110 struct acpi_namespace_node *method_call_node; /* Called method Node */
95 union acpi_parse_object *method_call_op; /* method_call Op if running a method */ 111 union acpi_parse_object *method_call_op; /* method_call Op if running a method */
96 union acpi_operand_object *method_desc; /* Method descriptor if running a method */ 112 union acpi_operand_object *method_desc; /* Method descriptor if running a method */
97 struct acpi_namespace_node *method_node; /* Method node if running a method. */ 113 struct acpi_namespace_node *method_node; /* Method node if running a method. */
98 union acpi_parse_object *op; /* Current parser op */ 114 union acpi_parse_object *op; /* Current parser op */
99 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
100 const struct acpi_opcode_info *op_info; /* Info on current opcode */ 115 const struct acpi_opcode_info *op_info; /* Info on current opcode */
101 union acpi_parse_object *origin; /* Start of walk [Obsolete] */ 116 union acpi_parse_object *origin; /* Start of walk [Obsolete] */
102 union acpi_operand_object **params;
103 struct acpi_parse_state parser_state; /* Current state of parser */
104 union acpi_operand_object *result_obj; 117 union acpi_operand_object *result_obj;
105 union acpi_generic_state *results; /* Stack of accumulated results */ 118 union acpi_generic_state *results; /* Stack of accumulated results */
106 union acpi_operand_object *return_desc; /* Return object, if any */ 119 union acpi_operand_object *return_desc; /* Return object, if any */
107 union acpi_generic_state *scope_info; /* Stack of nested scopes */ 120 union acpi_generic_state *scope_info; /* Stack of nested scopes */
108
109 union acpi_parse_object *prev_op; /* Last op that was processed */ 121 union acpi_parse_object *prev_op; /* Last op that was processed */
110 union acpi_parse_object *next_op; /* next op to be processed */ 122 union acpi_parse_object *next_op; /* next op to be processed */
123 struct acpi_thread_state *thread;
111 acpi_parse_downwards descending_callback; 124 acpi_parse_downwards descending_callback;
112 acpi_parse_upwards ascending_callback; 125 acpi_parse_upwards ascending_callback;
113 struct acpi_thread_state *thread;
114 struct acpi_walk_state *next; /* Next walk_state in list */
115}; 126};
116 127
117/* Info used by acpi_ps_init_objects */ 128/* Info used by acpi_ps_init_objects */
@@ -131,32 +142,6 @@ struct acpi_init_walk_info {
131 struct acpi_table_desc *table_desc; 142 struct acpi_table_desc *table_desc;
132}; 143};
133 144
134/* Info used by acpi_ns_initialize_devices */
135
136struct acpi_device_walk_info {
137 u16 device_count;
138 u16 num_STA;
139 u16 num_INI;
140 struct acpi_table_desc *table_desc;
141};
142
143/* TBD: [Restructure] Merge with struct above */
144
145struct acpi_walk_info {
146 u32 debug_level;
147 u32 count;
148 acpi_owner_id owner_id;
149 u8 display_type;
150};
151
152/* Display Types */
153
154#define ACPI_DISPLAY_SUMMARY (u8) 0
155#define ACPI_DISPLAY_OBJECTS (u8) 1
156#define ACPI_DISPLAY_MASK (u8) 1
157
158#define ACPI_DISPLAY_SHORT (u8) 2
159
160struct acpi_get_devices_info { 145struct acpi_get_devices_info {
161 acpi_walk_callback user_function; 146 acpi_walk_callback user_function;
162 void *context; 147 void *context;
@@ -189,16 +174,21 @@ union acpi_aml_operands {
189 } mid; 174 } mid;
190}; 175};
191 176
192/* Internal method parameter list */ 177/*
193 178 * Structure used to pass object evaluation parameters.
194struct acpi_parameter_info { 179 * Purpose is to reduce CPU stack use.
195 struct acpi_namespace_node *node; 180 */
181struct acpi_evaluate_info {
182 struct acpi_namespace_node *prefix_node;
183 char *pathname;
196 union acpi_operand_object *obj_desc; 184 union acpi_operand_object *obj_desc;
197 union acpi_operand_object **parameters; 185 union acpi_operand_object **parameters;
186 struct acpi_namespace_node *resolved_node;
198 union acpi_operand_object *return_object; 187 union acpi_operand_object *return_object;
199 u8 pass_number; 188 u8 pass_number;
200 u8 parameter_type; 189 u8 parameter_type;
201 u8 return_object_type; 190 u8 return_object_type;
191 u8 flags;
202}; 192};
203 193
204/* Types for parameter_type above */ 194/* Types for parameter_type above */
@@ -206,4 +196,35 @@ struct acpi_parameter_info {
206#define ACPI_PARAM_ARGS 0 196#define ACPI_PARAM_ARGS 0
207#define ACPI_PARAM_GPE 1 197#define ACPI_PARAM_GPE 1
208 198
199/* Values for Flags above */
200
201#define ACPI_IGNORE_RETURN_VALUE 1
202
203/* Info used by acpi_ns_initialize_devices */
204
205struct acpi_device_walk_info {
206 u16 device_count;
207 u16 num_STA;
208 u16 num_INI;
209 struct acpi_table_desc *table_desc;
210 struct acpi_evaluate_info *evaluate_info;
211};
212
213/* TBD: [Restructure] Merge with struct above */
214
215struct acpi_walk_info {
216 u32 debug_level;
217 u32 count;
218 acpi_owner_id owner_id;
219 u8 display_type;
220};
221
222/* Display Types */
223
224#define ACPI_DISPLAY_SUMMARY (u8) 0
225#define ACPI_DISPLAY_OBJECTS (u8) 1
226#define ACPI_DISPLAY_MASK (u8) 1
227
228#define ACPI_DISPLAY_SHORT (u8) 2
229
209#endif 230#endif
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index 30a47542e1c8..4dbaf02fe526 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -136,7 +136,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc);
136acpi_status 136acpi_status
137acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); 137acpi_tb_verify_table_checksum(struct acpi_table_header *table_header);
138 138
139u8 acpi_tb_generate_checksum(void *buffer, u32 length); 139u8 acpi_tb_sum_table(void *buffer, u32 length);
140
141u8 acpi_tb_generate_checksum(struct acpi_table_header *table);
142
143void acpi_tb_set_checksum(struct acpi_table_header *table);
140 144
141acpi_status 145acpi_status
142acpi_tb_validate_table_header(struct acpi_table_header *table_header); 146acpi_tb_validate_table_header(struct acpi_table_header *table_header);
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index ed53f842dad4..b125ceed9cb7 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: actbl.h - Table data structures defined in ACPI specification 3 * Name: actbl.h - Basic ACPI Table Definitions
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -45,66 +45,45 @@
45#define __ACTBL_H__ 45#define __ACTBL_H__
46 46
47/* 47/*
48 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 48 * Values for description table header signatures. Useful because they make
49 * This is the only type that is even remotely portable. Anything else is not 49 * it more difficult to inadvertently type in the wrong signature.
50 * portable, so do not use any other bitfield types.
51 */
52
53/*
54 * Values for description table header signatures
55 */ 50 */
56#define RSDP_NAME "RSDP"
57#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
58#define APIC_SIG "APIC" /* Multiple APIC Description Table */
59#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ 51#define DSDT_SIG "DSDT" /* Differentiated System Description Table */
60#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ 52#define FADT_SIG "FACP" /* Fixed ACPI Description Table */
61#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ 53#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
62#define PSDT_SIG "PSDT" /* Persistent System Description Table */ 54#define PSDT_SIG "PSDT" /* Persistent System Description Table */
55#define RSDP_SIG "RSD PTR " /* Root System Description Pointer */
63#define RSDT_SIG "RSDT" /* Root System Description Table */ 56#define RSDT_SIG "RSDT" /* Root System Description Table */
64#define XSDT_SIG "XSDT" /* Extended System Description Table */ 57#define XSDT_SIG "XSDT" /* Extended System Description Table */
65#define SSDT_SIG "SSDT" /* Secondary System Description Table */ 58#define SSDT_SIG "SSDT" /* Secondary System Description Table */
66#define SBST_SIG "SBST" /* Smart Battery Specification Table */ 59#define RSDP_NAME "RSDP"
67#define SPIC_SIG "SPIC" /* IOSAPIC table */
68#define BOOT_SIG "BOOT" /* Boot table */
69
70#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
71 60
72/* 61/*
73 * Common table types. The base code can remain 62 * All tables and structures must be byte-packed to match the ACPI
74 * constant if the underlying tables are changed 63 * specification, since the tables are provided by the system BIOS
75 */ 64 */
76#define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2
77#define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2
78#define FACS_DESCRIPTOR struct facs_descriptor_rev2
79#define FADT_DESCRIPTOR struct fadt_descriptor_rev2
80
81#pragma pack(1) 65#pragma pack(1)
82 66
83/* 67/*
84 * ACPI Version-independent tables 68 * These are the ACPI tables that are directly consumed by the subsystem.
69 *
70 * The RSDP and FACS do not use the common ACPI table header. All other ACPI
71 * tables use the header.
85 * 72 *
86 * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) 73 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
87 * are in separate files. 74 * This is the only type that is even remotely portable. Anything else is not
75 * portable, so do not use any other bitfield types.
88 */ 76 */
89struct rsdp_descriptor { /* Root System Descriptor Pointer */
90 char signature[8]; /* ACPI signature, contains "RSD PTR " */
91 u8 checksum; /* ACPI 1.0 checksum */
92 char oem_id[6]; /* OEM identification */
93 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
94 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
95 u32 length; /* XSDT Length in bytes, including header */
96 u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */
97 u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */
98 char reserved[3]; /* Reserved, must be zero */
99};
100 77
101struct acpi_common_facs { /* Common FACS for internal use */ 78/*******************************************************************************
102 u32 *global_lock; 79 *
103 u64 *firmware_waking_vector; 80 * ACPI Table Header. This common header is used by all tables except the
104 u8 vector_width; 81 * RSDP and FACS. The define is used for direct inclusion of header into
105}; 82 * other ACPI tables
83 *
84 ******************************************************************************/
106 85
107#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ 86#define ACPI_TABLE_HEADER_DEF \
108 char signature[4]; /* ASCII table signature */\ 87 char signature[4]; /* ASCII table signature */\
109 u32 length; /* Length of table in bytes, including this header */\ 88 u32 length; /* Length of table in bytes, including this header */\
110 u8 revision; /* ACPI Specification minor version # */\ 89 u8 revision; /* ACPI Specification minor version # */\
@@ -112,154 +91,239 @@ struct acpi_common_facs { /* Common FACS for internal use */
112 char oem_id[6]; /* ASCII OEM identification */\ 91 char oem_id[6]; /* ASCII OEM identification */\
113 char oem_table_id[8]; /* ASCII OEM table identification */\ 92 char oem_table_id[8]; /* ASCII OEM table identification */\
114 u32 oem_revision; /* OEM revision number */\ 93 u32 oem_revision; /* OEM revision number */\
115 char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ 94 char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\
116 u32 asl_compiler_revision; /* ASL compiler version */ 95 u32 asl_compiler_revision; /* ASL compiler version */
117 96
118struct acpi_table_header { /* ACPI common table header */ 97struct acpi_table_header {
119ACPI_TABLE_HEADER_DEF}; 98ACPI_TABLE_HEADER_DEF};
120 99
121/* 100/*
122 * MADT values and structures 101 * GAS - Generic Address Structure (ACPI 2.0+)
123 */ 102 */
103struct acpi_generic_address {
104 u8 address_space_id; /* Address space where struct or register exists */
105 u8 register_bit_width; /* Size in bits of given register */
106 u8 register_bit_offset; /* Bit offset within the register */
107 u8 access_width; /* Minimum Access size (ACPI 3.0) */
108 u64 address; /* 64-bit address of struct or register */
109};
124 110
125/* Values for MADT PCATCompat */ 111/*******************************************************************************
112 *
113 * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
114 *
115 ******************************************************************************/
116
117struct rsdp_descriptor {
118 char signature[8]; /* ACPI signature, contains "RSD PTR " */
119 u8 checksum; /* ACPI 1.0 checksum */
120 char oem_id[6]; /* OEM identification */
121 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
122 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
123 u32 length; /* Table length in bytes, including header (ACPI 2.0+) */
124 u64 xsdt_physical_address; /* 64-bit physical address of the XSDT (ACPI 2.0+) */
125 u8 extended_checksum; /* Checksum of entire table (ACPI 2.0+) */
126 u8 reserved[3]; /* Reserved, must be zero */
127};
126 128
127#define DUAL_PIC 0 129#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */
128#define MULTIPLE_APIC 1
129 130
130/* Master MADT */ 131/*******************************************************************************
132 *
133 * RSDT/XSDT - Root System Description Tables
134 *
135 ******************************************************************************/
131 136
132struct multiple_apic_table { 137struct rsdt_descriptor {
133 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 138 ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
134 u32 local_apic_address; /* Physical address of local APIC */ 139};
140
141struct xsdt_descriptor {
142 ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
143};
144
145/*******************************************************************************
146 *
147 * FACS - Firmware ACPI Control Structure (FACS)
148 *
149 ******************************************************************************/
150
151struct facs_descriptor {
152 char signature[4]; /* ASCII table signature */
153 u32 length; /* Length of structure, in bytes */
154 u32 hardware_signature; /* Hardware configuration signature */
155 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */
156 u32 global_lock; /* Global Lock for shared hardware resources */
135 157
136 /* Flags (32 bits) */ 158 /* Flags (32 bits) */
137 159
138 u8 PCATcompat:1; /* 00: System also has dual 8259s */ 160 u8 S4bios_f:1; /* 00: S4BIOS support is present */
139 u8:7; /* 01-07: Reserved, must be zero */ 161 u8:7; /* 01-07: Reserved, must be zero */
140 u8 reserved1[3]; /* 08-31: Reserved, must be zero */ 162 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
141};
142 163
143/* Values for Type in APIC_HEADER_DEF */ 164 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
165 u8 version; /* Version of this table (ACPI 2.0+) */
166 u8 reserved[31]; /* Reserved, must be zero */
167};
144 168
145#define APIC_PROCESSOR 0 169#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */
146#define APIC_IO 1 170#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */
147#define APIC_XRUPT_OVERRIDE 2
148#define APIC_NMI 3
149#define APIC_LOCAL_NMI 4
150#define APIC_ADDRESS_OVERRIDE 5
151#define APIC_IO_SAPIC 6
152#define APIC_LOCAL_SAPIC 7
153#define APIC_XRUPT_SOURCE 8
154#define APIC_RESERVED 9 /* 9 and greater are reserved */
155 171
156/* 172/*
157 * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) 173 * Common FACS - This is a version-independent FACS structure used for internal use only
158 */ 174 */
159#define APIC_HEADER_DEF /* Common APIC sub-structure header */\ 175struct acpi_common_facs {
160 u8 type; \ 176 u32 *global_lock;
161 u8 length; 177 u64 *firmware_waking_vector;
162 178 u8 vector_width;
163struct apic_header {
164APIC_HEADER_DEF};
165
166/* Values for MPS INTI flags */
167
168#define POLARITY_CONFORMS 0
169#define POLARITY_ACTIVE_HIGH 1
170#define POLARITY_RESERVED 2
171#define POLARITY_ACTIVE_LOW 3
172
173#define TRIGGER_CONFORMS 0
174#define TRIGGER_EDGE 1
175#define TRIGGER_RESERVED 2
176#define TRIGGER_LEVEL 3
177
178/* Common flag definitions (16 bits each) */
179
180#define MPS_INTI_FLAGS \
181 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
182 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
183 u8 : 4; /* 04-07: Reserved, must be zero */\
184 u8 reserved1; /* 08-15: Reserved, must be zero */
185
186#define LOCAL_APIC_FLAGS \
187 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
188 u8 : 7; /* 01-07: Reserved, must be zero */\
189 u8 reserved2; /* 08-15: Reserved, must be zero */
190
191/* Sub-structures for MADT */
192
193struct madt_processor_apic {
194 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
195 u8 local_apic_id; /* Processor's local APIC id */
196 LOCAL_APIC_FLAGS};
197
198struct madt_io_apic {
199 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */
200 u8 reserved; /* Reserved - must be zero */
201 u32 address; /* APIC physical address */
202 u32 interrupt; /* Global system interrupt where INTI
203 * lines start */
204}; 179};
205 180
206struct madt_interrupt_override { 181/*******************************************************************************
207 APIC_HEADER_DEF u8 bus; /* 0 - ISA */ 182 *
208 u8 source; /* Interrupt source (IRQ) */ 183 * FADT - Fixed ACPI Description Table (Signature "FACP")
209 u32 interrupt; /* Global system interrupt */ 184 *
210 MPS_INTI_FLAGS}; 185 ******************************************************************************/
186
187/* Fields common to all versions of the FADT */
188
189#define ACPI_FADT_COMMON \
190 ACPI_TABLE_HEADER_DEF \
191 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \
192 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \
193 u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
194 u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \
195 u16 sci_int; /* System vector of SCI interrupt */ \
196 u32 smi_cmd; /* Port address of SMI command port */ \
197 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \
198 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
199 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \
200 u8 pstate_cnt; /* Processor performance state control*/ \
201 u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \
202 u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \
203 u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
204 u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
205 u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \
206 u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
207 u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
208 u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
209 u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \
210 u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \
211 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \
212 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \
213 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \
214 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \
215 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \
216 u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \
217 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \
218 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \
219 u16 flush_size; /* Processor's memory cache line width, in bytes */ \
220 u16 flush_stride; /* Number of flush strides that need to be read */ \
221 u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
222 u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \
223 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
224 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
225 u8 century; /* Index to century in RTC CMOS RAM */ \
226 u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \
227 u8 reserved2; /* Reserved, must be zero */
211 228
212struct madt_nmi_source { 229/*
213 APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */ 230 * ACPI 2.0+ FADT
231 */
232struct fadt_descriptor {
233 ACPI_FADT_COMMON
234 /* Flags (32 bits) */
235 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
236 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
237 u8 proc_c1:1; /* 02: All processors support C1 state */
238 u8 plvl2_up:1; /* 03: C2 state works on MP system */
239 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
240 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
241 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
242 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
243 u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
244 u8 dock_cap:1; /* 09: Docking supported */
245 u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
246 u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
247 u8 headless:1; /* 12: No local video capabilities or local input devices */
248 u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
249
250 u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
251 u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
252 u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
253 u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
254 u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
255 u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */
256 u8:4; /* 20-23: Reserved, must be zero */
257 u8 reserved3; /* 24-31: Reserved, must be zero */
258
259 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
260 u8 reset_value; /* Value to write to the reset_register port to reset the system */
261 u8 reserved4[3]; /* These three bytes must be zero */
262 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
263 u64 Xdsdt; /* 64-bit physical address of DSDT */
264 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
265 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */
266 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
267 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
268 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
269 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
270 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */
271 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */
214}; 272};
215 273
216struct madt_local_apic_nmi { 274/*
217 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 275 * "Down-revved" ACPI 2.0 FADT descriptor
218 MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */ 276 * Defined here to allow compiler to generate the length of the struct
277 */
278struct fadt_descriptor_rev2_minus {
279 ACPI_FADT_COMMON u32 flags;
280 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
281 u8 reset_value; /* Value to write to the reset_register port to reset the system. */
282 u8 reserved7[3]; /* Reserved, must be zero */
219}; 283};
220 284
221struct madt_address_override { 285/*
222 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ 286 * ACPI 1.0 FADT
223 u64 address; /* APIC physical address */ 287 * Defined here to allow compiler to generate the length of the struct
288 */
289struct fadt_descriptor_rev1 {
290 ACPI_FADT_COMMON u32 flags;
224}; 291};
225 292
226struct madt_io_sapic { 293/* FADT: Prefered Power Management Profiles */
227 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
228 u8 reserved; /* Reserved, must be zero */
229 u32 interrupt_base; /* Glocal interrupt for SAPIC start */
230 u64 address; /* SAPIC physical address */
231};
232 294
233struct madt_local_sapic { 295#define PM_UNSPECIFIED 0
234 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 296#define PM_DESKTOP 1
235 u8 local_sapic_id; /* SAPIC ID */ 297#define PM_MOBILE 2
236 u8 local_sapic_eid; /* SAPIC EID */ 298#define PM_WORKSTATION 3
237 u8 reserved[3]; /* Reserved, must be zero */ 299#define PM_ENTERPRISE_SERVER 4
238 LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ 300#define PM_SOHO_SERVER 5
239 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ 301#define PM_APPLIANCE_PC 6
240};
241 302
242struct madt_interrupt_source { 303/* FADT: Boot Arch Flags */
243 APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */
244 u8 processor_id; /* Processor ID */
245 u8 processor_eid; /* Processor EID */
246 u8 io_sapic_vector; /* Vector value for PMI interrupts */
247 u32 interrupt; /* Global system interrupt */
248 u32 flags; /* Interrupt Source Flags */
249};
250 304
251/* 305#define BAF_LEGACY_DEVICES 0x0001
252 * Smart Battery 306#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
253 */ 307
254struct smart_battery_table { 308#define FADT2_REVISION_ID 3
255 ACPI_TABLE_HEADER_DEF u32 warning_level; 309#define FADT2_MINUS_REVISION_ID 2
256 u32 low_level; 310
257 u32 critical_level; 311/* Reset to default packing */
258};
259 312
260#pragma pack() 313#pragma pack()
261 314
262/* 315/*
316 * This macro is temporary until the table bitfield flag definitions
317 * are removed and replaced by a Flags field.
318 */
319#define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \
320 sizeof(((d *)0)->f) + o)
321/*
322 * Get the remaining ACPI tables
323 */
324#include "actbl1.h"
325
326/*
263 * ACPI Table information. We save the table address, length, 327 * ACPI Table information. We save the table address, length,
264 * and type of memory allocation (mapped or allocated) for each 328 * and type of memory allocation (mapped or allocated) for each
265 * table for 1) when we exit, and 2) if a new table is installed 329 * table for 1) when we exit, and 2) if a new table is installed
@@ -290,27 +354,17 @@ struct acpi_table_support {
290 u8 flags; 354 u8 flags;
291}; 355};
292 356
293/*
294 * Get the ACPI version-specific tables
295 */
296#include "actbl1.h" /* Acpi 1.0 table definitions */
297#include "actbl2.h" /* Acpi 2.0 table definitions */
298
299extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, 357extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
300 * needed for certain workarounds */ 358 * needed for certain workarounds */
359/* Macros used to generate offsets to specific table fields */
301 360
302#pragma pack(1) 361#define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f)
303/* 362#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f)
304 * High performance timer 363#define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f)
305 */ 364#define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f)
306struct hpet_table { 365#define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f)
307 ACPI_TABLE_HEADER_DEF u32 hardware_id;
308 struct acpi_generic_address base_address;
309 u8 hpet_number;
310 u16 clock_tick;
311 u8 attributes;
312};
313 366
314#pragma pack() 367#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o)
368#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o)
315 369
316#endif /* __ACTBL_H__ */ 370#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index cd428d57add0..745a6445a4f9 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: actbl1.h - ACPI 1.0 tables 3 * Name: actbl1.h - Additional ACPI table definitions
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -44,92 +44,599 @@
44#ifndef __ACTBL1_H__ 44#ifndef __ACTBL1_H__
45#define __ACTBL1_H__ 45#define __ACTBL1_H__
46 46
47/*******************************************************************************
48 *
49 * Additional ACPI Tables
50 *
51 * These tables are not consumed directly by the ACPICA subsystem, but are
52 * included here to support device drivers and the AML disassembler.
53 *
54 ******************************************************************************/
55
56/*
57 * Values for description table header signatures. Useful because they make
58 * it more difficult to inadvertently type in the wrong signature.
59 */
60#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
61#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
62#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */
63#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
64#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */
65#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
66#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
67#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
68#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
69#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
70#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
71#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
72#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
73#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
74#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
75
76/* Legacy names */
77
78#define APIC_SIG "APIC" /* Multiple APIC Description Table */
79#define BOOT_SIG "BOOT" /* Simple Boot Flag Table */
80#define SBST_SIG "SBST" /* Smart Battery Specification Table */
81
82/*
83 * All tables must be byte-packed to match the ACPI specification, since
84 * the tables are provided by the system BIOS.
85 */
47#pragma pack(1) 86#pragma pack(1)
48 87
49/* 88/*
50 * ACPI 1.0 Root System Description Table (RSDT) 89 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
90 * This is the only type that is even remotely portable. Anything else is not
91 * portable, so do not use any other bitfield types.
51 */ 92 */
52struct rsdt_descriptor_rev1 { 93
53 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 94/*******************************************************************************
54 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ 95 *
55}; 96 * ASF - Alert Standard Format table (Signature "ASF!")
97 *
98 ******************************************************************************/
99
100struct acpi_table_asf {
101ACPI_TABLE_HEADER_DEF};
102
103#define ACPI_ASF_HEADER_DEF \
104 u8 type; \
105 u8 reserved; \
106 u16 length;
107
108struct acpi_asf_header {
109ACPI_ASF_HEADER_DEF};
110
111/* Values for Type field */
112
113#define ASF_INFO 0
114#define ASF_ALERT 1
115#define ASF_CONTROL 2
116#define ASF_BOOT 3
117#define ASF_ADDRESS 4
118#define ASF_RESERVED 5
56 119
57/* 120/*
58 * ACPI 1.0 Firmware ACPI Control Structure (FACS) 121 * ASF subtables
59 */ 122 */
60struct facs_descriptor_rev1 { 123
61 char signature[4]; /* ASCII table signature */ 124/* 0: ASF Information */
62 u32 length; /* Length of structure in bytes */ 125
63 u32 hardware_signature; /* Hardware configuration signature */ 126struct acpi_asf_info {
64 u32 firmware_waking_vector; /* ACPI OS waking vector */ 127 ACPI_ASF_HEADER_DEF u8 min_reset_value;
65 u32 global_lock; /* Global Lock */ 128 u8 min_poll_interval;
129 u16 system_id;
130 u32 mfg_id;
131 u8 flags;
132 u8 reserved2[3];
133};
134
135/* 1: ASF Alerts */
136
137struct acpi_asf_alert {
138 ACPI_ASF_HEADER_DEF u8 assert_mask;
139 u8 deassert_mask;
140 u8 alerts;
141 u8 data_length;
142 u8 array[1];
143};
144
145/* 2: ASF Remote Control */
146
147struct acpi_asf_remote {
148 ACPI_ASF_HEADER_DEF u8 controls;
149 u8 data_length;
150 u16 reserved2;
151 u8 array[1];
152};
153
154/* 3: ASF RMCP Boot Options */
155
156struct acpi_asf_rmcp {
157 ACPI_ASF_HEADER_DEF u8 capabilities[7];
158 u8 completion_code;
159 u32 enterprise_id;
160 u8 command;
161 u16 parameter;
162 u16 boot_options;
163 u16 oem_parameters;
164};
165
166/* 4: ASF Address */
167
168struct acpi_asf_address {
169 ACPI_ASF_HEADER_DEF u8 eprom_address;
170 u8 devices;
171 u8 smbus_addresses[1];
172};
173
174/*******************************************************************************
175 *
176 * BOOT - Simple Boot Flag Table
177 *
178 ******************************************************************************/
179
180struct acpi_table_boot {
181 ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */
182 u8 reserved[3];
183};
184
185/*******************************************************************************
186 *
187 * CPEP - Corrected Platform Error Polling table
188 *
189 ******************************************************************************/
190
191struct acpi_table_cpep {
192 ACPI_TABLE_HEADER_DEF u64 reserved;
193};
194
195/* Subtable */
196
197struct acpi_cpep_polling {
198 u8 type;
199 u8 length;
200 u8 processor_id; /* Processor ID */
201 u8 processor_eid; /* Processor EID */
202 u32 polling_interval; /* Polling interval (msec) */
203};
204
205/*******************************************************************************
206 *
207 * DBGP - Debug Port table
208 *
209 ******************************************************************************/
210
211struct acpi_table_dbgp {
212 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
213 u8 reserved[3];
214 struct acpi_generic_address debug_port;
215};
216
217/*******************************************************************************
218 *
219 * ECDT - Embedded Controller Boot Resources Table
220 *
221 ******************************************************************************/
222
223struct ec_boot_resources {
224 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */
225 struct acpi_generic_address ec_data; /* Address of EC data register */
226 u32 uid; /* Unique ID - must be same as the EC _UID method */
227 u8 gpe_bit; /* The GPE for the EC */
228 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
229};
230
231/*******************************************************************************
232 *
233 * HPET - High Precision Event Timer table
234 *
235 ******************************************************************************/
236
237struct acpi_hpet_table {
238 ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */
239 struct acpi_generic_address base_address; /* Address of event timer block */
240 u8 hpet_number; /* HPET sequence number */
241 u16 clock_tick; /* Main counter min tick, periodic mode */
242 u8 attributes;
243};
244
245#if 0 /* HPET flags to be converted to macros */
246struct { /* Flags (8 bits) */
247 u8 page_protect:1; /* 00: No page protection */
248 u8 page_protect4:1; /* 01: 4_kB page protected */
249 u8 page_protect64:1; /* 02: 64_kB page protected */
250 u8:5; /* 03-07: Reserved, must be zero */
251} flags;
252#endif
253
254/*******************************************************************************
255 *
256 * MADT - Multiple APIC Description Table
257 *
258 ******************************************************************************/
259
260struct multiple_apic_table {
261 ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */
66 262
67 /* Flags (32 bits) */ 263 /* Flags (32 bits) */
68 264
69 u8 S4bios_f:1; /* 00: S4BIOS support is present */ 265 u8 PCATcompat:1; /* 00: System also has dual 8259s */
70 u8:7; /* 01-07: Reserved, must be zero */ 266 u8:7; /* 01-07: Reserved, must be zero */
71 u8 reserved1[3]; /* 08-31: Reserved, must be zero */ 267 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
72
73 u8 reserved2[40]; /* Reserved, must be zero */
74}; 268};
75 269
270/* Values for MADT PCATCompat */
271
272#define DUAL_PIC 0
273#define MULTIPLE_APIC 1
274
275/* Common MADT Sub-table header */
276
277#define APIC_HEADER_DEF \
278 u8 type; \
279 u8 length;
280
281struct apic_header {
282APIC_HEADER_DEF};
283
284/* Values for Type in struct apic_header */
285
286#define APIC_PROCESSOR 0
287#define APIC_IO 1
288#define APIC_XRUPT_OVERRIDE 2
289#define APIC_NMI 3
290#define APIC_LOCAL_NMI 4
291#define APIC_ADDRESS_OVERRIDE 5
292#define APIC_IO_SAPIC 6
293#define APIC_LOCAL_SAPIC 7
294#define APIC_XRUPT_SOURCE 8
295#define APIC_RESERVED 9 /* 9 and greater are reserved */
296
297/* Flag definitions for MADT sub-tables */
298
299#define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \
300 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
301 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
302 u8 : 4; /* 04-07: Reserved, must be zero */\
303 u8 reserved1; /* 08-15: Reserved, must be zero */
304
305#define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \
306 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
307 u8 : 7; /* 01-07: Reserved, must be zero */\
308 u8 reserved2[3]; /* 08-31: Reserved, must be zero */
309
310/* Values for MPS INTI flags */
311
312#define POLARITY_CONFORMS 0
313#define POLARITY_ACTIVE_HIGH 1
314#define POLARITY_RESERVED 2
315#define POLARITY_ACTIVE_LOW 3
316
317#define TRIGGER_CONFORMS 0
318#define TRIGGER_EDGE 1
319#define TRIGGER_RESERVED 2
320#define TRIGGER_LEVEL 3
321
76/* 322/*
77 * ACPI 1.0 Fixed ACPI Description Table (FADT) 323 * MADT Sub-tables, correspond to Type in struct apic_header
78 */ 324 */
79struct fadt_descriptor_rev1 { 325
80 ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 326/* 0: processor APIC */
81 u32 firmware_ctrl; /* Physical address of FACS */ 327
82 u32 dsdt; /* Physical address of DSDT */ 328struct madt_processor_apic {
83 u8 model; /* System Interrupt Model */ 329 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
84 u8 reserved1; /* Reserved, must be zero */ 330 u8 local_apic_id; /* Processor's local APIC id */
85 u16 sci_int; /* System vector of SCI interrupt */ 331 ACPI_MADT_LFLAGS};
86 u32 smi_cmd; /* Port address of SMI command port */ 332
87 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ 333/* 1: IO APIC */
88 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ 334
89 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ 335struct madt_io_apic {
90 u8 reserved2; /* Reserved, must be zero */ 336 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */
91 u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ 337 u8 reserved; /* Reserved - must be zero */
92 u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ 338 u32 address; /* APIC physical address */
93 u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ 339 u32 interrupt; /* Global system interrupt where INTI lines start */
94 u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ 340};
95 u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ 341
96 u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ 342/* 2: Interrupt Override */
97 u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ 343
98 u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ 344struct madt_interrupt_override {
99 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ 345 APIC_HEADER_DEF u8 bus; /* 0 - ISA */
100 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ 346 u8 source; /* Interrupt source (IRQ) */
101 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ 347 u32 interrupt; /* Global system interrupt */
102 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ 348 ACPI_MADT_IFLAGS};
103 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ 349
104 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ 350/* 3: NMI Sources */
105 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ 351
106 u8 reserved3; /* Reserved, must be zero */ 352struct madt_nmi_source {
107 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ 353 APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */
108 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ 354};
109 u16 flush_size; /* Size of area read to flush caches */ 355
110 u16 flush_stride; /* Stride used in flushing caches */ 356/* 4: Local APIC NMI */
111 u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ 357
112 u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ 358struct madt_local_apic_nmi {
113 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ 359 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
114 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ 360 ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */
115 u8 century; /* Index to century in RTC CMOS RAM */ 361};
116 u8 reserved4[3]; /* Reserved, must be zero */ 362
363/* 5: Address Override */
364
365struct madt_address_override {
366 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */
367 u64 address; /* APIC physical address */
368};
369
370/* 6: I/O Sapic */
371
372struct madt_io_sapic {
373 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
374 u8 reserved; /* Reserved, must be zero */
375 u32 interrupt_base; /* Glocal interrupt for SAPIC start */
376 u64 address; /* SAPIC physical address */
377};
378
379/* 7: Local Sapic */
380
381struct madt_local_sapic {
382 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
383 u8 local_sapic_id; /* SAPIC ID */
384 u8 local_sapic_eid; /* SAPIC EID */
385 u8 reserved[3]; /* Reserved, must be zero */
386 ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */
387 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */
388};
389
390/* 8: Platform Interrupt Source */
391
392struct madt_interrupt_source {
393 APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */
394 u8 processor_id; /* Processor ID */
395 u8 processor_eid; /* Processor EID */
396 u8 io_sapic_vector; /* Vector value for PMI interrupts */
397 u32 interrupt; /* Global system interrupt */
398 u32 flags; /* Interrupt Source Flags */
399};
400
401#ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H
402/*******************************************************************************
403 *
404 * MCFG - PCI Memory Mapped Configuration table and sub-table
405 *
406 ******************************************************************************/
407
408struct acpi_table_mcfg {
409 ACPI_TABLE_HEADER_DEF u8 reserved[8];
410};
411
412struct acpi_mcfg_allocation {
413 u64 base_address; /* Base address, processor-relative */
414 u16 pci_segment; /* PCI segment group number */
415 u8 start_bus_number; /* Starting PCI Bus number */
416 u8 end_bus_number; /* Final PCI Bus number */
417 u32 reserved;
418};
419#endif
420
421/*******************************************************************************
422 *
423 * SBST - Smart Battery Specification Table
424 *
425 ******************************************************************************/
426
427struct smart_battery_table {
428 ACPI_TABLE_HEADER_DEF u32 warning_level;
429 u32 low_level;
430 u32 critical_level;
431};
432
433/*******************************************************************************
434 *
435 * SLIT - System Locality Distance Information Table
436 *
437 ******************************************************************************/
438
439struct system_locality_info {
440 ACPI_TABLE_HEADER_DEF u64 locality_count;
441 u8 entry[1][1];
442};
443
444/*******************************************************************************
445 *
446 * SPCR - Serial Port Console Redirection table
447 *
448 ******************************************************************************/
449
450struct acpi_table_spcr {
451 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
452 u8 reserved[3];
453 struct acpi_generic_address serial_port;
454 u8 interrupt_type;
455 u8 pc_interrupt;
456 u32 interrupt;
457 u8 baud_rate;
458 u8 parity;
459 u8 stop_bits;
460 u8 flow_control;
461 u8 terminal_type;
462 u8 reserved2;
463 u16 pci_device_id;
464 u16 pci_vendor_id;
465 u8 pci_bus;
466 u8 pci_device;
467 u8 pci_function;
468 u32 pci_flags;
469 u8 pci_segment;
470 u32 reserved3;
471};
472
473/*******************************************************************************
474 *
475 * SPMI - Server Platform Management Interface table
476 *
477 ******************************************************************************/
478
479struct acpi_table_spmi {
480 ACPI_TABLE_HEADER_DEF u8 reserved;
481 u8 interface_type;
482 u16 spec_revision; /* Version of IPMI */
483 u8 interrupt_type;
484 u8 gpe_number; /* GPE assigned */
485 u8 reserved2;
486 u8 pci_device_flag;
487 u32 interrupt;
488 struct acpi_generic_address ipmi_register;
489 u8 pci_segment;
490 u8 pci_bus;
491 u8 pci_device;
492 u8 pci_function;
493};
494
495/*******************************************************************************
496 *
497 * SRAT - System Resource Affinity Table
498 *
499 ******************************************************************************/
500
501struct system_resource_affinity {
502 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */
503 u64 reserved2; /* Reserved, must be zero */
504};
505
506/* SRAT common sub-table header */
507
508#define SRAT_SUBTABLE_HEADER \
509 u8 type; \
510 u8 length;
511
512/* Values for Type above */
513
514#define SRAT_CPU_AFFINITY 0
515#define SRAT_MEMORY_AFFINITY 1
516#define SRAT_RESERVED 2
517
518/* SRAT sub-tables */
519
520struct static_resource_alloc {
521 SRAT_SUBTABLE_HEADER u8 proximity_domain_lo;
522 u8 apic_id;
523
524 /* Flags (32 bits) */
525
526 u8 enabled:1; /* 00: Use affinity structure */
527 u8:7; /* 01-07: Reserved, must be zero */
528 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
529
530 u8 local_sapic_eid;
531 u8 proximity_domain_hi[3];
532 u32 reserved4; /* Reserved, must be zero */
533};
534
535struct memory_affinity {
536 SRAT_SUBTABLE_HEADER u32 proximity_domain;
537 u16 reserved3;
538 u64 base_address;
539 u64 address_length;
540 u32 reserved4;
117 541
118 /* Flags (32 bits) */ 542 /* Flags (32 bits) */
119 543
120 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ 544 u8 enabled:1; /* 00: Use affinity structure */
121 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ 545 u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
122 u8 proc_c1:1; /* 02: All processors support C1 state */ 546 u8 non_volatile:1; /* 02: Memory is non-volatile */
123 u8 plvl2_up:1; /* 03: C2 state works on MP system */ 547 u8:5; /* 03-07: Reserved, must be zero */
124 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ 548 u8 reserved5[3]; /* 08-31: Reserved, must be zero */
125 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ 549
126 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ 550 u64 reserved6; /* Reserved, must be zero */
127 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ 551};
128 u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ 552
129 u8:7; /* 09-15: Reserved, must be zero */ 553/*******************************************************************************
130 u8 reserved5[2]; /* 16-31: Reserved, must be zero */ 554 *
555 * TCPA - Trusted Computing Platform Alliance table
556 *
557 ******************************************************************************/
558
559struct acpi_table_tcpa {
560 ACPI_TABLE_HEADER_DEF u16 reserved;
561 u32 max_log_length; /* Maximum length for the event log area */
562 u64 log_address; /* Address of the event log area */
131}; 563};
132 564
565/*******************************************************************************
566 *
567 * WDRT - Watchdog Resource Table
568 *
569 ******************************************************************************/
570
571struct acpi_table_wdrt {
572 ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */
573 u8 pci_segment; /* PCI Segment number */
574 u8 pci_bus; /* PCI Bus number */
575 u8 pci_device; /* PCI Device number */
576 u8 pci_function; /* PCI Function number */
577 u32 timer_period; /* Period of one timer count (msec) */
578 u32 max_count; /* Maximum counter value supported */
579 u32 min_count; /* Minimum counter value */
580 u8 flags;
581 u8 reserved[3];
582 u32 entries; /* Number of watchdog entries that follow */
583};
584
585#if 0 /* Flags, will be converted to macros */
586u8 enabled:1; /* 00: Timer enabled */
587u8:6; /* 01-06: Reserved */
588u8 sleep_stop:1; /* 07: Timer stopped in sleep state */
589#endif
590
591/* Macros used to generate offsets to specific table fields */
592
593#define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f)
594#define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f)
595#define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f)
596#define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f)
597#define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f)
598#define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f)
599#define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f)
600#define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f)
601#define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f)
602#define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f)
603#define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f)
604#define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f)
605#define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f)
606#define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f)
607#define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f)
608#define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f)
609#define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f)
610#define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f)
611#define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f)
612#define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f)
613#define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f)
614#define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f)
615#define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f)
616#define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f)
617#define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f)
618#define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f)
619#define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f)
620#define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f)
621#define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f)
622#define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f)
623#define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f)
624#define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f)
625#define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f)
626
627#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o)
628#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o)
629#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o)
630#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o)
631#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o)
632#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o)
633#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o)
634#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o)
635#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o)
636#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o)
637
638/* Reset to default packing */
639
133#pragma pack() 640#pragma pack()
134 641
135#endif /* __ACTBL1_H__ */ 642#endif /* __ACTBL1_H__ */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index dfc7ac1094bb..67efe6cad27b 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -44,234 +44,6 @@
44#ifndef __ACTBL2_H__ 44#ifndef __ACTBL2_H__
45#define __ACTBL2_H__ 45#define __ACTBL2_H__
46 46
47/* 47/* Code moved to both actbl.h and actbl1.h */
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#pragma pack(1)
68
69/*
70 * ACPI 2.0 Root System Description Table (RSDT)
71 */
72struct rsdt_descriptor_rev2 {
73 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
74 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
75};
76
77/*
78 * ACPI 2.0 Extended System Description Table (XSDT)
79 */
80struct xsdt_descriptor_rev2 {
81 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
82 u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
83};
84
85/*
86 * ACPI 2.0 Firmware ACPI Control Structure (FACS)
87 */
88struct facs_descriptor_rev2 {
89 char signature[4]; /* ASCII table signature */
90 u32 length; /* Length of structure, in bytes */
91 u32 hardware_signature; /* Hardware configuration signature */
92 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */
93 u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */
94
95 /* Flags (32 bits) */
96
97 u8 S4bios_f:1; /* 00: S4BIOS support is present */
98 u8:7; /* 01-07: Reserved, must be zero */
99 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
100
101 u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */
102 u8 version; /* Version of this table */
103 u8 reserved3[31]; /* Reserved, must be zero */
104};
105
106/*
107 * ACPI 2.0+ Generic Address Structure (GAS)
108 */
109struct acpi_generic_address {
110 u8 address_space_id; /* Address space where struct or register exists. */
111 u8 register_bit_width; /* Size in bits of given register */
112 u8 register_bit_offset; /* Bit offset within the register */
113 u8 access_width; /* Minimum Access size (ACPI 3.0) */
114 u64 address; /* 64-bit address of struct or register */
115};
116
117#define FADT_REV2_COMMON \
118 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \
119 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \
120 u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
121 u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \
122 u16 sci_int; /* System vector of SCI interrupt */ \
123 u32 smi_cmd; /* Port address of SMI command port */ \
124 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \
125 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
126 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \
127 u8 pstate_cnt; /* Processor performance state control*/ \
128 u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \
129 u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \
130 u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
131 u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
132 u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \
133 u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
134 u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
135 u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
136 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \
137 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \
138 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \
139 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \
140 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \
141 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \
142 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \
143 u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \
144 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \
145 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \
146 u16 flush_size; /* Number of flush strides that need to be read */ \
147 u16 flush_stride; /* Processor's memory cache line width, in bytes */ \
148 u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
149 u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \
150 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
151 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
152 u8 century; /* Index to century in RTC CMOS RAM */ \
153 u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
154
155/*
156 * ACPI 2.0+ Fixed ACPI Description Table (FADT)
157 */
158struct fadt_descriptor_rev2 {
159 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
160 FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
161
162 /* Flags (32 bits) */
163
164 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
165 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
166 u8 proc_c1:1; /* 02: All processors support C1 state */
167 u8 plvl2_up:1; /* 03: C2 state works on MP system */
168 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
169 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
170 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
171 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
172 u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
173 u8 dock_cap:1; /* 09: Docking supported */
174 u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
175 u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
176 u8 headless:1; /* 12: No local video capabilities or local input devices */
177 u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
178
179 u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
180 u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
181 u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
182 u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
183 u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
184 u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */
185 u8:4; /* 20-23: Reserved, must be zero */
186 u8 reserved3; /* 24-31: Reserved, must be zero */
187
188 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
189 u8 reset_value; /* Value to write to the reset_register port to reset the system */
190 u8 reserved4[3]; /* These three bytes must be zero */
191 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
192 u64 Xdsdt; /* 64-bit physical address of DSDT */
193 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
194 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */
195 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
196 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
197 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
198 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
199 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */
200 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */
201};
202
203/* "Down-revved" ACPI 2.0 FADT descriptor */
204
205struct fadt_descriptor_rev2_minus {
206 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
207 FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
208 u32 flags;
209 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
210 u8 reset_value; /* Value to write to the reset_register port to reset the system. */
211 u8 reserved7[3]; /* Reserved, must be zero */
212};
213
214/* ECDT - Embedded Controller Boot Resources Table */
215
216struct ec_boot_resources {
217 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */
218 struct acpi_generic_address ec_data; /* Address of EC data register */
219 u32 uid; /* Unique ID - must be same as the EC _UID method */
220 u8 gpe_bit; /* The GPE for the EC */
221 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
222};
223
224/* SRAT - System Resource Affinity Table */
225
226struct static_resource_alloc {
227 u8 type;
228 u8 length;
229 u8 proximity_domain_lo;
230 u8 apic_id;
231
232 /* Flags (32 bits) */
233
234 u8 enabled:1; /* 00: Use affinity structure */
235 u8:7; /* 01-07: Reserved, must be zero */
236 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
237
238 u8 local_sapic_eid;
239 u8 proximity_domain_hi[3];
240 u32 reserved4; /* Reserved, must be zero */
241};
242
243struct memory_affinity {
244 u8 type;
245 u8 length;
246 u32 proximity_domain;
247 u16 reserved3;
248 u64 base_address;
249 u64 address_length;
250 u32 reserved4;
251
252 /* Flags (32 bits) */
253
254 u8 enabled:1; /* 00: Use affinity structure */
255 u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
256 u8 non_volatile:1; /* 02: Memory is non-volatile */
257 u8:5; /* 03-07: Reserved, must be zero */
258 u8 reserved5[3]; /* 08-31: Reserved, must be zero */
259
260 u64 reserved6; /* Reserved, must be zero */
261};
262
263struct system_resource_affinity {
264 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */
265 u64 reserved2; /* Reserved, must be zero */
266};
267
268/* SLIT - System Locality Distance Information Table */
269
270struct system_locality_info {
271 ACPI_TABLE_HEADER_DEF u64 locality_count;
272 u8 entry[1][1];
273};
274
275#pragma pack()
276 48
277#endif /* __ACTBL2_H__ */ 49#endif /* __ACTBL2_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 7ca89cde706e..77cf1236b05a 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -44,6 +44,8 @@
44#ifndef __ACTYPES_H__ 44#ifndef __ACTYPES_H__
45#define __ACTYPES_H__ 45#define __ACTYPES_H__
46 46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
47/* 49/*
48 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header 50 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
49 * and must be either 16, 32, or 64 51 * and must be either 16, 32, or 64
@@ -154,7 +156,6 @@ typedef u64 acpi_physical_address;
154#define ACPI_MAX_PTR ACPI_UINT64_MAX 156#define ACPI_MAX_PTR ACPI_UINT64_MAX
155#define ACPI_SIZE_MAX ACPI_UINT64_MAX 157#define ACPI_SIZE_MAX ACPI_UINT64_MAX
156 158
157#define ALIGNED_ADDRESS_BOUNDARY 0x00000008
158#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ 159#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */
159 160
160/* 161/*
@@ -195,8 +196,6 @@ typedef u64 acpi_physical_address;
195#define ACPI_MAX_PTR ACPI_UINT32_MAX 196#define ACPI_MAX_PTR ACPI_UINT32_MAX
196#define ACPI_SIZE_MAX ACPI_UINT32_MAX 197#define ACPI_SIZE_MAX ACPI_UINT32_MAX
197 198
198#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
199
200/******************************************************************************* 199/*******************************************************************************
201 * 200 *
202 * Types specific to 16-bit targets 201 * Types specific to 16-bit targets
@@ -223,7 +222,6 @@ typedef char *acpi_physical_address;
223#define ACPI_MAX_PTR ACPI_UINT16_MAX 222#define ACPI_MAX_PTR ACPI_UINT16_MAX
224#define ACPI_SIZE_MAX ACPI_UINT16_MAX 223#define ACPI_SIZE_MAX ACPI_UINT16_MAX
225 224
226#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
227#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ 225#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
228 226
229/* 64-bit integers cannot be supported */ 227/* 64-bit integers cannot be supported */
@@ -254,7 +252,7 @@ typedef acpi_native_uint acpi_size;
254/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 252/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
255 253
256#ifndef acpi_uintptr_t 254#ifndef acpi_uintptr_t
257#define acpi_uintptr_t void * 255#define acpi_uintptr_t void *
258#endif 256#endif
259 257
260/* 258/*
@@ -263,7 +261,7 @@ typedef acpi_native_uint acpi_size;
263 * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) 261 * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
264 */ 262 */
265#ifndef acpi_cache_t 263#ifndef acpi_cache_t
266#define acpi_cache_t struct acpi_memory_list 264#define acpi_cache_t struct acpi_memory_list
267#endif 265#endif
268 266
269/* 267/*
@@ -271,7 +269,7 @@ typedef acpi_native_uint acpi_size;
271 * lock and unlock OSL interfaces. 269 * lock and unlock OSL interfaces.
272 */ 270 */
273#ifndef acpi_cpu_flags 271#ifndef acpi_cpu_flags
274#define acpi_cpu_flags acpi_native_uint 272#define acpi_cpu_flags acpi_native_uint
275#endif 273#endif
276 274
277/* 275/*
@@ -292,6 +290,21 @@ typedef acpi_native_uint acpi_size;
292#define ACPI_UNUSED_VAR 290#define ACPI_UNUSED_VAR
293#endif 291#endif
294 292
293/*
294 * All ACPICA functions that are available to the rest of the kernel are
295 * tagged with this macro which can be defined as appropriate for the host.
296 */
297#ifndef ACPI_EXPORT_SYMBOL
298#define ACPI_EXPORT_SYMBOL(symbol)
299#endif
300
301/*
302 * thread_id is returned by acpi_os_get_thread_id.
303 */
304#ifndef acpi_thread_id
305#define acpi_thread_id acpi_native_uint
306#endif
307
295/******************************************************************************* 308/*******************************************************************************
296 * 309 *
297 * Independent types 310 * Independent types
@@ -477,15 +490,15 @@ typedef u64 acpi_integer;
477 */ 490 */
478typedef u32 acpi_table_type; 491typedef u32 acpi_table_type;
479 492
480#define ACPI_TABLE_RSDP (acpi_table_type) 0 493#define ACPI_TABLE_ID_RSDP (acpi_table_type) 0
481#define ACPI_TABLE_DSDT (acpi_table_type) 1 494#define ACPI_TABLE_ID_DSDT (acpi_table_type) 1
482#define ACPI_TABLE_FADT (acpi_table_type) 2 495#define ACPI_TABLE_ID_FADT (acpi_table_type) 2
483#define ACPI_TABLE_FACS (acpi_table_type) 3 496#define ACPI_TABLE_ID_FACS (acpi_table_type) 3
484#define ACPI_TABLE_PSDT (acpi_table_type) 4 497#define ACPI_TABLE_ID_PSDT (acpi_table_type) 4
485#define ACPI_TABLE_SSDT (acpi_table_type) 5 498#define ACPI_TABLE_ID_SSDT (acpi_table_type) 5
486#define ACPI_TABLE_XSDT (acpi_table_type) 6 499#define ACPI_TABLE_ID_XSDT (acpi_table_type) 6
487#define ACPI_TABLE_MAX 6 500#define ACPI_TABLE_ID_MAX 6
488#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1) 501#define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1)
489 502
490/* 503/*
491 * Types associated with ACPI names and objects. The first group of 504 * Types associated with ACPI names and objects. The first group of
@@ -816,7 +829,7 @@ struct acpi_system_info {
816 u32 debug_level; 829 u32 debug_level;
817 u32 debug_layer; 830 u32 debug_layer;
818 u32 num_table_types; 831 u32 num_table_types;
819 struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; 832 struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1];
820}; 833};
821 834
822/* 835/*
@@ -858,7 +871,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function,
858 void *handler_context, 871 void *handler_context,
859 void *region_context); 872 void *region_context);
860 873
861#define ACPI_DEFAULT_HANDLER NULL 874#define ACPI_DEFAULT_HANDLER NULL
862 875
863typedef 876typedef
864acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, 877acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
@@ -911,12 +924,13 @@ struct acpi_compatible_id_list {
911#define ACPI_STA_DEVICE_PRESENT 0x01 924#define ACPI_STA_DEVICE_PRESENT 0x01
912#define ACPI_STA_DEVICE_ENABLED 0x02 925#define ACPI_STA_DEVICE_ENABLED 0x02
913#define ACPI_STA_DEVICE_UI 0x04 926#define ACPI_STA_DEVICE_UI 0x04
914#define ACPI_STA_DEVICE_OK 0x08 927#define ACPI_STA_DEVICE_FUNCTIONING 0x08
928#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
915#define ACPI_STA_BATTERY_PRESENT 0x10 929#define ACPI_STA_BATTERY_PRESENT 0x10
916 930
917#define ACPI_COMMON_OBJ_INFO \ 931#define ACPI_COMMON_OBJ_INFO \
918 acpi_object_type type; /* ACPI object type */ \ 932 acpi_object_type type; /* ACPI object type */ \
919 acpi_name name /* ACPI object Name */ 933 acpi_name name /* ACPI object Name */
920 934
921struct acpi_obj_info_header { 935struct acpi_obj_info_header {
922 ACPI_COMMON_OBJ_INFO; 936 ACPI_COMMON_OBJ_INFO;
@@ -957,7 +971,7 @@ struct acpi_mem_space_context {
957 * Definitions for Resource Attributes 971 * Definitions for Resource Attributes
958 */ 972 */
959typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ 973typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
960typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ 974typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
961 975
962/* 976/*
963 * Memory Attributes 977 * Memory Attributes
@@ -972,8 +986,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6
972 986
973/* 987/*
974 * IO Attributes 988 * IO Attributes
975 * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. 989 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
976 * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. 990 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
977 */ 991 */
978#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 992#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
979#define ACPI_ISA_ONLY_RANGES (u8) 0x02 993#define ACPI_ISA_ONLY_RANGES (u8) 0x02
@@ -1171,12 +1185,12 @@ struct acpi_resource_source {
1171/* Fields common to all address descriptors, 16/32/64 bit */ 1185/* Fields common to all address descriptors, 16/32/64 bit */
1172 1186
1173#define ACPI_RESOURCE_ADDRESS_COMMON \ 1187#define ACPI_RESOURCE_ADDRESS_COMMON \
1174 u8 resource_type; \ 1188 u8 resource_type; \
1175 u8 producer_consumer; \ 1189 u8 producer_consumer; \
1176 u8 decode; \ 1190 u8 decode; \
1177 u8 min_address_fixed; \ 1191 u8 min_address_fixed; \
1178 u8 max_address_fixed; \ 1192 u8 max_address_fixed; \
1179 union acpi_resource_attribute info; 1193 union acpi_resource_attribute info;
1180 1194
1181struct acpi_resource_address { 1195struct acpi_resource_address {
1182ACPI_RESOURCE_ADDRESS_COMMON}; 1196ACPI_RESOURCE_ADDRESS_COMMON};
@@ -1297,16 +1311,6 @@ struct acpi_resource {
1297 1311
1298#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) 1312#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
1299 1313
1300#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
1301#define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
1302#else
1303#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
1304#endif
1305
1306/*
1307 * END: of definitions for Resource Attributes
1308 */
1309
1310struct acpi_pci_routing_table { 1314struct acpi_pci_routing_table {
1311 u32 length; 1315 u32 length;
1312 u32 pin; 1316 u32 pin;
@@ -1315,8 +1319,4 @@ struct acpi_pci_routing_table {
1315 char source[4]; /* pad to 64 bits so sizeof() works in all cases */ 1319 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
1316}; 1320};
1317 1321
1318/*
1319 * END: of definitions for PCI Routing tables
1320 */
1321
1322#endif /* __ACTYPES_H__ */ 1322#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 0927765df6aa..ba039ea1a057 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -50,24 +50,24 @@ extern const u8 acpi_gbl_resource_aml_sizes[];
50 50
51#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) 51#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
52 52
53extern const char *acpi_gbl_BMdecode[2]; 53extern const char *acpi_gbl_bm_decode[];
54extern const char *acpi_gbl_config_decode[4]; 54extern const char *acpi_gbl_config_decode[];
55extern const char *acpi_gbl_consume_decode[2]; 55extern const char *acpi_gbl_consume_decode[];
56extern const char *acpi_gbl_DECdecode[2]; 56extern const char *acpi_gbl_dec_decode[];
57extern const char *acpi_gbl_HEdecode[2]; 57extern const char *acpi_gbl_he_decode[];
58extern const char *acpi_gbl_io_decode[2]; 58extern const char *acpi_gbl_io_decode[];
59extern const char *acpi_gbl_LLdecode[2]; 59extern const char *acpi_gbl_ll_decode[];
60extern const char *acpi_gbl_max_decode[2]; 60extern const char *acpi_gbl_max_decode[];
61extern const char *acpi_gbl_MEMdecode[4]; 61extern const char *acpi_gbl_mem_decode[];
62extern const char *acpi_gbl_min_decode[2]; 62extern const char *acpi_gbl_min_decode[];
63extern const char *acpi_gbl_MTPdecode[4]; 63extern const char *acpi_gbl_mtp_decode[];
64extern const char *acpi_gbl_RNGdecode[4]; 64extern const char *acpi_gbl_rng_decode[];
65extern const char *acpi_gbl_RWdecode[2]; 65extern const char *acpi_gbl_rw_decode[];
66extern const char *acpi_gbl_SHRdecode[2]; 66extern const char *acpi_gbl_shr_decode[];
67extern const char *acpi_gbl_SIZdecode[4]; 67extern const char *acpi_gbl_siz_decode[];
68extern const char *acpi_gbl_TRSdecode[2]; 68extern const char *acpi_gbl_trs_decode[];
69extern const char *acpi_gbl_TTPdecode[2]; 69extern const char *acpi_gbl_ttp_decode[];
70extern const char *acpi_gbl_TYPdecode[4]; 70extern const char *acpi_gbl_typ_decode[];
71#endif 71#endif
72 72
73/* Types for Resource descriptor entries */ 73/* Types for Resource descriptor entries */
@@ -78,6 +78,12 @@ extern const char *acpi_gbl_TYPdecode[4];
78#define ACPI_SMALL_VARIABLE_LENGTH 3 78#define ACPI_SMALL_VARIABLE_LENGTH 3
79 79
80typedef 80typedef
81acpi_status(*acpi_walk_aml_callback) (u8 * aml,
82 u32 length,
83 u32 offset,
84 u8 resource_index, void **context);
85
86typedef
81acpi_status(*acpi_pkg_callback) (u8 object_type, 87acpi_status(*acpi_pkg_callback) (u8 object_type,
82 union acpi_operand_object * source_object, 88 union acpi_operand_object * source_object,
83 union acpi_generic_state * state, 89 union acpi_generic_state * state,
@@ -277,6 +283,8 @@ acpi_ut_ptr_exit(u32 line_number,
277 283
278void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); 284void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
279 285
286void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
287
280void acpi_ut_report_error(char *module_name, u32 line_number); 288void acpi_ut_report_error(char *module_name, u32 line_number);
281 289
282void acpi_ut_report_info(char *module_name, u32 line_number); 290void acpi_ut_report_info(char *module_name, u32 line_number);
@@ -445,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
445/* 453/*
446 * utmisc 454 * utmisc
447 */ 455 */
456u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
457
448acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); 458acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
449 459
450void acpi_ut_release_owner_id(acpi_owner_id * owner_id); 460void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
@@ -460,7 +470,9 @@ void acpi_ut_print_string(char *string, u8 max_length);
460 470
461u8 acpi_ut_valid_acpi_name(u32 name); 471u8 acpi_ut_valid_acpi_name(u32 name);
462 472
463u8 acpi_ut_valid_acpi_character(char character); 473acpi_name acpi_ut_repair_name(acpi_name name);
474
475u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position);
464 476
465acpi_status 477acpi_status
466acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); 478acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
@@ -469,6 +481,25 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
469 481
470#define ACPI_ANY_BASE 0 482#define ACPI_ANY_BASE 0
471 483
484u32 acpi_ut_dword_byte_swap(u32 value);
485
486void acpi_ut_set_integer_width(u8 revision);
487
488#ifdef ACPI_DEBUG_OUTPUT
489void
490acpi_ut_display_init_pathname(u8 type,
491 struct acpi_namespace_node *obj_handle,
492 char *path);
493#endif
494
495/*
496 * utresrc
497 */
498acpi_status
499acpi_ut_walk_aml_resources(u8 * aml,
500 acpi_size aml_length,
501 acpi_walk_aml_callback user_function, void **context);
502
472acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); 503acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
473 504
474u32 acpi_ut_get_descriptor_length(void *aml); 505u32 acpi_ut_get_descriptor_length(void *aml);
@@ -483,20 +514,6 @@ acpi_status
483acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, 514acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
484 u8 ** end_tag); 515 u8 ** end_tag);
485 516
486u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
487
488u32 acpi_ut_dword_byte_swap(u32 value);
489
490void acpi_ut_set_integer_width(u8 revision);
491
492#ifdef ACPI_DEBUG_OUTPUT
493void
494acpi_ut_display_init_pathname(u8 type,
495 struct acpi_namespace_node *obj_handle,
496 char *path);
497
498#endif
499
500/* 517/*
501 * utmutex - mutex support 518 * utmutex - mutex support
502 */ 519 */
@@ -523,14 +540,15 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
523 540
524void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); 541void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line);
525 542
526void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); 543void *acpi_ut_allocate_zeroed(acpi_size size,
544 u32 component, char *module, u32 line);
527 545
528#ifdef ACPI_DBG_TRACK_ALLOCATIONS 546#ifdef ACPI_DBG_TRACK_ALLOCATIONS
529void *acpi_ut_allocate_and_track(acpi_size size, 547void *acpi_ut_allocate_and_track(acpi_size size,
530 u32 component, char *module, u32 line); 548 u32 component, char *module, u32 line);
531 549
532void *acpi_ut_callocate_and_track(acpi_size size, 550void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
533 u32 component, char *module, u32 line); 551 u32 component, char *module, u32 line);
534 552
535void 553void
536acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); 554acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line);
@@ -540,6 +558,11 @@ void acpi_ut_dump_allocation_info(void);
540#endif /* ACPI_FUTURE_USAGE */ 558#endif /* ACPI_FUTURE_USAGE */
541 559
542void acpi_ut_dump_allocations(u32 component, char *module); 560void acpi_ut_dump_allocations(u32 component, char *module);
561
562acpi_status
563acpi_ut_create_list(char *list_name,
564 u16 object_size, struct acpi_memory_list **return_cache);
565
543#endif 566#endif
544 567
545#endif /* _ACUTILS_H */ 568#endif /* _ACUTILS_H */
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index 37964a59aef8..cf18426a87b1 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -180,8 +180,10 @@
180#define AML_BANK_FIELD_OP (u16) 0x5b87 180#define AML_BANK_FIELD_OP (u16) 0x5b87
181#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ 181#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */
182 182
183/* Bogus opcodes (they are actually two separate opcodes) */ 183/*
184 184 * Combination opcodes (actually two one-byte opcodes)
185 * Used by the disassembler and i_aSL compiler
186 */
185#define AML_LGREATEREQUAL_OP (u16) 0x9295 187#define AML_LGREATEREQUAL_OP (u16) 0x9295
186#define AML_LLESSEQUAL_OP (u16) 0x9294 188#define AML_LLESSEQUAL_OP (u16) 0x9294
187#define AML_LNOTEQUAL_OP (u16) 0x9293 189#define AML_LNOTEQUAL_OP (u16) 0x9293
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
index fb4735315ad3..be03818af9d1 100644
--- a/include/acpi/amlresrc.h
+++ b/include/acpi/amlresrc.h
@@ -42,39 +42,45 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45/* acpisrc:struct_defs -- for acpisrc conversion */
46
45#ifndef __AMLRESRC_H 47#ifndef __AMLRESRC_H
46#define __AMLRESRC_H 48#define __AMLRESRC_H
47 49
48#define ASL_RESNAME_ADDRESS "_ADR" 50/*
49#define ASL_RESNAME_ALIGNMENT "_ALN" 51 * Resource descriptor tags, as defined in the ACPI specification.
50#define ASL_RESNAME_ADDRESSSPACE "_ASI" 52 * Used to symbolically reference fields within a descriptor.
51#define ASL_RESNAME_ACCESSSIZE "_ASZ" 53 */
52#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" 54#define ACPI_RESTAG_ADDRESS "_ADR"
53#define ASL_RESNAME_BASEADDRESS "_BAS" 55#define ACPI_RESTAG_ALIGNMENT "_ALN"
54#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ 56#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
55#define ASL_RESNAME_DECODE "_DEC" 57#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
56#define ASL_RESNAME_DMA "_DMA" 58#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
57#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ 59#define ACPI_RESTAG_BASEADDRESS "_BAS"
58#define ASL_RESNAME_GRANULARITY "_GRA" 60#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
59#define ASL_RESNAME_INTERRUPT "_INT" 61#define ACPI_RESTAG_DECODE "_DEC"
60#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ 62#define ACPI_RESTAG_DMA "_DMA"
61#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ 63#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
62#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ 64#define ACPI_RESTAG_GRANULARITY "_GRA"
63#define ASL_RESNAME_LENGTH "_LEN" 65#define ACPI_RESTAG_INTERRUPT "_INT"
64#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ 66#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
65#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ 67#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
66#define ASL_RESNAME_MAXADDR "_MAX" 68#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
67#define ASL_RESNAME_MINADDR "_MIN" 69#define ACPI_RESTAG_LENGTH "_LEN"
68#define ASL_RESNAME_MAXTYPE "_MAF" 70#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
69#define ASL_RESNAME_MINTYPE "_MIF" 71#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
70#define ASL_RESNAME_REGISTERBITOFFSET "_RBO" 72#define ACPI_RESTAG_MAXADDR "_MAX"
71#define ASL_RESNAME_REGISTERBITWIDTH "_RBW" 73#define ACPI_RESTAG_MINADDR "_MIN"
72#define ASL_RESNAME_RANGETYPE "_RNG" 74#define ACPI_RESTAG_MAXTYPE "_MAF"
73#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ 75#define ACPI_RESTAG_MINTYPE "_MIF"
74#define ASL_RESNAME_TRANSLATION "_TRA" 76#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
75#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ 77#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
76#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ 78#define ACPI_RESTAG_RANGETYPE "_RNG"
77#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ 79#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
80#define ACPI_RESTAG_TRANSLATION "_TRA"
81#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
82#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
83#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */
78 84
79/* Default sizes for "small" resource descriptors */ 85/* Default sizes for "small" resource descriptors */
80 86
@@ -109,7 +115,7 @@ struct asl_resource_node {
109 * SMALL descriptors 115 * SMALL descriptors
110 */ 116 */
111#define AML_RESOURCE_SMALL_HEADER_COMMON \ 117#define AML_RESOURCE_SMALL_HEADER_COMMON \
112 u8 descriptor_type; 118 u8 descriptor_type;
113 119
114struct aml_resource_small_header { 120struct aml_resource_small_header {
115AML_RESOURCE_SMALL_HEADER_COMMON}; 121AML_RESOURCE_SMALL_HEADER_COMMON};
@@ -162,8 +168,8 @@ struct aml_resource_end_tag {
162 * LARGE descriptors 168 * LARGE descriptors
163 */ 169 */
164#define AML_RESOURCE_LARGE_HEADER_COMMON \ 170#define AML_RESOURCE_LARGE_HEADER_COMMON \
165 u8 descriptor_type;\ 171 u8 descriptor_type;\
166 u16 resource_length; 172 u16 resource_length;
167 173
168struct aml_resource_large_header { 174struct aml_resource_large_header {
169AML_RESOURCE_LARGE_HEADER_COMMON}; 175AML_RESOURCE_LARGE_HEADER_COMMON};
@@ -194,9 +200,9 @@ struct aml_resource_fixed_memory32 {
194}; 200};
195 201
196#define AML_RESOURCE_ADDRESS_COMMON \ 202#define AML_RESOURCE_ADDRESS_COMMON \
197 u8 resource_type; \ 203 u8 resource_type; \
198 u8 flags; \ 204 u8 flags; \
199 u8 specific_flags; 205 u8 specific_flags;
200 206
201struct aml_resource_address { 207struct aml_resource_address {
202AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; 208AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
@@ -266,6 +272,7 @@ struct aml_resource_generic_register {
266union aml_resource { 272union aml_resource {
267 /* Descriptor headers */ 273 /* Descriptor headers */
268 274
275 u8 descriptor_type;
269 struct aml_resource_small_header small_header; 276 struct aml_resource_small_header small_header;
270 struct aml_resource_large_header large_header; 277 struct aml_resource_large_header large_header;
271 278
@@ -296,9 +303,9 @@ union aml_resource {
296 /* Utility overlays */ 303 /* Utility overlays */
297 304
298 struct aml_resource_address address; 305 struct aml_resource_address address;
299 u32 u32_item; 306 u32 dword_item;
300 u16 u16_item; 307 u16 word_item;
301 u8 U8item; 308 u8 byte_item;
302}; 309};
303 310
304#endif 311#endif
diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h
index 3fa81d55cd0c..c5472be6f3a2 100644
--- a/include/acpi/pdc_intel.h
+++ b/include/acpi/pdc_intel.h
@@ -18,6 +18,11 @@
18 ACPI_PDC_C_C1_HALT | \ 18 ACPI_PDC_C_C1_HALT | \
19 ACPI_PDC_P_FFH) 19 ACPI_PDC_P_FFH)
20 20
21#define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \
22 ACPI_PDC_C_C1_HALT | \
23 ACPI_PDC_SMP_P_SWCOORD | \
24 ACPI_PDC_P_FFH)
25
21#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ 26#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
22 ACPI_PDC_SMP_C1PT | \ 27 ACPI_PDC_SMP_C1PT | \
23 ACPI_PDC_C_C1_HALT) 28 ACPI_PDC_C_C1_HALT)
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 223ec6467108..453a469fd397 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -49,33 +49,41 @@
49 */ 49 */
50 50
51#ifdef ACPI_LIBRARY 51#ifdef ACPI_LIBRARY
52/*
53 * Note: The non-debug version of the acpi_library does not contain any
54 * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG
55 */
52#define ACPI_USE_LOCAL_CACHE 56#define ACPI_USE_LOCAL_CACHE
53#endif 57#endif
54 58
55#ifdef ACPI_DUMP_APP 59#ifdef ACPI_ASL_COMPILER
56#ifndef MSDOS
57#define ACPI_DEBUG_OUTPUT 60#define ACPI_DEBUG_OUTPUT
58#endif
59#define ACPI_APPLICATION 61#define ACPI_APPLICATION
60#define ACPI_DISASSEMBLER 62#define ACPI_DISASSEMBLER
61#define ACPI_NO_METHOD_EXECUTION 63#define ACPI_CONSTANT_EVAL_ONLY
64#define ACPI_LARGE_NAMESPACE_NODE
65#define ACPI_DATA_TABLE_DISASSEMBLY
62#endif 66#endif
63 67
64#ifdef ACPI_EXEC_APP 68#ifdef ACPI_EXEC_APP
65#undef DEBUGGER_THREADING 69#undef DEBUGGER_THREADING
66#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED 70#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
67#define ACPI_DEBUG_OUTPUT 71#define ACPI_FULL_DEBUG
68#define ACPI_APPLICATION 72#define ACPI_APPLICATION
69#define ACPI_DEBUGGER 73#define ACPI_DEBUGGER
70#define ACPI_DISASSEMBLER
71#define ACPI_MUTEX_DEBUG 74#define ACPI_MUTEX_DEBUG
75#define ACPI_DBG_TRACK_ALLOCATIONS
72#endif 76#endif
73 77
74#ifdef ACPI_ASL_COMPILER 78#ifdef ACPI_DASM_APP
79#ifndef MSDOS
75#define ACPI_DEBUG_OUTPUT 80#define ACPI_DEBUG_OUTPUT
81#endif
76#define ACPI_APPLICATION 82#define ACPI_APPLICATION
77#define ACPI_DISASSEMBLER 83#define ACPI_DISASSEMBLER
78#define ACPI_CONSTANT_EVAL_ONLY 84#define ACPI_NO_METHOD_EXECUTION
85#define ACPI_LARGE_NAMESPACE_NODE
86#define ACPI_DATA_TABLE_DISASSEMBLY
79#endif 87#endif
80 88
81#ifdef ACPI_APPLICATION 89#ifdef ACPI_APPLICATION
@@ -83,6 +91,12 @@
83#define ACPI_USE_LOCAL_CACHE 91#define ACPI_USE_LOCAL_CACHE
84#endif 92#endif
85 93
94#ifdef ACPI_FULL_DEBUG
95#define ACPI_DEBUGGER
96#define ACPI_DEBUG_OUTPUT
97#define ACPI_DISASSEMBLER
98#endif
99
86/* 100/*
87 * Environment configuration. The purpose of this file is to interface to the 101 * Environment configuration. The purpose of this file is to interface to the
88 * local generation environment. 102 * local generation environment.
@@ -137,7 +151,7 @@
137#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ 151#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
138#include "acdos16.h" 152#include "acdos16.h"
139 153
140#elif defined(__FreeBSD__) 154#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
141#include "acfreebsd.h" 155#include "acfreebsd.h"
142 156
143#elif defined(__NetBSD__) 157#elif defined(__NetBSD__)
@@ -163,17 +177,6 @@
163 177
164#endif 178#endif
165 179
166/*
167 * Memory allocation tracking. Used only if
168 * 1) This is the debug version
169 * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
170 */
171#ifdef ACPI_DEBUG_OUTPUT
172#if ACPI_MACHINE_WIDTH != 16
173#define ACPI_DBG_TRACK_ALLOCATIONS
174#endif
175#endif
176
177/*! [End] no source code translation !*/ 180/*! [End] no source code translation !*/
178 181
179/* 182/*
@@ -271,8 +274,8 @@ typedef char *va_list;
271/* 274/*
272 * Storage alignment properties 275 * Storage alignment properties
273 */ 276 */
274#define _AUPBND (sizeof (acpi_native_uint) - 1) 277#define _AUPBND (sizeof (acpi_native_int) - 1)
275#define _ADNBND (sizeof (acpi_native_uint) - 1) 278#define _ADNBND (sizeof (acpi_native_int) - 1)
276 279
277/* 280/*
278 * Variable argument list macro definitions 281 * Variable argument list macro definitions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 3c6a6205853a..277d35bced03 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -51,27 +51,22 @@
51 51
52#include <linux/string.h> 52#include <linux/string.h>
53#include <linux/kernel.h> 53#include <linux/kernel.h>
54#include <linux/module.h>
54#include <linux/ctype.h> 55#include <linux/ctype.h>
55#include <asm/system.h> 56#include <asm/system.h>
56#include <asm/atomic.h> 57#include <asm/atomic.h>
57#include <asm/div64.h> 58#include <asm/div64.h>
58#include <asm/acpi.h> 59#include <asm/acpi.h>
60#include <linux/slab.h>
59 61
60#define strtoul simple_strtoul 62/* Host-dependent types and defines */
61
62#define ACPI_MACHINE_WIDTH BITS_PER_LONG
63 63
64/* Type(s) for the OSL */ 64#define ACPI_MACHINE_WIDTH BITS_PER_LONG
65 65#define acpi_cache_t kmem_cache_t
66#ifdef ACPI_USE_LOCAL_CACHE 66#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
67#define acpi_cache_t struct acpi_memory_list 67#define strtoul simple_strtoul
68#else
69#include <linux/slab.h>
70#define acpi_cache_t kmem_cache_t
71#endif
72 68
73/* Full namespace pathname length limit - arbitrary */ 69/* Full namespace pathname length limit - arbitrary */
74
75#define ACPI_PATHNAME_MAX 256 70#define ACPI_PATHNAME_MAX 256
76 71
77#else /* !__KERNEL__ */ 72#else /* !__KERNEL__ */
@@ -103,4 +98,8 @@
103 98
104#define acpi_cpu_flags unsigned long 99#define acpi_cpu_flags unsigned long
105 100
101#define acpi_thread_id u32
102
103static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; }
104
106#endif /* __ACLINUX_H__ */ 105#endif /* __ACLINUX_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index ef7d83a41470..77371b3cdc44 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -2,6 +2,7 @@
2#define __ACPI_PROCESSOR_H 2#define __ACPI_PROCESSOR_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/cpu.h>
5 6
6#include <asm/acpi.h> 7#include <asm/acpi.h>
7 8
@@ -17,6 +18,17 @@
17 18
18#define ACPI_PDC_REVISION_ID 0x1 19#define ACPI_PDC_REVISION_ID 0x1
19 20
21#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
22#define ACPI_PSD_REV0_ENTRIES 5
23
24/*
25 * Types of coordination defined in ACPI 3.0. Same macros can be used across
26 * P, C and T states
27 */
28#define DOMAIN_COORD_TYPE_SW_ALL 0xfc
29#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
30#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
31
20/* Power Management */ 32/* Power Management */
21 33
22struct acpi_processor_cx; 34struct acpi_processor_cx;
@@ -65,6 +77,14 @@ struct acpi_processor_power {
65 77
66/* Performance Management */ 78/* Performance Management */
67 79
80struct acpi_psd_package {
81 acpi_integer num_entries;
82 acpi_integer revision;
83 acpi_integer domain;
84 acpi_integer coord_type;
85 acpi_integer num_processors;
86} __attribute__ ((packed));
87
68struct acpi_pct_register { 88struct acpi_pct_register {
69 u8 descriptor; 89 u8 descriptor;
70 u16 length; 90 u16 length;
@@ -91,7 +111,9 @@ struct acpi_processor_performance {
91 struct acpi_pct_register status_register; 111 struct acpi_pct_register status_register;
92 unsigned int state_count; 112 unsigned int state_count;
93 struct acpi_processor_px *states; 113 struct acpi_processor_px *states;
94 114 struct acpi_psd_package domain_info;
115 cpumask_t shared_cpu_map;
116 unsigned int shared_type;
95}; 117};
96 118
97/* Throttling Control */ 119/* Throttling Control */
@@ -160,6 +182,9 @@ struct acpi_processor_errata {
160 } piix4; 182 } piix4;
161}; 183};
162 184
185extern int acpi_processor_preregister_performance(
186 struct acpi_processor_performance **performance);
187
163extern int acpi_processor_register_performance(struct acpi_processor_performance 188extern int acpi_processor_register_performance(struct acpi_processor_performance
164 *performance, unsigned int cpu); 189 *performance, unsigned int cpu);
165extern void acpi_processor_unregister_performance(struct 190extern void acpi_processor_unregister_performance(struct
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h
index 5e4a35af2921..9f6995341fdc 100644
--- a/include/asm-i386/apicdef.h
+++ b/include/asm-i386/apicdef.h
@@ -121,7 +121,6 @@
121 */ 121 */
122#define u32 unsigned int 122#define u32 unsigned int
123 123
124#define lapic ((volatile struct local_apic *)APIC_BASE)
125 124
126struct local_apic { 125struct local_apic {
127 126
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index aa1c7b2e438c..2c95a319c056 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -162,6 +162,8 @@ extern int acpi_pci_disabled;
162 162
163extern u8 x86_acpiid_to_apicid[]; 163extern u8 x86_acpiid_to_apicid[];
164 164
165#define ARCH_HAS_POWER_INIT 1
166
165extern int acpi_skip_timer_override; 167extern int acpi_skip_timer_override;
166 168
167#endif /*__KERNEL__*/ 169#endif /*__KERNEL__*/
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h
index 5a48e9bcf218..1dd40067c67c 100644
--- a/include/asm-x86_64/apicdef.h
+++ b/include/asm-x86_64/apicdef.h
@@ -137,8 +137,6 @@
137 */ 137 */
138#define u32 unsigned int 138#define u32 unsigned int
139 139
140#define lapic ((volatile struct local_apic *)APIC_BASE)
141
142struct local_apic { 140struct local_apic {
143 141
144/*000*/ struct { u32 __reserved[4]; } __reserved_01; 142/*000*/ struct { u32 __reserved[4]; } __reserved_01;
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 5aa95011f7e6..466fbe9e4899 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -72,6 +72,8 @@ struct cpufreq_real_policy {
72 72
73struct cpufreq_policy { 73struct cpufreq_policy {
74 cpumask_t cpus; /* affected CPUs */ 74 cpumask_t cpus; /* affected CPUs */
75 unsigned int shared_type; /* ANY or ALL affected CPUs
76 should set cpufreq */
75 unsigned int cpu; /* cpu nr of registered CPU */ 77 unsigned int cpu; /* cpu nr of registered CPU */
76 struct cpufreq_cpuinfo cpuinfo;/* see above */ 78 struct cpufreq_cpuinfo cpuinfo;/* see above */
77 79
@@ -98,6 +100,8 @@ struct cpufreq_policy {
98#define CPUFREQ_INCOMPATIBLE (1) 100#define CPUFREQ_INCOMPATIBLE (1)
99#define CPUFREQ_NOTIFY (2) 101#define CPUFREQ_NOTIFY (2)
100 102
103#define CPUFREQ_SHARED_TYPE_ALL (0) /* All dependent CPUs should set freq */
104#define CPUFREQ_SHARED_TYPE_ANY (1) /* Freq can be set from any dependent CPU */
101 105
102/******************** cpufreq transition notifiers *******************/ 106/******************** cpufreq transition notifiers *******************/
103 107