]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/BdsLib: Added support to change the given DevicePath of a Boot Entry
authorOlivier Martin <olivier.martin@arm.com>
Wed, 25 Feb 2015 19:04:59 +0000 (19:04 +0000)
committeroliviermartin <oliviermartin@Edk2>
Wed, 25 Feb 2015 19:04:59 +0000 (19:04 +0000)
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

ArmPkg/Library/BdsLib/BdsFilePath.c
ArmPkg/Library/BdsLib/BdsInternal.h

index 924c61ed34f7b19a4050f8bc4911ad28d2da776b..a0a949d0147a37d4765aa86780d95c620fb104d7 100644 (file)
@@ -467,7 +467,7 @@ BdsFileSystemSupport (
 \r
 EFI_STATUS\r
 BdsFileSystemLoadImage (\r
-  IN     EFI_DEVICE_PATH       *DevicePath,\r
+  IN OUT EFI_DEVICE_PATH       **DevicePath,\r
   IN     EFI_HANDLE            Handle,\r
   IN     EFI_DEVICE_PATH       *RemainingDevicePath,\r
   IN     EFI_ALLOCATE_TYPE     Type,\r
@@ -560,9 +560,9 @@ BdsMemoryMapSupport (
 \r
 EFI_STATUS\r
 BdsMemoryMapLoadImage (\r
-  IN     EFI_DEVICE_PATH *DevicePath,\r
-  IN     EFI_HANDLE Handle,\r
-  IN     EFI_DEVICE_PATH *RemainingDevicePath,\r
+  IN OUT EFI_DEVICE_PATH       **DevicePath,\r
+  IN     EFI_HANDLE            Handle,\r
+  IN     EFI_DEVICE_PATH       *RemainingDevicePath,\r
   IN     EFI_ALLOCATE_TYPE     Type,\r
   IN OUT EFI_PHYSICAL_ADDRESS* Image,\r
   OUT    UINTN                 *ImageSize\r
@@ -575,8 +575,8 @@ BdsMemoryMapLoadImage (
   if (IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP)) {\r
     MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)RemainingDevicePath;\r
   } else {\r
-    ASSERT (IS_DEVICE_PATH_NODE (DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP));\r
-    MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)DevicePath;\r
+    ASSERT (IS_DEVICE_PATH_NODE (*DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP));\r
+    MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)*DevicePath;\r
   }\r
 \r
   Size = MemMapPathDevicePath->EndingAddress - MemMapPathDevicePath->StartingAddress;\r
@@ -612,9 +612,9 @@ BdsFirmwareVolumeSupport (
 \r
 EFI_STATUS\r
 BdsFirmwareVolumeLoadImage (\r
-  IN     EFI_DEVICE_PATH *DevicePath,\r
-  IN     EFI_HANDLE Handle,\r
-  IN     EFI_DEVICE_PATH *RemainingDevicePath,\r
+  IN OUT EFI_DEVICE_PATH       **DevicePath,\r
+  IN     EFI_HANDLE            Handle,\r
+  IN     EFI_DEVICE_PATH       *RemainingDevicePath,\r
   IN     EFI_ALLOCATE_TYPE     Type,\r
   IN OUT EFI_PHYSICAL_ADDRESS* Image,\r
   OUT    UINTN                 *ImageSize\r
@@ -733,12 +733,12 @@ BdsPxeSupport (
 \r
 EFI_STATUS\r
 BdsPxeLoadImage (\r
-  IN     EFI_DEVICE_PATH*       DevicePath,\r
-  IN     EFI_HANDLE             Handle,\r
-  IN     EFI_DEVICE_PATH*       RemainingDevicePath,\r
-  IN     EFI_ALLOCATE_TYPE      Type,\r
-  IN OUT EFI_PHYSICAL_ADDRESS   *Image,\r
-  OUT    UINTN                  *ImageSize\r
+  IN OUT EFI_DEVICE_PATH       **DevicePath,\r
+  IN     EFI_HANDLE            Handle,\r
+  IN     EFI_DEVICE_PATH       *RemainingDevicePath,\r
+  IN     EFI_ALLOCATE_TYPE     Type,\r
+  IN OUT EFI_PHYSICAL_ADDRESSImage,\r
+  OUT    UINTN                 *ImageSize\r
   )\r
 {\r
   EFI_STATUS              Status;\r
@@ -752,14 +752,14 @@ BdsPxeLoadImage (
     return Status;\r
   }\r
 \r
-  Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, NULL);\r
+  Status = LoadFileProtocol->LoadFile (LoadFileProtocol, *DevicePath, TRUE, &BufferSize, NULL);\r
   if (Status == EFI_BUFFER_TOO_SMALL) {\r
     Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(BufferSize), Image);\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
 \r
-    Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, (VOID*)(UINTN)(*Image));\r
+    Status = LoadFileProtocol->LoadFile (LoadFileProtocol, *DevicePath, TRUE, &BufferSize, (VOID*)(UINTN)(*Image));\r
     if (!EFI_ERROR (Status) && (ImageSize != NULL)) {\r
       *ImageSize = BufferSize;\r
     }\r
@@ -1018,12 +1018,12 @@ Mtftp4CheckPacket (
 **/\r
 EFI_STATUS\r
 BdsTftpLoadImage (\r
-  IN     EFI_DEVICE_PATH*       DevicePath,\r
-  IN     EFI_HANDLE             ControllerHandle,\r
-  IN     EFI_DEVICE_PATH*       RemainingDevicePath,\r
-  IN     EFI_ALLOCATE_TYPE      Type,\r
-  IN OUT EFI_PHYSICAL_ADDRESS   *Image,\r
-  OUT    UINTN                  *ImageSize\r
+  IN OUT EFI_DEVICE_PATH       **DevicePath,\r
+  IN     EFI_HANDLE            ControllerHandle,\r
+  IN     EFI_DEVICE_PATH       *RemainingDevicePath,\r
+  IN     EFI_ALLOCATE_TYPE     Type,\r
+  IN OUT EFI_PHYSICAL_ADDRESS  *Image,\r
+  OUT    UINTN                 *ImageSize\r
   )\r
 {\r
   EFI_STATUS               Status;\r
@@ -1340,7 +1340,7 @@ BdsLoadImageAndUpdateDevicePath (
   FileLoader = FileLoaders;\r
   while (FileLoader->Support != NULL) {\r
     if (FileLoader->Support (*DevicePath, Handle, RemainingDevicePath)) {\r
-      return FileLoader->LoadImage (*DevicePath, Handle, RemainingDevicePath, Type, Image, FileSize);\r
+      return FileLoader->LoadImage (DevicePath, Handle, RemainingDevicePath, Type, Image, FileSize);\r
     }\r
     FileLoader++;\r
   }\r
index 602fd8dcf34c4ee5de1c2b4eff7aa1bd126aa10a..a29d8ccd8b12f8f435f6a11eda18b4848a548a92 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
 \r
 #include <Uefi.h>\r
 \r
+/**\r
+ * Check if the file loader can support this device path.\r
+ *\r
+ * @param DevicePath    EFI Device Path of the image to load.\r
+ *                      This device path generally comes from the boot entry (ie: Boot####).\r
+ * @param Handle        Handle of the driver supporting the device path\r
+ * @param RemainingDevicePath   Part of the EFI Device Path that has not been resolved during\r
+ *                      the Device Path discovery\r
+ */\r
 typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT) (\r
   IN EFI_DEVICE_PATH            *DevicePath,\r
   IN EFI_HANDLE                 Handle,\r
   IN EFI_DEVICE_PATH            *RemainingDevicePath\r
   );\r
 \r
+/**\r
+ * Function to load an image from a given Device Path for a\r
+ * specific support (FileSystem, TFTP, PXE, ...)\r
+ *\r
+ * @param DevicePath    EFI Device Path of the image to load.\r
+ *                      This device path generally comes from the boot entry (ie: Boot####).\r
+ *                      This path is also defined as 'OUT' as there are some device paths that\r
+ *                      might not be completed such as EFI path for removable device. In these\r
+ *                      cases, it is expected the loader to add \EFI\BOOT\BOOT(ARM|AA64).EFI\r
+ * @param Handle        Handle of the driver supporting the device path\r
+ * @param RemainingDevicePath   Part of the EFI Device Path that has not been resolved during\r
+ *                      the Device Path discovery\r
+ * @param Type          Define where the image should be loaded (see EFI_ALLOCATE_TYPE definition)\r
+ * @param Image         Base Address of the image has been loaded\r
+ * @param ImageSize     Size of the image that has been loaded\r
+ */\r
 typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE) (\r
-  IN     EFI_DEVICE_PATH        *DevicePath,\r
+  IN OUT EFI_DEVICE_PATH        **DevicePath,\r
   IN     EFI_HANDLE             Handle,\r
   IN     EFI_DEVICE_PATH        *RemainingDevicePath,\r
   IN     EFI_ALLOCATE_TYPE      Type,\r