aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-04-18 22:49:35 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 00:08:52 -0400
commit44f6c01242da4e162f28d8e1216a8c7a91174605 (patch)
tree53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/executer
parentebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff)
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer')
-rw-r--r--drivers/acpi/executer/exconfig.c31
-rw-r--r--drivers/acpi/executer/exconvrt.c44
-rw-r--r--drivers/acpi/executer/excreate.c50
-rw-r--r--drivers/acpi/executer/exdump.c105
-rw-r--r--drivers/acpi/executer/exfield.c25
-rw-r--r--drivers/acpi/executer/exfldio.c133
-rw-r--r--drivers/acpi/executer/exmisc.c7
-rw-r--r--drivers/acpi/executer/exmutex.c45
-rw-r--r--drivers/acpi/executer/exnames.c70
-rw-r--r--drivers/acpi/executer/exoparg1.c94
-rw-r--r--drivers/acpi/executer/exoparg2.c69
-rw-r--r--drivers/acpi/executer/exoparg3.c25
-rw-r--r--drivers/acpi/executer/exoparg6.c26
-rw-r--r--drivers/acpi/executer/exprep.c104
-rw-r--r--drivers/acpi/executer/exregion.c34
-rw-r--r--drivers/acpi/executer/exresnte.c24
-rw-r--r--drivers/acpi/executer/exresolv.c63
-rw-r--r--drivers/acpi/executer/exresop.c80
-rw-r--r--drivers/acpi/executer/exstore.c260
-rw-r--r--drivers/acpi/executer/exstoren.c20
-rw-r--r--drivers/acpi/executer/exstorob.c9
-rw-r--r--drivers/acpi/executer/exsystem.c48
-rw-r--r--drivers/acpi/executer/exutils.c37
23 files changed, 896 insertions, 507 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index ac3c061967f2..734b2f24af48 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -54,6 +54,14 @@
54#define _COMPONENT ACPI_EXECUTER 54#define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exconfig") 55 ACPI_MODULE_NAME ("exconfig")
56 56
57/* Local prototypes */
58
59static acpi_status
60acpi_ex_add_table (
61 struct acpi_table_header *table,
62 struct acpi_namespace_node *parent_node,
63 union acpi_operand_object **ddb_handle);
64
57 65
58/******************************************************************************* 66/*******************************************************************************
59 * 67 *
@@ -70,7 +78,7 @@
70 * 78 *
71 ******************************************************************************/ 79 ******************************************************************************/
72 80
73acpi_status 81static acpi_status
74acpi_ex_add_table ( 82acpi_ex_add_table (
75 struct acpi_table_header *table, 83 struct acpi_table_header *table,
76 struct acpi_namespace_node *parent_node, 84 struct acpi_namespace_node *parent_node,
@@ -95,10 +103,10 @@ acpi_ex_add_table (
95 103
96 ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); 104 ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
97 105
98 table_info.type = ACPI_TABLE_SSDT; 106 table_info.type = ACPI_TABLE_SSDT;
99 table_info.pointer = table; 107 table_info.pointer = table;
100 table_info.length = (acpi_size) table->length; 108 table_info.length = (acpi_size) table->length;
101 table_info.allocation = ACPI_MEM_ALLOCATED; 109 table_info.allocation = ACPI_MEM_ALLOCATED;
102 110
103 status = acpi_tb_install_table (&table_info); 111 status = acpi_tb_install_table (&table_info);
104 if (ACPI_FAILURE (status)) { 112 if (ACPI_FAILURE (status)) {
@@ -226,11 +234,10 @@ acpi_ex_load_table_op (
226 start_node = parent_node; 234 start_node = parent_node;
227 } 235 }
228 236
229 /* 237 /* Find the node referenced by the parameter_path_string */
230 * Find the node referenced by the parameter_path_string 238
231 */
232 status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, 239 status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
233 ACPI_NS_SEARCH_PARENT, &parameter_node); 240 ACPI_NS_SEARCH_PARENT, &parameter_node);
234 if (ACPI_FAILURE (status)) { 241 if (ACPI_FAILURE (status)) {
235 return_ACPI_STATUS (status); 242 return_ACPI_STATUS (status);
236 } 243 }
@@ -248,7 +255,8 @@ acpi_ex_load_table_op (
248 if (parameter_node) { 255 if (parameter_node) {
249 /* Store the parameter data into the optional parameter object */ 256 /* Store the parameter data into the optional parameter object */
250 257
251 status = acpi_ex_store (operand[5], ACPI_CAST_PTR (union acpi_operand_object, parameter_node), 258 status = acpi_ex_store (operand[5],
259 ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
252 walk_state); 260 walk_state);
253 if (ACPI_FAILURE (status)) { 261 if (ACPI_FAILURE (status)) {
254 (void) acpi_ex_unload_table (ddb_handle); 262 (void) acpi_ex_unload_table (ddb_handle);
@@ -371,7 +379,8 @@ acpi_ex_load_op (
371 goto cleanup; 379 goto cleanup;
372 } 380 }
373 381
374 table_ptr = ACPI_CAST_PTR (struct acpi_table_header, buffer_desc->buffer.pointer); 382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
383 buffer_desc->buffer.pointer);
375 384
376 /* Sanity check the table length */ 385 /* Sanity check the table length */
377 386
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
index df7ba1219bf6..97856c48bd74 100644
--- a/drivers/acpi/executer/exconvrt.c
+++ b/drivers/acpi/executer/exconvrt.c
@@ -50,6 +50,15 @@
50#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
51 ACPI_MODULE_NAME ("exconvrt") 51 ACPI_MODULE_NAME ("exconvrt")
52 52
53/* Local prototypes */
54
55static u32
56acpi_ex_convert_to_ascii (
57 acpi_integer integer,
58 u16 base,
59 u8 *string,
60 u8 max_length);
61
53 62
54/******************************************************************************* 63/*******************************************************************************
55 * 64 *
@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer (
115 */ 124 */
116 result = 0; 125 result = 0;
117 126
118 /* 127 /* String conversion is different than Buffer conversion */
119 * String conversion is different than Buffer conversion 128
120 */
121 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 129 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
122 case ACPI_TYPE_STRING: 130 case ACPI_TYPE_STRING:
123 131
@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer (
168 break; 176 break;
169 } 177 }
170 178
171 /* 179 /* Create a new integer */
172 * Create a new integer 180
173 */
174 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 181 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
175 if (!return_desc) { 182 if (!return_desc) {
176 return_ACPI_STATUS (AE_NO_MEMORY); 183 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer (
251 * ASL/AML code that depends on the null being transferred to the new 258 * ASL/AML code that depends on the null being transferred to the new
252 * buffer. 259 * buffer.
253 */ 260 */
254 return_desc = acpi_ut_create_buffer_object ((acpi_size) obj_desc->string.length + 1); 261 return_desc = acpi_ut_create_buffer_object (
262 (acpi_size) obj_desc->string.length + 1);
255 if (!return_desc) { 263 if (!return_desc) {
256 return_ACPI_STATUS (AE_NO_MEMORY); 264 return_ACPI_STATUS (AE_NO_MEMORY);
257 } 265 }
@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer (
291 * 299 *
292 ******************************************************************************/ 300 ******************************************************************************/
293 301
294u32 302static u32
295acpi_ex_convert_to_ascii ( 303acpi_ex_convert_to_ascii (
296 acpi_integer integer, 304 acpi_integer integer,
297 u16 base, 305 u16 base,
@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii (
357 365
358 case 16: 366 case 16:
359 367
360 hex_length = ACPI_MUL_2 (data_width); /* 2 ascii hex chars per data byte */ 368 /* hex_length: 2 ascii hex chars per data byte */
361 369
370 hex_length = ACPI_MUL_2 (data_width);
362 for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { 371 for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
363 /* Get one hex digit, most significant digits first */ 372 /* Get one hex digit, most significant digits first */
364 373
@@ -475,7 +484,7 @@ acpi_ex_convert_to_string (
475 /* Setup string length, base, and separator */ 484 /* Setup string length, base, and separator */
476 485
477 switch (type) { 486 switch (type) {
478 case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */ 487 case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
479 /* 488 /*
480 * From ACPI: "If Data is a buffer, it is converted to a string of 489 * From ACPI: "If Data is a buffer, it is converted to a string of
481 * decimal values separated by commas." 490 * decimal values separated by commas."
@@ -509,7 +518,7 @@ acpi_ex_convert_to_string (
509 string_length = (obj_desc->buffer.length * 3); 518 string_length = (obj_desc->buffer.length * 3);
510 break; 519 break;
511 520
512 case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */ 521 case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
513 /* 522 /*
514 * From ACPI: "If Data is a buffer, it is converted to a string of 523 * From ACPI: "If Data is a buffer, it is converted to a string of
515 * hexadecimal values separated by commas." 524 * hexadecimal values separated by commas."
@@ -530,9 +539,8 @@ acpi_ex_convert_to_string (
530 return_ACPI_STATUS (AE_AML_STRING_LIMIT); 539 return_ACPI_STATUS (AE_AML_STRING_LIMIT);
531 } 540 }
532 541
533 /* 542 /* Create a new string object and string buffer */
534 * Create a new string object and string buffer 543
535 */
536 return_desc = acpi_ut_create_string_object ((acpi_size) string_length); 544 return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
537 if (!return_desc) { 545 if (!return_desc) {
538 return_ACPI_STATUS (AE_NO_MEMORY); 546 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -551,8 +559,10 @@ acpi_ex_convert_to_string (
551 *new_buf++ = separator; /* each separated by a comma or space */ 559 *new_buf++ = separator; /* each separated by a comma or space */
552 } 560 }
553 561
554 /* Null terminate the string (overwrites final comma/space from above) */ 562 /*
555 563 * Null terminate the string
564 * (overwrites final comma/space from above)
565 */
556 new_buf--; 566 new_buf--;
557 *new_buf = 0; 567 *new_buf = 0;
558 break; 568 break;
@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type (
645 655
646 656
647 case ACPI_TYPE_STRING: 657 case ACPI_TYPE_STRING:
648
649 /* 658 /*
650 * The operand must be a String. We can convert an 659 * The operand must be a String. We can convert an
651 * Integer or Buffer if necessary 660 * Integer or Buffer if necessary
@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type (
656 665
657 666
658 case ACPI_TYPE_BUFFER: 667 case ACPI_TYPE_BUFFER:
659
660 /* 668 /*
661 * The operand must be a Buffer. We can convert an 669 * The operand must be a Buffer. We can convert an
662 * Integer or String if necessary 670 * Integer or String if necessary
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c
index d94c260dac6d..812cdcb2e370 100644
--- a/drivers/acpi/executer/excreate.c
+++ b/drivers/acpi/executer/excreate.c
@@ -55,7 +55,7 @@
55 55
56 56
57#ifndef ACPI_NO_METHOD_EXECUTION 57#ifndef ACPI_NO_METHOD_EXECUTION
58/***************************************************************************** 58/*******************************************************************************
59 * 59 *
60 * FUNCTION: acpi_ex_create_alias 60 * FUNCTION: acpi_ex_create_alias
61 * 61 *
@@ -65,7 +65,7 @@
65 * 65 *
66 * DESCRIPTION: Create a new named alias 66 * DESCRIPTION: Create a new named alias
67 * 67 *
68 ****************************************************************************/ 68 ******************************************************************************/
69 69
70acpi_status 70acpi_status
71acpi_ex_create_alias ( 71acpi_ex_create_alias (
@@ -140,8 +140,7 @@ acpi_ex_create_alias (
140 * target node or the alias Node 140 * target node or the alias Node
141 */ 141 */
142 status = acpi_ns_attach_object (alias_node, 142 status = acpi_ns_attach_object (alias_node,
143 acpi_ns_get_attached_object (target_node), 143 acpi_ns_get_attached_object (target_node), target_node->type);
144 target_node->type);
145 break; 144 break;
146 } 145 }
147 146
@@ -151,7 +150,7 @@ acpi_ex_create_alias (
151} 150}
152 151
153 152
154/***************************************************************************** 153/*******************************************************************************
155 * 154 *
156 * FUNCTION: acpi_ex_create_event 155 * FUNCTION: acpi_ex_create_event
157 * 156 *
@@ -161,7 +160,7 @@ acpi_ex_create_alias (
161 * 160 *
162 * DESCRIPTION: Create a new event object 161 * DESCRIPTION: Create a new event object
163 * 162 *
164 ****************************************************************************/ 163 ******************************************************************************/
165 164
166acpi_status 165acpi_status
167acpi_ex_create_event ( 166acpi_ex_create_event (
@@ -185,7 +184,7 @@ acpi_ex_create_event (
185 * that the event is created in an unsignalled state 184 * that the event is created in an unsignalled state
186 */ 185 */
187 status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, 186 status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0,
188 &obj_desc->event.semaphore); 187 &obj_desc->event.semaphore);
189 if (ACPI_FAILURE (status)) { 188 if (ACPI_FAILURE (status)) {
190 goto cleanup; 189 goto cleanup;
191 } 190 }
@@ -193,7 +192,7 @@ acpi_ex_create_event (
193 /* Attach object to the Node */ 192 /* Attach object to the Node */
194 193
195 status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], 194 status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0],
196 obj_desc, ACPI_TYPE_EVENT); 195 obj_desc, ACPI_TYPE_EVENT);
197 196
198cleanup: 197cleanup:
199 /* 198 /*
@@ -205,7 +204,7 @@ cleanup:
205} 204}
206 205
207 206
208/***************************************************************************** 207/*******************************************************************************
209 * 208 *
210 * FUNCTION: acpi_ex_create_mutex 209 * FUNCTION: acpi_ex_create_mutex
211 * 210 *
@@ -217,7 +216,7 @@ cleanup:
217 * 216 *
218 * Mutex (Name[0], sync_level[1]) 217 * Mutex (Name[0], sync_level[1])
219 * 218 *
220 ****************************************************************************/ 219 ******************************************************************************/
221 220
222acpi_status 221acpi_status
223acpi_ex_create_mutex ( 222acpi_ex_create_mutex (
@@ -267,20 +266,20 @@ cleanup:
267} 266}
268 267
269 268
270/***************************************************************************** 269/*******************************************************************************
271 * 270 *
272 * FUNCTION: acpi_ex_create_region 271 * FUNCTION: acpi_ex_create_region
273 * 272 *
274 * PARAMETERS: aml_start - Pointer to the region declaration AML 273 * PARAMETERS: aml_start - Pointer to the region declaration AML
275 * aml_length - Max length of the declaration AML 274 * aml_length - Max length of the declaration AML
276 * Operands - List of operands for the opcode 275 * region_space - space_iD for the region
277 * walk_state - Current state 276 * walk_state - Current state
278 * 277 *
279 * RETURN: Status 278 * RETURN: Status
280 * 279 *
281 * DESCRIPTION: Create a new operation region object 280 * DESCRIPTION: Create a new operation region object
282 * 281 *
283 ****************************************************************************/ 282 ******************************************************************************/
284 283
285acpi_status 284acpi_status
286acpi_ex_create_region ( 285acpi_ex_create_region (
@@ -321,7 +320,7 @@ acpi_ex_create_region (
321 } 320 }
322 321
323 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", 322 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
324 acpi_ut_get_region_name (region_space), region_space)); 323 acpi_ut_get_region_name (region_space), region_space));
325 324
326 /* Create the region descriptor */ 325 /* Create the region descriptor */
327 326
@@ -360,7 +359,7 @@ cleanup:
360} 359}
361 360
362 361
363/***************************************************************************** 362/*******************************************************************************
364 * 363 *
365 * FUNCTION: acpi_ex_create_table_region 364 * FUNCTION: acpi_ex_create_table_region
366 * 365 *
@@ -370,7 +369,7 @@ cleanup:
370 * 369 *
371 * DESCRIPTION: Create a new data_table_region object 370 * DESCRIPTION: Create a new data_table_region object
372 * 371 *
373 ****************************************************************************/ 372 ******************************************************************************/
374 373
375acpi_status 374acpi_status
376acpi_ex_create_table_region ( 375acpi_ex_create_table_region (
@@ -455,7 +454,7 @@ cleanup:
455} 454}
456 455
457 456
458/***************************************************************************** 457/*******************************************************************************
459 * 458 *
460 * FUNCTION: acpi_ex_create_processor 459 * FUNCTION: acpi_ex_create_processor
461 * 460 *
@@ -467,7 +466,7 @@ cleanup:
467 * 466 *
468 * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) 467 * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3])
469 * 468 *
470 ****************************************************************************/ 469 ******************************************************************************/
471 470
472acpi_status 471acpi_status
473acpi_ex_create_processor ( 472acpi_ex_create_processor (
@@ -488,9 +487,8 @@ acpi_ex_create_processor (
488 return_ACPI_STATUS (AE_NO_MEMORY); 487 return_ACPI_STATUS (AE_NO_MEMORY);
489 } 488 }
490 489
491 /* 490 /* Initialize the processor object from the operands */
492 * Initialize the processor object from the operands 491
493 */
494 obj_desc->processor.proc_id = (u8) operand[1]->integer.value; 492 obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
495 obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; 493 obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
496 obj_desc->processor.length = (u8) operand[3]->integer.value; 494 obj_desc->processor.length = (u8) operand[3]->integer.value;
@@ -507,7 +505,7 @@ acpi_ex_create_processor (
507} 505}
508 506
509 507
510/***************************************************************************** 508/*******************************************************************************
511 * 509 *
512 * FUNCTION: acpi_ex_create_power_resource 510 * FUNCTION: acpi_ex_create_power_resource
513 * 511 *
@@ -519,7 +517,7 @@ acpi_ex_create_processor (
519 * 517 *
520 * power_resource (Name[0], system_level[1], resource_order[2]) 518 * power_resource (Name[0], system_level[1], resource_order[2])
521 * 519 *
522 ****************************************************************************/ 520 ******************************************************************************/
523 521
524acpi_status 522acpi_status
525acpi_ex_create_power_resource ( 523acpi_ex_create_power_resource (
@@ -555,10 +553,10 @@ acpi_ex_create_power_resource (
555 acpi_ut_remove_reference (obj_desc); 553 acpi_ut_remove_reference (obj_desc);
556 return_ACPI_STATUS (status); 554 return_ACPI_STATUS (status);
557} 555}
558
559#endif 556#endif
560 557
561/***************************************************************************** 558
559/*******************************************************************************
562 * 560 *
563 * FUNCTION: acpi_ex_create_method 561 * FUNCTION: acpi_ex_create_method
564 * 562 *
@@ -570,7 +568,7 @@ acpi_ex_create_power_resource (
570 * 568 *
571 * DESCRIPTION: Create a new method object 569 * DESCRIPTION: Create a new method object
572 * 570 *
573 ****************************************************************************/ 571 ******************************************************************************/
574 572
575acpi_status 573acpi_status
576acpi_ex_create_method ( 574acpi_ex_create_method (
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index e2f7c32f28de..408500648114 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -51,23 +51,48 @@
51#define _COMPONENT ACPI_EXECUTER 51#define _COMPONENT ACPI_EXECUTER
52 ACPI_MODULE_NAME ("exdump") 52 ACPI_MODULE_NAME ("exdump")
53 53
54/* Local prototypes */
55
56#ifdef ACPI_FUTURE_USAGE
57static void
58acpi_ex_out_string (
59 char *title,
60 char *value);
61
62static void
63acpi_ex_out_pointer (
64 char *title,
65 void *value);
66
67static void
68acpi_ex_out_integer (
69 char *title,
70 u32 value);
71
72static void
73acpi_ex_out_address (
74 char *title,
75 acpi_physical_address value);
76#endif /* ACPI_FUTURE_USAGE */
77
54 78
55/* 79/*
56 * The following routines are used for debug output only 80 * The following routines are used for debug output only
57 */ 81 */
58#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 82#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
59 83
60/***************************************************************************** 84/*******************************************************************************
61 * 85 *
62 * FUNCTION: acpi_ex_dump_operand 86 * FUNCTION: acpi_ex_dump_operand
63 * 87 *
64 * PARAMETERS: *obj_desc - Pointer to entry to be dumped 88 * PARAMETERS: *obj_desc - Pointer to entry to be dumped
89 * Depth - Current nesting depth
65 * 90 *
66 * RETURN: None 91 * RETURN: None
67 * 92 *
68 * DESCRIPTION: Dump an operand object 93 * DESCRIPTION: Dump an operand object
69 * 94 *
70 ****************************************************************************/ 95 ******************************************************************************/
71 96
72void 97void
73acpi_ex_dump_operand ( 98acpi_ex_dump_operand (
@@ -86,9 +111,8 @@ acpi_ex_dump_operand (
86 } 111 }
87 112
88 if (!obj_desc) { 113 if (!obj_desc) {
89 /* 114 /* This could be a null element of a package */
90 * This could be a null element of a package 115
91 */
92 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); 116 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
93 return; 117 return;
94 } 118 }
@@ -117,6 +141,8 @@ acpi_ex_dump_operand (
117 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); 141 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
118 } 142 }
119 143
144 /* Decode object type */
145
120 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 146 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
121 case ACPI_TYPE_LOCAL_REFERENCE: 147 case ACPI_TYPE_LOCAL_REFERENCE:
122 148
@@ -274,7 +300,9 @@ acpi_ex_dump_operand (
274 case ACPI_TYPE_STRING: 300 case ACPI_TYPE_STRING:
275 301
276 acpi_os_printf ("String length %X @ %p ", 302 acpi_os_printf ("String length %X @ %p ",
277 obj_desc->string.length, obj_desc->string.pointer); 303 obj_desc->string.length,
304 obj_desc->string.pointer);
305
278 acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); 306 acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
279 acpi_os_printf ("\n"); 307 acpi_os_printf ("\n");
280 break; 308 break;
@@ -290,10 +318,13 @@ acpi_ex_dump_operand (
290 318
291 acpi_os_printf ( 319 acpi_os_printf (
292 "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", 320 "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
293 obj_desc->field.bit_length, obj_desc->field.access_byte_width, 321 obj_desc->field.bit_length,
322 obj_desc->field.access_byte_width,
294 obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, 323 obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
295 obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, 324 obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
296 obj_desc->field.base_byte_offset, obj_desc->field.start_field_bit_offset); 325 obj_desc->field.base_byte_offset,
326 obj_desc->field.start_field_bit_offset);
327
297 acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); 328 acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1);
298 break; 329 break;
299 330
@@ -308,13 +339,15 @@ acpi_ex_dump_operand (
308 339
309 acpi_os_printf ( 340 acpi_os_printf (
310 "buffer_field: %X bits at byte %X bit %X of \n", 341 "buffer_field: %X bits at byte %X bit %X of \n",
311 obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, 342 obj_desc->buffer_field.bit_length,
343 obj_desc->buffer_field.base_byte_offset,
312 obj_desc->buffer_field.start_field_bit_offset); 344 obj_desc->buffer_field.start_field_bit_offset);
313 345
314 if (!obj_desc->buffer_field.buffer_obj) { 346 if (!obj_desc->buffer_field.buffer_obj) {
315 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); 347 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
316 } 348 }
317 else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { 349 else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) !=
350 ACPI_TYPE_BUFFER) {
318 acpi_os_printf ("*not a Buffer* \n"); 351 acpi_os_printf ("*not a Buffer* \n");
319 } 352 }
320 else { 353 else {
@@ -331,10 +364,10 @@ acpi_ex_dump_operand (
331 364
332 case ACPI_TYPE_METHOD: 365 case ACPI_TYPE_METHOD:
333 366
334 acpi_os_printf ( 367 acpi_os_printf ("Method(%X) @ %p:%X\n",
335 "Method(%X) @ %p:%X\n",
336 obj_desc->method.param_count, 368 obj_desc->method.param_count,
337 obj_desc->method.aml_start, obj_desc->method.aml_length); 369 obj_desc->method.aml_start,
370 obj_desc->method.aml_length);
338 break; 371 break;
339 372
340 373
@@ -379,7 +412,7 @@ acpi_ex_dump_operand (
379} 412}
380 413
381 414
382/***************************************************************************** 415/*******************************************************************************
383 * 416 *
384 * FUNCTION: acpi_ex_dump_operands 417 * FUNCTION: acpi_ex_dump_operands
385 * 418 *
@@ -393,7 +426,7 @@ acpi_ex_dump_operand (
393 * 426 *
394 * DESCRIPTION: Dump the object stack 427 * DESCRIPTION: Dump the object stack
395 * 428 *
396 ****************************************************************************/ 429 ******************************************************************************/
397 430
398void 431void
399acpi_ex_dump_operands ( 432acpi_ex_dump_operands (
@@ -441,10 +474,9 @@ acpi_ex_dump_operands (
441 474
442 475
443#ifdef ACPI_FUTURE_USAGE 476#ifdef ACPI_FUTURE_USAGE
444 477/*******************************************************************************
445/*****************************************************************************
446 * 478 *
447 * FUNCTION: acpi_ex_out* 479 * FUNCTION: acpi_ex_out* functions
448 * 480 *
449 * PARAMETERS: Title - Descriptive text 481 * PARAMETERS: Title - Descriptive text
450 * Value - Value to be displayed 482 * Value - Value to be displayed
@@ -453,9 +485,9 @@ acpi_ex_dump_operands (
453 * reduce the number of format strings required and keeps them 485 * reduce the number of format strings required and keeps them
454 * all in one place for easy modification. 486 * all in one place for easy modification.
455 * 487 *
456 ****************************************************************************/ 488 ******************************************************************************/
457 489
458void 490static void
459acpi_ex_out_string ( 491acpi_ex_out_string (
460 char *title, 492 char *title,
461 char *value) 493 char *value)
@@ -463,7 +495,7 @@ acpi_ex_out_string (
463 acpi_os_printf ("%20s : %s\n", title, value); 495 acpi_os_printf ("%20s : %s\n", title, value);
464} 496}
465 497
466void 498static void
467acpi_ex_out_pointer ( 499acpi_ex_out_pointer (
468 char *title, 500 char *title,
469 void *value) 501 void *value)
@@ -471,7 +503,7 @@ acpi_ex_out_pointer (
471 acpi_os_printf ("%20s : %p\n", title, value); 503 acpi_os_printf ("%20s : %p\n", title, value);
472} 504}
473 505
474void 506static void
475acpi_ex_out_integer ( 507acpi_ex_out_integer (
476 char *title, 508 char *title,
477 u32 value) 509 u32 value)
@@ -479,7 +511,7 @@ acpi_ex_out_integer (
479 acpi_os_printf ("%20s : %X\n", title, value); 511 acpi_os_printf ("%20s : %X\n", title, value);
480} 512}
481 513
482void 514static void
483acpi_ex_out_address ( 515acpi_ex_out_address (
484 char *title, 516 char *title,
485 acpi_physical_address value) 517 acpi_physical_address value)
@@ -493,16 +525,16 @@ acpi_ex_out_address (
493} 525}
494 526
495 527
496/***************************************************************************** 528/*******************************************************************************
497 * 529 *
498 * FUNCTION: acpi_ex_dump_node 530 * FUNCTION: acpi_ex_dump_node
499 * 531 *
500 * PARAMETERS: *Node - Descriptor to dump 532 * PARAMETERS: *Node - Descriptor to dump
501 * Flags - Force display 533 * Flags - Force display if TRUE
502 * 534 *
503 * DESCRIPTION: Dumps the members of the given.Node 535 * DESCRIPTION: Dumps the members of the given.Node
504 * 536 *
505 ****************************************************************************/ 537 ******************************************************************************/
506 538
507void 539void
508acpi_ex_dump_node ( 540acpi_ex_dump_node (
@@ -531,16 +563,16 @@ acpi_ex_dump_node (
531} 563}
532 564
533 565
534/***************************************************************************** 566/*******************************************************************************
535 * 567 *
536 * FUNCTION: acpi_ex_dump_object_descriptor 568 * FUNCTION: acpi_ex_dump_object_descriptor
537 * 569 *
538 * PARAMETERS: *Object - Descriptor to dump 570 * PARAMETERS: *Object - Descriptor to dump
539 * Flags - Force display 571 * Flags - Force display if TRUE
540 * 572 *
541 * DESCRIPTION: Dumps the members of the object descriptor given. 573 * DESCRIPTION: Dumps the members of the object descriptor given.
542 * 574 *
543 ****************************************************************************/ 575 ******************************************************************************/
544 576
545void 577void
546acpi_ex_dump_object_descriptor ( 578acpi_ex_dump_object_descriptor (
@@ -553,6 +585,10 @@ acpi_ex_dump_object_descriptor (
553 ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); 585 ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
554 586
555 587
588 if (!obj_desc) {
589 return_VOID;
590 }
591
556 if (!flags) { 592 if (!flags) {
557 if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { 593 if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
558 return_VOID; 594 return_VOID;
@@ -747,11 +783,17 @@ acpi_ex_dump_object_descriptor (
747 case ACPI_TYPE_LOCAL_REFERENCE: 783 case ACPI_TYPE_LOCAL_REFERENCE:
748 784
749 acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); 785 acpi_ex_out_integer ("target_type", obj_desc->reference.target_type);
750 acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name); 786 acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (
787 obj_desc->reference.opcode))->name);
751 acpi_ex_out_integer ("Offset", obj_desc->reference.offset); 788 acpi_ex_out_integer ("Offset", obj_desc->reference.offset);
752 acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); 789 acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object);
753 acpi_ex_out_pointer ("Node", obj_desc->reference.node); 790 acpi_ex_out_pointer ("Node", obj_desc->reference.node);
754 acpi_ex_out_pointer ("Where", obj_desc->reference.where); 791 acpi_ex_out_pointer ("Where", obj_desc->reference.where);
792
793 if (obj_desc->reference.object) {
794 acpi_os_printf ("\nReferenced Object:\n");
795 acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
796 }
755 break; 797 break;
756 798
757 799
@@ -788,6 +830,5 @@ acpi_ex_dump_object_descriptor (
788} 830}
789 831
790#endif /* ACPI_FUTURE_USAGE */ 832#endif /* ACPI_FUTURE_USAGE */
791
792#endif 833#endif
793 834
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index be7f2124fa02..22c8fa480f60 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field (
120 * Note: Smbus protocol value is passed in upper 16-bits of Function 120 * Note: Smbus protocol value is passed in upper 16-bits of Function
121 */ 121 */
122 status = acpi_ex_access_region (obj_desc, 0, 122 status = acpi_ex_access_region (obj_desc, 0,
123 ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), 123 ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
124 ACPI_READ | (obj_desc->field.attribute << 16)); 124 ACPI_READ | (obj_desc->field.attribute << 16));
125 acpi_ex_release_global_lock (locked); 125 acpi_ex_release_global_lock (locked);
126 goto exit; 126 goto exit;
127 } 127 }
@@ -196,6 +196,7 @@ exit:
196 * 196 *
197 * PARAMETERS: source_desc - Contains data to write 197 * PARAMETERS: source_desc - Contains data to write
198 * obj_desc - The named field 198 * obj_desc - The named field
199 * result_desc - Where the return value is returned, if any
199 * 200 *
200 * RETURN: Status 201 * RETURN: Status
201 * 202 *
@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field (
250 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { 251 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
251 ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", 252 ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
252 acpi_ut_get_object_type_name (source_desc))); 253 acpi_ut_get_object_type_name (source_desc)));
254
253 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 255 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
254 } 256 }
255 257
256 if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { 258 if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
257 ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n", 259 ACPI_REPORT_ERROR ((
260 "SMBus write requires Buffer of length %X, found length %X\n",
258 ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); 261 ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
262
259 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); 263 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
260 } 264 }
261 265
@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field (
265 } 269 }
266 270
267 buffer = buffer_desc->buffer.pointer; 271 buffer = buffer_desc->buffer.pointer;
268 ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE); 272 ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
273 ACPI_SMBUS_BUFFER_SIZE);
269 274
270 /* Lock entire transaction if requested */ 275 /* Lock entire transaction if requested */
271 276
272 locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); 277 locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
273 278
274 /* 279 /*
275 * Perform the write (returns status and perhaps data in the same buffer) 280 * Perform the write (returns status and perhaps data in the
281 * same buffer)
276 * Note: SMBus protocol type is passed in upper 16-bits of Function. 282 * Note: SMBus protocol type is passed in upper 16-bits of Function.
277 */ 283 */
278 status = acpi_ex_access_region (obj_desc, 0, 284 status = acpi_ex_access_region (obj_desc, 0,
@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field (
284 return_ACPI_STATUS (status); 290 return_ACPI_STATUS (status);
285 } 291 }
286 292
287 /* 293 /* Get a pointer to the data to be written */
288 * Get a pointer to the data to be written 294
289 */
290 switch (ACPI_GET_OBJECT_TYPE (source_desc)) { 295 switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
291 case ACPI_TYPE_INTEGER: 296 case ACPI_TYPE_INTEGER:
292 buffer = &source_desc->integer.value; 297 buffer = &source_desc->integer.value;
@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field (
314 * the ACPI specification. 319 * the ACPI specification.
315 */ 320 */
316 new_buffer = NULL; 321 new_buffer = NULL;
317 required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length); 322 required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
323 obj_desc->common_field.bit_length);
318 324
319 if (length < required_length) { 325 if (length < required_length) {
320 /* We need to create a new buffer */ 326 /* We need to create a new buffer */
@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field (
338 "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", 344 "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
339 source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), 345 source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
340 ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); 346 ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
347
341 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 348 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
342 "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", 349 "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
343 obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), 350 obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index 9d0f9d2e9061..3c2f89e00f78 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -52,12 +52,31 @@
52#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exfldio") 53 ACPI_MODULE_NAME ("exfldio")
54 54
55/* Local prototypes */
56
57static acpi_status
58acpi_ex_field_datum_io (
59 union acpi_operand_object *obj_desc,
60 u32 field_datum_byte_offset,
61 acpi_integer *value,
62 u32 read_write);
63
64static u8
65acpi_ex_register_overflow (
66 union acpi_operand_object *obj_desc,
67 acpi_integer value);
68
69static acpi_status
70acpi_ex_setup_region (
71 union acpi_operand_object *obj_desc,
72 u32 field_datum_byte_offset);
73
55 74
56/******************************************************************************* 75/*******************************************************************************
57 * 76 *
58 * FUNCTION: acpi_ex_setup_region 77 * FUNCTION: acpi_ex_setup_region
59 * 78 *
60 * PARAMETERS: *obj_desc - Field to be read or written 79 * PARAMETERS: obj_desc - Field to be read or written
61 * field_datum_byte_offset - Byte offset of this datum within the 80 * field_datum_byte_offset - Byte offset of this datum within the
62 * parent field 81 * parent field
63 * 82 *
@@ -69,7 +88,7 @@
69 * 88 *
70 ******************************************************************************/ 89 ******************************************************************************/
71 90
72acpi_status 91static acpi_status
73acpi_ex_setup_region ( 92acpi_ex_setup_region (
74 union acpi_operand_object *obj_desc, 93 union acpi_operand_object *obj_desc,
75 u32 field_datum_byte_offset) 94 u32 field_datum_byte_offset)
@@ -127,9 +146,9 @@ acpi_ex_setup_region (
127 * length of one field datum (access width) must fit within the region. 146 * length of one field datum (access width) must fit within the region.
128 * (Region length is specified in bytes) 147 * (Region length is specified in bytes)
129 */ 148 */
130 if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset 149 if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
131 + field_datum_byte_offset 150 field_datum_byte_offset +
132 + obj_desc->common_field.access_byte_width)) { 151 obj_desc->common_field.access_byte_width)) {
133 if (acpi_gbl_enable_interpreter_slack) { 152 if (acpi_gbl_enable_interpreter_slack) {
134 /* 153 /*
135 * 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
@@ -155,7 +174,8 @@ acpi_ex_setup_region (
155 "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", 174 "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
156 acpi_ut_get_node_name (obj_desc->common_field.node), 175 acpi_ut_get_node_name (obj_desc->common_field.node),
157 obj_desc->common_field.access_byte_width, 176 obj_desc->common_field.access_byte_width,
158 acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); 177 acpi_ut_get_node_name (rgn_desc->region.node),
178 rgn_desc->region.length));
159 } 179 }
160 180
161 /* 181 /*
@@ -167,7 +187,8 @@ acpi_ex_setup_region (
167 acpi_ut_get_node_name (obj_desc->common_field.node), 187 acpi_ut_get_node_name (obj_desc->common_field.node),
168 obj_desc->common_field.base_byte_offset, 188 obj_desc->common_field.base_byte_offset,
169 field_datum_byte_offset, obj_desc->common_field.access_byte_width, 189 field_datum_byte_offset, obj_desc->common_field.access_byte_width,
170 acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); 190 acpi_ut_get_node_name (rgn_desc->region.node),
191 rgn_desc->region.length));
171 192
172 return_ACPI_STATUS (AE_AML_REGION_LIMIT); 193 return_ACPI_STATUS (AE_AML_REGION_LIMIT);
173 } 194 }
@@ -180,10 +201,10 @@ acpi_ex_setup_region (
180 * 201 *
181 * FUNCTION: acpi_ex_access_region 202 * FUNCTION: acpi_ex_access_region
182 * 203 *
183 * PARAMETERS: *obj_desc - Field to be read 204 * PARAMETERS: obj_desc - Field to be read
184 * field_datum_byte_offset - Byte offset of this datum within the 205 * field_datum_byte_offset - Byte offset of this datum within the
185 * parent field 206 * parent field
186 * *Value - Where to store value (must at least 207 * Value - Where to store value (must at least
187 * the size of acpi_integer) 208 * the size of acpi_integer)
188 * Function - Read or Write flag plus other region- 209 * Function - Read or Write flag plus other region-
189 * dependent flags 210 * dependent flags
@@ -226,9 +247,9 @@ acpi_ex_access_region (
226 * 3) The current offset into the field 247 * 3) The current offset into the field
227 */ 248 */
228 rgn_desc = obj_desc->common_field.region_obj; 249 rgn_desc = obj_desc->common_field.region_obj;
229 address = rgn_desc->region.address 250 address = rgn_desc->region.address +
230 + obj_desc->common_field.base_byte_offset 251 obj_desc->common_field.base_byte_offset +
231 + field_datum_byte_offset; 252 field_datum_byte_offset;
232 253
233 if ((function & ACPI_IO_MASK) == ACPI_READ) { 254 if ((function & ACPI_IO_MASK) == ACPI_READ) {
234 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); 255 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
@@ -249,7 +270,8 @@ acpi_ex_access_region (
249 /* Invoke the appropriate address_space/op_region handler */ 270 /* Invoke the appropriate address_space/op_region handler */
250 271
251 status = acpi_ev_address_space_dispatch (rgn_desc, function, 272 status = acpi_ev_address_space_dispatch (rgn_desc, function,
252 address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); 273 address,
274 ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
253 275
254 if (ACPI_FAILURE (status)) { 276 if (ACPI_FAILURE (status)) {
255 if (status == AE_NOT_IMPLEMENTED) { 277 if (status == AE_NOT_IMPLEMENTED) {
@@ -274,7 +296,7 @@ acpi_ex_access_region (
274 * 296 *
275 * FUNCTION: acpi_ex_register_overflow 297 * FUNCTION: acpi_ex_register_overflow
276 * 298 *
277 * PARAMETERS: *obj_desc - Register(Field) to be written 299 * PARAMETERS: obj_desc - Register(Field) to be written
278 * Value - Value to be stored 300 * Value - Value to be stored
279 * 301 *
280 * RETURN: TRUE if value overflows the field, FALSE otherwise 302 * RETURN: TRUE if value overflows the field, FALSE otherwise
@@ -287,7 +309,7 @@ acpi_ex_access_region (
287 * 309 *
288 ******************************************************************************/ 310 ******************************************************************************/
289 311
290u8 312static u8
291acpi_ex_register_overflow ( 313acpi_ex_register_overflow (
292 union acpi_operand_object *obj_desc, 314 union acpi_operand_object *obj_desc,
293 acpi_integer value) 315 acpi_integer value)
@@ -319,10 +341,10 @@ acpi_ex_register_overflow (
319 * 341 *
320 * FUNCTION: acpi_ex_field_datum_io 342 * FUNCTION: acpi_ex_field_datum_io
321 * 343 *
322 * PARAMETERS: *obj_desc - Field to be read 344 * PARAMETERS: obj_desc - Field to be read
323 * field_datum_byte_offset - Byte offset of this datum within the 345 * field_datum_byte_offset - Byte offset of this datum within the
324 * parent field 346 * parent field
325 * *Value - Where to store value (must be 64 bits) 347 * Value - Where to store value (must be 64 bits)
326 * read_write - Read or Write flag 348 * read_write - Read or Write flag
327 * 349 *
328 * RETURN: Status 350 * RETURN: Status
@@ -333,7 +355,7 @@ acpi_ex_register_overflow (
333 * 355 *
334 ******************************************************************************/ 356 ******************************************************************************/
335 357
336acpi_status 358static acpi_status
337acpi_ex_field_datum_io ( 359acpi_ex_field_datum_io (
338 union acpi_operand_object *obj_desc, 360 union acpi_operand_object *obj_desc,
339 u32 field_datum_byte_offset, 361 u32 field_datum_byte_offset,
@@ -350,7 +372,9 @@ acpi_ex_field_datum_io (
350 if (read_write == ACPI_READ) { 372 if (read_write == ACPI_READ) {
351 if (!value) { 373 if (!value) {
352 local_value = 0; 374 local_value = 0;
353 value = &local_value; /* To support reads without saving return value */ 375
376 /* To support reads without saving return value */
377 value = &local_value;
354 } 378 }
355 379
356 /* Clear the entire return buffer first, [Very Important!] */ 380 /* Clear the entire return buffer first, [Very Important!] */
@@ -363,8 +387,10 @@ acpi_ex_field_datum_io (
363 * 387 *
364 * buffer_field - Read/write from/to a Buffer 388 * buffer_field - Read/write from/to a Buffer
365 * region_field - Read/write from/to a Operation Region. 389 * region_field - Read/write from/to a Operation Region.
366 * bank_field - Write to a Bank Register, then read/write from/to an op_region 390 * bank_field - Write to a Bank Register, then read/write from/to an
367 * index_field - Write to an Index Register, then read/write from/to a Data Register 391 * operation_region
392 * index_field - Write to an Index Register, then read/write from/to a
393 * Data Register
368 */ 394 */
369 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 395 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
370 case ACPI_TYPE_BUFFER_FIELD: 396 case ACPI_TYPE_BUFFER_FIELD:
@@ -384,19 +410,20 @@ acpi_ex_field_datum_io (
384 * Copy the data from the source buffer. 410 * Copy the data from the source buffer.
385 * Length is the field width in bytes. 411 * Length is the field width in bytes.
386 */ 412 */
387 ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer 413 ACPI_MEMCPY (value,
388 + obj_desc->buffer_field.base_byte_offset 414 (obj_desc->buffer_field.buffer_obj)->buffer.pointer +
389 + field_datum_byte_offset, 415 obj_desc->buffer_field.base_byte_offset +
390 obj_desc->common_field.access_byte_width); 416 field_datum_byte_offset,
417 obj_desc->common_field.access_byte_width);
391 } 418 }
392 else { 419 else {
393 /* 420 /*
394 * Copy the data to the target buffer. 421 * Copy the data to the target buffer.
395 * Length is the field width in bytes. 422 * Length is the field width in bytes.
396 */ 423 */
397 ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer 424 ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer +
398 + obj_desc->buffer_field.base_byte_offset 425 obj_desc->buffer_field.base_byte_offset +
399 + field_datum_byte_offset, 426 field_datum_byte_offset,
400 value, obj_desc->common_field.access_byte_width); 427 value, obj_desc->common_field.access_byte_width);
401 } 428 }
402 429
@@ -406,8 +433,10 @@ acpi_ex_field_datum_io (
406 433
407 case ACPI_TYPE_LOCAL_BANK_FIELD: 434 case ACPI_TYPE_LOCAL_BANK_FIELD:
408 435
409 /* Ensure that the bank_value is not beyond the capacity of the register */ 436 /*
410 437 * Ensure that the bank_value is not beyond the capacity of
438 * the register
439 */
411 if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, 440 if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,
412 (acpi_integer) obj_desc->bank_field.value)) { 441 (acpi_integer) obj_desc->bank_field.value)) {
413 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); 442 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
@@ -445,8 +474,10 @@ acpi_ex_field_datum_io (
445 case ACPI_TYPE_LOCAL_INDEX_FIELD: 474 case ACPI_TYPE_LOCAL_INDEX_FIELD:
446 475
447 476
448 /* Ensure that the index_value is not beyond the capacity of the register */ 477 /*
449 478 * Ensure that the index_value is not beyond the capacity of
479 * the register
480 */
450 if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, 481 if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,
451 (acpi_integer) obj_desc->index_field.value)) { 482 (acpi_integer) obj_desc->index_field.value)) {
452 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); 483 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
@@ -496,14 +527,16 @@ acpi_ex_field_datum_io (
496 527
497 if (ACPI_SUCCESS (status)) { 528 if (ACPI_SUCCESS (status)) {
498 if (read_write == ACPI_READ) { 529 if (read_write == ACPI_READ) {
499 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", 530 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
500 ACPI_FORMAT_UINT64 (*value), 531 "Value Read %8.8X%8.8X, Width %d\n",
501 obj_desc->common_field.access_byte_width)); 532 ACPI_FORMAT_UINT64 (*value),
533 obj_desc->common_field.access_byte_width));
502 } 534 }
503 else { 535 else {
504 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", 536 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
505 ACPI_FORMAT_UINT64 (*value), 537 "Value Written %8.8X%8.8X, Width %d\n",
506 obj_desc->common_field.access_byte_width)); 538 ACPI_FORMAT_UINT64 (*value),
539 obj_desc->common_field.access_byte_width));
507 } 540 }
508 } 541 }
509 542
@@ -515,8 +548,10 @@ acpi_ex_field_datum_io (
515 * 548 *
516 * FUNCTION: acpi_ex_write_with_update_rule 549 * FUNCTION: acpi_ex_write_with_update_rule
517 * 550 *
518 * PARAMETERS: *obj_desc - Field to be set 551 * PARAMETERS: obj_desc - Field to be written
519 * Value - Value to store 552 * Mask - bitmask within field datum
553 * field_value - Value to write
554 * field_datum_byte_offset - Offset of datum within field
520 * 555 *
521 * RETURN: Status 556 * RETURN: Status
522 * 557 *
@@ -689,7 +724,8 @@ acpi_ex_extract_from_field (
689 /* Merge with previous datum if necessary */ 724 /* Merge with previous datum if necessary */
690 725
691 merged_datum |= raw_datum << 726 merged_datum |= raw_datum <<
692 (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); 727 (obj_desc->common_field.access_bit_width -
728 obj_desc->common_field.start_field_bit_offset);
693 729
694 if (i == datum_count) { 730 if (i == datum_count) {
695 break; 731 break;
@@ -707,7 +743,8 @@ acpi_ex_extract_from_field (
707 743
708 /* Mask off any extra bits in the last datum */ 744 /* Mask off any extra bits in the last datum */
709 745
710 buffer_tail_bits = obj_desc->common_field.bit_length % obj_desc->common_field.access_bit_width; 746 buffer_tail_bits = obj_desc->common_field.bit_length %
747 obj_desc->common_field.access_bit_width;
711 if (buffer_tail_bits) { 748 if (buffer_tail_bits) {
712 merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); 749 merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
713 } 750 }
@@ -791,7 +828,8 @@ acpi_ex_insert_into_field (
791 /* Write merged datum to the target field */ 828 /* Write merged datum to the target field */
792 829
793 merged_datum &= mask; 830 merged_datum &= mask;
794 status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); 831 status = acpi_ex_write_with_update_rule (obj_desc, mask,
832 merged_datum, field_offset);
795 if (ACPI_FAILURE (status)) { 833 if (ACPI_FAILURE (status)) {
796 return_ACPI_STATUS (status); 834 return_ACPI_STATUS (status);
797 } 835 }
@@ -800,7 +838,8 @@ acpi_ex_insert_into_field (
800 838
801 field_offset += obj_desc->common_field.access_byte_width; 839 field_offset += obj_desc->common_field.access_byte_width;
802 merged_datum = raw_datum >> 840 merged_datum = raw_datum >>
803 (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); 841 (obj_desc->common_field.access_bit_width -
842 obj_desc->common_field.start_field_bit_offset);
804 mask = ACPI_INTEGER_MAX; 843 mask = ACPI_INTEGER_MAX;
805 844
806 if (i == datum_count) { 845 if (i == datum_count) {
@@ -819,7 +858,8 @@ acpi_ex_insert_into_field (
819 /* Mask off any extra bits in the last datum */ 858 /* Mask off any extra bits in the last datum */
820 859
821 buffer_tail_bits = (obj_desc->common_field.bit_length + 860 buffer_tail_bits = (obj_desc->common_field.bit_length +
822 obj_desc->common_field.start_field_bit_offset) % obj_desc->common_field.access_bit_width; 861 obj_desc->common_field.start_field_bit_offset) %
862 obj_desc->common_field.access_bit_width;
823 if (buffer_tail_bits) { 863 if (buffer_tail_bits) {
824 mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); 864 mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
825 } 865 }
@@ -827,7 +867,8 @@ acpi_ex_insert_into_field (
827 /* Write the last datum to the field */ 867 /* Write the last datum to the field */
828 868
829 merged_datum &= mask; 869 merged_datum &= mask;
830 status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); 870 status = acpi_ex_write_with_update_rule (obj_desc,
871 mask, merged_datum, field_offset);
831 872
832 return_ACPI_STATUS (status); 873 return_ACPI_STATUS (status);
833} 874}
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
index b542dcd58c07..022f281345b8 100644
--- a/drivers/acpi/executer/exmisc.c
+++ b/drivers/acpi/executer/exmisc.c
@@ -139,8 +139,9 @@ acpi_ex_get_object_reference (
139 reference_obj->reference.object = referenced_obj; 139 reference_obj->reference.object = referenced_obj;
140 *return_desc = reference_obj; 140 *return_desc = reference_obj;
141 141
142 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n", 142 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
143 obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); 143 "Object %p Type [%s], returning Reference %p\n",
144 obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
144 145
145 return_ACPI_STATUS (AE_OK); 146 return_ACPI_STATUS (AE_OK);
146} 147}
@@ -456,7 +457,7 @@ acpi_ex_do_math_op (
456 return (integer0 * integer1); 457 return (integer0 * integer1);
457 458
458 459
459 case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ 460 case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/
460 461
461 return (integer0 << integer1); 462 return (integer0 << integer1);
462 463
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
index 68c4bb1970a5..c3cb714d2cba 100644
--- a/drivers/acpi/executer/exmutex.c
+++ b/drivers/acpi/executer/exmutex.c
@@ -49,6 +49,13 @@
49#define _COMPONENT ACPI_EXECUTER 49#define _COMPONENT ACPI_EXECUTER
50 ACPI_MODULE_NAME ("exmutex") 50 ACPI_MODULE_NAME ("exmutex")
51 51
52/* Local prototypes */
53
54static void
55acpi_ex_link_mutex (
56 union acpi_operand_object *obj_desc,
57 struct acpi_thread_state *thread);
58
52 59
53/******************************************************************************* 60/*******************************************************************************
54 * 61 *
@@ -56,7 +63,7 @@
56 * 63 *
57 * PARAMETERS: obj_desc - The mutex to be unlinked 64 * PARAMETERS: obj_desc - The mutex to be unlinked
58 * 65 *
59 * RETURN: Status 66 * RETURN: None
60 * 67 *
61 * DESCRIPTION: Remove a mutex from the "acquired_mutex" list 68 * DESCRIPTION: Remove a mutex from the "acquired_mutex" list
62 * 69 *
@@ -92,16 +99,16 @@ acpi_ex_unlink_mutex (
92 * 99 *
93 * FUNCTION: acpi_ex_link_mutex 100 * FUNCTION: acpi_ex_link_mutex
94 * 101 *
95 * PARAMETERS: obj_desc - The mutex to be linked 102 * PARAMETERS: obj_desc - The mutex to be linked
96 * list_head - head of the "acquired_mutex" list 103 * Thread - Current executing thread object
97 * 104 *
98 * RETURN: Status 105 * RETURN: None
99 * 106 *
100 * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk 107 * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk
101 * 108 *
102 ******************************************************************************/ 109 ******************************************************************************/
103 110
104void 111static void
105acpi_ex_link_mutex ( 112acpi_ex_link_mutex (
106 union acpi_operand_object *obj_desc, 113 union acpi_operand_object *obj_desc,
107 struct acpi_thread_state *thread) 114 struct acpi_thread_state *thread)
@@ -132,8 +139,9 @@ acpi_ex_link_mutex (
132 * 139 *
133 * FUNCTION: acpi_ex_acquire_mutex 140 * FUNCTION: acpi_ex_acquire_mutex
134 * 141 *
135 * PARAMETERS: time_desc - The 'time to delay' object descriptor 142 * PARAMETERS: time_desc - Timeout integer
136 * obj_desc - The object descriptor for this op 143 * obj_desc - Mutex object
144 * walk_state - Current method execution state
137 * 145 *
138 * RETURN: Status 146 * RETURN: Status
139 * 147 *
@@ -161,7 +169,7 @@ acpi_ex_acquire_mutex (
161 169
162 if (!walk_state->thread) { 170 if (!walk_state->thread) {
163 ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", 171 ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
164 acpi_ut_get_node_name (obj_desc->mutex.node))); 172 acpi_ut_get_node_name (obj_desc->mutex.node)));
165 return_ACPI_STATUS (AE_AML_INTERNAL); 173 return_ACPI_STATUS (AE_AML_INTERNAL);
166 } 174 }
167 175
@@ -170,8 +178,9 @@ acpi_ex_acquire_mutex (
170 * mutex. This mechanism provides some deadlock prevention 178 * mutex. This mechanism provides some deadlock prevention
171 */ 179 */
172 if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { 180 if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
173 ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", 181 ACPI_REPORT_ERROR ((
174 acpi_ut_get_node_name (obj_desc->mutex.node))); 182 "Cannot acquire Mutex [%4.4s], incorrect sync_level\n",
183 acpi_ut_get_node_name (obj_desc->mutex.node)));
175 return_ACPI_STATUS (AE_AML_MUTEX_ORDER); 184 return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
176 } 185 }
177 186
@@ -180,8 +189,10 @@ acpi_ex_acquire_mutex (
180 if (obj_desc->mutex.owner_thread) { 189 if (obj_desc->mutex.owner_thread) {
181 /* Special case for Global Lock, allow all threads */ 190 /* Special case for Global Lock, allow all threads */
182 191
183 if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || 192 if ((obj_desc->mutex.owner_thread->thread_id ==
184 (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore)) { 193 walk_state->thread->thread_id) ||
194 (obj_desc->mutex.semaphore ==
195 acpi_gbl_global_lock_semaphore)) {
185 /* 196 /*
186 * The mutex is already owned by this thread, 197 * The mutex is already owned by this thread,
187 * just increment the acquisition depth 198 * just increment the acquisition depth
@@ -221,6 +232,7 @@ acpi_ex_acquire_mutex (
221 * FUNCTION: acpi_ex_release_mutex 232 * FUNCTION: acpi_ex_release_mutex
222 * 233 *
223 * PARAMETERS: obj_desc - The object descriptor for this op 234 * PARAMETERS: obj_desc - The object descriptor for this op
235 * walk_state - Current method execution state
224 * 236 *
225 * RETURN: Status 237 * RETURN: Status
226 * 238 *
@@ -278,8 +290,9 @@ acpi_ex_release_mutex (
278 * equal to the current sync level 290 * equal to the current sync level
279 */ 291 */
280 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { 292 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
281 ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect sync_level\n", 293 ACPI_REPORT_ERROR ((
282 acpi_ut_get_node_name (obj_desc->mutex.node))); 294 "Cannot release Mutex [%4.4s], incorrect sync_level\n",
295 acpi_ut_get_node_name (obj_desc->mutex.node)));
283 return_ACPI_STATUS (AE_AML_MUTEX_ORDER); 296 return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
284 } 297 }
285 298
@@ -313,11 +326,11 @@ acpi_ex_release_mutex (
313 * 326 *
314 * FUNCTION: acpi_ex_release_all_mutexes 327 * FUNCTION: acpi_ex_release_all_mutexes
315 * 328 *
316 * PARAMETERS: mutex_list - Head of the mutex list 329 * PARAMETERS: Thread - Current executing thread object
317 * 330 *
318 * RETURN: Status 331 * RETURN: Status
319 * 332 *
320 * DESCRIPTION: Release all mutexes in the list 333 * DESCRIPTION: Release all mutexes held by this thread
321 * 334 *
322 ******************************************************************************/ 335 ******************************************************************************/
323 336
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 7911c533c265..639f0bd3f6d8 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -50,13 +50,17 @@
50#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
51 ACPI_MODULE_NAME ("exnames") 51 ACPI_MODULE_NAME ("exnames")
52 52
53/* Local prototypes */
53 54
54/* AML Package Length encodings */ 55static char *
56acpi_ex_allocate_name_string (
57 u32 prefix_count,
58 u32 num_name_segs);
55 59
56#define ACPI_AML_PACKAGE_TYPE1 0x40 60static acpi_status
57#define ACPI_AML_PACKAGE_TYPE2 0x4000 61acpi_ex_name_segment (
58#define ACPI_AML_PACKAGE_TYPE3 0x400000 62 u8 **in_aml_address,
59#define ACPI_AML_PACKAGE_TYPE4 0x40000000 63 char *name_string);
60 64
61 65
62/******************************************************************************* 66/*******************************************************************************
@@ -64,7 +68,7 @@
64 * FUNCTION: acpi_ex_allocate_name_string 68 * FUNCTION: acpi_ex_allocate_name_string
65 * 69 *
66 * PARAMETERS: prefix_count - Count of parent levels. Special cases: 70 * PARAMETERS: prefix_count - Count of parent levels. Special cases:
67 * (-1) = root, 0 = none 71 * (-1)==root, 0==none
68 * num_name_segs - count of 4-character name segments 72 * num_name_segs - count of 4-character name segments
69 * 73 *
70 * RETURN: A pointer to the allocated string segment. This segment must 74 * RETURN: A pointer to the allocated string segment. This segment must
@@ -75,7 +79,7 @@
75 * 79 *
76 ******************************************************************************/ 80 ******************************************************************************/
77 81
78char * 82static char *
79acpi_ex_allocate_name_string ( 83acpi_ex_allocate_name_string (
80 u32 prefix_count, 84 u32 prefix_count,
81 u32 num_name_segs) 85 u32 num_name_segs)
@@ -88,7 +92,7 @@ acpi_ex_allocate_name_string (
88 92
89 93
90 /* 94 /*
91 * Allow room for all \ and ^ prefixes, all segments, and a multi_name_prefix. 95 * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
92 * Also, one byte for the null terminator. 96 * Also, one byte for the null terminator.
93 * This may actually be somewhat longer than needed. 97 * This may actually be somewhat longer than needed.
94 */ 98 */
@@ -107,7 +111,8 @@ acpi_ex_allocate_name_string (
107 */ 111 */
108 name_string = ACPI_MEM_ALLOCATE (size_needed); 112 name_string = ACPI_MEM_ALLOCATE (size_needed);
109 if (!name_string) { 113 if (!name_string) {
110 ACPI_REPORT_ERROR (("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); 114 ACPI_REPORT_ERROR ((
115 "ex_allocate_name_string: Could not allocate size %d\n", size_needed));
111 return_PTR (NULL); 116 return_PTR (NULL);
112 } 117 }
113 118
@@ -152,15 +157,17 @@ acpi_ex_allocate_name_string (
152 * 157 *
153 * FUNCTION: acpi_ex_name_segment 158 * FUNCTION: acpi_ex_name_segment
154 * 159 *
155 * PARAMETERS: interpreter_mode - Current running mode (load1/Load2/Exec) 160 * PARAMETERS: in_aml_address - Pointer to the name in the AML code
161 * name_string - Where to return the name. The name is appended
162 * to any existing string to form a namepath
156 * 163 *
157 * RETURN: Status 164 * RETURN: Status
158 * 165 *
159 * DESCRIPTION: Execute a name segment (4 bytes) 166 * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream
160 * 167 *
161 ******************************************************************************/ 168 ******************************************************************************/
162 169
163acpi_status 170static acpi_status
164acpi_ex_name_segment ( 171acpi_ex_name_segment (
165 u8 **in_aml_address, 172 u8 **in_aml_address,
166 char *name_string) 173 char *name_string)
@@ -223,10 +230,13 @@ acpi_ex_name_segment (
223 status = AE_CTRL_PENDING; 230 status = AE_CTRL_PENDING;
224 } 231 }
225 else { 232 else {
226 /* Segment started with one or more valid characters, but fewer than 4 */ 233 /*
227 234 * Segment started with one or more valid characters, but fewer than
235 * the required 4
236 */
228 status = AE_AML_BAD_NAME; 237 status = AE_AML_BAD_NAME;
229 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n", 238 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
239 "Bad character %02x in name, at %p\n",
230 *aml_address, aml_address)); 240 *aml_address, aml_address));
231 } 241 }
232 242
@@ -239,11 +249,16 @@ acpi_ex_name_segment (
239 * 249 *
240 * FUNCTION: acpi_ex_get_name_string 250 * FUNCTION: acpi_ex_get_name_string
241 * 251 *
242 * PARAMETERS: data_type - Data type to be associated with this name 252 * PARAMETERS: data_type - Object type to be associated with this
253 * name
254 * in_aml_address - Pointer to the namestring in the AML code
255 * out_name_string - Where the namestring is returned
256 * out_name_length - Length of the returned string
243 * 257 *
244 * RETURN: Status 258 * RETURN: Status, namestring and length
245 * 259 *
246 * DESCRIPTION: Get a name, including any prefixes. 260 * DESCRIPTION: Extract a full namepath from the AML byte stream,
261 * including any prefixes.
247 * 262 *
248 ******************************************************************************/ 263 ******************************************************************************/
249 264
@@ -286,7 +301,8 @@ acpi_ex_get_name_string (
286 switch (*aml_address) { 301 switch (*aml_address) {
287 case AML_ROOT_PREFIX: 302 case AML_ROOT_PREFIX:
288 303
289 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", aml_address)); 304 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
305 aml_address));
290 306
291 /* 307 /*
292 * Remember that we have a root_prefix -- 308 * Remember that we have a root_prefix --
@@ -303,7 +319,8 @@ acpi_ex_get_name_string (
303 /* Increment past possibly multiple parent prefixes */ 319 /* Increment past possibly multiple parent prefixes */
304 320
305 do { 321 do {
306 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", aml_address)); 322 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
323 aml_address));
307 324
308 aml_address++; 325 aml_address++;
309 prefix_count++; 326 prefix_count++;
@@ -321,13 +338,13 @@ acpi_ex_get_name_string (
321 break; 338 break;
322 } 339 }
323 340
324
325 /* Examine first character of name for name segment prefix operator */ 341 /* Examine first character of name for name segment prefix operator */
326 342
327 switch (*aml_address) { 343 switch (*aml_address) {
328 case AML_DUAL_NAME_PREFIX: 344 case AML_DUAL_NAME_PREFIX:
329 345
330 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", aml_address)); 346 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
347 aml_address));
331 348
332 aml_address++; 349 aml_address++;
333 name_string = acpi_ex_allocate_name_string (prefix_count, 2); 350 name_string = acpi_ex_allocate_name_string (prefix_count, 2);
@@ -349,7 +366,8 @@ acpi_ex_get_name_string (
349 366
350 case AML_MULTI_NAME_PREFIX_OP: 367 case AML_MULTI_NAME_PREFIX_OP:
351 368
352 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", aml_address)); 369 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
370 aml_address));
353 371
354 /* Fetch count of segments remaining in name path */ 372 /* Fetch count of segments remaining in name path */
355 373
@@ -368,7 +386,8 @@ acpi_ex_get_name_string (
368 has_prefix = TRUE; 386 has_prefix = TRUE;
369 387
370 while (num_segments && 388 while (num_segments &&
371 (status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) { 389 (status = acpi_ex_name_segment (&aml_address, name_string)) ==
390 AE_OK) {
372 num_segments--; 391 num_segments--;
373 } 392 }
374 393
@@ -380,7 +399,8 @@ acpi_ex_get_name_string (
380 /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ 399 /* null_name valid as of 8-12-98 ASL/AML Grammar Update */
381 400
382 if (prefix_count == ACPI_UINT32_MAX) { 401 if (prefix_count == ACPI_UINT32_MAX) {
383 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "name_seg is \"\\\" followed by NULL\n")); 402 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
403 "name_seg is \"\\\" followed by NULL\n"));
384 } 404 }
385 405
386 /* Consume the NULL byte */ 406 /* Consume the NULL byte */
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index 8482aefaf38b..dbdf8262ba00 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -97,7 +97,8 @@ acpi_ex_opcode_0A_0T_1R (
97 union acpi_operand_object *return_desc = NULL; 97 union acpi_operand_object *return_desc = NULL;
98 98
99 99
100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R",
101 acpi_ps_get_opcode_name (walk_state->opcode));
101 102
102 103
103 /* Examine the AML opcode */ 104 /* Examine the AML opcode */
@@ -161,7 +162,8 @@ acpi_ex_opcode_1A_0T_0R (
161 acpi_status status = AE_OK; 162 acpi_status status = AE_OK;
162 163
163 164
164 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); 165 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R",
166 acpi_ps_get_opcode_name (walk_state->opcode));
165 167
166 168
167 /* Examine the AML opcode */ 169 /* Examine the AML opcode */
@@ -236,7 +238,8 @@ acpi_ex_opcode_1A_1T_0R (
236 union acpi_operand_object **operand = &walk_state->operands[0]; 238 union acpi_operand_object **operand = &walk_state->operands[0];
237 239
238 240
239 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); 241 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R",
242 acpi_ps_get_opcode_name (walk_state->opcode));
240 243
241 244
242 /* Examine the AML opcode */ 245 /* Examine the AML opcode */
@@ -289,7 +292,8 @@ acpi_ex_opcode_1A_1T_1R (
289 acpi_integer digit; 292 acpi_integer digit;
290 293
291 294
292 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 295 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R",
296 acpi_ps_get_opcode_name (walk_state->opcode));
293 297
294 298
295 /* Examine the AML opcode */ 299 /* Examine the AML opcode */
@@ -409,8 +413,10 @@ acpi_ex_opcode_1A_1T_1R (
409 for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { 413 for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
410 (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); 414 (void) acpi_ut_short_divide (digit, 10, &digit, &temp32);
411 415
412 /* Insert the BCD digit that resides in the remainder from above */ 416 /*
413 417 * Insert the BCD digit that resides in the
418 * remainder from above
419 */
414 return_desc->integer.value |= (((acpi_integer) temp32) << 420 return_desc->integer.value |= (((acpi_integer) temp32) <<
415 ACPI_MUL_4 (i)); 421 ACPI_MUL_4 (i));
416 } 422 }
@@ -445,7 +451,8 @@ acpi_ex_opcode_1A_1T_1R (
445 451
446 /* Get the object reference, store it, and remove our reference */ 452 /* Get the object reference, store it, and remove our reference */
447 453
448 status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state); 454 status = acpi_ex_get_object_reference (operand[0],
455 &return_desc2, walk_state);
449 if (ACPI_FAILURE (status)) { 456 if (ACPI_FAILURE (status)) {
450 goto cleanup; 457 goto cleanup;
451 } 458 }
@@ -482,10 +489,10 @@ acpi_ex_opcode_1A_1T_1R (
482 489
483 if (!walk_state->result_obj) { 490 if (!walk_state->result_obj) {
484 /* 491 /*
485 * Normally, we would remove a reference on the Operand[0] parameter; 492 * Normally, we would remove a reference on the Operand[0]
486 * But since it is being used as the internal return object 493 * parameter; But since it is being used as the internal return
487 * (meaning we would normally increment it), the two cancel out, 494 * object (meaning we would normally increment it), the two
488 * and we simply don't do anything. 495 * cancel out, and we simply don't do anything.
489 */ 496 */
490 walk_state->result_obj = operand[0]; 497 walk_state->result_obj = operand[0];
491 walk_state->operands[0] = NULL; /* Prevent deletion */ 498 walk_state->operands[0] = NULL; /* Prevent deletion */
@@ -549,9 +556,8 @@ acpi_ex_opcode_1A_1T_1R (
549 case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ 556 case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */
550 case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ 557 case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */
551 558
552 /* 559 /* These are two obsolete opcodes */
553 * These are two obsolete opcodes 560
554 */
555 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 561 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
556 "%s is obsolete and not implemented\n", 562 "%s is obsolete and not implemented\n",
557 acpi_ps_get_opcode_name (walk_state->opcode))); 563 acpi_ps_get_opcode_name (walk_state->opcode)));
@@ -568,9 +574,8 @@ acpi_ex_opcode_1A_1T_1R (
568 } 574 }
569 575
570 if (ACPI_SUCCESS (status)) { 576 if (ACPI_SUCCESS (status)) {
571 /* 577 /* Store the return value computed above into the target object */
572 * Store the return value computed above into the target object 578
573 */
574 status = acpi_ex_store (return_desc, operand[1], walk_state); 579 status = acpi_ex_store (return_desc, operand[1], walk_state);
575 } 580 }
576 581
@@ -615,7 +620,8 @@ acpi_ex_opcode_1A_0T_1R (
615 acpi_integer value; 620 acpi_integer value;
616 621
617 622
618 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 623 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R",
624 acpi_ps_get_opcode_name (walk_state->opcode));
619 625
620 626
621 /* Examine the AML opcode */ 627 /* Examine the AML opcode */
@@ -706,9 +712,9 @@ acpi_ex_opcode_1A_0T_1R (
706 712
707 /* 713 /*
708 * Note: The operand is not resolved at this point because we want to 714 * Note: The operand is not resolved at this point because we want to
709 * get the associated object, not its value. For example, we don't want 715 * get the associated object, not its value. For example, we don't
710 * to resolve a field_unit to its value, we want the actual field_unit 716 * want to resolve a field_unit to its value, we want the actual
711 * object. 717 * field_unit object.
712 */ 718 */
713 719
714 /* Get the type of the base object */ 720 /* Get the type of the base object */
@@ -738,7 +744,8 @@ acpi_ex_opcode_1A_0T_1R (
738 744
739 /* Get the base object */ 745 /* Get the base object */
740 746
741 status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, &temp_desc); 747 status = acpi_ex_resolve_multiple (walk_state,
748 operand[0], &type, &temp_desc);
742 if (ACPI_FAILURE (status)) { 749 if (ACPI_FAILURE (status)) {
743 goto cleanup; 750 goto cleanup;
744 } 751 }
@@ -818,8 +825,10 @@ acpi_ex_opcode_1A_0T_1R (
818 825
819 /* Set Operand[0] to the value of the local/arg */ 826 /* Set Operand[0] to the value of the local/arg */
820 827
821 status = acpi_ds_method_data_get_value (operand[0]->reference.opcode, 828 status = acpi_ds_method_data_get_value (
822 operand[0]->reference.offset, walk_state, &temp_desc); 829 operand[0]->reference.opcode,
830 operand[0]->reference.offset,
831 walk_state, &temp_desc);
823 if (ACPI_FAILURE (status)) { 832 if (ACPI_FAILURE (status)) {
824 goto cleanup; 833 goto cleanup;
825 } 834 }
@@ -852,21 +861,26 @@ acpi_ex_opcode_1A_0T_1R (
852 case ACPI_TYPE_STRING: 861 case ACPI_TYPE_STRING:
853 862
854 /* 863 /*
855 * This is a deref_of (String). The string is a reference to a named ACPI object. 864 * This is a deref_of (String). The string is a reference
865 * to a named ACPI object.
856 * 866 *
857 * 1) Find the owning Node 867 * 1) Find the owning Node
858 * 2) Dereference the node to an actual object. Could be a Field, so we nee 868 * 2) Dereference the node to an actual object. Could be a
859 * to resolve the node to a value. 869 * Field, so we need to resolve the node to a value.
860 */ 870 */
861 status = acpi_ns_get_node_by_path (operand[0]->string.pointer, 871 status = acpi_ns_get_node_by_path (operand[0]->string.pointer,
862 walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT, 872 walk_state->scope_info->scope.node,
863 ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc)); 873 ACPI_NS_SEARCH_PARENT,
874 ACPI_CAST_INDIRECT_PTR (
875 struct acpi_namespace_node, &return_desc));
864 if (ACPI_FAILURE (status)) { 876 if (ACPI_FAILURE (status)) {
865 goto cleanup; 877 goto cleanup;
866 } 878 }
867 879
868 status = acpi_ex_resolve_node_to_value ( 880 status = acpi_ex_resolve_node_to_value (
869 ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc), walk_state); 881 ACPI_CAST_INDIRECT_PTR (
882 struct acpi_namespace_node, &return_desc),
883 walk_state);
870 goto cleanup; 884 goto cleanup;
871 885
872 886
@@ -883,14 +897,16 @@ acpi_ex_opcode_1A_0T_1R (
883 /* 897 /*
884 * This is a deref_of (object_reference) 898 * This is a deref_of (object_reference)
885 * Get the actual object from the Node (This is the dereference). 899 * Get the actual object from the Node (This is the dereference).
886 * -- This case may only happen when a local_x or arg_x is dereferenced above. 900 * This case may only happen when a local_x or arg_x is
901 * dereferenced above.
887 */ 902 */
888 return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) operand[0]); 903 return_desc = acpi_ns_get_attached_object (
904 (struct acpi_namespace_node *) operand[0]);
889 } 905 }
890 else { 906 else {
891 /* 907 /*
892 * This must be a reference object produced by either the Index() or 908 * This must be a reference object produced by either the
893 * ref_of() operator 909 * Index() or ref_of() operator
894 */ 910 */
895 switch (operand[0]->reference.opcode) { 911 switch (operand[0]->reference.opcode) {
896 case AML_INDEX_OP: 912 case AML_INDEX_OP:
@@ -931,8 +947,8 @@ acpi_ex_opcode_1A_0T_1R (
931 case ACPI_TYPE_PACKAGE: 947 case ACPI_TYPE_PACKAGE:
932 948
933 /* 949 /*
934 * Return the referenced element of the package. We must add 950 * Return the referenced element of the package. We must
935 * another reference to the referenced object, however. 951 * add another reference to the referenced object, however.
936 */ 952 */
937 return_desc = *(operand[0]->reference.where); 953 return_desc = *(operand[0]->reference.where);
938 if (!return_desc) { 954 if (!return_desc) {
@@ -967,9 +983,11 @@ acpi_ex_opcode_1A_0T_1R (
967 983
968 return_desc = operand[0]->reference.object; 984 return_desc = operand[0]->reference.object;
969 985
970 if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) { 986 if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) ==
987 ACPI_DESC_TYPE_NAMED) {
971 988
972 return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) return_desc); 989 return_desc = acpi_ns_get_attached_object (
990 (struct acpi_namespace_node *) return_desc);
973 } 991 }
974 992
975 /* Add another reference to the object! */ 993 /* Add another reference to the object! */
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c
index 8be4d80ceed5..7429032c2b6c 100644
--- a/drivers/acpi/executer/exoparg2.c
+++ b/drivers/acpi/executer/exoparg2.c
@@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R (
118 118
119 value = (u32) operand[1]->integer.value; 119 value = (u32) operand[1]->integer.value;
120 120
121 /* Notifies allowed on this object? */ 121 /* Are notifies allowed on this object? */
122 122
123 if (!acpi_ev_is_notify_object (node)) { 123 if (!acpi_ev_is_notify_object (node)) {
124 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 124 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R (
203 acpi_ps_get_opcode_name (walk_state->opcode)); 203 acpi_ps_get_opcode_name (walk_state->opcode));
204 204
205 205
206 /* 206 /* Execute the opcode */
207 * Execute the opcode 207
208 */
209 switch (walk_state->opcode) { 208 switch (walk_state->opcode) {
210 case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, remainder_result quotient_result) */ 209 case AML_DIVIDE_OP:
210
211 /* Divide (Dividend, Divisor, remainder_result quotient_result) */
211 212
212 return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 213 return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
213 if (!return_desc1) { 214 if (!return_desc1) {
@@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R (
241 goto cleanup; 242 goto cleanup;
242 } 243 }
243 244
244
245 /* Store the results to the target reference operands */ 245 /* Store the results to the target reference operands */
246 246
247 status = acpi_ex_store (return_desc2, operand[2], walk_state); 247 status = acpi_ex_store (return_desc2, operand[2], walk_state);
@@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R (
295{ 295{
296 union acpi_operand_object **operand = &walk_state->operands[0]; 296 union acpi_operand_object **operand = &walk_state->operands[0];
297 union acpi_operand_object *return_desc = NULL; 297 union acpi_operand_object *return_desc = NULL;
298 u32 index; 298 acpi_integer index;
299 acpi_status status = AE_OK; 299 acpi_status status = AE_OK;
300 acpi_size length; 300 acpi_size length;
301 301
@@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R (
304 acpi_ps_get_opcode_name (walk_state->opcode)); 304 acpi_ps_get_opcode_name (walk_state->opcode));
305 305
306 306
307 /* 307 /* Execute the opcode */
308 * Execute the opcode 308
309 */
310 if (walk_state->op_info->flags & AML_MATH) { 309 if (walk_state->op_info->flags & AML_MATH) {
311 /* All simple math opcodes (add, etc.) */ 310 /* All simple math opcodes (add, etc.) */
312 311
@@ -322,9 +321,8 @@ acpi_ex_opcode_2A_1T_1R (
322 goto store_result_to_target; 321 goto store_result_to_target;
323 } 322 }
324 323
325
326 switch (walk_state->opcode) { 324 switch (walk_state->opcode) {
327 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ 325 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
328 326
329 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 327 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
330 if (!return_desc) { 328 if (!return_desc) {
@@ -341,18 +339,19 @@ acpi_ex_opcode_2A_1T_1R (
341 break; 339 break;
342 340
343 341
344 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ 342 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
345 343
346 status = acpi_ex_do_concatenate (operand[0], operand[1], 344 status = acpi_ex_do_concatenate (operand[0], operand[1],
347 &return_desc, walk_state); 345 &return_desc, walk_state);
348 break; 346 break;
349 347
350 348
351 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ 349 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
352 350
353 /* 351 /*
354 * Input object is guaranteed to be a buffer at this point (it may have 352 * Input object is guaranteed to be a buffer at this point (it may have
355 * been converted.) Copy the raw buffer data to a new object of type String. 353 * been converted.) Copy the raw buffer data to a new object of
354 * type String.
356 */ 355 */
357 356
358 /* 357 /*
@@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R (
383 goto cleanup; 382 goto cleanup;
384 } 383 }
385 384
386 /* Copy the raw buffer data with no transform. NULL terminated already. */ 385 /* Copy the raw buffer data with no transform. NULL terminated already*/
387 386
388 ACPI_MEMCPY (return_desc->string.pointer, 387 ACPI_MEMCPY (return_desc->string.pointer,
389 operand[0]->buffer.pointer, length); 388 operand[0]->buffer.pointer, length);
390 break; 389 break;
391 390
392 391
393 case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ 392 case AML_CONCAT_RES_OP:
393
394 /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
394 395
395 status = acpi_ex_concat_template (operand[0], operand[1], 396 status = acpi_ex_concat_template (operand[0], operand[1],
396 &return_desc, walk_state); 397 &return_desc, walk_state);
@@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R (
407 goto cleanup; 408 goto cleanup;
408 } 409 }
409 410
410 index = (u32) operand[1]->integer.value; 411 index = operand[1]->integer.value;
412
413 /* At this point, the Source operand is a Package, Buffer, or String */
411 414
412 /*
413 * At this point, the Source operand is a Package, Buffer, or String
414 */
415 if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { 415 if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
416 /* Object to be indexed is a Package */ 416 /* Object to be indexed is a Package */
417 417
418 if (index >= operand[0]->package.count) { 418 if (index >= operand[0]->package.count) {
419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
420 "Index value (%X) beyond package end (%X)\n", 420 "Index value (%X%8.8X) beyond package end (%X)\n",
421 index, operand[0]->package.count)); 421 ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
422 status = AE_AML_PACKAGE_LIMIT; 422 status = AE_AML_PACKAGE_LIMIT;
423 goto cleanup; 423 goto cleanup;
424 } 424 }
425 425
426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE; 426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
427 return_desc->reference.object = operand[0]; 427 return_desc->reference.object = operand[0];
428 return_desc->reference.where = &operand[0]->package.elements [index]; 428 return_desc->reference.where = &operand[0]->package.elements [
429 index];
429 } 430 }
430 else { 431 else {
431 /* Object to be indexed is a Buffer/String */ 432 /* Object to be indexed is a Buffer/String */
432 433
433 if (index >= operand[0]->buffer.length) { 434 if (index >= operand[0]->buffer.length) {
434 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 435 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
435 "Index value (%X) beyond end of buffer (%X)\n", 436 "Index value (%X%8.8X) beyond end of buffer (%X)\n",
436 index, operand[0]->buffer.length)); 437 ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
437 status = AE_AML_BUFFER_LIMIT; 438 status = AE_AML_BUFFER_LIMIT;
438 goto cleanup; 439 goto cleanup;
439 } 440 }
@@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R (
451 /* Complete the Index reference object */ 452 /* Complete the Index reference object */
452 453
453 return_desc->reference.opcode = AML_INDEX_OP; 454 return_desc->reference.opcode = AML_INDEX_OP;
454 return_desc->reference.offset = index; 455 return_desc->reference.offset = (u32) index;
455 456
456 /* Store the reference to the Target */ 457 /* Store the reference to the Target */
457 458
@@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R (
536 goto cleanup; 537 goto cleanup;
537 } 538 }
538 539
539 /* 540 /* Execute the Opcode */
540 * Execute the Opcode 541
541 */ 542 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
542 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ { 543 /* logical_op (Operand0, Operand1) */
544
543 status = acpi_ex_do_logical_numeric_op (walk_state->opcode, 545 status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
544 operand[0]->integer.value, operand[1]->integer.value, 546 operand[0]->integer.value, operand[1]->integer.value,
545 &logical_result); 547 &logical_result);
546 goto store_logical_result; 548 goto store_logical_result;
547 } 549 }
548 else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { 550 else if (walk_state->op_info->flags & AML_LOGICAL) {
551 /* logical_op (Operand0, Operand1) */
552
549 status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], 553 status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
550 operand[1], &logical_result); 554 operand[1], &logical_result);
551 goto store_logical_result; 555 goto store_logical_result;
552 } 556 }
553 557
554
555 switch (walk_state->opcode) { 558 switch (walk_state->opcode) {
556 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ 559 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
557 560
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c
index 29d0b167745d..23b068adbf58 100644
--- a/drivers/acpi/executer/exoparg3.c
+++ b/drivers/acpi/executer/exoparg3.c
@@ -97,11 +97,12 @@ acpi_ex_opcode_3A_0T_0R (
97 acpi_status status = AE_OK; 97 acpi_status status = AE_OK;
98 98
99 99
100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); 100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R",
101 acpi_ps_get_opcode_name (walk_state->opcode));
101 102
102 103
103 switch (walk_state->opcode) { 104 switch (walk_state->opcode) {
104 case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ 105 case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
105 106
106 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 107 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
107 "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", 108 "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
@@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R (
116 fatal->argument = (u32) operand[2]->integer.value; 117 fatal->argument = (u32) operand[2]->integer.value;
117 } 118 }
118 119
119 /* 120 /* Always signal the OS! */
120 * Always signal the OS! 121
121 */
122 status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); 122 status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
123 123
124 /* Might return while OS is shutting down, just continue */ 124 /* Might return while OS is shutting down, just continue */
@@ -162,21 +162,23 @@ acpi_ex_opcode_3A_1T_1R (
162 union acpi_operand_object *return_desc = NULL; 162 union acpi_operand_object *return_desc = NULL;
163 char *buffer; 163 char *buffer;
164 acpi_status status = AE_OK; 164 acpi_status status = AE_OK;
165 acpi_native_uint index; 165 acpi_integer index;
166 acpi_size length; 166 acpi_size length;
167 167
168 168
169 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 169 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R",
170 acpi_ps_get_opcode_name (walk_state->opcode));
170 171
171 172
172 switch (walk_state->opcode) { 173 switch (walk_state->opcode) {
173 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ 174 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
174 175
175 /* 176 /*
176 * Create the return object. The Source operand is guaranteed to be 177 * Create the return object. The Source operand is guaranteed to be
177 * either a String or a Buffer, so just use its type. 178 * either a String or a Buffer, so just use its type.
178 */ 179 */
179 return_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (operand[0])); 180 return_desc = acpi_ut_create_internal_object (
181 ACPI_GET_OBJECT_TYPE (operand[0]));
180 if (!return_desc) { 182 if (!return_desc) {
181 status = AE_NO_MEMORY; 183 status = AE_NO_MEMORY;
182 goto cleanup; 184 goto cleanup;
@@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R (
184 186
185 /* Get the Integer values from the objects */ 187 /* Get the Integer values from the objects */
186 188
187 index = (acpi_native_uint) operand[1]->integer.value; 189 index = operand[1]->integer.value;
188 length = (acpi_size) operand[2]->integer.value; 190 length = (acpi_size) operand[2]->integer.value;
189 191
190 /* 192 /*
@@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R (
197 199
198 if ((index + length) > 200 if ((index + length) >
199 operand[0]->string.length) { 201 operand[0]->string.length) {
200 length = (acpi_size) operand[0]->string.length - index; 202 length = (acpi_size) operand[0]->string.length -
203 (acpi_size) index;
201 } 204 }
202 205
203 /* Allocate a new buffer for the String/Buffer */ 206 /* Allocate a new buffer for the String/Buffer */
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c
index d32624331626..17f81d42ee41 100644
--- a/drivers/acpi/executer/exoparg6.c
+++ b/drivers/acpi/executer/exoparg6.c
@@ -75,6 +75,14 @@
75 * fully resolved operands. 75 * fully resolved operands.
76!*/ 76!*/
77 77
78/* Local prototypes */
79
80static u8
81acpi_ex_do_match (
82 u32 match_op,
83 union acpi_operand_object *package_obj,
84 union acpi_operand_object *match_obj);
85
78 86
79/******************************************************************************* 87/*******************************************************************************
80 * 88 *
@@ -92,7 +100,7 @@
92 * 100 *
93 ******************************************************************************/ 101 ******************************************************************************/
94 102
95u8 103static u8
96acpi_ex_do_match ( 104acpi_ex_do_match (
97 u32 match_op, 105 u32 match_op,
98 union acpi_operand_object *package_obj, 106 union acpi_operand_object *package_obj,
@@ -216,11 +224,12 @@ acpi_ex_opcode_6A_0T_1R (
216 union acpi_operand_object **operand = &walk_state->operands[0]; 224 union acpi_operand_object **operand = &walk_state->operands[0];
217 union acpi_operand_object *return_desc = NULL; 225 union acpi_operand_object *return_desc = NULL;
218 acpi_status status = AE_OK; 226 acpi_status status = AE_OK;
219 u32 index; 227 acpi_integer index;
220 union acpi_operand_object *this_element; 228 union acpi_operand_object *this_element;
221 229
222 230
223 ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 231 ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R",
232 acpi_ps_get_opcode_name (walk_state->opcode));
224 233
225 234
226 switch (walk_state->opcode) { 235 switch (walk_state->opcode) {
@@ -241,9 +250,11 @@ acpi_ex_opcode_6A_0T_1R (
241 250
242 /* Get the package start_index, validate against the package length */ 251 /* Get the package start_index, validate against the package length */
243 252
244 index = (u32) operand[5]->integer.value; 253 index = operand[5]->integer.value;
245 if (index >= (u32) operand[0]->package.count) { 254 if (index >= operand[0]->package.count) {
246 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n")); 255 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
256 "Index (%X%8.8X) beyond package end (%X)\n",
257 ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
247 status = AE_AML_PACKAGE_LIMIT; 258 status = AE_AML_PACKAGE_LIMIT;
248 goto cleanup; 259 goto cleanup;
249 } 260 }
@@ -314,13 +325,12 @@ acpi_ex_opcode_6A_0T_1R (
314 325
315 default: 326 default:
316 327
317 ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", 328 ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
318 walk_state->opcode)); 329 walk_state->opcode));
319 status = AE_AML_BAD_OPCODE; 330 status = AE_AML_BAD_OPCODE;
320 goto cleanup; 331 goto cleanup;
321 } 332 }
322 333
323
324 walk_state->result_obj = return_desc; 334 walk_state->result_obj = return_desc;
325 335
326 336
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
index 264ef3bba31b..c9e3c68b5549 100644
--- a/drivers/acpi/executer/exprep.c
+++ b/drivers/acpi/executer/exprep.c
@@ -52,8 +52,23 @@
52#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exprep") 53 ACPI_MODULE_NAME ("exprep")
54 54
55/* Local prototypes */
56
57static u32
58acpi_ex_decode_field_access (
59 union acpi_operand_object *obj_desc,
60 u8 field_flags,
61 u32 *return_byte_alignment);
62
55 63
56#ifdef ACPI_UNDER_DEVELOPMENT 64#ifdef ACPI_UNDER_DEVELOPMENT
65
66static u32
67acpi_ex_generate_access (
68 u32 field_bit_offset,
69 u32 field_bit_length,
70 u32 region_length);
71
57/******************************************************************************* 72/*******************************************************************************
58 * 73 *
59 * FUNCTION: acpi_ex_generate_access 74 * FUNCTION: acpi_ex_generate_access
@@ -99,12 +114,14 @@ acpi_ex_generate_access (
99 /* Round Field start offset and length to "minimal" byte boundaries */ 114 /* Round Field start offset and length to "minimal" byte boundaries */
100 115
101 field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); 116 field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8));
102 field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + field_bit_offset, 8)); 117 field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length +
118 field_bit_offset, 8));
103 field_byte_length = field_byte_end_offset - field_byte_offset; 119 field_byte_length = field_byte_end_offset - field_byte_offset;
104 120
105 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 121 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
106 "Bit length %d, Bit offset %d\n", 122 "Bit length %d, Bit offset %d\n",
107 field_bit_length, field_bit_offset)); 123 field_bit_length, field_bit_offset));
124
108 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 125 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
109 "Byte Length %d, Byte Offset %d, End Offset %d\n", 126 "Byte Length %d, Byte Offset %d, End Offset %d\n",
110 field_byte_length, field_byte_offset, field_byte_end_offset)); 127 field_byte_length, field_byte_offset, field_byte_end_offset));
@@ -117,20 +134,26 @@ acpi_ex_generate_access (
117 */ 134 */
118 for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { 135 for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) {
119 /* 136 /*
120 * 1) Round end offset up to next access boundary and make sure that this 137 * 1) Round end offset up to next access boundary and make sure that
121 * does not go beyond the end of the parent region. 138 * this does not go beyond the end of the parent region.
122 * 2) When the Access width is greater than the field_byte_length, we are done. 139 * 2) When the Access width is greater than the field_byte_length, we
123 * (This does not optimize for the perfectly aligned case yet). 140 * are done. (This does not optimize for the perfectly aligned
141 * case yet).
124 */ 142 */
125 if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { 143 if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) {
126 field_start_offset = ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / 144 field_start_offset =
127 access_byte_width; 145 ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
128 field_end_offset = ACPI_ROUND_UP ((field_byte_length + field_byte_offset), 146 access_byte_width;
129 access_byte_width) / access_byte_width; 147
130 accesses = field_end_offset - field_start_offset; 148 field_end_offset =
149 ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
150 access_byte_width) / access_byte_width;
151
152 accesses = field_end_offset - field_start_offset;
131 153
132 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 154 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
133 "access_width %d end is within region\n", access_byte_width)); 155 "access_width %d end is within region\n", access_byte_width));
156
134 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 157 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
135 "Field Start %d, Field End %d -- requires %d accesses\n", 158 "Field Start %d, Field End %d -- requires %d accesses\n",
136 field_start_offset, field_end_offset, accesses)); 159 field_start_offset, field_end_offset, accesses));
@@ -139,8 +162,8 @@ acpi_ex_generate_access (
139 162
140 if (accesses <= 1) { 163 if (accesses <= 1) {
141 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 164 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
142 "Entire field can be accessed with one operation of size %d\n", 165 "Entire field can be accessed with one operation of size %d\n",
143 access_byte_width)); 166 access_byte_width));
144 return_VALUE (access_byte_width); 167 return_VALUE (access_byte_width);
145 } 168 }
146 169
@@ -155,15 +178,20 @@ acpi_ex_generate_access (
155 } 178 }
156 else { 179 else {
157 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 180 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
158 "access_width %d end is NOT within region\n", access_byte_width)); 181 "access_width %d end is NOT within region\n", access_byte_width));
159 if (access_byte_width == 1) { 182 if (access_byte_width == 1) {
160 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 183 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
161 "Field goes beyond end-of-region!\n")); 184 "Field goes beyond end-of-region!\n"));
162 return_VALUE (0); /* Field does not fit in the region at all */
163 }
164 185
165 /* This width goes beyond the end-of-region, back off to previous access */ 186 /* Field does not fit in the region at all */
166 187
188 return_VALUE (0);
189 }
190
191 /*
192 * This width goes beyond the end-of-region, back off to
193 * previous access
194 */
167 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 195 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
168 "Backing off to previous optimal access width of %d\n", 196 "Backing off to previous optimal access width of %d\n",
169 minimum_access_width)); 197 minimum_access_width));
@@ -171,8 +199,10 @@ acpi_ex_generate_access (
171 } 199 }
172 } 200 }
173 201
174 /* Could not read/write field with one operation, just use max access width */ 202 /*
175 203 * Could not read/write field with one operation,
204 * just use max access width
205 */
176 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 206 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
177 "Cannot access field in one operation, using width 8\n")); 207 "Cannot access field in one operation, using width 8\n"));
178 return_VALUE (8); 208 return_VALUE (8);
@@ -184,8 +214,9 @@ acpi_ex_generate_access (
184 * 214 *
185 * FUNCTION: acpi_ex_decode_field_access 215 * FUNCTION: acpi_ex_decode_field_access
186 * 216 *
187 * PARAMETERS: Access - Encoded field access bits 217 * PARAMETERS: obj_desc - Field object
188 * Length - Field length. 218 * field_flags - Encoded fieldflags (contains access bits)
219 * return_byte_alignment - Where the byte alignment is returned
189 * 220 *
190 * RETURN: Field granularity (8, 16, 32 or 64) and 221 * RETURN: Field granularity (8, 16, 32 or 64) and
191 * byte_alignment (1, 2, 3, or 4) 222 * byte_alignment (1, 2, 3, or 4)
@@ -214,9 +245,10 @@ acpi_ex_decode_field_access (
214 case AML_FIELD_ACCESS_ANY: 245 case AML_FIELD_ACCESS_ANY:
215 246
216#ifdef ACPI_UNDER_DEVELOPMENT 247#ifdef ACPI_UNDER_DEVELOPMENT
217 byte_alignment = acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, 248 byte_alignment =
218 obj_desc->common_field.bit_length, 249 acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
219 0xFFFFFFFF /* Temp until we pass region_length as param */); 250 obj_desc->common_field.bit_length,
251 0xFFFFFFFF /* Temp until we pass region_length as parameter */);
220 bit_length = byte_alignment * 8; 252 bit_length = byte_alignment * 8;
221#endif 253#endif
222 254
@@ -276,6 +308,7 @@ acpi_ex_decode_field_access (
276 * field_flags - Access, lock_rule, and update_rule. 308 * field_flags - Access, lock_rule, and update_rule.
277 * The format of a field_flag is described 309 * The format of a field_flag is described
278 * in the ACPI specification 310 * in the ACPI specification
311 * field_attribute - Special attributes (not used)
279 * field_bit_position - Field start position 312 * field_bit_position - Field start position
280 * field_bit_length - Field length in number of bits 313 * field_bit_length - Field length in number of bits
281 * 314 *
@@ -337,7 +370,7 @@ acpi_ex_prep_common_field_object (
337 /* Setup width (access granularity) fields */ 370 /* Setup width (access granularity) fields */
338 371
339 obj_desc->common_field.access_byte_width = (u8) 372 obj_desc->common_field.access_byte_width = (u8)
340 ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ 373 ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */
341 374
342 obj_desc->common_field.access_bit_width = (u8) access_bit_width; 375 obj_desc->common_field.access_bit_width = (u8) access_bit_width;
343 376
@@ -380,11 +413,7 @@ acpi_ex_prep_common_field_object (
380 * 413 *
381 * FUNCTION: acpi_ex_prep_field_value 414 * FUNCTION: acpi_ex_prep_field_value
382 * 415 *
383 * PARAMETERS: Node - Owning Node 416 * PARAMETERS: Info - Contains all field creation info
384 * region_node - Region in which field is being defined
385 * field_flags - Access, lock_rule, and update_rule.
386 * field_bit_position - Field start position
387 * field_bit_length - Field length in number of bits
388 * 417 *
389 * RETURN: Status 418 * RETURN: Status
390 * 419 *
@@ -445,7 +474,7 @@ acpi_ex_prep_field_value (
445 switch (info->field_type) { 474 switch (info->field_type) {
446 case ACPI_TYPE_LOCAL_REGION_FIELD: 475 case ACPI_TYPE_LOCAL_REGION_FIELD:
447 476
448 obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); 477 obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
449 478
450 /* An additional reference for the container */ 479 /* An additional reference for the container */
451 480
@@ -461,8 +490,10 @@ acpi_ex_prep_field_value (
461 case ACPI_TYPE_LOCAL_BANK_FIELD: 490 case ACPI_TYPE_LOCAL_BANK_FIELD:
462 491
463 obj_desc->bank_field.value = info->bank_value; 492 obj_desc->bank_field.value = info->bank_value;
464 obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node); 493 obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (
465 obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (info->register_node); 494 info->region_node);
495 obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (
496 info->register_node);
466 497
467 /* An additional reference for the attached objects */ 498 /* An additional reference for the attached objects */
468 499
@@ -481,10 +512,13 @@ acpi_ex_prep_field_value (
481 512
482 case ACPI_TYPE_LOCAL_INDEX_FIELD: 513 case ACPI_TYPE_LOCAL_INDEX_FIELD:
483 514
484 obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node); 515 obj_desc->index_field.index_obj = acpi_ns_get_attached_object (
485 obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node); 516 info->register_node);
517 obj_desc->index_field.data_obj = acpi_ns_get_attached_object (
518 info->data_register_node);
486 obj_desc->index_field.value = (u32) 519 obj_desc->index_field.value = (u32)
487 (info->field_bit_position / ACPI_MUL_8 (obj_desc->field.access_byte_width)); 520 (info->field_bit_position / ACPI_MUL_8 (
521 obj_desc->field.access_byte_width));
488 522
489 if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { 523 if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
490 ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); 524 ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c
index 7cfd0684c70b..723aaef4bb4a 100644
--- a/drivers/acpi/executer/exregion.c
+++ b/drivers/acpi/executer/exregion.c
@@ -115,7 +115,6 @@ acpi_ex_system_memory_space_handler (
115 return_ACPI_STATUS (AE_AML_OPERAND_VALUE); 115 return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
116 } 116 }
117 117
118
119#ifndef ACPI_MISALIGNED_TRANSFERS 118#ifndef ACPI_MISALIGNED_TRANSFERS
120 /* 119 /*
121 * Hardware does not support non-aligned data transfers, we must verify 120 * Hardware does not support non-aligned data transfers, we must verify
@@ -134,7 +133,8 @@ acpi_ex_system_memory_space_handler (
134 */ 133 */
135 if ((address < mem_info->mapped_physical_address) || 134 if ((address < mem_info->mapped_physical_address) ||
136 (((acpi_integer) address + length) > 135 (((acpi_integer) address + length) >
137 ((acpi_integer) mem_info->mapped_physical_address + mem_info->mapped_length))) { 136 ((acpi_integer)
137 mem_info->mapped_physical_address + mem_info->mapped_length))) {
138 /* 138 /*
139 * The request cannot be resolved by the current memory mapping; 139 * The request cannot be resolved by the current memory mapping;
140 * Delete the existing mapping and create a new one. 140 * Delete the existing mapping and create a new one.
@@ -150,7 +150,9 @@ acpi_ex_system_memory_space_handler (
150 * Don't attempt to map memory beyond the end of the region, and 150 * Don't attempt to map memory beyond the end of the region, and
151 * constrain the maximum mapping size to something reasonable. 151 * constrain the maximum mapping size to something reasonable.
152 */ 152 */
153 window_size = (acpi_size) ((mem_info->address + mem_info->length) - address); 153 window_size = (acpi_size)
154 ((mem_info->address + mem_info->length) - address);
155
154 if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { 156 if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
155 window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; 157 window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
156 } 158 }
@@ -160,8 +162,9 @@ acpi_ex_system_memory_space_handler (
160 status = acpi_os_map_memory (address, window_size, 162 status = acpi_os_map_memory (address, window_size,
161 (void **) &mem_info->mapped_logical_address); 163 (void **) &mem_info->mapped_logical_address);
162 if (ACPI_FAILURE (status)) { 164 if (ACPI_FAILURE (status)) {
163 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n", 165 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
164 ACPI_FORMAT_UINT64 (address), (u32) window_size)); 166 "Could not map memory at %8.8X%8.8X, size %X\n",
167 ACPI_FORMAT_UINT64 (address), (u32) window_size));
165 mem_info->mapped_length = 0; 168 mem_info->mapped_length = 0;
166 return_ACPI_STATUS (status); 169 return_ACPI_STATUS (status);
167 } 170 }
@@ -177,10 +180,12 @@ acpi_ex_system_memory_space_handler (
177 * access 180 * access
178 */ 181 */
179 logical_addr_ptr = mem_info->mapped_logical_address + 182 logical_addr_ptr = mem_info->mapped_logical_address +
180 ((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address); 183 ((acpi_integer) address -
184 (acpi_integer) mem_info->mapped_physical_address);
181 185
182 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 186 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
183 "system_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width, 187 "system_memory %d (%d width) Address=%8.8X%8.8X\n",
188 function, bit_width,
184 ACPI_FORMAT_UINT64 (address))); 189 ACPI_FORMAT_UINT64 (address)));
185 190
186 /* 191 /*
@@ -298,13 +303,15 @@ acpi_ex_system_io_space_handler (
298 switch (function) { 303 switch (function) {
299 case ACPI_READ: 304 case ACPI_READ:
300 305
301 status = acpi_os_read_port ((acpi_io_address) address, &value32, bit_width); 306 status = acpi_os_read_port ((acpi_io_address) address,
307 &value32, bit_width);
302 *value = value32; 308 *value = value32;
303 break; 309 break;
304 310
305 case ACPI_WRITE: 311 case ACPI_WRITE:
306 312
307 status = acpi_os_write_port ((acpi_io_address) address, (u32) *value, bit_width); 313 status = acpi_os_write_port ((acpi_io_address) address,
314 (u32) *value, bit_width);
308 break; 315 break;
309 316
310 default: 317 default:
@@ -375,12 +382,14 @@ acpi_ex_pci_config_space_handler (
375 case ACPI_READ: 382 case ACPI_READ:
376 383
377 *value = 0; 384 *value = 0;
378 status = acpi_os_read_pci_configuration (pci_id, pci_register, value, bit_width); 385 status = acpi_os_read_pci_configuration (pci_id, pci_register,
386 value, bit_width);
379 break; 387 break;
380 388
381 case ACPI_WRITE: 389 case ACPI_WRITE:
382 390
383 status = acpi_os_write_pci_configuration (pci_id, pci_register, *value, bit_width); 391 status = acpi_os_write_pci_configuration (pci_id, pci_register,
392 *value, bit_width);
384 break; 393 break;
385 394
386 default: 395 default:
@@ -505,8 +514,7 @@ acpi_ex_data_table_space_handler (
505 514
506 logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); 515 logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address);
507 516
508 517 /* Perform the memory read or write */
509 /* Perform the memory read or write */
510 518
511 switch (function) { 519 switch (function) {
512 case ACPI_READ: 520 case ACPI_READ:
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
index 7936329a0e35..21d5c74fa309 100644
--- a/drivers/acpi/executer/exresnte.c
+++ b/drivers/acpi/executer/exresnte.c
@@ -210,15 +210,15 @@ acpi_ex_resolve_node_to_value (
210 case ACPI_TYPE_LOCAL_BANK_FIELD: 210 case ACPI_TYPE_LOCAL_BANK_FIELD:
211 case ACPI_TYPE_LOCAL_INDEX_FIELD: 211 case ACPI_TYPE_LOCAL_INDEX_FIELD:
212 212
213 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read Node=%p source_desc=%p Type=%X\n", 213 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
214 "field_read Node=%p source_desc=%p Type=%X\n",
214 node, source_desc, entry_type)); 215 node, source_desc, entry_type));
215 216
216 status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); 217 status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
217 break; 218 break;
218 219
219 /* 220 /* For these objects, just return the object attached to the Node */
220 * For these objects, just return the object attached to the Node 221
221 */
222 case ACPI_TYPE_MUTEX: 222 case ACPI_TYPE_MUTEX:
223 case ACPI_TYPE_METHOD: 223 case ACPI_TYPE_METHOD:
224 case ACPI_TYPE_POWER: 224 case ACPI_TYPE_POWER:
@@ -233,12 +233,12 @@ acpi_ex_resolve_node_to_value (
233 acpi_ut_add_reference (obj_desc); 233 acpi_ut_add_reference (obj_desc);
234 break; 234 break;
235 235
236
237 /* TYPE_ANY is untyped, and thus there is no object associated with it */ 236 /* TYPE_ANY is untyped, and thus there is no object associated with it */
238 237
239 case ACPI_TYPE_ANY: 238 case ACPI_TYPE_ANY:
240 239
241 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n", 240 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
241 "Untyped entry %p, no attached object!\n",
242 node)); 242 node));
243 243
244 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ 244 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
@@ -259,7 +259,8 @@ acpi_ex_resolve_node_to_value (
259 default: 259 default:
260 /* No named references are allowed here */ 260 /* No named references are allowed here */
261 261
262 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n", 262 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
263 "Unsupported Reference opcode %X (%s)\n",
263 source_desc->reference.opcode, 264 source_desc->reference.opcode,
264 acpi_ps_get_opcode_name (source_desc->reference.opcode))); 265 acpi_ps_get_opcode_name (source_desc->reference.opcode)));
265 266
@@ -268,11 +269,12 @@ acpi_ex_resolve_node_to_value (
268 break; 269 break;
269 270
270 271
271 /* Default case is for unknown types */
272
273 default: 272 default:
274 273
275 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n", 274 /* Default case is for unknown types */
275
276 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
277 "Node %p - Unknown object type %X\n",
276 node, entry_type)); 278 node, entry_type));
277 279
278 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 280 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -280,7 +282,7 @@ acpi_ex_resolve_node_to_value (
280 } /* switch (entry_type) */ 282 } /* switch (entry_type) */
281 283
282 284
283 /* Put the object descriptor on the stack */ 285 /* Return the object descriptor */
284 286
285 *object_ptr = (void *) obj_desc; 287 *object_ptr = (void *) obj_desc;
286 return_ACPI_STATUS (status); 288 return_ACPI_STATUS (status);
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
index 7be604911156..3de45672379a 100644
--- a/drivers/acpi/executer/exresolv.c
+++ b/drivers/acpi/executer/exresolv.c
@@ -54,6 +54,13 @@
54#define _COMPONENT ACPI_EXECUTER 54#define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exresolv") 55 ACPI_MODULE_NAME ("exresolv")
56 56
57/* Local prototypes */
58
59static acpi_status
60acpi_ex_resolve_object_to_value (
61 union acpi_operand_object **stack_ptr,
62 struct acpi_walk_state *walk_state);
63
57 64
58/******************************************************************************* 65/*******************************************************************************
59 * 66 *
@@ -96,6 +103,11 @@ acpi_ex_resolve_to_value (
96 if (ACPI_FAILURE (status)) { 103 if (ACPI_FAILURE (status)) {
97 return_ACPI_STATUS (status); 104 return_ACPI_STATUS (status);
98 } 105 }
106
107 if (!*stack_ptr) {
108 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
109 return_ACPI_STATUS (AE_AML_NO_OPERAND);
110 }
99 } 111 }
100 112
101 /* 113 /*
@@ -120,18 +132,17 @@ acpi_ex_resolve_to_value (
120 * 132 *
121 * FUNCTION: acpi_ex_resolve_object_to_value 133 * FUNCTION: acpi_ex_resolve_object_to_value
122 * 134 *
123 * PARAMETERS: stack_ptr - Pointer to a stack location that contains a 135 * PARAMETERS: stack_ptr - Pointer to an internal object
124 * ptr to an internal object.
125 * walk_state - Current method state 136 * walk_state - Current method state
126 * 137 *
127 * RETURN: Status 138 * RETURN: Status
128 * 139 *
129 * DESCRIPTION: Retrieve the value from an internal object. The Reference type 140 * DESCRIPTION: Retrieve the value from an internal object. The Reference type
130 * uses the associated AML opcode to determine the value. 141 * uses the associated AML opcode to determine the value.
131 * 142 *
132 ******************************************************************************/ 143 ******************************************************************************/
133 144
134acpi_status 145static acpi_status
135acpi_ex_resolve_object_to_value ( 146acpi_ex_resolve_object_to_value (
136 union acpi_operand_object **stack_ptr, 147 union acpi_operand_object **stack_ptr,
137 struct acpi_walk_state *walk_state) 148 struct acpi_walk_state *walk_state)
@@ -159,7 +170,7 @@ acpi_ex_resolve_object_to_value (
159 case AML_NAME_OP: 170 case AML_NAME_OP:
160 171
161 /* 172 /*
162 * Convert indirect name ptr to a direct name ptr. 173 * Convert name reference to a namespace node
163 * Then, acpi_ex_resolve_node_to_value can be used to get the value 174 * Then, acpi_ex_resolve_node_to_value can be used to get the value
164 */ 175 */
165 temp_node = stack_desc->reference.object; 176 temp_node = stack_desc->reference.object;
@@ -168,7 +179,7 @@ acpi_ex_resolve_object_to_value (
168 179
169 acpi_ut_remove_reference (stack_desc); 180 acpi_ut_remove_reference (stack_desc);
170 181
171 /* Put direct name pointer onto stack and exit */ 182 /* Return the namespace node */
172 183
173 (*stack_ptr) = temp_node; 184 (*stack_ptr) = temp_node;
174 break; 185 break;
@@ -255,10 +266,19 @@ acpi_ex_resolve_object_to_value (
255 266
256 break; 267 break;
257 268
269 case AML_INT_NAMEPATH_OP: /* Reference to a named object */
270
271 /* Get the object pointed to by the namespace node */
272
273 *stack_ptr = (stack_desc->reference.node)->object;
274 acpi_ut_add_reference (*stack_ptr);
275 acpi_ut_remove_reference (stack_desc);
276 break;
258 277
259 default: 278 default:
260 279
261 ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n", 280 ACPI_REPORT_ERROR ((
281 "During resolve, Unknown Reference opcode %X (%s) in %p\n",
262 opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); 282 opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
263 status = AE_AML_INTERNAL; 283 status = AE_AML_INTERNAL;
264 break; 284 break;
@@ -278,9 +298,8 @@ acpi_ex_resolve_object_to_value (
278 break; 298 break;
279 299
280 300
281 /* 301 /* These cases may never happen here, but just in case.. */
282 * These cases may never happen here, but just in case.. 302
283 */
284 case ACPI_TYPE_BUFFER_FIELD: 303 case ACPI_TYPE_BUFFER_FIELD:
285 case ACPI_TYPE_LOCAL_REGION_FIELD: 304 case ACPI_TYPE_LOCAL_REGION_FIELD:
286 case ACPI_TYPE_LOCAL_BANK_FIELD: 305 case ACPI_TYPE_LOCAL_BANK_FIELD:
@@ -333,9 +352,8 @@ acpi_ex_resolve_multiple (
333 ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); 352 ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple");
334 353
335 354
336 /* 355 /* Operand can be either a namespace node or an operand descriptor */
337 * Operand can be either a namespace node or an operand descriptor 356
338 */
339 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { 357 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
340 case ACPI_DESC_TYPE_OPERAND: 358 case ACPI_DESC_TYPE_OPERAND:
341 type = obj_desc->common.type; 359 type = obj_desc->common.type;
@@ -357,10 +375,8 @@ acpi_ex_resolve_multiple (
357 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 375 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
358 } 376 }
359 377
378 /* If type is anything other than a reference, we are done */
360 379
361 /*
362 * If type is anything other than a reference, we are done
363 */
364 if (type != ACPI_TYPE_LOCAL_REFERENCE) { 380 if (type != ACPI_TYPE_LOCAL_REFERENCE) {
365 goto exit; 381 goto exit;
366 } 382 }
@@ -382,8 +398,9 @@ acpi_ex_resolve_multiple (
382 /* All "References" point to a NS node */ 398 /* All "References" point to a NS node */
383 399
384 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { 400 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
385 ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", 401 ACPI_REPORT_ERROR ((
386 node, acpi_ut_get_descriptor_name (node))); 402 "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
403 node, acpi_ut_get_descriptor_name (node)));
387 return_ACPI_STATUS (AE_AML_INTERNAL); 404 return_ACPI_STATUS (AE_AML_INTERNAL);
388 } 405 }
389 406
@@ -440,8 +457,9 @@ acpi_ex_resolve_multiple (
440 /* All "References" point to a NS node */ 457 /* All "References" point to a NS node */
441 458
442 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { 459 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
443 ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", 460 ACPI_REPORT_ERROR ((
444 node, acpi_ut_get_descriptor_name (node))); 461 "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
462 node, acpi_ut_get_descriptor_name (node)));
445 return_ACPI_STATUS (AE_AML_INTERNAL); 463 return_ACPI_STATUS (AE_AML_INTERNAL);
446 } 464 }
447 465
@@ -468,7 +486,7 @@ acpi_ex_resolve_multiple (
468 486
469 if (return_desc) { 487 if (return_desc) {
470 status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, 488 status = acpi_ds_method_data_get_value (obj_desc->reference.opcode,
471 obj_desc->reference.offset, walk_state, &obj_desc); 489 obj_desc->reference.offset, walk_state, &obj_desc);
472 if (ACPI_FAILURE (status)) { 490 if (ACPI_FAILURE (status)) {
473 return_ACPI_STATUS (status); 491 return_ACPI_STATUS (status);
474 } 492 }
@@ -500,7 +518,8 @@ acpi_ex_resolve_multiple (
500 518
501 default: 519 default:
502 520
503 ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", 521 ACPI_REPORT_ERROR ((
522 "acpi_ex_resolve_multiple: Unknown Reference subtype %X\n",
504 obj_desc->reference.opcode)); 523 obj_desc->reference.opcode));
505 return_ACPI_STATUS (AE_AML_INTERNAL); 524 return_ACPI_STATUS (AE_AML_INTERNAL);
506 } 525 }
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index c92890220c32..d8b470eefe7a 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -52,6 +52,14 @@
52#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exresop") 53 ACPI_MODULE_NAME ("exresop")
54 54
55/* Local prototypes */
56
57static acpi_status
58acpi_ex_check_object_type (
59 acpi_object_type type_needed,
60 acpi_object_type this_type,
61 void *object);
62
55 63
56/******************************************************************************* 64/*******************************************************************************
57 * 65 *
@@ -67,7 +75,7 @@
67 * 75 *
68 ******************************************************************************/ 76 ******************************************************************************/
69 77
70acpi_status 78static acpi_status
71acpi_ex_check_object_type ( 79acpi_ex_check_object_type (
72 acpi_object_type type_needed, 80 acpi_object_type type_needed,
73 acpi_object_type this_type, 81 acpi_object_type this_type,
@@ -142,6 +150,7 @@ acpi_ex_resolve_operands (
142 const struct acpi_opcode_info *op_info; 150 const struct acpi_opcode_info *op_info;
143 u32 this_arg_type; 151 u32 this_arg_type;
144 acpi_object_type type_needed; 152 acpi_object_type type_needed;
153 u16 target_op = 0;
145 154
146 155
147 ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); 156 ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode);
@@ -160,7 +169,8 @@ acpi_ex_resolve_operands (
160 return_ACPI_STATUS (AE_AML_INTERNAL); 169 return_ACPI_STATUS (AE_AML_INTERNAL);
161 } 170 }
162 171
163 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n", 172 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
173 "Opcode %X [%s] required_operand_types=%8.8X \n",
164 opcode, op_info->name, arg_types)); 174 opcode, op_info->name, arg_types));
165 175
166 /* 176 /*
@@ -187,7 +197,7 @@ acpi_ex_resolve_operands (
187 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { 197 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
188 case ACPI_DESC_TYPE_NAMED: 198 case ACPI_DESC_TYPE_NAMED:
189 199
190 /* Node */ 200 /* Namespace Node */
191 201
192 object_type = ((struct acpi_namespace_node *) obj_desc)->type; 202 object_type = ((struct acpi_namespace_node *) obj_desc)->type;
193 break; 203 break;
@@ -202,16 +212,16 @@ acpi_ex_resolve_operands (
202 /* Check for bad acpi_object_type */ 212 /* Check for bad acpi_object_type */
203 213
204 if (!acpi_ut_valid_object_type (object_type)) { 214 if (!acpi_ut_valid_object_type (object_type)) {
205 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n", 215 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
216 "Bad operand object type [%X]\n",
206 object_type)); 217 object_type));
207 218
208 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 219 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
209 } 220 }
210 221
211 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { 222 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
212 /* 223 /* Decode the Reference */
213 * Decode the Reference 224
214 */
215 op_info = acpi_ps_get_opcode_info (opcode); 225 op_info = acpi_ps_get_opcode_info (opcode);
216 if (op_info->class == AML_CLASS_UNKNOWN) { 226 if (op_info->class == AML_CLASS_UNKNOWN) {
217 return_ACPI_STATUS (AE_AML_BAD_OPCODE); 227 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
@@ -219,12 +229,17 @@ acpi_ex_resolve_operands (
219 229
220 switch (obj_desc->reference.opcode) { 230 switch (obj_desc->reference.opcode) {
221 case AML_DEBUG_OP: 231 case AML_DEBUG_OP:
232 target_op = AML_DEBUG_OP;
233
234 /*lint -fallthrough */
235
222 case AML_NAME_OP: 236 case AML_NAME_OP:
223 case AML_INDEX_OP: 237 case AML_INDEX_OP:
224 case AML_REF_OF_OP: 238 case AML_REF_OF_OP:
225 case AML_ARG_OP: 239 case AML_ARG_OP:
226 case AML_LOCAL_OP: 240 case AML_LOCAL_OP:
227 case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ 241 case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
242 case AML_INT_NAMEPATH_OP: /* Reference to a named object */
228 243
229 ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 244 ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
230 "Operand is a Reference, ref_opcode [%s]\n", 245 "Operand is a Reference, ref_opcode [%s]\n",
@@ -254,10 +269,8 @@ acpi_ex_resolve_operands (
254 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 269 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
255 } 270 }
256 271
272 /* Get one argument type, point to the next */
257 273
258 /*
259 * Get one argument type, point to the next
260 */
261 this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); 274 this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
262 INCREMENT_ARG_LIST (arg_types); 275 INCREMENT_ARG_LIST (arg_types);
263 276
@@ -271,26 +284,31 @@ acpi_ex_resolve_operands (
271 if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && 284 if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
272 (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { 285 (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
273 /* 286 /*
274 * String found - the string references a named object and must be 287 * String found - the string references a named object and
275 * resolved to a node 288 * must be resolved to a node
276 */ 289 */
277 goto next_operand; 290 goto next_operand;
278 } 291 }
279 292
280 /* Else not a string - fall through to the normal Reference case below */ 293 /*
294 * Else not a string - fall through to the normal Reference
295 * case below
296 */
281 /*lint -fallthrough */ 297 /*lint -fallthrough */
282 298
283 case ARGI_REFERENCE: /* References: */ 299 case ARGI_REFERENCE: /* References: */
284 case ARGI_INTEGER_REF: 300 case ARGI_INTEGER_REF:
285 case ARGI_OBJECT_REF: 301 case ARGI_OBJECT_REF:
286 case ARGI_DEVICE_REF: 302 case ARGI_DEVICE_REF:
287 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ 303 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
288 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ 304 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
289 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ 305 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
290
291 /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
292 306
293 if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ { 307 /*
308 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
309 * A Namespace Node is OK as-is
310 */
311 if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
294 goto next_operand; 312 goto next_operand;
295 } 313 }
296 314
@@ -300,11 +318,9 @@ acpi_ex_resolve_operands (
300 return_ACPI_STATUS (status); 318 return_ACPI_STATUS (status);
301 } 319 }
302 320
303 if (AML_NAME_OP == obj_desc->reference.opcode) { 321 if (obj_desc->reference.opcode == AML_NAME_OP) {
304 /* 322 /* Convert a named reference to the actual named object */
305 * Convert an indirect name ptr to direct name ptr and put 323
306 * it on the stack
307 */
308 temp_node = obj_desc->reference.object; 324 temp_node = obj_desc->reference.object;
309 acpi_ut_remove_reference (obj_desc); 325 acpi_ut_remove_reference (obj_desc);
310 (*stack_ptr) = temp_node; 326 (*stack_ptr) = temp_node;
@@ -332,7 +348,6 @@ acpi_ex_resolve_operands (
332 break; 348 break;
333 } 349 }
334 350
335
336 /* 351 /*
337 * Resolve this object to a value 352 * Resolve this object to a value
338 */ 353 */
@@ -392,7 +407,7 @@ acpi_ex_resolve_operands (
392 /* 407 /*
393 * The more complex cases allow multiple resolved object types 408 * The more complex cases allow multiple resolved object types
394 */ 409 */
395 case ARGI_INTEGER: /* Number */ 410 case ARGI_INTEGER:
396 411
397 /* 412 /*
398 * Need an operand of type ACPI_TYPE_INTEGER, 413 * Need an operand of type ACPI_TYPE_INTEGER,
@@ -563,7 +578,7 @@ acpi_ex_resolve_operands (
563 578
564 case ARGI_REGION_OR_FIELD: 579 case ARGI_REGION_OR_FIELD:
565 580
566 /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */ 581 /* Need an operand of type REGION or a FIELD in a region */
567 582
568 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 583 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
569 case ACPI_TYPE_REGION: 584 case ACPI_TYPE_REGION:
@@ -614,6 +629,12 @@ acpi_ex_resolve_operands (
614 break; 629 break;
615 } 630 }
616 631
632 if (target_op == AML_DEBUG_OP) {
633 /* Allow store of any object to the Debug object */
634
635 break;
636 }
637
617 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 638 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
618 "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", 639 "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
619 acpi_ut_get_object_type_name (obj_desc), obj_desc)); 640 acpi_ut_get_object_type_name (obj_desc), obj_desc));
@@ -652,8 +673,7 @@ next_operand:
652 if (GET_CURRENT_ARG_TYPE (arg_types)) { 673 if (GET_CURRENT_ARG_TYPE (arg_types)) {
653 stack_ptr--; 674 stack_ptr--;
654 } 675 }
655 676 }
656 } /* while (*Types) */
657 677
658 return_ACPI_STATUS (status); 678 return_ACPI_STATUS (status);
659} 679}
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
index e0fc6aba1253..2725db0901b8 100644
--- a/drivers/acpi/executer/exstore.c
+++ b/drivers/acpi/executer/exstore.c
@@ -48,11 +48,171 @@
48#include <acpi/acinterp.h> 48#include <acpi/acinterp.h>
49#include <acpi/amlcode.h> 49#include <acpi/amlcode.h>
50#include <acpi/acnamesp.h> 50#include <acpi/acnamesp.h>
51#include <acpi/acparser.h>
51 52
52 53
53#define _COMPONENT ACPI_EXECUTER 54#define _COMPONENT ACPI_EXECUTER
54 ACPI_MODULE_NAME ("exstore") 55 ACPI_MODULE_NAME ("exstore")
55 56
57/* Local prototypes */
58
59static void
60acpi_ex_do_debug_object (
61 union acpi_operand_object *source_desc,
62 u32 level,
63 u32 index);
64
65static acpi_status
66acpi_ex_store_object_to_index (
67 union acpi_operand_object *val_desc,
68 union acpi_operand_object *dest_desc,
69 struct acpi_walk_state *walk_state);
70
71
72/*******************************************************************************
73 *
74 * FUNCTION: acpi_ex_do_debug_object
75 *
76 * PARAMETERS: source_desc - Value to be stored
77 * Level - Indentation level (used for packages)
78 * Index - Current package element, zero if not pkg
79 *
80 * RETURN: None
81 *
82 * DESCRIPTION: Handles stores to the Debug Object.
83 *
84 ******************************************************************************/
85
86static void
87acpi_ex_do_debug_object (
88 union acpi_operand_object *source_desc,
89 u32 level,
90 u32 index)
91{
92 u32 i;
93
94
95 ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc);
96
97
98 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
99 level, " "));
100
101 /* Display index for package output only */
102
103 if (index > 0) {
104 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
105 "(%.2u) ", index -1));
106 }
107
108 if (!source_desc) {
109 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
110 return_VOID;
111 }
112
113 if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) {
114 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
115 acpi_ut_get_object_type_name (source_desc)));
116
117 if (!acpi_ut_valid_internal_object (source_desc)) {
118 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
119 "%p, Invalid Internal Object!\n", source_desc));
120 return_VOID;
121 }
122 }
123 else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) {
124 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
125 acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type),
126 source_desc));
127 return_VOID;
128 }
129 else {
130 return_VOID;
131 }
132
133 switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
134 case ACPI_TYPE_INTEGER:
135
136 /* Output correct integer width */
137
138 if (acpi_gbl_integer_byte_width == 4) {
139 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
140 (u32) source_desc->integer.value));
141 }
142 else {
143 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
144 ACPI_FORMAT_UINT64 (source_desc->integer.value)));
145 }
146 break;
147
148 case ACPI_TYPE_BUFFER:
149
150 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
151 (u32) source_desc->buffer.length));
152 ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
153 (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
154 break;
155
156 case ACPI_TYPE_STRING:
157
158 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
159 source_desc->string.length, source_desc->string.pointer));
160 break;
161
162 case ACPI_TYPE_PACKAGE:
163
164 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
165 source_desc->package.count));
166
167 /* Output the entire contents of the package */
168
169 for (i = 0; i < source_desc->package.count; i++) {
170 acpi_ex_do_debug_object (source_desc->package.elements[i],
171 level+4, i+1);
172 }
173 break;
174
175 case ACPI_TYPE_LOCAL_REFERENCE:
176
177 if (source_desc->reference.opcode == AML_INDEX_OP) {
178 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
179 acpi_ps_get_opcode_name (source_desc->reference.opcode),
180 source_desc->reference.offset));
181 }
182 else {
183 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
184 acpi_ps_get_opcode_name (source_desc->reference.opcode)));
185 }
186
187
188 if (source_desc->reference.object) {
189 if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) ==
190 ACPI_DESC_TYPE_NAMED) {
191 acpi_ex_do_debug_object (((struct acpi_namespace_node *)
192 source_desc->reference.object)->object,
193 level+4, 0);
194 }
195 else {
196 acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0);
197 }
198 }
199 else if (source_desc->reference.node) {
200 acpi_ex_do_debug_object ((source_desc->reference.node)->object,
201 level+4, 0);
202 }
203 break;
204
205 default:
206
207 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
208 source_desc, acpi_ut_get_object_type_name (source_desc)));
209 break;
210 }
211
212 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
213 return_VOID;
214}
215
56 216
57/******************************************************************************* 217/*******************************************************************************
58 * 218 *
@@ -154,8 +314,9 @@ acpi_ex_store (
154 314
155 /* Storing an object into a Name "container" */ 315 /* Storing an object into a Name "container" */
156 316
157 status = acpi_ex_store_object_to_node (source_desc, ref_desc->reference.object, 317 status = acpi_ex_store_object_to_node (source_desc,
158 walk_state, ACPI_IMPLICIT_CONVERSION); 318 ref_desc->reference.object,
319 walk_state, ACPI_IMPLICIT_CONVERSION);
159 break; 320 break;
160 321
161 322
@@ -173,7 +334,7 @@ acpi_ex_store (
173 /* Store to a method local/arg */ 334 /* Store to a method local/arg */
174 335
175 status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, 336 status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
176 ref_desc->reference.offset, source_desc, walk_state); 337 ref_desc->reference.offset, source_desc, walk_state);
177 break; 338 break;
178 339
179 340
@@ -187,60 +348,7 @@ acpi_ex_store (
187 "**** Write to Debug Object: Object %p %s ****:\n\n", 348 "**** Write to Debug Object: Object %p %s ****:\n\n",
188 source_desc, acpi_ut_get_object_type_name (source_desc))); 349 source_desc, acpi_ut_get_object_type_name (source_desc)));
189 350
190 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", 351 acpi_ex_do_debug_object (source_desc, 0, 0);
191 acpi_ut_get_object_type_name (source_desc)));
192
193 if (!acpi_ut_valid_internal_object (source_desc)) {
194 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
195 "%p, Invalid Internal Object!\n", source_desc));
196 break;
197 }
198
199 switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
200 case ACPI_TYPE_INTEGER:
201
202 if (acpi_gbl_integer_byte_width == 4) {
203 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
204 (u32) source_desc->integer.value));
205 }
206 else {
207 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
208 ACPI_FORMAT_UINT64 (source_desc->integer.value)));
209 }
210 break;
211
212
213 case ACPI_TYPE_BUFFER:
214
215 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
216 (u32) source_desc->buffer.length));
217 ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
218 (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
219 break;
220
221
222 case ACPI_TYPE_STRING:
223
224 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
225 source_desc->string.length, source_desc->string.pointer));
226 break;
227
228
229 case ACPI_TYPE_PACKAGE:
230
231 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n",
232 source_desc->package.count, source_desc->package.elements));
233 break;
234
235
236 default:
237
238 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
239 source_desc));
240 break;
241 }
242
243 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
244 break; 352 break;
245 353
246 354
@@ -272,7 +380,7 @@ acpi_ex_store (
272 * 380 *
273 ******************************************************************************/ 381 ******************************************************************************/
274 382
275acpi_status 383static acpi_status
276acpi_ex_store_object_to_index ( 384acpi_ex_store_object_to_index (
277 union acpi_operand_object *source_desc, 385 union acpi_operand_object *source_desc,
278 union acpi_operand_object *index_desc, 386 union acpi_operand_object *index_desc,
@@ -313,16 +421,22 @@ acpi_ex_store_object_to_index (
313 if (obj_desc) { 421 if (obj_desc) {
314 /* Decrement reference count by the ref count of the parent package */ 422 /* Decrement reference count by the ref count of the parent package */
315 423
316 for (i = 0; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { 424 for (i = 0;
425 i < ((union acpi_operand_object *)
426 index_desc->reference.object)->common.reference_count;
427 i++) {
317 acpi_ut_remove_reference (obj_desc); 428 acpi_ut_remove_reference (obj_desc);
318 } 429 }
319 } 430 }
320 431
321 *(index_desc->reference.where) = new_desc; 432 *(index_desc->reference.where) = new_desc;
322 433
323 /* Increment reference count by the ref count of the parent package -1 */ 434 /* Increment ref count by the ref count of the parent package-1 */
324 435
325 for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { 436 for (i = 1;
437 i < ((union acpi_operand_object *)
438 index_desc->reference.object)->common.reference_count;
439 i++) {
326 acpi_ut_add_reference (new_desc); 440 acpi_ut_add_reference (new_desc);
327 } 441 }
328 442
@@ -440,9 +554,8 @@ acpi_ex_store_object_to_node (
440 ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); 554 ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc);
441 555
442 556
443 /* 557 /* Get current type of the node, and object attached to Node */
444 * Get current type of the node, and object attached to Node 558
445 */
446 target_type = acpi_ns_get_type (node); 559 target_type = acpi_ns_get_type (node);
447 target_desc = acpi_ns_get_attached_object (node); 560 target_desc = acpi_ns_get_attached_object (node);
448 561
@@ -467,19 +580,18 @@ acpi_ex_store_object_to_node (
467 target_type = ACPI_TYPE_ANY; 580 target_type = ACPI_TYPE_ANY;
468 } 581 }
469 582
470 /* 583 /* Do the actual store operation */
471 * Do the actual store operation 584
472 */
473 switch (target_type) { 585 switch (target_type) {
474 case ACPI_TYPE_BUFFER_FIELD: 586 case ACPI_TYPE_BUFFER_FIELD:
475 case ACPI_TYPE_LOCAL_REGION_FIELD: 587 case ACPI_TYPE_LOCAL_REGION_FIELD:
476 case ACPI_TYPE_LOCAL_BANK_FIELD: 588 case ACPI_TYPE_LOCAL_BANK_FIELD:
477 case ACPI_TYPE_LOCAL_INDEX_FIELD: 589 case ACPI_TYPE_LOCAL_INDEX_FIELD:
478 590
479 /* 591 /* For fields, copy the source data to the target field. */
480 * For fields, copy the source data to the target field. 592
481 */ 593 status = acpi_ex_write_data_to_field (source_desc, target_desc,
482 status = acpi_ex_write_data_to_field (source_desc, target_desc, &walk_state->result_obj); 594 &walk_state->result_obj);
483 break; 595 break;
484 596
485 597
@@ -493,7 +605,8 @@ acpi_ex_store_object_to_node (
493 * 605 *
494 * Copy and/or convert the source object to a new target object 606 * Copy and/or convert the source object to a new target object
495 */ 607 */
496 status = acpi_ex_store_object_to_object (source_desc, target_desc, &new_desc, walk_state); 608 status = acpi_ex_store_object_to_object (source_desc, target_desc,
609 &new_desc, walk_state);
497 if (ACPI_FAILURE (status)) { 610 if (ACPI_FAILURE (status)) {
498 return_ACPI_STATUS (status); 611 return_ACPI_STATUS (status);
499 } 612 }
@@ -526,7 +639,8 @@ acpi_ex_store_object_to_node (
526 639
527 /* No conversions for all other types. Just attach the source object */ 640 /* No conversions for all other types. Just attach the source object */
528 641
529 status = acpi_ns_attach_object (node, source_desc, ACPI_GET_OBJECT_TYPE (source_desc)); 642 status = acpi_ns_attach_object (node, source_desc,
643 ACPI_GET_OBJECT_TYPE (source_desc));
530 break; 644 break;
531 } 645 }
532 646
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c
index d3677feb07fd..120f30ed0bd4 100644
--- a/drivers/acpi/executer/exstoren.c
+++ b/drivers/acpi/executer/exstoren.c
@@ -81,9 +81,8 @@ acpi_ex_resolve_object (
81 ACPI_FUNCTION_TRACE ("ex_resolve_object"); 81 ACPI_FUNCTION_TRACE ("ex_resolve_object");
82 82
83 83
84 /* 84 /* Ensure we have a Target that can be stored to */
85 * Ensure we have a Target that can be stored to 85
86 */
87 switch (target_type) { 86 switch (target_type) {
88 case ACPI_TYPE_BUFFER_FIELD: 87 case ACPI_TYPE_BUFFER_FIELD:
89 case ACPI_TYPE_LOCAL_REGION_FIELD: 88 case ACPI_TYPE_LOCAL_REGION_FIELD:
@@ -118,16 +117,14 @@ acpi_ex_resolve_object (
118 break; 117 break;
119 } 118 }
120 119
121 /* 120 /* Must have a Integer, Buffer, or String */
122 * Must have a Integer, Buffer, or String 121
123 */
124 if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && 122 if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) &&
125 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && 123 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) &&
126 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && 124 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) &&
127 !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { 125 !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
128 /* 126 /* Conversion successful but still not a valid type */
129 * Conversion successful but still not a valid type 127
130 */
131 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 128 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
132 "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", 129 "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
133 acpi_ut_get_object_type_name (source_desc), 130 acpi_ut_get_object_type_name (source_desc),
@@ -140,9 +137,8 @@ acpi_ex_resolve_object (
140 case ACPI_TYPE_LOCAL_ALIAS: 137 case ACPI_TYPE_LOCAL_ALIAS:
141 case ACPI_TYPE_LOCAL_METHOD_ALIAS: 138 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
142 139
143 /* 140 /* Aliases are resolved by acpi_ex_prep_operands */
144 * Aliases are resolved by acpi_ex_prep_operands 141
145 */
146 ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); 142 ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
147 status = AE_AML_INTERNAL; 143 status = AE_AML_INTERNAL;
148 break; 144 break;
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c
index 05e1ecae8d92..12d1527669c8 100644
--- a/drivers/acpi/executer/exstorob.c
+++ b/drivers/acpi/executer/exstorob.c
@@ -128,7 +128,8 @@ acpi_ex_store_buffer_to_buffer (
128 else { 128 else {
129 /* Truncate the source, copy only what will fit */ 129 /* Truncate the source, copy only what will fit */
130 130
131 ACPI_MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length); 131 ACPI_MEMCPY (target_desc->buffer.pointer, buffer,
132 target_desc->buffer.length);
132 133
133 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 134 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
134 "Truncating source buffer from %X to %X\n", 135 "Truncating source buffer from %X to %X\n",
@@ -183,7 +184,8 @@ acpi_ex_store_string_to_string (
183 * String will fit in existing non-static buffer. 184 * String will fit in existing non-static buffer.
184 * Clear old string and copy in the new one 185 * Clear old string and copy in the new one
185 */ 186 */
186 ACPI_MEMSET (target_desc->string.pointer, 0, (acpi_size) target_desc->string.length + 1); 187 ACPI_MEMSET (target_desc->string.pointer, 0,
188 (acpi_size) target_desc->string.length + 1);
187 ACPI_MEMCPY (target_desc->string.pointer, buffer, length); 189 ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
188 } 190 }
189 else { 191 else {
@@ -198,7 +200,8 @@ acpi_ex_store_string_to_string (
198 ACPI_MEM_FREE (target_desc->string.pointer); 200 ACPI_MEM_FREE (target_desc->string.pointer);
199 } 201 }
200 202
201 target_desc->string.pointer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); 203 target_desc->string.pointer = ACPI_MEM_CALLOCATE (
204 (acpi_size) length + 1);
202 if (!target_desc->string.pointer) { 205 if (!target_desc->string.pointer) {
203 return_ACPI_STATUS (AE_NO_MEMORY); 206 return_ACPI_STATUS (AE_NO_MEMORY);
204 } 207 }
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
index f92efc512890..cafa702108dc 100644
--- a/drivers/acpi/executer/exsystem.c
+++ b/drivers/acpi/executer/exsystem.c
@@ -55,8 +55,8 @@
55 * 55 *
56 * FUNCTION: acpi_ex_system_wait_semaphore 56 * FUNCTION: acpi_ex_system_wait_semaphore
57 * 57 *
58 * PARAMETERS: Semaphore - OSD semaphore to wait on 58 * PARAMETERS: Semaphore - Semaphore to wait on
59 * Timeout - Max time to wait 59 * Timeout - Max time to wait
60 * 60 *
61 * RETURN: Status 61 * RETURN: Status
62 * 62 *
@@ -90,7 +90,8 @@ acpi_ex_system_wait_semaphore (
90 90
91 status = acpi_os_wait_semaphore (semaphore, 1, timeout); 91 status = acpi_os_wait_semaphore (semaphore, 1, timeout);
92 92
93 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n", 93 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
94 "*** Thread awake after blocking, %s\n",
94 acpi_format_exception (status))); 95 acpi_format_exception (status)));
95 96
96 /* Reacquire the interpreter */ 97 /* Reacquire the interpreter */
@@ -111,8 +112,8 @@ acpi_ex_system_wait_semaphore (
111 * 112 *
112 * FUNCTION: acpi_ex_system_do_stall 113 * FUNCTION: acpi_ex_system_do_stall
113 * 114 *
114 * PARAMETERS: how_long - The amount of time to stall, 115 * PARAMETERS: how_long - The amount of time to stall,
115 * in microseconds 116 * in microseconds
116 * 117 *
117 * RETURN: Status 118 * RETURN: Status
118 * 119 *
@@ -141,7 +142,8 @@ acpi_ex_system_do_stall (
141 * (ACPI specifies 100 usec as max, but this gives some slack in 142 * (ACPI specifies 100 usec as max, but this gives some slack in
142 * order to support existing BIOSs) 143 * order to support existing BIOSs)
143 */ 144 */
144 ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", how_long)); 145 ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n",
146 how_long));
145 status = AE_AML_OPERAND_VALUE; 147 status = AE_AML_OPERAND_VALUE;
146 } 148 }
147 else { 149 else {
@@ -156,8 +158,8 @@ acpi_ex_system_do_stall (
156 * 158 *
157 * FUNCTION: acpi_ex_system_do_suspend 159 * FUNCTION: acpi_ex_system_do_suspend
158 * 160 *
159 * PARAMETERS: how_long - The amount of time to suspend, 161 * PARAMETERS: how_long - The amount of time to suspend,
160 * in milliseconds 162 * in milliseconds
161 * 163 *
162 * RETURN: None 164 * RETURN: None
163 * 165 *
@@ -192,8 +194,8 @@ acpi_ex_system_do_suspend (
192 * 194 *
193 * FUNCTION: acpi_ex_system_acquire_mutex 195 * FUNCTION: acpi_ex_system_acquire_mutex
194 * 196 *
195 * PARAMETERS: *time_desc - The 'time to delay' object descriptor 197 * PARAMETERS: time_desc - The 'time to delay' object descriptor
196 * *obj_desc - The object descriptor for this op 198 * obj_desc - The object descriptor for this op
197 * 199 *
198 * RETURN: Status 200 * RETURN: Status
199 * 201 *
@@ -218,16 +220,15 @@ acpi_ex_system_acquire_mutex (
218 return_ACPI_STATUS (AE_BAD_PARAMETER); 220 return_ACPI_STATUS (AE_BAD_PARAMETER);
219 } 221 }
220 222
221 /* 223 /* Support for the _GL_ Mutex object -- go get the global lock */
222 * Support for the _GL_ Mutex object -- go get the global lock 224
223 */
224 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { 225 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
225 status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); 226 status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
226 return_ACPI_STATUS (status); 227 return_ACPI_STATUS (status);
227 } 228 }
228 229
229 status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, 230 status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
230 (u16) time_desc->integer.value); 231 (u16) time_desc->integer.value);
231 return_ACPI_STATUS (status); 232 return_ACPI_STATUS (status);
232} 233}
233 234
@@ -236,7 +237,7 @@ acpi_ex_system_acquire_mutex (
236 * 237 *
237 * FUNCTION: acpi_ex_system_release_mutex 238 * FUNCTION: acpi_ex_system_release_mutex
238 * 239 *
239 * PARAMETERS: *obj_desc - The object descriptor for this op 240 * PARAMETERS: obj_desc - The object descriptor for this op
240 * 241 *
241 * RETURN: Status 242 * RETURN: Status
242 * 243 *
@@ -261,9 +262,8 @@ acpi_ex_system_release_mutex (
261 return_ACPI_STATUS (AE_BAD_PARAMETER); 262 return_ACPI_STATUS (AE_BAD_PARAMETER);
262 } 263 }
263 264
264 /* 265 /* Support for the _GL_ Mutex object -- release the global lock */
265 * Support for the _GL_ Mutex object -- release the global lock 266
266 */
267 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { 267 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
268 status = acpi_ev_release_global_lock (); 268 status = acpi_ev_release_global_lock ();
269 return_ACPI_STATUS (status); 269 return_ACPI_STATUS (status);
@@ -278,9 +278,9 @@ acpi_ex_system_release_mutex (
278 * 278 *
279 * FUNCTION: acpi_ex_system_signal_event 279 * FUNCTION: acpi_ex_system_signal_event
280 * 280 *
281 * PARAMETERS: *obj_desc - The object descriptor for this op 281 * PARAMETERS: obj_desc - The object descriptor for this op
282 * 282 *
283 * RETURN: AE_OK 283 * RETURN: Status
284 * 284 *
285 * DESCRIPTION: Provides an access point to perform synchronization operations 285 * DESCRIPTION: Provides an access point to perform synchronization operations
286 * within the AML. 286 * within the AML.
@@ -309,8 +309,8 @@ acpi_ex_system_signal_event (
309 * 309 *
310 * FUNCTION: acpi_ex_system_wait_event 310 * FUNCTION: acpi_ex_system_wait_event
311 * 311 *
312 * PARAMETERS: *time_desc - The 'time to delay' object descriptor 312 * PARAMETERS: time_desc - The 'time to delay' object descriptor
313 * *obj_desc - The object descriptor for this op 313 * obj_desc - The object descriptor for this op
314 * 314 *
315 * RETURN: Status 315 * RETURN: Status
316 * 316 *
@@ -333,7 +333,7 @@ acpi_ex_system_wait_event (
333 333
334 if (obj_desc) { 334 if (obj_desc) {
335 status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, 335 status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
336 (u16) time_desc->integer.value); 336 (u16) time_desc->integer.value);
337 } 337 }
338 338
339 return_ACPI_STATUS (status); 339 return_ACPI_STATUS (status);
@@ -344,7 +344,7 @@ acpi_ex_system_wait_event (
344 * 344 *
345 * FUNCTION: acpi_ex_system_reset_event 345 * FUNCTION: acpi_ex_system_reset_event
346 * 346 *
347 * PARAMETERS: *obj_desc - The object descriptor for this op 347 * PARAMETERS: obj_desc - The object descriptor for this op
348 * 348 *
349 * RETURN: Status 349 * RETURN: Status
350 * 350 *
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 40c6abb8b49a..5c7ec0c04177 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -67,22 +67,31 @@
67#define _COMPONENT ACPI_EXECUTER 67#define _COMPONENT ACPI_EXECUTER
68 ACPI_MODULE_NAME ("exutils") 68 ACPI_MODULE_NAME ("exutils")
69 69
70/* Local prototypes */
70 71
71#ifndef ACPI_NO_METHOD_EXECUTION 72static u32
73acpi_ex_digits_needed (
74 acpi_integer value,
75 u32 base);
72 76
77
78#ifndef ACPI_NO_METHOD_EXECUTION
73/******************************************************************************* 79/*******************************************************************************
74 * 80 *
75 * FUNCTION: acpi_ex_enter_interpreter 81 * FUNCTION: acpi_ex_enter_interpreter
76 * 82 *
77 * PARAMETERS: None 83 * PARAMETERS: None
78 * 84 *
85 * RETURN: Status
86 *
79 * DESCRIPTION: Enter the interpreter execution region. Failure to enter 87 * DESCRIPTION: Enter the interpreter execution region. Failure to enter
80 * the interpreter region is a fatal system error 88 * the interpreter region is a fatal system error
81 * 89 *
82 ******************************************************************************/ 90 ******************************************************************************/
83 91
84acpi_status 92acpi_status
85acpi_ex_enter_interpreter (void) 93acpi_ex_enter_interpreter (
94 void)
86{ 95{
87 acpi_status status; 96 acpi_status status;
88 97
@@ -104,6 +113,8 @@ acpi_ex_enter_interpreter (void)
104 * 113 *
105 * PARAMETERS: None 114 * PARAMETERS: None
106 * 115 *
116 * RETURN: None
117 *
107 * DESCRIPTION: Exit the interpreter execution region 118 * DESCRIPTION: Exit the interpreter execution region
108 * 119 *
109 * Cases where the interpreter is unlocked: 120 * Cases where the interpreter is unlocked:
@@ -119,7 +130,8 @@ acpi_ex_enter_interpreter (void)
119 ******************************************************************************/ 130 ******************************************************************************/
120 131
121void 132void
122acpi_ex_exit_interpreter (void) 133acpi_ex_exit_interpreter (
134 void)
123{ 135{
124 acpi_status status; 136 acpi_status status;
125 137
@@ -212,7 +224,8 @@ acpi_ex_acquire_global_lock (
212 locked = TRUE; 224 locked = TRUE;
213 } 225 }
214 else { 226 else {
215 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n", 227 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
228 "Could not acquire Global Lock, %s\n",
216 acpi_format_exception (status))); 229 acpi_format_exception (status)));
217 } 230 }
218 } 231 }
@@ -228,7 +241,7 @@ acpi_ex_acquire_global_lock (
228 * PARAMETERS: locked_by_me - Return value from corresponding call to 241 * PARAMETERS: locked_by_me - Return value from corresponding call to
229 * acquire_global_lock. 242 * acquire_global_lock.
230 * 243 *
231 * RETURN: Status 244 * RETURN: None
232 * 245 *
233 * DESCRIPTION: Release the global lock if it is locked. 246 * DESCRIPTION: Release the global lock if it is locked.
234 * 247 *
@@ -269,11 +282,14 @@ acpi_ex_release_global_lock (
269 * PARAMETERS: Value - Value to be represented 282 * PARAMETERS: Value - Value to be represented
270 * Base - Base of representation 283 * Base - Base of representation
271 * 284 *
272 * RETURN: the number of digits needed to represent Value in Base 285 * RETURN: The number of digits.
286 *
287 * DESCRIPTION: Calculate the number of digits needed to represent the Value
288 * in the given Base (Radix)
273 * 289 *
274 ******************************************************************************/ 290 ******************************************************************************/
275 291
276u32 292static u32
277acpi_ex_digits_needed ( 293acpi_ex_digits_needed (
278 acpi_integer value, 294 acpi_integer value,
279 u32 base) 295 u32 base)
@@ -312,6 +328,8 @@ acpi_ex_digits_needed (
312 * PARAMETERS: numeric_id - EISA ID to be converted 328 * PARAMETERS: numeric_id - EISA ID to be converted
313 * out_string - Where to put the converted string (8 bytes) 329 * out_string - Where to put the converted string (8 bytes)
314 * 330 *
331 * RETURN: None
332 *
315 * DESCRIPTION: Convert a numeric EISA ID to string representation 333 * DESCRIPTION: Convert a numeric EISA ID to string representation
316 * 334 *
317 ******************************************************************************/ 335 ******************************************************************************/
@@ -349,7 +367,10 @@ acpi_ex_eisa_id_to_string (
349 * PARAMETERS: Value - Value to be converted 367 * PARAMETERS: Value - Value to be converted
350 * out_string - Where to put the converted string (8 bytes) 368 * out_string - Where to put the converted string (8 bytes)
351 * 369 *
352 * RETURN: Convert a number to string representation 370 * RETURN: None, string
371 *
372 * DESCRIPTOIN: Convert a number to string representation. Assumes string
373 * buffer is large enough to hold the string.
353 * 374 *
354 ******************************************************************************/ 375 ******************************************************************************/
355 376