From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: zhichao.gao@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Wed, 17 Jul 2019 00:56:32 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 00:56:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,273,1559545200"; d="scan'208";a="187509130" Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 17 Jul 2019 00:56:27 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Ray Ni , Star Zeng , Liming gao , Sean Brogan , Michael Turner , Bret Barkelew Subject: [PATCH 4/4] MdeModulePkg: PcdBootManagerInBootOrder should only affect BootOrder Date: Wed, 17 Jul 2019 15:50:08 +0800 Message-Id: <20190717075008.22716-5-zhichao.gao@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190717075008.22716-1-zhichao.gao@intel.com> References: <20190717075008.22716-1-zhichao.gao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1979 The PcdBootManagerInBootOrder should only control whether BootManager is in BootOrder. It shouldn't affect the Hotkey service with BootManager. Acctually, setting this pcd hides the boot option from BootOrder. But it didn't disable the boot option. Cc: Jian J Wang Cc: Hao A Wu Cc: Ray Ni Cc: Star Zeng Cc: Liming gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 611acb91e2..8bdac924b4 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2322,8 +2322,6 @@ EfiBootManagerRefreshAllBootOption ( @retval EFI_SUCCESS Successfully register the Boot Manager Menu. @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found. - @retval EFI_UNSUPPORTED The Boot Manager Menu isn't register to Boot Order because of - PcdBootManagerInBootOrder. @retval others Return status of gRT->SetVariable (). BootOption still points to the Boot Manager Menu even the Status is not EFI_SUCCESS and EFI_NOT_FOUND. @@ -2344,6 +2342,7 @@ BmRegisterBootManagerMenu ( UINTN Index; VOID *Data; UINTN DataSize; + UINT16 OptionNumber; DevicePath = NULL; Description = NULL; @@ -2441,7 +2440,17 @@ BmRegisterBootManagerMenu ( if (PcdGetBool (PcdBootManagerInBootOrder)) { Status = EfiBootManagerAddLoadOptionVariable (BootOption, 0); } else { - Status = EFI_UNSUPPORTED; + // + // Get the free option number if the option number is unassigned + // + if (BootOption->OptionNumber == LoadOptionNumberUnassigned) { + Status = BmGetFreeOptionNumber (BootOption->OptionType, &OptionNumber); + if (EFI_ERROR (Status)) { + return Status; + } + BootOption->OptionNumber = OptionNumber; + } + Status = EfiBootManagerLoadOptionToVariable (BootOption); } return Status; -- 2.21.0.windows.1