Region specific context added.

date	2000.07.28.18.42.00;	author mwalz;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:40:32 +00:00
parent 120dd0cedd
commit 7d2f018023
2 changed files with 32 additions and 60 deletions

View File

@ -398,7 +398,7 @@ AcpiEvAddressSpaceDispatch (
ADDRESS_SPACE_HANDLER Handler;
ADDRESS_SPACE_SETUP RegionSetup;
ACPI_OBJECT_INTERNAL *HandlerDesc;
void *RegionContext;
void *RegionContext = NULL;
FUNCTION_TRACE ("EvAddressSpaceDispatch");
@ -489,11 +489,10 @@ AcpiEvAddressSpaceDispatch (
}
/*
* Invoke the handler. The RegionContext will contain
* address handler's context and possibly some other information
* (e.g. for PCI address handlers.
* Invoke the handler.
*/
Status = Handler (Function, Address, BitWidth, Value,
HandlerDesc->AddrHandler.Context,
RegionObj->Region.RegionContext);
if (ACPI_FAILURE (Status))
@ -536,7 +535,7 @@ AcpiEvDisassociateRegionFromHandler(
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OBJECT_INTERNAL **LastObjPtr;
ADDRESS_SPACE_SETUP RegionSetup;
void *RegionContext;
void *RegionContext = RegionObj->Region.RegionContext;
ACPI_STATUS Status;
@ -592,12 +591,6 @@ AcpiEvDisassociateRegionFromHandler(
HandlerObj->AddrHandler.Context,
&RegionContext);
/*
* Save the returned context (It is the original context
* passed into Install)
*/
HandlerObj->AddrHandler.Context = RegionContext;
/*
* Init routine may fail, Just ignore errors
*/

View File

@ -133,8 +133,8 @@
* PARAMETERS: RegionObj - region we are interested in
* Function - start or stop
* HandlerContext - Address space handler context
* Returned context - context to be used with each call to the
* handler for this region
* RegionContext - Region specific context
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling, a nop for now
@ -146,9 +146,8 @@ AcpiEvSystemMemoryRegionSetup (
ACPI_HANDLE Handle,
UINT32 Function,
void *HandlerContext,
void **ReturnContext)
void **RegionContext)
{
MEM_HANDLER_CONTEXT *MemContext;
ACPI_OBJECT_INTERNAL *RegionObj = (ACPI_OBJECT_INTERNAL *) Handle;
@ -159,13 +158,10 @@ AcpiEvSystemMemoryRegionSetup (
{
RegionObj->Region.RegionFlags &= ~(REGION_INITIALIZED);
*ReturnContext = NULL;
if (HandlerContext)
if (*RegionContext)
{
MemContext = HandlerContext;
*ReturnContext = MemContext->HandlerContext;
AcpiCmFree (MemContext);
AcpiCmFree (*RegionContext);
*RegionContext = NULL;
}
return_ACPI_STATUS (AE_OK);
}
@ -173,18 +169,16 @@ AcpiEvSystemMemoryRegionSetup (
/* Activate. Create a new context */
MemContext = AcpiCmCallocate (sizeof (MEM_HANDLER_CONTEXT));
if (!MemContext)
*RegionContext = AcpiCmCallocate (sizeof (MEM_HANDLER_CONTEXT));
if (!(*RegionContext))
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Init. (Mapping fields are all set to zeros above) */
MemContext->HandlerContext = HandlerContext;
RegionObj->Region.RegionFlags |= REGION_INITIALIZED;
*ReturnContext = MemContext;
return_ACPI_STATUS (AE_OK);
}
@ -196,8 +190,8 @@ AcpiEvSystemMemoryRegionSetup (
* PARAMETERS: RegionObj - region we are interested in
* Function - start or stop
* HandlerContext - Address space handler context
* Returned context - context to be used with each call to the
* handler for this region
* RegionContext - Region specific context
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
@ -209,25 +203,22 @@ AcpiEvIoSpaceRegionSetup (
ACPI_HANDLE Handle,
UINT32 Function,
void *HandlerContext,
void **ReturnContext)
void **RegionContext)
{
ACPI_OBJECT_INTERNAL *RegionObj = (ACPI_OBJECT_INTERNAL *) Handle;
FUNCTION_TRACE ("EvIoSpaceRegionSetup");
if (Function == ACPI_REGION_DEACTIVATE)
{
*RegionContext = NULL;
RegionObj->Region.RegionFlags &= ~(REGION_INITIALIZED);
*ReturnContext = HandlerContext;
return_ACPI_STATUS (AE_OK);
}
/* Activate the region */
RegionObj->Region.RegionFlags |= REGION_INITIALIZED;
*ReturnContext = HandlerContext;
else
{
*RegionContext = HandlerContext;
RegionObj->Region.RegionFlags |= REGION_INITIALIZED;
}
return_ACPI_STATUS (AE_OK);
}
@ -240,8 +231,8 @@ AcpiEvIoSpaceRegionSetup (
* PARAMETERS: RegionObj - region we are interested in
* Function - start or stop
* HandlerContext - Address space handler context
* Returned context - context to be used with each call to the
* handler for this region
* RegionContext - Region specific context
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
@ -255,11 +246,11 @@ AcpiEvPciConfigRegionSetup (
ACPI_HANDLE Handle,
UINT32 Function,
void *HandlerContext,
void **ReturnContext)
void **RegionContext)
{
ACPI_STATUS Status = AE_OK;
UINT32 Temp;
PCI_HANDLER_CONTEXT *PciContext;
PCI_HANDLER_CONTEXT *PciContext = *RegionContext;
ACPI_OBJECT_INTERNAL *HandlerObj;
ACPI_NAMED_OBJECT *SearchScope;
ACPI_OBJECT_INTERNAL *RegionObj = (ACPI_OBJECT_INTERNAL *) Handle;
@ -267,7 +258,6 @@ AcpiEvPciConfigRegionSetup (
FUNCTION_TRACE ("EvPciConfigRegionSetup");
HandlerObj = RegionObj->Region.AddrHandler;
if (!HandlerObj)
@ -285,13 +275,10 @@ AcpiEvPciConfigRegionSetup (
{
RegionObj->Region.RegionFlags &= ~(REGION_INITIALIZED);
*ReturnContext = NULL;
if (HandlerContext)
if (PciContext)
{
PciContext = HandlerContext;
*ReturnContext = PciContext->HandlerContext;
AcpiCmFree (PciContext);
*RegionContext = NULL;
}
return_ACPI_STATUS (Status);
@ -365,15 +352,8 @@ AcpiEvPciConfigRegionSetup (
PciContext->Bus = Temp;
}
/*
* Finally, include the original Handler context in the newly created PciContext
*/
PciContext->HandlerContext = HandlerContext;
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
*ReturnContext = PciContext;
RegionObj->Region.RegionFlags |= REGION_INITIALIZED;
return_ACPI_STATUS (AE_OK);
@ -387,8 +367,8 @@ AcpiEvPciConfigRegionSetup (
* PARAMETERS: RegionObj - region we are interested in
* Function - start or stop
* HandlerContext - Address space handler context
* Returned context - context to be used with each call to the
* handler for this region
* RegionContext - Region specific context
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
@ -400,23 +380,22 @@ AcpiEvDefaultRegionSetup (
ACPI_HANDLE Handle,
UINT32 Function,
void *HandlerContext,
void **ReturnContext)
void **RegionContext)
{
ACPI_OBJECT_INTERNAL *RegionObj = (ACPI_OBJECT_INTERNAL *) Handle;
FUNCTION_TRACE ("EvDefaultRegionSetup");
if (Function == ACPI_REGION_DEACTIVATE)
{
*RegionContext = NULL;
RegionObj->Region.RegionFlags &= ~(REGION_INITIALIZED);
*ReturnContext = NULL;
}
else
{
*RegionContext = HandlerContext;
RegionObj->Region.RegionFlags |= REGION_INITIALIZED;
*ReturnContext = HandlerContext;
}
return_ACPI_STATUS (AE_OK);