iASL: Do not abort table load on invalid space ID, FFixedHW support.

Ignore an invalid space ID during a table load. Instead, detect it
if a control method attempts access - then abort the method.
Also, fix support for FFixedHW address space.
This commit is contained in:
Robert Moore 2011-08-11 14:17:36 -07:00 committed by Lin Ming
parent 487361a06c
commit 543f278f0a
5 changed files with 60 additions and 13 deletions

View File

@ -1045,7 +1045,7 @@ AcpiDbDisplayHandlers (
while (HandlerObj)
{
if (i == HandlerObj->AddressSpace.SpaceId)
if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId)
{
AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
(HandlerObj->AddressSpace.HandlerFlags &

View File

@ -357,7 +357,7 @@ Cleanup:
*
* PARAMETERS: AmlStart - Pointer to the region declaration AML
* AmlLength - Max length of the declaration AML
* RegionSpace - SpaceID for the region
* SpaceId - Address space ID for the region
* WalkState - Current state
*
* RETURN: Status
@ -370,7 +370,7 @@ ACPI_STATUS
AcpiExCreateRegion (
UINT8 *AmlStart,
UINT32 AmlLength,
UINT8 RegionSpace,
UINT8 SpaceId,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
@ -399,16 +399,18 @@ AcpiExCreateRegion (
* Space ID must be one of the predefined IDs, or in the user-defined
* range
*/
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
(RegionSpace < ACPI_USER_REGION_BEGIN) &&
(RegionSpace != ACPI_ADR_SPACE_DATA_TABLE))
if (!AcpiIsValidSpaceId (SpaceId))
{
ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
/*
* Print an error message, but continue. We don't want to abort
* a table load for this exception. Instead, if the region is
* actually used at runtime, abort the executing method.
*/
ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId));
}
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
AcpiUtGetRegionName (RegionSpace), RegionSpace));
AcpiUtGetRegionName (SpaceId), SpaceId));
/* Create the region descriptor */
@ -437,7 +439,7 @@ AcpiExCreateRegion (
/* Init the region from the operands */
ObjDesc->Region.SpaceId = RegionSpace;
ObjDesc->Region.SpaceId = SpaceId;
ObjDesc->Region.Address = 0;
ObjDesc->Region.Length = 0;
ObjDesc->Region.Node = Node;

View File

@ -170,6 +170,7 @@ AcpiExSetupRegion (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *RgnDesc;
UINT8 SpaceId;
ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset);
@ -188,6 +189,16 @@ AcpiExSetupRegion (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
SpaceId = RgnDesc->Region.SpaceId;
/* Validate the Space ID */
if (!AcpiIsValidSpaceId (SpaceId))
{
ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
/*
* If the Region Address and Length have not been previously evaluated,
* evaluate them now and save the results.
@ -205,9 +216,9 @@ AcpiExSetupRegion (
* Exit now for SMBus, GSBus or IPMI address space, it has a non-linear
* address space and the request cannot be directly validated
*/
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI)
if (SpaceId == ACPI_ADR_SPACE_SMBUS ||
SpaceId == ACPI_ADR_SPACE_GSBUS ||
SpaceId == ACPI_ADR_SPACE_IPMI)
{
/* SMBus or IPMI has a non-linear address space */

View File

@ -571,4 +571,34 @@ AcpiExIntegerToString (
}
}
/*******************************************************************************
*
* FUNCTION: AcpiIsValidSpaceId
*
* PARAMETERS: SpaceId - ID to be validated
*
* RETURN: TRUE if valid/supported ID.
*
* DESCRIPTION: Validate an operation region SpaceID.
*
******************************************************************************/
BOOLEAN
AcpiIsValidSpaceId (
UINT8 SpaceId)
{
if ((SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) &&
(SpaceId < ACPI_USER_REGION_BEGIN) &&
(SpaceId != ACPI_ADR_SPACE_DATA_TABLE) &&
(SpaceId != ACPI_ADR_SPACE_FIXED_HARDWARE))
{
return (FALSE);
}
return (TRUE);
}
#endif

View File

@ -714,6 +714,10 @@ AcpiExIntegerToString (
char *Dest,
UINT64 Value);
BOOLEAN
AcpiIsValidSpaceId (
UINT8 SpaceId);
/*
* exregion - default OpRegion handlers