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 Omap35xxPkg/RealTimeClockLib accordingly.

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

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

Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
Cc: Leif Lindholm <quic_llind...@quicinc.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4565
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 
Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c
 | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git 
a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c
 
b/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c
index 10920a13786b..24fcaaf125c4 100644
--- 
a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c
+++ 
b/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c
@@ -10,11 +10,9 @@
 
 #include <Library/BaseMemoryLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/DebugLib.h>
 #include <Library/IoLib.h>
 
-#include <Protocol/RealTimeClock.h>
 #include <Protocol/EmbeddedExternalDevice.h>
 
 #include <Omap3530/Omap3530.h>
@@ -242,7 +240,6 @@ LibRtcInitialize (
   )
 {
   EFI_STATUS    Status;
-  EFI_HANDLE    Handle;
   UINT8         Data;
   EFI_TPL       OldTpl;
 
@@ -255,19 +252,5 @@ LibRtcInitialize (
   ASSERT_EFI_ERROR(Status);
   gBS->RestoreTPL(OldTpl);
 
-  // Setup the setters and getters
-  gRT->GetTime       = LibGetTime;
-  gRT->SetTime       = LibSetTime;
-  gRT->GetWakeupTime = LibGetWakeupTime;
-  gRT->SetWakeupTime = LibSetWakeupTime;
-
-  // Install the protocol
-  Handle = NULL;
-  Status = gBS->InstallMultipleProtocolInterfaces (
-                  &Handle,
-                  &gEfiRealTimeClockArchProtocolGuid,  NULL,
-                  NULL
-                 );
-
-  return Status;
+  return EFI_SUCCESS;
 }


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109841): https://edk2.groups.io/g/devel/message/109841
Mute This Topic: https://groups.io/mt/102079660/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to