]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: UefiBootManagerLib to handle LoadFile DevicePath
authorLiming Gao <liming.gao@intel.com>
Thu, 2 Jul 2015 04:27:54 +0000 (04:27 +0000)
committerlgao4 <lgao4@Edk2>
Thu, 2 Jul 2015 04:27:54 +0000 (04:27 +0000)
UEFI Spec HTTP Boot Device Path, after retrieving the boot resource
information, the BootURI device path node will be updated to include
the BootURI information. It means the device path on the child handle
will be updated after the LoadFile() service is called.

To handle this case, UefiBootManagerLib BmGetLoadOptionBuffer API
is updated as the below:
1) Get Device handle based on Device Path
2) Call LoadFile() service (GetFileBufferByFilePath() API) to get Load File Buffer.
3) Retrieve DevicePath from Device handle

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17798 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c

index 028edc35d53963f9c309b7bd0bdfd291f7d09888..3691c116a9d18b2723be8998817af7aa40967283 100644 (file)
@@ -1501,9 +1501,18 @@ BmGetLoadOptionBuffer (
   // Directly reads the load option when it doesn't reside in simple file system instance (LoadFile/LoadFile2),\r
   //   or it directly points to a file in simple file system instance.\r
   //\r
+  Node   = FilePath;\r
+  Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &Node, &Handle);\r
   FileBuffer = GetFileBufferByFilePath (TRUE, FilePath, FileSize, &AuthenticationStatus);\r
   if (FileBuffer != NULL) {\r
-    *FullPath = DuplicateDevicePath (FilePath);\r
+    if (EFI_ERROR (Status)) {\r
+      *FullPath = DuplicateDevicePath (FilePath);\r
+    } else {\r
+      //\r
+      // LoadFile () may cause the device path of the Handle be updated.\r
+      //\r
+      *FullPath = AppendDevicePath (DevicePathFromHandle (Handle), Node);\r
+    }\r
   }\r
 \r
   return FileBuffer;\r