95 IN CONST UINT32 PlatformTimerCount,
96 IN CONST UINT32 AcpiTableRevision
102 ASSERT (CfgMgrProtocol !=
NULL);
103 ASSERT (Gtdt !=
NULL);
105 Status = GetEArmObjGenericTimerInfo (
112 if (EFI_ERROR (Status)) {
115 "ERROR: GTDT: Failed to get GenericTimerInfo. Status = %r\n",
121 Gtdt->CntControlBasePhysicalAddress =
123 Gtdt->Reserved = EFI_ACPI_RESERVED_DWORD;
132 Gtdt->CntReadBasePhysicalAddress =
134 Gtdt->PlatformTimerCount = PlatformTimerCount;
135 Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 :
158 IN CONST UINT32 WatchdogOffset,
160 IN UINT32 WatchdogCount
165 ASSERT (Gtdt !=
NULL);
166 ASSERT (WatchdogInfoList !=
NULL);
169 ((UINT8 *)Gtdt + WatchdogOffset);
171 while (WatchdogCount-- != 0) {
173 DEBUG ((DEBUG_INFO,
"GTDT: Watchdog = 0x%p\n", Watchdog));
174 Watchdog->Type = EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG;
177 Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
178 Watchdog->RefreshFramePhysicalAddress =
179 WatchdogInfoList->RefreshFrameAddress;
180 Watchdog->WatchdogControlFramePhysicalAddress =
181 WatchdogInfoList->ControlFrameAddress;
182 Watchdog->WatchdogTimerGSIV = WatchdogInfoList->TimerGSIV;
183 Watchdog->WatchdogTimerFlags = WatchdogInfoList->Flags;
218 ASSERT ((Frame1 !=
NULL) && (Frame2 !=
NULL));
223 if (FrameNumber1 == FrameNumber2) {
226 "ERROR: GTDT: GT Block Frame Info Structures %d and %d have the same " \
227 "frame number: 0x%x.\n",
254 IN UINT32 GTBlockFrameCount
257 BOOLEAN IsFrameNumberDuplicated;
259 ASSERT (GtBlockFrame !=
NULL);
260 ASSERT (GTBlockTimerFrameList !=
NULL);
263 GTBlockTimerFrameList,
269 if (IsFrameNumberDuplicated) {
270 return EFI_INVALID_PARAMETER;
273 while (GTBlockFrameCount-- != 0) {
276 "GTDT: GtBlockFrame = 0x%p\n",
280 if (GTBlockTimerFrameList->FrameNumber >= 8) {
283 "ERROR: GTDT: Frame number %d is not in the range 0-7\n",
284 GTBlockTimerFrameList->FrameNumber
286 return EFI_INVALID_PARAMETER;
289 GtBlockFrame->GTFrameNumber = GTBlockTimerFrameList->FrameNumber;
290 GtBlockFrame->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
291 GtBlockFrame->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
292 GtBlockFrame->Reserved[2] = EFI_ACPI_RESERVED_BYTE;
294 GtBlockFrame->CntBaseX = GTBlockTimerFrameList->PhysicalAddressCntBase;
295 GtBlockFrame->CntEL0BaseX =
296 GTBlockTimerFrameList->PhysicalAddressCntEL0Base;
298 GtBlockFrame->GTxPhysicalTimerGSIV =
299 GTBlockTimerFrameList->PhysicalTimerGSIV;
300 GtBlockFrame->GTxPhysicalTimerFlags =
301 GTBlockTimerFrameList->PhysicalTimerFlags;
303 GtBlockFrame->GTxVirtualTimerGSIV = GTBlockTimerFrameList->VirtualTimerGSIV;
304 GtBlockFrame->GTxVirtualTimerFlags =
305 GTBlockTimerFrameList->VirtualTimerFlags;
307 GtBlockFrame->GTxCommonFlags = GTBlockTimerFrameList->CommonFlags;
309 GTBlockTimerFrameList++;
336 IN UINT32 BlockTimerCount
343 UINT32 GTBlockTimerFrameCount;
346 ASSERT (Gtdt !=
NULL);
347 ASSERT (GTBlockInfo !=
NULL);
352 while (BlockTimerCount-- != 0) {
353 DEBUG ((DEBUG_INFO,
"GTDT: GTBlock = 0x%p\n", GTBlock));
355 Status = GetEArmObjGTBlockTimerFrameInfo (
357 GTBlockInfo->GTBlockTimerFrameToken,
358 >BlockTimerFrameList,
359 >BlockTimerFrameCount
361 if (EFI_ERROR (Status) ||
362 (GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount))
366 "ERROR: GTDT: Failed to get Generic Timer Frames. Status = %r\n",
374 GTBlockInfo->GTBlockTimerFrameCount);
378 if (Length > MAX_UINT16) {
379 Status = EFI_INVALID_PARAMETER;
382 "ERROR: GTDT: Too many GT Frames. Count = %d. " \
383 "Maximum supported GT Block size exceeded. " \
385 GTBlockInfo->GTBlockTimerFrameCount,
392 GTBlock->Length = (UINT16)Length;
393 GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE;
394 GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress;
395 GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount;
396 GTBlock->GTBlockTimerOffset =
400 ((UINT8 *)GTBlock + GTBlock->GTBlockTimerOffset);
405 GTBlockTimerFrameList,
406 GTBlockTimerFrameCount
408 if (EFI_ERROR (Status)) {
411 "ERROR: GTDT: Failed to add Generic Timer Frames. Status = %r\n",
461 UINT32 PlatformTimerCount;
462 UINT32 WatchdogCount;
463 UINT32 BlockTimerCount;
468 UINT32 GTBlockOffset;
469 UINT32 WatchdogOffset;
471 ASSERT (This !=
NULL);
472 ASSERT (AcpiTableInfo !=
NULL);
473 ASSERT (CfgMgrProtocol !=
NULL);
474 ASSERT (Table !=
NULL);
475 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
476 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
478 if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
479 (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
483 "ERROR: GTDT: Requested table revision = %d, is not supported."
484 "Supported table revision: Minimum = %d, Maximum = %d\n",
485 AcpiTableInfo->AcpiTableRevision,
486 This->MinAcpiTableRevision,
487 This->AcpiTableRevision
489 return EFI_INVALID_PARAMETER;
493 Status = GetEArmObjPlatformGTBlockInfo (
499 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
502 "ERROR: GTDT: Failed to Get Platform GT Block Information." \
509 Status = GetEArmObjPlatformGenericWatchdogInfo (
515 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
518 "ERROR: GTDT: Failed to Get Platform Generic Watchdog Information." \
527 "GTDT: BlockTimerCount = %d, WatchdogCount = %d\n",
533 PlatformTimerCount = 0;
535 if (BlockTimerCount != 0) {
536 GTBlockOffset = TableSize;
537 PlatformTimerCount += BlockTimerCount;
541 for (Idx = 0; Idx < BlockTimerCount; Idx++) {
542 if (GTBlockInfo[Idx].GTBlockTimerFrameCount > 8) {
543 Status = EFI_INVALID_PARAMETER;
546 "GTDT: GTBockFrameCount cannot be more than 8." \
547 " GTBockFrameCount = %d, Status = %r\n",
548 GTBlockInfo[Idx].GTBlockTimerFrameCount,
555 GTBlockInfo[Idx].GTBlockTimerFrameCount);
560 "GTDT: GTBockOffset = 0x%x, PLATFORM_TIMER_COUNT = %d\n",
567 if (WatchdogCount != 0) {
568 WatchdogOffset = TableSize;
569 PlatformTimerCount += WatchdogCount;
574 "GTDT: WatchdogOffset = 0x%x, PLATFORM_TIMER_COUNT = %d\n",
581 if (*Table ==
NULL) {
582 Status = EFI_OUT_OF_RESOURCES;
585 "ERROR: GTDT: Failed to allocate memory for GTDT Table, Size = %d," \
596 "GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
608 if (EFI_ERROR (Status)) {
611 "ERROR: GTDT: Failed to add ACPI header. Status = %r\n",
621 AcpiTableInfo->AcpiTableRevision
623 if (EFI_ERROR (Status)) {
626 "ERROR: GTDT: Failed to add Generic Timer Info. Status = %r\n",
632 if (BlockTimerCount != 0) {
640 if (EFI_ERROR (Status)) {
643 "ERROR: GTDT: Failed to add GT Block timers. Status = %r\n",
650 if (WatchdogCount != 0) {
662 if (*Table !=
NULL) {
690 ASSERT (This !=
NULL);
691 ASSERT (AcpiTableInfo !=
NULL);
692 ASSERT (CfgMgrProtocol !=
NULL);
693 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
694 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
696 if ((Table ==
NULL) || (*Table ==
NULL)) {
697 DEBUG ((DEBUG_ERROR,
"ERROR: GTDT: Invalid Table Pointer\n"));
698 ASSERT ((Table !=
NULL) && (*Table !=
NULL));
699 return EFI_INVALID_PARAMETER;
709#define GTDT_GENERATOR_REVISION CREATE_REVISION (1, 0)
719 L
"ACPI.STD.GTDT.GENERATOR",
761 DEBUG ((DEBUG_INFO,
"GTDT: Register Generator. Status = %r\n", Status));
785 DEBUG ((DEBUG_INFO,
"GTDT: Deregister Generator. Status = %r\n", Status));
#define EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
#define EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE
#define EFI_ACPI_6_4_GTDT_GT_BLOCK
#define EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
EFI_STATUS EFIAPI RegisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
EFI_STATUS EFIAPI DeregisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
#define TABLE_GENERATOR_CREATOR_ID_ARM
#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId)
@ EStdAcpiTableIdGtdt
GTDT Generator.
@ EArmObjPlatformGTBlockInfo
8 - Platform GT Block Info
@ EArmObjPlatformGenericWatchdogInfo
10 - Platform Generic Watchdog
@ EArmObjGTBlockTimerFrameInfo
9 - Generic Timer Block Frame Info
@ EArmObjGenericTimerInfo
7 - Generic Timer Info
#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type)
@ EObjNameSpaceArm
ARM Objects Namespace.
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
STATIC EFI_STATUS EFIAPI BuildGtdtTable(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
BOOLEAN EFIAPI IsGtFrameNumberEqual(IN CONST VOID *Frame1, IN CONST VOID *Frame2, IN UINTN Index1, IN UINTN Index2)
STATIC EFI_STATUS EFIAPI AddGenericTimerInfo(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *CONST Gtdt, IN CONST UINT32 PlatformTimerCount, IN CONST UINT32 AcpiTableRevision)
STATIC EFI_STATUS AddGTBlockTimerFrames(IN EFI_ACPI_6_4_GTDT_GT_BLOCK_TIMER_STRUCTURE *GtBlockFrame, IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO *GTBlockTimerFrameList, IN UINT32 GTBlockFrameCount)
STATIC EFI_STATUS AddGTBlockList(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *CONST Gtdt, IN CONST UINT32 GTBlockOffset, IN CONST CM_ARM_GTBLOCK_INFO *GTBlockInfo, IN UINT32 BlockTimerCount)
EFI_STATUS EFIAPI AcpiGtdtLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
#define GTDT_GENERATOR_REVISION
STATIC VOID AddGenericWatchdogList(IN EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE *CONST Gtdt, IN CONST UINT32 WatchdogOffset, IN CONST CM_ARM_GENERIC_WATCHDOG_INFO *WatchdogInfoList, IN UINT32 WatchdogCount)
STATIC CONST ACPI_TABLE_GENERATOR GtdtGenerator
STATIC EFI_STATUS FreeGtdtTableResources(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
EFI_STATUS EFIAPI AcpiGtdtLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
EFI_STATUS EFIAPI AddAcpiHeader(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CONST ACPI_TABLE_GENERATOR *CONST Generator, IN OUT EFI_ACPI_DESCRIPTION_HEADER *CONST AcpiHeader, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST UINT32 Length)
BOOLEAN EFIAPI FindDuplicateValue(IN CONST VOID *Array, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN PFN_IS_EQUAL EqualTestFunction)
UINT32 NonSecurePL1TimerGSIV
The non-secure PL1 timer interrupt.
UINT32 NonSecurePL2TimerFlags
The non-secure PL2 timer flags.
UINT32 SecurePL1TimerGSIV
The secure PL1 timer interrupt.
UINT64 CounterControlBaseAddress
The physical base address for the counter control frame.
UINT32 VirtualTimerGSIV
The virtual timer interrupt.
UINT32 VirtualPL2TimerFlags
Flags for the virtual EL2 timer.
UINT32 NonSecurePL1TimerFlags
The non-secure PL1 timer flags.
UINT32 VirtualTimerFlags
The virtual timer flags.
UINT64 CounterReadBaseAddress
The physical base address for the counter read frame.
UINT32 SecurePL1TimerFlags
The secure PL1 timer flags.
UINT32 NonSecurePL2TimerGSIV
The non-secure PL2 timer interrupt.
UINT32 VirtualPL2TimerGSIV
GSIV for the virtual EL2 timer.