From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web09.5480.1623231490565783009 for ; Wed, 09 Jun 2021 02:38:10 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: zhiguang.liu@intel.com) IronPort-SDR: BI4TvCxhdTuhZLspwcgcN0qhOmvVbltvEtGuAiJrhIm0vRw2pumyXftCga2204Sx+OeiCbAPIn Zjbh4jcrdttQ== X-IronPort-AV: E=McAfee;i="6200,9189,10009"; a="290669774" X-IronPort-AV: E=Sophos;i="5.83,260,1616482800"; d="scan'208";a="290669774" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2021 02:38:09 -0700 IronPort-SDR: 5GfSzQBUVc+hjFkz29fy6ZI9hOoAyk8luiwAsrFLqNsYaSa7xmYIQ/fLAtKZ+4AOCKqHSNarLz thw7FvXT+8/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,260,1616482800"; d="scan'208";a="449886271" Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 09 Jun 2021 02:38:07 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Zhichao Gao , Ray Ni Subject: [PATCH] MdeModulePkg: Fix device path when the boot manager menu is from different FV Date: Wed, 9 Jun 2021 17:37:08 +0800 Message-Id: <20210609093708.2450-1-zhiguang.liu@intel.com> X-Mailer: git-send-email 2.30.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3441 When the boot manager menu is from different FV, the current logic still us= e the device path of the FV as the module links to this library Cc: Jian J Wang Cc: Hao A Wu Cc: Zhichao Gao Cc: Ray Ni Signed-off-by: Zhiguang Liu --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 28 +++-----------------= -------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePk= g/Library/UefiBootManagerLib/BmBoot.c index bef41ae102..95d185b639 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2405,13 +2405,9 @@ BmRegisterBootManagerMenu ( CHAR16 *Description;=0D UINTN DescriptionLength;=0D EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D - EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;=0D - MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;=0D UINTN HandleCount;=0D EFI_HANDLE *Handles;=0D UINTN Index;=0D - VOID *Data;=0D - UINTN DataSize;=0D =0D DevicePath =3D NULL;=0D Description =3D NULL;=0D @@ -2437,22 +2433,17 @@ BmRegisterBootManagerMenu ( }=0D =0D if (DevicePath =3D=3D NULL) {=0D - Data =3D NULL;=0D - Status =3D GetSectionFromAnyFv (=0D + Status =3D GetFileDevicePathFromAnyFv (=0D PcdGetPtr (PcdBootManagerMenuFile),=0D EFI_SECTION_PE32,=0D 0,=0D - (VOID **) &Data,=0D - &DataSize=0D + &DevicePath=0D );=0D - if (Data !=3D NULL) {=0D - FreePool (Data);=0D - }=0D if (EFI_ERROR (Status)) {=0D DEBUG ((EFI_D_WARN, "[Bds]BootManagerMenu FFS section can not be fou= nd, skip its boot option registration\n"));=0D return EFI_NOT_FOUND;=0D }=0D -=0D + ASSERT (DevicePath !=3D NULL);=0D //=0D // Get BootManagerMenu application's description from EFI User Interfa= ce Section.=0D //=0D @@ -2466,19 +2457,6 @@ BmRegisterBootManagerMenu ( if (EFI_ERROR (Status)) {=0D Description =3D NULL;=0D }=0D -=0D - EfiInitializeFwVolDevicepathNode (&FileNode, PcdGetPtr (PcdBootManager= MenuFile));=0D - Status =3D gBS->HandleProtocol (=0D - gImageHandle,=0D - &gEfiLoadedImageProtocolGuid,=0D - (VOID **) &LoadedImage=0D - );=0D - ASSERT_EFI_ERROR (Status);=0D - DevicePath =3D AppendDevicePathNode (=0D - DevicePathFromHandle (LoadedImage->DeviceHandle),=0D - (EFI_DEVICE_PATH_PROTOCOL *) &FileNode=0D - );=0D - ASSERT (DevicePath !=3D NULL);=0D }=0D =0D Status =3D EfiBootManagerInitializeLoadOption (=0D --=20 2.30.0.windows.2