1/******************************************************************************* 2 * 3 * Module Name: nseval - Object evaluation, includes control method execution 4 * 5 ******************************************************************************/ 6 7/****************************************************************************** 8 * --- 446 unchanged lines hidden (view full) --- 455 * 456 ******************************************************************************/ 457 458static void 459AcpiNsExecModuleCode ( 460 ACPI_OPERAND_OBJECT *MethodObj, 461 ACPI_EVALUATE_INFO *Info) 462{ |
463 ACPI_OPERAND_OBJECT *ParentObj; 464 ACPI_NAMESPACE_NODE *ParentNode; 465 ACPI_OBJECT_TYPE Type; |
466 ACPI_STATUS Status; 467 468 469 ACPI_FUNCTION_TRACE (NsExecModuleCode); 470 471 |
472 /* 473 * Get the parent node. We cheat by using the NextObject field 474 * of the method object descriptor. 475 */ 476 ParentNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, 477 MethodObj->Method.NextObject); 478 Type = AcpiNsGetType (ParentNode); 479 480 /* Must clear NextObject (AcpiNsAttachObject needs the field) */ 481 482 MethodObj->Method.NextObject = NULL; 483 |
484 /* Initialize the evaluation information block */ 485 486 ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); |
487 Info->PrefixNode = ParentNode; |
488 489 /* |
490 * Get the currently attached parent object. Add a reference, because the |
491 * ref count will be decreased when the method object is installed to |
492 * the parent node. |
493 */ |
494 ParentObj = AcpiNsGetAttachedObject (ParentNode); 495 if (ParentObj) 496 { 497 AcpiUtAddReference (ParentObj); 498 } |
499 |
500 /* Install the method (module-level code) in the parent node */ |
501 |
502 Status = AcpiNsAttachObject (ParentNode, MethodObj, |
503 ACPI_TYPE_METHOD); 504 if (ACPI_FAILURE (Status)) 505 { 506 goto Exit; 507 } 508 |
509 /* Execute the parent node as a control method */ |
510 511 Status = AcpiNsEvaluate (Info); 512 513 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p\n", 514 MethodObj->Method.AmlStart)); 515 516 /* Detach the temporary method object */ 517 |
518 AcpiNsDetachObject (ParentNode); |
519 |
520 /* Restore the original parent object */ |
521 |
522 if (ParentObj) 523 { 524 Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); 525 } 526 else 527 { 528 ParentNode->Type = (UINT8) Type; 529 } |
530 531Exit: |
532 if (ParentObj) 533 { 534 AcpiUtRemoveReference (ParentObj); 535 } |
536 return_VOID; 537} 538 |