X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkModulePkg%2FUniversal%2FBdsDxe%2FBootMngr%2FBootManager.c;h=f86d55594b90437f63cd85304fb03aea9f776c27;hb=847240774030f9da79140a9d515a64ec817eb6eb;hp=01ff5f88adc07d62b5eef7344df5e19dffc43cf1;hpb=180a5a35cb49699bd249dee19e41cee34c856a58;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c index 01ff5f88ad..f86d55594b 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c @@ -1,7 +1,7 @@ /** @file The platform boot manager reference implementation -Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2011, Intel Corporation. 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 @@ -15,9 +15,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "BootManager.h" UINT16 mKeyInput; -EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID; -LIST_ENTRY *mBootOptionsList; +LIST_ENTRY mBootOptionsList; BDS_COMMON_OPTION *gOption; +CHAR16 *mDeviceTypeStr[] = { + L"Legacy BEV", + L"Legacy Floppy", + L"Legacy Hard Drive", + L"Legacy CD ROM", + L"Legacy PCMCIA", + L"Legacy USB", + L"Legacy Embedded Network", + L"Legacy Unknown Device" +}; + HII_VENDOR_DEVICE_PATH mBootManagerHiiVendorDevicePath = { { @@ -29,10 +39,7 @@ HII_VENDOR_DEVICE_PATH mBootManagerHiiVendorDevicePath = { (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) } }, - // - // {1DDDBE15-481D-4d2b-8277-B191EAF66525} - // - { 0x1dddbe15, 0x481d, 0x4d2b, { 0x82, 0x77, 0xb1, 0x91, 0xea, 0xf6, 0x65, 0x25 } } + BOOT_MANAGER_FORMSET_GUID }, { END_DEVICE_PATH_TYPE, @@ -88,40 +95,47 @@ BootManagerCallback ( LIST_ENTRY *Link; UINT16 KeyCount; - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; - } - - // - // Initialize the key count - // - KeyCount = 0; + if (Action == EFI_BROWSER_ACTION_CHANGED) { + if ((Value == NULL) || (ActionRequest == NULL)) { + return EFI_INVALID_PARAMETER; + } - for (Link = mBootOptionsList->ForwardLink; Link != mBootOptionsList; Link = Link->ForwardLink) { - Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE); + // + // Initialize the key count + // + KeyCount = 0; - KeyCount++; + for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) { + Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE); - gOption = Option; + KeyCount++; - // - // Is this device the one chosen? - // - if (KeyCount == QuestionId) { - // - // Assigning the returned Key to a global allows the original routine to know what was chosen - // - mKeyInput = QuestionId; + gOption = Option; // - // Request to exit SendForm(), so that we could boot the selected option + // Is this device the one chosen? // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - break; + if (KeyCount == QuestionId) { + // + // Assigning the returned Key to a global allows the original routine to know what was chosen + // + mKeyInput = QuestionId; + + // + // Request to exit SendForm(), so that we could boot the selected option + // + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + break; + } } + + return EFI_SUCCESS; } - return EFI_SUCCESS; + // + // All other action return unsupported. + // + return EFI_UNSUPPORTED; } /** @@ -157,7 +171,7 @@ InitializeBootManager ( // Publish our HII data // gBootManagerPrivate.HiiHandle = HiiAddPackages ( - &mBootManagerGuid, + &gBootManagerFormSetGuid, gBootManagerPrivate.DriverHandle, BootManagerVfrBin, BdsDxeStrings, @@ -190,7 +204,6 @@ CallBootManager ( UINTN ExitDataSize; EFI_STRING_ID Token; EFI_INPUT_KEY Key; - LIST_ENTRY BdsBootOptionList; CHAR16 *HelpString; EFI_STRING_ID HelpToken; UINT16 *TempStr; @@ -201,9 +214,13 @@ CallBootManager ( VOID *EndOpCodeHandle; EFI_IFR_GUID_LABEL *StartLabel; EFI_IFR_GUID_LABEL *EndLabel; + UINT16 DeviceType; + BOOLEAN IsLegacyOption; + BOOLEAN NeedEndOp; - gOption = NULL; - InitializeListHead (&BdsBootOptionList); + DeviceType = (UINT16) -1; + gOption = NULL; + InitializeListHead (&mBootOptionsList); // // Connect all prior to entering the platform setup menu. @@ -212,14 +229,8 @@ CallBootManager ( BdsLibConnectAllDriversToAllControllers (); gConnectAllHappened = TRUE; } - // - // BugBug: Here we can not remove the legacy refresh macro, so we need - // get the boot order every time from "BootOrder" variable. - // Recreate the boot option list base on the BootOrder variable - // - BdsLibEnumerateAllBootOption (&BdsBootOptionList); - mBootOptionsList = &BdsBootOptionList; + BdsLibEnumerateAllBootOption (&mBootOptionsList); HiiHandle = gBootManagerPrivate.HiiHandle; @@ -247,8 +258,8 @@ CallBootManager ( EndLabel->Number = LABEL_BOOT_OPTION_END; mKeyInput = 0; - - for (Link = BdsBootOptionList.ForwardLink; Link != &BdsBootOptionList; Link = Link->ForwardLink) { + NeedEndOp = FALSE; + for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) { Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE); // @@ -262,7 +273,38 @@ CallBootManager ( if ((Option->Attribute & LOAD_OPTION_HIDDEN) != 0) { continue; } - + + // + // Group the legacy boot option in the sub title created dynamically + // + IsLegacyOption = (BOOLEAN) ( + (DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) && + (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP) + ); + + if (!IsLegacyOption && NeedEndOp) { + NeedEndOp = FALSE; + HiiCreateEndOpCode (StartOpCodeHandle); + } + + if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) Option->DevicePath)->DeviceType) { + if (NeedEndOp) { + HiiCreateEndOpCode (StartOpCodeHandle); + } + + DeviceType = ((BBS_BBS_DEVICE_PATH *) Option->DevicePath)->DeviceType; + Token = HiiSetString ( + HiiHandle, + 0, + mDeviceTypeStr[ + MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1) + ], + NULL + ); + HiiCreateSubTitleOpCode (StartOpCodeHandle, Token, 0, 0, 1); + NeedEndOp = TRUE; + } + ASSERT (Option->Description != NULL); Token = HiiSetString (HiiHandle, 0, Option->Description, NULL); @@ -286,9 +328,13 @@ CallBootManager ( ); } + if (NeedEndOp) { + HiiCreateEndOpCode (StartOpCodeHandle); + } + HiiUpdateForm ( HiiHandle, - &mBootManagerGuid, + &gBootManagerFormSetGuid, BOOT_MANAGER_FORM_ID, StartOpCodeHandle, EndOpCodeHandle @@ -302,7 +348,7 @@ CallBootManager ( gFormBrowser2, &HiiHandle, 1, - &mBootManagerGuid, + &gBootManagerFormSetGuid, 0, NULL, &ActionRequest