[edk2-devel] [PATCH edk2-platforms 3/4] Vlv2TbltDevicePkg: Only sort boot options when necessary

Gary Lin posted 4 patches 6 years, 6 months ago
[edk2-devel] [PATCH edk2-platforms 3/4] Vlv2TbltDevicePkg: Only sort boot options when necessary
Posted by Gary Lin 6 years, 6 months ago
* PlatformBootManagerAfterConsole() always sorted the boot options at
  the end, and this would invalidate the BootOrder created by the user.
  Besides, the current implementation would sort the boot options twice,
  and this is not efficient. We should just sort the boot options once
  at the end of the function only for the very first boot.

* Update the string in IsNeedSortBootOption() to match the descriptions
  of BootManagerMenuApp.

Cc: Zailiang Sun <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
 Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/BdsPlatform.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/BdsPlatform.c b/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/BdsPlatform.c
index 7fbbf281c6..a5423013a5 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/BdsPlatform.c
+++ b/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/BdsPlatform.c
@@ -1299,7 +1299,7 @@ IsNeedSortBootOption (
   //

   if ((BootOptionCount > 1) &&

       (((StrnCmp (BootOptions->Description, L"Enter Setup", StrLen (L"Enter Setup"))) == 0) ||

-       ((StrnCmp (BootOptions->Description, L"BootManagerMenuApp", StrLen (L"BootManagerMenuApp"))) == 0))) {

+       ((StrnCmp (BootOptions->Description, L"Boot Device List", StrLen (L"Boot Device List"))) == 0))) {

     return TRUE;

   }

 

@@ -1374,9 +1374,6 @@ PlatformBootManagerAfterConsole (
     //

     EfiBootManagerRefreshAllBootOption ();

 

-    if (IsNeedSortBootOption()) {

-      EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, CompareBootOption);

-    }

     //

     // PXE boot option may appear after boot option enumeration

     //

@@ -1400,7 +1397,9 @@ PlatformBootManagerAfterConsole (
   Print (L"Press F7 for BootMenu!\n");

 

   EfiBootManagerRefreshAllBootOption ();

-  EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, CompareBootOption);

+  if (IsNeedSortBootOption()) {

+    EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, CompareBootOption);

+  }

 }

 

 /**

-- 
2.22.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44443): https://edk2.groups.io/g/devel/message/44443
Mute This Topic: https://groups.io/mt/32606868/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-