X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FApplication%2FUiApp%2FFrontPage.c;h=4b95cccb5cf534952fbc6f42cd44add51ec2c769;hp=e1a1d05974fe5507a5cbbcff048c117162ad4ffb;hb=be689ecc93e5b9255ec329a86520c831f824084f;hpb=7266e2f69b8bfa47c1c7203ad51dabf6c4cb78c9 diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c b/MdeModulePkg/Application/UiApp/FrontPage.c index e1a1d05974..4b95cccb5c 100644 --- a/MdeModulePkg/Application/UiApp/FrontPage.c +++ b/MdeModulePkg/Application/UiApp/FrontPage.c @@ -1,14 +1,9 @@ /** @file FrontPage routines to handle the callbacks and browser calls -Copyright (c) 2004 - 2016, 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 -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. +Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -19,8 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID; -BOOLEAN gConnectAllHappened = FALSE; -BOOLEAN mFeaturerSwitch = TRUE; BOOLEAN mResetRequired = FALSE; EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2; @@ -153,6 +146,8 @@ FakeRouteConfig ( return EFI_INVALID_PARAMETER; } + *Progress = Configuration; + return EFI_NOT_FOUND; } @@ -400,7 +395,7 @@ ConvertProcessorToString ( if (Base10Exponent >= 6) { FreqMhz = ProcessorFrequency; - for (Index = 0; Index < (UINTN) (Base10Exponent - 6); Index++) { + for (Index = 0; Index < (UINT32) Base10Exponent - 6; Index++) { FreqMhz *= 10; } } else { @@ -409,9 +404,16 @@ ConvertProcessorToString ( DestMax = 0x20 / sizeof (CHAR16); StringBuffer = AllocateZeroPool (0x20); ASSERT (StringBuffer != NULL); - Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3); + UnicodeValueToStringS (StringBuffer, sizeof (CHAR16) * DestMax, LEFT_JUSTIFY, FreqMhz / 1000, 3); + Index = StrnLenS (StringBuffer, DestMax); StrCatS (StringBuffer, DestMax, L"."); - UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2); + UnicodeValueToStringS ( + StringBuffer + Index + 1, + sizeof (CHAR16) * (DestMax - (Index + 1)), + PREFIX_ZERO, + (FreqMhz % 1000) / 10, + 2 + ); StrCatS (StringBuffer, DestMax, L" GHz"); *String = (CHAR16 *) StringBuffer; return ; @@ -435,7 +437,7 @@ ConvertMemorySizeToString ( StringBuffer = AllocateZeroPool (0x24); ASSERT (StringBuffer != NULL); - UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 10); + UnicodeValueToStringS (StringBuffer, 0x24, LEFT_JUSTIFY, MemorySize, 10); StrCatS (StringBuffer, 0x24 / sizeof (CHAR16), L" MB RAM"); *String = (CHAR16 *) StringBuffer; @@ -484,7 +486,7 @@ GetOptionalStringByIndex ( *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING)); } else { *String = AllocatePool (StrSize * sizeof (CHAR16)); - AsciiStrToUnicodeStr (OptionalStrStart, *String); + AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize); } return EFI_SUCCESS; @@ -580,7 +582,7 @@ UpdateFrontPageBannerStrings ( SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL); while (!EFI_ERROR(Status)) { - if (Record->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) { + if (Record->Type == SMBIOS_TYPE_BIOS_INFORMATION) { Type0Record = (SMBIOS_TABLE_TYPE0 *) Record; StrIndex = Type0Record->BiosVersion; GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString); @@ -598,7 +600,7 @@ UpdateFrontPageBannerStrings ( } } - if (Record->Type == EFI_SMBIOS_TYPE_SYSTEM_INFORMATION) { + if (Record->Type == SMBIOS_TYPE_SYSTEM_INFORMATION) { Type1Record = (SMBIOS_TABLE_TYPE1 *) Record; StrIndex = Type1Record->ProductName; GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString); @@ -607,7 +609,7 @@ UpdateFrontPageBannerStrings ( FreePool (NewString); } - if ((Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) { + if ((Record->Type == SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) { Type4Record = (SMBIOS_TABLE_TYPE4 *) Record; // // The information in the record should be only valid when the CPU Socket is populated. @@ -628,7 +630,7 @@ UpdateFrontPageBannerStrings ( } } - if ( Record->Type == EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) { + if ( Record->Type == SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) { Type19Record = (SMBIOS_TABLE_TYPE19 *) Record; if (Type19Record->StartingAddress != 0xFFFFFFFF ) { InstalledMemory += RShiftU64(Type19Record->EndingAddress - @@ -662,8 +664,7 @@ UpdateFrontPageBannerStrings ( **/ EFI_STATUS -EFIAPI -BdsSetConsoleMode ( +UiSetConsoleMode ( BOOLEAN IsSetupMode ) { @@ -715,7 +716,7 @@ BdsSetConsoleMode ( if (IsSetupMode) { // - // The requried resolution and text mode is setup mode. + // The required resolution and text mode is setup mode. // NewHorizontalResolution = mSetupHorizontalResolution; NewVerticalResolution = mSetupVerticalResolution; @@ -771,7 +772,7 @@ BdsSetConsoleMode ( return EFI_SUCCESS; } else { // - // If current text mode is different from requried text mode. Set new video mode + // If current text mode is different from required text mode. Set new video mode // for (Index = 0; Index < MaxTextMode; Index++) { Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow); @@ -796,7 +797,7 @@ BdsSetConsoleMode ( } if (Index == MaxTextMode) { // - // If requried text mode is not supported, return error. + // If required text mode is not supported, return error. // FreePool (Info); return EFI_UNSUPPORTED; @@ -955,9 +956,9 @@ InitializeUserInterface ( InitializeStringSupport (); - BdsSetConsoleMode (TRUE); + UiSetConsoleMode (TRUE); UiEntry (FALSE); - BdsSetConsoleMode (FALSE); + UiSetConsoleMode (FALSE); UninitializeStringSupport (); HiiRemovePackages (HiiHandle); @@ -991,9 +992,10 @@ UiEntry ( // // Indicate if the connect all has been performed before. + // If has not been performed before, do here. // - if (ConnectAllHappened) { - gConnectAllHappened = TRUE; + if (!ConnectAllHappened) { + EfiBootManagerConnectAll (); } // @@ -1033,34 +1035,7 @@ UiEntry ( // -/** - Enable the setup browser reset reminder feature. - This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it. -**/ -VOID -EFIAPI -EnableResetReminderFeature ( - VOID - ) -{ - mFeaturerSwitch = TRUE; -} - - -/** - Disable the setup browser reset reminder feature. - This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it. - -**/ -VOID -EFIAPI -DisableResetReminderFeature ( - VOID - ) -{ - mFeaturerSwitch = FALSE; -} /** @@ -1078,33 +1053,7 @@ EnableResetRequired ( } -/** - Record the info that no reset is required. - A module boolean variable is used to record whether a reset is required. -**/ -VOID -EFIAPI -DisableResetRequired ( - VOID - ) -{ - mResetRequired = FALSE; -} - - -/** - Check whether platform policy enable the reset reminder feature. The default is enabled. - -**/ -BOOLEAN -EFIAPI -IsResetReminderFeatureEnable ( - VOID - ) -{ - return mFeaturerSwitch; -} /** @@ -1137,31 +1086,28 @@ SetupResetReminder ( CHAR16 *StringBuffer1; CHAR16 *StringBuffer2; - // //check any reset required change is applied? if yes, reset system // - if (IsResetReminderFeatureEnable ()) { - if (IsResetRequired ()) { - - StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); - ASSERT (StringBuffer1 != NULL); - StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); - ASSERT (StringBuffer2 != NULL); - StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now."); - StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset"); - // - // Popup a menu to notice user - // - do { - CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); - } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); + if (IsResetRequired ()) { + + StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); + ASSERT (StringBuffer1 != NULL); + StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); + ASSERT (StringBuffer2 != NULL); + StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now."); + StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset"); + // + // Popup a menu to notice user + // + do { + CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); + } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); - FreePool (StringBuffer1); - FreePool (StringBuffer2); + FreePool (StringBuffer1); + FreePool (StringBuffer2); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - } + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); } }