aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exstore.c
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/exstore.c
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/exstore.c')
-rw-r--r--drivers/acpi/executer/exstore.c260
1 files changed, 187 insertions, 73 deletions
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