Skip to content
Commit 88b0e7f0 authored by Laszlo Ersek's avatar Laszlo Ersek
Browse files

LoongArchQemuPkg/LsRealTimeClockLib: remove superfluous instance init steps

RealTimeClockLib instances are consumed by edk2's
EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function
InitializeRealTimeClock(), the driver:

(1) calls LibRtcInitialize(),

(2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime()
    runtime services to its own similarly-named functions -- where those
    functions wrap the corresponding RealTimeClockLib APIs,

(3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol
    interface.

Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through
II-9.7.2.7.

However, this means that LibRtcInitialize() (of any RealTimeClockLib
instance) should not itself (a) set the GetTime(), SetTime(),
GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install
EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be
overwritten in step (2) anyway, and step (3) will uselessly install a
second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the
protocol database. (The protocol only serves to notify the DXE Foundation
about said runtime services being available.)

Clean up LoongArchQemuPkg/LsRealTimeClockLib accordingly.

(Note that the lib instance INF file already does not list
UefiRuntimeServicesTableLib.)

Build-tested only (with "Loongson.dsc").

Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Chao Li <lichao@loongson.cn>
Cc: Xianglai li <lixianglai@loongson.cn>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4565


Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
Message-Id: <20231020121903.44986-3-lersek@redhat.com>
Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Reviewed-by: default avatarChao Li <lichao@loongson.cn>
parent cce27fdc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment