2005-06-29 15:40:01 +00:00
|
|
|
/******************************************************************************
|
2005-06-29 16:39:27 +00:00
|
|
|
*
|
2005-06-29 16:39:30 +00:00
|
|
|
* Module Name: evregion - ACPI AddressSpace / OpRegion handler dispatch
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* 1. Copyright Notice
|
|
|
|
*
|
2005-06-29 16:39:29 +00:00
|
|
|
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
2005-06-29 16:39:27 +00:00
|
|
|
* reserved.
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
|
|
|
* 2. License
|
2005-06-29 16:39:27 +00:00
|
|
|
*
|
2005-06-29 16:39:29 +00:00
|
|
|
* 2.1. This is your license from Intel Corp. under its intellectual property
|
|
|
|
* rights. You may have additional license terms from the party that provided
|
|
|
|
* you this software, covering your right to use that party's intellectual
|
|
|
|
* property rights.
|
|
|
|
*
|
|
|
|
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
|
|
|
* copy of the source code appearing in this file ("Covered Code") an
|
|
|
|
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
|
|
|
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
|
|
|
* make derivatives, distribute, use and display any portion of the Covered
|
|
|
|
* Code in any form, with the right to sublicense such rights; and
|
|
|
|
*
|
|
|
|
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
2005-06-29 16:39:31 +00:00
|
|
|
* license (with the right to sublicense), under only those claims of Intel
|
2005-06-29 16:39:29 +00:00
|
|
|
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
|
|
|
* offer to sell, and import the Covered Code and derivative works thereof
|
|
|
|
* solely to the minimum extent necessary to exercise the above copyright
|
|
|
|
* license, and in no event shall the patent license extend to any additions
|
|
|
|
* to or modifications of the Original Intel Code. No other license or right
|
|
|
|
* is granted directly or by implication, estoppel or otherwise;
|
|
|
|
*
|
|
|
|
* The above copyright and patent license is granted only if the following
|
2005-06-29 15:40:01 +00:00
|
|
|
* conditions are met:
|
|
|
|
*
|
2005-06-29 16:39:27 +00:00
|
|
|
* 3. Conditions
|
|
|
|
*
|
2005-06-29 16:39:29 +00:00
|
|
|
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
|
|
|
* Redistribution of source code of any substantial portion of the Covered
|
|
|
|
* Code or modification with rights to further distribute source must include
|
|
|
|
* the above Copyright Notice, the above License, this list of Conditions,
|
|
|
|
* and the following Disclaimer and Export Compliance provision. In addition,
|
|
|
|
* Licensee must cause all Covered Code to which Licensee contributes to
|
|
|
|
* contain a file documenting the changes Licensee made to create that Covered
|
|
|
|
* Code and the date of any change. Licensee must include in that file the
|
|
|
|
* documentation of any changes made by any predecessor Licensee. Licensee
|
|
|
|
* must include a prominent statement that the modification is derived,
|
|
|
|
* directly or indirectly, from Original Intel Code.
|
|
|
|
*
|
|
|
|
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
|
|
|
* Redistribution of source code of any substantial portion of the Covered
|
|
|
|
* Code or modification without rights to further distribute source must
|
|
|
|
* include the following Disclaimer and Export Compliance provision in the
|
|
|
|
* documentation and/or other materials provided with distribution. In
|
|
|
|
* addition, Licensee may not authorize further sublicense of source of any
|
|
|
|
* portion of the Covered Code, and must include terms to the effect that the
|
|
|
|
* license from Licensee to its licensee is limited to the intellectual
|
|
|
|
* property embodied in the software Licensee provides to its licensee, and
|
|
|
|
* not to intellectual property embodied in modifications its licensee may
|
|
|
|
* make.
|
|
|
|
*
|
|
|
|
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
|
|
|
* substantial portion of the Covered Code or modification must reproduce the
|
|
|
|
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
|
|
|
* provision in the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* 3.4. Intel retains all right, title, and interest in and to the Original
|
2005-06-29 15:40:01 +00:00
|
|
|
* Intel Code.
|
|
|
|
*
|
2005-06-29 16:39:29 +00:00
|
|
|
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
|
|
|
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
|
|
|
* other dealings in products derived from or relating to the Covered Code
|
2005-06-29 15:40:01 +00:00
|
|
|
* without prior written authorization from Intel.
|
|
|
|
*
|
|
|
|
* 4. Disclaimer and Export Compliance
|
|
|
|
*
|
2005-06-29 16:39:29 +00:00
|
|
|
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
|
|
|
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
|
|
|
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
|
|
|
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
|
|
|
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
2005-06-29 16:39:27 +00:00
|
|
|
* PARTICULAR PURPOSE.
|
|
|
|
*
|
2005-06-29 16:39:29 +00:00
|
|
|
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
|
|
|
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
|
|
|
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
|
|
|
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
|
|
|
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
|
|
|
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
|
|
|
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
2005-06-29 15:40:01 +00:00
|
|
|
* LIMITED REMEDY.
|
|
|
|
*
|
2005-06-29 16:39:29 +00:00
|
|
|
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
|
|
|
* software or system incorporating such software without first obtaining any
|
|
|
|
* required license or other approval from the U. S. Department of Commerce or
|
|
|
|
* any other agency or department of the United States Government. In the
|
|
|
|
* event Licensee exports any such software from the United States or
|
|
|
|
* re-exports any such software from a foreign destination, Licensee shall
|
|
|
|
* ensure that the distribution and export/re-export of the software is in
|
|
|
|
* compliance with all laws, regulations, orders, or other restrictions of the
|
|
|
|
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
|
|
|
* any of its subsidiaries will export/re-export any technical data, process,
|
|
|
|
* software, or service, directly or indirectly, to any country for which the
|
|
|
|
* United States government or any agency thereof requires an export license,
|
|
|
|
* other governmental approval, or letter of assurance, without first obtaining
|
|
|
|
* such license, approval or letter.
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2005-06-29 16:40:12 +00:00
|
|
|
|
|
|
|
#define __EVREGION_C__
|
|
|
|
|
2005-06-29 16:39:27 +00:00
|
|
|
#include <acpi.h>
|
|
|
|
#include <events.h>
|
2005-06-29 16:39:56 +00:00
|
|
|
#include <namesp.h>
|
|
|
|
#include <interp.h>
|
2005-06-29 16:39:35 +00:00
|
|
|
#include <amlcode.h>
|
2005-06-29 16:39:37 +00:00
|
|
|
#include <methods.h>
|
2005-06-29 15:40:01 +00:00
|
|
|
|
2005-06-29 16:39:27 +00:00
|
|
|
#define _COMPONENT EVENT_HANDLING
|
2005-06-29 16:39:46 +00:00
|
|
|
MODULE_NAME ("evregion");
|
2005-06-29 15:40:01 +00:00
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:40:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define PCI_ROOT_HID "PNP0A03"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: EvFindOnePciRootBus
|
|
|
|
*
|
|
|
|
* PARAMETERS:
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION:
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
|
|
|
EvFindOnePciRootBus (
|
|
|
|
ACPI_HANDLE ObjHandle,
|
|
|
|
UINT32 NestingLevel,
|
|
|
|
void *Context,
|
|
|
|
void **ReturnValue)
|
|
|
|
{
|
|
|
|
NAME_TABLE_ENTRY *Entry;
|
|
|
|
ACPI_OBJECT_INTERNAL *ObjDesc;
|
|
|
|
ACPI_STATUS Status;
|
|
|
|
|
|
|
|
|
|
|
|
Entry = (NAME_TABLE_ENTRY *) ObjHandle;
|
|
|
|
ObjDesc = ((NAME_TABLE_ENTRY *)ObjHandle)->Object;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We are looking for all valid _HID objects.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ((Entry->Name != *(UINT32 *) METHOD_NAME__HID) ||
|
|
|
|
(!ObjDesc))
|
|
|
|
{
|
|
|
|
return AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Found an _HID object.
|
|
|
|
* Now we need a HID with the value EISAID("PNP0A03")
|
|
|
|
* HID can be either a number or a string.
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (ObjDesc->Common.Type)
|
|
|
|
{
|
|
|
|
case ACPI_TYPE_Number:
|
|
|
|
|
|
|
|
/* TBD: What should this number be? */
|
|
|
|
|
|
|
|
if (ObjDesc->Number.Value != 0x12345678)
|
|
|
|
{
|
|
|
|
return AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_String:
|
|
|
|
|
|
|
|
if (STRNCMP (ObjDesc->String.Pointer, PCI_ROOT_HID, sizeof (PCI_ROOT_HID)))
|
|
|
|
{
|
|
|
|
return AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We found a valid PCI_ROOT_HID.
|
|
|
|
* The parent of the HID entry is the PCI device; Install the default PCI
|
|
|
|
* handler for this PCI device.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* TBD: Namespace is LOCKED here. This call might deadlock. */
|
|
|
|
|
|
|
|
Status = AcpiInstallAddressSpaceHandler (Entry->ParentEntry,
|
|
|
|
ADDRESS_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
|
|
|
|
|
|
|
return AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: EvFindPciRootBuses
|
|
|
|
*
|
|
|
|
* PARAMETERS:
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION:
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
|
|
|
EvFindPciRootBuses (
|
|
|
|
char *NameArg)
|
|
|
|
{
|
|
|
|
|
|
|
|
NsWalkNamespace (ACPI_TYPE_Any, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
|
|
|
|
FALSE, EvFindOnePciRootBus, NameArg, NULL);
|
|
|
|
|
|
|
|
return AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-29 16:39:44 +00:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: EvInstallDefaultAddressSpaceHandlers
|
|
|
|
*
|
|
|
|
* PARAMETERS:
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Installs the core subsystem address space handlers.
|
|
|
|
*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
|
|
|
EvInstallDefaultAddressSpaceHandlers (
|
|
|
|
void)
|
|
|
|
{
|
2005-06-29 16:39:57 +00:00
|
|
|
ACPI_STATUS Status;
|
2005-06-29 16:39:44 +00:00
|
|
|
|
2005-06-29 16:39:57 +00:00
|
|
|
|
2005-06-29 16:39:44 +00:00
|
|
|
FUNCTION_TRACE ("EvInstallDefaultAddressSpaceHandlers");
|
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* NOTE: All address spaces (PCI Config, EC, SMBus) are scope dependent
|
|
|
|
* and registration must occur for a specific device. In the case
|
|
|
|
* system memory and IO address spaces there is currently no device
|
|
|
|
* associated with the address space. For these we use the root.
|
|
|
|
*/
|
2005-06-29 16:39:44 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
Status = AcpiInstallAddressSpaceHandler (Gbl_RootObject,
|
|
|
|
ADDRESS_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
2005-06-29 16:39:57 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
Status = AcpiInstallAddressSpaceHandler (Gbl_RootObject,
|
|
|
|
ADDRESS_SPACE_SYSTEM_IO, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
2005-06-29 16:39:57 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
2005-06-29 16:39:44 +00:00
|
|
|
|
2005-06-29 16:39:52 +00:00
|
|
|
/*
|
2005-06-29 16:40:05 +00:00
|
|
|
* Install PCI config space handler for all PCI root bridge. A PCI root
|
|
|
|
* bridge is found by searching for devices containing a HID with the value
|
|
|
|
* EISAID("PNP0A03")
|
|
|
|
*
|
|
|
|
* BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG
|
|
|
|
*
|
|
|
|
* For now, I am hardcoding the installation of the PCI buses in. This
|
|
|
|
* needs to be fixed ASAP.
|
|
|
|
*
|
|
|
|
* BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG
|
2005-06-29 16:39:52 +00:00
|
|
|
*/
|
2005-06-29 16:39:44 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
{
|
2005-06-29 16:40:07 +00:00
|
|
|
char *PCIBus_devices[] = {"\\_SB_.PCI0", "\\_SB_.PCI1", "\\_SB_.PCI2", "\\_SB_.CBN", NULL };
|
2005-06-29 16:40:05 +00:00
|
|
|
NATIVE_UINT i = 0;
|
|
|
|
|
|
|
|
ACPI_HANDLE PCIBusHandle;
|
|
|
|
|
2005-06-29 16:40:07 +00:00
|
|
|
while (PCIBus_devices[i])
|
|
|
|
{
|
2005-06-29 16:40:05 +00:00
|
|
|
Status = AcpiGetHandle (NULL, PCIBus_devices[i], &PCIBusHandle);
|
|
|
|
if (ACPI_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
Status = AcpiInstallAddressSpaceHandler (PCIBusHandle,
|
|
|
|
ADDRESS_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
2005-06-29 16:40:07 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
} /* PCI Address space handler install */
|
|
|
|
|
2005-06-29 16:39:44 +00:00
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
2005-06-29 16:39:33 +00:00
|
|
|
|
2005-06-29 16:39:50 +00:00
|
|
|
/* TBD: Move to the methods directory */
|
|
|
|
|
2005-06-29 16:39:37 +00:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: EvExecuteRegMethod
|
|
|
|
*
|
|
|
|
* PARAMETERS: RegionObj - Object structure
|
|
|
|
* Function - On (1) or Off (0)
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Execute _REG method for a region
|
|
|
|
*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
|
|
|
EvExecuteRegMethod (
|
|
|
|
ACPI_OBJECT_INTERNAL *RegionObj,
|
|
|
|
UINT32 Function)
|
|
|
|
{
|
|
|
|
ACPI_OBJECT_INTERNAL *Params[3];
|
|
|
|
ACPI_OBJECT_INTERNAL SpaceID_Obj;
|
|
|
|
ACPI_OBJECT_INTERNAL Function_Obj;
|
|
|
|
ACPI_STATUS Status;
|
|
|
|
|
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
FUNCTION_TRACE ("EvExecuteRegMethod");
|
|
|
|
|
|
|
|
|
|
|
|
if (RegionObj->Region.REGMethod == NULL)
|
2005-06-29 16:39:37 +00:00
|
|
|
{
|
2005-06-29 16:39:40 +00:00
|
|
|
return_ACPI_STATUS (AE_OK);
|
2005-06-29 16:39:37 +00:00
|
|
|
}
|
|
|
|
|
2005-06-29 16:39:42 +00:00
|
|
|
/*
|
|
|
|
* _REG method has two arguments
|
|
|
|
* Arg0: Integer: Operation region space ID
|
|
|
|
* Same value as RegionObj->Region.SpaceId
|
|
|
|
* Arg1: Integer: connection status
|
|
|
|
* 1 for connecting the handler,
|
|
|
|
* 0 for disconnecting the handler
|
|
|
|
* Passed as a parameter
|
|
|
|
*/
|
2005-06-29 16:39:37 +00:00
|
|
|
|
2005-06-29 16:39:50 +00:00
|
|
|
CmInitStaticObject (&SpaceID_Obj);
|
|
|
|
CmInitStaticObject (&Function_Obj);
|
2005-06-29 16:39:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Method requires two parameters.
|
|
|
|
*/
|
|
|
|
Params [0] = &SpaceID_Obj;
|
|
|
|
Params [1] = &Function_Obj;
|
2005-06-29 16:39:55 +00:00
|
|
|
Params [2] = NULL;
|
2005-06-29 16:39:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the parameter objects
|
|
|
|
*/
|
2005-06-29 16:39:39 +00:00
|
|
|
SpaceID_Obj.Common.Type = ACPI_TYPE_Number;
|
2005-06-29 16:39:37 +00:00
|
|
|
SpaceID_Obj.Number.Value = RegionObj->Region.SpaceId;
|
|
|
|
|
2005-06-29 16:39:39 +00:00
|
|
|
Function_Obj.Common.Type = ACPI_TYPE_Number;
|
2005-06-29 16:39:37 +00:00
|
|
|
Function_Obj.Number.Value = Function;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Execute the method, no return value
|
|
|
|
*/
|
|
|
|
Status = NsEvaluateByHandle (RegionObj->Region.REGMethod, Params, NULL);
|
2005-06-29 16:39:40 +00:00
|
|
|
return_ACPI_STATUS (Status);
|
2005-06-29 16:39:37 +00:00
|
|
|
}
|
2005-06-29 15:40:01 +00:00
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:27 +00:00
|
|
|
/**************************************************************************
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
2005-06-29 16:39:30 +00:00
|
|
|
* FUNCTION: EvAddressSpaceDispatch
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
2005-06-29 16:40:05 +00:00
|
|
|
* PARAMETERS: RegionObj - internal region object
|
|
|
|
* SpaceId - ID of the address space (0-255)
|
2005-06-29 16:39:30 +00:00
|
|
|
* Function - Read or Write operation
|
|
|
|
* Address - Where in the space to read or write
|
|
|
|
* BitWidth - Field width in bits (8, 16, or 32)
|
|
|
|
* Value - Pointer to in or out value
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
2005-06-29 16:39:30 +00:00
|
|
|
* RETURN: Status
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
2005-06-29 16:39:30 +00:00
|
|
|
* DESCRIPTION: Dispatch an address space or operation region access to
|
|
|
|
* a previously installed handler.
|
2005-06-29 15:40:01 +00:00
|
|
|
*
|
2005-06-29 16:39:27 +00:00
|
|
|
*************************************************************************/
|
2005-06-29 15:40:01 +00:00
|
|
|
|
2005-06-29 16:39:30 +00:00
|
|
|
ACPI_STATUS
|
|
|
|
EvAddressSpaceDispatch (
|
2005-06-29 16:40:05 +00:00
|
|
|
ACPI_OBJECT_INTERNAL *RegionObj,
|
2005-06-29 16:39:30 +00:00
|
|
|
UINT32 Function,
|
|
|
|
UINT32 Address,
|
|
|
|
UINT32 BitWidth,
|
2005-06-29 16:39:37 +00:00
|
|
|
UINT32 *Value)
|
2005-06-29 15:40:01 +00:00
|
|
|
{
|
2005-06-29 16:39:30 +00:00
|
|
|
ACPI_STATUS Status;
|
2005-06-29 16:39:32 +00:00
|
|
|
ADDRESS_SPACE_HANDLER Handler;
|
2005-06-29 16:40:05 +00:00
|
|
|
REGION_SETUP_FUNCTION RegionSetup;
|
2005-06-29 16:39:57 +00:00
|
|
|
ACPI_OBJECT_INTERNAL *HandlerDesc;
|
2005-06-29 16:40:05 +00:00
|
|
|
void *RegionContext;
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:40:11 +00:00
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
FUNCTION_TRACE ("EvAddressSpaceDispatch");
|
|
|
|
|
2005-06-29 16:40:11 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* Check for an installed handler
|
|
|
|
*/
|
|
|
|
HandlerDesc = RegionObj->Region.AddrHandler;
|
2005-06-29 16:39:37 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
if (!HandlerDesc)
|
2005-06-29 16:39:30 +00:00
|
|
|
{
|
2005-06-29 16:40:11 +00:00
|
|
|
DEBUG_PRINT (TRACE_OPREGION, ("Dispatch address access region 0x%X, no handler\n", RegionObj));
|
2005-06-29 16:39:37 +00:00
|
|
|
return_ACPI_STATUS(AE_EXIST);
|
2005-06-29 16:39:30 +00:00
|
|
|
}
|
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* It may be the case that the region has never been initialized
|
|
|
|
* Some types of regions require special init code
|
2005-06-29 16:39:30 +00:00
|
|
|
*/
|
2005-06-29 16:40:11 +00:00
|
|
|
if (!(RegionObj->Region.RegionFlags & REGION_INITIALIZED))
|
|
|
|
{
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* This region has not been initialized yet, do it
|
|
|
|
*/
|
|
|
|
RegionSetup = HandlerDesc->AddrHandler.RegionSetupFunction;
|
2005-06-29 16:40:11 +00:00
|
|
|
if (!RegionSetup)
|
|
|
|
{
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* Bad news, no init routine and not init'd
|
|
|
|
*/
|
2005-06-29 16:40:11 +00:00
|
|
|
DEBUG_PRINT (ACPI_ERROR, ("EvAddressSpaceDispatch: No init routine for region %X\n",
|
|
|
|
RegionObj));
|
|
|
|
return_ACPI_STATUS (AE_UNKNOWN_STATUS);
|
2005-06-29 16:40:05 +00:00
|
|
|
}
|
2005-06-29 16:40:11 +00:00
|
|
|
|
|
|
|
Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
|
2005-06-29 16:40:05 +00:00
|
|
|
HandlerDesc->AddrHandler.InstallTimeContext,
|
|
|
|
&RegionContext);
|
|
|
|
/*
|
|
|
|
* Init routine may fail
|
|
|
|
*/
|
2005-06-29 16:40:11 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
DEBUG_PRINT (ACPI_ERROR, ("EvAddressSpaceDispatch: %s from region init, SpaceID %d\n",
|
|
|
|
CmFormatException (Status), RegionObj->Region.SpaceId));
|
2005-06-29 16:40:05 +00:00
|
|
|
return_ACPI_STATUS(Status);
|
2005-06-29 16:40:11 +00:00
|
|
|
}
|
2005-06-29 16:39:30 +00:00
|
|
|
|
2005-06-29 16:39:37 +00:00
|
|
|
/*
|
2005-06-29 16:40:05 +00:00
|
|
|
* Save the returned context for use in all accesses to the region
|
2005-06-29 16:39:37 +00:00
|
|
|
*/
|
2005-06-29 16:40:05 +00:00
|
|
|
HandlerDesc->AddrHandler.Context = RegionContext;
|
2005-06-29 16:39:37 +00:00
|
|
|
}
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* We have everything we need, begin the process
|
|
|
|
*/
|
|
|
|
Handler = HandlerDesc->AddrHandler.Handler;
|
|
|
|
|
|
|
|
DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO),
|
|
|
|
("Addrhandler 0x%X (0x%X), Address 0x%X\n",
|
|
|
|
RegionObj->Region.AddrHandler->AddrHandler, Handler, Address));
|
2005-06-29 16:39:57 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
if (!(HandlerDesc->AddrHandler.Flags & ADDR_HANDLER_DEFAULT_INSTALLED))
|
2005-06-29 16:39:57 +00:00
|
|
|
{
|
|
|
|
/*
|
2005-06-29 16:40:05 +00:00
|
|
|
* For handlers other than the default (supplied) handlers, we must
|
|
|
|
* exit the interpreter because the handler *might* block -- we don't
|
|
|
|
* know what it will do, so we can't hold the lock on the intepreter.
|
2005-06-29 16:39:57 +00:00
|
|
|
*/
|
2005-06-29 16:40:05 +00:00
|
|
|
AmlExitInterpreter();
|
2005-06-29 16:39:57 +00:00
|
|
|
}
|
2005-06-29 16:39:35 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* Invoke the handler.
|
|
|
|
*/
|
|
|
|
Status = Handler (Function, Address, BitWidth, Value, HandlerDesc->AddrHandler.Context);
|
2005-06-29 16:39:57 +00:00
|
|
|
|
2005-06-29 16:40:11 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
DEBUG_PRINT (ACPI_ERROR, ("EvAddressSpaceDispatch: %s from handler, SpaceID %d\n",
|
|
|
|
CmFormatException (Status), RegionObj->Region.SpaceId));
|
|
|
|
}
|
2005-06-29 16:40:02 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
if (!(HandlerDesc->AddrHandler.Flags & ADDR_HANDLER_DEFAULT_INSTALLED))
|
2005-06-29 16:39:57 +00:00
|
|
|
{
|
|
|
|
/* We just returned from a non-default handler, we must re-enter the interpreter */
|
|
|
|
|
|
|
|
AmlEnterInterpreter ();
|
|
|
|
}
|
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
return_ACPI_STATUS (Status);
|
2005-06-29 15:40:01 +00:00
|
|
|
}
|
2005-06-29 16:39:33 +00:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: EvDisassociateRegionAndHandler
|
|
|
|
*
|
|
|
|
* PARAMETERS: HandlerObj - Handler Object
|
|
|
|
* RegionObj - Region Object
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Break the association between the handler and the region
|
|
|
|
* this is a two way association.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
2005-06-29 16:39:35 +00:00
|
|
|
EvDisassociateRegionFromHandler(
|
|
|
|
ACPI_OBJECT_INTERNAL *RegionObj)
|
2005-06-29 16:39:33 +00:00
|
|
|
{
|
2005-06-29 16:39:35 +00:00
|
|
|
ACPI_OBJECT_INTERNAL *HandlerObj;
|
2005-06-29 16:39:33 +00:00
|
|
|
ACPI_OBJECT_INTERNAL *ObjDesc;
|
2005-06-29 16:39:35 +00:00
|
|
|
ACPI_OBJECT_INTERNAL **LastObjPtr;
|
2005-06-29 16:40:05 +00:00
|
|
|
REGION_SETUP_FUNCTION RegionSetup;
|
|
|
|
void *RegionContext;
|
|
|
|
ACPI_STATUS Status;
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:40:11 +00:00
|
|
|
|
2005-06-29 16:39:33 +00:00
|
|
|
FUNCTION_TRACE ("EvDisassociateRegionAndHandler");
|
|
|
|
|
2005-06-29 16:40:11 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* Get the address handler from the region object
|
|
|
|
*/
|
2005-06-29 16:39:43 +00:00
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
HandlerObj = RegionObj->Region.AddrHandler;
|
|
|
|
if (!HandlerObj)
|
|
|
|
{
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* This guy has no handler, we're done
|
|
|
|
*/
|
2005-06-29 16:39:36 +00:00
|
|
|
return_VOID;
|
2005-06-29 16:39:35 +00:00
|
|
|
}
|
2005-06-29 16:39:43 +00:00
|
|
|
|
2005-06-29 16:39:33 +00:00
|
|
|
/*
|
|
|
|
* Find this region in the handler's list
|
|
|
|
*/
|
2005-06-29 16:39:43 +00:00
|
|
|
|
2005-06-29 16:39:33 +00:00
|
|
|
ObjDesc = HandlerObj->AddrHandler.RegionList;
|
2005-06-29 16:39:43 +00:00
|
|
|
LastObjPtr = &HandlerObj->AddrHandler.RegionList;
|
2005-06-29 16:39:33 +00:00
|
|
|
|
|
|
|
while (ObjDesc)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* See if this is the one
|
|
|
|
*/
|
|
|
|
if (ObjDesc == RegionObj)
|
|
|
|
{
|
2005-06-29 16:39:57 +00:00
|
|
|
DEBUG_PRINT (TRACE_OPREGION, ("Removing Region 0x%X from address handler 0x%X\n",
|
|
|
|
RegionObj, HandlerObj));
|
2005-06-29 16:39:33 +00:00
|
|
|
/*
|
|
|
|
* This is it, remove it from the handler's list
|
|
|
|
*/
|
|
|
|
*LastObjPtr = ObjDesc->Region.Link;
|
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
2005-06-29 16:39:37 +00:00
|
|
|
* Now stop region accesses by executing the _REG
|
|
|
|
* method
|
2005-06-29 16:39:35 +00:00
|
|
|
*/
|
2005-06-29 16:39:37 +00:00
|
|
|
EvExecuteRegMethod (RegionObj, 0);
|
2005-06-29 16:39:35 +00:00
|
|
|
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* Tell undo region prep work
|
|
|
|
*/
|
|
|
|
RegionSetup = HandlerObj->AddrHandler.RegionSetupFunction;
|
|
|
|
Status = RegionSetup ( RegionObj,
|
|
|
|
ACPI_REGION_DEACTIVATE,
|
|
|
|
HandlerObj->AddrHandler.InstallTimeContext,
|
|
|
|
&RegionContext);
|
|
|
|
/*
|
|
|
|
* Init routine may fail
|
|
|
|
*/
|
2005-06-29 16:40:11 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
DEBUG_PRINT (ACPI_ERROR,
|
2005-06-29 16:40:05 +00:00
|
|
|
("EvDisassociateRegionFromHandler: %s from region init, SpaceID %d\n",
|
2005-06-29 16:40:11 +00:00
|
|
|
CmFormatException (Status), RegionObj->Region.SpaceId));
|
2005-06-29 16:40:05 +00:00
|
|
|
/*
|
|
|
|
* Just ignore failures for now
|
|
|
|
*/
|
2005-06-29 16:40:11 +00:00
|
|
|
}
|
2005-06-29 16:40:05 +00:00
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
|
|
|
* Remove handler reference in the region
|
|
|
|
*
|
|
|
|
* NOTE: this doesn't mean that the region goes away
|
|
|
|
* The region is just inaccessible as indicated to
|
|
|
|
* the _REG method
|
|
|
|
*
|
|
|
|
* If the region is on the handler's list
|
|
|
|
* this better be the region's handler
|
|
|
|
*/
|
2005-06-29 16:39:40 +00:00
|
|
|
ACPI_ASSERT (RegionObj->Region.AddrHandler == HandlerObj);
|
2005-06-29 16:39:35 +00:00
|
|
|
|
|
|
|
RegionObj->Region.AddrHandler = NULL;
|
|
|
|
|
2005-06-29 16:39:36 +00:00
|
|
|
return_VOID;
|
2005-06-29 16:39:33 +00:00
|
|
|
|
|
|
|
} /* found the right handler */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Move through the linked list of handlers
|
|
|
|
*/
|
|
|
|
LastObjPtr = &ObjDesc->Region.Link;
|
|
|
|
ObjDesc = ObjDesc->Region.Link;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we get here, the region was not not in the handler's region list
|
|
|
|
*/
|
2005-06-29 16:39:57 +00:00
|
|
|
DEBUG_PRINT (TRACE_OPREGION, ("Cannot remove region 0x%X from address handler 0x%X\n",
|
|
|
|
RegionObj, HandlerObj));
|
2005-06-29 16:39:33 +00:00
|
|
|
|
2005-06-29 16:39:42 +00:00
|
|
|
return_VOID;
|
2005-06-29 16:40:02 +00:00
|
|
|
}
|
2005-06-29 16:39:33 +00:00
|
|
|
|
2005-06-29 16:40:11 +00:00
|
|
|
|
2005-06-29 16:39:33 +00:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
2005-06-29 16:39:43 +00:00
|
|
|
* FUNCTION: EvAssociateRegionAndHandler
|
2005-06-29 16:39:33 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS: HandlerObj - Handler Object
|
|
|
|
* RegionObj - Region Object
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create the association between the handler and the region
|
|
|
|
* this is a two way association.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-06-29 16:39:36 +00:00
|
|
|
ACPI_STATUS
|
2005-06-29 16:39:43 +00:00
|
|
|
EvAssociateRegionAndHandler(
|
2005-06-29 16:39:33 +00:00
|
|
|
ACPI_OBJECT_INTERNAL *HandlerObj,
|
|
|
|
ACPI_OBJECT_INTERNAL *RegionObj)
|
|
|
|
{
|
2005-06-29 16:39:37 +00:00
|
|
|
ACPI_STATUS Status;
|
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:43 +00:00
|
|
|
FUNCTION_TRACE ("EvAssociateRegionAndHandler");
|
2005-06-29 16:39:33 +00:00
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:57 +00:00
|
|
|
DEBUG_PRINT (TRACE_OPREGION, ("Adding Region 0x%X to address handler 0x%X\n",
|
|
|
|
RegionObj, HandlerObj));
|
2005-06-29 16:39:35 +00:00
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
ACPI_ASSERT (RegionObj->Region.SpaceId == HandlerObj->AddrHandler.SpaceId);
|
|
|
|
ACPI_ASSERT (RegionObj->Region.AddrHandler == 0);
|
2005-06-29 16:39:33 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Link this region to the front of the handler's list
|
|
|
|
*/
|
|
|
|
|
|
|
|
RegionObj->Region.Link = HandlerObj->AddrHandler.RegionList;
|
|
|
|
HandlerObj->AddrHandler.RegionList = RegionObj;
|
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
|
|
|
* set the region's handler
|
|
|
|
*/
|
2005-06-29 16:40:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
HandlerObj->Common.ReferenceCount = (UINT16) (HandlerObj->Common.ReferenceCount + RegionObj->Common.ReferenceCount - 1);
|
|
|
|
*/
|
2005-06-29 16:39:35 +00:00
|
|
|
RegionObj->Region.AddrHandler = HandlerObj;
|
|
|
|
|
2005-06-29 16:39:37 +00:00
|
|
|
/*
|
|
|
|
* Last thing, tell ASL region is usable
|
|
|
|
*/
|
2005-06-29 16:40:13 +00:00
|
|
|
CmReleaseMutex (MTX_NAMESPACE);
|
|
|
|
Status = EvExecuteRegMethod (RegionObj, 1);
|
|
|
|
CmAcquireMutex (MTX_NAMESPACE);
|
2005-06-29 16:39:37 +00:00
|
|
|
|
|
|
|
return_ACPI_STATUS (Status);
|
2005-06-29 16:40:02 +00:00
|
|
|
}
|
2005-06-29 16:39:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: EvAddrHandlerHelper
|
|
|
|
*
|
|
|
|
* PARAMETERS: Handle - Entry to be dumped
|
|
|
|
* Level - Nesting level of the handle
|
|
|
|
* Context - Passed into NsWalkNamespace
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This routine checks to see if the object is a Region if it
|
|
|
|
* is then the address handler is installed in it.
|
|
|
|
*
|
|
|
|
* If the Object is a Device, and the device has a handler of
|
|
|
|
* the same type then the search is terminated in that branch.
|
|
|
|
*
|
|
|
|
* This is because the existing handler is closer in proximity
|
|
|
|
* to any more regions than the one we are trying to install.
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2005-06-29 16:39:41 +00:00
|
|
|
ACPI_STATUS
|
2005-06-29 16:39:33 +00:00
|
|
|
EvAddrHandlerHelper (
|
|
|
|
ACPI_HANDLE ObjHandle,
|
|
|
|
UINT32 Level,
|
2005-06-29 16:39:41 +00:00
|
|
|
void *Context,
|
|
|
|
void **ReturnValue)
|
2005-06-29 16:39:33 +00:00
|
|
|
{
|
2005-06-29 16:39:48 +00:00
|
|
|
ACPI_OBJECT_INTERNAL *HandlerObj;
|
|
|
|
ACPI_OBJECT_INTERNAL *TmpObj;
|
2005-06-29 16:39:33 +00:00
|
|
|
ACPI_OBJECT_INTERNAL *ObjDesc;
|
|
|
|
NAME_TABLE_ENTRY *ObjEntry;
|
2005-06-29 16:39:50 +00:00
|
|
|
ACPI_STATUS Status;
|
2005-06-29 16:39:33 +00:00
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:33 +00:00
|
|
|
HandlerObj = (ACPI_OBJECT_INTERNAL *) Context;
|
|
|
|
|
|
|
|
/* Parameter validation */
|
|
|
|
|
|
|
|
if (!HandlerObj)
|
|
|
|
{
|
2005-06-29 16:39:42 +00:00
|
|
|
return (AE_OK);
|
2005-06-29 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert and validate the device handle */
|
|
|
|
|
2005-06-29 16:39:58 +00:00
|
|
|
ObjEntry = NsConvertHandleToEntry (ObjHandle);
|
|
|
|
if (!ObjEntry)
|
2005-06-29 16:39:33 +00:00
|
|
|
{
|
2005-06-29 16:39:42 +00:00
|
|
|
return (AE_BAD_PARAMETER);
|
2005-06-29 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We only care about regions.and objects
|
|
|
|
* that can have address handlers
|
|
|
|
*/
|
|
|
|
|
2005-06-29 16:39:39 +00:00
|
|
|
if ((ObjEntry->Type != ACPI_TYPE_Device) &&
|
|
|
|
(ObjEntry->Type != ACPI_TYPE_Region) &&
|
2005-06-29 16:39:35 +00:00
|
|
|
(ObjEntry != Gbl_RootObject))
|
2005-06-29 16:39:33 +00:00
|
|
|
{
|
2005-06-29 16:39:42 +00:00
|
|
|
return (AE_OK);
|
2005-06-29 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for an existing internal object */
|
|
|
|
|
2005-06-29 16:39:48 +00:00
|
|
|
ObjDesc = NsGetAttachedObject ((ACPI_HANDLE) ObjEntry);
|
2005-06-29 16:39:33 +00:00
|
|
|
if (!ObjDesc)
|
|
|
|
{
|
|
|
|
/*
|
2005-06-29 16:39:35 +00:00
|
|
|
* The object DNE, we don't care about it
|
2005-06-29 16:39:33 +00:00
|
|
|
*/
|
2005-06-29 16:39:42 +00:00
|
|
|
return (AE_OK);
|
2005-06-29 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
|
|
|
* Devices are handled different than regions
|
|
|
|
*/
|
2005-06-29 16:39:51 +00:00
|
|
|
if (IS_THIS_OBJECT_TYPE (ObjDesc, ACPI_TYPE_Device))
|
2005-06-29 16:39:33 +00:00
|
|
|
{
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
|
|
|
* See if this guy has any handlers
|
|
|
|
*/
|
2005-06-29 16:39:33 +00:00
|
|
|
TmpObj = ObjDesc->Device.AddrHandler;
|
|
|
|
while (TmpObj)
|
|
|
|
{
|
|
|
|
/*
|
2005-06-29 16:39:35 +00:00
|
|
|
* Now let's see if it's for the same address space.
|
2005-06-29 16:39:33 +00:00
|
|
|
*/
|
2005-06-29 16:39:35 +00:00
|
|
|
if (TmpObj->AddrHandler.SpaceId == HandlerObj->AddrHandler.SpaceId)
|
2005-06-29 16:39:40 +00:00
|
|
|
{
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
|
|
|
* It's for the same address space
|
|
|
|
*/
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:57 +00:00
|
|
|
DEBUG_PRINT (TRACE_OPREGION, ("Found handler for %s in device 0x%X (0x%X) handler 0x%X\n",
|
|
|
|
Gbl_RegionTypes[HandlerObj->AddrHandler.SpaceId], ObjDesc, TmpObj, HandlerObj));
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:41 +00:00
|
|
|
/*
|
2005-06-29 16:39:35 +00:00
|
|
|
* Since the object we found it on was a device, then it
|
|
|
|
* means that someone has already installed a handler for
|
|
|
|
* the branch of the namespace from this device on. Just
|
|
|
|
* bail out telling the walk routine to not traverse this
|
|
|
|
* branch. This preserves the scoping rule for handlers.
|
|
|
|
*/
|
2005-06-29 16:40:08 +00:00
|
|
|
return (AE_CTRL_DEPTH);
|
2005-06-29 16:39:33 +00:00
|
|
|
}
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:33 +00:00
|
|
|
/*
|
|
|
|
* Move through the linked list of handlers
|
|
|
|
*/
|
|
|
|
TmpObj = TmpObj->AddrHandler.Link;
|
|
|
|
}
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
|
|
|
* As long as the device didn't have a handler for this
|
|
|
|
* space we don't care about it. We just ignore it and
|
|
|
|
* proceed.
|
|
|
|
*/
|
2005-06-29 16:39:42 +00:00
|
|
|
return (AE_OK);
|
2005-06-29 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-06-29 16:39:35 +00:00
|
|
|
* Only here if it was a region
|
|
|
|
*/
|
2005-06-29 16:39:40 +00:00
|
|
|
ACPI_ASSERT (ObjDesc->Common.Type == ACPI_TYPE_Region);
|
2005-06-29 16:39:35 +00:00
|
|
|
|
|
|
|
if (ObjDesc->Region.SpaceId != HandlerObj->AddrHandler.SpaceId)
|
|
|
|
{
|
|
|
|
/*
|
2005-06-29 16:39:41 +00:00
|
|
|
* This region is for a different address space
|
2005-06-29 16:39:35 +00:00
|
|
|
* ignore it
|
|
|
|
*/
|
2005-06-29 16:39:42 +00:00
|
|
|
return (AE_OK);
|
2005-06-29 16:39:35 +00:00
|
|
|
}
|
2005-06-29 16:39:40 +00:00
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
|
|
|
* Now we have a region and it is for the handler's address
|
|
|
|
* space type.
|
|
|
|
*
|
|
|
|
* First disconnect region for any previous handler (if any)
|
2005-06-29 16:39:33 +00:00
|
|
|
*/
|
2005-06-29 16:39:40 +00:00
|
|
|
EvDisassociateRegionFromHandler (ObjDesc);
|
2005-06-29 16:39:33 +00:00
|
|
|
|
2005-06-29 16:39:35 +00:00
|
|
|
/*
|
2005-06-29 16:39:43 +00:00
|
|
|
* Then connect the region to the new handler
|
2005-06-29 16:39:35 +00:00
|
|
|
*/
|
2005-06-29 16:39:50 +00:00
|
|
|
Status = EvAssociateRegionAndHandler (HandlerObj, ObjDesc);
|
2005-06-29 16:39:33 +00:00
|
|
|
|
2005-06-29 16:39:50 +00:00
|
|
|
return (Status);
|
2005-06-29 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
2005-06-29 16:39:40 +00:00
|
|
|
|