mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-11-03 21:17:23 +01:00 
			
		
		
		
	ArmPkg/BdsLib: Added support to change the given DevicePath of a Boot Entry
Some boot entries might not have a EFI Device Path FilePath attached to it (eg: EFI device Path for removable device path). This patch allows a support loader to edit the EFI Device Path and for instance add \EFI\BOOT\BOOT(ARM|AA64).EFI Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16930 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		
							parent
							
								
									b097a180b8
								
							
						
					
					
						commit
						df320b1084
					
				@ -467,7 +467,7 @@ BdsFileSystemSupport (
 | 
			
		||||
 | 
			
		||||
EFI_STATUS
 | 
			
		||||
BdsFileSystemLoadImage (
 | 
			
		||||
  IN     EFI_DEVICE_PATH       *DevicePath,
 | 
			
		||||
  IN OUT EFI_DEVICE_PATH       **DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE            Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH       *RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE     Type,
 | 
			
		||||
@ -560,9 +560,9 @@ BdsMemoryMapSupport (
 | 
			
		||||
 | 
			
		||||
EFI_STATUS
 | 
			
		||||
BdsMemoryMapLoadImage (
 | 
			
		||||
  IN     EFI_DEVICE_PATH *DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH *RemainingDevicePath,
 | 
			
		||||
  IN OUT EFI_DEVICE_PATH       **DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE            Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH       *RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE     Type,
 | 
			
		||||
  IN OUT EFI_PHYSICAL_ADDRESS* Image,
 | 
			
		||||
  OUT    UINTN                 *ImageSize
 | 
			
		||||
@ -575,8 +575,8 @@ BdsMemoryMapLoadImage (
 | 
			
		||||
  if (IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP)) {
 | 
			
		||||
    MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)RemainingDevicePath;
 | 
			
		||||
  } else {
 | 
			
		||||
    ASSERT (IS_DEVICE_PATH_NODE (DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP));
 | 
			
		||||
    MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)DevicePath;
 | 
			
		||||
    ASSERT (IS_DEVICE_PATH_NODE (*DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP));
 | 
			
		||||
    MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)*DevicePath;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Size = MemMapPathDevicePath->EndingAddress - MemMapPathDevicePath->StartingAddress;
 | 
			
		||||
@ -612,9 +612,9 @@ BdsFirmwareVolumeSupport (
 | 
			
		||||
 | 
			
		||||
EFI_STATUS
 | 
			
		||||
BdsFirmwareVolumeLoadImage (
 | 
			
		||||
  IN     EFI_DEVICE_PATH *DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH *RemainingDevicePath,
 | 
			
		||||
  IN OUT EFI_DEVICE_PATH       **DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE            Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH       *RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE     Type,
 | 
			
		||||
  IN OUT EFI_PHYSICAL_ADDRESS* Image,
 | 
			
		||||
  OUT    UINTN                 *ImageSize
 | 
			
		||||
@ -733,12 +733,12 @@ BdsPxeSupport (
 | 
			
		||||
 | 
			
		||||
EFI_STATUS
 | 
			
		||||
BdsPxeLoadImage (
 | 
			
		||||
  IN     EFI_DEVICE_PATH*       DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE             Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH*       RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE      Type,
 | 
			
		||||
  IN OUT EFI_PHYSICAL_ADDRESS   *Image,
 | 
			
		||||
  OUT    UINTN                  *ImageSize
 | 
			
		||||
  IN OUT EFI_DEVICE_PATH       **DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE            Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH       *RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE     Type,
 | 
			
		||||
  IN OUT EFI_PHYSICAL_ADDRESS* Image,
 | 
			
		||||
  OUT    UINTN                 *ImageSize
 | 
			
		||||
  )
 | 
			
		||||
{
 | 
			
		||||
  EFI_STATUS              Status;
 | 
			
		||||
@ -752,14 +752,14 @@ BdsPxeLoadImage (
 | 
			
		||||
    return Status;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, NULL);
 | 
			
		||||
  Status = LoadFileProtocol->LoadFile (LoadFileProtocol, *DevicePath, TRUE, &BufferSize, NULL);
 | 
			
		||||
  if (Status == EFI_BUFFER_TOO_SMALL) {
 | 
			
		||||
    Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(BufferSize), Image);
 | 
			
		||||
    if (EFI_ERROR (Status)) {
 | 
			
		||||
      return Status;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, (VOID*)(UINTN)(*Image));
 | 
			
		||||
    Status = LoadFileProtocol->LoadFile (LoadFileProtocol, *DevicePath, TRUE, &BufferSize, (VOID*)(UINTN)(*Image));
 | 
			
		||||
    if (!EFI_ERROR (Status) && (ImageSize != NULL)) {
 | 
			
		||||
      *ImageSize = BufferSize;
 | 
			
		||||
    }
 | 
			
		||||
@ -1018,12 +1018,12 @@ Mtftp4CheckPacket (
 | 
			
		||||
**/
 | 
			
		||||
EFI_STATUS
 | 
			
		||||
BdsTftpLoadImage (
 | 
			
		||||
  IN     EFI_DEVICE_PATH*       DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE             ControllerHandle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH*       RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE      Type,
 | 
			
		||||
  IN OUT EFI_PHYSICAL_ADDRESS   *Image,
 | 
			
		||||
  OUT    UINTN                  *ImageSize
 | 
			
		||||
  IN OUT EFI_DEVICE_PATH       **DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE            ControllerHandle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH       *RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE     Type,
 | 
			
		||||
  IN OUT EFI_PHYSICAL_ADDRESS  *Image,
 | 
			
		||||
  OUT    UINTN                 *ImageSize
 | 
			
		||||
  )
 | 
			
		||||
{
 | 
			
		||||
  EFI_STATUS               Status;
 | 
			
		||||
@ -1340,7 +1340,7 @@ BdsLoadImageAndUpdateDevicePath (
 | 
			
		||||
  FileLoader = FileLoaders;
 | 
			
		||||
  while (FileLoader->Support != NULL) {
 | 
			
		||||
    if (FileLoader->Support (*DevicePath, Handle, RemainingDevicePath)) {
 | 
			
		||||
      return FileLoader->LoadImage (*DevicePath, Handle, RemainingDevicePath, Type, Image, FileSize);
 | 
			
		||||
      return FileLoader->LoadImage (DevicePath, Handle, RemainingDevicePath, Type, Image, FileSize);
 | 
			
		||||
    }
 | 
			
		||||
    FileLoader++;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
/** @file
 | 
			
		||||
*
 | 
			
		||||
*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
 | 
			
		||||
*  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 | 
			
		||||
*
 | 
			
		||||
*  This program and the accompanying materials
 | 
			
		||||
*  are licensed and made available under the terms and conditions of the BSD License
 | 
			
		||||
@ -45,14 +45,39 @@
 | 
			
		||||
 | 
			
		||||
#include <Uefi.h>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Check if the file loader can support this device path.
 | 
			
		||||
 *
 | 
			
		||||
 * @param DevicePath    EFI Device Path of the image to load.
 | 
			
		||||
 *                      This device path generally comes from the boot entry (ie: Boot####).
 | 
			
		||||
 * @param Handle        Handle of the driver supporting the device path
 | 
			
		||||
 * @param RemainingDevicePath   Part of the EFI Device Path that has not been resolved during
 | 
			
		||||
 *                      the Device Path discovery
 | 
			
		||||
 */
 | 
			
		||||
typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT) (
 | 
			
		||||
  IN EFI_DEVICE_PATH            *DevicePath,
 | 
			
		||||
  IN EFI_HANDLE                 Handle,
 | 
			
		||||
  IN EFI_DEVICE_PATH            *RemainingDevicePath
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Function to load an image from a given Device Path for a
 | 
			
		||||
 * specific support (FileSystem, TFTP, PXE, ...)
 | 
			
		||||
 *
 | 
			
		||||
 * @param DevicePath    EFI Device Path of the image to load.
 | 
			
		||||
 *                      This device path generally comes from the boot entry (ie: Boot####).
 | 
			
		||||
 *                      This path is also defined as 'OUT' as there are some device paths that
 | 
			
		||||
 *                      might not be completed such as EFI path for removable device. In these
 | 
			
		||||
 *                      cases, it is expected the loader to add \EFI\BOOT\BOOT(ARM|AA64).EFI
 | 
			
		||||
 * @param Handle        Handle of the driver supporting the device path
 | 
			
		||||
 * @param RemainingDevicePath   Part of the EFI Device Path that has not been resolved during
 | 
			
		||||
 *                      the Device Path discovery
 | 
			
		||||
 * @param Type          Define where the image should be loaded (see EFI_ALLOCATE_TYPE definition)
 | 
			
		||||
 * @param Image         Base Address of the image has been loaded
 | 
			
		||||
 * @param ImageSize     Size of the image that has been loaded
 | 
			
		||||
 */
 | 
			
		||||
typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE) (
 | 
			
		||||
  IN     EFI_DEVICE_PATH        *DevicePath,
 | 
			
		||||
  IN OUT EFI_DEVICE_PATH        **DevicePath,
 | 
			
		||||
  IN     EFI_HANDLE             Handle,
 | 
			
		||||
  IN     EFI_DEVICE_PATH        *RemainingDevicePath,
 | 
			
		||||
  IN     EFI_ALLOCATE_TYPE      Type,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user