On Tue, Sep 01, 2015 at 11:58:20AM +0200, Ard Biesheuvel wrote:
> The Intel BDS platform library still depends on the ARM BDS specific
> BdsLib. So replace its invocations with GenericBdsLib counterparts,
> and fix up where needed, so that we can drop the dependency.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <[email protected]>
> ---
>  ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c      | 21 
> ++++++++++++++------
>  ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h      |  1 -
>  ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf |  1 -
>  3 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c 
> b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> index c82f27fb4edd..739704727945 100644
> --- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> +++ b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> @@ -63,8 +63,11 @@ GetConsoleDevicePathFromVariable (
>    CHAR16*                   NextDevicePathStr;
>    EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *EfiDevicePathFromTextProtocol;
>  
> -  Status = GetGlobalEnvironmentVariable (ConsoleVarName, NULL, NULL, 
> (VOID**)&DevicePathInstances);
> -  if (EFI_ERROR(Status)) {
> +  Status = EFI_SUCCESS;
> +  Size = 0;
> +
> +  DevicePathInstances = BdsLibGetVariableAndSize (ConsoleVarName, 
> &gEfiGlobalVariableGuid, &Size);
> +  if (DevicePathInstances == NULL) {
>      // In case no default console device path has been defined we assume a 
> driver handles the console (eg: SimpleTextInOutSerial)
>      if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'\0')) {
>        *DevicePaths = NULL;
> @@ -74,8 +77,6 @@ GetConsoleDevicePathFromVariable (
>      Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, 
> (VOID **)&EfiDevicePathFromTextProtocol);
>      ASSERT_EFI_ERROR(Status);
>  
> -    DevicePathInstances = NULL;
> -
>      // Extract the Device Path instances from the multi-device path string
>      while ((DefaultConsolePaths != NULL) && (DefaultConsolePaths[0] != 
> L'\0')) {
>        NextDevicePathStr = StrStr (DefaultConsolePaths, L";");
> @@ -141,7 +142,15 @@ InitializeConsolePipe (
>    while (ConsoleDevicePaths != NULL) {
>      DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);
>  
> -    Status = BdsConnectDevicePath (DevicePath, Handle, NULL);
> +    Status = BdsLibConnectDevicePath (DevicePath);
> +    if (!EFI_ERROR (Status)) {
> +      //
> +      // If BdsLibConnectDevicePath () succeeded, *Handle must have a 
> non-NULL
> +      // value. So ASSERT that this is the case.
> +      //
> +      gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, 
> Handle);
> +      ASSERT (*Handle != NULL);
> +    }
>      DEBUG_CODE_BEGIN();
>        if (EFI_ERROR(Status)) {
>          // We convert back to the text representation of the device Path
> @@ -171,7 +180,7 @@ InitializeConsolePipe (
>    if (*Interface == NULL) {
>      Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, 
> &NoHandles, &Buffer);
>      if (EFI_ERROR (Status)) {
> -      BdsConnectAllDrivers ();
> +      BdsLibConnectAll ();
>        Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, 
> &NoHandles, &Buffer);
>      }
>  
> diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h 
> b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
> index a244ac913255..7122d58be7d7 100644
> --- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
> +++ b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.h
> @@ -19,7 +19,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  #include <Protocol/DevicePathToText.h>
>  
>  #include <Library/BaseMemoryLib.h>
> -#include <Library/BdsLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/DevicePathLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> diff --git 
> a/ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf 
> b/ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
> index 07de4cae4824..d47298d01a81 100644
> --- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
> +++ b/ArmPlatformPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
> @@ -44,7 +44,6 @@ [Packages]
>  [LibraryClasses]
>    BaseLib
>    BaseMemoryLib
> -  BdsLib
>    DebugLib
>    DevicePathLib
>    MemoryAllocationLib
> -- 
> 1.9.1

So, it's not a big deal, and I think this series is useful enough to
go in anyway, but with this patch and ArmBds, I end up with two
preconfigured boot menu entries for Shell:
---
[1] EFI Misc Device
[2] EFI Misc Device 1
[3] EFI Misc Device 2
[4] EFI Misc Device 3
[5] EFI Misc Device 4
[6] EFI Internal Shell
[7] EFI Misc Device 5
[8] Shell
[9] Boot Manager
Start: 
---

I think this has now also discarded the default boot entry that used
to be on this platform with the ArmBds.

However, if Ryan does not object to that:
Reviewed-by: Leif Lindholm <[email protected]>
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to