X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmulatorPkg%2FLibrary%2FPlatformBmLib%2FPlatformBm.c;h=03f6157ae856ce7921555cdda741cf1089f60980;hp=4e3297c984aa0f909b006a390dcc2db986823013;hb=0e92957eaa50be08ebbd8f0fd4e989b380704466;hpb=e01238946cbd16f2dfccd7ec86aebe20d7408586 diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c index 4e3297c984..03f6157ae8 100644 --- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c +++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c @@ -2,13 +2,7 @@ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
Portions copyright (c) 2011, Apple Inc. All rights reserved. -This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -338,6 +332,35 @@ PlatformBdsRegisterStaticBootOptions ( PrintXY (10, 50, &White, &Black, L"Enter to boot directly."); } +/** + Returns the priority number. + + @param BootOption +**/ +UINTN +BootOptionPriority ( + CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ) +{ + // + // Make sure Shell is first + // + if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) { + return 0; + } + return 100; +} + +INTN +EFIAPI +CompareBootOption ( + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Left, + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Right + ) +{ + return BootOptionPriority (Left) - BootOptionPriority (Right); +} + /** Do the platform specific action after the console is connected. @@ -383,6 +406,7 @@ PlatformBootManagerAfterConsole ( PlatformBdsRegisterStaticBootOptions (); PlatformBdsConnectSequence (); EfiBootManagerRefreshAllBootOption (); + EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE)CompareBootOption); break; } }