This source file includes following definitions.
- ACPI_MODULE_NAME
1
2
3
4
5
6
7
8 #include <acpi/acpi.h>
9 #include "accommon.h"
10 #include "acparser.h"
11 #include "acinterp.h"
12 #include "acnamesp.h"
13
14 #define _COMPONENT ACPI_NAMESPACE
15 ACPI_MODULE_NAME("nseval")
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
43 {
44 acpi_status status;
45
46 ACPI_FUNCTION_TRACE(ns_evaluate);
47
48 if (!info) {
49 return_ACPI_STATUS(AE_BAD_PARAMETER);
50 }
51
52 if (!info->node) {
53
54
55
56
57
58
59
60
61 status =
62 acpi_ns_get_node(info->prefix_node, info->relative_pathname,
63 ACPI_NS_NO_UPSEARCH, &info->node);
64 if (ACPI_FAILURE(status)) {
65 return_ACPI_STATUS(status);
66 }
67 }
68
69
70
71
72
73 if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
74 info->node =
75 ACPI_CAST_PTR(struct acpi_namespace_node,
76 info->node->object);
77 }
78
79
80
81 info->return_object = NULL;
82 info->node_flags = info->node->flags;
83 info->obj_desc = acpi_ns_get_attached_object(info->node);
84
85 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
86 info->relative_pathname, info->node,
87 acpi_ns_get_attached_object(info->node)));
88
89
90
91 info->predefined =
92 acpi_ut_match_predefined_method(info->node->name.ascii);
93
94
95
96 info->full_pathname = acpi_ns_get_normalized_pathname(info->node, TRUE);
97 if (!info->full_pathname) {
98 return_ACPI_STATUS(AE_NO_MEMORY);
99 }
100
101
102
103 ACPI_DEBUG_PRINT_RAW((ACPI_DB_EVALUATION,
104 "%-26s: %s (%s)\n", " Enter evaluation",
105 &info->full_pathname[1],
106 acpi_ut_get_type_name(info->node->type)));
107
108
109
110 info->param_count = 0;
111 if (info->parameters) {
112 while (info->parameters[info->param_count]) {
113 info->param_count++;
114 }
115
116
117
118 if (info->param_count > ACPI_METHOD_NUM_ARGS) {
119 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
120 ACPI_WARN_ALWAYS,
121 "Excess arguments (%u) - using only %u",
122 info->param_count,
123 ACPI_METHOD_NUM_ARGS));
124
125 info->param_count = ACPI_METHOD_NUM_ARGS;
126 }
127 }
128
129
130
131
132
133 acpi_ns_check_acpi_compliance(info->full_pathname, info->node,
134 info->predefined);
135
136
137
138
139
140 acpi_ns_check_argument_count(info->full_pathname, info->node,
141 info->param_count, info->predefined);
142
143
144
145 acpi_ns_check_argument_types(info);
146
147
148
149
150
151
152
153
154 switch (acpi_ns_get_type(info->node)) {
155 case ACPI_TYPE_ANY:
156 case ACPI_TYPE_DEVICE:
157 case ACPI_TYPE_EVENT:
158 case ACPI_TYPE_MUTEX:
159 case ACPI_TYPE_REGION:
160 case ACPI_TYPE_THERMAL:
161 case ACPI_TYPE_LOCAL_SCOPE:
162
163
164
165
166 ACPI_ERROR((AE_INFO,
167 "%s: This object type [%s] "
168 "never contains data and cannot be evaluated",
169 info->full_pathname,
170 acpi_ut_get_type_name(info->node->type)));
171
172 status = AE_TYPE;
173 goto cleanup;
174
175 case ACPI_TYPE_METHOD:
176
177
178
179
180
181
182 if (!info->obj_desc) {
183 ACPI_ERROR((AE_INFO,
184 "%s: Method has no attached sub-object",
185 info->full_pathname));
186 status = AE_NULL_OBJECT;
187 goto cleanup;
188 }
189
190 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
191 "**** Execute method [%s] at AML address %p length %X\n",
192 info->full_pathname,
193 info->obj_desc->method.aml_start + 1,
194 info->obj_desc->method.aml_length - 1));
195
196
197
198
199
200
201
202
203
204 acpi_ex_enter_interpreter();
205 status = acpi_ps_execute_method(info);
206 acpi_ex_exit_interpreter();
207 break;
208
209 default:
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230 acpi_ex_enter_interpreter();
231
232
233
234 info->return_object =
235 ACPI_CAST_PTR(union acpi_operand_object, info->node);
236
237 status =
238 acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
239 (struct acpi_namespace_node,
240 &info->return_object), NULL);
241 acpi_ex_exit_interpreter();
242
243 if (ACPI_FAILURE(status)) {
244 info->return_object = NULL;
245 goto cleanup;
246 }
247
248 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Returned object %p [%s]\n",
249 info->return_object,
250 acpi_ut_get_object_type_name(info->
251 return_object)));
252
253 status = AE_CTRL_RETURN_VALUE;
254 break;
255 }
256
257
258
259
260
261 (void)acpi_ns_check_return_value(info->node, info, info->param_count,
262 status, &info->return_object);
263
264
265
266 if (status == AE_CTRL_RETURN_VALUE) {
267
268
269
270 if (info->flags & ACPI_IGNORE_RETURN_VALUE) {
271 acpi_ut_remove_reference(info->return_object);
272 info->return_object = NULL;
273 }
274
275
276
277 status = AE_OK;
278 } else if (ACPI_FAILURE(status)) {
279
280
281
282 if (info->return_object) {
283 acpi_ut_remove_reference(info->return_object);
284 info->return_object = NULL;
285 }
286 }
287
288 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
289 "*** Completed evaluation of object %s ***\n",
290 info->relative_pathname));
291
292 cleanup:
293
294
295 ACPI_DEBUG_PRINT_RAW((ACPI_DB_EVALUATION,
296 "%-26s: %s\n", " Exit evaluation",
297 &info->full_pathname[1]));
298
299
300
301
302
303 ACPI_FREE(info->full_pathname);
304 info->full_pathname = NULL;
305 return_ACPI_STATUS(status);
306 }