Ray:
  Thanks for your comments. I agree to drop this change to keep the same 
behavior of EfiBootManagerFindLoadOption().

Thanks
Liming
From: Ni, Ruiyu
Sent: Tuesday, July 26, 2016 11:02 AM
To: Gao, Liming <liming....@intel.com>; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch 4/8] MdeModulePkg UefiBootManagerLib: Enhance 
EfiBootManagerFindLoadOption

Liming,
Can you modify the patch to avoid changing the behavior of 
EfiBootManagerFindLoadOption()?

Thanks/Ray

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Liming Gao
> Sent: Monday, July 25, 2016 10:00 PM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Ni, Ruiyu
> Subject: [edk2] [Patch 4/8] MdeModulePkg UefiBootManagerLib: Enhance
> EfiBootManagerFindLoadOption
>
> The same boot file may have two different device paths. One is its FV File
> device path, another is LoadFile FV device path. These two paths includes the
> same NameGuid. So, EfiBootManagerFindLoadOption() is updated to
> compare their NameGuid.
>
> Cc: Ruiyu Ni
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao
> ---
> .../Library/UefiBootManagerLib/BmLoadOption.c | 44
> ++++++++++++++++++++--
> 1 file changed, 41 insertions(+), 3 deletions(-)
>
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
> index 9af98de..f9650ff 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
> @@ -506,6 +506,29 @@ EfiBootManagerInitializeLoadOption (
> return EFI_SUCCESS;
> }
>
> +/**
> + Find NameGuid from the input device path.
> +
> + @param DevicePath Input device path.
> +
> + @retval NULL NameGuid can't be found in the input device path.
> + @retval NameGuid Pointer to NameGuid found in the input device path.
> +**/
> +EFI_GUID *
> +BmFileNameGuidFromFilePath (
> + EFI_DEVICE_PATH_PROTOCOL *DevicePath
> +)
> +{
> + EFI_HANDLE FvHandle;
> + EFI_STATUS Status;
> +
> + Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid,
> + &DevicePath, &FvHandle); if (!EFI_ERROR (Status)) {
> + return EfiGetNameGuidFromFwVolDevicePathNode ((CONST
> + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath); }
> +
> + return NULL;
> +}
>
> /**
> Return the index of the load option in the load option array.
> @@ -529,15 +552,30 @@ EfiBootManagerFindLoadOption (
> )
> {
> UINTN Index;
> + EFI_GUID *KeyNameGuid;
> + EFI_GUID *NameGuid;
> +
> + KeyNameGuid = NULL;
> + if (Key->OptionType == LoadOptionTypeBoot) {
> + KeyNameGuid = BmFileNameGuidFromFilePath (Key->FilePath); }
>
> for (Index = 0; Index < Count; Index++) {
> - if ((Key->OptionType == Array[Index].OptionType) &&
> - (Key->Attributes == Array[Index].Attributes) &&
> + if (Key->OptionType == Array[Index].OptionType) {
> + if ((Key->Attributes == Array[Index].Attributes) &&
> (StrCmp (Key->Description, Array[Index].Description) == 0) &&
> (CompareMem (Key->FilePath, Array[Index].FilePath,
> GetDevicePathSize (Key->FilePath)) == 0) &&
> (Key->OptionalDataSize == Array[Index].OptionalDataSize) &&
> (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key-
> >OptionalDataSize) == 0)) {
> - return (INTN) Index;
> + return (INTN) Index;
> + }
> +
> + if (KeyNameGuid != NULL) {
> + NameGuid = BmFileNameGuidFromFilePath (Array[Index].FilePath);
> + if ((NameGuid != NULL) && CompareGuid (KeyNameGuid, NameGuid))
> {
> + return (INTN) Index;
> + }
> + }
> }
> }
>
> --
> 2.8.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to