-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bingxing Wang
committed
Nov 20, 2019
1 parent
6da19fa
commit 47a2642
Showing
12 changed files
with
179 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** @file | ||
* Generic Timer Description Table (GTDT) | ||
* | ||
* Copyright (c) 2012 - 2017, ARM Limited. All rights reserved. | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause-Patent | ||
* | ||
**/ | ||
|
||
#include "Platform.h" | ||
|
||
#include <Library/AcpiLib.h> | ||
#include <Library/PcdLib.h> | ||
#include <IndustryStandard/Acpi.h> | ||
|
||
#define GTDT_GLOBAL_FLAGS_MAPPED EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_MEMORY_MAPPED_BLOCK_PRESENT | ||
#define GTDT_GLOBAL_FLAGS_NOT_MAPPED 0 | ||
#define GTDT_GLOBAL_FLAGS_EDGE EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_INTERRUPT_MODE | ||
#define GTDT_GLOBAL_FLAGS_LEVEL 0 | ||
|
||
// Note: We could have a build flag that switches between memory mapped/non-memory mapped timer | ||
#ifdef SYSTEM_TIMER_BASE_ADDRESS | ||
#define GTDT_GLOBAL_FLAGS (GTDT_GLOBAL_FLAGS_MAPPED | GTDT_GLOBAL_FLAGS_LEVEL) | ||
#else | ||
#define GTDT_GLOBAL_FLAGS (GTDT_GLOBAL_FLAGS_NOT_MAPPED | GTDT_GLOBAL_FLAGS_LEVEL) | ||
#define SYSTEM_TIMER_BASE_ADDRESS 0xFFFFFFFFFFFFFFFF | ||
#endif | ||
|
||
#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE | ||
#define GTDT_TIMER_LEVEL_TRIGGERED 0 | ||
#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY | ||
#define GTDT_TIMER_ACTIVE_HIGH 0 | ||
|
||
#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED) | ||
|
||
#pragma pack (1) | ||
|
||
typedef struct { | ||
EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; | ||
} GENERIC_TIMER_DESCRIPTION_TABLE; | ||
|
||
#pragma pack () | ||
|
||
GENERIC_TIMER_DESCRIPTION_TABLE Gtdt = { | ||
{ | ||
{ | ||
EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, | ||
sizeof (EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE), | ||
EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, | ||
0, | ||
EFI_ACPI_OEM_ID, | ||
EFI_ACPI_OEM_TABLE_ID, | ||
EFI_ACPI_OEM_REVISION, | ||
EFI_ACPI_CREATOR_ID, | ||
EFI_ACPI_CREATOR_REVISION | ||
}, | ||
SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress | ||
0, // UINT32 Reserved | ||
FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV | ||
GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags | ||
FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV | ||
GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags | ||
FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV | ||
GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags | ||
FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV | ||
GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags | ||
0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress | ||
0, // UINT32 PlatformTimerCount | ||
0 | ||
}, | ||
}; | ||
|
||
// | ||
// Reference the table being generated to prevent the optimizer from removing the | ||
// data structure from the executable | ||
// | ||
VOID* CONST ReferenceAcpiTable = &Gtdt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.