evregion.c (245582) | evregion.c (249663) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: evregion - Operation Region support 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2013, Intel Corp. --- 46 unchanged lines hidden (view full) --- 55 56 57extern UINT8 AcpiGbl_DefaultAddressSpaces[]; 58 59/* Local prototypes */ 60 61static void 62AcpiEvOrphanEcRegMethod ( | 1/****************************************************************************** 2 * 3 * Module Name: evregion - Operation Region support 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2013, Intel Corp. --- 46 unchanged lines hidden (view full) --- 55 56 57extern UINT8 AcpiGbl_DefaultAddressSpaces[]; 58 59/* Local prototypes */ 60 61static void 62AcpiEvOrphanEcRegMethod ( |
63 void); | 63 ACPI_NAMESPACE_NODE *EcDeviceNode); |
64 65static ACPI_STATUS 66AcpiEvRegRun ( 67 ACPI_HANDLE ObjHandle, 68 UINT32 Level, 69 void *Context, 70 void **ReturnValue); 71 --- 487 unchanged lines hidden (view full) --- 559 560 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); 561 if (!Info) 562 { 563 return_ACPI_STATUS (AE_NO_MEMORY); 564 } 565 566 Info->PrefixNode = RegionObj2->Extra.Method_REG; | 64 65static ACPI_STATUS 66AcpiEvRegRun ( 67 ACPI_HANDLE ObjHandle, 68 UINT32 Level, 69 void *Context, 70 void **ReturnValue); 71 --- 487 unchanged lines hidden (view full) --- 559 560 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); 561 if (!Info) 562 { 563 return_ACPI_STATUS (AE_NO_MEMORY); 564 } 565 566 Info->PrefixNode = RegionObj2->Extra.Method_REG; |
567 Info->Pathname = NULL; | 567 Info->RelativePathname = NULL; |
568 Info->Parameters = Args; 569 Info->Flags = ACPI_IGNORE_RETURN_VALUE; 570 571 /* 572 * The _REG method has two arguments: 573 * 574 * Arg0 - Integer: 575 * Operation region space ID Same value as RegionObj->Region.SpaceId --- 69 unchanged lines hidden (view full) --- 645 Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, 646 ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, 647 &SpaceId, NULL); 648 649 /* Special case for EC: handle "orphan" _REG methods with no region */ 650 651 if (SpaceId == ACPI_ADR_SPACE_EC) 652 { | 568 Info->Parameters = Args; 569 Info->Flags = ACPI_IGNORE_RETURN_VALUE; 570 571 /* 572 * The _REG method has two arguments: 573 * 574 * Arg0 - Integer: 575 * Operation region space ID Same value as RegionObj->Region.SpaceId --- 69 unchanged lines hidden (view full) --- 645 Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, 646 ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, 647 &SpaceId, NULL); 648 649 /* Special case for EC: handle "orphan" _REG methods with no region */ 650 651 if (SpaceId == ACPI_ADR_SPACE_EC) 652 { |
653 AcpiEvOrphanEcRegMethod (); | 653 AcpiEvOrphanEcRegMethod (Node); |
654 } 655 656 return_ACPI_STATUS (Status); 657} 658 659 660/******************************************************************************* 661 * --- 61 unchanged lines hidden (view full) --- 723 return (Status); 724} 725 726 727/******************************************************************************* 728 * 729 * FUNCTION: AcpiEvOrphanEcRegMethod 730 * | 654 } 655 656 return_ACPI_STATUS (Status); 657} 658 659 660/******************************************************************************* 661 * --- 61 unchanged lines hidden (view full) --- 723 return (Status); 724} 725 726 727/******************************************************************************* 728 * 729 * FUNCTION: AcpiEvOrphanEcRegMethod 730 * |
731 * PARAMETERS: None | 731 * PARAMETERS: EcDeviceNode - Namespace node for an EC device |
732 * 733 * RETURN: None 734 * 735 * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC 736 * device. This is a _REG method that has no corresponding region 737 * within the EC device scope. The orphan _REG method appears to 738 * have been enabled by the description of the ECDT in the ACPI 739 * specification: "The availability of the region space can be 740 * detected by providing a _REG method object underneath the 741 * Embedded Controller device." 742 * | 732 * 733 * RETURN: None 734 * 735 * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC 736 * device. This is a _REG method that has no corresponding region 737 * within the EC device scope. The orphan _REG method appears to 738 * have been enabled by the description of the ECDT in the ACPI 739 * specification: "The availability of the region space can be 740 * detected by providing a _REG method object underneath the 741 * Embedded Controller device." 742 * |
743 * To quickly access the EC device, we use the EC_ID that appears 744 * within the ECDT. Otherwise, we would need to perform a time- 745 * consuming namespace walk, executing _HID methods to find the 746 * EC device. | 743 * To quickly access the EC device, we use the EcDeviceNode used 744 * during EC handler installation. Otherwise, we would need to 745 * perform a time consuming namespace walk, executing _HID 746 * methods to find the EC device. |
747 * | 747 * |
748 * MUTEX: Assumes the namespace is locked 749 * |
|
748 ******************************************************************************/ 749 750static void 751AcpiEvOrphanEcRegMethod ( | 750 ******************************************************************************/ 751 752static void 753AcpiEvOrphanEcRegMethod ( |
752 void) | 754 ACPI_NAMESPACE_NODE *EcDeviceNode) |
753{ | 755{ |
754 ACPI_TABLE_ECDT *Table; | 756 ACPI_HANDLE RegMethod; 757 ACPI_NAMESPACE_NODE *NextNode; |
755 ACPI_STATUS Status; 756 ACPI_OBJECT_LIST Args; 757 ACPI_OBJECT Objects[2]; | 758 ACPI_STATUS Status; 759 ACPI_OBJECT_LIST Args; 760 ACPI_OBJECT Objects[2]; |
758 ACPI_NAMESPACE_NODE *EcDeviceNode; 759 ACPI_NAMESPACE_NODE *RegMethod; 760 ACPI_NAMESPACE_NODE *NextNode; | |
761 762 763 ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); 764 765 | 761 762 763 ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); 764 765 |
766 /* Get the ECDT (if present in system) */ 767 768 Status = AcpiGetTable (ACPI_SIG_ECDT, 0, 769 ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table)); 770 if (ACPI_FAILURE (Status)) | 766 if (!EcDeviceNode) |
771 { 772 return_VOID; 773 } 774 | 767 { 768 return_VOID; 769 } 770 |
775 /* We need a valid EC_ID string */ 776 777 if (!(*Table->Id)) 778 { 779 return_VOID; 780 } 781 | |
782 /* Namespace is currently locked, must release */ 783 784 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 785 | 771 /* Namespace is currently locked, must release */ 772 773 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 774 |
786 /* Get a handle to the EC device referenced in the ECDT */ 787 788 Status = AcpiGetHandle (NULL, 789 ACPI_CAST_PTR (char, Table->Id), 790 ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode)); 791 if (ACPI_FAILURE (Status)) 792 { 793 goto Exit; 794 } 795 | |
796 /* Get a handle to a _REG method immediately under the EC device */ 797 | 775 /* Get a handle to a _REG method immediately under the EC device */ 776 |
798 Status = AcpiGetHandle (EcDeviceNode, 799 METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod)); | 777 Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod); |
800 if (ACPI_FAILURE (Status)) 801 { | 778 if (ACPI_FAILURE (Status)) 779 { |
802 goto Exit; | 780 goto Exit; /* There is no _REG method present */ |
803 } 804 805 /* 806 * Execute the _REG method only if there is no Operation Region in 807 * this scope with the Embedded Controller space ID. Otherwise, it 808 * will already have been executed. Note, this allows for Regions 809 * with other space IDs to be present; but the code below will then | 781 } 782 783 /* 784 * Execute the _REG method only if there is no Operation Region in 785 * this scope with the Embedded Controller space ID. Otherwise, it 786 * will already have been executed. Note, this allows for Regions 787 * with other space IDs to be present; but the code below will then |
810 * execute the _REG method with the EC space ID argument. | 788 * execute the _REG method with the EmbeddedControl SpaceID argument. |
811 */ 812 NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); 813 while (NextNode) 814 { 815 if ((NextNode->Type == ACPI_TYPE_REGION) && 816 (NextNode->Object) && 817 (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) 818 { | 789 */ 790 NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); 791 while (NextNode) 792 { 793 if ((NextNode->Type == ACPI_TYPE_REGION) && 794 (NextNode->Object) && 795 (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) 796 { |
819 goto Exit; /* Do not execute _REG */ | 797 goto Exit; /* Do not execute the _REG */ |
820 } | 798 } |
799 |
|
821 NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); 822 } 823 | 800 NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); 801 } 802 |
824 /* Evaluate the _REG(EC,Connect) method */ | 803 /* Evaluate the _REG(EmbeddedControl,Connect) method */ |
825 826 Args.Count = 2; 827 Args.Pointer = Objects; 828 Objects[0].Type = ACPI_TYPE_INTEGER; 829 Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; 830 Objects[1].Type = ACPI_TYPE_INTEGER; 831 Objects[1].Integer.Value = ACPI_REG_CONNECT; 832 833 Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL); 834 835Exit: 836 /* We ignore all errors from above, don't care */ 837 838 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 839 return_VOID; 840} | 804 805 Args.Count = 2; 806 Args.Pointer = Objects; 807 Objects[0].Type = ACPI_TYPE_INTEGER; 808 Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; 809 Objects[1].Type = ACPI_TYPE_INTEGER; 810 Objects[1].Integer.Value = ACPI_REG_CONNECT; 811 812 Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL); 813 814Exit: 815 /* We ignore all errors from above, don't care */ 816 817 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 818 return_VOID; 819} |