return NULL;\r
}\r
\r
+/**\r
+ Expand URI device path node to be full device path in platform.\r
+\r
+ @param FilePath The device path pointing to a load option.\r
+ It could be a short-form device path.\r
+ @param FullPath Return the full device path of the load option after\r
+ short-form device path expanding.\r
+ Caller is responsible to free it.\r
+ @param FileSize Return the load option size.\r
+\r
+ @return The load option buffer. Caller is responsible to free the memory.\r
+**/\r
+VOID *\r
+BmExpandUriDevicePath (\r
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
+ OUT EFI_DEVICE_PATH_PROTOCOL **FullPath,\r
+ OUT UINTN *FileSize\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ UINTN HandleCount;\r
+ EFI_HANDLE *Handles;\r
+ EFI_LOAD_FILE_PROTOCOL *LoadFile;\r
+ VOID *FileBuffer;\r
+\r
+ EfiBootManagerConnectAll ();\r
+ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiLoadFileProtocolGuid, NULL, &HandleCount, &Handles);\r
+ if (EFI_ERROR (Status)) {\r
+ HandleCount = 0;\r
+ Handles = NULL;\r
+ }\r
+\r
+ FileBuffer = NULL;\r
+\r
+ for (Index = 0; Index < HandleCount; Index++) {\r
+ Status = gBS->HandleProtocol (Handles[Index], &gEfiLoadFileProtocolGuid, (VOID *) &LoadFile);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ FileBuffer = NULL;\r
+ Status = LoadFile->LoadFile (LoadFile, FilePath, TRUE, FileSize, FileBuffer);\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ FileBuffer = AllocatePool (*FileSize);\r
+ if (FileBuffer == NULL) {\r
+ break;\r
+ }\r
+ Status = LoadFile->LoadFile (LoadFile, FilePath, TRUE, FileSize, FileBuffer);\r
+ }\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ *FullPath = DuplicateDevicePath (DevicePathFromHandle (Handles[Index]));\r
+ break;\r
+ }\r
+\r
+ if (FileBuffer != NULL) {\r
+ FreePool (FileBuffer);\r
+ }\r
+ }\r
+\r
+ if (Handles != NULL) {\r
+ FreePool (Handles);\r
+ }\r
+\r
+ return FileBuffer;\r
+}\r
+\r
/**\r
Save the partition DevicePath to the CachedDevicePath as the first instance.\r
\r
// Expand the File-path device path\r
//\r
return BmExpandFileDevicePath (FilePath, FullPath, FileSize);\r
+ } else if ((DevicePathType (FilePath) == MESSAGING_DEVICE_PATH) &&\r
+ (DevicePathSubType (FilePath) == MSG_URI_DP)) {\r
+ //\r
+ // Expand the URI device path\r
+ //\r
+ return BmExpandUriDevicePath (FilePath, FullPath, FileSize);\r
} else {\r
for (Node = FilePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) {\r
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) &&\r