[edk2] [PATCH 4/6] ArmVirtPkg/QemuFwCfgLib: add explicitly initialized instance

Laszlo Ersek posted 6 patches 7 years, 7 months ago
There is a newer version of this series
[edk2] [PATCH 4/6] ArmVirtPkg/QemuFwCfgLib: add explicitly initialized instance
Posted by Laszlo Ersek 7 years, 7 months ago
The QemuFwCfgLibExplicitInit instance differs from the normally used one
in that the client module has to call the QemuFwCfgInitialize() function
explicitly -- there is no library constructor --, and the client shall
also ensure that the dependency on FDT_CLIENT_PROTOCOL is satisfied --
there is no DepEx.

In particular this enables the module that produces FDT_CLIENT_PROTOCOL to
use the library, after the protocol is installed.

Note that neither QemuFwCfgLib instance calls
FDT_CLIENT_PROTOCOL.GetOsExposure(). In fact, the QemuFwCfgLibExplicitInit
instance will be utilized to implement
FDT_CLIENT_PROTOCOL.GetOsExposure().

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 ArmVirtPkg/Library/QemuFwCfgLib/{QemuFwCfgLib.inf => QemuFwCfgLibExplicitInit.inf} | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLibExplicitInit.inf
similarity index 72%
copy from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
copy to ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLibExplicitInit.inf
index eff4a2165062..007e5f1b2d54 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLibExplicitInit.inf
@@ -1,8 +1,8 @@
 ## @file
 #
-#  Stateful, implicitly initialized fw_cfg library.
+#  Stateful, explicitly initialized fw_cfg library.
 #
-#  Copyright (C) 2013 - 2014, Red Hat, Inc.
+#  Copyright (C) 2013 - 2017, Red Hat, Inc.
 #  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials are licensed and made available
@@ -18,13 +18,11 @@
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = QemuFwCfgLib
-  FILE_GUID                      = B271F41F-B841-48A9-BA8D-545B4BC2E2BF
+  BASE_NAME                      = QemuFwCfgLibExplicitInit
+  FILE_GUID                      = 7DF98175-3819-4966-A48C-E56056EA8F42
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = QemuFwCfgLib|DXE_DRIVER
-
-  CONSTRUCTOR                    = QemuFwCfgInitialize
+  LIBRARY_CLASS                  = QemuFwCfgLib|DXE_DRIVER UEFI_DRIVER
 
 #
 # The following information is for reference only and not required by the build
@@ -50,6 +48,3 @@ [LibraryClasses]
 
 [Protocols]
   gFdtClientProtocolGuid                                ## CONSUMES
-
-[Depex]
-  gFdtClientProtocolGuid
-- 
2.9.3


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 4/6] ArmVirtPkg/QemuFwCfgLib: add explicitly initialized instance
Posted by Laszlo Ersek 7 years, 7 months ago
On 03/08/17 20:05, Laszlo Ersek wrote:
> The QemuFwCfgLibExplicitInit instance differs from the normally used one
> in that the client module has to call the QemuFwCfgInitialize() function
> explicitly -- there is no library constructor --, and the client shall
> also ensure that the dependency on FDT_CLIENT_PROTOCOL is satisfied --
> there is no DepEx.
> 
> In particular this enables the module that produces FDT_CLIENT_PROTOCOL to
> use the library, after the protocol is installed.
> 
> Note that neither QemuFwCfgLib instance calls
> FDT_CLIENT_PROTOCOL.GetOsExposure(). In fact, the QemuFwCfgLibExplicitInit
> instance will be utilized to implement
> FDT_CLIENT_PROTOCOL.GetOsExposure().
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  ArmVirtPkg/Library/QemuFwCfgLib/{QemuFwCfgLib.inf => QemuFwCfgLibExplicitInit.inf} | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLibExplicitInit.inf
> similarity index 72%
> copy from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> copy to ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLibExplicitInit.inf
> index eff4a2165062..007e5f1b2d54 100644
> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLibExplicitInit.inf
> @@ -1,8 +1,8 @@
>  ## @file
>  #
> -#  Stateful, implicitly initialized fw_cfg library.
> +#  Stateful, explicitly initialized fw_cfg library.
>  #
> -#  Copyright (C) 2013 - 2014, Red Hat, Inc.
> +#  Copyright (C) 2013 - 2017, Red Hat, Inc.
>  #  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
>  #
>  #  This program and the accompanying materials are licensed and made available
> @@ -18,13 +18,11 @@
>  
>  [Defines]
>    INF_VERSION                    = 0x00010005
> -  BASE_NAME                      = QemuFwCfgLib
> -  FILE_GUID                      = B271F41F-B841-48A9-BA8D-545B4BC2E2BF
> +  BASE_NAME                      = QemuFwCfgLibExplicitInit
> +  FILE_GUID                      = 7DF98175-3819-4966-A48C-E56056EA8F42
>    MODULE_TYPE                    = BASE
>    VERSION_STRING                 = 1.0
> -  LIBRARY_CLASS                  = QemuFwCfgLib|DXE_DRIVER
> -
> -  CONSTRUCTOR                    = QemuFwCfgInitialize
> +  LIBRARY_CLASS                  = QemuFwCfgLib|DXE_DRIVER UEFI_DRIVER

The LIBRARY_CLASS change was unintentional (rebase oversight); if no
other issue is found, I'll fix it up before I push the series.

Thanks & sorry
Laszlo

>  
>  #
>  # The following information is for reference only and not required by the build
> @@ -50,6 +48,3 @@ [LibraryClasses]
>  
>  [Protocols]
>    gFdtClientProtocolGuid                                ## CONSUMES
> -
> -[Depex]
> -  gFdtClientProtocolGuid
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel