BdsDxe: Sync with select upstream changes

This commit is contained in:
vit9696 2020-12-06 22:42:55 +03:00
parent f8b550d71e
commit 07efdb57fb
6 changed files with 58 additions and 81 deletions

View File

@ -1,14 +1,8 @@
/** @file
Head file for BDS Architectural Protocol implementation
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
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.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

View File

@ -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.<BR>
# 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.<BR>
# 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

View File

@ -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.<BR>
//
// 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.<BR>
// 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."

View File

@ -0,0 +1,12 @@
// /** @file
// BdsDxe Localized Strings and Content
//
// Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
// **/
#string STR_PROPERTIES_MODULE_NAME
#language en-US
"Boot Device Selection Core DXE Driver"

View File

@ -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.<BR>
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.<BR>
(C) Copyright 2016-2019 Hewlett Packard Enterprise Development LP<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
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);
}

View File

@ -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;
}