1efcc2a30SJung-uk Kim /****************************************************************************** 2efcc2a30SJung-uk Kim * 3efcc2a30SJung-uk Kim * Module Name: evhandler - Support for Address Space handlers 4efcc2a30SJung-uk Kim * 5efcc2a30SJung-uk Kim *****************************************************************************/ 6efcc2a30SJung-uk Kim 70d84335fSJung-uk Kim /****************************************************************************** 80d84335fSJung-uk Kim * 90d84335fSJung-uk Kim * 1. Copyright Notice 100d84335fSJung-uk Kim * 11*804fe266SJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp. 12efcc2a30SJung-uk Kim * All rights reserved. 13efcc2a30SJung-uk Kim * 140d84335fSJung-uk Kim * 2. License 150d84335fSJung-uk Kim * 160d84335fSJung-uk Kim * 2.1. This is your license from Intel Corp. under its intellectual property 170d84335fSJung-uk Kim * rights. You may have additional license terms from the party that provided 180d84335fSJung-uk Kim * you this software, covering your right to use that party's intellectual 190d84335fSJung-uk Kim * property rights. 200d84335fSJung-uk Kim * 210d84335fSJung-uk Kim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 220d84335fSJung-uk Kim * copy of the source code appearing in this file ("Covered Code") an 230d84335fSJung-uk Kim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 240d84335fSJung-uk Kim * base code distributed originally by Intel ("Original Intel Code") to copy, 250d84335fSJung-uk Kim * make derivatives, distribute, use and display any portion of the Covered 260d84335fSJung-uk Kim * Code in any form, with the right to sublicense such rights; and 270d84335fSJung-uk Kim * 280d84335fSJung-uk Kim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 290d84335fSJung-uk Kim * license (with the right to sublicense), under only those claims of Intel 300d84335fSJung-uk Kim * patents that are infringed by the Original Intel Code, to make, use, sell, 310d84335fSJung-uk Kim * offer to sell, and import the Covered Code and derivative works thereof 320d84335fSJung-uk Kim * solely to the minimum extent necessary to exercise the above copyright 330d84335fSJung-uk Kim * license, and in no event shall the patent license extend to any additions 340d84335fSJung-uk Kim * to or modifications of the Original Intel Code. No other license or right 350d84335fSJung-uk Kim * is granted directly or by implication, estoppel or otherwise; 360d84335fSJung-uk Kim * 370d84335fSJung-uk Kim * The above copyright and patent license is granted only if the following 380d84335fSJung-uk Kim * conditions are met: 390d84335fSJung-uk Kim * 400d84335fSJung-uk Kim * 3. Conditions 410d84335fSJung-uk Kim * 420d84335fSJung-uk Kim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 430d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered 440d84335fSJung-uk Kim * Code or modification with rights to further distribute source must include 450d84335fSJung-uk Kim * the above Copyright Notice, the above License, this list of Conditions, 460d84335fSJung-uk Kim * and the following Disclaimer and Export Compliance provision. In addition, 470d84335fSJung-uk Kim * Licensee must cause all Covered Code to which Licensee contributes to 480d84335fSJung-uk Kim * contain a file documenting the changes Licensee made to create that Covered 490d84335fSJung-uk Kim * Code and the date of any change. Licensee must include in that file the 500d84335fSJung-uk Kim * documentation of any changes made by any predecessor Licensee. Licensee 510d84335fSJung-uk Kim * must include a prominent statement that the modification is derived, 520d84335fSJung-uk Kim * directly or indirectly, from Original Intel Code. 530d84335fSJung-uk Kim * 540d84335fSJung-uk Kim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 550d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered 560d84335fSJung-uk Kim * Code or modification without rights to further distribute source must 570d84335fSJung-uk Kim * include the following Disclaimer and Export Compliance provision in the 580d84335fSJung-uk Kim * documentation and/or other materials provided with distribution. In 590d84335fSJung-uk Kim * addition, Licensee may not authorize further sublicense of source of any 600d84335fSJung-uk Kim * portion of the Covered Code, and must include terms to the effect that the 610d84335fSJung-uk Kim * license from Licensee to its licensee is limited to the intellectual 620d84335fSJung-uk Kim * property embodied in the software Licensee provides to its licensee, and 630d84335fSJung-uk Kim * not to intellectual property embodied in modifications its licensee may 640d84335fSJung-uk Kim * make. 650d84335fSJung-uk Kim * 660d84335fSJung-uk Kim * 3.3. Redistribution of Executable. Redistribution in executable form of any 670d84335fSJung-uk Kim * substantial portion of the Covered Code or modification must reproduce the 680d84335fSJung-uk Kim * above Copyright Notice, and the following Disclaimer and Export Compliance 690d84335fSJung-uk Kim * provision in the documentation and/or other materials provided with the 700d84335fSJung-uk Kim * distribution. 710d84335fSJung-uk Kim * 720d84335fSJung-uk Kim * 3.4. Intel retains all right, title, and interest in and to the Original 730d84335fSJung-uk Kim * Intel Code. 740d84335fSJung-uk Kim * 750d84335fSJung-uk Kim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 760d84335fSJung-uk Kim * Intel shall be used in advertising or otherwise to promote the sale, use or 770d84335fSJung-uk Kim * other dealings in products derived from or relating to the Covered Code 780d84335fSJung-uk Kim * without prior written authorization from Intel. 790d84335fSJung-uk Kim * 800d84335fSJung-uk Kim * 4. Disclaimer and Export Compliance 810d84335fSJung-uk Kim * 820d84335fSJung-uk Kim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 830d84335fSJung-uk Kim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 840d84335fSJung-uk Kim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 850d84335fSJung-uk Kim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 860d84335fSJung-uk Kim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 870d84335fSJung-uk Kim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 880d84335fSJung-uk Kim * PARTICULAR PURPOSE. 890d84335fSJung-uk Kim * 900d84335fSJung-uk Kim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 910d84335fSJung-uk Kim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 920d84335fSJung-uk Kim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 930d84335fSJung-uk Kim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 940d84335fSJung-uk Kim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 950d84335fSJung-uk Kim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 960d84335fSJung-uk Kim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 970d84335fSJung-uk Kim * LIMITED REMEDY. 980d84335fSJung-uk Kim * 990d84335fSJung-uk Kim * 4.3. Licensee shall not export, either directly or indirectly, any of this 1000d84335fSJung-uk Kim * software or system incorporating such software without first obtaining any 1010d84335fSJung-uk Kim * required license or other approval from the U. S. Department of Commerce or 1020d84335fSJung-uk Kim * any other agency or department of the United States Government. In the 1030d84335fSJung-uk Kim * event Licensee exports any such software from the United States or 1040d84335fSJung-uk Kim * re-exports any such software from a foreign destination, Licensee shall 1050d84335fSJung-uk Kim * ensure that the distribution and export/re-export of the software is in 1060d84335fSJung-uk Kim * compliance with all laws, regulations, orders, or other restrictions of the 1070d84335fSJung-uk Kim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1080d84335fSJung-uk Kim * any of its subsidiaries will export/re-export any technical data, process, 1090d84335fSJung-uk Kim * software, or service, directly or indirectly, to any country for which the 1100d84335fSJung-uk Kim * United States government or any agency thereof requires an export license, 1110d84335fSJung-uk Kim * other governmental approval, or letter of assurance, without first obtaining 1120d84335fSJung-uk Kim * such license, approval or letter. 1130d84335fSJung-uk Kim * 1140d84335fSJung-uk Kim ***************************************************************************** 1150d84335fSJung-uk Kim * 1160d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the 1170d84335fSJung-uk Kim * following license: 1180d84335fSJung-uk Kim * 119efcc2a30SJung-uk Kim * Redistribution and use in source and binary forms, with or without 120efcc2a30SJung-uk Kim * modification, are permitted provided that the following conditions 121efcc2a30SJung-uk Kim * are met: 122efcc2a30SJung-uk Kim * 1. Redistributions of source code must retain the above copyright 123efcc2a30SJung-uk Kim * notice, this list of conditions, and the following disclaimer, 124efcc2a30SJung-uk Kim * without modification. 125efcc2a30SJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126efcc2a30SJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below 127efcc2a30SJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon 128efcc2a30SJung-uk Kim * including a substantially similar Disclaimer requirement for further 129efcc2a30SJung-uk Kim * binary redistribution. 130efcc2a30SJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names 131efcc2a30SJung-uk Kim * of any contributors may be used to endorse or promote products derived 132efcc2a30SJung-uk Kim * from this software without specific prior written permission. 133efcc2a30SJung-uk Kim * 1340d84335fSJung-uk Kim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1350d84335fSJung-uk Kim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1360d84335fSJung-uk Kim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1370d84335fSJung-uk Kim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1380d84335fSJung-uk Kim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1390d84335fSJung-uk Kim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1400d84335fSJung-uk Kim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1410d84335fSJung-uk Kim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1420d84335fSJung-uk Kim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1430d84335fSJung-uk Kim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1440d84335fSJung-uk Kim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1450d84335fSJung-uk Kim * 1460d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the 147efcc2a30SJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free 148efcc2a30SJung-uk Kim * Software Foundation. 149efcc2a30SJung-uk Kim * 1500d84335fSJung-uk Kim *****************************************************************************/ 151efcc2a30SJung-uk Kim 152efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h> 153efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h> 154efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/acevents.h> 155efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/acnamesp.h> 156efcc2a30SJung-uk Kim #include <contrib/dev/acpica/include/acinterp.h> 157efcc2a30SJung-uk Kim 158efcc2a30SJung-uk Kim #define _COMPONENT ACPI_EVENTS 159efcc2a30SJung-uk Kim ACPI_MODULE_NAME ("evhandler") 160efcc2a30SJung-uk Kim 161efcc2a30SJung-uk Kim 162efcc2a30SJung-uk Kim /* Local prototypes */ 163efcc2a30SJung-uk Kim 164efcc2a30SJung-uk Kim static ACPI_STATUS 165efcc2a30SJung-uk Kim AcpiEvInstallHandler ( 166efcc2a30SJung-uk Kim ACPI_HANDLE ObjHandle, 167efcc2a30SJung-uk Kim UINT32 Level, 168efcc2a30SJung-uk Kim void *Context, 169efcc2a30SJung-uk Kim void **ReturnValue); 170efcc2a30SJung-uk Kim 171f8146b88SJung-uk Kim 172efcc2a30SJung-uk Kim /* These are the address spaces that will get default handlers */ 173efcc2a30SJung-uk Kim 174efcc2a30SJung-uk Kim UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = 175efcc2a30SJung-uk Kim { 176efcc2a30SJung-uk Kim ACPI_ADR_SPACE_SYSTEM_MEMORY, 177efcc2a30SJung-uk Kim ACPI_ADR_SPACE_SYSTEM_IO, 178efcc2a30SJung-uk Kim ACPI_ADR_SPACE_PCI_CONFIG, 179efcc2a30SJung-uk Kim ACPI_ADR_SPACE_DATA_TABLE 180efcc2a30SJung-uk Kim }; 181efcc2a30SJung-uk Kim 182efcc2a30SJung-uk Kim 183efcc2a30SJung-uk Kim /******************************************************************************* 184efcc2a30SJung-uk Kim * 185efcc2a30SJung-uk Kim * FUNCTION: AcpiEvInstallRegionHandlers 186efcc2a30SJung-uk Kim * 187efcc2a30SJung-uk Kim * PARAMETERS: None 188efcc2a30SJung-uk Kim * 189efcc2a30SJung-uk Kim * RETURN: Status 190efcc2a30SJung-uk Kim * 191efcc2a30SJung-uk Kim * DESCRIPTION: Installs the core subsystem default address space handlers. 192efcc2a30SJung-uk Kim * 193efcc2a30SJung-uk Kim ******************************************************************************/ 194efcc2a30SJung-uk Kim 195efcc2a30SJung-uk Kim ACPI_STATUS 196efcc2a30SJung-uk Kim AcpiEvInstallRegionHandlers ( 197efcc2a30SJung-uk Kim void) 198efcc2a30SJung-uk Kim { 199efcc2a30SJung-uk Kim ACPI_STATUS Status; 200efcc2a30SJung-uk Kim UINT32 i; 201efcc2a30SJung-uk Kim 202efcc2a30SJung-uk Kim 203efcc2a30SJung-uk Kim ACPI_FUNCTION_TRACE (EvInstallRegionHandlers); 204efcc2a30SJung-uk Kim 205efcc2a30SJung-uk Kim 206efcc2a30SJung-uk Kim Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 207efcc2a30SJung-uk Kim if (ACPI_FAILURE (Status)) 208efcc2a30SJung-uk Kim { 209efcc2a30SJung-uk Kim return_ACPI_STATUS (Status); 210efcc2a30SJung-uk Kim } 211efcc2a30SJung-uk Kim 212efcc2a30SJung-uk Kim /* 213efcc2a30SJung-uk Kim * All address spaces (PCI Config, EC, SMBus) are scope dependent and 214efcc2a30SJung-uk Kim * registration must occur for a specific device. 215efcc2a30SJung-uk Kim * 216efcc2a30SJung-uk Kim * In the case of the system memory and IO address spaces there is 217efcc2a30SJung-uk Kim * currently no device associated with the address space. For these we 218efcc2a30SJung-uk Kim * use the root. 219efcc2a30SJung-uk Kim * 220efcc2a30SJung-uk Kim * We install the default PCI config space handler at the root so that 221efcc2a30SJung-uk Kim * this space is immediately available even though the we have not 222efcc2a30SJung-uk Kim * enumerated all the PCI Root Buses yet. This is to conform to the ACPI 223efcc2a30SJung-uk Kim * specification which states that the PCI config space must be always 224efcc2a30SJung-uk Kim * available -- even though we are nowhere near ready to find the PCI root 225efcc2a30SJung-uk Kim * buses at this point. 226efcc2a30SJung-uk Kim * 227efcc2a30SJung-uk Kim * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler 228efcc2a30SJung-uk Kim * has already been installed (via AcpiInstallAddressSpaceHandler). 229efcc2a30SJung-uk Kim * Similar for AE_SAME_HANDLER. 230efcc2a30SJung-uk Kim */ 231efcc2a30SJung-uk Kim for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) 232efcc2a30SJung-uk Kim { 233efcc2a30SJung-uk Kim Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode, 234efcc2a30SJung-uk Kim AcpiGbl_DefaultAddressSpaces[i], 235efcc2a30SJung-uk Kim ACPI_DEFAULT_HANDLER, NULL, NULL); 236efcc2a30SJung-uk Kim switch (Status) 237efcc2a30SJung-uk Kim { 238efcc2a30SJung-uk Kim case AE_OK: 239efcc2a30SJung-uk Kim case AE_SAME_HANDLER: 240efcc2a30SJung-uk Kim case AE_ALREADY_EXISTS: 241efcc2a30SJung-uk Kim 242efcc2a30SJung-uk Kim /* These exceptions are all OK */ 243efcc2a30SJung-uk Kim 244efcc2a30SJung-uk Kim Status = AE_OK; 245efcc2a30SJung-uk Kim break; 246efcc2a30SJung-uk Kim 247efcc2a30SJung-uk Kim default: 248efcc2a30SJung-uk Kim 249efcc2a30SJung-uk Kim goto UnlockAndExit; 250efcc2a30SJung-uk Kim } 251efcc2a30SJung-uk Kim } 252efcc2a30SJung-uk Kim 253efcc2a30SJung-uk Kim UnlockAndExit: 254efcc2a30SJung-uk Kim (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 255efcc2a30SJung-uk Kim return_ACPI_STATUS (Status); 256efcc2a30SJung-uk Kim } 257efcc2a30SJung-uk Kim 258efcc2a30SJung-uk Kim 259efcc2a30SJung-uk Kim /******************************************************************************* 260efcc2a30SJung-uk Kim * 261efcc2a30SJung-uk Kim * FUNCTION: AcpiEvHasDefaultHandler 262efcc2a30SJung-uk Kim * 263efcc2a30SJung-uk Kim * PARAMETERS: Node - Namespace node for the device 264efcc2a30SJung-uk Kim * SpaceId - The address space ID 265efcc2a30SJung-uk Kim * 266efcc2a30SJung-uk Kim * RETURN: TRUE if default handler is installed, FALSE otherwise 267efcc2a30SJung-uk Kim * 268efcc2a30SJung-uk Kim * DESCRIPTION: Check if the default handler is installed for the requested 269efcc2a30SJung-uk Kim * space ID. 270efcc2a30SJung-uk Kim * 271efcc2a30SJung-uk Kim ******************************************************************************/ 272efcc2a30SJung-uk Kim 273efcc2a30SJung-uk Kim BOOLEAN 274efcc2a30SJung-uk Kim AcpiEvHasDefaultHandler ( 275efcc2a30SJung-uk Kim ACPI_NAMESPACE_NODE *Node, 276efcc2a30SJung-uk Kim ACPI_ADR_SPACE_TYPE SpaceId) 277efcc2a30SJung-uk Kim { 278efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *ObjDesc; 279efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *HandlerObj; 280efcc2a30SJung-uk Kim 281efcc2a30SJung-uk Kim 282efcc2a30SJung-uk Kim /* Must have an existing internal object */ 283efcc2a30SJung-uk Kim 284efcc2a30SJung-uk Kim ObjDesc = AcpiNsGetAttachedObject (Node); 285efcc2a30SJung-uk Kim if (ObjDesc) 286efcc2a30SJung-uk Kim { 287f8146b88SJung-uk Kim HandlerObj = ObjDesc->CommonNotify.Handler; 288efcc2a30SJung-uk Kim 289efcc2a30SJung-uk Kim /* Walk the linked list of handlers for this object */ 290efcc2a30SJung-uk Kim 291efcc2a30SJung-uk Kim while (HandlerObj) 292efcc2a30SJung-uk Kim { 293efcc2a30SJung-uk Kim if (HandlerObj->AddressSpace.SpaceId == SpaceId) 294efcc2a30SJung-uk Kim { 295efcc2a30SJung-uk Kim if (HandlerObj->AddressSpace.HandlerFlags & 296efcc2a30SJung-uk Kim ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) 297efcc2a30SJung-uk Kim { 298efcc2a30SJung-uk Kim return (TRUE); 299efcc2a30SJung-uk Kim } 300efcc2a30SJung-uk Kim } 301efcc2a30SJung-uk Kim 302efcc2a30SJung-uk Kim HandlerObj = HandlerObj->AddressSpace.Next; 303efcc2a30SJung-uk Kim } 304efcc2a30SJung-uk Kim } 305efcc2a30SJung-uk Kim 306efcc2a30SJung-uk Kim return (FALSE); 307efcc2a30SJung-uk Kim } 308efcc2a30SJung-uk Kim 309efcc2a30SJung-uk Kim 310efcc2a30SJung-uk Kim /******************************************************************************* 311efcc2a30SJung-uk Kim * 312efcc2a30SJung-uk Kim * FUNCTION: AcpiEvInstallHandler 313efcc2a30SJung-uk Kim * 314efcc2a30SJung-uk Kim * PARAMETERS: WalkNamespace callback 315efcc2a30SJung-uk Kim * 316efcc2a30SJung-uk Kim * DESCRIPTION: This routine installs an address handler into objects that are 317efcc2a30SJung-uk Kim * of type Region or Device. 318efcc2a30SJung-uk Kim * 319efcc2a30SJung-uk Kim * If the Object is a Device, and the device has a handler of 320efcc2a30SJung-uk Kim * the same type then the search is terminated in that branch. 321efcc2a30SJung-uk Kim * 322efcc2a30SJung-uk Kim * This is because the existing handler is closer in proximity 323efcc2a30SJung-uk Kim * to any more regions than the one we are trying to install. 324efcc2a30SJung-uk Kim * 325efcc2a30SJung-uk Kim ******************************************************************************/ 326efcc2a30SJung-uk Kim 327efcc2a30SJung-uk Kim static ACPI_STATUS 328efcc2a30SJung-uk Kim AcpiEvInstallHandler ( 329efcc2a30SJung-uk Kim ACPI_HANDLE ObjHandle, 330efcc2a30SJung-uk Kim UINT32 Level, 331efcc2a30SJung-uk Kim void *Context, 332efcc2a30SJung-uk Kim void **ReturnValue) 333efcc2a30SJung-uk Kim { 334efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *HandlerObj; 335efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *NextHandlerObj; 336efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *ObjDesc; 337efcc2a30SJung-uk Kim ACPI_NAMESPACE_NODE *Node; 338efcc2a30SJung-uk Kim ACPI_STATUS Status; 339efcc2a30SJung-uk Kim 340efcc2a30SJung-uk Kim 341efcc2a30SJung-uk Kim ACPI_FUNCTION_NAME (EvInstallHandler); 342efcc2a30SJung-uk Kim 343efcc2a30SJung-uk Kim 344efcc2a30SJung-uk Kim HandlerObj = (ACPI_OPERAND_OBJECT *) Context; 345efcc2a30SJung-uk Kim 346efcc2a30SJung-uk Kim /* Parameter validation */ 347efcc2a30SJung-uk Kim 348efcc2a30SJung-uk Kim if (!HandlerObj) 349efcc2a30SJung-uk Kim { 350efcc2a30SJung-uk Kim return (AE_OK); 351efcc2a30SJung-uk Kim } 352efcc2a30SJung-uk Kim 353efcc2a30SJung-uk Kim /* Convert and validate the device handle */ 354efcc2a30SJung-uk Kim 355efcc2a30SJung-uk Kim Node = AcpiNsValidateHandle (ObjHandle); 356efcc2a30SJung-uk Kim if (!Node) 357efcc2a30SJung-uk Kim { 358efcc2a30SJung-uk Kim return (AE_BAD_PARAMETER); 359efcc2a30SJung-uk Kim } 360efcc2a30SJung-uk Kim 361efcc2a30SJung-uk Kim /* 362efcc2a30SJung-uk Kim * We only care about regions and objects that are allowed to have 363efcc2a30SJung-uk Kim * address space handlers 364efcc2a30SJung-uk Kim */ 365efcc2a30SJung-uk Kim if ((Node->Type != ACPI_TYPE_DEVICE) && 366efcc2a30SJung-uk Kim (Node->Type != ACPI_TYPE_REGION) && 367efcc2a30SJung-uk Kim (Node != AcpiGbl_RootNode)) 368efcc2a30SJung-uk Kim { 369efcc2a30SJung-uk Kim return (AE_OK); 370efcc2a30SJung-uk Kim } 371efcc2a30SJung-uk Kim 372efcc2a30SJung-uk Kim /* Check for an existing internal object */ 373efcc2a30SJung-uk Kim 374efcc2a30SJung-uk Kim ObjDesc = AcpiNsGetAttachedObject (Node); 375efcc2a30SJung-uk Kim if (!ObjDesc) 376efcc2a30SJung-uk Kim { 377efcc2a30SJung-uk Kim /* No object, just exit */ 378efcc2a30SJung-uk Kim 379efcc2a30SJung-uk Kim return (AE_OK); 380efcc2a30SJung-uk Kim } 381efcc2a30SJung-uk Kim 382efcc2a30SJung-uk Kim /* Devices are handled different than regions */ 383efcc2a30SJung-uk Kim 384efcc2a30SJung-uk Kim if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE) 385efcc2a30SJung-uk Kim { 386efcc2a30SJung-uk Kim /* Check if this Device already has a handler for this address space */ 387efcc2a30SJung-uk Kim 388f8146b88SJung-uk Kim NextHandlerObj = AcpiEvFindRegionHandler ( 389f8146b88SJung-uk Kim HandlerObj->AddressSpace.SpaceId, ObjDesc->CommonNotify.Handler); 390f8146b88SJung-uk Kim if (NextHandlerObj) 391efcc2a30SJung-uk Kim { 392efcc2a30SJung-uk Kim /* Found a handler, is it for the same address space? */ 393efcc2a30SJung-uk Kim 394efcc2a30SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, 395f8146b88SJung-uk Kim "Found handler for region [%s] in device %p(%p) handler %p\n", 396efcc2a30SJung-uk Kim AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId), 397efcc2a30SJung-uk Kim ObjDesc, NextHandlerObj, HandlerObj)); 398efcc2a30SJung-uk Kim 399efcc2a30SJung-uk Kim /* 400f8146b88SJung-uk Kim * Since the object we found it on was a device, then it means 401f8146b88SJung-uk Kim * that someone has already installed a handler for the branch 402f8146b88SJung-uk Kim * of the namespace from this device on. Just bail out telling 403f8146b88SJung-uk Kim * the walk routine to not traverse this branch. This preserves 404f8146b88SJung-uk Kim * the scoping rule for handlers. 405efcc2a30SJung-uk Kim */ 406efcc2a30SJung-uk Kim return (AE_CTRL_DEPTH); 407efcc2a30SJung-uk Kim } 408efcc2a30SJung-uk Kim 409efcc2a30SJung-uk Kim /* 410efcc2a30SJung-uk Kim * As long as the device didn't have a handler for this space we 411efcc2a30SJung-uk Kim * don't care about it. We just ignore it and proceed. 412efcc2a30SJung-uk Kim */ 413efcc2a30SJung-uk Kim return (AE_OK); 414efcc2a30SJung-uk Kim } 415efcc2a30SJung-uk Kim 416efcc2a30SJung-uk Kim /* Object is a Region */ 417efcc2a30SJung-uk Kim 418efcc2a30SJung-uk Kim if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId) 419efcc2a30SJung-uk Kim { 420efcc2a30SJung-uk Kim /* This region is for a different address space, just ignore it */ 421efcc2a30SJung-uk Kim 422efcc2a30SJung-uk Kim return (AE_OK); 423efcc2a30SJung-uk Kim } 424efcc2a30SJung-uk Kim 425efcc2a30SJung-uk Kim /* 426efcc2a30SJung-uk Kim * Now we have a region and it is for the handler's address space type. 427efcc2a30SJung-uk Kim * 428efcc2a30SJung-uk Kim * First disconnect region for any previous handler (if any) 429efcc2a30SJung-uk Kim */ 430efcc2a30SJung-uk Kim AcpiEvDetachRegion (ObjDesc, FALSE); 431efcc2a30SJung-uk Kim 432efcc2a30SJung-uk Kim /* Connect the region to the new handler */ 433efcc2a30SJung-uk Kim 434efcc2a30SJung-uk Kim Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE); 435efcc2a30SJung-uk Kim return (Status); 436efcc2a30SJung-uk Kim } 437efcc2a30SJung-uk Kim 438efcc2a30SJung-uk Kim 439efcc2a30SJung-uk Kim /******************************************************************************* 440efcc2a30SJung-uk Kim * 441f8146b88SJung-uk Kim * FUNCTION: AcpiEvFindRegionHandler 442f8146b88SJung-uk Kim * 443f8146b88SJung-uk Kim * PARAMETERS: SpaceId - The address space ID 444f8146b88SJung-uk Kim * HandlerObj - Head of the handler object list 445f8146b88SJung-uk Kim * 446f8146b88SJung-uk Kim * RETURN: Matching handler object. NULL if space ID not matched 447f8146b88SJung-uk Kim * 448f8146b88SJung-uk Kim * DESCRIPTION: Search a handler object list for a match on the address 449f8146b88SJung-uk Kim * space ID. 450f8146b88SJung-uk Kim * 451f8146b88SJung-uk Kim ******************************************************************************/ 452f8146b88SJung-uk Kim 453f8146b88SJung-uk Kim ACPI_OPERAND_OBJECT * 454f8146b88SJung-uk Kim AcpiEvFindRegionHandler ( 455f8146b88SJung-uk Kim ACPI_ADR_SPACE_TYPE SpaceId, 456f8146b88SJung-uk Kim ACPI_OPERAND_OBJECT *HandlerObj) 457f8146b88SJung-uk Kim { 458f8146b88SJung-uk Kim 459f8146b88SJung-uk Kim /* Walk the handler list for this device */ 460f8146b88SJung-uk Kim 461f8146b88SJung-uk Kim while (HandlerObj) 462f8146b88SJung-uk Kim { 463f8146b88SJung-uk Kim /* Same SpaceId indicates a handler is installed */ 464f8146b88SJung-uk Kim 465f8146b88SJung-uk Kim if (HandlerObj->AddressSpace.SpaceId == SpaceId) 466f8146b88SJung-uk Kim { 467f8146b88SJung-uk Kim return (HandlerObj); 468f8146b88SJung-uk Kim } 469f8146b88SJung-uk Kim 470f8146b88SJung-uk Kim /* Next handler object */ 471f8146b88SJung-uk Kim 472f8146b88SJung-uk Kim HandlerObj = HandlerObj->AddressSpace.Next; 473f8146b88SJung-uk Kim } 474f8146b88SJung-uk Kim 475f8146b88SJung-uk Kim return (NULL); 476f8146b88SJung-uk Kim } 477f8146b88SJung-uk Kim 478f8146b88SJung-uk Kim 479f8146b88SJung-uk Kim /******************************************************************************* 480f8146b88SJung-uk Kim * 481efcc2a30SJung-uk Kim * FUNCTION: AcpiEvInstallSpaceHandler 482efcc2a30SJung-uk Kim * 483efcc2a30SJung-uk Kim * PARAMETERS: Node - Namespace node for the device 484efcc2a30SJung-uk Kim * SpaceId - The address space ID 485efcc2a30SJung-uk Kim * Handler - Address of the handler 486efcc2a30SJung-uk Kim * Setup - Address of the setup function 487efcc2a30SJung-uk Kim * Context - Value passed to the handler on each access 488efcc2a30SJung-uk Kim * 489efcc2a30SJung-uk Kim * RETURN: Status 490efcc2a30SJung-uk Kim * 491efcc2a30SJung-uk Kim * DESCRIPTION: Install a handler for all OpRegions of a given SpaceId. 492efcc2a30SJung-uk Kim * Assumes namespace is locked 493efcc2a30SJung-uk Kim * 494efcc2a30SJung-uk Kim ******************************************************************************/ 495efcc2a30SJung-uk Kim 496efcc2a30SJung-uk Kim ACPI_STATUS 497efcc2a30SJung-uk Kim AcpiEvInstallSpaceHandler ( 498efcc2a30SJung-uk Kim ACPI_NAMESPACE_NODE *Node, 499efcc2a30SJung-uk Kim ACPI_ADR_SPACE_TYPE SpaceId, 500efcc2a30SJung-uk Kim ACPI_ADR_SPACE_HANDLER Handler, 501efcc2a30SJung-uk Kim ACPI_ADR_SPACE_SETUP Setup, 502efcc2a30SJung-uk Kim void *Context) 503efcc2a30SJung-uk Kim { 504efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *ObjDesc; 505efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *HandlerObj; 506f8146b88SJung-uk Kim ACPI_STATUS Status = AE_OK; 507efcc2a30SJung-uk Kim ACPI_OBJECT_TYPE Type; 508efcc2a30SJung-uk Kim UINT8 Flags = 0; 509efcc2a30SJung-uk Kim 510efcc2a30SJung-uk Kim 511efcc2a30SJung-uk Kim ACPI_FUNCTION_TRACE (EvInstallSpaceHandler); 512efcc2a30SJung-uk Kim 513efcc2a30SJung-uk Kim 514efcc2a30SJung-uk Kim /* 515f8146b88SJung-uk Kim * This registration is valid for only the types below and the root. 516f8146b88SJung-uk Kim * The root node is where the default handlers get installed. 517efcc2a30SJung-uk Kim */ 518efcc2a30SJung-uk Kim if ((Node->Type != ACPI_TYPE_DEVICE) && 519efcc2a30SJung-uk Kim (Node->Type != ACPI_TYPE_PROCESSOR) && 520efcc2a30SJung-uk Kim (Node->Type != ACPI_TYPE_THERMAL) && 521efcc2a30SJung-uk Kim (Node != AcpiGbl_RootNode)) 522efcc2a30SJung-uk Kim { 523efcc2a30SJung-uk Kim Status = AE_BAD_PARAMETER; 524efcc2a30SJung-uk Kim goto UnlockAndExit; 525efcc2a30SJung-uk Kim } 526efcc2a30SJung-uk Kim 527efcc2a30SJung-uk Kim if (Handler == ACPI_DEFAULT_HANDLER) 528efcc2a30SJung-uk Kim { 529efcc2a30SJung-uk Kim Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED; 530efcc2a30SJung-uk Kim 531efcc2a30SJung-uk Kim switch (SpaceId) 532efcc2a30SJung-uk Kim { 533efcc2a30SJung-uk Kim case ACPI_ADR_SPACE_SYSTEM_MEMORY: 534a9d8d09cSJung-uk Kim 535efcc2a30SJung-uk Kim Handler = AcpiExSystemMemorySpaceHandler; 536efcc2a30SJung-uk Kim Setup = AcpiEvSystemMemoryRegionSetup; 537efcc2a30SJung-uk Kim break; 538efcc2a30SJung-uk Kim 539efcc2a30SJung-uk Kim case ACPI_ADR_SPACE_SYSTEM_IO: 540a9d8d09cSJung-uk Kim 541efcc2a30SJung-uk Kim Handler = AcpiExSystemIoSpaceHandler; 542efcc2a30SJung-uk Kim Setup = AcpiEvIoSpaceRegionSetup; 543efcc2a30SJung-uk Kim break; 544efcc2a30SJung-uk Kim 545efcc2a30SJung-uk Kim case ACPI_ADR_SPACE_PCI_CONFIG: 546a9d8d09cSJung-uk Kim 547efcc2a30SJung-uk Kim Handler = AcpiExPciConfigSpaceHandler; 548efcc2a30SJung-uk Kim Setup = AcpiEvPciConfigRegionSetup; 549efcc2a30SJung-uk Kim break; 550efcc2a30SJung-uk Kim 551efcc2a30SJung-uk Kim case ACPI_ADR_SPACE_CMOS: 552a9d8d09cSJung-uk Kim 553efcc2a30SJung-uk Kim Handler = AcpiExCmosSpaceHandler; 554efcc2a30SJung-uk Kim Setup = AcpiEvCmosRegionSetup; 555efcc2a30SJung-uk Kim break; 556efcc2a30SJung-uk Kim 557efcc2a30SJung-uk Kim case ACPI_ADR_SPACE_PCI_BAR_TARGET: 558a9d8d09cSJung-uk Kim 559efcc2a30SJung-uk Kim Handler = AcpiExPciBarSpaceHandler; 560efcc2a30SJung-uk Kim Setup = AcpiEvPciBarRegionSetup; 561efcc2a30SJung-uk Kim break; 562efcc2a30SJung-uk Kim 563efcc2a30SJung-uk Kim case ACPI_ADR_SPACE_DATA_TABLE: 564a9d8d09cSJung-uk Kim 565efcc2a30SJung-uk Kim Handler = AcpiExDataTableSpaceHandler; 566ab71bbb7SJung-uk Kim Setup = AcpiEvDataTableRegionSetup; 567efcc2a30SJung-uk Kim break; 568efcc2a30SJung-uk Kim 569efcc2a30SJung-uk Kim default: 570a9d8d09cSJung-uk Kim 571efcc2a30SJung-uk Kim Status = AE_BAD_PARAMETER; 572efcc2a30SJung-uk Kim goto UnlockAndExit; 573efcc2a30SJung-uk Kim } 574efcc2a30SJung-uk Kim } 575efcc2a30SJung-uk Kim 576efcc2a30SJung-uk Kim /* If the caller hasn't specified a setup routine, use the default */ 577efcc2a30SJung-uk Kim 578efcc2a30SJung-uk Kim if (!Setup) 579efcc2a30SJung-uk Kim { 580efcc2a30SJung-uk Kim Setup = AcpiEvDefaultRegionSetup; 581efcc2a30SJung-uk Kim } 582efcc2a30SJung-uk Kim 583efcc2a30SJung-uk Kim /* Check for an existing internal object */ 584efcc2a30SJung-uk Kim 585efcc2a30SJung-uk Kim ObjDesc = AcpiNsGetAttachedObject (Node); 586efcc2a30SJung-uk Kim if (ObjDesc) 587efcc2a30SJung-uk Kim { 588efcc2a30SJung-uk Kim /* 589f8146b88SJung-uk Kim * The attached device object already exists. Now make sure 590f8146b88SJung-uk Kim * the handler is not already installed. 591efcc2a30SJung-uk Kim */ 592f8146b88SJung-uk Kim HandlerObj = AcpiEvFindRegionHandler (SpaceId, 593f8146b88SJung-uk Kim ObjDesc->CommonNotify.Handler); 594efcc2a30SJung-uk Kim 595f8146b88SJung-uk Kim if (HandlerObj) 596efcc2a30SJung-uk Kim { 597efcc2a30SJung-uk Kim if (HandlerObj->AddressSpace.Handler == Handler) 598efcc2a30SJung-uk Kim { 599efcc2a30SJung-uk Kim /* 600efcc2a30SJung-uk Kim * It is (relatively) OK to attempt to install the SAME 601efcc2a30SJung-uk Kim * handler twice. This can easily happen with the 602efcc2a30SJung-uk Kim * PCI_Config space. 603efcc2a30SJung-uk Kim */ 604efcc2a30SJung-uk Kim Status = AE_SAME_HANDLER; 605efcc2a30SJung-uk Kim goto UnlockAndExit; 606efcc2a30SJung-uk Kim } 607efcc2a30SJung-uk Kim else 608efcc2a30SJung-uk Kim { 609efcc2a30SJung-uk Kim /* A handler is already installed */ 610efcc2a30SJung-uk Kim 611efcc2a30SJung-uk Kim Status = AE_ALREADY_EXISTS; 612efcc2a30SJung-uk Kim } 613f8146b88SJung-uk Kim 614efcc2a30SJung-uk Kim goto UnlockAndExit; 615efcc2a30SJung-uk Kim } 616efcc2a30SJung-uk Kim } 617efcc2a30SJung-uk Kim else 618efcc2a30SJung-uk Kim { 619efcc2a30SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, 620f8146b88SJung-uk Kim "Creating object on Device %p while installing handler\n", 621f8146b88SJung-uk Kim Node)); 622efcc2a30SJung-uk Kim 623efcc2a30SJung-uk Kim /* ObjDesc does not exist, create one */ 624efcc2a30SJung-uk Kim 625efcc2a30SJung-uk Kim if (Node->Type == ACPI_TYPE_ANY) 626efcc2a30SJung-uk Kim { 627efcc2a30SJung-uk Kim Type = ACPI_TYPE_DEVICE; 628efcc2a30SJung-uk Kim } 629efcc2a30SJung-uk Kim else 630efcc2a30SJung-uk Kim { 631efcc2a30SJung-uk Kim Type = Node->Type; 632efcc2a30SJung-uk Kim } 633efcc2a30SJung-uk Kim 634efcc2a30SJung-uk Kim ObjDesc = AcpiUtCreateInternalObject (Type); 635efcc2a30SJung-uk Kim if (!ObjDesc) 636efcc2a30SJung-uk Kim { 637efcc2a30SJung-uk Kim Status = AE_NO_MEMORY; 638efcc2a30SJung-uk Kim goto UnlockAndExit; 639efcc2a30SJung-uk Kim } 640efcc2a30SJung-uk Kim 641efcc2a30SJung-uk Kim /* Init new descriptor */ 642efcc2a30SJung-uk Kim 643efcc2a30SJung-uk Kim ObjDesc->Common.Type = (UINT8) Type; 644efcc2a30SJung-uk Kim 645efcc2a30SJung-uk Kim /* Attach the new object to the Node */ 646efcc2a30SJung-uk Kim 647efcc2a30SJung-uk Kim Status = AcpiNsAttachObject (Node, ObjDesc, Type); 648efcc2a30SJung-uk Kim 649efcc2a30SJung-uk Kim /* Remove local reference to the object */ 650efcc2a30SJung-uk Kim 651efcc2a30SJung-uk Kim AcpiUtRemoveReference (ObjDesc); 652efcc2a30SJung-uk Kim 653efcc2a30SJung-uk Kim if (ACPI_FAILURE (Status)) 654efcc2a30SJung-uk Kim { 655efcc2a30SJung-uk Kim goto UnlockAndExit; 656efcc2a30SJung-uk Kim } 657efcc2a30SJung-uk Kim } 658efcc2a30SJung-uk Kim 659efcc2a30SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, 660f8146b88SJung-uk Kim "Installing address handler for region %s(%X) " 661f8146b88SJung-uk Kim "on Device %4.4s %p(%p)\n", 662efcc2a30SJung-uk Kim AcpiUtGetRegionName (SpaceId), SpaceId, 663efcc2a30SJung-uk Kim AcpiUtGetNodeName (Node), Node, ObjDesc)); 664efcc2a30SJung-uk Kim 665efcc2a30SJung-uk Kim /* 666efcc2a30SJung-uk Kim * Install the handler 667efcc2a30SJung-uk Kim * 668efcc2a30SJung-uk Kim * At this point there is no existing handler. Just allocate the object 669efcc2a30SJung-uk Kim * for the handler and link it into the list. 670efcc2a30SJung-uk Kim */ 671efcc2a30SJung-uk Kim HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER); 672efcc2a30SJung-uk Kim if (!HandlerObj) 673efcc2a30SJung-uk Kim { 674efcc2a30SJung-uk Kim Status = AE_NO_MEMORY; 675efcc2a30SJung-uk Kim goto UnlockAndExit; 676efcc2a30SJung-uk Kim } 677efcc2a30SJung-uk Kim 678efcc2a30SJung-uk Kim /* Init handler obj */ 679efcc2a30SJung-uk Kim 680cfd1ed46SJung-uk Kim Status = AcpiOsCreateMutex (&HandlerObj->AddressSpace.ContextMutex); 681cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status)) 682cfd1ed46SJung-uk Kim { 683cfd1ed46SJung-uk Kim AcpiUtRemoveReference (HandlerObj); 684cfd1ed46SJung-uk Kim goto UnlockAndExit; 685cfd1ed46SJung-uk Kim } 686cfd1ed46SJung-uk Kim 687efcc2a30SJung-uk Kim HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId; 688efcc2a30SJung-uk Kim HandlerObj->AddressSpace.HandlerFlags = Flags; 689efcc2a30SJung-uk Kim HandlerObj->AddressSpace.RegionList = NULL; 690efcc2a30SJung-uk Kim HandlerObj->AddressSpace.Node = Node; 691efcc2a30SJung-uk Kim HandlerObj->AddressSpace.Handler = Handler; 692efcc2a30SJung-uk Kim HandlerObj->AddressSpace.Context = Context; 693efcc2a30SJung-uk Kim HandlerObj->AddressSpace.Setup = Setup; 694efcc2a30SJung-uk Kim 695efcc2a30SJung-uk Kim /* Install at head of Device.AddressSpace list */ 696efcc2a30SJung-uk Kim 697f8146b88SJung-uk Kim HandlerObj->AddressSpace.Next = ObjDesc->CommonNotify.Handler; 698efcc2a30SJung-uk Kim 699efcc2a30SJung-uk Kim /* 700efcc2a30SJung-uk Kim * The Device object is the first reference on the HandlerObj. 701efcc2a30SJung-uk Kim * Each region that uses the handler adds a reference. 702efcc2a30SJung-uk Kim */ 703f8146b88SJung-uk Kim ObjDesc->CommonNotify.Handler = HandlerObj; 704efcc2a30SJung-uk Kim 705efcc2a30SJung-uk Kim /* 706f8146b88SJung-uk Kim * Walk the namespace finding all of the regions this handler will 707f8146b88SJung-uk Kim * manage. 708efcc2a30SJung-uk Kim * 709f8146b88SJung-uk Kim * Start at the device and search the branch toward the leaf nodes 710f8146b88SJung-uk Kim * until either the leaf is encountered or a device is detected that 711f8146b88SJung-uk Kim * has an address handler of the same type. 712efcc2a30SJung-uk Kim * 713f8146b88SJung-uk Kim * In either case, back up and search down the remainder of the branch 714efcc2a30SJung-uk Kim */ 715f8146b88SJung-uk Kim Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, 716f8146b88SJung-uk Kim ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, 717f8146b88SJung-uk Kim AcpiEvInstallHandler, NULL, HandlerObj, NULL); 718efcc2a30SJung-uk Kim 719efcc2a30SJung-uk Kim UnlockAndExit: 720efcc2a30SJung-uk Kim return_ACPI_STATUS (Status); 721efcc2a30SJung-uk Kim } 722