From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A5BB21A1DF2 for ; Thu, 25 Aug 2016 21:25:06 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 25 Aug 2016 21:25:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,579,1464678000"; d="scan'208";a="161140656" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 25 Aug 2016 21:25:06 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 25 Aug 2016 21:25:06 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 25 Aug 2016 21:25:05 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.107]) with mapi id 14.03.0248.002; Fri, 26 Aug 2016 12:25:03 +0800 From: "Ni, Ruiyu" To: "Dong, Eric" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] Nt32Pkg PlatformBootManagerLib: Enable BootManagerMenuApp. Thread-Index: AQHR/eCbhBBH/oIPMU2GQe7RWyjTqKBap9kg Date: Fri, 26 Aug 2016 04:25:03 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D1ADC30E2@SHSMSX103.ccr.corp.intel.com> References: <1472026910-64440-1-git-send-email-eric.dong@intel.com> In-Reply-To: <1472026910-64440-1-git-send-email-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDc5MTkwNTQtMTg5MC00ZDg5LWEyMGMtYjhmMTA2YjYyOTg0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Iis4K0RvV0taa1ljYzJVXC9WVWdnUzd6SzJxZG1NbkMwNmx5Qm02eUw1TTF3PSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] Nt32Pkg PlatformBootManagerLib: Enable BootManagerMenuApp. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 04:25:06 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni >-----Original Message----- >From: Dong, Eric >Sent: Wednesday, August 24, 2016 4:22 PM >To: edk2-devel@lists.01.org >Cc: Ni, Ruiyu >Subject: [Patch] Nt32Pkg PlatformBootManagerLib: Enable BootManagerMenuApp= . > >Enable BootManagerMenuApp application for Nt32 platform. >Also enable F7 hotkey to select this boot option. > >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Eric Dong >Cc: Ruiyu Ni >--- > .../PlatformBootManagerLib/PlatformBootManager.c | 169 ++++++++++++++++= ++++- > .../PlatformBootManagerLib/PlatformBootManager.h | 1 + > .../PlatformBootManagerLib.inf | 1 + > Nt32Pkg/Nt32Pkg.dsc | 4 + > Nt32Pkg/Nt32Pkg.fdf | 1 + > 5 files changed, 173 insertions(+), 3 deletions(-) > >diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c >b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c >index 4b23eb1..e75b849 100644 >--- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c >+++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c >@@ -15,6 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITH= ER EXPRESS OR IMPLIED. > > #include "PlatformBootManager.h" > >+EFI_GUID mBootMenuFile =3D { >+ 0xEEC25BDC, 0x67F2, 0x4D95, { 0xB1, 0xD5, 0xF8, 0x1B, 0x20, 0x39, 0xD1,= 0x1D } >+}; >+ > /** > Perform the platform diagnostic, such like test memory. OEM/IBV also > can customize this function to support specific platform diagnostic. >@@ -144,6 +148,154 @@ CompareBootOption ( > } > > /** >+ Generate device path include the input file guid info. >+ >+ @param FileGuid Input file guid for the BootManagerMenuApp. >+ >+ @retval DevicePath for BootManagerMenuApp. >+**/ >+EFI_DEVICE_PATH * >+FvFilePath ( >+ EFI_GUID *FileGuid >+ ) >+{ >+ >+ EFI_STATUS Status; >+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; >+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode; >+ >+ EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid); >+ >+ Status =3D gBS->HandleProtocol ( >+ gImageHandle, >+ &gEfiLoadedImageProtocolGuid, >+ (VOID **) &LoadedImage >+ ); >+ ASSERT_EFI_ERROR (Status); >+ >+ return AppendDevicePathNode ( >+ DevicePathFromHandle (LoadedImage->DeviceHandle), >+ (EFI_DEVICE_PATH_PROTOCOL *) &FileNode >+ ); >+} >+ >+/** >+ Create one boot option for BootManagerMenuApp. >+ >+ @param FileGuid Input file guid for the BootManagerMenuApp. >+ @param Description Description of the BootManagerMenuApp boot op= tion. >+ @param Position Position of the new load option to put in the= ****Order variable. >+ @param IsBootCategory Whether this is a boot category. >+ >+ >+ @retval OptionNumber Return the option number info. >+ >+**/ >+UINTN >+RegisterBootManagerMenuAppBootOption ( >+ EFI_GUID *FileGuid, >+ CHAR16 *Description, >+ UINTN Position, >+ BOOLEAN IsBootCategory >+ ) >+{ >+ EFI_STATUS Status; >+ EFI_BOOT_MANAGER_LOAD_OPTION NewOption; >+ EFI_DEVICE_PATH_PROTOCOL *DevicePath; >+ UINTN OptionNumber; >+ >+ DevicePath =3D FvFilePath (FileGuid); >+ Status =3D EfiBootManagerInitializeLoadOption ( >+ &NewOption, >+ LoadOptionNumberUnassigned, >+ LoadOptionTypeBoot, >+ IsBootCategory ? LOAD_OPTION_ACTIVE : LOAD_OPTION_CATEGORY_A= PP, >+ Description, >+ DevicePath, >+ NULL, >+ 0 >+ ); >+ ASSERT_EFI_ERROR (Status); >+ FreePool (DevicePath); >+ >+ Status =3D EfiBootManagerAddLoadOptionVariable (&NewOption, Position); >+ ASSERT_EFI_ERROR (Status); >+ >+ OptionNumber =3D NewOption.OptionNumber; >+ >+ EfiBootManagerFreeLoadOption (&NewOption); >+ >+ return OptionNumber; >+} >+ >+/** >+ Check if it's a Device Path pointing to BootManagerMenuApp. >+ >+ @param DevicePath Input device path. >+ >+ @retval TRUE The device path is BootManagerMenuApp File Device Path. >+ @retval FALSE The device path is NOT BootManagerMenuApp File Device Pa= th. >+**/ >+BOOLEAN >+IsBootManagerMenuAppFilePath ( >+ EFI_DEVICE_PATH_PROTOCOL *DevicePath >+) >+{ >+ EFI_HANDLE FvHandle; >+ VOID *NameGuid; >+ EFI_STATUS Status; >+ >+ Status =3D gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &De= vicePath, &FvHandle); >+ if (!EFI_ERROR (Status)) { >+ NameGuid =3D EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_V= OL_FILEPATH_DEVICE_PATH *) >DevicePath); >+ if (NameGuid !=3D NULL) { >+ return CompareGuid (NameGuid, &mBootMenuFile); >+ } >+ } >+ >+ return FALSE; >+} >+ >+/** >+ Return the boot option number to the BootManagerMenuApp. >+ >+ If not found it in the current boot option, create a new one. >+ >+ @retval OptionNumber Return the boot option number to the BootManager= MenuApp. >+ >+**/ >+UINTN >+GetBootManagerMenuAppOption ( >+ VOID >+ ) >+{ >+ UINTN BootOptionCount; >+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; >+ UINTN Index; >+ UINTN OptionNumber; >+ >+ BootOptions =3D EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOpt= ionTypeBoot); >+ >+ for (Index =3D 0; Index < BootOptionCount; Index++) { >+ if (IsBootManagerMenuAppFilePath (BootOptions[Index].FilePath)) { >+ OptionNumber =3D BootOptions[Index].OptionNumber; >+ break; >+ } >+ } >+ >+ EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); >+ >+ if (Index >=3D BootOptionCount) { >+ // >+ // If not found the BootManagerMenuApp, create it. >+ // >+ OptionNumber =3D (UINT16) RegisterBootManagerMenuAppBootOption (&mBoo= tMenuFile, L"UEFI >BootManagerMenuApp", (UINTN) -1, FALSE); >+ } >+ >+ return OptionNumber; >+} >+ >+/** > Do the platform specific action after the console is connected. > > Such as: >@@ -163,7 +315,9 @@ PlatformBootManagerAfterConsole ( > EFI_GRAPHICS_OUTPUT_BLT_PIXEL White; > EFI_INPUT_KEY Enter; > EFI_INPUT_KEY F2; >+ EFI_INPUT_KEY F7; > EFI_BOOT_MANAGER_LOAD_OPTION BootOption; >+ UINTN OptionNumber; > > Black.Blue =3D Black.Green =3D Black.Red =3D Black.Reserved =3D 0; > White.Blue =3D White.Green =3D White.Red =3D White.Reserved =3D 0xFF; >@@ -186,14 +340,23 @@ PlatformBootManagerAfterConsole ( > EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNum= ber, 0, &F2, NULL); > > // >+ // 3. Boot Device List menu >+ // >+ F7.ScanCode =3D SCAN_F7; >+ F7.UnicodeChar =3D CHAR_NULL; >+ OptionNumber =3D GetBootManagerMenuAppOption (); >+ EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)OptionNumber, 0, &F7,= NULL); >+ >+ // > // Make Shell as the first boot option > // > EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE= ) CompareBootOption); > > PlatformBootManagerDiagnostics (QUICK, TRUE); >- >- PrintXY (10, 10, &White, &Black, L"F2 to enter Boot Manager Menu. >"); >- PrintXY (10, 30, &White, &Black, L"Enter to boot directly."); >+ >+ PrintXY (10, 10, &White, &Black, L"F2 to enter Setup. = "); >+ PrintXY (10, 30, &White, &Black, L"F7 to enter Boot Manager Menu."); >+ PrintXY (10, 50, &White, &Black, L"Enter to boot directly."); > } > > /** >diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.h >b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.h >index e2c6681..e014932 100644 >--- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.h >+++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.h >@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHE= R EXPRESS OR IMPLIED. > #include > #include > #include >+#include > > #include > #include >diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib= .inf >b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf >index 71e8738..c552f97 100644 >--- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf >+++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf >@@ -62,6 +62,7 @@ > gEfiGraphicsOutputProtocolGuid ## CONSUMES > gEfiUgaDrawProtocolGuid ## CONSUMES > gEfiBootLogoProtocolGuid ## CONSUMES >+ gEfiFirmwareVolume2ProtocolGuid ## CONSUMES > > [Pcd] > gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut >diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc >index e3f9326..408cc51 100644 >--- a/Nt32Pkg/Nt32Pkg.dsc >+++ b/Nt32Pkg/Nt32Pkg.dsc >@@ -470,6 +470,10 @@ > > MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.in= f > MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf >+ MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf { >+ >+ NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBoo= tManagerLib.inf >+ } > > #########################################################################= ########################## > # >diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf >index 39046ec..bd9eeca 100644 >--- a/Nt32Pkg/Nt32Pkg.fdf >+++ b/Nt32Pkg/Nt32Pkg.fdf >@@ -262,6 +262,7 @@ INF NetworkPkg/HttpBootDxe/HttpBootDxe.inf > INF NetworkPkg/DnsDxe/DnsDxe.inf > INF NetworkPkg/HttpDxe/HttpDxe.inf > INF NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf >+INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf > #########################################################################= ####### > # > # FILE statements are provided so that a platform integrator can include >-- >2.6.4.windows.1