nseval.c (197104) | nseval.c (199337) |
---|---|
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{ | 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 *RootObj; | 463 ACPI_OPERAND_OBJECT *ParentObj; 464 ACPI_NAMESPACE_NODE *ParentNode; 465 ACPI_OBJECT_TYPE Type; |
464 ACPI_STATUS Status; 465 466 467 ACPI_FUNCTION_TRACE (NsExecModuleCode); 468 469 | 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 |
|
470 /* Initialize the evaluation information block */ 471 472 ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); | 484 /* Initialize the evaluation information block */ 485 486 ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); |
473 Info->PrefixNode = AcpiGbl_RootNode; | 487 Info->PrefixNode = ParentNode; |
474 475 /* | 488 489 /* |
476 * Get the currently attached root object. Add a reference, because the | 490 * Get the currently attached parent object. Add a reference, because the |
477 * ref count will be decreased when the method object is installed to | 491 * ref count will be decreased when the method object is installed to |
478 * the root node. | 492 * the parent node. |
479 */ | 493 */ |
480 RootObj = AcpiNsGetAttachedObject (AcpiGbl_RootNode); 481 AcpiUtAddReference (RootObj); | 494 ParentObj = AcpiNsGetAttachedObject (ParentNode); 495 if (ParentObj) 496 { 497 AcpiUtAddReference (ParentObj); 498 } |
482 | 499 |
483 /* Install the method (module-level code) in the root node */ | 500 /* Install the method (module-level code) in the parent node */ |
484 | 501 |
485 Status = AcpiNsAttachObject (AcpiGbl_RootNode, MethodObj, | 502 Status = AcpiNsAttachObject (ParentNode, MethodObj, |
486 ACPI_TYPE_METHOD); 487 if (ACPI_FAILURE (Status)) 488 { 489 goto Exit; 490 } 491 | 503 ACPI_TYPE_METHOD); 504 if (ACPI_FAILURE (Status)) 505 { 506 goto Exit; 507 } 508 |
492 /* Execute the root node as a control method */ | 509 /* Execute the parent node as a control method */ |
493 494 Status = AcpiNsEvaluate (Info); 495 496 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p\n", 497 MethodObj->Method.AmlStart)); 498 499 /* Detach the temporary method object */ 500 | 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 |
501 AcpiNsDetachObject (AcpiGbl_RootNode); | 518 AcpiNsDetachObject (ParentNode); |
502 | 519 |
503 /* Restore the original root object */ | 520 /* Restore the original parent object */ |
504 | 521 |
505 Status = AcpiNsAttachObject (AcpiGbl_RootNode, RootObj, ACPI_TYPE_DEVICE); | 522 if (ParentObj) 523 { 524 Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); 525 } 526 else 527 { 528 ParentNode->Type = (UINT8) Type; 529 } |
506 507Exit: | 530 531Exit: |
508 AcpiUtRemoveReference (RootObj); | 532 if (ParentObj) 533 { 534 AcpiUtRemoveReference (ParentObj); 535 } |
509 return_VOID; 510} 511 | 536 return_VOID; 537} 538 |