diff options
author | Valery Podrezov <valery.a.podrezov@intel.com> | 2007-02-02 11:48:21 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-02 21:14:27 -0500 |
commit | 9bc75cff4919f9d947982d805aed89582a20d04d (patch) | |
tree | d07b8eb59b0dd6384f8fc5694113759ef7b8668e /drivers/acpi/parser | |
parent | 4d0b4af958453afe871022e44abd57fac09baf67 (diff) |
ACPICA: Eliminate control method 2-pass parse/execute.
Completed an AML interpreter performance enhancement for control method
execution. Previously a 2-pass parse/execution, control methods are now
completely parsed and executed in single pass. This improves overall
interpreter performance by ~25%, reduces code size, and reduces CPU stack use.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/parser')
-rw-r--r-- | drivers/acpi/parser/psloop.c | 2 | ||||
-rw-r--r-- | drivers/acpi/parser/psxface.c | 114 |
2 files changed, 38 insertions, 78 deletions
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index a83be5201856..881687ca3154 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -226,7 +226,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | |||
226 | return_ACPI_STATUS(status); | 226 | return_ACPI_STATUS(status); |
227 | } | 227 | } |
228 | 228 | ||
229 | if (!op) { | 229 | if (!*op) { |
230 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | 230 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); |
231 | } | 231 | } |
232 | 232 | ||
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 5d996c1140af..9069c697cf1d 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -54,8 +54,6 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info); | |||
54 | 54 | ||
55 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info); | 55 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info); |
56 | 56 | ||
57 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info); | ||
58 | |||
59 | static void | 57 | static void |
60 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action); | 58 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action); |
61 | 59 | ||
@@ -215,6 +213,8 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) | |||
215 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) | 213 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) |
216 | { | 214 | { |
217 | acpi_status status; | 215 | acpi_status status; |
216 | union acpi_parse_object *op; | ||
217 | struct acpi_walk_state *walk_state; | ||
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE(ps_execute_method); | 219 | ACPI_FUNCTION_TRACE(ps_execute_method); |
220 | 220 | ||
@@ -234,8 +234,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | /* | 236 | /* |
237 | * The caller "owns" the parameters, so give each one an extra | 237 | * The caller "owns" the parameters, so give each one an extra reference |
238 | * reference | ||
239 | */ | 238 | */ |
240 | acpi_ps_update_parameter_list(info, REF_INCREMENT); | 239 | acpi_ps_update_parameter_list(info, REF_INCREMENT); |
241 | 240 | ||
@@ -244,30 +243,50 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) | |||
244 | acpi_ps_start_trace(info); | 243 | acpi_ps_start_trace(info); |
245 | 244 | ||
246 | /* | 245 | /* |
247 | * 1) Perform the first pass parse of the method to enter any | 246 | * Execute the method. Performs parse simultaneously |
248 | * named objects that it creates into the namespace | ||
249 | */ | 247 | */ |
250 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 248 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
251 | "**** Begin Method Parse **** Entry=%p obj=%p\n", | 249 | "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n", |
252 | info->resolved_node, info->obj_desc)); | 250 | info->resolved_node->name.ascii, info->resolved_node, |
251 | info->obj_desc)); | ||
253 | 252 | ||
254 | info->pass_number = 1; | 253 | /* Create and init a Root Node */ |
255 | status = acpi_ps_execute_pass(info); | 254 | |
256 | if (ACPI_FAILURE(status)) { | 255 | op = acpi_ps_create_scope_op(); |
256 | if (!op) { | ||
257 | status = AE_NO_MEMORY; | ||
257 | goto cleanup; | 258 | goto cleanup; |
258 | } | 259 | } |
259 | 260 | ||
260 | /* | 261 | /* Create and initialize a new walk state */ |
261 | * 2) Execute the method. Performs second pass parse simultaneously | ||
262 | */ | ||
263 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
264 | "**** Begin Method Execution **** Entry=%p obj=%p\n", | ||
265 | info->resolved_node, info->obj_desc)); | ||
266 | 262 | ||
267 | info->pass_number = 3; | 263 | info->pass_number = 3; |
268 | status = acpi_ps_execute_pass(info); | 264 | walk_state = |
265 | acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL, | ||
266 | NULL, NULL); | ||
267 | if (!walk_state) { | ||
268 | status = AE_NO_MEMORY; | ||
269 | goto cleanup; | ||
270 | } | ||
271 | |||
272 | status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, | ||
273 | info->obj_desc->method.aml_start, | ||
274 | info->obj_desc->method.aml_length, info, | ||
275 | info->pass_number); | ||
276 | if (ACPI_FAILURE(status)) { | ||
277 | acpi_ds_delete_walk_state(walk_state); | ||
278 | goto cleanup; | ||
279 | } | ||
280 | |||
281 | /* Parse the AML */ | ||
282 | |||
283 | status = acpi_ps_parse_aml(walk_state); | ||
284 | |||
285 | /* walk_state was deleted by parse_aml */ | ||
269 | 286 | ||
270 | cleanup: | 287 | cleanup: |
288 | acpi_ps_delete_parse_tree(op); | ||
289 | |||
271 | /* End optional tracing */ | 290 | /* End optional tracing */ |
272 | 291 | ||
273 | acpi_ps_stop_trace(info); | 292 | acpi_ps_stop_trace(info); |
@@ -330,62 +349,3 @@ acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) | |||
330 | } | 349 | } |
331 | } | 350 | } |
332 | } | 351 | } |
333 | |||
334 | /******************************************************************************* | ||
335 | * | ||
336 | * FUNCTION: acpi_ps_execute_pass | ||
337 | * | ||
338 | * PARAMETERS: Info - See struct acpi_evaluate_info | ||
339 | * (Used: pass_number, Node, and obj_desc) | ||
340 | * | ||
341 | * RETURN: Status | ||
342 | * | ||
343 | * DESCRIPTION: Single AML pass: Parse or Execute a control method | ||
344 | * | ||
345 | ******************************************************************************/ | ||
346 | |||
347 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info) | ||
348 | { | ||
349 | acpi_status status; | ||
350 | union acpi_parse_object *op; | ||
351 | struct acpi_walk_state *walk_state; | ||
352 | |||
353 | ACPI_FUNCTION_TRACE(ps_execute_pass); | ||
354 | |||
355 | /* Create and init a Root Node */ | ||
356 | |||
357 | op = acpi_ps_create_scope_op(); | ||
358 | if (!op) { | ||
359 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
360 | } | ||
361 | |||
362 | /* Create and initialize a new walk state */ | ||
363 | |||
364 | walk_state = | ||
365 | acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL, | ||
366 | NULL, NULL); | ||
367 | if (!walk_state) { | ||
368 | status = AE_NO_MEMORY; | ||
369 | goto cleanup; | ||
370 | } | ||
371 | |||
372 | status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, | ||
373 | info->obj_desc->method.aml_start, | ||
374 | info->obj_desc->method.aml_length, | ||
375 | info->pass_number == 1 ? NULL : info, | ||
376 | info->pass_number); | ||
377 | if (ACPI_FAILURE(status)) { | ||
378 | acpi_ds_delete_walk_state(walk_state); | ||
379 | goto cleanup; | ||
380 | } | ||
381 | |||
382 | /* Parse the AML */ | ||
383 | |||
384 | status = acpi_ps_parse_aml(walk_state); | ||
385 | |||
386 | /* Walk state was deleted by parse_aml */ | ||
387 | |||
388 | cleanup: | ||
389 | acpi_ps_delete_parse_tree(op); | ||
390 | return_ACPI_STATUS(status); | ||
391 | } | ||