mirror of https://github.com/acidanthera/audk.git
DynamicTablesPkg: GTDT updates for ACPI 6.3
The ACPI 6.3 specification adds support for describing ARMv8.1 EL2 virtual timers. Update GTDT Generator to extend this support. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
parent
77db115601
commit
e8015f2fac
|
@ -301,6 +301,12 @@ typedef struct CmArmGenericTimerInfo {
|
||||||
|
|
||||||
/// The non-secure PL2 timer flags
|
/// The non-secure PL2 timer flags
|
||||||
UINT32 NonSecurePL2TimerFlags;
|
UINT32 NonSecurePL2TimerFlags;
|
||||||
|
|
||||||
|
/// GSIV for the virtual EL2 timer
|
||||||
|
UINT32 VirtualPL2TimerGSIV;
|
||||||
|
|
||||||
|
/// Flags for the virtual EL2 timer
|
||||||
|
UINT32 VirtualPL2TimerFlags;
|
||||||
} CM_ARM_GENERIC_TIMER_INFO;
|
} CM_ARM_GENERIC_TIMER_INFO;
|
||||||
|
|
||||||
/** A structure that describes the
|
/** A structure that describes the
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@par Reference(s):
|
@par Reference(s):
|
||||||
- ACPI 6.2 Specification - Errata A, September 2017
|
- ACPI 6.3 Specification - January 2019
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ GET_OBJECT_LIST (
|
||||||
Protocol Interface.
|
Protocol Interface.
|
||||||
@param [in] Gtdt Pointer to the GTDT Table.
|
@param [in] Gtdt Pointer to the GTDT Table.
|
||||||
@param [in] PlatformTimerCount Platform timer count.
|
@param [in] PlatformTimerCount Platform timer count.
|
||||||
|
@param [in] AcpiTableRevision Acpi Revision targeted by the platform.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
@retval EFI_SUCCESS Success.
|
||||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||||
|
@ -90,8 +91,9 @@ EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AddGenericTimerInfo (
|
AddGenericTimerInfo (
|
||||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||||
IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||||
IN CONST UINT32 PlatformTimerCount
|
IN CONST UINT32 PlatformTimerCount,
|
||||||
|
IN CONST UINT32 AcpiTableRevision
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
@ -131,9 +133,14 @@ AddGenericTimerInfo (
|
||||||
GenericTimerInfo->CounterReadBaseAddress;
|
GenericTimerInfo->CounterReadBaseAddress;
|
||||||
Gtdt->PlatformTimerCount = PlatformTimerCount;
|
Gtdt->PlatformTimerCount = PlatformTimerCount;
|
||||||
Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 :
|
Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 :
|
||||||
sizeof (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE);
|
sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) {
|
||||||
|
Gtdt->VirtualPL2TimerGSIV = GenericTimerInfo->VirtualPL2TimerGSIV;
|
||||||
|
Gtdt->VirtualPL2TimerFlags = GenericTimerInfo->VirtualPL2TimerFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add the SBSA Generic Watchdog Timers to the GTDT table.
|
/** Add the SBSA Generic Watchdog Timers to the GTDT table.
|
||||||
|
@ -147,26 +154,26 @@ AddGenericTimerInfo (
|
||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
AddGenericWatchdogList (
|
AddGenericWatchdogList (
|
||||||
IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||||
IN CONST UINT32 WatchdogOffset,
|
IN CONST UINT32 WatchdogOffset,
|
||||||
IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList,
|
IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList,
|
||||||
IN UINT32 WatchdogCount
|
IN UINT32 WatchdogCount
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog;
|
EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog;
|
||||||
|
|
||||||
ASSERT (Gtdt != NULL);
|
ASSERT (Gtdt != NULL);
|
||||||
ASSERT (WatchdogInfoList != NULL);
|
ASSERT (WatchdogInfoList != NULL);
|
||||||
|
|
||||||
Watchdog = (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *)
|
Watchdog = (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *)
|
||||||
((UINT8*)Gtdt + WatchdogOffset);
|
((UINT8*)Gtdt + WatchdogOffset);
|
||||||
|
|
||||||
while (WatchdogCount-- != 0) {
|
while (WatchdogCount-- != 0) {
|
||||||
// Add watchdog entry
|
// Add watchdog entry
|
||||||
DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog));
|
DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog));
|
||||||
Watchdog->Type = EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG;
|
Watchdog->Type = EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG;
|
||||||
Watchdog->Length =
|
Watchdog->Length =
|
||||||
sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE);
|
sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE);
|
||||||
Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
|
Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
|
||||||
Watchdog->RefreshFramePhysicalAddress =
|
Watchdog->RefreshFramePhysicalAddress =
|
||||||
WatchdogInfoList->RefreshFrameAddress;
|
WatchdogInfoList->RefreshFrameAddress;
|
||||||
|
@ -242,7 +249,7 @@ IsGtFrameNumberEqual (
|
||||||
STATIC
|
STATIC
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AddGTBlockTimerFrames (
|
AddGTBlockTimerFrames (
|
||||||
IN EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame,
|
IN EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame,
|
||||||
IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList,
|
IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList,
|
||||||
IN UINT32 GTBlockFrameCount
|
IN UINT32 GTBlockFrameCount
|
||||||
)
|
)
|
||||||
|
@ -332,22 +339,22 @@ STATIC
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
AddGTBlockList (
|
AddGTBlockList (
|
||||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
|
||||||
IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
|
||||||
IN CONST UINT32 GTBlockOffset,
|
IN CONST UINT32 GTBlockOffset,
|
||||||
IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo,
|
IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo,
|
||||||
IN UINT32 BlockTimerCount
|
IN UINT32 BlockTimerCount
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE * GTBlock;
|
EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE * GTBlock;
|
||||||
EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame;
|
EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame;
|
||||||
CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList;
|
CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList;
|
||||||
UINT32 GTBlockTimerFrameCount;
|
UINT32 GTBlockTimerFrameCount;
|
||||||
|
|
||||||
ASSERT (Gtdt != NULL);
|
ASSERT (Gtdt != NULL);
|
||||||
ASSERT (GTBlockInfo != NULL);
|
ASSERT (GTBlockInfo != NULL);
|
||||||
|
|
||||||
GTBlock = (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt +
|
GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt +
|
||||||
GTBlockOffset);
|
GTBlockOffset);
|
||||||
|
|
||||||
while (BlockTimerCount-- != 0) {
|
while (BlockTimerCount-- != 0) {
|
||||||
|
@ -369,18 +376,18 @@ AddGTBlockList (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
GTBlock->Type = EFI_ACPI_6_2_GTDT_GT_BLOCK;
|
GTBlock->Type = EFI_ACPI_6_3_GTDT_GT_BLOCK;
|
||||||
GTBlock->Length = sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE) +
|
GTBlock->Length = sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) +
|
||||||
(sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
(sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
||||||
GTBlockInfo->GTBlockTimerFrameCount);
|
GTBlockInfo->GTBlockTimerFrameCount);
|
||||||
|
|
||||||
GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
|
GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
|
||||||
GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
|
GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
|
||||||
GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
|
GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
|
||||||
GTBlock->GTBlockTimerOffset =
|
GTBlock->GTBlockTimerOffset =
|
||||||
sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE);
|
sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE);
|
||||||
|
|
||||||
GtBlockFrame = (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
|
GtBlockFrame = (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
|
||||||
((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset);
|
((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset);
|
||||||
|
|
||||||
// Add GT Block Timer frames
|
// Add GT Block Timer frames
|
||||||
|
@ -399,7 +406,7 @@ AddGTBlockList (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next GTBlock
|
// Next GTBlock
|
||||||
GTBlock = (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock +
|
GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock +
|
||||||
GTBlock->Length);
|
GTBlock->Length);
|
||||||
GTBlockInfo++;
|
GTBlockInfo++;
|
||||||
}// for
|
}// for
|
||||||
|
@ -446,7 +453,7 @@ BuildGtdtTable (
|
||||||
UINT32 BlockTimerCount;
|
UINT32 BlockTimerCount;
|
||||||
CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList;
|
CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList;
|
||||||
CM_ARM_GTBLOCK_INFO * GTBlockInfo;
|
CM_ARM_GTBLOCK_INFO * GTBlockInfo;
|
||||||
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt;
|
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt;
|
||||||
UINT32 Idx;
|
UINT32 Idx;
|
||||||
UINT32 GTBlockOffset;
|
UINT32 GTBlockOffset;
|
||||||
UINT32 WatchdogOffset;
|
UINT32 WatchdogOffset;
|
||||||
|
@ -513,11 +520,11 @@ BuildGtdtTable (
|
||||||
|
|
||||||
// Calculate the GTDT Table Size
|
// Calculate the GTDT Table Size
|
||||||
PlatformTimerCount = 0;
|
PlatformTimerCount = 0;
|
||||||
TableSize = sizeof (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE);
|
TableSize = sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE);
|
||||||
if (BlockTimerCount != 0) {
|
if (BlockTimerCount != 0) {
|
||||||
GTBlockOffset = TableSize;
|
GTBlockOffset = TableSize;
|
||||||
PlatformTimerCount += BlockTimerCount;
|
PlatformTimerCount += BlockTimerCount;
|
||||||
TableSize += (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE) *
|
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) *
|
||||||
BlockTimerCount);
|
BlockTimerCount);
|
||||||
|
|
||||||
for (Idx = 0; Idx < BlockTimerCount; Idx++) {
|
for (Idx = 0; Idx < BlockTimerCount; Idx++) {
|
||||||
|
@ -532,7 +539,7 @@ BuildGtdtTable (
|
||||||
));
|
));
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
TableSize += (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) *
|
||||||
GTBlockInfo[Idx].GTBlockTimerFrameCount);
|
GTBlockInfo[Idx].GTBlockTimerFrameCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,7 +555,7 @@ BuildGtdtTable (
|
||||||
if (WatchdogCount != 0) {
|
if (WatchdogCount != 0) {
|
||||||
WatchdogOffset = TableSize;
|
WatchdogOffset = TableSize;
|
||||||
PlatformTimerCount += WatchdogCount;
|
PlatformTimerCount += WatchdogCount;
|
||||||
TableSize += (sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE) *
|
TableSize += (sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE) *
|
||||||
WatchdogCount);
|
WatchdogCount);
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
|
@ -571,7 +578,7 @@ BuildGtdtTable (
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gtdt = (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
|
Gtdt = (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
"GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
|
"GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
|
||||||
|
@ -598,7 +605,8 @@ BuildGtdtTable (
|
||||||
Status = AddGenericTimerInfo (
|
Status = AddGenericTimerInfo (
|
||||||
CfgMgrProtocol,
|
CfgMgrProtocol,
|
||||||
Gtdt,
|
Gtdt,
|
||||||
PlatformTimerCount
|
PlatformTimerCount,
|
||||||
|
AcpiTableInfo->AcpiTableRevision
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
|
@ -697,9 +705,9 @@ ACPI_TABLE_GENERATOR GtdtGenerator = {
|
||||||
// Generator Description
|
// Generator Description
|
||||||
L"ACPI.STD.GTDT.GENERATOR",
|
L"ACPI.STD.GTDT.GENERATOR",
|
||||||
// ACPI Table Signature
|
// ACPI Table Signature
|
||||||
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
|
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
|
||||||
// ACPI Table Revision supported by this Generator
|
// ACPI Table Revision supported by this Generator
|
||||||
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
|
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
|
||||||
// Minimum ACPI Table Revision supported by this Generator
|
// Minimum ACPI Table Revision supported by this Generator
|
||||||
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
|
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
|
||||||
// Creator ID
|
// Creator ID
|
||||||
|
|
Loading…
Reference in New Issue