mirror of
https://github.com/acpica/acpica/
synced 2025-02-24 17:34:43 +03:00
AcpiExec: Split handler installation into early/late phases.
Most handlers should be installed before call to AcpiEnableSubsystem. However, Event handlers and region handlers should be installed after AcpiInitializeObjects. Override handlers for the "default" regions should be installed early, however. ACPICA BZ 848.
This commit is contained in:
parent
ceee99f6e0
commit
8ab2602d47
@ -232,7 +232,11 @@ AeDisplayAllMethods (
|
||||
UINT32 DisplayCount);
|
||||
|
||||
ACPI_STATUS
|
||||
AeInstallHandlers (
|
||||
AeInstallEarlyHandlers (
|
||||
void);
|
||||
|
||||
ACPI_STATUS
|
||||
AeInstallLateHandlers (
|
||||
void);
|
||||
|
||||
void
|
||||
|
@ -163,10 +163,40 @@ AeInterfaceHandler (
|
||||
ACPI_STRING InterfaceName,
|
||||
UINT32 Supported);
|
||||
|
||||
static UINT32
|
||||
AeEventHandler (
|
||||
void *Context);
|
||||
|
||||
static UINT32 SigintCount = 0;
|
||||
static AE_DEBUG_REGIONS AeRegions;
|
||||
|
||||
|
||||
/*
|
||||
* We will override most of the default region handlers, especially the
|
||||
* SystemMemory handler, which must be implemented locally. Do not override
|
||||
* the PCI_Config handler since we would like to exercise the default handler
|
||||
* code.
|
||||
*/
|
||||
static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] =
|
||||
{
|
||||
ACPI_ADR_SPACE_SYSTEM_MEMORY,
|
||||
ACPI_ADR_SPACE_SYSTEM_IO,
|
||||
ACPI_ADR_SPACE_DATA_TABLE
|
||||
};
|
||||
|
||||
/*
|
||||
* We will install handlers for some of the various address space IDs
|
||||
*/
|
||||
static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
|
||||
{
|
||||
ACPI_ADR_SPACE_EC,
|
||||
ACPI_ADR_SPACE_SMBUS,
|
||||
ACPI_ADR_SPACE_PCI_BAR_TARGET,
|
||||
ACPI_ADR_SPACE_IPMI,
|
||||
ACPI_ADR_SPACE_FIXED_HARDWARE
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AeCtrlCHandler
|
||||
@ -555,6 +585,22 @@ AeInterfaceHandler (
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AeEventHandler
|
||||
*
|
||||
* DESCRIPTION: Handler for Fixed Events
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static UINT32
|
||||
AeEventHandler (
|
||||
void *Context)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AeRegionInit
|
||||
@ -585,7 +631,58 @@ AeRegionInit (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AeInstallHandlers
|
||||
* FUNCTION: AeInstallLateHandlers
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Install handlers for the AcpiExec utility.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AeInstallLateHandlers (
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Install some fixed event handlers */
|
||||
|
||||
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL);
|
||||
AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
|
||||
|
||||
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL);
|
||||
AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
|
||||
|
||||
/*
|
||||
* Install handlers for some of the "device driver" address spaces
|
||||
* such as EC, SMBus, etc.
|
||||
*/
|
||||
for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
|
||||
{
|
||||
/* Install handler at the root object */
|
||||
|
||||
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
|
||||
SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not install an OpRegion handler for %s space(%u)",
|
||||
AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
|
||||
return (Status);
|
||||
}
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AeInstallEarlyHandlers
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
@ -598,11 +695,9 @@ AeRegionInit (
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static ACPI_ADR_SPACE_TYPE SpaceIdList[] = {0, 1, 3, 4, 5, 6, 7, 0x80};
|
||||
#define AEXEC_NUM_REGIONS 8
|
||||
|
||||
ACPI_STATUS
|
||||
AeInstallHandlers (void)
|
||||
AeInstallEarlyHandlers (
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
UINT32 i;
|
||||
@ -700,25 +795,24 @@ AeInstallHandlers (void)
|
||||
printf ("No _SB_ found, %s\n", AcpiFormatException (Status));
|
||||
}
|
||||
|
||||
/* Set a handler for all supported operation regions */
|
||||
|
||||
for (i = 0; i < AEXEC_NUM_REGIONS; i++)
|
||||
/*
|
||||
* Install handlers that will override the default handlers for some of
|
||||
* the space IDs.
|
||||
*/
|
||||
for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++)
|
||||
{
|
||||
/* Remove any existing handler */
|
||||
/* Install handler at the root object */
|
||||
|
||||
(void) AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
|
||||
SpaceIdList[i], AeRegionHandler);
|
||||
|
||||
/* Install handler at the root object.
|
||||
* TBD: all default handlers should be installed here!
|
||||
*/
|
||||
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
|
||||
SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
|
||||
DefaultSpaceIdList[i], AeRegionHandler,
|
||||
AeRegionInit, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_EXCEPTION ((AE_INFO, Status,
|
||||
"Could not install an OpRegion handler for %s space(%u)",
|
||||
AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
|
||||
"Could not install a default OpRegion handler for %s space(%u)",
|
||||
AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]),
|
||||
DefaultSpaceIdList[i]));
|
||||
return (Status);
|
||||
}
|
||||
}
|
||||
@ -729,7 +823,6 @@ AeInstallHandlers (void)
|
||||
*/
|
||||
AeRegions.NumberOfRegions = 0;
|
||||
AeRegions.RegionList = NULL;
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
@ -688,15 +688,18 @@ main (
|
||||
goto enterloop;
|
||||
}
|
||||
|
||||
Status = AeInstallHandlers ();
|
||||
/*
|
||||
* Install most of the handlers.
|
||||
* Override some default region handlers, especially SystemMemory
|
||||
*/
|
||||
Status = AeInstallEarlyHandlers ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto enterloop;
|
||||
}
|
||||
|
||||
/*
|
||||
* TBD:
|
||||
* Need a way to call this after the "LOAD" command
|
||||
* TBD: Need a way to call this after the "LOAD" command
|
||||
*/
|
||||
Status = AcpiEnableSubsystem (InitFlags);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -712,6 +715,11 @@ main (
|
||||
goto enterloop;
|
||||
}
|
||||
|
||||
/*
|
||||
* Install handlers for "device driver" space IDs (EC,SMBus, etc.)
|
||||
* and fixed event handlers
|
||||
*/
|
||||
AeInstallLateHandlers ();
|
||||
AeMiscellaneousTests ();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user