Path: blob/main/sys/contrib/dev/acpica/components/events/evrgnini.c
48525 views
/******************************************************************************1*2* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#include <contrib/dev/acpica/include/acpi.h>152#include <contrib/dev/acpica/include/accommon.h>153#include <contrib/dev/acpica/include/acevents.h>154#include <contrib/dev/acpica/include/acnamesp.h>155#include <contrib/dev/acpica/include/acinterp.h>156157#define _COMPONENT ACPI_EVENTS158ACPI_MODULE_NAME ("evrgnini")159160161/*******************************************************************************162*163* FUNCTION: AcpiEvSystemMemoryRegionSetup164*165* PARAMETERS: Handle - Region we are interested in166* Function - Start or stop167* HandlerContext - Address space handler context168* RegionContext - Region specific context169*170* RETURN: Status171*172* DESCRIPTION: Setup a SystemMemory operation region173*174******************************************************************************/175176ACPI_STATUS177AcpiEvSystemMemoryRegionSetup (178ACPI_HANDLE Handle,179UINT32 Function,180void *HandlerContext,181void **RegionContext)182{183ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle;184ACPI_MEM_SPACE_CONTEXT *LocalRegionContext;185ACPI_MEM_MAPPING *Mm;186187188ACPI_FUNCTION_TRACE (EvSystemMemoryRegionSetup);189190191if (Function == ACPI_REGION_DEACTIVATE)192{193if (*RegionContext)194{195LocalRegionContext = (ACPI_MEM_SPACE_CONTEXT *) *RegionContext;196197/* Delete memory mappings if present */198199while (LocalRegionContext->FirstMm)200{201Mm = LocalRegionContext->FirstMm;202LocalRegionContext->FirstMm = Mm->NextMm;203AcpiOsUnmapMemory(Mm->LogicalAddress, Mm->Length);204ACPI_FREE(Mm);205}206ACPI_FREE (LocalRegionContext);207*RegionContext = NULL;208}209return_ACPI_STATUS (AE_OK);210}211212/* Create a new context */213214LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_MEM_SPACE_CONTEXT));215if (!(LocalRegionContext))216{217return_ACPI_STATUS (AE_NO_MEMORY);218}219220/* Save the region length and address for use in the handler */221222LocalRegionContext->Length = RegionDesc->Region.Length;223LocalRegionContext->Address = RegionDesc->Region.Address;224225*RegionContext = LocalRegionContext;226return_ACPI_STATUS (AE_OK);227}228229230/*******************************************************************************231*232* FUNCTION: AcpiEvIoSpaceRegionSetup233*234* PARAMETERS: Handle - Region we are interested in235* Function - Start or stop236* HandlerContext - Address space handler context237* RegionContext - Region specific context238*239* RETURN: Status240*241* DESCRIPTION: Setup a IO operation region242*243******************************************************************************/244245ACPI_STATUS246AcpiEvIoSpaceRegionSetup (247ACPI_HANDLE Handle,248UINT32 Function,249void *HandlerContext,250void **RegionContext)251{252ACPI_FUNCTION_TRACE (EvIoSpaceRegionSetup);253254255if (Function == ACPI_REGION_DEACTIVATE)256{257*RegionContext = NULL;258}259else260{261*RegionContext = HandlerContext;262}263264return_ACPI_STATUS (AE_OK);265}266267268/*******************************************************************************269*270* FUNCTION: AcpiEvPciConfigRegionSetup271*272* PARAMETERS: Handle - Region we are interested in273* Function - Start or stop274* HandlerContext - Address space handler context275* RegionContext - Region specific context276*277* RETURN: Status278*279* DESCRIPTION: Setup a PCI_Config operation region280*281* MUTEX: Assumes namespace is not locked282*283******************************************************************************/284285ACPI_STATUS286AcpiEvPciConfigRegionSetup (287ACPI_HANDLE Handle,288UINT32 Function,289void *HandlerContext,290void **RegionContext)291{292ACPI_STATUS Status = AE_OK;293UINT64 PciValue;294ACPI_PCI_ID *PciId = *RegionContext;295ACPI_OPERAND_OBJECT *HandlerObj;296ACPI_NAMESPACE_NODE *ParentNode;297ACPI_NAMESPACE_NODE *PciRootNode;298ACPI_NAMESPACE_NODE *PciDeviceNode;299ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle;300301302ACPI_FUNCTION_TRACE (EvPciConfigRegionSetup);303304305HandlerObj = RegionObj->Region.Handler;306if (!HandlerObj)307{308/*309* No installed handler. This shouldn't happen because the dispatch310* routine checks before we get here, but we check again just in case.311*/312ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,313"Attempting to init a region %p, with no handler\n", RegionObj));314return_ACPI_STATUS (AE_NOT_EXIST);315}316317*RegionContext = NULL;318if (Function == ACPI_REGION_DEACTIVATE)319{320if (PciId)321{322ACPI_FREE (PciId);323}324return_ACPI_STATUS (Status);325}326327ParentNode = RegionObj->Region.Node->Parent;328329/*330* Get the _SEG and _BBN values from the device upon which the handler331* is installed.332*333* We need to get the _SEG and _BBN objects relative to the PCI BUS device.334* This is the device the handler has been registered to handle.335*/336337/*338* If the AddressSpace.Node is still pointing to the root, we need339* to scan upward for a PCI Root bridge and re-associate the OpRegion340* handlers with that device.341*/342if (HandlerObj->AddressSpace.Node == AcpiGbl_RootNode)343{344/* Start search from the parent object */345346PciRootNode = ParentNode;347while (PciRootNode != AcpiGbl_RootNode)348{349/* Get the _HID/_CID in order to detect a RootBridge */350351if (AcpiEvIsPciRootBridge (PciRootNode))352{353/* Install a handler for this PCI root bridge */354355Status = AcpiInstallAddressSpaceHandler (356(ACPI_HANDLE) PciRootNode,357ACPI_ADR_SPACE_PCI_CONFIG,358ACPI_DEFAULT_HANDLER, NULL, NULL);359if (ACPI_FAILURE (Status))360{361if (Status == AE_SAME_HANDLER)362{363/*364* It is OK if the handler is already installed on the365* root bridge. Still need to return a context object366* for the new PCI_Config operation region, however.367*/368}369else370{371ACPI_EXCEPTION ((AE_INFO, Status,372"Could not install PciConfig handler "373"for Root Bridge %4.4s",374AcpiUtGetNodeName (PciRootNode)));375}376}377break;378}379380PciRootNode = PciRootNode->Parent;381}382383/* PCI root bridge not found, use namespace root node */384}385else386{387PciRootNode = HandlerObj->AddressSpace.Node;388}389390/*391* If this region is now initialized, we are done.392* (InstallAddressSpaceHandler could have initialized it)393*/394if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)395{396return_ACPI_STATUS (AE_OK);397}398399/* Region is still not initialized. Create a new context */400401PciId = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PCI_ID));402if (!PciId)403{404return_ACPI_STATUS (AE_NO_MEMORY);405}406407/*408* For PCI_Config space access, we need the segment, bus, device and409* function numbers. Acquire them here.410*411* Find the parent device object. (This allows the operation region to be412* within a subscope under the device, such as a control method.)413*/414PciDeviceNode = RegionObj->Region.Node;415while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE))416{417PciDeviceNode = PciDeviceNode->Parent;418}419420if (!PciDeviceNode)421{422ACPI_FREE (PciId);423return_ACPI_STATUS (AE_AML_OPERAND_TYPE);424}425426/*427* Get the PCI device and function numbers from the _ADR object428* contained in the parent's scope.429*/430Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,431PciDeviceNode, &PciValue);432433/*434* The default is zero, and since the allocation above zeroed the data,435* just do nothing on failure.436*/437if (ACPI_SUCCESS (Status))438{439PciId->Device = ACPI_HIWORD (ACPI_LODWORD (PciValue));440PciId->Function = ACPI_LOWORD (ACPI_LODWORD (PciValue));441}442443/* The PCI segment number comes from the _SEG method */444445Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG,446PciRootNode, &PciValue);447if (ACPI_SUCCESS (Status))448{449PciId->Segment = ACPI_LOWORD (PciValue);450}451452/* The PCI bus number comes from the _BBN method */453454Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN,455PciRootNode, &PciValue);456if (ACPI_SUCCESS (Status))457{458PciId->Bus = ACPI_LOWORD (PciValue);459}460461/* Complete/update the PCI ID for this device */462463Status = AcpiHwDerivePciId (PciId, PciRootNode, RegionObj->Region.Node);464if (ACPI_FAILURE (Status))465{466ACPI_FREE (PciId);467return_ACPI_STATUS (Status);468}469470*RegionContext = PciId;471return_ACPI_STATUS (AE_OK);472}473474475/*******************************************************************************476*477* FUNCTION: AcpiEvIsPciRootBridge478*479* PARAMETERS: Node - Device node being examined480*481* RETURN: TRUE if device is a PCI/PCI-Express Root Bridge482*483* DESCRIPTION: Determine if the input device represents a PCI Root Bridge by484* examining the _HID and _CID for the device.485*486******************************************************************************/487488BOOLEAN489AcpiEvIsPciRootBridge (490ACPI_NAMESPACE_NODE *Node)491{492ACPI_STATUS Status;493ACPI_PNP_DEVICE_ID *Hid;494ACPI_PNP_DEVICE_ID_LIST *Cid;495UINT32 i;496BOOLEAN Match;497498499/* Get the _HID and check for a PCI Root Bridge */500501Status = AcpiUtExecute_HID (Node, &Hid);502if (ACPI_FAILURE (Status))503{504return (FALSE);505}506507Match = AcpiUtIsPciRootBridge (Hid->String);508ACPI_FREE (Hid);509510if (Match)511{512return (TRUE);513}514515/* The _HID did not match. Get the _CID and check for a PCI Root Bridge */516517Status = AcpiUtExecute_CID (Node, &Cid);518if (ACPI_FAILURE (Status))519{520return (FALSE);521}522523/* Check all _CIDs in the returned list */524525for (i = 0; i < Cid->Count; i++)526{527if (AcpiUtIsPciRootBridge (Cid->Ids[i].String))528{529ACPI_FREE (Cid);530return (TRUE);531}532}533534ACPI_FREE (Cid);535return (FALSE);536}537538539/*******************************************************************************540*541* FUNCTION: AcpiEvPciBarRegionSetup542*543* PARAMETERS: Handle - Region we are interested in544* Function - Start or stop545* HandlerContext - Address space handler context546* RegionContext - Region specific context547*548* RETURN: Status549*550* DESCRIPTION: Setup a PciBAR operation region551*552* MUTEX: Assumes namespace is not locked553*554******************************************************************************/555556ACPI_STATUS557AcpiEvPciBarRegionSetup (558ACPI_HANDLE Handle,559UINT32 Function,560void *HandlerContext,561void **RegionContext)562{563ACPI_FUNCTION_TRACE (EvPciBarRegionSetup);564565566return_ACPI_STATUS (AE_OK);567}568569570/*******************************************************************************571*572* FUNCTION: AcpiEvCmosRegionSetup573*574* PARAMETERS: Handle - Region we are interested in575* Function - Start or stop576* HandlerContext - Address space handler context577* RegionContext - Region specific context578*579* RETURN: Status580*581* DESCRIPTION: Setup a CMOS operation region582*583* MUTEX: Assumes namespace is not locked584*585******************************************************************************/586587ACPI_STATUS588AcpiEvCmosRegionSetup (589ACPI_HANDLE Handle,590UINT32 Function,591void *HandlerContext,592void **RegionContext)593{594ACPI_FUNCTION_TRACE (EvCmosRegionSetup);595596597return_ACPI_STATUS (AE_OK);598}599600601/*******************************************************************************602*603* FUNCTION: AcpiEvDataTableRegionSetup604*605* PARAMETERS: Handle - Region we are interested in606* Function - Start or stop607* HandlerContext - Address space handler context608* RegionContext - Region specific context609*610* RETURN: Status611*612* DESCRIPTION: Setup a DataTableRegion613*614* MUTEX: Assumes namespace is not locked615*616******************************************************************************/617618ACPI_STATUS619AcpiEvDataTableRegionSetup (620ACPI_HANDLE Handle,621UINT32 Function,622void *HandlerContext,623void **RegionContext)624{625ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle;626ACPI_DATA_TABLE_MAPPING *LocalRegionContext;627628629ACPI_FUNCTION_TRACE (EvDataTableRegionSetup);630631632if (Function == ACPI_REGION_DEACTIVATE)633{634if (*RegionContext)635{636ACPI_FREE (*RegionContext);637*RegionContext = NULL;638}639return_ACPI_STATUS (AE_OK);640}641642/* Create a new context */643644LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DATA_TABLE_MAPPING));645if (!(LocalRegionContext))646{647return_ACPI_STATUS (AE_NO_MEMORY);648}649650/* Save the data table pointer for use in the handler */651652LocalRegionContext->Pointer = RegionDesc->Region.Pointer;653654*RegionContext = LocalRegionContext;655return_ACPI_STATUS (AE_OK);656}657658659/*******************************************************************************660*661* FUNCTION: AcpiEvDefaultRegionSetup662*663* PARAMETERS: Handle - Region we are interested in664* Function - Start or stop665* HandlerContext - Address space handler context666* RegionContext - Region specific context667*668* RETURN: Status669*670* DESCRIPTION: Default region initialization671*672******************************************************************************/673674ACPI_STATUS675AcpiEvDefaultRegionSetup (676ACPI_HANDLE Handle,677UINT32 Function,678void *HandlerContext,679void **RegionContext)680{681ACPI_FUNCTION_TRACE (EvDefaultRegionSetup);682683684if (Function == ACPI_REGION_DEACTIVATE)685{686*RegionContext = NULL;687}688else689{690*RegionContext = HandlerContext;691}692693return_ACPI_STATUS (AE_OK);694}695696697/*******************************************************************************698*699* FUNCTION: AcpiEvInitializeRegion700*701* PARAMETERS: RegionObj - Region we are initializing702*703* RETURN: Status704*705* DESCRIPTION: Initializes the region, finds any _REG methods and saves them706* for execution at a later time707*708* Get the appropriate address space handler for a newly709* created region.710*711* This also performs address space specific initialization. For712* example, PCI regions must have an _ADR object that contains713* a PCI address in the scope of the definition. This address is714* required to perform an access to PCI config space.715*716* MUTEX: Interpreter should be unlocked, because we may run the _REG717* method for this region.718*719* NOTE: Possible incompliance:720* There is a behavior conflict in automatic _REG execution:721* 1. When the interpreter is evaluating a method, we can only722* automatically run _REG for the following case:723* Method(_REG, 2) {}724* OperationRegion (OPR1, 0x80, 0x1000010, 0x4)725* 2. When the interpreter is loading a table, we can also726* automatically run _REG for the following case:727* OperationRegion (OPR1, 0x80, 0x1000010, 0x4)728* Method(_REG, 2) {}729* Though this may not be compliant to the de-facto standard, the730* logic is kept in order not to trigger regressions. And keeping731* this logic should be taken care by the caller of this function.732*733******************************************************************************/734735ACPI_STATUS736AcpiEvInitializeRegion (737ACPI_OPERAND_OBJECT *RegionObj)738{739ACPI_OPERAND_OBJECT *HandlerObj;740ACPI_OPERAND_OBJECT *ObjDesc;741ACPI_ADR_SPACE_TYPE SpaceId;742ACPI_NAMESPACE_NODE *Node;743744745ACPI_FUNCTION_TRACE (EvInitializeRegion);746747748if (!RegionObj)749{750return_ACPI_STATUS (AE_BAD_PARAMETER);751}752753if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED)754{755return_ACPI_STATUS (AE_OK);756}757758RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;759760Node = RegionObj->Region.Node->Parent;761SpaceId = RegionObj->Region.SpaceId;762763/*764* The following loop depends upon the root Node having no parent765* ie: AcpiGbl_RootNode->Parent being set to NULL766*/767while (Node)768{769/* Check to see if a handler exists */770771HandlerObj = NULL;772ObjDesc = AcpiNsGetAttachedObject (Node);773if (ObjDesc)774{775/* Can only be a handler if the object exists */776777switch (Node->Type)778{779case ACPI_TYPE_DEVICE:780case ACPI_TYPE_PROCESSOR:781case ACPI_TYPE_THERMAL:782783HandlerObj = ObjDesc->CommonNotify.Handler;784break;785786default:787788/* Ignore other objects */789790break;791}792793HandlerObj = AcpiEvFindRegionHandler (SpaceId, HandlerObj);794if (HandlerObj)795{796/* Found correct handler */797798ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,799"Found handler %p for region %p in obj %p\n",800HandlerObj, RegionObj, ObjDesc));801802(void) AcpiEvAttachRegion (HandlerObj, RegionObj, FALSE);803804/*805* Tell all users that this region is usable by806* running the _REG method807*/808AcpiExExitInterpreter ();809(void) AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT);810AcpiExEnterInterpreter ();811return_ACPI_STATUS (AE_OK);812}813}814815/* This node does not have the handler we need; Pop up one level */816817Node = Node->Parent;818}819820/*821* If we get here, there is no handler for this region. This is not822* fatal because many regions get created before a handler is installed823* for said region.824*/825ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,826"No handler for RegionType %s(%X) (RegionObj %p)\n",827AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj));828829return_ACPI_STATUS (AE_OK);830}831832833