[edk2,edk2-platforms,2/4] Platform/ARM/BdsLid: drop unused BdsStartEfiApplication ()

Message ID 20181122172645.20819-3-ard.biesheuvel@linaro.org
State New
Headers show
Series
  • Platform/ARM: fix DevicePath mishandling in BdsLib
Related show

Commit Message

Ard Biesheuvel Nov. 22, 2018, 5:26 p.m.
To prevent having to fix it, let's drop BdsStartEfiApplication
entirely since it is never used.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 Platform/ARM/Include/Library/BdsLib.h     | 19 -------
 Platform/ARM/Library/BdsLib/BdsFilePath.c | 58 --------------------
 2 files changed, 77 deletions(-)

-- 
2.17.1

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

Comments

Laszlo Ersek Nov. 22, 2018, 5:55 p.m. | #1
On 11/22/18 18:26, Ard Biesheuvel wrote:
> To prevent having to fix it, let's drop BdsStartEfiApplication

> entirely since it is never used.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  Platform/ARM/Include/Library/BdsLib.h     | 19 -------

>  Platform/ARM/Library/BdsLib/BdsFilePath.c | 58 --------------------

>  2 files changed, 77 deletions(-)

> 

> diff --git a/Platform/ARM/Include/Library/BdsLib.h b/Platform/ARM/Include/Library/BdsLib.h

> index 4528c2e8739b..23f777d4097d 100644

> --- a/Platform/ARM/Include/Library/BdsLib.h

> +++ b/Platform/ARM/Include/Library/BdsLib.h

> @@ -140,25 +140,6 @@ BootOptionAllocateBootIndex (

>    VOID

>    );

>  

> -/**

> -  Start an EFI Application from a Device Path

> -

> -  @param  ParentImageHandle     Handle of the calling image

> -  @param  DevicePath            Location of the EFI Application

> -

> -  @retval EFI_SUCCESS           All drivers have been connected

> -  @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found

> -  @retval EFI_OUT_OF_RESOURCES  There is not enough resource memory to store the matching results.

> -

> -**/

> -EFI_STATUS

> -BdsStartEfiApplication (

> -  IN EFI_HANDLE                  ParentImageHandle,

> -  IN EFI_DEVICE_PATH_PROTOCOL    *DevicePath,

> -  IN UINTN                       LoadOptionsSize,

> -  IN VOID*                       LoadOptions

> -  );

> -

>  EFI_STATUS

>  BdsLoadImage (

>    IN     EFI_DEVICE_PATH       *DevicePath,

> diff --git a/Platform/ARM/Library/BdsLib/BdsFilePath.c b/Platform/ARM/Library/BdsLib/BdsFilePath.c

> index 7a4a5052a786..67dafa4f3651 100644

> --- a/Platform/ARM/Library/BdsLib/BdsFilePath.c

> +++ b/Platform/ARM/Library/BdsLib/BdsFilePath.c

> @@ -1353,61 +1353,3 @@ BdsLoadImage (

>  {

>    return BdsLoadImageAndUpdateDevicePath (&DevicePath, Type, Image, FileSize);

>  }

> -

> -/**

> -  Start an EFI Application from a Device Path

> -

> -  @param  ParentImageHandle     Handle of the calling image

> -  @param  DevicePath            Location of the EFI Application

> -

> -  @retval EFI_SUCCESS           All drivers have been connected

> -  @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found

> -  @retval EFI_OUT_OF_RESOURCES  There is not enough resource memory to store the matching results.

> -

> -**/

> -EFI_STATUS

> -BdsStartEfiApplication (

> -  IN EFI_HANDLE                  ParentImageHandle,

> -  IN EFI_DEVICE_PATH_PROTOCOL    *DevicePath,

> -  IN UINTN                       LoadOptionsSize,

> -  IN VOID*                       LoadOptions

> -  )

> -{

> -  EFI_STATUS                   Status;

> -  EFI_HANDLE                   ImageHandle;

> -  EFI_PHYSICAL_ADDRESS         BinaryBuffer;

> -  UINTN                        BinarySize;

> -  EFI_LOADED_IMAGE_PROTOCOL*   LoadedImage;

> -

> -  // Find the nearest supported file loader

> -  Status = BdsLoadImageAndUpdateDevicePath (&DevicePath, AllocateAnyPages, &BinaryBuffer, &BinarySize);

> -  if (EFI_ERROR (Status)) {

> -    return Status;

> -  }

> -

> -  // Load the image from the Buffer with Boot Services function

> -  Status = gBS->LoadImage (TRUE, ParentImageHandle, DevicePath, (VOID*)(UINTN)BinaryBuffer, BinarySize, &ImageHandle);

> -  if (EFI_ERROR (Status)) {

> -    return Status;

> -  }

> -

> -  // Passed LoadOptions to the EFI Application

> -  if (LoadOptionsSize != 0) {

> -    Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);

> -    if (EFI_ERROR (Status)) {

> -      return Status;

> -    }

> -

> -    LoadedImage->LoadOptionsSize  = LoadOptionsSize;

> -    LoadedImage->LoadOptions      = LoadOptions;

> -  }

> -

> -  // Before calling the image, enable the Watchdog Timer for  the 5 Minute period

> -  gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);

> -  // Start the image

> -  Status = gBS->StartImage (ImageHandle, NULL, NULL);

> -  // Clear the Watchdog Timer after the image returns

> -  gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);

> -

> -  return Status;

> -}

> 


Makes sense; first we import BdsLib.h, then fix it up together with the
(sole) lib instance.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

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

Patch

diff --git a/Platform/ARM/Include/Library/BdsLib.h b/Platform/ARM/Include/Library/BdsLib.h
index 4528c2e8739b..23f777d4097d 100644
--- a/Platform/ARM/Include/Library/BdsLib.h
+++ b/Platform/ARM/Include/Library/BdsLib.h
@@ -140,25 +140,6 @@  BootOptionAllocateBootIndex (
   VOID
   );
 
-/**
-  Start an EFI Application from a Device Path
-
-  @param  ParentImageHandle     Handle of the calling image
-  @param  DevicePath            Location of the EFI Application
-
-  @retval EFI_SUCCESS           All drivers have been connected
-  @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found
-  @retval EFI_OUT_OF_RESOURCES  There is not enough resource memory to store the matching results.
-
-**/
-EFI_STATUS
-BdsStartEfiApplication (
-  IN EFI_HANDLE                  ParentImageHandle,
-  IN EFI_DEVICE_PATH_PROTOCOL    *DevicePath,
-  IN UINTN                       LoadOptionsSize,
-  IN VOID*                       LoadOptions
-  );
-
 EFI_STATUS
 BdsLoadImage (
   IN     EFI_DEVICE_PATH       *DevicePath,
diff --git a/Platform/ARM/Library/BdsLib/BdsFilePath.c b/Platform/ARM/Library/BdsLib/BdsFilePath.c
index 7a4a5052a786..67dafa4f3651 100644
--- a/Platform/ARM/Library/BdsLib/BdsFilePath.c
+++ b/Platform/ARM/Library/BdsLib/BdsFilePath.c
@@ -1353,61 +1353,3 @@  BdsLoadImage (
 {
   return BdsLoadImageAndUpdateDevicePath (&DevicePath, Type, Image, FileSize);
 }
-
-/**
-  Start an EFI Application from a Device Path
-
-  @param  ParentImageHandle     Handle of the calling image
-  @param  DevicePath            Location of the EFI Application
-
-  @retval EFI_SUCCESS           All drivers have been connected
-  @retval EFI_NOT_FOUND         The Linux kernel Device Path has not been found
-  @retval EFI_OUT_OF_RESOURCES  There is not enough resource memory to store the matching results.
-
-**/
-EFI_STATUS
-BdsStartEfiApplication (
-  IN EFI_HANDLE                  ParentImageHandle,
-  IN EFI_DEVICE_PATH_PROTOCOL    *DevicePath,
-  IN UINTN                       LoadOptionsSize,
-  IN VOID*                       LoadOptions
-  )
-{
-  EFI_STATUS                   Status;
-  EFI_HANDLE                   ImageHandle;
-  EFI_PHYSICAL_ADDRESS         BinaryBuffer;
-  UINTN                        BinarySize;
-  EFI_LOADED_IMAGE_PROTOCOL*   LoadedImage;
-
-  // Find the nearest supported file loader
-  Status = BdsLoadImageAndUpdateDevicePath (&DevicePath, AllocateAnyPages, &BinaryBuffer, &BinarySize);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  // Load the image from the Buffer with Boot Services function
-  Status = gBS->LoadImage (TRUE, ParentImageHandle, DevicePath, (VOID*)(UINTN)BinaryBuffer, BinarySize, &ImageHandle);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  // Passed LoadOptions to the EFI Application
-  if (LoadOptionsSize != 0) {
-    Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-
-    LoadedImage->LoadOptionsSize  = LoadOptionsSize;
-    LoadedImage->LoadOptions      = LoadOptions;
-  }
-
-  // Before calling the image, enable the Watchdog Timer for  the 5 Minute period
-  gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
-  // Start the image
-  Status = gBS->StartImage (ImageHandle, NULL, NULL);
-  // Clear the Watchdog Timer after the image returns
-  gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
-
-  return Status;
-}