aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exresnte.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exresnte.c')
-rw-r--r--drivers/acpi/executer/exresnte.c172
1 files changed, 84 insertions, 88 deletions
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
index 21d5c74fa309..ff5d8f97e8eb 100644
--- a/drivers/acpi/executer/exresnte.c
+++ b/drivers/acpi/executer/exresnte.c
@@ -42,7 +42,6 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45
46#include <acpi/acpi.h> 45#include <acpi/acpi.h>
47#include <acpi/acdispat.h> 46#include <acpi/acdispat.h>
48#include <acpi/acinterp.h> 47#include <acpi/acinterp.h>
@@ -50,10 +49,8 @@
50#include <acpi/acparser.h> 49#include <acpi/acparser.h>
51#include <acpi/amlcode.h> 50#include <acpi/amlcode.h>
52 51
53
54#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exresnte") 53ACPI_MODULE_NAME("exresnte")
56
57 54
58/******************************************************************************* 55/*******************************************************************************
59 * 56 *
@@ -80,41 +77,37 @@
80 * ACPI_TYPE_PACKAGE 77 * ACPI_TYPE_PACKAGE
81 * 78 *
82 ******************************************************************************/ 79 ******************************************************************************/
83
84acpi_status 80acpi_status
85acpi_ex_resolve_node_to_value ( 81acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
86 struct acpi_namespace_node **object_ptr, 82 struct acpi_walk_state *walk_state)
87 struct acpi_walk_state *walk_state)
88
89{ 83{
90 acpi_status status = AE_OK; 84 acpi_status status = AE_OK;
91 union acpi_operand_object *source_desc; 85 union acpi_operand_object *source_desc;
92 union acpi_operand_object *obj_desc = NULL; 86 union acpi_operand_object *obj_desc = NULL;
93 struct acpi_namespace_node *node; 87 struct acpi_namespace_node *node;
94 acpi_object_type entry_type; 88 acpi_object_type entry_type;
95
96
97 ACPI_FUNCTION_TRACE ("ex_resolve_node_to_value");
98 89
90 ACPI_FUNCTION_TRACE("ex_resolve_node_to_value");
99 91
100 /* 92 /*
101 * The stack pointer points to a struct acpi_namespace_node (Node). Get the 93 * The stack pointer points to a struct acpi_namespace_node (Node). Get the
102 * object that is attached to the Node. 94 * object that is attached to the Node.
103 */ 95 */
104 node = *object_ptr; 96 node = *object_ptr;
105 source_desc = acpi_ns_get_attached_object (node); 97 source_desc = acpi_ns_get_attached_object(node);
106 entry_type = acpi_ns_get_type ((acpi_handle) node); 98 entry_type = acpi_ns_get_type((acpi_handle) node);
107 99
108 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", 100 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
109 node, source_desc, acpi_ut_get_type_name (entry_type))); 101 node, source_desc,
102 acpi_ut_get_type_name(entry_type)));
110 103
111 if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || 104 if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
112 (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { 105 (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
113 /* There is always exactly one level of indirection */ 106 /* There is always exactly one level of indirection */
114 107
115 node = ACPI_CAST_PTR (struct acpi_namespace_node, node->object); 108 node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
116 source_desc = acpi_ns_get_attached_object (node); 109 source_desc = acpi_ns_get_attached_object(node);
117 entry_type = acpi_ns_get_type ((acpi_handle) node); 110 entry_type = acpi_ns_get_type((acpi_handle) node);
118 *object_ptr = node; 111 *object_ptr = node;
119 } 112 }
120 113
@@ -124,14 +117,14 @@ acpi_ex_resolve_node_to_value (
124 * 2) Method locals and arguments have a pseudo-Node 117 * 2) Method locals and arguments have a pseudo-Node
125 */ 118 */
126 if (entry_type == ACPI_TYPE_DEVICE || 119 if (entry_type == ACPI_TYPE_DEVICE ||
127 (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { 120 (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
128 return_ACPI_STATUS (AE_OK); 121 return_ACPI_STATUS(AE_OK);
129 } 122 }
130 123
131 if (!source_desc) { 124 if (!source_desc) {
132 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n", 125 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
133 node)); 126 "No object attached to node %p\n", node));
134 return_ACPI_STATUS (AE_AML_NO_OPERAND); 127 return_ACPI_STATUS(AE_AML_NO_OPERAND);
135 } 128 }
136 129
137 /* 130 /*
@@ -141,83 +134,89 @@ acpi_ex_resolve_node_to_value (
141 switch (entry_type) { 134 switch (entry_type) {
142 case ACPI_TYPE_PACKAGE: 135 case ACPI_TYPE_PACKAGE:
143 136
144 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_PACKAGE) { 137 if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) {
145 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n", 138 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
146 acpi_ut_get_object_type_name (source_desc))); 139 "Object not a Package, type %s\n",
147 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 140 acpi_ut_get_object_type_name
141 (source_desc)));
142 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
148 } 143 }
149 144
150 status = acpi_ds_get_package_arguments (source_desc); 145 status = acpi_ds_get_package_arguments(source_desc);
151 if (ACPI_SUCCESS (status)) { 146 if (ACPI_SUCCESS(status)) {
152 /* Return an additional reference to the object */ 147 /* Return an additional reference to the object */
153 148
154 obj_desc = source_desc; 149 obj_desc = source_desc;
155 acpi_ut_add_reference (obj_desc); 150 acpi_ut_add_reference(obj_desc);
156 } 151 }
157 break; 152 break;
158 153
159
160 case ACPI_TYPE_BUFFER: 154 case ACPI_TYPE_BUFFER:
161 155
162 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { 156 if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
163 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n", 157 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
164 acpi_ut_get_object_type_name (source_desc))); 158 "Object not a Buffer, type %s\n",
165 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 159 acpi_ut_get_object_type_name
160 (source_desc)));
161 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
166 } 162 }
167 163
168 status = acpi_ds_get_buffer_arguments (source_desc); 164 status = acpi_ds_get_buffer_arguments(source_desc);
169 if (ACPI_SUCCESS (status)) { 165 if (ACPI_SUCCESS(status)) {
170 /* Return an additional reference to the object */ 166 /* Return an additional reference to the object */
171 167
172 obj_desc = source_desc; 168 obj_desc = source_desc;
173 acpi_ut_add_reference (obj_desc); 169 acpi_ut_add_reference(obj_desc);
174 } 170 }
175 break; 171 break;
176 172
177
178 case ACPI_TYPE_STRING: 173 case ACPI_TYPE_STRING:
179 174
180 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) { 175 if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) {
181 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n", 176 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
182 acpi_ut_get_object_type_name (source_desc))); 177 "Object not a String, type %s\n",
183 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 178 acpi_ut_get_object_type_name
179 (source_desc)));
180 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
184 } 181 }
185 182
186 /* Return an additional reference to the object */ 183 /* Return an additional reference to the object */
187 184
188 obj_desc = source_desc; 185 obj_desc = source_desc;
189 acpi_ut_add_reference (obj_desc); 186 acpi_ut_add_reference(obj_desc);
190 break; 187 break;
191 188
192
193 case ACPI_TYPE_INTEGER: 189 case ACPI_TYPE_INTEGER:
194 190
195 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) { 191 if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) {
196 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n", 192 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
197 acpi_ut_get_object_type_name (source_desc))); 193 "Object not a Integer, type %s\n",
198 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 194 acpi_ut_get_object_type_name
195 (source_desc)));
196 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
199 } 197 }
200 198
201 /* Return an additional reference to the object */ 199 /* Return an additional reference to the object */
202 200
203 obj_desc = source_desc; 201 obj_desc = source_desc;
204 acpi_ut_add_reference (obj_desc); 202 acpi_ut_add_reference(obj_desc);
205 break; 203 break;
206 204
207
208 case ACPI_TYPE_BUFFER_FIELD: 205 case ACPI_TYPE_BUFFER_FIELD:
209 case ACPI_TYPE_LOCAL_REGION_FIELD: 206 case ACPI_TYPE_LOCAL_REGION_FIELD:
210 case ACPI_TYPE_LOCAL_BANK_FIELD: 207 case ACPI_TYPE_LOCAL_BANK_FIELD:
211 case ACPI_TYPE_LOCAL_INDEX_FIELD: 208 case ACPI_TYPE_LOCAL_INDEX_FIELD:
212 209
213 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 210 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
214 "field_read Node=%p source_desc=%p Type=%X\n", 211 "field_read Node=%p source_desc=%p Type=%X\n",
215 node, source_desc, entry_type)); 212 node, source_desc, entry_type));
216 213
217 status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); 214 status =
215 acpi_ex_read_data_from_field(walk_state, source_desc,
216 &obj_desc);
218 break; 217 break;
219 218
220 /* For these objects, just return the object attached to the Node */ 219 /* For these objects, just return the object attached to the Node */
221 220
222 case ACPI_TYPE_MUTEX: 221 case ACPI_TYPE_MUTEX:
223 case ACPI_TYPE_METHOD: 222 case ACPI_TYPE_METHOD:
@@ -230,19 +229,18 @@ acpi_ex_resolve_node_to_value (
230 /* Return an additional reference to the object */ 229 /* Return an additional reference to the object */
231 230
232 obj_desc = source_desc; 231 obj_desc = source_desc;
233 acpi_ut_add_reference (obj_desc); 232 acpi_ut_add_reference(obj_desc);
234 break; 233 break;
235 234
236 /* TYPE_ANY is untyped, and thus there is no object associated with it */ 235 /* TYPE_ANY is untyped, and thus there is no object associated with it */
237 236
238 case ACPI_TYPE_ANY: 237 case ACPI_TYPE_ANY:
239 238
240 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 239 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
241 "Untyped entry %p, no attached object!\n", 240 "Untyped entry %p, no attached object!\n",
242 node)); 241 node));
243
244 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
245 242
243 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
246 244
247 case ACPI_TYPE_LOCAL_REFERENCE: 245 case ACPI_TYPE_LOCAL_REFERENCE:
248 246
@@ -253,39 +251,37 @@ acpi_ex_resolve_node_to_value (
253 /* Return an additional reference to the object */ 251 /* Return an additional reference to the object */
254 252
255 obj_desc = source_desc; 253 obj_desc = source_desc;
256 acpi_ut_add_reference (obj_desc); 254 acpi_ut_add_reference(obj_desc);
257 break; 255 break;
258 256
259 default: 257 default:
260 /* No named references are allowed here */ 258 /* No named references are allowed here */
261 259
262 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 260 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
263 "Unsupported Reference opcode %X (%s)\n", 261 "Unsupported Reference opcode %X (%s)\n",
264 source_desc->reference.opcode, 262 source_desc->reference.opcode,
265 acpi_ps_get_opcode_name (source_desc->reference.opcode))); 263 acpi_ps_get_opcode_name(source_desc->
264 reference.
265 opcode)));
266 266
267 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 267 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
268 } 268 }
269 break; 269 break;
270 270
271
272 default: 271 default:
273 272
274 /* Default case is for unknown types */ 273 /* Default case is for unknown types */
275 274
276 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 275 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
277 "Node %p - Unknown object type %X\n", 276 "Node %p - Unknown object type %X\n",
278 node, entry_type)); 277 node, entry_type));
279
280 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
281 278
282 } /* switch (entry_type) */ 279 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
283 280
281 } /* switch (entry_type) */
284 282
285 /* Return the object descriptor */ 283 /* Return the object descriptor */
286 284
287 *object_ptr = (void *) obj_desc; 285 *object_ptr = (void *)obj_desc;
288 return_ACPI_STATUS (status); 286 return_ACPI_STATUS(status);
289} 287}
290
291