mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
UefiCpuPkg: RiscV64: CpuTimerLib: Add SEC/PEI and DXE library instances
Commit c27b5554 introduced a constructor that calls
GetPerformanceCounterProperties() to help initializing mTimeBase early.
However, in the PEI phase, this constructor may run before
the HOB list is available, leading to a crash.
This patch fixes the issue by providing a separate library instances
for the SEC/PEI phases that avoid invoking this constructor.
Also, rename this library as it can not be base library anymore.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
This commit is contained in:
parent
d7bf8b91f3
commit
d48465508b
5 changed files with 46 additions and 8 deletions
|
|
@ -124,7 +124,7 @@ GetPerformanceCounter (
|
|||
return (UINT64)RiscVReadTimer ();
|
||||
}
|
||||
|
||||
/**return
|
||||
/**
|
||||
Retrieves the 64-bit frequency in Hz and the range of performance counter
|
||||
values.
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ GetTimeInNanoSecond (
|
|||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BaseRiscV64CpuTimerLibConstructor (
|
||||
RiscV64CpuTimerLibConstructor (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
## @file
|
||||
# RISC-V Base CPU Timer Library Instance
|
||||
# RISC-V CPU Timer Library Instance
|
||||
#
|
||||
# Copyright (c) 2016 - 2019, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
|
||||
# Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.<BR>
|
||||
# Copyright (C) 2026 Qualcomm Technologies, Inc. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
|
|
@ -10,13 +11,13 @@
|
|||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = BaseRisV64CpuTimerLib
|
||||
BASE_NAME = RiscV64CpuTimerDxeLib
|
||||
FILE_GUID = B635A600-EA24-4199-88E8-5761EEA96A51
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = TimerLib
|
||||
MODULE_UNI_FILE = BaseRisV64CpuTimerLib.uni
|
||||
CONSTRUCTOR = BaseRiscV64CpuTimerLibConstructor
|
||||
LIBRARY_CLASS = TimerLib | DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER UEFI_APPLICATION
|
||||
MODULE_UNI_FILE = RiscV64CpuTimerLib.uni
|
||||
CONSTRUCTOR = RiscV64CpuTimerLibConstructor
|
||||
|
||||
[Sources]
|
||||
CpuTimerLib.c
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
## @file
|
||||
# RISC-V CPU Timer Library Instance
|
||||
#
|
||||
# Copyright (c) 2016 - 2019, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
|
||||
# Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.<BR>
|
||||
# Copyright (C) 2026 Qualcomm Technologies, Inc. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = RiscV64CpuTimerSecLib
|
||||
FILE_GUID = 59D73C04-6D8F-4F7A-A444-86F059CCF939
|
||||
MODULE_TYPE = SEC
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = TimerLib | SEC PEI_CORE PEIM
|
||||
MODULE_UNI_FILE = RiscV64CpuTimerLib.uni
|
||||
|
||||
[Sources]
|
||||
CpuTimerLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
UefiCpuPkg/UefiCpuPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
PcdLib
|
||||
DebugLib
|
||||
FdtLib
|
||||
HobLib
|
||||
|
||||
[Guids]
|
||||
gFdtHobGuid
|
||||
|
|
@ -224,8 +224,9 @@
|
|||
UefiCpuPkg/Library/CpuExceptionHandlerLib/UnitTest/DxeCpuExceptionHandlerLibUnitTest.inf
|
||||
|
||||
[Components.RISCV64]
|
||||
UefiCpuPkg/Library/BaseRiscV64CpuTimerLib/BaseRiscV64CpuTimerLib.inf
|
||||
UefiCpuPkg/Library/BaseRiscVMmuLib/BaseRiscVMmuLib.inf
|
||||
UefiCpuPkg/Library/RiscV64CpuTimerLib/RiscV64CpuTimerDxeLib.inf
|
||||
UefiCpuPkg/Library/RiscV64CpuTimerLib/RiscV64CpuTimerSecLib.inf
|
||||
UefiCpuPkg/CpuTimerDxeRiscV64/CpuTimerDxeRiscV64.inf
|
||||
UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV64.inf
|
||||
UefiCpuPkg/CpuMmio2Dxe/CpuMmio2Dxe.inf
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue