diff --git a/Legacy/BootPlatform/BdsDxe/Bds.h b/Legacy/BootPlatform/BdsDxe/Bds.h index 9261f14f..9a2b8471 100644 --- a/Legacy/BootPlatform/BdsDxe/Bds.h +++ b/Legacy/BootPlatform/BdsDxe/Bds.h @@ -1,14 +1,8 @@ /** @file Head file for BDS Architectural Protocol implementation -Copyright (c) 2004 - 2014, 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 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ diff --git a/Legacy/BootPlatform/BdsDxe/BdsDxe.inf b/Legacy/BootPlatform/BdsDxe/BdsDxe.inf index d10c1619..a4f928bf 100644 --- a/Legacy/BootPlatform/BdsDxe/BdsDxe.inf +++ b/Legacy/BootPlatform/BdsDxe/BdsDxe.inf @@ -1,28 +1,13 @@ ## @file +# BdsDxe module is core driver for BDS phase. # -# BDSDxe module is core driver for BDS phase. -# When DxeCore dispatching all DXE driver, this module will produce architecture protocol +# When DxeCore dispatching all DXE driver, this module will produce architecture protocol # gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore will invoke Entry # interface of protocol gEfiBdsArchProtocolGuid, then BDS phase is entered. # -# Generally, this module take reposiblity to connect all necessary devices for platform boot, -# these boot device path are hold in PlatformBdsLib library instance produced by platform. -# For legacy boot, BDS will transfer control to legacy BIOS after legacy boot device is select. -# For EFI boot, BDS will load boot loader file EFI\BOOT\BOOTIA32.EFI, EFI\BOOT\BOOTX64.EFI, -# EFI\BOOT\BOOTIA64.EFI file from selected boot device and transfer control to boot loader. +# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent # -# BDSDxe also maintain the UI for "Boot Manager, Boot Maintaince Manager, Device Manager" which -# is used for user to configure boot option or maintain hardware device. -# -# Copyright (c) 2008 - 2014, 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. -# ## [Defines] @@ -31,13 +16,13 @@ MODULE_UNI_FILE = BdsDxe.uni FILE_GUID = FC5C7020-1A48-4198-9BE2-EAD5ABC8CF2F MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 + VERSION_STRING = 1.0 ENTRY_POINT = BdsInitialize # # The following information is for reference only and not required by the build tools. # -# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# VALID_ARCHITECTURES = IA32 X64 EBC # [Sources] @@ -84,3 +69,6 @@ [Depex] TRUE + +[UserExtensions.TianoCore."ExtraFiles"] + BdsDxeExtra.uni diff --git a/Legacy/BootPlatform/BdsDxe/BdsDxe.uni b/Legacy/BootPlatform/BdsDxe/BdsDxe.uni index b0ff98b3..433b706e 100644 --- a/Legacy/BootPlatform/BdsDxe/BdsDxe.uni +++ b/Legacy/BootPlatform/BdsDxe/BdsDxe.uni @@ -4,30 +4,13 @@ // When DxeCore dispatching all DXE driver, this module will produce architecture protocol // gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore will invoke Entry // interface of protocol gEfiBdsArchProtocolGuid, then BDS phase is entered. -// -// Generally, this module take reposiblity to connect all necessary devices for platform boot, -// these boot device path are hold in PlatformBdsLib library instance produced by platform. -// For legacy boot, BDS will transfer control to legacy BIOS after legacy boot device is select. -// For EFI boot, BDS will load boot loader file EFI\BOOT\BOOTIA32.EFI, EFI\BOOT\BOOTX64.EFI, -// EFI\BOOT\BOOTIA64.EFI file from selected boot device and transfer control to boot loader. -// -// BDSDxe also maintain the UI for "Boot Manager, Boot Maintaince Manager, Device Manager" which -// is used for user to configure boot option or maintain hardware device. // -// Copyright (c) 2008 - 2014, 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) 2015 - 2018, Intel Corporation. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent // // **/ -#string STR_MODULE_ABSTRACT #language en-US "BDSDxe module is core driver for BDS phase" - -#string STR_MODULE_DESCRIPTION #language en-US "When DxeCore dispatching all DXE driver, this module will produce architecture protocol gEfiBdsArchProtocolGuid. After DxeCore finishes dispatching, DxeCore will invoke the Entry interface of protocol gEfiBdsArchProtocolGuid. Then BDS phase is entered. Generally, this module takes reposiblity to connect all necessary devices for platform boot. These boot device paths are held in PlatformBdsLib a library instance produced by the platform. For legacy boot, BDS will transfer control to legacy BIOS after legacy boot device is selected. For EFI boot, BDS will load boot loader file EFI\BOOT\BOOTIA32.EFI, EFI\BOOT\BOOTX64.EFI, EFI\BOOT\BOOTIA64.EFI files from selected boot devices, and transfers control to the boot loader. BDSDxe also maintains the UI for \"Boot Manager, Boot Maintaince Manager, Device Manager\", which is used by the user to configure boot options or to maintain hardware devices." +#string STR_MODULE_ABSTRACT #language en-US "BdsDxe module is core driver for BDS phase" +#string STR_MODULE_DESCRIPTION #language en-US "When DxeCore dispatching all DXE driver, this module will produce architecture protocol gEfiBdsArchProtocolGuid. After DxeCore finishes dispatching, DxeCore will invoke the Entry interface of protocol gEfiBdsArchProtocolGuid. Then BDS phase is entered." diff --git a/Legacy/BootPlatform/BdsDxe/BdsDxeExtra.uni b/Legacy/BootPlatform/BdsDxe/BdsDxeExtra.uni new file mode 100644 index 00000000..6a1429fa --- /dev/null +++ b/Legacy/BootPlatform/BdsDxe/BdsDxeExtra.uni @@ -0,0 +1,12 @@ +// /** @file +// BdsDxe Localized Strings and Content +// +// Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Boot Device Selection Core DXE Driver" diff --git a/Legacy/BootPlatform/BdsDxe/BdsEntry.c b/Legacy/BootPlatform/BdsDxe/BdsEntry.c index 76494d36..5bbd63f2 100644 --- a/Legacy/BootPlatform/BdsDxe/BdsEntry.c +++ b/Legacy/BootPlatform/BdsDxe/BdsEntry.c @@ -5,14 +5,10 @@ After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked to enter BDS phase. -Copyright (c) 2004 - 2014, 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 - 2019, Intel Corporation. All rights reserved.
+(C) Copyright 2016-2019 Hewlett Packard Enterprise Development LP
+(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -49,11 +45,11 @@ EFI_BDS_ARCH_PROTOCOL gBds = { /// The read-only variables defined in UEFI Spec. /// CHAR16 *mReadOnlyVariables[] = { - L"PlatformLangCodes", - L"LangCodes", - L"BootOptionSupport", - L"HwErrRecSupport", - L"OsIndicationsSupported" + EFI_PLATFORM_LANG_CODES_VARIABLE_NAME + EFI_LANG_CODES_VARIABLE_NAME, + EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, + EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME, + EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME }; /** @@ -264,10 +260,10 @@ BdsBootDeviceSelect ( /** - Validate input console variable data. + Validate input console variable data. If found the device path is not a valid device path, remove the variable. - + @param VariableName Input console variable name. **/ @@ -277,16 +273,12 @@ BdsFormalizeConsoleVariable ( IN CHAR16 *VariableName ) { - EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *DevicePath; UINTN VariableSize; + EFI_STATUS Status; - DevicePath = BdsLibGetVariableAndSize ( - VariableName, - &gEfiGlobalVariableGuid, - &VariableSize - ); - if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) { + GetEfiGlobalVariable2 (VariableName, (VOID **) &DevicePath, &VariableSize); + if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) { Status = gRT->SetVariable ( VariableName, &gEfiGlobalVariableGuid, @@ -294,8 +286,15 @@ BdsFormalizeConsoleVariable ( 0, NULL ); + // + // Deleting variable with current variable implementation shouldn't fail. + // ASSERT_EFI_ERROR (Status); } + + if (DevicePath != NULL) { + FreePool (DevicePath); + } } /** @@ -309,7 +308,7 @@ BdsFormalizeConsoleVariable ( **/ STATIC -VOID +VOID BdsFormalizeEfiGlobalVariable ( VOID ) @@ -319,9 +318,9 @@ BdsFormalizeEfiGlobalVariable ( // // Validate Console variable. // - BdsFormalizeConsoleVariable (L"ConIn"); - BdsFormalizeConsoleVariable (L"ConOut"); - BdsFormalizeConsoleVariable (L"ErrOut"); + BdsFormalizeConsoleVariable (EFI_CON_IN_VARIABLE_NAME); + BdsFormalizeConsoleVariable (EFI_CON_OUT_VARIABLE_NAME); + BdsFormalizeConsoleVariable (EFI_ERR_OUT_VARIABLE_NAME); // // OS indicater support variable @@ -330,7 +329,7 @@ BdsFormalizeEfiGlobalVariable ( | EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED; gRT->SetVariable ( - L"OsIndicationsSupported", + EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, &gEfiGlobalVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, sizeof(UINT64), @@ -405,7 +404,7 @@ BdsEntry ( // Fixup Table CRC after we updated Firmware Vendor and Revision // gST->Hdr.CRC32 = 0; - gBS->CalculateCrc32 (gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32); + gBS->CalculateCrc32 ((VOID *) gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32); // // Validate Variable. @@ -419,7 +418,7 @@ BdsEntry ( Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock); DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status)); if (!EFI_ERROR (Status)) { - for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof (mReadOnlyVariables[0]); Index++) { + for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) { Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid); ASSERT_EFI_ERROR (Status); } diff --git a/Library/DuetBdsLib/BdsPlatform.c b/Library/DuetBdsLib/BdsPlatform.c index 5231800d..2ff889eb 100644 --- a/Library/DuetBdsLib/BdsPlatform.c +++ b/Library/DuetBdsLib/BdsPlatform.c @@ -744,7 +744,7 @@ GetGopDevicePath ( } // - // Try to connect this handle, so that GOP dirver could start on this + // Try to connect this handle, so that GOP driver could start on this // device and create child handles with GraphicsOutput Protocol installed // on them, then we get device paths of these child handles and select // them as possible console device. @@ -763,7 +763,8 @@ GetGopDevicePath ( // Add all the child handles as possible Console Device // for (Index = 0; Index < GopHandleCount; Index++) { - Status = gBS->HandleProtocol (GopHandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath); + Status = gBS->HandleProtocol (GopHandleBuffer[Index], + &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath); if (EFI_ERROR (Status)) { continue; }