Add mechanism to defer _REG methods for some installed handlers.

The memory/io/pci/dataTable regions must always be available. For
any user installed handlers for these spaces, defer execution of
_REG methods until AcpiEnableSubsystem. This prevents any
chicken/egg problems and ensures that no methods are executed
until all of these regions are ready and available.
This commit is contained in:
Robert Moore 2011-01-28 12:37:20 -08:00
parent 21575b86a8
commit ceee99f6e0
5 changed files with 41 additions and 3 deletions

View File

@ -334,6 +334,8 @@ AcpiEvInitializeOpRegions (
}
}
AcpiGbl_RegMethodsExecuted = TRUE;
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}

View File

@ -192,9 +192,41 @@ AcpiInstallAddressSpaceHandler (
goto UnlockAndExit;
}
/* Run all _REG methods for this address space */
/*
* For the default SpaceIDs, (the IDs for which there are default region handlers
* installed) Only execute the _REG methods if the global initialization _REG
* methods have already been run (via AcpiInitializeObjects). In other words,
* we will defer the execution of the _REG methods for these SpaceIDs until
* execution of AcpiInitializeObjects. This is done because we need the handlers
* for the default spaces (mem/io/pci/table) to be installed before we can run
* any control methods (or _REG methods). There is known BIOS code that depends
* on this.
*
* For all other SpaceIDs, we can safely execute the _REG methods immediately.
* This means that for IDs like EmbeddedController, this function should be called
* only after AcpiEnableSubsystem has been called.
*/
switch (SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
case ACPI_ADR_SPACE_SYSTEM_IO:
case ACPI_ADR_SPACE_PCI_CONFIG:
case ACPI_ADR_SPACE_DATA_TABLE:
if (AcpiGbl_RegMethodsExecuted)
{
/* Run all _REG methods for this address space */
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
}
break;
default:
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
break;
}
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);

View File

@ -378,6 +378,7 @@ AcpiUtInitGlobals (
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
AcpiGbl_OsiData = 0;
AcpiGbl_OsiMutex = NULL;
AcpiGbl_RegMethodsExecuted = FALSE;
/* Hardware oriented */

View File

@ -295,7 +295,6 @@ AcpiDbGetBusInfo (
void);
/*
* dbdisply - debug display commands
*/

View File

@ -317,6 +317,10 @@ ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MAS
ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex;
ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset;
/* Initialization sequencing */
ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted;
/* Misc */
ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;