[edk2-devel] [edk2-platforms PATCH 16/19] Armada7k8k/RealTimeClockLib: hide LibRtcVirtualNotifyEvent

Laszlo Ersek posted 19 patches 2 years, 4 months ago
[edk2-devel] [edk2-platforms PATCH 16/19] Armada7k8k/RealTimeClockLib: hide LibRtcVirtualNotifyEvent
Posted by Laszlo Ersek 2 years, 4 months ago
The RealTimeClockLib class header in edk2 mistakenly declares a function
called LibRtcVirtualNotifyEvent(). No component ever calls this function
crossing module boundaries; all RealTimeClockLib instances in edk2 and
edk2-platforms are supposed to register (and do register) their
SetVirtualAddressMap() notification functions.

Rename LibRtcVirtualNotifyEvent() to VirtualNotifyEvent(), and make it
static, in preparation for removing the LibRtcVirtualNotifyEvent()
declaration from the lib class header later. Also hoist the function
definition above the reference.

Build-tested only, with the following platforms:

- Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc
- Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc
- Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc
- Platform/SolidRun/Cn913xCEx7Eval/Cn913xCEx7Eval.dsc

("Platform/Marvell/Cn913xDb/Cn913xDbA.dsc" fails to build regardless:
"build" complains that
"Silicon/Marvell/OcteonTx/DeviceTree/T91/$(PLATFORM_NAME).inf" is missing,
and as far as I can see, not even the
"Silicon/Marvell/OcteonTx/DeviceTree" directory exists.)

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4564
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c | 52 ++++++++++----------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
index 49c9385d53d6..d538b030b111 100644
--- a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
+++ b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
@@ -205,6 +205,31 @@ LibSetWakeupTime (
   return EFI_SUCCESS;
 }
 
+/**
+  Fixup internal data so that EFI can be call in virtual mode.
+  Call the passed in Child Notify event and convert any pointers in
+  lib to virtual mode.
+
+  @param[in]    Event   The Event that is being processed
+  @param[in]    Context Event Context
+**/
+STATIC
+VOID
+EFIAPI
+VirtualNotifyEvent (
+  IN EFI_EVENT        Event,
+  IN VOID             *Context
+  )
+{
+  //
+  // Only needed if you are going to support the OS calling RTC functions in virtual mode.
+  // You will need to call EfiConvertPointer (). To convert any stored physical addresses
+  // to virtual address. After the OS transistions to calling in virtual mode, all future
+  // runtime calls will be made in virtual mode.
+  //
+  EfiConvertPointer (0x0, (VOID**)&mArmadaRtcBase);
+}
+
 /**
   This is the declaration of an EFI image entry point. This can be the entry point to an application
   written to this specification, an EFI boot service driver, or an EFI runtime driver.
@@ -285,7 +310,7 @@ LibRtcInitialize (
   Status = gBS->CreateEventEx (
                   EVT_NOTIFY_SIGNAL,
                   TPL_NOTIFY,
-                  LibRtcVirtualNotifyEvent,
+                  VirtualNotifyEvent,
                   NULL,
                   &gEfiEventVirtualAddressChangeGuid,
                   &mRtcVirtualAddrChangeEvent
@@ -304,28 +329,3 @@ ErrSetMem:
 
   return Status;
 }
-
-
-/**
-  Fixup internal data so that EFI can be call in virtual mode.
-  Call the passed in Child Notify event and convert any pointers in
-  lib to virtual mode.
-
-  @param[in]    Event   The Event that is being processed
-  @param[in]    Context Event Context
-**/
-VOID
-EFIAPI
-LibRtcVirtualNotifyEvent (
-  IN EFI_EVENT        Event,
-  IN VOID             *Context
-  )
-{
-  //
-  // Only needed if you are going to support the OS calling RTC functions in virtual mode.
-  // You will need to call EfiConvertPointer (). To convert any stored physical addresses
-  // to virtual address. After the OS transistions to calling in virtual mode, all future
-  // runtime calls will be made in virtual mode.
-  //
-  EfiConvertPointer (0x0, (VOID**)&mArmadaRtcBase);
-}



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109558): https://edk2.groups.io/g/devel/message/109558
Mute This Topic: https://groups.io/mt/101914670/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-platforms PATCH 16/19] Armada7k8k/RealTimeClockLib: hide LibRtcVirtualNotifyEvent
Posted by Marcin Wojtas via groups.io 2 years, 3 months ago
Hi,

czw., 12 paź 2023 o 11:10 Laszlo Ersek <lersek@redhat.com> napisał(a):
>
> The RealTimeClockLib class header in edk2 mistakenly declares a function
> called LibRtcVirtualNotifyEvent(). No component ever calls this function
> crossing module boundaries; all RealTimeClockLib instances in edk2 and
> edk2-platforms are supposed to register (and do register) their
> SetVirtualAddressMap() notification functions.
>
> Rename LibRtcVirtualNotifyEvent() to VirtualNotifyEvent(), and make it
> static, in preparation for removing the LibRtcVirtualNotifyEvent()
> declaration from the lib class header later. Also hoist the function
> definition above the reference.
>
> Build-tested only, with the following platforms:
>
> - Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc
> - Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc
> - Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc
> - Platform/SolidRun/Cn913xCEx7Eval/Cn913xCEx7Eval.dsc
>
> ("Platform/Marvell/Cn913xDb/Cn913xDbA.dsc" fails to build regardless:
> "build" complains that
> "Silicon/Marvell/OcteonTx/DeviceTree/T91/$(PLATFORM_NAME).inf" is missing,
> and as far as I can see, not even the
> "Silicon/Marvell/OcteonTx/DeviceTree" directory exists.)
>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Marcin Wojtas <mw@semihalf.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4564
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c | 52 ++++++++++----------
>  1 file changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
> index 49c9385d53d6..d538b030b111 100644
> --- a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
> +++ b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
> @@ -205,6 +205,31 @@ LibSetWakeupTime (
>    return EFI_SUCCESS;
>  }
>
> +/**
> +  Fixup internal data so that EFI can be call in virtual mode.
> +  Call the passed in Child Notify event and convert any pointers in
> +  lib to virtual mode.
> +
> +  @param[in]    Event   The Event that is being processed
> +  @param[in]    Context Event Context
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +VirtualNotifyEvent (
> +  IN EFI_EVENT        Event,
> +  IN VOID             *Context
> +  )
> +{
> +  //
> +  // Only needed if you are going to support the OS calling RTC functions in virtual mode.
> +  // You will need to call EfiConvertPointer (). To convert any stored physical addresses
> +  // to virtual address. After the OS transistions to calling in virtual mode, all future
> +  // runtime calls will be made in virtual mode.
> +  //
> +  EfiConvertPointer (0x0, (VOID**)&mArmadaRtcBase);
> +}
> +
>  /**
>    This is the declaration of an EFI image entry point. This can be the entry point to an application
>    written to this specification, an EFI boot service driver, or an EFI runtime driver.
> @@ -285,7 +310,7 @@ LibRtcInitialize (
>    Status = gBS->CreateEventEx (
>                    EVT_NOTIFY_SIGNAL,
>                    TPL_NOTIFY,
> -                  LibRtcVirtualNotifyEvent,
> +                  VirtualNotifyEvent,
>                    NULL,
>                    &gEfiEventVirtualAddressChangeGuid,
>                    &mRtcVirtualAddrChangeEvent
> @@ -304,28 +329,3 @@ ErrSetMem:
>
>    return Status;
>  }
> -
> -
> -/**
> -  Fixup internal data so that EFI can be call in virtual mode.
> -  Call the passed in Child Notify event and convert any pointers in
> -  lib to virtual mode.
> -
> -  @param[in]    Event   The Event that is being processed
> -  @param[in]    Context Event Context
> -**/
> -VOID
> -EFIAPI
> -LibRtcVirtualNotifyEvent (
> -  IN EFI_EVENT        Event,
> -  IN VOID             *Context
> -  )
> -{
> -  //
> -  // Only needed if you are going to support the OS calling RTC functions in virtual mode.
> -  // You will need to call EfiConvertPointer (). To convert any stored physical addresses
> -  // to virtual address. After the OS transistions to calling in virtual mode, all future
> -  // runtime calls will be made in virtual mode.
> -  //
> -  EfiConvertPointer (0x0, (VOID**)&mArmadaRtcBase);
> -}
>

Reviewed-by: Marcin Wojtas <mw@semihalf.com>

Thanks,
Marcin


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109574): https://edk2.groups.io/g/devel/message/109574
Mute This Topic: https://groups.io/mt/101914670/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-