aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dispatcher')
-rw-r--r--drivers/acpi/dispatcher/dsfield.c37
-rw-r--r--drivers/acpi/dispatcher/dsinit.c51
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c360
-rw-r--r--drivers/acpi/dispatcher/dsmthdat.c37
-rw-r--r--drivers/acpi/dispatcher/dsobject.c106
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c58
-rw-r--r--drivers/acpi/dispatcher/dsutils.c33
-rw-r--r--drivers/acpi/dispatcher/dswexec.c80
-rw-r--r--drivers/acpi/dispatcher/dswload.c270
-rw-r--r--drivers/acpi/dispatcher/dswscope.c6
-rw-r--r--drivers/acpi/dispatcher/dswstate.c128
11 files changed, 680 insertions, 486 deletions
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c
index 2022aeaecfbb..76bc0463f6de 100644
--- a/drivers/acpi/dispatcher/dsfield.c
+++ b/drivers/acpi/dispatcher/dsfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -128,7 +128,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
128 ACPI_IMODE_LOAD_PASS1, flags, walk_state, 128 ACPI_IMODE_LOAD_PASS1, flags, walk_state,
129 &(node)); 129 &(node));
130 if (ACPI_FAILURE(status)) { 130 if (ACPI_FAILURE(status)) {
131 ACPI_REPORT_NSERROR(arg->common.value.string, status); 131 ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
132 return_ACPI_STATUS(status); 132 return_ACPI_STATUS(status);
133 } 133 }
134 } 134 }
@@ -232,7 +232,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
232 + (acpi_integer) arg->common.value.size; 232 + (acpi_integer) arg->common.value.size;
233 233
234 if (position > ACPI_UINT32_MAX) { 234 if (position > ACPI_UINT32_MAX) {
235 ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n")); 235 ACPI_ERROR((AE_INFO,
236 "Bit offset within field too large (> 0xFFFFFFFF)"));
236 return_ACPI_STATUS(AE_SUPPORT); 237 return_ACPI_STATUS(AE_SUPPORT);
237 } 238 }
238 239
@@ -268,8 +269,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
268 ACPI_NS_DONT_OPEN_SCOPE, 269 ACPI_NS_DONT_OPEN_SCOPE,
269 walk_state, &info->field_node); 270 walk_state, &info->field_node);
270 if (ACPI_FAILURE(status)) { 271 if (ACPI_FAILURE(status)) {
271 ACPI_REPORT_NSERROR((char *)&arg->named.name, 272 ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
272 status); 273 status);
273 if (status != AE_ALREADY_EXISTS) { 274 if (status != AE_ALREADY_EXISTS) {
274 return_ACPI_STATUS(status); 275 return_ACPI_STATUS(status);
275 } 276 }
@@ -293,7 +294,11 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
293 + (acpi_integer) arg->common.value.size; 294 + (acpi_integer) arg->common.value.size;
294 295
295 if (position > ACPI_UINT32_MAX) { 296 if (position > ACPI_UINT32_MAX) {
296 ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name)); 297 ACPI_ERROR((AE_INFO,
298 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
299 ACPI_CAST_PTR(char,
300 &info->field_node->
301 name)));
297 return_ACPI_STATUS(AE_SUPPORT); 302 return_ACPI_STATUS(AE_SUPPORT);
298 } 303 }
299 304
@@ -302,9 +307,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
302 307
303 default: 308 default:
304 309
305 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 310 ACPI_ERROR((AE_INFO,
306 "Invalid opcode in field list: %X\n", 311 "Invalid opcode in field list: %X",
307 arg->common.aml_opcode)); 312 arg->common.aml_opcode));
308 return_ACPI_STATUS(AE_AML_BAD_OPCODE); 313 return_ACPI_STATUS(AE_AML_BAD_OPCODE);
309 } 314 }
310 315
@@ -349,7 +354,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
349 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, 354 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
350 walk_state, &region_node); 355 walk_state, &region_node);
351 if (ACPI_FAILURE(status)) { 356 if (ACPI_FAILURE(status)) {
352 ACPI_REPORT_NSERROR(arg->common.value.name, status); 357 ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
353 return_ACPI_STATUS(status); 358 return_ACPI_STATUS(status);
354 } 359 }
355 } 360 }
@@ -431,8 +436,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
431 ACPI_NS_ERROR_IF_FOUND, 436 ACPI_NS_ERROR_IF_FOUND,
432 walk_state, &node); 437 walk_state, &node);
433 if (ACPI_FAILURE(status)) { 438 if (ACPI_FAILURE(status)) {
434 ACPI_REPORT_NSERROR((char *)&arg->named.name, 439 ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
435 status); 440 status);
436 if (status != AE_ALREADY_EXISTS) { 441 if (status != AE_ALREADY_EXISTS) {
437 return_ACPI_STATUS(status); 442 return_ACPI_STATUS(status);
438 } 443 }
@@ -488,7 +493,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
488 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, 493 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
489 walk_state, &region_node); 494 walk_state, &region_node);
490 if (ACPI_FAILURE(status)) { 495 if (ACPI_FAILURE(status)) {
491 ACPI_REPORT_NSERROR(arg->common.value.name, status); 496 ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
492 return_ACPI_STATUS(status); 497 return_ACPI_STATUS(status);
493 } 498 }
494 } 499 }
@@ -502,7 +507,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
502 ACPI_NS_SEARCH_PARENT, walk_state, 507 ACPI_NS_SEARCH_PARENT, walk_state,
503 &info.register_node); 508 &info.register_node);
504 if (ACPI_FAILURE(status)) { 509 if (ACPI_FAILURE(status)) {
505 ACPI_REPORT_NSERROR(arg->common.value.string, status); 510 ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
506 return_ACPI_STATUS(status); 511 return_ACPI_STATUS(status);
507 } 512 }
508 513
@@ -560,7 +565,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
560 ACPI_NS_SEARCH_PARENT, walk_state, 565 ACPI_NS_SEARCH_PARENT, walk_state,
561 &info.register_node); 566 &info.register_node);
562 if (ACPI_FAILURE(status)) { 567 if (ACPI_FAILURE(status)) {
563 ACPI_REPORT_NSERROR(arg->common.value.string, status); 568 ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
564 return_ACPI_STATUS(status); 569 return_ACPI_STATUS(status);
565 } 570 }
566 571
@@ -573,7 +578,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
573 ACPI_NS_SEARCH_PARENT, walk_state, 578 ACPI_NS_SEARCH_PARENT, walk_state,
574 &info.data_register_node); 579 &info.data_register_node);
575 if (ACPI_FAILURE(status)) { 580 if (ACPI_FAILURE(status)) {
576 ACPI_REPORT_NSERROR(arg->common.value.string, status); 581 ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
577 return_ACPI_STATUS(status); 582 return_ACPI_STATUS(status);
578 } 583 }
579 584
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
index 8693c704aea6..e65a07ad2422 100644
--- a/drivers/acpi/dispatcher/dsinit.c
+++ b/drivers/acpi/dispatcher/dsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -84,7 +84,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
84 acpi_object_type type; 84 acpi_object_type type;
85 acpi_status status; 85 acpi_status status;
86 86
87 ACPI_FUNCTION_NAME("ds_init_one_object"); 87 ACPI_FUNCTION_ENTRY();
88 88
89 /* 89 /*
90 * We are only interested in NS nodes owned by the table that 90 * We are only interested in NS nodes owned by the table that
@@ -105,11 +105,10 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
105 105
106 status = acpi_ds_initialize_region(obj_handle); 106 status = acpi_ds_initialize_region(obj_handle);
107 if (ACPI_FAILURE(status)) { 107 if (ACPI_FAILURE(status)) {
108 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 108 ACPI_EXCEPTION((AE_INFO, status,
109 "Region %p [%4.4s] - Init failure, %s\n", 109 "During Region initialization %p [%4.4s]",
110 obj_handle, 110 obj_handle,
111 acpi_ut_get_node_name(obj_handle), 111 acpi_ut_get_node_name(obj_handle)));
112 acpi_format_exception(status)));
113 } 112 }
114 113
115 info->op_region_count++; 114 info->op_region_count++;
@@ -118,14 +117,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
118 case ACPI_TYPE_METHOD: 117 case ACPI_TYPE_METHOD:
119 118
120 /* 119 /*
121 * Print a dot for each method unless we are going to print
122 * the entire pathname
123 */
124 if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
125 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
126 }
127
128 /*
129 * Set the execution data width (32 or 64) based upon the 120 * Set the execution data width (32 or 64) based upon the
130 * revision number of the parent ACPI table. 121 * revision number of the parent ACPI table.
131 * TBD: This is really for possible future support of integer width 122 * TBD: This is really for possible future support of integer width
@@ -134,6 +125,21 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
134 if (info->table_desc->pointer->revision == 1) { 125 if (info->table_desc->pointer->revision == 1) {
135 node->flags |= ANOBJ_DATA_WIDTH_32; 126 node->flags |= ANOBJ_DATA_WIDTH_32;
136 } 127 }
128#ifdef ACPI_INIT_PARSE_METHODS
129 /*
130 * Note 11/2005: Removed this code to parse all methods during table
131 * load because it causes problems if there are any errors during the
132 * parse. Also, it seems like overkill and we probably don't want to
133 * abort a table load because of an issue with a single method.
134 */
135
136 /*
137 * Print a dot for each method unless we are going to print
138 * the entire pathname
139 */
140 if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
141 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
142 }
137 143
138 /* 144 /*
139 * Always parse methods to detect errors, we will delete 145 * Always parse methods to detect errors, we will delete
@@ -141,15 +147,15 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
141 */ 147 */
142 status = acpi_ds_parse_method(obj_handle); 148 status = acpi_ds_parse_method(obj_handle);
143 if (ACPI_FAILURE(status)) { 149 if (ACPI_FAILURE(status)) {
144 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 150 ACPI_ERROR((AE_INFO,
145 "\n+Method %p [%4.4s] - parse failure, %s\n", 151 "Method %p [%4.4s] - parse failure, %s",
146 obj_handle, 152 obj_handle,
147 acpi_ut_get_node_name(obj_handle), 153 acpi_ut_get_node_name(obj_handle),
148 acpi_format_exception(status))); 154 acpi_format_exception(status)));
149 155
150 /* This parse failed, but we will continue parsing more methods */ 156 /* This parse failed, but we will continue parsing more methods */
151 } 157 }
152 158#endif
153 info->method_count++; 159 info->method_count++;
154 break; 160 break;
155 161
@@ -207,8 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
207 status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, 213 status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
208 acpi_ds_init_one_object, &info, NULL); 214 acpi_ds_init_one_object, &info, NULL);
209 if (ACPI_FAILURE(status)) { 215 if (ACPI_FAILURE(status)) {
210 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", 216 ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
211 acpi_format_exception(status)));
212 } 217 }
213 218
214 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, 219 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index 36c1ca0b9adb..c475546535b6 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -47,135 +47,66 @@
47#include <acpi/acdispat.h> 47#include <acpi/acdispat.h>
48#include <acpi/acinterp.h> 48#include <acpi/acinterp.h>
49#include <acpi/acnamesp.h> 49#include <acpi/acnamesp.h>
50#include <acpi/acdisasm.h>
50 51
51#define _COMPONENT ACPI_DISPATCHER 52#define _COMPONENT ACPI_DISPATCHER
52ACPI_MODULE_NAME("dsmethod") 53ACPI_MODULE_NAME("dsmethod")
53 54
54/******************************************************************************* 55/*******************************************************************************
55 * 56 *
56 * FUNCTION: acpi_ds_parse_method 57 * FUNCTION: acpi_ds_method_error
57 * 58 *
58 * PARAMETERS: Node - Method node 59 * PARAMETERS: Status - Execution status
60 * walk_state - Current state
59 * 61 *
60 * RETURN: Status 62 * RETURN: Status
61 * 63 *
62 * DESCRIPTION: Parse the AML that is associated with the method. 64 * DESCRIPTION: Called on method error. Invoke the global exception handler if
65 * present, dump the method data if the disassembler is configured
63 * 66 *
64 * MUTEX: Assumes parser is locked 67 * Note: Allows the exception handler to change the status code
65 * 68 *
66 ******************************************************************************/ 69 ******************************************************************************/
67acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) 70acpi_status
71acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
68{ 72{
69 acpi_status status; 73 ACPI_FUNCTION_ENTRY();
70 union acpi_operand_object *obj_desc;
71 union acpi_parse_object *op;
72 struct acpi_walk_state *walk_state;
73
74 ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node);
75 74
76 /* Parameter Validation */ 75 /* Ignore AE_OK and control exception codes */
77 76
78 if (!node) { 77 if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) {
79 return_ACPI_STATUS(AE_NULL_ENTRY); 78 return (status);
80 } 79 }
81 80
82 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 81 /* Invoke the global exception handler */
83 "**** Parsing [%4.4s] **** named_obj=%p\n",
84 acpi_ut_get_node_name(node), node));
85
86 /* Extract the method object from the method Node */
87 82
88 obj_desc = acpi_ns_get_attached_object(node); 83 if (acpi_gbl_exception_handler) {
89 if (!obj_desc) { 84 /* Exit the interpreter, allow handler to execute methods */
90 return_ACPI_STATUS(AE_NULL_OBJECT);
91 }
92 85
93 /* Create a mutex for the method if there is a concurrency limit */ 86 acpi_ex_exit_interpreter();
94 87
95 if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && 88 /*
96 (!obj_desc->method.semaphore)) { 89 * Handler can map the exception code to anything it wants, including
97 status = acpi_os_create_semaphore(obj_desc->method.concurrency, 90 * AE_OK, in which case the executing method will not be aborted.
98 obj_desc->method.concurrency, 91 */
99 &obj_desc->method.semaphore); 92 status = acpi_gbl_exception_handler(status,
100 if (ACPI_FAILURE(status)) { 93 walk_state->method_node ?
101 return_ACPI_STATUS(status); 94 walk_state->method_node->
102 } 95 name.integer : 0,
103 } 96 walk_state->opcode,
104 97 walk_state->aml_offset,
105 /* 98 NULL);
106 * Allocate a new parser op to be the root of the parsed 99 (void)acpi_ex_enter_interpreter();
107 * method tree
108 */
109 op = acpi_ps_alloc_op(AML_METHOD_OP);
110 if (!op) {
111 return_ACPI_STATUS(AE_NO_MEMORY);
112 }
113
114 /* Init new op with the method name and pointer back to the Node */
115
116 acpi_ps_set_name(op, node->name.integer);
117 op->common.node = node;
118
119 /*
120 * Get a new owner_id for objects created by this method. Namespace
121 * objects (such as Operation Regions) can be created during the
122 * first pass parse.
123 */
124 status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
125 if (ACPI_FAILURE(status)) {
126 goto cleanup;
127 }
128
129 /* Create and initialize a new walk state */
130
131 walk_state =
132 acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
133 NULL);
134 if (!walk_state) {
135 status = AE_NO_MEMORY;
136 goto cleanup2;
137 } 100 }
138 101#ifdef ACPI_DISASSEMBLER
139 status = acpi_ds_init_aml_walk(walk_state, op, node,
140 obj_desc->method.aml_start,
141 obj_desc->method.aml_length, NULL, 1);
142 if (ACPI_FAILURE(status)) { 102 if (ACPI_FAILURE(status)) {
143 acpi_ds_delete_walk_state(walk_state); 103 /* Display method locals/args if disassembler is present */
144 goto cleanup2;
145 }
146 104
147 /* 105 acpi_dm_dump_method_info(status, walk_state, walk_state->op);
148 * Parse the method, first pass
149 *
150 * The first pass load is where newly declared named objects are added into
151 * the namespace. Actual evaluation of the named objects (what would be
152 * called a "second pass") happens during the actual execution of the
153 * method so that operands to the named objects can take on dynamic
154 * run-time values.
155 */
156 status = acpi_ps_parse_aml(walk_state);
157 if (ACPI_FAILURE(status)) {
158 goto cleanup2;
159 } 106 }
107#endif
160 108
161 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 109 return (status);
162 "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
163 acpi_ut_get_node_name(node), node, op));
164
165 /*
166 * Delete the parse tree. We simply re-parse the method for every
167 * execution since there isn't much overhead (compared to keeping lots
168 * of parse trees around)
169 */
170 acpi_ns_delete_namespace_subtree(node);
171 acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
172
173 cleanup2:
174 acpi_ut_release_owner_id(&obj_desc->method.owner_id);
175
176 cleanup:
177 acpi_ps_delete_parse_tree(op);
178 return_ACPI_STATUS(status);
179} 110}
180 111
181/******************************************************************************* 112/*******************************************************************************
@@ -195,9 +126,9 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
195 ******************************************************************************/ 126 ******************************************************************************/
196 127
197acpi_status 128acpi_status
198acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, 129acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
199 union acpi_operand_object *obj_desc, 130 union acpi_operand_object * obj_desc,
200 struct acpi_namespace_node *calling_method_node) 131 struct acpi_namespace_node * calling_method_node)
201{ 132{
202 acpi_status status = AE_OK; 133 acpi_status status = AE_OK;
203 134
@@ -210,7 +141,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
210 /* Prevent wraparound of thread count */ 141 /* Prevent wraparound of thread count */
211 142
212 if (obj_desc->method.thread_count == ACPI_UINT8_MAX) { 143 if (obj_desc->method.thread_count == ACPI_UINT8_MAX) {
213 ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n")); 144 ACPI_ERROR((AE_INFO,
145 "Method reached maximum reentrancy limit (255)"));
214 return_ACPI_STATUS(AE_AML_METHOD_LIMIT); 146 return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
215 } 147 }
216 148
@@ -539,22 +471,61 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
539 acpi_os_signal_semaphore(walk_state->method_desc->method. 471 acpi_os_signal_semaphore(walk_state->method_desc->method.
540 semaphore, 1); 472 semaphore, 1);
541 if (ACPI_FAILURE(status)) { 473 if (ACPI_FAILURE(status)) {
542 ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); 474 ACPI_ERROR((AE_INFO,
475 "Could not signal method semaphore"));
543 476
544 /* Ignore error and continue cleanup */ 477 /* Ignore error and continue cleanup */
545 } 478 }
546 } 479 }
547 480
481 /*
482 * There are no more threads executing this method. Perform
483 * additional cleanup.
484 *
485 * The method Node is stored in the walk state
486 */
487 method_node = walk_state->method_node;
488
489 /* Lock namespace for possible update */
490
491 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
492 if (ACPI_FAILURE(status)) {
493 goto exit;
494 }
495
496 /*
497 * Delete any namespace entries created immediately underneath
498 * the method
499 */
500 if (method_node->child) {
501 acpi_ns_delete_namespace_subtree(method_node);
502 }
503
504 /*
505 * Delete any namespace entries created anywhere else within
506 * the namespace by the execution of this method
507 */
508 acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method.
509 owner_id);
510 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
511
512 /* Are there any other threads currently executing this method? */
513
548 if (walk_state->method_desc->method.thread_count) { 514 if (walk_state->method_desc->method.thread_count) {
515 /*
516 * Additional threads. Do not release the owner_id in this case,
517 * we immediately reuse it for the next thread executing this method
518 */
549 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 519 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
550 "*** Not deleting method namespace, there are still %d threads\n", 520 "*** Completed execution of one thread, %d threads remaining\n",
551 walk_state->method_desc->method. 521 walk_state->method_desc->method.
552 thread_count)); 522 thread_count));
553 } else { /* This is the last executing thread */ 523 } else {
524 /* This is the only executing thread for this method */
554 525
555 /* 526 /*
556 * Support to dynamically change a method from not_serialized to 527 * Support to dynamically change a method from not_serialized to
557 * Serialized if it appears that the method is written foolishly and 528 * Serialized if it appears that the method is incorrectly written and
558 * does not support multiple thread execution. The best example of this 529 * does not support multiple thread execution. The best example of this
559 * is if such a method creates namespace objects and blocks. A second 530 * is if such a method creates namespace objects and blocks. A second
560 * thread will fail with an AE_ALREADY_EXISTS exception 531 * thread will fail with an AE_ALREADY_EXISTS exception
@@ -570,34 +541,8 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
570 semaphore); 541 semaphore);
571 } 542 }
572 543
573 /* 544 /* No more threads, we can free the owner_id */
574 * There are no more threads executing this method. Perform
575 * additional cleanup.
576 *
577 * The method Node is stored in the walk state
578 */
579 method_node = walk_state->method_node;
580
581 /*
582 * Delete any namespace entries created immediately underneath
583 * the method
584 */
585 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
586 if (ACPI_FAILURE(status)) {
587 goto exit;
588 }
589
590 if (method_node->child) {
591 acpi_ns_delete_namespace_subtree(method_node);
592 }
593 545
594 /*
595 * Delete any namespace entries created anywhere else within
596 * the namespace
597 */
598 acpi_ns_delete_namespace_by_owner(walk_state->method_desc->
599 method.owner_id);
600 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
601 acpi_ut_release_owner_id(&walk_state->method_desc->method. 546 acpi_ut_release_owner_id(&walk_state->method_desc->method.
602 owner_id); 547 owner_id);
603 } 548 }
@@ -606,3 +551,140 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
606 (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); 551 (void)acpi_ut_release_mutex(ACPI_MTX_PARSER);
607 return_VOID; 552 return_VOID;
608} 553}
554
555#ifdef ACPI_INIT_PARSE_METHODS
556 /*
557 * Note 11/2005: Removed this code to parse all methods during table
558 * load because it causes problems if there are any errors during the
559 * parse. Also, it seems like overkill and we probably don't want to
560 * abort a table load because of an issue with a single method.
561 */
562
563/*******************************************************************************
564 *
565 * FUNCTION: acpi_ds_parse_method
566 *
567 * PARAMETERS: Node - Method node
568 *
569 * RETURN: Status
570 *
571 * DESCRIPTION: Parse the AML that is associated with the method.
572 *
573 * MUTEX: Assumes parser is locked
574 *
575 ******************************************************************************/
576
577acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
578{
579 acpi_status status;
580 union acpi_operand_object *obj_desc;
581 union acpi_parse_object *op;
582 struct acpi_walk_state *walk_state;
583
584 ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node);
585
586 /* Parameter Validation */
587
588 if (!node) {
589 return_ACPI_STATUS(AE_NULL_ENTRY);
590 }
591
592 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
593 "**** Parsing [%4.4s] **** named_obj=%p\n",
594 acpi_ut_get_node_name(node), node));
595
596 /* Extract the method object from the method Node */
597
598 obj_desc = acpi_ns_get_attached_object(node);
599 if (!obj_desc) {
600 return_ACPI_STATUS(AE_NULL_OBJECT);
601 }
602
603 /* Create a mutex for the method if there is a concurrency limit */
604
605 if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) &&
606 (!obj_desc->method.semaphore)) {
607 status = acpi_os_create_semaphore(obj_desc->method.concurrency,
608 obj_desc->method.concurrency,
609 &obj_desc->method.semaphore);
610 if (ACPI_FAILURE(status)) {
611 return_ACPI_STATUS(status);
612 }
613 }
614
615 /*
616 * Allocate a new parser op to be the root of the parsed
617 * method tree
618 */
619 op = acpi_ps_alloc_op(AML_METHOD_OP);
620 if (!op) {
621 return_ACPI_STATUS(AE_NO_MEMORY);
622 }
623
624 /* Init new op with the method name and pointer back to the Node */
625
626 acpi_ps_set_name(op, node->name.integer);
627 op->common.node = node;
628
629 /*
630 * Get a new owner_id for objects created by this method. Namespace
631 * objects (such as Operation Regions) can be created during the
632 * first pass parse.
633 */
634 status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
635 if (ACPI_FAILURE(status)) {
636 goto cleanup;
637 }
638
639 /* Create and initialize a new walk state */
640
641 walk_state =
642 acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
643 NULL);
644 if (!walk_state) {
645 status = AE_NO_MEMORY;
646 goto cleanup2;
647 }
648
649 status = acpi_ds_init_aml_walk(walk_state, op, node,
650 obj_desc->method.aml_start,
651 obj_desc->method.aml_length, NULL, 1);
652 if (ACPI_FAILURE(status)) {
653 acpi_ds_delete_walk_state(walk_state);
654 goto cleanup2;
655 }
656
657 /*
658 * Parse the method, first pass
659 *
660 * The first pass load is where newly declared named objects are added into
661 * the namespace. Actual evaluation of the named objects (what would be
662 * called a "second pass") happens during the actual execution of the
663 * method so that operands to the named objects can take on dynamic
664 * run-time values.
665 */
666 status = acpi_ps_parse_aml(walk_state);
667 if (ACPI_FAILURE(status)) {
668 goto cleanup2;
669 }
670
671 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
672 "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
673 acpi_ut_get_node_name(node), node, op));
674
675 /*
676 * Delete the parse tree. We simply re-parse the method for every
677 * execution since there isn't much overhead (compared to keeping lots
678 * of parse trees around)
679 */
680 acpi_ns_delete_namespace_subtree(node);
681 acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
682
683 cleanup2:
684 acpi_ut_release_owner_id(&obj_desc->method.owner_id);
685
686 cleanup:
687 acpi_ps_delete_parse_tree(op);
688 return_ACPI_STATUS(status);
689}
690#endif
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c
index 4095ce70982b..c025674f938b 100644
--- a/drivers/acpi/dispatcher/dsmthdat.c
+++ b/drivers/acpi/dispatcher/dsmthdat.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -260,9 +260,9 @@ acpi_ds_method_data_get_node(u16 opcode,
260 case AML_LOCAL_OP: 260 case AML_LOCAL_OP:
261 261
262 if (index > ACPI_METHOD_MAX_LOCAL) { 262 if (index > ACPI_METHOD_MAX_LOCAL) {
263 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 263 ACPI_ERROR((AE_INFO,
264 "Local index %d is invalid (max %d)\n", 264 "Local index %d is invalid (max %d)",
265 index, ACPI_METHOD_MAX_LOCAL)); 265 index, ACPI_METHOD_MAX_LOCAL));
266 return_ACPI_STATUS(AE_AML_INVALID_INDEX); 266 return_ACPI_STATUS(AE_AML_INVALID_INDEX);
267 } 267 }
268 268
@@ -274,9 +274,9 @@ acpi_ds_method_data_get_node(u16 opcode,
274 case AML_ARG_OP: 274 case AML_ARG_OP:
275 275
276 if (index > ACPI_METHOD_MAX_ARG) { 276 if (index > ACPI_METHOD_MAX_ARG) {
277 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 277 ACPI_ERROR((AE_INFO,
278 "Arg index %d is invalid (max %d)\n", 278 "Arg index %d is invalid (max %d)",
279 index, ACPI_METHOD_MAX_ARG)); 279 index, ACPI_METHOD_MAX_ARG));
280 return_ACPI_STATUS(AE_AML_INVALID_INDEX); 280 return_ACPI_STATUS(AE_AML_INVALID_INDEX);
281 } 281 }
282 282
@@ -286,8 +286,7 @@ acpi_ds_method_data_get_node(u16 opcode,
286 break; 286 break;
287 287
288 default: 288 default:
289 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n", 289 ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode));
290 opcode));
291 return_ACPI_STATUS(AE_AML_BAD_OPCODE); 290 return_ACPI_STATUS(AE_AML_BAD_OPCODE);
292 } 291 }
293 292
@@ -378,8 +377,7 @@ acpi_ds_method_data_get_value(u16 opcode,
378 /* Validate the object descriptor */ 377 /* Validate the object descriptor */
379 378
380 if (!dest_desc) { 379 if (!dest_desc) {
381 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 380 ACPI_ERROR((AE_INFO, "Null object descriptor pointer"));
382 "Null object descriptor pointer\n"));
383 return_ACPI_STATUS(AE_BAD_PARAMETER); 381 return_ACPI_STATUS(AE_BAD_PARAMETER);
384 } 382 }
385 383
@@ -424,23 +422,24 @@ acpi_ds_method_data_get_value(u16 opcode,
424 switch (opcode) { 422 switch (opcode) {
425 case AML_ARG_OP: 423 case AML_ARG_OP:
426 424
427 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 425 ACPI_ERROR((AE_INFO,
428 "Uninitialized Arg[%d] at node %p\n", 426 "Uninitialized Arg[%d] at node %p",
429 index, node)); 427 index, node));
430 428
431 return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); 429 return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
432 430
433 case AML_LOCAL_OP: 431 case AML_LOCAL_OP:
434 432
435 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 433 ACPI_ERROR((AE_INFO,
436 "Uninitialized Local[%d] at node %p\n", 434 "Uninitialized Local[%d] at node %p",
437 index, node)); 435 index, node));
438 436
439 return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); 437 return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
440 438
441 default: 439 default:
442 ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n", 440 ACPI_ERROR((AE_INFO,
443 opcode)); 441 "Not a Arg/Local opcode: %X",
442 opcode));
444 return_ACPI_STATUS(AE_AML_INTERNAL); 443 return_ACPI_STATUS(AE_AML_INTERNAL);
445 } 444 }
446 } 445 }
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index 8ac0cd93adb5..8b21f0f9e517 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
51#define _COMPONENT ACPI_DISPATCHER 51#define _COMPONENT ACPI_DISPATCHER
52ACPI_MODULE_NAME("dsobject") 52ACPI_MODULE_NAME("dsobject")
53 53
54/* Local prototypes */
54static acpi_status 55static acpi_status
55acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, 56acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
56 union acpi_parse_object *op, 57 union acpi_parse_object *op,
@@ -85,7 +86,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
85 *obj_desc_ptr = NULL; 86 *obj_desc_ptr = NULL;
86 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { 87 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
87 /* 88 /*
88 * This is an named object reference. If this name was 89 * This is a named object reference. If this name was
89 * previously looked up in the namespace, it was stored in this op. 90 * previously looked up in the namespace, it was stored in this op.
90 * Otherwise, go ahead and look it up now 91 * Otherwise, go ahead and look it up now
91 */ 92 */
@@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
96 ACPI_IMODE_EXECUTE, 97 ACPI_IMODE_EXECUTE,
97 ACPI_NS_SEARCH_PARENT | 98 ACPI_NS_SEARCH_PARENT |
98 ACPI_NS_DONT_OPEN_SCOPE, NULL, 99 ACPI_NS_DONT_OPEN_SCOPE, NULL,
99 (struct acpi_namespace_node **) 100 ACPI_CAST_INDIRECT_PTR(struct
100 &(op->common.node)); 101 acpi_namespace_node,
101 102 &(op->
103 common.
104 node)));
102 if (ACPI_FAILURE(status)) { 105 if (ACPI_FAILURE(status)) {
103 ACPI_REPORT_NSERROR(op->common.value.string, 106 /* Check if we are resolving a named reference within a package */
104 status); 107
108 if ((status == AE_NOT_FOUND)
109 && (acpi_gbl_enable_interpreter_slack)
110 &&
111 ((op->common.parent->common.aml_opcode ==
112 AML_PACKAGE_OP)
113 || (op->common.parent->common.aml_opcode ==
114 AML_VAR_PACKAGE_OP))) {
115 /*
116 * We didn't find the target and we are populating elements
117 * of a package - ignore if slack enabled. Some ASL code
118 * contains dangling invalid references in packages and
119 * expects that no exception will be issued. Leave the
120 * element as a null element. It cannot be used, but it
121 * can be overwritten by subsequent ASL code - this is
122 * typically the case.
123 */
124 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
125 "Ignoring unresolved reference in package [%4.4s]\n",
126 walk_state->
127 scope_info->scope.
128 node->name.ascii));
129
130 return_ACPI_STATUS(AE_OK);
131 } else {
132 ACPI_ERROR_NAMESPACE(op->common.value.
133 string, status);
134 }
135
105 return_ACPI_STATUS(status); 136 return_ACPI_STATUS(status);
106 } 137 }
107 } 138 }
108 } 139 }
109 140
110 /* Create and init the internal ACPI object */ 141 /* Create and init a new internal ACPI object */
111 142
112 obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info 143 obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
113 (op->common.aml_opcode))-> 144 (op->common.aml_opcode))->
@@ -157,13 +188,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
157 188
158 ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); 189 ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
159 190
191 /*
192 * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
193 * The buffer object already exists (from the NS node), otherwise it must
194 * be created.
195 */
160 obj_desc = *obj_desc_ptr; 196 obj_desc = *obj_desc_ptr;
161 if (obj_desc) { 197 if (!obj_desc) {
162 /*
163 * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
164 * The buffer object already exists (from the NS node)
165 */
166 } else {
167 /* Create a new buffer object */ 198 /* Create a new buffer object */
168 199
169 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); 200 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@@ -183,10 +214,9 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
183 byte_list = arg->named.next; 214 byte_list = arg->named.next;
184 if (byte_list) { 215 if (byte_list) {
185 if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { 216 if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
186 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 217 ACPI_ERROR((AE_INFO,
187 "Expecting bytelist, got AML opcode %X in op %p\n", 218 "Expecting bytelist, got AML opcode %X in op %p",
188 byte_list->common.aml_opcode, 219 byte_list->common.aml_opcode, byte_list));
189 byte_list));
190 220
191 acpi_ut_remove_reference(obj_desc); 221 acpi_ut_remove_reference(obj_desc);
192 return (AE_TYPE); 222 return (AE_TYPE);
@@ -259,7 +289,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
259 union acpi_operand_object *obj_desc = NULL; 289 union acpi_operand_object *obj_desc = NULL;
260 u32 package_list_length; 290 u32 package_list_length;
261 acpi_status status = AE_OK; 291 acpi_status status = AE_OK;
262 u32 i; 292 acpi_native_uint i;
263 293
264 ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); 294 ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
265 295
@@ -271,13 +301,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
271 parent = parent->common.parent; 301 parent = parent->common.parent;
272 } 302 }
273 303
304 /*
305 * If we are evaluating a Named package object "Name (xxxx, Package)",
306 * the package object already exists, otherwise it must be created.
307 */
274 obj_desc = *obj_desc_ptr; 308 obj_desc = *obj_desc_ptr;
275 if (obj_desc) { 309 if (!obj_desc) {
276 /*
277 * We are evaluating a Named package object "Name (xxxx, Package)".
278 * Get the existing package object from the NS node
279 */
280 } else {
281 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); 310 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
282 *obj_desc_ptr = obj_desc; 311 *obj_desc_ptr = obj_desc;
283 if (!obj_desc) { 312 if (!obj_desc) {
@@ -291,11 +320,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
291 320
292 /* Count the number of items in the package list */ 321 /* Count the number of items in the package list */
293 322
294 package_list_length = 0;
295 arg = op->common.value.arg; 323 arg = op->common.value.arg;
296 arg = arg->common.next; 324 arg = arg->common.next;
297 while (arg) { 325 for (package_list_length = 0; arg; package_list_length++) {
298 package_list_length++;
299 arg = arg->common.next; 326 arg = arg->common.next;
300 } 327 }
301 328
@@ -322,12 +349,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
322 } 349 }
323 350
324 /* 351 /*
325 * Now init the elements of the package 352 * Initialize all elements of the package
326 */ 353 */
327 i = 0;
328 arg = op->common.value.arg; 354 arg = op->common.value.arg;
329 arg = arg->common.next; 355 arg = arg->common.next;
330 while (arg) { 356 for (i = 0; arg; i++) {
331 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 357 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
332 /* Object (package or buffer) is already built */ 358 /* Object (package or buffer) is already built */
333 359
@@ -340,8 +366,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
340 package. 366 package.
341 elements[i]); 367 elements[i]);
342 } 368 }
343
344 i++;
345 arg = arg->common.next; 369 arg = arg->common.next;
346 } 370 }
347 371
@@ -518,9 +542,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
518 542
519 default: 543 default:
520 544
521 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 545 ACPI_ERROR((AE_INFO,
522 "Unknown constant opcode %X\n", 546 "Unknown constant opcode %X",
523 opcode)); 547 opcode));
524 status = AE_AML_OPERAND_TYPE; 548 status = AE_AML_OPERAND_TYPE;
525 break; 549 break;
526 } 550 }
@@ -535,9 +559,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
535 break; 559 break;
536 560
537 default: 561 default:
538 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 562 ACPI_ERROR((AE_INFO, "Unknown Integer type %X",
539 "Unknown Integer type %X\n", 563 op_info->type));
540 op_info->type));
541 status = AE_AML_OPERAND_TYPE; 564 status = AE_AML_OPERAND_TYPE;
542 break; 565 break;
543 } 566 }
@@ -615,9 +638,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
615 638
616 default: 639 default:
617 640
618 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 641 ACPI_ERROR((AE_INFO, "Unimplemented data type: %X",
619 "Unimplemented data type: %X\n", 642 ACPI_GET_OBJECT_TYPE(obj_desc)));
620 ACPI_GET_OBJECT_TYPE(obj_desc)));
621 643
622 status = AE_AML_OPERAND_TYPE; 644 status = AE_AML_OPERAND_TYPE;
623 break; 645 break;
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
index 939d167bf87b..6229c10674e1 100644
--- a/drivers/acpi/dispatcher/dsopcode.c
+++ b/drivers/acpi/dispatcher/dsopcode.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2005, R. Byron Moore 9 * Copyright (C) 2000 - 2006, R. Byron Moore
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -245,7 +245,9 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
245 245
246 node = obj_desc->buffer.node; 246 node = obj_desc->buffer.node;
247 if (!node) { 247 if (!node) {
248 ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc)); 248 ACPI_ERROR((AE_INFO,
249 "No pointer back to NS node in buffer obj %p",
250 obj_desc));
249 return_ACPI_STATUS(AE_AML_INTERNAL); 251 return_ACPI_STATUS(AE_AML_INTERNAL);
250 } 252 }
251 253
@@ -287,8 +289,9 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
287 289
288 node = obj_desc->package.node; 290 node = obj_desc->package.node;
289 if (!node) { 291 if (!node) {
290 ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n", 292 ACPI_ERROR((AE_INFO,
291 obj_desc)); 293 "No pointer back to NS node in package %p",
294 obj_desc));
292 return_ACPI_STATUS(AE_AML_INTERNAL); 295 return_ACPI_STATUS(AE_AML_INTERNAL);
293 } 296 }
294 297
@@ -413,9 +416,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
413 /* Host object must be a Buffer */ 416 /* Host object must be a Buffer */
414 417
415 if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { 418 if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
416 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 419 ACPI_ERROR((AE_INFO,
417 "Target of Create Field is not a Buffer object - %s\n", 420 "Target of Create Field is not a Buffer object - %s",
418 acpi_ut_get_object_type_name(buffer_desc))); 421 acpi_ut_get_object_type_name(buffer_desc)));
419 422
420 status = AE_AML_OPERAND_TYPE; 423 status = AE_AML_OPERAND_TYPE;
421 goto cleanup; 424 goto cleanup;
@@ -427,10 +430,10 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
427 * after resolution in acpi_ex_resolve_operands(). 430 * after resolution in acpi_ex_resolve_operands().
428 */ 431 */
429 if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) { 432 if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
430 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 433 ACPI_ERROR((AE_INFO,
431 "(%s) destination not a NS Node [%s]\n", 434 "(%s) destination not a NS Node [%s]",
432 acpi_ps_get_opcode_name(aml_opcode), 435 acpi_ps_get_opcode_name(aml_opcode),
433 acpi_ut_get_descriptor_name(result_desc))); 436 acpi_ut_get_descriptor_name(result_desc)));
434 437
435 status = AE_AML_OPERAND_TYPE; 438 status = AE_AML_OPERAND_TYPE;
436 goto cleanup; 439 goto cleanup;
@@ -453,8 +456,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
453 /* Must have a valid (>0) bit count */ 456 /* Must have a valid (>0) bit count */
454 457
455 if (bit_count == 0) { 458 if (bit_count == 0) {
456 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 459 ACPI_ERROR((AE_INFO,
457 "Attempt to create_field of length 0\n")); 460 "Attempt to create_field of length zero"));
458 status = AE_AML_OPERAND_VALUE; 461 status = AE_AML_OPERAND_VALUE;
459 goto cleanup; 462 goto cleanup;
460 } 463 }
@@ -507,9 +510,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
507 510
508 default: 511 default:
509 512
510 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 513 ACPI_ERROR((AE_INFO,
511 "Unknown field creation opcode %02x\n", 514 "Unknown field creation opcode %02x", aml_opcode));
512 aml_opcode));
513 status = AE_AML_BAD_OPCODE; 515 status = AE_AML_BAD_OPCODE;
514 goto cleanup; 516 goto cleanup;
515 } 517 }
@@ -517,13 +519,12 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
517 /* Entire field must fit within the current length of the buffer */ 519 /* Entire field must fit within the current length of the buffer */
518 520
519 if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) { 521 if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) {
520 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 522 ACPI_ERROR((AE_INFO,
521 "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", 523 "Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
522 acpi_ut_get_node_name(result_desc), 524 acpi_ut_get_node_name(result_desc),
523 bit_offset + bit_count, 525 bit_offset + bit_count,
524 acpi_ut_get_node_name(buffer_desc->buffer. 526 acpi_ut_get_node_name(buffer_desc->buffer.node),
525 node), 527 8 * (u32) buffer_desc->buffer.length));
526 8 * (u32) buffer_desc->buffer.length));
527 status = AE_AML_BUFFER_LIMIT; 528 status = AE_AML_BUFFER_LIMIT;
528 goto cleanup; 529 goto cleanup;
529 } 530 }
@@ -629,9 +630,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
629 "after acpi_ex_resolve_operands"); 630 "after acpi_ex_resolve_operands");
630 631
631 if (ACPI_FAILURE(status)) { 632 if (ACPI_FAILURE(status)) {
632 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", 633 ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)",
633 acpi_ps_get_opcode_name(op->common. 634 acpi_ps_get_opcode_name(op->common.aml_opcode),
634 aml_opcode), status)); 635 status));
635 636
636 return_ACPI_STATUS(status); 637 return_ACPI_STATUS(status);
637 } 638 }
@@ -1155,9 +1156,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
1155 1156
1156 default: 1157 default:
1157 1158
1158 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1159 ACPI_ERROR((AE_INFO, "Unknown control opcode=%X Op=%p",
1159 "Unknown control opcode=%X Op=%p\n", 1160 op->common.aml_opcode, op));
1160 op->common.aml_opcode, op));
1161 1161
1162 status = AE_AML_BAD_OPCODE; 1162 status = AE_AML_BAD_OPCODE;
1163 break; 1163 break;
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c
index 83ae1c1aa286..53356a591ac1 100644
--- a/drivers/acpi/dispatcher/dsutils.c
+++ b/drivers/acpi/dispatcher/dsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -176,8 +176,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
176 /* Must have both an Op and a Result Object */ 176 /* Must have both an Op and a Result Object */
177 177
178 if (!op) { 178 if (!op) {
179 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); 179 ACPI_ERROR((AE_INFO, "Null Op"));
180 return_VALUE(TRUE); 180 return_UINT8(TRUE);
181 } 181 }
182 182
183 /* 183 /*
@@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
208 "At Method level, result of [%s] not used\n", 208 "At Method level, result of [%s] not used\n",
209 acpi_ps_get_opcode_name(op->common. 209 acpi_ps_get_opcode_name(op->common.
210 aml_opcode))); 210 aml_opcode)));
211 return_VALUE(FALSE); 211 return_UINT8(FALSE);
212 } 212 }
213 213
214 /* Get info on the parent. The root_op is AML_SCOPE */ 214 /* Get info on the parent. The root_op is AML_SCOPE */
@@ -216,9 +216,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
216 parent_info = 216 parent_info =
217 acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); 217 acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
218 if (parent_info->class == AML_CLASS_UNKNOWN) { 218 if (parent_info->class == AML_CLASS_UNKNOWN) {
219 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 219 ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
220 "Unknown parent opcode. Op=%p\n", op)); 220 return_UINT8(FALSE);
221 return_VALUE(FALSE);
222 } 221 }
223 222
224 /* 223 /*
@@ -304,7 +303,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
304 acpi_ps_get_opcode_name(op->common.parent->common. 303 acpi_ps_get_opcode_name(op->common.parent->common.
305 aml_opcode), op)); 304 aml_opcode), op));
306 305
307 return_VALUE(TRUE); 306 return_UINT8(TRUE);
308 307
309 result_not_used: 308 result_not_used:
310 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 309 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -313,7 +312,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
313 acpi_ps_get_opcode_name(op->common.parent->common. 312 acpi_ps_get_opcode_name(op->common.parent->common.
314 aml_opcode), op)); 313 aml_opcode), op));
315 314
316 return_VALUE(FALSE); 315 return_UINT8(FALSE);
317} 316}
318 317
319/******************************************************************************* 318/*******************************************************************************
@@ -344,7 +343,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
344 ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); 343 ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
345 344
346 if (!op) { 345 if (!op) {
347 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); 346 ACPI_ERROR((AE_INFO, "Null Op"));
348 return_VOID; 347 return_VOID;
349 } 348 }
350 349
@@ -567,7 +566,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
567 } 566 }
568 567
569 if (ACPI_FAILURE(status)) { 568 if (ACPI_FAILURE(status)) {
570 ACPI_REPORT_NSERROR(name_string, status); 569 ACPI_ERROR_NAMESPACE(name_string, status);
571 } 570 }
572 } 571 }
573 572
@@ -616,7 +615,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
616 615
617 if (op_info->flags & AML_HAS_RETVAL) { 616 if (op_info->flags & AML_HAS_RETVAL) {
618 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 617 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
619 "Argument previously created, already stacked \n")); 618 "Argument previously created, already stacked\n"));
620 619
621 ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object 620 ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
622 (walk_state-> 621 (walk_state->
@@ -635,10 +634,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
635 * Only error is underflow, and this indicates 634 * Only error is underflow, and this indicates
636 * a missing or null operand! 635 * a missing or null operand!
637 */ 636 */
638 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 637 ACPI_EXCEPTION((AE_INFO, status,
639 "Missing or null operand, %s\n", 638 "Missing or null operand"));
640 acpi_format_exception
641 (status)));
642 return_ACPI_STATUS(status); 639 return_ACPI_STATUS(status);
643 } 640 }
644 } else { 641 } else {
@@ -730,7 +727,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,
730 */ 727 */
731 (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); 728 (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
732 729
733 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n", 730 ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d",
734 (arg_count + 1), acpi_format_exception(status))); 731 (arg_count + 1)));
735 return_ACPI_STATUS(status); 732 return_ACPI_STATUS(status);
736} 733}
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
index e522763bb692..f1af655ff113 100644
--- a/drivers/acpi/dispatcher/dswexec.c
+++ b/drivers/acpi/dispatcher/dswexec.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2005, R. Byron Moore 9 * Copyright (C) 2000 - 2006, R. Byron Moore
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -100,9 +100,8 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
100 if (result_obj) { 100 if (result_obj) {
101 status = acpi_ds_result_pop(&obj_desc, walk_state); 101 status = acpi_ds_result_pop(&obj_desc, walk_state);
102 if (ACPI_FAILURE(status)) { 102 if (ACPI_FAILURE(status)) {
103 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 103 ACPI_EXCEPTION((AE_INFO, status,
104 "Could not get result from predicate evaluation, %s\n", 104 "Could not get result from predicate evaluation"));
105 acpi_format_exception(status)));
106 105
107 return_ACPI_STATUS(status); 106 return_ACPI_STATUS(status);
108 } 107 }
@@ -123,9 +122,9 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
123 } 122 }
124 123
125 if (!obj_desc) { 124 if (!obj_desc) {
126 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 125 ACPI_ERROR((AE_INFO,
127 "No predicate obj_desc=%p State=%p\n", 126 "No predicate obj_desc=%p State=%p",
128 obj_desc, walk_state)); 127 obj_desc, walk_state));
129 128
130 return_ACPI_STATUS(AE_AML_NO_OPERAND); 129 return_ACPI_STATUS(AE_AML_NO_OPERAND);
131 } 130 }
@@ -140,10 +139,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
140 } 139 }
141 140
142 if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { 141 if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
143 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 142 ACPI_ERROR((AE_INFO,
144 "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", 143 "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X",
145 obj_desc, walk_state, 144 obj_desc, walk_state,
146 ACPI_GET_OBJECT_TYPE(obj_desc))); 145 ACPI_GET_OBJECT_TYPE(obj_desc)));
147 146
148 status = AE_AML_OPERAND_TYPE; 147 status = AE_AML_OPERAND_TYPE;
149 goto cleanup; 148 goto cleanup;
@@ -314,12 +313,13 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
314 313
315 case AML_CLASS_EXECUTE: 314 case AML_CLASS_EXECUTE:
316 case AML_CLASS_CREATE: 315 case AML_CLASS_CREATE:
317
318 /* 316 /*
319 * Most operators with arguments. 317 * Most operators with arguments.
320 * Start a new result/operand state 318 * Start a new result/operand state
321 */ 319 */
322 status = acpi_ds_result_stack_push(walk_state); 320 if (walk_state->opcode != AML_CREATE_FIELD_OP) {
321 status = acpi_ds_result_stack_push(walk_state);
322 }
323 break; 323 break;
324 324
325 default: 325 default:
@@ -361,8 +361,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
361 op_class = walk_state->op_info->class; 361 op_class = walk_state->op_info->class;
362 362
363 if (op_class == AML_CLASS_UNKNOWN) { 363 if (op_class == AML_CLASS_UNKNOWN) {
364 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n", 364 ACPI_ERROR((AE_INFO, "Unknown opcode %X",
365 op->common.aml_opcode)); 365 op->common.aml_opcode));
366 return_ACPI_STATUS(AE_NOT_IMPLEMENTED); 366 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
367 } 367 }
368 368
@@ -452,12 +452,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
452 walk_state->operands[1]->reference.offset)) { 452 walk_state->operands[1]->reference.offset)) {
453 status = AE_OK; 453 status = AE_OK;
454 } else { 454 } else {
455 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 455 ACPI_EXCEPTION((AE_INFO, status,
456 "[%s]: Could not resolve operands, %s\n", 456 "While resolving operands for [%s]",
457 acpi_ps_get_opcode_name 457 acpi_ps_get_opcode_name
458 (walk_state->opcode), 458 (walk_state->opcode)));
459 acpi_format_exception
460 (status)));
461 } 459 }
462 } 460 }
463 461
@@ -676,8 +674,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
676 674
677 case AML_TYPE_UNDEFINED: 675 case AML_TYPE_UNDEFINED:
678 676
679 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 677 ACPI_ERROR((AE_INFO,
680 "Undefined opcode type Op=%p\n", op)); 678 "Undefined opcode type Op=%p", op));
681 return_ACPI_STATUS(AE_NOT_IMPLEMENTED); 679 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
682 680
683 case AML_TYPE_BOGUS: 681 case AML_TYPE_BOGUS:
@@ -689,10 +687,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
689 687
690 default: 688 default:
691 689
692 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 690 ACPI_ERROR((AE_INFO,
693 "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", 691 "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p",
694 op_class, op_type, 692 op_class, op_type, op->common.aml_opcode,
695 op->common.aml_opcode, op)); 693 op));
696 694
697 status = AE_NOT_IMPLEMENTED; 695 status = AE_NOT_IMPLEMENTED;
698 break; 696 break;
@@ -723,20 +721,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
723 721
724 cleanup: 722 cleanup:
725 723
726 /* Invoke exception handler on error */
727
728 if (ACPI_FAILURE(status) &&
729 acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
730 acpi_ex_exit_interpreter();
731 status = acpi_gbl_exception_handler(status,
732 walk_state->method_node->
733 name.integer,
734 walk_state->opcode,
735 walk_state->aml_offset,
736 NULL);
737 (void)acpi_ex_enter_interpreter();
738 }
739
740 if (walk_state->result_obj) { 724 if (walk_state->result_obj) {
741 /* Break to debugger to display result */ 725 /* Break to debugger to display result */
742 726
@@ -758,18 +742,14 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
758 } 742 }
759#endif 743#endif
760 744
761 /* Always clear the object stack */ 745 /* Invoke exception handler on error */
762
763 walk_state->num_operands = 0;
764
765#ifdef ACPI_DISASSEMBLER
766
767 /* On error, display method locals/args */
768 746
769 if (ACPI_FAILURE(status)) { 747 if (ACPI_FAILURE(status)) {
770 acpi_dm_dump_method_info(status, walk_state, op); 748 status = acpi_ds_method_error(status, walk_state);
771 } 749 }
772#endif
773 750
751 /* Always clear the object stack */
752
753 walk_state->num_operands = 0;
774 return_ACPI_STATUS(status); 754 return_ACPI_STATUS(status);
775} 755}
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index 411731261c29..d3d24da31c81 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
127 char *path; 127 char *path;
128 u32 flags; 128 u32 flags;
129 129
130 ACPI_FUNCTION_NAME("ds_load1_begin_op"); 130 ACPI_FUNCTION_TRACE("ds_load1_begin_op");
131 131
132 op = walk_state->op; 132 op = walk_state->op;
133 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, 133 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -138,14 +138,14 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
138 if (op) { 138 if (op) {
139 if (!(walk_state->op_info->flags & AML_NAMED)) { 139 if (!(walk_state->op_info->flags & AML_NAMED)) {
140 *out_op = op; 140 *out_op = op;
141 return (AE_OK); 141 return_ACPI_STATUS(AE_OK);
142 } 142 }
143 143
144 /* Check if this object has already been installed in the namespace */ 144 /* Check if this object has already been installed in the namespace */
145 145
146 if (op->common.node) { 146 if (op->common.node) {
147 *out_op = op; 147 *out_op = op;
148 return (AE_OK); 148 return_ACPI_STATUS(AE_OK);
149 } 149 }
150 } 150 }
151 151
@@ -187,8 +187,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
187 } 187 }
188#endif 188#endif
189 if (ACPI_FAILURE(status)) { 189 if (ACPI_FAILURE(status)) {
190 ACPI_REPORT_NSERROR(path, status); 190 ACPI_ERROR_NAMESPACE(path, status);
191 return (status); 191 return_ACPI_STATUS(status);
192 } 192 }
193 193
194 /* 194 /*
@@ -233,9 +233,11 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
233 233
234 /* All other types are an error */ 234 /* All other types are an error */
235 235
236 ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); 236 ACPI_ERROR((AE_INFO,
237 "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)",
238 acpi_ut_get_type_name(node->type), path));
237 239
238 return (AE_AML_OPERAND_TYPE); 240 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
239 } 241 }
240 break; 242 break;
241 243
@@ -257,6 +259,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
257 * buffer_field, or Package), the name of the object is already 259 * buffer_field, or Package), the name of the object is already
258 * in the namespace. 260 * in the namespace.
259 */ 261 */
262
260 if (walk_state->deferred_node) { 263 if (walk_state->deferred_node) {
261 /* This name is already in the namespace, get the node */ 264 /* This name is already in the namespace, get the node */
262 265
@@ -265,6 +268,16 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
265 break; 268 break;
266 } 269 }
267 270
271 /*
272 * If we are executing a method, do not create any namespace objects
273 * during the load phase, only during execution.
274 */
275 if (walk_state->method_node) {
276 node = NULL;
277 status = AE_OK;
278 break;
279 }
280
268 flags = ACPI_NS_NO_UPSEARCH; 281 flags = ACPI_NS_NO_UPSEARCH;
269 if ((walk_state->opcode != AML_SCOPE_OP) && 282 if ((walk_state->opcode != AML_SCOPE_OP) &&
270 (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { 283 (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
@@ -289,8 +302,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
289 ACPI_IMODE_LOAD_PASS1, flags, walk_state, 302 ACPI_IMODE_LOAD_PASS1, flags, walk_state,
290 &(node)); 303 &(node));
291 if (ACPI_FAILURE(status)) { 304 if (ACPI_FAILURE(status)) {
292 ACPI_REPORT_NSERROR(path, status); 305 ACPI_ERROR_NAMESPACE(path, status);
293 return (status); 306 return_ACPI_STATUS(status);
294 } 307 }
295 break; 308 break;
296 } 309 }
@@ -302,28 +315,29 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
302 315
303 op = acpi_ps_alloc_op(walk_state->opcode); 316 op = acpi_ps_alloc_op(walk_state->opcode);
304 if (!op) { 317 if (!op) {
305 return (AE_NO_MEMORY); 318 return_ACPI_STATUS(AE_NO_MEMORY);
306 } 319 }
307 } 320 }
308 321
309 /* Initialize */ 322 /* Initialize the op */
310
311 op->named.name = node->name.integer;
312 323
313#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) 324#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
314 op->named.path = (u8 *) path; 325 op->named.path = ACPI_CAST_PTR(u8, path);
315#endif 326#endif
316 327
317 /* 328 if (node) {
318 * Put the Node in the "op" object that the parser uses, so we 329 /*
319 * can get it again quickly when this scope is closed 330 * Put the Node in the "op" object that the parser uses, so we
320 */ 331 * can get it again quickly when this scope is closed
321 op->common.node = node; 332 */
333 op->common.node = node;
334 op->named.name = node->name.integer;
335 }
336
322 acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), 337 acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state),
323 op); 338 op);
324
325 *out_op = op; 339 *out_op = op;
326 return (status); 340 return_ACPI_STATUS(status);
327} 341}
328 342
329/******************************************************************************* 343/*******************************************************************************
@@ -339,13 +353,13 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
339 * 353 *
340 ******************************************************************************/ 354 ******************************************************************************/
341 355
342acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) 356acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
343{ 357{
344 union acpi_parse_object *op; 358 union acpi_parse_object *op;
345 acpi_object_type object_type; 359 acpi_object_type object_type;
346 acpi_status status = AE_OK; 360 acpi_status status = AE_OK;
347 361
348 ACPI_FUNCTION_NAME("ds_load1_end_op"); 362 ACPI_FUNCTION_TRACE("ds_load1_end_op");
349 363
350 op = walk_state->op; 364 op = walk_state->op;
351 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, 365 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -354,7 +368,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
354 /* We are only interested in opcodes that have an associated name */ 368 /* We are only interested in opcodes that have an associated name */
355 369
356 if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) { 370 if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) {
357 return (AE_OK); 371 return_ACPI_STATUS(AE_OK);
358 } 372 }
359 373
360 /* Get the object type to determine if we should pop the scope */ 374 /* Get the object type to determine if we should pop the scope */
@@ -363,21 +377,37 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
363 377
364#ifndef ACPI_NO_METHOD_EXECUTION 378#ifndef ACPI_NO_METHOD_EXECUTION
365 if (walk_state->op_info->flags & AML_FIELD) { 379 if (walk_state->op_info->flags & AML_FIELD) {
366 if (walk_state->opcode == AML_FIELD_OP || 380 /*
367 walk_state->opcode == AML_BANK_FIELD_OP || 381 * If we are executing a method, do not create any namespace objects
368 walk_state->opcode == AML_INDEX_FIELD_OP) { 382 * during the load phase, only during execution.
369 status = acpi_ds_init_field_objects(op, walk_state); 383 */
384 if (!walk_state->method_node) {
385 if (walk_state->opcode == AML_FIELD_OP ||
386 walk_state->opcode == AML_BANK_FIELD_OP ||
387 walk_state->opcode == AML_INDEX_FIELD_OP) {
388 status =
389 acpi_ds_init_field_objects(op, walk_state);
390 }
370 } 391 }
371 return (status); 392 return_ACPI_STATUS(status);
372 } 393 }
373 394
374 if (op->common.aml_opcode == AML_REGION_OP) { 395 /*
375 status = acpi_ex_create_region(op->named.data, op->named.length, 396 * If we are executing a method, do not create any namespace objects
376 (acpi_adr_space_type) 397 * during the load phase, only during execution.
377 ((op->common.value.arg)->common. 398 */
378 value.integer), walk_state); 399 if (!walk_state->method_node) {
379 if (ACPI_FAILURE(status)) { 400 if (op->common.aml_opcode == AML_REGION_OP) {
380 return (status); 401 status =
402 acpi_ex_create_region(op->named.data,
403 op->named.length,
404 (acpi_adr_space_type)
405 ((op->common.value.arg)->
406 common.value.integer),
407 walk_state);
408 if (ACPI_FAILURE(status)) {
409 return_ACPI_STATUS(status);
410 }
381 } 411 }
382 } 412 }
383#endif 413#endif
@@ -391,47 +421,63 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
391 common. 421 common.
392 aml_opcode))-> 422 aml_opcode))->
393 object_type; 423 object_type;
394 op->common.node->type = (u8) object_type; 424
425 /* Set node type if we have a namespace node */
426
427 if (op->common.node) {
428 op->common.node->type = (u8) object_type;
429 }
395 } 430 }
396 } 431 }
397 432
398 if (op->common.aml_opcode == AML_METHOD_OP) { 433 /*
399 /* 434 * If we are executing a method, do not create any namespace objects
400 * method_op pkg_length name_string method_flags term_list 435 * during the load phase, only during execution.
401 * 436 */
402 * Note: We must create the method node/object pair as soon as we 437 if (!walk_state->method_node) {
403 * see the method declaration. This allows later pass1 parsing 438 if (op->common.aml_opcode == AML_METHOD_OP) {
404 * of invocations of the method (need to know the number of 439 /*
405 * arguments.) 440 * method_op pkg_length name_string method_flags term_list
406 */ 441 *
407 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 442 * Note: We must create the method node/object pair as soon as we
408 "LOADING-Method: State=%p Op=%p named_obj=%p\n", 443 * see the method declaration. This allows later pass1 parsing
409 walk_state, op, op->named.node)); 444 * of invocations of the method (need to know the number of
445 * arguments.)
446 */
447 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
448 "LOADING-Method: State=%p Op=%p named_obj=%p\n",
449 walk_state, op, op->named.node));
410 450
411 if (!acpi_ns_get_attached_object(op->named.node)) { 451 if (!acpi_ns_get_attached_object(op->named.node)) {
412 walk_state->operands[0] = (void *)op->named.node; 452 walk_state->operands[0] =
413 walk_state->num_operands = 1; 453 ACPI_CAST_PTR(void, op->named.node);
454 walk_state->num_operands = 1;
414 455
415 status = 456 status =
416 acpi_ds_create_operands(walk_state, 457 acpi_ds_create_operands(walk_state,
417 op->common.value.arg); 458 op->common.value.
418 if (ACPI_SUCCESS(status)) { 459 arg);
419 status = acpi_ex_create_method(op->named.data, 460 if (ACPI_SUCCESS(status)) {
420 op->named.length, 461 status =
421 walk_state); 462 acpi_ex_create_method(op->named.
422 } 463 data,
423 walk_state->operands[0] = NULL; 464 op->named.
424 walk_state->num_operands = 0; 465 length,
466 walk_state);
467 }
468 walk_state->operands[0] = NULL;
469 walk_state->num_operands = 0;
425 470
426 if (ACPI_FAILURE(status)) { 471 if (ACPI_FAILURE(status)) {
427 return (status); 472 return_ACPI_STATUS(status);
473 }
428 } 474 }
429 } 475 }
430 } 476 }
431 477
432 /* Pop the scope stack */ 478 /* Pop the scope stack (only if loading a table) */
433 479
434 if (acpi_ns_opens_scope(object_type)) { 480 if (!walk_state->method_node && acpi_ns_opens_scope(object_type)) {
435 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 481 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
436 "(%s): Popping scope for Op %p\n", 482 "(%s): Popping scope for Op %p\n",
437 acpi_ut_get_type_name(object_type), op)); 483 acpi_ut_get_type_name(object_type), op));
@@ -439,7 +485,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
439 status = acpi_ds_scope_stack_pop(walk_state); 485 status = acpi_ds_scope_stack_pop(walk_state);
440 } 486 }
441 487
442 return (status); 488 return_ACPI_STATUS(status);
443} 489}
444 490
445/******************************************************************************* 491/*******************************************************************************
@@ -456,8 +502,8 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
456 ******************************************************************************/ 502 ******************************************************************************/
457 503
458acpi_status 504acpi_status
459acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, 505acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
460 union acpi_parse_object ** out_op) 506 union acpi_parse_object **out_op)
461{ 507{
462 union acpi_parse_object *op; 508 union acpi_parse_object *op;
463 struct acpi_namespace_node *node; 509 struct acpi_namespace_node *node;
@@ -574,10 +620,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
574 if (status == AE_NOT_FOUND) { 620 if (status == AE_NOT_FOUND) {
575 status = AE_OK; 621 status = AE_OK;
576 } else { 622 } else {
577 ACPI_REPORT_NSERROR(buffer_ptr, status); 623 ACPI_ERROR_NAMESPACE(buffer_ptr, status);
578 } 624 }
579#else 625#else
580 ACPI_REPORT_NSERROR(buffer_ptr, status); 626 ACPI_ERROR_NAMESPACE(buffer_ptr, status);
581#endif 627#endif
582 return_ACPI_STATUS(status); 628 return_ACPI_STATUS(status);
583 } 629 }
@@ -607,7 +653,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
607 * Scope (DEB) { ... } 653 * Scope (DEB) { ... }
608 */ 654 */
609 655
610 ACPI_REPORT_WARNING(("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", buffer_ptr, acpi_ut_get_type_name(node->type))); 656 ACPI_WARNING((AE_INFO,
657 "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
658 buffer_ptr,
659 acpi_ut_get_type_name(node->type)));
611 660
612 node->type = ACPI_TYPE_ANY; 661 node->type = ACPI_TYPE_ANY;
613 walk_state->scope_info->common.value = ACPI_TYPE_ANY; 662 walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -617,7 +666,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
617 666
618 /* All other types are an error */ 667 /* All other types are an error */
619 668
620 ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr)); 669 ACPI_ERROR((AE_INFO,
670 "Invalid type (%s) for target of Scope operator [%4.4s]",
671 acpi_ut_get_type_name(node->type),
672 buffer_ptr));
621 673
622 return (AE_AML_OPERAND_TYPE); 674 return (AE_AML_OPERAND_TYPE);
623 } 675 }
@@ -670,7 +722,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
670 } 722 }
671 723
672 if (ACPI_FAILURE(status)) { 724 if (ACPI_FAILURE(status)) {
673 ACPI_REPORT_NSERROR(buffer_ptr, status); 725 ACPI_ERROR_NAMESPACE(buffer_ptr, status);
674 return_ACPI_STATUS(status); 726 return_ACPI_STATUS(status);
675 } 727 }
676 728
@@ -840,6 +892,13 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
840 892
841 case AML_TYPE_NAMED_FIELD: 893 case AML_TYPE_NAMED_FIELD:
842 894
895 /*
896 * If we are executing a method, initialize the field
897 */
898 if (walk_state->method_node) {
899 status = acpi_ds_init_field_objects(op, walk_state);
900 }
901
843 switch (op->common.aml_opcode) { 902 switch (op->common.aml_opcode) {
844 case AML_INDEX_FIELD_OP: 903 case AML_INDEX_FIELD_OP:
845 904
@@ -929,6 +988,24 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
929 switch (op->common.aml_opcode) { 988 switch (op->common.aml_opcode) {
930#ifndef ACPI_NO_METHOD_EXECUTION 989#ifndef ACPI_NO_METHOD_EXECUTION
931 case AML_REGION_OP: 990 case AML_REGION_OP:
991
992 /*
993 * If we are executing a method, initialize the region
994 */
995 if (walk_state->method_node) {
996 status =
997 acpi_ex_create_region(op->named.data,
998 op->named.length,
999 (acpi_adr_space_type)
1000 ((op->common.value.
1001 arg)->common.value.
1002 integer),
1003 walk_state);
1004 if (ACPI_FAILURE(status)) {
1005 return (status);
1006 }
1007 }
1008
932 /* 1009 /*
933 * The op_region is not fully parsed at this time. Only valid 1010 * The op_region is not fully parsed at this time. Only valid
934 * argument is the space_id. (We must save the address of the 1011 * argument is the space_id. (We must save the address of the
@@ -957,11 +1034,50 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
957 1034
958 status = acpi_ds_create_node(walk_state, node, op); 1035 status = acpi_ds_create_node(walk_state, node, op);
959 break; 1036 break;
1037
1038 case AML_METHOD_OP:
1039 /*
1040 * method_op pkg_length name_string method_flags term_list
1041 *
1042 * Note: We must create the method node/object pair as soon as we
1043 * see the method declaration. This allows later pass1 parsing
1044 * of invocations of the method (need to know the number of
1045 * arguments.)
1046 */
1047 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
1048 "LOADING-Method: State=%p Op=%p named_obj=%p\n",
1049 walk_state, op, op->named.node));
1050
1051 if (!acpi_ns_get_attached_object(op->named.node)) {
1052 walk_state->operands[0] =
1053 ACPI_CAST_PTR(void, op->named.node);
1054 walk_state->num_operands = 1;
1055
1056 status =
1057 acpi_ds_create_operands(walk_state,
1058 op->common.value.
1059 arg);
1060 if (ACPI_SUCCESS(status)) {
1061 status =
1062 acpi_ex_create_method(op->named.
1063 data,
1064 op->named.
1065 length,
1066 walk_state);
1067 }
1068 walk_state->operands[0] = NULL;
1069 walk_state->num_operands = 0;
1070
1071 if (ACPI_FAILURE(status)) {
1072 return_ACPI_STATUS(status);
1073 }
1074 }
1075 break;
1076
960#endif /* ACPI_NO_METHOD_EXECUTION */ 1077#endif /* ACPI_NO_METHOD_EXECUTION */
961 1078
962 default: 1079 default:
963 /* All NAMED_COMPLEX opcodes must be handled above */ 1080 /* All NAMED_COMPLEX opcodes must be handled above */
964 /* Note: Method objects were already created in Pass 1 */
965 break; 1081 break;
966 } 1082 }
967 break; 1083 break;
@@ -1004,7 +1120,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
1004 */ 1120 */
1005 op->common.node = new_node; 1121 op->common.node = new_node;
1006 } else { 1122 } else {
1007 ACPI_REPORT_NSERROR(arg->common.value.string, status); 1123 ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
1008 } 1124 }
1009 break; 1125 break;
1010 1126
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c
index defe956ef751..ada21ef4a174 100644
--- a/drivers/acpi/dispatcher/dswscope.c
+++ b/drivers/acpi/dispatcher/dswscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -107,14 +107,14 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
107 if (!node) { 107 if (!node) {
108 /* Invalid scope */ 108 /* Invalid scope */
109 109
110 ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n")); 110 ACPI_ERROR((AE_INFO, "Null scope parameter"));
111 return_ACPI_STATUS(AE_BAD_PARAMETER); 111 return_ACPI_STATUS(AE_BAD_PARAMETER);
112 } 112 }
113 113
114 /* Make sure object type is valid */ 114 /* Make sure object type is valid */
115 115
116 if (!acpi_ut_valid_object_type(type)) { 116 if (!acpi_ut_valid_object_type(type)) {
117 ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); 117 ACPI_WARNING((AE_INFO, "Invalid object type: 0x%X", type));
118 } 118 }
119 119
120 /* Allocate a new scope object */ 120 /* Allocate a new scope object */
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c
index 7d68a5aaf3c4..fa78cb74ee36 100644
--- a/drivers/acpi/dispatcher/dswstate.c
+++ b/drivers/acpi/dispatcher/dswstate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -92,26 +92,23 @@ acpi_ds_result_remove(union acpi_operand_object **object,
92 92
93 state = walk_state->results; 93 state = walk_state->results;
94 if (!state) { 94 if (!state) {
95 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 95 ACPI_ERROR((AE_INFO, "No result object pushed! State=%p",
96 "No result object pushed! State=%p\n", 96 walk_state));
97 walk_state));
98 return (AE_NOT_EXIST); 97 return (AE_NOT_EXIST);
99 } 98 }
100 99
101 if (index >= ACPI_OBJ_MAX_OPERAND) { 100 if (index >= ACPI_OBJ_MAX_OPERAND) {
102 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 101 ACPI_ERROR((AE_INFO,
103 "Index out of range: %X State=%p Num=%X\n", 102 "Index out of range: %X State=%p Num=%X",
104 index, walk_state, 103 index, walk_state, state->results.num_results));
105 state->results.num_results));
106 } 104 }
107 105
108 /* Check for a valid result object */ 106 /* Check for a valid result object */
109 107
110 if (!state->results.obj_desc[index]) { 108 if (!state->results.obj_desc[index]) {
111 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 109 ACPI_ERROR((AE_INFO,
112 "Null operand! State=%p #Ops=%X, Index=%X\n", 110 "Null operand! State=%p #Ops=%X, Index=%X",
113 walk_state, state->results.num_results, 111 walk_state, state->results.num_results, index));
114 index));
115 return (AE_AML_NO_RETURN_VALUE); 112 return (AE_AML_NO_RETURN_VALUE);
116 } 113 }
117 114
@@ -163,9 +160,8 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
163 } 160 }
164 161
165 if (!state->results.num_results) { 162 if (!state->results.num_results) {
166 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 163 ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p",
167 "Result stack is empty! State=%p\n", 164 walk_state));
168 walk_state));
169 return (AE_AML_NO_RETURN_VALUE); 165 return (AE_AML_NO_RETURN_VALUE);
170 } 166 }
171 167
@@ -192,8 +188,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
192 } 188 }
193 } 189 }
194 190
195 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 191 ACPI_ERROR((AE_INFO, "No result objects! State=%p", walk_state));
196 "No result objects! State=%p\n", walk_state));
197 return (AE_AML_NO_RETURN_VALUE); 192 return (AE_AML_NO_RETURN_VALUE);
198} 193}
199 194
@@ -222,15 +217,14 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
222 217
223 state = walk_state->results; 218 state = walk_state->results;
224 if (!state) { 219 if (!state) {
225 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 220 ACPI_ERROR((AE_INFO,
226 "Warning: No result object pushed! State=%p\n", 221 "No result object pushed! State=%p", walk_state));
227 walk_state));
228 return (AE_NOT_EXIST); 222 return (AE_NOT_EXIST);
229 } 223 }
230 224
231 if (!state->results.num_results) { 225 if (!state->results.num_results) {
232 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 226 ACPI_ERROR((AE_INFO, "No result objects! State=%p",
233 "No result objects! State=%p\n", walk_state)); 227 walk_state));
234 return (AE_AML_NO_RETURN_VALUE); 228 return (AE_AML_NO_RETURN_VALUE);
235 } 229 }
236 230
@@ -250,10 +244,10 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
250 /* Check for a valid result object */ 244 /* Check for a valid result object */
251 245
252 if (!*object) { 246 if (!*object) {
253 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 247 ACPI_ERROR((AE_INFO,
254 "Null operand! State=%p #Ops=%X Index=%X\n", 248 "Null operand! State=%p #Ops=%X Index=%X",
255 walk_state, state->results.num_results, 249 walk_state, state->results.num_results,
256 (u32) index)); 250 (u32) index));
257 return (AE_AML_NO_RETURN_VALUE); 251 return (AE_AML_NO_RETURN_VALUE);
258 } 252 }
259 253
@@ -288,23 +282,21 @@ acpi_ds_result_push(union acpi_operand_object * object,
288 282
289 state = walk_state->results; 283 state = walk_state->results;
290 if (!state) { 284 if (!state) {
291 ACPI_REPORT_ERROR(("No result stack frame during push\n")); 285 ACPI_ERROR((AE_INFO, "No result stack frame during push"));
292 return (AE_AML_INTERNAL); 286 return (AE_AML_INTERNAL);
293 } 287 }
294 288
295 if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { 289 if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) {
296 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 290 ACPI_ERROR((AE_INFO,
297 "Result stack overflow: Obj=%p State=%p Num=%X\n", 291 "Result stack overflow: Obj=%p State=%p Num=%X",
298 object, walk_state, 292 object, walk_state, state->results.num_results));
299 state->results.num_results));
300 return (AE_STACK_OVERFLOW); 293 return (AE_STACK_OVERFLOW);
301 } 294 }
302 295
303 if (!object) { 296 if (!object) {
304 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 297 ACPI_ERROR((AE_INFO,
305 "Null Object! Obj=%p State=%p Num=%X\n", 298 "Null Object! Obj=%p State=%p Num=%X",
306 object, walk_state, 299 object, walk_state, state->results.num_results));
307 state->results.num_results));
308 return (AE_BAD_PARAMETER); 300 return (AE_BAD_PARAMETER);
309 } 301 }
310 302
@@ -413,10 +405,9 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
413 /* Check for stack overflow */ 405 /* Check for stack overflow */
414 406
415 if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { 407 if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) {
416 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 408 ACPI_ERROR((AE_INFO,
417 "overflow! Obj=%p State=%p #Ops=%X\n", 409 "Object stack overflow! Obj=%p State=%p #Ops=%X",
418 object, walk_state, 410 object, walk_state, walk_state->num_operands));
419 walk_state->num_operands));
420 return (AE_STACK_OVERFLOW); 411 return (AE_STACK_OVERFLOW);
421 } 412 }
422 413
@@ -460,10 +451,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
460 /* Check for stack underflow */ 451 /* Check for stack underflow */
461 452
462 if (walk_state->num_operands == 0) { 453 if (walk_state->num_operands == 0) {
463 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 454 ACPI_ERROR((AE_INFO,
464 "Underflow! Count=%X State=%p #Ops=%X\n", 455 "Object stack underflow! Count=%X State=%p #Ops=%X",
465 pop_count, walk_state, 456 pop_count, walk_state,
466 walk_state->num_operands)); 457 walk_state->num_operands));
467 return (AE_STACK_UNDERFLOW); 458 return (AE_STACK_UNDERFLOW);
468 } 459 }
469 460
@@ -506,10 +497,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
506 /* Check for stack underflow */ 497 /* Check for stack underflow */
507 498
508 if (walk_state->num_operands == 0) { 499 if (walk_state->num_operands == 0) {
509 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 500 ACPI_ERROR((AE_INFO,
510 "Underflow! Count=%X State=%p #Ops=%X\n", 501 "Object stack underflow! Count=%X State=%p #Ops=%X",
511 pop_count, walk_state, 502 pop_count, walk_state,
512 walk_state->num_operands)); 503 walk_state->num_operands));
513 return (AE_STACK_UNDERFLOW); 504 return (AE_STACK_UNDERFLOW);
514 } 505 }
515 506
@@ -826,16 +817,14 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
826 } 817 }
827 818
828 if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { 819 if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
829 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 820 ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
830 "%p is not a valid walk state\n", 821 walk_state));
831 walk_state));
832 return; 822 return;
833 } 823 }
834 824
835 if (walk_state->parser_state.scope) { 825 if (walk_state->parser_state.scope) {
836 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 826 ACPI_ERROR((AE_INFO, "%p walk still has a scope list",
837 "%p walk still has a scope list\n", 827 walk_state));
838 walk_state));
839 } 828 }
840 829
841 /* Always must free any linked control states */ 830 /* Always must free any linked control states */
@@ -894,25 +883,24 @@ acpi_ds_result_insert(void *object,
894 883
895 state = walk_state->results; 884 state = walk_state->results;
896 if (!state) { 885 if (!state) {
897 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 886 ACPI_ERROR((AE_INFO, "No result object pushed! State=%p",
898 "No result object pushed! State=%p\n", 887 walk_state));
899 walk_state));
900 return (AE_NOT_EXIST); 888 return (AE_NOT_EXIST);
901 } 889 }
902 890
903 if (index >= ACPI_OBJ_NUM_OPERANDS) { 891 if (index >= ACPI_OBJ_NUM_OPERANDS) {
904 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 892 ACPI_ERROR((AE_INFO,
905 "Index out of range: %X Obj=%p State=%p Num=%X\n", 893 "Index out of range: %X Obj=%p State=%p Num=%X",
906 index, object, walk_state, 894 index, object, walk_state,
907 state->results.num_results)); 895 state->results.num_results));
908 return (AE_BAD_PARAMETER); 896 return (AE_BAD_PARAMETER);
909 } 897 }
910 898
911 if (!object) { 899 if (!object) {
912 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 900 ACPI_ERROR((AE_INFO,
913 "Null Object! Index=%X Obj=%p State=%p Num=%X\n", 901 "Null Object! Index=%X Obj=%p State=%p Num=%X",
914 index, object, walk_state, 902 index, object, walk_state,
915 state->results.num_results)); 903 state->results.num_results));
916 return (AE_BAD_PARAMETER); 904 return (AE_BAD_PARAMETER);
917 } 905 }
918 906
@@ -986,9 +974,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
986 /* Check for stack underflow */ 974 /* Check for stack underflow */
987 975
988 if (walk_state->num_operands == 0) { 976 if (walk_state->num_operands == 0) {
989 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 977 ACPI_ERROR((AE_INFO,
990 "Missing operand/stack empty! State=%p #Ops=%X\n", 978 "Missing operand/stack empty! State=%p #Ops=%X",
991 walk_state, walk_state->num_operands)); 979 walk_state, walk_state->num_operands));
992 *object = NULL; 980 *object = NULL;
993 return (AE_AML_NO_OPERAND); 981 return (AE_AML_NO_OPERAND);
994 } 982 }
@@ -1000,9 +988,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
1000 /* Check for a valid operand */ 988 /* Check for a valid operand */
1001 989
1002 if (!walk_state->operands[walk_state->num_operands]) { 990 if (!walk_state->operands[walk_state->num_operands]) {
1003 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 991 ACPI_ERROR((AE_INFO,
1004 "Null operand! State=%p #Ops=%X\n", 992 "Null operand! State=%p #Ops=%X",
1005 walk_state, walk_state->num_operands)); 993 walk_state, walk_state->num_operands));
1006 *object = NULL; 994 *object = NULL;
1007 return (AE_AML_NO_OPERAND); 995 return (AE_AML_NO_OPERAND);
1008 } 996 }