aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer')
-rw-r--r--drivers/acpi/executer/exconfig.c54
-rw-r--r--drivers/acpi/executer/exconvrt.c12
-rw-r--r--drivers/acpi/executer/excreate.c25
-rw-r--r--drivers/acpi/executer/exdump.c36
-rw-r--r--drivers/acpi/executer/exfield.c18
-rw-r--r--drivers/acpi/executer/exfldio.c67
-rw-r--r--drivers/acpi/executer/exmisc.c25
-rw-r--r--drivers/acpi/executer/exmutex.c15
-rw-r--r--drivers/acpi/executer/exnames.c28
-rw-r--r--drivers/acpi/executer/exoparg1.c101
-rw-r--r--drivers/acpi/executer/exoparg2.c89
-rw-r--r--drivers/acpi/executer/exoparg3.c17
-rw-r--r--drivers/acpi/executer/exoparg6.c3
-rw-r--r--drivers/acpi/executer/exprep.c45
-rw-r--r--drivers/acpi/executer/exregion.c40
-rw-r--r--drivers/acpi/executer/exresnte.c17
-rw-r--r--drivers/acpi/executer/exresolv.c77
-rw-r--r--drivers/acpi/executer/exresop.c12
-rw-r--r--drivers/acpi/executer/exstore.c15
-rw-r--r--drivers/acpi/executer/exstoren.c7
-rw-r--r--drivers/acpi/executer/exstorob.c17
-rw-r--r--drivers/acpi/executer/exsystem.c12
-rw-r--r--drivers/acpi/executer/exutils.c17
23 files changed, 442 insertions, 307 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index a29782fe3ecf..823352435e08 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -82,7 +82,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
82 struct acpi_table_desc table_info; 82 struct acpi_table_desc table_info;
83 union acpi_operand_object *obj_desc; 83 union acpi_operand_object *obj_desc;
84 84
85 ACPI_FUNCTION_TRACE("ex_add_table"); 85 ACPI_FUNCTION_TRACE(ex_add_table);
86 86
87 /* Create an object to be the table handle */ 87 /* Create an object to be the table handle */
88 88
@@ -100,7 +100,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
100 100
101 ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); 101 ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc));
102 102
103 table_info.type = ACPI_TABLE_SSDT; 103 table_info.type = ACPI_TABLE_ID_SSDT;
104 table_info.pointer = table; 104 table_info.pointer = table;
105 table_info.length = (acpi_size) table->length; 105 table_info.length = (acpi_size) table->length;
106 table_info.allocation = ACPI_MEM_ALLOCATED; 106 table_info.allocation = ACPI_MEM_ALLOCATED;
@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
110 110
111 if (ACPI_FAILURE(status)) { 111 if (ACPI_FAILURE(status)) {
112 if (status == AE_ALREADY_EXISTS) { 112 if (status == AE_ALREADY_EXISTS) {
113
113 /* Table already exists, just return the handle */ 114 /* Table already exists, just return the handle */
114 115
115 return_ACPI_STATUS(AE_OK); 116 return_ACPI_STATUS(AE_OK);
@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
121 122
122 status = acpi_ns_load_table(table_info.installed_desc, parent_node); 123 status = acpi_ns_load_table(table_info.installed_desc, parent_node);
123 if (ACPI_FAILURE(status)) { 124 if (ACPI_FAILURE(status)) {
125
124 /* Uninstall table on error */ 126 /* Uninstall table on error */
125 127
126 (void)acpi_tb_uninstall_table(table_info.installed_desc); 128 (void)acpi_tb_uninstall_table(table_info.installed_desc);
@@ -160,7 +162,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
160 struct acpi_namespace_node *parameter_node = NULL; 162 struct acpi_namespace_node *parameter_node = NULL;
161 union acpi_operand_object *ddb_handle; 163 union acpi_operand_object *ddb_handle;
162 164
163 ACPI_FUNCTION_TRACE("ex_load_table_op"); 165 ACPI_FUNCTION_TRACE(ex_load_table_op);
164 166
165#if 0 167#if 0
166 /* 168 /*
@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
169 */ 171 */
170 status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); 172 status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
171 if (status == AE_OK) { 173 if (status == AE_OK) {
174
172 /* Signature matched -- don't allow override */ 175 /* Signature matched -- don't allow override */
173 176
174 return_ACPI_STATUS(AE_ALREADY_EXISTS); 177 return_ACPI_STATUS(AE_ALREADY_EXISTS);
@@ -211,9 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
211 * location within the namespace where the table will be loaded. 214 * location within the namespace where the table will be loaded.
212 */ 215 */
213 status = 216 status =
214 acpi_ns_get_node_by_path(operand[3]->string.pointer, 217 acpi_ns_get_node(start_node, operand[3]->string.pointer,
215 start_node, ACPI_NS_SEARCH_PARENT, 218 ACPI_NS_SEARCH_PARENT, &parent_node);
216 &parent_node);
217 if (ACPI_FAILURE(status)) { 219 if (ACPI_FAILURE(status)) {
218 return_ACPI_STATUS(status); 220 return_ACPI_STATUS(status);
219 } 221 }
@@ -234,9 +236,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
234 /* Find the node referenced by the parameter_path_string */ 236 /* Find the node referenced by the parameter_path_string */
235 237
236 status = 238 status =
237 acpi_ns_get_node_by_path(operand[4]->string.pointer, 239 acpi_ns_get_node(start_node, operand[4]->string.pointer,
238 start_node, ACPI_NS_SEARCH_PARENT, 240 ACPI_NS_SEARCH_PARENT, &parameter_node);
239 &parameter_node);
240 if (ACPI_FAILURE(status)) { 241 if (ACPI_FAILURE(status)) {
241 return_ACPI_STATUS(status); 242 return_ACPI_STATUS(status);
242 } 243 }
@@ -252,6 +253,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
252 /* Parameter Data (optional) */ 253 /* Parameter Data (optional) */
253 254
254 if (parameter_node) { 255 if (parameter_node) {
256
255 /* Store the parameter data into the optional parameter object */ 257 /* Store the parameter data into the optional parameter object */
256 258
257 status = acpi_ex_store(operand[5], 259 status = acpi_ex_store(operand[5],
@@ -294,9 +296,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
294 struct acpi_table_header *table_ptr = NULL; 296 struct acpi_table_header *table_ptr = NULL;
295 acpi_physical_address address; 297 acpi_physical_address address;
296 struct acpi_table_header table_header; 298 struct acpi_table_header table_header;
299 acpi_integer temp;
297 u32 i; 300 u32 i;
298 301
299 ACPI_FUNCTION_TRACE("ex_load_op"); 302 ACPI_FUNCTION_TRACE(ex_load_op);
300 303
301 /* Object can be either an op_region or a Field */ 304 /* Object can be either an op_region or a Field */
302 305
@@ -322,7 +325,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
322 325
323 address = obj_desc->region.address; 326 address = obj_desc->region.address;
324 327
325 /* Get the table length from the table header */ 328 /* Get part of the table header to get the table length */
326 329
327 table_header.length = 0; 330 table_header.length = 0;
328 for (i = 0; i < 8; i++) { 331 for (i = 0; i < 8; i++) {
@@ -330,11 +333,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
330 acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, 333 acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
331 (acpi_physical_address) 334 (acpi_physical_address)
332 (i + address), 8, 335 (i + address), 8,
333 ((u8 *) & 336 &temp);
334 table_header) + i);
335 if (ACPI_FAILURE(status)) { 337 if (ACPI_FAILURE(status)) {
336 return_ACPI_STATUS(status); 338 return_ACPI_STATUS(status);
337 } 339 }
340
341 /* Get the one valid byte of the returned 64-bit value */
342
343 ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp;
338 } 344 }
339 345
340 /* Sanity check the table length */ 346 /* Sanity check the table length */
@@ -345,7 +351,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
345 351
346 /* Allocate a buffer for the entire table */ 352 /* Allocate a buffer for the entire table */
347 353
348 table_ptr = ACPI_MEM_ALLOCATE(table_header.length); 354 table_ptr = ACPI_ALLOCATE(table_header.length);
349 if (!table_ptr) { 355 if (!table_ptr) {
350 return_ACPI_STATUS(AE_NO_MEMORY); 356 return_ACPI_STATUS(AE_NO_MEMORY);
351 } 357 }
@@ -357,11 +363,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
357 acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, 363 acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
358 (acpi_physical_address) 364 (acpi_physical_address)
359 (i + address), 8, 365 (i + address), 8,
360 ((u8 *) table_ptr + 366 &temp);
361 i));
362 if (ACPI_FAILURE(status)) { 367 if (ACPI_FAILURE(status)) {
363 goto cleanup; 368 goto cleanup;
364 } 369 }
370
371 /* Get the one valid byte of the returned 64-bit value */
372
373 ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp;
365 } 374 }
366 break; 375 break;
367 376
@@ -407,12 +416,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
407 416
408 /* The table must be either an SSDT or a PSDT */ 417 /* The table must be either an SSDT or a PSDT */
409 418
410 if ((!ACPI_STRNCMP(table_ptr->signature, 419 if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) &&
411 acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, 420 (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) {
412 acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
413 (!ACPI_STRNCMP(table_ptr->signature,
414 acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
415 acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
416 ACPI_ERROR((AE_INFO, 421 ACPI_ERROR((AE_INFO,
417 "Table has invalid signature [%4.4s], must be SSDT or PSDT", 422 "Table has invalid signature [%4.4s], must be SSDT or PSDT",
418 table_ptr->signature)); 423 table_ptr->signature));
@@ -424,6 +429,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
424 429
425 status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); 430 status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
426 if (ACPI_FAILURE(status)) { 431 if (ACPI_FAILURE(status)) {
432
427 /* On error, table_ptr was deallocated above */ 433 /* On error, table_ptr was deallocated above */
428 434
429 return_ACPI_STATUS(status); 435 return_ACPI_STATUS(status);
@@ -442,7 +448,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
442 448
443 cleanup: 449 cleanup:
444 if (ACPI_FAILURE(status)) { 450 if (ACPI_FAILURE(status)) {
445 ACPI_MEM_FREE(table_ptr); 451 ACPI_FREE(table_ptr);
446 } 452 }
447 return_ACPI_STATUS(status); 453 return_ACPI_STATUS(status);
448} 454}
@@ -465,7 +471,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
465 union acpi_operand_object *table_desc = ddb_handle; 471 union acpi_operand_object *table_desc = ddb_handle;
466 struct acpi_table_desc *table_info; 472 struct acpi_table_desc *table_info;
467 473
468 ACPI_FUNCTION_TRACE("ex_unload_table"); 474 ACPI_FUNCTION_TRACE(ex_unload_table);
469 475
470 /* 476 /*
471 * Validate the handle 477 * Validate the handle
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
index e6d52e12d77a..b732e399b1ef 100644
--- a/drivers/acpi/executer/exconvrt.c
+++ b/drivers/acpi/executer/exconvrt.c
@@ -79,7 +79,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
79 u32 count; 79 u32 count;
80 acpi_status status; 80 acpi_status status;
81 81
82 ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); 82 ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc);
83 83
84 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 84 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
85 case ACPI_TYPE_INTEGER: 85 case ACPI_TYPE_INTEGER:
@@ -199,7 +199,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
199 union acpi_operand_object *return_desc; 199 union acpi_operand_object *return_desc;
200 u8 *new_buf; 200 u8 *new_buf;
201 201
202 ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); 202 ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc);
203 203
204 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 204 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
205 case ACPI_TYPE_BUFFER: 205 case ACPI_TYPE_BUFFER:
@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
319 remainder = 0; 319 remainder = 0;
320 320
321 for (i = decimal_length; i > 0; i--) { 321 for (i = decimal_length; i > 0; i--) {
322
322 /* Divide by nth factor of 10 */ 323 /* Divide by nth factor of 10 */
323 324
324 digit = integer; 325 digit = integer;
@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
346 347
347 hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); 348 hex_length = (acpi_native_uint) ACPI_MUL_2(data_width);
348 for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { 349 for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
350
349 /* Get one hex digit, most significant digits first */ 351 /* Get one hex digit, most significant digits first */
350 352
351 string[k] = 353 string[k] =
@@ -400,7 +402,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
400 u16 base = 16; 402 u16 base = 16;
401 u8 separator = ','; 403 u8 separator = ',';
402 404
403 ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); 405 ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc);
404 406
405 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 407 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
406 case ACPI_TYPE_STRING: 408 case ACPI_TYPE_STRING:
@@ -567,7 +569,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
567{ 569{
568 acpi_status status = AE_OK; 570 acpi_status status = AE_OK;
569 571
570 ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); 572 ACPI_FUNCTION_TRACE(ex_convert_to_target_type);
571 573
572 /* Default behavior */ 574 /* Default behavior */
573 575
@@ -657,7 +659,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
657 659
658 default: 660 default:
659 ACPI_ERROR((AE_INFO, 661 ACPI_ERROR((AE_INFO,
660 "Unknown Target type ID 0x%X aml_opcode %X dest_type %s", 662 "Unknown Target type ID 0x%X AmlOpcode %X DestType %s",
661 GET_CURRENT_ARG_TYPE(walk_state->op_info-> 663 GET_CURRENT_ARG_TYPE(walk_state->op_info->
662 runtime_args), 664 runtime_args),
663 walk_state->opcode, 665 walk_state->opcode,
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c
index 680575402835..106dc7219df7 100644
--- a/drivers/acpi/executer/excreate.c
+++ b/drivers/acpi/executer/excreate.c
@@ -69,7 +69,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
69 struct acpi_namespace_node *alias_node; 69 struct acpi_namespace_node *alias_node;
70 acpi_status status = AE_OK; 70 acpi_status status = AE_OK;
71 71
72 ACPI_FUNCTION_TRACE("ex_create_alias"); 72 ACPI_FUNCTION_TRACE(ex_create_alias);
73 73
74 /* Get the source/alias operands (both namespace nodes) */ 74 /* Get the source/alias operands (both namespace nodes) */
75 75
@@ -164,7 +164,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state)
164 acpi_status status; 164 acpi_status status;
165 union acpi_operand_object *obj_desc; 165 union acpi_operand_object *obj_desc;
166 166
167 ACPI_FUNCTION_TRACE("ex_create_event"); 167 ACPI_FUNCTION_TRACE(ex_create_event);
168 168
169 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); 169 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT);
170 if (!obj_desc) { 170 if (!obj_desc) {
@@ -216,7 +216,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
216 acpi_status status = AE_OK; 216 acpi_status status = AE_OK;
217 union acpi_operand_object *obj_desc; 217 union acpi_operand_object *obj_desc;
218 218
219 ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); 219 ACPI_FUNCTION_TRACE_PTR(ex_create_mutex, ACPI_WALK_OPERANDS);
220 220
221 /* Create the new mutex object */ 221 /* Create the new mutex object */
222 222
@@ -243,8 +243,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
243 obj_desc->mutex.node = 243 obj_desc->mutex.node =
244 (struct acpi_namespace_node *)walk_state->operands[0]; 244 (struct acpi_namespace_node *)walk_state->operands[0];
245 245
246 status = acpi_ns_attach_object(obj_desc->mutex.node, 246 status =
247 obj_desc, ACPI_TYPE_MUTEX); 247 acpi_ns_attach_object(obj_desc->mutex.node, obj_desc,
248 ACPI_TYPE_MUTEX);
248 249
249 cleanup: 250 cleanup:
250 /* 251 /*
@@ -280,7 +281,7 @@ acpi_ex_create_region(u8 * aml_start,
280 struct acpi_namespace_node *node; 281 struct acpi_namespace_node *node;
281 union acpi_operand_object *region_obj2; 282 union acpi_operand_object *region_obj2;
282 283
283 ACPI_FUNCTION_TRACE("ex_create_region"); 284 ACPI_FUNCTION_TRACE(ex_create_region);
284 285
285 /* Get the Namespace Node */ 286 /* Get the Namespace Node */
286 287
@@ -300,7 +301,7 @@ acpi_ex_create_region(u8 * aml_start,
300 */ 301 */
301 if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && 302 if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
302 (region_space < ACPI_USER_REGION_BEGIN)) { 303 (region_space < ACPI_USER_REGION_BEGIN)) {
303 ACPI_ERROR((AE_INFO, "Invalid address_space type %X", 304 ACPI_ERROR((AE_INFO, "Invalid AddressSpace type %X",
304 region_space)); 305 region_space));
305 return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); 306 return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
306 } 307 }
@@ -364,7 +365,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
364 struct acpi_table_header *table; 365 struct acpi_table_header *table;
365 union acpi_operand_object *region_obj2; 366 union acpi_operand_object *region_obj2;
366 367
367 ACPI_FUNCTION_TRACE("ex_create_table_region"); 368 ACPI_FUNCTION_TRACE(ex_create_table_region);
368 369
369 /* Get the Node from the object stack */ 370 /* Get the Node from the object stack */
370 371
@@ -452,7 +453,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
452 union acpi_operand_object *obj_desc; 453 union acpi_operand_object *obj_desc;
453 acpi_status status; 454 acpi_status status;
454 455
455 ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); 456 ACPI_FUNCTION_TRACE_PTR(ex_create_processor, walk_state);
456 457
457 /* Create the processor object */ 458 /* Create the processor object */
458 459
@@ -464,9 +465,9 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
464 /* Initialize the processor object from the operands */ 465 /* Initialize the processor object from the operands */
465 466
466 obj_desc->processor.proc_id = (u8) operand[1]->integer.value; 467 obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
468 obj_desc->processor.length = (u8) operand[3]->integer.value;
467 obj_desc->processor.address = 469 obj_desc->processor.address =
468 (acpi_io_address) operand[2]->integer.value; 470 (acpi_io_address) operand[2]->integer.value;
469 obj_desc->processor.length = (u8) operand[3]->integer.value;
470 471
471 /* Install the processor object in the parent Node */ 472 /* Install the processor object in the parent Node */
472 473
@@ -499,7 +500,7 @@ acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state)
499 acpi_status status; 500 acpi_status status;
500 union acpi_operand_object *obj_desc; 501 union acpi_operand_object *obj_desc;
501 502
502 ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); 503 ACPI_FUNCTION_TRACE_PTR(ex_create_power_resource, walk_state);
503 504
504 /* Create the power resource object */ 505 /* Create the power resource object */
505 506
@@ -549,7 +550,7 @@ acpi_ex_create_method(u8 * aml_start,
549 acpi_status status; 550 acpi_status status;
550 u8 method_flags; 551 u8 method_flags;
551 552
552 ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); 553 ACPI_FUNCTION_TRACE_PTR(ex_create_method, walk_state);
553 554
554 /* Create a new method object */ 555 /* Create a new method object */
555 556
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index a7cca8d4f855..7b9718e976bf 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -61,6 +61,10 @@ static void acpi_ex_out_pointer(char *title, void *value);
61 61
62static void acpi_ex_out_address(char *title, acpi_physical_address value); 62static void acpi_ex_out_address(char *title, acpi_physical_address value);
63 63
64static void
65acpi_ex_dump_object(union acpi_operand_object *obj_desc,
66 struct acpi_exdump_info *info);
67
64static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); 68static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
65 69
66static void 70static void
@@ -119,7 +123,7 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = {
119 123
120static struct acpi_exdump_info acpi_ex_dump_method[8] = { 124static struct acpi_exdump_info acpi_ex_dump_method[8] = {
121 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, 125 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL},
122 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, 126 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"},
123 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, 127 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"},
124 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, 128 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"},
125 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, 129 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"},
@@ -263,12 +267,10 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
263 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} 267 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
264}; 268};
265 269
266static struct acpi_exdump_info acpi_ex_dump_node[6] = { 270static struct acpi_exdump_info acpi_ex_dump_node[5] = {
267 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, 271 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
268 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, 272 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
269 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, 273 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
270 {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count),
271 "Reference Count"},
272 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, 274 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"},
273 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} 275 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"}
274}; 276};
@@ -330,7 +332,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
330 332
331 if (!info) { 333 if (!info) {
332 acpi_os_printf 334 acpi_os_printf
333 ("ex_dump_object: Display not implemented for object type %s\n", 335 ("ExDumpObject: Display not implemented for object type %s\n",
334 acpi_ut_get_object_type_name(obj_desc)); 336 acpi_ut_get_object_type_name(obj_desc));
335 return; 337 return;
336 } 338 }
@@ -454,7 +456,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
454 u32 length; 456 u32 length;
455 u32 index; 457 u32 index;
456 458
457 ACPI_FUNCTION_NAME("ex_dump_operand") 459 ACPI_FUNCTION_NAME(ex_dump_operand)
458 460
459 if (! 461 if (!
460 ((ACPI_LV_EXEC & acpi_dbg_level) 462 ((ACPI_LV_EXEC & acpi_dbg_level)
@@ -463,6 +465,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
463 } 465 }
464 466
465 if (!obj_desc) { 467 if (!obj_desc) {
468
466 /* This could be a null element of a package */ 469 /* This could be a null element of a package */
467 470
468 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); 471 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
@@ -522,7 +525,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
522 525
523 case AML_REF_OF_OP: 526 case AML_REF_OF_OP:
524 527
525 acpi_os_printf("Reference: (ref_of) %p\n", 528 acpi_os_printf("Reference: (RefOf) %p\n",
526 obj_desc->reference.object); 529 obj_desc->reference.object);
527 break; 530 break;
528 531
@@ -532,6 +535,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
532 obj_desc->reference.offset); 535 obj_desc->reference.offset);
533 536
534 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 537 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
538
535 /* Value is an Integer */ 539 /* Value is an Integer */
536 540
537 acpi_os_printf(" value is [%8.8X%8.8x]", 541 acpi_os_printf(" value is [%8.8X%8.8x]",
@@ -610,7 +614,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
610 614
611 case ACPI_TYPE_PACKAGE: 615 case ACPI_TYPE_PACKAGE:
612 616
613 acpi_os_printf("Package [Len %X] element_array %p\n", 617 acpi_os_printf("Package [Len %X] ElementArray %p\n",
614 obj_desc->package.count, 618 obj_desc->package.count,
615 obj_desc->package.elements); 619 obj_desc->package.elements);
616 620
@@ -662,13 +666,13 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
662 666
663 case ACPI_TYPE_LOCAL_BANK_FIELD: 667 case ACPI_TYPE_LOCAL_BANK_FIELD:
664 668
665 acpi_os_printf("bank_field\n"); 669 acpi_os_printf("BankField\n");
666 break; 670 break;
667 671
668 case ACPI_TYPE_LOCAL_REGION_FIELD: 672 case ACPI_TYPE_LOCAL_REGION_FIELD:
669 673
670 acpi_os_printf 674 acpi_os_printf
671 ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", 675 ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
672 obj_desc->field.bit_length, 676 obj_desc->field.bit_length,
673 obj_desc->field.access_byte_width, 677 obj_desc->field.access_byte_width,
674 obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, 678 obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
@@ -681,12 +685,12 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
681 685
682 case ACPI_TYPE_LOCAL_INDEX_FIELD: 686 case ACPI_TYPE_LOCAL_INDEX_FIELD:
683 687
684 acpi_os_printf("index_field\n"); 688 acpi_os_printf("IndexField\n");
685 break; 689 break;
686 690
687 case ACPI_TYPE_BUFFER_FIELD: 691 case ACPI_TYPE_BUFFER_FIELD:
688 692
689 acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", 693 acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n",
690 obj_desc->buffer_field.bit_length, 694 obj_desc->buffer_field.bit_length,
691 obj_desc->buffer_field.base_byte_offset, 695 obj_desc->buffer_field.base_byte_offset,
692 obj_desc->buffer_field.start_field_bit_offset); 696 obj_desc->buffer_field.start_field_bit_offset);
@@ -777,7 +781,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
777{ 781{
778 acpi_native_uint i; 782 acpi_native_uint i;
779 783
780 ACPI_FUNCTION_NAME("ex_dump_operands"); 784 ACPI_FUNCTION_NAME(ex_dump_operands);
781 785
782 if (!ident) { 786 if (!ident) {
783 ident = "?"; 787 ident = "?";
@@ -901,7 +905,7 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
901 acpi_os_printf("Could not convert name to pathname\n"); 905 acpi_os_printf("Could not convert name to pathname\n");
902 } else { 906 } else {
903 acpi_os_printf("%s\n", (char *)ret_buf.pointer); 907 acpi_os_printf("%s\n", (char *)ret_buf.pointer);
904 ACPI_MEM_FREE(ret_buf.pointer); 908 ACPI_FREE(ret_buf.pointer);
905 } 909 }
906 } else if (obj_desc->reference.object) { 910 } else if (obj_desc->reference.object) {
907 acpi_os_printf("\nReferenced Object: %p\n", 911 acpi_os_printf("\nReferenced Object: %p\n",
@@ -1017,7 +1021,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
1017void 1021void
1018acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) 1022acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
1019{ 1023{
1020 ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); 1024 ACPI_FUNCTION_TRACE(ex_dump_object_descriptor);
1021 1025
1022 if (!obj_desc) { 1026 if (!obj_desc) {
1023 return_VOID; 1027 return_VOID;
@@ -1046,7 +1050,7 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
1046 1050
1047 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { 1051 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
1048 acpi_os_printf 1052 acpi_os_printf
1049 ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", 1053 ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
1050 obj_desc, acpi_ut_get_descriptor_name(obj_desc)); 1054 obj_desc, acpi_ut_get_descriptor_name(obj_desc));
1051 return_VOID; 1055 return_VOID;
1052 } 1056 }
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index e259201ce9a0..9ea9c3a67ca9 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -73,7 +73,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
73 void *buffer; 73 void *buffer;
74 u8 locked; 74 u8 locked;
75 75
76 ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc); 76 ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc);
77 77
78 /* Parameter validation */ 78 /* Parameter validation */
79 79
@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
142 length = 142 length =
143 (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); 143 (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
144 if (length > acpi_gbl_integer_byte_width) { 144 if (length > acpi_gbl_integer_byte_width) {
145
145 /* Field is too large for an Integer, create a Buffer instead */ 146 /* Field is too large for an Integer, create a Buffer instead */
146 147
147 buffer_desc = acpi_ut_create_buffer_object(length); 148 buffer_desc = acpi_ut_create_buffer_object(length);
@@ -163,11 +164,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
163 } 164 }
164 165
165 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 166 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
166 "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", 167 "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n",
167 obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, 168 obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer,
168 (u32) length)); 169 (u32) length));
169 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 170 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
170 "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", 171 "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
171 obj_desc->common_field.bit_length, 172 obj_desc->common_field.bit_length,
172 obj_desc->common_field.start_field_bit_offset, 173 obj_desc->common_field.start_field_bit_offset,
173 obj_desc->common_field.base_byte_offset)); 174 obj_desc->common_field.base_byte_offset));
@@ -219,7 +220,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
219 u8 locked; 220 u8 locked;
220 union acpi_operand_object *buffer_desc; 221 union acpi_operand_object *buffer_desc;
221 222
222 ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc); 223 ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc);
223 224
224 /* Parameter validation */ 225 /* Parameter validation */
225 226
@@ -329,9 +330,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
329 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); 330 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
330 331
331 if (length < required_length) { 332 if (length < required_length) {
333
332 /* We need to create a new buffer */ 334 /* We need to create a new buffer */
333 335
334 new_buffer = ACPI_MEM_CALLOCATE(required_length); 336 new_buffer = ACPI_ALLOCATE_ZEROED(required_length);
335 if (!new_buffer) { 337 if (!new_buffer) {
336 return_ACPI_STATUS(AE_NO_MEMORY); 338 return_ACPI_STATUS(AE_NO_MEMORY);
337 } 339 }
@@ -347,14 +349,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
347 } 349 }
348 350
349 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 351 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
350 "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", 352 "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
351 source_desc, 353 source_desc,
352 acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE 354 acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
353 (source_desc)), 355 (source_desc)),
354 ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); 356 ACPI_GET_OBJECT_TYPE(source_desc), buffer, length));
355 357
356 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 358 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
357 "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", 359 "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
358 obj_desc, 360 obj_desc,
359 acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), 361 acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)),
360 ACPI_GET_OBJECT_TYPE(obj_desc), 362 ACPI_GET_OBJECT_TYPE(obj_desc),
@@ -375,7 +377,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
375 /* Free temporary buffer if we used one */ 377 /* Free temporary buffer if we used one */
376 378
377 if (new_buffer) { 379 if (new_buffer) {
378 ACPI_MEM_FREE(new_buffer); 380 ACPI_FREE(new_buffer);
379 } 381 }
380 382
381 return_ACPI_STATUS(status); 383 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index bd1af35f7fcf..051053f7cccb 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -87,7 +87,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
87 acpi_status status = AE_OK; 87 acpi_status status = AE_OK;
88 union acpi_operand_object *rgn_desc; 88 union acpi_operand_object *rgn_desc;
89 89
90 ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset); 90 ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset);
91 91
92 rgn_desc = obj_desc->common_field.region_obj; 92 rgn_desc = obj_desc->common_field.region_obj;
93 93
@@ -112,7 +112,18 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
112 } 112 }
113 } 113 }
114 114
115 /* Exit if Address/Length have been disallowed by the host OS */
116
117 if (rgn_desc->common.flags & AOPOBJ_INVALID) {
118 return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS);
119 }
120
121 /*
122 * Exit now for SMBus address space, it has a non-linear address space
123 * and the request cannot be directly validated
124 */
115 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { 125 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
126
116 /* SMBus has a non-linear address space */ 127 /* SMBus has a non-linear address space */
117 128
118 return_ACPI_STATUS(AE_OK); 129 return_ACPI_STATUS(AE_OK);
@@ -134,10 +145,10 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
134 * length of one field datum (access width) must fit within the region. 145 * length of one field datum (access width) must fit within the region.
135 * (Region length is specified in bytes) 146 * (Region length is specified in bytes)
136 */ 147 */
137 if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + 148 if (rgn_desc->region.length <
138 field_datum_byte_offset + 149 (obj_desc->common_field.base_byte_offset +
139 obj_desc->common_field. 150 field_datum_byte_offset +
140 access_byte_width)) { 151 obj_desc->common_field.access_byte_width)) {
141 if (acpi_gbl_enable_interpreter_slack) { 152 if (acpi_gbl_enable_interpreter_slack) {
142 /* 153 /*
143 * Slack mode only: We will go ahead and allow access to this 154 * Slack mode only: We will go ahead and allow access to this
@@ -217,7 +228,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
217 union acpi_operand_object *rgn_desc; 228 union acpi_operand_object *rgn_desc;
218 acpi_physical_address address; 229 acpi_physical_address address;
219 230
220 ACPI_FUNCTION_TRACE("ex_access_region"); 231 ACPI_FUNCTION_TRACE(ex_access_region);
221 232
222 /* 233 /*
223 * Ensure that the region operands are fully evaluated and verify 234 * Ensure that the region operands are fully evaluated and verify
@@ -246,7 +257,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
246 } 257 }
247 258
248 ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, 259 ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
249 " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", 260 " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
250 acpi_ut_get_region_name(rgn_desc->region. 261 acpi_ut_get_region_name(rgn_desc->region.
251 space_id), 262 space_id),
252 rgn_desc->region.space_id, 263 rgn_desc->region.space_id,
@@ -352,7 +363,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
352 acpi_status status; 363 acpi_status status;
353 acpi_integer local_value; 364 acpi_integer local_value;
354 365
355 ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset); 366 ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset);
356 367
357 if (read_write == ACPI_READ) { 368 if (read_write == ACPI_READ) {
358 if (!value) { 369 if (!value) {
@@ -487,10 +498,11 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
487 } 498 }
488 499
489 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 500 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
490 "I/O to Data Register: value_ptr %p\n", 501 "I/O to Data Register: ValuePtr %p\n",
491 value)); 502 value));
492 503
493 if (read_write == ACPI_READ) { 504 if (read_write == ACPI_READ) {
505
494 /* Read the datum from the data_register */ 506 /* Read the datum from the data_register */
495 507
496 status = 508 status =
@@ -559,7 +571,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
559 acpi_integer merged_value; 571 acpi_integer merged_value;
560 acpi_integer current_value; 572 acpi_integer current_value;
561 573
562 ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask); 574 ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask);
563 575
564 /* Start with the new bits */ 576 /* Start with the new bits */
565 577
@@ -568,6 +580,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
568 /* If the mask is all ones, we don't need to worry about the update rule */ 580 /* If the mask is all ones, we don't need to worry about the update rule */
569 581
570 if (mask != ACPI_INTEGER_MAX) { 582 if (mask != ACPI_INTEGER_MAX) {
583
571 /* Decode the update rule */ 584 /* Decode the update rule */
572 585
573 switch (obj_desc->common_field. 586 switch (obj_desc->common_field.
@@ -614,7 +627,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
614 default: 627 default:
615 628
616 ACPI_ERROR((AE_INFO, 629 ACPI_ERROR((AE_INFO,
617 "Unknown update_rule value: %X", 630 "Unknown UpdateRule value: %X",
618 (obj_desc->common_field. 631 (obj_desc->common_field.
619 field_flags & 632 field_flags &
620 AML_FIELD_UPDATE_RULE_MASK))); 633 AML_FIELD_UPDATE_RULE_MASK)));
@@ -623,7 +636,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
623 } 636 }
624 637
625 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 638 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
626 "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", 639 "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n",
627 ACPI_FORMAT_UINT64(mask), 640 ACPI_FORMAT_UINT64(mask),
628 field_datum_byte_offset, 641 field_datum_byte_offset,
629 obj_desc->common_field.access_byte_width, 642 obj_desc->common_field.access_byte_width,
@@ -666,7 +679,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
666 u32 field_datum_count; 679 u32 field_datum_count;
667 u32 i; 680 u32 i;
668 681
669 ACPI_FUNCTION_TRACE("ex_extract_from_field"); 682 ACPI_FUNCTION_TRACE(ex_extract_from_field);
670 683
671 /* Validate target buffer and clear it */ 684 /* Validate target buffer and clear it */
672 685
@@ -704,6 +717,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
704 /* Read the rest of the field */ 717 /* Read the rest of the field */
705 718
706 for (i = 1; i < field_datum_count; i++) { 719 for (i = 1; i < field_datum_count; i++) {
720
707 /* Get next input datum from the field */ 721 /* Get next input datum from the field */
708 722
709 field_offset += obj_desc->common_field.access_byte_width; 723 field_offset += obj_desc->common_field.access_byte_width;
@@ -771,6 +785,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
771{ 785{
772 acpi_status status; 786 acpi_status status;
773 acpi_integer mask; 787 acpi_integer mask;
788 acpi_integer width_mask;
774 acpi_integer merged_datum; 789 acpi_integer merged_datum;
775 acpi_integer raw_datum = 0; 790 acpi_integer raw_datum = 0;
776 u32 field_offset = 0; 791 u32 field_offset = 0;
@@ -780,7 +795,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
780 u32 field_datum_count; 795 u32 field_datum_count;
781 u32 i; 796 u32 i;
782 797
783 ACPI_FUNCTION_TRACE("ex_insert_into_field"); 798 ACPI_FUNCTION_TRACE(ex_insert_into_field);
784 799
785 /* Validate input buffer */ 800 /* Validate input buffer */
786 801
@@ -795,15 +810,20 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
795 810
796 /* Compute the number of datums (access width data items) */ 811 /* Compute the number of datums (access width data items) */
797 812
813 width_mask =
814 ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width);
798 mask = 815 mask =
799 ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); 816 width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field.
800 datum_count = 817 start_field_bit_offset);
801 ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, 818
802 obj_desc->common_field.access_bit_width); 819 datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
803 field_datum_count = 820 obj_desc->common_field.access_bit_width);
804 ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + 821
805 obj_desc->common_field.start_field_bit_offset, 822 field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
806 obj_desc->common_field.access_bit_width); 823 obj_desc->common_field.
824 start_field_bit_offset,
825 obj_desc->common_field.
826 access_bit_width);
807 827
808 /* Get initial Datum from the input buffer */ 828 /* Get initial Datum from the input buffer */
809 829
@@ -817,6 +837,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
817 /* Write the entire field */ 837 /* Write the entire field */
818 838
819 for (i = 1; i < field_datum_count; i++) { 839 for (i = 1; i < field_datum_count; i++) {
840
820 /* Write merged datum to the target field */ 841 /* Write merged datum to the target field */
821 842
822 merged_datum &= mask; 843 merged_datum &= mask;
@@ -833,7 +854,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
833 merged_datum = raw_datum >> 854 merged_datum = raw_datum >>
834 (obj_desc->common_field.access_bit_width - 855 (obj_desc->common_field.access_bit_width -
835 obj_desc->common_field.start_field_bit_offset); 856 obj_desc->common_field.start_field_bit_offset);
836 mask = ACPI_INTEGER_MAX; 857 mask = width_mask;
837 858
838 if (i == datum_count) { 859 if (i == datum_count) {
839 break; 860 break;
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
index 48c18d29222a..bd98aab017cf 100644
--- a/drivers/acpi/executer/exmisc.c
+++ b/drivers/acpi/executer/exmisc.c
@@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
72 union acpi_operand_object *reference_obj; 72 union acpi_operand_object *reference_obj;
73 union acpi_operand_object *referenced_obj; 73 union acpi_operand_object *referenced_obj;
74 74
75 ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); 75 ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc);
76 76
77 *return_desc = NULL; 77 *return_desc = NULL;
78 78
@@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
168 acpi_size length1; 168 acpi_size length1;
169 acpi_size new_length; 169 acpi_size new_length;
170 170
171 ACPI_FUNCTION_TRACE("ex_concat_template"); 171 ACPI_FUNCTION_TRACE(ex_concat_template);
172 172
173 /* 173 /*
174 * Find the end_tag descriptor in each resource template. 174 * Find the end_tag descriptor in each resource template.
@@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
250 char *new_buf; 250 char *new_buf;
251 acpi_status status; 251 acpi_status status;
252 252
253 ACPI_FUNCTION_TRACE("ex_do_concatenate"); 253 ACPI_FUNCTION_TRACE(ex_do_concatenate);
254 254
255 /* 255 /*
256 * Convert the second operand if necessary. The first operand 256 * Convert the second operand if necessary. The first operand
@@ -445,10 +445,24 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
445 445
446 case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ 446 case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
447 447
448 /*
449 * We need to check if the shiftcount is larger than the integer bit
450 * width since the behavior of this is not well-defined in the C language.
451 */
452 if (integer1 >= acpi_gbl_integer_bit_width) {
453 return (0);
454 }
448 return (integer0 << integer1); 455 return (integer0 << integer1);
449 456
450 case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ 457 case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */
451 458
459 /*
460 * We need to check if the shiftcount is larger than the integer bit
461 * width since the behavior of this is not well-defined in the C language.
462 */
463 if (integer1 >= acpi_gbl_integer_bit_width) {
464 return (0);
465 }
452 return (integer0 >> integer1); 466 return (integer0 >> integer1);
453 467
454 case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ 468 case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */
@@ -489,7 +503,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode,
489 acpi_status status = AE_OK; 503 acpi_status status = AE_OK;
490 u8 local_result = FALSE; 504 u8 local_result = FALSE;
491 505
492 ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); 506 ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op);
493 507
494 switch (opcode) { 508 switch (opcode) {
495 case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ 509 case AML_LAND_OP: /* LAnd (Integer0, Integer1) */
@@ -557,7 +571,7 @@ acpi_ex_do_logical_op(u16 opcode,
557 u8 local_result = FALSE; 571 u8 local_result = FALSE;
558 int compare; 572 int compare;
559 573
560 ACPI_FUNCTION_TRACE("ex_do_logical_op"); 574 ACPI_FUNCTION_TRACE(ex_do_logical_op);
561 575
562 /* 576 /*
563 * Convert the second operand if necessary. The first operand 577 * Convert the second operand if necessary. The first operand
@@ -649,6 +663,7 @@ acpi_ex_do_logical_op(u16 opcode,
649 /* Length and all bytes must be equal */ 663 /* Length and all bytes must be equal */
650 664
651 if ((length0 == length1) && (compare == 0)) { 665 if ((length0 == length1) && (compare == 0)) {
666
652 /* Length and all bytes match ==> TRUE */ 667 /* Length and all bytes match ==> TRUE */
653 668
654 local_result = TRUE; 669 local_result = TRUE;
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
index f843b22e20b9..93098d68cadf 100644
--- a/drivers/acpi/executer/exmutex.c
+++ b/drivers/acpi/executer/exmutex.c
@@ -61,7 +61,7 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
61 * 61 *
62 * RETURN: None 62 * RETURN: None
63 * 63 *
64 * DESCRIPTION: Remove a mutex from the "acquired_mutex" list 64 * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list
65 * 65 *
66 ******************************************************************************/ 66 ******************************************************************************/
67 67
@@ -95,7 +95,7 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc)
95 * 95 *
96 * RETURN: None 96 * RETURN: None
97 * 97 *
98 * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk 98 * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk
99 * 99 *
100 ******************************************************************************/ 100 ******************************************************************************/
101 101
@@ -144,7 +144,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
144{ 144{
145 acpi_status status; 145 acpi_status status;
146 146
147 ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc); 147 ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex, obj_desc);
148 148
149 if (!obj_desc) { 149 if (!obj_desc) {
150 return_ACPI_STATUS(AE_BAD_PARAMETER); 150 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -165,7 +165,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
165 */ 165 */
166 if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { 166 if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
167 ACPI_ERROR((AE_INFO, 167 ACPI_ERROR((AE_INFO,
168 "Cannot acquire Mutex [%4.4s], incorrect sync_level", 168 "Cannot acquire Mutex [%4.4s], incorrect SyncLevel",
169 acpi_ut_get_node_name(obj_desc->mutex.node))); 169 acpi_ut_get_node_name(obj_desc->mutex.node)));
170 return_ACPI_STATUS(AE_AML_MUTEX_ORDER); 170 return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
171 } 171 }
@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
173 /* Support for multiple acquires by the owning thread */ 173 /* Support for multiple acquires by the owning thread */
174 174
175 if (obj_desc->mutex.owner_thread) { 175 if (obj_desc->mutex.owner_thread) {
176
176 /* Special case for Global Lock, allow all threads */ 177 /* Special case for Global Lock, allow all threads */
177 178
178 if ((obj_desc->mutex.owner_thread->thread_id == 179 if ((obj_desc->mutex.owner_thread->thread_id ==
@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
192 193
193 status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); 194 status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
194 if (ACPI_FAILURE(status)) { 195 if (ACPI_FAILURE(status)) {
196
195 /* Includes failure from a timeout on time_desc */ 197 /* Includes failure from a timeout on time_desc */
196 198
197 return_ACPI_STATUS(status); 199 return_ACPI_STATUS(status);
@@ -232,7 +234,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
232{ 234{
233 acpi_status status; 235 acpi_status status;
234 236
235 ACPI_FUNCTION_TRACE("ex_release_mutex"); 237 ACPI_FUNCTION_TRACE(ex_release_mutex);
236 238
237 if (!obj_desc) { 239 if (!obj_desc) {
238 return_ACPI_STATUS(AE_BAD_PARAMETER); 240 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -277,7 +279,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
277 */ 279 */
278 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { 280 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
279 ACPI_ERROR((AE_INFO, 281 ACPI_ERROR((AE_INFO,
280 "Cannot release Mutex [%4.4s], incorrect sync_level", 282 "Cannot release Mutex [%4.4s], incorrect SyncLevel",
281 acpi_ut_get_node_name(obj_desc->mutex.node))); 283 acpi_ut_get_node_name(obj_desc->mutex.node)));
282 return_ACPI_STATUS(AE_AML_MUTEX_ORDER); 284 return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
283 } 285 }
@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
286 288
287 obj_desc->mutex.acquisition_depth--; 289 obj_desc->mutex.acquisition_depth--;
288 if (obj_desc->mutex.acquisition_depth != 0) { 290 if (obj_desc->mutex.acquisition_depth != 0) {
291
289 /* Just decrement the depth and return */ 292 /* Just decrement the depth and return */
290 293
291 return_ACPI_STATUS(AE_OK); 294 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 054fe5e1a314..d3d70364626c 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -77,7 +77,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
77 char *name_string; 77 char *name_string;
78 u32 size_needed; 78 u32 size_needed;
79 79
80 ACPI_FUNCTION_TRACE("ex_allocate_name_string"); 80 ACPI_FUNCTION_TRACE(ex_allocate_name_string);
81 81
82 /* 82 /*
83 * 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.
@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
85 * This may actually be somewhat longer than needed. 85 * This may actually be somewhat longer than needed.
86 */ 86 */
87 if (prefix_count == ACPI_UINT32_MAX) { 87 if (prefix_count == ACPI_UINT32_MAX) {
88
88 /* Special case for root */ 89 /* Special case for root */
89 90
90 size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; 91 size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
@@ -97,7 +98,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
97 * Allocate a buffer for the name. 98 * Allocate a buffer for the name.
98 * This buffer must be deleted by the caller! 99 * This buffer must be deleted by the caller!
99 */ 100 */
100 name_string = ACPI_MEM_ALLOCATE(size_needed); 101 name_string = ACPI_ALLOCATE(size_needed);
101 if (!name_string) { 102 if (!name_string) {
102 ACPI_ERROR((AE_INFO, 103 ACPI_ERROR((AE_INFO,
103 "Could not allocate size %d", size_needed)); 104 "Could not allocate size %d", size_needed));
@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
119 /* Set up Dual or Multi prefixes if needed */ 120 /* Set up Dual or Multi prefixes if needed */
120 121
121 if (num_name_segs > 2) { 122 if (num_name_segs > 2) {
123
122 /* Set up multi prefixes */ 124 /* Set up multi prefixes */
123 125
124 *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; 126 *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
125 *temp_ptr++ = (char)num_name_segs; 127 *temp_ptr++ = (char)num_name_segs;
126 } else if (2 == num_name_segs) { 128 } else if (2 == num_name_segs) {
129
127 /* Set up dual prefixes */ 130 /* Set up dual prefixes */
128 131
129 *temp_ptr++ = AML_DUAL_NAME_PREFIX; 132 *temp_ptr++ = AML_DUAL_NAME_PREFIX;
@@ -159,7 +162,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
159 u32 index; 162 u32 index;
160 char char_buf[5]; 163 char char_buf[5];
161 164
162 ACPI_FUNCTION_TRACE("ex_name_segment"); 165 ACPI_FUNCTION_TRACE(ex_name_segment);
163 166
164 /* 167 /*
165 * If first character is a digit, then we know that we aren't looking at a 168 * If first character is a digit, then we know that we aren't looking at a
@@ -176,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
176 179
177 for (index = 0; 180 for (index = 0;
178 (index < ACPI_NAME_SIZE) 181 (index < ACPI_NAME_SIZE)
179 && (acpi_ut_valid_acpi_character(*aml_address)); index++) { 182 && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
180 char_buf[index] = *aml_address++; 183 char_buf[index] = *aml_address++;
181 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); 184 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
182 } 185 }
@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
184 /* Valid name segment */ 187 /* Valid name segment */
185 188
186 if (index == 4) { 189 if (index == 4) {
190
187 /* Found 4 valid characters */ 191 /* Found 4 valid characters */
188 192
189 char_buf[4] = '\0'; 193 char_buf[4] = '\0';
@@ -249,11 +253,12 @@ acpi_ex_get_name_string(acpi_object_type data_type,
249 u32 prefix_count = 0; 253 u32 prefix_count = 0;
250 u8 has_prefix = FALSE; 254 u8 has_prefix = FALSE;
251 255
252 ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); 256 ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address);
253 257
254 if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || 258 if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
255 ACPI_TYPE_LOCAL_BANK_FIELD == data_type || 259 ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
256 ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { 260 ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
261
257 /* Disallow prefixes for types associated with field_unit names */ 262 /* Disallow prefixes for types associated with field_unit names */
258 263
259 name_string = acpi_ex_allocate_name_string(0, 1); 264 name_string = acpi_ex_allocate_name_string(0, 1);
@@ -272,7 +277,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
272 case AML_ROOT_PREFIX: 277 case AML_ROOT_PREFIX:
273 278
274 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 279 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
275 "root_prefix(\\) at %p\n", 280 "RootPrefix(\\) at %p\n",
276 aml_address)); 281 aml_address));
277 282
278 /* 283 /*
@@ -290,7 +295,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
290 295
291 do { 296 do {
292 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 297 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
293 "parent_prefix (^) at %p\n", 298 "ParentPrefix (^) at %p\n",
294 aml_address)); 299 aml_address));
295 300
296 aml_address++; 301 aml_address++;
@@ -314,7 +319,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
314 case AML_DUAL_NAME_PREFIX: 319 case AML_DUAL_NAME_PREFIX:
315 320
316 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 321 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
317 "dual_name_prefix at %p\n", 322 "DualNamePrefix at %p\n",
318 aml_address)); 323 aml_address));
319 324
320 aml_address++; 325 aml_address++;
@@ -341,7 +346,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
341 case AML_MULTI_NAME_PREFIX_OP: 346 case AML_MULTI_NAME_PREFIX_OP:
342 347
343 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 348 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
344 "multi_name_prefix at %p\n", 349 "MultiNamePrefix at %p\n",
345 aml_address)); 350 aml_address));
346 351
347 /* Fetch count of segments remaining in name path */ 352 /* Fetch count of segments remaining in name path */
@@ -377,7 +382,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
377 382
378 if (prefix_count == ACPI_UINT32_MAX) { 383 if (prefix_count == ACPI_UINT32_MAX) {
379 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 384 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
380 "name_seg is \"\\\" followed by NULL\n")); 385 "NameSeg is \"\\\" followed by NULL\n"));
381 } 386 }
382 387
383 /* Consume the NULL byte */ 388 /* Consume the NULL byte */
@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
410 } 415 }
411 416
412 if (AE_CTRL_PENDING == status && has_prefix) { 417 if (AE_CTRL_PENDING == status && has_prefix) {
418
413 /* Ran out of segments after processing a prefix */ 419 /* Ran out of segments after processing a prefix */
414 420
415 ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); 421 ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string));
@@ -418,7 +424,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
418 424
419 if (ACPI_FAILURE(status)) { 425 if (ACPI_FAILURE(status)) {
420 if (name_string) { 426 if (name_string) {
421 ACPI_MEM_FREE(name_string); 427 ACPI_FREE(name_string);
422 } 428 }
423 return_ACPI_STATUS(status); 429 return_ACPI_STATUS(status);
424 } 430 }
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index 23d0823bcd5e..6374d8be88e0 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
89 acpi_status status = AE_OK; 89 acpi_status status = AE_OK;
90 union acpi_operand_object *return_desc = NULL; 90 union acpi_operand_object *return_desc = NULL;
91 91
92 ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", 92 ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R,
93 acpi_ps_get_opcode_name(walk_state->opcode)); 93 acpi_ps_get_opcode_name(walk_state->opcode));
94 94
95 /* Examine the AML opcode */ 95 /* Examine the AML opcode */
@@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
150 union acpi_operand_object **operand = &walk_state->operands[0]; 150 union acpi_operand_object **operand = &walk_state->operands[0];
151 acpi_status status = AE_OK; 151 acpi_status status = AE_OK;
152 152
153 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", 153 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R,
154 acpi_ps_get_opcode_name(walk_state->opcode)); 154 acpi_ps_get_opcode_name(walk_state->opcode));
155 155
156 /* Examine the AML opcode */ 156 /* Examine the AML opcode */
@@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
216 acpi_status status = AE_OK; 216 acpi_status status = AE_OK;
217 union acpi_operand_object **operand = &walk_state->operands[0]; 217 union acpi_operand_object **operand = &walk_state->operands[0];
218 218
219 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", 219 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R,
220 acpi_ps_get_opcode_name(walk_state->opcode)); 220 acpi_ps_get_opcode_name(walk_state->opcode));
221 221
222 /* Examine the AML opcode */ 222 /* Examine the AML opcode */
@@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
264 acpi_integer power_of_ten; 264 acpi_integer power_of_ten;
265 acpi_integer digit; 265 acpi_integer digit;
266 266
267 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", 267 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R,
268 acpi_ps_get_opcode_name(walk_state->opcode)); 268 acpi_ps_get_opcode_name(walk_state->opcode));
269 269
270 /* Examine the AML opcode */ 270 /* Examine the AML opcode */
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
322 322
323 /* Since the bit position is one-based, subtract from 33 (65) */ 323 /* Since the bit position is one-based, subtract from 33 (65) */
324 324
325 return_desc->integer.value = temp32 == 0 ? 0 : 325 return_desc->integer.value =
326 (ACPI_INTEGER_BIT_SIZE + 1) - temp32; 326 temp32 ==
327 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
327 break; 328 break;
328 329
329 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ 330 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
@@ -342,6 +343,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
342 for (i = 0; 343 for (i = 0;
343 (i < acpi_gbl_integer_nybble_width) && (digit > 0); 344 (i < acpi_gbl_integer_nybble_width) && (digit > 0);
344 i++) { 345 i++) {
346
345 /* Get the least significant 4-bit BCD digit */ 347 /* Get the least significant 4-bit BCD digit */
346 348
347 temp32 = ((u32) digit) & 0xF; 349 temp32 = ((u32) digit) & 0xF;
@@ -487,6 +489,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
487 status = acpi_ex_convert_to_string(operand[0], &return_desc, 489 status = acpi_ex_convert_to_string(operand[0], &return_desc,
488 ACPI_EXPLICIT_CONVERT_DECIMAL); 490 ACPI_EXPLICIT_CONVERT_DECIMAL);
489 if (return_desc == operand[0]) { 491 if (return_desc == operand[0]) {
492
490 /* No conversion performed, add ref to handle return value */ 493 /* No conversion performed, add ref to handle return value */
491 acpi_ut_add_reference(return_desc); 494 acpi_ut_add_reference(return_desc);
492 } 495 }
@@ -497,6 +500,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
497 status = acpi_ex_convert_to_string(operand[0], &return_desc, 500 status = acpi_ex_convert_to_string(operand[0], &return_desc,
498 ACPI_EXPLICIT_CONVERT_HEX); 501 ACPI_EXPLICIT_CONVERT_HEX);
499 if (return_desc == operand[0]) { 502 if (return_desc == operand[0]) {
503
500 /* No conversion performed, add ref to handle return value */ 504 /* No conversion performed, add ref to handle return value */
501 acpi_ut_add_reference(return_desc); 505 acpi_ut_add_reference(return_desc);
502 } 506 }
@@ -506,6 +510,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
506 510
507 status = acpi_ex_convert_to_buffer(operand[0], &return_desc); 511 status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
508 if (return_desc == operand[0]) { 512 if (return_desc == operand[0]) {
513
509 /* No conversion performed, add ref to handle return value */ 514 /* No conversion performed, add ref to handle return value */
510 acpi_ut_add_reference(return_desc); 515 acpi_ut_add_reference(return_desc);
511 } 516 }
@@ -516,6 +521,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
516 status = acpi_ex_convert_to_integer(operand[0], &return_desc, 521 status = acpi_ex_convert_to_integer(operand[0], &return_desc,
517 ACPI_ANY_BASE); 522 ACPI_ANY_BASE);
518 if (return_desc == operand[0]) { 523 if (return_desc == operand[0]) {
524
519 /* No conversion performed, add ref to handle return value */ 525 /* No conversion performed, add ref to handle return value */
520 acpi_ut_add_reference(return_desc); 526 acpi_ut_add_reference(return_desc);
521 } 527 }
@@ -541,6 +547,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
541 } 547 }
542 548
543 if (ACPI_SUCCESS(status)) { 549 if (ACPI_SUCCESS(status)) {
550
544 /* Store the return value computed above into the target object */ 551 /* Store the return value computed above into the target object */
545 552
546 status = acpi_ex_store(return_desc, operand[1], walk_state); 553 status = acpi_ex_store(return_desc, operand[1], walk_state);
@@ -548,16 +555,18 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
548 555
549 cleanup: 556 cleanup:
550 557
551 if (!walk_state->result_obj) {
552 walk_state->result_obj = return_desc;
553 }
554
555 /* Delete return object on error */ 558 /* Delete return object on error */
556 559
557 if (ACPI_FAILURE(status)) { 560 if (ACPI_FAILURE(status)) {
558 acpi_ut_remove_reference(return_desc); 561 acpi_ut_remove_reference(return_desc);
559 } 562 }
560 563
564 /* Save return object on success */
565
566 else if (!walk_state->result_obj) {
567 walk_state->result_obj = return_desc;
568 }
569
561 return_ACPI_STATUS(status); 570 return_ACPI_STATUS(status);
562} 571}
563 572
@@ -582,7 +591,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
582 u32 type; 591 u32 type;
583 acpi_integer value; 592 acpi_integer value;
584 593
585 ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", 594 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R,
586 acpi_ps_get_opcode_name(walk_state->opcode)); 595 acpi_ps_get_opcode_name(walk_state->opcode));
587 596
588 /* Examine the AML opcode */ 597 /* Examine the AML opcode */
@@ -625,6 +634,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
625 temp_desc = operand[0]; 634 temp_desc = operand[0];
626 if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == 635 if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
627 ACPI_DESC_TYPE_OPERAND) { 636 ACPI_DESC_TYPE_OPERAND) {
637
628 /* Internal reference object - prevent deletion */ 638 /* Internal reference object - prevent deletion */
629 639
630 acpi_ut_add_reference(temp_desc); 640 acpi_ut_add_reference(temp_desc);
@@ -689,6 +699,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
689 if (ACPI_FAILURE(status)) { 699 if (ACPI_FAILURE(status)) {
690 goto cleanup; 700 goto cleanup;
691 } 701 }
702
692 /* Allocate a descriptor to hold the type. */ 703 /* Allocate a descriptor to hold the type. */
693 704
694 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 705 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -777,8 +788,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
777 788
778 /* Check for a method local or argument, or standalone String */ 789 /* Check for a method local or argument, or standalone String */
779 790
780 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != 791 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
781 ACPI_DESC_TYPE_NAMED) { 792 ACPI_DESC_TYPE_NAMED) {
793 temp_desc =
794 acpi_ns_get_attached_object((struct
795 acpi_namespace_node *)
796 operand[0]);
797 if (temp_desc
798 &&
799 ((ACPI_GET_OBJECT_TYPE(temp_desc) ==
800 ACPI_TYPE_STRING)
801 || (ACPI_GET_OBJECT_TYPE(temp_desc) ==
802 ACPI_TYPE_LOCAL_REFERENCE))) {
803 operand[0] = temp_desc;
804 acpi_ut_add_reference(temp_desc);
805 } else {
806 status = AE_AML_OPERAND_TYPE;
807 goto cleanup;
808 }
809 } else {
782 switch (ACPI_GET_OBJECT_TYPE(operand[0])) { 810 switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
783 case ACPI_TYPE_LOCAL_REFERENCE: 811 case ACPI_TYPE_LOCAL_REFERENCE:
784 /* 812 /*
@@ -827,26 +855,35 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
827 break; 855 break;
828 856
829 case ACPI_TYPE_STRING: 857 case ACPI_TYPE_STRING:
858 break;
830 859
860 default:
861 status = AE_AML_OPERAND_TYPE;
862 goto cleanup;
863 }
864 }
865
866 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
867 ACPI_DESC_TYPE_NAMED) {
868 if (ACPI_GET_OBJECT_TYPE(operand[0]) ==
869 ACPI_TYPE_STRING) {
831 /* 870 /*
832 * This is a deref_of (String). The string is a reference 871 * This is a deref_of (String). The string is a reference
833 * to a named ACPI object. 872 * to a named ACPI object.
834 * 873 *
835 * 1) Find the owning Node 874 * 1) Find the owning Node
836 * 2) Dereference the node to an actual object. Could be a 875 * 2) Dereference the node to an actual object. Could be a
837 * Field, so we need to resolve the node to a value. 876 * Field, so we need to resolve the node to a value.
838 */ 877 */
839 status = 878 status =
840 acpi_ns_get_node_by_path(operand[0]->string. 879 acpi_ns_get_node(walk_state->scope_info->
841 pointer, 880 scope.node,
842 walk_state-> 881 operand[0]->string.pointer,
843 scope_info->scope. 882 ACPI_NS_SEARCH_PARENT,
844 node, 883 ACPI_CAST_INDIRECT_PTR
845 ACPI_NS_SEARCH_PARENT, 884 (struct
846 ACPI_CAST_INDIRECT_PTR 885 acpi_namespace_node,
847 (struct 886 &return_desc));
848 acpi_namespace_node,
849 &return_desc));
850 if (ACPI_FAILURE(status)) { 887 if (ACPI_FAILURE(status)) {
851 goto cleanup; 888 goto cleanup;
852 } 889 }
@@ -857,11 +894,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
857 (struct acpi_namespace_node, &return_desc), 894 (struct acpi_namespace_node, &return_desc),
858 walk_state); 895 walk_state);
859 goto cleanup; 896 goto cleanup;
860
861 default:
862
863 status = AE_AML_OPERAND_TYPE;
864 goto cleanup;
865 } 897 }
866 } 898 }
867 899
@@ -937,13 +969,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
937 acpi_ut_add_reference 969 acpi_ut_add_reference
938 (return_desc); 970 (return_desc);
939 } 971 }
940
941 break; 972 break;
942 973
943 default: 974 default:
944 975
945 ACPI_ERROR((AE_INFO, 976 ACPI_ERROR((AE_INFO,
946 "Unknown Index target_type %X in obj %p", 977 "Unknown Index TargetType %X in obj %p",
947 operand[0]->reference. 978 operand[0]->reference.
948 target_type, operand[0])); 979 target_type, operand[0]));
949 status = AE_AML_OPERAND_TYPE; 980 status = AE_AML_OPERAND_TYPE;
@@ -957,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
957 988
958 if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == 989 if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
959 ACPI_DESC_TYPE_NAMED) { 990 ACPI_DESC_TYPE_NAMED) {
960
961 return_desc = 991 return_desc =
962 acpi_ns_get_attached_object((struct 992 acpi_ns_get_attached_object((struct
963 acpi_namespace_node 993 acpi_namespace_node
@@ -972,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
972 1002
973 default: 1003 default:
974 ACPI_ERROR((AE_INFO, 1004 ACPI_ERROR((AE_INFO,
975 "Unknown opcode in ref(%p) - %X", 1005 "Unknown opcode in reference(%p) - %X",
976 operand[0], 1006 operand[0],
977 operand[0]->reference.opcode)); 1007 operand[0]->reference.opcode));
978 1008
@@ -998,6 +1028,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
998 acpi_ut_remove_reference(return_desc); 1028 acpi_ut_remove_reference(return_desc);
999 } 1029 }
1000 1030
1001 walk_state->result_obj = return_desc; 1031 /* Save return object on success */
1032
1033 else {
1034 walk_state->result_obj = return_desc;
1035 }
1036
1002 return_ACPI_STATUS(status); 1037 return_ACPI_STATUS(status);
1003} 1038}
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c
index e263a5ddd405..7d2cbc113160 100644
--- a/drivers/acpi/executer/exoparg2.c
+++ b/drivers/acpi/executer/exoparg2.c
@@ -92,7 +92,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
92 u32 value; 92 u32 value;
93 acpi_status status = AE_OK; 93 acpi_status status = AE_OK;
94 94
95 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R", 95 ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_0R,
96 acpi_ps_get_opcode_name(walk_state->opcode)); 96 acpi_ps_get_opcode_name(walk_state->opcode));
97 97
98 /* Examine the opcode */ 98 /* Examine the opcode */
@@ -121,7 +121,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
121#ifdef ACPI_GPE_NOTIFY_CHECK 121#ifdef ACPI_GPE_NOTIFY_CHECK
122 /* 122 /*
123 * 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
124 * don't receive any "device_wake" Notifies from a GPE _Lxx or _Exx 124 * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
125 * GPE method during system runtime. If we do, the GPE is marked 125 * GPE method during system runtime. If we do, the GPE is marked
126 * as "wake-only" and disabled. 126 * as "wake-only" and disabled.
127 * 127 *
@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
138 acpi_ev_check_for_wake_only_gpe(walk_state-> 138 acpi_ev_check_for_wake_only_gpe(walk_state->
139 gpe_event_info); 139 gpe_event_info);
140 if (ACPI_FAILURE(status)) { 140 if (ACPI_FAILURE(status)) {
141
141 /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ 142 /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
142 143
143 return_ACPI_STATUS(AE_OK) 144 return_ACPI_STATUS(AE_OK)
@@ -185,7 +186,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
185 union acpi_operand_object *return_desc2 = NULL; 186 union acpi_operand_object *return_desc2 = NULL;
186 acpi_status status; 187 acpi_status status;
187 188
188 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R", 189 ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_2T_1R,
189 acpi_ps_get_opcode_name(walk_state->opcode)); 190 acpi_ps_get_opcode_name(walk_state->opcode));
190 191
191 /* Execute the opcode */ 192 /* Execute the opcode */
@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
252 acpi_ut_remove_reference(return_desc2); 253 acpi_ut_remove_reference(return_desc2);
253 254
254 if (ACPI_FAILURE(status)) { 255 if (ACPI_FAILURE(status)) {
256
255 /* Delete the return object */ 257 /* Delete the return object */
256 258
257 acpi_ut_remove_reference(return_desc1); 259 acpi_ut_remove_reference(return_desc1);
@@ -281,12 +283,13 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
281 acpi_status status = AE_OK; 283 acpi_status status = AE_OK;
282 acpi_size length; 284 acpi_size length;
283 285
284 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R", 286 ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R,
285 acpi_ps_get_opcode_name(walk_state->opcode)); 287 acpi_ps_get_opcode_name(walk_state->opcode));
286 288
287 /* Execute the opcode */ 289 /* Execute the opcode */
288 290
289 if (walk_state->op_info->flags & AML_MATH) { 291 if (walk_state->op_info->flags & AML_MATH) {
292
290 /* All simple math opcodes (add, etc.) */ 293 /* All simple math opcodes (add, etc.) */
291 294
292 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 295 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
383 goto cleanup; 386 goto cleanup;
384 } 387 }
385 388
389 /* Initialize the Index reference object */
390
386 index = operand[1]->integer.value; 391 index = operand[1]->integer.value;
392 return_desc->reference.offset = (u32) index;
393 return_desc->reference.opcode = AML_INDEX_OP;
387 394
388 /* At this point, the Source operand is a Package, Buffer, or String */ 395 /*
396 * At this point, the Source operand is a String, Buffer, or Package.
397 * Verify that the index is within range.
398 */
399 switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
400 case ACPI_TYPE_STRING:
389 401
390 if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { 402 if (index >= operand[0]->string.length) {
391 /* Object to be indexed is a Package */ 403 status = AE_AML_STRING_LIMIT;
404 }
405
406 return_desc->reference.target_type =
407 ACPI_TYPE_BUFFER_FIELD;
408 break;
409
410 case ACPI_TYPE_BUFFER:
411
412 if (index >= operand[0]->buffer.length) {
413 status = AE_AML_BUFFER_LIMIT;
414 }
415
416 return_desc->reference.target_type =
417 ACPI_TYPE_BUFFER_FIELD;
418 break;
419
420 case ACPI_TYPE_PACKAGE:
392 421
393 if (index >= operand[0]->package.count) { 422 if (index >= operand[0]->package.count) {
394 ACPI_ERROR((AE_INFO,
395 "Index value (%X%8.8X) beyond package end (%X)",
396 ACPI_FORMAT_UINT64(index),
397 operand[0]->package.count));
398 status = AE_AML_PACKAGE_LIMIT; 423 status = AE_AML_PACKAGE_LIMIT;
399 goto cleanup;
400 } 424 }
401 425
402 return_desc->reference.target_type = ACPI_TYPE_PACKAGE; 426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
403 return_desc->reference.object = operand[0];
404 return_desc->reference.where = 427 return_desc->reference.where =
405 &operand[0]->package.elements[index]; 428 &operand[0]->package.elements[index];
406 } else { 429 break;
407 /* Object to be indexed is a Buffer/String */
408 430
409 if (index >= operand[0]->buffer.length) { 431 default:
410 ACPI_ERROR((AE_INFO,
411 "Index value (%X%8.8X) beyond end of buffer (%X)",
412 ACPI_FORMAT_UINT64(index),
413 operand[0]->buffer.length));
414 status = AE_AML_BUFFER_LIMIT;
415 goto cleanup;
416 }
417 432
418 return_desc->reference.target_type = 433 status = AE_AML_INTERNAL;
419 ACPI_TYPE_BUFFER_FIELD; 434 goto cleanup;
420 return_desc->reference.object = operand[0]; 435 }
436
437 /* Failure means that the Index was beyond the end of the object */
438
439 if (ACPI_FAILURE(status)) {
440 ACPI_EXCEPTION((AE_INFO, status,
441 "Index (%X%8.8X) is beyond end of object",
442 ACPI_FORMAT_UINT64(index)));
443 goto cleanup;
421 } 444 }
422 445
423 /* 446 /*
424 * Add a reference to the target package/buffer/string for the life 447 * Save the target object and add a reference to it for the life
425 * of the index. 448 * of the index
426 */ 449 */
450 return_desc->reference.object = operand[0];
427 acpi_ut_add_reference(operand[0]); 451 acpi_ut_add_reference(operand[0]);
428 452
429 /* Complete the Index reference object */
430
431 return_desc->reference.opcode = AML_INDEX_OP;
432 return_desc->reference.offset = (u32) index;
433
434 /* Store the reference to the Target */ 453 /* Store the reference to the Target */
435 454
436 status = acpi_ex_store(return_desc, operand[2], walk_state); 455 status = acpi_ex_store(return_desc, operand[2], walk_state);
@@ -495,7 +514,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
495 acpi_status status = AE_OK; 514 acpi_status status = AE_OK;
496 u8 logical_result = FALSE; 515 u8 logical_result = FALSE;
497 516
498 ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R", 517 ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_1R,
499 acpi_ps_get_opcode_name(walk_state->opcode)); 518 acpi_ps_get_opcode_name(walk_state->opcode));
500 519
501 /* Create the internal return object */ 520 /* Create the internal return object */
@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
509 /* Execute the Opcode */ 528 /* Execute the Opcode */
510 529
511 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { 530 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
531
512 /* logical_op (Operand0, Operand1) */ 532 /* logical_op (Operand0, Operand1) */
513 533
514 status = acpi_ex_do_logical_numeric_op(walk_state->opcode, 534 status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
518 value, &logical_result); 538 value, &logical_result);
519 goto store_logical_result; 539 goto store_logical_result;
520 } else if (walk_state->op_info->flags & AML_LOGICAL) { 540 } else if (walk_state->op_info->flags & AML_LOGICAL) {
541
521 /* logical_op (Operand0, Operand1) */ 542 /* logical_op (Operand0, Operand1) */
522 543
523 status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], 544 status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c
index 6a3a883cb8a3..e2d945dfd509 100644
--- a/drivers/acpi/executer/exoparg3.c
+++ b/drivers/acpi/executer/exoparg3.c
@@ -88,20 +88,19 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
88 struct acpi_signal_fatal_info *fatal; 88 struct acpi_signal_fatal_info *fatal;
89 acpi_status status = AE_OK; 89 acpi_status status = AE_OK;
90 90
91 ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", 91 ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R,
92 acpi_ps_get_opcode_name(walk_state->opcode)); 92 acpi_ps_get_opcode_name(walk_state->opcode));
93 93
94 switch (walk_state->opcode) { 94 switch (walk_state->opcode) {
95 case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ 95 case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
96 96
97 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 97 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
98 "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", 98 "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
99 (u32) operand[0]->integer.value, 99 (u32) operand[0]->integer.value,
100 (u32) operand[1]->integer.value, 100 (u32) operand[1]->integer.value,
101 (u32) operand[2]->integer.value)); 101 (u32) operand[2]->integer.value));
102 102
103 fatal = 103 fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
104 ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
105 if (fatal) { 104 if (fatal) {
106 fatal->type = (u32) operand[0]->integer.value; 105 fatal->type = (u32) operand[0]->integer.value;
107 fatal->code = (u32) operand[1]->integer.value; 106 fatal->code = (u32) operand[1]->integer.value;
@@ -114,7 +113,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
114 113
115 /* Might return while OS is shutting down, just continue */ 114 /* Might return while OS is shutting down, just continue */
116 115
117 ACPI_MEM_FREE(fatal); 116 ACPI_FREE(fatal);
118 break; 117 break;
119 118
120 default: 119 default:
@@ -151,7 +150,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
151 acpi_integer index; 150 acpi_integer index;
152 acpi_size length; 151 acpi_size length;
153 152
154 ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", 153 ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R,
155 acpi_ps_get_opcode_name(walk_state->opcode)); 154 acpi_ps_get_opcode_name(walk_state->opcode));
156 155
157 switch (walk_state->opcode) { 156 switch (walk_state->opcode) {
@@ -196,7 +195,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
196 195
197 /* Always allocate a new buffer for the String */ 196 /* Always allocate a new buffer for the String */
198 197
199 buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); 198 buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1);
200 if (!buffer) { 199 if (!buffer) {
201 status = AE_NO_MEMORY; 200 status = AE_NO_MEMORY;
202 goto cleanup; 201 goto cleanup;
@@ -208,9 +207,10 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
208 /* If the requested length is zero, don't allocate a buffer */ 207 /* If the requested length is zero, don't allocate a buffer */
209 208
210 if (length > 0) { 209 if (length > 0) {
210
211 /* Allocate a new buffer for the Buffer */ 211 /* Allocate a new buffer for the Buffer */
212 212
213 buffer = ACPI_MEM_CALLOCATE(length); 213 buffer = ACPI_ALLOCATE_ZEROED(length);
214 if (!buffer) { 214 if (!buffer) {
215 status = AE_NO_MEMORY; 215 status = AE_NO_MEMORY;
216 goto cleanup; 216 goto cleanup;
@@ -225,6 +225,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
225 } 225 }
226 226
227 if (buffer) { 227 if (buffer) {
228
228 /* We have a buffer, copy the portion requested */ 229 /* We have a buffer, copy the portion requested */
229 230
230 ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, 231 ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c
index e043d924444f..f0c0ba6eb408 100644
--- a/drivers/acpi/executer/exoparg6.c
+++ b/drivers/acpi/executer/exoparg6.c
@@ -220,7 +220,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
220 acpi_integer index; 220 acpi_integer index;
221 union acpi_operand_object *this_element; 221 union acpi_operand_object *this_element;
222 222
223 ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", 223 ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R,
224 acpi_ps_get_opcode_name(walk_state->opcode)); 224 acpi_ps_get_opcode_name(walk_state->opcode));
225 225
226 switch (walk_state->opcode) { 226 switch (walk_state->opcode) {
@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
276 * match was found. 276 * match was found.
277 */ 277 */
278 for (; index < operand[0]->package.count; index++) { 278 for (; index < operand[0]->package.count; index++) {
279
279 /* Get the current package element */ 280 /* Get the current package element */
280 281
281 this_element = operand[0]->package.elements[index]; 282 this_element = operand[0]->package.elements[index];
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
index 7719ae5d4f16..44d064f427b9 100644
--- a/drivers/acpi/executer/exprep.c
+++ b/drivers/acpi/executer/exprep.c
@@ -97,7 +97,7 @@ acpi_ex_generate_access(u32 field_bit_offset,
97 u32 minimum_accesses = 0xFFFFFFFF; 97 u32 minimum_accesses = 0xFFFFFFFF;
98 u32 accesses; 98 u32 accesses;
99 99
100 ACPI_FUNCTION_TRACE("ex_generate_access"); 100 ACPI_FUNCTION_TRACE(ex_generate_access);
101 101
102 /* Round Field start offset and length to "minimal" byte boundaries */ 102 /* Round Field start offset and length to "minimal" byte boundaries */
103 103
@@ -146,7 +146,7 @@ acpi_ex_generate_access(u32 field_bit_offset,
146 accesses = field_end_offset - field_start_offset; 146 accesses = field_end_offset - field_start_offset;
147 147
148 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 148 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
149 "access_width %d end is within region\n", 149 "AccessWidth %d end is within region\n",
150 access_byte_width)); 150 access_byte_width));
151 151
152 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 152 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
@@ -173,7 +173,7 @@ acpi_ex_generate_access(u32 field_bit_offset,
173 } 173 }
174 } else { 174 } else {
175 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 175 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
176 "access_width %d end is NOT within region\n", 176 "AccessWidth %d end is NOT within region\n",
177 access_byte_width)); 177 access_byte_width));
178 if (access_byte_width == 1) { 178 if (access_byte_width == 1) {
179 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 179 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
@@ -228,7 +228,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
228 u32 byte_alignment; 228 u32 byte_alignment;
229 u32 bit_length; 229 u32 bit_length;
230 230
231 ACPI_FUNCTION_TRACE("ex_decode_field_access"); 231 ACPI_FUNCTION_TRACE(ex_decode_field_access);
232 232
233 access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); 233 access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
234 234
@@ -322,7 +322,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
322 u32 byte_alignment; 322 u32 byte_alignment;
323 u32 nearest_byte_address; 323 u32 nearest_byte_address;
324 324
325 ACPI_FUNCTION_TRACE("ex_prep_common_field_object"); 325 ACPI_FUNCTION_TRACE(ex_prep_common_field_object);
326 326
327 /* 327 /*
328 * Note: the structure being initialized is the 328 * Note: the structure being initialized is the
@@ -415,13 +415,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
415 u32 type; 415 u32 type;
416 acpi_status status; 416 acpi_status status;
417 417
418 ACPI_FUNCTION_TRACE("ex_prep_field_value"); 418 ACPI_FUNCTION_TRACE(ex_prep_field_value);
419 419
420 /* Parameter validation */ 420 /* Parameter validation */
421 421
422 if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { 422 if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
423 if (!info->region_node) { 423 if (!info->region_node) {
424 ACPI_ERROR((AE_INFO, "Null region_node")); 424 ACPI_ERROR((AE_INFO, "Null RegionNode"));
425 return_ACPI_STATUS(AE_AML_NO_OPERAND); 425 return_ACPI_STATUS(AE_AML_NO_OPERAND);
426 } 426 }
427 427
@@ -467,7 +467,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
467 acpi_ut_add_reference(obj_desc->field.region_obj); 467 acpi_ut_add_reference(obj_desc->field.region_obj);
468 468
469 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 469 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
470 "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", 470 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
471 obj_desc->field.start_field_bit_offset, 471 obj_desc->field.start_field_bit_offset,
472 obj_desc->field.base_byte_offset, 472 obj_desc->field.base_byte_offset,
473 obj_desc->field.access_byte_width, 473 obj_desc->field.access_byte_width,
@@ -488,7 +488,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
488 acpi_ut_add_reference(obj_desc->bank_field.bank_obj); 488 acpi_ut_add_reference(obj_desc->bank_field.bank_obj);
489 489
490 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 490 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
491 "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", 491 "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n",
492 obj_desc->bank_field.start_field_bit_offset, 492 obj_desc->bank_field.start_field_bit_offset,
493 obj_desc->bank_field.base_byte_offset, 493 obj_desc->bank_field.base_byte_offset,
494 obj_desc->field.access_byte_width, 494 obj_desc->field.access_byte_width,
@@ -519,16 +519,29 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
519 acpi_ut_add_reference(obj_desc->index_field.index_obj); 519 acpi_ut_add_reference(obj_desc->index_field.index_obj);
520 520
521 /* 521 /*
522 * April 2006: Changed to match MS behavior
523 *
522 * The value written to the Index register is the byte offset of the 524 * The value written to the Index register is the byte offset of the
523 * target field 525 * target field in units of the granularity of the index_field
524 * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position) 526 *
527 * Previously, the value was calculated as an index in terms of the
528 * width of the Data register, as below:
529 *
530 * obj_desc->index_field.Value = (u32)
531 * (Info->field_bit_position / ACPI_MUL_8 (
532 * obj_desc->Field.access_byte_width));
533 *
534 * February 2006: Tried value as a byte offset:
535 * obj_desc->index_field.Value = (u32)
536 * ACPI_DIV_8 (Info->field_bit_position);
525 */ 537 */
526 obj_desc->index_field.value = (u32) 538 obj_desc->index_field.value =
527 (info->field_bit_position / 539 (u32) ACPI_ROUND_DOWN(ACPI_DIV_8(info->field_bit_position),
528 ACPI_MUL_8(obj_desc->field.access_byte_width)); 540 obj_desc->index_field.
541 access_byte_width);
529 542
530 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 543 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
531 "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", 544 "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
532 obj_desc->index_field.start_field_bit_offset, 545 obj_desc->index_field.start_field_bit_offset,
533 obj_desc->index_field.base_byte_offset, 546 obj_desc->index_field.base_byte_offset,
534 obj_desc->index_field.value, 547 obj_desc->index_field.value,
@@ -550,7 +563,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
550 acpi_ns_get_type(info->field_node)); 563 acpi_ns_get_type(info->field_node));
551 564
552 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 565 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
553 "Set named_obj %p [%4.4s], obj_desc %p\n", 566 "Set NamedObj %p [%4.4s], ObjDesc %p\n",
554 info->field_node, 567 info->field_node,
555 acpi_ut_get_node_name(info->field_node), obj_desc)); 568 acpi_ut_get_node_name(info->field_node), obj_desc));
556 569
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c
index 6a4cfdff606d..3cc97ba48b36 100644
--- a/drivers/acpi/executer/exregion.c
+++ b/drivers/acpi/executer/exregion.c
@@ -81,7 +81,7 @@ acpi_ex_system_memory_space_handler(u32 function,
81 u32 remainder; 81 u32 remainder;
82#endif 82#endif
83 83
84 ACPI_FUNCTION_TRACE("ex_system_memory_space_handler"); 84 ACPI_FUNCTION_TRACE(ex_system_memory_space_handler);
85 85
86 /* Validate and translate the bit width */ 86 /* Validate and translate the bit width */
87 87
@@ -103,7 +103,7 @@ acpi_ex_system_memory_space_handler(u32 function,
103 break; 103 break;
104 104
105 default: 105 default:
106 ACPI_ERROR((AE_INFO, "Invalid system_memory width %d", 106 ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d",
107 bit_width)); 107 bit_width));
108 return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 108 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
109 } 109 }
@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function,
135 * Delete the existing mapping and create a new one. 135 * Delete the existing mapping and create a new one.
136 */ 136 */
137 if (mem_info->mapped_length) { 137 if (mem_info->mapped_length) {
138
138 /* Valid mapping, delete it */ 139 /* Valid mapping, delete it */
139 140
140 acpi_os_unmap_memory(mem_info->mapped_logical_address, 141 acpi_os_unmap_memory(mem_info->mapped_logical_address,
@@ -181,8 +182,8 @@ acpi_ex_system_memory_space_handler(u32 function,
181 (acpi_integer) mem_info->mapped_physical_address); 182 (acpi_integer) mem_info->mapped_physical_address);
182 183
183 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 184 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
184 "system_memory %d (%d width) Address=%8.8X%8.8X\n", 185 "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
185 function, bit_width, ACPI_FORMAT_UINT64(address))); 186 bit_width, function, ACPI_FORMAT_UINT64(address)));
186 187
187 /* 188 /*
188 * Perform the memory read or write 189 * Perform the memory read or write
@@ -283,11 +284,11 @@ acpi_ex_system_io_space_handler(u32 function,
283 acpi_status status = AE_OK; 284 acpi_status status = AE_OK;
284 u32 value32; 285 u32 value32;
285 286
286 ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); 287 ACPI_FUNCTION_TRACE(ex_system_io_space_handler);
287 288
288 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 289 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
289 "system_iO %d (%d width) Address=%8.8X%8.8X\n", 290 "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
290 function, bit_width, ACPI_FORMAT_UINT64(address))); 291 bit_width, function, ACPI_FORMAT_UINT64(address)));
291 292
292 /* Decode the function parameter */ 293 /* Decode the function parameter */
293 294
@@ -342,7 +343,7 @@ acpi_ex_pci_config_space_handler(u32 function,
342 struct acpi_pci_id *pci_id; 343 struct acpi_pci_id *pci_id;
343 u16 pci_register; 344 u16 pci_register;
344 345
345 ACPI_FUNCTION_TRACE("ex_pci_config_space_handler"); 346 ACPI_FUNCTION_TRACE(ex_pci_config_space_handler);
346 347
347 /* 348 /*
348 * The arguments to acpi_os(Read|Write)pci_configuration are: 349 * The arguments to acpi_os(Read|Write)pci_configuration are:
@@ -360,7 +361,7 @@ acpi_ex_pci_config_space_handler(u32 function,
360 pci_register = (u16) (u32) address; 361 pci_register = (u16) (u32) address;
361 362
362 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 363 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
363 "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",
364 function, bit_width, pci_id->segment, pci_id->bus, 365 function, bit_width, pci_id->segment, pci_id->bus,
365 pci_id->device, pci_id->function, pci_register)); 366 pci_id->device, pci_id->function, pci_register));
366 367
@@ -414,7 +415,7 @@ acpi_ex_cmos_space_handler(u32 function,
414{ 415{
415 acpi_status status = AE_OK; 416 acpi_status status = AE_OK;
416 417
417 ACPI_FUNCTION_TRACE("ex_cmos_space_handler"); 418 ACPI_FUNCTION_TRACE(ex_cmos_space_handler);
418 419
419 return_ACPI_STATUS(status); 420 return_ACPI_STATUS(status);
420} 421}
@@ -446,7 +447,7 @@ acpi_ex_pci_bar_space_handler(u32 function,
446{ 447{
447 acpi_status status = AE_OK; 448 acpi_status status = AE_OK;
448 449
449 ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler"); 450 ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler);
450 451
451 return_ACPI_STATUS(status); 452 return_ACPI_STATUS(status);
452} 453}
@@ -476,23 +477,16 @@ acpi_ex_data_table_space_handler(u32 function,
476 acpi_integer * value, 477 acpi_integer * value,
477 void *handler_context, void *region_context) 478 void *handler_context, void *region_context)
478{ 479{
479 acpi_status status = AE_OK; 480 ACPI_FUNCTION_TRACE(ex_data_table_space_handler);
480 u32 byte_width = ACPI_DIV_8(bit_width);
481 u32 i;
482 char *logical_addr_ptr;
483
484 ACPI_FUNCTION_TRACE("ex_data_table_space_handler");
485
486 logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
487 481
488 /* Perform the memory read or write */ 482 /* Perform the memory read or write */
489 483
490 switch (function) { 484 switch (function) {
491 case ACPI_READ: 485 case ACPI_READ:
492 486
493 for (i = 0; i < byte_width; i++) { 487 ACPI_MEMCPY(ACPI_CAST_PTR(char, value),
494 ((char *)value)[i] = logical_addr_ptr[i]; 488 ACPI_PHYSADDR_TO_PTR(address),
495 } 489 ACPI_DIV_8(bit_width));
496 break; 490 break;
497 491
498 case ACPI_WRITE: 492 case ACPI_WRITE:
@@ -501,5 +495,5 @@ acpi_ex_data_table_space_handler(u32 function,
501 return_ACPI_STATUS(AE_SUPPORT); 495 return_ACPI_STATUS(AE_SUPPORT);
502 } 496 }
503 497
504 return_ACPI_STATUS(status); 498 return_ACPI_STATUS(AE_OK);
505} 499}
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
index 01b26c80d22b..3089b05a1368 100644
--- a/drivers/acpi/executer/exresnte.c
+++ b/drivers/acpi/executer/exresnte.c
@@ -87,7 +87,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
87 struct acpi_namespace_node *node; 87 struct acpi_namespace_node *node;
88 acpi_object_type entry_type; 88 acpi_object_type entry_type;
89 89
90 ACPI_FUNCTION_TRACE("ex_resolve_node_to_value"); 90 ACPI_FUNCTION_TRACE(ex_resolve_node_to_value);
91 91
92 /* 92 /*
93 * 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
@@ -97,12 +97,13 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
97 source_desc = acpi_ns_get_attached_object(node); 97 source_desc = acpi_ns_get_attached_object(node);
98 entry_type = acpi_ns_get_type((acpi_handle) node); 98 entry_type = acpi_ns_get_type((acpi_handle) node);
99 99
100 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", 100 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
101 node, source_desc, 101 node, source_desc,
102 acpi_ut_get_type_name(entry_type))); 102 acpi_ut_get_type_name(entry_type)));
103 103
104 if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || 104 if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
105 (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { 105 (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
106
106 /* There is always exactly one level of indirection */ 107 /* There is always exactly one level of indirection */
107 108
108 node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); 109 node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
@@ -113,10 +114,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
113 114
114 /* 115 /*
115 * Several object types require no further processing: 116 * Several object types require no further processing:
116 * 1) Devices rarely have an attached object, return the Node 117 * 1) Device/Thermal objects don't have a "real" subobject, return the Node
117 * 2) Method locals and arguments have a pseudo-Node 118 * 2) Method locals and arguments have a pseudo-Node
118 */ 119 */
119 if (entry_type == ACPI_TYPE_DEVICE || 120 if ((entry_type == ACPI_TYPE_DEVICE) ||
121 (entry_type == ACPI_TYPE_THERMAL) ||
120 (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { 122 (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
121 return_ACPI_STATUS(AE_OK); 123 return_ACPI_STATUS(AE_OK);
122 } 124 }
@@ -141,6 +143,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
141 143
142 status = acpi_ds_get_package_arguments(source_desc); 144 status = acpi_ds_get_package_arguments(source_desc);
143 if (ACPI_SUCCESS(status)) { 145 if (ACPI_SUCCESS(status)) {
146
144 /* Return an additional reference to the object */ 147 /* Return an additional reference to the object */
145 148
146 obj_desc = source_desc; 149 obj_desc = source_desc;
@@ -158,6 +161,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
158 161
159 status = acpi_ds_get_buffer_arguments(source_desc); 162 status = acpi_ds_get_buffer_arguments(source_desc);
160 if (ACPI_SUCCESS(status)) { 163 if (ACPI_SUCCESS(status)) {
164
161 /* Return an additional reference to the object */ 165 /* Return an additional reference to the object */
162 166
163 obj_desc = source_desc; 167 obj_desc = source_desc;
@@ -199,7 +203,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
199 case ACPI_TYPE_LOCAL_INDEX_FIELD: 203 case ACPI_TYPE_LOCAL_INDEX_FIELD:
200 204
201 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 205 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
202 "field_read Node=%p source_desc=%p Type=%X\n", 206 "FieldRead Node=%p SourceDesc=%p Type=%X\n",
203 node, source_desc, entry_type)); 207 node, source_desc, entry_type));
204 208
205 status = 209 status =
@@ -213,7 +217,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
213 case ACPI_TYPE_METHOD: 217 case ACPI_TYPE_METHOD:
214 case ACPI_TYPE_POWER: 218 case ACPI_TYPE_POWER:
215 case ACPI_TYPE_PROCESSOR: 219 case ACPI_TYPE_PROCESSOR:
216 case ACPI_TYPE_THERMAL:
217 case ACPI_TYPE_EVENT: 220 case ACPI_TYPE_EVENT:
218 case ACPI_TYPE_REGION: 221 case ACPI_TYPE_REGION:
219 222
@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
240 /* This is a ddb_handle */ 243 /* This is a ddb_handle */
241 /* Return an additional reference to the object */ 244 /* Return an additional reference to the object */
242 245
246 case AML_REF_OF_OP:
247
243 obj_desc = source_desc; 248 obj_desc = source_desc;
244 acpi_ut_add_reference(obj_desc); 249 acpi_ut_add_reference(obj_desc);
245 break; 250 break;
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
index 1deed492fe88..6499de878017 100644
--- a/drivers/acpi/executer/exresolv.c
+++ b/drivers/acpi/executer/exresolv.c
@@ -78,7 +78,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
78{ 78{
79 acpi_status status; 79 acpi_status status;
80 80
81 ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); 81 ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr);
82 82
83 if (!stack_ptr || !*stack_ptr) { 83 if (!stack_ptr || !*stack_ptr) {
84 ACPI_ERROR((AE_INFO, "Internal - null pointer")); 84 ACPI_ERROR((AE_INFO, "Internal - null pointer"));
@@ -144,7 +144,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
144 union acpi_operand_object *obj_desc; 144 union acpi_operand_object *obj_desc;
145 u16 opcode; 145 u16 opcode;
146 146
147 ACPI_FUNCTION_TRACE("ex_resolve_object_to_value"); 147 ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
148 148
149 stack_desc = *stack_ptr; 149 stack_desc = *stack_ptr;
150 150
@@ -190,7 +190,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
190 } 190 }
191 191
192 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 192 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
193 "[Arg/Local %X] value_obj is %p\n", 193 "[Arg/Local %X] ValueObj is %p\n",
194 stack_desc->reference.offset, 194 stack_desc->reference.offset,
195 obj_desc)); 195 obj_desc));
196 196
@@ -239,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
239 /* Invalid reference object */ 239 /* Invalid reference object */
240 240
241 ACPI_ERROR((AE_INFO, 241 ACPI_ERROR((AE_INFO,
242 "Unknown target_type %X in Index/Reference obj %p", 242 "Unknown TargetType %X in Index/Reference obj %p",
243 stack_desc->reference.target_type, 243 stack_desc->reference.target_type,
244 stack_desc)); 244 stack_desc));
245 status = AE_AML_INTERNAL; 245 status = AE_AML_INTERNAL;
@@ -257,10 +257,24 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
257 257
258 case AML_INT_NAMEPATH_OP: /* Reference to a named object */ 258 case AML_INT_NAMEPATH_OP: /* Reference to a named object */
259 259
260 /* Get the object pointed to by the namespace node */ 260 /* Dereference the name */
261
262 if ((stack_desc->reference.node->type ==
263 ACPI_TYPE_DEVICE)
264 || (stack_desc->reference.node->type ==
265 ACPI_TYPE_THERMAL)) {
266
267 /* These node types do not have 'real' subobjects */
268
269 *stack_ptr = (void *)stack_desc->reference.node;
270 } else {
271 /* Get the object pointed to by the namespace node */
272
273 *stack_ptr =
274 (stack_desc->reference.node)->object;
275 acpi_ut_add_reference(*stack_ptr);
276 }
261 277
262 *stack_ptr = (stack_desc->reference.node)->object;
263 acpi_ut_add_reference(*stack_ptr);
264 acpi_ut_remove_reference(stack_desc); 278 acpi_ut_remove_reference(stack_desc);
265 break; 279 break;
266 280
@@ -293,7 +307,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
293 case ACPI_TYPE_LOCAL_INDEX_FIELD: 307 case ACPI_TYPE_LOCAL_INDEX_FIELD:
294 308
295 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 309 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
296 "field_read source_desc=%p Type=%X\n", 310 "FieldRead SourceDesc=%p Type=%X\n",
297 stack_desc, 311 stack_desc,
298 ACPI_GET_OBJECT_TYPE(stack_desc))); 312 ACPI_GET_OBJECT_TYPE(stack_desc)));
299 313
@@ -337,7 +351,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
337 acpi_object_type type; 351 acpi_object_type type;
338 acpi_status status; 352 acpi_status status;
339 353
340 ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple"); 354 ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple);
341 355
342 /* Operand can be either a namespace node or an operand descriptor */ 356 /* Operand can be either a namespace node or an operand descriptor */
343 357
@@ -382,10 +396,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
382 while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { 396 while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
383 switch (obj_desc->reference.opcode) { 397 switch (obj_desc->reference.opcode) {
384 case AML_REF_OF_OP: 398 case AML_REF_OF_OP:
399 case AML_INT_NAMEPATH_OP:
385 400
386 /* Dereference the reference pointer */ 401 /* Dereference the reference pointer */
387 402
388 node = obj_desc->reference.object; 403 if (obj_desc->reference.opcode == AML_REF_OF_OP) {
404 node = obj_desc->reference.object;
405 } else { /* AML_INT_NAMEPATH_OP */
406
407 node = obj_desc->reference.node;
408 }
389 409
390 /* All "References" point to a NS node */ 410 /* All "References" point to a NS node */
391 411
@@ -401,6 +421,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
401 421
402 obj_desc = acpi_ns_get_attached_object(node); 422 obj_desc = acpi_ns_get_attached_object(node);
403 if (!obj_desc) { 423 if (!obj_desc) {
424
404 /* No object, use the NS node type */ 425 /* No object, use the NS node type */
405 426
406 type = acpi_ns_get_type(node); 427 type = acpi_ns_get_type(node);
@@ -432,6 +453,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
432 */ 453 */
433 obj_desc = *(obj_desc->reference.where); 454 obj_desc = *(obj_desc->reference.where);
434 if (!obj_desc) { 455 if (!obj_desc) {
456
435 /* NULL package elements are allowed */ 457 /* NULL package elements are allowed */
436 458
437 type = 0; /* Uninitialized */ 459 type = 0; /* Uninitialized */
@@ -439,39 +461,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
439 } 461 }
440 break; 462 break;
441 463
442 case AML_INT_NAMEPATH_OP:
443
444 /* Dereference the reference pointer */
445
446 node = obj_desc->reference.node;
447
448 /* All "References" point to a NS node */
449
450 if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
451 ACPI_DESC_TYPE_NAMED) {
452 ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]",
453 node,
454 acpi_ut_get_descriptor_name(node)));
455 return_ACPI_STATUS(AE_AML_INTERNAL);
456 }
457
458 /* Get the attached object */
459
460 obj_desc = acpi_ns_get_attached_object(node);
461 if (!obj_desc) {
462 /* No object, use the NS node type */
463
464 type = acpi_ns_get_type(node);
465 goto exit;
466 }
467
468 /* Check for circular references */
469
470 if (obj_desc == operand) {
471 return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
472 }
473 break;
474
475 case AML_LOCAL_OP: 464 case AML_LOCAL_OP:
476 case AML_ARG_OP: 465 case AML_ARG_OP:
477 466
@@ -513,7 +502,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
513 502
514 case AML_DEBUG_OP: 503 case AML_DEBUG_OP:
515 504
516 /* The Debug Object is of type "debug_object" */ 505 /* The Debug Object is of type "DebugObject" */
517 506
518 type = ACPI_TYPE_DEBUG_OBJECT; 507 type = ACPI_TYPE_DEBUG_OBJECT;
519 goto exit; 508 goto exit;
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index a1c000f5a415..4c93d0972333 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
77 ACPI_FUNCTION_ENTRY(); 77 ACPI_FUNCTION_ENTRY();
78 78
79 if (type_needed == ACPI_TYPE_ANY) { 79 if (type_needed == ACPI_TYPE_ANY) {
80
80 /* All types OK, so we don't perform any typechecks */ 81 /* All types OK, so we don't perform any typechecks */
81 82
82 return (AE_OK); 83 return (AE_OK);
@@ -143,7 +144,7 @@ acpi_ex_resolve_operands(u16 opcode,
143 acpi_object_type type_needed; 144 acpi_object_type type_needed;
144 u16 target_op = 0; 145 u16 target_op = 0;
145 146
146 ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); 147 ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode);
147 148
148 op_info = acpi_ps_get_opcode_info(opcode); 149 op_info = acpi_ps_get_opcode_info(opcode);
149 if (op_info->class == AML_CLASS_UNKNOWN) { 150 if (op_info->class == AML_CLASS_UNKNOWN) {
@@ -158,7 +159,7 @@ acpi_ex_resolve_operands(u16 opcode,
158 } 159 }
159 160
160 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 161 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
161 "Opcode %X [%s] required_operand_types=%8.8X\n", 162 "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
162 opcode, op_info->name, arg_types)); 163 opcode, op_info->name, arg_types));
163 164
164 /* 165 /*
@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode,
224 } 225 }
225 226
226 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { 227 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
228
227 /* Decode the Reference */ 229 /* Decode the Reference */
228 230
229 op_info = acpi_ps_get_opcode_info(opcode); 231 op_info = acpi_ps_get_opcode_info(opcode);
@@ -247,7 +249,7 @@ acpi_ex_resolve_operands(u16 opcode,
247 249
248 ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT 250 ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
249 ((ACPI_DB_EXEC, 251 ((ACPI_DB_EXEC,
250 "Operand is a Reference, ref_opcode [%s]\n", 252 "Operand is a Reference, RefOpcode [%s]\n",
251 (acpi_ps_get_opcode_info 253 (acpi_ps_get_opcode_info
252 (obj_desc-> 254 (obj_desc->
253 reference. 255 reference.
@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode,
332 } 334 }
333 335
334 if (obj_desc->reference.opcode == AML_NAME_OP) { 336 if (obj_desc->reference.opcode == AML_NAME_OP) {
337
335 /* Convert a named reference to the actual named object */ 338 /* Convert a named reference to the actual named object */
336 339
337 temp_node = obj_desc->reference.object; 340 temp_node = obj_desc->reference.object;
@@ -623,7 +626,7 @@ acpi_ex_resolve_operands(u16 opcode,
623 626
624 default: 627 default:
625 ACPI_ERROR((AE_INFO, 628 ACPI_ERROR((AE_INFO,
626 "Needed [Region/region_field], found [%s] %p", 629 "Needed [Region/RegionField], found [%s] %p",
627 acpi_ut_get_object_type_name 630 acpi_ut_get_object_type_name
628 (obj_desc), obj_desc)); 631 (obj_desc), obj_desc));
629 632
@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode,
662 } 665 }
663 666
664 if (target_op == AML_DEBUG_OP) { 667 if (target_op == AML_DEBUG_OP) {
668
665 /* Allow store of any object to the Debug object */ 669 /* Allow store of any object to the Debug object */
666 670
667 break; 671 break;
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
index 3f020c0e2b95..0456405ba019 100644
--- a/drivers/acpi/executer/exstore.c
+++ b/drivers/acpi/executer/exstore.c
@@ -82,7 +82,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
82{ 82{
83 u32 i; 83 u32 i;
84 84
85 ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc); 85 ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc);
86 86
87 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", 87 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
88 level, " ")); 88 level, " "));
@@ -245,7 +245,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
245 acpi_status status = AE_OK; 245 acpi_status status = AE_OK;
246 union acpi_operand_object *ref_desc = dest_desc; 246 union acpi_operand_object *ref_desc = dest_desc;
247 247
248 ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc); 248 ACPI_FUNCTION_TRACE_PTR(ex_store, dest_desc);
249 249
250 /* Validate parameters */ 250 /* Validate parameters */
251 251
@@ -297,7 +297,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
297 297
298 ACPI_DUMP_STACK_ENTRY(source_desc); 298 ACPI_DUMP_STACK_ENTRY(source_desc);
299 ACPI_DUMP_STACK_ENTRY(dest_desc); 299 ACPI_DUMP_STACK_ENTRY(dest_desc);
300 ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", 300 ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore",
301 2, 301 2,
302 "Target is not a Reference or Constant object"); 302 "Target is not a Reference or Constant object");
303 303
@@ -396,7 +396,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
396 u8 value = 0; 396 u8 value = 0;
397 u32 i; 397 u32 i;
398 398
399 ACPI_FUNCTION_TRACE("ex_store_object_to_index"); 399 ACPI_FUNCTION_TRACE(ex_store_object_to_index);
400 400
401 /* 401 /*
402 * Destination must be a reference pointer, and 402 * Destination must be a reference pointer, and
@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
423 } 423 }
424 424
425 if (obj_desc) { 425 if (obj_desc) {
426
426 /* Decrement reference count by the ref count of the parent package */ 427 /* Decrement reference count by the ref count of the parent package */
427 428
428 for (i = 0; i < ((union acpi_operand_object *) 429 for (i = 0; i < ((union acpi_operand_object *)
@@ -502,8 +503,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
502 break; 503 break;
503 504
504 default: 505 default:
505 ACPI_ERROR((AE_INFO, 506 ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField"));
506 "Target is not a Package or buffer_field"));
507 status = AE_AML_OPERAND_TYPE; 507 status = AE_AML_OPERAND_TYPE;
508 break; 508 break;
509 } 509 }
@@ -548,7 +548,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
548 union acpi_operand_object *new_desc; 548 union acpi_operand_object *new_desc;
549 acpi_object_type target_type; 549 acpi_object_type target_type;
550 550
551 ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc); 551 ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_node, source_desc);
552 552
553 /* Get current type of the node, and object attached to Node */ 553 /* Get current type of the node, and object attached to Node */
554 554
@@ -572,6 +572,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
572 /* If no implicit conversion, drop into the default case below */ 572 /* If no implicit conversion, drop into the default case below */
573 573
574 if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { 574 if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
575
575 /* Force execution of default (no implicit conversion) */ 576 /* Force execution of default (no implicit conversion) */
576 577
577 target_type = ACPI_TYPE_ANY; 578 target_type = ACPI_TYPE_ANY;
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c
index 42967baf760d..591aaf0e18b3 100644
--- a/drivers/acpi/executer/exstoren.c
+++ b/drivers/acpi/executer/exstoren.c
@@ -72,7 +72,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
72 union acpi_operand_object *source_desc = *source_desc_ptr; 72 union acpi_operand_object *source_desc = *source_desc_ptr;
73 acpi_status status = AE_OK; 73 acpi_status status = AE_OK;
74 74
75 ACPI_FUNCTION_TRACE("ex_resolve_object"); 75 ACPI_FUNCTION_TRACE(ex_resolve_object);
76 76
77 /* Ensure we have a Target that can be stored to */ 77 /* Ensure we have a Target that can be stored to */
78 78
@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
97 */ 97 */
98 if (ACPI_GET_OBJECT_TYPE(source_desc) == 98 if (ACPI_GET_OBJECT_TYPE(source_desc) ==
99 ACPI_TYPE_LOCAL_REFERENCE) { 99 ACPI_TYPE_LOCAL_REFERENCE) {
100
100 /* Resolve a reference object first */ 101 /* Resolve a reference object first */
101 102
102 status = 103 status =
@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
121 !((ACPI_GET_OBJECT_TYPE(source_desc) == 122 !((ACPI_GET_OBJECT_TYPE(source_desc) ==
122 ACPI_TYPE_LOCAL_REFERENCE) 123 ACPI_TYPE_LOCAL_REFERENCE)
123 && (source_desc->reference.opcode == AML_LOAD_OP))) { 124 && (source_desc->reference.opcode == AML_LOAD_OP))) {
125
124 /* Conversion successful but still not a valid type */ 126 /* Conversion successful but still not a valid type */
125 127
126 ACPI_ERROR((AE_INFO, 128 ACPI_ERROR((AE_INFO,
@@ -199,7 +201,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
199 union acpi_operand_object *actual_src_desc; 201 union acpi_operand_object *actual_src_desc;
200 acpi_status status = AE_OK; 202 acpi_status status = AE_OK;
201 203
202 ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc); 204 ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_object, source_desc);
203 205
204 actual_src_desc = source_desc; 206 actual_src_desc = source_desc;
205 if (!dest_desc) { 207 if (!dest_desc) {
@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
289 } 291 }
290 292
291 if (actual_src_desc != source_desc) { 293 if (actual_src_desc != source_desc) {
294
292 /* Delete the intermediate (temporary) source object */ 295 /* Delete the intermediate (temporary) source object */
293 296
294 acpi_ut_remove_reference(actual_src_desc); 297 acpi_ut_remove_reference(actual_src_desc);
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c
index 6ab707087750..99ebe5adfcda 100644
--- a/drivers/acpi/executer/exstorob.c
+++ b/drivers/acpi/executer/exstorob.c
@@ -67,7 +67,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
67 u32 length; 67 u32 length;
68 u8 *buffer; 68 u8 *buffer;
69 69
70 ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); 70 ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc);
71 71
72 /* We know that source_desc is a buffer by now */ 72 /* We know that source_desc is a buffer by now */
73 73
@@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
80 */ 80 */
81 if ((target_desc->buffer.length == 0) || 81 if ((target_desc->buffer.length == 0) ||
82 (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { 82 (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
83 target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); 83 target_desc->buffer.pointer = ACPI_ALLOCATE(length);
84 if (!target_desc->buffer.pointer) { 84 if (!target_desc->buffer.pointer) {
85 return_ACPI_STATUS(AE_NO_MEMORY); 85 return_ACPI_STATUS(AE_NO_MEMORY);
86 } 86 }
@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
91 /* Copy source buffer to target buffer */ 91 /* Copy source buffer to target buffer */
92 92
93 if (length <= target_desc->buffer.length) { 93 if (length <= target_desc->buffer.length) {
94
94 /* Clear existing buffer and copy in the new one */ 95 /* Clear existing buffer and copy in the new one */
95 96
96 ACPI_MEMSET(target_desc->buffer.pointer, 0, 97 ACPI_MEMSET(target_desc->buffer.pointer, 0,
@@ -102,7 +103,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
102 * NOTE: ACPI versions up to 3.0 specified that the buffer must be 103 * NOTE: ACPI versions up to 3.0 specified that the buffer must be
103 * truncated if the string is smaller than the buffer. However, "other" 104 * truncated if the string is smaller than the buffer. However, "other"
104 * implementations of ACPI never did this and thus became the defacto 105 * implementations of ACPI never did this and thus became the defacto
105 * standard. ACPi 3.0_a changes this behavior such that the buffer 106 * standard. ACPI 3.0_a changes this behavior such that the buffer
106 * is no longer truncated. 107 * is no longer truncated.
107 */ 108 */
108 109
@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
113 * copy must not truncate the original buffer. 114 * copy must not truncate the original buffer.
114 */ 115 */
115 if (original_src_type == ACPI_TYPE_STRING) { 116 if (original_src_type == ACPI_TYPE_STRING) {
117
116 /* Set the new length of the target */ 118 /* Set the new length of the target */
117 119
118 target_desc->buffer.length = length; 120 target_desc->buffer.length = length;
@@ -156,7 +158,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
156 u32 length; 158 u32 length;
157 u8 *buffer; 159 u8 *buffer;
158 160
159 ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); 161 ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc);
160 162
161 /* We know that source_desc is a string by now */ 163 /* We know that source_desc is a string by now */
162 164
@@ -183,13 +185,14 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
183 */ 185 */
184 if (target_desc->string.pointer && 186 if (target_desc->string.pointer &&
185 (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { 187 (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
188
186 /* Only free if not a pointer into the DSDT */ 189 /* Only free if not a pointer into the DSDT */
187 190
188 ACPI_MEM_FREE(target_desc->string.pointer); 191 ACPI_FREE(target_desc->string.pointer);
189 } 192 }
190 193
191 target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) 194 target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size)
192 length + 1); 195 length + 1);
193 if (!target_desc->string.pointer) { 196 if (!target_desc->string.pointer) {
194 return_ACPI_STATUS(AE_NO_MEMORY); 197 return_ACPI_STATUS(AE_NO_MEMORY);
195 } 198 }
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
index ea9144f42e1f..52beee3674a0 100644
--- a/drivers/acpi/executer/exsystem.c
+++ b/drivers/acpi/executer/exsystem.c
@@ -68,7 +68,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
68 acpi_status status; 68 acpi_status status;
69 acpi_status status2; 69 acpi_status status2;
70 70
71 ACPI_FUNCTION_TRACE("ex_system_wait_semaphore"); 71 ACPI_FUNCTION_TRACE(ex_system_wait_semaphore);
72 72
73 status = acpi_os_wait_semaphore(semaphore, 1, 0); 73 status = acpi_os_wait_semaphore(semaphore, 1, 0);
74 if (ACPI_SUCCESS(status)) { 74 if (ACPI_SUCCESS(status)) {
@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
76 } 76 }
77 77
78 if (status == AE_TIME) { 78 if (status == AE_TIME) {
79
79 /* We must wait, so unlock the interpreter */ 80 /* We must wait, so unlock the interpreter */
80 81
81 acpi_ex_exit_interpreter(); 82 acpi_ex_exit_interpreter();
@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
90 91
91 status2 = acpi_ex_enter_interpreter(); 92 status2 = acpi_ex_enter_interpreter();
92 if (ACPI_FAILURE(status2)) { 93 if (ACPI_FAILURE(status2)) {
94
93 /* Report fatal error, could not acquire interpreter */ 95 /* Report fatal error, could not acquire interpreter */
94 96
95 return_ACPI_STATUS(status2); 97 return_ACPI_STATUS(status2);
@@ -191,7 +193,7 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc,
191{ 193{
192 acpi_status status = AE_OK; 194 acpi_status status = AE_OK;
193 195
194 ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc); 196 ACPI_FUNCTION_TRACE_PTR(ex_system_acquire_mutex, obj_desc);
195 197
196 if (!obj_desc) { 198 if (!obj_desc) {
197 return_ACPI_STATUS(AE_BAD_PARAMETER); 199 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -229,7 +231,7 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
229{ 231{
230 acpi_status status = AE_OK; 232 acpi_status status = AE_OK;
231 233
232 ACPI_FUNCTION_TRACE("ex_system_release_mutex"); 234 ACPI_FUNCTION_TRACE(ex_system_release_mutex);
233 235
234 if (!obj_desc) { 236 if (!obj_desc) {
235 return_ACPI_STATUS(AE_BAD_PARAMETER); 237 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -263,7 +265,7 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
263{ 265{
264 acpi_status status = AE_OK; 266 acpi_status status = AE_OK;
265 267
266 ACPI_FUNCTION_TRACE("ex_system_signal_event"); 268 ACPI_FUNCTION_TRACE(ex_system_signal_event);
267 269
268 if (obj_desc) { 270 if (obj_desc) {
269 status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); 271 status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1);
@@ -293,7 +295,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
293{ 295{
294 acpi_status status = AE_OK; 296 acpi_status status = AE_OK;
295 297
296 ACPI_FUNCTION_TRACE("ex_system_wait_event"); 298 ACPI_FUNCTION_TRACE(ex_system_wait_event);
297 299
298 if (obj_desc) { 300 if (obj_desc) {
299 status = 301 status =
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index f73a61aeb7ec..982c8b65876f 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -87,9 +87,9 @@ acpi_status acpi_ex_enter_interpreter(void)
87{ 87{
88 acpi_status status; 88 acpi_status status;
89 89
90 ACPI_FUNCTION_TRACE("ex_enter_interpreter"); 90 ACPI_FUNCTION_TRACE(ex_enter_interpreter);
91 91
92 status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); 92 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
93 if (ACPI_FAILURE(status)) { 93 if (ACPI_FAILURE(status)) {
94 ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); 94 ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
95 } 95 }
@@ -123,9 +123,9 @@ void acpi_ex_exit_interpreter(void)
123{ 123{
124 acpi_status status; 124 acpi_status status;
125 125
126 ACPI_FUNCTION_TRACE("ex_exit_interpreter"); 126 ACPI_FUNCTION_TRACE(ex_exit_interpreter);
127 127
128 status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); 128 status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
129 if (ACPI_FAILURE(status)) { 129 if (ACPI_FAILURE(status)) {
130 ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); 130 ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
131 } 131 }
@@ -189,11 +189,12 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
189 u8 locked = FALSE; 189 u8 locked = FALSE;
190 acpi_status status; 190 acpi_status status;
191 191
192 ACPI_FUNCTION_TRACE("ex_acquire_global_lock"); 192 ACPI_FUNCTION_TRACE(ex_acquire_global_lock);
193 193
194 /* Only attempt lock if the always_lock bit is set */ 194 /* Only attempt lock if the always_lock bit is set */
195 195
196 if (field_flags & AML_FIELD_LOCK_RULE_MASK) { 196 if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
197
197 /* We should attempt to get the lock, wait forever */ 198 /* We should attempt to get the lock, wait forever */
198 199
199 status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); 200 status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
@@ -225,15 +226,17 @@ void acpi_ex_release_global_lock(u8 locked_by_me)
225{ 226{
226 acpi_status status; 227 acpi_status status;
227 228
228 ACPI_FUNCTION_TRACE("ex_release_global_lock"); 229 ACPI_FUNCTION_TRACE(ex_release_global_lock);
229 230
230 /* Only attempt unlock if the caller locked it */ 231 /* Only attempt unlock if the caller locked it */
231 232
232 if (locked_by_me) { 233 if (locked_by_me) {
234
233 /* OK, now release the lock */ 235 /* OK, now release the lock */
234 236
235 status = acpi_ev_release_global_lock(); 237 status = acpi_ev_release_global_lock();
236 if (ACPI_FAILURE(status)) { 238 if (ACPI_FAILURE(status)) {
239
237 /* Report the error, but there isn't much else we can do */ 240 /* Report the error, but there isn't much else we can do */
238 241
239 ACPI_EXCEPTION((AE_INFO, status, 242 ACPI_EXCEPTION((AE_INFO, status,
@@ -263,7 +266,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
263 u32 num_digits; 266 u32 num_digits;
264 acpi_integer current_value; 267 acpi_integer current_value;
265 268
266 ACPI_FUNCTION_TRACE("ex_digits_needed"); 269 ACPI_FUNCTION_TRACE(ex_digits_needed);
267 270
268 /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ 271 /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
269 272