mirror of https://github.com/acidanthera/audk.git
ArmPkg: Move TimerDxe and ArmArchTimerLib to new ArmGenericTimerCounterLib
Move TimerDxe and ArmArchTimerLib to ArmGenericTimerCounterLib, and update all platforms to select the physical counter instance they have been using implicitly all along. Contributed-under: TianoCore Contribution Agreement 1.0 Acked-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16078 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2785509b57
commit
4f6d34b434
|
@ -64,6 +64,7 @@
|
||||||
|
|
||||||
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
|
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
|
||||||
ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
|
ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
|
||||||
|
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
|
||||||
ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
|
ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
|
||||||
ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
|
ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
|
||||||
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
|
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
|
||||||
|
|
|
@ -15,9 +15,8 @@
|
||||||
#include <Base.h>
|
#include <Base.h>
|
||||||
#include <Library/ArmLib.h>
|
#include <Library/ArmLib.h>
|
||||||
#include <Library/ArmCpuLib.h>
|
#include <Library/ArmCpuLib.h>
|
||||||
#include <Library/ArmArchTimer.h>
|
#include <Library/ArmGenericTimerCounterLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/IoLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
#include <Chipset/ArmCortexA15.h>
|
#include <Chipset/ArmCortexA15.h>
|
||||||
|
@ -39,7 +38,7 @@ ArmCpuSetup (
|
||||||
|
|
||||||
// Note: System Counter frequency can only be set in Secure privileged mode,
|
// Note: System Counter frequency can only be set in Secure privileged mode,
|
||||||
// if security extensions are implemented.
|
// if security extensions are implemented.
|
||||||
ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
||||||
|
|
||||||
if (ArmIsMpCore()) {
|
if (ArmIsMpCore()) {
|
||||||
// Turn on SMP coherency
|
// Turn on SMP coherency
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#/* @file
|
#/* @file
|
||||||
# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
ArmLib
|
ArmLib
|
||||||
IoLib
|
ArmGenericTimerCounterLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
|
|
|
@ -15,9 +15,8 @@
|
||||||
#include <Base.h>
|
#include <Base.h>
|
||||||
#include <Library/ArmLib.h>
|
#include <Library/ArmLib.h>
|
||||||
#include <Library/ArmCpuLib.h>
|
#include <Library/ArmCpuLib.h>
|
||||||
#include <Library/ArmArchTimer.h>
|
#include <Library/ArmGenericTimerCounterLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/IoLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
#include <Chipset/ArmCortexA5x.h>
|
#include <Chipset/ArmCortexA5x.h>
|
||||||
|
@ -33,7 +32,7 @@ ArmCpuSetup (
|
||||||
|
|
||||||
// Note: System Counter frequency can only be set in Secure privileged mode,
|
// Note: System Counter frequency can only be set in Secure privileged mode,
|
||||||
// if security extensions are implemented.
|
// if security extensions are implemented.
|
||||||
ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
||||||
|
|
||||||
if (ArmIsMpCore ()) {
|
if (ArmIsMpCore ()) {
|
||||||
// Turn on SMP coherency
|
// Turn on SMP coherency
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
ArmLib
|
ArmLib
|
||||||
IoLib
|
ArmGenericTimerCounterLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <Base.h>
|
#include <Base.h>
|
||||||
#include <Library/ArmCpuLib.h>
|
#include <Library/ArmCpuLib.h>
|
||||||
#include <Library/ArmArchTimer.h>
|
#include <Library/ArmGenericTimerCounterLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
#include <Chipset/ArmAemV8.h>
|
#include <Chipset/ArmAemV8.h>
|
||||||
|
@ -26,7 +26,7 @@ ArmCpuSetup (
|
||||||
{
|
{
|
||||||
// Note: System Counter frequency can only be set in Secure privileged mode,
|
// Note: System Counter frequency can only be set in Secure privileged mode,
|
||||||
// if security extensions are implemented.
|
// if security extensions are implemented.
|
||||||
ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
ArmPkg/ArmPkg.dec
|
ArmPkg/ArmPkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
ArmLib
|
ArmGenericTimerCounterLib
|
||||||
IoLib
|
|
||||||
PcdLib
|
PcdLib
|
||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
#include <Library/IoLib.h>
|
#include <Library/IoLib.h>
|
||||||
|
#include <Library/ArmGenericTimerCounterLib.h>
|
||||||
#include <Library/ArmArchTimer.h>
|
#include <Library/ArmArchTimer.h>
|
||||||
|
|
||||||
#include <Protocol/Timer.h>
|
#include <Protocol/Timer.h>
|
||||||
|
@ -101,7 +102,7 @@ ExitBootServicesEvent (
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ArmArchTimerDisableTimer ();
|
ArmGenericTimerDisableTimer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,7 +145,7 @@ TimerDriverSetTimerPeriod (
|
||||||
EFI_TPL OriginalTPL;
|
EFI_TPL OriginalTPL;
|
||||||
|
|
||||||
// Always disable the timer
|
// Always disable the timer
|
||||||
ArmArchTimerDisableTimer ();
|
ArmGenericTimerDisableTimer ();
|
||||||
|
|
||||||
if (TimerPeriod != 0) {
|
if (TimerPeriod != 0) {
|
||||||
// mTimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3
|
// mTimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3
|
||||||
|
@ -163,13 +164,13 @@ TimerDriverSetTimerPeriod (
|
||||||
|
|
||||||
gBS->RestoreTPL (OriginalTPL);
|
gBS->RestoreTPL (OriginalTPL);
|
||||||
|
|
||||||
// Get value of the current physical timer
|
// Get value of the current timer
|
||||||
CounterValue = ArmReadCntPct ();
|
CounterValue = ArmGenericTimerGetSystemCount ();
|
||||||
// Set the interrupt in Current Time + mTimerTick
|
// Set the interrupt in Current Time + mTimerTick
|
||||||
ArmWriteCntpCval (CounterValue + mTimerTicks);
|
ArmGenericTimerSetCompareVal (CounterValue + mTimerTicks);
|
||||||
|
|
||||||
// Enable the timer
|
// Enable the timer
|
||||||
ArmArchTimerEnableTimer ();
|
ArmGenericTimerEnableTimer ();
|
||||||
} else {
|
} else {
|
||||||
// Save the new timer period
|
// Save the new timer period
|
||||||
mTimerPeriod = TimerPeriod;
|
mTimerPeriod = TimerPeriod;
|
||||||
|
@ -307,7 +308,7 @@ TimerInterruptHandler (
|
||||||
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||||
|
|
||||||
// Check if the timer interrupt is active
|
// Check if the timer interrupt is active
|
||||||
if ((ArmArchTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {
|
if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {
|
||||||
|
|
||||||
// Signal end of interrupt early to help avoid losing subsequent ticks from long duration handlers
|
// Signal end of interrupt early to help avoid losing subsequent ticks from long duration handlers
|
||||||
gInterrupt->EndOfInterrupt (gInterrupt, Source);
|
gInterrupt->EndOfInterrupt (gInterrupt, Source);
|
||||||
|
@ -321,9 +322,9 @@ TimerInterruptHandler (
|
||||||
//
|
//
|
||||||
|
|
||||||
// Get current counter value
|
// Get current counter value
|
||||||
CurrentValue = ArmReadCntPct ();
|
CurrentValue = ArmGenericTimerGetSystemCount ();
|
||||||
// Get the counter value to compare with
|
// Get the counter value to compare with
|
||||||
CompareValue = ArmReadCntpCval ();
|
CompareValue = ArmGenericTimerGetCompareVal ();
|
||||||
|
|
||||||
// This loop is needed in case we missed interrupts (eg: case when the interrupt handling
|
// This loop is needed in case we missed interrupts (eg: case when the interrupt handling
|
||||||
// has taken longer than mTickPeriod).
|
// has taken longer than mTickPeriod).
|
||||||
|
@ -335,7 +336,7 @@ TimerInterruptHandler (
|
||||||
} while (CompareValue < CurrentValue);
|
} while (CompareValue < CurrentValue);
|
||||||
|
|
||||||
// Set next compare value
|
// Set next compare value
|
||||||
ArmWriteCntpCval (CompareValue);
|
ArmGenericTimerSetCompareVal (CompareValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable timer interrupts
|
// Enable timer interrupts
|
||||||
|
@ -379,10 +380,10 @@ TimerInitialize (
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
// Disable the timer
|
// Disable the timer
|
||||||
TimerCtrlReg = ArmArchTimerGetTimerCtrlReg ();
|
TimerCtrlReg = ArmGenericTimerGetTimerCtrlReg ();
|
||||||
TimerCtrlReg |= ARM_ARCH_TIMER_IMASK;
|
TimerCtrlReg |= ARM_ARCH_TIMER_IMASK;
|
||||||
TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
|
TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
|
||||||
ArmArchTimerSetTimerCtrlReg (TimerCtrlReg);
|
ArmGenericTimerSetTimerCtrlReg (TimerCtrlReg);
|
||||||
Status = TimerDriverSetTimerPeriod (&gTimer, 0);
|
Status = TimerDriverSetTimerPeriod (&gTimer, 0);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
@ -416,7 +417,7 @@ TimerInitialize (
|
||||||
|
|
||||||
// Everything is ready, unmask and enable timer interrupts
|
// Everything is ready, unmask and enable timer interrupts
|
||||||
TimerCtrlReg = ARM_ARCH_TIMER_ENABLE;
|
TimerCtrlReg = ARM_ARCH_TIMER_ENABLE;
|
||||||
ArmArchTimerSetTimerCtrlReg (TimerCtrlReg);
|
ArmGenericTimerSetTimerCtrlReg (TimerCtrlReg);
|
||||||
|
|
||||||
// Register for an ExitBootServicesEvent
|
// Register for an ExitBootServicesEvent
|
||||||
Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent);
|
Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent);
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
DebugLib
|
DebugLib
|
||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
IoLib
|
IoLib
|
||||||
|
ArmGenericTimerCounterLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
|
|
||||||
|
|
|
@ -52,64 +52,4 @@ ArmArchTimerWriteReg (
|
||||||
IN VOID *SrcBuf
|
IN VOID *SrcBuf
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerEnableTimer (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerDisableTimer (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerFreq (
|
|
||||||
IN UINTN FreqInHz
|
|
||||||
);
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerFreq (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerVal (
|
|
||||||
IN UINTN Val
|
|
||||||
);
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerVal (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
UINT64
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetSystemCount (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerCtrlReg (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerCtrlReg (
|
|
||||||
UINTN Val
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetCompareVal (
|
|
||||||
IN UINT64 Val
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif // __ARM_ARCH_TIMER_H__
|
#endif // __ARM_ARCH_TIMER_H__
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <Library/TimerLib.h>
|
#include <Library/TimerLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
#include <Library/ArmArchTimer.h>
|
#include <Library/ArmGenericTimerCounterLib.h>
|
||||||
|
|
||||||
#define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/1000000U)
|
#define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/1000000U)
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ TimerConstructor (
|
||||||
// Only set the frequency for ARMv7. We expect the secure firmware to have already do it
|
// Only set the frequency for ARMv7. We expect the secure firmware to have already do it
|
||||||
// If the security extensions are not implemented set Timer Frequency
|
// If the security extensions are not implemented set Timer Frequency
|
||||||
if ((ArmReadIdPfr1 () & ARM_PFR1_SEC) == 0x0) {
|
if ((ArmReadIdPfr1 () & ARM_PFR1_SEC) == 0x0) {
|
||||||
ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Architectural Timer Frequency must be set in the Secure privileged(if secure extensions are supported) mode.
|
// Architectural Timer Frequency must be set in the Secure privileged(if secure extensions are supported) mode.
|
||||||
// If the reset value (0) is returned just ASSERT.
|
// If the reset value (0) is returned just ASSERT.
|
||||||
TimerFreq = ArmArchTimerGetTimerFreq ();
|
TimerFreq = ArmGenericTimerGetTimerFreq ();
|
||||||
ASSERT (TimerFreq != 0);
|
ASSERT (TimerFreq != 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -88,13 +88,13 @@ MicroSecondDelay (
|
||||||
TimerTicks64 = (MicroSeconds * PcdGet32 (PcdArmArchTimerFreqInHz)) / 1000000U;
|
TimerTicks64 = (MicroSeconds * PcdGet32 (PcdArmArchTimerFreqInHz)) / 1000000U;
|
||||||
|
|
||||||
// Read System Counter value
|
// Read System Counter value
|
||||||
SystemCounterVal = ArmArchTimerGetSystemCount ();
|
SystemCounterVal = ArmGenericTimerGetSystemCount ();
|
||||||
|
|
||||||
TimerTicks64 += SystemCounterVal;
|
TimerTicks64 += SystemCounterVal;
|
||||||
|
|
||||||
// Wait until delay count is expired.
|
// Wait until delay count is expired.
|
||||||
while (SystemCounterVal < TimerTicks64) {
|
while (SystemCounterVal < TimerTicks64) {
|
||||||
SystemCounterVal = ArmArchTimerGetSystemCount ();
|
SystemCounterVal = ArmGenericTimerGetSystemCount ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return MicroSeconds;
|
return MicroSeconds;
|
||||||
|
@ -149,7 +149,7 @@ GetPerformanceCounter (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Just return the value of system count
|
// Just return the value of system count
|
||||||
return ArmArchTimerGetSystemCount ();
|
return ArmGenericTimerGetSystemCount ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -192,5 +192,5 @@ GetPerformanceCounterProperties (
|
||||||
*EndValue = 0xFFFFFFFFFFFFFFFFUL;
|
*EndValue = 0xFFFFFFFFFFFFFFFFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (UINT64)ArmArchTimerGetTimerFreq ();
|
return (UINT64)ArmGenericTimerGetTimerFreq ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
DebugLib
|
DebugLib
|
||||||
ArmLib
|
ArmLib
|
||||||
BaseLib
|
BaseLib
|
||||||
|
ArmGenericTimerCounterLib
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz
|
gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz
|
||||||
|
|
|
@ -166,110 +166,3 @@ ArmArchTimerWriteReg (
|
||||||
ASSERT (0);
|
ASSERT (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerEnableTimer (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN TimerCtrlReg;
|
|
||||||
|
|
||||||
ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;
|
|
||||||
ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerDisableTimer (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN TimerCtrlReg;
|
|
||||||
|
|
||||||
ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
|
|
||||||
ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerFreq (
|
|
||||||
IN UINTN FreqInHz
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerFreq (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN ArchTimerFreq = 0;
|
|
||||||
ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
|
|
||||||
return ArchTimerFreq;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerVal (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN ArchTimerVal;
|
|
||||||
ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerVal);
|
|
||||||
return ArchTimerVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerVal (
|
|
||||||
IN UINTN Val
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntpTval, (VOID *)&Val);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT64
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetSystemCount (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINT64 SystemCount;
|
|
||||||
ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount);
|
|
||||||
return SystemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerCtrlReg (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN Val;
|
|
||||||
ArmArchTimerReadReg (CntpCtl, (VOID *)&Val);
|
|
||||||
return Val;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerCtrlReg (
|
|
||||||
UINTN Val
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntpCtl, (VOID *)&Val);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetCompareVal (
|
|
||||||
IN UINT64 Val
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntpCval, (VOID *)&Val);
|
|
||||||
}
|
|
||||||
|
|
|
@ -166,110 +166,3 @@ ArmArchTimerWriteReg (
|
||||||
ASSERT (0);
|
ASSERT (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerEnableTimer (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN TimerCtrlReg;
|
|
||||||
|
|
||||||
ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;
|
|
||||||
ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerDisableTimer (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN TimerCtrlReg;
|
|
||||||
|
|
||||||
ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
|
|
||||||
ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerFreq (
|
|
||||||
IN UINTN FreqInHz
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerFreq (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN ArchTimerFreq;
|
|
||||||
ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
|
|
||||||
return ArchTimerFreq;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerVal (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN ArchTimerVal;
|
|
||||||
ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerVal);
|
|
||||||
return ArchTimerVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerVal (
|
|
||||||
IN UINTN Val
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntpTval, (VOID *)&Val);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT64
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetSystemCount (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINT64 SystemCount;
|
|
||||||
ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount);
|
|
||||||
return SystemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerGetTimerCtrlReg (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN Val;
|
|
||||||
ArmArchTimerReadReg (CntpCtl, (VOID *)&Val);
|
|
||||||
return Val;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetTimerCtrlReg (
|
|
||||||
UINTN Val
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntpCtl, (VOID *)&Val);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmArchTimerSetCompareVal (
|
|
||||||
IN UINT64 Val
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ArmArchTimerWriteReg (CntpCval, (VOID *)&Val);
|
|
||||||
}
|
|
||||||
|
|
|
@ -120,6 +120,7 @@
|
||||||
[LibraryClasses.AARCH64]
|
[LibraryClasses.AARCH64]
|
||||||
ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf
|
ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64Lib.inf
|
||||||
ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
|
ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
|
||||||
|
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
|
||||||
|
|
||||||
[LibraryClasses.common.SEC]
|
[LibraryClasses.common.SEC]
|
||||||
ArmPlatformSecLib|ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
|
ArmPlatformSecLib|ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
|
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
|
||||||
ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
|
ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
|
||||||
ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
|
ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
|
||||||
|
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
|
||||||
|
|
||||||
# RealView Emulation Board Specific Libraries
|
# RealView Emulation Board Specific Libraries
|
||||||
EfiResetSystemLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
|
EfiResetSystemLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
|
ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
|
||||||
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
|
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
|
||||||
ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
|
ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
|
||||||
|
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
|
||||||
|
|
||||||
# Versatile Express Specific Libraries
|
# Versatile Express Specific Libraries
|
||||||
ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
|
ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
|
||||||
|
|
Loading…
Reference in New Issue