diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/executer | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer')
23 files changed, 3253 insertions, 3710 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index d11e9ec827f1..1ce365d651d8 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
@@ -50,18 +49,14 @@ | |||
50 | #include <acpi/actables.h> | 49 | #include <acpi/actables.h> |
51 | #include <acpi/acdispat.h> | 50 | #include <acpi/acdispat.h> |
52 | 51 | ||
53 | |||
54 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exconfig") | 53 | ACPI_MODULE_NAME("exconfig") |
56 | 54 | ||
57 | /* Local prototypes */ | 55 | /* Local prototypes */ |
58 | |||
59 | static acpi_status | 56 | static acpi_status |
60 | acpi_ex_add_table ( | 57 | acpi_ex_add_table(struct acpi_table_header *table, |
61 | struct acpi_table_header *table, | 58 | struct acpi_namespace_node *parent_node, |
62 | struct acpi_namespace_node *parent_node, | 59 | union acpi_operand_object **ddb_handle); |
63 | union acpi_operand_object **ddb_handle); | ||
64 | |||
65 | 60 | ||
66 | /******************************************************************************* | 61 | /******************************************************************************* |
67 | * | 62 | * |
@@ -79,24 +74,21 @@ acpi_ex_add_table ( | |||
79 | ******************************************************************************/ | 74 | ******************************************************************************/ |
80 | 75 | ||
81 | static acpi_status | 76 | static acpi_status |
82 | acpi_ex_add_table ( | 77 | acpi_ex_add_table(struct acpi_table_header *table, |
83 | struct acpi_table_header *table, | 78 | struct acpi_namespace_node *parent_node, |
84 | struct acpi_namespace_node *parent_node, | 79 | union acpi_operand_object **ddb_handle) |
85 | union acpi_operand_object **ddb_handle) | ||
86 | { | 80 | { |
87 | acpi_status status; | 81 | acpi_status status; |
88 | struct acpi_table_desc table_info; | 82 | struct acpi_table_desc table_info; |
89 | union acpi_operand_object *obj_desc; | 83 | union acpi_operand_object *obj_desc; |
90 | |||
91 | |||
92 | ACPI_FUNCTION_TRACE ("ex_add_table"); | ||
93 | 84 | ||
85 | ACPI_FUNCTION_TRACE("ex_add_table"); | ||
94 | 86 | ||
95 | /* Create an object to be the table handle */ | 87 | /* Create an object to be the table handle */ |
96 | 88 | ||
97 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE); | 89 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); |
98 | if (!obj_desc) { | 90 | if (!obj_desc) { |
99 | return_ACPI_STATUS (AE_NO_MEMORY); | 91 | return_ACPI_STATUS(AE_NO_MEMORY); |
100 | } | 92 | } |
101 | 93 | ||
102 | /* Init the table handle */ | 94 | /* Init the table handle */ |
@@ -106,45 +98,43 @@ acpi_ex_add_table ( | |||
106 | 98 | ||
107 | /* Install the new table into the local data structures */ | 99 | /* Install the new table into the local data structures */ |
108 | 100 | ||
109 | ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); | 101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); |
110 | 102 | ||
111 | table_info.type = ACPI_TABLE_SSDT; | 103 | table_info.type = ACPI_TABLE_SSDT; |
112 | table_info.pointer = table; | 104 | table_info.pointer = table; |
113 | table_info.length = (acpi_size) table->length; | 105 | table_info.length = (acpi_size) table->length; |
114 | table_info.allocation = ACPI_MEM_ALLOCATED; | 106 | table_info.allocation = ACPI_MEM_ALLOCATED; |
115 | 107 | ||
116 | status = acpi_tb_install_table (&table_info); | 108 | status = acpi_tb_install_table(&table_info); |
117 | obj_desc->reference.object = table_info.installed_desc; | 109 | obj_desc->reference.object = table_info.installed_desc; |
118 | 110 | ||
119 | if (ACPI_FAILURE (status)) { | 111 | if (ACPI_FAILURE(status)) { |
120 | if (status == AE_ALREADY_EXISTS) { | 112 | if (status == AE_ALREADY_EXISTS) { |
121 | /* Table already exists, just return the handle */ | 113 | /* Table already exists, just return the handle */ |
122 | 114 | ||
123 | return_ACPI_STATUS (AE_OK); | 115 | return_ACPI_STATUS(AE_OK); |
124 | } | 116 | } |
125 | goto cleanup; | 117 | goto cleanup; |
126 | } | 118 | } |
127 | 119 | ||
128 | /* Add the table to the namespace */ | 120 | /* Add the table to the namespace */ |
129 | 121 | ||
130 | status = acpi_ns_load_table (table_info.installed_desc, parent_node); | 122 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); |
131 | if (ACPI_FAILURE (status)) { | 123 | if (ACPI_FAILURE(status)) { |
132 | /* Uninstall table on error */ | 124 | /* Uninstall table on error */ |
133 | 125 | ||
134 | (void) acpi_tb_uninstall_table (table_info.installed_desc); | 126 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
135 | goto cleanup; | 127 | goto cleanup; |
136 | } | 128 | } |
137 | 129 | ||
138 | return_ACPI_STATUS (AE_OK); | 130 | return_ACPI_STATUS(AE_OK); |
139 | |||
140 | 131 | ||
141 | cleanup: | 132 | cleanup: |
142 | acpi_ut_remove_reference (obj_desc); | 133 | acpi_ut_remove_reference(obj_desc); |
143 | *ddb_handle = NULL; | 134 | *ddb_handle = NULL; |
144 | return_ACPI_STATUS (status); | 135 | return_ACPI_STATUS(status); |
145 | } | 136 | } |
146 | 137 | ||
147 | |||
148 | /******************************************************************************* | 138 | /******************************************************************************* |
149 | * | 139 | * |
150 | * FUNCTION: acpi_ex_load_table_op | 140 | * FUNCTION: acpi_ex_load_table_op |
@@ -159,56 +149,53 @@ cleanup: | |||
159 | ******************************************************************************/ | 149 | ******************************************************************************/ |
160 | 150 | ||
161 | acpi_status | 151 | acpi_status |
162 | acpi_ex_load_table_op ( | 152 | acpi_ex_load_table_op(struct acpi_walk_state *walk_state, |
163 | struct acpi_walk_state *walk_state, | 153 | union acpi_operand_object **return_desc) |
164 | union acpi_operand_object **return_desc) | ||
165 | { | 154 | { |
166 | acpi_status status; | 155 | acpi_status status; |
167 | union acpi_operand_object **operand = &walk_state->operands[0]; | 156 | union acpi_operand_object **operand = &walk_state->operands[0]; |
168 | struct acpi_table_header *table; | 157 | struct acpi_table_header *table; |
169 | struct acpi_namespace_node *parent_node; | 158 | struct acpi_namespace_node *parent_node; |
170 | struct acpi_namespace_node *start_node; | 159 | struct acpi_namespace_node *start_node; |
171 | struct acpi_namespace_node *parameter_node = NULL; | 160 | struct acpi_namespace_node *parameter_node = NULL; |
172 | union acpi_operand_object *ddb_handle; | 161 | union acpi_operand_object *ddb_handle; |
173 | |||
174 | |||
175 | ACPI_FUNCTION_TRACE ("ex_load_table_op"); | ||
176 | 162 | ||
163 | ACPI_FUNCTION_TRACE("ex_load_table_op"); | ||
177 | 164 | ||
178 | #if 0 | 165 | #if 0 |
179 | /* | 166 | /* |
180 | * Make sure that the signature does not match one of the tables that | 167 | * Make sure that the signature does not match one of the tables that |
181 | * is already loaded. | 168 | * is already loaded. |
182 | */ | 169 | */ |
183 | status = acpi_tb_match_signature (operand[0]->string.pointer, NULL); | 170 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); |
184 | if (status == AE_OK) { | 171 | if (status == AE_OK) { |
185 | /* Signature matched -- don't allow override */ | 172 | /* Signature matched -- don't allow override */ |
186 | 173 | ||
187 | return_ACPI_STATUS (AE_ALREADY_EXISTS); | 174 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
188 | } | 175 | } |
189 | #endif | 176 | #endif |
190 | 177 | ||
191 | /* Find the ACPI table */ | 178 | /* Find the ACPI table */ |
192 | 179 | ||
193 | status = acpi_tb_find_table (operand[0]->string.pointer, | 180 | status = acpi_tb_find_table(operand[0]->string.pointer, |
194 | operand[1]->string.pointer, | 181 | operand[1]->string.pointer, |
195 | operand[2]->string.pointer, &table); | 182 | operand[2]->string.pointer, &table); |
196 | if (ACPI_FAILURE (status)) { | 183 | if (ACPI_FAILURE(status)) { |
197 | if (status != AE_NOT_FOUND) { | 184 | if (status != AE_NOT_FOUND) { |
198 | return_ACPI_STATUS (status); | 185 | return_ACPI_STATUS(status); |
199 | } | 186 | } |
200 | 187 | ||
201 | /* Table not found, return an Integer=0 and AE_OK */ | 188 | /* Table not found, return an Integer=0 and AE_OK */ |
202 | 189 | ||
203 | ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 190 | ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
204 | if (!ddb_handle) { | 191 | if (!ddb_handle) { |
205 | return_ACPI_STATUS (AE_NO_MEMORY); | 192 | return_ACPI_STATUS(AE_NO_MEMORY); |
206 | } | 193 | } |
207 | 194 | ||
208 | ddb_handle->integer.value = 0; | 195 | ddb_handle->integer.value = 0; |
209 | *return_desc = ddb_handle; | 196 | *return_desc = ddb_handle; |
210 | 197 | ||
211 | return_ACPI_STATUS (AE_OK); | 198 | return_ACPI_STATUS(AE_OK); |
212 | } | 199 | } |
213 | 200 | ||
214 | /* Default nodes */ | 201 | /* Default nodes */ |
@@ -223,10 +210,12 @@ acpi_ex_load_table_op ( | |||
223 | * Find the node referenced by the root_path_string. This is the | 210 | * Find the node referenced by the root_path_string. This is the |
224 | * location within the namespace where the table will be loaded. | 211 | * location within the namespace where the table will be loaded. |
225 | */ | 212 | */ |
226 | status = acpi_ns_get_node_by_path (operand[3]->string.pointer, start_node, | 213 | status = |
227 | ACPI_NS_SEARCH_PARENT, &parent_node); | 214 | acpi_ns_get_node_by_path(operand[3]->string.pointer, |
228 | if (ACPI_FAILURE (status)) { | 215 | start_node, ACPI_NS_SEARCH_PARENT, |
229 | return_ACPI_STATUS (status); | 216 | &parent_node); |
217 | if (ACPI_FAILURE(status)) { | ||
218 | return_ACPI_STATUS(status); | ||
230 | } | 219 | } |
231 | } | 220 | } |
232 | 221 | ||
@@ -234,7 +223,7 @@ acpi_ex_load_table_op ( | |||
234 | 223 | ||
235 | if (operand[4]->string.length > 0) { | 224 | if (operand[4]->string.length > 0) { |
236 | if ((operand[4]->string.pointer[0] != '\\') && | 225 | if ((operand[4]->string.pointer[0] != '\\') && |
237 | (operand[4]->string.pointer[0] != '^')) { | 226 | (operand[4]->string.pointer[0] != '^')) { |
238 | /* | 227 | /* |
239 | * Path is not absolute, so it will be relative to the node | 228 | * Path is not absolute, so it will be relative to the node |
240 | * referenced by the root_path_string (or the NS root if omitted) | 229 | * referenced by the root_path_string (or the NS root if omitted) |
@@ -244,18 +233,20 @@ acpi_ex_load_table_op ( | |||
244 | 233 | ||
245 | /* Find the node referenced by the parameter_path_string */ | 234 | /* Find the node referenced by the parameter_path_string */ |
246 | 235 | ||
247 | status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, | 236 | status = |
248 | ACPI_NS_SEARCH_PARENT, ¶meter_node); | 237 | acpi_ns_get_node_by_path(operand[4]->string.pointer, |
249 | if (ACPI_FAILURE (status)) { | 238 | start_node, ACPI_NS_SEARCH_PARENT, |
250 | return_ACPI_STATUS (status); | 239 | ¶meter_node); |
240 | if (ACPI_FAILURE(status)) { | ||
241 | return_ACPI_STATUS(status); | ||
251 | } | 242 | } |
252 | } | 243 | } |
253 | 244 | ||
254 | /* Load the table into the namespace */ | 245 | /* Load the table into the namespace */ |
255 | 246 | ||
256 | status = acpi_ex_add_table (table, parent_node, &ddb_handle); | 247 | status = acpi_ex_add_table(table, parent_node, &ddb_handle); |
257 | if (ACPI_FAILURE (status)) { | 248 | if (ACPI_FAILURE(status)) { |
258 | return_ACPI_STATUS (status); | 249 | return_ACPI_STATUS(status); |
259 | } | 250 | } |
260 | 251 | ||
261 | /* Parameter Data (optional) */ | 252 | /* Parameter Data (optional) */ |
@@ -263,20 +254,20 @@ acpi_ex_load_table_op ( | |||
263 | if (parameter_node) { | 254 | if (parameter_node) { |
264 | /* Store the parameter data into the optional parameter object */ | 255 | /* Store the parameter data into the optional parameter object */ |
265 | 256 | ||
266 | status = acpi_ex_store (operand[5], | 257 | status = acpi_ex_store(operand[5], |
267 | ACPI_CAST_PTR (union acpi_operand_object, parameter_node), | 258 | ACPI_CAST_PTR(union acpi_operand_object, |
268 | walk_state); | 259 | parameter_node), |
269 | if (ACPI_FAILURE (status)) { | 260 | walk_state); |
270 | (void) acpi_ex_unload_table (ddb_handle); | 261 | if (ACPI_FAILURE(status)) { |
271 | return_ACPI_STATUS (status); | 262 | (void)acpi_ex_unload_table(ddb_handle); |
263 | return_ACPI_STATUS(status); | ||
272 | } | 264 | } |
273 | } | 265 | } |
274 | 266 | ||
275 | *return_desc = ddb_handle; | 267 | *return_desc = ddb_handle; |
276 | return_ACPI_STATUS (status); | 268 | return_ACPI_STATUS(status); |
277 | } | 269 | } |
278 | 270 | ||
279 | |||
280 | /******************************************************************************* | 271 | /******************************************************************************* |
281 | * | 272 | * |
282 | * FUNCTION: acpi_ex_load_op | 273 | * FUNCTION: acpi_ex_load_op |
@@ -293,38 +284,37 @@ acpi_ex_load_table_op ( | |||
293 | ******************************************************************************/ | 284 | ******************************************************************************/ |
294 | 285 | ||
295 | acpi_status | 286 | acpi_status |
296 | acpi_ex_load_op ( | 287 | acpi_ex_load_op(union acpi_operand_object *obj_desc, |
297 | union acpi_operand_object *obj_desc, | 288 | union acpi_operand_object *target, |
298 | union acpi_operand_object *target, | 289 | struct acpi_walk_state *walk_state) |
299 | struct acpi_walk_state *walk_state) | ||
300 | { | 290 | { |
301 | acpi_status status; | 291 | acpi_status status; |
302 | union acpi_operand_object *ddb_handle; | 292 | union acpi_operand_object *ddb_handle; |
303 | union acpi_operand_object *buffer_desc = NULL; | 293 | union acpi_operand_object *buffer_desc = NULL; |
304 | struct acpi_table_header *table_ptr = NULL; | 294 | struct acpi_table_header *table_ptr = NULL; |
305 | acpi_physical_address address; | 295 | acpi_physical_address address; |
306 | struct acpi_table_header table_header; | 296 | struct acpi_table_header table_header; |
307 | u32 i; | 297 | u32 i; |
308 | |||
309 | ACPI_FUNCTION_TRACE ("ex_load_op"); | ||
310 | 298 | ||
299 | ACPI_FUNCTION_TRACE("ex_load_op"); | ||
311 | 300 | ||
312 | /* Object can be either an op_region or a Field */ | 301 | /* Object can be either an op_region or a Field */ |
313 | 302 | ||
314 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 303 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
315 | case ACPI_TYPE_REGION: | 304 | case ACPI_TYPE_REGION: |
316 | 305 | ||
317 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", | 306 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", |
318 | obj_desc, acpi_ut_get_object_type_name (obj_desc))); | 307 | obj_desc, |
308 | acpi_ut_get_object_type_name(obj_desc))); | ||
319 | 309 | ||
320 | /* | 310 | /* |
321 | * If the Region Address and Length have not been previously evaluated, | 311 | * If the Region Address and Length have not been previously evaluated, |
322 | * evaluate them now and save the results. | 312 | * evaluate them now and save the results. |
323 | */ | 313 | */ |
324 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { | 314 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { |
325 | status = acpi_ds_get_region_arguments (obj_desc); | 315 | status = acpi_ds_get_region_arguments(obj_desc); |
326 | if (ACPI_FAILURE (status)) { | 316 | if (ACPI_FAILURE(status)) { |
327 | return_ACPI_STATUS (status); | 317 | return_ACPI_STATUS(status); |
328 | } | 318 | } |
329 | } | 319 | } |
330 | 320 | ||
@@ -336,121 +326,127 @@ acpi_ex_load_op ( | |||
336 | 326 | ||
337 | table_header.length = 0; | 327 | table_header.length = 0; |
338 | for (i = 0; i < 8; i++) { | 328 | for (i = 0; i < 8; i++) { |
339 | status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ, | 329 | status = |
340 | (acpi_physical_address) (i + address), 8, | 330 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
341 | ((u8 *) &table_header) + i); | 331 | (acpi_physical_address) |
342 | if (ACPI_FAILURE (status)) { | 332 | (i + address), 8, |
343 | return_ACPI_STATUS (status); | 333 | ((u8 *) & |
334 | table_header) + i); | ||
335 | if (ACPI_FAILURE(status)) { | ||
336 | return_ACPI_STATUS(status); | ||
344 | } | 337 | } |
345 | } | 338 | } |
346 | 339 | ||
347 | /* Sanity check the table length */ | 340 | /* Sanity check the table length */ |
348 | 341 | ||
349 | if (table_header.length < sizeof (struct acpi_table_header)) { | 342 | if (table_header.length < sizeof(struct acpi_table_header)) { |
350 | return_ACPI_STATUS (AE_BAD_HEADER); | 343 | return_ACPI_STATUS(AE_BAD_HEADER); |
351 | } | 344 | } |
352 | 345 | ||
353 | /* Allocate a buffer for the entire table */ | 346 | /* Allocate a buffer for the entire table */ |
354 | 347 | ||
355 | table_ptr = ACPI_MEM_ALLOCATE (table_header.length); | 348 | table_ptr = ACPI_MEM_ALLOCATE(table_header.length); |
356 | if (!table_ptr) { | 349 | if (!table_ptr) { |
357 | return_ACPI_STATUS (AE_NO_MEMORY); | 350 | return_ACPI_STATUS(AE_NO_MEMORY); |
358 | } | 351 | } |
359 | 352 | ||
360 | /* Get the entire table from the op region */ | 353 | /* Get the entire table from the op region */ |
361 | 354 | ||
362 | for (i = 0; i < table_header.length; i++) { | 355 | for (i = 0; i < table_header.length; i++) { |
363 | status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ, | 356 | status = |
364 | (acpi_physical_address) (i + address), 8, | 357 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
365 | ((u8 *) table_ptr + i)); | 358 | (acpi_physical_address) |
366 | if (ACPI_FAILURE (status)) { | 359 | (i + address), 8, |
360 | ((u8 *) table_ptr + | ||
361 | i)); | ||
362 | if (ACPI_FAILURE(status)) { | ||
367 | goto cleanup; | 363 | goto cleanup; |
368 | } | 364 | } |
369 | } | 365 | } |
370 | break; | 366 | break; |
371 | 367 | ||
372 | |||
373 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 368 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
374 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 369 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
375 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 370 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
376 | 371 | ||
377 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n", | 372 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Field %p %s\n", |
378 | obj_desc, acpi_ut_get_object_type_name (obj_desc))); | 373 | obj_desc, |
374 | acpi_ut_get_object_type_name(obj_desc))); | ||
379 | 375 | ||
380 | /* | 376 | /* |
381 | * The length of the field must be at least as large as the table. | 377 | * The length of the field must be at least as large as the table. |
382 | * Read the entire field and thus the entire table. Buffer is | 378 | * Read the entire field and thus the entire table. Buffer is |
383 | * allocated during the read. | 379 | * allocated during the read. |
384 | */ | 380 | */ |
385 | status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc); | 381 | status = |
386 | if (ACPI_FAILURE (status)) { | 382 | acpi_ex_read_data_from_field(walk_state, obj_desc, |
387 | return_ACPI_STATUS (status); | 383 | &buffer_desc); |
384 | if (ACPI_FAILURE(status)) { | ||
385 | return_ACPI_STATUS(status); | ||
388 | } | 386 | } |
389 | 387 | ||
390 | table_ptr = ACPI_CAST_PTR (struct acpi_table_header, | 388 | table_ptr = ACPI_CAST_PTR(struct acpi_table_header, |
391 | buffer_desc->buffer.pointer); | 389 | buffer_desc->buffer.pointer); |
392 | 390 | ||
393 | /* All done with the buffer_desc, delete it */ | 391 | /* All done with the buffer_desc, delete it */ |
394 | 392 | ||
395 | buffer_desc->buffer.pointer = NULL; | 393 | buffer_desc->buffer.pointer = NULL; |
396 | acpi_ut_remove_reference (buffer_desc); | 394 | acpi_ut_remove_reference(buffer_desc); |
397 | 395 | ||
398 | /* Sanity check the table length */ | 396 | /* Sanity check the table length */ |
399 | 397 | ||
400 | if (table_ptr->length < sizeof (struct acpi_table_header)) { | 398 | if (table_ptr->length < sizeof(struct acpi_table_header)) { |
401 | status = AE_BAD_HEADER; | 399 | status = AE_BAD_HEADER; |
402 | goto cleanup; | 400 | goto cleanup; |
403 | } | 401 | } |
404 | break; | 402 | break; |
405 | 403 | ||
406 | |||
407 | default: | 404 | default: |
408 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 405 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
409 | } | 406 | } |
410 | 407 | ||
411 | /* The table must be either an SSDT or a PSDT */ | 408 | /* The table must be either an SSDT or a PSDT */ |
412 | 409 | ||
413 | if ((!ACPI_STRNCMP (table_ptr->signature, | 410 | if ((!ACPI_STRNCMP(table_ptr->signature, |
414 | acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, | 411 | acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, |
415 | acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && | 412 | acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && |
416 | (!ACPI_STRNCMP (table_ptr->signature, | 413 | (!ACPI_STRNCMP(table_ptr->signature, |
417 | acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, | 414 | acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, |
418 | acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { | 415 | acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { |
419 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 416 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
420 | "Table has invalid signature [%4.4s], must be SSDT or PSDT\n", | 417 | "Table has invalid signature [%4.4s], must be SSDT or PSDT\n", |
421 | table_ptr->signature)); | 418 | table_ptr->signature)); |
422 | status = AE_BAD_SIGNATURE; | 419 | status = AE_BAD_SIGNATURE; |
423 | goto cleanup; | 420 | goto cleanup; |
424 | } | 421 | } |
425 | 422 | ||
426 | /* Install the new table into the local data structures */ | 423 | /* Install the new table into the local data structures */ |
427 | 424 | ||
428 | status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle); | 425 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); |
429 | if (ACPI_FAILURE (status)) { | 426 | if (ACPI_FAILURE(status)) { |
430 | /* On error, table_ptr was deallocated above */ | 427 | /* On error, table_ptr was deallocated above */ |
431 | 428 | ||
432 | return_ACPI_STATUS (status); | 429 | return_ACPI_STATUS(status); |
433 | } | 430 | } |
434 | 431 | ||
435 | /* Store the ddb_handle into the Target operand */ | 432 | /* Store the ddb_handle into the Target operand */ |
436 | 433 | ||
437 | status = acpi_ex_store (ddb_handle, target, walk_state); | 434 | status = acpi_ex_store(ddb_handle, target, walk_state); |
438 | if (ACPI_FAILURE (status)) { | 435 | if (ACPI_FAILURE(status)) { |
439 | (void) acpi_ex_unload_table (ddb_handle); | 436 | (void)acpi_ex_unload_table(ddb_handle); |
440 | 437 | ||
441 | /* table_ptr was deallocated above */ | 438 | /* table_ptr was deallocated above */ |
442 | 439 | ||
443 | return_ACPI_STATUS (status); | 440 | return_ACPI_STATUS(status); |
444 | } | 441 | } |
445 | 442 | ||
446 | cleanup: | 443 | cleanup: |
447 | if (ACPI_FAILURE (status)) { | 444 | if (ACPI_FAILURE(status)) { |
448 | ACPI_MEM_FREE (table_ptr); | 445 | ACPI_MEM_FREE(table_ptr); |
449 | } | 446 | } |
450 | return_ACPI_STATUS (status); | 447 | return_ACPI_STATUS(status); |
451 | } | 448 | } |
452 | 449 | ||
453 | |||
454 | /******************************************************************************* | 450 | /******************************************************************************* |
455 | * | 451 | * |
456 | * FUNCTION: acpi_ex_unload_table | 452 | * FUNCTION: acpi_ex_unload_table |
@@ -463,17 +459,13 @@ cleanup: | |||
463 | * | 459 | * |
464 | ******************************************************************************/ | 460 | ******************************************************************************/ |
465 | 461 | ||
466 | acpi_status | 462 | acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) |
467 | acpi_ex_unload_table ( | ||
468 | union acpi_operand_object *ddb_handle) | ||
469 | { | 463 | { |
470 | acpi_status status = AE_OK; | 464 | acpi_status status = AE_OK; |
471 | union acpi_operand_object *table_desc = ddb_handle; | 465 | union acpi_operand_object *table_desc = ddb_handle; |
472 | struct acpi_table_desc *table_info; | 466 | struct acpi_table_desc *table_info; |
473 | |||
474 | |||
475 | ACPI_FUNCTION_TRACE ("ex_unload_table"); | ||
476 | 467 | ||
468 | ACPI_FUNCTION_TRACE("ex_unload_table"); | ||
477 | 469 | ||
478 | /* | 470 | /* |
479 | * Validate the handle | 471 | * Validate the handle |
@@ -482,29 +474,28 @@ acpi_ex_unload_table ( | |||
482 | * validated here. | 474 | * validated here. |
483 | */ | 475 | */ |
484 | if ((!ddb_handle) || | 476 | if ((!ddb_handle) || |
485 | (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) || | 477 | (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) || |
486 | (ACPI_GET_OBJECT_TYPE (ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) { | 478 | (ACPI_GET_OBJECT_TYPE(ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) { |
487 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 479 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
488 | } | 480 | } |
489 | 481 | ||
490 | /* Get the actual table descriptor from the ddb_handle */ | 482 | /* Get the actual table descriptor from the ddb_handle */ |
491 | 483 | ||
492 | table_info = (struct acpi_table_desc *) table_desc->reference.object; | 484 | table_info = (struct acpi_table_desc *)table_desc->reference.object; |
493 | 485 | ||
494 | /* | 486 | /* |
495 | * Delete the entire namespace under this table Node | 487 | * Delete the entire namespace under this table Node |
496 | * (Offset contains the table_id) | 488 | * (Offset contains the table_id) |
497 | */ | 489 | */ |
498 | acpi_ns_delete_namespace_by_owner (table_info->owner_id); | 490 | acpi_ns_delete_namespace_by_owner(table_info->owner_id); |
499 | acpi_ut_release_owner_id (&table_info->owner_id); | 491 | acpi_ut_release_owner_id(&table_info->owner_id); |
500 | 492 | ||
501 | /* Delete the table itself */ | 493 | /* Delete the table itself */ |
502 | 494 | ||
503 | (void) acpi_tb_uninstall_table (table_info->installed_desc); | 495 | (void)acpi_tb_uninstall_table(table_info->installed_desc); |
504 | 496 | ||
505 | /* Delete the table descriptor (ddb_handle) */ | 497 | /* Delete the table descriptor (ddb_handle) */ |
506 | 498 | ||
507 | acpi_ut_remove_reference (table_desc); | 499 | acpi_ut_remove_reference(table_desc); |
508 | return_ACPI_STATUS (status); | 500 | return_ACPI_STATUS(status); |
509 | } | 501 | } |
510 | |||
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 21331625e66e..04e5194989a6 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -41,24 +41,17 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exconvrt") | 49 | ACPI_MODULE_NAME("exconvrt") |
52 | 50 | ||
53 | /* Local prototypes */ | 51 | /* Local prototypes */ |
54 | |||
55 | static u32 | 52 | static u32 |
56 | acpi_ex_convert_to_ascii ( | 53 | acpi_ex_convert_to_ascii(acpi_integer integer, |
57 | acpi_integer integer, | 54 | u16 base, u8 * string, u8 max_length); |
58 | u16 base, | ||
59 | u8 *string, | ||
60 | u8 max_length); | ||
61 | |||
62 | 55 | ||
63 | /******************************************************************************* | 56 | /******************************************************************************* |
64 | * | 57 | * |
@@ -76,29 +69,25 @@ acpi_ex_convert_to_ascii ( | |||
76 | ******************************************************************************/ | 69 | ******************************************************************************/ |
77 | 70 | ||
78 | acpi_status | 71 | acpi_status |
79 | acpi_ex_convert_to_integer ( | 72 | acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, |
80 | union acpi_operand_object *obj_desc, | 73 | union acpi_operand_object **result_desc, u32 flags) |
81 | union acpi_operand_object **result_desc, | ||
82 | u32 flags) | ||
83 | { | 74 | { |
84 | union acpi_operand_object *return_desc; | 75 | union acpi_operand_object *return_desc; |
85 | u8 *pointer; | 76 | u8 *pointer; |
86 | acpi_integer result; | 77 | acpi_integer result; |
87 | u32 i; | 78 | u32 i; |
88 | u32 count; | 79 | u32 count; |
89 | acpi_status status; | 80 | acpi_status status; |
90 | |||
91 | 81 | ||
92 | ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_integer", obj_desc); | 82 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); |
93 | 83 | ||
94 | 84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | |
95 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | ||
96 | case ACPI_TYPE_INTEGER: | 85 | case ACPI_TYPE_INTEGER: |
97 | 86 | ||
98 | /* No conversion necessary */ | 87 | /* No conversion necessary */ |
99 | 88 | ||
100 | *result_desc = obj_desc; | 89 | *result_desc = obj_desc; |
101 | return_ACPI_STATUS (AE_OK); | 90 | return_ACPI_STATUS(AE_OK); |
102 | 91 | ||
103 | case ACPI_TYPE_BUFFER: | 92 | case ACPI_TYPE_BUFFER: |
104 | case ACPI_TYPE_STRING: | 93 | case ACPI_TYPE_STRING: |
@@ -106,11 +95,11 @@ acpi_ex_convert_to_integer ( | |||
106 | /* Note: Takes advantage of common buffer/string fields */ | 95 | /* Note: Takes advantage of common buffer/string fields */ |
107 | 96 | ||
108 | pointer = obj_desc->buffer.pointer; | 97 | pointer = obj_desc->buffer.pointer; |
109 | count = obj_desc->buffer.length; | 98 | count = obj_desc->buffer.length; |
110 | break; | 99 | break; |
111 | 100 | ||
112 | default: | 101 | default: |
113 | return_ACPI_STATUS (AE_TYPE); | 102 | return_ACPI_STATUS(AE_TYPE); |
114 | } | 103 | } |
115 | 104 | ||
116 | /* | 105 | /* |
@@ -126,7 +115,7 @@ acpi_ex_convert_to_integer ( | |||
126 | 115 | ||
127 | /* String conversion is different than Buffer conversion */ | 116 | /* String conversion is different than Buffer conversion */ |
128 | 117 | ||
129 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 118 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
130 | case ACPI_TYPE_STRING: | 119 | case ACPI_TYPE_STRING: |
131 | 120 | ||
132 | /* | 121 | /* |
@@ -135,19 +124,18 @@ acpi_ex_convert_to_integer ( | |||
135 | * of ACPI 3.0) is that the to_integer() operator allows both decimal | 124 | * of ACPI 3.0) is that the to_integer() operator allows both decimal |
136 | * and hexadecimal strings (hex prefixed with "0x"). | 125 | * and hexadecimal strings (hex prefixed with "0x"). |
137 | */ | 126 | */ |
138 | status = acpi_ut_strtoul64 ((char *) pointer, flags, &result); | 127 | status = acpi_ut_strtoul64((char *)pointer, flags, &result); |
139 | if (ACPI_FAILURE (status)) { | 128 | if (ACPI_FAILURE(status)) { |
140 | return_ACPI_STATUS (status); | 129 | return_ACPI_STATUS(status); |
141 | } | 130 | } |
142 | break; | 131 | break; |
143 | 132 | ||
144 | |||
145 | case ACPI_TYPE_BUFFER: | 133 | case ACPI_TYPE_BUFFER: |
146 | 134 | ||
147 | /* Check for zero-length buffer */ | 135 | /* Check for zero-length buffer */ |
148 | 136 | ||
149 | if (!count) { | 137 | if (!count) { |
150 | return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); | 138 | return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); |
151 | } | 139 | } |
152 | 140 | ||
153 | /* Transfer no more than an integer's worth of data */ | 141 | /* Transfer no more than an integer's worth of data */ |
@@ -170,7 +158,6 @@ acpi_ex_convert_to_integer ( | |||
170 | } | 158 | } |
171 | break; | 159 | break; |
172 | 160 | ||
173 | |||
174 | default: | 161 | default: |
175 | /* No other types can get here */ | 162 | /* No other types can get here */ |
176 | break; | 163 | break; |
@@ -178,20 +165,19 @@ acpi_ex_convert_to_integer ( | |||
178 | 165 | ||
179 | /* Create a new integer */ | 166 | /* Create a new integer */ |
180 | 167 | ||
181 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 168 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
182 | if (!return_desc) { | 169 | if (!return_desc) { |
183 | return_ACPI_STATUS (AE_NO_MEMORY); | 170 | return_ACPI_STATUS(AE_NO_MEMORY); |
184 | } | 171 | } |
185 | 172 | ||
186 | /* Save the Result */ | 173 | /* Save the Result */ |
187 | 174 | ||
188 | return_desc->integer.value = result; | 175 | return_desc->integer.value = result; |
189 | acpi_ex_truncate_for32bit_table (return_desc); | 176 | acpi_ex_truncate_for32bit_table(return_desc); |
190 | *result_desc = return_desc; | 177 | *result_desc = return_desc; |
191 | return_ACPI_STATUS (AE_OK); | 178 | return_ACPI_STATUS(AE_OK); |
192 | } | 179 | } |
193 | 180 | ||
194 | |||
195 | /******************************************************************************* | 181 | /******************************************************************************* |
196 | * | 182 | * |
197 | * FUNCTION: acpi_ex_convert_to_buffer | 183 | * FUNCTION: acpi_ex_convert_to_buffer |
@@ -207,25 +193,21 @@ acpi_ex_convert_to_integer ( | |||
207 | ******************************************************************************/ | 193 | ******************************************************************************/ |
208 | 194 | ||
209 | acpi_status | 195 | acpi_status |
210 | acpi_ex_convert_to_buffer ( | 196 | acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, |
211 | union acpi_operand_object *obj_desc, | 197 | union acpi_operand_object **result_desc) |
212 | union acpi_operand_object **result_desc) | ||
213 | { | 198 | { |
214 | union acpi_operand_object *return_desc; | 199 | union acpi_operand_object *return_desc; |
215 | u8 *new_buf; | 200 | u8 *new_buf; |
216 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); | ||
217 | 203 | ||
218 | ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_buffer", obj_desc); | 204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
219 | |||
220 | |||
221 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | ||
222 | case ACPI_TYPE_BUFFER: | 205 | case ACPI_TYPE_BUFFER: |
223 | 206 | ||
224 | /* No conversion necessary */ | 207 | /* No conversion necessary */ |
225 | 208 | ||
226 | *result_desc = obj_desc; | 209 | *result_desc = obj_desc; |
227 | return_ACPI_STATUS (AE_OK); | 210 | return_ACPI_STATUS(AE_OK); |
228 | |||
229 | 211 | ||
230 | case ACPI_TYPE_INTEGER: | 212 | case ACPI_TYPE_INTEGER: |
231 | 213 | ||
@@ -233,20 +215,20 @@ acpi_ex_convert_to_buffer ( | |||
233 | * Create a new Buffer object. | 215 | * Create a new Buffer object. |
234 | * Need enough space for one integer | 216 | * Need enough space for one integer |
235 | */ | 217 | */ |
236 | return_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width); | 218 | return_desc = |
219 | acpi_ut_create_buffer_object(acpi_gbl_integer_byte_width); | ||
237 | if (!return_desc) { | 220 | if (!return_desc) { |
238 | return_ACPI_STATUS (AE_NO_MEMORY); | 221 | return_ACPI_STATUS(AE_NO_MEMORY); |
239 | } | 222 | } |
240 | 223 | ||
241 | /* Copy the integer to the buffer, LSB first */ | 224 | /* Copy the integer to the buffer, LSB first */ |
242 | 225 | ||
243 | new_buf = return_desc->buffer.pointer; | 226 | new_buf = return_desc->buffer.pointer; |
244 | ACPI_MEMCPY (new_buf, | 227 | ACPI_MEMCPY(new_buf, |
245 | &obj_desc->integer.value, | 228 | &obj_desc->integer.value, |
246 | acpi_gbl_integer_byte_width); | 229 | acpi_gbl_integer_byte_width); |
247 | break; | 230 | break; |
248 | 231 | ||
249 | |||
250 | case ACPI_TYPE_STRING: | 232 | case ACPI_TYPE_STRING: |
251 | 233 | ||
252 | /* | 234 | /* |
@@ -258,32 +240,31 @@ acpi_ex_convert_to_buffer ( | |||
258 | * ASL/AML code that depends on the null being transferred to the new | 240 | * ASL/AML code that depends on the null being transferred to the new |
259 | * buffer. | 241 | * buffer. |
260 | */ | 242 | */ |
261 | return_desc = acpi_ut_create_buffer_object ( | 243 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
262 | (acpi_size) obj_desc->string.length + 1); | 244 | obj_desc->string. |
245 | length + 1); | ||
263 | if (!return_desc) { | 246 | if (!return_desc) { |
264 | return_ACPI_STATUS (AE_NO_MEMORY); | 247 | return_ACPI_STATUS(AE_NO_MEMORY); |
265 | } | 248 | } |
266 | 249 | ||
267 | /* Copy the string to the buffer */ | 250 | /* Copy the string to the buffer */ |
268 | 251 | ||
269 | new_buf = return_desc->buffer.pointer; | 252 | new_buf = return_desc->buffer.pointer; |
270 | ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer, | 253 | ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer, |
271 | obj_desc->string.length); | 254 | obj_desc->string.length); |
272 | break; | 255 | break; |
273 | 256 | ||
274 | |||
275 | default: | 257 | default: |
276 | return_ACPI_STATUS (AE_TYPE); | 258 | return_ACPI_STATUS(AE_TYPE); |
277 | } | 259 | } |
278 | 260 | ||
279 | /* Mark buffer initialized */ | 261 | /* Mark buffer initialized */ |
280 | 262 | ||
281 | return_desc->common.flags |= AOPOBJ_DATA_VALID; | 263 | return_desc->common.flags |= AOPOBJ_DATA_VALID; |
282 | *result_desc = return_desc; | 264 | *result_desc = return_desc; |
283 | return_ACPI_STATUS (AE_OK); | 265 | return_ACPI_STATUS(AE_OK); |
284 | } | 266 | } |
285 | 267 | ||
286 | |||
287 | /******************************************************************************* | 268 | /******************************************************************************* |
288 | * | 269 | * |
289 | * FUNCTION: acpi_ex_convert_to_ascii | 270 | * FUNCTION: acpi_ex_convert_to_ascii |
@@ -300,24 +281,19 @@ acpi_ex_convert_to_buffer ( | |||
300 | ******************************************************************************/ | 281 | ******************************************************************************/ |
301 | 282 | ||
302 | static u32 | 283 | static u32 |
303 | acpi_ex_convert_to_ascii ( | 284 | acpi_ex_convert_to_ascii(acpi_integer integer, |
304 | acpi_integer integer, | 285 | u16 base, u8 * string, u8 data_width) |
305 | u16 base, | ||
306 | u8 *string, | ||
307 | u8 data_width) | ||
308 | { | 286 | { |
309 | acpi_integer digit; | 287 | acpi_integer digit; |
310 | acpi_native_uint i; | 288 | acpi_native_uint i; |
311 | acpi_native_uint j; | 289 | acpi_native_uint j; |
312 | acpi_native_uint k = 0; | 290 | acpi_native_uint k = 0; |
313 | acpi_native_uint hex_length; | 291 | acpi_native_uint hex_length; |
314 | acpi_native_uint decimal_length; | 292 | acpi_native_uint decimal_length; |
315 | u32 remainder; | 293 | u32 remainder; |
316 | u8 supress_zeros; | 294 | u8 supress_zeros; |
317 | |||
318 | |||
319 | ACPI_FUNCTION_ENTRY (); | ||
320 | 295 | ||
296 | ACPI_FUNCTION_ENTRY(); | ||
321 | 297 | ||
322 | switch (base) { | 298 | switch (base) { |
323 | case 10: | 299 | case 10: |
@@ -339,7 +315,7 @@ acpi_ex_convert_to_ascii ( | |||
339 | break; | 315 | break; |
340 | } | 316 | } |
341 | 317 | ||
342 | supress_zeros = TRUE; /* No leading zeros */ | 318 | supress_zeros = TRUE; /* No leading zeros */ |
343 | remainder = 0; | 319 | remainder = 0; |
344 | 320 | ||
345 | for (i = decimal_length; i > 0; i--) { | 321 | for (i = decimal_length; i > 0; i--) { |
@@ -347,7 +323,8 @@ acpi_ex_convert_to_ascii ( | |||
347 | 323 | ||
348 | digit = integer; | 324 | digit = integer; |
349 | for (j = 0; j < i; j++) { | 325 | for (j = 0; j < i; j++) { |
350 | (void) acpi_ut_short_divide (digit, 10, &digit, &remainder); | 326 | (void)acpi_ut_short_divide(digit, 10, &digit, |
327 | &remainder); | ||
351 | } | 328 | } |
352 | 329 | ||
353 | /* Handle leading zeros */ | 330 | /* Handle leading zeros */ |
@@ -367,11 +344,13 @@ acpi_ex_convert_to_ascii ( | |||
367 | 344 | ||
368 | /* hex_length: 2 ascii hex chars per data byte */ | 345 | /* hex_length: 2 ascii hex chars per data byte */ |
369 | 346 | ||
370 | hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width); | 347 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); |
371 | for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { | 348 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { |
372 | /* Get one hex digit, most significant digits first */ | 349 | /* Get one hex digit, most significant digits first */ |
373 | 350 | ||
374 | string[k] = (u8) acpi_ut_hex_to_ascii_char (integer, ACPI_MUL_4 (j)); | 351 | string[k] = |
352 | (u8) acpi_ut_hex_to_ascii_char(integer, | ||
353 | ACPI_MUL_4(j)); | ||
375 | k++; | 354 | k++; |
376 | } | 355 | } |
377 | break; | 356 | break; |
@@ -387,15 +366,14 @@ acpi_ex_convert_to_ascii ( | |||
387 | * Finally, null terminate the string and return the length | 366 | * Finally, null terminate the string and return the length |
388 | */ | 367 | */ |
389 | if (!k) { | 368 | if (!k) { |
390 | string [0] = ACPI_ASCII_ZERO; | 369 | string[0] = ACPI_ASCII_ZERO; |
391 | k = 1; | 370 | k = 1; |
392 | } | 371 | } |
393 | 372 | ||
394 | string [k] = 0; | 373 | string[k] = 0; |
395 | return ((u32) k); | 374 | return ((u32) k); |
396 | } | 375 | } |
397 | 376 | ||
398 | |||
399 | /******************************************************************************* | 377 | /******************************************************************************* |
400 | * | 378 | * |
401 | * FUNCTION: acpi_ex_convert_to_string | 379 | * FUNCTION: acpi_ex_convert_to_string |
@@ -412,30 +390,25 @@ acpi_ex_convert_to_ascii ( | |||
412 | ******************************************************************************/ | 390 | ******************************************************************************/ |
413 | 391 | ||
414 | acpi_status | 392 | acpi_status |
415 | acpi_ex_convert_to_string ( | 393 | acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, |
416 | union acpi_operand_object *obj_desc, | 394 | union acpi_operand_object ** result_desc, u32 type) |
417 | union acpi_operand_object **result_desc, | ||
418 | u32 type) | ||
419 | { | 395 | { |
420 | union acpi_operand_object *return_desc; | 396 | union acpi_operand_object *return_desc; |
421 | u8 *new_buf; | 397 | u8 *new_buf; |
422 | u32 i; | 398 | u32 i; |
423 | u32 string_length = 0; | 399 | u32 string_length = 0; |
424 | u16 base = 16; | 400 | u16 base = 16; |
425 | u8 separator = ','; | 401 | u8 separator = ','; |
426 | 402 | ||
403 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); | ||
427 | 404 | ||
428 | ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc); | 405 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
429 | |||
430 | |||
431 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | ||
432 | case ACPI_TYPE_STRING: | 406 | case ACPI_TYPE_STRING: |
433 | 407 | ||
434 | /* No conversion necessary */ | 408 | /* No conversion necessary */ |
435 | 409 | ||
436 | *result_desc = obj_desc; | 410 | *result_desc = obj_desc; |
437 | return_ACPI_STATUS (AE_OK); | 411 | return_ACPI_STATUS(AE_OK); |
438 | |||
439 | 412 | ||
440 | case ACPI_TYPE_INTEGER: | 413 | case ACPI_TYPE_INTEGER: |
441 | 414 | ||
@@ -452,7 +425,7 @@ acpi_ex_convert_to_string ( | |||
452 | 425 | ||
453 | /* Two hex string characters for each integer byte */ | 426 | /* Two hex string characters for each integer byte */ |
454 | 427 | ||
455 | string_length = ACPI_MUL_2 (acpi_gbl_integer_byte_width); | 428 | string_length = ACPI_MUL_2(acpi_gbl_integer_byte_width); |
456 | break; | 429 | break; |
457 | } | 430 | } |
458 | 431 | ||
@@ -460,31 +433,33 @@ acpi_ex_convert_to_string ( | |||
460 | * Create a new String | 433 | * Create a new String |
461 | * Need enough space for one ASCII integer (plus null terminator) | 434 | * Need enough space for one ASCII integer (plus null terminator) |
462 | */ | 435 | */ |
463 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); | 436 | return_desc = |
437 | acpi_ut_create_string_object((acpi_size) string_length); | ||
464 | if (!return_desc) { | 438 | if (!return_desc) { |
465 | return_ACPI_STATUS (AE_NO_MEMORY); | 439 | return_ACPI_STATUS(AE_NO_MEMORY); |
466 | } | 440 | } |
467 | 441 | ||
468 | new_buf = return_desc->buffer.pointer; | 442 | new_buf = return_desc->buffer.pointer; |
469 | 443 | ||
470 | /* Convert integer to string */ | 444 | /* Convert integer to string */ |
471 | 445 | ||
472 | string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base, | 446 | string_length = |
473 | new_buf, acpi_gbl_integer_byte_width); | 447 | acpi_ex_convert_to_ascii(obj_desc->integer.value, base, |
448 | new_buf, | ||
449 | acpi_gbl_integer_byte_width); | ||
474 | 450 | ||
475 | /* Null terminate at the correct place */ | 451 | /* Null terminate at the correct place */ |
476 | 452 | ||
477 | return_desc->string.length = string_length; | 453 | return_desc->string.length = string_length; |
478 | new_buf [string_length] = 0; | 454 | new_buf[string_length] = 0; |
479 | break; | 455 | break; |
480 | 456 | ||
481 | |||
482 | case ACPI_TYPE_BUFFER: | 457 | case ACPI_TYPE_BUFFER: |
483 | 458 | ||
484 | /* Setup string length, base, and separator */ | 459 | /* Setup string length, base, and separator */ |
485 | 460 | ||
486 | switch (type) { | 461 | switch (type) { |
487 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ | 462 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ |
488 | /* | 463 | /* |
489 | * From ACPI: "If Data is a buffer, it is converted to a string of | 464 | * From ACPI: "If Data is a buffer, it is converted to a string of |
490 | * decimal values separated by commas." | 465 | * decimal values separated by commas." |
@@ -498,11 +473,9 @@ acpi_ex_convert_to_string ( | |||
498 | for (i = 0; i < obj_desc->buffer.length; i++) { | 473 | for (i = 0; i < obj_desc->buffer.length; i++) { |
499 | if (obj_desc->buffer.pointer[i] >= 100) { | 474 | if (obj_desc->buffer.pointer[i] >= 100) { |
500 | string_length += 4; | 475 | string_length += 4; |
501 | } | 476 | } else if (obj_desc->buffer.pointer[i] >= 10) { |
502 | else if (obj_desc->buffer.pointer[i] >= 10) { | ||
503 | string_length += 3; | 477 | string_length += 3; |
504 | } | 478 | } else { |
505 | else { | ||
506 | string_length += 2; | 479 | string_length += 2; |
507 | } | 480 | } |
508 | } | 481 | } |
@@ -518,7 +491,7 @@ acpi_ex_convert_to_string ( | |||
518 | string_length = (obj_desc->buffer.length * 3); | 491 | string_length = (obj_desc->buffer.length * 3); |
519 | break; | 492 | break; |
520 | 493 | ||
521 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ | 494 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ |
522 | /* | 495 | /* |
523 | * From ACPI: "If Data is a buffer, it is converted to a string of | 496 | * From ACPI: "If Data is a buffer, it is converted to a string of |
524 | * hexadecimal values separated by commas." | 497 | * hexadecimal values separated by commas." |
@@ -527,7 +500,7 @@ acpi_ex_convert_to_string ( | |||
527 | break; | 500 | break; |
528 | 501 | ||
529 | default: | 502 | default: |
530 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 503 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
531 | } | 504 | } |
532 | 505 | ||
533 | /* | 506 | /* |
@@ -535,15 +508,16 @@ acpi_ex_convert_to_string ( | |||
535 | * (-1 because of extra separator included in string_length from above) | 508 | * (-1 because of extra separator included in string_length from above) |
536 | */ | 509 | */ |
537 | string_length--; | 510 | string_length--; |
538 | if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ { | 511 | if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */ |
539 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); | 512 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
540 | } | 513 | } |
541 | 514 | ||
542 | /* Create a new string object and string buffer */ | 515 | /* Create a new string object and string buffer */ |
543 | 516 | ||
544 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); | 517 | return_desc = |
518 | acpi_ut_create_string_object((acpi_size) string_length); | ||
545 | if (!return_desc) { | 519 | if (!return_desc) { |
546 | return_ACPI_STATUS (AE_NO_MEMORY); | 520 | return_ACPI_STATUS(AE_NO_MEMORY); |
547 | } | 521 | } |
548 | 522 | ||
549 | new_buf = return_desc->buffer.pointer; | 523 | new_buf = return_desc->buffer.pointer; |
@@ -553,10 +527,11 @@ acpi_ex_convert_to_string ( | |||
553 | * (separated by commas or spaces) | 527 | * (separated by commas or spaces) |
554 | */ | 528 | */ |
555 | for (i = 0; i < obj_desc->buffer.length; i++) { | 529 | for (i = 0; i < obj_desc->buffer.length; i++) { |
556 | new_buf += acpi_ex_convert_to_ascii ( | 530 | new_buf += acpi_ex_convert_to_ascii((acpi_integer) |
557 | (acpi_integer) obj_desc->buffer.pointer[i], base, | 531 | obj_desc->buffer. |
558 | new_buf, 1); | 532 | pointer[i], base, |
559 | *new_buf++ = separator; /* each separated by a comma or space */ | 533 | new_buf, 1); |
534 | *new_buf++ = separator; /* each separated by a comma or space */ | ||
560 | } | 535 | } |
561 | 536 | ||
562 | /* | 537 | /* |
@@ -568,14 +543,13 @@ acpi_ex_convert_to_string ( | |||
568 | break; | 543 | break; |
569 | 544 | ||
570 | default: | 545 | default: |
571 | return_ACPI_STATUS (AE_TYPE); | 546 | return_ACPI_STATUS(AE_TYPE); |
572 | } | 547 | } |
573 | 548 | ||
574 | *result_desc = return_desc; | 549 | *result_desc = return_desc; |
575 | return_ACPI_STATUS (AE_OK); | 550 | return_ACPI_STATUS(AE_OK); |
576 | } | 551 | } |
577 | 552 | ||
578 | |||
579 | /******************************************************************************* | 553 | /******************************************************************************* |
580 | * | 554 | * |
581 | * FUNCTION: acpi_ex_convert_to_target_type | 555 | * FUNCTION: acpi_ex_convert_to_target_type |
@@ -592,17 +566,14 @@ acpi_ex_convert_to_string ( | |||
592 | ******************************************************************************/ | 566 | ******************************************************************************/ |
593 | 567 | ||
594 | acpi_status | 568 | acpi_status |
595 | acpi_ex_convert_to_target_type ( | 569 | acpi_ex_convert_to_target_type(acpi_object_type destination_type, |
596 | acpi_object_type destination_type, | 570 | union acpi_operand_object *source_desc, |
597 | union acpi_operand_object *source_desc, | 571 | union acpi_operand_object **result_desc, |
598 | union acpi_operand_object **result_desc, | 572 | struct acpi_walk_state *walk_state) |
599 | struct acpi_walk_state *walk_state) | ||
600 | { | 573 | { |
601 | acpi_status status = AE_OK; | 574 | acpi_status status = AE_OK; |
602 | |||
603 | |||
604 | ACPI_FUNCTION_TRACE ("ex_convert_to_target_type"); | ||
605 | 575 | ||
576 | ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); | ||
606 | 577 | ||
607 | /* Default behavior */ | 578 | /* Default behavior */ |
608 | 579 | ||
@@ -612,10 +583,10 @@ acpi_ex_convert_to_target_type ( | |||
612 | * If required by the target, | 583 | * If required by the target, |
613 | * perform implicit conversion on the source before we store it. | 584 | * perform implicit conversion on the source before we store it. |
614 | */ | 585 | */ |
615 | switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) { | 586 | switch (GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args)) { |
616 | case ARGI_SIMPLE_TARGET: | 587 | case ARGI_SIMPLE_TARGET: |
617 | case ARGI_FIXED_TARGET: | 588 | case ARGI_FIXED_TARGET: |
618 | case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ | 589 | case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ |
619 | 590 | ||
620 | switch (destination_type) { | 591 | switch (destination_type) { |
621 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 592 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
@@ -627,17 +598,19 @@ acpi_ex_convert_to_target_type ( | |||
627 | default: | 598 | default: |
628 | /* No conversion allowed for these types */ | 599 | /* No conversion allowed for these types */ |
629 | 600 | ||
630 | if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) { | 601 | if (destination_type != |
631 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 602 | ACPI_GET_OBJECT_TYPE(source_desc)) { |
632 | "Explicit operator, will store (%s) over existing type (%s)\n", | 603 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
633 | acpi_ut_get_object_type_name (source_desc), | 604 | "Explicit operator, will store (%s) over existing type (%s)\n", |
634 | acpi_ut_get_type_name (destination_type))); | 605 | acpi_ut_get_object_type_name |
606 | (source_desc), | ||
607 | acpi_ut_get_type_name | ||
608 | (destination_type))); | ||
635 | status = AE_TYPE; | 609 | status = AE_TYPE; |
636 | } | 610 | } |
637 | } | 611 | } |
638 | break; | 612 | break; |
639 | 613 | ||
640 | |||
641 | case ARGI_TARGETREF: | 614 | case ARGI_TARGETREF: |
642 | 615 | ||
643 | switch (destination_type) { | 616 | switch (destination_type) { |
@@ -649,55 +622,55 @@ acpi_ex_convert_to_target_type ( | |||
649 | * These types require an Integer operand. We can convert | 622 | * These types require an Integer operand. We can convert |
650 | * a Buffer or a String to an Integer if necessary. | 623 | * a Buffer or a String to an Integer if necessary. |
651 | */ | 624 | */ |
652 | status = acpi_ex_convert_to_integer (source_desc, result_desc, | 625 | status = |
653 | 16); | 626 | acpi_ex_convert_to_integer(source_desc, result_desc, |
627 | 16); | ||
654 | break; | 628 | break; |
655 | 629 | ||
656 | |||
657 | case ACPI_TYPE_STRING: | 630 | case ACPI_TYPE_STRING: |
658 | /* | 631 | /* |
659 | * The operand must be a String. We can convert an | 632 | * The operand must be a String. We can convert an |
660 | * Integer or Buffer if necessary | 633 | * Integer or Buffer if necessary |
661 | */ | 634 | */ |
662 | status = acpi_ex_convert_to_string (source_desc, result_desc, | 635 | status = |
663 | ACPI_IMPLICIT_CONVERT_HEX); | 636 | acpi_ex_convert_to_string(source_desc, result_desc, |
637 | ACPI_IMPLICIT_CONVERT_HEX); | ||
664 | break; | 638 | break; |
665 | 639 | ||
666 | |||
667 | case ACPI_TYPE_BUFFER: | 640 | case ACPI_TYPE_BUFFER: |
668 | /* | 641 | /* |
669 | * The operand must be a Buffer. We can convert an | 642 | * The operand must be a Buffer. We can convert an |
670 | * Integer or String if necessary | 643 | * Integer or String if necessary |
671 | */ | 644 | */ |
672 | status = acpi_ex_convert_to_buffer (source_desc, result_desc); | 645 | status = |
646 | acpi_ex_convert_to_buffer(source_desc, result_desc); | ||
673 | break; | 647 | break; |
674 | 648 | ||
675 | |||
676 | default: | 649 | default: |
677 | ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n", | 650 | ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type)); |
678 | destination_type)); | ||
679 | status = AE_AML_INTERNAL; | 651 | status = AE_AML_INTERNAL; |
680 | break; | 652 | break; |
681 | } | 653 | } |
682 | break; | 654 | break; |
683 | 655 | ||
684 | |||
685 | case ARGI_REFERENCE: | 656 | case ARGI_REFERENCE: |
686 | /* | 657 | /* |
687 | * create_xxxx_field cases - we are storing the field object into the name | 658 | * create_xxxx_field cases - we are storing the field object into the name |
688 | */ | 659 | */ |
689 | break; | 660 | break; |
690 | 661 | ||
691 | |||
692 | default: | 662 | default: |
693 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 663 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
694 | "Unknown Target type ID 0x%X Op %s dest_type %s\n", | 664 | "Unknown Target type ID 0x%X Op %s dest_type %s\n", |
695 | GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args), | 665 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> |
696 | walk_state->op_info->name, acpi_ut_get_type_name (destination_type))); | 666 | runtime_args), |
697 | 667 | walk_state->op_info->name, | |
698 | ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n", | 668 | acpi_ut_get_type_name(destination_type))); |
699 | GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args))) | 669 | |
700 | status = AE_AML_INTERNAL; | 670 | ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n", |
671 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> | ||
672 | runtime_args))) | ||
673 | status = AE_AML_INTERNAL; | ||
701 | } | 674 | } |
702 | 675 | ||
703 | /* | 676 | /* |
@@ -710,7 +683,5 @@ acpi_ex_convert_to_target_type ( | |||
710 | status = AE_OK; | 683 | status = AE_OK; |
711 | } | 684 | } |
712 | 685 | ||
713 | return_ACPI_STATUS (status); | 686 | return_ACPI_STATUS(status); |
714 | } | 687 | } |
715 | |||
716 | |||
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 812cdcb2e370..91c49188fb07 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
@@ -49,10 +48,8 @@ | |||
49 | #include <acpi/acevents.h> | 48 | #include <acpi/acevents.h> |
50 | #include <acpi/actables.h> | 49 | #include <acpi/actables.h> |
51 | 50 | ||
52 | |||
53 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
54 | ACPI_MODULE_NAME ("excreate") | 52 | ACPI_MODULE_NAME("excreate") |
55 | |||
56 | 53 | ||
57 | #ifndef ACPI_NO_METHOD_EXECUTION | 54 | #ifndef ACPI_NO_METHOD_EXECUTION |
58 | /******************************************************************************* | 55 | /******************************************************************************* |
@@ -66,33 +63,30 @@ | |||
66 | * DESCRIPTION: Create a new named alias | 63 | * DESCRIPTION: Create a new named alias |
67 | * | 64 | * |
68 | ******************************************************************************/ | 65 | ******************************************************************************/ |
69 | 66 | acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |
70 | acpi_status | ||
71 | acpi_ex_create_alias ( | ||
72 | struct acpi_walk_state *walk_state) | ||
73 | { | 67 | { |
74 | struct acpi_namespace_node *target_node; | 68 | struct acpi_namespace_node *target_node; |
75 | struct acpi_namespace_node *alias_node; | 69 | struct acpi_namespace_node *alias_node; |
76 | acpi_status status = AE_OK; | 70 | acpi_status status = AE_OK; |
77 | |||
78 | |||
79 | ACPI_FUNCTION_TRACE ("ex_create_alias"); | ||
80 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ex_create_alias"); | ||
81 | 73 | ||
82 | /* Get the source/alias operands (both namespace nodes) */ | 74 | /* Get the source/alias operands (both namespace nodes) */ |
83 | 75 | ||
84 | alias_node = (struct acpi_namespace_node *) walk_state->operands[0]; | 76 | alias_node = (struct acpi_namespace_node *)walk_state->operands[0]; |
85 | target_node = (struct acpi_namespace_node *) walk_state->operands[1]; | 77 | target_node = (struct acpi_namespace_node *)walk_state->operands[1]; |
86 | 78 | ||
87 | if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) || | 79 | if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) || |
88 | (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { | 80 | (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { |
89 | /* | 81 | /* |
90 | * Dereference an existing alias so that we don't create a chain | 82 | * Dereference an existing alias so that we don't create a chain |
91 | * of aliases. With this code, we guarantee that an alias is | 83 | * of aliases. With this code, we guarantee that an alias is |
92 | * always exactly one level of indirection away from the | 84 | * always exactly one level of indirection away from the |
93 | * actual aliased name. | 85 | * actual aliased name. |
94 | */ | 86 | */ |
95 | target_node = ACPI_CAST_PTR (struct acpi_namespace_node, target_node->object); | 87 | target_node = |
88 | ACPI_CAST_PTR(struct acpi_namespace_node, | ||
89 | target_node->object); | ||
96 | } | 90 | } |
97 | 91 | ||
98 | /* | 92 | /* |
@@ -115,7 +109,8 @@ acpi_ex_create_alias ( | |||
115 | * types, the object can change dynamically via a Store. | 109 | * types, the object can change dynamically via a Store. |
116 | */ | 110 | */ |
117 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; | 111 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; |
118 | alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node); | 112 | alias_node->object = |
113 | ACPI_CAST_PTR(union acpi_operand_object, target_node); | ||
119 | break; | 114 | break; |
120 | 115 | ||
121 | case ACPI_TYPE_METHOD: | 116 | case ACPI_TYPE_METHOD: |
@@ -126,7 +121,8 @@ acpi_ex_create_alias ( | |||
126 | * types, the object can change dynamically via a Store. | 121 | * types, the object can change dynamically via a Store. |
127 | */ | 122 | */ |
128 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; | 123 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; |
129 | alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node); | 124 | alias_node->object = |
125 | ACPI_CAST_PTR(union acpi_operand_object, target_node); | ||
130 | break; | 126 | break; |
131 | 127 | ||
132 | default: | 128 | default: |
@@ -139,17 +135,18 @@ acpi_ex_create_alias ( | |||
139 | * additional reference to prevent deletion out from under either the | 135 | * additional reference to prevent deletion out from under either the |
140 | * target node or the alias Node | 136 | * target node or the alias Node |
141 | */ | 137 | */ |
142 | status = acpi_ns_attach_object (alias_node, | 138 | status = acpi_ns_attach_object(alias_node, |
143 | acpi_ns_get_attached_object (target_node), target_node->type); | 139 | acpi_ns_get_attached_object |
140 | (target_node), | ||
141 | target_node->type); | ||
144 | break; | 142 | break; |
145 | } | 143 | } |
146 | 144 | ||
147 | /* Since both operands are Nodes, we don't need to delete them */ | 145 | /* Since both operands are Nodes, we don't need to delete them */ |
148 | 146 | ||
149 | return_ACPI_STATUS (status); | 147 | return_ACPI_STATUS(status); |
150 | } | 148 | } |
151 | 149 | ||
152 | |||
153 | /******************************************************************************* | 150 | /******************************************************************************* |
154 | * | 151 | * |
155 | * FUNCTION: acpi_ex_create_event | 152 | * FUNCTION: acpi_ex_create_event |
@@ -162,18 +159,14 @@ acpi_ex_create_alias ( | |||
162 | * | 159 | * |
163 | ******************************************************************************/ | 160 | ******************************************************************************/ |
164 | 161 | ||
165 | acpi_status | 162 | acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) |
166 | acpi_ex_create_event ( | ||
167 | struct acpi_walk_state *walk_state) | ||
168 | { | 163 | { |
169 | acpi_status status; | 164 | acpi_status status; |
170 | union acpi_operand_object *obj_desc; | 165 | union acpi_operand_object *obj_desc; |
171 | |||
172 | |||
173 | ACPI_FUNCTION_TRACE ("ex_create_event"); | ||
174 | 166 | ||
167 | ACPI_FUNCTION_TRACE("ex_create_event"); | ||
175 | 168 | ||
176 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT); | 169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); |
177 | if (!obj_desc) { | 170 | if (!obj_desc) { |
178 | status = AE_NO_MEMORY; | 171 | status = AE_NO_MEMORY; |
179 | goto cleanup; | 172 | goto cleanup; |
@@ -183,27 +176,27 @@ acpi_ex_create_event ( | |||
183 | * Create the actual OS semaphore, with zero initial units -- meaning | 176 | * Create the actual OS semaphore, with zero initial units -- meaning |
184 | * that the event is created in an unsignalled state | 177 | * that the event is created in an unsignalled state |
185 | */ | 178 | */ |
186 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, | 179 | status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, |
187 | &obj_desc->event.semaphore); | 180 | &obj_desc->event.semaphore); |
188 | if (ACPI_FAILURE (status)) { | 181 | if (ACPI_FAILURE(status)) { |
189 | goto cleanup; | 182 | goto cleanup; |
190 | } | 183 | } |
191 | 184 | ||
192 | /* Attach object to the Node */ | 185 | /* Attach object to the Node */ |
193 | 186 | ||
194 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], | 187 | status = |
195 | obj_desc, ACPI_TYPE_EVENT); | 188 | acpi_ns_attach_object((struct acpi_namespace_node *)walk_state-> |
189 | operands[0], obj_desc, ACPI_TYPE_EVENT); | ||
196 | 190 | ||
197 | cleanup: | 191 | cleanup: |
198 | /* | 192 | /* |
199 | * Remove local reference to the object (on error, will cause deletion | 193 | * Remove local reference to the object (on error, will cause deletion |
200 | * of both object and semaphore if present.) | 194 | * of both object and semaphore if present.) |
201 | */ | 195 | */ |
202 | acpi_ut_remove_reference (obj_desc); | 196 | acpi_ut_remove_reference(obj_desc); |
203 | return_ACPI_STATUS (status); | 197 | return_ACPI_STATUS(status); |
204 | } | 198 | } |
205 | 199 | ||
206 | |||
207 | /******************************************************************************* | 200 | /******************************************************************************* |
208 | * | 201 | * |
209 | * FUNCTION: acpi_ex_create_mutex | 202 | * FUNCTION: acpi_ex_create_mutex |
@@ -218,20 +211,16 @@ cleanup: | |||
218 | * | 211 | * |
219 | ******************************************************************************/ | 212 | ******************************************************************************/ |
220 | 213 | ||
221 | acpi_status | 214 | acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) |
222 | acpi_ex_create_mutex ( | ||
223 | struct acpi_walk_state *walk_state) | ||
224 | { | 215 | { |
225 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
226 | union acpi_operand_object *obj_desc; | 217 | union acpi_operand_object *obj_desc; |
227 | |||
228 | |||
229 | ACPI_FUNCTION_TRACE_PTR ("ex_create_mutex", ACPI_WALK_OPERANDS); | ||
230 | 218 | ||
219 | ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); | ||
231 | 220 | ||
232 | /* Create the new mutex object */ | 221 | /* Create the new mutex object */ |
233 | 222 | ||
234 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX); | 223 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX); |
235 | if (!obj_desc) { | 224 | if (!obj_desc) { |
236 | status = AE_NO_MEMORY; | 225 | status = AE_NO_MEMORY; |
237 | goto cleanup; | 226 | goto cleanup; |
@@ -242,30 +231,30 @@ acpi_ex_create_mutex ( | |||
242 | * One unit max to make it a mutex, with one initial unit to allow | 231 | * One unit max to make it a mutex, with one initial unit to allow |
243 | * the mutex to be acquired. | 232 | * the mutex to be acquired. |
244 | */ | 233 | */ |
245 | status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore); | 234 | status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore); |
246 | if (ACPI_FAILURE (status)) { | 235 | if (ACPI_FAILURE(status)) { |
247 | goto cleanup; | 236 | goto cleanup; |
248 | } | 237 | } |
249 | 238 | ||
250 | /* Init object and attach to NS node */ | 239 | /* Init object and attach to NS node */ |
251 | 240 | ||
252 | obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value; | 241 | obj_desc->mutex.sync_level = |
253 | obj_desc->mutex.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 242 | (u8) walk_state->operands[1]->integer.value; |
254 | 243 | obj_desc->mutex.node = | |
255 | status = acpi_ns_attach_object (obj_desc->mutex.node, | 244 | (struct acpi_namespace_node *)walk_state->operands[0]; |
256 | obj_desc, ACPI_TYPE_MUTEX); | ||
257 | 245 | ||
246 | status = acpi_ns_attach_object(obj_desc->mutex.node, | ||
247 | obj_desc, ACPI_TYPE_MUTEX); | ||
258 | 248 | ||
259 | cleanup: | 249 | cleanup: |
260 | /* | 250 | /* |
261 | * Remove local reference to the object (on error, will cause deletion | 251 | * Remove local reference to the object (on error, will cause deletion |
262 | * of both object and semaphore if present.) | 252 | * of both object and semaphore if present.) |
263 | */ | 253 | */ |
264 | acpi_ut_remove_reference (obj_desc); | 254 | acpi_ut_remove_reference(obj_desc); |
265 | return_ACPI_STATUS (status); | 255 | return_ACPI_STATUS(status); |
266 | } | 256 | } |
267 | 257 | ||
268 | |||
269 | /******************************************************************************* | 258 | /******************************************************************************* |
270 | * | 259 | * |
271 | * FUNCTION: acpi_ex_create_region | 260 | * FUNCTION: acpi_ex_create_region |
@@ -282,20 +271,16 @@ cleanup: | |||
282 | ******************************************************************************/ | 271 | ******************************************************************************/ |
283 | 272 | ||
284 | acpi_status | 273 | acpi_status |
285 | acpi_ex_create_region ( | 274 | acpi_ex_create_region(u8 * aml_start, |
286 | u8 *aml_start, | 275 | u32 aml_length, |
287 | u32 aml_length, | 276 | u8 region_space, struct acpi_walk_state *walk_state) |
288 | u8 region_space, | ||
289 | struct acpi_walk_state *walk_state) | ||
290 | { | 277 | { |
291 | acpi_status status; | 278 | acpi_status status; |
292 | union acpi_operand_object *obj_desc; | 279 | union acpi_operand_object *obj_desc; |
293 | struct acpi_namespace_node *node; | 280 | struct acpi_namespace_node *node; |
294 | union acpi_operand_object *region_obj2; | 281 | union acpi_operand_object *region_obj2; |
295 | |||
296 | |||
297 | ACPI_FUNCTION_TRACE ("ex_create_region"); | ||
298 | 282 | ||
283 | ACPI_FUNCTION_TRACE("ex_create_region"); | ||
299 | 284 | ||
300 | /* Get the Namespace Node */ | 285 | /* Get the Namespace Node */ |
301 | 286 | ||
@@ -305,8 +290,8 @@ acpi_ex_create_region ( | |||
305 | * If the region object is already attached to this node, | 290 | * If the region object is already attached to this node, |
306 | * just return | 291 | * just return |
307 | */ | 292 | */ |
308 | if (acpi_ns_get_attached_object (node)) { | 293 | if (acpi_ns_get_attached_object(node)) { |
309 | return_ACPI_STATUS (AE_OK); | 294 | return_ACPI_STATUS(AE_OK); |
310 | } | 295 | } |
311 | 296 | ||
312 | /* | 297 | /* |
@@ -314,17 +299,18 @@ acpi_ex_create_region ( | |||
314 | * range | 299 | * range |
315 | */ | 300 | */ |
316 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && | 301 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && |
317 | (region_space < ACPI_USER_REGION_BEGIN)) { | 302 | (region_space < ACPI_USER_REGION_BEGIN)) { |
318 | ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space)); | 303 | ACPI_REPORT_ERROR(("Invalid address_space type %X\n", |
319 | return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); | 304 | region_space)); |
305 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); | ||
320 | } | 306 | } |
321 | 307 | ||
322 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", | 308 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (%X)\n", |
323 | acpi_ut_get_region_name (region_space), region_space)); | 309 | acpi_ut_get_region_name(region_space), region_space)); |
324 | 310 | ||
325 | /* Create the region descriptor */ | 311 | /* Create the region descriptor */ |
326 | 312 | ||
327 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION); | 313 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); |
328 | if (!obj_desc) { | 314 | if (!obj_desc) { |
329 | status = AE_NO_MEMORY; | 315 | status = AE_NO_MEMORY; |
330 | goto cleanup; | 316 | goto cleanup; |
@@ -334,7 +320,7 @@ acpi_ex_create_region ( | |||
334 | * Remember location in AML stream of address & length | 320 | * Remember location in AML stream of address & length |
335 | * operands since they need to be evaluated at run time. | 321 | * operands since they need to be evaluated at run time. |
336 | */ | 322 | */ |
337 | region_obj2 = obj_desc->common.next_object; | 323 | region_obj2 = obj_desc->common.next_object; |
338 | region_obj2->extra.aml_start = aml_start; | 324 | region_obj2->extra.aml_start = aml_start; |
339 | region_obj2->extra.aml_length = aml_length; | 325 | region_obj2->extra.aml_length = aml_length; |
340 | 326 | ||
@@ -343,22 +329,20 @@ acpi_ex_create_region ( | |||
343 | obj_desc->region.space_id = region_space; | 329 | obj_desc->region.space_id = region_space; |
344 | obj_desc->region.address = 0; | 330 | obj_desc->region.address = 0; |
345 | obj_desc->region.length = 0; | 331 | obj_desc->region.length = 0; |
346 | obj_desc->region.node = node; | 332 | obj_desc->region.node = node; |
347 | 333 | ||
348 | /* Install the new region object in the parent Node */ | 334 | /* Install the new region object in the parent Node */ |
349 | 335 | ||
350 | status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION); | 336 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); |
351 | 337 | ||
352 | 338 | cleanup: | |
353 | cleanup: | ||
354 | 339 | ||
355 | /* Remove local reference to the object */ | 340 | /* Remove local reference to the object */ |
356 | 341 | ||
357 | acpi_ut_remove_reference (obj_desc); | 342 | acpi_ut_remove_reference(obj_desc); |
358 | return_ACPI_STATUS (status); | 343 | return_ACPI_STATUS(status); |
359 | } | 344 | } |
360 | 345 | ||
361 | |||
362 | /******************************************************************************* | 346 | /******************************************************************************* |
363 | * | 347 | * |
364 | * FUNCTION: acpi_ex_create_table_region | 348 | * FUNCTION: acpi_ex_create_table_region |
@@ -371,20 +355,16 @@ cleanup: | |||
371 | * | 355 | * |
372 | ******************************************************************************/ | 356 | ******************************************************************************/ |
373 | 357 | ||
374 | acpi_status | 358 | acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) |
375 | acpi_ex_create_table_region ( | ||
376 | struct acpi_walk_state *walk_state) | ||
377 | { | 359 | { |
378 | acpi_status status; | 360 | acpi_status status; |
379 | union acpi_operand_object **operand = &walk_state->operands[0]; | 361 | union acpi_operand_object **operand = &walk_state->operands[0]; |
380 | union acpi_operand_object *obj_desc; | 362 | union acpi_operand_object *obj_desc; |
381 | struct acpi_namespace_node *node; | 363 | struct acpi_namespace_node *node; |
382 | struct acpi_table_header *table; | 364 | struct acpi_table_header *table; |
383 | union acpi_operand_object *region_obj2; | 365 | union acpi_operand_object *region_obj2; |
384 | |||
385 | |||
386 | ACPI_FUNCTION_TRACE ("ex_create_table_region"); | ||
387 | 366 | ||
367 | ACPI_FUNCTION_TRACE("ex_create_table_region"); | ||
388 | 368 | ||
389 | /* Get the Node from the object stack */ | 369 | /* Get the Node from the object stack */ |
390 | 370 | ||
@@ -394,66 +374,64 @@ acpi_ex_create_table_region ( | |||
394 | * If the region object is already attached to this node, | 374 | * If the region object is already attached to this node, |
395 | * just return | 375 | * just return |
396 | */ | 376 | */ |
397 | if (acpi_ns_get_attached_object (node)) { | 377 | if (acpi_ns_get_attached_object(node)) { |
398 | return_ACPI_STATUS (AE_OK); | 378 | return_ACPI_STATUS(AE_OK); |
399 | } | 379 | } |
400 | 380 | ||
401 | /* Find the ACPI table */ | 381 | /* Find the ACPI table */ |
402 | 382 | ||
403 | status = acpi_tb_find_table (operand[1]->string.pointer, | 383 | status = acpi_tb_find_table(operand[1]->string.pointer, |
404 | operand[2]->string.pointer, | 384 | operand[2]->string.pointer, |
405 | operand[3]->string.pointer, &table); | 385 | operand[3]->string.pointer, &table); |
406 | if (ACPI_FAILURE (status)) { | 386 | if (ACPI_FAILURE(status)) { |
407 | return_ACPI_STATUS (status); | 387 | return_ACPI_STATUS(status); |
408 | } | 388 | } |
409 | 389 | ||
410 | /* Create the region descriptor */ | 390 | /* Create the region descriptor */ |
411 | 391 | ||
412 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION); | 392 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); |
413 | if (!obj_desc) { | 393 | if (!obj_desc) { |
414 | return_ACPI_STATUS (AE_NO_MEMORY); | 394 | return_ACPI_STATUS(AE_NO_MEMORY); |
415 | } | 395 | } |
416 | 396 | ||
417 | region_obj2 = obj_desc->common.next_object; | 397 | region_obj2 = obj_desc->common.next_object; |
418 | region_obj2->extra.region_context = NULL; | 398 | region_obj2->extra.region_context = NULL; |
419 | 399 | ||
420 | /* Init the region from the operands */ | 400 | /* Init the region from the operands */ |
421 | 401 | ||
422 | obj_desc->region.space_id = REGION_DATA_TABLE; | 402 | obj_desc->region.space_id = REGION_DATA_TABLE; |
423 | obj_desc->region.address = (acpi_physical_address) ACPI_TO_INTEGER (table); | 403 | obj_desc->region.address = |
404 | (acpi_physical_address) ACPI_TO_INTEGER(table); | ||
424 | obj_desc->region.length = table->length; | 405 | obj_desc->region.length = table->length; |
425 | obj_desc->region.node = node; | 406 | obj_desc->region.node = node; |
426 | obj_desc->region.flags = AOPOBJ_DATA_VALID; | 407 | obj_desc->region.flags = AOPOBJ_DATA_VALID; |
427 | 408 | ||
428 | /* Install the new region object in the parent Node */ | 409 | /* Install the new region object in the parent Node */ |
429 | 410 | ||
430 | status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION); | 411 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); |
431 | if (ACPI_FAILURE (status)) { | 412 | if (ACPI_FAILURE(status)) { |
432 | goto cleanup; | 413 | goto cleanup; |
433 | } | 414 | } |
434 | 415 | ||
435 | status = acpi_ev_initialize_region (obj_desc, FALSE); | 416 | status = acpi_ev_initialize_region(obj_desc, FALSE); |
436 | if (ACPI_FAILURE (status)) { | 417 | if (ACPI_FAILURE(status)) { |
437 | if (status == AE_NOT_EXIST) { | 418 | if (status == AE_NOT_EXIST) { |
438 | status = AE_OK; | 419 | status = AE_OK; |
439 | } | 420 | } else { |
440 | else { | ||
441 | goto cleanup; | 421 | goto cleanup; |
442 | } | 422 | } |
443 | } | 423 | } |
444 | 424 | ||
445 | obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; | 425 | obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; |
446 | 426 | ||
447 | 427 | cleanup: | |
448 | cleanup: | ||
449 | 428 | ||
450 | /* Remove local reference to the object */ | 429 | /* Remove local reference to the object */ |
451 | 430 | ||
452 | acpi_ut_remove_reference (obj_desc); | 431 | acpi_ut_remove_reference(obj_desc); |
453 | return_ACPI_STATUS (status); | 432 | return_ACPI_STATUS(status); |
454 | } | 433 | } |
455 | 434 | ||
456 | |||
457 | /******************************************************************************* | 435 | /******************************************************************************* |
458 | * | 436 | * |
459 | * FUNCTION: acpi_ex_create_processor | 437 | * FUNCTION: acpi_ex_create_processor |
@@ -468,43 +446,39 @@ cleanup: | |||
468 | * | 446 | * |
469 | ******************************************************************************/ | 447 | ******************************************************************************/ |
470 | 448 | ||
471 | acpi_status | 449 | acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) |
472 | acpi_ex_create_processor ( | ||
473 | struct acpi_walk_state *walk_state) | ||
474 | { | 450 | { |
475 | union acpi_operand_object **operand = &walk_state->operands[0]; | 451 | union acpi_operand_object **operand = &walk_state->operands[0]; |
476 | union acpi_operand_object *obj_desc; | 452 | union acpi_operand_object *obj_desc; |
477 | acpi_status status; | 453 | acpi_status status; |
478 | |||
479 | |||
480 | ACPI_FUNCTION_TRACE_PTR ("ex_create_processor", walk_state); | ||
481 | 454 | ||
455 | ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); | ||
482 | 456 | ||
483 | /* Create the processor object */ | 457 | /* Create the processor object */ |
484 | 458 | ||
485 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR); | 459 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR); |
486 | if (!obj_desc) { | 460 | if (!obj_desc) { |
487 | return_ACPI_STATUS (AE_NO_MEMORY); | 461 | return_ACPI_STATUS(AE_NO_MEMORY); |
488 | } | 462 | } |
489 | 463 | ||
490 | /* Initialize the processor object from the operands */ | 464 | /* Initialize the processor object from the operands */ |
491 | 465 | ||
492 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; | 466 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; |
493 | obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; | 467 | obj_desc->processor.address = |
494 | obj_desc->processor.length = (u8) operand[3]->integer.value; | 468 | (acpi_io_address) operand[2]->integer.value; |
469 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
495 | 470 | ||
496 | /* Install the processor object in the parent Node */ | 471 | /* Install the processor object in the parent Node */ |
497 | 472 | ||
498 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], | 473 | status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], |
499 | obj_desc, ACPI_TYPE_PROCESSOR); | 474 | obj_desc, ACPI_TYPE_PROCESSOR); |
500 | 475 | ||
501 | /* Remove local reference to the object */ | 476 | /* Remove local reference to the object */ |
502 | 477 | ||
503 | acpi_ut_remove_reference (obj_desc); | 478 | acpi_ut_remove_reference(obj_desc); |
504 | return_ACPI_STATUS (status); | 479 | return_ACPI_STATUS(status); |
505 | } | 480 | } |
506 | 481 | ||
507 | |||
508 | /******************************************************************************* | 482 | /******************************************************************************* |
509 | * | 483 | * |
510 | * FUNCTION: acpi_ex_create_power_resource | 484 | * FUNCTION: acpi_ex_create_power_resource |
@@ -519,43 +493,39 @@ acpi_ex_create_processor ( | |||
519 | * | 493 | * |
520 | ******************************************************************************/ | 494 | ******************************************************************************/ |
521 | 495 | ||
522 | acpi_status | 496 | acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state) |
523 | acpi_ex_create_power_resource ( | ||
524 | struct acpi_walk_state *walk_state) | ||
525 | { | 497 | { |
526 | union acpi_operand_object **operand = &walk_state->operands[0]; | 498 | union acpi_operand_object **operand = &walk_state->operands[0]; |
527 | acpi_status status; | 499 | acpi_status status; |
528 | union acpi_operand_object *obj_desc; | 500 | union acpi_operand_object *obj_desc; |
529 | |||
530 | |||
531 | ACPI_FUNCTION_TRACE_PTR ("ex_create_power_resource", walk_state); | ||
532 | 501 | ||
502 | ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); | ||
533 | 503 | ||
534 | /* Create the power resource object */ | 504 | /* Create the power resource object */ |
535 | 505 | ||
536 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER); | 506 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER); |
537 | if (!obj_desc) { | 507 | if (!obj_desc) { |
538 | return_ACPI_STATUS (AE_NO_MEMORY); | 508 | return_ACPI_STATUS(AE_NO_MEMORY); |
539 | } | 509 | } |
540 | 510 | ||
541 | /* Initialize the power object from the operands */ | 511 | /* Initialize the power object from the operands */ |
542 | 512 | ||
543 | obj_desc->power_resource.system_level = (u8) operand[1]->integer.value; | 513 | obj_desc->power_resource.system_level = (u8) operand[1]->integer.value; |
544 | obj_desc->power_resource.resource_order = (u16) operand[2]->integer.value; | 514 | obj_desc->power_resource.resource_order = |
515 | (u16) operand[2]->integer.value; | ||
545 | 516 | ||
546 | /* Install the power resource object in the parent Node */ | 517 | /* Install the power resource object in the parent Node */ |
547 | 518 | ||
548 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], | 519 | status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], |
549 | obj_desc, ACPI_TYPE_POWER); | 520 | obj_desc, ACPI_TYPE_POWER); |
550 | 521 | ||
551 | /* Remove local reference to the object */ | 522 | /* Remove local reference to the object */ |
552 | 523 | ||
553 | acpi_ut_remove_reference (obj_desc); | 524 | acpi_ut_remove_reference(obj_desc); |
554 | return_ACPI_STATUS (status); | 525 | return_ACPI_STATUS(status); |
555 | } | 526 | } |
556 | #endif | 527 | #endif |
557 | 528 | ||
558 | |||
559 | /******************************************************************************* | 529 | /******************************************************************************* |
560 | * | 530 | * |
561 | * FUNCTION: acpi_ex_create_method | 531 | * FUNCTION: acpi_ex_create_method |
@@ -571,25 +541,21 @@ acpi_ex_create_power_resource ( | |||
571 | ******************************************************************************/ | 541 | ******************************************************************************/ |
572 | 542 | ||
573 | acpi_status | 543 | acpi_status |
574 | acpi_ex_create_method ( | 544 | acpi_ex_create_method(u8 * aml_start, |
575 | u8 *aml_start, | 545 | u32 aml_length, struct acpi_walk_state *walk_state) |
576 | u32 aml_length, | ||
577 | struct acpi_walk_state *walk_state) | ||
578 | { | 546 | { |
579 | union acpi_operand_object **operand = &walk_state->operands[0]; | 547 | union acpi_operand_object **operand = &walk_state->operands[0]; |
580 | union acpi_operand_object *obj_desc; | 548 | union acpi_operand_object *obj_desc; |
581 | acpi_status status; | 549 | acpi_status status; |
582 | u8 method_flags; | 550 | u8 method_flags; |
583 | |||
584 | |||
585 | ACPI_FUNCTION_TRACE_PTR ("ex_create_method", walk_state); | ||
586 | 551 | ||
552 | ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); | ||
587 | 553 | ||
588 | /* Create a new method object */ | 554 | /* Create a new method object */ |
589 | 555 | ||
590 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD); | 556 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); |
591 | if (!obj_desc) { | 557 | if (!obj_desc) { |
592 | return_ACPI_STATUS (AE_NO_MEMORY); | 558 | return_ACPI_STATUS(AE_NO_MEMORY); |
593 | } | 559 | } |
594 | 560 | ||
595 | /* Save the method's AML pointer and length */ | 561 | /* Save the method's AML pointer and length */ |
@@ -603,8 +569,10 @@ acpi_ex_create_method ( | |||
603 | */ | 569 | */ |
604 | method_flags = (u8) operand[1]->integer.value; | 570 | method_flags = (u8) operand[1]->integer.value; |
605 | 571 | ||
606 | obj_desc->method.method_flags = (u8) (method_flags & ~AML_METHOD_ARG_COUNT); | 572 | obj_desc->method.method_flags = |
607 | obj_desc->method.param_count = (u8) (method_flags & AML_METHOD_ARG_COUNT); | 573 | (u8) (method_flags & ~AML_METHOD_ARG_COUNT); |
574 | obj_desc->method.param_count = | ||
575 | (u8) (method_flags & AML_METHOD_ARG_COUNT); | ||
608 | 576 | ||
609 | /* | 577 | /* |
610 | * Get the concurrency count. If required, a semaphore will be | 578 | * Get the concurrency count. If required, a semaphore will be |
@@ -613,32 +581,28 @@ acpi_ex_create_method ( | |||
613 | if (acpi_gbl_all_methods_serialized) { | 581 | if (acpi_gbl_all_methods_serialized) { |
614 | obj_desc->method.concurrency = 1; | 582 | obj_desc->method.concurrency = 1; |
615 | obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; | 583 | obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; |
616 | } | 584 | } else if (method_flags & AML_METHOD_SERIALIZED) { |
617 | else if (method_flags & AML_METHOD_SERIALIZED) { | ||
618 | /* | 585 | /* |
619 | * ACPI 1.0: Concurrency = 1 | 586 | * ACPI 1.0: Concurrency = 1 |
620 | * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) | 587 | * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) |
621 | */ | 588 | */ |
622 | obj_desc->method.concurrency = (u8) | 589 | obj_desc->method.concurrency = (u8) |
623 | (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); | 590 | (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); |
624 | } | 591 | } else { |
625 | else { | ||
626 | obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY; | 592 | obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY; |
627 | } | 593 | } |
628 | 594 | ||
629 | /* Attach the new object to the method Node */ | 595 | /* Attach the new object to the method Node */ |
630 | 596 | ||
631 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0], | 597 | status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0], |
632 | obj_desc, ACPI_TYPE_METHOD); | 598 | obj_desc, ACPI_TYPE_METHOD); |
633 | 599 | ||
634 | /* Remove local reference to the object */ | 600 | /* Remove local reference to the object */ |
635 | 601 | ||
636 | acpi_ut_remove_reference (obj_desc); | 602 | acpi_ut_remove_reference(obj_desc); |
637 | 603 | ||
638 | /* Remove a reference to the operand */ | 604 | /* Remove a reference to the operand */ |
639 | 605 | ||
640 | acpi_ut_remove_reference (operand[1]); | 606 | acpi_ut_remove_reference(operand[1]); |
641 | return_ACPI_STATUS (status); | 607 | return_ACPI_STATUS(status); |
642 | } | 608 | } |
643 | |||
644 | |||
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 4f98dceed39a..bc2fa996047e 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
@@ -49,46 +48,27 @@ | |||
49 | #include <acpi/acparser.h> | 48 | #include <acpi/acparser.h> |
50 | 49 | ||
51 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME ("exdump") | 51 | ACPI_MODULE_NAME("exdump") |
53 | 52 | ||
54 | /* | 53 | /* |
55 | * The following routines are used for debug output only | 54 | * The following routines are used for debug output only |
56 | */ | 55 | */ |
57 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 56 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
58 | |||
59 | /* Local prototypes */ | 57 | /* Local prototypes */ |
60 | |||
61 | #ifdef ACPI_FUTURE_USAGE | 58 | #ifdef ACPI_FUTURE_USAGE |
62 | static void | 59 | static void acpi_ex_out_string(char *title, char *value); |
63 | acpi_ex_out_string ( | ||
64 | char *title, | ||
65 | char *value); | ||
66 | 60 | ||
67 | static void | 61 | static void acpi_ex_out_pointer(char *title, void *value); |
68 | acpi_ex_out_pointer ( | ||
69 | char *title, | ||
70 | void *value); | ||
71 | 62 | ||
72 | static void | 63 | static void acpi_ex_out_integer(char *title, u32 value); |
73 | acpi_ex_out_integer ( | ||
74 | char *title, | ||
75 | u32 value); | ||
76 | 64 | ||
77 | static void | 65 | static void acpi_ex_out_address(char *title, acpi_physical_address value); |
78 | acpi_ex_out_address ( | ||
79 | char *title, | ||
80 | acpi_physical_address value); | ||
81 | 66 | ||
82 | static void | 67 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); |
83 | acpi_ex_dump_reference ( | ||
84 | union acpi_operand_object *obj_desc); | ||
85 | 68 | ||
86 | static void | 69 | static void |
87 | acpi_ex_dump_package ( | 70 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); |
88 | union acpi_operand_object *obj_desc, | 71 | #endif /* ACPI_FUTURE_USAGE */ |
89 | u32 level, | ||
90 | u32 index); | ||
91 | #endif /* ACPI_FUTURE_USAGE */ | ||
92 | 72 | ||
93 | /******************************************************************************* | 73 | /******************************************************************************* |
94 | * | 74 | * |
@@ -103,143 +83,140 @@ acpi_ex_dump_package ( | |||
103 | * | 83 | * |
104 | ******************************************************************************/ | 84 | ******************************************************************************/ |
105 | 85 | ||
106 | void | 86 | void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) |
107 | acpi_ex_dump_operand ( | ||
108 | union acpi_operand_object *obj_desc, | ||
109 | u32 depth) | ||
110 | { | 87 | { |
111 | u32 length; | 88 | u32 length; |
112 | u32 index; | 89 | u32 index; |
113 | |||
114 | |||
115 | ACPI_FUNCTION_NAME ("ex_dump_operand") | ||
116 | 90 | ||
91 | ACPI_FUNCTION_NAME("ex_dump_operand") | ||
117 | 92 | ||
118 | if (!((ACPI_LV_EXEC & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { | 93 | if (! |
94 | ((ACPI_LV_EXEC & acpi_dbg_level) | ||
95 | && (_COMPONENT & acpi_dbg_layer))) { | ||
119 | return; | 96 | return; |
120 | } | 97 | } |
121 | 98 | ||
122 | if (!obj_desc) { | 99 | if (!obj_desc) { |
123 | /* This could be a null element of a package */ | 100 | /* This could be a null element of a package */ |
124 | 101 | ||
125 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); | 102 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); |
126 | return; | 103 | return; |
127 | } | 104 | } |
128 | 105 | ||
129 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | 106 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { |
130 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc)); | 107 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ", |
131 | ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC); | 108 | obj_desc)); |
109 | ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC); | ||
132 | return; | 110 | return; |
133 | } | 111 | } |
134 | 112 | ||
135 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 113 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
136 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 114 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
137 | "%p is not a node or operand object: [%s]\n", | 115 | "%p is not a node or operand object: [%s]\n", |
138 | obj_desc, acpi_ut_get_descriptor_name (obj_desc))); | 116 | obj_desc, |
139 | ACPI_DUMP_BUFFER (obj_desc, sizeof (union acpi_operand_object)); | 117 | acpi_ut_get_descriptor_name(obj_desc))); |
118 | ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object)); | ||
140 | return; | 119 | return; |
141 | } | 120 | } |
142 | 121 | ||
143 | /* obj_desc is a valid object */ | 122 | /* obj_desc is a valid object */ |
144 | 123 | ||
145 | if (depth > 0) { | 124 | if (depth > 0) { |
146 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ", | 125 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ", |
147 | depth, " ", depth, obj_desc)); | 126 | depth, " ", depth, obj_desc)); |
148 | } | 127 | } else { |
149 | else { | 128 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc)); |
150 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); | ||
151 | } | 129 | } |
152 | 130 | ||
153 | /* Decode object type */ | 131 | /* Decode object type */ |
154 | 132 | ||
155 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 133 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
156 | case ACPI_TYPE_LOCAL_REFERENCE: | 134 | case ACPI_TYPE_LOCAL_REFERENCE: |
157 | 135 | ||
158 | switch (obj_desc->reference.opcode) { | 136 | switch (obj_desc->reference.opcode) { |
159 | case AML_DEBUG_OP: | 137 | case AML_DEBUG_OP: |
160 | 138 | ||
161 | acpi_os_printf ("Reference: Debug\n"); | 139 | acpi_os_printf("Reference: Debug\n"); |
162 | break; | 140 | break; |
163 | 141 | ||
164 | |||
165 | case AML_NAME_OP: | 142 | case AML_NAME_OP: |
166 | 143 | ||
167 | ACPI_DUMP_PATHNAME (obj_desc->reference.object, | 144 | ACPI_DUMP_PATHNAME(obj_desc->reference.object, |
168 | "Reference: Name: ", ACPI_LV_INFO, _COMPONENT); | 145 | "Reference: Name: ", ACPI_LV_INFO, |
169 | ACPI_DUMP_ENTRY (obj_desc->reference.object, ACPI_LV_INFO); | 146 | _COMPONENT); |
147 | ACPI_DUMP_ENTRY(obj_desc->reference.object, | ||
148 | ACPI_LV_INFO); | ||
170 | break; | 149 | break; |
171 | 150 | ||
172 | |||
173 | case AML_INDEX_OP: | 151 | case AML_INDEX_OP: |
174 | 152 | ||
175 | acpi_os_printf ("Reference: Index %p\n", | 153 | acpi_os_printf("Reference: Index %p\n", |
176 | obj_desc->reference.object); | 154 | obj_desc->reference.object); |
177 | break; | 155 | break; |
178 | 156 | ||
179 | |||
180 | case AML_REF_OF_OP: | 157 | case AML_REF_OF_OP: |
181 | 158 | ||
182 | acpi_os_printf ("Reference: (ref_of) %p\n", | 159 | acpi_os_printf("Reference: (ref_of) %p\n", |
183 | obj_desc->reference.object); | 160 | obj_desc->reference.object); |
184 | break; | 161 | break; |
185 | 162 | ||
186 | |||
187 | case AML_ARG_OP: | 163 | case AML_ARG_OP: |
188 | 164 | ||
189 | acpi_os_printf ("Reference: Arg%d", | 165 | acpi_os_printf("Reference: Arg%d", |
190 | obj_desc->reference.offset); | 166 | obj_desc->reference.offset); |
191 | 167 | ||
192 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 168 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
193 | /* Value is an Integer */ | 169 | /* Value is an Integer */ |
194 | 170 | ||
195 | acpi_os_printf (" value is [%8.8X%8.8x]", | 171 | acpi_os_printf(" value is [%8.8X%8.8x]", |
196 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | 172 | ACPI_FORMAT_UINT64(obj_desc-> |
173 | integer. | ||
174 | value)); | ||
197 | } | 175 | } |
198 | 176 | ||
199 | acpi_os_printf ("\n"); | 177 | acpi_os_printf("\n"); |
200 | break; | 178 | break; |
201 | 179 | ||
202 | |||
203 | case AML_LOCAL_OP: | 180 | case AML_LOCAL_OP: |
204 | 181 | ||
205 | acpi_os_printf ("Reference: Local%d", | 182 | acpi_os_printf("Reference: Local%d", |
206 | obj_desc->reference.offset); | 183 | obj_desc->reference.offset); |
207 | 184 | ||
208 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 185 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
209 | 186 | ||
210 | /* Value is an Integer */ | 187 | /* Value is an Integer */ |
211 | 188 | ||
212 | acpi_os_printf (" value is [%8.8X%8.8x]", | 189 | acpi_os_printf(" value is [%8.8X%8.8x]", |
213 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | 190 | ACPI_FORMAT_UINT64(obj_desc-> |
191 | integer. | ||
192 | value)); | ||
214 | } | 193 | } |
215 | 194 | ||
216 | acpi_os_printf ("\n"); | 195 | acpi_os_printf("\n"); |
217 | break; | 196 | break; |
218 | 197 | ||
219 | |||
220 | case AML_INT_NAMEPATH_OP: | 198 | case AML_INT_NAMEPATH_OP: |
221 | 199 | ||
222 | acpi_os_printf ("Reference.Node->Name %X\n", | 200 | acpi_os_printf("Reference.Node->Name %X\n", |
223 | obj_desc->reference.node->name.integer); | 201 | obj_desc->reference.node->name.integer); |
224 | break; | 202 | break; |
225 | 203 | ||
226 | |||
227 | default: | 204 | default: |
228 | 205 | ||
229 | /* Unknown opcode */ | 206 | /* Unknown opcode */ |
230 | 207 | ||
231 | acpi_os_printf ("Unknown Reference opcode=%X\n", | 208 | acpi_os_printf("Unknown Reference opcode=%X\n", |
232 | obj_desc->reference.opcode); | 209 | obj_desc->reference.opcode); |
233 | break; | 210 | break; |
234 | 211 | ||
235 | } | 212 | } |
236 | break; | 213 | break; |
237 | 214 | ||
238 | |||
239 | case ACPI_TYPE_BUFFER: | 215 | case ACPI_TYPE_BUFFER: |
240 | 216 | ||
241 | acpi_os_printf ("Buffer len %X @ %p \n", | 217 | acpi_os_printf("Buffer len %X @ %p \n", |
242 | obj_desc->buffer.length, obj_desc->buffer.pointer); | 218 | obj_desc->buffer.length, |
219 | obj_desc->buffer.pointer); | ||
243 | 220 | ||
244 | length = obj_desc->buffer.length; | 221 | length = obj_desc->buffer.length; |
245 | if (length > 64) { | 222 | if (length > 64) { |
@@ -249,178 +226,166 @@ acpi_ex_dump_operand ( | |||
249 | /* Debug only -- dump the buffer contents */ | 226 | /* Debug only -- dump the buffer contents */ |
250 | 227 | ||
251 | if (obj_desc->buffer.pointer) { | 228 | if (obj_desc->buffer.pointer) { |
252 | acpi_os_printf ("Buffer Contents: "); | 229 | acpi_os_printf("Buffer Contents: "); |
253 | 230 | ||
254 | for (index = 0; index < length; index++) { | 231 | for (index = 0; index < length; index++) { |
255 | acpi_os_printf (" %02x", obj_desc->buffer.pointer[index]); | 232 | acpi_os_printf(" %02x", |
233 | obj_desc->buffer.pointer[index]); | ||
256 | } | 234 | } |
257 | acpi_os_printf ("\n"); | 235 | acpi_os_printf("\n"); |
258 | } | 236 | } |
259 | break; | 237 | break; |
260 | 238 | ||
261 | |||
262 | case ACPI_TYPE_INTEGER: | 239 | case ACPI_TYPE_INTEGER: |
263 | 240 | ||
264 | acpi_os_printf ("Integer %8.8X%8.8X\n", | 241 | acpi_os_printf("Integer %8.8X%8.8X\n", |
265 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | 242 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); |
266 | break; | 243 | break; |
267 | 244 | ||
268 | |||
269 | case ACPI_TYPE_PACKAGE: | 245 | case ACPI_TYPE_PACKAGE: |
270 | 246 | ||
271 | acpi_os_printf ("Package [Len %X] element_array %p\n", | 247 | acpi_os_printf("Package [Len %X] element_array %p\n", |
272 | obj_desc->package.count, obj_desc->package.elements); | 248 | obj_desc->package.count, |
249 | obj_desc->package.elements); | ||
273 | 250 | ||
274 | /* | 251 | /* |
275 | * If elements exist, package element pointer is valid, | 252 | * If elements exist, package element pointer is valid, |
276 | * and debug_level exceeds 1, dump package's elements. | 253 | * and debug_level exceeds 1, dump package's elements. |
277 | */ | 254 | */ |
278 | if (obj_desc->package.count && | 255 | if (obj_desc->package.count && |
279 | obj_desc->package.elements && | 256 | obj_desc->package.elements && acpi_dbg_level > 1) { |
280 | acpi_dbg_level > 1) { | 257 | for (index = 0; index < obj_desc->package.count; |
281 | for (index = 0; index < obj_desc->package.count; index++) { | 258 | index++) { |
282 | acpi_ex_dump_operand (obj_desc->package.elements[index], depth+1); | 259 | acpi_ex_dump_operand(obj_desc->package. |
260 | elements[index], | ||
261 | depth + 1); | ||
283 | } | 262 | } |
284 | } | 263 | } |
285 | break; | 264 | break; |
286 | 265 | ||
287 | |||
288 | case ACPI_TYPE_REGION: | 266 | case ACPI_TYPE_REGION: |
289 | 267 | ||
290 | acpi_os_printf ("Region %s (%X)", | 268 | acpi_os_printf("Region %s (%X)", |
291 | acpi_ut_get_region_name (obj_desc->region.space_id), | 269 | acpi_ut_get_region_name(obj_desc->region. |
292 | obj_desc->region.space_id); | 270 | space_id), |
271 | obj_desc->region.space_id); | ||
293 | 272 | ||
294 | /* | 273 | /* |
295 | * If the address and length have not been evaluated, | 274 | * If the address and length have not been evaluated, |
296 | * don't print them. | 275 | * don't print them. |
297 | */ | 276 | */ |
298 | if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) { | 277 | if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) { |
299 | acpi_os_printf ("\n"); | 278 | acpi_os_printf("\n"); |
300 | } | 279 | } else { |
301 | else { | 280 | acpi_os_printf(" base %8.8X%8.8X Length %X\n", |
302 | acpi_os_printf (" base %8.8X%8.8X Length %X\n", | 281 | ACPI_FORMAT_UINT64(obj_desc->region. |
303 | ACPI_FORMAT_UINT64 (obj_desc->region.address), | 282 | address), |
304 | obj_desc->region.length); | 283 | obj_desc->region.length); |
305 | } | 284 | } |
306 | break; | 285 | break; |
307 | 286 | ||
308 | |||
309 | case ACPI_TYPE_STRING: | 287 | case ACPI_TYPE_STRING: |
310 | 288 | ||
311 | acpi_os_printf ("String length %X @ %p ", | 289 | acpi_os_printf("String length %X @ %p ", |
312 | obj_desc->string.length, | 290 | obj_desc->string.length, |
313 | obj_desc->string.pointer); | 291 | obj_desc->string.pointer); |
314 | 292 | ||
315 | acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); | 293 | acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); |
316 | acpi_os_printf ("\n"); | 294 | acpi_os_printf("\n"); |
317 | break; | 295 | break; |
318 | 296 | ||
319 | |||
320 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 297 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
321 | 298 | ||
322 | acpi_os_printf ("bank_field\n"); | 299 | acpi_os_printf("bank_field\n"); |
323 | break; | 300 | break; |
324 | 301 | ||
325 | |||
326 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 302 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
327 | 303 | ||
328 | acpi_os_printf ( | 304 | acpi_os_printf |
329 | "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", | 305 | ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", |
330 | obj_desc->field.bit_length, | 306 | obj_desc->field.bit_length, |
331 | obj_desc->field.access_byte_width, | 307 | obj_desc->field.access_byte_width, |
332 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, | 308 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, |
333 | obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, | 309 | obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, |
334 | obj_desc->field.base_byte_offset, | 310 | obj_desc->field.base_byte_offset, |
335 | obj_desc->field.start_field_bit_offset); | 311 | obj_desc->field.start_field_bit_offset); |
336 | 312 | ||
337 | acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); | 313 | acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1); |
338 | break; | 314 | break; |
339 | 315 | ||
340 | |||
341 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 316 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
342 | 317 | ||
343 | acpi_os_printf ("index_field\n"); | 318 | acpi_os_printf("index_field\n"); |
344 | break; | 319 | break; |
345 | 320 | ||
346 | |||
347 | case ACPI_TYPE_BUFFER_FIELD: | 321 | case ACPI_TYPE_BUFFER_FIELD: |
348 | 322 | ||
349 | acpi_os_printf ( | 323 | acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n", |
350 | "buffer_field: %X bits at byte %X bit %X of \n", | 324 | obj_desc->buffer_field.bit_length, |
351 | obj_desc->buffer_field.bit_length, | 325 | obj_desc->buffer_field.base_byte_offset, |
352 | obj_desc->buffer_field.base_byte_offset, | 326 | obj_desc->buffer_field.start_field_bit_offset); |
353 | obj_desc->buffer_field.start_field_bit_offset); | ||
354 | 327 | ||
355 | if (!obj_desc->buffer_field.buffer_obj) { | 328 | if (!obj_desc->buffer_field.buffer_obj) { |
356 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); | 329 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n")); |
357 | } | 330 | } else |
358 | else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != | 331 | if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) |
359 | ACPI_TYPE_BUFFER) { | 332 | != ACPI_TYPE_BUFFER) { |
360 | acpi_os_printf ("*not a Buffer* \n"); | 333 | acpi_os_printf("*not a Buffer* \n"); |
361 | } | 334 | } else { |
362 | else { | 335 | acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, |
363 | acpi_ex_dump_operand (obj_desc->buffer_field.buffer_obj, depth+1); | 336 | depth + 1); |
364 | } | 337 | } |
365 | break; | 338 | break; |
366 | 339 | ||
367 | |||
368 | case ACPI_TYPE_EVENT: | 340 | case ACPI_TYPE_EVENT: |
369 | 341 | ||
370 | acpi_os_printf ("Event\n"); | 342 | acpi_os_printf("Event\n"); |
371 | break; | 343 | break; |
372 | 344 | ||
373 | |||
374 | case ACPI_TYPE_METHOD: | 345 | case ACPI_TYPE_METHOD: |
375 | 346 | ||
376 | acpi_os_printf ("Method(%X) @ %p:%X\n", | 347 | acpi_os_printf("Method(%X) @ %p:%X\n", |
377 | obj_desc->method.param_count, | 348 | obj_desc->method.param_count, |
378 | obj_desc->method.aml_start, | 349 | obj_desc->method.aml_start, |
379 | obj_desc->method.aml_length); | 350 | obj_desc->method.aml_length); |
380 | break; | 351 | break; |
381 | 352 | ||
382 | |||
383 | case ACPI_TYPE_MUTEX: | 353 | case ACPI_TYPE_MUTEX: |
384 | 354 | ||
385 | acpi_os_printf ("Mutex\n"); | 355 | acpi_os_printf("Mutex\n"); |
386 | break; | 356 | break; |
387 | 357 | ||
388 | |||
389 | case ACPI_TYPE_DEVICE: | 358 | case ACPI_TYPE_DEVICE: |
390 | 359 | ||
391 | acpi_os_printf ("Device\n"); | 360 | acpi_os_printf("Device\n"); |
392 | break; | 361 | break; |
393 | 362 | ||
394 | |||
395 | case ACPI_TYPE_POWER: | 363 | case ACPI_TYPE_POWER: |
396 | 364 | ||
397 | acpi_os_printf ("Power\n"); | 365 | acpi_os_printf("Power\n"); |
398 | break; | 366 | break; |
399 | 367 | ||
400 | |||
401 | case ACPI_TYPE_PROCESSOR: | 368 | case ACPI_TYPE_PROCESSOR: |
402 | 369 | ||
403 | acpi_os_printf ("Processor\n"); | 370 | acpi_os_printf("Processor\n"); |
404 | break; | 371 | break; |
405 | 372 | ||
406 | |||
407 | case ACPI_TYPE_THERMAL: | 373 | case ACPI_TYPE_THERMAL: |
408 | 374 | ||
409 | acpi_os_printf ("Thermal\n"); | 375 | acpi_os_printf("Thermal\n"); |
410 | break; | 376 | break; |
411 | 377 | ||
412 | |||
413 | default: | 378 | default: |
414 | /* Unknown Type */ | 379 | /* Unknown Type */ |
415 | 380 | ||
416 | acpi_os_printf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (obj_desc)); | 381 | acpi_os_printf("Unknown Type %X\n", |
382 | ACPI_GET_OBJECT_TYPE(obj_desc)); | ||
417 | break; | 383 | break; |
418 | } | 384 | } |
419 | 385 | ||
420 | return; | 386 | return; |
421 | } | 387 | } |
422 | 388 | ||
423 | |||
424 | /******************************************************************************* | 389 | /******************************************************************************* |
425 | * | 390 | * |
426 | * FUNCTION: acpi_ex_dump_operands | 391 | * FUNCTION: acpi_ex_dump_operands |
@@ -438,20 +403,15 @@ acpi_ex_dump_operand ( | |||
438 | ******************************************************************************/ | 403 | ******************************************************************************/ |
439 | 404 | ||
440 | void | 405 | void |
441 | acpi_ex_dump_operands ( | 406 | acpi_ex_dump_operands(union acpi_operand_object **operands, |
442 | union acpi_operand_object **operands, | 407 | acpi_interpreter_mode interpreter_mode, |
443 | acpi_interpreter_mode interpreter_mode, | 408 | char *ident, |
444 | char *ident, | 409 | u32 num_levels, |
445 | u32 num_levels, | 410 | char *note, char *module_name, u32 line_number) |
446 | char *note, | ||
447 | char *module_name, | ||
448 | u32 line_number) | ||
449 | { | 411 | { |
450 | acpi_native_uint i; | 412 | acpi_native_uint i; |
451 | |||
452 | |||
453 | ACPI_FUNCTION_NAME ("ex_dump_operands"); | ||
454 | 413 | ||
414 | ACPI_FUNCTION_NAME("ex_dump_operands"); | ||
455 | 415 | ||
456 | if (!ident) { | 416 | if (!ident) { |
457 | ident = "?"; | 417 | ident = "?"; |
@@ -461,9 +421,9 @@ acpi_ex_dump_operands ( | |||
461 | note = "?"; | 421 | note = "?"; |
462 | } | 422 | } |
463 | 423 | ||
464 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 424 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
465 | "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", | 425 | "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", |
466 | ident, num_levels)); | 426 | ident, num_levels)); |
467 | 427 | ||
468 | if (num_levels == 0) { | 428 | if (num_levels == 0) { |
469 | num_levels = 1; | 429 | num_levels = 1; |
@@ -472,16 +432,15 @@ acpi_ex_dump_operands ( | |||
472 | /* Dump the operand stack starting at the top */ | 432 | /* Dump the operand stack starting at the top */ |
473 | 433 | ||
474 | for (i = 0; num_levels > 0; i--, num_levels--) { | 434 | for (i = 0; num_levels > 0; i--, num_levels--) { |
475 | acpi_ex_dump_operand (operands[i], 0); | 435 | acpi_ex_dump_operand(operands[i], 0); |
476 | } | 436 | } |
477 | 437 | ||
478 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 438 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
479 | "************* Operand Stack dump from %s(%d), %s\n", | 439 | "************* Operand Stack dump from %s(%d), %s\n", |
480 | module_name, line_number, note)); | 440 | module_name, line_number, note)); |
481 | return; | 441 | return; |
482 | } | 442 | } |
483 | 443 | ||
484 | |||
485 | #ifdef ACPI_FUTURE_USAGE | 444 | #ifdef ACPI_FUTURE_USAGE |
486 | /******************************************************************************* | 445 | /******************************************************************************* |
487 | * | 446 | * |
@@ -496,44 +455,31 @@ acpi_ex_dump_operands ( | |||
496 | * | 455 | * |
497 | ******************************************************************************/ | 456 | ******************************************************************************/ |
498 | 457 | ||
499 | static void | 458 | static void acpi_ex_out_string(char *title, char *value) |
500 | acpi_ex_out_string ( | ||
501 | char *title, | ||
502 | char *value) | ||
503 | { | 459 | { |
504 | acpi_os_printf ("%20s : %s\n", title, value); | 460 | acpi_os_printf("%20s : %s\n", title, value); |
505 | } | 461 | } |
506 | 462 | ||
507 | static void | 463 | static void acpi_ex_out_pointer(char *title, void *value) |
508 | acpi_ex_out_pointer ( | ||
509 | char *title, | ||
510 | void *value) | ||
511 | { | 464 | { |
512 | acpi_os_printf ("%20s : %p\n", title, value); | 465 | acpi_os_printf("%20s : %p\n", title, value); |
513 | } | 466 | } |
514 | 467 | ||
515 | static void | 468 | static void acpi_ex_out_integer(char *title, u32 value) |
516 | acpi_ex_out_integer ( | ||
517 | char *title, | ||
518 | u32 value) | ||
519 | { | 469 | { |
520 | acpi_os_printf ("%20s : %.2X\n", title, value); | 470 | acpi_os_printf("%20s : %.2X\n", title, value); |
521 | } | 471 | } |
522 | 472 | ||
523 | static void | 473 | static void acpi_ex_out_address(char *title, acpi_physical_address value) |
524 | acpi_ex_out_address ( | ||
525 | char *title, | ||
526 | acpi_physical_address value) | ||
527 | { | 474 | { |
528 | 475 | ||
529 | #if ACPI_MACHINE_WIDTH == 16 | 476 | #if ACPI_MACHINE_WIDTH == 16 |
530 | acpi_os_printf ("%20s : %p\n", title, value); | 477 | acpi_os_printf("%20s : %p\n", title, value); |
531 | #else | 478 | #else |
532 | acpi_os_printf ("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64 (value)); | 479 | acpi_os_printf("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); |
533 | #endif | 480 | #endif |
534 | } | 481 | } |
535 | 482 | ||
536 | |||
537 | /******************************************************************************* | 483 | /******************************************************************************* |
538 | * | 484 | * |
539 | * FUNCTION: acpi_ex_dump_node | 485 | * FUNCTION: acpi_ex_dump_node |
@@ -545,33 +491,31 @@ acpi_ex_out_address ( | |||
545 | * | 491 | * |
546 | ******************************************************************************/ | 492 | ******************************************************************************/ |
547 | 493 | ||
548 | void | 494 | void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) |
549 | acpi_ex_dump_node ( | ||
550 | struct acpi_namespace_node *node, | ||
551 | u32 flags) | ||
552 | { | 495 | { |
553 | 496 | ||
554 | ACPI_FUNCTION_ENTRY (); | 497 | ACPI_FUNCTION_ENTRY(); |
555 | |||
556 | 498 | ||
557 | if (!flags) { | 499 | if (!flags) { |
558 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { | 500 | if (! |
501 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | ||
502 | && (_COMPONENT & acpi_dbg_layer))) { | ||
559 | return; | 503 | return; |
560 | } | 504 | } |
561 | } | 505 | } |
562 | 506 | ||
563 | acpi_os_printf ("%20s : %4.4s\n", "Name", acpi_ut_get_node_name (node)); | 507 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); |
564 | acpi_ex_out_string ("Type", acpi_ut_get_type_name (node->type)); | 508 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); |
565 | acpi_ex_out_integer ("Flags", node->flags); | 509 | acpi_ex_out_integer("Flags", node->flags); |
566 | acpi_ex_out_integer ("Owner Id", node->owner_id); | 510 | acpi_ex_out_integer("Owner Id", node->owner_id); |
567 | acpi_ex_out_integer ("Reference Count", node->reference_count); | 511 | acpi_ex_out_integer("Reference Count", node->reference_count); |
568 | acpi_ex_out_pointer ("Attached Object", acpi_ns_get_attached_object (node)); | 512 | acpi_ex_out_pointer("Attached Object", |
569 | acpi_ex_out_pointer ("child_list", node->child); | 513 | acpi_ns_get_attached_object(node)); |
570 | acpi_ex_out_pointer ("next_peer", node->peer); | 514 | acpi_ex_out_pointer("child_list", node->child); |
571 | acpi_ex_out_pointer ("Parent", acpi_ns_get_parent_node (node)); | 515 | acpi_ex_out_pointer("next_peer", node->peer); |
516 | acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); | ||
572 | } | 517 | } |
573 | 518 | ||
574 | |||
575 | /******************************************************************************* | 519 | /******************************************************************************* |
576 | * | 520 | * |
577 | * FUNCTION: acpi_ex_dump_reference | 521 | * FUNCTION: acpi_ex_dump_reference |
@@ -582,32 +526,29 @@ acpi_ex_dump_node ( | |||
582 | * | 526 | * |
583 | ******************************************************************************/ | 527 | ******************************************************************************/ |
584 | 528 | ||
585 | static void | 529 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) |
586 | acpi_ex_dump_reference ( | ||
587 | union acpi_operand_object *obj_desc) | ||
588 | { | 530 | { |
589 | struct acpi_buffer ret_buf; | 531 | struct acpi_buffer ret_buf; |
590 | acpi_status status; | 532 | acpi_status status; |
591 | |||
592 | 533 | ||
593 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | 534 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { |
594 | acpi_os_printf ("Named Object %p ", obj_desc->reference.node); | 535 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); |
595 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 536 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
596 | status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf); | 537 | status = |
597 | if (ACPI_FAILURE (status)) { | 538 | acpi_ns_handle_to_pathname(obj_desc->reference.node, |
598 | acpi_os_printf ("Could not convert name to pathname\n"); | 539 | &ret_buf); |
540 | if (ACPI_FAILURE(status)) { | ||
541 | acpi_os_printf("Could not convert name to pathname\n"); | ||
542 | } else { | ||
543 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); | ||
544 | ACPI_MEM_FREE(ret_buf.pointer); | ||
599 | } | 545 | } |
600 | else { | 546 | } else if (obj_desc->reference.object) { |
601 | acpi_os_printf ("%s\n", (char *) ret_buf.pointer); | 547 | acpi_os_printf("\nReferenced Object: %p\n", |
602 | ACPI_MEM_FREE (ret_buf.pointer); | 548 | obj_desc->reference.object); |
603 | } | ||
604 | } | ||
605 | else if (obj_desc->reference.object) { | ||
606 | acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object); | ||
607 | } | 549 | } |
608 | } | 550 | } |
609 | 551 | ||
610 | |||
611 | /******************************************************************************* | 552 | /******************************************************************************* |
612 | * | 553 | * |
613 | * FUNCTION: acpi_ex_dump_package | 554 | * FUNCTION: acpi_ex_dump_package |
@@ -621,92 +562,85 @@ acpi_ex_dump_reference ( | |||
621 | ******************************************************************************/ | 562 | ******************************************************************************/ |
622 | 563 | ||
623 | static void | 564 | static void |
624 | acpi_ex_dump_package ( | 565 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) |
625 | union acpi_operand_object *obj_desc, | ||
626 | u32 level, | ||
627 | u32 index) | ||
628 | { | 566 | { |
629 | u32 i; | 567 | u32 i; |
630 | |||
631 | 568 | ||
632 | /* Indentation and index output */ | 569 | /* Indentation and index output */ |
633 | 570 | ||
634 | if (level > 0) { | 571 | if (level > 0) { |
635 | for (i = 0; i < level; i++) { | 572 | for (i = 0; i < level; i++) { |
636 | acpi_os_printf (" "); | 573 | acpi_os_printf(" "); |
637 | } | 574 | } |
638 | 575 | ||
639 | acpi_os_printf ("[%.2d] ", index); | 576 | acpi_os_printf("[%.2d] ", index); |
640 | } | 577 | } |
641 | 578 | ||
642 | acpi_os_printf ("%p ", obj_desc); | 579 | acpi_os_printf("%p ", obj_desc); |
643 | 580 | ||
644 | /* Null package elements are allowed */ | 581 | /* Null package elements are allowed */ |
645 | 582 | ||
646 | if (!obj_desc) { | 583 | if (!obj_desc) { |
647 | acpi_os_printf ("[Null Object]\n"); | 584 | acpi_os_printf("[Null Object]\n"); |
648 | return; | 585 | return; |
649 | } | 586 | } |
650 | 587 | ||
651 | /* Packages may only contain a few object types */ | 588 | /* Packages may only contain a few object types */ |
652 | 589 | ||
653 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 590 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
654 | case ACPI_TYPE_INTEGER: | 591 | case ACPI_TYPE_INTEGER: |
655 | 592 | ||
656 | acpi_os_printf ("[Integer] = %8.8X%8.8X\n", | 593 | acpi_os_printf("[Integer] = %8.8X%8.8X\n", |
657 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | 594 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); |
658 | break; | 595 | break; |
659 | 596 | ||
660 | |||
661 | case ACPI_TYPE_STRING: | 597 | case ACPI_TYPE_STRING: |
662 | 598 | ||
663 | acpi_os_printf ("[String] Value: "); | 599 | acpi_os_printf("[String] Value: "); |
664 | for (i = 0; i < obj_desc->string.length; i++) { | 600 | for (i = 0; i < obj_desc->string.length; i++) { |
665 | acpi_os_printf ("%c", obj_desc->string.pointer[i]); | 601 | acpi_os_printf("%c", obj_desc->string.pointer[i]); |
666 | } | 602 | } |
667 | acpi_os_printf ("\n"); | 603 | acpi_os_printf("\n"); |
668 | break; | 604 | break; |
669 | 605 | ||
670 | |||
671 | case ACPI_TYPE_BUFFER: | 606 | case ACPI_TYPE_BUFFER: |
672 | 607 | ||
673 | acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length); | 608 | acpi_os_printf("[Buffer] Length %.2X = ", |
609 | obj_desc->buffer.length); | ||
674 | if (obj_desc->buffer.length) { | 610 | if (obj_desc->buffer.length) { |
675 | acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, | 611 | acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, |
676 | obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT); | 612 | obj_desc->buffer.length, |
677 | } | 613 | DB_DWORD_DISPLAY, _COMPONENT); |
678 | else { | 614 | } else { |
679 | acpi_os_printf ("\n"); | 615 | acpi_os_printf("\n"); |
680 | } | 616 | } |
681 | break; | 617 | break; |
682 | 618 | ||
683 | |||
684 | case ACPI_TYPE_PACKAGE: | 619 | case ACPI_TYPE_PACKAGE: |
685 | 620 | ||
686 | acpi_os_printf ("[Package] Contains %d Elements: \n", | 621 | acpi_os_printf("[Package] Contains %d Elements: \n", |
687 | obj_desc->package.count); | 622 | obj_desc->package.count); |
688 | 623 | ||
689 | for (i = 0; i < obj_desc->package.count; i++) { | 624 | for (i = 0; i < obj_desc->package.count; i++) { |
690 | acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i); | 625 | acpi_ex_dump_package(obj_desc->package.elements[i], |
626 | level + 1, i); | ||
691 | } | 627 | } |
692 | break; | 628 | break; |
693 | 629 | ||
694 | |||
695 | case ACPI_TYPE_LOCAL_REFERENCE: | 630 | case ACPI_TYPE_LOCAL_REFERENCE: |
696 | 631 | ||
697 | acpi_os_printf ("[Object Reference] "); | 632 | acpi_os_printf("[Object Reference] "); |
698 | acpi_ex_dump_reference (obj_desc); | 633 | acpi_ex_dump_reference(obj_desc); |
699 | break; | 634 | break; |
700 | 635 | ||
701 | |||
702 | default: | 636 | default: |
703 | 637 | ||
704 | acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc)); | 638 | acpi_os_printf("[Unknown Type] %X\n", |
639 | ACPI_GET_OBJECT_TYPE(obj_desc)); | ||
705 | break; | 640 | break; |
706 | } | 641 | } |
707 | } | 642 | } |
708 | 643 | ||
709 | |||
710 | /******************************************************************************* | 644 | /******************************************************************************* |
711 | * | 645 | * |
712 | * FUNCTION: acpi_ex_dump_object_descriptor | 646 | * FUNCTION: acpi_ex_dump_object_descriptor |
@@ -719,190 +653,213 @@ acpi_ex_dump_package ( | |||
719 | ******************************************************************************/ | 653 | ******************************************************************************/ |
720 | 654 | ||
721 | void | 655 | void |
722 | acpi_ex_dump_object_descriptor ( | 656 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) |
723 | union acpi_operand_object *obj_desc, | ||
724 | u32 flags) | ||
725 | { | 657 | { |
726 | ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); | 658 | ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); |
727 | |||
728 | 659 | ||
729 | if (!obj_desc) { | 660 | if (!obj_desc) { |
730 | return_VOID; | 661 | return_VOID; |
731 | } | 662 | } |
732 | 663 | ||
733 | if (!flags) { | 664 | if (!flags) { |
734 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { | 665 | if (! |
666 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | ||
667 | && (_COMPONENT & acpi_dbg_layer))) { | ||
735 | return_VOID; | 668 | return_VOID; |
736 | } | 669 | } |
737 | } | 670 | } |
738 | 671 | ||
739 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | 672 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { |
740 | acpi_ex_dump_node ((struct acpi_namespace_node *) obj_desc, flags); | 673 | acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, |
741 | acpi_os_printf ("\nAttached Object (%p):\n", | 674 | flags); |
742 | ((struct acpi_namespace_node *) obj_desc)->object); | 675 | acpi_os_printf("\nAttached Object (%p):\n", |
743 | acpi_ex_dump_object_descriptor ( | 676 | ((struct acpi_namespace_node *)obj_desc)-> |
744 | ((struct acpi_namespace_node *) obj_desc)->object, flags); | 677 | object); |
678 | acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) | ||
679 | obj_desc)->object, flags); | ||
745 | return_VOID; | 680 | return_VOID; |
746 | } | 681 | } |
747 | 682 | ||
748 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 683 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
749 | acpi_os_printf ( | 684 | acpi_os_printf |
750 | "ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", | 685 | ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", |
751 | obj_desc, acpi_ut_get_descriptor_name (obj_desc)); | 686 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); |
752 | return_VOID; | 687 | return_VOID; |
753 | } | 688 | } |
754 | 689 | ||
755 | /* Common Fields */ | 690 | /* Common Fields */ |
756 | 691 | ||
757 | acpi_ex_out_string ("Type", acpi_ut_get_object_type_name (obj_desc)); | 692 | acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc)); |
758 | acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count); | 693 | acpi_ex_out_integer("Reference Count", |
759 | acpi_ex_out_integer ("Flags", obj_desc->common.flags); | 694 | obj_desc->common.reference_count); |
695 | acpi_ex_out_integer("Flags", obj_desc->common.flags); | ||
760 | 696 | ||
761 | /* Object-specific Fields */ | 697 | /* Object-specific Fields */ |
762 | 698 | ||
763 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 699 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
764 | case ACPI_TYPE_INTEGER: | 700 | case ACPI_TYPE_INTEGER: |
765 | 701 | ||
766 | acpi_os_printf ("%20s : %8.8X%8.8X\n", "Value", | 702 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", |
767 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | 703 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); |
768 | break; | 704 | break; |
769 | 705 | ||
770 | |||
771 | case ACPI_TYPE_STRING: | 706 | case ACPI_TYPE_STRING: |
772 | 707 | ||
773 | acpi_ex_out_integer ("Length", obj_desc->string.length); | 708 | acpi_ex_out_integer("Length", obj_desc->string.length); |
774 | 709 | ||
775 | acpi_os_printf ("%20s : %p ", "Pointer", obj_desc->string.pointer); | 710 | acpi_os_printf("%20s : %p ", "Pointer", |
776 | acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); | 711 | obj_desc->string.pointer); |
777 | acpi_os_printf ("\n"); | 712 | acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); |
713 | acpi_os_printf("\n"); | ||
778 | break; | 714 | break; |
779 | 715 | ||
780 | |||
781 | case ACPI_TYPE_BUFFER: | 716 | case ACPI_TYPE_BUFFER: |
782 | 717 | ||
783 | acpi_ex_out_integer ("Length", obj_desc->buffer.length); | 718 | acpi_ex_out_integer("Length", obj_desc->buffer.length); |
784 | acpi_ex_out_pointer ("Pointer", obj_desc->buffer.pointer); | 719 | acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer); |
785 | ACPI_DUMP_BUFFER (obj_desc->buffer.pointer, obj_desc->buffer.length); | 720 | ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, |
721 | obj_desc->buffer.length); | ||
786 | break; | 722 | break; |
787 | 723 | ||
788 | |||
789 | case ACPI_TYPE_PACKAGE: | 724 | case ACPI_TYPE_PACKAGE: |
790 | 725 | ||
791 | acpi_ex_out_integer ("Flags", obj_desc->package.flags); | 726 | acpi_ex_out_integer("Flags", obj_desc->package.flags); |
792 | acpi_ex_out_integer ("Elements", obj_desc->package.count); | 727 | acpi_ex_out_integer("Elements", obj_desc->package.count); |
793 | acpi_ex_out_pointer ("Element List", obj_desc->package.elements); | 728 | acpi_ex_out_pointer("Element List", obj_desc->package.elements); |
794 | 729 | ||
795 | /* Dump the package contents */ | 730 | /* Dump the package contents */ |
796 | 731 | ||
797 | acpi_os_printf ("\nPackage Contents:\n"); | 732 | acpi_os_printf("\nPackage Contents:\n"); |
798 | acpi_ex_dump_package (obj_desc, 0, 0); | 733 | acpi_ex_dump_package(obj_desc, 0, 0); |
799 | break; | 734 | break; |
800 | 735 | ||
801 | |||
802 | case ACPI_TYPE_DEVICE: | 736 | case ACPI_TYPE_DEVICE: |
803 | 737 | ||
804 | acpi_ex_out_pointer ("Handler", obj_desc->device.handler); | 738 | acpi_ex_out_pointer("Handler", obj_desc->device.handler); |
805 | acpi_ex_out_pointer ("system_notify", obj_desc->device.system_notify); | 739 | acpi_ex_out_pointer("system_notify", |
806 | acpi_ex_out_pointer ("device_notify", obj_desc->device.device_notify); | 740 | obj_desc->device.system_notify); |
741 | acpi_ex_out_pointer("device_notify", | ||
742 | obj_desc->device.device_notify); | ||
807 | break; | 743 | break; |
808 | 744 | ||
809 | |||
810 | case ACPI_TYPE_EVENT: | 745 | case ACPI_TYPE_EVENT: |
811 | 746 | ||
812 | acpi_ex_out_pointer ("Semaphore", obj_desc->event.semaphore); | 747 | acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore); |
813 | break; | 748 | break; |
814 | 749 | ||
815 | |||
816 | case ACPI_TYPE_METHOD: | 750 | case ACPI_TYPE_METHOD: |
817 | 751 | ||
818 | acpi_ex_out_integer ("param_count", obj_desc->method.param_count); | 752 | acpi_ex_out_integer("param_count", |
819 | acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); | 753 | obj_desc->method.param_count); |
820 | acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); | 754 | acpi_ex_out_integer("Concurrency", |
821 | acpi_ex_out_integer ("owner_id", obj_desc->method.owner_id); | 755 | obj_desc->method.concurrency); |
822 | acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); | 756 | acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore); |
823 | acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); | 757 | acpi_ex_out_integer("owner_id", obj_desc->method.owner_id); |
758 | acpi_ex_out_integer("aml_length", obj_desc->method.aml_length); | ||
759 | acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start); | ||
824 | break; | 760 | break; |
825 | 761 | ||
826 | |||
827 | case ACPI_TYPE_MUTEX: | 762 | case ACPI_TYPE_MUTEX: |
828 | 763 | ||
829 | acpi_ex_out_integer ("sync_level", obj_desc->mutex.sync_level); | 764 | acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level); |
830 | acpi_ex_out_pointer ("owner_thread", obj_desc->mutex.owner_thread); | 765 | acpi_ex_out_pointer("owner_thread", |
831 | acpi_ex_out_integer ("acquire_depth", obj_desc->mutex.acquisition_depth); | 766 | obj_desc->mutex.owner_thread); |
832 | acpi_ex_out_pointer ("Semaphore", obj_desc->mutex.semaphore); | 767 | acpi_ex_out_integer("acquire_depth", |
768 | obj_desc->mutex.acquisition_depth); | ||
769 | acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore); | ||
833 | break; | 770 | break; |
834 | 771 | ||
835 | |||
836 | case ACPI_TYPE_REGION: | 772 | case ACPI_TYPE_REGION: |
837 | 773 | ||
838 | acpi_ex_out_integer ("space_id", obj_desc->region.space_id); | 774 | acpi_ex_out_integer("space_id", obj_desc->region.space_id); |
839 | acpi_ex_out_integer ("Flags", obj_desc->region.flags); | 775 | acpi_ex_out_integer("Flags", obj_desc->region.flags); |
840 | acpi_ex_out_address ("Address", obj_desc->region.address); | 776 | acpi_ex_out_address("Address", obj_desc->region.address); |
841 | acpi_ex_out_integer ("Length", obj_desc->region.length); | 777 | acpi_ex_out_integer("Length", obj_desc->region.length); |
842 | acpi_ex_out_pointer ("Handler", obj_desc->region.handler); | 778 | acpi_ex_out_pointer("Handler", obj_desc->region.handler); |
843 | acpi_ex_out_pointer ("Next", obj_desc->region.next); | 779 | acpi_ex_out_pointer("Next", obj_desc->region.next); |
844 | break; | 780 | break; |
845 | 781 | ||
846 | |||
847 | case ACPI_TYPE_POWER: | 782 | case ACPI_TYPE_POWER: |
848 | 783 | ||
849 | acpi_ex_out_integer ("system_level", obj_desc->power_resource.system_level); | 784 | acpi_ex_out_integer("system_level", |
850 | acpi_ex_out_integer ("resource_order", obj_desc->power_resource.resource_order); | 785 | obj_desc->power_resource.system_level); |
851 | acpi_ex_out_pointer ("system_notify", obj_desc->power_resource.system_notify); | 786 | acpi_ex_out_integer("resource_order", |
852 | acpi_ex_out_pointer ("device_notify", obj_desc->power_resource.device_notify); | 787 | obj_desc->power_resource.resource_order); |
788 | acpi_ex_out_pointer("system_notify", | ||
789 | obj_desc->power_resource.system_notify); | ||
790 | acpi_ex_out_pointer("device_notify", | ||
791 | obj_desc->power_resource.device_notify); | ||
853 | break; | 792 | break; |
854 | 793 | ||
855 | |||
856 | case ACPI_TYPE_PROCESSOR: | 794 | case ACPI_TYPE_PROCESSOR: |
857 | 795 | ||
858 | acpi_ex_out_integer ("Processor ID", obj_desc->processor.proc_id); | 796 | acpi_ex_out_integer("Processor ID", |
859 | acpi_ex_out_integer ("Length", obj_desc->processor.length); | 797 | obj_desc->processor.proc_id); |
860 | acpi_ex_out_address ("Address", (acpi_physical_address) obj_desc->processor.address); | 798 | acpi_ex_out_integer("Length", obj_desc->processor.length); |
861 | acpi_ex_out_pointer ("system_notify", obj_desc->processor.system_notify); | 799 | acpi_ex_out_address("Address", |
862 | acpi_ex_out_pointer ("device_notify", obj_desc->processor.device_notify); | 800 | (acpi_physical_address) obj_desc->processor. |
863 | acpi_ex_out_pointer ("Handler", obj_desc->processor.handler); | 801 | address); |
802 | acpi_ex_out_pointer("system_notify", | ||
803 | obj_desc->processor.system_notify); | ||
804 | acpi_ex_out_pointer("device_notify", | ||
805 | obj_desc->processor.device_notify); | ||
806 | acpi_ex_out_pointer("Handler", obj_desc->processor.handler); | ||
864 | break; | 807 | break; |
865 | 808 | ||
866 | |||
867 | case ACPI_TYPE_THERMAL: | 809 | case ACPI_TYPE_THERMAL: |
868 | 810 | ||
869 | acpi_ex_out_pointer ("system_notify", obj_desc->thermal_zone.system_notify); | 811 | acpi_ex_out_pointer("system_notify", |
870 | acpi_ex_out_pointer ("device_notify", obj_desc->thermal_zone.device_notify); | 812 | obj_desc->thermal_zone.system_notify); |
871 | acpi_ex_out_pointer ("Handler", obj_desc->thermal_zone.handler); | 813 | acpi_ex_out_pointer("device_notify", |
814 | obj_desc->thermal_zone.device_notify); | ||
815 | acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler); | ||
872 | break; | 816 | break; |
873 | 817 | ||
874 | |||
875 | case ACPI_TYPE_BUFFER_FIELD: | 818 | case ACPI_TYPE_BUFFER_FIELD: |
876 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 819 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
877 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 820 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
878 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 821 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
879 | 822 | ||
880 | acpi_ex_out_integer ("field_flags", obj_desc->common_field.field_flags); | 823 | acpi_ex_out_integer("field_flags", |
881 | acpi_ex_out_integer ("access_byte_width",obj_desc->common_field.access_byte_width); | 824 | obj_desc->common_field.field_flags); |
882 | acpi_ex_out_integer ("bit_length", obj_desc->common_field.bit_length); | 825 | acpi_ex_out_integer("access_byte_width", |
883 | acpi_ex_out_integer ("fld_bit_offset", obj_desc->common_field.start_field_bit_offset); | 826 | obj_desc->common_field.access_byte_width); |
884 | acpi_ex_out_integer ("base_byte_offset", obj_desc->common_field.base_byte_offset); | 827 | acpi_ex_out_integer("bit_length", |
885 | acpi_ex_out_pointer ("parent_node", obj_desc->common_field.node); | 828 | obj_desc->common_field.bit_length); |
886 | 829 | acpi_ex_out_integer("fld_bit_offset", | |
887 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 830 | obj_desc->common_field. |
831 | start_field_bit_offset); | ||
832 | acpi_ex_out_integer("base_byte_offset", | ||
833 | obj_desc->common_field.base_byte_offset); | ||
834 | acpi_ex_out_pointer("parent_node", obj_desc->common_field.node); | ||
835 | |||
836 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | ||
888 | case ACPI_TYPE_BUFFER_FIELD: | 837 | case ACPI_TYPE_BUFFER_FIELD: |
889 | acpi_ex_out_pointer ("buffer_obj", obj_desc->buffer_field.buffer_obj); | 838 | acpi_ex_out_pointer("buffer_obj", |
839 | obj_desc->buffer_field.buffer_obj); | ||
890 | break; | 840 | break; |
891 | 841 | ||
892 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 842 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
893 | acpi_ex_out_pointer ("region_obj", obj_desc->field.region_obj); | 843 | acpi_ex_out_pointer("region_obj", |
844 | obj_desc->field.region_obj); | ||
894 | break; | 845 | break; |
895 | 846 | ||
896 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 847 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
897 | acpi_ex_out_integer ("Value", obj_desc->bank_field.value); | 848 | acpi_ex_out_integer("Value", |
898 | acpi_ex_out_pointer ("region_obj", obj_desc->bank_field.region_obj); | 849 | obj_desc->bank_field.value); |
899 | acpi_ex_out_pointer ("bank_obj", obj_desc->bank_field.bank_obj); | 850 | acpi_ex_out_pointer("region_obj", |
851 | obj_desc->bank_field.region_obj); | ||
852 | acpi_ex_out_pointer("bank_obj", | ||
853 | obj_desc->bank_field.bank_obj); | ||
900 | break; | 854 | break; |
901 | 855 | ||
902 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 856 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
903 | acpi_ex_out_integer ("Value", obj_desc->index_field.value); | 857 | acpi_ex_out_integer("Value", |
904 | acpi_ex_out_pointer ("Index", obj_desc->index_field.index_obj); | 858 | obj_desc->index_field.value); |
905 | acpi_ex_out_pointer ("Data", obj_desc->index_field.data_obj); | 859 | acpi_ex_out_pointer("Index", |
860 | obj_desc->index_field.index_obj); | ||
861 | acpi_ex_out_pointer("Data", | ||
862 | obj_desc->index_field.data_obj); | ||
906 | break; | 863 | break; |
907 | 864 | ||
908 | default: | 865 | default: |
@@ -911,53 +868,52 @@ acpi_ex_dump_object_descriptor ( | |||
911 | } | 868 | } |
912 | break; | 869 | break; |
913 | 870 | ||
914 | |||
915 | case ACPI_TYPE_LOCAL_REFERENCE: | 871 | case ACPI_TYPE_LOCAL_REFERENCE: |
916 | 872 | ||
917 | acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); | 873 | acpi_ex_out_integer("target_type", |
918 | acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info ( | 874 | obj_desc->reference.target_type); |
919 | obj_desc->reference.opcode))->name); | 875 | acpi_ex_out_string("Opcode", |
920 | acpi_ex_out_integer ("Offset", obj_desc->reference.offset); | 876 | (acpi_ps_get_opcode_info |
921 | acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); | 877 | (obj_desc->reference.opcode))->name); |
922 | acpi_ex_out_pointer ("Node", obj_desc->reference.node); | 878 | acpi_ex_out_integer("Offset", obj_desc->reference.offset); |
923 | acpi_ex_out_pointer ("Where", obj_desc->reference.where); | 879 | acpi_ex_out_pointer("obj_desc", obj_desc->reference.object); |
880 | acpi_ex_out_pointer("Node", obj_desc->reference.node); | ||
881 | acpi_ex_out_pointer("Where", obj_desc->reference.where); | ||
924 | 882 | ||
925 | acpi_ex_dump_reference (obj_desc); | 883 | acpi_ex_dump_reference(obj_desc); |
926 | break; | 884 | break; |
927 | 885 | ||
928 | |||
929 | case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: | 886 | case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: |
930 | 887 | ||
931 | acpi_ex_out_integer ("space_id", obj_desc->address_space.space_id); | 888 | acpi_ex_out_integer("space_id", |
932 | acpi_ex_out_pointer ("Next", obj_desc->address_space.next); | 889 | obj_desc->address_space.space_id); |
933 | acpi_ex_out_pointer ("region_list", obj_desc->address_space.region_list); | 890 | acpi_ex_out_pointer("Next", obj_desc->address_space.next); |
934 | acpi_ex_out_pointer ("Node", obj_desc->address_space.node); | 891 | acpi_ex_out_pointer("region_list", |
935 | acpi_ex_out_pointer ("Context", obj_desc->address_space.context); | 892 | obj_desc->address_space.region_list); |
893 | acpi_ex_out_pointer("Node", obj_desc->address_space.node); | ||
894 | acpi_ex_out_pointer("Context", obj_desc->address_space.context); | ||
936 | break; | 895 | break; |
937 | 896 | ||
938 | |||
939 | case ACPI_TYPE_LOCAL_NOTIFY: | 897 | case ACPI_TYPE_LOCAL_NOTIFY: |
940 | 898 | ||
941 | acpi_ex_out_pointer ("Node", obj_desc->notify.node); | 899 | acpi_ex_out_pointer("Node", obj_desc->notify.node); |
942 | acpi_ex_out_pointer ("Context", obj_desc->notify.context); | 900 | acpi_ex_out_pointer("Context", obj_desc->notify.context); |
943 | break; | 901 | break; |
944 | 902 | ||
945 | |||
946 | case ACPI_TYPE_LOCAL_ALIAS: | 903 | case ACPI_TYPE_LOCAL_ALIAS: |
947 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | 904 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: |
948 | case ACPI_TYPE_LOCAL_EXTRA: | 905 | case ACPI_TYPE_LOCAL_EXTRA: |
949 | case ACPI_TYPE_LOCAL_DATA: | 906 | case ACPI_TYPE_LOCAL_DATA: |
950 | default: | 907 | default: |
951 | 908 | ||
952 | acpi_os_printf ( | 909 | acpi_os_printf |
953 | "ex_dump_object_descriptor: Display not implemented for object type %s\n", | 910 | ("ex_dump_object_descriptor: Display not implemented for object type %s\n", |
954 | acpi_ut_get_object_type_name (obj_desc)); | 911 | acpi_ut_get_object_type_name(obj_desc)); |
955 | break; | 912 | break; |
956 | } | 913 | } |
957 | 914 | ||
958 | return_VOID; | 915 | return_VOID; |
959 | } | 916 | } |
960 | 917 | ||
961 | #endif /* ACPI_FUTURE_USAGE */ | 918 | #endif /* ACPI_FUTURE_USAGE */ |
962 | #endif | 919 | #endif |
963 | |||
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index a690c9250990..ab1ba399aa28 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -41,15 +41,12 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acdispat.h> | 45 | #include <acpi/acdispat.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exfield") | 49 | ACPI_MODULE_NAME("exfield") |
52 | |||
53 | 50 | ||
54 | /******************************************************************************* | 51 | /******************************************************************************* |
55 | * | 52 | * |
@@ -65,67 +62,70 @@ | |||
65 | * Buffer, depending on the size of the field. | 62 | * Buffer, depending on the size of the field. |
66 | * | 63 | * |
67 | ******************************************************************************/ | 64 | ******************************************************************************/ |
68 | |||
69 | acpi_status | 65 | acpi_status |
70 | acpi_ex_read_data_from_field ( | 66 | acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, |
71 | struct acpi_walk_state *walk_state, | 67 | union acpi_operand_object *obj_desc, |
72 | union acpi_operand_object *obj_desc, | 68 | union acpi_operand_object **ret_buffer_desc) |
73 | union acpi_operand_object **ret_buffer_desc) | ||
74 | { | 69 | { |
75 | acpi_status status; | 70 | acpi_status status; |
76 | union acpi_operand_object *buffer_desc; | 71 | union acpi_operand_object *buffer_desc; |
77 | acpi_size length; | 72 | acpi_size length; |
78 | void *buffer; | 73 | void *buffer; |
79 | u8 locked; | 74 | u8 locked; |
80 | |||
81 | |||
82 | ACPI_FUNCTION_TRACE_PTR ("ex_read_data_from_field", obj_desc); | ||
83 | 75 | ||
76 | ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc); | ||
84 | 77 | ||
85 | /* Parameter validation */ | 78 | /* Parameter validation */ |
86 | 79 | ||
87 | if (!obj_desc) { | 80 | if (!obj_desc) { |
88 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 81 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
89 | } | 82 | } |
90 | if (!ret_buffer_desc) { | 83 | if (!ret_buffer_desc) { |
91 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 84 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
92 | } | 85 | } |
93 | 86 | ||
94 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { | 87 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { |
95 | /* | 88 | /* |
96 | * If the buffer_field arguments have not been previously evaluated, | 89 | * If the buffer_field arguments have not been previously evaluated, |
97 | * evaluate them now and save the results. | 90 | * evaluate them now and save the results. |
98 | */ | 91 | */ |
99 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { | 92 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { |
100 | status = acpi_ds_get_buffer_field_arguments (obj_desc); | 93 | status = acpi_ds_get_buffer_field_arguments(obj_desc); |
101 | if (ACPI_FAILURE (status)) { | 94 | if (ACPI_FAILURE(status)) { |
102 | return_ACPI_STATUS (status); | 95 | return_ACPI_STATUS(status); |
103 | } | 96 | } |
104 | } | 97 | } |
105 | } | 98 | } else |
106 | else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) && | 99 | if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) |
107 | (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) { | 100 | && (obj_desc->field.region_obj->region.space_id == |
101 | ACPI_ADR_SPACE_SMBUS)) { | ||
108 | /* | 102 | /* |
109 | * This is an SMBus read. We must create a buffer to hold the data | 103 | * This is an SMBus read. We must create a buffer to hold the data |
110 | * and directly access the region handler. | 104 | * and directly access the region handler. |
111 | */ | 105 | */ |
112 | buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE); | 106 | buffer_desc = |
107 | acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); | ||
113 | if (!buffer_desc) { | 108 | if (!buffer_desc) { |
114 | return_ACPI_STATUS (AE_NO_MEMORY); | 109 | return_ACPI_STATUS(AE_NO_MEMORY); |
115 | } | 110 | } |
116 | 111 | ||
117 | /* Lock entire transaction if requested */ | 112 | /* Lock entire transaction if requested */ |
118 | 113 | ||
119 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); | 114 | locked = |
115 | acpi_ex_acquire_global_lock(obj_desc->common_field. | ||
116 | field_flags); | ||
120 | 117 | ||
121 | /* | 118 | /* |
122 | * Perform the read. | 119 | * Perform the read. |
123 | * Note: Smbus protocol value is passed in upper 16-bits of Function | 120 | * Note: Smbus protocol value is passed in upper 16-bits of Function |
124 | */ | 121 | */ |
125 | status = acpi_ex_access_region (obj_desc, 0, | 122 | status = acpi_ex_access_region(obj_desc, 0, |
126 | ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), | 123 | ACPI_CAST_PTR(acpi_integer, |
127 | ACPI_READ | (obj_desc->field.attribute << 16)); | 124 | buffer_desc-> |
128 | acpi_ex_release_global_lock (locked); | 125 | buffer.pointer), |
126 | ACPI_READ | (obj_desc->field. | ||
127 | attribute << 16)); | ||
128 | acpi_ex_release_global_lock(locked); | ||
129 | goto exit; | 129 | goto exit; |
130 | } | 130 | } |
131 | 131 | ||
@@ -139,22 +139,22 @@ acpi_ex_read_data_from_field ( | |||
139 | * | 139 | * |
140 | * Note: Field.length is in bits. | 140 | * Note: Field.length is in bits. |
141 | */ | 141 | */ |
142 | length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length); | 142 | length = |
143 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); | ||
143 | if (length > acpi_gbl_integer_byte_width) { | 144 | if (length > acpi_gbl_integer_byte_width) { |
144 | /* Field is too large for an Integer, create a Buffer instead */ | 145 | /* Field is too large for an Integer, create a Buffer instead */ |
145 | 146 | ||
146 | buffer_desc = acpi_ut_create_buffer_object (length); | 147 | buffer_desc = acpi_ut_create_buffer_object(length); |
147 | if (!buffer_desc) { | 148 | if (!buffer_desc) { |
148 | return_ACPI_STATUS (AE_NO_MEMORY); | 149 | return_ACPI_STATUS(AE_NO_MEMORY); |
149 | } | 150 | } |
150 | buffer = buffer_desc->buffer.pointer; | 151 | buffer = buffer_desc->buffer.pointer; |
151 | } | 152 | } else { |
152 | else { | ||
153 | /* Field will fit within an Integer (normal case) */ | 153 | /* Field will fit within an Integer (normal case) */ |
154 | 154 | ||
155 | buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 155 | buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
156 | if (!buffer_desc) { | 156 | if (!buffer_desc) { |
157 | return_ACPI_STATUS (AE_NO_MEMORY); | 157 | return_ACPI_STATUS(AE_NO_MEMORY); |
158 | } | 158 | } |
159 | 159 | ||
160 | length = acpi_gbl_integer_byte_width; | 160 | length = acpi_gbl_integer_byte_width; |
@@ -162,37 +162,36 @@ acpi_ex_read_data_from_field ( | |||
162 | buffer = &buffer_desc->integer.value; | 162 | buffer = &buffer_desc->integer.value; |
163 | } | 163 | } |
164 | 164 | ||
165 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 165 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
166 | "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", | 166 | "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", |
167 | obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length)); | 167 | obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, |
168 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 168 | (u32) length)); |
169 | "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", | 169 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
170 | obj_desc->common_field.bit_length, | 170 | "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", |
171 | obj_desc->common_field.start_field_bit_offset, | 171 | obj_desc->common_field.bit_length, |
172 | obj_desc->common_field.base_byte_offset)); | 172 | obj_desc->common_field.start_field_bit_offset, |
173 | obj_desc->common_field.base_byte_offset)); | ||
173 | 174 | ||
174 | /* Lock entire transaction if requested */ | 175 | /* Lock entire transaction if requested */ |
175 | 176 | ||
176 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); | 177 | locked = |
178 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
177 | 179 | ||
178 | /* Read from the field */ | 180 | /* Read from the field */ |
179 | 181 | ||
180 | status = acpi_ex_extract_from_field (obj_desc, buffer, (u32) length); | 182 | status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); |
181 | acpi_ex_release_global_lock (locked); | 183 | acpi_ex_release_global_lock(locked); |
182 | |||
183 | 184 | ||
184 | exit: | 185 | exit: |
185 | if (ACPI_FAILURE (status)) { | 186 | if (ACPI_FAILURE(status)) { |
186 | acpi_ut_remove_reference (buffer_desc); | 187 | acpi_ut_remove_reference(buffer_desc); |
187 | } | 188 | } else { |
188 | else { | ||
189 | *ret_buffer_desc = buffer_desc; | 189 | *ret_buffer_desc = buffer_desc; |
190 | } | 190 | } |
191 | 191 | ||
192 | return_ACPI_STATUS (status); | 192 | return_ACPI_STATUS(status); |
193 | } | 193 | } |
194 | 194 | ||
195 | |||
196 | /******************************************************************************* | 195 | /******************************************************************************* |
197 | * | 196 | * |
198 | * FUNCTION: acpi_ex_write_data_to_field | 197 | * FUNCTION: acpi_ex_write_data_to_field |
@@ -208,97 +207,96 @@ exit: | |||
208 | ******************************************************************************/ | 207 | ******************************************************************************/ |
209 | 208 | ||
210 | acpi_status | 209 | acpi_status |
211 | acpi_ex_write_data_to_field ( | 210 | acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, |
212 | union acpi_operand_object *source_desc, | 211 | union acpi_operand_object *obj_desc, |
213 | union acpi_operand_object *obj_desc, | 212 | union acpi_operand_object **result_desc) |
214 | union acpi_operand_object **result_desc) | ||
215 | { | 213 | { |
216 | acpi_status status; | 214 | acpi_status status; |
217 | u32 length; | 215 | u32 length; |
218 | u32 required_length; | 216 | u32 required_length; |
219 | void *buffer; | 217 | void *buffer; |
220 | void *new_buffer; | 218 | void *new_buffer; |
221 | u8 locked; | 219 | u8 locked; |
222 | union acpi_operand_object *buffer_desc; | 220 | union acpi_operand_object *buffer_desc; |
223 | |||
224 | |||
225 | ACPI_FUNCTION_TRACE_PTR ("ex_write_data_to_field", obj_desc); | ||
226 | 221 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc); | ||
227 | 223 | ||
228 | /* Parameter validation */ | 224 | /* Parameter validation */ |
229 | 225 | ||
230 | if (!source_desc || !obj_desc) { | 226 | if (!source_desc || !obj_desc) { |
231 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 227 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
232 | } | 228 | } |
233 | 229 | ||
234 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { | 230 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { |
235 | /* | 231 | /* |
236 | * If the buffer_field arguments have not been previously evaluated, | 232 | * If the buffer_field arguments have not been previously evaluated, |
237 | * evaluate them now and save the results. | 233 | * evaluate them now and save the results. |
238 | */ | 234 | */ |
239 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { | 235 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { |
240 | status = acpi_ds_get_buffer_field_arguments (obj_desc); | 236 | status = acpi_ds_get_buffer_field_arguments(obj_desc); |
241 | if (ACPI_FAILURE (status)) { | 237 | if (ACPI_FAILURE(status)) { |
242 | return_ACPI_STATUS (status); | 238 | return_ACPI_STATUS(status); |
243 | } | 239 | } |
244 | } | 240 | } |
245 | } | 241 | } else |
246 | else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) && | 242 | if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) |
247 | (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) { | 243 | && (obj_desc->field.region_obj->region.space_id == |
244 | ACPI_ADR_SPACE_SMBUS)) { | ||
248 | /* | 245 | /* |
249 | * This is an SMBus write. We will bypass the entire field mechanism | 246 | * This is an SMBus write. We will bypass the entire field mechanism |
250 | * and handoff the buffer directly to the handler. | 247 | * and handoff the buffer directly to the handler. |
251 | * | 248 | * |
252 | * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). | 249 | * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). |
253 | */ | 250 | */ |
254 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { | 251 | if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { |
255 | ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", | 252 | ACPI_REPORT_ERROR(("SMBus write requires Buffer, found type %s\n", acpi_ut_get_object_type_name(source_desc))); |
256 | acpi_ut_get_object_type_name (source_desc))); | ||
257 | 253 | ||
258 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 254 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
259 | } | 255 | } |
260 | 256 | ||
261 | if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { | 257 | if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { |
262 | ACPI_REPORT_ERROR (( | 258 | ACPI_REPORT_ERROR(("SMBus write requires Buffer of length %X, found length %X\n", ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); |
263 | "SMBus write requires Buffer of length %X, found length %X\n", | ||
264 | ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); | ||
265 | 259 | ||
266 | return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); | 260 | return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); |
267 | } | 261 | } |
268 | 262 | ||
269 | buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE); | 263 | buffer_desc = |
264 | acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); | ||
270 | if (!buffer_desc) { | 265 | if (!buffer_desc) { |
271 | return_ACPI_STATUS (AE_NO_MEMORY); | 266 | return_ACPI_STATUS(AE_NO_MEMORY); |
272 | } | 267 | } |
273 | 268 | ||
274 | buffer = buffer_desc->buffer.pointer; | 269 | buffer = buffer_desc->buffer.pointer; |
275 | ACPI_MEMCPY (buffer, source_desc->buffer.pointer, | 270 | ACPI_MEMCPY(buffer, source_desc->buffer.pointer, |
276 | ACPI_SMBUS_BUFFER_SIZE); | 271 | ACPI_SMBUS_BUFFER_SIZE); |
277 | 272 | ||
278 | /* Lock entire transaction if requested */ | 273 | /* Lock entire transaction if requested */ |
279 | 274 | ||
280 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); | 275 | locked = |
276 | acpi_ex_acquire_global_lock(obj_desc->common_field. | ||
277 | field_flags); | ||
281 | 278 | ||
282 | /* | 279 | /* |
283 | * Perform the write (returns status and perhaps data in the | 280 | * Perform the write (returns status and perhaps data in the |
284 | * same buffer) | 281 | * same buffer) |
285 | * Note: SMBus protocol type is passed in upper 16-bits of Function. | 282 | * Note: SMBus protocol type is passed in upper 16-bits of Function. |
286 | */ | 283 | */ |
287 | status = acpi_ex_access_region (obj_desc, 0, | 284 | status = acpi_ex_access_region(obj_desc, 0, |
288 | (acpi_integer *) buffer, | 285 | (acpi_integer *) buffer, |
289 | ACPI_WRITE | (obj_desc->field.attribute << 16)); | 286 | ACPI_WRITE | (obj_desc->field. |
290 | acpi_ex_release_global_lock (locked); | 287 | attribute << 16)); |
288 | acpi_ex_release_global_lock(locked); | ||
291 | 289 | ||
292 | *result_desc = buffer_desc; | 290 | *result_desc = buffer_desc; |
293 | return_ACPI_STATUS (status); | 291 | return_ACPI_STATUS(status); |
294 | } | 292 | } |
295 | 293 | ||
296 | /* Get a pointer to the data to be written */ | 294 | /* Get a pointer to the data to be written */ |
297 | 295 | ||
298 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | 296 | switch (ACPI_GET_OBJECT_TYPE(source_desc)) { |
299 | case ACPI_TYPE_INTEGER: | 297 | case ACPI_TYPE_INTEGER: |
300 | buffer = &source_desc->integer.value; | 298 | buffer = &source_desc->integer.value; |
301 | length = sizeof (source_desc->integer.value); | 299 | length = sizeof(source_desc->integer.value); |
302 | break; | 300 | break; |
303 | 301 | ||
304 | case ACPI_TYPE_BUFFER: | 302 | case ACPI_TYPE_BUFFER: |
@@ -312,7 +310,7 @@ acpi_ex_write_data_to_field ( | |||
312 | break; | 310 | break; |
313 | 311 | ||
314 | default: | 312 | default: |
315 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 313 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
316 | } | 314 | } |
317 | 315 | ||
318 | /* | 316 | /* |
@@ -322,15 +320,15 @@ acpi_ex_write_data_to_field ( | |||
322 | * the ACPI specification. | 320 | * the ACPI specification. |
323 | */ | 321 | */ |
324 | new_buffer = NULL; | 322 | new_buffer = NULL; |
325 | required_length = ACPI_ROUND_BITS_UP_TO_BYTES ( | 323 | required_length = |
326 | obj_desc->common_field.bit_length); | 324 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); |
327 | 325 | ||
328 | if (length < required_length) { | 326 | if (length < required_length) { |
329 | /* We need to create a new buffer */ | 327 | /* We need to create a new buffer */ |
330 | 328 | ||
331 | new_buffer = ACPI_MEM_CALLOCATE (required_length); | 329 | new_buffer = ACPI_MEM_CALLOCATE(required_length); |
332 | if (!new_buffer) { | 330 | if (!new_buffer) { |
333 | return_ACPI_STATUS (AE_NO_MEMORY); | 331 | return_ACPI_STATUS(AE_NO_MEMORY); |
334 | } | 332 | } |
335 | 333 | ||
336 | /* | 334 | /* |
@@ -338,40 +336,42 @@ acpi_ex_write_data_to_field ( | |||
338 | * at Byte zero. All unused (upper) bytes of the | 336 | * at Byte zero. All unused (upper) bytes of the |
339 | * buffer will be 0. | 337 | * buffer will be 0. |
340 | */ | 338 | */ |
341 | ACPI_MEMCPY ((char *) new_buffer, (char *) buffer, length); | 339 | ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length); |
342 | buffer = new_buffer; | 340 | buffer = new_buffer; |
343 | length = required_length; | 341 | length = required_length; |
344 | } | 342 | } |
345 | 343 | ||
346 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 344 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
347 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", | 345 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", |
348 | source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), | 346 | source_desc, |
349 | ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); | 347 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE |
350 | 348 | (source_desc)), | |
351 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 349 | ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); |
352 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", | 350 | |
353 | obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), | 351 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
354 | ACPI_GET_OBJECT_TYPE (obj_desc), | 352 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", |
355 | obj_desc->common_field.bit_length, | 353 | obj_desc, |
356 | obj_desc->common_field.start_field_bit_offset, | 354 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), |
357 | obj_desc->common_field.base_byte_offset)); | 355 | ACPI_GET_OBJECT_TYPE(obj_desc), |
356 | obj_desc->common_field.bit_length, | ||
357 | obj_desc->common_field.start_field_bit_offset, | ||
358 | obj_desc->common_field.base_byte_offset)); | ||
358 | 359 | ||
359 | /* Lock entire transaction if requested */ | 360 | /* Lock entire transaction if requested */ |
360 | 361 | ||
361 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); | 362 | locked = |
363 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
362 | 364 | ||
363 | /* Write to the field */ | 365 | /* Write to the field */ |
364 | 366 | ||
365 | status = acpi_ex_insert_into_field (obj_desc, buffer, length); | 367 | status = acpi_ex_insert_into_field(obj_desc, buffer, length); |
366 | acpi_ex_release_global_lock (locked); | 368 | acpi_ex_release_global_lock(locked); |
367 | 369 | ||
368 | /* Free temporary buffer if we used one */ | 370 | /* Free temporary buffer if we used one */ |
369 | 371 | ||
370 | if (new_buffer) { | 372 | if (new_buffer) { |
371 | ACPI_MEM_FREE (new_buffer); | 373 | ACPI_MEM_FREE(new_buffer); |
372 | } | 374 | } |
373 | 375 | ||
374 | return_ACPI_STATUS (status); | 376 | return_ACPI_STATUS(status); |
375 | } | 377 | } |
376 | |||
377 | |||
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 3c2f89e00f78..ba6e08843c29 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -41,36 +41,28 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | #include <acpi/acevents.h> | 47 | #include <acpi/acevents.h> |
49 | #include <acpi/acdispat.h> | 48 | #include <acpi/acdispat.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exfldio") | 51 | ACPI_MODULE_NAME("exfldio") |
54 | 52 | ||
55 | /* Local prototypes */ | 53 | /* Local prototypes */ |
56 | |||
57 | static acpi_status | 54 | static acpi_status |
58 | acpi_ex_field_datum_io ( | 55 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, |
59 | union acpi_operand_object *obj_desc, | 56 | u32 field_datum_byte_offset, |
60 | u32 field_datum_byte_offset, | 57 | acpi_integer * value, u32 read_write); |
61 | acpi_integer *value, | ||
62 | u32 read_write); | ||
63 | 58 | ||
64 | static u8 | 59 | static u8 |
65 | acpi_ex_register_overflow ( | 60 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, |
66 | union acpi_operand_object *obj_desc, | 61 | acpi_integer value); |
67 | acpi_integer value); | ||
68 | 62 | ||
69 | static acpi_status | 63 | static acpi_status |
70 | acpi_ex_setup_region ( | 64 | acpi_ex_setup_region(union acpi_operand_object *obj_desc, |
71 | union acpi_operand_object *obj_desc, | 65 | u32 field_datum_byte_offset); |
72 | u32 field_datum_byte_offset); | ||
73 | |||
74 | 66 | ||
75 | /******************************************************************************* | 67 | /******************************************************************************* |
76 | * | 68 | * |
@@ -89,27 +81,25 @@ acpi_ex_setup_region ( | |||
89 | ******************************************************************************/ | 81 | ******************************************************************************/ |
90 | 82 | ||
91 | static acpi_status | 83 | static acpi_status |
92 | acpi_ex_setup_region ( | 84 | acpi_ex_setup_region(union acpi_operand_object *obj_desc, |
93 | union acpi_operand_object *obj_desc, | 85 | u32 field_datum_byte_offset) |
94 | u32 field_datum_byte_offset) | ||
95 | { | 86 | { |
96 | acpi_status status = AE_OK; | 87 | acpi_status status = AE_OK; |
97 | union acpi_operand_object *rgn_desc; | 88 | union acpi_operand_object *rgn_desc; |
98 | |||
99 | |||
100 | ACPI_FUNCTION_TRACE_U32 ("ex_setup_region", field_datum_byte_offset); | ||
101 | 89 | ||
90 | ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset); | ||
102 | 91 | ||
103 | rgn_desc = obj_desc->common_field.region_obj; | 92 | rgn_desc = obj_desc->common_field.region_obj; |
104 | 93 | ||
105 | /* We must have a valid region */ | 94 | /* We must have a valid region */ |
106 | 95 | ||
107 | if (ACPI_GET_OBJECT_TYPE (rgn_desc) != ACPI_TYPE_REGION) { | 96 | if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) { |
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n", | 97 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
109 | ACPI_GET_OBJECT_TYPE (rgn_desc), | 98 | "Needed Region, found type %X (%s)\n", |
110 | acpi_ut_get_object_type_name (rgn_desc))); | 99 | ACPI_GET_OBJECT_TYPE(rgn_desc), |
100 | acpi_ut_get_object_type_name(rgn_desc))); | ||
111 | 101 | ||
112 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 102 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
113 | } | 103 | } |
114 | 104 | ||
115 | /* | 105 | /* |
@@ -117,26 +107,25 @@ acpi_ex_setup_region ( | |||
117 | * evaluate them now and save the results. | 107 | * evaluate them now and save the results. |
118 | */ | 108 | */ |
119 | if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) { | 109 | if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) { |
120 | status = acpi_ds_get_region_arguments (rgn_desc); | 110 | status = acpi_ds_get_region_arguments(rgn_desc); |
121 | if (ACPI_FAILURE (status)) { | 111 | if (ACPI_FAILURE(status)) { |
122 | return_ACPI_STATUS (status); | 112 | return_ACPI_STATUS(status); |
123 | } | 113 | } |
124 | } | 114 | } |
125 | 115 | ||
126 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { | 116 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { |
127 | /* SMBus has a non-linear address space */ | 117 | /* SMBus has a non-linear address space */ |
128 | 118 | ||
129 | return_ACPI_STATUS (AE_OK); | 119 | return_ACPI_STATUS(AE_OK); |
130 | } | 120 | } |
131 | |||
132 | #ifdef ACPI_UNDER_DEVELOPMENT | 121 | #ifdef ACPI_UNDER_DEVELOPMENT |
133 | /* | 122 | /* |
134 | * If the Field access is any_acc, we can now compute the optimal | 123 | * If the Field access is any_acc, we can now compute the optimal |
135 | * access (because we know know the length of the parent region) | 124 | * access (because we know know the length of the parent region) |
136 | */ | 125 | */ |
137 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { | 126 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { |
138 | if (ACPI_FAILURE (status)) { | 127 | if (ACPI_FAILURE(status)) { |
139 | return_ACPI_STATUS (status); | 128 | return_ACPI_STATUS(status); |
140 | } | 129 | } |
141 | } | 130 | } |
142 | #endif | 131 | #endif |
@@ -147,56 +136,64 @@ acpi_ex_setup_region ( | |||
147 | * (Region length is specified in bytes) | 136 | * (Region length is specified in bytes) |
148 | */ | 137 | */ |
149 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + | 138 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + |
150 | field_datum_byte_offset + | 139 | field_datum_byte_offset + |
151 | obj_desc->common_field.access_byte_width)) { | 140 | obj_desc->common_field. |
141 | access_byte_width)) { | ||
152 | if (acpi_gbl_enable_interpreter_slack) { | 142 | if (acpi_gbl_enable_interpreter_slack) { |
153 | /* | 143 | /* |
154 | * Slack mode only: We will go ahead and allow access to this | 144 | * Slack mode only: We will go ahead and allow access to this |
155 | * field if it is within the region length rounded up to the next | 145 | * field if it is within the region length rounded up to the next |
156 | * access width boundary. | 146 | * access width boundary. |
157 | */ | 147 | */ |
158 | if (ACPI_ROUND_UP (rgn_desc->region.length, | 148 | if (ACPI_ROUND_UP(rgn_desc->region.length, |
159 | obj_desc->common_field.access_byte_width) >= | 149 | obj_desc->common_field. |
160 | (obj_desc->common_field.base_byte_offset + | 150 | access_byte_width) >= |
161 | (acpi_native_uint) obj_desc->common_field.access_byte_width + | 151 | (obj_desc->common_field.base_byte_offset + |
162 | field_datum_byte_offset)) { | 152 | (acpi_native_uint) obj_desc->common_field. |
163 | return_ACPI_STATUS (AE_OK); | 153 | access_byte_width + field_datum_byte_offset)) { |
154 | return_ACPI_STATUS(AE_OK); | ||
164 | } | 155 | } |
165 | } | 156 | } |
166 | 157 | ||
167 | if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) { | 158 | if (rgn_desc->region.length < |
159 | obj_desc->common_field.access_byte_width) { | ||
168 | /* | 160 | /* |
169 | * This is the case where the access_type (acc_word, etc.) is wider | 161 | * This is the case where the access_type (acc_word, etc.) is wider |
170 | * than the region itself. For example, a region of length one | 162 | * than the region itself. For example, a region of length one |
171 | * byte, and a field with Dword access specified. | 163 | * byte, and a field with Dword access specified. |
172 | */ | 164 | */ |
173 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 165 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
174 | "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", | 166 | "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", |
175 | acpi_ut_get_node_name (obj_desc->common_field.node), | 167 | acpi_ut_get_node_name(obj_desc-> |
176 | obj_desc->common_field.access_byte_width, | 168 | common_field. |
177 | acpi_ut_get_node_name (rgn_desc->region.node), | 169 | node), |
178 | rgn_desc->region.length)); | 170 | obj_desc->common_field. |
171 | access_byte_width, | ||
172 | acpi_ut_get_node_name(rgn_desc-> | ||
173 | region.node), | ||
174 | rgn_desc->region.length)); | ||
179 | } | 175 | } |
180 | 176 | ||
181 | /* | 177 | /* |
182 | * Offset rounded up to next multiple of field width | 178 | * Offset rounded up to next multiple of field width |
183 | * exceeds region length, indicate an error | 179 | * exceeds region length, indicate an error |
184 | */ | 180 | */ |
185 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 181 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
186 | "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", | 182 | "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", |
187 | acpi_ut_get_node_name (obj_desc->common_field.node), | 183 | acpi_ut_get_node_name(obj_desc->common_field. |
188 | obj_desc->common_field.base_byte_offset, | 184 | node), |
189 | field_datum_byte_offset, obj_desc->common_field.access_byte_width, | 185 | obj_desc->common_field.base_byte_offset, |
190 | acpi_ut_get_node_name (rgn_desc->region.node), | 186 | field_datum_byte_offset, |
191 | rgn_desc->region.length)); | 187 | obj_desc->common_field.access_byte_width, |
192 | 188 | acpi_ut_get_node_name(rgn_desc->region.node), | |
193 | return_ACPI_STATUS (AE_AML_REGION_LIMIT); | 189 | rgn_desc->region.length)); |
190 | |||
191 | return_ACPI_STATUS(AE_AML_REGION_LIMIT); | ||
194 | } | 192 | } |
195 | 193 | ||
196 | return_ACPI_STATUS (AE_OK); | 194 | return_ACPI_STATUS(AE_OK); |
197 | } | 195 | } |
198 | 196 | ||
199 | |||
200 | /******************************************************************************* | 197 | /******************************************************************************* |
201 | * | 198 | * |
202 | * FUNCTION: acpi_ex_access_region | 199 | * FUNCTION: acpi_ex_access_region |
@@ -216,27 +213,23 @@ acpi_ex_setup_region ( | |||
216 | ******************************************************************************/ | 213 | ******************************************************************************/ |
217 | 214 | ||
218 | acpi_status | 215 | acpi_status |
219 | acpi_ex_access_region ( | 216 | acpi_ex_access_region(union acpi_operand_object *obj_desc, |
220 | union acpi_operand_object *obj_desc, | 217 | u32 field_datum_byte_offset, |
221 | u32 field_datum_byte_offset, | 218 | acpi_integer * value, u32 function) |
222 | acpi_integer *value, | ||
223 | u32 function) | ||
224 | { | 219 | { |
225 | acpi_status status; | 220 | acpi_status status; |
226 | union acpi_operand_object *rgn_desc; | 221 | union acpi_operand_object *rgn_desc; |
227 | acpi_physical_address address; | 222 | acpi_physical_address address; |
228 | |||
229 | |||
230 | ACPI_FUNCTION_TRACE ("ex_access_region"); | ||
231 | 223 | ||
224 | ACPI_FUNCTION_TRACE("ex_access_region"); | ||
232 | 225 | ||
233 | /* | 226 | /* |
234 | * Ensure that the region operands are fully evaluated and verify | 227 | * Ensure that the region operands are fully evaluated and verify |
235 | * the validity of the request | 228 | * the validity of the request |
236 | */ | 229 | */ |
237 | status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset); | 230 | status = acpi_ex_setup_region(obj_desc, field_datum_byte_offset); |
238 | if (ACPI_FAILURE (status)) { | 231 | if (ACPI_FAILURE(status)) { |
239 | return_ACPI_STATUS (status); | 232 | return_ACPI_STATUS(status); |
240 | } | 233 | } |
241 | 234 | ||
242 | /* | 235 | /* |
@@ -248,50 +241,53 @@ acpi_ex_access_region ( | |||
248 | */ | 241 | */ |
249 | rgn_desc = obj_desc->common_field.region_obj; | 242 | rgn_desc = obj_desc->common_field.region_obj; |
250 | address = rgn_desc->region.address + | 243 | address = rgn_desc->region.address + |
251 | obj_desc->common_field.base_byte_offset + | 244 | obj_desc->common_field.base_byte_offset + field_datum_byte_offset; |
252 | field_datum_byte_offset; | ||
253 | 245 | ||
254 | if ((function & ACPI_IO_MASK) == ACPI_READ) { | 246 | if ((function & ACPI_IO_MASK) == ACPI_READ) { |
255 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); | 247 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[READ]")); |
256 | } | 248 | } else { |
257 | else { | 249 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[WRITE]")); |
258 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]")); | ||
259 | } | 250 | } |
260 | 251 | ||
261 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD, | 252 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, |
262 | " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", | 253 | " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", |
263 | acpi_ut_get_region_name (rgn_desc->region.space_id), | 254 | acpi_ut_get_region_name(rgn_desc->region. |
264 | rgn_desc->region.space_id, | 255 | space_id), |
265 | obj_desc->common_field.access_byte_width, | 256 | rgn_desc->region.space_id, |
266 | obj_desc->common_field.base_byte_offset, | 257 | obj_desc->common_field.access_byte_width, |
267 | field_datum_byte_offset, | 258 | obj_desc->common_field.base_byte_offset, |
268 | ACPI_FORMAT_UINT64 (address))); | 259 | field_datum_byte_offset, |
260 | ACPI_FORMAT_UINT64(address))); | ||
269 | 261 | ||
270 | /* Invoke the appropriate address_space/op_region handler */ | 262 | /* Invoke the appropriate address_space/op_region handler */ |
271 | 263 | ||
272 | status = acpi_ev_address_space_dispatch (rgn_desc, function, | 264 | status = acpi_ev_address_space_dispatch(rgn_desc, function, |
273 | address, | 265 | address, |
274 | ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); | 266 | ACPI_MUL_8(obj_desc-> |
267 | common_field. | ||
268 | access_byte_width), | ||
269 | value); | ||
275 | 270 | ||
276 | if (ACPI_FAILURE (status)) { | 271 | if (ACPI_FAILURE(status)) { |
277 | if (status == AE_NOT_IMPLEMENTED) { | 272 | if (status == AE_NOT_IMPLEMENTED) { |
278 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 273 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
279 | "Region %s(%X) not implemented\n", | 274 | "Region %s(%X) not implemented\n", |
280 | acpi_ut_get_region_name (rgn_desc->region.space_id), | 275 | acpi_ut_get_region_name(rgn_desc-> |
281 | rgn_desc->region.space_id)); | 276 | region. |
282 | } | 277 | space_id), |
283 | else if (status == AE_NOT_EXIST) { | 278 | rgn_desc->region.space_id)); |
284 | ACPI_REPORT_ERROR (( | 279 | } else if (status == AE_NOT_EXIST) { |
285 | "Region %s(%X) has no handler\n", | 280 | ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n", |
286 | acpi_ut_get_region_name (rgn_desc->region.space_id), | 281 | acpi_ut_get_region_name(rgn_desc-> |
287 | rgn_desc->region.space_id)); | 282 | region. |
283 | space_id), | ||
284 | rgn_desc->region.space_id)); | ||
288 | } | 285 | } |
289 | } | 286 | } |
290 | 287 | ||
291 | return_ACPI_STATUS (status); | 288 | return_ACPI_STATUS(status); |
292 | } | 289 | } |
293 | 290 | ||
294 | |||
295 | /******************************************************************************* | 291 | /******************************************************************************* |
296 | * | 292 | * |
297 | * FUNCTION: acpi_ex_register_overflow | 293 | * FUNCTION: acpi_ex_register_overflow |
@@ -310,9 +306,8 @@ acpi_ex_access_region ( | |||
310 | ******************************************************************************/ | 306 | ******************************************************************************/ |
311 | 307 | ||
312 | static u8 | 308 | static u8 |
313 | acpi_ex_register_overflow ( | 309 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, |
314 | union acpi_operand_object *obj_desc, | 310 | acpi_integer value) |
315 | acpi_integer value) | ||
316 | { | 311 | { |
317 | 312 | ||
318 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { | 313 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { |
@@ -336,7 +331,6 @@ acpi_ex_register_overflow ( | |||
336 | return (FALSE); | 331 | return (FALSE); |
337 | } | 332 | } |
338 | 333 | ||
339 | |||
340 | /******************************************************************************* | 334 | /******************************************************************************* |
341 | * | 335 | * |
342 | * FUNCTION: acpi_ex_field_datum_io | 336 | * FUNCTION: acpi_ex_field_datum_io |
@@ -356,18 +350,14 @@ acpi_ex_register_overflow ( | |||
356 | ******************************************************************************/ | 350 | ******************************************************************************/ |
357 | 351 | ||
358 | static acpi_status | 352 | static acpi_status |
359 | acpi_ex_field_datum_io ( | 353 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, |
360 | union acpi_operand_object *obj_desc, | 354 | u32 field_datum_byte_offset, |
361 | u32 field_datum_byte_offset, | 355 | acpi_integer * value, u32 read_write) |
362 | acpi_integer *value, | ||
363 | u32 read_write) | ||
364 | { | 356 | { |
365 | acpi_status status; | 357 | acpi_status status; |
366 | acpi_integer local_value; | 358 | acpi_integer local_value; |
367 | |||
368 | |||
369 | ACPI_FUNCTION_TRACE_U32 ("ex_field_datum_io", field_datum_byte_offset); | ||
370 | 359 | ||
360 | ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset); | ||
371 | 361 | ||
372 | if (read_write == ACPI_READ) { | 362 | if (read_write == ACPI_READ) { |
373 | if (!value) { | 363 | if (!value) { |
@@ -392,16 +382,16 @@ acpi_ex_field_datum_io ( | |||
392 | * index_field - Write to an Index Register, then read/write from/to a | 382 | * index_field - Write to an Index Register, then read/write from/to a |
393 | * Data Register | 383 | * Data Register |
394 | */ | 384 | */ |
395 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 385 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
396 | case ACPI_TYPE_BUFFER_FIELD: | 386 | case ACPI_TYPE_BUFFER_FIELD: |
397 | /* | 387 | /* |
398 | * If the buffer_field arguments have not been previously evaluated, | 388 | * If the buffer_field arguments have not been previously evaluated, |
399 | * evaluate them now and save the results. | 389 | * evaluate them now and save the results. |
400 | */ | 390 | */ |
401 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { | 391 | if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { |
402 | status = acpi_ds_get_buffer_field_arguments (obj_desc); | 392 | status = acpi_ds_get_buffer_field_arguments(obj_desc); |
403 | if (ACPI_FAILURE (status)) { | 393 | if (ACPI_FAILURE(status)) { |
404 | return_ACPI_STATUS (status); | 394 | return_ACPI_STATUS(status); |
405 | } | 395 | } |
406 | } | 396 | } |
407 | 397 | ||
@@ -410,47 +400,50 @@ acpi_ex_field_datum_io ( | |||
410 | * Copy the data from the source buffer. | 400 | * Copy the data from the source buffer. |
411 | * Length is the field width in bytes. | 401 | * Length is the field width in bytes. |
412 | */ | 402 | */ |
413 | ACPI_MEMCPY (value, | 403 | ACPI_MEMCPY(value, |
414 | (obj_desc->buffer_field.buffer_obj)->buffer.pointer + | 404 | (obj_desc->buffer_field.buffer_obj)->buffer. |
415 | obj_desc->buffer_field.base_byte_offset + | 405 | pointer + |
416 | field_datum_byte_offset, | 406 | obj_desc->buffer_field.base_byte_offset + |
417 | obj_desc->common_field.access_byte_width); | 407 | field_datum_byte_offset, |
418 | } | 408 | obj_desc->common_field.access_byte_width); |
419 | else { | 409 | } else { |
420 | /* | 410 | /* |
421 | * Copy the data to the target buffer. | 411 | * Copy the data to the target buffer. |
422 | * Length is the field width in bytes. | 412 | * Length is the field width in bytes. |
423 | */ | 413 | */ |
424 | ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer + | 414 | ACPI_MEMCPY((obj_desc->buffer_field.buffer_obj)->buffer. |
425 | obj_desc->buffer_field.base_byte_offset + | 415 | pointer + |
426 | field_datum_byte_offset, | 416 | obj_desc->buffer_field.base_byte_offset + |
427 | value, obj_desc->common_field.access_byte_width); | 417 | field_datum_byte_offset, value, |
418 | obj_desc->common_field.access_byte_width); | ||
428 | } | 419 | } |
429 | 420 | ||
430 | status = AE_OK; | 421 | status = AE_OK; |
431 | break; | 422 | break; |
432 | 423 | ||
433 | |||
434 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 424 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
435 | 425 | ||
436 | /* | 426 | /* |
437 | * Ensure that the bank_value is not beyond the capacity of | 427 | * Ensure that the bank_value is not beyond the capacity of |
438 | * the register | 428 | * the register |
439 | */ | 429 | */ |
440 | if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, | 430 | if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj, |
441 | (acpi_integer) obj_desc->bank_field.value)) { | 431 | (acpi_integer) obj_desc-> |
442 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); | 432 | bank_field.value)) { |
433 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); | ||
443 | } | 434 | } |
444 | 435 | ||
445 | /* | 436 | /* |
446 | * For bank_fields, we must write the bank_value to the bank_register | 437 | * For bank_fields, we must write the bank_value to the bank_register |
447 | * (itself a region_field) before we can access the data. | 438 | * (itself a region_field) before we can access the data. |
448 | */ | 439 | */ |
449 | status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj, | 440 | status = |
450 | &obj_desc->bank_field.value, | 441 | acpi_ex_insert_into_field(obj_desc->bank_field.bank_obj, |
451 | sizeof (obj_desc->bank_field.value)); | 442 | &obj_desc->bank_field.value, |
452 | if (ACPI_FAILURE (status)) { | 443 | sizeof(obj_desc->bank_field. |
453 | return_ACPI_STATUS (status); | 444 | value)); |
445 | if (ACPI_FAILURE(status)) { | ||
446 | return_ACPI_STATUS(status); | ||
454 | } | 447 | } |
455 | 448 | ||
456 | /* | 449 | /* |
@@ -460,90 +453,92 @@ acpi_ex_field_datum_io ( | |||
460 | 453 | ||
461 | /*lint -fallthrough */ | 454 | /*lint -fallthrough */ |
462 | 455 | ||
463 | |||
464 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 456 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
465 | /* | 457 | /* |
466 | * For simple region_fields, we just directly access the owning | 458 | * For simple region_fields, we just directly access the owning |
467 | * Operation Region. | 459 | * Operation Region. |
468 | */ | 460 | */ |
469 | status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value, | 461 | status = |
470 | read_write); | 462 | acpi_ex_access_region(obj_desc, field_datum_byte_offset, |
463 | value, read_write); | ||
471 | break; | 464 | break; |
472 | 465 | ||
473 | |||
474 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 466 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
475 | 467 | ||
476 | |||
477 | /* | 468 | /* |
478 | * Ensure that the index_value is not beyond the capacity of | 469 | * Ensure that the index_value is not beyond the capacity of |
479 | * the register | 470 | * the register |
480 | */ | 471 | */ |
481 | if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, | 472 | if (acpi_ex_register_overflow(obj_desc->index_field.index_obj, |
482 | (acpi_integer) obj_desc->index_field.value)) { | 473 | (acpi_integer) obj_desc-> |
483 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); | 474 | index_field.value)) { |
475 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); | ||
484 | } | 476 | } |
485 | 477 | ||
486 | /* Write the index value to the index_register (itself a region_field) */ | 478 | /* Write the index value to the index_register (itself a region_field) */ |
487 | 479 | ||
488 | field_datum_byte_offset += obj_desc->index_field.value; | 480 | field_datum_byte_offset += obj_desc->index_field.value; |
489 | 481 | ||
490 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 482 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
491 | "Write to Index Register: Value %8.8X\n", | 483 | "Write to Index Register: Value %8.8X\n", |
492 | field_datum_byte_offset)); | 484 | field_datum_byte_offset)); |
493 | 485 | ||
494 | status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj, | 486 | status = |
495 | &field_datum_byte_offset, | 487 | acpi_ex_insert_into_field(obj_desc->index_field.index_obj, |
496 | sizeof (field_datum_byte_offset)); | 488 | &field_datum_byte_offset, |
497 | if (ACPI_FAILURE (status)) { | 489 | sizeof(field_datum_byte_offset)); |
498 | return_ACPI_STATUS (status); | 490 | if (ACPI_FAILURE(status)) { |
491 | return_ACPI_STATUS(status); | ||
499 | } | 492 | } |
500 | 493 | ||
501 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 494 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
502 | "I/O to Data Register: value_ptr %p\n", | 495 | "I/O to Data Register: value_ptr %p\n", |
503 | value)); | 496 | value)); |
504 | 497 | ||
505 | if (read_write == ACPI_READ) { | 498 | if (read_write == ACPI_READ) { |
506 | /* Read the datum from the data_register */ | 499 | /* Read the datum from the data_register */ |
507 | 500 | ||
508 | status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj, | 501 | status = |
509 | value, sizeof (acpi_integer)); | 502 | acpi_ex_extract_from_field(obj_desc->index_field. |
510 | } | 503 | data_obj, value, |
511 | else { | 504 | sizeof(acpi_integer)); |
505 | } else { | ||
512 | /* Write the datum to the data_register */ | 506 | /* Write the datum to the data_register */ |
513 | 507 | ||
514 | status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj, | 508 | status = |
515 | value, sizeof (acpi_integer)); | 509 | acpi_ex_insert_into_field(obj_desc->index_field. |
510 | data_obj, value, | ||
511 | sizeof(acpi_integer)); | ||
516 | } | 512 | } |
517 | break; | 513 | break; |
518 | 514 | ||
519 | |||
520 | default: | 515 | default: |
521 | 516 | ||
522 | ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n", | 517 | ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n", |
523 | ACPI_GET_OBJECT_TYPE (obj_desc))); | 518 | ACPI_GET_OBJECT_TYPE(obj_desc))); |
524 | status = AE_AML_INTERNAL; | 519 | status = AE_AML_INTERNAL; |
525 | break; | 520 | break; |
526 | } | 521 | } |
527 | 522 | ||
528 | if (ACPI_SUCCESS (status)) { | 523 | if (ACPI_SUCCESS(status)) { |
529 | if (read_write == ACPI_READ) { | 524 | if (read_write == ACPI_READ) { |
530 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 525 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
531 | "Value Read %8.8X%8.8X, Width %d\n", | 526 | "Value Read %8.8X%8.8X, Width %d\n", |
532 | ACPI_FORMAT_UINT64 (*value), | 527 | ACPI_FORMAT_UINT64(*value), |
533 | obj_desc->common_field.access_byte_width)); | 528 | obj_desc->common_field. |
534 | } | 529 | access_byte_width)); |
535 | else { | 530 | } else { |
536 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 531 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
537 | "Value Written %8.8X%8.8X, Width %d\n", | 532 | "Value Written %8.8X%8.8X, Width %d\n", |
538 | ACPI_FORMAT_UINT64 (*value), | 533 | ACPI_FORMAT_UINT64(*value), |
539 | obj_desc->common_field.access_byte_width)); | 534 | obj_desc->common_field. |
535 | access_byte_width)); | ||
540 | } | 536 | } |
541 | } | 537 | } |
542 | 538 | ||
543 | return_ACPI_STATUS (status); | 539 | return_ACPI_STATUS(status); |
544 | } | 540 | } |
545 | 541 | ||
546 | |||
547 | /******************************************************************************* | 542 | /******************************************************************************* |
548 | * | 543 | * |
549 | * FUNCTION: acpi_ex_write_with_update_rule | 544 | * FUNCTION: acpi_ex_write_with_update_rule |
@@ -560,19 +555,16 @@ acpi_ex_field_datum_io ( | |||
560 | ******************************************************************************/ | 555 | ******************************************************************************/ |
561 | 556 | ||
562 | acpi_status | 557 | acpi_status |
563 | acpi_ex_write_with_update_rule ( | 558 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, |
564 | union acpi_operand_object *obj_desc, | 559 | acpi_integer mask, |
565 | acpi_integer mask, | 560 | acpi_integer field_value, |
566 | acpi_integer field_value, | 561 | u32 field_datum_byte_offset) |
567 | u32 field_datum_byte_offset) | ||
568 | { | 562 | { |
569 | acpi_status status = AE_OK; | 563 | acpi_status status = AE_OK; |
570 | acpi_integer merged_value; | 564 | acpi_integer merged_value; |
571 | acpi_integer current_value; | 565 | acpi_integer current_value; |
572 | |||
573 | |||
574 | ACPI_FUNCTION_TRACE_U32 ("ex_write_with_update_rule", mask); | ||
575 | 566 | ||
567 | ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask); | ||
576 | 568 | ||
577 | /* Start with the new bits */ | 569 | /* Start with the new bits */ |
578 | 570 | ||
@@ -583,22 +575,27 @@ acpi_ex_write_with_update_rule ( | |||
583 | if (mask != ACPI_INTEGER_MAX) { | 575 | if (mask != ACPI_INTEGER_MAX) { |
584 | /* Decode the update rule */ | 576 | /* Decode the update rule */ |
585 | 577 | ||
586 | switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) { | 578 | switch (obj_desc->common_field. |
579 | field_flags & AML_FIELD_UPDATE_RULE_MASK) { | ||
587 | case AML_FIELD_UPDATE_PRESERVE: | 580 | case AML_FIELD_UPDATE_PRESERVE: |
588 | /* | 581 | /* |
589 | * Check if update rule needs to be applied (not if mask is all | 582 | * Check if update rule needs to be applied (not if mask is all |
590 | * ones) The left shift drops the bits we want to ignore. | 583 | * ones) The left shift drops the bits we want to ignore. |
591 | */ | 584 | */ |
592 | if ((~mask << (ACPI_MUL_8 (sizeof (mask)) - | 585 | if ((~mask << (ACPI_MUL_8(sizeof(mask)) - |
593 | ACPI_MUL_8 (obj_desc->common_field.access_byte_width))) != 0) { | 586 | ACPI_MUL_8(obj_desc->common_field. |
587 | access_byte_width))) != 0) { | ||
594 | /* | 588 | /* |
595 | * Read the current contents of the byte/word/dword containing | 589 | * Read the current contents of the byte/word/dword containing |
596 | * the field, and merge with the new field value. | 590 | * the field, and merge with the new field value. |
597 | */ | 591 | */ |
598 | status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, | 592 | status = |
599 | ¤t_value, ACPI_READ); | 593 | acpi_ex_field_datum_io(obj_desc, |
600 | if (ACPI_FAILURE (status)) { | 594 | field_datum_byte_offset, |
601 | return_ACPI_STATUS (status); | 595 | ¤t_value, |
596 | ACPI_READ); | ||
597 | if (ACPI_FAILURE(status)) { | ||
598 | return_ACPI_STATUS(status); | ||
602 | } | 599 | } |
603 | 600 | ||
604 | merged_value |= (current_value & ~mask); | 601 | merged_value |= (current_value & ~mask); |
@@ -621,30 +618,31 @@ acpi_ex_write_with_update_rule ( | |||
621 | 618 | ||
622 | default: | 619 | default: |
623 | 620 | ||
624 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 621 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
625 | "write_with_update_rule: Unknown update_rule setting: %X\n", | 622 | "write_with_update_rule: Unknown update_rule setting: %X\n", |
626 | (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK))); | 623 | (obj_desc->common_field. |
627 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); | 624 | field_flags & |
625 | AML_FIELD_UPDATE_RULE_MASK))); | ||
626 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | ||
628 | } | 627 | } |
629 | } | 628 | } |
630 | 629 | ||
631 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 630 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
632 | "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", | 631 | "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", |
633 | ACPI_FORMAT_UINT64 (mask), | 632 | ACPI_FORMAT_UINT64(mask), |
634 | field_datum_byte_offset, | 633 | field_datum_byte_offset, |
635 | obj_desc->common_field.access_byte_width, | 634 | obj_desc->common_field.access_byte_width, |
636 | ACPI_FORMAT_UINT64 (field_value), | 635 | ACPI_FORMAT_UINT64(field_value), |
637 | ACPI_FORMAT_UINT64 (merged_value))); | 636 | ACPI_FORMAT_UINT64(merged_value))); |
638 | 637 | ||
639 | /* Write the merged value */ | 638 | /* Write the merged value */ |
640 | 639 | ||
641 | status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, | 640 | status = acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset, |
642 | &merged_value, ACPI_WRITE); | 641 | &merged_value, ACPI_WRITE); |
643 | 642 | ||
644 | return_ACPI_STATUS (status); | 643 | return_ACPI_STATUS(status); |
645 | } | 644 | } |
646 | 645 | ||
647 | |||
648 | /******************************************************************************* | 646 | /******************************************************************************* |
649 | * | 647 | * |
650 | * FUNCTION: acpi_ex_extract_from_field | 648 | * FUNCTION: acpi_ex_extract_from_field |
@@ -660,54 +658,54 @@ acpi_ex_write_with_update_rule ( | |||
660 | ******************************************************************************/ | 658 | ******************************************************************************/ |
661 | 659 | ||
662 | acpi_status | 660 | acpi_status |
663 | acpi_ex_extract_from_field ( | 661 | acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, |
664 | union acpi_operand_object *obj_desc, | 662 | void *buffer, u32 buffer_length) |
665 | void *buffer, | ||
666 | u32 buffer_length) | ||
667 | { | 663 | { |
668 | acpi_status status; | 664 | acpi_status status; |
669 | acpi_integer raw_datum; | 665 | acpi_integer raw_datum; |
670 | acpi_integer merged_datum; | 666 | acpi_integer merged_datum; |
671 | u32 field_offset = 0; | 667 | u32 field_offset = 0; |
672 | u32 buffer_offset = 0; | 668 | u32 buffer_offset = 0; |
673 | u32 buffer_tail_bits; | 669 | u32 buffer_tail_bits; |
674 | u32 datum_count; | 670 | u32 datum_count; |
675 | u32 field_datum_count; | 671 | u32 field_datum_count; |
676 | u32 i; | 672 | u32 i; |
677 | 673 | ||
678 | 674 | ACPI_FUNCTION_TRACE("ex_extract_from_field"); | |
679 | ACPI_FUNCTION_TRACE ("ex_extract_from_field"); | ||
680 | |||
681 | 675 | ||
682 | /* Validate target buffer and clear it */ | 676 | /* Validate target buffer and clear it */ |
683 | 677 | ||
684 | if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( | 678 | if (buffer_length < |
685 | obj_desc->common_field.bit_length)) { | 679 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { |
686 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 680 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
687 | "Field size %X (bits) is too large for buffer (%X)\n", | 681 | "Field size %X (bits) is too large for buffer (%X)\n", |
688 | obj_desc->common_field.bit_length, buffer_length)); | 682 | obj_desc->common_field.bit_length, |
683 | buffer_length)); | ||
689 | 684 | ||
690 | return_ACPI_STATUS (AE_BUFFER_OVERFLOW); | 685 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); |
691 | } | 686 | } |
692 | ACPI_MEMSET (buffer, 0, buffer_length); | 687 | ACPI_MEMSET(buffer, 0, buffer_length); |
693 | 688 | ||
694 | /* Compute the number of datums (access width data items) */ | 689 | /* Compute the number of datums (access width data items) */ |
695 | 690 | ||
696 | datum_count = ACPI_ROUND_UP_TO ( | 691 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
697 | obj_desc->common_field.bit_length, | 692 | obj_desc->common_field.access_bit_width); |
698 | obj_desc->common_field.access_bit_width); | 693 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
699 | field_datum_count = ACPI_ROUND_UP_TO ( | 694 | obj_desc->common_field. |
700 | obj_desc->common_field.bit_length + | 695 | start_field_bit_offset, |
701 | obj_desc->common_field.start_field_bit_offset, | 696 | obj_desc->common_field. |
702 | obj_desc->common_field.access_bit_width); | 697 | access_bit_width); |
703 | 698 | ||
704 | /* Priming read from the field */ | 699 | /* Priming read from the field */ |
705 | 700 | ||
706 | status = acpi_ex_field_datum_io (obj_desc, field_offset, &raw_datum, ACPI_READ); | 701 | status = |
707 | if (ACPI_FAILURE (status)) { | 702 | acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum, |
708 | return_ACPI_STATUS (status); | 703 | ACPI_READ); |
704 | if (ACPI_FAILURE(status)) { | ||
705 | return_ACPI_STATUS(status); | ||
709 | } | 706 | } |
710 | merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; | 707 | merged_datum = |
708 | raw_datum >> obj_desc->common_field.start_field_bit_offset; | ||
711 | 709 | ||
712 | /* Read the rest of the field */ | 710 | /* Read the rest of the field */ |
713 | 711 | ||
@@ -715,17 +713,17 @@ acpi_ex_extract_from_field ( | |||
715 | /* Get next input datum from the field */ | 713 | /* Get next input datum from the field */ |
716 | 714 | ||
717 | field_offset += obj_desc->common_field.access_byte_width; | 715 | field_offset += obj_desc->common_field.access_byte_width; |
718 | status = acpi_ex_field_datum_io (obj_desc, field_offset, | 716 | status = acpi_ex_field_datum_io(obj_desc, field_offset, |
719 | &raw_datum, ACPI_READ); | 717 | &raw_datum, ACPI_READ); |
720 | if (ACPI_FAILURE (status)) { | 718 | if (ACPI_FAILURE(status)) { |
721 | return_ACPI_STATUS (status); | 719 | return_ACPI_STATUS(status); |
722 | } | 720 | } |
723 | 721 | ||
724 | /* Merge with previous datum if necessary */ | 722 | /* Merge with previous datum if necessary */ |
725 | 723 | ||
726 | merged_datum |= raw_datum << | 724 | merged_datum |= raw_datum << |
727 | (obj_desc->common_field.access_bit_width - | 725 | (obj_desc->common_field.access_bit_width - |
728 | obj_desc->common_field.start_field_bit_offset); | 726 | obj_desc->common_field.start_field_bit_offset); |
729 | 727 | ||
730 | if (i == datum_count) { | 728 | if (i == datum_count) { |
731 | break; | 729 | break; |
@@ -733,32 +731,32 @@ acpi_ex_extract_from_field ( | |||
733 | 731 | ||
734 | /* Write merged datum to target buffer */ | 732 | /* Write merged datum to target buffer */ |
735 | 733 | ||
736 | ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, | 734 | ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum, |
737 | ACPI_MIN(obj_desc->common_field.access_byte_width, | 735 | ACPI_MIN(obj_desc->common_field.access_byte_width, |
738 | buffer_length - buffer_offset)); | 736 | buffer_length - buffer_offset)); |
739 | 737 | ||
740 | buffer_offset += obj_desc->common_field.access_byte_width; | 738 | buffer_offset += obj_desc->common_field.access_byte_width; |
741 | merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; | 739 | merged_datum = |
740 | raw_datum >> obj_desc->common_field.start_field_bit_offset; | ||
742 | } | 741 | } |
743 | 742 | ||
744 | /* Mask off any extra bits in the last datum */ | 743 | /* Mask off any extra bits in the last datum */ |
745 | 744 | ||
746 | buffer_tail_bits = obj_desc->common_field.bit_length % | 745 | buffer_tail_bits = obj_desc->common_field.bit_length % |
747 | obj_desc->common_field.access_bit_width; | 746 | obj_desc->common_field.access_bit_width; |
748 | if (buffer_tail_bits) { | 747 | if (buffer_tail_bits) { |
749 | merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); | 748 | merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); |
750 | } | 749 | } |
751 | 750 | ||
752 | /* Write the last datum to the buffer */ | 751 | /* Write the last datum to the buffer */ |
753 | 752 | ||
754 | ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, | 753 | ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum, |
755 | ACPI_MIN(obj_desc->common_field.access_byte_width, | 754 | ACPI_MIN(obj_desc->common_field.access_byte_width, |
756 | buffer_length - buffer_offset)); | 755 | buffer_length - buffer_offset)); |
757 | 756 | ||
758 | return_ACPI_STATUS (AE_OK); | 757 | return_ACPI_STATUS(AE_OK); |
759 | } | 758 | } |
760 | 759 | ||
761 | |||
762 | /******************************************************************************* | 760 | /******************************************************************************* |
763 | * | 761 | * |
764 | * FUNCTION: acpi_ex_insert_into_field | 762 | * FUNCTION: acpi_ex_insert_into_field |
@@ -774,53 +772,54 @@ acpi_ex_extract_from_field ( | |||
774 | ******************************************************************************/ | 772 | ******************************************************************************/ |
775 | 773 | ||
776 | acpi_status | 774 | acpi_status |
777 | acpi_ex_insert_into_field ( | 775 | acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, |
778 | union acpi_operand_object *obj_desc, | 776 | void *buffer, u32 buffer_length) |
779 | void *buffer, | ||
780 | u32 buffer_length) | ||
781 | { | 777 | { |
782 | acpi_status status; | 778 | acpi_status status; |
783 | acpi_integer mask; | 779 | acpi_integer mask; |
784 | acpi_integer merged_datum; | 780 | acpi_integer merged_datum; |
785 | acpi_integer raw_datum = 0; | 781 | acpi_integer raw_datum = 0; |
786 | u32 field_offset = 0; | 782 | u32 field_offset = 0; |
787 | u32 buffer_offset = 0; | 783 | u32 buffer_offset = 0; |
788 | u32 buffer_tail_bits; | 784 | u32 buffer_tail_bits; |
789 | u32 datum_count; | 785 | u32 datum_count; |
790 | u32 field_datum_count; | 786 | u32 field_datum_count; |
791 | u32 i; | 787 | u32 i; |
792 | 788 | ||
793 | 789 | ACPI_FUNCTION_TRACE("ex_insert_into_field"); | |
794 | ACPI_FUNCTION_TRACE ("ex_insert_into_field"); | ||
795 | |||
796 | 790 | ||
797 | /* Validate input buffer */ | 791 | /* Validate input buffer */ |
798 | 792 | ||
799 | if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( | 793 | if (buffer_length < |
800 | obj_desc->common_field.bit_length)) { | 794 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { |
801 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 795 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
802 | "Field size %X (bits) is too large for buffer (%X)\n", | 796 | "Field size %X (bits) is too large for buffer (%X)\n", |
803 | obj_desc->common_field.bit_length, buffer_length)); | 797 | obj_desc->common_field.bit_length, |
798 | buffer_length)); | ||
804 | 799 | ||
805 | return_ACPI_STATUS (AE_BUFFER_OVERFLOW); | 800 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); |
806 | } | 801 | } |
807 | 802 | ||
808 | /* Compute the number of datums (access width data items) */ | 803 | /* Compute the number of datums (access width data items) */ |
809 | 804 | ||
810 | mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset); | 805 | mask = |
811 | datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length, | 806 | ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); |
812 | obj_desc->common_field.access_bit_width); | 807 | datum_count = |
813 | field_datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length + | 808 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
814 | obj_desc->common_field.start_field_bit_offset, | 809 | obj_desc->common_field.access_bit_width); |
815 | obj_desc->common_field.access_bit_width); | 810 | field_datum_count = |
811 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | ||
812 | obj_desc->common_field.start_field_bit_offset, | ||
813 | obj_desc->common_field.access_bit_width); | ||
816 | 814 | ||
817 | /* Get initial Datum from the input buffer */ | 815 | /* Get initial Datum from the input buffer */ |
818 | 816 | ||
819 | ACPI_MEMCPY (&raw_datum, buffer, | 817 | ACPI_MEMCPY(&raw_datum, buffer, |
820 | ACPI_MIN(obj_desc->common_field.access_byte_width, | 818 | ACPI_MIN(obj_desc->common_field.access_byte_width, |
821 | buffer_length - buffer_offset)); | 819 | buffer_length - buffer_offset)); |
822 | 820 | ||
823 | merged_datum = raw_datum << obj_desc->common_field.start_field_bit_offset; | 821 | merged_datum = |
822 | raw_datum << obj_desc->common_field.start_field_bit_offset; | ||
824 | 823 | ||
825 | /* Write the entire field */ | 824 | /* Write the entire field */ |
826 | 825 | ||
@@ -828,18 +827,19 @@ acpi_ex_insert_into_field ( | |||
828 | /* Write merged datum to the target field */ | 827 | /* Write merged datum to the target field */ |
829 | 828 | ||
830 | merged_datum &= mask; | 829 | merged_datum &= mask; |
831 | status = acpi_ex_write_with_update_rule (obj_desc, mask, | 830 | status = acpi_ex_write_with_update_rule(obj_desc, mask, |
832 | merged_datum, field_offset); | 831 | merged_datum, |
833 | if (ACPI_FAILURE (status)) { | 832 | field_offset); |
834 | return_ACPI_STATUS (status); | 833 | if (ACPI_FAILURE(status)) { |
834 | return_ACPI_STATUS(status); | ||
835 | } | 835 | } |
836 | 836 | ||
837 | /* Start new output datum by merging with previous input datum */ | 837 | /* Start new output datum by merging with previous input datum */ |
838 | 838 | ||
839 | field_offset += obj_desc->common_field.access_byte_width; | 839 | field_offset += obj_desc->common_field.access_byte_width; |
840 | merged_datum = raw_datum >> | 840 | merged_datum = raw_datum >> |
841 | (obj_desc->common_field.access_bit_width - | 841 | (obj_desc->common_field.access_bit_width - |
842 | obj_desc->common_field.start_field_bit_offset); | 842 | obj_desc->common_field.start_field_bit_offset); |
843 | mask = ACPI_INTEGER_MAX; | 843 | mask = ACPI_INTEGER_MAX; |
844 | 844 | ||
845 | if (i == datum_count) { | 845 | if (i == datum_count) { |
@@ -849,28 +849,28 @@ acpi_ex_insert_into_field ( | |||
849 | /* Get the next input datum from the buffer */ | 849 | /* Get the next input datum from the buffer */ |
850 | 850 | ||
851 | buffer_offset += obj_desc->common_field.access_byte_width; | 851 | buffer_offset += obj_desc->common_field.access_byte_width; |
852 | ACPI_MEMCPY (&raw_datum, ((char *) buffer) + buffer_offset, | 852 | ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, |
853 | ACPI_MIN(obj_desc->common_field.access_byte_width, | 853 | ACPI_MIN(obj_desc->common_field.access_byte_width, |
854 | buffer_length - buffer_offset)); | 854 | buffer_length - buffer_offset)); |
855 | merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset; | 855 | merged_datum |= |
856 | raw_datum << obj_desc->common_field.start_field_bit_offset; | ||
856 | } | 857 | } |
857 | 858 | ||
858 | /* Mask off any extra bits in the last datum */ | 859 | /* Mask off any extra bits in the last datum */ |
859 | 860 | ||
860 | buffer_tail_bits = (obj_desc->common_field.bit_length + | 861 | buffer_tail_bits = (obj_desc->common_field.bit_length + |
861 | obj_desc->common_field.start_field_bit_offset) % | 862 | obj_desc->common_field.start_field_bit_offset) % |
862 | obj_desc->common_field.access_bit_width; | 863 | obj_desc->common_field.access_bit_width; |
863 | if (buffer_tail_bits) { | 864 | if (buffer_tail_bits) { |
864 | mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); | 865 | mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); |
865 | } | 866 | } |
866 | 867 | ||
867 | /* Write the last datum to the field */ | 868 | /* Write the last datum to the field */ |
868 | 869 | ||
869 | merged_datum &= mask; | 870 | merged_datum &= mask; |
870 | status = acpi_ex_write_with_update_rule (obj_desc, | 871 | status = acpi_ex_write_with_update_rule(obj_desc, |
871 | mask, merged_datum, field_offset); | 872 | mask, merged_datum, |
873 | field_offset); | ||
872 | 874 | ||
873 | return_ACPI_STATUS (status); | 875 | return_ACPI_STATUS(status); |
874 | } | 876 | } |
875 | |||
876 | |||
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 237ef28c8132..a3f4d72bedc9 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -42,15 +42,12 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
49 | 48 | ||
50 | |||
51 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME ("exmisc") | 50 | ACPI_MODULE_NAME("exmisc") |
53 | |||
54 | 51 | ||
55 | /******************************************************************************* | 52 | /******************************************************************************* |
56 | * | 53 | * |
@@ -66,27 +63,23 @@ | |||
66 | * Common code for the ref_of_op and the cond_ref_of_op. | 63 | * Common code for the ref_of_op and the cond_ref_of_op. |
67 | * | 64 | * |
68 | ******************************************************************************/ | 65 | ******************************************************************************/ |
69 | |||
70 | acpi_status | 66 | acpi_status |
71 | acpi_ex_get_object_reference ( | 67 | acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, |
72 | union acpi_operand_object *obj_desc, | 68 | union acpi_operand_object **return_desc, |
73 | union acpi_operand_object **return_desc, | 69 | struct acpi_walk_state *walk_state) |
74 | struct acpi_walk_state *walk_state) | ||
75 | { | 70 | { |
76 | union acpi_operand_object *reference_obj; | 71 | union acpi_operand_object *reference_obj; |
77 | union acpi_operand_object *referenced_obj; | 72 | union acpi_operand_object *referenced_obj; |
78 | |||
79 | |||
80 | ACPI_FUNCTION_TRACE_PTR ("ex_get_object_reference", obj_desc); | ||
81 | 73 | ||
74 | ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); | ||
82 | 75 | ||
83 | *return_desc = NULL; | 76 | *return_desc = NULL; |
84 | 77 | ||
85 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 78 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
86 | case ACPI_DESC_TYPE_OPERAND: | 79 | case ACPI_DESC_TYPE_OPERAND: |
87 | 80 | ||
88 | if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) { | 81 | if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) { |
89 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 82 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
90 | } | 83 | } |
91 | 84 | ||
92 | /* | 85 | /* |
@@ -104,13 +97,11 @@ acpi_ex_get_object_reference ( | |||
104 | 97 | ||
105 | default: | 98 | default: |
106 | 99 | ||
107 | ACPI_REPORT_ERROR (("Unknown Reference opcode in get_reference %X\n", | 100 | ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode)); |
108 | obj_desc->reference.opcode)); | 101 | return_ACPI_STATUS(AE_AML_INTERNAL); |
109 | return_ACPI_STATUS (AE_AML_INTERNAL); | ||
110 | } | 102 | } |
111 | break; | 103 | break; |
112 | 104 | ||
113 | |||
114 | case ACPI_DESC_TYPE_NAMED: | 105 | case ACPI_DESC_TYPE_NAMED: |
115 | 106 | ||
116 | /* | 107 | /* |
@@ -119,34 +110,32 @@ acpi_ex_get_object_reference ( | |||
119 | referenced_obj = obj_desc; | 110 | referenced_obj = obj_desc; |
120 | break; | 111 | break; |
121 | 112 | ||
122 | |||
123 | default: | 113 | default: |
124 | 114 | ||
125 | ACPI_REPORT_ERROR (("Invalid descriptor type in get_reference: %X\n", | 115 | ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); |
126 | ACPI_GET_DESCRIPTOR_TYPE (obj_desc))); | 116 | return_ACPI_STATUS(AE_TYPE); |
127 | return_ACPI_STATUS (AE_TYPE); | ||
128 | } | 117 | } |
129 | 118 | ||
130 | |||
131 | /* Create a new reference object */ | 119 | /* Create a new reference object */ |
132 | 120 | ||
133 | reference_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE); | 121 | reference_obj = |
122 | acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); | ||
134 | if (!reference_obj) { | 123 | if (!reference_obj) { |
135 | return_ACPI_STATUS (AE_NO_MEMORY); | 124 | return_ACPI_STATUS(AE_NO_MEMORY); |
136 | } | 125 | } |
137 | 126 | ||
138 | reference_obj->reference.opcode = AML_REF_OF_OP; | 127 | reference_obj->reference.opcode = AML_REF_OF_OP; |
139 | reference_obj->reference.object = referenced_obj; | 128 | reference_obj->reference.object = referenced_obj; |
140 | *return_desc = reference_obj; | 129 | *return_desc = reference_obj; |
141 | 130 | ||
142 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 131 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
143 | "Object %p Type [%s], returning Reference %p\n", | 132 | "Object %p Type [%s], returning Reference %p\n", |
144 | obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); | 133 | obj_desc, acpi_ut_get_object_type_name(obj_desc), |
134 | *return_desc)); | ||
145 | 135 | ||
146 | return_ACPI_STATUS (AE_OK); | 136 | return_ACPI_STATUS(AE_OK); |
147 | } | 137 | } |
148 | 138 | ||
149 | |||
150 | /******************************************************************************* | 139 | /******************************************************************************* |
151 | * | 140 | * |
152 | * FUNCTION: acpi_ex_concat_template | 141 | * FUNCTION: acpi_ex_concat_template |
@@ -163,63 +152,58 @@ acpi_ex_get_object_reference ( | |||
163 | ******************************************************************************/ | 152 | ******************************************************************************/ |
164 | 153 | ||
165 | acpi_status | 154 | acpi_status |
166 | acpi_ex_concat_template ( | 155 | acpi_ex_concat_template(union acpi_operand_object *operand0, |
167 | union acpi_operand_object *operand0, | 156 | union acpi_operand_object *operand1, |
168 | union acpi_operand_object *operand1, | 157 | union acpi_operand_object **actual_return_desc, |
169 | union acpi_operand_object **actual_return_desc, | 158 | struct acpi_walk_state *walk_state) |
170 | struct acpi_walk_state *walk_state) | ||
171 | { | 159 | { |
172 | union acpi_operand_object *return_desc; | 160 | union acpi_operand_object *return_desc; |
173 | u8 *new_buf; | 161 | u8 *new_buf; |
174 | u8 *end_tag1; | 162 | u8 *end_tag1; |
175 | u8 *end_tag2; | 163 | u8 *end_tag2; |
176 | acpi_size length1; | 164 | acpi_size length1; |
177 | acpi_size length2; | 165 | acpi_size length2; |
178 | |||
179 | |||
180 | ACPI_FUNCTION_TRACE ("ex_concat_template"); | ||
181 | 166 | ||
167 | ACPI_FUNCTION_TRACE("ex_concat_template"); | ||
182 | 168 | ||
183 | /* Find the end_tags in each resource template */ | 169 | /* Find the end_tags in each resource template */ |
184 | 170 | ||
185 | end_tag1 = acpi_ut_get_resource_end_tag (operand0); | 171 | end_tag1 = acpi_ut_get_resource_end_tag(operand0); |
186 | end_tag2 = acpi_ut_get_resource_end_tag (operand1); | 172 | end_tag2 = acpi_ut_get_resource_end_tag(operand1); |
187 | if (!end_tag1 || !end_tag2) { | 173 | if (!end_tag1 || !end_tag2) { |
188 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 174 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
189 | } | 175 | } |
190 | 176 | ||
191 | /* Compute the length of each part */ | 177 | /* Compute the length of each part */ |
192 | 178 | ||
193 | length1 = ACPI_PTR_DIFF (end_tag1, operand0->buffer.pointer); | 179 | length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); |
194 | length2 = ACPI_PTR_DIFF (end_tag2, operand1->buffer.pointer) + | 180 | length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ |
195 | 2; /* Size of END_TAG */ | ||
196 | 181 | ||
197 | /* Create a new buffer object for the result */ | 182 | /* Create a new buffer object for the result */ |
198 | 183 | ||
199 | return_desc = acpi_ut_create_buffer_object (length1 + length2); | 184 | return_desc = acpi_ut_create_buffer_object(length1 + length2); |
200 | if (!return_desc) { | 185 | if (!return_desc) { |
201 | return_ACPI_STATUS (AE_NO_MEMORY); | 186 | return_ACPI_STATUS(AE_NO_MEMORY); |
202 | } | 187 | } |
203 | 188 | ||
204 | /* Copy the templates to the new descriptor */ | 189 | /* Copy the templates to the new descriptor */ |
205 | 190 | ||
206 | new_buf = return_desc->buffer.pointer; | 191 | new_buf = return_desc->buffer.pointer; |
207 | ACPI_MEMCPY (new_buf, operand0->buffer.pointer, length1); | 192 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); |
208 | ACPI_MEMCPY (new_buf + length1, operand1->buffer.pointer, length2); | 193 | ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); |
209 | 194 | ||
210 | /* Compute the new checksum */ | 195 | /* Compute the new checksum */ |
211 | 196 | ||
212 | new_buf[return_desc->buffer.length - 1] = | 197 | new_buf[return_desc->buffer.length - 1] = |
213 | acpi_ut_generate_checksum (return_desc->buffer.pointer, | 198 | acpi_ut_generate_checksum(return_desc->buffer.pointer, |
214 | (return_desc->buffer.length - 1)); | 199 | (return_desc->buffer.length - 1)); |
215 | 200 | ||
216 | /* Return the completed template descriptor */ | 201 | /* Return the completed template descriptor */ |
217 | 202 | ||
218 | *actual_return_desc = return_desc; | 203 | *actual_return_desc = return_desc; |
219 | return_ACPI_STATUS (AE_OK); | 204 | return_ACPI_STATUS(AE_OK); |
220 | } | 205 | } |
221 | 206 | ||
222 | |||
223 | /******************************************************************************* | 207 | /******************************************************************************* |
224 | * | 208 | * |
225 | * FUNCTION: acpi_ex_do_concatenate | 209 | * FUNCTION: acpi_ex_do_concatenate |
@@ -236,21 +220,18 @@ acpi_ex_concat_template ( | |||
236 | ******************************************************************************/ | 220 | ******************************************************************************/ |
237 | 221 | ||
238 | acpi_status | 222 | acpi_status |
239 | acpi_ex_do_concatenate ( | 223 | acpi_ex_do_concatenate(union acpi_operand_object *operand0, |
240 | union acpi_operand_object *operand0, | 224 | union acpi_operand_object *operand1, |
241 | union acpi_operand_object *operand1, | 225 | union acpi_operand_object **actual_return_desc, |
242 | union acpi_operand_object **actual_return_desc, | 226 | struct acpi_walk_state *walk_state) |
243 | struct acpi_walk_state *walk_state) | ||
244 | { | 227 | { |
245 | union acpi_operand_object *local_operand1 = operand1; | 228 | union acpi_operand_object *local_operand1 = operand1; |
246 | union acpi_operand_object *return_desc; | 229 | union acpi_operand_object *return_desc; |
247 | char *new_buf; | 230 | char *new_buf; |
248 | acpi_status status; | 231 | acpi_status status; |
249 | acpi_size new_length; | 232 | acpi_size new_length; |
250 | |||
251 | |||
252 | ACPI_FUNCTION_TRACE ("ex_do_concatenate"); | ||
253 | 233 | ||
234 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); | ||
254 | 235 | ||
255 | /* | 236 | /* |
256 | * Convert the second operand if necessary. The first operand | 237 | * Convert the second operand if necessary. The first operand |
@@ -259,27 +240,28 @@ acpi_ex_do_concatenate ( | |||
259 | * guaranteed to be either Integer/String/Buffer by the operand | 240 | * guaranteed to be either Integer/String/Buffer by the operand |
260 | * resolution mechanism. | 241 | * resolution mechanism. |
261 | */ | 242 | */ |
262 | switch (ACPI_GET_OBJECT_TYPE (operand0)) { | 243 | switch (ACPI_GET_OBJECT_TYPE(operand0)) { |
263 | case ACPI_TYPE_INTEGER: | 244 | case ACPI_TYPE_INTEGER: |
264 | status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16); | 245 | status = |
246 | acpi_ex_convert_to_integer(operand1, &local_operand1, 16); | ||
265 | break; | 247 | break; |
266 | 248 | ||
267 | case ACPI_TYPE_STRING: | 249 | case ACPI_TYPE_STRING: |
268 | status = acpi_ex_convert_to_string (operand1, &local_operand1, | 250 | status = acpi_ex_convert_to_string(operand1, &local_operand1, |
269 | ACPI_IMPLICIT_CONVERT_HEX); | 251 | ACPI_IMPLICIT_CONVERT_HEX); |
270 | break; | 252 | break; |
271 | 253 | ||
272 | case ACPI_TYPE_BUFFER: | 254 | case ACPI_TYPE_BUFFER: |
273 | status = acpi_ex_convert_to_buffer (operand1, &local_operand1); | 255 | status = acpi_ex_convert_to_buffer(operand1, &local_operand1); |
274 | break; | 256 | break; |
275 | 257 | ||
276 | default: | 258 | default: |
277 | ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n", | 259 | ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", |
278 | ACPI_GET_OBJECT_TYPE (operand0))); | 260 | ACPI_GET_OBJECT_TYPE(operand0))); |
279 | status = AE_AML_INTERNAL; | 261 | status = AE_AML_INTERNAL; |
280 | } | 262 | } |
281 | 263 | ||
282 | if (ACPI_FAILURE (status)) { | 264 | if (ACPI_FAILURE(status)) { |
283 | goto cleanup; | 265 | goto cleanup; |
284 | } | 266 | } |
285 | 267 | ||
@@ -296,32 +278,33 @@ acpi_ex_do_concatenate ( | |||
296 | * 2) Two Strings concatenated to produce a new String | 278 | * 2) Two Strings concatenated to produce a new String |
297 | * 3) Two Buffers concatenated to produce a new Buffer | 279 | * 3) Two Buffers concatenated to produce a new Buffer |
298 | */ | 280 | */ |
299 | switch (ACPI_GET_OBJECT_TYPE (operand0)) { | 281 | switch (ACPI_GET_OBJECT_TYPE(operand0)) { |
300 | case ACPI_TYPE_INTEGER: | 282 | case ACPI_TYPE_INTEGER: |
301 | 283 | ||
302 | /* Result of two Integers is a Buffer */ | 284 | /* Result of two Integers is a Buffer */ |
303 | /* Need enough buffer space for two integers */ | 285 | /* Need enough buffer space for two integers */ |
304 | 286 | ||
305 | return_desc = acpi_ut_create_buffer_object ((acpi_size) | 287 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
306 | ACPI_MUL_2 (acpi_gbl_integer_byte_width)); | 288 | ACPI_MUL_2 |
289 | (acpi_gbl_integer_byte_width)); | ||
307 | if (!return_desc) { | 290 | if (!return_desc) { |
308 | status = AE_NO_MEMORY; | 291 | status = AE_NO_MEMORY; |
309 | goto cleanup; | 292 | goto cleanup; |
310 | } | 293 | } |
311 | 294 | ||
312 | new_buf = (char *) return_desc->buffer.pointer; | 295 | new_buf = (char *)return_desc->buffer.pointer; |
313 | 296 | ||
314 | /* Copy the first integer, LSB first */ | 297 | /* Copy the first integer, LSB first */ |
315 | 298 | ||
316 | ACPI_MEMCPY (new_buf, | 299 | ACPI_MEMCPY(new_buf, |
317 | &operand0->integer.value, | 300 | &operand0->integer.value, |
318 | acpi_gbl_integer_byte_width); | 301 | acpi_gbl_integer_byte_width); |
319 | 302 | ||
320 | /* Copy the second integer (LSB first) after the first */ | 303 | /* Copy the second integer (LSB first) after the first */ |
321 | 304 | ||
322 | ACPI_MEMCPY (new_buf + acpi_gbl_integer_byte_width, | 305 | ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width, |
323 | &local_operand1->integer.value, | 306 | &local_operand1->integer.value, |
324 | acpi_gbl_integer_byte_width); | 307 | acpi_gbl_integer_byte_width); |
325 | break; | 308 | break; |
326 | 309 | ||
327 | case ACPI_TYPE_STRING: | 310 | case ACPI_TYPE_STRING: |
@@ -329,13 +312,13 @@ acpi_ex_do_concatenate ( | |||
329 | /* Result of two Strings is a String */ | 312 | /* Result of two Strings is a String */ |
330 | 313 | ||
331 | new_length = (acpi_size) operand0->string.length + | 314 | new_length = (acpi_size) operand0->string.length + |
332 | (acpi_size) local_operand1->string.length; | 315 | (acpi_size) local_operand1->string.length; |
333 | if (new_length > ACPI_MAX_STRING_CONVERSION) { | 316 | if (new_length > ACPI_MAX_STRING_CONVERSION) { |
334 | status = AE_AML_STRING_LIMIT; | 317 | status = AE_AML_STRING_LIMIT; |
335 | goto cleanup; | 318 | goto cleanup; |
336 | } | 319 | } |
337 | 320 | ||
338 | return_desc = acpi_ut_create_string_object (new_length); | 321 | return_desc = acpi_ut_create_string_object(new_length); |
339 | if (!return_desc) { | 322 | if (!return_desc) { |
340 | status = AE_NO_MEMORY; | 323 | status = AE_NO_MEMORY; |
341 | goto cleanup; | 324 | goto cleanup; |
@@ -345,56 +328,56 @@ acpi_ex_do_concatenate ( | |||
345 | 328 | ||
346 | /* Concatenate the strings */ | 329 | /* Concatenate the strings */ |
347 | 330 | ||
348 | ACPI_STRCPY (new_buf, | 331 | ACPI_STRCPY(new_buf, operand0->string.pointer); |
349 | operand0->string.pointer); | 332 | ACPI_STRCPY(new_buf + operand0->string.length, |
350 | ACPI_STRCPY (new_buf + operand0->string.length, | 333 | local_operand1->string.pointer); |
351 | local_operand1->string.pointer); | ||
352 | break; | 334 | break; |
353 | 335 | ||
354 | case ACPI_TYPE_BUFFER: | 336 | case ACPI_TYPE_BUFFER: |
355 | 337 | ||
356 | /* Result of two Buffers is a Buffer */ | 338 | /* Result of two Buffers is a Buffer */ |
357 | 339 | ||
358 | return_desc = acpi_ut_create_buffer_object ( | 340 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
359 | (acpi_size) operand0->buffer.length + | 341 | operand0->buffer. |
360 | (acpi_size) local_operand1->buffer.length); | 342 | length + |
343 | (acpi_size) | ||
344 | local_operand1-> | ||
345 | buffer.length); | ||
361 | if (!return_desc) { | 346 | if (!return_desc) { |
362 | status = AE_NO_MEMORY; | 347 | status = AE_NO_MEMORY; |
363 | goto cleanup; | 348 | goto cleanup; |
364 | } | 349 | } |
365 | 350 | ||
366 | new_buf = (char *) return_desc->buffer.pointer; | 351 | new_buf = (char *)return_desc->buffer.pointer; |
367 | 352 | ||
368 | /* Concatenate the buffers */ | 353 | /* Concatenate the buffers */ |
369 | 354 | ||
370 | ACPI_MEMCPY (new_buf, | 355 | ACPI_MEMCPY(new_buf, |
371 | operand0->buffer.pointer, | 356 | operand0->buffer.pointer, operand0->buffer.length); |
372 | operand0->buffer.length); | 357 | ACPI_MEMCPY(new_buf + operand0->buffer.length, |
373 | ACPI_MEMCPY (new_buf + operand0->buffer.length, | 358 | local_operand1->buffer.pointer, |
374 | local_operand1->buffer.pointer, | 359 | local_operand1->buffer.length); |
375 | local_operand1->buffer.length); | ||
376 | break; | 360 | break; |
377 | 361 | ||
378 | default: | 362 | default: |
379 | 363 | ||
380 | /* Invalid object type, should not happen here */ | 364 | /* Invalid object type, should not happen here */ |
381 | 365 | ||
382 | ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n", | 366 | ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n", |
383 | ACPI_GET_OBJECT_TYPE (operand0))); | 367 | ACPI_GET_OBJECT_TYPE(operand0))); |
384 | status =AE_AML_INTERNAL; | 368 | status = AE_AML_INTERNAL; |
385 | goto cleanup; | 369 | goto cleanup; |
386 | } | 370 | } |
387 | 371 | ||
388 | *actual_return_desc = return_desc; | 372 | *actual_return_desc = return_desc; |
389 | 373 | ||
390 | cleanup: | 374 | cleanup: |
391 | if (local_operand1 != operand1) { | 375 | if (local_operand1 != operand1) { |
392 | acpi_ut_remove_reference (local_operand1); | 376 | acpi_ut_remove_reference(local_operand1); |
393 | } | 377 | } |
394 | return_ACPI_STATUS (status); | 378 | return_ACPI_STATUS(status); |
395 | } | 379 | } |
396 | 380 | ||
397 | |||
398 | /******************************************************************************* | 381 | /******************************************************************************* |
399 | * | 382 | * |
400 | * FUNCTION: acpi_ex_do_math_op | 383 | * FUNCTION: acpi_ex_do_math_op |
@@ -412,62 +395,49 @@ cleanup: | |||
412 | ******************************************************************************/ | 395 | ******************************************************************************/ |
413 | 396 | ||
414 | acpi_integer | 397 | acpi_integer |
415 | acpi_ex_do_math_op ( | 398 | acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) |
416 | u16 opcode, | ||
417 | acpi_integer integer0, | ||
418 | acpi_integer integer1) | ||
419 | { | 399 | { |
420 | 400 | ||
421 | ACPI_FUNCTION_ENTRY (); | 401 | ACPI_FUNCTION_ENTRY(); |
422 | |||
423 | 402 | ||
424 | switch (opcode) { | 403 | switch (opcode) { |
425 | case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */ | 404 | case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */ |
426 | 405 | ||
427 | return (integer0 + integer1); | 406 | return (integer0 + integer1); |
428 | 407 | ||
429 | 408 | case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */ | |
430 | case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */ | ||
431 | 409 | ||
432 | return (integer0 & integer1); | 410 | return (integer0 & integer1); |
433 | 411 | ||
434 | 412 | case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */ | |
435 | case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */ | ||
436 | 413 | ||
437 | return (~(integer0 & integer1)); | 414 | return (~(integer0 & integer1)); |
438 | 415 | ||
439 | 416 | case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */ | |
440 | case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */ | ||
441 | 417 | ||
442 | return (integer0 | integer1); | 418 | return (integer0 | integer1); |
443 | 419 | ||
444 | 420 | case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */ | |
445 | case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */ | ||
446 | 421 | ||
447 | return (~(integer0 | integer1)); | 422 | return (~(integer0 | integer1)); |
448 | 423 | ||
449 | 424 | case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */ | |
450 | case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */ | ||
451 | 425 | ||
452 | return (integer0 ^ integer1); | 426 | return (integer0 ^ integer1); |
453 | 427 | ||
454 | 428 | case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */ | |
455 | case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */ | ||
456 | 429 | ||
457 | return (integer0 * integer1); | 430 | return (integer0 * integer1); |
458 | 431 | ||
459 | 432 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ | |
460 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/ | ||
461 | 433 | ||
462 | return (integer0 << integer1); | 434 | return (integer0 << integer1); |
463 | 435 | ||
464 | 436 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ | |
465 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ | ||
466 | 437 | ||
467 | return (integer0 >> integer1); | 438 | return (integer0 >> integer1); |
468 | 439 | ||
469 | 440 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ | |
470 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ | ||
471 | 441 | ||
472 | return (integer0 - integer1); | 442 | return (integer0 - integer1); |
473 | 443 | ||
@@ -477,7 +447,6 @@ acpi_ex_do_math_op ( | |||
477 | } | 447 | } |
478 | } | 448 | } |
479 | 449 | ||
480 | |||
481 | /******************************************************************************* | 450 | /******************************************************************************* |
482 | * | 451 | * |
483 | * FUNCTION: acpi_ex_do_logical_numeric_op | 452 | * FUNCTION: acpi_ex_do_logical_numeric_op |
@@ -499,28 +468,24 @@ acpi_ex_do_math_op ( | |||
499 | ******************************************************************************/ | 468 | ******************************************************************************/ |
500 | 469 | ||
501 | acpi_status | 470 | acpi_status |
502 | acpi_ex_do_logical_numeric_op ( | 471 | acpi_ex_do_logical_numeric_op(u16 opcode, |
503 | u16 opcode, | 472 | acpi_integer integer0, |
504 | acpi_integer integer0, | 473 | acpi_integer integer1, u8 * logical_result) |
505 | acpi_integer integer1, | ||
506 | u8 *logical_result) | ||
507 | { | 474 | { |
508 | acpi_status status = AE_OK; | 475 | acpi_status status = AE_OK; |
509 | u8 local_result = FALSE; | 476 | u8 local_result = FALSE; |
510 | |||
511 | |||
512 | ACPI_FUNCTION_TRACE ("ex_do_logical_numeric_op"); | ||
513 | 477 | ||
478 | ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); | ||
514 | 479 | ||
515 | switch (opcode) { | 480 | switch (opcode) { |
516 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ | 481 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ |
517 | 482 | ||
518 | if (integer0 && integer1) { | 483 | if (integer0 && integer1) { |
519 | local_result = TRUE; | 484 | local_result = TRUE; |
520 | } | 485 | } |
521 | break; | 486 | break; |
522 | 487 | ||
523 | case AML_LOR_OP: /* LOr (Integer0, Integer1) */ | 488 | case AML_LOR_OP: /* LOr (Integer0, Integer1) */ |
524 | 489 | ||
525 | if (integer0 || integer1) { | 490 | if (integer0 || integer1) { |
526 | local_result = TRUE; | 491 | local_result = TRUE; |
@@ -535,10 +500,9 @@ acpi_ex_do_logical_numeric_op ( | |||
535 | /* Return the logical result and status */ | 500 | /* Return the logical result and status */ |
536 | 501 | ||
537 | *logical_result = local_result; | 502 | *logical_result = local_result; |
538 | return_ACPI_STATUS (status); | 503 | return_ACPI_STATUS(status); |
539 | } | 504 | } |
540 | 505 | ||
541 | |||
542 | /******************************************************************************* | 506 | /******************************************************************************* |
543 | * | 507 | * |
544 | * FUNCTION: acpi_ex_do_logical_op | 508 | * FUNCTION: acpi_ex_do_logical_op |
@@ -566,24 +530,20 @@ acpi_ex_do_logical_numeric_op ( | |||
566 | ******************************************************************************/ | 530 | ******************************************************************************/ |
567 | 531 | ||
568 | acpi_status | 532 | acpi_status |
569 | acpi_ex_do_logical_op ( | 533 | acpi_ex_do_logical_op(u16 opcode, |
570 | u16 opcode, | 534 | union acpi_operand_object *operand0, |
571 | union acpi_operand_object *operand0, | 535 | union acpi_operand_object *operand1, u8 * logical_result) |
572 | union acpi_operand_object *operand1, | ||
573 | u8 *logical_result) | ||
574 | { | 536 | { |
575 | union acpi_operand_object *local_operand1 = operand1; | 537 | union acpi_operand_object *local_operand1 = operand1; |
576 | acpi_integer integer0; | 538 | acpi_integer integer0; |
577 | acpi_integer integer1; | 539 | acpi_integer integer1; |
578 | u32 length0; | 540 | u32 length0; |
579 | u32 length1; | 541 | u32 length1; |
580 | acpi_status status = AE_OK; | 542 | acpi_status status = AE_OK; |
581 | u8 local_result = FALSE; | 543 | u8 local_result = FALSE; |
582 | int compare; | 544 | int compare; |
583 | |||
584 | |||
585 | ACPI_FUNCTION_TRACE ("ex_do_logical_op"); | ||
586 | 545 | ||
546 | ACPI_FUNCTION_TRACE("ex_do_logical_op"); | ||
587 | 547 | ||
588 | /* | 548 | /* |
589 | * Convert the second operand if necessary. The first operand | 549 | * Convert the second operand if necessary. The first operand |
@@ -592,18 +552,19 @@ acpi_ex_do_logical_op ( | |||
592 | * guaranteed to be either Integer/String/Buffer by the operand | 552 | * guaranteed to be either Integer/String/Buffer by the operand |
593 | * resolution mechanism. | 553 | * resolution mechanism. |
594 | */ | 554 | */ |
595 | switch (ACPI_GET_OBJECT_TYPE (operand0)) { | 555 | switch (ACPI_GET_OBJECT_TYPE(operand0)) { |
596 | case ACPI_TYPE_INTEGER: | 556 | case ACPI_TYPE_INTEGER: |
597 | status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16); | 557 | status = |
558 | acpi_ex_convert_to_integer(operand1, &local_operand1, 16); | ||
598 | break; | 559 | break; |
599 | 560 | ||
600 | case ACPI_TYPE_STRING: | 561 | case ACPI_TYPE_STRING: |
601 | status = acpi_ex_convert_to_string (operand1, &local_operand1, | 562 | status = acpi_ex_convert_to_string(operand1, &local_operand1, |
602 | ACPI_IMPLICIT_CONVERT_HEX); | 563 | ACPI_IMPLICIT_CONVERT_HEX); |
603 | break; | 564 | break; |
604 | 565 | ||
605 | case ACPI_TYPE_BUFFER: | 566 | case ACPI_TYPE_BUFFER: |
606 | status = acpi_ex_convert_to_buffer (operand1, &local_operand1); | 567 | status = acpi_ex_convert_to_buffer(operand1, &local_operand1); |
607 | break; | 568 | break; |
608 | 569 | ||
609 | default: | 570 | default: |
@@ -611,14 +572,14 @@ acpi_ex_do_logical_op ( | |||
611 | break; | 572 | break; |
612 | } | 573 | } |
613 | 574 | ||
614 | if (ACPI_FAILURE (status)) { | 575 | if (ACPI_FAILURE(status)) { |
615 | goto cleanup; | 576 | goto cleanup; |
616 | } | 577 | } |
617 | 578 | ||
618 | /* | 579 | /* |
619 | * Two cases: 1) Both Integers, 2) Both Strings or Buffers | 580 | * Two cases: 1) Both Integers, 2) Both Strings or Buffers |
620 | */ | 581 | */ |
621 | if (ACPI_GET_OBJECT_TYPE (operand0) == ACPI_TYPE_INTEGER) { | 582 | if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) { |
622 | /* | 583 | /* |
623 | * 1) Both operands are of type integer | 584 | * 1) Both operands are of type integer |
624 | * Note: local_operand1 may have changed above | 585 | * Note: local_operand1 may have changed above |
@@ -627,21 +588,21 @@ acpi_ex_do_logical_op ( | |||
627 | integer1 = local_operand1->integer.value; | 588 | integer1 = local_operand1->integer.value; |
628 | 589 | ||
629 | switch (opcode) { | 590 | switch (opcode) { |
630 | case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ | 591 | case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ |
631 | 592 | ||
632 | if (integer0 == integer1) { | 593 | if (integer0 == integer1) { |
633 | local_result = TRUE; | 594 | local_result = TRUE; |
634 | } | 595 | } |
635 | break; | 596 | break; |
636 | 597 | ||
637 | case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ | 598 | case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ |
638 | 599 | ||
639 | if (integer0 > integer1) { | 600 | if (integer0 > integer1) { |
640 | local_result = TRUE; | 601 | local_result = TRUE; |
641 | } | 602 | } |
642 | break; | 603 | break; |
643 | 604 | ||
644 | case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ | 605 | case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ |
645 | 606 | ||
646 | if (integer0 < integer1) { | 607 | if (integer0 < integer1) { |
647 | local_result = TRUE; | 608 | local_result = TRUE; |
@@ -652,8 +613,7 @@ acpi_ex_do_logical_op ( | |||
652 | status = AE_AML_INTERNAL; | 613 | status = AE_AML_INTERNAL; |
653 | break; | 614 | break; |
654 | } | 615 | } |
655 | } | 616 | } else { |
656 | else { | ||
657 | /* | 617 | /* |
658 | * 2) Both operands are Strings or both are Buffers | 618 | * 2) Both operands are Strings or both are Buffers |
659 | * Note: Code below takes advantage of common Buffer/String | 619 | * Note: Code below takes advantage of common Buffer/String |
@@ -665,31 +625,31 @@ acpi_ex_do_logical_op ( | |||
665 | 625 | ||
666 | /* Lexicographic compare: compare the data bytes */ | 626 | /* Lexicographic compare: compare the data bytes */ |
667 | 627 | ||
668 | compare = ACPI_MEMCMP ((const char * ) operand0->buffer.pointer, | 628 | compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, |
669 | (const char * ) local_operand1->buffer.pointer, | 629 | (const char *)local_operand1->buffer. |
670 | (length0 > length1) ? length1 : length0); | 630 | pointer, |
631 | (length0 > length1) ? length1 : length0); | ||
671 | 632 | ||
672 | switch (opcode) { | 633 | switch (opcode) { |
673 | case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ | 634 | case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ |
674 | 635 | ||
675 | /* Length and all bytes must be equal */ | 636 | /* Length and all bytes must be equal */ |
676 | 637 | ||
677 | if ((length0 == length1) && | 638 | if ((length0 == length1) && (compare == 0)) { |
678 | (compare == 0)) { | ||
679 | /* Length and all bytes match ==> TRUE */ | 639 | /* Length and all bytes match ==> TRUE */ |
680 | 640 | ||
681 | local_result = TRUE; | 641 | local_result = TRUE; |
682 | } | 642 | } |
683 | break; | 643 | break; |
684 | 644 | ||
685 | case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ | 645 | case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ |
686 | 646 | ||
687 | if (compare > 0) { | 647 | if (compare > 0) { |
688 | local_result = TRUE; | 648 | local_result = TRUE; |
689 | goto cleanup; /* TRUE */ | 649 | goto cleanup; /* TRUE */ |
690 | } | 650 | } |
691 | if (compare < 0) { | 651 | if (compare < 0) { |
692 | goto cleanup; /* FALSE */ | 652 | goto cleanup; /* FALSE */ |
693 | } | 653 | } |
694 | 654 | ||
695 | /* Bytes match (to shortest length), compare lengths */ | 655 | /* Bytes match (to shortest length), compare lengths */ |
@@ -699,14 +659,14 @@ acpi_ex_do_logical_op ( | |||
699 | } | 659 | } |
700 | break; | 660 | break; |
701 | 661 | ||
702 | case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ | 662 | case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ |
703 | 663 | ||
704 | if (compare > 0) { | 664 | if (compare > 0) { |
705 | goto cleanup; /* FALSE */ | 665 | goto cleanup; /* FALSE */ |
706 | } | 666 | } |
707 | if (compare < 0) { | 667 | if (compare < 0) { |
708 | local_result = TRUE; | 668 | local_result = TRUE; |
709 | goto cleanup; /* TRUE */ | 669 | goto cleanup; /* TRUE */ |
710 | } | 670 | } |
711 | 671 | ||
712 | /* Bytes match (to shortest length), compare lengths */ | 672 | /* Bytes match (to shortest length), compare lengths */ |
@@ -722,18 +682,16 @@ acpi_ex_do_logical_op ( | |||
722 | } | 682 | } |
723 | } | 683 | } |
724 | 684 | ||
725 | cleanup: | 685 | cleanup: |
726 | 686 | ||
727 | /* New object was created if implicit conversion performed - delete */ | 687 | /* New object was created if implicit conversion performed - delete */ |
728 | 688 | ||
729 | if (local_operand1 != operand1) { | 689 | if (local_operand1 != operand1) { |
730 | acpi_ut_remove_reference (local_operand1); | 690 | acpi_ut_remove_reference(local_operand1); |
731 | } | 691 | } |
732 | 692 | ||
733 | /* Return the logical result and status */ | 693 | /* Return the logical result and status */ |
734 | 694 | ||
735 | *logical_result = local_result; | 695 | *logical_result = local_result; |
736 | return_ACPI_STATUS (status); | 696 | return_ACPI_STATUS(status); |
737 | } | 697 | } |
738 | |||
739 | |||
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index c3cb714d2cba..ab47f6d8b5c0 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -42,20 +42,16 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME ("exmutex") | 49 | ACPI_MODULE_NAME("exmutex") |
51 | 50 | ||
52 | /* Local prototypes */ | 51 | /* Local prototypes */ |
53 | |||
54 | static void | 52 | static void |
55 | acpi_ex_link_mutex ( | 53 | acpi_ex_link_mutex(union acpi_operand_object *obj_desc, |
56 | union acpi_operand_object *obj_desc, | 54 | struct acpi_thread_state *thread); |
57 | struct acpi_thread_state *thread); | ||
58 | |||
59 | 55 | ||
60 | /******************************************************************************* | 56 | /******************************************************************************* |
61 | * | 57 | * |
@@ -69,12 +65,9 @@ acpi_ex_link_mutex ( | |||
69 | * | 65 | * |
70 | ******************************************************************************/ | 66 | ******************************************************************************/ |
71 | 67 | ||
72 | void | 68 | void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) |
73 | acpi_ex_unlink_mutex ( | ||
74 | union acpi_operand_object *obj_desc) | ||
75 | { | 69 | { |
76 | struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; | 70 | struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; |
77 | |||
78 | 71 | ||
79 | if (!thread) { | 72 | if (!thread) { |
80 | return; | 73 | return; |
@@ -88,13 +81,11 @@ acpi_ex_unlink_mutex ( | |||
88 | 81 | ||
89 | if (obj_desc->mutex.prev) { | 82 | if (obj_desc->mutex.prev) { |
90 | (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; | 83 | (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; |
91 | } | 84 | } else { |
92 | else { | ||
93 | thread->acquired_mutex_list = obj_desc->mutex.next; | 85 | thread->acquired_mutex_list = obj_desc->mutex.next; |
94 | } | 86 | } |
95 | } | 87 | } |
96 | 88 | ||
97 | |||
98 | /******************************************************************************* | 89 | /******************************************************************************* |
99 | * | 90 | * |
100 | * FUNCTION: acpi_ex_link_mutex | 91 | * FUNCTION: acpi_ex_link_mutex |
@@ -109,12 +100,10 @@ acpi_ex_unlink_mutex ( | |||
109 | ******************************************************************************/ | 100 | ******************************************************************************/ |
110 | 101 | ||
111 | static void | 102 | static void |
112 | acpi_ex_link_mutex ( | 103 | acpi_ex_link_mutex(union acpi_operand_object *obj_desc, |
113 | union acpi_operand_object *obj_desc, | 104 | struct acpi_thread_state *thread) |
114 | struct acpi_thread_state *thread) | ||
115 | { | 105 | { |
116 | union acpi_operand_object *list_head; | 106 | union acpi_operand_object *list_head; |
117 | |||
118 | 107 | ||
119 | list_head = thread->acquired_mutex_list; | 108 | list_head = thread->acquired_mutex_list; |
120 | 109 | ||
@@ -134,7 +123,6 @@ acpi_ex_link_mutex ( | |||
134 | thread->acquired_mutex_list = obj_desc; | 123 | thread->acquired_mutex_list = obj_desc; |
135 | } | 124 | } |
136 | 125 | ||
137 | |||
138 | /******************************************************************************* | 126 | /******************************************************************************* |
139 | * | 127 | * |
140 | * FUNCTION: acpi_ex_acquire_mutex | 128 | * FUNCTION: acpi_ex_acquire_mutex |
@@ -150,27 +138,23 @@ acpi_ex_link_mutex ( | |||
150 | ******************************************************************************/ | 138 | ******************************************************************************/ |
151 | 139 | ||
152 | acpi_status | 140 | acpi_status |
153 | acpi_ex_acquire_mutex ( | 141 | acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, |
154 | union acpi_operand_object *time_desc, | 142 | union acpi_operand_object *obj_desc, |
155 | union acpi_operand_object *obj_desc, | 143 | struct acpi_walk_state *walk_state) |
156 | struct acpi_walk_state *walk_state) | ||
157 | { | 144 | { |
158 | acpi_status status; | 145 | acpi_status status; |
159 | |||
160 | |||
161 | ACPI_FUNCTION_TRACE_PTR ("ex_acquire_mutex", obj_desc); | ||
162 | 146 | ||
147 | ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc); | ||
163 | 148 | ||
164 | if (!obj_desc) { | 149 | if (!obj_desc) { |
165 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 150 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
166 | } | 151 | } |
167 | 152 | ||
168 | /* Sanity check -- we must have a valid thread ID */ | 153 | /* Sanity check -- we must have a valid thread ID */ |
169 | 154 | ||
170 | if (!walk_state->thread) { | 155 | if (!walk_state->thread) { |
171 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", | 156 | ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); |
172 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 157 | return_ACPI_STATUS(AE_AML_INTERNAL); |
173 | return_ACPI_STATUS (AE_AML_INTERNAL); | ||
174 | } | 158 | } |
175 | 159 | ||
176 | /* | 160 | /* |
@@ -178,10 +162,8 @@ acpi_ex_acquire_mutex ( | |||
178 | * mutex. This mechanism provides some deadlock prevention | 162 | * mutex. This mechanism provides some deadlock prevention |
179 | */ | 163 | */ |
180 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 164 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
181 | ACPI_REPORT_ERROR (( | 165 | ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node))); |
182 | "Cannot acquire Mutex [%4.4s], incorrect sync_level\n", | 166 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
183 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
184 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | ||
185 | } | 167 | } |
186 | 168 | ||
187 | /* Support for multiple acquires by the owning thread */ | 169 | /* Support for multiple acquires by the owning thread */ |
@@ -190,43 +172,43 @@ acpi_ex_acquire_mutex ( | |||
190 | /* Special case for Global Lock, allow all threads */ | 172 | /* Special case for Global Lock, allow all threads */ |
191 | 173 | ||
192 | if ((obj_desc->mutex.owner_thread->thread_id == | 174 | if ((obj_desc->mutex.owner_thread->thread_id == |
193 | walk_state->thread->thread_id) || | 175 | walk_state->thread->thread_id) || |
194 | (obj_desc->mutex.semaphore == | 176 | (obj_desc->mutex.semaphore == |
195 | acpi_gbl_global_lock_semaphore)) { | 177 | acpi_gbl_global_lock_semaphore)) { |
196 | /* | 178 | /* |
197 | * The mutex is already owned by this thread, | 179 | * The mutex is already owned by this thread, |
198 | * just increment the acquisition depth | 180 | * just increment the acquisition depth |
199 | */ | 181 | */ |
200 | obj_desc->mutex.acquisition_depth++; | 182 | obj_desc->mutex.acquisition_depth++; |
201 | return_ACPI_STATUS (AE_OK); | 183 | return_ACPI_STATUS(AE_OK); |
202 | } | 184 | } |
203 | } | 185 | } |
204 | 186 | ||
205 | /* Acquire the mutex, wait if necessary */ | 187 | /* Acquire the mutex, wait if necessary */ |
206 | 188 | ||
207 | status = acpi_ex_system_acquire_mutex (time_desc, obj_desc); | 189 | status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); |
208 | if (ACPI_FAILURE (status)) { | 190 | if (ACPI_FAILURE(status)) { |
209 | /* Includes failure from a timeout on time_desc */ | 191 | /* Includes failure from a timeout on time_desc */ |
210 | 192 | ||
211 | return_ACPI_STATUS (status); | 193 | return_ACPI_STATUS(status); |
212 | } | 194 | } |
213 | 195 | ||
214 | /* Have the mutex: update mutex and walk info and save the sync_level */ | 196 | /* Have the mutex: update mutex and walk info and save the sync_level */ |
215 | 197 | ||
216 | obj_desc->mutex.owner_thread = walk_state->thread; | 198 | obj_desc->mutex.owner_thread = walk_state->thread; |
217 | obj_desc->mutex.acquisition_depth = 1; | 199 | obj_desc->mutex.acquisition_depth = 1; |
218 | obj_desc->mutex.original_sync_level = walk_state->thread->current_sync_level; | 200 | obj_desc->mutex.original_sync_level = |
201 | walk_state->thread->current_sync_level; | ||
219 | 202 | ||
220 | walk_state->thread->current_sync_level = obj_desc->mutex.sync_level; | 203 | walk_state->thread->current_sync_level = obj_desc->mutex.sync_level; |
221 | 204 | ||
222 | /* Link the mutex to the current thread for force-unlock at method exit */ | 205 | /* Link the mutex to the current thread for force-unlock at method exit */ |
223 | 206 | ||
224 | acpi_ex_link_mutex (obj_desc, walk_state->thread); | 207 | acpi_ex_link_mutex(obj_desc, walk_state->thread); |
225 | 208 | ||
226 | return_ACPI_STATUS (AE_OK); | 209 | return_ACPI_STATUS(AE_OK); |
227 | } | 210 | } |
228 | 211 | ||
229 | |||
230 | /******************************************************************************* | 212 | /******************************************************************************* |
231 | * | 213 | * |
232 | * FUNCTION: acpi_ex_release_mutex | 214 | * FUNCTION: acpi_ex_release_mutex |
@@ -241,48 +223,40 @@ acpi_ex_acquire_mutex ( | |||
241 | ******************************************************************************/ | 223 | ******************************************************************************/ |
242 | 224 | ||
243 | acpi_status | 225 | acpi_status |
244 | acpi_ex_release_mutex ( | 226 | acpi_ex_release_mutex(union acpi_operand_object *obj_desc, |
245 | union acpi_operand_object *obj_desc, | 227 | struct acpi_walk_state *walk_state) |
246 | struct acpi_walk_state *walk_state) | ||
247 | { | 228 | { |
248 | acpi_status status; | 229 | acpi_status status; |
249 | |||
250 | |||
251 | ACPI_FUNCTION_TRACE ("ex_release_mutex"); | ||
252 | 230 | ||
231 | ACPI_FUNCTION_TRACE("ex_release_mutex"); | ||
253 | 232 | ||
254 | if (!obj_desc) { | 233 | if (!obj_desc) { |
255 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 234 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
256 | } | 235 | } |
257 | 236 | ||
258 | /* The mutex must have been previously acquired in order to release it */ | 237 | /* The mutex must have been previously acquired in order to release it */ |
259 | 238 | ||
260 | if (!obj_desc->mutex.owner_thread) { | 239 | if (!obj_desc->mutex.owner_thread) { |
261 | ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n", | 240 | ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node))); |
262 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 241 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); |
263 | return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); | ||
264 | } | 242 | } |
265 | 243 | ||
266 | /* Sanity check -- we must have a valid thread ID */ | 244 | /* Sanity check -- we must have a valid thread ID */ |
267 | 245 | ||
268 | if (!walk_state->thread) { | 246 | if (!walk_state->thread) { |
269 | ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n", | 247 | ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); |
270 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 248 | return_ACPI_STATUS(AE_AML_INTERNAL); |
271 | return_ACPI_STATUS (AE_AML_INTERNAL); | ||
272 | } | 249 | } |
273 | 250 | ||
274 | /* | 251 | /* |
275 | * The Mutex is owned, but this thread must be the owner. | 252 | * The Mutex is owned, but this thread must be the owner. |
276 | * Special case for Global Lock, any thread can release | 253 | * Special case for Global Lock, any thread can release |
277 | */ | 254 | */ |
278 | if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) && | 255 | if ((obj_desc->mutex.owner_thread->thread_id != |
279 | (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { | 256 | walk_state->thread->thread_id) |
280 | ACPI_REPORT_ERROR (( | 257 | && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { |
281 | "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", | 258 | ACPI_REPORT_ERROR(("Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", walk_state->thread->thread_id, acpi_ut_get_node_name(obj_desc->mutex.node), obj_desc->mutex.owner_thread->thread_id)); |
282 | walk_state->thread->thread_id, | 259 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
283 | acpi_ut_get_node_name (obj_desc->mutex.node), | ||
284 | obj_desc->mutex.owner_thread->thread_id)); | ||
285 | return_ACPI_STATUS (AE_AML_NOT_OWNER); | ||
286 | } | 260 | } |
287 | 261 | ||
288 | /* | 262 | /* |
@@ -290,10 +264,8 @@ acpi_ex_release_mutex ( | |||
290 | * equal to the current sync level | 264 | * equal to the current sync level |
291 | */ | 265 | */ |
292 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 266 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
293 | ACPI_REPORT_ERROR (( | 267 | ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node))); |
294 | "Cannot release Mutex [%4.4s], incorrect sync_level\n", | 268 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
295 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
296 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | ||
297 | } | 269 | } |
298 | 270 | ||
299 | /* Match multiple Acquires with multiple Releases */ | 271 | /* Match multiple Acquires with multiple Releases */ |
@@ -302,26 +274,26 @@ acpi_ex_release_mutex ( | |||
302 | if (obj_desc->mutex.acquisition_depth != 0) { | 274 | if (obj_desc->mutex.acquisition_depth != 0) { |
303 | /* Just decrement the depth and return */ | 275 | /* Just decrement the depth and return */ |
304 | 276 | ||
305 | return_ACPI_STATUS (AE_OK); | 277 | return_ACPI_STATUS(AE_OK); |
306 | } | 278 | } |
307 | 279 | ||
308 | /* Unlink the mutex from the owner's list */ | 280 | /* Unlink the mutex from the owner's list */ |
309 | 281 | ||
310 | acpi_ex_unlink_mutex (obj_desc); | 282 | acpi_ex_unlink_mutex(obj_desc); |
311 | 283 | ||
312 | /* Release the mutex */ | 284 | /* Release the mutex */ |
313 | 285 | ||
314 | status = acpi_ex_system_release_mutex (obj_desc); | 286 | status = acpi_ex_system_release_mutex(obj_desc); |
315 | 287 | ||
316 | /* Update the mutex and walk state, restore sync_level before acquire */ | 288 | /* Update the mutex and walk state, restore sync_level before acquire */ |
317 | 289 | ||
318 | obj_desc->mutex.owner_thread = NULL; | 290 | obj_desc->mutex.owner_thread = NULL; |
319 | walk_state->thread->current_sync_level = obj_desc->mutex.original_sync_level; | 291 | walk_state->thread->current_sync_level = |
292 | obj_desc->mutex.original_sync_level; | ||
320 | 293 | ||
321 | return_ACPI_STATUS (status); | 294 | return_ACPI_STATUS(status); |
322 | } | 295 | } |
323 | 296 | ||
324 | |||
325 | /******************************************************************************* | 297 | /******************************************************************************* |
326 | * | 298 | * |
327 | * FUNCTION: acpi_ex_release_all_mutexes | 299 | * FUNCTION: acpi_ex_release_all_mutexes |
@@ -334,17 +306,13 @@ acpi_ex_release_mutex ( | |||
334 | * | 306 | * |
335 | ******************************************************************************/ | 307 | ******************************************************************************/ |
336 | 308 | ||
337 | void | 309 | void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) |
338 | acpi_ex_release_all_mutexes ( | ||
339 | struct acpi_thread_state *thread) | ||
340 | { | 310 | { |
341 | union acpi_operand_object *next = thread->acquired_mutex_list; | 311 | union acpi_operand_object *next = thread->acquired_mutex_list; |
342 | union acpi_operand_object *this; | 312 | union acpi_operand_object *this; |
343 | acpi_status status; | 313 | acpi_status status; |
344 | |||
345 | |||
346 | ACPI_FUNCTION_ENTRY (); | ||
347 | 314 | ||
315 | ACPI_FUNCTION_ENTRY(); | ||
348 | 316 | ||
349 | /* Traverse the list of owned mutexes, releasing each one */ | 317 | /* Traverse the list of owned mutexes, releasing each one */ |
350 | 318 | ||
@@ -353,13 +321,13 @@ acpi_ex_release_all_mutexes ( | |||
353 | next = this->mutex.next; | 321 | next = this->mutex.next; |
354 | 322 | ||
355 | this->mutex.acquisition_depth = 1; | 323 | this->mutex.acquisition_depth = 1; |
356 | this->mutex.prev = NULL; | 324 | this->mutex.prev = NULL; |
357 | this->mutex.next = NULL; | 325 | this->mutex.next = NULL; |
358 | 326 | ||
359 | /* Release the mutex */ | 327 | /* Release the mutex */ |
360 | 328 | ||
361 | status = acpi_ex_system_release_mutex (this); | 329 | status = acpi_ex_system_release_mutex(this); |
362 | if (ACPI_FAILURE (status)) { | 330 | if (ACPI_FAILURE(status)) { |
363 | continue; | 331 | continue; |
364 | } | 332 | } |
365 | 333 | ||
@@ -372,5 +340,3 @@ acpi_ex_release_all_mutexes ( | |||
372 | thread->current_sync_level = this->mutex.original_sync_level; | 340 | thread->current_sync_level = this->mutex.original_sync_level; |
373 | } | 341 | } |
374 | } | 342 | } |
375 | |||
376 | |||
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index b6ba1a7a677a..239d8473e9a5 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -42,26 +42,18 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
49 | 48 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exnames") | 50 | ACPI_MODULE_NAME("exnames") |
52 | 51 | ||
53 | /* Local prototypes */ | 52 | /* Local prototypes */ |
54 | 53 | static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs); | |
55 | static char * | ||
56 | acpi_ex_allocate_name_string ( | ||
57 | u32 prefix_count, | ||
58 | u32 num_name_segs); | ||
59 | 54 | ||
60 | static acpi_status | 55 | static acpi_status |
61 | acpi_ex_name_segment ( | 56 | acpi_ex_name_segment(u8 ** in_aml_address, char *name_string); |
62 | u8 **in_aml_address, | ||
63 | char *name_string); | ||
64 | |||
65 | 57 | ||
66 | /******************************************************************************* | 58 | /******************************************************************************* |
67 | * | 59 | * |
@@ -79,17 +71,13 @@ acpi_ex_name_segment ( | |||
79 | * | 71 | * |
80 | ******************************************************************************/ | 72 | ******************************************************************************/ |
81 | 73 | ||
82 | static char * | 74 | static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) |
83 | acpi_ex_allocate_name_string ( | ||
84 | u32 prefix_count, | ||
85 | u32 num_name_segs) | ||
86 | { | 75 | { |
87 | char *temp_ptr; | 76 | char *temp_ptr; |
88 | char *name_string; | 77 | char *name_string; |
89 | u32 size_needed; | 78 | u32 size_needed; |
90 | |||
91 | ACPI_FUNCTION_TRACE ("ex_allocate_name_string"); | ||
92 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ex_allocate_name_string"); | ||
93 | 81 | ||
94 | /* | 82 | /* |
95 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. | 83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. |
@@ -100,20 +88,19 @@ acpi_ex_allocate_name_string ( | |||
100 | /* Special case for root */ | 88 | /* Special case for root */ |
101 | 89 | ||
102 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; | 90 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; |
103 | } | 91 | } else { |
104 | else { | 92 | size_needed = |
105 | size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; | 93 | prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; |
106 | } | 94 | } |
107 | 95 | ||
108 | /* | 96 | /* |
109 | * Allocate a buffer for the name. | 97 | * Allocate a buffer for the name. |
110 | * This buffer must be deleted by the caller! | 98 | * This buffer must be deleted by the caller! |
111 | */ | 99 | */ |
112 | name_string = ACPI_MEM_ALLOCATE (size_needed); | 100 | name_string = ACPI_MEM_ALLOCATE(size_needed); |
113 | if (!name_string) { | 101 | if (!name_string) { |
114 | ACPI_REPORT_ERROR (( | 102 | ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); |
115 | "ex_allocate_name_string: Could not allocate size %d\n", size_needed)); | 103 | return_PTR(NULL); |
116 | return_PTR (NULL); | ||
117 | } | 104 | } |
118 | 105 | ||
119 | temp_ptr = name_string; | 106 | temp_ptr = name_string; |
@@ -122,23 +109,20 @@ acpi_ex_allocate_name_string ( | |||
122 | 109 | ||
123 | if (prefix_count == ACPI_UINT32_MAX) { | 110 | if (prefix_count == ACPI_UINT32_MAX) { |
124 | *temp_ptr++ = AML_ROOT_PREFIX; | 111 | *temp_ptr++ = AML_ROOT_PREFIX; |
125 | } | 112 | } else { |
126 | else { | ||
127 | while (prefix_count--) { | 113 | while (prefix_count--) { |
128 | *temp_ptr++ = AML_PARENT_PREFIX; | 114 | *temp_ptr++ = AML_PARENT_PREFIX; |
129 | } | 115 | } |
130 | } | 116 | } |
131 | 117 | ||
132 | |||
133 | /* Set up Dual or Multi prefixes if needed */ | 118 | /* Set up Dual or Multi prefixes if needed */ |
134 | 119 | ||
135 | if (num_name_segs > 2) { | 120 | if (num_name_segs > 2) { |
136 | /* Set up multi prefixes */ | 121 | /* Set up multi prefixes */ |
137 | 122 | ||
138 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; | 123 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; |
139 | *temp_ptr++ = (char) num_name_segs; | 124 | *temp_ptr++ = (char)num_name_segs; |
140 | } | 125 | } else if (2 == num_name_segs) { |
141 | else if (2 == num_name_segs) { | ||
142 | /* Set up dual prefixes */ | 126 | /* Set up dual prefixes */ |
143 | 127 | ||
144 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; | 128 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; |
@@ -150,7 +134,7 @@ acpi_ex_allocate_name_string ( | |||
150 | */ | 134 | */ |
151 | *temp_ptr = 0; | 135 | *temp_ptr = 0; |
152 | 136 | ||
153 | return_PTR (name_string); | 137 | return_PTR(name_string); |
154 | } | 138 | } |
155 | 139 | ||
156 | /******************************************************************************* | 140 | /******************************************************************************* |
@@ -167,19 +151,14 @@ acpi_ex_allocate_name_string ( | |||
167 | * | 151 | * |
168 | ******************************************************************************/ | 152 | ******************************************************************************/ |
169 | 153 | ||
170 | static acpi_status | 154 | static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) |
171 | acpi_ex_name_segment ( | ||
172 | u8 **in_aml_address, | ||
173 | char *name_string) | ||
174 | { | 155 | { |
175 | char *aml_address = (void *) *in_aml_address; | 156 | char *aml_address = (void *)*in_aml_address; |
176 | acpi_status status = AE_OK; | 157 | acpi_status status = AE_OK; |
177 | u32 index; | 158 | u32 index; |
178 | char char_buf[5]; | 159 | char char_buf[5]; |
179 | |||
180 | |||
181 | ACPI_FUNCTION_TRACE ("ex_name_segment"); | ||
182 | 160 | ||
161 | ACPI_FUNCTION_TRACE("ex_name_segment"); | ||
183 | 162 | ||
184 | /* | 163 | /* |
185 | * If first character is a digit, then we know that we aren't looking at a | 164 | * If first character is a digit, then we know that we aren't looking at a |
@@ -188,20 +167,20 @@ acpi_ex_name_segment ( | |||
188 | char_buf[0] = *aml_address; | 167 | char_buf[0] = *aml_address; |
189 | 168 | ||
190 | if ('0' <= char_buf[0] && char_buf[0] <= '9') { | 169 | if ('0' <= char_buf[0] && char_buf[0] <= '9') { |
191 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", char_buf[0])); | 170 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n", |
192 | return_ACPI_STATUS (AE_CTRL_PENDING); | 171 | char_buf[0])); |
172 | return_ACPI_STATUS(AE_CTRL_PENDING); | ||
193 | } | 173 | } |
194 | 174 | ||
195 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n")); | 175 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n")); |
196 | 176 | ||
197 | for (index = 0; | 177 | for (index = 0; |
198 | (index < ACPI_NAME_SIZE) && (acpi_ut_valid_acpi_character (*aml_address)); | 178 | (index < ACPI_NAME_SIZE) |
199 | index++) { | 179 | && (acpi_ut_valid_acpi_character(*aml_address)); index++) { |
200 | char_buf[index] = *aml_address++; | 180 | char_buf[index] = *aml_address++; |
201 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[index])); | 181 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); |
202 | } | 182 | } |
203 | 183 | ||
204 | |||
205 | /* Valid name segment */ | 184 | /* Valid name segment */ |
206 | 185 | ||
207 | if (index == 4) { | 186 | if (index == 4) { |
@@ -210,41 +189,37 @@ acpi_ex_name_segment ( | |||
210 | char_buf[4] = '\0'; | 189 | char_buf[4] = '\0'; |
211 | 190 | ||
212 | if (name_string) { | 191 | if (name_string) { |
213 | ACPI_STRCAT (name_string, char_buf); | 192 | ACPI_STRCAT(name_string, char_buf); |
214 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 193 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
215 | "Appended to - %s \n", name_string)); | 194 | "Appended to - %s \n", name_string)); |
195 | } else { | ||
196 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
197 | "No Name string - %s \n", char_buf)); | ||
216 | } | 198 | } |
217 | else { | 199 | } else if (index == 0) { |
218 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | ||
219 | "No Name string - %s \n", char_buf)); | ||
220 | } | ||
221 | } | ||
222 | else if (index == 0) { | ||
223 | /* | 200 | /* |
224 | * First character was not a valid name character, | 201 | * First character was not a valid name character, |
225 | * so we are looking at something other than a name. | 202 | * so we are looking at something other than a name. |
226 | */ | 203 | */ |
227 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 204 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
228 | "Leading character is not alpha: %02Xh (not a name)\n", | 205 | "Leading character is not alpha: %02Xh (not a name)\n", |
229 | char_buf[0])); | 206 | char_buf[0])); |
230 | status = AE_CTRL_PENDING; | 207 | status = AE_CTRL_PENDING; |
231 | } | 208 | } else { |
232 | else { | ||
233 | /* | 209 | /* |
234 | * Segment started with one or more valid characters, but fewer than | 210 | * Segment started with one or more valid characters, but fewer than |
235 | * the required 4 | 211 | * the required 4 |
236 | */ | 212 | */ |
237 | status = AE_AML_BAD_NAME; | 213 | status = AE_AML_BAD_NAME; |
238 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 214 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
239 | "Bad character %02x in name, at %p\n", | 215 | "Bad character %02x in name, at %p\n", |
240 | *aml_address, aml_address)); | 216 | *aml_address, aml_address)); |
241 | } | 217 | } |
242 | 218 | ||
243 | *in_aml_address = (u8 *) aml_address; | 219 | *in_aml_address = (u8 *) aml_address; |
244 | return_ACPI_STATUS (status); | 220 | return_ACPI_STATUS(status); |
245 | } | 221 | } |
246 | 222 | ||
247 | |||
248 | /******************************************************************************* | 223 | /******************************************************************************* |
249 | * | 224 | * |
250 | * FUNCTION: acpi_ex_get_name_string | 225 | * FUNCTION: acpi_ex_get_name_string |
@@ -263,37 +238,32 @@ acpi_ex_name_segment ( | |||
263 | ******************************************************************************/ | 238 | ******************************************************************************/ |
264 | 239 | ||
265 | acpi_status | 240 | acpi_status |
266 | acpi_ex_get_name_string ( | 241 | acpi_ex_get_name_string(acpi_object_type data_type, |
267 | acpi_object_type data_type, | 242 | u8 * in_aml_address, |
268 | u8 *in_aml_address, | 243 | char **out_name_string, u32 * out_name_length) |
269 | char **out_name_string, | ||
270 | u32 *out_name_length) | ||
271 | { | 244 | { |
272 | acpi_status status = AE_OK; | 245 | acpi_status status = AE_OK; |
273 | u8 *aml_address = in_aml_address; | 246 | u8 *aml_address = in_aml_address; |
274 | char *name_string = NULL; | 247 | char *name_string = NULL; |
275 | u32 num_segments; | 248 | u32 num_segments; |
276 | u32 prefix_count = 0; | 249 | u32 prefix_count = 0; |
277 | u8 has_prefix = FALSE; | 250 | u8 has_prefix = FALSE; |
278 | 251 | ||
279 | 252 | ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); | |
280 | ACPI_FUNCTION_TRACE_PTR ("ex_get_name_string", aml_address); | 253 | |
281 | 254 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || | |
282 | 255 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || | |
283 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || | 256 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { |
284 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || | ||
285 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { | ||
286 | /* Disallow prefixes for types associated with field_unit names */ | 257 | /* Disallow prefixes for types associated with field_unit names */ |
287 | 258 | ||
288 | name_string = acpi_ex_allocate_name_string (0, 1); | 259 | name_string = acpi_ex_allocate_name_string(0, 1); |
289 | if (!name_string) { | 260 | if (!name_string) { |
290 | status = AE_NO_MEMORY; | 261 | status = AE_NO_MEMORY; |
262 | } else { | ||
263 | status = | ||
264 | acpi_ex_name_segment(&aml_address, name_string); | ||
291 | } | 265 | } |
292 | else { | 266 | } else { |
293 | status = acpi_ex_name_segment (&aml_address, name_string); | ||
294 | } | ||
295 | } | ||
296 | else { | ||
297 | /* | 267 | /* |
298 | * data_type is not a field name. | 268 | * data_type is not a field name. |
299 | * Examine first character of name for root or parent prefix operators | 269 | * Examine first character of name for root or parent prefix operators |
@@ -301,8 +271,9 @@ acpi_ex_get_name_string ( | |||
301 | switch (*aml_address) { | 271 | switch (*aml_address) { |
302 | case AML_ROOT_PREFIX: | 272 | case AML_ROOT_PREFIX: |
303 | 273 | ||
304 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", | 274 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
305 | aml_address)); | 275 | "root_prefix(\\) at %p\n", |
276 | aml_address)); | ||
306 | 277 | ||
307 | /* | 278 | /* |
308 | * Remember that we have a root_prefix -- | 279 | * Remember that we have a root_prefix -- |
@@ -313,14 +284,14 @@ acpi_ex_get_name_string ( | |||
313 | has_prefix = TRUE; | 284 | has_prefix = TRUE; |
314 | break; | 285 | break; |
315 | 286 | ||
316 | |||
317 | case AML_PARENT_PREFIX: | 287 | case AML_PARENT_PREFIX: |
318 | 288 | ||
319 | /* Increment past possibly multiple parent prefixes */ | 289 | /* Increment past possibly multiple parent prefixes */ |
320 | 290 | ||
321 | do { | 291 | do { |
322 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", | 292 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
323 | aml_address)); | 293 | "parent_prefix (^) at %p\n", |
294 | aml_address)); | ||
324 | 295 | ||
325 | aml_address++; | 296 | aml_address++; |
326 | prefix_count++; | 297 | prefix_count++; |
@@ -330,7 +301,6 @@ acpi_ex_get_name_string ( | |||
330 | has_prefix = TRUE; | 301 | has_prefix = TRUE; |
331 | break; | 302 | break; |
332 | 303 | ||
333 | |||
334 | default: | 304 | default: |
335 | 305 | ||
336 | /* Not a prefix character */ | 306 | /* Not a prefix character */ |
@@ -343,11 +313,13 @@ acpi_ex_get_name_string ( | |||
343 | switch (*aml_address) { | 313 | switch (*aml_address) { |
344 | case AML_DUAL_NAME_PREFIX: | 314 | case AML_DUAL_NAME_PREFIX: |
345 | 315 | ||
346 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", | 316 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
347 | aml_address)); | 317 | "dual_name_prefix at %p\n", |
318 | aml_address)); | ||
348 | 319 | ||
349 | aml_address++; | 320 | aml_address++; |
350 | name_string = acpi_ex_allocate_name_string (prefix_count, 2); | 321 | name_string = |
322 | acpi_ex_allocate_name_string(prefix_count, 2); | ||
351 | if (!name_string) { | 323 | if (!name_string) { |
352 | status = AE_NO_MEMORY; | 324 | status = AE_NO_MEMORY; |
353 | break; | 325 | break; |
@@ -357,24 +329,29 @@ acpi_ex_get_name_string ( | |||
357 | 329 | ||
358 | has_prefix = TRUE; | 330 | has_prefix = TRUE; |
359 | 331 | ||
360 | status = acpi_ex_name_segment (&aml_address, name_string); | 332 | status = |
361 | if (ACPI_SUCCESS (status)) { | 333 | acpi_ex_name_segment(&aml_address, name_string); |
362 | status = acpi_ex_name_segment (&aml_address, name_string); | 334 | if (ACPI_SUCCESS(status)) { |
335 | status = | ||
336 | acpi_ex_name_segment(&aml_address, | ||
337 | name_string); | ||
363 | } | 338 | } |
364 | break; | 339 | break; |
365 | 340 | ||
366 | |||
367 | case AML_MULTI_NAME_PREFIX_OP: | 341 | case AML_MULTI_NAME_PREFIX_OP: |
368 | 342 | ||
369 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", | 343 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
370 | aml_address)); | 344 | "multi_name_prefix at %p\n", |
345 | aml_address)); | ||
371 | 346 | ||
372 | /* Fetch count of segments remaining in name path */ | 347 | /* Fetch count of segments remaining in name path */ |
373 | 348 | ||
374 | aml_address++; | 349 | aml_address++; |
375 | num_segments = *aml_address; | 350 | num_segments = *aml_address; |
376 | 351 | ||
377 | name_string = acpi_ex_allocate_name_string (prefix_count, num_segments); | 352 | name_string = |
353 | acpi_ex_allocate_name_string(prefix_count, | ||
354 | num_segments); | ||
378 | if (!name_string) { | 355 | if (!name_string) { |
379 | status = AE_NO_MEMORY; | 356 | status = AE_NO_MEMORY; |
380 | break; | 357 | break; |
@@ -386,27 +363,28 @@ acpi_ex_get_name_string ( | |||
386 | has_prefix = TRUE; | 363 | has_prefix = TRUE; |
387 | 364 | ||
388 | while (num_segments && | 365 | while (num_segments && |
389 | (status = acpi_ex_name_segment (&aml_address, name_string)) == | 366 | (status = |
390 | AE_OK) { | 367 | acpi_ex_name_segment(&aml_address, |
368 | name_string)) == AE_OK) { | ||
391 | num_segments--; | 369 | num_segments--; |
392 | } | 370 | } |
393 | 371 | ||
394 | break; | 372 | break; |
395 | 373 | ||
396 | |||
397 | case 0: | 374 | case 0: |
398 | 375 | ||
399 | /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ | 376 | /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ |
400 | 377 | ||
401 | if (prefix_count == ACPI_UINT32_MAX) { | 378 | if (prefix_count == ACPI_UINT32_MAX) { |
402 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 379 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
403 | "name_seg is \"\\\" followed by NULL\n")); | 380 | "name_seg is \"\\\" followed by NULL\n")); |
404 | } | 381 | } |
405 | 382 | ||
406 | /* Consume the NULL byte */ | 383 | /* Consume the NULL byte */ |
407 | 384 | ||
408 | aml_address++; | 385 | aml_address++; |
409 | name_string = acpi_ex_allocate_name_string (prefix_count, 0); | 386 | name_string = |
387 | acpi_ex_allocate_name_string(prefix_count, 0); | ||
410 | if (!name_string) { | 388 | if (!name_string) { |
411 | status = AE_NO_MEMORY; | 389 | status = AE_NO_MEMORY; |
412 | break; | 390 | break; |
@@ -414,18 +392,19 @@ acpi_ex_get_name_string ( | |||
414 | 392 | ||
415 | break; | 393 | break; |
416 | 394 | ||
417 | |||
418 | default: | 395 | default: |
419 | 396 | ||
420 | /* Name segment string */ | 397 | /* Name segment string */ |
421 | 398 | ||
422 | name_string = acpi_ex_allocate_name_string (prefix_count, 1); | 399 | name_string = |
400 | acpi_ex_allocate_name_string(prefix_count, 1); | ||
423 | if (!name_string) { | 401 | if (!name_string) { |
424 | status = AE_NO_MEMORY; | 402 | status = AE_NO_MEMORY; |
425 | break; | 403 | break; |
426 | } | 404 | } |
427 | 405 | ||
428 | status = acpi_ex_name_segment (&aml_address, name_string); | 406 | status = |
407 | acpi_ex_name_segment(&aml_address, name_string); | ||
429 | break; | 408 | break; |
430 | } | 409 | } |
431 | } | 410 | } |
@@ -433,22 +412,20 @@ acpi_ex_get_name_string ( | |||
433 | if (AE_CTRL_PENDING == status && has_prefix) { | 412 | if (AE_CTRL_PENDING == status && has_prefix) { |
434 | /* Ran out of segments after processing a prefix */ | 413 | /* Ran out of segments after processing a prefix */ |
435 | 414 | ||
436 | ACPI_REPORT_ERROR ( | 415 | ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n", |
437 | ("ex_do_name: Malformed Name at %p\n", name_string)); | 416 | name_string)); |
438 | status = AE_AML_BAD_NAME; | 417 | status = AE_AML_BAD_NAME; |
439 | } | 418 | } |
440 | 419 | ||
441 | if (ACPI_FAILURE (status)) { | 420 | if (ACPI_FAILURE(status)) { |
442 | if (name_string) { | 421 | if (name_string) { |
443 | ACPI_MEM_FREE (name_string); | 422 | ACPI_MEM_FREE(name_string); |
444 | } | 423 | } |
445 | return_ACPI_STATUS (status); | 424 | return_ACPI_STATUS(status); |
446 | } | 425 | } |
447 | 426 | ||
448 | *out_name_string = name_string; | 427 | *out_name_string = name_string; |
449 | *out_name_length = (u32) (aml_address - in_aml_address); | 428 | *out_name_length = (u32) (aml_address - in_aml_address); |
450 | 429 | ||
451 | return_ACPI_STATUS (status); | 430 | return_ACPI_STATUS(status); |
452 | } | 431 | } |
453 | |||
454 | |||
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 48c30f800083..97e34542f5e4 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
48 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
@@ -50,10 +49,8 @@ | |||
50 | #include <acpi/amlcode.h> | 49 | #include <acpi/amlcode.h> |
51 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
52 | 51 | ||
53 | |||
54 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exoparg1") | 53 | ACPI_MODULE_NAME("exoparg1") |
56 | |||
57 | 54 | ||
58 | /*! | 55 | /*! |
59 | * Naming convention for AML interpreter execution routines. | 56 | * Naming convention for AML interpreter execution routines. |
@@ -76,7 +73,6 @@ | |||
76 | * The AcpiExOpcode* functions are called via the Dispatcher component with | 73 | * The AcpiExOpcode* functions are called via the Dispatcher component with |
77 | * fully resolved operands. | 74 | * fully resolved operands. |
78 | !*/ | 75 | !*/ |
79 | |||
80 | /******************************************************************************* | 76 | /******************************************************************************* |
81 | * | 77 | * |
82 | * FUNCTION: acpi_ex_opcode_0A_0T_1R | 78 | * FUNCTION: acpi_ex_opcode_0A_0T_1R |
@@ -88,61 +84,53 @@ | |||
88 | * DESCRIPTION: Execute operator with no operands, one return value | 84 | * DESCRIPTION: Execute operator with no operands, one return value |
89 | * | 85 | * |
90 | ******************************************************************************/ | 86 | ******************************************************************************/ |
91 | 87 | acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |
92 | acpi_status | ||
93 | acpi_ex_opcode_0A_0T_1R ( | ||
94 | struct acpi_walk_state *walk_state) | ||
95 | { | 88 | { |
96 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
97 | union acpi_operand_object *return_desc = NULL; | 90 | union acpi_operand_object *return_desc = NULL; |
98 | |||
99 | |||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", | ||
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
102 | 91 | ||
92 | ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", | ||
93 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
103 | 94 | ||
104 | /* Examine the AML opcode */ | 95 | /* Examine the AML opcode */ |
105 | 96 | ||
106 | switch (walk_state->opcode) { | 97 | switch (walk_state->opcode) { |
107 | case AML_TIMER_OP: /* Timer () */ | 98 | case AML_TIMER_OP: /* Timer () */ |
108 | 99 | ||
109 | /* Create a return object of type Integer */ | 100 | /* Create a return object of type Integer */ |
110 | 101 | ||
111 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 102 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
112 | if (!return_desc) { | 103 | if (!return_desc) { |
113 | status = AE_NO_MEMORY; | 104 | status = AE_NO_MEMORY; |
114 | goto cleanup; | 105 | goto cleanup; |
115 | } | 106 | } |
116 | #if ACPI_MACHINE_WIDTH != 16 | 107 | #if ACPI_MACHINE_WIDTH != 16 |
117 | return_desc->integer.value = acpi_os_get_timer (); | 108 | return_desc->integer.value = acpi_os_get_timer(); |
118 | #endif | 109 | #endif |
119 | break; | 110 | break; |
120 | 111 | ||
121 | default: /* Unknown opcode */ | 112 | default: /* Unknown opcode */ |
122 | 113 | ||
123 | ACPI_REPORT_ERROR (("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", | 114 | ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); |
124 | walk_state->opcode)); | ||
125 | status = AE_AML_BAD_OPCODE; | 115 | status = AE_AML_BAD_OPCODE; |
126 | break; | 116 | break; |
127 | } | 117 | } |
128 | 118 | ||
129 | cleanup: | 119 | cleanup: |
130 | 120 | ||
131 | /* Delete return object on error */ | 121 | /* Delete return object on error */ |
132 | 122 | ||
133 | if ((ACPI_FAILURE (status)) || walk_state->result_obj) { | 123 | if ((ACPI_FAILURE(status)) || walk_state->result_obj) { |
134 | acpi_ut_remove_reference (return_desc); | 124 | acpi_ut_remove_reference(return_desc); |
135 | } | 125 | } else { |
136 | else { | ||
137 | /* Save the return value */ | 126 | /* Save the return value */ |
138 | 127 | ||
139 | walk_state->result_obj = return_desc; | 128 | walk_state->result_obj = return_desc; |
140 | } | 129 | } |
141 | 130 | ||
142 | return_ACPI_STATUS (status); | 131 | return_ACPI_STATUS(status); |
143 | } | 132 | } |
144 | 133 | ||
145 | |||
146 | /******************************************************************************* | 134 | /******************************************************************************* |
147 | * | 135 | * |
148 | * FUNCTION: acpi_ex_opcode_1A_0T_0R | 136 | * FUNCTION: acpi_ex_opcode_1A_0T_0R |
@@ -156,69 +144,58 @@ cleanup: | |||
156 | * | 144 | * |
157 | ******************************************************************************/ | 145 | ******************************************************************************/ |
158 | 146 | ||
159 | acpi_status | 147 | acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) |
160 | acpi_ex_opcode_1A_0T_0R ( | ||
161 | struct acpi_walk_state *walk_state) | ||
162 | { | 148 | { |
163 | union acpi_operand_object **operand = &walk_state->operands[0]; | 149 | union acpi_operand_object **operand = &walk_state->operands[0]; |
164 | acpi_status status = AE_OK; | 150 | acpi_status status = AE_OK; |
165 | |||
166 | |||
167 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", | ||
168 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
169 | 151 | ||
152 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", | ||
153 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
170 | 154 | ||
171 | /* Examine the AML opcode */ | 155 | /* Examine the AML opcode */ |
172 | 156 | ||
173 | switch (walk_state->opcode) { | 157 | switch (walk_state->opcode) { |
174 | case AML_RELEASE_OP: /* Release (mutex_object) */ | 158 | case AML_RELEASE_OP: /* Release (mutex_object) */ |
175 | 159 | ||
176 | status = acpi_ex_release_mutex (operand[0], walk_state); | 160 | status = acpi_ex_release_mutex(operand[0], walk_state); |
177 | break; | 161 | break; |
178 | 162 | ||
163 | case AML_RESET_OP: /* Reset (event_object) */ | ||
179 | 164 | ||
180 | case AML_RESET_OP: /* Reset (event_object) */ | 165 | status = acpi_ex_system_reset_event(operand[0]); |
181 | |||
182 | status = acpi_ex_system_reset_event (operand[0]); | ||
183 | break; | 166 | break; |
184 | 167 | ||
168 | case AML_SIGNAL_OP: /* Signal (event_object) */ | ||
185 | 169 | ||
186 | case AML_SIGNAL_OP: /* Signal (event_object) */ | 170 | status = acpi_ex_system_signal_event(operand[0]); |
187 | |||
188 | status = acpi_ex_system_signal_event (operand[0]); | ||
189 | break; | 171 | break; |
190 | 172 | ||
173 | case AML_SLEEP_OP: /* Sleep (msec_time) */ | ||
191 | 174 | ||
192 | case AML_SLEEP_OP: /* Sleep (msec_time) */ | 175 | status = acpi_ex_system_do_suspend(operand[0]->integer.value); |
193 | |||
194 | status = acpi_ex_system_do_suspend (operand[0]->integer.value); | ||
195 | break; | 176 | break; |
196 | 177 | ||
178 | case AML_STALL_OP: /* Stall (usec_time) */ | ||
197 | 179 | ||
198 | case AML_STALL_OP: /* Stall (usec_time) */ | 180 | status = |
199 | 181 | acpi_ex_system_do_stall((u32) operand[0]->integer.value); | |
200 | status = acpi_ex_system_do_stall ((u32) operand[0]->integer.value); | ||
201 | break; | 182 | break; |
202 | 183 | ||
184 | case AML_UNLOAD_OP: /* Unload (Handle) */ | ||
203 | 185 | ||
204 | case AML_UNLOAD_OP: /* Unload (Handle) */ | 186 | status = acpi_ex_unload_table(operand[0]); |
205 | |||
206 | status = acpi_ex_unload_table (operand[0]); | ||
207 | break; | 187 | break; |
208 | 188 | ||
189 | default: /* Unknown opcode */ | ||
209 | 190 | ||
210 | default: /* Unknown opcode */ | 191 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); |
211 | |||
212 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", | ||
213 | walk_state->opcode)); | ||
214 | status = AE_AML_BAD_OPCODE; | 192 | status = AE_AML_BAD_OPCODE; |
215 | break; | 193 | break; |
216 | } | 194 | } |
217 | 195 | ||
218 | return_ACPI_STATUS (status); | 196 | return_ACPI_STATUS(status); |
219 | } | 197 | } |
220 | 198 | ||
221 | |||
222 | /******************************************************************************* | 199 | /******************************************************************************* |
223 | * | 200 | * |
224 | * FUNCTION: acpi_ex_opcode_1A_1T_0R | 201 | * FUNCTION: acpi_ex_opcode_1A_1T_0R |
@@ -232,41 +209,34 @@ acpi_ex_opcode_1A_0T_0R ( | |||
232 | * | 209 | * |
233 | ******************************************************************************/ | 210 | ******************************************************************************/ |
234 | 211 | ||
235 | acpi_status | 212 | acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) |
236 | acpi_ex_opcode_1A_1T_0R ( | ||
237 | struct acpi_walk_state *walk_state) | ||
238 | { | 213 | { |
239 | acpi_status status = AE_OK; | 214 | acpi_status status = AE_OK; |
240 | union acpi_operand_object **operand = &walk_state->operands[0]; | 215 | union acpi_operand_object **operand = &walk_state->operands[0]; |
241 | |||
242 | |||
243 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", | ||
244 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
245 | 216 | ||
217 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", | ||
218 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
246 | 219 | ||
247 | /* Examine the AML opcode */ | 220 | /* Examine the AML opcode */ |
248 | 221 | ||
249 | switch (walk_state->opcode) { | 222 | switch (walk_state->opcode) { |
250 | case AML_LOAD_OP: | 223 | case AML_LOAD_OP: |
251 | 224 | ||
252 | status = acpi_ex_load_op (operand[0], operand[1], walk_state); | 225 | status = acpi_ex_load_op(operand[0], operand[1], walk_state); |
253 | break; | 226 | break; |
254 | 227 | ||
255 | default: /* Unknown opcode */ | 228 | default: /* Unknown opcode */ |
256 | 229 | ||
257 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", | 230 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode)); |
258 | walk_state->opcode)); | ||
259 | status = AE_AML_BAD_OPCODE; | 231 | status = AE_AML_BAD_OPCODE; |
260 | goto cleanup; | 232 | goto cleanup; |
261 | } | 233 | } |
262 | 234 | ||
235 | cleanup: | ||
263 | 236 | ||
264 | cleanup: | 237 | return_ACPI_STATUS(status); |
265 | |||
266 | return_ACPI_STATUS (status); | ||
267 | } | 238 | } |
268 | 239 | ||
269 | |||
270 | /******************************************************************************* | 240 | /******************************************************************************* |
271 | * | 241 | * |
272 | * FUNCTION: acpi_ex_opcode_1A_1T_1R | 242 | * FUNCTION: acpi_ex_opcode_1A_1T_1R |
@@ -280,23 +250,19 @@ cleanup: | |||
280 | * | 250 | * |
281 | ******************************************************************************/ | 251 | ******************************************************************************/ |
282 | 252 | ||
283 | acpi_status | 253 | acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) |
284 | acpi_ex_opcode_1A_1T_1R ( | ||
285 | struct acpi_walk_state *walk_state) | ||
286 | { | 254 | { |
287 | acpi_status status = AE_OK; | 255 | acpi_status status = AE_OK; |
288 | union acpi_operand_object **operand = &walk_state->operands[0]; | 256 | union acpi_operand_object **operand = &walk_state->operands[0]; |
289 | union acpi_operand_object *return_desc = NULL; | 257 | union acpi_operand_object *return_desc = NULL; |
290 | union acpi_operand_object *return_desc2 = NULL; | 258 | union acpi_operand_object *return_desc2 = NULL; |
291 | u32 temp32; | 259 | u32 temp32; |
292 | u32 i; | 260 | u32 i; |
293 | acpi_integer power_of_ten; | 261 | acpi_integer power_of_ten; |
294 | acpi_integer digit; | 262 | acpi_integer digit; |
295 | 263 | ||
296 | 264 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", | |
297 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", | 265 | acpi_ps_get_opcode_name(walk_state->opcode)); |
298 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
299 | |||
300 | 266 | ||
301 | /* Examine the AML opcode */ | 267 | /* Examine the AML opcode */ |
302 | 268 | ||
@@ -310,20 +276,19 @@ acpi_ex_opcode_1A_1T_1R ( | |||
310 | 276 | ||
311 | /* Create a return object of type Integer for these opcodes */ | 277 | /* Create a return object of type Integer for these opcodes */ |
312 | 278 | ||
313 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 279 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
314 | if (!return_desc) { | 280 | if (!return_desc) { |
315 | status = AE_NO_MEMORY; | 281 | status = AE_NO_MEMORY; |
316 | goto cleanup; | 282 | goto cleanup; |
317 | } | 283 | } |
318 | 284 | ||
319 | switch (walk_state->opcode) { | 285 | switch (walk_state->opcode) { |
320 | case AML_BIT_NOT_OP: /* Not (Operand, Result) */ | 286 | case AML_BIT_NOT_OP: /* Not (Operand, Result) */ |
321 | 287 | ||
322 | return_desc->integer.value = ~operand[0]->integer.value; | 288 | return_desc->integer.value = ~operand[0]->integer.value; |
323 | break; | 289 | break; |
324 | 290 | ||
325 | 291 | case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */ | |
326 | case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */ | ||
327 | 292 | ||
328 | return_desc->integer.value = operand[0]->integer.value; | 293 | return_desc->integer.value = operand[0]->integer.value; |
329 | 294 | ||
@@ -332,15 +297,14 @@ acpi_ex_opcode_1A_1T_1R ( | |||
332 | * endian unsigned value, so this boundary condition is valid. | 297 | * endian unsigned value, so this boundary condition is valid. |
333 | */ | 298 | */ |
334 | for (temp32 = 0; return_desc->integer.value && | 299 | for (temp32 = 0; return_desc->integer.value && |
335 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { | 300 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { |
336 | return_desc->integer.value >>= 1; | 301 | return_desc->integer.value >>= 1; |
337 | } | 302 | } |
338 | 303 | ||
339 | return_desc->integer.value = temp32; | 304 | return_desc->integer.value = temp32; |
340 | break; | 305 | break; |
341 | 306 | ||
342 | 307 | case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */ | |
343 | case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */ | ||
344 | 308 | ||
345 | return_desc->integer.value = operand[0]->integer.value; | 309 | return_desc->integer.value = operand[0]->integer.value; |
346 | 310 | ||
@@ -349,18 +313,17 @@ acpi_ex_opcode_1A_1T_1R ( | |||
349 | * endian unsigned value, so this boundary condition is valid. | 313 | * endian unsigned value, so this boundary condition is valid. |
350 | */ | 314 | */ |
351 | for (temp32 = 0; return_desc->integer.value && | 315 | for (temp32 = 0; return_desc->integer.value && |
352 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { | 316 | temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { |
353 | return_desc->integer.value <<= 1; | 317 | return_desc->integer.value <<= 1; |
354 | } | 318 | } |
355 | 319 | ||
356 | /* Since the bit position is one-based, subtract from 33 (65) */ | 320 | /* Since the bit position is one-based, subtract from 33 (65) */ |
357 | 321 | ||
358 | return_desc->integer.value = temp32 == 0 ? 0 : | 322 | return_desc->integer.value = temp32 == 0 ? 0 : |
359 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | 323 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; |
360 | break; | 324 | break; |
361 | 325 | ||
362 | 326 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | |
363 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | ||
364 | 327 | ||
365 | /* | 328 | /* |
366 | * The 64-bit ACPI integer can hold 16 4-bit BCD characters | 329 | * The 64-bit ACPI integer can hold 16 4-bit BCD characters |
@@ -373,7 +336,9 @@ acpi_ex_opcode_1A_1T_1R ( | |||
373 | 336 | ||
374 | /* Convert each BCD digit (each is one nybble wide) */ | 337 | /* Convert each BCD digit (each is one nybble wide) */ |
375 | 338 | ||
376 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { | 339 | for (i = 0; |
340 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); | ||
341 | i++) { | ||
377 | /* Get the least significant 4-bit BCD digit */ | 342 | /* Get the least significant 4-bit BCD digit */ |
378 | 343 | ||
379 | temp32 = ((u32) digit) & 0xF; | 344 | temp32 = ((u32) digit) & 0xF; |
@@ -381,9 +346,9 @@ acpi_ex_opcode_1A_1T_1R ( | |||
381 | /* Check the range of the digit */ | 346 | /* Check the range of the digit */ |
382 | 347 | ||
383 | if (temp32 > 9) { | 348 | if (temp32 > 9) { |
384 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 349 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
385 | "BCD digit too large (not decimal): 0x%X\n", | 350 | "BCD digit too large (not decimal): 0x%X\n", |
386 | temp32)); | 351 | temp32)); |
387 | 352 | ||
388 | status = AE_AML_NUMERIC_OVERFLOW; | 353 | status = AE_AML_NUMERIC_OVERFLOW; |
389 | goto cleanup; | 354 | goto cleanup; |
@@ -391,8 +356,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
391 | 356 | ||
392 | /* Sum the digit into the result with the current power of 10 */ | 357 | /* Sum the digit into the result with the current power of 10 */ |
393 | 358 | ||
394 | return_desc->integer.value += (((acpi_integer) temp32) * | 359 | return_desc->integer.value += |
395 | power_of_ten); | 360 | (((acpi_integer) temp32) * power_of_ten); |
396 | 361 | ||
397 | /* Shift to next BCD digit */ | 362 | /* Shift to next BCD digit */ |
398 | 363 | ||
@@ -404,45 +369,50 @@ acpi_ex_opcode_1A_1T_1R ( | |||
404 | } | 369 | } |
405 | break; | 370 | break; |
406 | 371 | ||
407 | 372 | case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */ | |
408 | case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */ | ||
409 | 373 | ||
410 | return_desc->integer.value = 0; | 374 | return_desc->integer.value = 0; |
411 | digit = operand[0]->integer.value; | 375 | digit = operand[0]->integer.value; |
412 | 376 | ||
413 | /* Each BCD digit is one nybble wide */ | 377 | /* Each BCD digit is one nybble wide */ |
414 | 378 | ||
415 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { | 379 | for (i = 0; |
416 | (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); | 380 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); |
381 | i++) { | ||
382 | (void)acpi_ut_short_divide(digit, 10, &digit, | ||
383 | &temp32); | ||
417 | 384 | ||
418 | /* | 385 | /* |
419 | * Insert the BCD digit that resides in the | 386 | * Insert the BCD digit that resides in the |
420 | * remainder from above | 387 | * remainder from above |
421 | */ | 388 | */ |
422 | return_desc->integer.value |= (((acpi_integer) temp32) << | 389 | return_desc->integer.value |= |
423 | ACPI_MUL_4 (i)); | 390 | (((acpi_integer) temp32) << ACPI_MUL_4(i)); |
424 | } | 391 | } |
425 | 392 | ||
426 | /* Overflow if there is any data left in Digit */ | 393 | /* Overflow if there is any data left in Digit */ |
427 | 394 | ||
428 | if (digit > 0) { | 395 | if (digit > 0) { |
429 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 396 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
430 | "Integer too large to convert to BCD: %8.8X%8.8X\n", | 397 | "Integer too large to convert to BCD: %8.8X%8.8X\n", |
431 | ACPI_FORMAT_UINT64 (operand[0]->integer.value))); | 398 | ACPI_FORMAT_UINT64(operand |
399 | [0]-> | ||
400 | integer. | ||
401 | value))); | ||
432 | status = AE_AML_NUMERIC_OVERFLOW; | 402 | status = AE_AML_NUMERIC_OVERFLOW; |
433 | goto cleanup; | 403 | goto cleanup; |
434 | } | 404 | } |
435 | break; | 405 | break; |
436 | 406 | ||
437 | 407 | case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ | |
438 | case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ | ||
439 | 408 | ||
440 | /* | 409 | /* |
441 | * This op is a little strange because the internal return value is | 410 | * This op is a little strange because the internal return value is |
442 | * different than the return value stored in the result descriptor | 411 | * different than the return value stored in the result descriptor |
443 | * (There are really two return values) | 412 | * (There are really two return values) |
444 | */ | 413 | */ |
445 | if ((struct acpi_namespace_node *) operand[0] == acpi_gbl_root_node) { | 414 | if ((struct acpi_namespace_node *)operand[0] == |
415 | acpi_gbl_root_node) { | ||
446 | /* | 416 | /* |
447 | * This means that the object does not exist in the namespace, | 417 | * This means that the object does not exist in the namespace, |
448 | * return FALSE | 418 | * return FALSE |
@@ -453,38 +423,38 @@ acpi_ex_opcode_1A_1T_1R ( | |||
453 | 423 | ||
454 | /* Get the object reference, store it, and remove our reference */ | 424 | /* Get the object reference, store it, and remove our reference */ |
455 | 425 | ||
456 | status = acpi_ex_get_object_reference (operand[0], | 426 | status = acpi_ex_get_object_reference(operand[0], |
457 | &return_desc2, walk_state); | 427 | &return_desc2, |
458 | if (ACPI_FAILURE (status)) { | 428 | walk_state); |
429 | if (ACPI_FAILURE(status)) { | ||
459 | goto cleanup; | 430 | goto cleanup; |
460 | } | 431 | } |
461 | 432 | ||
462 | status = acpi_ex_store (return_desc2, operand[1], walk_state); | 433 | status = |
463 | acpi_ut_remove_reference (return_desc2); | 434 | acpi_ex_store(return_desc2, operand[1], walk_state); |
435 | acpi_ut_remove_reference(return_desc2); | ||
464 | 436 | ||
465 | /* The object exists in the namespace, return TRUE */ | 437 | /* The object exists in the namespace, return TRUE */ |
466 | 438 | ||
467 | return_desc->integer.value = ACPI_INTEGER_MAX; | 439 | return_desc->integer.value = ACPI_INTEGER_MAX; |
468 | goto cleanup; | 440 | goto cleanup; |
469 | 441 | ||
470 | |||
471 | default: | 442 | default: |
472 | /* No other opcodes get here */ | 443 | /* No other opcodes get here */ |
473 | break; | 444 | break; |
474 | } | 445 | } |
475 | break; | 446 | break; |
476 | 447 | ||
477 | 448 | case AML_STORE_OP: /* Store (Source, Target) */ | |
478 | case AML_STORE_OP: /* Store (Source, Target) */ | ||
479 | 449 | ||
480 | /* | 450 | /* |
481 | * A store operand is typically a number, string, buffer or lvalue | 451 | * A store operand is typically a number, string, buffer or lvalue |
482 | * Be careful about deleting the source object, | 452 | * Be careful about deleting the source object, |
483 | * since the object itself may have been stored. | 453 | * since the object itself may have been stored. |
484 | */ | 454 | */ |
485 | status = acpi_ex_store (operand[0], operand[1], walk_state); | 455 | status = acpi_ex_store(operand[0], operand[1], walk_state); |
486 | if (ACPI_FAILURE (status)) { | 456 | if (ACPI_FAILURE(status)) { |
487 | return_ACPI_STATUS (status); | 457 | return_ACPI_STATUS(status); |
488 | } | 458 | } |
489 | 459 | ||
490 | /* It is possible that the Store already produced a return object */ | 460 | /* It is possible that the Store already produced a return object */ |
@@ -497,92 +467,84 @@ acpi_ex_opcode_1A_1T_1R ( | |||
497 | * cancel out, and we simply don't do anything. | 467 | * cancel out, and we simply don't do anything. |
498 | */ | 468 | */ |
499 | walk_state->result_obj = operand[0]; | 469 | walk_state->result_obj = operand[0]; |
500 | walk_state->operands[0] = NULL; /* Prevent deletion */ | 470 | walk_state->operands[0] = NULL; /* Prevent deletion */ |
501 | } | 471 | } |
502 | return_ACPI_STATUS (status); | 472 | return_ACPI_STATUS(status); |
503 | |||
504 | 473 | ||
505 | /* | 474 | /* |
506 | * ACPI 2.0 Opcodes | 475 | * ACPI 2.0 Opcodes |
507 | */ | 476 | */ |
508 | case AML_COPY_OP: /* Copy (Source, Target) */ | 477 | case AML_COPY_OP: /* Copy (Source, Target) */ |
509 | 478 | ||
510 | status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc, | 479 | status = |
511 | walk_state); | 480 | acpi_ut_copy_iobject_to_iobject(operand[0], &return_desc, |
481 | walk_state); | ||
512 | break; | 482 | break; |
513 | 483 | ||
484 | case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ | ||
514 | 485 | ||
515 | case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ | 486 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
516 | 487 | ACPI_EXPLICIT_CONVERT_DECIMAL); | |
517 | status = acpi_ex_convert_to_string (operand[0], &return_desc, | ||
518 | ACPI_EXPLICIT_CONVERT_DECIMAL); | ||
519 | if (return_desc == operand[0]) { | 488 | if (return_desc == operand[0]) { |
520 | /* No conversion performed, add ref to handle return value */ | 489 | /* No conversion performed, add ref to handle return value */ |
521 | acpi_ut_add_reference (return_desc); | 490 | acpi_ut_add_reference(return_desc); |
522 | } | 491 | } |
523 | break; | 492 | break; |
524 | 493 | ||
494 | case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ | ||
525 | 495 | ||
526 | case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ | 496 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
527 | 497 | ACPI_EXPLICIT_CONVERT_HEX); | |
528 | status = acpi_ex_convert_to_string (operand[0], &return_desc, | ||
529 | ACPI_EXPLICIT_CONVERT_HEX); | ||
530 | if (return_desc == operand[0]) { | 498 | if (return_desc == operand[0]) { |
531 | /* No conversion performed, add ref to handle return value */ | 499 | /* No conversion performed, add ref to handle return value */ |
532 | acpi_ut_add_reference (return_desc); | 500 | acpi_ut_add_reference(return_desc); |
533 | } | 501 | } |
534 | break; | 502 | break; |
535 | 503 | ||
504 | case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ | ||
536 | 505 | ||
537 | case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ | 506 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); |
538 | |||
539 | status = acpi_ex_convert_to_buffer (operand[0], &return_desc); | ||
540 | if (return_desc == operand[0]) { | 507 | if (return_desc == operand[0]) { |
541 | /* No conversion performed, add ref to handle return value */ | 508 | /* No conversion performed, add ref to handle return value */ |
542 | acpi_ut_add_reference (return_desc); | 509 | acpi_ut_add_reference(return_desc); |
543 | } | 510 | } |
544 | break; | 511 | break; |
545 | 512 | ||
513 | case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ | ||
546 | 514 | ||
547 | case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ | 515 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, |
548 | 516 | ACPI_ANY_BASE); | |
549 | status = acpi_ex_convert_to_integer (operand[0], &return_desc, | ||
550 | ACPI_ANY_BASE); | ||
551 | if (return_desc == operand[0]) { | 517 | if (return_desc == operand[0]) { |
552 | /* No conversion performed, add ref to handle return value */ | 518 | /* No conversion performed, add ref to handle return value */ |
553 | acpi_ut_add_reference (return_desc); | 519 | acpi_ut_add_reference(return_desc); |
554 | } | 520 | } |
555 | break; | 521 | break; |
556 | 522 | ||
557 | 523 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ | |
558 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ | 524 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ |
559 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ | ||
560 | 525 | ||
561 | /* These are two obsolete opcodes */ | 526 | /* These are two obsolete opcodes */ |
562 | 527 | ||
563 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 528 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
564 | "%s is obsolete and not implemented\n", | 529 | "%s is obsolete and not implemented\n", |
565 | acpi_ps_get_opcode_name (walk_state->opcode))); | 530 | acpi_ps_get_opcode_name(walk_state->opcode))); |
566 | status = AE_SUPPORT; | 531 | status = AE_SUPPORT; |
567 | goto cleanup; | 532 | goto cleanup; |
568 | 533 | ||
534 | default: /* Unknown opcode */ | ||
569 | 535 | ||
570 | default: /* Unknown opcode */ | 536 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); |
571 | |||
572 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", | ||
573 | walk_state->opcode)); | ||
574 | status = AE_AML_BAD_OPCODE; | 537 | status = AE_AML_BAD_OPCODE; |
575 | goto cleanup; | 538 | goto cleanup; |
576 | } | 539 | } |
577 | 540 | ||
578 | if (ACPI_SUCCESS (status)) { | 541 | if (ACPI_SUCCESS(status)) { |
579 | /* Store the return value computed above into the target object */ | 542 | /* Store the return value computed above into the target object */ |
580 | 543 | ||
581 | status = acpi_ex_store (return_desc, operand[1], walk_state); | 544 | status = acpi_ex_store(return_desc, operand[1], walk_state); |
582 | } | 545 | } |
583 | 546 | ||
584 | 547 | cleanup: | |
585 | cleanup: | ||
586 | 548 | ||
587 | if (!walk_state->result_obj) { | 549 | if (!walk_state->result_obj) { |
588 | walk_state->result_obj = return_desc; | 550 | walk_state->result_obj = return_desc; |
@@ -590,14 +552,13 @@ cleanup: | |||
590 | 552 | ||
591 | /* Delete return object on error */ | 553 | /* Delete return object on error */ |
592 | 554 | ||
593 | if (ACPI_FAILURE (status)) { | 555 | if (ACPI_FAILURE(status)) { |
594 | acpi_ut_remove_reference (return_desc); | 556 | acpi_ut_remove_reference(return_desc); |
595 | } | 557 | } |
596 | 558 | ||
597 | return_ACPI_STATUS (status); | 559 | return_ACPI_STATUS(status); |
598 | } | 560 | } |
599 | 561 | ||
600 | |||
601 | /******************************************************************************* | 562 | /******************************************************************************* |
602 | * | 563 | * |
603 | * FUNCTION: acpi_ex_opcode_1A_0T_1R | 564 | * FUNCTION: acpi_ex_opcode_1A_0T_1R |
@@ -610,28 +571,24 @@ cleanup: | |||
610 | * | 571 | * |
611 | ******************************************************************************/ | 572 | ******************************************************************************/ |
612 | 573 | ||
613 | acpi_status | 574 | acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) |
614 | acpi_ex_opcode_1A_0T_1R ( | ||
615 | struct acpi_walk_state *walk_state) | ||
616 | { | 575 | { |
617 | union acpi_operand_object **operand = &walk_state->operands[0]; | 576 | union acpi_operand_object **operand = &walk_state->operands[0]; |
618 | union acpi_operand_object *temp_desc; | 577 | union acpi_operand_object *temp_desc; |
619 | union acpi_operand_object *return_desc = NULL; | 578 | union acpi_operand_object *return_desc = NULL; |
620 | acpi_status status = AE_OK; | 579 | acpi_status status = AE_OK; |
621 | u32 type; | 580 | u32 type; |
622 | acpi_integer value; | 581 | acpi_integer value; |
623 | |||
624 | |||
625 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", | ||
626 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
627 | 582 | ||
583 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", | ||
584 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
628 | 585 | ||
629 | /* Examine the AML opcode */ | 586 | /* Examine the AML opcode */ |
630 | 587 | ||
631 | switch (walk_state->opcode) { | 588 | switch (walk_state->opcode) { |
632 | case AML_LNOT_OP: /* LNot (Operand) */ | 589 | case AML_LNOT_OP: /* LNot (Operand) */ |
633 | 590 | ||
634 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 591 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
635 | if (!return_desc) { | 592 | if (!return_desc) { |
636 | status = AE_NO_MEMORY; | 593 | status = AE_NO_MEMORY; |
637 | goto cleanup; | 594 | goto cleanup; |
@@ -646,15 +603,14 @@ acpi_ex_opcode_1A_0T_1R ( | |||
646 | } | 603 | } |
647 | break; | 604 | break; |
648 | 605 | ||
649 | 606 | case AML_DECREMENT_OP: /* Decrement (Operand) */ | |
650 | case AML_DECREMENT_OP: /* Decrement (Operand) */ | 607 | case AML_INCREMENT_OP: /* Increment (Operand) */ |
651 | case AML_INCREMENT_OP: /* Increment (Operand) */ | ||
652 | 608 | ||
653 | /* | 609 | /* |
654 | * Create a new integer. Can't just get the base integer and | 610 | * Create a new integer. Can't just get the base integer and |
655 | * increment it because it may be an Arg or Field. | 611 | * increment it because it may be an Arg or Field. |
656 | */ | 612 | */ |
657 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 613 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
658 | if (!return_desc) { | 614 | if (!return_desc) { |
659 | status = AE_NO_MEMORY; | 615 | status = AE_NO_MEMORY; |
660 | goto cleanup; | 616 | goto cleanup; |
@@ -665,10 +621,11 @@ acpi_ex_opcode_1A_0T_1R ( | |||
665 | * NS Node or an internal object. | 621 | * NS Node or an internal object. |
666 | */ | 622 | */ |
667 | temp_desc = operand[0]; | 623 | temp_desc = operand[0]; |
668 | if (ACPI_GET_DESCRIPTOR_TYPE (temp_desc) == ACPI_DESC_TYPE_OPERAND) { | 624 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == |
625 | ACPI_DESC_TYPE_OPERAND) { | ||
669 | /* Internal reference object - prevent deletion */ | 626 | /* Internal reference object - prevent deletion */ |
670 | 627 | ||
671 | acpi_ut_add_reference (temp_desc); | 628 | acpi_ut_add_reference(temp_desc); |
672 | } | 629 | } |
673 | 630 | ||
674 | /* | 631 | /* |
@@ -678,11 +635,15 @@ acpi_ex_opcode_1A_0T_1R ( | |||
678 | * NOTE: We use LNOT_OP here in order to force resolution of the | 635 | * NOTE: We use LNOT_OP here in order to force resolution of the |
679 | * reference operand to an actual integer. | 636 | * reference operand to an actual integer. |
680 | */ | 637 | */ |
681 | status = acpi_ex_resolve_operands (AML_LNOT_OP, &temp_desc, walk_state); | 638 | status = |
682 | if (ACPI_FAILURE (status)) { | 639 | acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc, |
683 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n", | 640 | walk_state); |
684 | acpi_ps_get_opcode_name (walk_state->opcode), | 641 | if (ACPI_FAILURE(status)) { |
685 | acpi_format_exception(status))); | 642 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
643 | "%s: bad operand(s) %s\n", | ||
644 | acpi_ps_get_opcode_name(walk_state-> | ||
645 | opcode), | ||
646 | acpi_format_exception(status))); | ||
686 | 647 | ||
687 | goto cleanup; | 648 | goto cleanup; |
688 | } | 649 | } |
@@ -692,25 +653,25 @@ acpi_ex_opcode_1A_0T_1R ( | |||
692 | * Perform the actual increment or decrement | 653 | * Perform the actual increment or decrement |
693 | */ | 654 | */ |
694 | if (walk_state->opcode == AML_INCREMENT_OP) { | 655 | if (walk_state->opcode == AML_INCREMENT_OP) { |
695 | return_desc->integer.value = temp_desc->integer.value +1; | 656 | return_desc->integer.value = |
696 | } | 657 | temp_desc->integer.value + 1; |
697 | else { | 658 | } else { |
698 | return_desc->integer.value = temp_desc->integer.value -1; | 659 | return_desc->integer.value = |
660 | temp_desc->integer.value - 1; | ||
699 | } | 661 | } |
700 | 662 | ||
701 | /* Finished with this Integer object */ | 663 | /* Finished with this Integer object */ |
702 | 664 | ||
703 | acpi_ut_remove_reference (temp_desc); | 665 | acpi_ut_remove_reference(temp_desc); |
704 | 666 | ||
705 | /* | 667 | /* |
706 | * Store the result back (indirectly) through the original | 668 | * Store the result back (indirectly) through the original |
707 | * Reference object | 669 | * Reference object |
708 | */ | 670 | */ |
709 | status = acpi_ex_store (return_desc, operand[0], walk_state); | 671 | status = acpi_ex_store(return_desc, operand[0], walk_state); |
710 | break; | 672 | break; |
711 | 673 | ||
712 | 674 | case AML_TYPE_OP: /* object_type (source_object) */ | |
713 | case AML_TYPE_OP: /* object_type (source_object) */ | ||
714 | 675 | ||
715 | /* | 676 | /* |
716 | * Note: The operand is not resolved at this point because we want to | 677 | * Note: The operand is not resolved at this point because we want to |
@@ -721,13 +682,15 @@ acpi_ex_opcode_1A_0T_1R ( | |||
721 | 682 | ||
722 | /* Get the type of the base object */ | 683 | /* Get the type of the base object */ |
723 | 684 | ||
724 | status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL); | 685 | status = |
725 | if (ACPI_FAILURE (status)) { | 686 | acpi_ex_resolve_multiple(walk_state, operand[0], &type, |
687 | NULL); | ||
688 | if (ACPI_FAILURE(status)) { | ||
726 | goto cleanup; | 689 | goto cleanup; |
727 | } | 690 | } |
728 | /* Allocate a descriptor to hold the type. */ | 691 | /* Allocate a descriptor to hold the type. */ |
729 | 692 | ||
730 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 693 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
731 | if (!return_desc) { | 694 | if (!return_desc) { |
732 | status = AE_NO_MEMORY; | 695 | status = AE_NO_MEMORY; |
733 | goto cleanup; | 696 | goto cleanup; |
@@ -736,8 +699,7 @@ acpi_ex_opcode_1A_0T_1R ( | |||
736 | return_desc->integer.value = type; | 699 | return_desc->integer.value = type; |
737 | break; | 700 | break; |
738 | 701 | ||
739 | 702 | case AML_SIZE_OF_OP: /* size_of (source_object) */ | |
740 | case AML_SIZE_OF_OP: /* size_of (source_object) */ | ||
741 | 703 | ||
742 | /* | 704 | /* |
743 | * Note: The operand is not resolved at this point because we want to | 705 | * Note: The operand is not resolved at this point because we want to |
@@ -746,9 +708,10 @@ acpi_ex_opcode_1A_0T_1R ( | |||
746 | 708 | ||
747 | /* Get the base object */ | 709 | /* Get the base object */ |
748 | 710 | ||
749 | status = acpi_ex_resolve_multiple (walk_state, | 711 | status = acpi_ex_resolve_multiple(walk_state, |
750 | operand[0], &type, &temp_desc); | 712 | operand[0], &type, |
751 | if (ACPI_FAILURE (status)) { | 713 | &temp_desc); |
714 | if (ACPI_FAILURE(status)) { | ||
752 | goto cleanup; | 715 | goto cleanup; |
753 | } | 716 | } |
754 | 717 | ||
@@ -779,9 +742,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
779 | break; | 742 | break; |
780 | 743 | ||
781 | default: | 744 | default: |
782 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 745 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
783 | "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", | 746 | "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", |
784 | acpi_ut_get_type_name (type))); | 747 | acpi_ut_get_type_name(type))); |
785 | status = AE_AML_OPERAND_TYPE; | 748 | status = AE_AML_OPERAND_TYPE; |
786 | goto cleanup; | 749 | goto cleanup; |
787 | } | 750 | } |
@@ -790,7 +753,7 @@ acpi_ex_opcode_1A_0T_1R ( | |||
790 | * Now that we have the size of the object, create a result | 753 | * Now that we have the size of the object, create a result |
791 | * object to hold the value | 754 | * object to hold the value |
792 | */ | 755 | */ |
793 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 756 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
794 | if (!return_desc) { | 757 | if (!return_desc) { |
795 | status = AE_NO_MEMORY; | 758 | status = AE_NO_MEMORY; |
796 | goto cleanup; | 759 | goto cleanup; |
@@ -799,22 +762,23 @@ acpi_ex_opcode_1A_0T_1R ( | |||
799 | return_desc->integer.value = value; | 762 | return_desc->integer.value = value; |
800 | break; | 763 | break; |
801 | 764 | ||
765 | case AML_REF_OF_OP: /* ref_of (source_object) */ | ||
802 | 766 | ||
803 | case AML_REF_OF_OP: /* ref_of (source_object) */ | 767 | status = |
804 | 768 | acpi_ex_get_object_reference(operand[0], &return_desc, | |
805 | status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state); | 769 | walk_state); |
806 | if (ACPI_FAILURE (status)) { | 770 | if (ACPI_FAILURE(status)) { |
807 | goto cleanup; | 771 | goto cleanup; |
808 | } | 772 | } |
809 | break; | 773 | break; |
810 | 774 | ||
811 | 775 | case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */ | |
812 | case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */ | ||
813 | 776 | ||
814 | /* Check for a method local or argument, or standalone String */ | 777 | /* Check for a method local or argument, or standalone String */ |
815 | 778 | ||
816 | if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) { | 779 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != |
817 | switch (ACPI_GET_OBJECT_TYPE (operand[0])) { | 780 | ACPI_DESC_TYPE_NAMED) { |
781 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | ||
818 | case ACPI_TYPE_LOCAL_REFERENCE: | 782 | case ACPI_TYPE_LOCAL_REFERENCE: |
819 | /* | 783 | /* |
820 | * This is a deref_of (local_x | arg_x) | 784 | * This is a deref_of (local_x | arg_x) |
@@ -827,11 +791,12 @@ acpi_ex_opcode_1A_0T_1R ( | |||
827 | 791 | ||
828 | /* Set Operand[0] to the value of the local/arg */ | 792 | /* Set Operand[0] to the value of the local/arg */ |
829 | 793 | ||
830 | status = acpi_ds_method_data_get_value ( | 794 | status = |
831 | operand[0]->reference.opcode, | 795 | acpi_ds_method_data_get_value |
832 | operand[0]->reference.offset, | 796 | (operand[0]->reference.opcode, |
833 | walk_state, &temp_desc); | 797 | operand[0]->reference.offset, |
834 | if (ACPI_FAILURE (status)) { | 798 | walk_state, &temp_desc); |
799 | if (ACPI_FAILURE(status)) { | ||
835 | goto cleanup; | 800 | goto cleanup; |
836 | } | 801 | } |
837 | 802 | ||
@@ -839,7 +804,7 @@ acpi_ex_opcode_1A_0T_1R ( | |||
839 | * Delete our reference to the input object and | 804 | * Delete our reference to the input object and |
840 | * point to the object just retrieved | 805 | * point to the object just retrieved |
841 | */ | 806 | */ |
842 | acpi_ut_remove_reference (operand[0]); | 807 | acpi_ut_remove_reference(operand[0]); |
843 | operand[0] = temp_desc; | 808 | operand[0] = temp_desc; |
844 | break; | 809 | break; |
845 | 810 | ||
@@ -847,8 +812,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
847 | 812 | ||
848 | /* Get the object to which the reference refers */ | 813 | /* Get the object to which the reference refers */ |
849 | 814 | ||
850 | temp_desc = operand[0]->reference.object; | 815 | temp_desc = |
851 | acpi_ut_remove_reference (operand[0]); | 816 | operand[0]->reference.object; |
817 | acpi_ut_remove_reference(operand[0]); | ||
852 | operand[0] = temp_desc; | 818 | operand[0] = temp_desc; |
853 | break; | 819 | break; |
854 | 820 | ||
@@ -859,7 +825,6 @@ acpi_ex_opcode_1A_0T_1R ( | |||
859 | } | 825 | } |
860 | break; | 826 | break; |
861 | 827 | ||
862 | |||
863 | case ACPI_TYPE_STRING: | 828 | case ACPI_TYPE_STRING: |
864 | 829 | ||
865 | /* | 830 | /* |
@@ -870,22 +835,28 @@ acpi_ex_opcode_1A_0T_1R ( | |||
870 | * 2) Dereference the node to an actual object. Could be a | 835 | * 2) Dereference the node to an actual object. Could be a |
871 | * Field, so we need to resolve the node to a value. | 836 | * Field, so we need to resolve the node to a value. |
872 | */ | 837 | */ |
873 | status = acpi_ns_get_node_by_path (operand[0]->string.pointer, | 838 | status = |
874 | walk_state->scope_info->scope.node, | 839 | acpi_ns_get_node_by_path(operand[0]->string. |
875 | ACPI_NS_SEARCH_PARENT, | 840 | pointer, |
876 | ACPI_CAST_INDIRECT_PTR ( | 841 | walk_state-> |
877 | struct acpi_namespace_node, &return_desc)); | 842 | scope_info->scope. |
878 | if (ACPI_FAILURE (status)) { | 843 | node, |
844 | ACPI_NS_SEARCH_PARENT, | ||
845 | ACPI_CAST_INDIRECT_PTR | ||
846 | (struct | ||
847 | acpi_namespace_node, | ||
848 | &return_desc)); | ||
849 | if (ACPI_FAILURE(status)) { | ||
879 | goto cleanup; | 850 | goto cleanup; |
880 | } | 851 | } |
881 | 852 | ||
882 | status = acpi_ex_resolve_node_to_value ( | 853 | status = |
883 | ACPI_CAST_INDIRECT_PTR ( | 854 | acpi_ex_resolve_node_to_value |
884 | struct acpi_namespace_node, &return_desc), | 855 | (ACPI_CAST_INDIRECT_PTR |
885 | walk_state); | 856 | (struct acpi_namespace_node, &return_desc), |
857 | walk_state); | ||
886 | goto cleanup; | 858 | goto cleanup; |
887 | 859 | ||
888 | |||
889 | default: | 860 | default: |
890 | 861 | ||
891 | status = AE_AML_OPERAND_TYPE; | 862 | status = AE_AML_OPERAND_TYPE; |
@@ -895,18 +866,20 @@ acpi_ex_opcode_1A_0T_1R ( | |||
895 | 866 | ||
896 | /* Operand[0] may have changed from the code above */ | 867 | /* Operand[0] may have changed from the code above */ |
897 | 868 | ||
898 | if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) { | 869 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == |
870 | ACPI_DESC_TYPE_NAMED) { | ||
899 | /* | 871 | /* |
900 | * This is a deref_of (object_reference) | 872 | * This is a deref_of (object_reference) |
901 | * Get the actual object from the Node (This is the dereference). | 873 | * Get the actual object from the Node (This is the dereference). |
902 | * This case may only happen when a local_x or arg_x is | 874 | * This case may only happen when a local_x or arg_x is |
903 | * dereferenced above. | 875 | * dereferenced above. |
904 | */ | 876 | */ |
905 | return_desc = acpi_ns_get_attached_object ( | 877 | return_desc = acpi_ns_get_attached_object((struct |
906 | (struct acpi_namespace_node *) operand[0]); | 878 | acpi_namespace_node |
907 | acpi_ut_add_reference (return_desc); | 879 | *) |
908 | } | 880 | operand[0]); |
909 | else { | 881 | acpi_ut_add_reference(return_desc); |
882 | } else { | ||
910 | /* | 883 | /* |
911 | * This must be a reference object produced by either the | 884 | * This must be a reference object produced by either the |
912 | * Index() or ref_of() operator | 885 | * Index() or ref_of() operator |
@@ -921,7 +894,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
921 | switch (operand[0]->reference.target_type) { | 894 | switch (operand[0]->reference.target_type) { |
922 | case ACPI_TYPE_BUFFER_FIELD: | 895 | case ACPI_TYPE_BUFFER_FIELD: |
923 | 896 | ||
924 | temp_desc = operand[0]->reference.object; | 897 | temp_desc = |
898 | operand[0]->reference.object; | ||
925 | 899 | ||
926 | /* | 900 | /* |
927 | * Create a new object that contains one element of the | 901 | * Create a new object that contains one element of the |
@@ -931,7 +905,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
931 | * sub-buffer of the main buffer, it is only a pointer to a | 905 | * sub-buffer of the main buffer, it is only a pointer to a |
932 | * single element (byte) of the buffer! | 906 | * single element (byte) of the buffer! |
933 | */ | 907 | */ |
934 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 908 | return_desc = |
909 | acpi_ut_create_internal_object | ||
910 | (ACPI_TYPE_INTEGER); | ||
935 | if (!return_desc) { | 911 | if (!return_desc) { |
936 | status = AE_NO_MEMORY; | 912 | status = AE_NO_MEMORY; |
937 | goto cleanup; | 913 | goto cleanup; |
@@ -943,56 +919,63 @@ acpi_ex_opcode_1A_0T_1R ( | |||
943 | * reference to the buffer itself. | 919 | * reference to the buffer itself. |
944 | */ | 920 | */ |
945 | return_desc->integer.value = | 921 | return_desc->integer.value = |
946 | temp_desc->buffer.pointer[operand[0]->reference.offset]; | 922 | temp_desc->buffer. |
923 | pointer[operand[0]->reference. | ||
924 | offset]; | ||
947 | break; | 925 | break; |
948 | 926 | ||
949 | |||
950 | case ACPI_TYPE_PACKAGE: | 927 | case ACPI_TYPE_PACKAGE: |
951 | 928 | ||
952 | /* | 929 | /* |
953 | * Return the referenced element of the package. We must | 930 | * Return the referenced element of the package. We must |
954 | * add another reference to the referenced object, however. | 931 | * add another reference to the referenced object, however. |
955 | */ | 932 | */ |
956 | return_desc = *(operand[0]->reference.where); | 933 | return_desc = |
934 | *(operand[0]->reference.where); | ||
957 | if (return_desc) { | 935 | if (return_desc) { |
958 | acpi_ut_add_reference (return_desc); | 936 | acpi_ut_add_reference |
937 | (return_desc); | ||
959 | } | 938 | } |
960 | 939 | ||
961 | break; | 940 | break; |
962 | 941 | ||
963 | |||
964 | default: | 942 | default: |
965 | 943 | ||
966 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 944 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
967 | "Unknown Index target_type %X in obj %p\n", | 945 | "Unknown Index target_type %X in obj %p\n", |
968 | operand[0]->reference.target_type, operand[0])); | 946 | operand[0]->reference. |
947 | target_type, | ||
948 | operand[0])); | ||
969 | status = AE_AML_OPERAND_TYPE; | 949 | status = AE_AML_OPERAND_TYPE; |
970 | goto cleanup; | 950 | goto cleanup; |
971 | } | 951 | } |
972 | break; | 952 | break; |
973 | 953 | ||
974 | |||
975 | case AML_REF_OF_OP: | 954 | case AML_REF_OF_OP: |
976 | 955 | ||
977 | return_desc = operand[0]->reference.object; | 956 | return_desc = operand[0]->reference.object; |
978 | 957 | ||
979 | if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == | 958 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == |
980 | ACPI_DESC_TYPE_NAMED) { | 959 | ACPI_DESC_TYPE_NAMED) { |
981 | 960 | ||
982 | return_desc = acpi_ns_get_attached_object ( | 961 | return_desc = |
983 | (struct acpi_namespace_node *) return_desc); | 962 | acpi_ns_get_attached_object((struct |
963 | acpi_namespace_node | ||
964 | *) | ||
965 | return_desc); | ||
984 | } | 966 | } |
985 | 967 | ||
986 | /* Add another reference to the object! */ | 968 | /* Add another reference to the object! */ |
987 | 969 | ||
988 | acpi_ut_add_reference (return_desc); | 970 | acpi_ut_add_reference(return_desc); |
989 | break; | 971 | break; |
990 | 972 | ||
991 | |||
992 | default: | 973 | default: |
993 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 974 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
994 | "Unknown opcode in ref(%p) - %X\n", | 975 | "Unknown opcode in ref(%p) - %X\n", |
995 | operand[0], operand[0]->reference.opcode)); | 976 | operand[0], |
977 | operand[0]->reference. | ||
978 | opcode)); | ||
996 | 979 | ||
997 | status = AE_TYPE; | 980 | status = AE_TYPE; |
998 | goto cleanup; | 981 | goto cleanup; |
@@ -1000,25 +983,21 @@ acpi_ex_opcode_1A_0T_1R ( | |||
1000 | } | 983 | } |
1001 | break; | 984 | break; |
1002 | 985 | ||
1003 | |||
1004 | default: | 986 | default: |
1005 | 987 | ||
1006 | ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", | 988 | ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); |
1007 | walk_state->opcode)); | ||
1008 | status = AE_AML_BAD_OPCODE; | 989 | status = AE_AML_BAD_OPCODE; |
1009 | goto cleanup; | 990 | goto cleanup; |
1010 | } | 991 | } |
1011 | 992 | ||
1012 | 993 | cleanup: | |
1013 | cleanup: | ||
1014 | 994 | ||
1015 | /* Delete return object on error */ | 995 | /* Delete return object on error */ |
1016 | 996 | ||
1017 | if (ACPI_FAILURE (status)) { | 997 | if (ACPI_FAILURE(status)) { |
1018 | acpi_ut_remove_reference (return_desc); | 998 | acpi_ut_remove_reference(return_desc); |
1019 | } | 999 | } |
1020 | 1000 | ||
1021 | walk_state->result_obj = return_desc; | 1001 | walk_state->result_obj = return_desc; |
1022 | return_ACPI_STATUS (status); | 1002 | return_ACPI_STATUS(status); |
1023 | } | 1003 | } |
1024 | |||
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 7429032c2b6c..8d70c6beef00 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -41,17 +41,14 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 45 | #include <acpi/acparser.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/acevents.h> | 47 | #include <acpi/acevents.h> |
49 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exoparg2") | 51 | ACPI_MODULE_NAME("exoparg2") |
54 | |||
55 | 52 | ||
56 | /*! | 53 | /*! |
57 | * Naming convention for AML interpreter execution routines. | 54 | * Naming convention for AML interpreter execution routines. |
@@ -74,8 +71,6 @@ | |||
74 | * The AcpiExOpcode* functions are called via the Dispatcher component with | 71 | * The AcpiExOpcode* functions are called via the Dispatcher component with |
75 | * fully resolved operands. | 72 | * fully resolved operands. |
76 | !*/ | 73 | !*/ |
77 | |||
78 | |||
79 | /******************************************************************************* | 74 | /******************************************************************************* |
80 | * | 75 | * |
81 | * FUNCTION: acpi_ex_opcode_2A_0T_0R | 76 | * FUNCTION: acpi_ex_opcode_2A_0T_0R |
@@ -90,29 +85,24 @@ | |||
90 | * ALLOCATION: Deletes both operands | 85 | * ALLOCATION: Deletes both operands |
91 | * | 86 | * |
92 | ******************************************************************************/ | 87 | ******************************************************************************/ |
93 | 88 | acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |
94 | acpi_status | ||
95 | acpi_ex_opcode_2A_0T_0R ( | ||
96 | struct acpi_walk_state *walk_state) | ||
97 | { | 89 | { |
98 | union acpi_operand_object **operand = &walk_state->operands[0]; | 90 | union acpi_operand_object **operand = &walk_state->operands[0]; |
99 | struct acpi_namespace_node *node; | 91 | struct acpi_namespace_node *node; |
100 | u32 value; | 92 | u32 value; |
101 | acpi_status status = AE_OK; | 93 | acpi_status status = AE_OK; |
102 | |||
103 | |||
104 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_0R", | ||
105 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
106 | 94 | ||
95 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R", | ||
96 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
107 | 97 | ||
108 | /* Examine the opcode */ | 98 | /* Examine the opcode */ |
109 | 99 | ||
110 | switch (walk_state->opcode) { | 100 | switch (walk_state->opcode) { |
111 | case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */ | 101 | case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */ |
112 | 102 | ||
113 | /* The first operand is a namespace node */ | 103 | /* The first operand is a namespace node */ |
114 | 104 | ||
115 | node = (struct acpi_namespace_node *) operand[0]; | 105 | node = (struct acpi_namespace_node *)operand[0]; |
116 | 106 | ||
117 | /* Second value is the notify value */ | 107 | /* Second value is the notify value */ |
118 | 108 | ||
@@ -120,15 +110,14 @@ acpi_ex_opcode_2A_0T_0R ( | |||
120 | 110 | ||
121 | /* Are notifies allowed on this object? */ | 111 | /* Are notifies allowed on this object? */ |
122 | 112 | ||
123 | if (!acpi_ev_is_notify_object (node)) { | 113 | if (!acpi_ev_is_notify_object(node)) { |
124 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 114 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
125 | "Unexpected notify object type [%s]\n", | 115 | "Unexpected notify object type [%s]\n", |
126 | acpi_ut_get_type_name (node->type))); | 116 | acpi_ut_get_type_name(node->type))); |
127 | 117 | ||
128 | status = AE_AML_OPERAND_TYPE; | 118 | status = AE_AML_OPERAND_TYPE; |
129 | break; | 119 | break; |
130 | } | 120 | } |
131 | |||
132 | #ifdef ACPI_GPE_NOTIFY_CHECK | 121 | #ifdef ACPI_GPE_NOTIFY_CHECK |
133 | /* | 122 | /* |
134 | * GPE method wake/notify check. Here, we want to ensure that we | 123 | * GPE method wake/notify check. Here, we want to ensure that we |
@@ -144,12 +133,14 @@ acpi_ex_opcode_2A_0T_0R ( | |||
144 | * If all three cases are true, this is a wake-only GPE that should | 133 | * If all three cases are true, this is a wake-only GPE that should |
145 | * be disabled at runtime. | 134 | * be disabled at runtime. |
146 | */ | 135 | */ |
147 | if (value == 2) /* device_wake */ { | 136 | if (value == 2) { /* device_wake */ |
148 | status = acpi_ev_check_for_wake_only_gpe (walk_state->gpe_event_info); | 137 | status = |
149 | if (ACPI_FAILURE (status)) { | 138 | acpi_ev_check_for_wake_only_gpe(walk_state-> |
139 | gpe_event_info); | ||
140 | if (ACPI_FAILURE(status)) { | ||
150 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ | 141 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ |
151 | 142 | ||
152 | return_ACPI_STATUS (AE_OK) | 143 | return_ACPI_STATUS(AE_OK) |
153 | } | 144 | } |
154 | } | 145 | } |
155 | #endif | 146 | #endif |
@@ -161,21 +152,18 @@ acpi_ex_opcode_2A_0T_0R ( | |||
161 | * from this thread -- because handlers may in turn run other | 152 | * from this thread -- because handlers may in turn run other |
162 | * control methods. | 153 | * control methods. |
163 | */ | 154 | */ |
164 | status = acpi_ev_queue_notify_request (node, value); | 155 | status = acpi_ev_queue_notify_request(node, value); |
165 | break; | 156 | break; |
166 | 157 | ||
167 | |||
168 | default: | 158 | default: |
169 | 159 | ||
170 | ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", | 160 | ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); |
171 | walk_state->opcode)); | ||
172 | status = AE_AML_BAD_OPCODE; | 161 | status = AE_AML_BAD_OPCODE; |
173 | } | 162 | } |
174 | 163 | ||
175 | return_ACPI_STATUS (status); | 164 | return_ACPI_STATUS(status); |
176 | } | 165 | } |
177 | 166 | ||
178 | |||
179 | /******************************************************************************* | 167 | /******************************************************************************* |
180 | * | 168 | * |
181 | * FUNCTION: acpi_ex_opcode_2A_2T_1R | 169 | * FUNCTION: acpi_ex_opcode_2A_2T_1R |
@@ -189,19 +177,15 @@ acpi_ex_opcode_2A_0T_0R ( | |||
189 | * | 177 | * |
190 | ******************************************************************************/ | 178 | ******************************************************************************/ |
191 | 179 | ||
192 | acpi_status | 180 | acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) |
193 | acpi_ex_opcode_2A_2T_1R ( | ||
194 | struct acpi_walk_state *walk_state) | ||
195 | { | 181 | { |
196 | union acpi_operand_object **operand = &walk_state->operands[0]; | 182 | union acpi_operand_object **operand = &walk_state->operands[0]; |
197 | union acpi_operand_object *return_desc1 = NULL; | 183 | union acpi_operand_object *return_desc1 = NULL; |
198 | union acpi_operand_object *return_desc2 = NULL; | 184 | union acpi_operand_object *return_desc2 = NULL; |
199 | acpi_status status; | 185 | acpi_status status; |
200 | |||
201 | |||
202 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R", | ||
203 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
204 | 186 | ||
187 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R", | ||
188 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
205 | 189 | ||
206 | /* Execute the opcode */ | 190 | /* Execute the opcode */ |
207 | 191 | ||
@@ -210,13 +194,15 @@ acpi_ex_opcode_2A_2T_1R ( | |||
210 | 194 | ||
211 | /* Divide (Dividend, Divisor, remainder_result quotient_result) */ | 195 | /* Divide (Dividend, Divisor, remainder_result quotient_result) */ |
212 | 196 | ||
213 | return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 197 | return_desc1 = |
198 | acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
214 | if (!return_desc1) { | 199 | if (!return_desc1) { |
215 | status = AE_NO_MEMORY; | 200 | status = AE_NO_MEMORY; |
216 | goto cleanup; | 201 | goto cleanup; |
217 | } | 202 | } |
218 | 203 | ||
219 | return_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 204 | return_desc2 = |
205 | acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
220 | if (!return_desc2) { | 206 | if (!return_desc2) { |
221 | status = AE_NO_MEMORY; | 207 | status = AE_NO_MEMORY; |
222 | goto cleanup; | 208 | goto cleanup; |
@@ -224,33 +210,31 @@ acpi_ex_opcode_2A_2T_1R ( | |||
224 | 210 | ||
225 | /* Quotient to return_desc1, remainder to return_desc2 */ | 211 | /* Quotient to return_desc1, remainder to return_desc2 */ |
226 | 212 | ||
227 | status = acpi_ut_divide (operand[0]->integer.value, | 213 | status = acpi_ut_divide(operand[0]->integer.value, |
228 | operand[1]->integer.value, | 214 | operand[1]->integer.value, |
229 | &return_desc1->integer.value, | 215 | &return_desc1->integer.value, |
230 | &return_desc2->integer.value); | 216 | &return_desc2->integer.value); |
231 | if (ACPI_FAILURE (status)) { | 217 | if (ACPI_FAILURE(status)) { |
232 | goto cleanup; | 218 | goto cleanup; |
233 | } | 219 | } |
234 | break; | 220 | break; |
235 | 221 | ||
236 | |||
237 | default: | 222 | default: |
238 | 223 | ||
239 | ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", | 224 | ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode)); |
240 | walk_state->opcode)); | ||
241 | status = AE_AML_BAD_OPCODE; | 225 | status = AE_AML_BAD_OPCODE; |
242 | goto cleanup; | 226 | goto cleanup; |
243 | } | 227 | } |
244 | 228 | ||
245 | /* Store the results to the target reference operands */ | 229 | /* Store the results to the target reference operands */ |
246 | 230 | ||
247 | status = acpi_ex_store (return_desc2, operand[2], walk_state); | 231 | status = acpi_ex_store(return_desc2, operand[2], walk_state); |
248 | if (ACPI_FAILURE (status)) { | 232 | if (ACPI_FAILURE(status)) { |
249 | goto cleanup; | 233 | goto cleanup; |
250 | } | 234 | } |
251 | 235 | ||
252 | status = acpi_ex_store (return_desc1, operand[3], walk_state); | 236 | status = acpi_ex_store(return_desc1, operand[3], walk_state); |
253 | if (ACPI_FAILURE (status)) { | 237 | if (ACPI_FAILURE(status)) { |
254 | goto cleanup; | 238 | goto cleanup; |
255 | } | 239 | } |
256 | 240 | ||
@@ -258,24 +242,22 @@ acpi_ex_opcode_2A_2T_1R ( | |||
258 | 242 | ||
259 | walk_state->result_obj = return_desc1; | 243 | walk_state->result_obj = return_desc1; |
260 | 244 | ||
261 | 245 | cleanup: | |
262 | cleanup: | ||
263 | /* | 246 | /* |
264 | * Since the remainder is not returned indirectly, remove a reference to | 247 | * Since the remainder is not returned indirectly, remove a reference to |
265 | * it. Only the quotient is returned indirectly. | 248 | * it. Only the quotient is returned indirectly. |
266 | */ | 249 | */ |
267 | acpi_ut_remove_reference (return_desc2); | 250 | acpi_ut_remove_reference(return_desc2); |
268 | 251 | ||
269 | if (ACPI_FAILURE (status)) { | 252 | if (ACPI_FAILURE(status)) { |
270 | /* Delete the return object */ | 253 | /* Delete the return object */ |
271 | 254 | ||
272 | acpi_ut_remove_reference (return_desc1); | 255 | acpi_ut_remove_reference(return_desc1); |
273 | } | 256 | } |
274 | 257 | ||
275 | return_ACPI_STATUS (status); | 258 | return_ACPI_STATUS(status); |
276 | } | 259 | } |
277 | 260 | ||
278 | |||
279 | /******************************************************************************* | 261 | /******************************************************************************* |
280 | * | 262 | * |
281 | * FUNCTION: acpi_ex_opcode_2A_1T_1R | 263 | * FUNCTION: acpi_ex_opcode_2A_1T_1R |
@@ -289,42 +271,39 @@ cleanup: | |||
289 | * | 271 | * |
290 | ******************************************************************************/ | 272 | ******************************************************************************/ |
291 | 273 | ||
292 | acpi_status | 274 | acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) |
293 | acpi_ex_opcode_2A_1T_1R ( | ||
294 | struct acpi_walk_state *walk_state) | ||
295 | { | 275 | { |
296 | union acpi_operand_object **operand = &walk_state->operands[0]; | 276 | union acpi_operand_object **operand = &walk_state->operands[0]; |
297 | union acpi_operand_object *return_desc = NULL; | 277 | union acpi_operand_object *return_desc = NULL; |
298 | acpi_integer index; | 278 | acpi_integer index; |
299 | acpi_status status = AE_OK; | 279 | acpi_status status = AE_OK; |
300 | acpi_size length; | 280 | acpi_size length; |
301 | |||
302 | |||
303 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R", | ||
304 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
305 | 281 | ||
282 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R", | ||
283 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
306 | 284 | ||
307 | /* Execute the opcode */ | 285 | /* Execute the opcode */ |
308 | 286 | ||
309 | if (walk_state->op_info->flags & AML_MATH) { | 287 | if (walk_state->op_info->flags & AML_MATH) { |
310 | /* All simple math opcodes (add, etc.) */ | 288 | /* All simple math opcodes (add, etc.) */ |
311 | 289 | ||
312 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 290 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
313 | if (!return_desc) { | 291 | if (!return_desc) { |
314 | status = AE_NO_MEMORY; | 292 | status = AE_NO_MEMORY; |
315 | goto cleanup; | 293 | goto cleanup; |
316 | } | 294 | } |
317 | 295 | ||
318 | return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode, | 296 | return_desc->integer.value = |
319 | operand[0]->integer.value, | 297 | acpi_ex_do_math_op(walk_state->opcode, |
320 | operand[1]->integer.value); | 298 | operand[0]->integer.value, |
299 | operand[1]->integer.value); | ||
321 | goto store_result_to_target; | 300 | goto store_result_to_target; |
322 | } | 301 | } |
323 | 302 | ||
324 | switch (walk_state->opcode) { | 303 | switch (walk_state->opcode) { |
325 | case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ | 304 | case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ |
326 | 305 | ||
327 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 306 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
328 | if (!return_desc) { | 307 | if (!return_desc) { |
329 | status = AE_NO_MEMORY; | 308 | status = AE_NO_MEMORY; |
330 | goto cleanup; | 309 | goto cleanup; |
@@ -332,21 +311,18 @@ acpi_ex_opcode_2A_1T_1R ( | |||
332 | 311 | ||
333 | /* return_desc will contain the remainder */ | 312 | /* return_desc will contain the remainder */ |
334 | 313 | ||
335 | status = acpi_ut_divide (operand[0]->integer.value, | 314 | status = acpi_ut_divide(operand[0]->integer.value, |
336 | operand[1]->integer.value, | 315 | operand[1]->integer.value, |
337 | NULL, | 316 | NULL, &return_desc->integer.value); |
338 | &return_desc->integer.value); | ||
339 | break; | 317 | break; |
340 | 318 | ||
319 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ | ||
341 | 320 | ||
342 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ | 321 | status = acpi_ex_do_concatenate(operand[0], operand[1], |
343 | 322 | &return_desc, walk_state); | |
344 | status = acpi_ex_do_concatenate (operand[0], operand[1], | ||
345 | &return_desc, walk_state); | ||
346 | break; | 323 | break; |
347 | 324 | ||
348 | 325 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ | |
349 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ | ||
350 | 326 | ||
351 | /* | 327 | /* |
352 | * Input object is guaranteed to be a buffer at this point (it may have | 328 | * Input object is guaranteed to be a buffer at this point (it may have |
@@ -365,8 +341,8 @@ acpi_ex_opcode_2A_1T_1R ( | |||
365 | */ | 341 | */ |
366 | length = 0; | 342 | length = 0; |
367 | while ((length < operand[0]->buffer.length) && | 343 | while ((length < operand[0]->buffer.length) && |
368 | (length < operand[1]->integer.value) && | 344 | (length < operand[1]->integer.value) && |
369 | (operand[0]->buffer.pointer[length])) { | 345 | (operand[0]->buffer.pointer[length])) { |
370 | length++; | 346 | length++; |
371 | if (length > ACPI_MAX_STRING_CONVERSION) { | 347 | if (length > ACPI_MAX_STRING_CONVERSION) { |
372 | status = AE_AML_STRING_LIMIT; | 348 | status = AE_AML_STRING_LIMIT; |
@@ -376,33 +352,32 @@ acpi_ex_opcode_2A_1T_1R ( | |||
376 | 352 | ||
377 | /* Allocate a new string object */ | 353 | /* Allocate a new string object */ |
378 | 354 | ||
379 | return_desc = acpi_ut_create_string_object (length); | 355 | return_desc = acpi_ut_create_string_object(length); |
380 | if (!return_desc) { | 356 | if (!return_desc) { |
381 | status = AE_NO_MEMORY; | 357 | status = AE_NO_MEMORY; |
382 | goto cleanup; | 358 | goto cleanup; |
383 | } | 359 | } |
384 | 360 | ||
385 | /* Copy the raw buffer data with no transform. NULL terminated already*/ | 361 | /* Copy the raw buffer data with no transform. NULL terminated already */ |
386 | 362 | ||
387 | ACPI_MEMCPY (return_desc->string.pointer, | 363 | ACPI_MEMCPY(return_desc->string.pointer, |
388 | operand[0]->buffer.pointer, length); | 364 | operand[0]->buffer.pointer, length); |
389 | break; | 365 | break; |
390 | 366 | ||
391 | |||
392 | case AML_CONCAT_RES_OP: | 367 | case AML_CONCAT_RES_OP: |
393 | 368 | ||
394 | /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ | 369 | /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ |
395 | 370 | ||
396 | status = acpi_ex_concat_template (operand[0], operand[1], | 371 | status = acpi_ex_concat_template(operand[0], operand[1], |
397 | &return_desc, walk_state); | 372 | &return_desc, walk_state); |
398 | break; | 373 | break; |
399 | 374 | ||
400 | 375 | case AML_INDEX_OP: /* Index (Source Index Result) */ | |
401 | case AML_INDEX_OP: /* Index (Source Index Result) */ | ||
402 | 376 | ||
403 | /* Create the internal return object */ | 377 | /* Create the internal return object */ |
404 | 378 | ||
405 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE); | 379 | return_desc = |
380 | acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); | ||
406 | if (!return_desc) { | 381 | if (!return_desc) { |
407 | status = AE_NO_MEMORY; | 382 | status = AE_NO_MEMORY; |
408 | goto cleanup; | 383 | goto cleanup; |
@@ -412,76 +387,75 @@ acpi_ex_opcode_2A_1T_1R ( | |||
412 | 387 | ||
413 | /* At this point, the Source operand is a Package, Buffer, or String */ | 388 | /* At this point, the Source operand is a Package, Buffer, or String */ |
414 | 389 | ||
415 | if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { | 390 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { |
416 | /* Object to be indexed is a Package */ | 391 | /* Object to be indexed is a Package */ |
417 | 392 | ||
418 | if (index >= operand[0]->package.count) { | 393 | if (index >= operand[0]->package.count) { |
419 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 394 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
420 | "Index value (%X%8.8X) beyond package end (%X)\n", | 395 | "Index value (%X%8.8X) beyond package end (%X)\n", |
421 | ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); | 396 | ACPI_FORMAT_UINT64(index), |
397 | operand[0]->package.count)); | ||
422 | status = AE_AML_PACKAGE_LIMIT; | 398 | status = AE_AML_PACKAGE_LIMIT; |
423 | goto cleanup; | 399 | goto cleanup; |
424 | } | 400 | } |
425 | 401 | ||
426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; | 402 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; |
427 | return_desc->reference.object = operand[0]; | 403 | return_desc->reference.object = operand[0]; |
428 | return_desc->reference.where = &operand[0]->package.elements [ | 404 | return_desc->reference.where = |
429 | index]; | 405 | &operand[0]->package.elements[index]; |
430 | } | 406 | } else { |
431 | else { | ||
432 | /* Object to be indexed is a Buffer/String */ | 407 | /* Object to be indexed is a Buffer/String */ |
433 | 408 | ||
434 | if (index >= operand[0]->buffer.length) { | 409 | if (index >= operand[0]->buffer.length) { |
435 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 410 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
436 | "Index value (%X%8.8X) beyond end of buffer (%X)\n", | 411 | "Index value (%X%8.8X) beyond end of buffer (%X)\n", |
437 | ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length)); | 412 | ACPI_FORMAT_UINT64(index), |
413 | operand[0]->buffer.length)); | ||
438 | status = AE_AML_BUFFER_LIMIT; | 414 | status = AE_AML_BUFFER_LIMIT; |
439 | goto cleanup; | 415 | goto cleanup; |
440 | } | 416 | } |
441 | 417 | ||
442 | return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD; | 418 | return_desc->reference.target_type = |
443 | return_desc->reference.object = operand[0]; | 419 | ACPI_TYPE_BUFFER_FIELD; |
420 | return_desc->reference.object = operand[0]; | ||
444 | } | 421 | } |
445 | 422 | ||
446 | /* | 423 | /* |
447 | * Add a reference to the target package/buffer/string for the life | 424 | * Add a reference to the target package/buffer/string for the life |
448 | * of the index. | 425 | * of the index. |
449 | */ | 426 | */ |
450 | acpi_ut_add_reference (operand[0]); | 427 | acpi_ut_add_reference(operand[0]); |
451 | 428 | ||
452 | /* Complete the Index reference object */ | 429 | /* Complete the Index reference object */ |
453 | 430 | ||
454 | return_desc->reference.opcode = AML_INDEX_OP; | 431 | return_desc->reference.opcode = AML_INDEX_OP; |
455 | return_desc->reference.offset = (u32) index; | 432 | return_desc->reference.offset = (u32) index; |
456 | 433 | ||
457 | /* Store the reference to the Target */ | 434 | /* Store the reference to the Target */ |
458 | 435 | ||
459 | status = acpi_ex_store (return_desc, operand[2], walk_state); | 436 | status = acpi_ex_store(return_desc, operand[2], walk_state); |
460 | 437 | ||
461 | /* Return the reference */ | 438 | /* Return the reference */ |
462 | 439 | ||
463 | walk_state->result_obj = return_desc; | 440 | walk_state->result_obj = return_desc; |
464 | goto cleanup; | 441 | goto cleanup; |
465 | 442 | ||
466 | |||
467 | default: | 443 | default: |
468 | 444 | ||
469 | ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", | 445 | ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); |
470 | walk_state->opcode)); | ||
471 | status = AE_AML_BAD_OPCODE; | 446 | status = AE_AML_BAD_OPCODE; |
472 | break; | 447 | break; |
473 | } | 448 | } |
474 | 449 | ||
450 | store_result_to_target: | ||
475 | 451 | ||
476 | store_result_to_target: | 452 | if (ACPI_SUCCESS(status)) { |
477 | |||
478 | if (ACPI_SUCCESS (status)) { | ||
479 | /* | 453 | /* |
480 | * Store the result of the operation (which is now in return_desc) into | 454 | * Store the result of the operation (which is now in return_desc) into |
481 | * the Target descriptor. | 455 | * the Target descriptor. |
482 | */ | 456 | */ |
483 | status = acpi_ex_store (return_desc, operand[2], walk_state); | 457 | status = acpi_ex_store(return_desc, operand[2], walk_state); |
484 | if (ACPI_FAILURE (status)) { | 458 | if (ACPI_FAILURE(status)) { |
485 | goto cleanup; | 459 | goto cleanup; |
486 | } | 460 | } |
487 | 461 | ||
@@ -490,19 +464,17 @@ store_result_to_target: | |||
490 | } | 464 | } |
491 | } | 465 | } |
492 | 466 | ||
493 | 467 | cleanup: | |
494 | cleanup: | ||
495 | 468 | ||
496 | /* Delete return object on error */ | 469 | /* Delete return object on error */ |
497 | 470 | ||
498 | if (ACPI_FAILURE (status)) { | 471 | if (ACPI_FAILURE(status)) { |
499 | acpi_ut_remove_reference (return_desc); | 472 | acpi_ut_remove_reference(return_desc); |
500 | } | 473 | } |
501 | 474 | ||
502 | return_ACPI_STATUS (status); | 475 | return_ACPI_STATUS(status); |
503 | } | 476 | } |
504 | 477 | ||
505 | |||
506 | /******************************************************************************* | 478 | /******************************************************************************* |
507 | * | 479 | * |
508 | * FUNCTION: acpi_ex_opcode_2A_0T_1R | 480 | * FUNCTION: acpi_ex_opcode_2A_0T_1R |
@@ -515,23 +487,19 @@ cleanup: | |||
515 | * | 487 | * |
516 | ******************************************************************************/ | 488 | ******************************************************************************/ |
517 | 489 | ||
518 | acpi_status | 490 | acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) |
519 | acpi_ex_opcode_2A_0T_1R ( | ||
520 | struct acpi_walk_state *walk_state) | ||
521 | { | 491 | { |
522 | union acpi_operand_object **operand = &walk_state->operands[0]; | 492 | union acpi_operand_object **operand = &walk_state->operands[0]; |
523 | union acpi_operand_object *return_desc = NULL; | 493 | union acpi_operand_object *return_desc = NULL; |
524 | acpi_status status = AE_OK; | 494 | acpi_status status = AE_OK; |
525 | u8 logical_result = FALSE; | 495 | u8 logical_result = FALSE; |
526 | |||
527 | |||
528 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R", | ||
529 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
530 | 496 | ||
497 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R", | ||
498 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
531 | 499 | ||
532 | /* Create the internal return object */ | 500 | /* Create the internal return object */ |
533 | 501 | ||
534 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 502 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
535 | if (!return_desc) { | 503 | if (!return_desc) { |
536 | status = AE_NO_MEMORY; | 504 | status = AE_NO_MEMORY; |
537 | goto cleanup; | 505 | goto cleanup; |
@@ -542,50 +510,48 @@ acpi_ex_opcode_2A_0T_1R ( | |||
542 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { | 510 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { |
543 | /* logical_op (Operand0, Operand1) */ | 511 | /* logical_op (Operand0, Operand1) */ |
544 | 512 | ||
545 | status = acpi_ex_do_logical_numeric_op (walk_state->opcode, | 513 | status = acpi_ex_do_logical_numeric_op(walk_state->opcode, |
546 | operand[0]->integer.value, operand[1]->integer.value, | 514 | operand[0]->integer. |
547 | &logical_result); | 515 | value, |
516 | operand[1]->integer. | ||
517 | value, &logical_result); | ||
548 | goto store_logical_result; | 518 | goto store_logical_result; |
549 | } | 519 | } else if (walk_state->op_info->flags & AML_LOGICAL) { |
550 | else if (walk_state->op_info->flags & AML_LOGICAL) { | ||
551 | /* logical_op (Operand0, Operand1) */ | 520 | /* logical_op (Operand0, Operand1) */ |
552 | 521 | ||
553 | status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], | 522 | status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], |
554 | operand[1], &logical_result); | 523 | operand[1], &logical_result); |
555 | goto store_logical_result; | 524 | goto store_logical_result; |
556 | } | 525 | } |
557 | 526 | ||
558 | switch (walk_state->opcode) { | 527 | switch (walk_state->opcode) { |
559 | case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ | 528 | case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ |
560 | 529 | ||
561 | status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state); | 530 | status = |
531 | acpi_ex_acquire_mutex(operand[1], operand[0], walk_state); | ||
562 | if (status == AE_TIME) { | 532 | if (status == AE_TIME) { |
563 | logical_result = TRUE; /* TRUE = Acquire timed out */ | 533 | logical_result = TRUE; /* TRUE = Acquire timed out */ |
564 | status = AE_OK; | 534 | status = AE_OK; |
565 | } | 535 | } |
566 | break; | 536 | break; |
567 | 537 | ||
538 | case AML_WAIT_OP: /* Wait (event_object, Timeout) */ | ||
568 | 539 | ||
569 | case AML_WAIT_OP: /* Wait (event_object, Timeout) */ | 540 | status = acpi_ex_system_wait_event(operand[1], operand[0]); |
570 | |||
571 | status = acpi_ex_system_wait_event (operand[1], operand[0]); | ||
572 | if (status == AE_TIME) { | 541 | if (status == AE_TIME) { |
573 | logical_result = TRUE; /* TRUE, Wait timed out */ | 542 | logical_result = TRUE; /* TRUE, Wait timed out */ |
574 | status = AE_OK; | 543 | status = AE_OK; |
575 | } | 544 | } |
576 | break; | 545 | break; |
577 | 546 | ||
578 | |||
579 | default: | 547 | default: |
580 | 548 | ||
581 | ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", | 549 | ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); |
582 | walk_state->opcode)); | ||
583 | status = AE_AML_BAD_OPCODE; | 550 | status = AE_AML_BAD_OPCODE; |
584 | goto cleanup; | 551 | goto cleanup; |
585 | } | 552 | } |
586 | 553 | ||
587 | 554 | store_logical_result: | |
588 | store_logical_result: | ||
589 | /* | 555 | /* |
590 | * Set return value to according to logical_result. logical TRUE (all ones) | 556 | * Set return value to according to logical_result. logical TRUE (all ones) |
591 | * Default is FALSE (zero) | 557 | * Default is FALSE (zero) |
@@ -596,16 +562,13 @@ store_logical_result: | |||
596 | 562 | ||
597 | walk_state->result_obj = return_desc; | 563 | walk_state->result_obj = return_desc; |
598 | 564 | ||
599 | 565 | cleanup: | |
600 | cleanup: | ||
601 | 566 | ||
602 | /* Delete return object on error */ | 567 | /* Delete return object on error */ |
603 | 568 | ||
604 | if (ACPI_FAILURE (status)) { | 569 | if (ACPI_FAILURE(status)) { |
605 | acpi_ut_remove_reference (return_desc); | 570 | acpi_ut_remove_reference(return_desc); |
606 | } | 571 | } |
607 | 572 | ||
608 | return_ACPI_STATUS (status); | 573 | return_ACPI_STATUS(status); |
609 | } | 574 | } |
610 | |||
611 | |||
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 197890f443b5..483365777670 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -42,16 +42,13 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/acparser.h> | 47 | #include <acpi/acparser.h> |
49 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exoparg3") | 51 | ACPI_MODULE_NAME("exoparg3") |
54 | |||
55 | 52 | ||
56 | /*! | 53 | /*! |
57 | * Naming convention for AML interpreter execution routines. | 54 | * Naming convention for AML interpreter execution routines. |
@@ -74,8 +71,6 @@ | |||
74 | * The AcpiExOpcode* functions are called via the Dispatcher component with | 71 | * The AcpiExOpcode* functions are called via the Dispatcher component with |
75 | * fully resolved operands. | 72 | * fully resolved operands. |
76 | !*/ | 73 | !*/ |
77 | |||
78 | |||
79 | /******************************************************************************* | 74 | /******************************************************************************* |
80 | * | 75 | * |
81 | * FUNCTION: acpi_ex_opcode_3A_0T_0R | 76 | * FUNCTION: acpi_ex_opcode_3A_0T_0R |
@@ -87,61 +82,53 @@ | |||
87 | * DESCRIPTION: Execute Triadic operator (3 operands) | 82 | * DESCRIPTION: Execute Triadic operator (3 operands) |
88 | * | 83 | * |
89 | ******************************************************************************/ | 84 | ******************************************************************************/ |
90 | 85 | acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |
91 | acpi_status | ||
92 | acpi_ex_opcode_3A_0T_0R ( | ||
93 | struct acpi_walk_state *walk_state) | ||
94 | { | 86 | { |
95 | union acpi_operand_object **operand = &walk_state->operands[0]; | 87 | union acpi_operand_object **operand = &walk_state->operands[0]; |
96 | struct acpi_signal_fatal_info *fatal; | 88 | struct acpi_signal_fatal_info *fatal; |
97 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
98 | |||
99 | |||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", | ||
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
102 | 90 | ||
91 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", | ||
92 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
103 | 93 | ||
104 | switch (walk_state->opcode) { | 94 | switch (walk_state->opcode) { |
105 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
106 | 96 | ||
107 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
108 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 98 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
109 | (u32) operand[0]->integer.value, | 99 | (u32) operand[0]->integer.value, |
110 | (u32) operand[1]->integer.value, | 100 | (u32) operand[1]->integer.value, |
111 | (u32) operand[2]->integer.value)); | 101 | (u32) operand[2]->integer.value)); |
112 | 102 | ||
113 | fatal = ACPI_MEM_ALLOCATE (sizeof (struct acpi_signal_fatal_info)); | 103 | fatal = |
104 | ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); | ||
114 | if (fatal) { | 105 | if (fatal) { |
115 | fatal->type = (u32) operand[0]->integer.value; | 106 | fatal->type = (u32) operand[0]->integer.value; |
116 | fatal->code = (u32) operand[1]->integer.value; | 107 | fatal->code = (u32) operand[1]->integer.value; |
117 | fatal->argument = (u32) operand[2]->integer.value; | 108 | fatal->argument = (u32) operand[2]->integer.value; |
118 | } | 109 | } |
119 | 110 | ||
120 | /* Always signal the OS! */ | 111 | /* Always signal the OS! */ |
121 | 112 | ||
122 | status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); | 113 | status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal); |
123 | 114 | ||
124 | /* Might return while OS is shutting down, just continue */ | 115 | /* Might return while OS is shutting down, just continue */ |
125 | 116 | ||
126 | ACPI_MEM_FREE (fatal); | 117 | ACPI_MEM_FREE(fatal); |
127 | break; | 118 | break; |
128 | 119 | ||
129 | |||
130 | default: | 120 | default: |
131 | 121 | ||
132 | ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", | 122 | ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); |
133 | walk_state->opcode)); | ||
134 | status = AE_AML_BAD_OPCODE; | 123 | status = AE_AML_BAD_OPCODE; |
135 | goto cleanup; | 124 | goto cleanup; |
136 | } | 125 | } |
137 | 126 | ||
127 | cleanup: | ||
138 | 128 | ||
139 | cleanup: | 129 | return_ACPI_STATUS(status); |
140 | |||
141 | return_ACPI_STATUS (status); | ||
142 | } | 130 | } |
143 | 131 | ||
144 | |||
145 | /******************************************************************************* | 132 | /******************************************************************************* |
146 | * | 133 | * |
147 | * FUNCTION: acpi_ex_opcode_3A_1T_1R | 134 | * FUNCTION: acpi_ex_opcode_3A_1T_1R |
@@ -154,31 +141,28 @@ cleanup: | |||
154 | * | 141 | * |
155 | ******************************************************************************/ | 142 | ******************************************************************************/ |
156 | 143 | ||
157 | acpi_status | 144 | acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) |
158 | acpi_ex_opcode_3A_1T_1R ( | ||
159 | struct acpi_walk_state *walk_state) | ||
160 | { | 145 | { |
161 | union acpi_operand_object **operand = &walk_state->operands[0]; | 146 | union acpi_operand_object **operand = &walk_state->operands[0]; |
162 | union acpi_operand_object *return_desc = NULL; | 147 | union acpi_operand_object *return_desc = NULL; |
163 | char *buffer = NULL; | 148 | char *buffer = NULL; |
164 | acpi_status status = AE_OK; | 149 | acpi_status status = AE_OK; |
165 | acpi_integer index; | 150 | acpi_integer index; |
166 | acpi_size length; | 151 | acpi_size length; |
167 | |||
168 | |||
169 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", | ||
170 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
171 | 152 | ||
153 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", | ||
154 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
172 | 155 | ||
173 | switch (walk_state->opcode) { | 156 | switch (walk_state->opcode) { |
174 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ | 157 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ |
175 | 158 | ||
176 | /* | 159 | /* |
177 | * Create the return object. The Source operand is guaranteed to be | 160 | * Create the return object. The Source operand is guaranteed to be |
178 | * either a String or a Buffer, so just use its type. | 161 | * either a String or a Buffer, so just use its type. |
179 | */ | 162 | */ |
180 | return_desc = acpi_ut_create_internal_object ( | 163 | return_desc = |
181 | ACPI_GET_OBJECT_TYPE (operand[0])); | 164 | acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE |
165 | (operand[0])); | ||
182 | if (!return_desc) { | 166 | if (!return_desc) { |
183 | status = AE_NO_MEMORY; | 167 | status = AE_NO_MEMORY; |
184 | goto cleanup; | 168 | goto cleanup; |
@@ -201,17 +185,17 @@ acpi_ex_opcode_3A_1T_1R ( | |||
201 | 185 | ||
202 | else if ((index + length) > operand[0]->string.length) { | 186 | else if ((index + length) > operand[0]->string.length) { |
203 | length = (acpi_size) operand[0]->string.length - | 187 | length = (acpi_size) operand[0]->string.length - |
204 | (acpi_size) index; | 188 | (acpi_size) index; |
205 | } | 189 | } |
206 | 190 | ||
207 | /* Strings always have a sub-pointer, not so for buffers */ | 191 | /* Strings always have a sub-pointer, not so for buffers */ |
208 | 192 | ||
209 | switch (ACPI_GET_OBJECT_TYPE (operand[0])) { | 193 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { |
210 | case ACPI_TYPE_STRING: | 194 | case ACPI_TYPE_STRING: |
211 | 195 | ||
212 | /* Always allocate a new buffer for the String */ | 196 | /* Always allocate a new buffer for the String */ |
213 | 197 | ||
214 | buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); | 198 | buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); |
215 | if (!buffer) { | 199 | if (!buffer) { |
216 | status = AE_NO_MEMORY; | 200 | status = AE_NO_MEMORY; |
217 | goto cleanup; | 201 | goto cleanup; |
@@ -225,7 +209,7 @@ acpi_ex_opcode_3A_1T_1R ( | |||
225 | if (length > 0) { | 209 | if (length > 0) { |
226 | /* Allocate a new buffer for the Buffer */ | 210 | /* Allocate a new buffer for the Buffer */ |
227 | 211 | ||
228 | buffer = ACPI_MEM_CALLOCATE (length); | 212 | buffer = ACPI_MEM_CALLOCATE(length); |
229 | if (!buffer) { | 213 | if (!buffer) { |
230 | status = AE_NO_MEMORY; | 214 | status = AE_NO_MEMORY; |
231 | goto cleanup; | 215 | goto cleanup; |
@@ -233,7 +217,7 @@ acpi_ex_opcode_3A_1T_1R ( | |||
233 | } | 217 | } |
234 | break; | 218 | break; |
235 | 219 | ||
236 | default: /* Should not happen */ | 220 | default: /* Should not happen */ |
237 | 221 | ||
238 | status = AE_AML_OPERAND_TYPE; | 222 | status = AE_AML_OPERAND_TYPE; |
239 | goto cleanup; | 223 | goto cleanup; |
@@ -242,8 +226,8 @@ acpi_ex_opcode_3A_1T_1R ( | |||
242 | if (length > 0) { | 226 | if (length > 0) { |
243 | /* Copy the portion requested */ | 227 | /* Copy the portion requested */ |
244 | 228 | ||
245 | ACPI_MEMCPY (buffer, operand[0]->string.pointer + index, | 229 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, |
246 | length); | 230 | length); |
247 | } | 231 | } |
248 | 232 | ||
249 | /* Set the length of the new String/Buffer */ | 233 | /* Set the length of the new String/Buffer */ |
@@ -256,25 +240,23 @@ acpi_ex_opcode_3A_1T_1R ( | |||
256 | return_desc->buffer.flags |= AOPOBJ_DATA_VALID; | 240 | return_desc->buffer.flags |= AOPOBJ_DATA_VALID; |
257 | break; | 241 | break; |
258 | 242 | ||
259 | |||
260 | default: | 243 | default: |
261 | 244 | ||
262 | ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", | 245 | ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); |
263 | walk_state->opcode)); | ||
264 | status = AE_AML_BAD_OPCODE; | 246 | status = AE_AML_BAD_OPCODE; |
265 | goto cleanup; | 247 | goto cleanup; |
266 | } | 248 | } |
267 | 249 | ||
268 | /* Store the result in the target */ | 250 | /* Store the result in the target */ |
269 | 251 | ||
270 | status = acpi_ex_store (return_desc, operand[3], walk_state); | 252 | status = acpi_ex_store(return_desc, operand[3], walk_state); |
271 | 253 | ||
272 | cleanup: | 254 | cleanup: |
273 | 255 | ||
274 | /* Delete return object on error */ | 256 | /* Delete return object on error */ |
275 | 257 | ||
276 | if (ACPI_FAILURE (status) || walk_state->result_obj) { | 258 | if (ACPI_FAILURE(status) || walk_state->result_obj) { |
277 | acpi_ut_remove_reference (return_desc); | 259 | acpi_ut_remove_reference(return_desc); |
278 | } | 260 | } |
279 | 261 | ||
280 | /* Set the return object and exit */ | 262 | /* Set the return object and exit */ |
@@ -282,7 +264,5 @@ cleanup: | |||
282 | else { | 264 | else { |
283 | walk_state->result_obj = return_desc; | 265 | walk_state->result_obj = return_desc; |
284 | } | 266 | } |
285 | return_ACPI_STATUS (status); | 267 | return_ACPI_STATUS(status); |
286 | } | 268 | } |
287 | |||
288 | |||
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index 17f81d42ee41..5dee77139576 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -42,16 +42,13 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/acparser.h> | 47 | #include <acpi/acparser.h> |
49 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exoparg6") | 51 | ACPI_MODULE_NAME("exoparg6") |
54 | |||
55 | 52 | ||
56 | /*! | 53 | /*! |
57 | * Naming convention for AML interpreter execution routines. | 54 | * Naming convention for AML interpreter execution routines. |
@@ -74,15 +71,11 @@ | |||
74 | * The AcpiExOpcode* functions are called via the Dispatcher component with | 71 | * The AcpiExOpcode* functions are called via the Dispatcher component with |
75 | * fully resolved operands. | 72 | * fully resolved operands. |
76 | !*/ | 73 | !*/ |
77 | |||
78 | /* Local prototypes */ | 74 | /* Local prototypes */ |
79 | |||
80 | static u8 | 75 | static u8 |
81 | acpi_ex_do_match ( | 76 | acpi_ex_do_match(u32 match_op, |
82 | u32 match_op, | 77 | union acpi_operand_object *package_obj, |
83 | union acpi_operand_object *package_obj, | 78 | union acpi_operand_object *match_obj); |
84 | union acpi_operand_object *match_obj); | ||
85 | |||
86 | 79 | ||
87 | /******************************************************************************* | 80 | /******************************************************************************* |
88 | * | 81 | * |
@@ -101,14 +94,12 @@ acpi_ex_do_match ( | |||
101 | ******************************************************************************/ | 94 | ******************************************************************************/ |
102 | 95 | ||
103 | static u8 | 96 | static u8 |
104 | acpi_ex_do_match ( | 97 | acpi_ex_do_match(u32 match_op, |
105 | u32 match_op, | 98 | union acpi_operand_object *package_obj, |
106 | union acpi_operand_object *package_obj, | 99 | union acpi_operand_object *match_obj) |
107 | union acpi_operand_object *match_obj) | ||
108 | { | 100 | { |
109 | u8 logical_result = TRUE; | 101 | u8 logical_result = TRUE; |
110 | acpi_status status; | 102 | acpi_status status; |
111 | |||
112 | 103 | ||
113 | /* | 104 | /* |
114 | * Note: Since the package_obj/match_obj ordering is opposite to that of | 105 | * Note: Since the package_obj/match_obj ordering is opposite to that of |
@@ -133,9 +124,10 @@ acpi_ex_do_match ( | |||
133 | * True if equal: (P[i] == M) | 124 | * True if equal: (P[i] == M) |
134 | * Change to: (M == P[i]) | 125 | * Change to: (M == P[i]) |
135 | */ | 126 | */ |
136 | status = acpi_ex_do_logical_op (AML_LEQUAL_OP, match_obj, package_obj, | 127 | status = |
137 | &logical_result); | 128 | acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj, |
138 | if (ACPI_FAILURE (status)) { | 129 | &logical_result); |
130 | if (ACPI_FAILURE(status)) { | ||
139 | return (FALSE); | 131 | return (FALSE); |
140 | } | 132 | } |
141 | break; | 133 | break; |
@@ -146,12 +138,13 @@ acpi_ex_do_match ( | |||
146 | * True if less than or equal: (P[i] <= M) (P[i] not_greater than M) | 138 | * True if less than or equal: (P[i] <= M) (P[i] not_greater than M) |
147 | * Change to: (M >= P[i]) (M not_less than P[i]) | 139 | * Change to: (M >= P[i]) (M not_less than P[i]) |
148 | */ | 140 | */ |
149 | status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj, | 141 | status = |
150 | &logical_result); | 142 | acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj, |
151 | if (ACPI_FAILURE (status)) { | 143 | &logical_result); |
144 | if (ACPI_FAILURE(status)) { | ||
152 | return (FALSE); | 145 | return (FALSE); |
153 | } | 146 | } |
154 | logical_result = (u8) !logical_result; | 147 | logical_result = (u8) ! logical_result; |
155 | break; | 148 | break; |
156 | 149 | ||
157 | case MATCH_MLT: | 150 | case MATCH_MLT: |
@@ -160,9 +153,10 @@ acpi_ex_do_match ( | |||
160 | * True if less than: (P[i] < M) | 153 | * True if less than: (P[i] < M) |
161 | * Change to: (M > P[i]) | 154 | * Change to: (M > P[i]) |
162 | */ | 155 | */ |
163 | status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj, | 156 | status = |
164 | &logical_result); | 157 | acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj, |
165 | if (ACPI_FAILURE (status)) { | 158 | package_obj, &logical_result); |
159 | if (ACPI_FAILURE(status)) { | ||
166 | return (FALSE); | 160 | return (FALSE); |
167 | } | 161 | } |
168 | break; | 162 | break; |
@@ -173,12 +167,13 @@ acpi_ex_do_match ( | |||
173 | * True if greater than or equal: (P[i] >= M) (P[i] not_less than M) | 167 | * True if greater than or equal: (P[i] >= M) (P[i] not_less than M) |
174 | * Change to: (M <= P[i]) (M not_greater than P[i]) | 168 | * Change to: (M <= P[i]) (M not_greater than P[i]) |
175 | */ | 169 | */ |
176 | status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj, | 170 | status = |
177 | &logical_result); | 171 | acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj, |
178 | if (ACPI_FAILURE (status)) { | 172 | package_obj, &logical_result); |
173 | if (ACPI_FAILURE(status)) { | ||
179 | return (FALSE); | 174 | return (FALSE); |
180 | } | 175 | } |
181 | logical_result = (u8)!logical_result; | 176 | logical_result = (u8) ! logical_result; |
182 | break; | 177 | break; |
183 | 178 | ||
184 | case MATCH_MGT: | 179 | case MATCH_MGT: |
@@ -187,9 +182,10 @@ acpi_ex_do_match ( | |||
187 | * True if greater than: (P[i] > M) | 182 | * True if greater than: (P[i] > M) |
188 | * Change to: (M < P[i]) | 183 | * Change to: (M < P[i]) |
189 | */ | 184 | */ |
190 | status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj, | 185 | status = |
191 | &logical_result); | 186 | acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj, |
192 | if (ACPI_FAILURE (status)) { | 187 | &logical_result); |
188 | if (ACPI_FAILURE(status)) { | ||
193 | return (FALSE); | 189 | return (FALSE); |
194 | } | 190 | } |
195 | break; | 191 | break; |
@@ -204,7 +200,6 @@ acpi_ex_do_match ( | |||
204 | return logical_result; | 200 | return logical_result; |
205 | } | 201 | } |
206 | 202 | ||
207 | |||
208 | /******************************************************************************* | 203 | /******************************************************************************* |
209 | * | 204 | * |
210 | * FUNCTION: acpi_ex_opcode_6A_0T_1R | 205 | * FUNCTION: acpi_ex_opcode_6A_0T_1R |
@@ -217,20 +212,16 @@ acpi_ex_do_match ( | |||
217 | * | 212 | * |
218 | ******************************************************************************/ | 213 | ******************************************************************************/ |
219 | 214 | ||
220 | acpi_status | 215 | acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) |
221 | acpi_ex_opcode_6A_0T_1R ( | ||
222 | struct acpi_walk_state *walk_state) | ||
223 | { | 216 | { |
224 | union acpi_operand_object **operand = &walk_state->operands[0]; | 217 | union acpi_operand_object **operand = &walk_state->operands[0]; |
225 | union acpi_operand_object *return_desc = NULL; | 218 | union acpi_operand_object *return_desc = NULL; |
226 | acpi_status status = AE_OK; | 219 | acpi_status status = AE_OK; |
227 | acpi_integer index; | 220 | acpi_integer index; |
228 | union acpi_operand_object *this_element; | 221 | union acpi_operand_object *this_element; |
229 | |||
230 | |||
231 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", | ||
232 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
233 | 222 | ||
223 | ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", | ||
224 | acpi_ps_get_opcode_name(walk_state->opcode)); | ||
234 | 225 | ||
235 | switch (walk_state->opcode) { | 226 | switch (walk_state->opcode) { |
236 | case AML_MATCH_OP: | 227 | case AML_MATCH_OP: |
@@ -242,8 +233,9 @@ acpi_ex_opcode_6A_0T_1R ( | |||
242 | /* Validate both Match Term Operators (MTR, MEQ, etc.) */ | 233 | /* Validate both Match Term Operators (MTR, MEQ, etc.) */ |
243 | 234 | ||
244 | if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || | 235 | if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || |
245 | (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { | 236 | (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { |
246 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n")); | 237 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
238 | "Match operator out of range\n")); | ||
247 | status = AE_AML_OPERAND_VALUE; | 239 | status = AE_AML_OPERAND_VALUE; |
248 | goto cleanup; | 240 | goto cleanup; |
249 | } | 241 | } |
@@ -252,16 +244,17 @@ acpi_ex_opcode_6A_0T_1R ( | |||
252 | 244 | ||
253 | index = operand[5]->integer.value; | 245 | index = operand[5]->integer.value; |
254 | if (index >= operand[0]->package.count) { | 246 | if (index >= operand[0]->package.count) { |
255 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 247 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
256 | "Index (%X%8.8X) beyond package end (%X)\n", | 248 | "Index (%X%8.8X) beyond package end (%X)\n", |
257 | ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); | 249 | ACPI_FORMAT_UINT64(index), |
250 | operand[0]->package.count)); | ||
258 | status = AE_AML_PACKAGE_LIMIT; | 251 | status = AE_AML_PACKAGE_LIMIT; |
259 | goto cleanup; | 252 | goto cleanup; |
260 | } | 253 | } |
261 | 254 | ||
262 | /* Create an integer for the return value */ | 255 | /* Create an integer for the return value */ |
263 | 256 | ||
264 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 257 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
265 | if (!return_desc) { | 258 | if (!return_desc) { |
266 | status = AE_NO_MEMORY; | 259 | status = AE_NO_MEMORY; |
267 | goto cleanup; | 260 | goto cleanup; |
@@ -283,7 +276,7 @@ acpi_ex_opcode_6A_0T_1R ( | |||
283 | * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no | 276 | * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no |
284 | * match was found. | 277 | * match was found. |
285 | */ | 278 | */ |
286 | for ( ; index < operand[0]->package.count; index++) { | 279 | for (; index < operand[0]->package.count; index++) { |
287 | /* Get the current package element */ | 280 | /* Get the current package element */ |
288 | 281 | ||
289 | this_element = operand[0]->package.elements[index]; | 282 | this_element = operand[0]->package.elements[index]; |
@@ -299,13 +292,13 @@ acpi_ex_opcode_6A_0T_1R ( | |||
299 | * (proceed to next iteration of enclosing for loop) signifies a | 292 | * (proceed to next iteration of enclosing for loop) signifies a |
300 | * non-match. | 293 | * non-match. |
301 | */ | 294 | */ |
302 | if (!acpi_ex_do_match ((u32) operand[1]->integer.value, | 295 | if (!acpi_ex_do_match((u32) operand[1]->integer.value, |
303 | this_element, operand[2])) { | 296 | this_element, operand[2])) { |
304 | continue; | 297 | continue; |
305 | } | 298 | } |
306 | 299 | ||
307 | if (!acpi_ex_do_match ((u32) operand[3]->integer.value, | 300 | if (!acpi_ex_do_match((u32) operand[3]->integer.value, |
308 | this_element, operand[4])) { | 301 | this_element, operand[4])) { |
309 | continue; | 302 | continue; |
310 | } | 303 | } |
311 | 304 | ||
@@ -316,31 +309,27 @@ acpi_ex_opcode_6A_0T_1R ( | |||
316 | } | 309 | } |
317 | break; | 310 | break; |
318 | 311 | ||
319 | |||
320 | case AML_LOAD_TABLE_OP: | 312 | case AML_LOAD_TABLE_OP: |
321 | 313 | ||
322 | status = acpi_ex_load_table_op (walk_state, &return_desc); | 314 | status = acpi_ex_load_table_op(walk_state, &return_desc); |
323 | break; | 315 | break; |
324 | 316 | ||
325 | |||
326 | default: | 317 | default: |
327 | 318 | ||
328 | ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", | 319 | ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); |
329 | walk_state->opcode)); | ||
330 | status = AE_AML_BAD_OPCODE; | 320 | status = AE_AML_BAD_OPCODE; |
331 | goto cleanup; | 321 | goto cleanup; |
332 | } | 322 | } |
333 | 323 | ||
334 | walk_state->result_obj = return_desc; | 324 | walk_state->result_obj = return_desc; |
335 | 325 | ||
336 | 326 | cleanup: | |
337 | cleanup: | ||
338 | 327 | ||
339 | /* Delete return object on error */ | 328 | /* Delete return object on error */ |
340 | 329 | ||
341 | if (ACPI_FAILURE (status)) { | 330 | if (ACPI_FAILURE(status)) { |
342 | acpi_ut_remove_reference (return_desc); | 331 | acpi_ut_remove_reference(return_desc); |
343 | } | 332 | } |
344 | 333 | ||
345 | return_ACPI_STATUS (status); | 334 | return_ACPI_STATUS(status); |
346 | } | 335 | } |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index c9e3c68b5549..7476c363e407 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -42,32 +42,24 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
49 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exprep") | 51 | ACPI_MODULE_NAME("exprep") |
54 | 52 | ||
55 | /* Local prototypes */ | 53 | /* Local prototypes */ |
56 | |||
57 | static u32 | 54 | static u32 |
58 | acpi_ex_decode_field_access ( | 55 | acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, |
59 | union acpi_operand_object *obj_desc, | 56 | u8 field_flags, u32 * return_byte_alignment); |
60 | u8 field_flags, | ||
61 | u32 *return_byte_alignment); | ||
62 | |||
63 | 57 | ||
64 | #ifdef ACPI_UNDER_DEVELOPMENT | 58 | #ifdef ACPI_UNDER_DEVELOPMENT |
65 | 59 | ||
66 | static u32 | 60 | static u32 |
67 | acpi_ex_generate_access ( | 61 | acpi_ex_generate_access(u32 field_bit_offset, |
68 | u32 field_bit_offset, | 62 | u32 field_bit_length, u32 region_length); |
69 | u32 field_bit_length, | ||
70 | u32 region_length); | ||
71 | 63 | ||
72 | /******************************************************************************* | 64 | /******************************************************************************* |
73 | * | 65 | * |
@@ -92,39 +84,36 @@ acpi_ex_generate_access ( | |||
92 | ******************************************************************************/ | 84 | ******************************************************************************/ |
93 | 85 | ||
94 | static u32 | 86 | static u32 |
95 | acpi_ex_generate_access ( | 87 | acpi_ex_generate_access(u32 field_bit_offset, |
96 | u32 field_bit_offset, | 88 | u32 field_bit_length, u32 region_length) |
97 | u32 field_bit_length, | ||
98 | u32 region_length) | ||
99 | { | 89 | { |
100 | u32 field_byte_length; | 90 | u32 field_byte_length; |
101 | u32 field_byte_offset; | 91 | u32 field_byte_offset; |
102 | u32 field_byte_end_offset; | 92 | u32 field_byte_end_offset; |
103 | u32 access_byte_width; | 93 | u32 access_byte_width; |
104 | u32 field_start_offset; | 94 | u32 field_start_offset; |
105 | u32 field_end_offset; | 95 | u32 field_end_offset; |
106 | u32 minimum_access_width = 0xFFFFFFFF; | 96 | u32 minimum_access_width = 0xFFFFFFFF; |
107 | u32 minimum_accesses = 0xFFFFFFFF; | 97 | u32 minimum_accesses = 0xFFFFFFFF; |
108 | u32 accesses; | 98 | u32 accesses; |
109 | 99 | ||
110 | 100 | ACPI_FUNCTION_TRACE("ex_generate_access"); | |
111 | ACPI_FUNCTION_TRACE ("ex_generate_access"); | ||
112 | |||
113 | 101 | ||
114 | /* Round Field start offset and length to "minimal" byte boundaries */ | 102 | /* Round Field start offset and length to "minimal" byte boundaries */ |
115 | 103 | ||
116 | field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); | 104 | field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8)); |
117 | field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + | 105 | field_byte_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length + |
118 | field_bit_offset, 8)); | 106 | field_bit_offset, 8)); |
119 | field_byte_length = field_byte_end_offset - field_byte_offset; | 107 | field_byte_length = field_byte_end_offset - field_byte_offset; |
120 | 108 | ||
121 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 109 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
122 | "Bit length %d, Bit offset %d\n", | 110 | "Bit length %d, Bit offset %d\n", |
123 | field_bit_length, field_bit_offset)); | 111 | field_bit_length, field_bit_offset)); |
124 | 112 | ||
125 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
126 | "Byte Length %d, Byte Offset %d, End Offset %d\n", | 114 | "Byte Length %d, Byte Offset %d, End Offset %d\n", |
127 | field_byte_length, field_byte_offset, field_byte_end_offset)); | 115 | field_byte_length, field_byte_offset, |
116 | field_byte_end_offset)); | ||
128 | 117 | ||
129 | /* | 118 | /* |
130 | * Iterative search for the maximum access width that is both aligned | 119 | * Iterative search for the maximum access width that is both aligned |
@@ -132,7 +121,8 @@ acpi_ex_generate_access ( | |||
132 | * | 121 | * |
133 | * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes) | 122 | * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes) |
134 | */ | 123 | */ |
135 | for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { | 124 | for (access_byte_width = 1; access_byte_width <= 8; |
125 | access_byte_width <<= 1) { | ||
136 | /* | 126 | /* |
137 | * 1) Round end offset up to next access boundary and make sure that | 127 | * 1) Round end offset up to next access boundary and make sure that |
138 | * this does not go beyond the end of the parent region. | 128 | * this does not go beyond the end of the parent region. |
@@ -140,31 +130,37 @@ acpi_ex_generate_access ( | |||
140 | * are done. (This does not optimize for the perfectly aligned | 130 | * are done. (This does not optimize for the perfectly aligned |
141 | * case yet). | 131 | * case yet). |
142 | */ | 132 | */ |
143 | if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { | 133 | if (ACPI_ROUND_UP(field_byte_end_offset, access_byte_width) <= |
134 | region_length) { | ||
144 | field_start_offset = | 135 | field_start_offset = |
145 | ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / | 136 | ACPI_ROUND_DOWN(field_byte_offset, |
146 | access_byte_width; | 137 | access_byte_width) / |
138 | access_byte_width; | ||
147 | 139 | ||
148 | field_end_offset = | 140 | field_end_offset = |
149 | ACPI_ROUND_UP ((field_byte_length + field_byte_offset), | 141 | ACPI_ROUND_UP((field_byte_length + |
150 | access_byte_width) / access_byte_width; | 142 | field_byte_offset), |
143 | access_byte_width) / | ||
144 | access_byte_width; | ||
151 | 145 | ||
152 | accesses = field_end_offset - field_start_offset; | 146 | accesses = field_end_offset - field_start_offset; |
153 | 147 | ||
154 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 148 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
155 | "access_width %d end is within region\n", access_byte_width)); | 149 | "access_width %d end is within region\n", |
150 | access_byte_width)); | ||
156 | 151 | ||
157 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 152 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
158 | "Field Start %d, Field End %d -- requires %d accesses\n", | 153 | "Field Start %d, Field End %d -- requires %d accesses\n", |
159 | field_start_offset, field_end_offset, accesses)); | 154 | field_start_offset, field_end_offset, |
155 | accesses)); | ||
160 | 156 | ||
161 | /* Single access is optimal */ | 157 | /* Single access is optimal */ |
162 | 158 | ||
163 | if (accesses <= 1) { | 159 | if (accesses <= 1) { |
164 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 160 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
165 | "Entire field can be accessed with one operation of size %d\n", | 161 | "Entire field can be accessed with one operation of size %d\n", |
166 | access_byte_width)); | 162 | access_byte_width)); |
167 | return_VALUE (access_byte_width); | 163 | return_VALUE(access_byte_width); |
168 | } | 164 | } |
169 | 165 | ||
170 | /* | 166 | /* |
@@ -172,30 +168,30 @@ acpi_ex_generate_access ( | |||
172 | * try the next wider access on next iteration | 168 | * try the next wider access on next iteration |
173 | */ | 169 | */ |
174 | if (accesses < minimum_accesses) { | 170 | if (accesses < minimum_accesses) { |
175 | minimum_accesses = accesses; | 171 | minimum_accesses = accesses; |
176 | minimum_access_width = access_byte_width; | 172 | minimum_access_width = access_byte_width; |
177 | } | 173 | } |
178 | } | 174 | } else { |
179 | else { | 175 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
180 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 176 | "access_width %d end is NOT within region\n", |
181 | "access_width %d end is NOT within region\n", access_byte_width)); | 177 | access_byte_width)); |
182 | if (access_byte_width == 1) { | 178 | if (access_byte_width == 1) { |
183 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 179 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
184 | "Field goes beyond end-of-region!\n")); | 180 | "Field goes beyond end-of-region!\n")); |
185 | 181 | ||
186 | /* Field does not fit in the region at all */ | 182 | /* Field does not fit in the region at all */ |
187 | 183 | ||
188 | return_VALUE (0); | 184 | return_VALUE(0); |
189 | } | 185 | } |
190 | 186 | ||
191 | /* | 187 | /* |
192 | * This width goes beyond the end-of-region, back off to | 188 | * This width goes beyond the end-of-region, back off to |
193 | * previous access | 189 | * previous access |
194 | */ | 190 | */ |
195 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 191 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
196 | "Backing off to previous optimal access width of %d\n", | 192 | "Backing off to previous optimal access width of %d\n", |
197 | minimum_access_width)); | 193 | minimum_access_width)); |
198 | return_VALUE (minimum_access_width); | 194 | return_VALUE(minimum_access_width); |
199 | } | 195 | } |
200 | } | 196 | } |
201 | 197 | ||
@@ -203,12 +199,11 @@ acpi_ex_generate_access ( | |||
203 | * Could not read/write field with one operation, | 199 | * Could not read/write field with one operation, |
204 | * just use max access width | 200 | * just use max access width |
205 | */ | 201 | */ |
206 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 202 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
207 | "Cannot access field in one operation, using width 8\n")); | 203 | "Cannot access field in one operation, using width 8\n")); |
208 | return_VALUE (8); | 204 | return_VALUE(8); |
209 | } | 205 | } |
210 | #endif /* ACPI_UNDER_DEVELOPMENT */ | 206 | #endif /* ACPI_UNDER_DEVELOPMENT */ |
211 | |||
212 | 207 | ||
213 | /******************************************************************************* | 208 | /******************************************************************************* |
214 | * | 209 | * |
@@ -226,18 +221,14 @@ acpi_ex_generate_access ( | |||
226 | ******************************************************************************/ | 221 | ******************************************************************************/ |
227 | 222 | ||
228 | static u32 | 223 | static u32 |
229 | acpi_ex_decode_field_access ( | 224 | acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, |
230 | union acpi_operand_object *obj_desc, | 225 | u8 field_flags, u32 * return_byte_alignment) |
231 | u8 field_flags, | ||
232 | u32 *return_byte_alignment) | ||
233 | { | 226 | { |
234 | u32 access; | 227 | u32 access; |
235 | u32 byte_alignment; | 228 | u32 byte_alignment; |
236 | u32 bit_length; | 229 | u32 bit_length; |
237 | |||
238 | |||
239 | ACPI_FUNCTION_TRACE ("ex_decode_field_access"); | ||
240 | 230 | ||
231 | ACPI_FUNCTION_TRACE("ex_decode_field_access"); | ||
241 | 232 | ||
242 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); | 233 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); |
243 | 234 | ||
@@ -246,9 +237,12 @@ acpi_ex_decode_field_access ( | |||
246 | 237 | ||
247 | #ifdef ACPI_UNDER_DEVELOPMENT | 238 | #ifdef ACPI_UNDER_DEVELOPMENT |
248 | byte_alignment = | 239 | byte_alignment = |
249 | acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, | 240 | acpi_ex_generate_access(obj_desc->common_field. |
250 | obj_desc->common_field.bit_length, | 241 | start_field_bit_offset, |
251 | 0xFFFFFFFF /* Temp until we pass region_length as parameter */); | 242 | obj_desc->common_field.bit_length, |
243 | 0xFFFFFFFF | ||
244 | /* Temp until we pass region_length as parameter */ | ||
245 | ); | ||
252 | bit_length = byte_alignment * 8; | 246 | bit_length = byte_alignment * 8; |
253 | #endif | 247 | #endif |
254 | 248 | ||
@@ -257,36 +251,35 @@ acpi_ex_decode_field_access ( | |||
257 | break; | 251 | break; |
258 | 252 | ||
259 | case AML_FIELD_ACCESS_BYTE: | 253 | case AML_FIELD_ACCESS_BYTE: |
260 | case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ | 254 | case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ |
261 | byte_alignment = 1; | 255 | byte_alignment = 1; |
262 | bit_length = 8; | 256 | bit_length = 8; |
263 | break; | 257 | break; |
264 | 258 | ||
265 | case AML_FIELD_ACCESS_WORD: | 259 | case AML_FIELD_ACCESS_WORD: |
266 | byte_alignment = 2; | 260 | byte_alignment = 2; |
267 | bit_length = 16; | 261 | bit_length = 16; |
268 | break; | 262 | break; |
269 | 263 | ||
270 | case AML_FIELD_ACCESS_DWORD: | 264 | case AML_FIELD_ACCESS_DWORD: |
271 | byte_alignment = 4; | 265 | byte_alignment = 4; |
272 | bit_length = 32; | 266 | bit_length = 32; |
273 | break; | 267 | break; |
274 | 268 | ||
275 | case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ | 269 | case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ |
276 | byte_alignment = 8; | 270 | byte_alignment = 8; |
277 | bit_length = 64; | 271 | bit_length = 64; |
278 | break; | 272 | break; |
279 | 273 | ||
280 | default: | 274 | default: |
281 | /* Invalid field access type */ | 275 | /* Invalid field access type */ |
282 | 276 | ||
283 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 277 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
284 | "Unknown field access type %X\n", | 278 | "Unknown field access type %X\n", access)); |
285 | access)); | 279 | return_VALUE(0); |
286 | return_VALUE (0); | ||
287 | } | 280 | } |
288 | 281 | ||
289 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { | 282 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { |
290 | /* | 283 | /* |
291 | * buffer_field access can be on any byte boundary, so the | 284 | * buffer_field access can be on any byte boundary, so the |
292 | * byte_alignment is always 1 byte -- regardless of any byte_alignment | 285 | * byte_alignment is always 1 byte -- regardless of any byte_alignment |
@@ -296,10 +289,9 @@ acpi_ex_decode_field_access ( | |||
296 | } | 289 | } |
297 | 290 | ||
298 | *return_byte_alignment = byte_alignment; | 291 | *return_byte_alignment = byte_alignment; |
299 | return_VALUE (bit_length); | 292 | return_VALUE(bit_length); |
300 | } | 293 | } |
301 | 294 | ||
302 | |||
303 | /******************************************************************************* | 295 | /******************************************************************************* |
304 | * | 296 | * |
305 | * FUNCTION: acpi_ex_prep_common_field_object | 297 | * FUNCTION: acpi_ex_prep_common_field_object |
@@ -322,20 +314,16 @@ acpi_ex_decode_field_access ( | |||
322 | ******************************************************************************/ | 314 | ******************************************************************************/ |
323 | 315 | ||
324 | acpi_status | 316 | acpi_status |
325 | acpi_ex_prep_common_field_object ( | 317 | acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, |
326 | union acpi_operand_object *obj_desc, | 318 | u8 field_flags, |
327 | u8 field_flags, | 319 | u8 field_attribute, |
328 | u8 field_attribute, | 320 | u32 field_bit_position, u32 field_bit_length) |
329 | u32 field_bit_position, | ||
330 | u32 field_bit_length) | ||
331 | { | 321 | { |
332 | u32 access_bit_width; | 322 | u32 access_bit_width; |
333 | u32 byte_alignment; | 323 | u32 byte_alignment; |
334 | u32 nearest_byte_address; | 324 | u32 nearest_byte_address; |
335 | |||
336 | |||
337 | ACPI_FUNCTION_TRACE ("ex_prep_common_field_object"); | ||
338 | 325 | ||
326 | ACPI_FUNCTION_TRACE("ex_prep_common_field_object"); | ||
339 | 327 | ||
340 | /* | 328 | /* |
341 | * Note: the structure being initialized is the | 329 | * Note: the structure being initialized is the |
@@ -361,16 +349,16 @@ acpi_ex_prep_common_field_object ( | |||
361 | * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is | 349 | * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is |
362 | * the same (equivalent) as the byte_alignment. | 350 | * the same (equivalent) as the byte_alignment. |
363 | */ | 351 | */ |
364 | access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags, | 352 | access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags, |
365 | &byte_alignment); | 353 | &byte_alignment); |
366 | if (!access_bit_width) { | 354 | if (!access_bit_width) { |
367 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); | 355 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
368 | } | 356 | } |
369 | 357 | ||
370 | /* Setup width (access granularity) fields */ | 358 | /* Setup width (access granularity) fields */ |
371 | 359 | ||
372 | obj_desc->common_field.access_byte_width = (u8) | 360 | obj_desc->common_field.access_byte_width = (u8) |
373 | ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ | 361 | ACPI_DIV_8(access_bit_width); /* 1, 2, 4, 8 */ |
374 | 362 | ||
375 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; | 363 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; |
376 | 364 | ||
@@ -385,30 +373,30 @@ acpi_ex_prep_common_field_object ( | |||
385 | * region or buffer. | 373 | * region or buffer. |
386 | */ | 374 | */ |
387 | nearest_byte_address = | 375 | nearest_byte_address = |
388 | ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position); | 376 | ACPI_ROUND_BITS_DOWN_TO_BYTES(field_bit_position); |
389 | obj_desc->common_field.base_byte_offset = (u32) | 377 | obj_desc->common_field.base_byte_offset = (u32) |
390 | ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment); | 378 | ACPI_ROUND_DOWN(nearest_byte_address, byte_alignment); |
391 | 379 | ||
392 | /* | 380 | /* |
393 | * start_field_bit_offset is the offset of the first bit of the field within | 381 | * start_field_bit_offset is the offset of the first bit of the field within |
394 | * a field datum. | 382 | * a field datum. |
395 | */ | 383 | */ |
396 | obj_desc->common_field.start_field_bit_offset = (u8) | 384 | obj_desc->common_field.start_field_bit_offset = (u8) |
397 | (field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset)); | 385 | (field_bit_position - |
386 | ACPI_MUL_8(obj_desc->common_field.base_byte_offset)); | ||
398 | 387 | ||
399 | /* | 388 | /* |
400 | * Does the entire field fit within a single field access element? (datum) | 389 | * Does the entire field fit within a single field access element? (datum) |
401 | * (i.e., without crossing a datum boundary) | 390 | * (i.e., without crossing a datum boundary) |
402 | */ | 391 | */ |
403 | if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <= | 392 | if ((obj_desc->common_field.start_field_bit_offset + |
404 | (u16) access_bit_width) { | 393 | field_bit_length) <= (u16) access_bit_width) { |
405 | obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM; | 394 | obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM; |
406 | } | 395 | } |
407 | 396 | ||
408 | return_ACPI_STATUS (AE_OK); | 397 | return_ACPI_STATUS(AE_OK); |
409 | } | 398 | } |
410 | 399 | ||
411 | |||
412 | /******************************************************************************* | 400 | /******************************************************************************* |
413 | * | 401 | * |
414 | * FUNCTION: acpi_ex_prep_field_value | 402 | * FUNCTION: acpi_ex_prep_field_value |
@@ -422,51 +410,49 @@ acpi_ex_prep_common_field_object ( | |||
422 | * | 410 | * |
423 | ******************************************************************************/ | 411 | ******************************************************************************/ |
424 | 412 | ||
425 | acpi_status | 413 | acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) |
426 | acpi_ex_prep_field_value ( | ||
427 | struct acpi_create_field_info *info) | ||
428 | { | 414 | { |
429 | union acpi_operand_object *obj_desc; | 415 | union acpi_operand_object *obj_desc; |
430 | u32 type; | 416 | u32 type; |
431 | acpi_status status; | 417 | acpi_status status; |
432 | |||
433 | |||
434 | ACPI_FUNCTION_TRACE ("ex_prep_field_value"); | ||
435 | 418 | ||
419 | ACPI_FUNCTION_TRACE("ex_prep_field_value"); | ||
436 | 420 | ||
437 | /* Parameter validation */ | 421 | /* Parameter validation */ |
438 | 422 | ||
439 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { | 423 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { |
440 | if (!info->region_node) { | 424 | if (!info->region_node) { |
441 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null region_node\n")); | 425 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n")); |
442 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 426 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
443 | } | 427 | } |
444 | 428 | ||
445 | type = acpi_ns_get_type (info->region_node); | 429 | type = acpi_ns_get_type(info->region_node); |
446 | if (type != ACPI_TYPE_REGION) { | 430 | if (type != ACPI_TYPE_REGION) { |
447 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 431 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
448 | "Needed Region, found type %X (%s)\n", | 432 | "Needed Region, found type %X (%s)\n", |
449 | type, acpi_ut_get_type_name (type))); | 433 | type, acpi_ut_get_type_name(type))); |
450 | 434 | ||
451 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 435 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
452 | } | 436 | } |
453 | } | 437 | } |
454 | 438 | ||
455 | /* Allocate a new field object */ | 439 | /* Allocate a new field object */ |
456 | 440 | ||
457 | obj_desc = acpi_ut_create_internal_object (info->field_type); | 441 | obj_desc = acpi_ut_create_internal_object(info->field_type); |
458 | if (!obj_desc) { | 442 | if (!obj_desc) { |
459 | return_ACPI_STATUS (AE_NO_MEMORY); | 443 | return_ACPI_STATUS(AE_NO_MEMORY); |
460 | } | 444 | } |
461 | 445 | ||
462 | /* Initialize areas of the object that are common to all fields */ | 446 | /* Initialize areas of the object that are common to all fields */ |
463 | 447 | ||
464 | obj_desc->common_field.node = info->field_node; | 448 | obj_desc->common_field.node = info->field_node; |
465 | status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags, | 449 | status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags, |
466 | info->attribute, info->field_bit_position, info->field_bit_length); | 450 | info->attribute, |
467 | if (ACPI_FAILURE (status)) { | 451 | info->field_bit_position, |
468 | acpi_ut_delete_object_desc (obj_desc); | 452 | info->field_bit_length); |
469 | return_ACPI_STATUS (status); | 453 | if (ACPI_FAILURE(status)) { |
454 | acpi_ut_delete_object_desc(obj_desc); | ||
455 | return_ACPI_STATUS(status); | ||
470 | } | 456 | } |
471 | 457 | ||
472 | /* Initialize areas of the object that are specific to the field type */ | 458 | /* Initialize areas of the object that are specific to the field type */ |
@@ -474,71 +460,73 @@ acpi_ex_prep_field_value ( | |||
474 | switch (info->field_type) { | 460 | switch (info->field_type) { |
475 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 461 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
476 | 462 | ||
477 | obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); | 463 | obj_desc->field.region_obj = |
464 | acpi_ns_get_attached_object(info->region_node); | ||
478 | 465 | ||
479 | /* An additional reference for the container */ | 466 | /* An additional reference for the container */ |
480 | 467 | ||
481 | acpi_ut_add_reference (obj_desc->field.region_obj); | 468 | acpi_ut_add_reference(obj_desc->field.region_obj); |
482 | 469 | ||
483 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 470 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
484 | "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", | 471 | "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", |
485 | obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset, | 472 | obj_desc->field.start_field_bit_offset, |
486 | obj_desc->field.access_byte_width, obj_desc->field.region_obj)); | 473 | obj_desc->field.base_byte_offset, |
474 | obj_desc->field.access_byte_width, | ||
475 | obj_desc->field.region_obj)); | ||
487 | break; | 476 | break; |
488 | 477 | ||
489 | |||
490 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 478 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
491 | 479 | ||
492 | obj_desc->bank_field.value = info->bank_value; | 480 | obj_desc->bank_field.value = info->bank_value; |
493 | obj_desc->bank_field.region_obj = acpi_ns_get_attached_object ( | 481 | obj_desc->bank_field.region_obj = |
494 | info->region_node); | 482 | acpi_ns_get_attached_object(info->region_node); |
495 | obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object ( | 483 | obj_desc->bank_field.bank_obj = |
496 | info->register_node); | 484 | acpi_ns_get_attached_object(info->register_node); |
497 | 485 | ||
498 | /* An additional reference for the attached objects */ | 486 | /* An additional reference for the attached objects */ |
499 | 487 | ||
500 | acpi_ut_add_reference (obj_desc->bank_field.region_obj); | 488 | acpi_ut_add_reference(obj_desc->bank_field.region_obj); |
501 | acpi_ut_add_reference (obj_desc->bank_field.bank_obj); | 489 | acpi_ut_add_reference(obj_desc->bank_field.bank_obj); |
502 | 490 | ||
503 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 491 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
504 | "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", | 492 | "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", |
505 | obj_desc->bank_field.start_field_bit_offset, | 493 | obj_desc->bank_field.start_field_bit_offset, |
506 | obj_desc->bank_field.base_byte_offset, | 494 | obj_desc->bank_field.base_byte_offset, |
507 | obj_desc->field.access_byte_width, | 495 | obj_desc->field.access_byte_width, |
508 | obj_desc->bank_field.region_obj, | 496 | obj_desc->bank_field.region_obj, |
509 | obj_desc->bank_field.bank_obj)); | 497 | obj_desc->bank_field.bank_obj)); |
510 | break; | 498 | break; |
511 | 499 | ||
512 | |||
513 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 500 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
514 | 501 | ||
515 | obj_desc->index_field.index_obj = acpi_ns_get_attached_object ( | 502 | obj_desc->index_field.index_obj = |
516 | info->register_node); | 503 | acpi_ns_get_attached_object(info->register_node); |
517 | obj_desc->index_field.data_obj = acpi_ns_get_attached_object ( | 504 | obj_desc->index_field.data_obj = |
518 | info->data_register_node); | 505 | acpi_ns_get_attached_object(info->data_register_node); |
519 | obj_desc->index_field.value = (u32) | 506 | obj_desc->index_field.value = (u32) |
520 | (info->field_bit_position / ACPI_MUL_8 ( | 507 | (info->field_bit_position / |
521 | obj_desc->field.access_byte_width)); | 508 | ACPI_MUL_8(obj_desc->field.access_byte_width)); |
522 | 509 | ||
523 | if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { | 510 | if (!obj_desc->index_field.data_obj |
524 | ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); | 511 | || !obj_desc->index_field.index_obj) { |
525 | acpi_ut_delete_object_desc (obj_desc); | 512 | ACPI_REPORT_ERROR(("Null Index Object during field prep\n")); |
526 | return_ACPI_STATUS (AE_AML_INTERNAL); | 513 | acpi_ut_delete_object_desc(obj_desc); |
514 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
527 | } | 515 | } |
528 | 516 | ||
529 | /* An additional reference for the attached objects */ | 517 | /* An additional reference for the attached objects */ |
530 | 518 | ||
531 | acpi_ut_add_reference (obj_desc->index_field.data_obj); | 519 | acpi_ut_add_reference(obj_desc->index_field.data_obj); |
532 | acpi_ut_add_reference (obj_desc->index_field.index_obj); | 520 | acpi_ut_add_reference(obj_desc->index_field.index_obj); |
533 | 521 | ||
534 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 522 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
535 | "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", | 523 | "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", |
536 | obj_desc->index_field.start_field_bit_offset, | 524 | obj_desc->index_field.start_field_bit_offset, |
537 | obj_desc->index_field.base_byte_offset, | 525 | obj_desc->index_field.base_byte_offset, |
538 | obj_desc->index_field.value, | 526 | obj_desc->index_field.value, |
539 | obj_desc->field.access_byte_width, | 527 | obj_desc->field.access_byte_width, |
540 | obj_desc->index_field.index_obj, | 528 | obj_desc->index_field.index_obj, |
541 | obj_desc->index_field.data_obj)); | 529 | obj_desc->index_field.data_obj)); |
542 | break; | 530 | break; |
543 | 531 | ||
544 | default: | 532 | default: |
@@ -550,15 +538,16 @@ acpi_ex_prep_field_value ( | |||
550 | * Store the constructed descriptor (obj_desc) into the parent Node, | 538 | * Store the constructed descriptor (obj_desc) into the parent Node, |
551 | * preserving the current type of that named_obj. | 539 | * preserving the current type of that named_obj. |
552 | */ | 540 | */ |
553 | status = acpi_ns_attach_object (info->field_node, obj_desc, | 541 | status = acpi_ns_attach_object(info->field_node, obj_desc, |
554 | acpi_ns_get_type (info->field_node)); | 542 | acpi_ns_get_type(info->field_node)); |
555 | 543 | ||
556 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n", | 544 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
557 | info->field_node, acpi_ut_get_node_name (info->field_node), obj_desc)); | 545 | "Set named_obj %p [%4.4s], obj_desc %p\n", |
546 | info->field_node, | ||
547 | acpi_ut_get_node_name(info->field_node), obj_desc)); | ||
558 | 548 | ||
559 | /* Remove local reference to the object */ | 549 | /* Remove local reference to the object */ |
560 | 550 | ||
561 | acpi_ut_remove_reference (obj_desc); | 551 | acpi_ut_remove_reference(obj_desc); |
562 | return_ACPI_STATUS (status); | 552 | return_ACPI_STATUS(status); |
563 | } | 553 | } |
564 | |||
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 723aaef4bb4a..9a2f5bea3afe 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -42,14 +42,11 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exregion") | 49 | ACPI_MODULE_NAME("exregion") |
52 | |||
53 | 50 | ||
54 | /******************************************************************************* | 51 | /******************************************************************************* |
55 | * | 52 | * |
@@ -68,27 +65,23 @@ | |||
68 | * DESCRIPTION: Handler for the System Memory address space (Op Region) | 65 | * DESCRIPTION: Handler for the System Memory address space (Op Region) |
69 | * | 66 | * |
70 | ******************************************************************************/ | 67 | ******************************************************************************/ |
71 | |||
72 | acpi_status | 68 | acpi_status |
73 | acpi_ex_system_memory_space_handler ( | 69 | acpi_ex_system_memory_space_handler(u32 function, |
74 | u32 function, | 70 | acpi_physical_address address, |
75 | acpi_physical_address address, | 71 | u32 bit_width, |
76 | u32 bit_width, | 72 | acpi_integer * value, |
77 | acpi_integer *value, | 73 | void *handler_context, void *region_context) |
78 | void *handler_context, | ||
79 | void *region_context) | ||
80 | { | 74 | { |
81 | acpi_status status = AE_OK; | 75 | acpi_status status = AE_OK; |
82 | void *logical_addr_ptr = NULL; | 76 | void *logical_addr_ptr = NULL; |
83 | struct acpi_mem_space_context *mem_info = region_context; | 77 | struct acpi_mem_space_context *mem_info = region_context; |
84 | u32 length; | 78 | u32 length; |
85 | acpi_size window_size; | 79 | acpi_size window_size; |
86 | #ifndef ACPI_MISALIGNED_TRANSFERS | 80 | #ifndef ACPI_MISALIGNED_TRANSFERS |
87 | u32 remainder; | 81 | u32 remainder; |
88 | #endif | 82 | #endif |
89 | 83 | ||
90 | ACPI_FUNCTION_TRACE ("ex_system_memory_space_handler"); | 84 | ACPI_FUNCTION_TRACE("ex_system_memory_space_handler"); |
91 | |||
92 | 85 | ||
93 | /* Validate and translate the bit width */ | 86 | /* Validate and translate the bit width */ |
94 | 87 | ||
@@ -110,9 +103,10 @@ acpi_ex_system_memory_space_handler ( | |||
110 | break; | 103 | break; |
111 | 104 | ||
112 | default: | 105 | default: |
113 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid system_memory width %d\n", | 106 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
114 | bit_width)); | 107 | "Invalid system_memory width %d\n", |
115 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); | 108 | bit_width)); |
109 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | ||
116 | } | 110 | } |
117 | 111 | ||
118 | #ifndef ACPI_MISALIGNED_TRANSFERS | 112 | #ifndef ACPI_MISALIGNED_TRANSFERS |
@@ -120,9 +114,10 @@ acpi_ex_system_memory_space_handler ( | |||
120 | * Hardware does not support non-aligned data transfers, we must verify | 114 | * Hardware does not support non-aligned data transfers, we must verify |
121 | * the request. | 115 | * the request. |
122 | */ | 116 | */ |
123 | (void) acpi_ut_short_divide ((acpi_integer) address, length, NULL, &remainder); | 117 | (void)acpi_ut_short_divide((acpi_integer) address, length, NULL, |
118 | &remainder); | ||
124 | if (remainder != 0) { | 119 | if (remainder != 0) { |
125 | return_ACPI_STATUS (AE_AML_ALIGNMENT); | 120 | return_ACPI_STATUS(AE_AML_ALIGNMENT); |
126 | } | 121 | } |
127 | #endif | 122 | #endif |
128 | 123 | ||
@@ -132,9 +127,10 @@ acpi_ex_system_memory_space_handler ( | |||
132 | * 2) Address beyond the current mapping? | 127 | * 2) Address beyond the current mapping? |
133 | */ | 128 | */ |
134 | if ((address < mem_info->mapped_physical_address) || | 129 | if ((address < mem_info->mapped_physical_address) || |
135 | (((acpi_integer) address + length) > | 130 | (((acpi_integer) address + length) > ((acpi_integer) |
136 | ((acpi_integer) | 131 | mem_info-> |
137 | mem_info->mapped_physical_address + mem_info->mapped_length))) { | 132 | mapped_physical_address + |
133 | mem_info->mapped_length))) { | ||
138 | /* | 134 | /* |
139 | * The request cannot be resolved by the current memory mapping; | 135 | * The request cannot be resolved by the current memory mapping; |
140 | * Delete the existing mapping and create a new one. | 136 | * Delete the existing mapping and create a new one. |
@@ -142,8 +138,8 @@ acpi_ex_system_memory_space_handler ( | |||
142 | if (mem_info->mapped_length) { | 138 | if (mem_info->mapped_length) { |
143 | /* Valid mapping, delete it */ | 139 | /* Valid mapping, delete it */ |
144 | 140 | ||
145 | acpi_os_unmap_memory (mem_info->mapped_logical_address, | 141 | acpi_os_unmap_memory(mem_info->mapped_logical_address, |
146 | mem_info->mapped_length); | 142 | mem_info->mapped_length); |
147 | } | 143 | } |
148 | 144 | ||
149 | /* | 145 | /* |
@@ -151,7 +147,7 @@ acpi_ex_system_memory_space_handler ( | |||
151 | * constrain the maximum mapping size to something reasonable. | 147 | * constrain the maximum mapping size to something reasonable. |
152 | */ | 148 | */ |
153 | window_size = (acpi_size) | 149 | window_size = (acpi_size) |
154 | ((mem_info->address + mem_info->length) - address); | 150 | ((mem_info->address + mem_info->length) - address); |
155 | 151 | ||
156 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { | 152 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { |
157 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; | 153 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; |
@@ -159,14 +155,16 @@ acpi_ex_system_memory_space_handler ( | |||
159 | 155 | ||
160 | /* Create a new mapping starting at the address given */ | 156 | /* Create a new mapping starting at the address given */ |
161 | 157 | ||
162 | status = acpi_os_map_memory (address, window_size, | 158 | status = acpi_os_map_memory(address, window_size, |
163 | (void **) &mem_info->mapped_logical_address); | 159 | (void **)&mem_info-> |
164 | if (ACPI_FAILURE (status)) { | 160 | mapped_logical_address); |
165 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 161 | if (ACPI_FAILURE(status)) { |
166 | "Could not map memory at %8.8X%8.8X, size %X\n", | 162 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
167 | ACPI_FORMAT_UINT64 (address), (u32) window_size)); | 163 | "Could not map memory at %8.8X%8.8X, size %X\n", |
164 | ACPI_FORMAT_UINT64(address), | ||
165 | (u32) window_size)); | ||
168 | mem_info->mapped_length = 0; | 166 | mem_info->mapped_length = 0; |
169 | return_ACPI_STATUS (status); | 167 | return_ACPI_STATUS(status); |
170 | } | 168 | } |
171 | 169 | ||
172 | /* Save the physical address and mapping size */ | 170 | /* Save the physical address and mapping size */ |
@@ -180,42 +178,41 @@ acpi_ex_system_memory_space_handler ( | |||
180 | * access | 178 | * access |
181 | */ | 179 | */ |
182 | logical_addr_ptr = mem_info->mapped_logical_address + | 180 | logical_addr_ptr = mem_info->mapped_logical_address + |
183 | ((acpi_integer) address - | 181 | ((acpi_integer) address - |
184 | (acpi_integer) mem_info->mapped_physical_address); | 182 | (acpi_integer) mem_info->mapped_physical_address); |
185 | 183 | ||
186 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 184 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
187 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", | 185 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", |
188 | function, bit_width, | 186 | function, bit_width, ACPI_FORMAT_UINT64(address))); |
189 | ACPI_FORMAT_UINT64 (address))); | 187 | |
190 | 188 | /* | |
191 | /* | 189 | * Perform the memory read or write |
192 | * Perform the memory read or write | 190 | * |
193 | * | 191 | * Note: For machines that do not support non-aligned transfers, the target |
194 | * Note: For machines that do not support non-aligned transfers, the target | 192 | * address was checked for alignment above. We do not attempt to break the |
195 | * address was checked for alignment above. We do not attempt to break the | 193 | * transfer up into smaller (byte-size) chunks because the AML specifically |
196 | * transfer up into smaller (byte-size) chunks because the AML specifically | 194 | * asked for a transfer width that the hardware may require. |
197 | * asked for a transfer width that the hardware may require. | 195 | */ |
198 | */ | ||
199 | switch (function) { | 196 | switch (function) { |
200 | case ACPI_READ: | 197 | case ACPI_READ: |
201 | 198 | ||
202 | *value = 0; | 199 | *value = 0; |
203 | switch (bit_width) { | 200 | switch (bit_width) { |
204 | case 8: | 201 | case 8: |
205 | *value = (acpi_integer) *((u8 *) logical_addr_ptr); | 202 | *value = (acpi_integer) * ((u8 *) logical_addr_ptr); |
206 | break; | 203 | break; |
207 | 204 | ||
208 | case 16: | 205 | case 16: |
209 | *value = (acpi_integer) *((u16 *) logical_addr_ptr); | 206 | *value = (acpi_integer) * ((u16 *) logical_addr_ptr); |
210 | break; | 207 | break; |
211 | 208 | ||
212 | case 32: | 209 | case 32: |
213 | *value = (acpi_integer) *((u32 *) logical_addr_ptr); | 210 | *value = (acpi_integer) * ((u32 *) logical_addr_ptr); |
214 | break; | 211 | break; |
215 | 212 | ||
216 | #if ACPI_MACHINE_WIDTH != 16 | 213 | #if ACPI_MACHINE_WIDTH != 16 |
217 | case 64: | 214 | case 64: |
218 | *value = (acpi_integer) *((u64 *) logical_addr_ptr); | 215 | *value = (acpi_integer) * ((u64 *) logical_addr_ptr); |
219 | break; | 216 | break; |
220 | #endif | 217 | #endif |
221 | default: | 218 | default: |
@@ -228,20 +225,20 @@ acpi_ex_system_memory_space_handler ( | |||
228 | 225 | ||
229 | switch (bit_width) { | 226 | switch (bit_width) { |
230 | case 8: | 227 | case 8: |
231 | *(u8 *) logical_addr_ptr = (u8) *value; | 228 | *(u8 *) logical_addr_ptr = (u8) * value; |
232 | break; | 229 | break; |
233 | 230 | ||
234 | case 16: | 231 | case 16: |
235 | *(u16 *) logical_addr_ptr = (u16) *value; | 232 | *(u16 *) logical_addr_ptr = (u16) * value; |
236 | break; | 233 | break; |
237 | 234 | ||
238 | case 32: | 235 | case 32: |
239 | *(u32 *) logical_addr_ptr = (u32) *value; | 236 | *(u32 *) logical_addr_ptr = (u32) * value; |
240 | break; | 237 | break; |
241 | 238 | ||
242 | #if ACPI_MACHINE_WIDTH != 16 | 239 | #if ACPI_MACHINE_WIDTH != 16 |
243 | case 64: | 240 | case 64: |
244 | *(u64 *) logical_addr_ptr = (u64) *value; | 241 | *(u64 *) logical_addr_ptr = (u64) * value; |
245 | break; | 242 | break; |
246 | #endif | 243 | #endif |
247 | 244 | ||
@@ -256,10 +253,9 @@ acpi_ex_system_memory_space_handler ( | |||
256 | break; | 253 | break; |
257 | } | 254 | } |
258 | 255 | ||
259 | return_ACPI_STATUS (status); | 256 | return_ACPI_STATUS(status); |
260 | } | 257 | } |
261 | 258 | ||
262 | |||
263 | /******************************************************************************* | 259 | /******************************************************************************* |
264 | * | 260 | * |
265 | * FUNCTION: acpi_ex_system_io_space_handler | 261 | * FUNCTION: acpi_ex_system_io_space_handler |
@@ -279,39 +275,35 @@ acpi_ex_system_memory_space_handler ( | |||
279 | ******************************************************************************/ | 275 | ******************************************************************************/ |
280 | 276 | ||
281 | acpi_status | 277 | acpi_status |
282 | acpi_ex_system_io_space_handler ( | 278 | acpi_ex_system_io_space_handler(u32 function, |
283 | u32 function, | 279 | acpi_physical_address address, |
284 | acpi_physical_address address, | 280 | u32 bit_width, |
285 | u32 bit_width, | 281 | acpi_integer * value, |
286 | acpi_integer *value, | 282 | void *handler_context, void *region_context) |
287 | void *handler_context, | ||
288 | void *region_context) | ||
289 | { | 283 | { |
290 | acpi_status status = AE_OK; | 284 | acpi_status status = AE_OK; |
291 | u32 value32; | 285 | u32 value32; |
292 | 286 | ||
287 | ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); | ||
293 | 288 | ||
294 | ACPI_FUNCTION_TRACE ("ex_system_io_space_handler"); | 289 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
295 | 290 | "system_iO %d (%d width) Address=%8.8X%8.8X\n", | |
296 | 291 | function, bit_width, ACPI_FORMAT_UINT64(address))); | |
297 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | ||
298 | "system_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width, | ||
299 | ACPI_FORMAT_UINT64 (address))); | ||
300 | 292 | ||
301 | /* Decode the function parameter */ | 293 | /* Decode the function parameter */ |
302 | 294 | ||
303 | switch (function) { | 295 | switch (function) { |
304 | case ACPI_READ: | 296 | case ACPI_READ: |
305 | 297 | ||
306 | status = acpi_os_read_port ((acpi_io_address) address, | 298 | status = acpi_os_read_port((acpi_io_address) address, |
307 | &value32, bit_width); | 299 | &value32, bit_width); |
308 | *value = value32; | 300 | *value = value32; |
309 | break; | 301 | break; |
310 | 302 | ||
311 | case ACPI_WRITE: | 303 | case ACPI_WRITE: |
312 | 304 | ||
313 | status = acpi_os_write_port ((acpi_io_address) address, | 305 | status = acpi_os_write_port((acpi_io_address) address, |
314 | (u32) *value, bit_width); | 306 | (u32) * value, bit_width); |
315 | break; | 307 | break; |
316 | 308 | ||
317 | default: | 309 | default: |
@@ -319,10 +311,9 @@ acpi_ex_system_io_space_handler ( | |||
319 | break; | 311 | break; |
320 | } | 312 | } |
321 | 313 | ||
322 | return_ACPI_STATUS (status); | 314 | return_ACPI_STATUS(status); |
323 | } | 315 | } |
324 | 316 | ||
325 | |||
326 | /******************************************************************************* | 317 | /******************************************************************************* |
327 | * | 318 | * |
328 | * FUNCTION: acpi_ex_pci_config_space_handler | 319 | * FUNCTION: acpi_ex_pci_config_space_handler |
@@ -342,21 +333,17 @@ acpi_ex_system_io_space_handler ( | |||
342 | ******************************************************************************/ | 333 | ******************************************************************************/ |
343 | 334 | ||
344 | acpi_status | 335 | acpi_status |
345 | acpi_ex_pci_config_space_handler ( | 336 | acpi_ex_pci_config_space_handler(u32 function, |
346 | u32 function, | 337 | acpi_physical_address address, |
347 | acpi_physical_address address, | 338 | u32 bit_width, |
348 | u32 bit_width, | 339 | acpi_integer * value, |
349 | acpi_integer *value, | 340 | void *handler_context, void *region_context) |
350 | void *handler_context, | ||
351 | void *region_context) | ||
352 | { | 341 | { |
353 | acpi_status status = AE_OK; | 342 | acpi_status status = AE_OK; |
354 | struct acpi_pci_id *pci_id; | 343 | struct acpi_pci_id *pci_id; |
355 | u16 pci_register; | 344 | u16 pci_register; |
356 | |||
357 | |||
358 | ACPI_FUNCTION_TRACE ("ex_pci_config_space_handler"); | ||
359 | 345 | ||
346 | ACPI_FUNCTION_TRACE("ex_pci_config_space_handler"); | ||
360 | 347 | ||
361 | /* | 348 | /* |
362 | * The arguments to acpi_os(Read|Write)pci_configuration are: | 349 | * The arguments to acpi_os(Read|Write)pci_configuration are: |
@@ -370,26 +357,26 @@ acpi_ex_pci_config_space_handler ( | |||
370 | * Value - input value for write, output address for read | 357 | * Value - input value for write, output address for read |
371 | * | 358 | * |
372 | */ | 359 | */ |
373 | pci_id = (struct acpi_pci_id *) region_context; | 360 | pci_id = (struct acpi_pci_id *)region_context; |
374 | pci_register = (u16) (u32) address; | 361 | pci_register = (u16) (u32) address; |
375 | 362 | ||
376 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 363 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
377 | "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", | 364 | "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", |
378 | function, bit_width, pci_id->segment, pci_id->bus, pci_id->device, | 365 | function, bit_width, pci_id->segment, pci_id->bus, |
379 | pci_id->function, pci_register)); | 366 | pci_id->device, pci_id->function, pci_register)); |
380 | 367 | ||
381 | switch (function) { | 368 | switch (function) { |
382 | case ACPI_READ: | 369 | case ACPI_READ: |
383 | 370 | ||
384 | *value = 0; | 371 | *value = 0; |
385 | status = acpi_os_read_pci_configuration (pci_id, pci_register, | 372 | status = acpi_os_read_pci_configuration(pci_id, pci_register, |
386 | value, bit_width); | 373 | value, bit_width); |
387 | break; | 374 | break; |
388 | 375 | ||
389 | case ACPI_WRITE: | 376 | case ACPI_WRITE: |
390 | 377 | ||
391 | status = acpi_os_write_pci_configuration (pci_id, pci_register, | 378 | status = acpi_os_write_pci_configuration(pci_id, pci_register, |
392 | *value, bit_width); | 379 | *value, bit_width); |
393 | break; | 380 | break; |
394 | 381 | ||
395 | default: | 382 | default: |
@@ -398,10 +385,9 @@ acpi_ex_pci_config_space_handler ( | |||
398 | break; | 385 | break; |
399 | } | 386 | } |
400 | 387 | ||
401 | return_ACPI_STATUS (status); | 388 | return_ACPI_STATUS(status); |
402 | } | 389 | } |
403 | 390 | ||
404 | |||
405 | /******************************************************************************* | 391 | /******************************************************************************* |
406 | * | 392 | * |
407 | * FUNCTION: acpi_ex_cmos_space_handler | 393 | * FUNCTION: acpi_ex_cmos_space_handler |
@@ -421,24 +407,19 @@ acpi_ex_pci_config_space_handler ( | |||
421 | ******************************************************************************/ | 407 | ******************************************************************************/ |
422 | 408 | ||
423 | acpi_status | 409 | acpi_status |
424 | acpi_ex_cmos_space_handler ( | 410 | acpi_ex_cmos_space_handler(u32 function, |
425 | u32 function, | 411 | acpi_physical_address address, |
426 | acpi_physical_address address, | 412 | u32 bit_width, |
427 | u32 bit_width, | 413 | acpi_integer * value, |
428 | acpi_integer *value, | 414 | void *handler_context, void *region_context) |
429 | void *handler_context, | ||
430 | void *region_context) | ||
431 | { | 415 | { |
432 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
433 | |||
434 | 417 | ||
435 | ACPI_FUNCTION_TRACE ("ex_cmos_space_handler"); | 418 | ACPI_FUNCTION_TRACE("ex_cmos_space_handler"); |
436 | 419 | ||
437 | 420 | return_ACPI_STATUS(status); | |
438 | return_ACPI_STATUS (status); | ||
439 | } | 421 | } |
440 | 422 | ||
441 | |||
442 | /******************************************************************************* | 423 | /******************************************************************************* |
443 | * | 424 | * |
444 | * FUNCTION: acpi_ex_pci_bar_space_handler | 425 | * FUNCTION: acpi_ex_pci_bar_space_handler |
@@ -458,24 +439,19 @@ acpi_ex_cmos_space_handler ( | |||
458 | ******************************************************************************/ | 439 | ******************************************************************************/ |
459 | 440 | ||
460 | acpi_status | 441 | acpi_status |
461 | acpi_ex_pci_bar_space_handler ( | 442 | acpi_ex_pci_bar_space_handler(u32 function, |
462 | u32 function, | 443 | acpi_physical_address address, |
463 | acpi_physical_address address, | 444 | u32 bit_width, |
464 | u32 bit_width, | 445 | acpi_integer * value, |
465 | acpi_integer *value, | 446 | void *handler_context, void *region_context) |
466 | void *handler_context, | ||
467 | void *region_context) | ||
468 | { | 447 | { |
469 | acpi_status status = AE_OK; | 448 | acpi_status status = AE_OK; |
470 | |||
471 | 449 | ||
472 | ACPI_FUNCTION_TRACE ("ex_pci_bar_space_handler"); | 450 | ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler"); |
473 | 451 | ||
474 | 452 | return_ACPI_STATUS(status); | |
475 | return_ACPI_STATUS (status); | ||
476 | } | 453 | } |
477 | 454 | ||
478 | |||
479 | /******************************************************************************* | 455 | /******************************************************************************* |
480 | * | 456 | * |
481 | * FUNCTION: acpi_ex_data_table_space_handler | 457 | * FUNCTION: acpi_ex_data_table_space_handler |
@@ -495,24 +471,20 @@ acpi_ex_pci_bar_space_handler ( | |||
495 | ******************************************************************************/ | 471 | ******************************************************************************/ |
496 | 472 | ||
497 | acpi_status | 473 | acpi_status |
498 | acpi_ex_data_table_space_handler ( | 474 | acpi_ex_data_table_space_handler(u32 function, |
499 | u32 function, | 475 | acpi_physical_address address, |
500 | acpi_physical_address address, | 476 | u32 bit_width, |
501 | u32 bit_width, | 477 | acpi_integer * value, |
502 | acpi_integer *value, | 478 | void *handler_context, void *region_context) |
503 | void *handler_context, | ||
504 | void *region_context) | ||
505 | { | 479 | { |
506 | acpi_status status = AE_OK; | 480 | acpi_status status = AE_OK; |
507 | u32 byte_width = ACPI_DIV_8 (bit_width); | 481 | u32 byte_width = ACPI_DIV_8(bit_width); |
508 | u32 i; | 482 | u32 i; |
509 | char *logical_addr_ptr; | 483 | char *logical_addr_ptr; |
510 | |||
511 | 484 | ||
512 | ACPI_FUNCTION_TRACE ("ex_data_table_space_handler"); | 485 | ACPI_FUNCTION_TRACE("ex_data_table_space_handler"); |
513 | 486 | ||
514 | 487 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address); | |
515 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); | ||
516 | 488 | ||
517 | /* Perform the memory read or write */ | 489 | /* Perform the memory read or write */ |
518 | 490 | ||
@@ -520,17 +492,15 @@ acpi_ex_data_table_space_handler ( | |||
520 | case ACPI_READ: | 492 | case ACPI_READ: |
521 | 493 | ||
522 | for (i = 0; i < byte_width; i++) { | 494 | for (i = 0; i < byte_width; i++) { |
523 | ((char *) value) [i] = logical_addr_ptr[i]; | 495 | ((char *)value)[i] = logical_addr_ptr[i]; |
524 | } | 496 | } |
525 | break; | 497 | break; |
526 | 498 | ||
527 | case ACPI_WRITE: | 499 | case ACPI_WRITE: |
528 | default: | 500 | default: |
529 | 501 | ||
530 | return_ACPI_STATUS (AE_SUPPORT); | 502 | return_ACPI_STATUS(AE_SUPPORT); |
531 | } | 503 | } |
532 | 504 | ||
533 | return_ACPI_STATUS (status); | 505 | return_ACPI_STATUS(status); |
534 | } | 506 | } |
535 | |||
536 | |||
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 21d5c74fa309..ff5d8f97e8eb 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -50,10 +49,8 @@ | |||
50 | #include <acpi/acparser.h> | 49 | #include <acpi/acparser.h> |
51 | #include <acpi/amlcode.h> | 50 | #include <acpi/amlcode.h> |
52 | 51 | ||
53 | |||
54 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exresnte") | 53 | ACPI_MODULE_NAME("exresnte") |
56 | |||
57 | 54 | ||
58 | /******************************************************************************* | 55 | /******************************************************************************* |
59 | * | 56 | * |
@@ -80,41 +77,37 @@ | |||
80 | * ACPI_TYPE_PACKAGE | 77 | * ACPI_TYPE_PACKAGE |
81 | * | 78 | * |
82 | ******************************************************************************/ | 79 | ******************************************************************************/ |
83 | |||
84 | acpi_status | 80 | acpi_status |
85 | acpi_ex_resolve_node_to_value ( | 81 | acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, |
86 | struct acpi_namespace_node **object_ptr, | 82 | struct acpi_walk_state *walk_state) |
87 | struct acpi_walk_state *walk_state) | ||
88 | |||
89 | { | 83 | { |
90 | acpi_status status = AE_OK; | 84 | acpi_status status = AE_OK; |
91 | union acpi_operand_object *source_desc; | 85 | union acpi_operand_object *source_desc; |
92 | union acpi_operand_object *obj_desc = NULL; | 86 | union acpi_operand_object *obj_desc = NULL; |
93 | struct acpi_namespace_node *node; | 87 | struct acpi_namespace_node *node; |
94 | acpi_object_type entry_type; | 88 | acpi_object_type entry_type; |
95 | |||
96 | |||
97 | ACPI_FUNCTION_TRACE ("ex_resolve_node_to_value"); | ||
98 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_resolve_node_to_value"); | ||
99 | 91 | ||
100 | /* | 92 | /* |
101 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the | 93 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the |
102 | * object that is attached to the Node. | 94 | * object that is attached to the Node. |
103 | */ | 95 | */ |
104 | node = *object_ptr; | 96 | node = *object_ptr; |
105 | source_desc = acpi_ns_get_attached_object (node); | 97 | source_desc = acpi_ns_get_attached_object(node); |
106 | entry_type = acpi_ns_get_type ((acpi_handle) node); | 98 | entry_type = acpi_ns_get_type((acpi_handle) node); |
107 | 99 | ||
108 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", | 100 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", |
109 | node, source_desc, acpi_ut_get_type_name (entry_type))); | 101 | node, source_desc, |
102 | acpi_ut_get_type_name(entry_type))); | ||
110 | 103 | ||
111 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || | 104 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || |
112 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { | 105 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { |
113 | /* There is always exactly one level of indirection */ | 106 | /* There is always exactly one level of indirection */ |
114 | 107 | ||
115 | node = ACPI_CAST_PTR (struct acpi_namespace_node, node->object); | 108 | node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); |
116 | source_desc = acpi_ns_get_attached_object (node); | 109 | source_desc = acpi_ns_get_attached_object(node); |
117 | entry_type = acpi_ns_get_type ((acpi_handle) node); | 110 | entry_type = acpi_ns_get_type((acpi_handle) node); |
118 | *object_ptr = node; | 111 | *object_ptr = node; |
119 | } | 112 | } |
120 | 113 | ||
@@ -124,14 +117,14 @@ acpi_ex_resolve_node_to_value ( | |||
124 | * 2) Method locals and arguments have a pseudo-Node | 117 | * 2) Method locals and arguments have a pseudo-Node |
125 | */ | 118 | */ |
126 | if (entry_type == ACPI_TYPE_DEVICE || | 119 | if (entry_type == ACPI_TYPE_DEVICE || |
127 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { | 120 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { |
128 | return_ACPI_STATUS (AE_OK); | 121 | return_ACPI_STATUS(AE_OK); |
129 | } | 122 | } |
130 | 123 | ||
131 | if (!source_desc) { | 124 | if (!source_desc) { |
132 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n", | 125 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
133 | node)); | 126 | "No object attached to node %p\n", node)); |
134 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 127 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
135 | } | 128 | } |
136 | 129 | ||
137 | /* | 130 | /* |
@@ -141,83 +134,89 @@ acpi_ex_resolve_node_to_value ( | |||
141 | switch (entry_type) { | 134 | switch (entry_type) { |
142 | case ACPI_TYPE_PACKAGE: | 135 | case ACPI_TYPE_PACKAGE: |
143 | 136 | ||
144 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_PACKAGE) { | 137 | if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) { |
145 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n", | 138 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
146 | acpi_ut_get_object_type_name (source_desc))); | 139 | "Object not a Package, type %s\n", |
147 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 140 | acpi_ut_get_object_type_name |
141 | (source_desc))); | ||
142 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
148 | } | 143 | } |
149 | 144 | ||
150 | status = acpi_ds_get_package_arguments (source_desc); | 145 | status = acpi_ds_get_package_arguments(source_desc); |
151 | if (ACPI_SUCCESS (status)) { | 146 | if (ACPI_SUCCESS(status)) { |
152 | /* Return an additional reference to the object */ | 147 | /* Return an additional reference to the object */ |
153 | 148 | ||
154 | obj_desc = source_desc; | 149 | obj_desc = source_desc; |
155 | acpi_ut_add_reference (obj_desc); | 150 | acpi_ut_add_reference(obj_desc); |
156 | } | 151 | } |
157 | break; | 152 | break; |
158 | 153 | ||
159 | |||
160 | case ACPI_TYPE_BUFFER: | 154 | case ACPI_TYPE_BUFFER: |
161 | 155 | ||
162 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { | 156 | if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { |
163 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n", | 157 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
164 | acpi_ut_get_object_type_name (source_desc))); | 158 | "Object not a Buffer, type %s\n", |
165 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 159 | acpi_ut_get_object_type_name |
160 | (source_desc))); | ||
161 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
166 | } | 162 | } |
167 | 163 | ||
168 | status = acpi_ds_get_buffer_arguments (source_desc); | 164 | status = acpi_ds_get_buffer_arguments(source_desc); |
169 | if (ACPI_SUCCESS (status)) { | 165 | if (ACPI_SUCCESS(status)) { |
170 | /* Return an additional reference to the object */ | 166 | /* Return an additional reference to the object */ |
171 | 167 | ||
172 | obj_desc = source_desc; | 168 | obj_desc = source_desc; |
173 | acpi_ut_add_reference (obj_desc); | 169 | acpi_ut_add_reference(obj_desc); |
174 | } | 170 | } |
175 | break; | 171 | break; |
176 | 172 | ||
177 | |||
178 | case ACPI_TYPE_STRING: | 173 | case ACPI_TYPE_STRING: |
179 | 174 | ||
180 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) { | 175 | if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) { |
181 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n", | 176 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
182 | acpi_ut_get_object_type_name (source_desc))); | 177 | "Object not a String, type %s\n", |
183 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 178 | acpi_ut_get_object_type_name |
179 | (source_desc))); | ||
180 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
184 | } | 181 | } |
185 | 182 | ||
186 | /* Return an additional reference to the object */ | 183 | /* Return an additional reference to the object */ |
187 | 184 | ||
188 | obj_desc = source_desc; | 185 | obj_desc = source_desc; |
189 | acpi_ut_add_reference (obj_desc); | 186 | acpi_ut_add_reference(obj_desc); |
190 | break; | 187 | break; |
191 | 188 | ||
192 | |||
193 | case ACPI_TYPE_INTEGER: | 189 | case ACPI_TYPE_INTEGER: |
194 | 190 | ||
195 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) { | 191 | if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) { |
196 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n", | 192 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
197 | acpi_ut_get_object_type_name (source_desc))); | 193 | "Object not a Integer, type %s\n", |
198 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 194 | acpi_ut_get_object_type_name |
195 | (source_desc))); | ||
196 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
199 | } | 197 | } |
200 | 198 | ||
201 | /* Return an additional reference to the object */ | 199 | /* Return an additional reference to the object */ |
202 | 200 | ||
203 | obj_desc = source_desc; | 201 | obj_desc = source_desc; |
204 | acpi_ut_add_reference (obj_desc); | 202 | acpi_ut_add_reference(obj_desc); |
205 | break; | 203 | break; |
206 | 204 | ||
207 | |||
208 | case ACPI_TYPE_BUFFER_FIELD: | 205 | case ACPI_TYPE_BUFFER_FIELD: |
209 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 206 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
210 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 207 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
211 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 208 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
212 | 209 | ||
213 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 210 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
214 | "field_read Node=%p source_desc=%p Type=%X\n", | 211 | "field_read Node=%p source_desc=%p Type=%X\n", |
215 | node, source_desc, entry_type)); | 212 | node, source_desc, entry_type)); |
216 | 213 | ||
217 | status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); | 214 | status = |
215 | acpi_ex_read_data_from_field(walk_state, source_desc, | ||
216 | &obj_desc); | ||
218 | break; | 217 | break; |
219 | 218 | ||
220 | /* For these objects, just return the object attached to the Node */ | 219 | /* For these objects, just return the object attached to the Node */ |
221 | 220 | ||
222 | case ACPI_TYPE_MUTEX: | 221 | case ACPI_TYPE_MUTEX: |
223 | case ACPI_TYPE_METHOD: | 222 | case ACPI_TYPE_METHOD: |
@@ -230,19 +229,18 @@ acpi_ex_resolve_node_to_value ( | |||
230 | /* Return an additional reference to the object */ | 229 | /* Return an additional reference to the object */ |
231 | 230 | ||
232 | obj_desc = source_desc; | 231 | obj_desc = source_desc; |
233 | acpi_ut_add_reference (obj_desc); | 232 | acpi_ut_add_reference(obj_desc); |
234 | break; | 233 | break; |
235 | 234 | ||
236 | /* TYPE_ANY is untyped, and thus there is no object associated with it */ | 235 | /* TYPE_ANY is untyped, and thus there is no object associated with it */ |
237 | 236 | ||
238 | case ACPI_TYPE_ANY: | 237 | case ACPI_TYPE_ANY: |
239 | 238 | ||
240 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 239 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
241 | "Untyped entry %p, no attached object!\n", | 240 | "Untyped entry %p, no attached object!\n", |
242 | node)); | 241 | node)); |
243 | |||
244 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ | ||
245 | 242 | ||
243 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ | ||
246 | 244 | ||
247 | case ACPI_TYPE_LOCAL_REFERENCE: | 245 | case ACPI_TYPE_LOCAL_REFERENCE: |
248 | 246 | ||
@@ -253,39 +251,37 @@ acpi_ex_resolve_node_to_value ( | |||
253 | /* Return an additional reference to the object */ | 251 | /* Return an additional reference to the object */ |
254 | 252 | ||
255 | obj_desc = source_desc; | 253 | obj_desc = source_desc; |
256 | acpi_ut_add_reference (obj_desc); | 254 | acpi_ut_add_reference(obj_desc); |
257 | break; | 255 | break; |
258 | 256 | ||
259 | default: | 257 | default: |
260 | /* No named references are allowed here */ | 258 | /* No named references are allowed here */ |
261 | 259 | ||
262 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 260 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
263 | "Unsupported Reference opcode %X (%s)\n", | 261 | "Unsupported Reference opcode %X (%s)\n", |
264 | source_desc->reference.opcode, | 262 | source_desc->reference.opcode, |
265 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); | 263 | acpi_ps_get_opcode_name(source_desc-> |
264 | reference. | ||
265 | opcode))); | ||
266 | 266 | ||
267 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 267 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
268 | } | 268 | } |
269 | break; | 269 | break; |
270 | 270 | ||
271 | |||
272 | default: | 271 | default: |
273 | 272 | ||
274 | /* Default case is for unknown types */ | 273 | /* Default case is for unknown types */ |
275 | 274 | ||
276 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 275 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
277 | "Node %p - Unknown object type %X\n", | 276 | "Node %p - Unknown object type %X\n", |
278 | node, entry_type)); | 277 | node, entry_type)); |
279 | |||
280 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | ||
281 | 278 | ||
282 | } /* switch (entry_type) */ | 279 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
283 | 280 | ||
281 | } /* switch (entry_type) */ | ||
284 | 282 | ||
285 | /* Return the object descriptor */ | 283 | /* Return the object descriptor */ |
286 | 284 | ||
287 | *object_ptr = (void *) obj_desc; | 285 | *object_ptr = (void *)obj_desc; |
288 | return_ACPI_STATUS (status); | 286 | return_ACPI_STATUS(status); |
289 | } | 287 | } |
290 | |||
291 | |||
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 3de45672379a..97eecbd3242d 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
@@ -50,17 +49,13 @@ | |||
50 | #include <acpi/acnamesp.h> | 49 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acparser.h> | 50 | #include <acpi/acparser.h> |
52 | 51 | ||
53 | |||
54 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exresolv") | 53 | ACPI_MODULE_NAME("exresolv") |
56 | 54 | ||
57 | /* Local prototypes */ | 55 | /* Local prototypes */ |
58 | |||
59 | static acpi_status | 56 | static acpi_status |
60 | acpi_ex_resolve_object_to_value ( | 57 | acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, |
61 | union acpi_operand_object **stack_ptr, | 58 | struct acpi_walk_state *walk_state); |
62 | struct acpi_walk_state *walk_state); | ||
63 | |||
64 | 59 | ||
65 | /******************************************************************************* | 60 | /******************************************************************************* |
66 | * | 61 | * |
@@ -78,19 +73,16 @@ acpi_ex_resolve_object_to_value ( | |||
78 | ******************************************************************************/ | 73 | ******************************************************************************/ |
79 | 74 | ||
80 | acpi_status | 75 | acpi_status |
81 | acpi_ex_resolve_to_value ( | 76 | acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, |
82 | union acpi_operand_object **stack_ptr, | 77 | struct acpi_walk_state *walk_state) |
83 | struct acpi_walk_state *walk_state) | ||
84 | { | 78 | { |
85 | acpi_status status; | 79 | acpi_status status; |
86 | |||
87 | |||
88 | ACPI_FUNCTION_TRACE_PTR ("ex_resolve_to_value", stack_ptr); | ||
89 | 80 | ||
81 | ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); | ||
90 | 82 | ||
91 | if (!stack_ptr || !*stack_ptr) { | 83 | if (!stack_ptr || !*stack_ptr) { |
92 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); | 84 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n")); |
93 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 85 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
94 | } | 86 | } |
95 | 87 | ||
96 | /* | 88 | /* |
@@ -98,15 +90,16 @@ acpi_ex_resolve_to_value ( | |||
98 | * 1) A valid union acpi_operand_object, or | 90 | * 1) A valid union acpi_operand_object, or |
99 | * 2) A struct acpi_namespace_node (named_obj) | 91 | * 2) A struct acpi_namespace_node (named_obj) |
100 | */ | 92 | */ |
101 | if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_OPERAND) { | 93 | if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_OPERAND) { |
102 | status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state); | 94 | status = acpi_ex_resolve_object_to_value(stack_ptr, walk_state); |
103 | if (ACPI_FAILURE (status)) { | 95 | if (ACPI_FAILURE(status)) { |
104 | return_ACPI_STATUS (status); | 96 | return_ACPI_STATUS(status); |
105 | } | 97 | } |
106 | 98 | ||
107 | if (!*stack_ptr) { | 99 | if (!*stack_ptr) { |
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); | 100 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
109 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 101 | "Internal - null pointer\n")); |
102 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | ||
110 | } | 103 | } |
111 | } | 104 | } |
112 | 105 | ||
@@ -114,20 +107,20 @@ acpi_ex_resolve_to_value ( | |||
114 | * Object on the stack may have changed if acpi_ex_resolve_object_to_value() | 107 | * Object on the stack may have changed if acpi_ex_resolve_object_to_value() |
115 | * was called (i.e., we can't use an _else_ here.) | 108 | * was called (i.e., we can't use an _else_ here.) |
116 | */ | 109 | */ |
117 | if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_NAMED) { | 110 | if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) { |
118 | status = acpi_ex_resolve_node_to_value ( | 111 | status = |
119 | ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, stack_ptr), | 112 | acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR |
120 | walk_state); | 113 | (struct acpi_namespace_node, |
121 | if (ACPI_FAILURE (status)) { | 114 | stack_ptr), walk_state); |
122 | return_ACPI_STATUS (status); | 115 | if (ACPI_FAILURE(status)) { |
116 | return_ACPI_STATUS(status); | ||
123 | } | 117 | } |
124 | } | 118 | } |
125 | 119 | ||
126 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr)); | 120 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr)); |
127 | return_ACPI_STATUS (AE_OK); | 121 | return_ACPI_STATUS(AE_OK); |
128 | } | 122 | } |
129 | 123 | ||
130 | |||
131 | /******************************************************************************* | 124 | /******************************************************************************* |
132 | * | 125 | * |
133 | * FUNCTION: acpi_ex_resolve_object_to_value | 126 | * FUNCTION: acpi_ex_resolve_object_to_value |
@@ -143,25 +136,22 @@ acpi_ex_resolve_to_value ( | |||
143 | ******************************************************************************/ | 136 | ******************************************************************************/ |
144 | 137 | ||
145 | static acpi_status | 138 | static acpi_status |
146 | acpi_ex_resolve_object_to_value ( | 139 | acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, |
147 | union acpi_operand_object **stack_ptr, | 140 | struct acpi_walk_state *walk_state) |
148 | struct acpi_walk_state *walk_state) | ||
149 | { | 141 | { |
150 | acpi_status status = AE_OK; | 142 | acpi_status status = AE_OK; |
151 | union acpi_operand_object *stack_desc; | 143 | union acpi_operand_object *stack_desc; |
152 | void *temp_node; | 144 | void *temp_node; |
153 | union acpi_operand_object *obj_desc; | 145 | union acpi_operand_object *obj_desc; |
154 | u16 opcode; | 146 | u16 opcode; |
155 | |||
156 | |||
157 | ACPI_FUNCTION_TRACE ("ex_resolve_object_to_value"); | ||
158 | 147 | ||
148 | ACPI_FUNCTION_TRACE("ex_resolve_object_to_value"); | ||
159 | 149 | ||
160 | stack_desc = *stack_ptr; | 150 | stack_desc = *stack_ptr; |
161 | 151 | ||
162 | /* This is an union acpi_operand_object */ | 152 | /* This is an union acpi_operand_object */ |
163 | 153 | ||
164 | switch (ACPI_GET_OBJECT_TYPE (stack_desc)) { | 154 | switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { |
165 | case ACPI_TYPE_LOCAL_REFERENCE: | 155 | case ACPI_TYPE_LOCAL_REFERENCE: |
166 | 156 | ||
167 | opcode = stack_desc->reference.opcode; | 157 | opcode = stack_desc->reference.opcode; |
@@ -177,14 +167,13 @@ acpi_ex_resolve_object_to_value ( | |||
177 | 167 | ||
178 | /* Delete the Reference Object */ | 168 | /* Delete the Reference Object */ |
179 | 169 | ||
180 | acpi_ut_remove_reference (stack_desc); | 170 | acpi_ut_remove_reference(stack_desc); |
181 | 171 | ||
182 | /* Return the namespace node */ | 172 | /* Return the namespace node */ |
183 | 173 | ||
184 | (*stack_ptr) = temp_node; | 174 | (*stack_ptr) = temp_node; |
185 | break; | 175 | break; |
186 | 176 | ||
187 | |||
188 | case AML_LOCAL_OP: | 177 | case AML_LOCAL_OP: |
189 | case AML_ARG_OP: | 178 | case AML_ARG_OP: |
190 | 179 | ||
@@ -192,24 +181,28 @@ acpi_ex_resolve_object_to_value ( | |||
192 | * Get the local from the method's state info | 181 | * Get the local from the method's state info |
193 | * Note: this increments the local's object reference count | 182 | * Note: this increments the local's object reference count |
194 | */ | 183 | */ |
195 | status = acpi_ds_method_data_get_value (opcode, | 184 | status = acpi_ds_method_data_get_value(opcode, |
196 | stack_desc->reference.offset, walk_state, &obj_desc); | 185 | stack_desc-> |
197 | if (ACPI_FAILURE (status)) { | 186 | reference.offset, |
198 | return_ACPI_STATUS (status); | 187 | walk_state, |
188 | &obj_desc); | ||
189 | if (ACPI_FAILURE(status)) { | ||
190 | return_ACPI_STATUS(status); | ||
199 | } | 191 | } |
200 | 192 | ||
201 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] value_obj is %p\n", | 193 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
202 | stack_desc->reference.offset, obj_desc)); | 194 | "[Arg/Local %X] value_obj is %p\n", |
195 | stack_desc->reference.offset, | ||
196 | obj_desc)); | ||
203 | 197 | ||
204 | /* | 198 | /* |
205 | * Now we can delete the original Reference Object and | 199 | * Now we can delete the original Reference Object and |
206 | * replace it with the resolved value | 200 | * replace it with the resolved value |
207 | */ | 201 | */ |
208 | acpi_ut_remove_reference (stack_desc); | 202 | acpi_ut_remove_reference(stack_desc); |
209 | *stack_ptr = obj_desc; | 203 | *stack_ptr = obj_desc; |
210 | break; | 204 | break; |
211 | 205 | ||
212 | |||
213 | case AML_INDEX_OP: | 206 | case AML_INDEX_OP: |
214 | 207 | ||
215 | switch (stack_desc->reference.target_type) { | 208 | switch (stack_desc->reference.target_type) { |
@@ -218,7 +211,6 @@ acpi_ex_resolve_object_to_value ( | |||
218 | /* Just return - leave the Reference on the stack */ | 211 | /* Just return - leave the Reference on the stack */ |
219 | break; | 212 | break; |
220 | 213 | ||
221 | |||
222 | case ACPI_TYPE_PACKAGE: | 214 | case ACPI_TYPE_PACKAGE: |
223 | 215 | ||
224 | obj_desc = *stack_desc->reference.where; | 216 | obj_desc = *stack_desc->reference.where; |
@@ -228,36 +220,31 @@ acpi_ex_resolve_object_to_value ( | |||
228 | * (i.e., dereference the package index) | 220 | * (i.e., dereference the package index) |
229 | * Delete the ref object, increment the returned object | 221 | * Delete the ref object, increment the returned object |
230 | */ | 222 | */ |
231 | acpi_ut_remove_reference (stack_desc); | 223 | acpi_ut_remove_reference(stack_desc); |
232 | acpi_ut_add_reference (obj_desc); | 224 | acpi_ut_add_reference(obj_desc); |
233 | *stack_ptr = obj_desc; | 225 | *stack_ptr = obj_desc; |
234 | } | 226 | } else { |
235 | else { | ||
236 | /* | 227 | /* |
237 | * A NULL object descriptor means an unitialized element of | 228 | * A NULL object descriptor means an unitialized element of |
238 | * the package, can't dereference it | 229 | * the package, can't dereference it |
239 | */ | 230 | */ |
240 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 231 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
241 | "Attempt to deref an Index to NULL pkg element Idx=%p\n", | 232 | "Attempt to deref an Index to NULL pkg element Idx=%p\n", |
242 | stack_desc)); | 233 | stack_desc)); |
243 | status = AE_AML_UNINITIALIZED_ELEMENT; | 234 | status = AE_AML_UNINITIALIZED_ELEMENT; |
244 | } | 235 | } |
245 | break; | 236 | break; |
246 | 237 | ||
247 | |||
248 | default: | 238 | default: |
249 | 239 | ||
250 | /* Invalid reference object */ | 240 | /* Invalid reference object */ |
251 | 241 | ||
252 | ACPI_REPORT_ERROR (( | 242 | ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); |
253 | "During resolve, Unknown target_type %X in Index/Reference obj %p\n", | ||
254 | stack_desc->reference.target_type, stack_desc)); | ||
255 | status = AE_AML_INTERNAL; | 243 | status = AE_AML_INTERNAL; |
256 | break; | 244 | break; |
257 | } | 245 | } |
258 | break; | 246 | break; |
259 | 247 | ||
260 | |||
261 | case AML_REF_OF_OP: | 248 | case AML_REF_OF_OP: |
262 | case AML_DEBUG_OP: | 249 | case AML_DEBUG_OP: |
263 | case AML_LOAD_OP: | 250 | case AML_LOAD_OP: |
@@ -266,60 +253,58 @@ acpi_ex_resolve_object_to_value ( | |||
266 | 253 | ||
267 | break; | 254 | break; |
268 | 255 | ||
269 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 256 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
270 | 257 | ||
271 | /* Get the object pointed to by the namespace node */ | 258 | /* Get the object pointed to by the namespace node */ |
272 | 259 | ||
273 | *stack_ptr = (stack_desc->reference.node)->object; | 260 | *stack_ptr = (stack_desc->reference.node)->object; |
274 | acpi_ut_add_reference (*stack_ptr); | 261 | acpi_ut_add_reference(*stack_ptr); |
275 | acpi_ut_remove_reference (stack_desc); | 262 | acpi_ut_remove_reference(stack_desc); |
276 | break; | 263 | break; |
277 | 264 | ||
278 | default: | 265 | default: |
279 | 266 | ||
280 | ACPI_REPORT_ERROR (( | 267 | ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); |
281 | "During resolve, Unknown Reference opcode %X (%s) in %p\n", | ||
282 | opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); | ||
283 | status = AE_AML_INTERNAL; | 268 | status = AE_AML_INTERNAL; |
284 | break; | 269 | break; |
285 | } | 270 | } |
286 | break; | 271 | break; |
287 | 272 | ||
288 | |||
289 | case ACPI_TYPE_BUFFER: | 273 | case ACPI_TYPE_BUFFER: |
290 | 274 | ||
291 | status = acpi_ds_get_buffer_arguments (stack_desc); | 275 | status = acpi_ds_get_buffer_arguments(stack_desc); |
292 | break; | 276 | break; |
293 | 277 | ||
294 | |||
295 | case ACPI_TYPE_PACKAGE: | 278 | case ACPI_TYPE_PACKAGE: |
296 | 279 | ||
297 | status = acpi_ds_get_package_arguments (stack_desc); | 280 | status = acpi_ds_get_package_arguments(stack_desc); |
298 | break; | 281 | break; |
299 | 282 | ||
300 | 283 | /* These cases may never happen here, but just in case.. */ | |
301 | /* These cases may never happen here, but just in case.. */ | ||
302 | 284 | ||
303 | case ACPI_TYPE_BUFFER_FIELD: | 285 | case ACPI_TYPE_BUFFER_FIELD: |
304 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 286 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
305 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 287 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
306 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 288 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
307 | 289 | ||
308 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read source_desc=%p Type=%X\n", | 290 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
309 | stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc))); | 291 | "field_read source_desc=%p Type=%X\n", |
292 | stack_desc, | ||
293 | ACPI_GET_OBJECT_TYPE(stack_desc))); | ||
310 | 294 | ||
311 | status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc); | 295 | status = |
312 | *stack_ptr = (void *) obj_desc; | 296 | acpi_ex_read_data_from_field(walk_state, stack_desc, |
297 | &obj_desc); | ||
298 | *stack_ptr = (void *)obj_desc; | ||
313 | break; | 299 | break; |
314 | 300 | ||
315 | default: | 301 | default: |
316 | break; | 302 | break; |
317 | } | 303 | } |
318 | 304 | ||
319 | return_ACPI_STATUS (status); | 305 | return_ACPI_STATUS(status); |
320 | } | 306 | } |
321 | 307 | ||
322 | |||
323 | /******************************************************************************* | 308 | /******************************************************************************* |
324 | * | 309 | * |
325 | * FUNCTION: acpi_ex_resolve_multiple | 310 | * FUNCTION: acpi_ex_resolve_multiple |
@@ -337,42 +322,44 @@ acpi_ex_resolve_object_to_value ( | |||
337 | ******************************************************************************/ | 322 | ******************************************************************************/ |
338 | 323 | ||
339 | acpi_status | 324 | acpi_status |
340 | acpi_ex_resolve_multiple ( | 325 | acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, |
341 | struct acpi_walk_state *walk_state, | 326 | union acpi_operand_object *operand, |
342 | union acpi_operand_object *operand, | 327 | acpi_object_type * return_type, |
343 | acpi_object_type *return_type, | 328 | union acpi_operand_object **return_desc) |
344 | union acpi_operand_object **return_desc) | ||
345 | { | 329 | { |
346 | union acpi_operand_object *obj_desc = (void *) operand; | 330 | union acpi_operand_object *obj_desc = (void *)operand; |
347 | struct acpi_namespace_node *node; | 331 | struct acpi_namespace_node *node; |
348 | acpi_object_type type; | 332 | acpi_object_type type; |
349 | acpi_status status; | 333 | acpi_status status; |
350 | |||
351 | |||
352 | ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); | ||
353 | 334 | ||
335 | ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple"); | ||
354 | 336 | ||
355 | /* Operand can be either a namespace node or an operand descriptor */ | 337 | /* Operand can be either a namespace node or an operand descriptor */ |
356 | 338 | ||
357 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 339 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
358 | case ACPI_DESC_TYPE_OPERAND: | 340 | case ACPI_DESC_TYPE_OPERAND: |
359 | type = obj_desc->common.type; | 341 | type = obj_desc->common.type; |
360 | break; | 342 | break; |
361 | 343 | ||
362 | case ACPI_DESC_TYPE_NAMED: | 344 | case ACPI_DESC_TYPE_NAMED: |
363 | type = ((struct acpi_namespace_node *) obj_desc)->type; | 345 | type = ((struct acpi_namespace_node *)obj_desc)->type; |
364 | obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc); | 346 | obj_desc = |
347 | acpi_ns_get_attached_object((struct acpi_namespace_node *) | ||
348 | obj_desc); | ||
365 | 349 | ||
366 | /* If we had an Alias node, use the attached object for type info */ | 350 | /* If we had an Alias node, use the attached object for type info */ |
367 | 351 | ||
368 | if (type == ACPI_TYPE_LOCAL_ALIAS) { | 352 | if (type == ACPI_TYPE_LOCAL_ALIAS) { |
369 | type = ((struct acpi_namespace_node *) obj_desc)->type; | 353 | type = ((struct acpi_namespace_node *)obj_desc)->type; |
370 | obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc); | 354 | obj_desc = |
355 | acpi_ns_get_attached_object((struct | ||
356 | acpi_namespace_node *) | ||
357 | obj_desc); | ||
371 | } | 358 | } |
372 | break; | 359 | break; |
373 | 360 | ||
374 | default: | 361 | default: |
375 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 362 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
376 | } | 363 | } |
377 | 364 | ||
378 | /* If type is anything other than a reference, we are done */ | 365 | /* If type is anything other than a reference, we are done */ |
@@ -387,7 +374,7 @@ acpi_ex_resolve_multiple ( | |||
387 | * of the object_type and size_of operators). This means traversing | 374 | * of the object_type and size_of operators). This means traversing |
388 | * the list of possibly many nested references. | 375 | * the list of possibly many nested references. |
389 | */ | 376 | */ |
390 | while (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 377 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { |
391 | switch (obj_desc->reference.opcode) { | 378 | switch (obj_desc->reference.opcode) { |
392 | case AML_REF_OF_OP: | 379 | case AML_REF_OF_OP: |
393 | 380 | ||
@@ -397,31 +384,29 @@ acpi_ex_resolve_multiple ( | |||
397 | 384 | ||
398 | /* All "References" point to a NS node */ | 385 | /* All "References" point to a NS node */ |
399 | 386 | ||
400 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { | 387 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != |
401 | ACPI_REPORT_ERROR (( | 388 | ACPI_DESC_TYPE_NAMED) { |
402 | "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", | 389 | ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); |
403 | node, acpi_ut_get_descriptor_name (node))); | 390 | return_ACPI_STATUS(AE_AML_INTERNAL); |
404 | return_ACPI_STATUS (AE_AML_INTERNAL); | ||
405 | } | 391 | } |
406 | 392 | ||
407 | /* Get the attached object */ | 393 | /* Get the attached object */ |
408 | 394 | ||
409 | obj_desc = acpi_ns_get_attached_object (node); | 395 | obj_desc = acpi_ns_get_attached_object(node); |
410 | if (!obj_desc) { | 396 | if (!obj_desc) { |
411 | /* No object, use the NS node type */ | 397 | /* No object, use the NS node type */ |
412 | 398 | ||
413 | type = acpi_ns_get_type (node); | 399 | type = acpi_ns_get_type(node); |
414 | goto exit; | 400 | goto exit; |
415 | } | 401 | } |
416 | 402 | ||
417 | /* Check for circular references */ | 403 | /* Check for circular references */ |
418 | 404 | ||
419 | if (obj_desc == operand) { | 405 | if (obj_desc == operand) { |
420 | return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); | 406 | return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); |
421 | } | 407 | } |
422 | break; | 408 | break; |
423 | 409 | ||
424 | |||
425 | case AML_INDEX_OP: | 410 | case AML_INDEX_OP: |
426 | 411 | ||
427 | /* Get the type of this reference (index into another object) */ | 412 | /* Get the type of this reference (index into another object) */ |
@@ -442,12 +427,11 @@ acpi_ex_resolve_multiple ( | |||
442 | if (!obj_desc) { | 427 | if (!obj_desc) { |
443 | /* NULL package elements are allowed */ | 428 | /* NULL package elements are allowed */ |
444 | 429 | ||
445 | type = 0; /* Uninitialized */ | 430 | type = 0; /* Uninitialized */ |
446 | goto exit; | 431 | goto exit; |
447 | } | 432 | } |
448 | break; | 433 | break; |
449 | 434 | ||
450 | |||
451 | case AML_INT_NAMEPATH_OP: | 435 | case AML_INT_NAMEPATH_OP: |
452 | 436 | ||
453 | /* Dereference the reference pointer */ | 437 | /* Dereference the reference pointer */ |
@@ -456,50 +440,61 @@ acpi_ex_resolve_multiple ( | |||
456 | 440 | ||
457 | /* All "References" point to a NS node */ | 441 | /* All "References" point to a NS node */ |
458 | 442 | ||
459 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { | 443 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != |
460 | ACPI_REPORT_ERROR (( | 444 | ACPI_DESC_TYPE_NAMED) { |
461 | "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", | 445 | ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); |
462 | node, acpi_ut_get_descriptor_name (node))); | 446 | return_ACPI_STATUS(AE_AML_INTERNAL); |
463 | return_ACPI_STATUS (AE_AML_INTERNAL); | ||
464 | } | 447 | } |
465 | 448 | ||
466 | /* Get the attached object */ | 449 | /* Get the attached object */ |
467 | 450 | ||
468 | obj_desc = acpi_ns_get_attached_object (node); | 451 | obj_desc = acpi_ns_get_attached_object(node); |
469 | if (!obj_desc) { | 452 | if (!obj_desc) { |
470 | /* No object, use the NS node type */ | 453 | /* No object, use the NS node type */ |
471 | 454 | ||
472 | type = acpi_ns_get_type (node); | 455 | type = acpi_ns_get_type(node); |
473 | goto exit; | 456 | goto exit; |
474 | } | 457 | } |
475 | 458 | ||
476 | /* Check for circular references */ | 459 | /* Check for circular references */ |
477 | 460 | ||
478 | if (obj_desc == operand) { | 461 | if (obj_desc == operand) { |
479 | return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); | 462 | return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); |
480 | } | 463 | } |
481 | break; | 464 | break; |
482 | 465 | ||
483 | |||
484 | case AML_LOCAL_OP: | 466 | case AML_LOCAL_OP: |
485 | case AML_ARG_OP: | 467 | case AML_ARG_OP: |
486 | 468 | ||
487 | if (return_desc) { | 469 | if (return_desc) { |
488 | status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, | 470 | status = |
489 | obj_desc->reference.offset, walk_state, &obj_desc); | 471 | acpi_ds_method_data_get_value(obj_desc-> |
490 | if (ACPI_FAILURE (status)) { | 472 | reference. |
491 | return_ACPI_STATUS (status); | 473 | opcode, |
474 | obj_desc-> | ||
475 | reference. | ||
476 | offset, | ||
477 | walk_state, | ||
478 | &obj_desc); | ||
479 | if (ACPI_FAILURE(status)) { | ||
480 | return_ACPI_STATUS(status); | ||
492 | } | 481 | } |
493 | acpi_ut_remove_reference (obj_desc); | 482 | acpi_ut_remove_reference(obj_desc); |
494 | } | 483 | } else { |
495 | else { | 484 | status = |
496 | status = acpi_ds_method_data_get_node (obj_desc->reference.opcode, | 485 | acpi_ds_method_data_get_node(obj_desc-> |
497 | obj_desc->reference.offset, walk_state, &node); | 486 | reference. |
498 | if (ACPI_FAILURE (status)) { | 487 | opcode, |
499 | return_ACPI_STATUS (status); | 488 | obj_desc-> |
489 | reference. | ||
490 | offset, | ||
491 | walk_state, | ||
492 | &node); | ||
493 | if (ACPI_FAILURE(status)) { | ||
494 | return_ACPI_STATUS(status); | ||
500 | } | 495 | } |
501 | 496 | ||
502 | obj_desc = acpi_ns_get_attached_object (node); | 497 | obj_desc = acpi_ns_get_attached_object(node); |
503 | if (!obj_desc) { | 498 | if (!obj_desc) { |
504 | type = ACPI_TYPE_ANY; | 499 | type = ACPI_TYPE_ANY; |
505 | goto exit; | 500 | goto exit; |
@@ -507,7 +502,6 @@ acpi_ex_resolve_multiple ( | |||
507 | } | 502 | } |
508 | break; | 503 | break; |
509 | 504 | ||
510 | |||
511 | case AML_DEBUG_OP: | 505 | case AML_DEBUG_OP: |
512 | 506 | ||
513 | /* The Debug Object is of type "debug_object" */ | 507 | /* The Debug Object is of type "debug_object" */ |
@@ -515,13 +509,10 @@ acpi_ex_resolve_multiple ( | |||
515 | type = ACPI_TYPE_DEBUG_OBJECT; | 509 | type = ACPI_TYPE_DEBUG_OBJECT; |
516 | goto exit; | 510 | goto exit; |
517 | 511 | ||
518 | |||
519 | default: | 512 | default: |
520 | 513 | ||
521 | ACPI_REPORT_ERROR (( | 514 | ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode)); |
522 | "acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", | 515 | return_ACPI_STATUS(AE_AML_INTERNAL); |
523 | obj_desc->reference.opcode)); | ||
524 | return_ACPI_STATUS (AE_AML_INTERNAL); | ||
525 | } | 516 | } |
526 | } | 517 | } |
527 | 518 | ||
@@ -529,10 +520,9 @@ acpi_ex_resolve_multiple ( | |||
529 | * Now we are guaranteed to have an object that has not been created | 520 | * Now we are guaranteed to have an object that has not been created |
530 | * via the ref_of or Index operators. | 521 | * via the ref_of or Index operators. |
531 | */ | 522 | */ |
532 | type = ACPI_GET_OBJECT_TYPE (obj_desc); | 523 | type = ACPI_GET_OBJECT_TYPE(obj_desc); |
533 | 524 | ||
534 | 525 | exit: | |
535 | exit: | ||
536 | /* Convert internal types to external types */ | 526 | /* Convert internal types to external types */ |
537 | 527 | ||
538 | switch (type) { | 528 | switch (type) { |
@@ -559,7 +549,5 @@ exit: | |||
559 | if (return_desc) { | 549 | if (return_desc) { |
560 | *return_desc = obj_desc; | 550 | *return_desc = obj_desc; |
561 | } | 551 | } |
562 | return_ACPI_STATUS (AE_OK); | 552 | return_ACPI_STATUS(AE_OK); |
563 | } | 553 | } |
564 | |||
565 | |||
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index aaba7abcb52d..ff064e79ab90 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -42,24 +42,18 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | #include <acpi/acparser.h> | 47 | #include <acpi/acparser.h> |
49 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exresop") | 51 | ACPI_MODULE_NAME("exresop") |
54 | 52 | ||
55 | /* Local prototypes */ | 53 | /* Local prototypes */ |
56 | |||
57 | static acpi_status | 54 | static acpi_status |
58 | acpi_ex_check_object_type ( | 55 | acpi_ex_check_object_type(acpi_object_type type_needed, |
59 | acpi_object_type type_needed, | 56 | acpi_object_type this_type, void *object); |
60 | acpi_object_type this_type, | ||
61 | void *object); | ||
62 | |||
63 | 57 | ||
64 | /******************************************************************************* | 58 | /******************************************************************************* |
65 | * | 59 | * |
@@ -76,13 +70,10 @@ acpi_ex_check_object_type ( | |||
76 | ******************************************************************************/ | 70 | ******************************************************************************/ |
77 | 71 | ||
78 | static acpi_status | 72 | static acpi_status |
79 | acpi_ex_check_object_type ( | 73 | acpi_ex_check_object_type(acpi_object_type type_needed, |
80 | acpi_object_type type_needed, | 74 | acpi_object_type this_type, void *object) |
81 | acpi_object_type this_type, | ||
82 | void *object) | ||
83 | { | 75 | { |
84 | ACPI_FUNCTION_NAME ("ex_check_object_type"); | 76 | ACPI_FUNCTION_NAME("ex_check_object_type"); |
85 | |||
86 | 77 | ||
87 | if (type_needed == ACPI_TYPE_ANY) { | 78 | if (type_needed == ACPI_TYPE_ANY) { |
88 | /* All types OK, so we don't perform any typechecks */ | 79 | /* All types OK, so we don't perform any typechecks */ |
@@ -97,16 +88,17 @@ acpi_ex_check_object_type ( | |||
97 | * specification, a store to a constant is a noop.) | 88 | * specification, a store to a constant is a noop.) |
98 | */ | 89 | */ |
99 | if ((this_type == ACPI_TYPE_INTEGER) && | 90 | if ((this_type == ACPI_TYPE_INTEGER) && |
100 | (((union acpi_operand_object *) object)->common.flags & AOPOBJ_AML_CONSTANT)) { | 91 | (((union acpi_operand_object *)object)->common. |
92 | flags & AOPOBJ_AML_CONSTANT)) { | ||
101 | return (AE_OK); | 93 | return (AE_OK); |
102 | } | 94 | } |
103 | } | 95 | } |
104 | 96 | ||
105 | if (type_needed != this_type) { | 97 | if (type_needed != this_type) { |
106 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 98 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
107 | "Needed [%s], found [%s] %p\n", | 99 | "Needed [%s], found [%s] %p\n", |
108 | acpi_ut_get_type_name (type_needed), | 100 | acpi_ut_get_type_name(type_needed), |
109 | acpi_ut_get_type_name (this_type), object)); | 101 | acpi_ut_get_type_name(this_type), object)); |
110 | 102 | ||
111 | return (AE_AML_OPERAND_TYPE); | 103 | return (AE_AML_OPERAND_TYPE); |
112 | } | 104 | } |
@@ -114,7 +106,6 @@ acpi_ex_check_object_type ( | |||
114 | return (AE_OK); | 106 | return (AE_OK); |
115 | } | 107 | } |
116 | 108 | ||
117 | |||
118 | /******************************************************************************* | 109 | /******************************************************************************* |
119 | * | 110 | * |
120 | * FUNCTION: acpi_ex_resolve_operands | 111 | * FUNCTION: acpi_ex_resolve_operands |
@@ -137,41 +128,37 @@ acpi_ex_check_object_type ( | |||
137 | ******************************************************************************/ | 128 | ******************************************************************************/ |
138 | 129 | ||
139 | acpi_status | 130 | acpi_status |
140 | acpi_ex_resolve_operands ( | 131 | acpi_ex_resolve_operands(u16 opcode, |
141 | u16 opcode, | 132 | union acpi_operand_object ** stack_ptr, |
142 | union acpi_operand_object **stack_ptr, | 133 | struct acpi_walk_state * walk_state) |
143 | struct acpi_walk_state *walk_state) | ||
144 | { | 134 | { |
145 | union acpi_operand_object *obj_desc; | 135 | union acpi_operand_object *obj_desc; |
146 | acpi_status status = AE_OK; | 136 | acpi_status status = AE_OK; |
147 | u8 object_type; | 137 | u8 object_type; |
148 | void *temp_node; | 138 | void *temp_node; |
149 | u32 arg_types; | 139 | u32 arg_types; |
150 | const struct acpi_opcode_info *op_info; | 140 | const struct acpi_opcode_info *op_info; |
151 | u32 this_arg_type; | 141 | u32 this_arg_type; |
152 | acpi_object_type type_needed; | 142 | acpi_object_type type_needed; |
153 | u16 target_op = 0; | 143 | u16 target_op = 0; |
154 | 144 | ||
155 | 145 | ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); | |
156 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); | 146 | |
157 | 147 | op_info = acpi_ps_get_opcode_info(opcode); | |
158 | |||
159 | op_info = acpi_ps_get_opcode_info (opcode); | ||
160 | if (op_info->class == AML_CLASS_UNKNOWN) { | 148 | if (op_info->class == AML_CLASS_UNKNOWN) { |
161 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 149 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
162 | } | 150 | } |
163 | 151 | ||
164 | arg_types = op_info->runtime_args; | 152 | arg_types = op_info->runtime_args; |
165 | if (arg_types == ARGI_INVALID_OPCODE) { | 153 | if (arg_types == ARGI_INVALID_OPCODE) { |
166 | ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n", | 154 | ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); |
167 | opcode)); | ||
168 | 155 | ||
169 | return_ACPI_STATUS (AE_AML_INTERNAL); | 156 | return_ACPI_STATUS(AE_AML_INTERNAL); |
170 | } | 157 | } |
171 | 158 | ||
172 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 159 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
173 | "Opcode %X [%s] required_operand_types=%8.8X \n", | 160 | "Opcode %X [%s] required_operand_types=%8.8X \n", |
174 | opcode, op_info->name, arg_types)); | 161 | opcode, op_info->name, arg_types)); |
175 | 162 | ||
176 | /* | 163 | /* |
177 | * Normal exit is with (arg_types == 0) at end of argument list. | 164 | * Normal exit is with (arg_types == 0) at end of argument list. |
@@ -180,12 +167,11 @@ acpi_ex_resolve_operands ( | |||
180 | * to) the required type; if stack underflows; or upon | 167 | * to) the required type; if stack underflows; or upon |
181 | * finding a NULL stack entry (which should not happen). | 168 | * finding a NULL stack entry (which should not happen). |
182 | */ | 169 | */ |
183 | while (GET_CURRENT_ARG_TYPE (arg_types)) { | 170 | while (GET_CURRENT_ARG_TYPE(arg_types)) { |
184 | if (!stack_ptr || !*stack_ptr) { | 171 | if (!stack_ptr || !*stack_ptr) { |
185 | ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n", | 172 | ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); |
186 | stack_ptr)); | ||
187 | 173 | ||
188 | return_ACPI_STATUS (AE_AML_INTERNAL); | 174 | return_ACPI_STATUS(AE_AML_INTERNAL); |
189 | } | 175 | } |
190 | 176 | ||
191 | /* Extract useful items */ | 177 | /* Extract useful items */ |
@@ -194,37 +180,37 @@ acpi_ex_resolve_operands ( | |||
194 | 180 | ||
195 | /* Decode the descriptor type */ | 181 | /* Decode the descriptor type */ |
196 | 182 | ||
197 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 183 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
198 | case ACPI_DESC_TYPE_NAMED: | 184 | case ACPI_DESC_TYPE_NAMED: |
199 | 185 | ||
200 | /* Namespace Node */ | 186 | /* Namespace Node */ |
201 | 187 | ||
202 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; | 188 | object_type = |
189 | ((struct acpi_namespace_node *)obj_desc)->type; | ||
203 | break; | 190 | break; |
204 | 191 | ||
205 | |||
206 | case ACPI_DESC_TYPE_OPERAND: | 192 | case ACPI_DESC_TYPE_OPERAND: |
207 | 193 | ||
208 | /* ACPI internal object */ | 194 | /* ACPI internal object */ |
209 | 195 | ||
210 | object_type = ACPI_GET_OBJECT_TYPE (obj_desc); | 196 | object_type = ACPI_GET_OBJECT_TYPE(obj_desc); |
211 | 197 | ||
212 | /* Check for bad acpi_object_type */ | 198 | /* Check for bad acpi_object_type */ |
213 | 199 | ||
214 | if (!acpi_ut_valid_object_type (object_type)) { | 200 | if (!acpi_ut_valid_object_type(object_type)) { |
215 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 201 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
216 | "Bad operand object type [%X]\n", | 202 | "Bad operand object type [%X]\n", |
217 | object_type)); | 203 | object_type)); |
218 | 204 | ||
219 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 205 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
220 | } | 206 | } |
221 | 207 | ||
222 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 208 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
223 | /* Decode the Reference */ | 209 | /* Decode the Reference */ |
224 | 210 | ||
225 | op_info = acpi_ps_get_opcode_info (opcode); | 211 | op_info = acpi_ps_get_opcode_info(opcode); |
226 | if (op_info->class == AML_CLASS_UNKNOWN) { | 212 | if (op_info->class == AML_CLASS_UNKNOWN) { |
227 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 213 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
228 | } | 214 | } |
229 | 215 | ||
230 | switch (obj_desc->reference.opcode) { | 216 | switch (obj_desc->reference.opcode) { |
@@ -238,51 +224,62 @@ acpi_ex_resolve_operands ( | |||
238 | case AML_REF_OF_OP: | 224 | case AML_REF_OF_OP: |
239 | case AML_ARG_OP: | 225 | case AML_ARG_OP: |
240 | case AML_LOCAL_OP: | 226 | case AML_LOCAL_OP: |
241 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ | 227 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ |
242 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 228 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
243 | 229 | ||
244 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 230 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT |
245 | "Operand is a Reference, ref_opcode [%s]\n", | 231 | ((ACPI_DB_EXEC, |
246 | (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name))); | 232 | "Operand is a Reference, ref_opcode [%s]\n", |
233 | (acpi_ps_get_opcode_info | ||
234 | (obj_desc-> | ||
235 | reference. | ||
236 | opcode))-> | ||
237 | name))); | ||
247 | break; | 238 | break; |
248 | 239 | ||
249 | default: | 240 | default: |
250 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 241 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
251 | "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", | 242 | "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", |
252 | obj_desc->reference.opcode, | 243 | obj_desc->reference. |
253 | (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)); | 244 | opcode, |
254 | 245 | (acpi_ps_get_opcode_info | |
255 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 246 | (obj_desc->reference. |
247 | opcode))->name)); | ||
248 | |||
249 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
256 | } | 250 | } |
257 | } | 251 | } |
258 | break; | 252 | break; |
259 | 253 | ||
260 | |||
261 | default: | 254 | default: |
262 | 255 | ||
263 | /* Invalid descriptor */ | 256 | /* Invalid descriptor */ |
264 | 257 | ||
265 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 258 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
266 | "Invalid descriptor %p [%s]\n", | 259 | "Invalid descriptor %p [%s]\n", |
267 | obj_desc, acpi_ut_get_descriptor_name (obj_desc))); | 260 | obj_desc, |
261 | acpi_ut_get_descriptor_name | ||
262 | (obj_desc))); | ||
268 | 263 | ||
269 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 264 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
270 | } | 265 | } |
271 | 266 | ||
272 | /* Get one argument type, point to the next */ | 267 | /* Get one argument type, point to the next */ |
273 | 268 | ||
274 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); | 269 | this_arg_type = GET_CURRENT_ARG_TYPE(arg_types); |
275 | INCREMENT_ARG_LIST (arg_types); | 270 | INCREMENT_ARG_LIST(arg_types); |
276 | 271 | ||
277 | /* | 272 | /* |
278 | * Handle cases where the object does not need to be | 273 | * Handle cases where the object does not need to be |
279 | * resolved to a value | 274 | * resolved to a value |
280 | */ | 275 | */ |
281 | switch (this_arg_type) { | 276 | switch (this_arg_type) { |
282 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ | 277 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ |
283 | 278 | ||
284 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && | 279 | if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
285 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { | 280 | ACPI_DESC_TYPE_OPERAND) |
281 | && (ACPI_GET_OBJECT_TYPE(obj_desc) == | ||
282 | ACPI_TYPE_STRING)) { | ||
286 | /* | 283 | /* |
287 | * String found - the string references a named object and | 284 | * String found - the string references a named object and |
288 | * must be resolved to a node | 285 | * must be resolved to a node |
@@ -296,39 +293,40 @@ acpi_ex_resolve_operands ( | |||
296 | */ | 293 | */ |
297 | /*lint -fallthrough */ | 294 | /*lint -fallthrough */ |
298 | 295 | ||
299 | case ARGI_REFERENCE: /* References: */ | 296 | case ARGI_REFERENCE: /* References: */ |
300 | case ARGI_INTEGER_REF: | 297 | case ARGI_INTEGER_REF: |
301 | case ARGI_OBJECT_REF: | 298 | case ARGI_OBJECT_REF: |
302 | case ARGI_DEVICE_REF: | 299 | case ARGI_DEVICE_REF: |
303 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ | 300 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ |
304 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ | 301 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ |
305 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ | 302 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ |
306 | 303 | ||
307 | /* | 304 | /* |
308 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE | 305 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE |
309 | * A Namespace Node is OK as-is | 306 | * A Namespace Node is OK as-is |
310 | */ | 307 | */ |
311 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | 308 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
309 | ACPI_DESC_TYPE_NAMED) { | ||
312 | goto next_operand; | 310 | goto next_operand; |
313 | } | 311 | } |
314 | 312 | ||
315 | status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE, | 313 | status = |
316 | object_type, obj_desc); | 314 | acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE, |
317 | if (ACPI_FAILURE (status)) { | 315 | object_type, obj_desc); |
318 | return_ACPI_STATUS (status); | 316 | if (ACPI_FAILURE(status)) { |
317 | return_ACPI_STATUS(status); | ||
319 | } | 318 | } |
320 | 319 | ||
321 | if (obj_desc->reference.opcode == AML_NAME_OP) { | 320 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
322 | /* Convert a named reference to the actual named object */ | 321 | /* Convert a named reference to the actual named object */ |
323 | 322 | ||
324 | temp_node = obj_desc->reference.object; | 323 | temp_node = obj_desc->reference.object; |
325 | acpi_ut_remove_reference (obj_desc); | 324 | acpi_ut_remove_reference(obj_desc); |
326 | (*stack_ptr) = temp_node; | 325 | (*stack_ptr) = temp_node; |
327 | } | 326 | } |
328 | goto next_operand; | 327 | goto next_operand; |
329 | 328 | ||
330 | 329 | case ARGI_DATAREFOBJ: /* Store operator only */ | |
331 | case ARGI_DATAREFOBJ: /* Store operator only */ | ||
332 | 330 | ||
333 | /* | 331 | /* |
334 | * We don't want to resolve index_op reference objects during | 332 | * We don't want to resolve index_op reference objects during |
@@ -337,8 +335,10 @@ acpi_ex_resolve_operands ( | |||
337 | * -- All others must be resolved below. | 335 | * -- All others must be resolved below. |
338 | */ | 336 | */ |
339 | if ((opcode == AML_STORE_OP) && | 337 | if ((opcode == AML_STORE_OP) && |
340 | (ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) && | 338 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == |
341 | ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { | 339 | ACPI_TYPE_LOCAL_REFERENCE) |
340 | && ((*stack_ptr)->reference.opcode == | ||
341 | AML_INDEX_OP)) { | ||
342 | goto next_operand; | 342 | goto next_operand; |
343 | } | 343 | } |
344 | break; | 344 | break; |
@@ -351,9 +351,9 @@ acpi_ex_resolve_operands ( | |||
351 | /* | 351 | /* |
352 | * Resolve this object to a value | 352 | * Resolve this object to a value |
353 | */ | 353 | */ |
354 | status = acpi_ex_resolve_to_value (stack_ptr, walk_state); | 354 | status = acpi_ex_resolve_to_value(stack_ptr, walk_state); |
355 | if (ACPI_FAILURE (status)) { | 355 | if (ACPI_FAILURE(status)) { |
356 | return_ACPI_STATUS (status); | 356 | return_ACPI_STATUS(status); |
357 | } | 357 | } |
358 | 358 | ||
359 | /* Get the resolved object */ | 359 | /* Get the resolved object */ |
@@ -364,10 +364,10 @@ acpi_ex_resolve_operands ( | |||
364 | * Check the resulting object (value) type | 364 | * Check the resulting object (value) type |
365 | */ | 365 | */ |
366 | switch (this_arg_type) { | 366 | switch (this_arg_type) { |
367 | /* | 367 | /* |
368 | * For the simple cases, only one type of resolved object | 368 | * For the simple cases, only one type of resolved object |
369 | * is allowed | 369 | * is allowed |
370 | */ | 370 | */ |
371 | case ARGI_MUTEX: | 371 | case ARGI_MUTEX: |
372 | 372 | ||
373 | /* Need an operand of type ACPI_TYPE_MUTEX */ | 373 | /* Need an operand of type ACPI_TYPE_MUTEX */ |
@@ -382,7 +382,7 @@ acpi_ex_resolve_operands ( | |||
382 | type_needed = ACPI_TYPE_EVENT; | 382 | type_needed = ACPI_TYPE_EVENT; |
383 | break; | 383 | break; |
384 | 384 | ||
385 | case ARGI_PACKAGE: /* Package */ | 385 | case ARGI_PACKAGE: /* Package */ |
386 | 386 | ||
387 | /* Need an operand of type ACPI_TYPE_PACKAGE */ | 387 | /* Need an operand of type ACPI_TYPE_PACKAGE */ |
388 | 388 | ||
@@ -403,10 +403,9 @@ acpi_ex_resolve_operands ( | |||
403 | type_needed = ACPI_TYPE_LOCAL_REFERENCE; | 403 | type_needed = ACPI_TYPE_LOCAL_REFERENCE; |
404 | break; | 404 | break; |
405 | 405 | ||
406 | 406 | /* | |
407 | /* | 407 | * The more complex cases allow multiple resolved object types |
408 | * The more complex cases allow multiple resolved object types | 408 | */ |
409 | */ | ||
410 | case ARGI_INTEGER: | 409 | case ARGI_INTEGER: |
411 | 410 | ||
412 | /* | 411 | /* |
@@ -414,25 +413,27 @@ acpi_ex_resolve_operands ( | |||
414 | * But we can implicitly convert from a STRING or BUFFER | 413 | * But we can implicitly convert from a STRING or BUFFER |
415 | * Aka - "Implicit Source Operand Conversion" | 414 | * Aka - "Implicit Source Operand Conversion" |
416 | */ | 415 | */ |
417 | status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16); | 416 | status = |
418 | if (ACPI_FAILURE (status)) { | 417 | acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); |
418 | if (ACPI_FAILURE(status)) { | ||
419 | if (status == AE_TYPE) { | 419 | if (status == AE_TYPE) { |
420 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 420 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
421 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 421 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
422 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 422 | acpi_ut_get_object_type_name |
423 | (obj_desc), | ||
424 | obj_desc)); | ||
423 | 425 | ||
424 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 426 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
425 | } | 427 | } |
426 | 428 | ||
427 | return_ACPI_STATUS (status); | 429 | return_ACPI_STATUS(status); |
428 | } | 430 | } |
429 | 431 | ||
430 | if (obj_desc != *stack_ptr) { | 432 | if (obj_desc != *stack_ptr) { |
431 | acpi_ut_remove_reference (obj_desc); | 433 | acpi_ut_remove_reference(obj_desc); |
432 | } | 434 | } |
433 | goto next_operand; | 435 | goto next_operand; |
434 | 436 | ||
435 | |||
436 | case ARGI_BUFFER: | 437 | case ARGI_BUFFER: |
437 | 438 | ||
438 | /* | 439 | /* |
@@ -440,25 +441,26 @@ acpi_ex_resolve_operands ( | |||
440 | * But we can implicitly convert from a STRING or INTEGER | 441 | * But we can implicitly convert from a STRING or INTEGER |
441 | * Aka - "Implicit Source Operand Conversion" | 442 | * Aka - "Implicit Source Operand Conversion" |
442 | */ | 443 | */ |
443 | status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); | 444 | status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); |
444 | if (ACPI_FAILURE (status)) { | 445 | if (ACPI_FAILURE(status)) { |
445 | if (status == AE_TYPE) { | 446 | if (status == AE_TYPE) { |
446 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 447 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
447 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 448 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
448 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 449 | acpi_ut_get_object_type_name |
450 | (obj_desc), | ||
451 | obj_desc)); | ||
449 | 452 | ||
450 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 453 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
451 | } | 454 | } |
452 | 455 | ||
453 | return_ACPI_STATUS (status); | 456 | return_ACPI_STATUS(status); |
454 | } | 457 | } |
455 | 458 | ||
456 | if (obj_desc != *stack_ptr) { | 459 | if (obj_desc != *stack_ptr) { |
457 | acpi_ut_remove_reference (obj_desc); | 460 | acpi_ut_remove_reference(obj_desc); |
458 | } | 461 | } |
459 | goto next_operand; | 462 | goto next_operand; |
460 | 463 | ||
461 | |||
462 | case ARGI_STRING: | 464 | case ARGI_STRING: |
463 | 465 | ||
464 | /* | 466 | /* |
@@ -466,83 +468,86 @@ acpi_ex_resolve_operands ( | |||
466 | * But we can implicitly convert from a BUFFER or INTEGER | 468 | * But we can implicitly convert from a BUFFER or INTEGER |
467 | * Aka - "Implicit Source Operand Conversion" | 469 | * Aka - "Implicit Source Operand Conversion" |
468 | */ | 470 | */ |
469 | status = acpi_ex_convert_to_string (obj_desc, stack_ptr, | 471 | status = acpi_ex_convert_to_string(obj_desc, stack_ptr, |
470 | ACPI_IMPLICIT_CONVERT_HEX); | 472 | ACPI_IMPLICIT_CONVERT_HEX); |
471 | if (ACPI_FAILURE (status)) { | 473 | if (ACPI_FAILURE(status)) { |
472 | if (status == AE_TYPE) { | 474 | if (status == AE_TYPE) { |
473 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 475 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
474 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 476 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
475 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 477 | acpi_ut_get_object_type_name |
478 | (obj_desc), | ||
479 | obj_desc)); | ||
476 | 480 | ||
477 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 481 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
478 | } | 482 | } |
479 | 483 | ||
480 | return_ACPI_STATUS (status); | 484 | return_ACPI_STATUS(status); |
481 | } | 485 | } |
482 | 486 | ||
483 | if (obj_desc != *stack_ptr) { | 487 | if (obj_desc != *stack_ptr) { |
484 | acpi_ut_remove_reference (obj_desc); | 488 | acpi_ut_remove_reference(obj_desc); |
485 | } | 489 | } |
486 | goto next_operand; | 490 | goto next_operand; |
487 | 491 | ||
488 | |||
489 | case ARGI_COMPUTEDATA: | 492 | case ARGI_COMPUTEDATA: |
490 | 493 | ||
491 | /* Need an operand of type INTEGER, STRING or BUFFER */ | 494 | /* Need an operand of type INTEGER, STRING or BUFFER */ |
492 | 495 | ||
493 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 496 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
494 | case ACPI_TYPE_INTEGER: | 497 | case ACPI_TYPE_INTEGER: |
495 | case ACPI_TYPE_STRING: | 498 | case ACPI_TYPE_STRING: |
496 | case ACPI_TYPE_BUFFER: | 499 | case ACPI_TYPE_BUFFER: |
497 | 500 | ||
498 | /* Valid operand */ | 501 | /* Valid operand */ |
499 | break; | 502 | break; |
500 | 503 | ||
501 | default: | 504 | default: |
502 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 505 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
503 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 506 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
504 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 507 | acpi_ut_get_object_type_name |
508 | (obj_desc), obj_desc)); | ||
505 | 509 | ||
506 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 510 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
507 | } | 511 | } |
508 | goto next_operand; | 512 | goto next_operand; |
509 | 513 | ||
510 | |||
511 | case ARGI_BUFFER_OR_STRING: | 514 | case ARGI_BUFFER_OR_STRING: |
512 | 515 | ||
513 | /* Need an operand of type STRING or BUFFER */ | 516 | /* Need an operand of type STRING or BUFFER */ |
514 | 517 | ||
515 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 518 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
516 | case ACPI_TYPE_STRING: | 519 | case ACPI_TYPE_STRING: |
517 | case ACPI_TYPE_BUFFER: | 520 | case ACPI_TYPE_BUFFER: |
518 | 521 | ||
519 | /* Valid operand */ | 522 | /* Valid operand */ |
520 | break; | 523 | break; |
521 | 524 | ||
522 | case ACPI_TYPE_INTEGER: | 525 | case ACPI_TYPE_INTEGER: |
523 | 526 | ||
524 | /* Highest priority conversion is to type Buffer */ | 527 | /* Highest priority conversion is to type Buffer */ |
525 | 528 | ||
526 | status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); | 529 | status = |
527 | if (ACPI_FAILURE (status)) { | 530 | acpi_ex_convert_to_buffer(obj_desc, |
528 | return_ACPI_STATUS (status); | 531 | stack_ptr); |
532 | if (ACPI_FAILURE(status)) { | ||
533 | return_ACPI_STATUS(status); | ||
529 | } | 534 | } |
530 | 535 | ||
531 | if (obj_desc != *stack_ptr) { | 536 | if (obj_desc != *stack_ptr) { |
532 | acpi_ut_remove_reference (obj_desc); | 537 | acpi_ut_remove_reference(obj_desc); |
533 | } | 538 | } |
534 | break; | 539 | break; |
535 | 540 | ||
536 | default: | 541 | default: |
537 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 542 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
538 | "Needed [Integer/String/Buffer], found [%s] %p\n", | 543 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
539 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 544 | acpi_ut_get_object_type_name |
545 | (obj_desc), obj_desc)); | ||
540 | 546 | ||
541 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 547 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
542 | } | 548 | } |
543 | goto next_operand; | 549 | goto next_operand; |
544 | 550 | ||
545 | |||
546 | case ARGI_DATAOBJECT: | 551 | case ARGI_DATAOBJECT: |
547 | /* | 552 | /* |
548 | * ARGI_DATAOBJECT is only used by the size_of operator. | 553 | * ARGI_DATAOBJECT is only used by the size_of operator. |
@@ -551,7 +556,7 @@ acpi_ex_resolve_operands ( | |||
551 | * The only reference allowed here is a direct reference to | 556 | * The only reference allowed here is a direct reference to |
552 | * a namespace node. | 557 | * a namespace node. |
553 | */ | 558 | */ |
554 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 559 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
555 | case ACPI_TYPE_PACKAGE: | 560 | case ACPI_TYPE_PACKAGE: |
556 | case ACPI_TYPE_STRING: | 561 | case ACPI_TYPE_STRING: |
557 | case ACPI_TYPE_BUFFER: | 562 | case ACPI_TYPE_BUFFER: |
@@ -561,20 +566,20 @@ acpi_ex_resolve_operands ( | |||
561 | break; | 566 | break; |
562 | 567 | ||
563 | default: | 568 | default: |
564 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 569 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
565 | "Needed [Buffer/String/Package/Reference], found [%s] %p\n", | 570 | "Needed [Buffer/String/Package/Reference], found [%s] %p\n", |
566 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 571 | acpi_ut_get_object_type_name |
572 | (obj_desc), obj_desc)); | ||
567 | 573 | ||
568 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 574 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
569 | } | 575 | } |
570 | goto next_operand; | 576 | goto next_operand; |
571 | 577 | ||
572 | |||
573 | case ARGI_COMPLEXOBJ: | 578 | case ARGI_COMPLEXOBJ: |
574 | 579 | ||
575 | /* Need a buffer or package or (ACPI 2.0) String */ | 580 | /* Need a buffer or package or (ACPI 2.0) String */ |
576 | 581 | ||
577 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 582 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
578 | case ACPI_TYPE_PACKAGE: | 583 | case ACPI_TYPE_PACKAGE: |
579 | case ACPI_TYPE_STRING: | 584 | case ACPI_TYPE_STRING: |
580 | case ACPI_TYPE_BUFFER: | 585 | case ACPI_TYPE_BUFFER: |
@@ -583,20 +588,20 @@ acpi_ex_resolve_operands ( | |||
583 | break; | 588 | break; |
584 | 589 | ||
585 | default: | 590 | default: |
586 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 591 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
587 | "Needed [Buffer/String/Package], found [%s] %p\n", | 592 | "Needed [Buffer/String/Package], found [%s] %p\n", |
588 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 593 | acpi_ut_get_object_type_name |
594 | (obj_desc), obj_desc)); | ||
589 | 595 | ||
590 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 596 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
591 | } | 597 | } |
592 | goto next_operand; | 598 | goto next_operand; |
593 | 599 | ||
594 | |||
595 | case ARGI_REGION_OR_FIELD: | 600 | case ARGI_REGION_OR_FIELD: |
596 | 601 | ||
597 | /* Need an operand of type REGION or a FIELD in a region */ | 602 | /* Need an operand of type REGION or a FIELD in a region */ |
598 | 603 | ||
599 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 604 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
600 | case ACPI_TYPE_REGION: | 605 | case ACPI_TYPE_REGION: |
601 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 606 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
602 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 607 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
@@ -606,20 +611,20 @@ acpi_ex_resolve_operands ( | |||
606 | break; | 611 | break; |
607 | 612 | ||
608 | default: | 613 | default: |
609 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 614 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
610 | "Needed [Region/region_field], found [%s] %p\n", | 615 | "Needed [Region/region_field], found [%s] %p\n", |
611 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 616 | acpi_ut_get_object_type_name |
617 | (obj_desc), obj_desc)); | ||
612 | 618 | ||
613 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 619 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
614 | } | 620 | } |
615 | goto next_operand; | 621 | goto next_operand; |
616 | 622 | ||
617 | |||
618 | case ARGI_DATAREFOBJ: | 623 | case ARGI_DATAREFOBJ: |
619 | 624 | ||
620 | /* Used by the Store() operator only */ | 625 | /* Used by the Store() operator only */ |
621 | 626 | ||
622 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 627 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
623 | case ACPI_TYPE_INTEGER: | 628 | case ACPI_TYPE_INTEGER: |
624 | case ACPI_TYPE_PACKAGE: | 629 | case ACPI_TYPE_PACKAGE: |
625 | case ACPI_TYPE_STRING: | 630 | case ACPI_TYPE_STRING: |
@@ -651,47 +656,46 @@ acpi_ex_resolve_operands ( | |||
651 | break; | 656 | break; |
652 | } | 657 | } |
653 | 658 | ||
654 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 659 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
655 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", | 660 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", |
656 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 661 | acpi_ut_get_object_type_name |
662 | (obj_desc), obj_desc)); | ||
657 | 663 | ||
658 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 664 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
659 | } | 665 | } |
660 | goto next_operand; | 666 | goto next_operand; |
661 | 667 | ||
662 | |||
663 | default: | 668 | default: |
664 | 669 | ||
665 | /* Unknown type */ | 670 | /* Unknown type */ |
666 | 671 | ||
667 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 672 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
668 | "Internal - Unknown ARGI (required operand) type %X\n", | 673 | "Internal - Unknown ARGI (required operand) type %X\n", |
669 | this_arg_type)); | 674 | this_arg_type)); |
670 | 675 | ||
671 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 676 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
672 | } | 677 | } |
673 | 678 | ||
674 | /* | 679 | /* |
675 | * Make sure that the original object was resolved to the | 680 | * Make sure that the original object was resolved to the |
676 | * required object type (Simple cases only). | 681 | * required object type (Simple cases only). |
677 | */ | 682 | */ |
678 | status = acpi_ex_check_object_type (type_needed, | 683 | status = acpi_ex_check_object_type(type_needed, |
679 | ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr); | 684 | ACPI_GET_OBJECT_TYPE |
680 | if (ACPI_FAILURE (status)) { | 685 | (*stack_ptr), *stack_ptr); |
681 | return_ACPI_STATUS (status); | 686 | if (ACPI_FAILURE(status)) { |
687 | return_ACPI_STATUS(status); | ||
682 | } | 688 | } |
683 | 689 | ||
684 | next_operand: | 690 | next_operand: |
685 | /* | 691 | /* |
686 | * If more operands needed, decrement stack_ptr to point | 692 | * If more operands needed, decrement stack_ptr to point |
687 | * to next operand on stack | 693 | * to next operand on stack |
688 | */ | 694 | */ |
689 | if (GET_CURRENT_ARG_TYPE (arg_types)) { | 695 | if (GET_CURRENT_ARG_TYPE(arg_types)) { |
690 | stack_ptr--; | 696 | stack_ptr--; |
691 | } | 697 | } |
692 | } | 698 | } |
693 | 699 | ||
694 | return_ACPI_STATUS (status); | 700 | return_ACPI_STATUS(status); |
695 | } | 701 | } |
696 | |||
697 | |||
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 59dbfeaa54c0..a7d8eea305c2 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -50,24 +49,18 @@ | |||
50 | #include <acpi/acnamesp.h> | 49 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acparser.h> | 50 | #include <acpi/acparser.h> |
52 | 51 | ||
53 | |||
54 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exstore") | 53 | ACPI_MODULE_NAME("exstore") |
56 | 54 | ||
57 | /* Local prototypes */ | 55 | /* Local prototypes */ |
58 | |||
59 | static void | 56 | static void |
60 | acpi_ex_do_debug_object ( | 57 | acpi_ex_do_debug_object(union acpi_operand_object *source_desc, |
61 | union acpi_operand_object *source_desc, | 58 | u32 level, u32 index); |
62 | u32 level, | ||
63 | u32 index); | ||
64 | 59 | ||
65 | static acpi_status | 60 | static acpi_status |
66 | acpi_ex_store_object_to_index ( | 61 | acpi_ex_store_object_to_index(union acpi_operand_object *val_desc, |
67 | union acpi_operand_object *val_desc, | 62 | union acpi_operand_object *dest_desc, |
68 | union acpi_operand_object *dest_desc, | 63 | struct acpi_walk_state *walk_state); |
69 | struct acpi_walk_state *walk_state); | ||
70 | |||
71 | 64 | ||
72 | /******************************************************************************* | 65 | /******************************************************************************* |
73 | * | 66 | * |
@@ -84,136 +77,146 @@ acpi_ex_store_object_to_index ( | |||
84 | ******************************************************************************/ | 77 | ******************************************************************************/ |
85 | 78 | ||
86 | static void | 79 | static void |
87 | acpi_ex_do_debug_object ( | 80 | acpi_ex_do_debug_object(union acpi_operand_object *source_desc, |
88 | union acpi_operand_object *source_desc, | 81 | u32 level, u32 index) |
89 | u32 level, | ||
90 | u32 index) | ||
91 | { | 82 | { |
92 | u32 i; | 83 | u32 i; |
93 | |||
94 | 84 | ||
95 | ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc); | 85 | ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc); |
96 | 86 | ||
97 | 87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | |
98 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | 88 | level, " ")); |
99 | level, " ")); | ||
100 | 89 | ||
101 | /* Display index for package output only */ | 90 | /* Display index for package output only */ |
102 | 91 | ||
103 | if (index > 0) { | 92 | if (index > 0) { |
104 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | 93 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
105 | "(%.2u) ", index -1)); | 94 | "(%.2u) ", index - 1)); |
106 | } | 95 | } |
107 | 96 | ||
108 | if (!source_desc) { | 97 | if (!source_desc) { |
109 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); | 98 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); |
110 | return_VOID; | 99 | return_VOID; |
111 | } | 100 | } |
112 | 101 | ||
113 | if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) { | 102 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { |
114 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", | 103 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ", |
115 | acpi_ut_get_object_type_name (source_desc))); | 104 | acpi_ut_get_object_type_name |
105 | (source_desc))); | ||
116 | 106 | ||
117 | if (!acpi_ut_valid_internal_object (source_desc)) { | 107 | if (!acpi_ut_valid_internal_object(source_desc)) { |
118 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | 108 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
119 | "%p, Invalid Internal Object!\n", source_desc)); | 109 | "%p, Invalid Internal Object!\n", |
120 | return_VOID; | 110 | source_desc)); |
111 | return_VOID; | ||
121 | } | 112 | } |
122 | } | 113 | } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == |
123 | else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) { | 114 | ACPI_DESC_TYPE_NAMED) { |
124 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", | 115 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", |
125 | acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type), | 116 | acpi_ut_get_type_name(((struct |
126 | source_desc)); | 117 | acpi_namespace_node |
118 | *)source_desc)-> | ||
119 | type), | ||
120 | source_desc)); | ||
127 | return_VOID; | 121 | return_VOID; |
128 | } | 122 | } else { |
129 | else { | ||
130 | return_VOID; | 123 | return_VOID; |
131 | } | 124 | } |
132 | 125 | ||
133 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | 126 | switch (ACPI_GET_OBJECT_TYPE(source_desc)) { |
134 | case ACPI_TYPE_INTEGER: | 127 | case ACPI_TYPE_INTEGER: |
135 | 128 | ||
136 | /* Output correct integer width */ | 129 | /* Output correct integer width */ |
137 | 130 | ||
138 | if (acpi_gbl_integer_byte_width == 4) { | 131 | if (acpi_gbl_integer_byte_width == 4) { |
139 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", | 132 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", |
140 | (u32) source_desc->integer.value)); | 133 | (u32) source_desc->integer. |
141 | } | 134 | value)); |
142 | else { | 135 | } else { |
143 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", | 136 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
144 | ACPI_FORMAT_UINT64 (source_desc->integer.value))); | 137 | "0x%8.8X%8.8X\n", |
138 | ACPI_FORMAT_UINT64(source_desc-> | ||
139 | integer. | ||
140 | value))); | ||
145 | } | 141 | } |
146 | break; | 142 | break; |
147 | 143 | ||
148 | case ACPI_TYPE_BUFFER: | 144 | case ACPI_TYPE_BUFFER: |
149 | 145 | ||
150 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", | 146 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", |
151 | (u32) source_desc->buffer.length)); | 147 | (u32) source_desc->buffer.length)); |
152 | ACPI_DUMP_BUFFER (source_desc->buffer.pointer, | 148 | ACPI_DUMP_BUFFER(source_desc->buffer.pointer, |
153 | (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); | 149 | (source_desc->buffer.length < |
150 | 32) ? source_desc->buffer.length : 32); | ||
154 | break; | 151 | break; |
155 | 152 | ||
156 | case ACPI_TYPE_STRING: | 153 | case ACPI_TYPE_STRING: |
157 | 154 | ||
158 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", | 155 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", |
159 | source_desc->string.length, source_desc->string.pointer)); | 156 | source_desc->string.length, |
157 | source_desc->string.pointer)); | ||
160 | break; | 158 | break; |
161 | 159 | ||
162 | case ACPI_TYPE_PACKAGE: | 160 | case ACPI_TYPE_PACKAGE: |
163 | 161 | ||
164 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", | 162 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
165 | source_desc->package.count)); | 163 | "[0x%.2X Elements]\n", |
164 | source_desc->package.count)); | ||
166 | 165 | ||
167 | /* Output the entire contents of the package */ | 166 | /* Output the entire contents of the package */ |
168 | 167 | ||
169 | for (i = 0; i < source_desc->package.count; i++) { | 168 | for (i = 0; i < source_desc->package.count; i++) { |
170 | acpi_ex_do_debug_object (source_desc->package.elements[i], | 169 | acpi_ex_do_debug_object(source_desc->package. |
171 | level+4, i+1); | 170 | elements[i], level + 4, i + 1); |
172 | } | 171 | } |
173 | break; | 172 | break; |
174 | 173 | ||
175 | case ACPI_TYPE_LOCAL_REFERENCE: | 174 | case ACPI_TYPE_LOCAL_REFERENCE: |
176 | 175 | ||
177 | if (source_desc->reference.opcode == AML_INDEX_OP) { | 176 | if (source_desc->reference.opcode == AML_INDEX_OP) { |
178 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n", | 177 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
179 | acpi_ps_get_opcode_name (source_desc->reference.opcode), | 178 | "[%s, 0x%X]\n", |
180 | source_desc->reference.offset)); | 179 | acpi_ps_get_opcode_name |
180 | (source_desc->reference.opcode), | ||
181 | source_desc->reference.offset)); | ||
182 | } else { | ||
183 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n", | ||
184 | acpi_ps_get_opcode_name | ||
185 | (source_desc->reference.opcode))); | ||
181 | } | 186 | } |
182 | else { | ||
183 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n", | ||
184 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); | ||
185 | } | ||
186 | |||
187 | 187 | ||
188 | if (source_desc->reference.object) { | 188 | if (source_desc->reference.object) { |
189 | if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == | 189 | if (ACPI_GET_DESCRIPTOR_TYPE |
190 | ACPI_DESC_TYPE_NAMED) { | 190 | (source_desc->reference.object) == |
191 | acpi_ex_do_debug_object (((struct acpi_namespace_node *) | 191 | ACPI_DESC_TYPE_NAMED) { |
192 | source_desc->reference.object)->object, | 192 | acpi_ex_do_debug_object(((struct |
193 | level+4, 0); | 193 | acpi_namespace_node *) |
194 | source_desc->reference. | ||
195 | object)->object, | ||
196 | level + 4, 0); | ||
197 | } else { | ||
198 | acpi_ex_do_debug_object(source_desc->reference. | ||
199 | object, level + 4, 0); | ||
194 | } | 200 | } |
195 | else { | 201 | } else if (source_desc->reference.node) { |
196 | acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0); | 202 | acpi_ex_do_debug_object((source_desc->reference.node)-> |
197 | } | 203 | object, level + 4, 0); |
198 | } | ||
199 | else if (source_desc->reference.node) { | ||
200 | acpi_ex_do_debug_object ((source_desc->reference.node)->object, | ||
201 | level+4, 0); | ||
202 | } | 204 | } |
203 | break; | 205 | break; |
204 | 206 | ||
205 | default: | 207 | default: |
206 | 208 | ||
207 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", | 209 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n", |
208 | source_desc, acpi_ut_get_object_type_name (source_desc))); | 210 | source_desc, |
211 | acpi_ut_get_object_type_name | ||
212 | (source_desc))); | ||
209 | break; | 213 | break; |
210 | } | 214 | } |
211 | 215 | ||
212 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); | 216 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n")); |
213 | return_VOID; | 217 | return_VOID; |
214 | } | 218 | } |
215 | 219 | ||
216 | |||
217 | /******************************************************************************* | 220 | /******************************************************************************* |
218 | * | 221 | * |
219 | * FUNCTION: acpi_ex_store | 222 | * FUNCTION: acpi_ex_store |
@@ -235,42 +238,41 @@ acpi_ex_do_debug_object ( | |||
235 | ******************************************************************************/ | 238 | ******************************************************************************/ |
236 | 239 | ||
237 | acpi_status | 240 | acpi_status |
238 | acpi_ex_store ( | 241 | acpi_ex_store(union acpi_operand_object *source_desc, |
239 | union acpi_operand_object *source_desc, | 242 | union acpi_operand_object *dest_desc, |
240 | union acpi_operand_object *dest_desc, | 243 | struct acpi_walk_state *walk_state) |
241 | struct acpi_walk_state *walk_state) | ||
242 | { | 244 | { |
243 | acpi_status status = AE_OK; | 245 | acpi_status status = AE_OK; |
244 | union acpi_operand_object *ref_desc = dest_desc; | 246 | union acpi_operand_object *ref_desc = dest_desc; |
245 | |||
246 | |||
247 | ACPI_FUNCTION_TRACE_PTR ("ex_store", dest_desc); | ||
248 | 247 | ||
248 | ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc); | ||
249 | 249 | ||
250 | /* Validate parameters */ | 250 | /* Validate parameters */ |
251 | 251 | ||
252 | if (!source_desc || !dest_desc) { | 252 | if (!source_desc || !dest_desc) { |
253 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n")); | 253 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n")); |
254 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 254 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
255 | } | 255 | } |
256 | 256 | ||
257 | /* dest_desc can be either a namespace node or an ACPI object */ | 257 | /* dest_desc can be either a namespace node or an ACPI object */ |
258 | 258 | ||
259 | if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) { | 259 | if (ACPI_GET_DESCRIPTOR_TYPE(dest_desc) == ACPI_DESC_TYPE_NAMED) { |
260 | /* | 260 | /* |
261 | * Dest is a namespace node, | 261 | * Dest is a namespace node, |
262 | * Storing an object into a Named node. | 262 | * Storing an object into a Named node. |
263 | */ | 263 | */ |
264 | status = acpi_ex_store_object_to_node (source_desc, | 264 | status = acpi_ex_store_object_to_node(source_desc, |
265 | (struct acpi_namespace_node *) dest_desc, walk_state, | 265 | (struct |
266 | ACPI_IMPLICIT_CONVERSION); | 266 | acpi_namespace_node *) |
267 | dest_desc, walk_state, | ||
268 | ACPI_IMPLICIT_CONVERSION); | ||
267 | 269 | ||
268 | return_ACPI_STATUS (status); | 270 | return_ACPI_STATUS(status); |
269 | } | 271 | } |
270 | 272 | ||
271 | /* Destination object must be a Reference or a Constant object */ | 273 | /* Destination object must be a Reference or a Constant object */ |
272 | 274 | ||
273 | switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { | 275 | switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { |
274 | case ACPI_TYPE_LOCAL_REFERENCE: | 276 | case ACPI_TYPE_LOCAL_REFERENCE: |
275 | break; | 277 | break; |
276 | 278 | ||
@@ -279,7 +281,7 @@ acpi_ex_store ( | |||
279 | /* Allow stores to Constants -- a Noop as per ACPI spec */ | 281 | /* Allow stores to Constants -- a Noop as per ACPI spec */ |
280 | 282 | ||
281 | if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) { | 283 | if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) { |
282 | return_ACPI_STATUS (AE_OK); | 284 | return_ACPI_STATUS(AE_OK); |
283 | } | 285 | } |
284 | 286 | ||
285 | /*lint -fallthrough */ | 287 | /*lint -fallthrough */ |
@@ -288,16 +290,18 @@ acpi_ex_store ( | |||
288 | 290 | ||
289 | /* Destination is not a Reference object */ | 291 | /* Destination is not a Reference object */ |
290 | 292 | ||
291 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 293 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
292 | "Target is not a Reference or Constant object - %s [%p]\n", | 294 | "Target is not a Reference or Constant object - %s [%p]\n", |
293 | acpi_ut_get_object_type_name (dest_desc), dest_desc)); | 295 | acpi_ut_get_object_type_name(dest_desc), |
296 | dest_desc)); | ||
294 | 297 | ||
295 | ACPI_DUMP_STACK_ENTRY (source_desc); | 298 | ACPI_DUMP_STACK_ENTRY(source_desc); |
296 | ACPI_DUMP_STACK_ENTRY (dest_desc); | 299 | ACPI_DUMP_STACK_ENTRY(dest_desc); |
297 | ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", | 300 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", |
298 | 2, "Target is not a Reference or Constant object"); | 301 | 2, |
302 | "Target is not a Reference or Constant object"); | ||
299 | 303 | ||
300 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 304 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
301 | } | 305 | } |
302 | 306 | ||
303 | /* | 307 | /* |
@@ -314,58 +318,59 @@ acpi_ex_store ( | |||
314 | 318 | ||
315 | /* Storing an object into a Name "container" */ | 319 | /* Storing an object into a Name "container" */ |
316 | 320 | ||
317 | status = acpi_ex_store_object_to_node (source_desc, | 321 | status = acpi_ex_store_object_to_node(source_desc, |
318 | ref_desc->reference.object, | 322 | ref_desc->reference. |
319 | walk_state, ACPI_IMPLICIT_CONVERSION); | 323 | object, walk_state, |
324 | ACPI_IMPLICIT_CONVERSION); | ||
320 | break; | 325 | break; |
321 | 326 | ||
322 | |||
323 | case AML_INDEX_OP: | 327 | case AML_INDEX_OP: |
324 | 328 | ||
325 | /* Storing to an Index (pointer into a packager or buffer) */ | 329 | /* Storing to an Index (pointer into a packager or buffer) */ |
326 | 330 | ||
327 | status = acpi_ex_store_object_to_index (source_desc, ref_desc, walk_state); | 331 | status = |
332 | acpi_ex_store_object_to_index(source_desc, ref_desc, | ||
333 | walk_state); | ||
328 | break; | 334 | break; |
329 | 335 | ||
330 | |||
331 | case AML_LOCAL_OP: | 336 | case AML_LOCAL_OP: |
332 | case AML_ARG_OP: | 337 | case AML_ARG_OP: |
333 | 338 | ||
334 | /* Store to a method local/arg */ | 339 | /* Store to a method local/arg */ |
335 | 340 | ||
336 | status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, | 341 | status = |
337 | ref_desc->reference.offset, source_desc, walk_state); | 342 | acpi_ds_store_object_to_local(ref_desc->reference.opcode, |
343 | ref_desc->reference.offset, | ||
344 | source_desc, walk_state); | ||
338 | break; | 345 | break; |
339 | 346 | ||
340 | |||
341 | case AML_DEBUG_OP: | 347 | case AML_DEBUG_OP: |
342 | 348 | ||
343 | /* | 349 | /* |
344 | * Storing to the Debug object causes the value stored to be | 350 | * Storing to the Debug object causes the value stored to be |
345 | * displayed and otherwise has no effect -- see ACPI Specification | 351 | * displayed and otherwise has no effect -- see ACPI Specification |
346 | */ | 352 | */ |
347 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 353 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
348 | "**** Write to Debug Object: Object %p %s ****:\n\n", | 354 | "**** Write to Debug Object: Object %p %s ****:\n\n", |
349 | source_desc, acpi_ut_get_object_type_name (source_desc))); | 355 | source_desc, |
356 | acpi_ut_get_object_type_name(source_desc))); | ||
350 | 357 | ||
351 | acpi_ex_do_debug_object (source_desc, 0, 0); | 358 | acpi_ex_do_debug_object(source_desc, 0, 0); |
352 | break; | 359 | break; |
353 | 360 | ||
354 | |||
355 | default: | 361 | default: |
356 | 362 | ||
357 | ACPI_REPORT_ERROR (("ex_store: Unknown Reference opcode %X\n", | 363 | ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n", |
358 | ref_desc->reference.opcode)); | 364 | ref_desc->reference.opcode)); |
359 | ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR); | 365 | ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); |
360 | 366 | ||
361 | status = AE_AML_INTERNAL; | 367 | status = AE_AML_INTERNAL; |
362 | break; | 368 | break; |
363 | } | 369 | } |
364 | 370 | ||
365 | return_ACPI_STATUS (status); | 371 | return_ACPI_STATUS(status); |
366 | } | 372 | } |
367 | 373 | ||
368 | |||
369 | /******************************************************************************* | 374 | /******************************************************************************* |
370 | * | 375 | * |
371 | * FUNCTION: acpi_ex_store_object_to_index | 376 | * FUNCTION: acpi_ex_store_object_to_index |
@@ -381,20 +386,17 @@ acpi_ex_store ( | |||
381 | ******************************************************************************/ | 386 | ******************************************************************************/ |
382 | 387 | ||
383 | static acpi_status | 388 | static acpi_status |
384 | acpi_ex_store_object_to_index ( | 389 | acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, |
385 | union acpi_operand_object *source_desc, | 390 | union acpi_operand_object *index_desc, |
386 | union acpi_operand_object *index_desc, | 391 | struct acpi_walk_state *walk_state) |
387 | struct acpi_walk_state *walk_state) | ||
388 | { | 392 | { |
389 | acpi_status status = AE_OK; | 393 | acpi_status status = AE_OK; |
390 | union acpi_operand_object *obj_desc; | 394 | union acpi_operand_object *obj_desc; |
391 | union acpi_operand_object *new_desc; | 395 | union acpi_operand_object *new_desc; |
392 | u8 value = 0; | 396 | u8 value = 0; |
393 | u32 i; | 397 | u32 i; |
394 | |||
395 | |||
396 | ACPI_FUNCTION_TRACE ("ex_store_object_to_index"); | ||
397 | 398 | ||
399 | ACPI_FUNCTION_TRACE("ex_store_object_to_index"); | ||
398 | 400 | ||
399 | /* | 401 | /* |
400 | * Destination must be a reference pointer, and | 402 | * Destination must be a reference pointer, and |
@@ -413,19 +415,20 @@ acpi_ex_store_object_to_index ( | |||
413 | */ | 415 | */ |
414 | obj_desc = *(index_desc->reference.where); | 416 | obj_desc = *(index_desc->reference.where); |
415 | 417 | ||
416 | status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state); | 418 | status = |
417 | if (ACPI_FAILURE (status)) { | 419 | acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc, |
418 | return_ACPI_STATUS (status); | 420 | walk_state); |
421 | if (ACPI_FAILURE(status)) { | ||
422 | return_ACPI_STATUS(status); | ||
419 | } | 423 | } |
420 | 424 | ||
421 | if (obj_desc) { | 425 | if (obj_desc) { |
422 | /* Decrement reference count by the ref count of the parent package */ | 426 | /* Decrement reference count by the ref count of the parent package */ |
423 | 427 | ||
424 | for (i = 0; | 428 | for (i = 0; i < ((union acpi_operand_object *) |
425 | i < ((union acpi_operand_object *) | 429 | index_desc->reference.object)->common. |
426 | index_desc->reference.object)->common.reference_count; | 430 | reference_count; i++) { |
427 | i++) { | 431 | acpi_ut_remove_reference(obj_desc); |
428 | acpi_ut_remove_reference (obj_desc); | ||
429 | } | 432 | } |
430 | } | 433 | } |
431 | 434 | ||
@@ -433,16 +436,14 @@ acpi_ex_store_object_to_index ( | |||
433 | 436 | ||
434 | /* Increment ref count by the ref count of the parent package-1 */ | 437 | /* Increment ref count by the ref count of the parent package-1 */ |
435 | 438 | ||
436 | for (i = 1; | 439 | for (i = 1; i < ((union acpi_operand_object *) |
437 | i < ((union acpi_operand_object *) | 440 | index_desc->reference.object)->common. |
438 | index_desc->reference.object)->common.reference_count; | 441 | reference_count; i++) { |
439 | i++) { | 442 | acpi_ut_add_reference(new_desc); |
440 | acpi_ut_add_reference (new_desc); | ||
441 | } | 443 | } |
442 | 444 | ||
443 | break; | 445 | break; |
444 | 446 | ||
445 | |||
446 | case ACPI_TYPE_BUFFER_FIELD: | 447 | case ACPI_TYPE_BUFFER_FIELD: |
447 | 448 | ||
448 | /* | 449 | /* |
@@ -460,16 +461,16 @@ acpi_ex_store_object_to_index ( | |||
460 | * by the INDEX_OP code. | 461 | * by the INDEX_OP code. |
461 | */ | 462 | */ |
462 | obj_desc = index_desc->reference.object; | 463 | obj_desc = index_desc->reference.object; |
463 | if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) && | 464 | if ((ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_BUFFER) && |
464 | (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) { | 465 | (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_STRING)) { |
465 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 466 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
466 | } | 467 | } |
467 | 468 | ||
468 | /* | 469 | /* |
469 | * The assignment of the individual elements will be slightly | 470 | * The assignment of the individual elements will be slightly |
470 | * different for each source type. | 471 | * different for each source type. |
471 | */ | 472 | */ |
472 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | 473 | switch (ACPI_GET_OBJECT_TYPE(source_desc)) { |
473 | case ACPI_TYPE_INTEGER: | 474 | case ACPI_TYPE_INTEGER: |
474 | 475 | ||
475 | /* Use the least-significant byte of the integer */ | 476 | /* Use the least-significant byte of the integer */ |
@@ -489,10 +490,11 @@ acpi_ex_store_object_to_index ( | |||
489 | 490 | ||
490 | /* All other types are invalid */ | 491 | /* All other types are invalid */ |
491 | 492 | ||
492 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 493 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
493 | "Source must be Integer/Buffer/String type, not %s\n", | 494 | "Source must be Integer/Buffer/String type, not %s\n", |
494 | acpi_ut_get_object_type_name (source_desc))); | 495 | acpi_ut_get_object_type_name |
495 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 496 | (source_desc))); |
497 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
496 | } | 498 | } |
497 | 499 | ||
498 | /* Store the source value into the target buffer byte */ | 500 | /* Store the source value into the target buffer byte */ |
@@ -500,18 +502,16 @@ acpi_ex_store_object_to_index ( | |||
500 | obj_desc->buffer.pointer[index_desc->reference.offset] = value; | 502 | obj_desc->buffer.pointer[index_desc->reference.offset] = value; |
501 | break; | 503 | break; |
502 | 504 | ||
503 | |||
504 | default: | 505 | default: |
505 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 506 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
506 | "Target is not a Package or buffer_field\n")); | 507 | "Target is not a Package or buffer_field\n")); |
507 | status = AE_AML_OPERAND_TYPE; | 508 | status = AE_AML_OPERAND_TYPE; |
508 | break; | 509 | break; |
509 | } | 510 | } |
510 | 511 | ||
511 | return_ACPI_STATUS (status); | 512 | return_ACPI_STATUS(status); |
512 | } | 513 | } |
513 | 514 | ||
514 | |||
515 | /******************************************************************************* | 515 | /******************************************************************************* |
516 | * | 516 | * |
517 | * FUNCTION: acpi_ex_store_object_to_node | 517 | * FUNCTION: acpi_ex_store_object_to_node |
@@ -539,37 +539,35 @@ acpi_ex_store_object_to_index ( | |||
539 | ******************************************************************************/ | 539 | ******************************************************************************/ |
540 | 540 | ||
541 | acpi_status | 541 | acpi_status |
542 | acpi_ex_store_object_to_node ( | 542 | acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, |
543 | union acpi_operand_object *source_desc, | 543 | struct acpi_namespace_node *node, |
544 | struct acpi_namespace_node *node, | 544 | struct acpi_walk_state *walk_state, |
545 | struct acpi_walk_state *walk_state, | 545 | u8 implicit_conversion) |
546 | u8 implicit_conversion) | ||
547 | { | 546 | { |
548 | acpi_status status = AE_OK; | 547 | acpi_status status = AE_OK; |
549 | union acpi_operand_object *target_desc; | 548 | union acpi_operand_object *target_desc; |
550 | union acpi_operand_object *new_desc; | 549 | union acpi_operand_object *new_desc; |
551 | acpi_object_type target_type; | 550 | acpi_object_type target_type; |
552 | |||
553 | |||
554 | ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); | ||
555 | 551 | ||
552 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc); | ||
556 | 553 | ||
557 | /* Get current type of the node, and object attached to Node */ | 554 | /* Get current type of the node, and object attached to Node */ |
558 | 555 | ||
559 | target_type = acpi_ns_get_type (node); | 556 | target_type = acpi_ns_get_type(node); |
560 | target_desc = acpi_ns_get_attached_object (node); | 557 | target_desc = acpi_ns_get_attached_object(node); |
561 | 558 | ||
562 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", | 559 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", |
563 | source_desc, acpi_ut_get_object_type_name (source_desc), | 560 | source_desc, |
564 | node, acpi_ut_get_type_name (target_type))); | 561 | acpi_ut_get_object_type_name(source_desc), node, |
562 | acpi_ut_get_type_name(target_type))); | ||
565 | 563 | ||
566 | /* | 564 | /* |
567 | * Resolve the source object to an actual value | 565 | * Resolve the source object to an actual value |
568 | * (If it is a reference object) | 566 | * (If it is a reference object) |
569 | */ | 567 | */ |
570 | status = acpi_ex_resolve_object (&source_desc, target_type, walk_state); | 568 | status = acpi_ex_resolve_object(&source_desc, target_type, walk_state); |
571 | if (ACPI_FAILURE (status)) { | 569 | if (ACPI_FAILURE(status)) { |
572 | return_ACPI_STATUS (status); | 570 | return_ACPI_STATUS(status); |
573 | } | 571 | } |
574 | 572 | ||
575 | /* If no implicit conversion, drop into the default case below */ | 573 | /* If no implicit conversion, drop into the default case below */ |
@@ -590,11 +588,10 @@ acpi_ex_store_object_to_node ( | |||
590 | 588 | ||
591 | /* For fields, copy the source data to the target field. */ | 589 | /* For fields, copy the source data to the target field. */ |
592 | 590 | ||
593 | status = acpi_ex_write_data_to_field (source_desc, target_desc, | 591 | status = acpi_ex_write_data_to_field(source_desc, target_desc, |
594 | &walk_state->result_obj); | 592 | &walk_state->result_obj); |
595 | break; | 593 | break; |
596 | 594 | ||
597 | |||
598 | case ACPI_TYPE_INTEGER: | 595 | case ACPI_TYPE_INTEGER: |
599 | case ACPI_TYPE_STRING: | 596 | case ACPI_TYPE_STRING: |
600 | case ACPI_TYPE_BUFFER: | 597 | case ACPI_TYPE_BUFFER: |
@@ -605,10 +602,11 @@ acpi_ex_store_object_to_node ( | |||
605 | * | 602 | * |
606 | * Copy and/or convert the source object to a new target object | 603 | * Copy and/or convert the source object to a new target object |
607 | */ | 604 | */ |
608 | status = acpi_ex_store_object_to_object (source_desc, target_desc, | 605 | status = |
609 | &new_desc, walk_state); | 606 | acpi_ex_store_object_to_object(source_desc, target_desc, |
610 | if (ACPI_FAILURE (status)) { | 607 | &new_desc, walk_state); |
611 | return_ACPI_STATUS (status); | 608 | if (ACPI_FAILURE(status)) { |
609 | return_ACPI_STATUS(status); | ||
612 | } | 610 | } |
613 | 611 | ||
614 | if (new_desc != target_desc) { | 612 | if (new_desc != target_desc) { |
@@ -621,30 +619,33 @@ acpi_ex_store_object_to_node ( | |||
621 | * has been performed such that the node/object type has been | 619 | * has been performed such that the node/object type has been |
622 | * changed. | 620 | * changed. |
623 | */ | 621 | */ |
624 | status = acpi_ns_attach_object (node, new_desc, new_desc->common.type); | 622 | status = |
625 | 623 | acpi_ns_attach_object(node, new_desc, | |
626 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 624 | new_desc->common.type); |
627 | "Store %s into %s via Convert/Attach\n", | 625 | |
628 | acpi_ut_get_object_type_name (source_desc), | 626 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
629 | acpi_ut_get_object_type_name (new_desc))); | 627 | "Store %s into %s via Convert/Attach\n", |
628 | acpi_ut_get_object_type_name | ||
629 | (source_desc), | ||
630 | acpi_ut_get_object_type_name | ||
631 | (new_desc))); | ||
630 | } | 632 | } |
631 | break; | 633 | break; |
632 | 634 | ||
633 | |||
634 | default: | 635 | default: |
635 | 636 | ||
636 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 637 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
637 | "Storing %s (%p) directly into node (%p) with no implicit conversion\n", | 638 | "Storing %s (%p) directly into node (%p) with no implicit conversion\n", |
638 | acpi_ut_get_object_type_name (source_desc), source_desc, node)); | 639 | acpi_ut_get_object_type_name(source_desc), |
640 | source_desc, node)); | ||
639 | 641 | ||
640 | /* No conversions for all other types. Just attach the source object */ | 642 | /* No conversions for all other types. Just attach the source object */ |
641 | 643 | ||
642 | status = acpi_ns_attach_object (node, source_desc, | 644 | status = acpi_ns_attach_object(node, source_desc, |
643 | ACPI_GET_OBJECT_TYPE (source_desc)); | 645 | ACPI_GET_OBJECT_TYPE |
646 | (source_desc)); | ||
644 | break; | 647 | break; |
645 | } | 648 | } |
646 | 649 | ||
647 | return_ACPI_STATUS (status); | 650 | return_ACPI_STATUS(status); |
648 | } | 651 | } |
649 | |||
650 | |||
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 433588ab432a..382f63c14ea1 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -43,15 +43,12 @@ | |||
43 | * POSSIBILITY OF SUCH DAMAGES. | 43 | * POSSIBILITY OF SUCH DAMAGES. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | |||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
49 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exstoren") | 51 | ACPI_MODULE_NAME("exstoren") |
54 | |||
55 | 52 | ||
56 | /******************************************************************************* | 53 | /******************************************************************************* |
57 | * | 54 | * |
@@ -67,19 +64,15 @@ | |||
67 | * it and return the actual object in the source_desc_ptr. | 64 | * it and return the actual object in the source_desc_ptr. |
68 | * | 65 | * |
69 | ******************************************************************************/ | 66 | ******************************************************************************/ |
70 | |||
71 | acpi_status | 67 | acpi_status |
72 | acpi_ex_resolve_object ( | 68 | acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, |
73 | union acpi_operand_object **source_desc_ptr, | 69 | acpi_object_type target_type, |
74 | acpi_object_type target_type, | 70 | struct acpi_walk_state *walk_state) |
75 | struct acpi_walk_state *walk_state) | ||
76 | { | 71 | { |
77 | union acpi_operand_object *source_desc = *source_desc_ptr; | 72 | union acpi_operand_object *source_desc = *source_desc_ptr; |
78 | acpi_status status = AE_OK; | 73 | acpi_status status = AE_OK; |
79 | |||
80 | |||
81 | ACPI_FUNCTION_TRACE ("ex_resolve_object"); | ||
82 | 74 | ||
75 | ACPI_FUNCTION_TRACE("ex_resolve_object"); | ||
83 | 76 | ||
84 | /* Ensure we have a Target that can be stored to */ | 77 | /* Ensure we have a Target that can be stored to */ |
85 | 78 | ||
@@ -102,11 +95,14 @@ acpi_ex_resolve_object ( | |||
102 | * are all essentially the same. This case handles the | 95 | * are all essentially the same. This case handles the |
103 | * "interchangeable" types Integer, String, and Buffer. | 96 | * "interchangeable" types Integer, String, and Buffer. |
104 | */ | 97 | */ |
105 | if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 98 | if (ACPI_GET_OBJECT_TYPE(source_desc) == |
99 | ACPI_TYPE_LOCAL_REFERENCE) { | ||
106 | /* Resolve a reference object first */ | 100 | /* Resolve a reference object first */ |
107 | 101 | ||
108 | status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state); | 102 | status = |
109 | if (ACPI_FAILURE (status)) { | 103 | acpi_ex_resolve_to_value(source_desc_ptr, |
104 | walk_state); | ||
105 | if (ACPI_FAILURE(status)) { | ||
110 | break; | 106 | break; |
111 | } | 107 | } |
112 | } | 108 | } |
@@ -119,31 +115,32 @@ acpi_ex_resolve_object ( | |||
119 | 115 | ||
120 | /* Must have a Integer, Buffer, or String */ | 116 | /* Must have a Integer, Buffer, or String */ |
121 | 117 | ||
122 | if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && | 118 | if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) && |
123 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && | 119 | (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) && |
124 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && | 120 | (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) && |
125 | !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { | 121 | !((ACPI_GET_OBJECT_TYPE(source_desc) == |
122 | ACPI_TYPE_LOCAL_REFERENCE) | ||
123 | && (source_desc->reference.opcode == AML_LOAD_OP))) { | ||
126 | /* Conversion successful but still not a valid type */ | 124 | /* Conversion successful but still not a valid type */ |
127 | 125 | ||
128 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 126 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
129 | "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", | 127 | "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", |
130 | acpi_ut_get_object_type_name (source_desc), | 128 | acpi_ut_get_object_type_name |
131 | acpi_ut_get_type_name (target_type))); | 129 | (source_desc), |
130 | acpi_ut_get_type_name(target_type))); | ||
132 | status = AE_AML_OPERAND_TYPE; | 131 | status = AE_AML_OPERAND_TYPE; |
133 | } | 132 | } |
134 | break; | 133 | break; |
135 | 134 | ||
136 | |||
137 | case ACPI_TYPE_LOCAL_ALIAS: | 135 | case ACPI_TYPE_LOCAL_ALIAS: |
138 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | 136 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: |
139 | 137 | ||
140 | /* Aliases are resolved by acpi_ex_prep_operands */ | 138 | /* Aliases are resolved by acpi_ex_prep_operands */ |
141 | 139 | ||
142 | ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); | 140 | ACPI_REPORT_ERROR(("Store into Alias - should never happen\n")); |
143 | status = AE_AML_INTERNAL; | 141 | status = AE_AML_INTERNAL; |
144 | break; | 142 | break; |
145 | 143 | ||
146 | |||
147 | case ACPI_TYPE_PACKAGE: | 144 | case ACPI_TYPE_PACKAGE: |
148 | default: | 145 | default: |
149 | 146 | ||
@@ -154,10 +151,9 @@ acpi_ex_resolve_object ( | |||
154 | break; | 151 | break; |
155 | } | 152 | } |
156 | 153 | ||
157 | return_ACPI_STATUS (status); | 154 | return_ACPI_STATUS(status); |
158 | } | 155 | } |
159 | 156 | ||
160 | |||
161 | /******************************************************************************* | 157 | /******************************************************************************* |
162 | * | 158 | * |
163 | * FUNCTION: acpi_ex_store_object_to_object | 159 | * FUNCTION: acpi_ex_store_object_to_object |
@@ -194,18 +190,15 @@ acpi_ex_resolve_object ( | |||
194 | ******************************************************************************/ | 190 | ******************************************************************************/ |
195 | 191 | ||
196 | acpi_status | 192 | acpi_status |
197 | acpi_ex_store_object_to_object ( | 193 | acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, |
198 | union acpi_operand_object *source_desc, | 194 | union acpi_operand_object *dest_desc, |
199 | union acpi_operand_object *dest_desc, | 195 | union acpi_operand_object **new_desc, |
200 | union acpi_operand_object **new_desc, | 196 | struct acpi_walk_state *walk_state) |
201 | struct acpi_walk_state *walk_state) | ||
202 | { | 197 | { |
203 | union acpi_operand_object *actual_src_desc; | 198 | union acpi_operand_object *actual_src_desc; |
204 | acpi_status status = AE_OK; | 199 | acpi_status status = AE_OK; |
205 | |||
206 | |||
207 | ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_object", source_desc); | ||
208 | 200 | ||
201 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc); | ||
209 | 202 | ||
210 | actual_src_desc = source_desc; | 203 | actual_src_desc = source_desc; |
211 | if (!dest_desc) { | 204 | if (!dest_desc) { |
@@ -214,11 +207,14 @@ acpi_ex_store_object_to_object ( | |||
214 | * package element), so we can simply copy the source object | 207 | * package element), so we can simply copy the source object |
215 | * creating a new destination object | 208 | * creating a new destination object |
216 | */ | 209 | */ |
217 | status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state); | 210 | status = |
218 | return_ACPI_STATUS (status); | 211 | acpi_ut_copy_iobject_to_iobject(actual_src_desc, new_desc, |
212 | walk_state); | ||
213 | return_ACPI_STATUS(status); | ||
219 | } | 214 | } |
220 | 215 | ||
221 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) { | 216 | if (ACPI_GET_OBJECT_TYPE(source_desc) != |
217 | ACPI_GET_OBJECT_TYPE(dest_desc)) { | ||
222 | /* | 218 | /* |
223 | * The source type does not match the type of the destination. | 219 | * The source type does not match the type of the destination. |
224 | * Perform the "implicit conversion" of the source to the current type | 220 | * Perform the "implicit conversion" of the source to the current type |
@@ -228,10 +224,13 @@ acpi_ex_store_object_to_object ( | |||
228 | * Otherwise, actual_src_desc is a temporary object to hold the | 224 | * Otherwise, actual_src_desc is a temporary object to hold the |
229 | * converted object. | 225 | * converted object. |
230 | */ | 226 | */ |
231 | status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc), | 227 | status = |
232 | source_desc, &actual_src_desc, walk_state); | 228 | acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE |
233 | if (ACPI_FAILURE (status)) { | 229 | (dest_desc), source_desc, |
234 | return_ACPI_STATUS (status); | 230 | &actual_src_desc, |
231 | walk_state); | ||
232 | if (ACPI_FAILURE(status)) { | ||
233 | return_ACPI_STATUS(status); | ||
235 | } | 234 | } |
236 | 235 | ||
237 | if (source_desc == actual_src_desc) { | 236 | if (source_desc == actual_src_desc) { |
@@ -240,7 +239,7 @@ acpi_ex_store_object_to_object ( | |||
240 | * new object. | 239 | * new object. |
241 | */ | 240 | */ |
242 | *new_desc = source_desc; | 241 | *new_desc = source_desc; |
243 | return_ACPI_STATUS (AE_OK); | 242 | return_ACPI_STATUS(AE_OK); |
244 | } | 243 | } |
245 | } | 244 | } |
246 | 245 | ||
@@ -248,38 +247,42 @@ acpi_ex_store_object_to_object ( | |||
248 | * We now have two objects of identical types, and we can perform a | 247 | * We now have two objects of identical types, and we can perform a |
249 | * copy of the *value* of the source object. | 248 | * copy of the *value* of the source object. |
250 | */ | 249 | */ |
251 | switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { | 250 | switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { |
252 | case ACPI_TYPE_INTEGER: | 251 | case ACPI_TYPE_INTEGER: |
253 | 252 | ||
254 | dest_desc->integer.value = actual_src_desc->integer.value; | 253 | dest_desc->integer.value = actual_src_desc->integer.value; |
255 | 254 | ||
256 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 255 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
257 | 256 | ||
258 | acpi_ex_truncate_for32bit_table (dest_desc); | 257 | acpi_ex_truncate_for32bit_table(dest_desc); |
259 | break; | 258 | break; |
260 | 259 | ||
261 | case ACPI_TYPE_STRING: | 260 | case ACPI_TYPE_STRING: |
262 | 261 | ||
263 | status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc); | 262 | status = |
263 | acpi_ex_store_string_to_string(actual_src_desc, dest_desc); | ||
264 | break; | 264 | break; |
265 | 265 | ||
266 | case ACPI_TYPE_BUFFER: | 266 | case ACPI_TYPE_BUFFER: |
267 | 267 | ||
268 | status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc); | 268 | status = |
269 | acpi_ex_store_buffer_to_buffer(actual_src_desc, dest_desc); | ||
269 | break; | 270 | break; |
270 | 271 | ||
271 | case ACPI_TYPE_PACKAGE: | 272 | case ACPI_TYPE_PACKAGE: |
272 | 273 | ||
273 | status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc, | 274 | status = |
274 | walk_state); | 275 | acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc, |
276 | walk_state); | ||
275 | break; | 277 | break; |
276 | 278 | ||
277 | default: | 279 | default: |
278 | /* | 280 | /* |
279 | * All other types come here. | 281 | * All other types come here. |
280 | */ | 282 | */ |
281 | ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n", | 283 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
282 | acpi_ut_get_object_type_name (dest_desc))); | 284 | "Store into type %s not implemented\n", |
285 | acpi_ut_get_object_type_name(dest_desc))); | ||
283 | 286 | ||
284 | status = AE_NOT_IMPLEMENTED; | 287 | status = AE_NOT_IMPLEMENTED; |
285 | break; | 288 | break; |
@@ -288,11 +291,9 @@ acpi_ex_store_object_to_object ( | |||
288 | if (actual_src_desc != source_desc) { | 291 | if (actual_src_desc != source_desc) { |
289 | /* Delete the intermediate (temporary) source object */ | 292 | /* Delete the intermediate (temporary) source object */ |
290 | 293 | ||
291 | acpi_ut_remove_reference (actual_src_desc); | 294 | acpi_ut_remove_reference(actual_src_desc); |
292 | } | 295 | } |
293 | 296 | ||
294 | *new_desc = dest_desc; | 297 | *new_desc = dest_desc; |
295 | return_ACPI_STATUS (status); | 298 | return_ACPI_STATUS(status); |
296 | } | 299 | } |
297 | |||
298 | |||
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 12d1527669c8..c4ff654a6697 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -42,14 +42,11 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exstorob") | 49 | ACPI_MODULE_NAME("exstorob") |
52 | |||
53 | 50 | ||
54 | /******************************************************************************* | 51 | /******************************************************************************* |
55 | * | 52 | * |
@@ -63,18 +60,14 @@ | |||
63 | * DESCRIPTION: Copy a buffer object to another buffer object. | 60 | * DESCRIPTION: Copy a buffer object to another buffer object. |
64 | * | 61 | * |
65 | ******************************************************************************/ | 62 | ******************************************************************************/ |
66 | |||
67 | acpi_status | 63 | acpi_status |
68 | acpi_ex_store_buffer_to_buffer ( | 64 | acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, |
69 | union acpi_operand_object *source_desc, | 65 | union acpi_operand_object *target_desc) |
70 | union acpi_operand_object *target_desc) | ||
71 | { | 66 | { |
72 | u32 length; | 67 | u32 length; |
73 | u8 *buffer; | 68 | u8 *buffer; |
74 | |||
75 | |||
76 | ACPI_FUNCTION_TRACE_PTR ("ex_store_buffer_to_buffer", source_desc); | ||
77 | 69 | ||
70 | ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); | ||
78 | 71 | ||
79 | /* We know that source_desc is a buffer by now */ | 72 | /* We know that source_desc is a buffer by now */ |
80 | 73 | ||
@@ -86,10 +79,10 @@ acpi_ex_store_buffer_to_buffer ( | |||
86 | * allocate a new buffer of the proper length | 79 | * allocate a new buffer of the proper length |
87 | */ | 80 | */ |
88 | if ((target_desc->buffer.length == 0) || | 81 | if ((target_desc->buffer.length == 0) || |
89 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { | 82 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { |
90 | target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length); | 83 | target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); |
91 | if (!target_desc->buffer.pointer) { | 84 | if (!target_desc->buffer.pointer) { |
92 | return_ACPI_STATUS (AE_NO_MEMORY); | 85 | return_ACPI_STATUS(AE_NO_MEMORY); |
93 | } | 86 | } |
94 | 87 | ||
95 | target_desc->buffer.length = length; | 88 | target_desc->buffer.length = length; |
@@ -100,8 +93,9 @@ acpi_ex_store_buffer_to_buffer ( | |||
100 | if (length <= target_desc->buffer.length) { | 93 | if (length <= target_desc->buffer.length) { |
101 | /* Clear existing buffer and copy in the new one */ | 94 | /* Clear existing buffer and copy in the new one */ |
102 | 95 | ||
103 | ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length); | 96 | ACPI_MEMSET(target_desc->buffer.pointer, 0, |
104 | ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length); | 97 | target_desc->buffer.length); |
98 | ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length); | ||
105 | 99 | ||
106 | #ifdef ACPI_OBSOLETE_BEHAVIOR | 100 | #ifdef ACPI_OBSOLETE_BEHAVIOR |
107 | /* | 101 | /* |
@@ -124,26 +118,24 @@ acpi_ex_store_buffer_to_buffer ( | |||
124 | target_desc->buffer.length = length; | 118 | target_desc->buffer.length = length; |
125 | } | 119 | } |
126 | #endif | 120 | #endif |
127 | } | 121 | } else { |
128 | else { | ||
129 | /* Truncate the source, copy only what will fit */ | 122 | /* Truncate the source, copy only what will fit */ |
130 | 123 | ||
131 | ACPI_MEMCPY (target_desc->buffer.pointer, buffer, | 124 | ACPI_MEMCPY(target_desc->buffer.pointer, buffer, |
132 | target_desc->buffer.length); | 125 | target_desc->buffer.length); |
133 | 126 | ||
134 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 127 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
135 | "Truncating source buffer from %X to %X\n", | 128 | "Truncating source buffer from %X to %X\n", |
136 | length, target_desc->buffer.length)); | 129 | length, target_desc->buffer.length)); |
137 | } | 130 | } |
138 | 131 | ||
139 | /* Copy flags */ | 132 | /* Copy flags */ |
140 | 133 | ||
141 | target_desc->buffer.flags = source_desc->buffer.flags; | 134 | target_desc->buffer.flags = source_desc->buffer.flags; |
142 | target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; | 135 | target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; |
143 | return_ACPI_STATUS (AE_OK); | 136 | return_ACPI_STATUS(AE_OK); |
144 | } | 137 | } |
145 | 138 | ||
146 | |||
147 | /******************************************************************************* | 139 | /******************************************************************************* |
148 | * | 140 | * |
149 | * FUNCTION: acpi_ex_store_string_to_string | 141 | * FUNCTION: acpi_ex_store_string_to_string |
@@ -158,16 +150,13 @@ acpi_ex_store_buffer_to_buffer ( | |||
158 | ******************************************************************************/ | 150 | ******************************************************************************/ |
159 | 151 | ||
160 | acpi_status | 152 | acpi_status |
161 | acpi_ex_store_string_to_string ( | 153 | acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, |
162 | union acpi_operand_object *source_desc, | 154 | union acpi_operand_object *target_desc) |
163 | union acpi_operand_object *target_desc) | ||
164 | { | 155 | { |
165 | u32 length; | 156 | u32 length; |
166 | u8 *buffer; | 157 | u8 *buffer; |
167 | |||
168 | |||
169 | ACPI_FUNCTION_TRACE_PTR ("ex_store_string_to_string", source_desc); | ||
170 | 158 | ||
159 | ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); | ||
171 | 160 | ||
172 | /* We know that source_desc is a string by now */ | 161 | /* We know that source_desc is a string by now */ |
173 | 162 | ||
@@ -179,41 +168,38 @@ acpi_ex_store_string_to_string ( | |||
179 | * pointer is not a static pointer (part of an ACPI table) | 168 | * pointer is not a static pointer (part of an ACPI table) |
180 | */ | 169 | */ |
181 | if ((length < target_desc->string.length) && | 170 | if ((length < target_desc->string.length) && |
182 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { | 171 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { |
183 | /* | 172 | /* |
184 | * String will fit in existing non-static buffer. | 173 | * String will fit in existing non-static buffer. |
185 | * Clear old string and copy in the new one | 174 | * Clear old string and copy in the new one |
186 | */ | 175 | */ |
187 | ACPI_MEMSET (target_desc->string.pointer, 0, | 176 | ACPI_MEMSET(target_desc->string.pointer, 0, |
188 | (acpi_size) target_desc->string.length + 1); | 177 | (acpi_size) target_desc->string.length + 1); |
189 | ACPI_MEMCPY (target_desc->string.pointer, buffer, length); | 178 | ACPI_MEMCPY(target_desc->string.pointer, buffer, length); |
190 | } | 179 | } else { |
191 | else { | ||
192 | /* | 180 | /* |
193 | * Free the current buffer, then allocate a new buffer | 181 | * Free the current buffer, then allocate a new buffer |
194 | * large enough to hold the value | 182 | * large enough to hold the value |
195 | */ | 183 | */ |
196 | if (target_desc->string.pointer && | 184 | if (target_desc->string.pointer && |
197 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { | 185 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { |
198 | /* Only free if not a pointer into the DSDT */ | 186 | /* Only free if not a pointer into the DSDT */ |
199 | 187 | ||
200 | ACPI_MEM_FREE (target_desc->string.pointer); | 188 | ACPI_MEM_FREE(target_desc->string.pointer); |
201 | } | 189 | } |
202 | 190 | ||
203 | target_desc->string.pointer = ACPI_MEM_CALLOCATE ( | 191 | target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) |
204 | (acpi_size) length + 1); | 192 | length + 1); |
205 | if (!target_desc->string.pointer) { | 193 | if (!target_desc->string.pointer) { |
206 | return_ACPI_STATUS (AE_NO_MEMORY); | 194 | return_ACPI_STATUS(AE_NO_MEMORY); |
207 | } | 195 | } |
208 | 196 | ||
209 | target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; | 197 | target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; |
210 | ACPI_MEMCPY (target_desc->string.pointer, buffer, length); | 198 | ACPI_MEMCPY(target_desc->string.pointer, buffer, length); |
211 | } | 199 | } |
212 | 200 | ||
213 | /* Set the new target length */ | 201 | /* Set the new target length */ |
214 | 202 | ||
215 | target_desc->string.length = length; | 203 | target_desc->string.length = length; |
216 | return_ACPI_STATUS (AE_OK); | 204 | return_ACPI_STATUS(AE_OK); |
217 | } | 205 | } |
218 | |||
219 | |||
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index cafa702108dc..8a88b841237d 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -42,14 +42,12 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
48 | #include <acpi/acevents.h> | 47 | #include <acpi/acevents.h> |
49 | 48 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exsystem") | 50 | ACPI_MODULE_NAME("exsystem") |
52 | |||
53 | 51 | ||
54 | /******************************************************************************* | 52 | /******************************************************************************* |
55 | * | 53 | * |
@@ -65,49 +63,42 @@ | |||
65 | * interpreter is released. | 63 | * interpreter is released. |
66 | * | 64 | * |
67 | ******************************************************************************/ | 65 | ******************************************************************************/ |
68 | 66 | acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |
69 | acpi_status | ||
70 | acpi_ex_system_wait_semaphore ( | ||
71 | acpi_handle semaphore, | ||
72 | u16 timeout) | ||
73 | { | 67 | { |
74 | acpi_status status; | 68 | acpi_status status; |
75 | acpi_status status2; | 69 | acpi_status status2; |
76 | |||
77 | 70 | ||
78 | ACPI_FUNCTION_TRACE ("ex_system_wait_semaphore"); | 71 | ACPI_FUNCTION_TRACE("ex_system_wait_semaphore"); |
79 | 72 | ||
80 | 73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); | |
81 | status = acpi_os_wait_semaphore (semaphore, 1, 0); | 74 | if (ACPI_SUCCESS(status)) { |
82 | if (ACPI_SUCCESS (status)) { | 75 | return_ACPI_STATUS(status); |
83 | return_ACPI_STATUS (status); | ||
84 | } | 76 | } |
85 | 77 | ||
86 | if (status == AE_TIME) { | 78 | if (status == AE_TIME) { |
87 | /* We must wait, so unlock the interpreter */ | 79 | /* We must wait, so unlock the interpreter */ |
88 | 80 | ||
89 | acpi_ex_exit_interpreter (); | 81 | acpi_ex_exit_interpreter(); |
90 | 82 | ||
91 | status = acpi_os_wait_semaphore (semaphore, 1, timeout); | 83 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
92 | 84 | ||
93 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 85 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
94 | "*** Thread awake after blocking, %s\n", | 86 | "*** Thread awake after blocking, %s\n", |
95 | acpi_format_exception (status))); | 87 | acpi_format_exception(status))); |
96 | 88 | ||
97 | /* Reacquire the interpreter */ | 89 | /* Reacquire the interpreter */ |
98 | 90 | ||
99 | status2 = acpi_ex_enter_interpreter (); | 91 | status2 = acpi_ex_enter_interpreter(); |
100 | if (ACPI_FAILURE (status2)) { | 92 | if (ACPI_FAILURE(status2)) { |
101 | /* Report fatal error, could not acquire interpreter */ | 93 | /* Report fatal error, could not acquire interpreter */ |
102 | 94 | ||
103 | return_ACPI_STATUS (status2); | 95 | return_ACPI_STATUS(status2); |
104 | } | 96 | } |
105 | } | 97 | } |
106 | 98 | ||
107 | return_ACPI_STATUS (status); | 99 | return_ACPI_STATUS(status); |
108 | } | 100 | } |
109 | 101 | ||
110 | |||
111 | /******************************************************************************* | 102 | /******************************************************************************* |
112 | * | 103 | * |
113 | * FUNCTION: acpi_ex_system_do_stall | 104 | * FUNCTION: acpi_ex_system_do_stall |
@@ -125,35 +116,29 @@ acpi_ex_system_wait_semaphore ( | |||
125 | * | 116 | * |
126 | ******************************************************************************/ | 117 | ******************************************************************************/ |
127 | 118 | ||
128 | acpi_status | 119 | acpi_status acpi_ex_system_do_stall(u32 how_long) |
129 | acpi_ex_system_do_stall ( | ||
130 | u32 how_long) | ||
131 | { | 120 | { |
132 | acpi_status status = AE_OK; | 121 | acpi_status status = AE_OK; |
133 | |||
134 | 122 | ||
135 | ACPI_FUNCTION_ENTRY (); | 123 | ACPI_FUNCTION_ENTRY(); |
136 | 124 | ||
137 | 125 | if (how_long > 255) { /* 255 microseconds */ | |
138 | if (how_long > 255) /* 255 microseconds */ { | ||
139 | /* | 126 | /* |
140 | * Longer than 255 usec, this is an error | 127 | * Longer than 255 usec, this is an error |
141 | * | 128 | * |
142 | * (ACPI specifies 100 usec as max, but this gives some slack in | 129 | * (ACPI specifies 100 usec as max, but this gives some slack in |
143 | * order to support existing BIOSs) | 130 | * order to support existing BIOSs) |
144 | */ | 131 | */ |
145 | ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", | 132 | ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n", |
146 | how_long)); | 133 | how_long)); |
147 | status = AE_AML_OPERAND_VALUE; | 134 | status = AE_AML_OPERAND_VALUE; |
148 | } | 135 | } else { |
149 | else { | 136 | acpi_os_stall(how_long); |
150 | acpi_os_stall (how_long); | ||
151 | } | 137 | } |
152 | 138 | ||
153 | return (status); | 139 | return (status); |
154 | } | 140 | } |
155 | 141 | ||
156 | |||
157 | /******************************************************************************* | 142 | /******************************************************************************* |
158 | * | 143 | * |
159 | * FUNCTION: acpi_ex_system_do_suspend | 144 | * FUNCTION: acpi_ex_system_do_suspend |
@@ -167,29 +152,24 @@ acpi_ex_system_do_stall ( | |||
167 | * | 152 | * |
168 | ******************************************************************************/ | 153 | ******************************************************************************/ |
169 | 154 | ||
170 | acpi_status | 155 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) |
171 | acpi_ex_system_do_suspend ( | ||
172 | acpi_integer how_long) | ||
173 | { | 156 | { |
174 | acpi_status status; | 157 | acpi_status status; |
175 | |||
176 | |||
177 | ACPI_FUNCTION_ENTRY (); | ||
178 | 158 | ||
159 | ACPI_FUNCTION_ENTRY(); | ||
179 | 160 | ||
180 | /* Since this thread will sleep, we must release the interpreter */ | 161 | /* Since this thread will sleep, we must release the interpreter */ |
181 | 162 | ||
182 | acpi_ex_exit_interpreter (); | 163 | acpi_ex_exit_interpreter(); |
183 | 164 | ||
184 | acpi_os_sleep (how_long); | 165 | acpi_os_sleep(how_long); |
185 | 166 | ||
186 | /* And now we must get the interpreter again */ | 167 | /* And now we must get the interpreter again */ |
187 | 168 | ||
188 | status = acpi_ex_enter_interpreter (); | 169 | status = acpi_ex_enter_interpreter(); |
189 | return (status); | 170 | return (status); |
190 | } | 171 | } |
191 | 172 | ||
192 | |||
193 | /******************************************************************************* | 173 | /******************************************************************************* |
194 | * | 174 | * |
195 | * FUNCTION: acpi_ex_system_acquire_mutex | 175 | * FUNCTION: acpi_ex_system_acquire_mutex |
@@ -206,33 +186,30 @@ acpi_ex_system_do_suspend ( | |||
206 | ******************************************************************************/ | 186 | ******************************************************************************/ |
207 | 187 | ||
208 | acpi_status | 188 | acpi_status |
209 | acpi_ex_system_acquire_mutex ( | 189 | acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, |
210 | union acpi_operand_object *time_desc, | 190 | union acpi_operand_object * obj_desc) |
211 | union acpi_operand_object *obj_desc) | ||
212 | { | 191 | { |
213 | acpi_status status = AE_OK; | 192 | acpi_status status = AE_OK; |
214 | |||
215 | |||
216 | ACPI_FUNCTION_TRACE_PTR ("ex_system_acquire_mutex", obj_desc); | ||
217 | 193 | ||
194 | ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc); | ||
218 | 195 | ||
219 | if (!obj_desc) { | 196 | if (!obj_desc) { |
220 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 197 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
221 | } | 198 | } |
222 | 199 | ||
223 | /* Support for the _GL_ Mutex object -- go get the global lock */ | 200 | /* Support for the _GL_ Mutex object -- go get the global lock */ |
224 | 201 | ||
225 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 202 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { |
226 | status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); | 203 | status = |
227 | return_ACPI_STATUS (status); | 204 | acpi_ev_acquire_global_lock((u16) time_desc->integer.value); |
205 | return_ACPI_STATUS(status); | ||
228 | } | 206 | } |
229 | 207 | ||
230 | status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, | 208 | status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore, |
231 | (u16) time_desc->integer.value); | 209 | (u16) time_desc->integer.value); |
232 | return_ACPI_STATUS (status); | 210 | return_ACPI_STATUS(status); |
233 | } | 211 | } |
234 | 212 | ||
235 | |||
236 | /******************************************************************************* | 213 | /******************************************************************************* |
237 | * | 214 | * |
238 | * FUNCTION: acpi_ex_system_release_mutex | 215 | * FUNCTION: acpi_ex_system_release_mutex |
@@ -248,32 +225,27 @@ acpi_ex_system_acquire_mutex ( | |||
248 | * | 225 | * |
249 | ******************************************************************************/ | 226 | ******************************************************************************/ |
250 | 227 | ||
251 | acpi_status | 228 | acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) |
252 | acpi_ex_system_release_mutex ( | ||
253 | union acpi_operand_object *obj_desc) | ||
254 | { | 229 | { |
255 | acpi_status status = AE_OK; | 230 | acpi_status status = AE_OK; |
256 | |||
257 | |||
258 | ACPI_FUNCTION_TRACE ("ex_system_release_mutex"); | ||
259 | 231 | ||
232 | ACPI_FUNCTION_TRACE("ex_system_release_mutex"); | ||
260 | 233 | ||
261 | if (!obj_desc) { | 234 | if (!obj_desc) { |
262 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 235 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
263 | } | 236 | } |
264 | 237 | ||
265 | /* Support for the _GL_ Mutex object -- release the global lock */ | 238 | /* Support for the _GL_ Mutex object -- release the global lock */ |
266 | 239 | ||
267 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 240 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { |
268 | status = acpi_ev_release_global_lock (); | 241 | status = acpi_ev_release_global_lock(); |
269 | return_ACPI_STATUS (status); | 242 | return_ACPI_STATUS(status); |
270 | } | 243 | } |
271 | 244 | ||
272 | status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1); | 245 | status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1); |
273 | return_ACPI_STATUS (status); | 246 | return_ACPI_STATUS(status); |
274 | } | 247 | } |
275 | 248 | ||
276 | |||
277 | /******************************************************************************* | 249 | /******************************************************************************* |
278 | * | 250 | * |
279 | * FUNCTION: acpi_ex_system_signal_event | 251 | * FUNCTION: acpi_ex_system_signal_event |
@@ -287,24 +259,19 @@ acpi_ex_system_release_mutex ( | |||
287 | * | 259 | * |
288 | ******************************************************************************/ | 260 | ******************************************************************************/ |
289 | 261 | ||
290 | acpi_status | 262 | acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) |
291 | acpi_ex_system_signal_event ( | ||
292 | union acpi_operand_object *obj_desc) | ||
293 | { | 263 | { |
294 | acpi_status status = AE_OK; | 264 | acpi_status status = AE_OK; |
295 | |||
296 | |||
297 | ACPI_FUNCTION_TRACE ("ex_system_signal_event"); | ||
298 | 265 | ||
266 | ACPI_FUNCTION_TRACE("ex_system_signal_event"); | ||
299 | 267 | ||
300 | if (obj_desc) { | 268 | if (obj_desc) { |
301 | status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1); | 269 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); |
302 | } | 270 | } |
303 | 271 | ||
304 | return_ACPI_STATUS (status); | 272 | return_ACPI_STATUS(status); |
305 | } | 273 | } |
306 | 274 | ||
307 | |||
308 | /******************************************************************************* | 275 | /******************************************************************************* |
309 | * | 276 | * |
310 | * FUNCTION: acpi_ex_system_wait_event | 277 | * FUNCTION: acpi_ex_system_wait_event |
@@ -321,25 +288,23 @@ acpi_ex_system_signal_event ( | |||
321 | ******************************************************************************/ | 288 | ******************************************************************************/ |
322 | 289 | ||
323 | acpi_status | 290 | acpi_status |
324 | acpi_ex_system_wait_event ( | 291 | acpi_ex_system_wait_event(union acpi_operand_object *time_desc, |
325 | union acpi_operand_object *time_desc, | 292 | union acpi_operand_object *obj_desc) |
326 | union acpi_operand_object *obj_desc) | ||
327 | { | 293 | { |
328 | acpi_status status = AE_OK; | 294 | acpi_status status = AE_OK; |
329 | |||
330 | |||
331 | ACPI_FUNCTION_TRACE ("ex_system_wait_event"); | ||
332 | 295 | ||
296 | ACPI_FUNCTION_TRACE("ex_system_wait_event"); | ||
333 | 297 | ||
334 | if (obj_desc) { | 298 | if (obj_desc) { |
335 | status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, | 299 | status = |
336 | (u16) time_desc->integer.value); | 300 | acpi_ex_system_wait_semaphore(obj_desc->event.semaphore, |
301 | (u16) time_desc->integer. | ||
302 | value); | ||
337 | } | 303 | } |
338 | 304 | ||
339 | return_ACPI_STATUS (status); | 305 | return_ACPI_STATUS(status); |
340 | } | 306 | } |
341 | 307 | ||
342 | |||
343 | /******************************************************************************* | 308 | /******************************************************************************* |
344 | * | 309 | * |
345 | * FUNCTION: acpi_ex_system_reset_event | 310 | * FUNCTION: acpi_ex_system_reset_event |
@@ -352,27 +317,23 @@ acpi_ex_system_wait_event ( | |||
352 | * | 317 | * |
353 | ******************************************************************************/ | 318 | ******************************************************************************/ |
354 | 319 | ||
355 | acpi_status | 320 | acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) |
356 | acpi_ex_system_reset_event ( | ||
357 | union acpi_operand_object *obj_desc) | ||
358 | { | 321 | { |
359 | acpi_status status = AE_OK; | 322 | acpi_status status = AE_OK; |
360 | void *temp_semaphore; | 323 | void *temp_semaphore; |
361 | |||
362 | |||
363 | ACPI_FUNCTION_ENTRY (); | ||
364 | 324 | ||
325 | ACPI_FUNCTION_ENTRY(); | ||
365 | 326 | ||
366 | /* | 327 | /* |
367 | * We are going to simply delete the existing semaphore and | 328 | * We are going to simply delete the existing semaphore and |
368 | * create a new one! | 329 | * create a new one! |
369 | */ | 330 | */ |
370 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); | 331 | status = |
371 | if (ACPI_SUCCESS (status)) { | 332 | acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); |
372 | (void) acpi_os_delete_semaphore (obj_desc->event.semaphore); | 333 | if (ACPI_SUCCESS(status)) { |
334 | (void)acpi_os_delete_semaphore(obj_desc->event.semaphore); | ||
373 | obj_desc->event.semaphore = temp_semaphore; | 335 | obj_desc->event.semaphore = temp_semaphore; |
374 | } | 336 | } |
375 | 337 | ||
376 | return (status); | 338 | return (status); |
377 | } | 339 | } |
378 | |||
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index d00b0dcba96a..1ee79d8c8f88 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | /* | 45 | /* |
47 | * DEFINE_AML_GLOBALS is tested in amlcode.h | 46 | * DEFINE_AML_GLOBALS is tested in amlcode.h |
48 | * to determine whether certain global names should be "defined" or only | 47 | * to determine whether certain global names should be "defined" or only |
@@ -65,15 +64,10 @@ | |||
65 | #include <acpi/acevents.h> | 64 | #include <acpi/acevents.h> |
66 | 65 | ||
67 | #define _COMPONENT ACPI_EXECUTER | 66 | #define _COMPONENT ACPI_EXECUTER |
68 | ACPI_MODULE_NAME ("exutils") | 67 | ACPI_MODULE_NAME("exutils") |
69 | 68 | ||
70 | /* Local prototypes */ | 69 | /* Local prototypes */ |
71 | 70 | static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); | |
72 | static u32 | ||
73 | acpi_ex_digits_needed ( | ||
74 | acpi_integer value, | ||
75 | u32 base); | ||
76 | |||
77 | 71 | ||
78 | #ifndef ACPI_NO_METHOD_EXECUTION | 72 | #ifndef ACPI_NO_METHOD_EXECUTION |
79 | /******************************************************************************* | 73 | /******************************************************************************* |
@@ -89,24 +83,20 @@ acpi_ex_digits_needed ( | |||
89 | * | 83 | * |
90 | ******************************************************************************/ | 84 | ******************************************************************************/ |
91 | 85 | ||
92 | acpi_status | 86 | acpi_status acpi_ex_enter_interpreter(void) |
93 | acpi_ex_enter_interpreter ( | ||
94 | void) | ||
95 | { | 87 | { |
96 | acpi_status status; | 88 | acpi_status status; |
97 | |||
98 | ACPI_FUNCTION_TRACE ("ex_enter_interpreter"); | ||
99 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_enter_interpreter"); | ||
100 | 91 | ||
101 | status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE); | 92 | status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); |
102 | if (ACPI_FAILURE (status)) { | 93 | if (ACPI_FAILURE(status)) { |
103 | ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n")); | 94 | ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n")); |
104 | } | 95 | } |
105 | 96 | ||
106 | return_ACPI_STATUS (status); | 97 | return_ACPI_STATUS(status); |
107 | } | 98 | } |
108 | 99 | ||
109 | |||
110 | /******************************************************************************* | 100 | /******************************************************************************* |
111 | * | 101 | * |
112 | * FUNCTION: acpi_ex_exit_interpreter | 102 | * FUNCTION: acpi_ex_exit_interpreter |
@@ -129,25 +119,20 @@ acpi_ex_enter_interpreter ( | |||
129 | * | 119 | * |
130 | ******************************************************************************/ | 120 | ******************************************************************************/ |
131 | 121 | ||
132 | void | 122 | void acpi_ex_exit_interpreter(void) |
133 | acpi_ex_exit_interpreter ( | ||
134 | void) | ||
135 | { | 123 | { |
136 | acpi_status status; | 124 | acpi_status status; |
137 | |||
138 | |||
139 | ACPI_FUNCTION_TRACE ("ex_exit_interpreter"); | ||
140 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ex_exit_interpreter"); | ||
141 | 127 | ||
142 | status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE); | 128 | status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); |
143 | if (ACPI_FAILURE (status)) { | 129 | if (ACPI_FAILURE(status)) { |
144 | ACPI_REPORT_ERROR (("Could not release interpreter mutex\n")); | 130 | ACPI_REPORT_ERROR(("Could not release interpreter mutex\n")); |
145 | } | 131 | } |
146 | 132 | ||
147 | return_VOID; | 133 | return_VOID; |
148 | } | 134 | } |
149 | 135 | ||
150 | |||
151 | /******************************************************************************* | 136 | /******************************************************************************* |
152 | * | 137 | * |
153 | * FUNCTION: acpi_ex_truncate_for32bit_table | 138 | * FUNCTION: acpi_ex_truncate_for32bit_table |
@@ -161,20 +146,17 @@ acpi_ex_exit_interpreter ( | |||
161 | * | 146 | * |
162 | ******************************************************************************/ | 147 | ******************************************************************************/ |
163 | 148 | ||
164 | void | 149 | void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) |
165 | acpi_ex_truncate_for32bit_table ( | ||
166 | union acpi_operand_object *obj_desc) | ||
167 | { | 150 | { |
168 | 151 | ||
169 | ACPI_FUNCTION_ENTRY (); | 152 | ACPI_FUNCTION_ENTRY(); |
170 | |||
171 | 153 | ||
172 | /* | 154 | /* |
173 | * Object must be a valid number and we must be executing | 155 | * Object must be a valid number and we must be executing |
174 | * a control method | 156 | * a control method |
175 | */ | 157 | */ |
176 | if ((!obj_desc) || | 158 | if ((!obj_desc) || |
177 | (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER)) { | 159 | (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { |
178 | return; | 160 | return; |
179 | } | 161 | } |
180 | 162 | ||
@@ -187,7 +169,6 @@ acpi_ex_truncate_for32bit_table ( | |||
187 | } | 169 | } |
188 | } | 170 | } |
189 | 171 | ||
190 | |||
191 | /******************************************************************************* | 172 | /******************************************************************************* |
192 | * | 173 | * |
193 | * FUNCTION: acpi_ex_acquire_global_lock | 174 | * FUNCTION: acpi_ex_acquire_global_lock |
@@ -203,37 +184,31 @@ acpi_ex_truncate_for32bit_table ( | |||
203 | * | 184 | * |
204 | ******************************************************************************/ | 185 | ******************************************************************************/ |
205 | 186 | ||
206 | u8 | 187 | u8 acpi_ex_acquire_global_lock(u32 field_flags) |
207 | acpi_ex_acquire_global_lock ( | ||
208 | u32 field_flags) | ||
209 | { | 188 | { |
210 | u8 locked = FALSE; | 189 | u8 locked = FALSE; |
211 | acpi_status status; | 190 | acpi_status status; |
212 | |||
213 | |||
214 | ACPI_FUNCTION_TRACE ("ex_acquire_global_lock"); | ||
215 | 191 | ||
192 | ACPI_FUNCTION_TRACE("ex_acquire_global_lock"); | ||
216 | 193 | ||
217 | /* Only attempt lock if the always_lock bit is set */ | 194 | /* Only attempt lock if the always_lock bit is set */ |
218 | 195 | ||
219 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { | 196 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { |
220 | /* We should attempt to get the lock, wait forever */ | 197 | /* We should attempt to get the lock, wait forever */ |
221 | 198 | ||
222 | status = acpi_ev_acquire_global_lock (ACPI_WAIT_FOREVER); | 199 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); |
223 | if (ACPI_SUCCESS (status)) { | 200 | if (ACPI_SUCCESS(status)) { |
224 | locked = TRUE; | 201 | locked = TRUE; |
225 | } | 202 | } else { |
226 | else { | 203 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
227 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 204 | "Could not acquire Global Lock, %s\n", |
228 | "Could not acquire Global Lock, %s\n", | 205 | acpi_format_exception(status))); |
229 | acpi_format_exception (status))); | ||
230 | } | 206 | } |
231 | } | 207 | } |
232 | 208 | ||
233 | return_VALUE (locked); | 209 | return_VALUE(locked); |
234 | } | 210 | } |
235 | 211 | ||
236 | |||
237 | /******************************************************************************* | 212 | /******************************************************************************* |
238 | * | 213 | * |
239 | * FUNCTION: acpi_ex_release_global_lock | 214 | * FUNCTION: acpi_ex_release_global_lock |
@@ -247,34 +222,28 @@ acpi_ex_acquire_global_lock ( | |||
247 | * | 222 | * |
248 | ******************************************************************************/ | 223 | ******************************************************************************/ |
249 | 224 | ||
250 | void | 225 | void acpi_ex_release_global_lock(u8 locked_by_me) |
251 | acpi_ex_release_global_lock ( | ||
252 | u8 locked_by_me) | ||
253 | { | 226 | { |
254 | acpi_status status; | 227 | acpi_status status; |
255 | |||
256 | |||
257 | ACPI_FUNCTION_TRACE ("ex_release_global_lock"); | ||
258 | 228 | ||
229 | ACPI_FUNCTION_TRACE("ex_release_global_lock"); | ||
259 | 230 | ||
260 | /* Only attempt unlock if the caller locked it */ | 231 | /* Only attempt unlock if the caller locked it */ |
261 | 232 | ||
262 | if (locked_by_me) { | 233 | if (locked_by_me) { |
263 | /* OK, now release the lock */ | 234 | /* OK, now release the lock */ |
264 | 235 | ||
265 | status = acpi_ev_release_global_lock (); | 236 | status = acpi_ev_release_global_lock(); |
266 | if (ACPI_FAILURE (status)) { | 237 | if (ACPI_FAILURE(status)) { |
267 | /* Report the error, but there isn't much else we can do */ | 238 | /* Report the error, but there isn't much else we can do */ |
268 | 239 | ||
269 | ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n", | 240 | ACPI_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status))); |
270 | acpi_format_exception (status))); | ||
271 | } | 241 | } |
272 | } | 242 | } |
273 | 243 | ||
274 | return_VOID; | 244 | return_VOID; |
275 | } | 245 | } |
276 | 246 | ||
277 | |||
278 | /******************************************************************************* | 247 | /******************************************************************************* |
279 | * | 248 | * |
280 | * FUNCTION: acpi_ex_digits_needed | 249 | * FUNCTION: acpi_ex_digits_needed |
@@ -289,22 +258,17 @@ acpi_ex_release_global_lock ( | |||
289 | * | 258 | * |
290 | ******************************************************************************/ | 259 | ******************************************************************************/ |
291 | 260 | ||
292 | static u32 | 261 | static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) |
293 | acpi_ex_digits_needed ( | ||
294 | acpi_integer value, | ||
295 | u32 base) | ||
296 | { | 262 | { |
297 | u32 num_digits; | 263 | u32 num_digits; |
298 | acpi_integer current_value; | 264 | acpi_integer current_value; |
299 | |||
300 | |||
301 | ACPI_FUNCTION_TRACE ("ex_digits_needed"); | ||
302 | 265 | ||
266 | ACPI_FUNCTION_TRACE("ex_digits_needed"); | ||
303 | 267 | ||
304 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ | 268 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ |
305 | 269 | ||
306 | if (value == 0) { | 270 | if (value == 0) { |
307 | return_VALUE (1); | 271 | return_VALUE(1); |
308 | } | 272 | } |
309 | 273 | ||
310 | current_value = value; | 274 | current_value = value; |
@@ -313,14 +277,14 @@ acpi_ex_digits_needed ( | |||
313 | /* Count the digits in the requested base */ | 277 | /* Count the digits in the requested base */ |
314 | 278 | ||
315 | while (current_value) { | 279 | while (current_value) { |
316 | (void) acpi_ut_short_divide (current_value, base, ¤t_value, NULL); | 280 | (void)acpi_ut_short_divide(current_value, base, ¤t_value, |
281 | NULL); | ||
317 | num_digits++; | 282 | num_digits++; |
318 | } | 283 | } |
319 | 284 | ||
320 | return_VALUE (num_digits); | 285 | return_VALUE(num_digits); |
321 | } | 286 | } |
322 | 287 | ||
323 | |||
324 | /******************************************************************************* | 288 | /******************************************************************************* |
325 | * | 289 | * |
326 | * FUNCTION: acpi_ex_eisa_id_to_string | 290 | * FUNCTION: acpi_ex_eisa_id_to_string |
@@ -334,32 +298,26 @@ acpi_ex_digits_needed ( | |||
334 | * | 298 | * |
335 | ******************************************************************************/ | 299 | ******************************************************************************/ |
336 | 300 | ||
337 | void | 301 | void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string) |
338 | acpi_ex_eisa_id_to_string ( | ||
339 | u32 numeric_id, | ||
340 | char *out_string) | ||
341 | { | 302 | { |
342 | u32 eisa_id; | 303 | u32 eisa_id; |
343 | |||
344 | |||
345 | ACPI_FUNCTION_ENTRY (); | ||
346 | 304 | ||
305 | ACPI_FUNCTION_ENTRY(); | ||
347 | 306 | ||
348 | /* Swap ID to big-endian to get contiguous bits */ | 307 | /* Swap ID to big-endian to get contiguous bits */ |
349 | 308 | ||
350 | eisa_id = acpi_ut_dword_byte_swap (numeric_id); | 309 | eisa_id = acpi_ut_dword_byte_swap(numeric_id); |
351 | 310 | ||
352 | out_string[0] = (char) ('@' + (((unsigned long) eisa_id >> 26) & 0x1f)); | 311 | out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f)); |
353 | out_string[1] = (char) ('@' + ((eisa_id >> 21) & 0x1f)); | 312 | out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f)); |
354 | out_string[2] = (char) ('@' + ((eisa_id >> 16) & 0x1f)); | 313 | out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f)); |
355 | out_string[3] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 12); | 314 | out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12); |
356 | out_string[4] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 8); | 315 | out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8); |
357 | out_string[5] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 4); | 316 | out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4); |
358 | out_string[6] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 0); | 317 | out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0); |
359 | out_string[7] = 0; | 318 | out_string[7] = 0; |
360 | } | 319 | } |
361 | 320 | ||
362 | |||
363 | /******************************************************************************* | 321 | /******************************************************************************* |
364 | * | 322 | * |
365 | * FUNCTION: acpi_ex_unsigned_integer_to_string | 323 | * FUNCTION: acpi_ex_unsigned_integer_to_string |
@@ -374,25 +332,20 @@ acpi_ex_eisa_id_to_string ( | |||
374 | * | 332 | * |
375 | ******************************************************************************/ | 333 | ******************************************************************************/ |
376 | 334 | ||
377 | void | 335 | void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string) |
378 | acpi_ex_unsigned_integer_to_string ( | ||
379 | acpi_integer value, | ||
380 | char *out_string) | ||
381 | { | 336 | { |
382 | u32 count; | 337 | u32 count; |
383 | u32 digits_needed; | 338 | u32 digits_needed; |
384 | u32 remainder; | 339 | u32 remainder; |
385 | |||
386 | |||
387 | ACPI_FUNCTION_ENTRY (); | ||
388 | 340 | ||
341 | ACPI_FUNCTION_ENTRY(); | ||
389 | 342 | ||
390 | digits_needed = acpi_ex_digits_needed (value, 10); | 343 | digits_needed = acpi_ex_digits_needed(value, 10); |
391 | out_string[digits_needed] = 0; | 344 | out_string[digits_needed] = 0; |
392 | 345 | ||
393 | for (count = digits_needed; count > 0; count--) { | 346 | for (count = digits_needed; count > 0; count--) { |
394 | (void) acpi_ut_short_divide (value, 10, &value, &remainder); | 347 | (void)acpi_ut_short_divide(value, 10, &value, &remainder); |
395 | out_string[count-1] = (char) ('0' + remainder);\ | 348 | out_string[count - 1] = (char)('0' + remainder); |
396 | } | 349 | } |
397 | } | 350 | } |
398 | 351 | ||