mirror of https://github.com/acidanthera/audk.git
ArmVirtPkg: handle virtual EL2 timer in DT
FEAT_VHE, introduced in ARMv8.1, adds a virtual EL2 timer. However, this library verifies that exactly 3 or 4 12-byte timer interrupts are provided in input DT, ASSERTing when the new timer is added. Change the assert to >= 36. Extend the current logic, also initializing PcdArmArchTimerHypVirtIntrNum if 5 interrupts are provided. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com> Reported-by: Peter Maydell <peter.maydell@linaro.org> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
baee97670f
commit
eb485b6438
|
@ -178,6 +178,7 @@
|
|||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum|0x0
|
||||
|
||||
#
|
||||
# ARM General Interrupt Controller
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum|0x0
|
||||
|
||||
#
|
||||
# ARM General Interrupt Controller
|
||||
|
|
|
@ -253,6 +253,7 @@
|
|||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum|0x0
|
||||
|
||||
#
|
||||
# ARM General Interrupt Controller
|
||||
|
|
|
@ -214,6 +214,7 @@
|
|||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum|0x0
|
||||
|
||||
#
|
||||
# ARM General Interrupt Controller
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum|0x0
|
||||
|
||||
#
|
||||
# ARM General Interrupt Controller
|
||||
|
|
|
@ -35,6 +35,7 @@ ArmVirtTimerFdtClientLibConstructor (
|
|||
CONST INTERRUPT_PROPERTY *InterruptProp;
|
||||
UINT32 PropSize;
|
||||
INT32 SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;
|
||||
INT32 HypVirtIntrNum;
|
||||
RETURN_STATUS PcdStatus;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
|
@ -66,10 +67,10 @@ ArmVirtTimerFdtClientLibConstructor (
|
|||
}
|
||||
|
||||
//
|
||||
// - interrupts : Interrupt list for secure, non-secure, virtual and
|
||||
// hypervisor timers, in that order.
|
||||
// - interrupts : Interrupt list for secure, non-secure, virtual,
|
||||
// hypervisor and hypervisor virtual timers, in that order.
|
||||
//
|
||||
ASSERT (PropSize == 36 || PropSize == 48);
|
||||
ASSERT (PropSize >= 36);
|
||||
|
||||
SecIntrNum = SwapBytes32 (InterruptProp[0].Number)
|
||||
+ (InterruptProp[0].Type ? 16 : 0);
|
||||
|
@ -79,6 +80,8 @@ ArmVirtTimerFdtClientLibConstructor (
|
|||
+ (InterruptProp[2].Type ? 16 : 0);
|
||||
HypIntrNum = PropSize < 48 ? 0 : SwapBytes32 (InterruptProp[3].Number)
|
||||
+ (InterruptProp[3].Type ? 16 : 0);
|
||||
HypVirtIntrNum = PropSize < 60 ? 0 : SwapBytes32 (InterruptProp[4].Number)
|
||||
+ (InterruptProp[4].Type ? 16 : 0);
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
|
@ -97,6 +100,8 @@ ArmVirtTimerFdtClientLibConstructor (
|
|||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
PcdStatus = PcdSet32S (PcdArmArchTimerHypIntrNum, HypIntrNum);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
PcdStatus = PcdSet32S (PcdArmArchTimerHypVirtIntrNum, HypVirtIntrNum);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum
|
||||
|
||||
[Depex]
|
||||
gFdtClientProtocolGuid
|
||||
|
|
Loading…
Reference in New Issue