Sunny, For a short-form URI device path, it's like Uri(...)\End. We cannot get the parent handle from such short-form URI device path. So we have to use EfiBootManagerConnectAll().
Regards, Ray >-----Original Message----- >From: Wang, Sunny (HPS SW) [mailto:[email protected]] >Sent: Friday, February 26, 2016 5:28 PM >To: Ni, Ruiyu <[email protected]>; [email protected] >Cc: Fu, Siyuan <[email protected]>; Wang, Sunny (HPS SW) ><[email protected]>; El-Haj-Mahmoud, Samer ><[email protected]> >Subject: RE: [edk2] [Patch 3/4] MdeModulePkg/Bds: Support short-form URI boot. > >Hi Ray, > For this patch, I just have a question: > - Why do we need to call EfiBootManagerConnectAll in > BmExpandUriDevicePath? It would cause additional and visible >boot time. If we just want to connect URI boot option's parent handle, we can >use EfiBootManagerConnectDevicePath >instead. > >Regards, >Sunny Wang > >-----Original Message----- >From: edk2-devel [mailto:[email protected]] On Behalf Of Ruiyu Ni >Sent: Wednesday, February 24, 2016 3:40 PM >To: [email protected] >Cc: Ruiyu Ni; Siyuan Fu >Subject: [edk2] [Patch 3/4] MdeModulePkg/Bds: Support short-form URI boot. > >The patch adds short-form URI boot support to follow UEFI Spec. > >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Ruiyu Ni <[email protected]> >Cc: Siyuan Fu <[email protected]> >--- > MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 72 ++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > >diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c >b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c >index 35234ba..9ce841e 100644 >--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c >+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c >@@ -1182,6 +1182,72 @@ BmExpandFileDevicePath ( } > > /** >+ Expand URI device path node to be full device path in platform. >+ >+ @param FilePath The device path pointing to a load option. >+ It could be a short-form device path. >+ @param FullPath Return the full device path of the load option after >+ short-form device path expanding. >+ Caller is responsible to free it. >+ @param FileSize Return the load option size. >+ >+ @return The load option buffer. Caller is responsible to free the memory. >+**/ >+VOID * >+BmExpandUriDevicePath ( >+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath, >+ OUT EFI_DEVICE_PATH_PROTOCOL **FullPath, >+ OUT UINTN *FileSize >+ ) >+{ >+ EFI_STATUS Status; >+ UINTN Index; >+ UINTN HandleCount; >+ EFI_HANDLE *Handles; >+ EFI_LOAD_FILE_PROTOCOL *LoadFile; >+ VOID *FileBuffer; >+ >+ EfiBootManagerConnectAll (); >+ Status = gBS->LocateHandleBuffer (ByProtocol, >+ &gEfiLoadFileProtocolGuid, NULL, &HandleCount, &Handles); if (EFI_ERROR >(Status)) { >+ HandleCount = 0; >+ Handles = NULL; >+ } >+ >+ FileBuffer = NULL; >+ >+ for (Index = 0; Index < HandleCount; Index++) { >+ Status = gBS->HandleProtocol (Handles[Index], &gEfiLoadFileProtocolGuid, >(VOID *) &LoadFile); >+ ASSERT_EFI_ERROR (Status); >+ >+ FileBuffer = NULL; >+ Status = LoadFile->LoadFile (LoadFile, FilePath, TRUE, FileSize, >FileBuffer); >+ if (Status == EFI_BUFFER_TOO_SMALL) { >+ FileBuffer = AllocatePool (*FileSize); >+ if (FileBuffer == NULL) { >+ break; >+ } >+ Status = LoadFile->LoadFile (LoadFile, FilePath, TRUE, FileSize, >FileBuffer); >+ } >+ >+ if (!EFI_ERROR (Status)) { >+ *FullPath = DuplicateDevicePath (DevicePathFromHandle (Handles[Index])); >+ break; >+ } >+ >+ if (FileBuffer != NULL) { >+ FreePool (FileBuffer); >+ } >+ } >+ >+ if (Handles != NULL) { >+ FreePool (Handles); >+ } >+ >+ return FileBuffer; >+} >+ >+/** > Save the partition DevicePath to the CachedDevicePath as the first instance. > > @param CachedDevicePath The device path cache. >@@ -1718,6 +1784,12 @@ BmGetLoadOptionBuffer ( > // Expand the File-path device path > // > return BmExpandFileDevicePath (FilePath, FullPath, FileSize); >+ } else if ((DevicePathType (FilePath) == MESSAGING_DEVICE_PATH) && >+ (DevicePathSubType (FilePath) == MSG_URI_DP)) { >+ // >+ // Expand the URI device path >+ // >+ return BmExpandUriDevicePath (FilePath, FullPath, FileSize); > } else { > for (Node = FilePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode > (Node)) { > if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && >-- >2.7.0.windows.1 > >_______________________________________________ >edk2-devel mailing list >[email protected] >https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

