summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Universal/BdsDxe
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2017-08-02 09:54:47 +0800
committerGuo Mang <mang.guo@intel.com>2017-09-05 19:45:08 +0800
commit6c128c65b5ec0e5b8b5a0ccb165f3afd29e485f8 (patch)
tree444372d92a0ae8991fe4d15eb3937df43690dfda /IntelFrameworkModulePkg/Universal/BdsDxe
parentb207c6434d7a5a4502975d322312e07017e8a8cb (diff)
downloadedk2-platforms-6c128c65b5ec0e5b8b5a0ccb165f3afd29e485f8.tar.xz
Remove core packages since we can get them from edk2 repository
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'IntelFrameworkModulePkg/Universal/BdsDxe')
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h237
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf228
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.unibin5172 -> 0 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxeExtra.unibin1370 -> 0 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c754
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c254
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.h82
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bm.vfr365
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c411
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bmstring.unibin38776 -> 0 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c1690
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h1679
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c1823
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c1198
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Data.c332
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr127
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c469
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h243
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c1391
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c1378
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c399
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.h103
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerStrings.unibin3344 -> 0 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerVfr.Vfr50
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c233
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c2591
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h523
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.unibin13366 -> 0 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr93
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.h56
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DriverHealthVfr.Vfr38
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c1472
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h254
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.unibin9974 -> 0 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr137
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c597
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h67
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c48
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.h32
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Language.c499
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Language.h51
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c433
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/String.c59
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/String.h65
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Strings.unibin7444 -> 0 bytes
45 files changed, 0 insertions, 20461 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h
deleted file mode 100644
index 93bafd2dd8..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/** @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.
-
-**/
-
-#ifndef _BDS_MODULE_H_
-#define _BDS_MODULE_H_
-
-#include <FrameworkDxe.h>
-#include <IndustryStandard/PeImage.h>
-#include <Guid/MdeModuleHii.h>
-#include <Guid/FileSystemVolumeLabelInfo.h>
-#include <Guid/HiiPlatformSetupFormset.h>
-#include <Guid/StatusCodeDataTypeVariable.h>
-#include <Protocol/DevicePath.h>
-#include <IndustryStandard/SmBios.h>
-#include <Protocol/LoadFile.h>
-#include <Guid/FileInfo.h>
-#include <Protocol/HiiConfigRouting.h>
-#include <Protocol/Bds.h>
-#include <Protocol/Smbios.h>
-#include <Protocol/UgaDraw.h>
-#include <Protocol/BlockIo.h>
-#include <Guid/GlobalVariable.h>
-#include <Guid/CapsuleVendor.h>
-#include <Guid/StatusCodeDataTypeId.h>
-#include <Guid/LegacyDevOrder.h>
-#include <Guid/BdsHii.h>
-#include <Guid/ConnectConInEvent.h>
-#include <Guid/Performance.h>
-#include <Guid/FmpCapsule.h>
-#include <Protocol/GenericMemoryTest.h>
-#include <Protocol/FormBrowser2.h>
-#include <Protocol/HiiConfigAccess.h>
-#include <Protocol/GraphicsOutput.h>
-#include <Protocol/SimpleFileSystem.h>
-#include <Protocol/HiiDatabase.h>
-#include <Protocol/HiiString.h>
-#include <Protocol/SerialIo.h>
-#include <Protocol/LegacyBios.h>
-#include <Protocol/SimpleTextInEx.h>
-#include <Protocol/DriverHealth.h>
-#include <Protocol/BootLogo.h>
-#include <Protocol/VariableLock.h>
-
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/PrintLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PerformanceLib.h>
-#include <Library/ReportStatusCodeLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/HobLib.h>
-#include <Library/BaseLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/PcdLib.h>
-#include <Library/CapsuleLib.h>
-#include <Library/HiiLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/UefiHiiServicesLib.h>
-
-#include <Library/GenericBdsLib.h>
-#include <Library/PlatformBdsLib.h>
-
-#pragma pack(1)
-
-///
-/// HII specific Vendor Device Path definition.
-///
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-
-#pragma pack()
-
-/**
-
- Show progress bar with title above it. It only works in Graphics mode.
-
- @param TitleForeground Foreground color for Title.
- @param TitleBackground Background color for Title.
- @param Title Title above progress bar.
- @param ProgressColor Progress bar color.
- @param Progress Progress (0-100)
- @param PreviousValue The previous value of the progress.
-
- @retval EFI_STATUS Success update the progress bar
-
-**/
-EFI_STATUS
-PlatformBdsShowProgress (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- IN CHAR16 *Title,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- IN UINTN Progress,
- IN UINTN PreviousValue
- );
-
-//
-// Prototypes
-//
-
-/**
-
- Install Boot Device Selection Protocol
-
- @param ImageHandle The image handle.
- @param SystemTable The system table.
-
- @retval EFI_SUCEESS BDS has finished initializing.
- Return the dispatcher and recall BDS.Entry
- @retval Other Return status from AllocatePool() or gBS->InstallProtocolInterface
-
-**/
-EFI_STATUS
-EFIAPI
-BdsInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
-
- Service routine for BdsInstance->Entry(). Devices are connected, the
- consoles are initialized, and the boot options are tried.
-
- @param This Protocol Instance structure.
-
-**/
-VOID
-EFIAPI
-BdsEntry (
- IN EFI_BDS_ARCH_PROTOCOL *This
- );
-
-
-/**
- Perform the memory test base on the memory test intensive level,
- and update the memory resource.
-
- @param Level The memory test intensive level.
-
- @retval EFI_STATUS Success test all the system memory and update
- the memory resource
-
-**/
-EFI_STATUS
-EFIAPI
-BdsMemoryTest (
- IN EXTENDMEM_COVERAGE_LEVEL Level
- );
-
-/**
-
- This routine is called to see if there are any capsules we need to process.
- If the boot mode is not UPDATE, then we do nothing. Otherwise find the
- capsule HOBS and produce firmware volumes for them via the DXE service.
- Then call the dispatcher to dispatch drivers from them. Finally, check
- the status of the updates.
-
- This function should be called by BDS in case we need to do some
- sort of processing even if there is no capsule to process. We
- need to do this if an earlier update went away and we need to
- clear the capsule variable so on the next reset PEI does not see it and
- think there is a capsule available.
-
- @param BootMode the current boot mode
-
- @retval EFI_INVALID_PARAMETER boot mode is not correct for an update
- @retval EFI_SUCCESS There is no error when processing capsule
-
-**/
-EFI_STATUS
-EFIAPI
-BdsProcessCapsules (
- EFI_BOOT_MODE BootMode
- );
-
-/**
- Set the variable and report the error through status code upon failure.
-
- @param VariableName A Null-terminated string that is the name of the vendor's variable.
- Each VariableName is unique for each VendorGuid. VariableName must
- contain 1 or more characters. If VariableName is an empty string,
- then EFI_INVALID_PARAMETER is returned.
- @param VendorGuid A unique identifier for the vendor.
- @param Attributes Attributes bitmask to set for the variable.
- @param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
- EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
- EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
- causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
- set, then a SetVariable() call with a DataSize of zero will not cause any change to
- the variable value (the timestamp associated with the variable may be updated however
- even if no new data value is provided,see the description of the
- EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
- be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
- @param Data The contents for the variable.
-
- @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
- defined by the Attributes.
- @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
- DataSize exceeds the maximum allowed.
- @retval EFI_INVALID_PARAMETER VariableName is an empty string.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
- @retval EFI_WRITE_PROTECTED The variable in question is read-only.
- @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
- @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
- or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
- does NOT pass the validation check carried out by the firmware.
-
- @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
-**/
-EFI_STATUS
-BdsDxeSetVariableAndReportStatusCodeOnError (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- );
-
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
deleted file mode 100644
index 6afb8a09df..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ /dev/null
@@ -1,228 +0,0 @@
-## @file
-# BDSDxe module is core driver for BDS phase.
-#
-# 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 - 2015, 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]
- INF_VERSION = 0x00010005
- BASE_NAME = BdsDxe
- MODULE_UNI_FILE = BdsDxe.uni
- FILE_GUID = FC5C7020-1A48-4198-9BE2-EAD5ABC8CF2F
- MODULE_TYPE = DXE_DRIVER
- 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
-#
-
-[Sources]
- FrontPage.h
- Language.h
- Bds.h
- Hotkey.h
- BootMaint/BBSsupport.h
- BootMngr/BootManager.h
- BootMaint/BootMaint.h
- String.h
- BootMaint/FormGuid.h
- HwErrRecSupport.c
- HwErrRecSupport.h
-
- DeviceMngr/DeviceManager.h
- DeviceMngr/DeviceManagerVfr.h
- DeviceMngr/DeviceManagerVfr.Vfr
- DeviceMngr/DriverHealthVfr.Vfr
- DeviceMngr/DeviceManagerStrings.uni
- DeviceMngr/DeviceManager.c
- BootMngr/BootManagerVfr.Vfr
- BootMngr/BootManagerStrings.uni
- BootMngr/BootManager.c
- BootMaint/FE.vfr
- BootMaint/FileExplorer.c
- BootMaint/BootMaint.c
- BootMaint/BBSsupport.c
- BootMaint/UpdatePage.c
- BootMaint/Variable.c
- BootMaint/Data.c
- BootMaint/ConsoleOption.c
- BootMaint/BootOption.c
- BootMaint/BmLib.c
- BootMaint/Bm.vfr
- BootMaint/Bmstring.uni
- Hotkey.c
- MemoryTest.c
- Capsules.c
- Strings.uni
- String.c
- Language.c
- FrontPageVfr.Vfr
- FrontPageStrings.uni
- FrontPage.c
- BdsEntry.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- DevicePathLib
- BaseLib
- HobLib
- UefiRuntimeServicesTableLib
- GenericBdsLib
- ReportStatusCodeLib
- PerformanceLib
- MemoryAllocationLib
- UefiLib
- UefiBootServicesTableLib
- BaseMemoryLib
- DebugLib
- PrintLib
- HiiLib
- UefiDriverEntryPoint
- PlatformBdsLib
- CapsuleLib
- PcdLib
- UefiHiiServicesLib
-
-[Guids]
- ## SOMETIMES_PRODUCES ## Variable:L"BootXXXX" # Boot option variable
- ## SOMETIMES_PRODUCES ## Variable:L"DriverXXXX" # Driver load option.
- ## SOMETIMES_PRODUCES ## Variable:L"PlatformLang" # Platform supported languange in Rfc4646 format
- ## SOMETIMES_PRODUCES ## Variable:L"Lang" # Platform supported languange in Iso639 format
- ## SOMETIMES_PRODUCES ## Variable:L"LangCodes" # Value of PcdUefiVariableDefaultLangCodes
- ## PRODUCES ## Variable:L"PlatformLangCodes" # Value of PcdUefiVariableDefaultPlatformLangCodes
- ## SOMETIMES_PRODUCES ## Variable:L"KeyXXXX" # Hotkey option variable
- ## PRODUCES ## Variable:L"HwErrRecSupport" # The level of platform supported hardware Error Record Persistence
- ## PRODUCES ## Variable:L"Timeout" # The time out value in second of showing progress bar
- ## SOMETIMES_PRODUCES ## Variable:L"BootOptionSupport" # The feature supported in boot option menu, value could be: EFI_BOOT_OPTION_SUPPORT_KEY, EFI_BOOT_OPTION_SUPPORT_APP
- ## SOMETIMES_PRODUCES ## Variable:L"BootOrder" # The boot option array
- ## SOMETIMES_PRODUCES ## Variable:L"DriverOrder" # The driver order list
- ## SOMETIMES_CONSUMES ## Variable:L"ConIn" # The device path of console in device
- ## SOMETIMES_PRODUCES ## Variable:L"ConIn" # The device path of console in device
- ## SOMETIMES_CONSUMES ## Variable:L"ConOut" # The device path of console out device
- ## SOMETIMES_PRODUCES ## Variable:L"ConOut" # The device path of console out device
- ## SOMETIMES_CONSUMES ## Variable:L"ErrOut" # The device path of error out device
- ## SOMETIMES_PRODUCES ## Variable:L"ErrOut" # The device path of error out device
- ## SOMETIMES_CONSUMES ## Variable:L"ConInDev" # The device path of console in device
- ## SOMETIMES_CONSUMES ## Variable:L"ConOutDev" # The device path of console out device
- ## SOMETIMES_CONSUMES ## Variable:L"ErrOutDev" # The device path of error out device
- ## SOMETIMES_PRODUCES ## Variable:L"BootNext" # The number of next boot option
- gEfiGlobalVariableGuid
- gEfiFileSystemVolumeLabelInfoIdGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Indicate the information type is volume
- gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Indicate the information type is file
- gEfiHiiPlatformSetupFormsetGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Indicate the formset class guid to be displayed
- gEfiIfrTianoGuid ## SOMETIMES_PRODUCES ## UNDEFINED # Extended IFR Guid Opcode
- gEfiHiiDriverHealthFormsetGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Indicate the Driver Health formset class guid to be displayed
- ## SOMETIMES_PRODUCES ## Variable:L"LegacyDevOrder"
- ## SOMETIMES_CONSUMES ## Variable:L"LegacyDevOrder"
- gEfiLegacyDevOrderVariableGuid
- gFrontPageFormSetGuid ## SOMETIMES_CONSUMES ## HII # FrontPage HII Package
- gBootMaintFormSetGuid ## SOMETIMES_CONSUMES ## HII # BootMaint HII Package
- gFileExploreFormSetGuid ## SOMETIMES_CONSUMES ## HII # FileExplore HII Package
- gBootManagerFormSetGuid ## SOMETIMES_CONSUMES ## HII # BootManager HII Package
- gDeviceManagerFormSetGuid ## SOMETIMES_CONSUMES ## HII # DeviceManager HII Package
- gDriverHealthFormSetGuid ## SOMETIMES_CONSUMES ## HII # DriverHealth HII Package
- ## SOMETIMES_PRODUCES ## Event
- ## SOMETIMES_CONSUMES ## Event
- gConnectConInEventGuid
- gEfiFmpCapsuleGuid ## SOMETIMES_CONSUMES ## GUID # FMP Capsule
- gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES ## GUID
- gEfiUartDevicePathGuid ## SOMETIMES_CONSUMES ## GUID (Identify the device path for UARD device)
-
-[Protocols]
- gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES
- gEfiLoadFileProtocolGuid ## SOMETIMES_CONSUMES
- gEfiBdsArchProtocolGuid ## PRODUCES
- gEfiSmbiosProtocolGuid ## CONSUMES
- gEfiGenericMemTestProtocolGuid ## SOMETIMES_CONSUMES
- gEfiLegacyBiosProtocolGuid ## SOMETIMES_CONSUMES
- gEfiUgaDrawProtocolGuid |gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## SOMETIMES_CONSUMES
- gEfiBlockIoProtocolGuid ## SOMETIMES_CONSUMES
- gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES
- ## CONSUMES
- ## NOTIFY
- gEfiSimpleTextInputExProtocolGuid
- gEfiHiiConfigAccessProtocolGuid ## SOMETIMES_PRODUCES
- gEfiFormBrowser2ProtocolGuid ## CONSUMES
- gEfiSerialIoProtocolGuid ## SOMETIMES_CONSUMES
- gEfiDevicePathProtocolGuid ## CONSUMES
- gEfiDriverHealthProtocolGuid ## SOMETIMES_CONSUMES
- gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMES
- gEfiBootLogoProtocolGuid ## SOMETIMES_CONSUMES
- gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES
-
-[FeaturePcd]
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable ## CONSUMES
-
-[Pcd]
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes ## SOMETIMES_CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang ## SOMETIMES_CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## SOMETIMES_CONSUMES
- ## CONSUMES
- ## PRODUCES
- gEfiMdePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## PRODUCES
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## PRODUCES
- ## SOMETIMES_CONSUMES
- ## SOMETIMES_PRODUCES
- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
- ## CONSUMES
- ## PRODUCES
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootState
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## PRODUCES
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## PRODUCES
- gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand ## SOMETIMES_CONSUMES
- ## CONSUMES
- ## SOMETIMES_PRODUCES
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn
- ## CONSUMES
- ## SOMETIMES_PRODUCES
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## CONSUMES
-
-[Depex]
- TRUE
-
-#
-# [BootMode]
-# FLASH_UPDATE ## SOMETIMES_CONSUMES # Update Capsule Image
-#
-
-[UserExtensions.TianoCore."ExtraFiles"]
- BdsDxeExtra.uni
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.uni
deleted file mode 100644
index a120733895..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.uni
+++ /dev/null
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxeExtra.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxeExtra.uni
deleted file mode 100644
index 9aee074abe..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxeExtra.uni
+++ /dev/null
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
deleted file mode 100644
index ae7ad2153c..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
+++ /dev/null
@@ -1,754 +0,0 @@
-/** @file
- This module produce main entry for BDS phase - BdsEntry.
- When this module was dispatched by DxeCore, gEfiBdsArchProtocolGuid will be installed
- which contains interface of BdsEntry.
- 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.
-
-**/
-
-#include "Bds.h"
-#include "Language.h"
-#include "FrontPage.h"
-#include "Hotkey.h"
-#include "HwErrRecSupport.h"
-
-///
-/// BDS arch protocol instance initial value.
-///
-/// Note: Current BDS not directly get the BootMode, DefaultBoot,
-/// TimeoutDefault, MemoryTestLevel value from the BDS arch protocol.
-/// Please refer to the library useage of BdsLibGetBootMode, BdsLibGetTimeout
-/// and PlatformBdsDiagnostics in BdsPlatform.c
-///
-EFI_HANDLE gBdsHandle = NULL;
-
-EFI_BDS_ARCH_PROTOCOL gBds = {
- BdsEntry
-};
-
-UINT16 *mBootNext = NULL;
-
-///
-/// The read-only variables defined in UEFI Spec.
-///
-CHAR16 *mReadOnlyVariables[] = {
- L"PlatformLangCodes",
- L"LangCodes",
- L"BootOptionSupport",
- L"HwErrRecSupport",
- L"OsIndicationsSupported"
- };
-
-/**
-
- Install Boot Device Selection Protocol
-
- @param ImageHandle The image handle.
- @param SystemTable The system table.
-
- @retval EFI_SUCEESS BDS has finished initializing.
- Return the dispatcher and recall BDS.Entry
- @retval Other Return status from AllocatePool() or gBS->InstallProtocolInterface
-
-**/
-EFI_STATUS
-EFIAPI
-BdsInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Install protocol interface
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &gBdsHandle,
- &gEfiBdsArchProtocolGuid, &gBds,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-
-/**
- An empty function to pass error checking of CreateEventEx ().
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context,
- which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-BdsEmptyCallbackFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
-}
-
-/**
-
- This function attempts to boot for the boot order specified
- by platform policy.
-
-**/
-VOID
-BdsBootDeviceSelect (
- VOID
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- BDS_COMMON_OPTION *BootOption;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- UINT16 Timeout;
- LIST_ENTRY BootLists;
- CHAR16 Buffer[20];
- BOOLEAN BootNextExist;
- LIST_ENTRY *LinkBootNext;
- EFI_EVENT ConnectConInEvent;
-
- //
- // Got the latest boot option
- //
- BootNextExist = FALSE;
- LinkBootNext = NULL;
- ConnectConInEvent = NULL;
- InitializeListHead (&BootLists);
-
- //
- // First check the boot next option
- //
- ZeroMem (Buffer, sizeof (Buffer));
-
- //
- // Create Event to signal ConIn connection request
- //
- if (PcdGetBool (PcdConInConnectOnDemand)) {
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- BdsEmptyCallbackFunction,
- NULL,
- &gConnectConInEventGuid,
- &ConnectConInEvent
- );
- if (EFI_ERROR(Status)) {
- ConnectConInEvent = NULL;
- }
- }
-
- if (mBootNext != NULL) {
- //
- // Indicate we have the boot next variable, so this time
- // boot will always have this boot option
- //
- BootNextExist = TRUE;
-
- //
- // Clear the this variable so it's only exist in this time boot
- //
- Status = gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- NULL
- );
- //
- // Deleting variable with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
-
- //
- // Add the boot next boot option
- //
- UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);
- BootOption = BdsLibVariableToOption (&BootLists, Buffer);
-
- //
- // If fail to get boot option from variable, just return and do nothing.
- //
- if (BootOption == NULL) {
- return;
- }
-
- BootOption->BootCurrent = *mBootNext;
- }
- //
- // Parse the boot order to get boot option
- //
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
-
- //
- // When we didn't have chance to build boot option variables in the first
- // full configuration boot (e.g.: Reset in the first page or in Device Manager),
- // we have no boot options in the following mini configuration boot.
- // Give the last chance to enumerate the boot options.
- //
- if (IsListEmpty (&BootLists)) {
- BdsLibEnumerateAllBootOption (&BootLists);
- }
-
- Link = BootLists.ForwardLink;
-
- //
- // Parameter check, make sure the loop will be valid
- //
- if (Link == NULL) {
- return ;
- }
- //
- // Here we make the boot in a loop, every boot success will
- // return to the front page
- //
- for (;;) {
- //
- // Check the boot option list first
- //
- if (Link == &BootLists) {
- //
- // When LazyConIn enabled, signal connect ConIn event before enter UI
- //
- if (PcdGetBool (PcdConInConnectOnDemand) && ConnectConInEvent != NULL) {
- gBS->SignalEvent (ConnectConInEvent);
- }
-
- //
- // There are two ways to enter here:
- // 1. There is no active boot option, give user chance to
- // add new boot option
- // 2. All the active boot option processed, and there is no
- // one is success to boot, then we back here to allow user
- // add new active boot option
- //
- Timeout = 0xffff;
- PlatformBdsEnterFrontPage (Timeout, FALSE);
- InitializeListHead (&BootLists);
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
- continue;
- }
- //
- // Get the boot option from the link list
- //
- BootOption = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- //
- // According to EFI Specification, if a load option is not marked
- // as LOAD_OPTION_ACTIVE, the boot manager will not automatically
- // load the option.
- //
- if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {
- //
- // skip the header of the link list, because it has no boot option
- //
- Link = Link->ForwardLink;
- continue;
- }
- //
- // Make sure the boot option device path connected,
- // but ignore the BBS device path
- //
- if (DevicePathType (BootOption->DevicePath) != BBS_DEVICE_PATH) {
- //
- // Notes: the internal shell can not been connected with device path
- // so we do not check the status here
- //
- BdsLibConnectDevicePath (BootOption->DevicePath);
- }
-
- //
- // Restore to original mode before launching boot option.
- //
- BdsSetConsoleMode (FALSE);
-
- //
- // All the driver options should have been processed since
- // now boot will be performed.
- //
- Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
- if (Status != EFI_SUCCESS) {
- //
- // Call platform action to indicate the boot fail
- //
- BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
- PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);
-
- //
- // Check the next boot option
- //
- Link = Link->ForwardLink;
-
- } else {
- //
- // Call platform action to indicate the boot success
- //
- BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
- PlatformBdsBootSuccess (BootOption);
-
- //
- // Boot success, then stop process the boot order, and
- // present the boot manager menu, front page
- //
-
- //
- // When LazyConIn enabled, signal connect ConIn Event before enter UI
- //
- if (PcdGetBool (PcdConInConnectOnDemand) && ConnectConInEvent != NULL) {
- gBS->SignalEvent (ConnectConInEvent);
- }
-
- Timeout = 0xffff;
- PlatformBdsEnterFrontPage (Timeout, FALSE);
-
- //
- // Rescan the boot option list, avoid potential risk of the boot
- // option change in front page
- //
- if (BootNextExist) {
- LinkBootNext = BootLists.ForwardLink;
- }
-
- InitializeListHead (&BootLists);
- if (LinkBootNext != NULL) {
- //
- // Reserve the boot next option
- //
- InsertTailList (&BootLists, LinkBootNext);
- }
-
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
- }
- }
-
-}
-
-/**
-
- 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.
-
-**/
-VOID
-BdsFormalizeConsoleVariable (
- IN CHAR16 *VariableName
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINTN VariableSize;
- EFI_STATUS Status;
-
- DevicePath = BdsLibGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) {
- Status = gRT->SetVariable (
- VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- NULL
- );
- //
- // Deleting variable with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-/**
-
- Formalize Bds global variables.
-
- 1. For ConIn/ConOut/ConErr, if found the device path is not a valid device path, remove the variable.
- 2. For OsIndicationsSupported, Create a BS/RT/UINT64 variable to report caps
- 3. Delete OsIndications variable if it is not NV/BS/RT UINT64
- Item 3 is used to solve case when OS corrupts OsIndications. Here simply delete this NV variable.
-
-**/
-VOID
-BdsFormalizeEfiGlobalVariable (
- VOID
- )
-{
- EFI_STATUS Status;
- UINT64 OsIndicationSupport;
- UINT64 OsIndication;
- UINTN DataSize;
- UINT32 Attributes;
-
- //
- // Validate Console variable.
- //
- BdsFormalizeConsoleVariable (L"ConIn");
- BdsFormalizeConsoleVariable (L"ConOut");
- BdsFormalizeConsoleVariable (L"ErrOut");
-
- //
- // OS indicater support variable
- //
- OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI \
- | EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED;
-
- BdsDxeSetVariableAndReportStatusCodeOnError (
- L"OsIndicationsSupported",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(UINT64),
- &OsIndicationSupport
- );
-
- //
- // If OsIndications is invalid, remove it.
- // Invalid case
- // 1. Data size != UINT64
- // 2. OsIndication value inconsistence
- // 3. OsIndication attribute inconsistence
- //
- OsIndication = 0;
- Attributes = 0;
- DataSize = sizeof(UINT64);
- Status = gRT->GetVariable (
- L"OsIndications",
- &gEfiGlobalVariableGuid,
- &Attributes,
- &DataSize,
- &OsIndication
- );
-
- if (!EFI_ERROR(Status)) {
- if (DataSize != sizeof(UINT64) ||
- (OsIndication & ~OsIndicationSupport) != 0 ||
- Attributes != (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE)){
-
- DEBUG ((EFI_D_ERROR, "Unformalized OsIndications variable exists. Delete it\n"));
- Status = gRT->SetVariable (
- L"OsIndications",
- &gEfiGlobalVariableGuid,
- 0,
- 0,
- NULL
- );
- //
- // Deleting variable with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
- }
-
-}
-
-/**
-
- Allocate a block of memory that will contain performance data to OS.
-
-**/
-VOID
-BdsAllocateMemoryForPerformanceData (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase;
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
-
- AcpiLowMemoryBase = 0x0FFFFFFFFULL;
-
- //
- // Allocate a block of memory that will contain performance data to OS.
- //
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- EFI_SIZE_TO_PAGES (PERF_DATA_MAX_LENGTH),
- &AcpiLowMemoryBase
- );
- if (!EFI_ERROR (Status)) {
- //
- // Save the pointer to variable for use in S3 resume.
- //
- BdsDxeSetVariableAndReportStatusCodeOnError (
- L"PerfDataMemAddr",
- &gPerformanceProtocolGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (EFI_PHYSICAL_ADDRESS),
- &AcpiLowMemoryBase
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "[Bds] PerfDataMemAddr (%08x) cannot be saved to NV storage.\n", AcpiLowMemoryBase));
- }
- //
- // Mark L"PerfDataMemAddr" variable to read-only if the Variable Lock protocol exists
- // Still lock it even the variable cannot be saved to prevent it's set by 3rd party code.
- //
- Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
- if (!EFI_ERROR (Status)) {
- Status = VariableLock->RequestToLock (VariableLock, L"PerfDataMemAddr", &gPerformanceProtocolGuid);
- ASSERT_EFI_ERROR (Status);
- }
- }
-}
-
-/**
-
- Service routine for BdsInstance->Entry(). Devices are connected, the
- consoles are initialized, and the boot options are tried.
-
- @param This Protocol Instance structure.
-
-**/
-VOID
-EFIAPI
-BdsEntry (
- IN EFI_BDS_ARCH_PROTOCOL *This
- )
-{
- LIST_ENTRY DriverOptionList;
- LIST_ENTRY BootOptionList;
- UINTN BootNextSize;
- CHAR16 *FirmwareVendor;
- EFI_STATUS Status;
- UINT16 BootTimeOut;
- UINTN Index;
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
-
- //
- // Insert the performance probe
- //
- PERF_END (NULL, "DXE", NULL, 0);
- PERF_START (NULL, "BDS", NULL, 0);
-
- PERF_CODE (
- BdsAllocateMemoryForPerformanceData ();
- );
-
- //
- // Initialize the global system boot option and driver option
- //
- InitializeListHead (&DriverOptionList);
- InitializeListHead (&BootOptionList);
-
- //
- // Initialize hotkey service
- //
- InitializeHotkeyService ();
-
- //
- // Fill in FirmwareVendor and FirmwareRevision from PCDs
- //
- FirmwareVendor = (CHAR16 *)PcdGetPtr (PcdFirmwareVendor);
- gST->FirmwareVendor = AllocateRuntimeCopyPool (StrSize (FirmwareVendor), FirmwareVendor);
- ASSERT (gST->FirmwareVendor != NULL);
- gST->FirmwareRevision = PcdGet32 (PcdFirmwareRevision);
-
- //
- // Fixup Tasble CRC after we updated Firmware Vendor and Revision
- //
- gST->Hdr.CRC32 = 0;
- gBS->CalculateCrc32 ((VOID *)gST, sizeof(EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);
-
- //
- // Validate Variable.
- //
- BdsFormalizeEfiGlobalVariable();
-
- //
- // Mark the read-only variables if the Variable Lock protocol exists
- //
- 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++) {
- Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
- ASSERT_EFI_ERROR (Status);
- }
- }
-
- //
- // Report Status Code to indicate connecting drivers will happen
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS)
- );
-
- InitializeHwErrRecSupport();
-
- //
- // Initialize L"Timeout" EFI global variable.
- //
- BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
- if (BootTimeOut != 0xFFFF) {
- //
- // If time out value equal 0xFFFF, no need set to 0xFFFF to variable area because UEFI specification
- // define same behavior between no value or 0xFFFF value for L"Timeout".
- //
- BdsDxeSetVariableAndReportStatusCodeOnError (
- L"Timeout",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT16),
- &BootTimeOut
- );
- }
-
- //
- // bugbug: platform specific code
- // Initialize the platform specific string and language
- //
- InitializeStringSupport ();
- InitializeLanguage (TRUE);
- InitializeFrontPage (TRUE);
-
- //
- // Do the platform init, can be customized by OEM/IBV
- //
- PERF_START (NULL, "PlatformBds", "BDS", 0);
- PlatformBdsInit ();
-
- //
- // Set up the device list based on EFI 1.1 variables
- // process Driver#### and Load the driver's in the
- // driver option list
- //
- BdsLibBuildOptionFromVar (&DriverOptionList, L"DriverOrder");
- if (!IsListEmpty (&DriverOptionList)) {
- BdsLibLoadDrivers (&DriverOptionList);
- }
- //
- // Check if we have the boot next option
- //
- mBootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- //
- // Setup some platform policy here
- //
- PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, BdsProcessCapsules, BdsMemoryTest);
- PERF_END (NULL, "PlatformBds", "BDS", 0);
-
- //
- // BDS select the boot device to load OS
- //
- BdsBootDeviceSelect ();
-
- //
- // Only assert here since this is the right behavior, we should never
- // return back to DxeCore.
- //
- ASSERT (FALSE);
-
- return ;
-}
-
-
-/**
- Set the variable and report the error through status code upon failure.
-
- @param VariableName A Null-terminated string that is the name of the vendor's variable.
- Each VariableName is unique for each VendorGuid. VariableName must
- contain 1 or more characters. If VariableName is an empty string,
- then EFI_INVALID_PARAMETER is returned.
- @param VendorGuid A unique identifier for the vendor.
- @param Attributes Attributes bitmask to set for the variable.
- @param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
- EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
- EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
- causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
- set, then a SetVariable() call with a DataSize of zero will not cause any change to
- the variable value (the timestamp associated with the variable may be updated however
- even if no new data value is provided,see the description of the
- EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
- be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
- @param Data The contents for the variable.
-
- @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
- defined by the Attributes.
- @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
- DataSize exceeds the maximum allowed.
- @retval EFI_INVALID_PARAMETER VariableName is an empty string.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
- @retval EFI_WRITE_PROTECTED The variable in question is read-only.
- @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
- @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
- or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
- does NOT pass the validation check carried out by the firmware.
-
- @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
-**/
-EFI_STATUS
-BdsDxeSetVariableAndReportStatusCodeOnError (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- )
-{
- EFI_STATUS Status;
- EDKII_SET_VARIABLE_STATUS *SetVariableStatus;
- UINTN NameSize;
-
- Status = gRT->SetVariable (
- VariableName,
- VendorGuid,
- Attributes,
- DataSize,
- Data
- );
- if (EFI_ERROR (Status)) {
- NameSize = StrSize (VariableName);
- SetVariableStatus = AllocatePool (sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize);
- if (SetVariableStatus != NULL) {
- CopyGuid (&SetVariableStatus->Guid, VendorGuid);
- SetVariableStatus->NameSize = NameSize;
- SetVariableStatus->DataSize = DataSize;
- SetVariableStatus->SetStatus = Status;
- SetVariableStatus->Attributes = Attributes;
- CopyMem (SetVariableStatus + 1, VariableName, NameSize);
- CopyMem (((UINT8 *) (SetVariableStatus + 1)) + NameSize, Data, DataSize);
-
- REPORT_STATUS_CODE_EX (
- EFI_ERROR_CODE,
- PcdGet32 (PcdErrorCodeSetVariable),
- 0,
- NULL,
- &gEdkiiStatusCodeDataTypeVariableGuid,
- SetVariableStatus,
- sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize
- );
-
- FreePool (SetVariableStatus);
- }
- }
-
- return Status;
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
deleted file mode 100644
index 6a0b525f15..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/** @file
- This function deal with the legacy boot option, it create, delete
- and manage the legacy boot option, all legacy boot option is getting from
- the legacy BBS table.
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "BBSsupport.h"
-
-#pragma pack(1)
-typedef struct {
- BBS_TABLE BbsEntry;
- UINT16 BbsIndex;
-} LEGACY_BOOT_OPTION_BBS_DATA;
-#pragma pack()
-
-/**
- Re-order the Boot Option according to the DevOrder.
-
- The routine re-orders the Boot Option in BootOption array according to
- the order specified by DevOrder.
-
- @param DevOrder Pointer to buffer containing the BBS Index,
- high 8-bit value 0xFF indicating a disabled boot option
- @param DevOrderCount Count of the BBS Index
- @param EnBootOption Callee allocated buffer containing the enabled Boot Option Numbers
- @param EnBootOptionCount Count of the enabled Boot Option Numbers
- @param DisBootOption Callee allocated buffer containing the disabled Boot Option Numbers
- @param DisBootOptionCount Count of the disabled Boot Option Numbers
-**/
-VOID
-OrderLegacyBootOption4SameType (
- UINT16 *DevOrder,
- UINTN DevOrderCount,
- UINT16 **EnBootOption,
- UINTN *EnBootOptionCount,
- UINT16 **DisBootOption,
- UINTN *DisBootOptionCount
- )
-{
- EFI_STATUS Status;
- UINT16 *NewBootOption;
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- UINTN Index;
- UINTN StartPosition;
-
- BDS_COMMON_OPTION *BootOption;
-
- CHAR16 OptionName[sizeof ("Boot####")];
- UINT16 *BbsIndexArray;
- UINT16 *DeviceTypeArray;
- LIST_ENTRY List;
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- ASSERT (BootOrder != NULL);
-
- BbsIndexArray = AllocatePool (BootOrderSize);
- DeviceTypeArray = AllocatePool (BootOrderSize);
- *EnBootOption = AllocatePool (BootOrderSize);
- *DisBootOption = AllocatePool (BootOrderSize);
- *DisBootOptionCount = 0;
- *EnBootOptionCount = 0;
- Index = 0;
-
- ASSERT (BbsIndexArray != NULL);
- ASSERT (DeviceTypeArray != NULL);
- ASSERT (*EnBootOption != NULL);
- ASSERT (*DisBootOption != NULL);
-
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
-
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]);
- InitializeListHead (&List);
- BootOption = BdsLibVariableToOption (&List, OptionName);
- ASSERT (BootOption != NULL);
-
- if ((DevicePathType (BootOption->DevicePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (BootOption->DevicePath) == BBS_BBS_DP)) {
- //
- // Legacy Boot Option
- //
- ASSERT (BootOption->LoadOptionsSize == sizeof (LEGACY_BOOT_OPTION_BBS_DATA));
-
- DeviceTypeArray[Index] = ((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType;
- BbsIndexArray [Index] = ((LEGACY_BOOT_OPTION_BBS_DATA *) BootOption->LoadOptions)->BbsIndex;
- } else {
- DeviceTypeArray[Index] = BBS_TYPE_UNKNOWN;
- BbsIndexArray [Index] = 0xFFFF;
- }
- FreePool (BootOption->DevicePath);
- FreePool (BootOption->Description);
- FreePool (BootOption->LoadOptions);
- FreePool (BootOption);
- }
-
- //
- // Record the corresponding Boot Option Numbers according to the DevOrder
- // Record the EnBootOption and DisBootOption according to the DevOrder
- //
- StartPosition = BootOrderSize / sizeof (UINT16);
- NewBootOption = AllocatePool (DevOrderCount * sizeof (UINT16));
- ASSERT (NewBootOption != NULL);
- while (DevOrderCount-- != 0) {
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
- if (BbsIndexArray[Index] == (DevOrder[DevOrderCount] & 0xFF)) {
- StartPosition = MIN (StartPosition, Index);
- NewBootOption[DevOrderCount] = BootOrder[Index];
-
- if ((DevOrder[DevOrderCount] & 0xFF00) == 0xFF00) {
- (*DisBootOption)[*DisBootOptionCount] = BootOrder[Index];
- (*DisBootOptionCount)++;
- } else {
- (*EnBootOption)[*EnBootOptionCount] = BootOrder[Index];
- (*EnBootOptionCount)++;
- }
- break;
- }
- }
- }
-
- //
- // Overwrite the old BootOption
- //
- CopyMem (&BootOrder[StartPosition], NewBootOption, (*DisBootOptionCount + *EnBootOptionCount) * sizeof (UINT16));
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BootOrderSize,
- BootOrder
- );
- //
- // Changing content without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
-
- FreePool (NewBootOption);
- FreePool (DeviceTypeArray);
- FreePool (BbsIndexArray);
- FreePool (BootOrder);
-}
-
-/**
- Group the legacy boot options in the BootOption.
-
- The routine assumes the boot options in the beginning that covers all the device
- types are ordered properly and re-position the following boot options just after
- the corresponding boot options with the same device type.
- For example:
- 1. Input = [Harddisk1 CdRom2 Efi1 Harddisk0 CdRom0 CdRom1 Harddisk2 Efi0]
- Assuming [Harddisk1 CdRom2 Efi1] is ordered properly
- Output = [Harddisk1 Harddisk0 Harddisk2 CdRom2 CdRom0 CdRom1 Efi1 Efi0]
-
- 2. Input = [Efi1 Efi0 CdRom1 Harddisk0 Harddisk1 Harddisk2 CdRom0 CdRom2]
- Assuming [Efi1 Efi0 CdRom1 Harddisk0] is ordered properly
- Output = [Efi1 Efi0 CdRom1 CdRom0 CdRom2 Harddisk0 Harddisk1 Harddisk2]
-
-**/
-VOID
-GroupMultipleLegacyBootOption4SameType (
- VOID
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- UINTN DeviceIndex;
- UINTN DeviceTypeIndex[7];
- UINTN *NextIndex;
- UINT16 OptionNumber;
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- CHAR16 OptionName[sizeof ("Boot####")];
- BDS_COMMON_OPTION *BootOption;
- LIST_ENTRY List;
-
- SetMem (DeviceTypeIndex, sizeof (DeviceTypeIndex), 0xff);
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
-
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]);
- InitializeListHead (&List);
- BootOption = BdsLibVariableToOption (&List, OptionName);
- ASSERT (BootOption != NULL);
-
- if ((DevicePathType (BootOption->DevicePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (BootOption->DevicePath) == BBS_BBS_DP)) {
- //
- // Legacy Boot Option
- //
- ASSERT ((((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF) < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]));
- NextIndex = &DeviceTypeIndex[((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF];
-
- if (*NextIndex == (UINTN) -1) {
- //
- // *NextIndex is the Index in BootOrder to put the next Option Number for the same type
- //
- *NextIndex = Index + 1;
- } else {
- //
- // insert the current boot option before *NextIndex, causing [*Next .. Index] shift right one position
- //
- OptionNumber = BootOrder[Index];
- CopyMem (&BootOrder[*NextIndex + 1], &BootOrder[*NextIndex], (Index - *NextIndex) * sizeof (UINT16));
- BootOrder[*NextIndex] = OptionNumber;
-
- //
- // Update the DeviceTypeIndex array to reflect the right shift operation
- //
- for (DeviceIndex = 0; DeviceIndex < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]); DeviceIndex++) {
- if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && DeviceTypeIndex[DeviceIndex] >= *NextIndex) {
- DeviceTypeIndex[DeviceIndex]++;
- }
- }
- }
- }
- FreePool (BootOption->DevicePath);
- FreePool (BootOption->Description);
- FreePool (BootOption->LoadOptions);
- FreePool (BootOption);
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BootOrderSize,
- BootOrder
- );
- //
- // Changing content without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- FreePool (BootOrder);
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.h b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.h
deleted file mode 100644
index e73dc85995..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/** @file
- declares interface functions
-
-Copyright (c) 2004 - 2012, 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.
-
-**/
-
-#ifndef _EFI_BDS_BBS_SUPPORT_H_
-#define _EFI_BDS_BBS_SUPPORT_H_
-
-#include "BootMaint.h"
-
-/**
- Build Legacy Device Name String according.
-
- @param CurBBSEntry BBS Table.
- @param Index Index.
- @param BufSize The buffer size.
- @param BootString The output string.
-
- @return VOID No output.
-
-**/
-VOID
-BdsBuildLegacyDevNameString (
- IN BBS_TABLE *CurBBSEntry,
- IN UINTN Index,
- IN UINTN BufSize,
- OUT CHAR16 *BootString
- );
-
-/**
- Group the legacy boot options in the BootOption.
-
- The routine assumes the boot options in the beginning that covers all the device
- types are ordered properly and re-position the following boot options just after
- the corresponding boot options with the same device type.
- For example:
- 1. Input = [Harddisk1 CdRom2 Efi1 Harddisk0 CdRom0 CdRom1 Harddisk2 Efi0]
- Assuming [Harddisk1 CdRom2 Efi1] is ordered properly
- Output = [Harddisk1 Harddisk0 Harddisk2 CdRom2 CdRom0 CdRom1 Efi1 Efi0]
-
- 2. Input = [Efi1 Efi0 CdRom1 Harddisk0 Harddisk1 Harddisk2 CdRom0 CdRom2]
- Assuming [Efi1 Efi0 CdRom1 Harddisk0] is ordered properly
- Output = [Efi1 Efi0 CdRom1 CdRom0 CdRom2 Harddisk0 Harddisk1 Harddisk2]
-**/
-VOID
-GroupMultipleLegacyBootOption4SameType (
- VOID
- );
-
-/**
- Re-order the Boot Option according to the DevOrder.
-
- The routine re-orders the Boot Option in BootOption array according to
- the order specified by DevOrder.
-
- @param DevOrder Pointer to buffer containing the BBS Index,
- high 8-bit value 0xFF indicating a disabled boot option
- @param DevOrderCount Count of the BBS Index
- @param EnBootOption Callee allocated buffer containing the enabled Boot Option Numbers
- @param EnBootOptionCount Count of the enabled Boot Option Numbers
- @param DisBootOption Callee allocated buffer containing the disabled Boot Option Numbers
- @param DisBootOptionCount Count of the disabled Boot Option Numbers
-**/
-VOID
-OrderLegacyBootOption4SameType (
- UINT16 *DevOrder,
- UINTN DevOrderCount,
- UINT16 **EnBootOption,
- UINTN *EnBootOptionCount,
- UINT16 **DisBootOption,
- UINTN *DisBootOptionCount
- );
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bm.vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bm.vfr
deleted file mode 100644
index 0d35c2c37e..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bm.vfr
+++ /dev/null
@@ -1,365 +0,0 @@
-///** @file
-//
-// Boot Maintenance Utility Formset
-//
-// Copyright (c) 2004 - 2010, 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.
-//
-//**/
-
-#include "FormGuid.h"
-
-formset
- guid = BOOT_MAINT_FORMSET_GUID,
- title = STRING_TOKEN(STR_FORM_MAIN_TITLE),
- help = STRING_TOKEN(STR_NULL_STRING),
- classguid = BOOT_MAINT_FORMSET_GUID,
-
- varstore BMM_FAKE_NV_DATA,
- varid = VARSTORE_ID_BOOT_MAINT,
- name = BmmData,
- guid = BOOT_MAINT_FORMSET_GUID;
-
- form formid = FORM_MAIN_ID,
- title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
-
- goto FORM_BOOT_SETUP_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_SETUP_HELP),
- flags = INTERACTIVE,
- key = FORM_BOOT_SETUP_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_DRIVER_SETUP_ID,
- prompt = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE),
- help = STRING_TOKEN(STR_FORM_DRIVER_SETUP_HELP),
- flags = INTERACTIVE,
- key = FORM_DRIVER_SETUP_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_CON_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_MAIN_HELP),
- flags = INTERACTIVE,
- key = FORM_CON_MAIN_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_BOOT_FROM_FILE_ID,
- prompt = STRING_TOKEN(STR_BOOT_FROM_FILE),
- help = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),
- flags = INTERACTIVE,
- key = KEY_VALUE_BOOT_FROM_FILE;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-// label FORM_MAIN_ID;
-
- goto FORM_BOOT_NEXT_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_NEXT_HELP),
- flags = INTERACTIVE,
- key = FORM_BOOT_NEXT_ID;
-
- goto FORM_TIME_OUT_ID,
- prompt = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE),
- help = STRING_TOKEN(STR_FORM_TIME_OUT_HELP),
- flags = INTERACTIVE,
- key = FORM_TIME_OUT_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- text
- help = STRING_TOKEN(STR_RESET),
- text = STRING_TOKEN(STR_RESET),
- flags = INTERACTIVE,
- key = FORM_RESET;
-
- endform;
-
- form formid = FORM_BOOT_SETUP_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN);
- //flags = INTERACTIVE,
- //key = FORM_MAIN_ID;
-
- goto FORM_BOOT_ADD_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_ADD_HELP),
- flags = INTERACTIVE,
- key = FORM_BOOT_ADD_ID;
-
- goto FORM_BOOT_DEL_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_IMMEDIATE_HELP),
- flags = INTERACTIVE,
- key = FORM_BOOT_DEL_ID;
-
- goto FORM_BOOT_CHG_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_IMMEDIATE_HELP),
- flags = INTERACTIVE,
- key = FORM_BOOT_CHG_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
- //
- // We will add "Select Legacy Boot Floppy Drive" and "Select Legacy Boot Hard Drive"
- // here dynamically
- //
- label FORM_BOOT_LEGACY_DEVICE_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_DRIVER_SETUP_ID,
- title = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN);
- //help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- //flags = INTERACTIVE,
- //key = FORM_MAIN_ID;
-
- goto FORM_DRV_ADD_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_ADD_HELP),
- flags = INTERACTIVE,
- key = FORM_DRV_ADD_ID;
-
- goto FORM_DRV_DEL_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE,
- key = FORM_DRV_DEL_ID;
-
- goto FORM_DRV_CHG_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE,
- key = FORM_DRV_CHG_ID;
- endform;
-
- form formid = FORM_BOOT_DEL_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE);
-
- label FORM_BOOT_DEL_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_BOOT_CHG_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
-
- label FORM_BOOT_CHG_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_BOOT_NEXT_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE);
-
- label FORM_BOOT_NEXT_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_TIME_OUT_ID,
- title = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE);
-
- label FORM_TIME_OUT_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_DRV_ADD_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN);
- //flags = INTERACTIVE,
- //key = FORM_MAIN_ID;
-
- goto FORM_DRV_ADD_FILE_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
- flags = INTERACTIVE,
- key = FORM_DRV_ADD_FILE_ID;
-
- endform;
-
- form formid = FORM_DRV_DEL_ID,
- title = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE);
-
- label FORM_DRV_DEL_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_DRV_CHG_ID,
- title = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE);
-
- label FORM_DRV_CHG_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_CON_MAIN_ID,
- title = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN);
- //flags = INTERACTIVE,
- //key = FORM_MAIN_ID;
-
- goto FORM_CON_IN_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_IN_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_IN_HELP),
- flags = INTERACTIVE,
- key = FORM_CON_IN_ID;
-
- goto FORM_CON_OUT_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_OUT_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_OUT_HELP),
- flags = INTERACTIVE,
- key = FORM_CON_OUT_ID;
-
- goto FORM_CON_ERR_ID,
- prompt = STRING_TOKEN(STR_FORM_STD_ERR_TITLE),
- help = STRING_TOKEN(STR_FORM_STD_ERR_HELP),
- flags = INTERACTIVE,
- key = FORM_CON_ERR_ID;
-
- goto FORM_CON_MODE_ID,
- prompt = STRING_TOKEN(STR_FORM_MODE_TITLE),
- help = STRING_TOKEN(STR_FORM_MODE_HELP),
- flags = INTERACTIVE,
- key = FORM_CON_MODE_ID;
-
- goto FORM_CON_COM_ID,
- prompt = STRING_TOKEN(STR_FORM_COM_TITLE),
- help = STRING_TOKEN(STR_FORM_COM_HELP),
- flags = INTERACTIVE,
- key = FORM_CON_COM_ID;
- endform;
-
- form formid = FORM_CON_MODE_ID,
- title = STRING_TOKEN(STR_FORM_MODE_TITLE);
-
- label FORM_CON_MODE_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_CON_COM_ID,
- title = STRING_TOKEN(STR_FORM_COM_TITLE);
-
- label FORM_CON_COM_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_CON_COM_SETUP_ID,
- title = STRING_TOKEN(STR_CON_COM_SETUP);
-
- label FORM_CON_COM_SETUP_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_FILE_SEEK_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_FILE_SEEK_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_FILE_NEW_SEEK_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_FILE_NEW_SEEK_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_DRV_ADD_HANDLE_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_HANDLE_TITLE);
-
- label FORM_DRV_ADD_HANDLE_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_DRV_ADD_HANDLE_DESC_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
-
- label FORM_DRV_ADD_HANDLE_DESC_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_CON_IN_ID,
- title = STRING_TOKEN(STR_FORM_CON_IN_TITLE);
-
- label FORM_CON_IN_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_CON_OUT_ID,
- title = STRING_TOKEN(STR_FORM_CON_OUT_TITLE);
-
- label FORM_CON_OUT_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_CON_ERR_ID,
- title = STRING_TOKEN(STR_FORM_STD_ERR_TITLE);
-
- label FORM_CON_ERR_ID;
- label LABEL_END;
-
- endform;
-
- form formid = FORM_SET_FD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_FD_ORDER_TITLE);
-
- label FORM_SET_FD_ORDER_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_SET_HD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_HD_ORDER_TITLE);
-
- label FORM_SET_HD_ORDER_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_SET_CD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_CD_ORDER_TITLE);
-
- label FORM_SET_CD_ORDER_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_SET_NET_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_NET_ORDER_TITLE);
-
- label FORM_SET_NET_ORDER_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_SET_BEV_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_BEV_ORDER_TITLE);
-
- label FORM_SET_BEV_ORDER_ID;
- label LABEL_END;
- endform;
-
-endformset;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
deleted file mode 100644
index 4424831859..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/** @file
- Utility routines used by boot maintenance modules.
-
-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.
-
-**/
-
-#include "BootMaint.h"
-
-/**
-
- Function opens and returns a file handle to the root directory of a volume.
-
- @param DeviceHandle A handle for a device
-
- @return A valid file handle or NULL is returned
-
-**/
-EFI_FILE_HANDLE
-EfiLibOpenRoot (
- IN EFI_HANDLE DeviceHandle
- )
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
- EFI_FILE_HANDLE File;
-
- File = NULL;
-
- //
- // File the file system interface to the device
- //
- Status = gBS->HandleProtocol (
- DeviceHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID *) &Volume
- );
-
- //
- // Open the root directory of the volume
- //
- if (!EFI_ERROR (Status)) {
- Status = Volume->OpenVolume (
- Volume,
- &File
- );
- }
- //
- // Done
- //
- return EFI_ERROR (Status) ? NULL : File;
-}
-
-/**
-
- Helper function called as part of the code needed
- to allocate the proper sized buffer for various
- EFI interfaces.
-
-
- @param Status Current status
- @param Buffer Current allocated buffer, or NULL
- @param BufferSize Current buffer size needed
-
- @retval TRUE if the buffer was reallocated and the caller
- should try the API again.
- @retval FALSE The caller should not call this function again.
-
-**/
-BOOLEAN
-EfiGrowBuffer (
- IN OUT EFI_STATUS *Status,
- IN OUT VOID **Buffer,
- IN UINTN BufferSize
- )
-{
- BOOLEAN TryAgain;
-
- //
- // If this is an initial request, buffer will be null with a new buffer size
- //
- if ((*Buffer == NULL) && (BufferSize != 0)) {
- *Status = EFI_BUFFER_TOO_SMALL;
- }
- //
- // If the status code is "buffer too small", resize the buffer
- //
- TryAgain = FALSE;
- if (*Status == EFI_BUFFER_TOO_SMALL) {
-
- if (*Buffer != NULL) {
- FreePool (*Buffer);
- }
-
- *Buffer = AllocateZeroPool (BufferSize);
-
- if (*Buffer != NULL) {
- TryAgain = TRUE;
- } else {
- *Status = EFI_OUT_OF_RESOURCES;
- }
- }
- //
- // If there's an error, free the buffer
- //
- if (!TryAgain && EFI_ERROR (*Status) && (*Buffer != NULL)) {
- FreePool (*Buffer);
- *Buffer = NULL;
- }
-
- return TryAgain;
-}
-
-/**
- Function returns the value of the specified variable.
-
-
- @param Name A Null-terminated Unicode string that is
- the name of the vendor's variable.
- @param VendorGuid A unique identifier for the vendor.
-
- @return The payload of the variable.
- @retval NULL If the variable can't be read.
-
-**/
-VOID *
-EfiLibGetVariable (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid
- )
-{
- UINTN VarSize;
-
- return BdsLibGetVariableAndSize (Name, VendorGuid, &VarSize);
-}
-
-/**
- Function deletes the variable specified by VarName and VarGuid.
-
- @param VarName A Null-terminated Unicode string that is
- the name of the vendor's variable.
-
- @param VarGuid A unique identifier for the vendor.
-
- @retval EFI_SUCCESS The variable was found and removed
- @retval EFI_UNSUPPORTED The variable store was inaccessible
- @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available
- @retval EFI_NOT_FOUND The variable was not found
-
-**/
-EFI_STATUS
-EfiLibDeleteVariable (
- IN CHAR16 *VarName,
- IN EFI_GUID *VarGuid
- )
-{
- VOID *VarBuf;
- EFI_STATUS Status;
-
- VarBuf = EfiLibGetVariable (VarName, VarGuid);
- Status = EFI_NOT_FOUND;
-
- if (VarBuf != NULL) {
- //
- // Delete variable from Storage
- //
- Status = gRT->SetVariable (
- VarName,
- VarGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- NULL
- );
- //
- // Deleting variable with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- FreePool (VarBuf);
- }
-
- return Status;
-}
-
-/**
-
- Function gets the file system information from an open file descriptor,
- and stores it in a buffer allocated from pool.
-
-
- @param FHand The file handle.
-
- @return A pointer to a buffer with file information.
- @retval NULL is returned if failed to get Vaolume Label Info.
-
-**/
-EFI_FILE_SYSTEM_VOLUME_LABEL *
-EfiLibFileSystemVolumeLabelInfo (
- IN EFI_FILE_HANDLE FHand
- )
-{
- EFI_STATUS Status;
- EFI_FILE_SYSTEM_VOLUME_LABEL *Buffer;
- UINTN BufferSize;
- //
- // Initialize for GrowBuffer loop
- //
- Buffer = NULL;
- BufferSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL + 200;
-
- //
- // Call the real function
- //
- while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
- Status = FHand->GetInfo (
- FHand,
- &gEfiFileSystemVolumeLabelInfoIdGuid,
- &BufferSize,
- Buffer
- );
- }
-
- return Buffer;
-}
-
-/**
- Duplicate a string.
-
- @param Src The source.
-
- @return A new string which is duplicated copy of the source.
- @retval NULL If there is not enough memory.
-
-**/
-CHAR16 *
-EfiStrDuplicate (
- IN CHAR16 *Src
- )
-{
- CHAR16 *Dest;
- UINTN Size;
-
- Size = StrSize (Src);
- Dest = AllocateZeroPool (Size);
- ASSERT (Dest != NULL);
- if (Dest != NULL) {
- CopyMem (Dest, Src, Size);
- }
-
- return Dest;
-}
-
-/**
-
- Function gets the file information from an open file descriptor, and stores it
- in a buffer allocated from pool.
-
- @param FHand File Handle.
-
- @return A pointer to a buffer with file information or NULL is returned
-
-**/
-EFI_FILE_INFO *
-EfiLibFileInfo (
- IN EFI_FILE_HANDLE FHand
- )
-{
- EFI_STATUS Status;
- EFI_FILE_INFO *Buffer;
- UINTN BufferSize;
-
- //
- // Initialize for GrowBuffer loop
- //
- Buffer = NULL;
- BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
-
- //
- // Call the real function
- //
- while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
- Status = FHand->GetInfo (
- FHand,
- &gEfiFileInfoGuid,
- &BufferSize,
- Buffer
- );
- }
-
- return Buffer;
-}
-
-/**
- Function is used to determine the number of device path instances
- that exist in a device path.
-
-
- @param DevicePath A pointer to a device path data structure.
-
- @return This function counts and returns the number of device path instances
- in DevicePath.
-
-**/
-UINTN
-EfiDevicePathInstanceCount (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- UINTN Count;
- UINTN Size;
-
- Count = 0;
- while (GetNextDevicePathInstance (&DevicePath, &Size) != NULL) {
- Count += 1;
- }
-
- return Count;
-}
-
-/**
- Adjusts the size of a previously allocated buffer.
-
-
- @param OldPool - A pointer to the buffer whose size is being adjusted.
- @param OldSize - The size of the current buffer.
- @param NewSize - The size of the new buffer.
-
- @return The newly allocated buffer.
- @retval NULL Allocation failed.
-
-**/
-VOID *
-EfiReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- )
-{
- VOID *NewPool;
-
- NewPool = NULL;
- if (NewSize != 0) {
- NewPool = AllocateZeroPool (NewSize);
- }
-
- if (OldPool != NULL) {
- if (NewPool != NULL) {
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
- }
-
- FreePool (OldPool);
- }
-
- return NewPool;
-}
-
-/**
- Get a string from the Data Hub record based on
- a device path.
-
- @param DevPath The device Path.
-
- @return A string located from the Data Hub records based on
- the device path.
- @retval NULL If failed to get the String from Data Hub.
-
-**/
-UINT16 *
-EfiLibStrFromDatahub (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-{
- return NULL;
-}
-
-/**
-
- Find the first instance of this Protocol
- in the system and return it's interface.
-
-
- @param ProtocolGuid Provides the protocol to search for
- @param Interface On return, a pointer to the first interface
- that matches ProtocolGuid
-
- @retval EFI_SUCCESS A protocol instance matching ProtocolGuid was found
- @retval EFI_NOT_FOUND No protocol instances were found that match ProtocolGuid
-
-**/
-EFI_STATUS
-EfiLibLocateProtocol (
- IN EFI_GUID *ProtocolGuid,
- OUT VOID **Interface
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- ProtocolGuid,
- NULL,
- (VOID **) Interface
- );
- return Status;
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bmstring.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bmstring.uni
deleted file mode 100644
index b0aabc3b11..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Bmstring.uni
+++ /dev/null
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
deleted file mode 100644
index d4b4475f09..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
+++ /dev/null
@@ -1,1690 +0,0 @@
-/** @file
- The functions for Boot Maintainence Main menu.
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "BootMaint.h"
-#include "FormGuid.h"
-#include "Bds.h"
-#include "FrontPage.h"
-
-EFI_DEVICE_PATH_PROTOCOL EndDevicePath[] = {
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- END_DEVICE_PATH_LENGTH,
- 0
- }
- }
-};
-
-HII_VENDOR_DEVICE_PATH mBmmHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- BOOT_MAINT_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-HII_VENDOR_DEVICE_PATH mFeHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- FILE_EXPLORE_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-CHAR16 mBootMaintStorageName[] = L"BmmData";
-CHAR16 mFileExplorerStorageName[] = L"FeData";
-BMM_CALLBACK_DATA *mBmmCallbackInfo = NULL;
-
-/**
- Init all memu.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-InitAllMenu (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Free up all Menu Option list.
-
-**/
-VOID
-FreeAllMenu (
- VOID
- );
-
-/**
- Initialize all of BMM configuration data in BmmFakeNvData and BmmOldFakeNVData member
- in BMM context data and create all of dynamic OP code for BMM.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-InitializeBmmConfig (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
-
- ASSERT (CallbackData != NULL);
-
- //
- // Initialize data which located in BMM main page
- //
- CallbackData->BmmFakeNvData.BootNext = (UINT16) (BootOptionMenu.MenuNumber);
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewLoadContext->IsBootNext) {
- CallbackData->BmmFakeNvData.BootNext = Index;
- break;
- }
- }
-
- CallbackData->BmmFakeNvData.BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
-
- //
- // Initialize data which located in Boot Options Menu
- //
- GetBootOrder (CallbackData);
- GetLegacyDeviceOrder (CallbackData);
-
- //
- // Initialize data which located in Driver Options Menu
- //
- GetDriverOrder (CallbackData);
-
- //
- // Initialize data which located in Console Options Menu
- //
- GetConsoleOutMode (CallbackData);
- GetConsoleInCheck (CallbackData);
- GetConsoleOutCheck (CallbackData);
- GetConsoleErrCheck (CallbackData);
- GetTerminalAttribute (CallbackData);
-
- //
- // Backup Initialize BMM configuartion data to BmmOldFakeNVData
- //
- CopyMem (&CallbackData->BmmOldFakeNVData, &CallbackData->BmmFakeNvData, sizeof (BMM_FAKE_NV_DATA));
-}
-
-/**
- Create string tokens for a menu from its help strings and display strings
-
- @param CallbackData The BMM context data.
- @param HiiHandle Hii Handle of the package to be updated.
- @param MenuOption The Menu whose string tokens need to be created
-
- @retval EFI_SUCCESS String tokens created successfully
- @retval others contain some errors
-**/
-EFI_STATUS
-CreateMenuStringToken (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN BM_MENU_OPTION *MenuOption
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
-
- for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
-
- NewMenuEntry->DisplayStringToken = HiiSetString (
- HiiHandle,
- 0,
- NewMenuEntry->DisplayString,
- NULL
- );
-
- if (NULL == NewMenuEntry->HelpString) {
- NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
- } else {
- NewMenuEntry->HelpStringToken = HiiSetString (
- HiiHandle,
- 0,
- NewMenuEntry->HelpString,
- NULL
- );
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function allows a caller to extract the current configuration for one
- or more named elements from the target driver.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Request A null-terminated Unicode string in <ConfigRequest> format.
- @param Progress On return, points to a character in the Request string.
- Points to the string's null terminator if request was successful.
- Points to the most recent '&' before the first failing name/value
- pair (or the beginning of the string if the failure is in the
- first name/value pair) if the request was not successful.
- @param Results A null-terminated Unicode string in <ConfigAltResp> format which
- has all values filled in for the names in the Request string.
- String to be allocated by the called function.
-
- @retval EFI_SUCCESS The Results is filled with the requested values.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
- @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
-
-**/
-EFI_STATUS
-EFIAPI
-BootMaintExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- BMM_CALLBACK_DATA *Private;
- EFI_STRING ConfigRequestHdr;
- EFI_STRING ConfigRequest;
- BOOLEAN AllocatedRequest;
- UINTN Size;
-
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Progress = Request;
- if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gBootMaintFormSetGuid, mBootMaintStorageName)) {
- return EFI_NOT_FOUND;
- }
-
- ConfigRequestHdr = NULL;
- ConfigRequest = NULL;
- AllocatedRequest = FALSE;
- Size = 0;
-
- Private = BMM_CALLBACK_DATA_FROM_THIS (This);
- //
- // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
- //
- BufferSize = sizeof (BMM_FAKE_NV_DATA);
- ConfigRequest = Request;
- if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
- //
- // Request has no request element, construct full request string.
- // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
- // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
- //
- ConfigRequestHdr = HiiConstructConfigHdr (&gBootMaintFormSetGuid, mBootMaintStorageName, Private->BmmDriverHandle);
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
- ASSERT (ConfigRequest != NULL);
- AllocatedRequest = TRUE;
- UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
- FreePool (ConfigRequestHdr);
- }
-
- Status = gHiiConfigRouting->BlockToConfig (
- gHiiConfigRouting,
- ConfigRequest,
- (UINT8 *) &Private->BmmFakeNvData,
- BufferSize,
- Results,
- Progress
- );
- //
- // Free the allocated config request string.
- //
- if (AllocatedRequest) {
- FreePool (ConfigRequest);
- ConfigRequest = NULL;
- }
- //
- // Set Progress string to the original request string.
- //
- if (Request == NULL) {
- *Progress = NULL;
- } else if (StrStr (Request, L"OFFSET") == NULL) {
- *Progress = Request + StrLen (Request);
- }
-
- return Status;
-}
-
-/**
- This function applies changes in a driver's configuration.
- Input is a Configuration, which has the routing data for this
- driver followed by name / value configuration pairs. The driver
- must apply those pairs to its configurable storage. If the
- driver's configuration is stored in a linear block of data
- and the driver's name / value pairs are in <BlockConfig>
- format, it may use the ConfigToBlock helper function (above) to
- simplify the job. Currently not implemented.
-
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param[in] Configuration A null-terminated Unicode string in
- <ConfigString> format.
- @param[out] Progress A pointer to a string filled in with the
- offset of the most recent '&' before the
- first failing name / value pair (or the
- beginn ing of the string if the failure
- is in the first name / value pair) or
- the terminating NULL if all was
- successful.
-
- @retval EFI_SUCCESS The results have been distributed or are
- awaiting distribution.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
- parts of the results that must be
- stored awaiting possible future
- protocols.
- @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
- Results parameter would result
- in this type of error.
- @retval EFI_NOT_FOUND Target for the specified routing data
- was not found.
-**/
-EFI_STATUS
-EFIAPI
-BootMaintRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
- BMM_FAKE_NV_DATA *NewBmmData;
- BMM_FAKE_NV_DATA *OldBmmData;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
- BOOLEAN TerminalAttChange;
- BMM_CALLBACK_DATA *Private;
-
- if (Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Configuration;
-
- if (Configuration == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check routing data in <ConfigHdr>.
- // Note: there is no name for Name/Value storage, only GUID will be checked
- //
- if (!HiiIsConfigHdrMatch (Configuration, &gBootMaintFormSetGuid, mBootMaintStorageName)) {
- return EFI_NOT_FOUND;
- }
-
- Status = gBS->LocateProtocol (
- &gEfiHiiConfigRoutingProtocolGuid,
- NULL,
- (VOID**) &ConfigRouting
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Private = BMM_CALLBACK_DATA_FROM_THIS (This);
- //
- // Get Buffer Storage data from EFI variable
- //
- BufferSize = sizeof (BMM_FAKE_NV_DATA);
- OldBmmData = &Private->BmmOldFakeNVData;
- NewBmmData = &Private->BmmFakeNvData;
- //
- // Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
- //
- Status = ConfigRouting->ConfigToBlock (
- ConfigRouting,
- Configuration,
- (UINT8 *) NewBmmData,
- &BufferSize,
- Progress
- );
- ASSERT_EFI_ERROR (Status);
- //
- // Compare new and old BMM configuration data and only do action for modified item to
- // avoid setting unnecessary non-volatile variable
- //
-
- //
- // Check data which located in BMM main page and save the settings if need
- //
- if (CompareMem (NewBmmData->LegacyFD, OldBmmData->LegacyFD, sizeof (NewBmmData->LegacyFD)) != 0) {
- Var_UpdateBBSOption (Private, FORM_SET_FD_ORDER_ID);
- }
-
- if (CompareMem (NewBmmData->LegacyHD, OldBmmData->LegacyHD, sizeof (NewBmmData->LegacyHD)) != 0) {
- Var_UpdateBBSOption (Private, FORM_SET_HD_ORDER_ID);
- }
-
- if (CompareMem (NewBmmData->LegacyCD, OldBmmData->LegacyCD, sizeof (NewBmmData->LegacyCD)) != 0) {
- Var_UpdateBBSOption (Private, FORM_SET_CD_ORDER_ID);
- }
-
- if (CompareMem (NewBmmData->LegacyNET, OldBmmData->LegacyNET, sizeof (NewBmmData->LegacyNET)) != 0) {
- Var_UpdateBBSOption (Private, FORM_SET_NET_ORDER_ID);
- }
-
- if (CompareMem (NewBmmData->LegacyBEV, OldBmmData->LegacyBEV, sizeof (NewBmmData->LegacyBEV)) != 0) {
- Var_UpdateBBSOption (Private, FORM_SET_BEV_ORDER_ID);
- }
-
- //
- // Change for "delete boot option" page need update NewBmmData->BootOptionOrder, so process
- // NewBmmData->BootOptionOrder before NewBmmData->BootOptionDel
- //
- if (CompareMem (NewBmmData->BootOptionOrder, OldBmmData->BootOptionOrder, sizeof (NewBmmData->BootOptionOrder)) != 0) {
- Status = Var_UpdateBootOrder (Private);
- }
-
- //
- // Change for "delete driver option" page need update NewBmmData->DriverOptionOrder, so process
- // NewBmmData->DriverOptionOrder before NewBmmData->DriverOptionDel
- //
- if (CompareMem (NewBmmData->DriverOptionOrder, OldBmmData->DriverOptionOrder, sizeof (NewBmmData->DriverOptionOrder)) != 0) {
- Status = Var_UpdateDriverOrder (Private);
- }
-
- //
- // Check data which located in Boot Options Menu and save the settings if need
- //
- if (CompareMem (NewBmmData->BootOptionDel, OldBmmData->BootOptionDel, sizeof (NewBmmData->BootOptionDel)) != 0) {
- for (Index = 0;
- ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (NewBmmData->BootOptionDel) / sizeof (NewBmmData->BootOptionDel[0]))));
- Index ++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = NewBmmData->BootOptionDel[Index];
- NewBmmData->BootOptionDel[Index] = FALSE;
- NewBmmData->BootOptionDelMark[Index] = FALSE;
- }
-
- Var_DelBootOption ();
- }
-
- //
- // Check data which located in Driver Options Menu and save the settings if need
- //
- if (CompareMem (NewBmmData->DriverOptionDel, OldBmmData->DriverOptionDel, sizeof (NewBmmData->DriverOptionDel)) != 0) {
- for (Index = 0;
- ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (NewBmmData->DriverOptionDel) / sizeof (NewBmmData->DriverOptionDel[0]))));
- Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = NewBmmData->DriverOptionDel[Index];
- NewBmmData->DriverOptionDel[Index] = FALSE;
- NewBmmData->DriverOptionDelMark[Index] = FALSE;
- }
- Var_DelDriverOption ();
- }
-
- if (CompareMem (&NewBmmData->BootTimeOut, &OldBmmData->BootTimeOut, sizeof (NewBmmData->BootTimeOut)) != 0) {
- Status = gRT->SetVariable (
- L"Timeout",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT16),
- &(NewBmmData->BootTimeOut)
- );
- ASSERT_EFI_ERROR(Status);
-
- //
- // Bugbug: code not exit in UiApp but in IntelFrameworkModulePkg, need do more check.
- //
- Private->BmmOldFakeNVData.BootTimeOut = NewBmmData->BootTimeOut;
- }
-
- if (CompareMem (&NewBmmData->BootNext, &OldBmmData->BootNext, sizeof (NewBmmData->BootNext)) != 0) {
- Status = Var_UpdateBootNext (Private);
- }
-
- if (CompareMem (&NewBmmData->ConsoleOutMode, &OldBmmData->ConsoleOutMode, sizeof (NewBmmData->ConsoleOutMode)) != 0) {
- Var_UpdateConMode (Private);
- }
-
- TerminalAttChange = FALSE;
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
-
- //
- // only need update modified items
- //
- if (CompareMem (&NewBmmData->COMBaudRate[Index], &OldBmmData->COMBaudRate[Index], sizeof (NewBmmData->COMBaudRate[Index])) == 0 &&
- CompareMem (&NewBmmData->COMDataRate[Index], &OldBmmData->COMDataRate[Index], sizeof (NewBmmData->COMDataRate[Index])) == 0 &&
- CompareMem (&NewBmmData->COMStopBits[Index], &OldBmmData->COMStopBits[Index], sizeof (NewBmmData->COMStopBits[Index])) == 0 &&
- CompareMem (&NewBmmData->COMParity[Index], &OldBmmData->COMParity[Index], sizeof (NewBmmData->COMParity[Index])) == 0 &&
- CompareMem (&NewBmmData->COMTerminalType[Index], &OldBmmData->COMTerminalType[Index], sizeof (NewBmmData->COMTerminalType[Index])) == 0 &&
- CompareMem (&NewBmmData->COMFlowControl[Index], &OldBmmData->COMFlowControl[Index], sizeof (NewBmmData->COMFlowControl[Index])) == 0) {
- continue;
- }
-
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- ASSERT (NewMenuEntry != NULL);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->BaudRateIndex = NewBmmData->COMBaudRate[Index];
- ASSERT (NewBmmData->COMBaudRate[Index] < (sizeof (BaudRateList) / sizeof (BaudRateList[0])));
- NewTerminalContext->BaudRate = BaudRateList[NewBmmData->COMBaudRate[Index]].Value;
- NewTerminalContext->DataBitsIndex = NewBmmData->COMDataRate[Index];
- ASSERT (NewBmmData->COMDataRate[Index] < (sizeof (DataBitsList) / sizeof (DataBitsList[0])));
- NewTerminalContext->DataBits = (UINT8) DataBitsList[NewBmmData->COMDataRate[Index]].Value;
- NewTerminalContext->StopBitsIndex = NewBmmData->COMStopBits[Index];
- ASSERT (NewBmmData->COMStopBits[Index] < (sizeof (StopBitsList) / sizeof (StopBitsList[0])));
- NewTerminalContext->StopBits = (UINT8) StopBitsList[NewBmmData->COMStopBits[Index]].Value;
- NewTerminalContext->ParityIndex = NewBmmData->COMParity[Index];
- ASSERT (NewBmmData->COMParity[Index] < (sizeof (ParityList) / sizeof (ParityList[0])));
- NewTerminalContext->Parity = (UINT8) ParityList[NewBmmData->COMParity[Index]].Value;
- NewTerminalContext->TerminalType = NewBmmData->COMTerminalType[Index];
- NewTerminalContext->FlowControl = NewBmmData->COMFlowControl[Index];
- ChangeTerminalDevicePath (
- &(NewTerminalContext->DevicePath),
- FALSE
- );
- TerminalAttChange = TRUE;
- }
- if (TerminalAttChange) {
- Var_UpdateConsoleInpOption ();
- Var_UpdateConsoleOutOption ();
- Var_UpdateErrorOutOption ();
- }
-
- //
- // Check data which located in Console Options Menu and save the settings if need
- //
- if (CompareMem (NewBmmData->ConsoleInCheck, OldBmmData->ConsoleInCheck, sizeof (NewBmmData->ConsoleInCheck)) != 0) {
- for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- ASSERT (Index < MAX_MENU_NUMBER);
- NewConsoleContext->IsActive = NewBmmData->ConsoleInCheck[Index];
- }
-
- Var_UpdateConsoleInpOption ();
- }
-
- if (CompareMem (NewBmmData->ConsoleOutCheck, OldBmmData->ConsoleOutCheck, sizeof (NewBmmData->ConsoleOutCheck)) != 0) {
- for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- ASSERT (Index < MAX_MENU_NUMBER);
- NewConsoleContext->IsActive = NewBmmData->ConsoleOutCheck[Index];
- }
-
- Var_UpdateConsoleOutOption ();
- }
-
- if (CompareMem (NewBmmData->ConsoleErrCheck, OldBmmData->ConsoleErrCheck, sizeof (NewBmmData->ConsoleErrCheck)) != 0) {
- for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- ASSERT (Index < MAX_MENU_NUMBER);
- NewConsoleContext->IsActive = NewBmmData->ConsoleErrCheck[Index];
- }
-
- Var_UpdateErrorOutOption ();
- }
-
- //
- // After user do the save action, need to update OldBmmData.
- //
- CopyMem (OldBmmData, NewBmmData, sizeof (BMM_FAKE_NV_DATA));
-
- return EFI_SUCCESS;
-}
-
-/**
- Create GoTo OP code into FORM_BOOT_LEGACY_DEVICE label for legacy boot option.
-
-**/
-EFI_STATUS
-InitializeLegacyBootOption (
- VOID
- )
-{
- RefreshUpdateData ();
- mStartLabel->Number = FORM_BOOT_LEGACY_DEVICE_ID;
-
- //
- // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
- // in BootOption form: legacy FD/HD/CD/NET/BEV
- //
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_FD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_FD_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_HD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_HD_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_CD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_CD_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_NET_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_NET_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_BEV_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_BEV_ORDER_ID
- );
-
- HiiUpdateForm (
- mBmmCallbackInfo->BmmHiiHandle,
- &gBootMaintFormSetGuid,
- FORM_BOOT_SETUP_ID,
- mStartOpCodeHandle, // Label FORM_BOOT_LEGACY_DEVICE_ID
- mEndOpCodeHandle // LABEL_END
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- This function processes the results of changes in configuration.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
- @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.
-**/
-EFI_STATUS
-EFIAPI
-BootMaintCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- )
-{
- BMM_CALLBACK_DATA *Private;
- BM_MENU_ENTRY *NewMenuEntry;
- BMM_FAKE_NV_DATA *CurrentFakeNVMap;
- EFI_STATUS Status;
- UINTN OldValue;
- UINTN NewValue;
- UINTN Number;
- UINTN Pos;
- UINTN Bit;
- UINT16 NewValuePos;
- UINT16 Index3;
- UINT16 Index2;
- UINT16 Index;
- UINT8 *OldLegacyDev;
- UINT8 *NewLegacyDev;
- UINT8 *DisMap;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
-
- Private = BMM_CALLBACK_DATA_FROM_THIS (This);
- if (Action == EFI_BROWSER_ACTION_FORM_OPEN && QuestionId == FORM_BOOT_SETUP_ID) {
- //
- // Initilize Form for legacy boot option.
- //
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID **) &LegacyBios);
- if (!EFI_ERROR (Status)) {
- InitializeLegacyBootOption ();
- }
-
- return EFI_SUCCESS;
- }
-
- if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
- }
-
- Status = EFI_SUCCESS;
- OldValue = 0;
- NewValue = 0;
- Number = 0;
- OldLegacyDev = NULL;
- NewLegacyDev = NULL;
- NewValuePos = 0;
- DisMap = NULL;
-
- Private = BMM_CALLBACK_DATA_FROM_THIS (This);
- //
- // Retrive uncommitted data from Form Browser
- //
- CurrentFakeNVMap = &Private->BmmFakeNvData;
- HiiGetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);
- if (Action == EFI_BROWSER_ACTION_CHANGING) {
- if (Value == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- UpdatePageId (Private, QuestionId);
-
- if (QuestionId < FILE_OPTION_OFFSET) {
- if (QuestionId < CONFIG_OPTION_OFFSET) {
- switch (QuestionId) {
- case KEY_VALUE_BOOT_FROM_FILE:
- Private->FeCurrentState = FileExplorerStateBootFromFile;
- break;
-
- case FORM_BOOT_ADD_ID:
- Private->FeCurrentState = FileExplorerStateAddBootOption;
- break;
-
- case FORM_DRV_ADD_FILE_ID:
- Private->FeCurrentState = FileExplorerStateAddDriverOptionState;
- break;
-
- case FORM_DRV_ADD_HANDLE_ID:
- CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private);
- UpdateDrvAddHandlePage (Private);
- break;
-
- case FORM_BOOT_DEL_ID:
- CleanUpPage (FORM_BOOT_DEL_ID, Private);
- UpdateBootDelPage (Private);
- break;
-
- case FORM_BOOT_CHG_ID:
- case FORM_DRV_CHG_ID:
- UpdatePageBody (QuestionId, Private);
- break;
-
- case FORM_DRV_DEL_ID:
- CleanUpPage (FORM_DRV_DEL_ID, Private);
- UpdateDrvDelPage (Private);
- break;
-
- case FORM_BOOT_NEXT_ID:
- CleanUpPage (FORM_BOOT_NEXT_ID, Private);
- UpdateBootNextPage (Private);
- break;
-
- case FORM_TIME_OUT_ID:
- CleanUpPage (FORM_TIME_OUT_ID, Private);
- UpdateTimeOutPage (Private);
- break;
-
- case FORM_CON_IN_ID:
- case FORM_CON_OUT_ID:
- case FORM_CON_ERR_ID:
- UpdatePageBody (QuestionId, Private);
- break;
-
- case FORM_CON_MODE_ID:
- CleanUpPage (FORM_CON_MODE_ID, Private);
- UpdateConModePage (Private);
- break;
-
- case FORM_CON_COM_ID:
- CleanUpPage (FORM_CON_COM_ID, Private);
- UpdateConCOMPage (Private);
- break;
-
- case FORM_SET_FD_ORDER_ID:
- case FORM_SET_HD_ORDER_ID:
- case FORM_SET_CD_ORDER_ID:
- case FORM_SET_NET_ORDER_ID:
- case FORM_SET_BEV_ORDER_ID:
- CleanUpPage (QuestionId, Private);
- UpdateSetLegacyDeviceOrderPage (QuestionId, Private);
- break;
-
- default:
- break;
- }
- } else if ((QuestionId >= TERMINAL_OPTION_OFFSET) && (QuestionId < CONSOLE_OPTION_OFFSET)) {
- Index2 = (UINT16) (QuestionId - TERMINAL_OPTION_OFFSET);
- Private->CurrentTerminal = Index2;
-
- CleanUpPage (FORM_CON_COM_SETUP_ID, Private);
- UpdateTerminalPage (Private);
-
- } else if (QuestionId >= HANDLE_OPTION_OFFSET) {
- Index2 = (UINT16) (QuestionId - HANDLE_OPTION_OFFSET);
-
- NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index2);
- ASSERT (NewMenuEntry != NULL);
- Private->HandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;
-
- CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private);
-
- Private->MenuEntry = NewMenuEntry;
- Private->LoadContext->FilePathList = Private->HandleContext->DevicePath;
-
- UpdateDriverAddHandleDescPage (Private);
- }
- }
- } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
- if ((Value == NULL) || (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
- if (Value->b){
- //
- // Means user try to delete this boot option but not press F10 or "Commit Changes and Exit" menu.
- //
- CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = TRUE;
- } else {
- //
- // Means user remove the old check status.
- //
- CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = FALSE;
- }
- } else if ((QuestionId >= DRIVER_OPTION_DEL_QUESTION_ID) && (QuestionId < DRIVER_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
- if (Value->b){
- CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = TRUE;
- } else {
- CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = FALSE;
- }
- } else if ((QuestionId >= LEGACY_FD_QUESTION_ID) && (QuestionId < LEGACY_BEV_QUESTION_ID + MAX_MENU_NUMBER)) {
- //
- // Update Select FD/HD/CD/NET/BEV Order Form
- //
-
- DisMap = Private->BmmOldFakeNVData.DisableMap;
-
- if (QuestionId >= LEGACY_FD_QUESTION_ID && QuestionId < LEGACY_FD_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyFDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyFD;
- NewLegacyDev = CurrentFakeNVMap->LegacyFD;
- } else if (QuestionId >= LEGACY_HD_QUESTION_ID && QuestionId < LEGACY_HD_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyHDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyHD;
- NewLegacyDev = CurrentFakeNVMap->LegacyHD;
- } else if (QuestionId >= LEGACY_CD_QUESTION_ID && QuestionId < LEGACY_CD_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyCDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyCD;
- NewLegacyDev = CurrentFakeNVMap->LegacyCD;
- } else if (QuestionId >= LEGACY_NET_QUESTION_ID && QuestionId < LEGACY_NET_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyNETMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyNET;
- NewLegacyDev = CurrentFakeNVMap->LegacyNET;
- } else if (QuestionId >= LEGACY_BEV_QUESTION_ID && QuestionId < LEGACY_BEV_QUESTION_ID + MAX_MENU_NUMBER) {
- Number = (UINT16) LegacyBEVMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyBEV;
- NewLegacyDev = CurrentFakeNVMap->LegacyBEV;
- }
- //
- // First, find the different position
- // if there is change, it should be only one
- //
- for (Index = 0; Index < Number; Index++) {
- if (OldLegacyDev[Index] != NewLegacyDev[Index]) {
- OldValue = OldLegacyDev[Index];
- NewValue = NewLegacyDev[Index];
- break;
- }
- }
-
- if (Index != Number) {
- //
- // there is change, now process
- //
- if (0xFF == NewValue) {
- //
- // This item will be disable
- // Just move the items behind this forward to overlap it
- //
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
- for (Index2 = Index; Index2 < Number - 1; Index2++) {
- NewLegacyDev[Index2] = NewLegacyDev[Index2 + 1];
- }
-
- NewLegacyDev[Index2] = 0xFF;
- } else {
- for (Index2 = 0; Index2 < Number; Index2++) {
- if (Index2 == Index) {
- continue;
- }
-
- if (OldLegacyDev[Index2] == NewValue) {
- //
- // If NewValue is in OldLegacyDev array
- // remember its old position
- //
- NewValuePos = Index2;
- break;
- }
- }
-
- if (Index2 != Number) {
- //
- // We will change current item to an existing item
- // (It's hard to describe here, please read code, it's like a cycle-moving)
- //
- for (Index2 = NewValuePos; Index2 != Index;) {
- if (NewValuePos < Index) {
- NewLegacyDev[Index2] = OldLegacyDev[Index2 + 1];
- Index2++;
- } else {
- NewLegacyDev[Index2] = OldLegacyDev[Index2 - 1];
- Index2--;
- }
- }
- } else {
- //
- // If NewValue is not in OldlegacyDev array, we are changing to a disabled item
- // so we should modify DisMap to reflect the change
- //
- Pos = NewValue / 8;
- Bit = 7 - (NewValue % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] & (~ (UINT8) (1 << Bit)));
- if (0xFF != OldValue) {
- //
- // Because NewValue is a item that was disabled before
- // so after changing the OldValue should be disabled
- // actually we are doing a swap of enable-disable states of two items
- //
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
- }
- }
- }
- //
- // To prevent DISABLE appears in the middle of the list
- // we should perform a re-ordering
- //
- Index3 = Index;
- Index = 0;
- while (Index < Number) {
- if (0xFF != NewLegacyDev[Index]) {
- Index++;
- continue;
- }
-
- Index2 = Index;
- Index2++;
- while (Index2 < Number) {
- if (0xFF != NewLegacyDev[Index2]) {
- break;
- }
-
- Index2++;
- }
-
- if (Index2 < Number) {
- NewLegacyDev[Index] = NewLegacyDev[Index2];
- NewLegacyDev[Index2] = 0xFF;
- }
-
- Index++;
- }
-
- //
- // Return correct question value.
- //
- Value->u8 = NewLegacyDev[Index3];
- }
- } else {
- switch (QuestionId) {
- case KEY_VALUE_SAVE_AND_EXIT:
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
- break;
-
- case KEY_VALUE_NO_SAVE_AND_EXIT:
- //
- // Restore local maintain data.
- //
- DiscardChangeHandler (Private, CurrentFakeNVMap);
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
- break;
-
- case FORM_RESET:
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- return EFI_UNSUPPORTED;
-
- default:
- break;
- }
- }
- }
-
- //
- // Pass changed uncommitted data back to Form Browser
- //
- HiiSetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);
- return EFI_SUCCESS;
-}
-
-/**
- Discard all changes done to the BMM pages such as Boot Order change,
- Driver order change.
-
- @param Private The BMM context data.
- @param CurrentFakeNVMap The current Fack NV Map.
-
-**/
-VOID
-DiscardChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
- )
-{
- UINT16 Index;
-
- switch (Private->BmmPreviousPageId) {
- case FORM_BOOT_CHG_ID:
- CopyMem (CurrentFakeNVMap->BootOptionOrder, Private->BmmOldFakeNVData.BootOptionOrder, sizeof (CurrentFakeNVMap->BootOptionOrder));
- break;
-
- case FORM_DRV_CHG_ID:
- CopyMem (CurrentFakeNVMap->DriverOptionOrder, Private->BmmOldFakeNVData.DriverOptionOrder, sizeof (CurrentFakeNVMap->DriverOptionOrder));
- break;
-
- case FORM_BOOT_DEL_ID:
- ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0])));
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->BootOptionDel[Index] = FALSE;
- CurrentFakeNVMap->BootOptionDelMark[Index] = FALSE;
- }
- break;
-
- case FORM_DRV_DEL_ID:
- ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0])));
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->DriverOptionDel[Index] = FALSE;
- CurrentFakeNVMap->DriverOptionDelMark[Index] = FALSE;
- }
- break;
-
- case FORM_BOOT_NEXT_ID:
- CurrentFakeNVMap->BootNext = Private->BmmOldFakeNVData.BootNext;
- break;
-
- case FORM_TIME_OUT_ID:
- CurrentFakeNVMap->BootTimeOut = Private->BmmOldFakeNVData.BootTimeOut;
- break;
-
- case FORM_DRV_ADD_HANDLE_DESC_ID:
- case FORM_DRV_ADD_FILE_ID:
- case FORM_DRV_ADD_HANDLE_ID:
- CurrentFakeNVMap->DriverAddHandleDesc[0] = 0x0000;
- CurrentFakeNVMap->DriverAddHandleOptionalData[0] = 0x0000;
- break;
-
- default:
- break;
- }
-}
-
-/**
- Initialize the Boot Maintenance Utitliy.
-
-
- @retval EFI_SUCCESS utility ended successfully
- @retval others contain some errors
-
-**/
-EFI_STATUS
-InitializeBM (
- VOID
- )
-{
- BMM_CALLBACK_DATA *BmmCallbackInfo;
- EFI_STATUS Status;
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
- UINT32 Length;
- UINT8 *Data;
-
- Status = EFI_SUCCESS;
- BmmCallbackInfo = mBmmCallbackInfo;
-
- BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
- BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
- BmmCallbackInfo->FeCurrentState = FileExplorerStateInActive;
- BmmCallbackInfo->FeDisplayContext = FileExplorerDisplayUnknown;
-
- //
- // Reinstall String packages to include more new strings.
- //
-
- //
- // String package size
- //
- Length = ReadUnaligned32 ((UINT32 *) BdsDxeStrings) - sizeof (UINT32);
-
- //
- // Add the length of the Package List Header and the terminating Package Header
- //
- Length += sizeof (EFI_HII_PACKAGE_LIST_HEADER) + sizeof (EFI_HII_PACKAGE_HEADER);
-
- //
- // Allocate the storage for the entire Package List
- //
- PackageListHeader = AllocateZeroPool (Length);
-
- //
- // If the Package List can not be allocated, then return a NULL HII Handle
- //
- if (PackageListHeader == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Fill in the GUID and Length of the Package List Header
- //
- PackageListHeader->PackageLength = Length;
-
- //
- // Copy String Data into Package list.
- //
- Data = (UINT8 *)(PackageListHeader + 1);
- Length = ReadUnaligned32 ((UINT32 *) BdsDxeStrings) - sizeof (UINT32);
- CopyMem (Data, (UINT8 *) BdsDxeStrings + sizeof (UINT32), Length);
-
- //
- // Add End type HII package.
- //
- Data += Length;
- ((EFI_HII_PACKAGE_HEADER *) Data)->Type = EFI_HII_PACKAGE_END;
- ((EFI_HII_PACKAGE_HEADER *) Data)->Length = sizeof (EFI_HII_PACKAGE_HEADER);
-
- //
- // Update String package for BM
- //
- CopyGuid (&PackageListHeader->PackageListGuid, &gBootMaintFormSetGuid);
- Status = gHiiDatabase->UpdatePackageList (gHiiDatabase, BmmCallbackInfo->BmmHiiHandle, PackageListHeader);
-
- //
- // Update String package for FE.
- //
- CopyGuid (&PackageListHeader->PackageListGuid, &gFileExploreFormSetGuid);
- Status = gHiiDatabase->UpdatePackageList (gHiiDatabase, BmmCallbackInfo->FeHiiHandle, PackageListHeader);
-
- FreePool (PackageListHeader);
-
- //
- // Init OpCode Handle and Allocate space for creation of Buffer
- //
- mStartOpCodeHandle = HiiAllocateOpCodeHandle ();
- if (mStartOpCodeHandle == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Exit;
- }
-
- mEndOpCodeHandle = HiiAllocateOpCodeHandle ();
- if (mEndOpCodeHandle == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Exit;
- }
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mStartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- mStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- mEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mEndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- mEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- mEndLabel->Number = LABEL_END;
-
- InitializeStringDepository ();
-
- InitAllMenu (BmmCallbackInfo);
-
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleInpMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleOutMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleErrMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &BootOptionMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverOptionMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &TerminalMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverMenu);
-
- InitializeBmmConfig (BmmCallbackInfo);
-
- //
- // Dispatch BMM main formset and File Explorer formset.
- //
- FormSetDispatcher (BmmCallbackInfo);
-
- //
- // Clean up.
- //
- CleanUpStringDepository ();
-
- FreeAllMenu ();
-
-Exit:
- if (mStartOpCodeHandle != NULL) {
- HiiFreeOpCodeHandle (mStartOpCodeHandle);
- }
-
- if (mEndOpCodeHandle != NULL) {
- HiiFreeOpCodeHandle (mEndOpCodeHandle);
- }
-
- return Status;
-}
-
-
-/**
- Initialized all Menu Option List.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-InitAllMenu (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- InitializeListHead (&BootOptionMenu.Head);
- InitializeListHead (&DriverOptionMenu.Head);
- BOpt_GetBootOptions (CallbackData);
- BOpt_GetDriverOptions (CallbackData);
- BOpt_GetLegacyOptions ();
- InitializeListHead (&FsOptionMenu.Head);
- BOpt_FindDrivers ();
- InitializeListHead (&DirectoryMenu.Head);
- InitializeListHead (&ConsoleInpMenu.Head);
- InitializeListHead (&ConsoleOutMenu.Head);
- InitializeListHead (&ConsoleErrMenu.Head);
- InitializeListHead (&TerminalMenu.Head);
- LocateSerialIo ();
- GetAllConsoles ();
-}
-
-/**
- Free up all Menu Option list.
-
-**/
-VOID
-FreeAllMenu (
- VOID
- )
-{
- BOpt_FreeMenu (&DirectoryMenu);
- BOpt_FreeMenu (&FsOptionMenu);
- BOpt_FreeMenu (&BootOptionMenu);
- BOpt_FreeMenu (&DriverOptionMenu);
- BOpt_FreeMenu (&DriverMenu);
- BOpt_FreeLegacyOptions ();
- FreeAllConsoles ();
-}
-
-/**
- Initialize all the string depositories.
-
-**/
-VOID
-InitializeStringDepository (
- VOID
- )
-{
- STRING_DEPOSITORY *StringDepository;
- StringDepository = AllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);
- FileOptionStrDepository = StringDepository++;
- ConsoleOptionStrDepository = StringDepository++;
- BootOptionStrDepository = StringDepository++;
- BootOptionHelpStrDepository = StringDepository++;
- DriverOptionStrDepository = StringDepository++;
- DriverOptionHelpStrDepository = StringDepository++;
- TerminalStrDepository = StringDepository;
-}
-
-/**
- Fetch a usable string node from the string depository and return the string token.
-
- @param CallbackData The BMM context data.
- @param StringDepository The string repository.
-
- @retval EFI_STRING_ID String token.
-
-**/
-EFI_STRING_ID
-GetStringTokenFromDepository (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN STRING_DEPOSITORY *StringDepository
- )
-{
- STRING_LIST_NODE *CurrentListNode;
- STRING_LIST_NODE *NextListNode;
-
- CurrentListNode = StringDepository->CurrentNode;
-
- if ((NULL != CurrentListNode) && (NULL != CurrentListNode->Next)) {
- //
- // Fetch one reclaimed node from the list.
- //
- NextListNode = StringDepository->CurrentNode->Next;
- } else {
- //
- // If there is no usable node in the list, update the list.
- //
- NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));
- ASSERT (NextListNode != NULL);
- NextListNode->StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, L" ", NULL);
- ASSERT (NextListNode->StringToken != 0);
-
- StringDepository->TotalNodeNumber++;
-
- if (NULL == CurrentListNode) {
- StringDepository->ListHead = NextListNode;
- } else {
- CurrentListNode->Next = NextListNode;
- }
- }
-
- StringDepository->CurrentNode = NextListNode;
-
- return StringDepository->CurrentNode->StringToken;
-}
-
-/**
- Reclaim string depositories by moving the current node pointer to list head..
-
-**/
-VOID
-ReclaimStringDepository (
- VOID
- )
-{
- UINTN DepositoryIndex;
- STRING_DEPOSITORY *StringDepository;
-
- StringDepository = FileOptionStrDepository;
- for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {
- StringDepository->CurrentNode = StringDepository->ListHead;
- StringDepository++;
- }
-}
-
-/**
- Release resource for all the string depositories.
-
-**/
-VOID
-CleanUpStringDepository (
- VOID
- )
-{
- UINTN NodeIndex;
- UINTN DepositoryIndex;
- STRING_LIST_NODE *CurrentListNode;
- STRING_LIST_NODE *NextListNode;
- STRING_DEPOSITORY *StringDepository;
-
- //
- // Release string list nodes.
- //
- StringDepository = FileOptionStrDepository;
- for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {
- CurrentListNode = StringDepository->ListHead;
- for (NodeIndex = 0; NodeIndex < StringDepository->TotalNodeNumber; NodeIndex++) {
- NextListNode = CurrentListNode->Next;
- FreePool (CurrentListNode);
- CurrentListNode = NextListNode;
- }
-
- StringDepository++;
- }
- //
- // Release string depository.
- //
- FreePool (FileOptionStrDepository);
-}
-
-/**
- Start boot maintenance manager
-
- @retval EFI_SUCCESS If BMM is invoked successfully.
- @return Other value if BMM return unsuccessfully.
-
-**/
-EFI_STATUS
-BdsStartBootMaint (
- VOID
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY BdsBootOptionList;
-
- InitializeListHead (&BdsBootOptionList);
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
- //
- // Have chance to enumerate boot device
- //
- BdsLibEnumerateAllBootOption (&BdsBootOptionList);
-
- //
- // Group the legacy boot options for the same device type
- //
- GroupMultipleLegacyBootOption4SameType ();
-
- //
- // Init the BMM
- //
- Status = InitializeBM ();
-
- return Status;
-}
-
-/**
- Dispatch BMM formset and FileExplorer formset.
-
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS If function complete successfully.
- @return Other value if the Setup Browser process BMM's pages and
- return unsuccessfully.
-
-**/
-EFI_STATUS
-FormSetDispatcher (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- EFI_BROWSER_ACTION_REQUEST ActionRequest;
-
- while (TRUE) {
- UpdatePageId (CallbackData, FORM_MAIN_ID);
-
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &CallbackData->BmmHiiHandle,
- 1,
- &gBootMaintFormSetGuid,
- 0,
- NULL,
- &ActionRequest
- );
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- ReclaimStringDepository ();
-
- //
- // When this Formset returns, check if we are going to explore files.
- //
- if (FileExplorerStateInActive != CallbackData->FeCurrentState) {
- UpdateFileExplorer (CallbackData, 0);
-
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &CallbackData->FeHiiHandle,
- 1,
- &gFileExploreFormSetGuid,
- 0,
- NULL,
- &ActionRequest
- );
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- CallbackData->FeCurrentState = FileExplorerStateInActive;
- CallbackData->FeDisplayContext = FileExplorerDisplayUnknown;
- ReclaimStringDepository ();
- } else {
- break;
- }
- }
-
- return Status;
-}
-
-/**
- Intall BootMaint and FileExplorer HiiPackages.
-
-**/
-EFI_STATUS
-InitBMPackage (
- VOID
- )
-{
- BMM_CALLBACK_DATA *BmmCallbackInfo;
- EFI_STATUS Status;
- UINT8 *Ptr;
-
- //
- // Create CallbackData structures for Driver Callback
- //
- BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));
- if (BmmCallbackInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Create LoadOption in BmmCallbackInfo for Driver Callback
- //
- Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));
- if (Ptr == NULL) {
- FreePool (BmmCallbackInfo);
- BmmCallbackInfo = NULL;
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize Bmm callback data.
- //
- BmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *) Ptr;
- Ptr += sizeof (BM_LOAD_CONTEXT);
-
- BmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_FILE_CONTEXT);
-
- BmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_HANDLE_CONTEXT);
-
- BmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr;
-
- BmmCallbackInfo->Signature = BMM_CALLBACK_DATA_SIGNATURE;
- BmmCallbackInfo->BmmConfigAccess.ExtractConfig = BootMaintExtractConfig;
- BmmCallbackInfo->BmmConfigAccess.RouteConfig = BootMaintRouteConfig;
- BmmCallbackInfo->BmmConfigAccess.Callback = BootMaintCallback;
- BmmCallbackInfo->FeConfigAccess.ExtractConfig = FakeExtractConfig;
- BmmCallbackInfo->FeConfigAccess.RouteConfig = FileExplorerRouteConfig;
- BmmCallbackInfo->FeConfigAccess.Callback = FileExplorerCallback;
-
- //
- // Install Device Path Protocol and Config Access protocol to driver handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &BmmCallbackInfo->BmmDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mBmmHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->BmmConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install Device Path Protocol and Config Access protocol to driver handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &BmmCallbackInfo->FeDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mFeHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->FeConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Post our Boot Maint VFR binary to the HII database.
- //
- BmmCallbackInfo->BmmHiiHandle = HiiAddPackages (
- &gBootMaintFormSetGuid,
- BmmCallbackInfo->BmmDriverHandle,
- BmBin,
- BdsDxeStrings,
- NULL
- );
- ASSERT (BmmCallbackInfo->BmmHiiHandle != NULL);
-
- //
- // Post our File Explorer VFR binary to the HII database.
- //
- BmmCallbackInfo->FeHiiHandle = HiiAddPackages (
- &gFileExploreFormSetGuid,
- BmmCallbackInfo->FeDriverHandle,
- FEBin,
- BdsDxeStrings,
- NULL
- );
- ASSERT (BmmCallbackInfo->FeHiiHandle != NULL);
-
- mBmmCallbackInfo = BmmCallbackInfo;
-
- return EFI_SUCCESS;
-}
-
-/**
- Remvoe the intalled BootMaint and FileExplorer HiiPackages.
-
-**/
-VOID
-FreeBMPackage (
- VOID
- )
-{
- BMM_CALLBACK_DATA *BmmCallbackInfo;
-
- BmmCallbackInfo = mBmmCallbackInfo;
-
- //
- // Remove our IFR data from HII database
- //
- HiiRemovePackages (BmmCallbackInfo->BmmHiiHandle);
- HiiRemovePackages (BmmCallbackInfo->FeHiiHandle);
-
- if (BmmCallbackInfo->FeDriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- BmmCallbackInfo->FeDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mFeHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->FeConfigAccess,
- NULL
- );
- }
-
- if (BmmCallbackInfo->BmmDriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- BmmCallbackInfo->BmmDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mBmmHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->BmmConfigAccess,
- NULL
- );
- }
-
- FreePool (BmmCallbackInfo->LoadContext);
- FreePool (BmmCallbackInfo);
-
- mBmmCallbackInfo = NULL;
-
- return;
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
deleted file mode 100644
index 098692fa53..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
+++ /dev/null
@@ -1,1679 +0,0 @@
-/** @file
- Header file for boot maintenance module.
-
-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.
-
-**/
-
-#ifndef _BOOT_MAINT_H_
-#define _BOOT_MAINT_H_
-
-#include "Bds.h"
-#include "BBSsupport.h"
-#include "FormGuid.h"
-#include "FrontPage.h"
-
-//
-// Constants which are variable names used to access variables
-//
-#define VAR_CON_OUT_MODE L"ConOutMode"
-
-//
-// String Contant
-//
-#define STR_FLOPPY L"Floppy Drive #%02x"
-#define STR_HARDDISK L"HardDisk Drive #%02x"
-#define STR_CDROM L"ATAPI CDROM Drive #%02x"
-#define STR_NET L"NET Drive #%02x"
-#define STR_BEV L"BEV Drive #%02x"
-#define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
-#define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
-#define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
-#define STR_NET_HELP L"NET Drive #%02x"
-#define STR_BEV_HELP L"BEV Drive #%02x"
-
-extern CHAR16 mFileExplorerStorageName[];
-extern CHAR16 mBootMaintStorageName[];
-//
-// These are the VFR compiler generated data representing our VFR data.
-//
-extern UINT8 BmBin[];
-extern UINT8 FEBin[];
-
-//
-// Below are the number of options in Baudrate, Databits,
-// Parity and Stopbits selection for serial ports.
-//
-#define BM_COM_ATTR_BUADRATE 19
-#define BM_COM_ATTR_DATABITS 4
-#define BM_COM_ATTR_PARITY 5
-#define BM_COM_ATTR_STOPBITS 3
-
-//
-// Callback function helper
-//
-#define BMM_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('C', 'b', 'c', 'k')
-#define BMM_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, BmmConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)
-
-#define FE_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, FeConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)
-
-//
-// Enumeration type definition
-//
-typedef enum _TYPE_OF_TERMINAL {
- TerminalTypePcAnsi = 0,
- TerminalTypeVt100,
- TerminalTypeVt100Plus,
- TerminalTypeVtUtf8
-} TYPE_OF_TERMINAL;
-
-typedef enum _FILE_EXPLORER_STATE {
- FileExplorerStateInActive = 0,
- FileExplorerStateBootFromFile,
- FileExplorerStateAddBootOption,
- FileExplorerStateAddDriverOptionState,
- FileExplorerStateUnknown
-} FILE_EXPLORER_STATE;
-
-typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
- FileExplorerDisplayFileSystem,
- FileExplorerDisplayDirectory,
- FileExplorerDisplayUnknown
-} FILE_EXPLORER_DISPLAY_CONTEXT;
-
-//
-// All of the signatures that will be used in list structure
-//
-#define BM_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
-#define BM_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('l', 'o', 'a', 'd')
-#define BM_CONSOLE_OPTION_SIGNATURE SIGNATURE_32 ('c', 'n', 's', 'l')
-#define BM_FILE_OPTION_SIGNATURE SIGNATURE_32 ('f', 'i', 'l', 'e')
-#define BM_HANDLE_OPTION_SIGNATURE SIGNATURE_32 ('h', 'n', 'd', 'l')
-#define BM_TERMINAL_OPTION_SIGNATURE SIGNATURE_32 ('t', 'r', 'm', 'l')
-#define BM_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
-
-#define BM_LOAD_CONTEXT_SELECT 0x0
-#define BM_CONSOLE_CONTEXT_SELECT 0x1
-#define BM_FILE_CONTEXT_SELECT 0x2
-#define BM_HANDLE_CONTEXT_SELECT 0x3
-#define BM_TERMINAL_CONTEXT_SELECT 0x5
-
-#define BM_CONSOLE_IN_CONTEXT_SELECT 0x6
-#define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7
-#define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8
-#define BM_LEGACY_DEV_CONTEXT_SELECT 0x9
-
-//
-// Buffer size for update data
-//
-#define UPDATE_DATA_SIZE 0x100000
-
-//
-// Namespace of callback keys used in display and file system navigation
-//
-#define MAX_BBS_OFFSET 0xE000
-#define NET_OPTION_OFFSET 0xD800
-#define BEV_OPTION_OFFSET 0xD000
-#define FD_OPTION_OFFSET 0xC000
-#define HD_OPTION_OFFSET 0xB000
-#define CD_OPTION_OFFSET 0xA000
-#define FILE_OPTION_GOTO_OFFSET 0xC000
-#define FILE_OPTION_OFFSET 0x8000
-#define FILE_OPTION_MASK 0x3FFF
-#define HANDLE_OPTION_OFFSET 0x7000
-#define CONSOLE_OPTION_OFFSET 0x6000
-#define TERMINAL_OPTION_OFFSET 0x5000
-#define CONFIG_OPTION_OFFSET 0x1200
-#define KEY_VALUE_OFFSET 0x1100
-#define FORM_ID_OFFSET 0x1000
-
-//
-// VarOffset that will be used to create question
-// all these values are computed from the structure
-// defined below
-//
-#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field)))
-
-//
-// Question Id of Zero is invalid, so add an offset to it
-//
-#define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
-
-#define BOOT_TIME_OUT_VAR_OFFSET VAR_OFFSET (BootTimeOut)
-#define BOOT_NEXT_VAR_OFFSET VAR_OFFSET (BootNext)
-#define COM1_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM1BaudRate)
-#define COM1_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM1DataRate)
-#define COM1_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM1StopBits)
-#define COM1_PARITY_VAR_OFFSET VAR_OFFSET (COM1Parity)
-#define COM1_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
-#define COM2_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM2BaudRate)
-#define COM2_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM2DataRate)
-#define COM2_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM2StopBits)
-#define COM2_PARITY_VAR_OFFSET VAR_OFFSET (COM2Parity)
-#define COM2_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
-#define DRV_ADD_HANDLE_DESC_VAR_OFFSET VAR_OFFSET (DriverAddHandleDesc)
-#define DRV_ADD_ACTIVE_VAR_OFFSET VAR_OFFSET (DriverAddActive)
-#define DRV_ADD_RECON_VAR_OFFSET VAR_OFFSET (DriverAddForceReconnect)
-#define CON_IN_COM1_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM1)
-#define CON_IN_COM2_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM2)
-#define CON_OUT_COM1_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM1)
-#define CON_OUT_COM2_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM2)
-#define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)
-#define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)
-#define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)
-#define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)
-#define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)
-#define CON_ERR_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleErrCheck)
-#define BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)
-#define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)
-#define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)
-#define DRIVER_OPTION_DEL_VAR_OFFSET VAR_OFFSET (DriverOptionDel)
-#define DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)
-#define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)
-#define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate)
-#define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
-#define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
-#define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
-#define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)
-#define LEGACY_FD_VAR_OFFSET VAR_OFFSET (LegacyFD)
-#define LEGACY_HD_VAR_OFFSET VAR_OFFSET (LegacyHD)
-#define LEGACY_CD_VAR_OFFSET VAR_OFFSET (LegacyCD)
-#define LEGACY_NET_VAR_OFFSET VAR_OFFSET (LegacyNET)
-#define LEGACY_BEV_VAR_OFFSET VAR_OFFSET (LegacyBEV)
-
-#define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
-#define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
-#define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)
-#define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)
-#define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)
-#define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)
-#define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
-#define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)
-#define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)
-#define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)
-#define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)
-#define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
-#define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)
-#define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)
-#define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)
-#define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)
-#define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)
-#define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)
-#define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)
-#define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
-#define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
-#define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)
-#define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)
-#define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)
-#define CON_ERR_DEVICE_QUESTION_ID QUESTION_ID (ConsoleErrCheck)
-#define BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)
-#define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)
-#define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
-#define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
-#define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
-#define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
-#define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
-#define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
-#define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
-#define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
-#define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)
-#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
-#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
-#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
-#define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
-#define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
-
-#define STRING_DEPOSITORY_NUMBER 8
-
-///
-/// Serial Ports attributes, first one is the value for
-/// return from callback function, stringtoken is used to
-/// display the value properly
-///
-typedef struct {
- UINTN Value;
- UINT16 StringToken;
-} COM_ATTR;
-
-typedef struct {
- UINT64 BaudRate;
- UINT8 DataBits;
- UINT8 Parity;
- UINT8 StopBits;
-
- UINT8 BaudRateIndex;
- UINT8 DataBitsIndex;
- UINT8 ParityIndex;
- UINT8 StopBitsIndex;
-
- UINT8 FlowControl;
-
- UINT8 IsConIn;
- UINT8 IsConOut;
- UINT8 IsStdErr;
- UINT8 TerminalType;
-
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_TERMINAL_CONTEXT;
-
-typedef struct {
- BOOLEAN IsBootNext;
- BOOLEAN LoadOptionModified;
- BOOLEAN Deleted;
-
- BOOLEAN IsLegacy;
- BOOLEAN IsActive;
- BOOLEAN ForceReconnect;
- UINTN OptionalDataSize;
-
- UINTN LoadOptionSize;
- UINT8 *LoadOption;
-
- UINT32 Attributes;
- UINT16 FilePathListLength;
- UINT16 *Description;
- EFI_DEVICE_PATH_PROTOCOL *FilePathList;
- UINT8 *OptionalData;
-
- UINT16 BbsIndex;
-} BM_LOAD_CONTEXT;
-
-typedef struct {
- BBS_TABLE *BbsEntry;
- UINT16 BbsIndex;
- UINT16 BbsCount;
- CHAR16 *Description;
-} BM_LEGACY_DEVICE_CONTEXT;
-
-typedef struct {
-
- BOOLEAN IsActive;
-
- BOOLEAN IsTerminal;
-
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_CONSOLE_CONTEXT;
-
-typedef struct {
- UINTN Column;
- UINTN Row;
-} CONSOLE_OUT_MODE;
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_FILE_HANDLE FHandle;
- UINT16 *FileName;
- EFI_FILE_SYSTEM_VOLUME_LABEL *Info;
-
- BOOLEAN IsRoot;
- BOOLEAN IsDir;
- BOOLEAN IsRemovableMedia;
- BOOLEAN IsLoadFile;
- BOOLEAN IsBootLegacy;
-} BM_FILE_CONTEXT;
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_HANDLE_CONTEXT;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Head;
- UINTN MenuNumber;
-} BM_MENU_OPTION;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- UINTN OptionNumber;
- UINT16 *DisplayString;
- UINT16 *HelpString;
- EFI_STRING_ID DisplayStringToken;
- EFI_STRING_ID HelpStringToken;
- UINTN ContextSelection;
- VOID *VariableContext;
-} BM_MENU_ENTRY;
-
-typedef struct {
- //
- // Shared callback data.
- //
- UINTN Signature;
-
- BM_MENU_ENTRY *MenuEntry;
- BM_HANDLE_CONTEXT *HandleContext;
- BM_FILE_CONTEXT *FileContext;
- BM_LOAD_CONTEXT *LoadContext;
- BM_TERMINAL_CONTEXT *TerminalContext;
- UINTN CurrentTerminal;
- BBS_TYPE BbsType;
-
- //
- // BMM main formset callback data.
- //
- EFI_HII_HANDLE BmmHiiHandle;
- EFI_HANDLE BmmDriverHandle;
- EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess;
- EFI_FORM_ID BmmCurrentPageId;
- EFI_FORM_ID BmmPreviousPageId;
- BOOLEAN BmmAskSaveOrNot;
- BMM_FAKE_NV_DATA BmmFakeNvData;
- BMM_FAKE_NV_DATA BmmOldFakeNVData;
-
- //
- // File explorer formset callback data.
- //
- EFI_HII_HANDLE FeHiiHandle;
- EFI_HANDLE FeDriverHandle;
- EFI_HII_CONFIG_ACCESS_PROTOCOL FeConfigAccess;
- FILE_EXPLORER_STATE FeCurrentState;
- FILE_EXPLORER_DISPLAY_CONTEXT FeDisplayContext;
- FILE_EXPLORER_NV_DATA FeFakeNvData;
-} BMM_CALLBACK_DATA;
-
-typedef struct _STRING_LIST_NODE STRING_LIST_NODE;
-
-struct _STRING_LIST_NODE {
- EFI_STRING_ID StringToken;
- STRING_LIST_NODE *Next;
-};
-
-typedef struct _STRING_DEPOSITORY {
- UINTN TotalNodeNumber;
- STRING_LIST_NODE *CurrentNode;
- STRING_LIST_NODE *ListHead;
-} STRING_DEPOSITORY;
-
-//
-// #pragma pack()
-//
-// For initializing File System menu
-//
-
-/**
- This function build the FsOptionMenu list which records all
- available file system in the system. They includes all instances
- of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM
- and all type of legacy boot device.
-
- @param CallbackData BMM context data
-
- @retval EFI_SUCCESS Success find the file system
- @retval EFI_OUT_OF_RESOURCES Can not create menu entry
-
-**/
-EFI_STATUS
-BOpt_FindFileSystem (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Find files under current directory
- All files and sub-directories in current directory
- will be stored in DirectoryMenu for future use.
-
- @param CallbackData The BMM context data.
- @param MenuEntry The Menu Entry.
-
- @retval EFI_SUCCESS Get files from current dir successfully.
- @return Other value if can't get files from current dir.
-
-**/
-EFI_STATUS
-BOpt_FindFiles (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_ENTRY *MenuEntry
- );
-
-/**
-
- Find drivers that will be added as Driver#### variables from handles
- in current system environment
- All valid handles in the system except those consume SimpleFs, LoadFile
- are stored in DriverMenu for future use.
-
- @retval EFI_SUCCESS The function complets successfully.
- @return Other value if failed to build the DriverMenu.
-
-**/
-EFI_STATUS
-BOpt_FindDrivers (
- VOID
- );
-
-/**
-
- Build the BootOptionMenu according to BootOrder Variable.
- This Routine will access the Boot#### to get EFI_LOAD_OPTION.
-
- @param CallbackData The BMM context data.
-
- @return The number of the Var Boot####.
-
-**/
-EFI_STATUS
-BOpt_GetBootOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
-
- Build up all DriverOptionMenu
-
- @param CallbackData The BMM context data.
-
- @return EFI_SUCESS The functin completes successfully.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.
-
-
-**/
-EFI_STATUS
-BOpt_GetDriverOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-
-/**
- Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_OUT_OF_RESOURCES No enough memory to complete this function.
-
-**/
-EFI_STATUS
-BOpt_GetLegacyOptions (
- VOID
- );
-
-/**
- Free out resouce allocated from Legacy Boot Options.
-
-**/
-VOID
-BOpt_FreeLegacyOptions (
- VOID
- );
-
-/**
- Free resources allocated in Allocate Rountine.
-
- @param FreeMenu Menu to be freed
-
-**/
-VOID
-BOpt_FreeMenu (
- BM_MENU_OPTION *FreeMenu
- );
-
-
-/**
-
- Append file name to existing file name.
-
- @param Str1 The existing file name
- @param Str2 The file name to be appended
-
- @return Allocate a new string to hold the appended result.
- Caller is responsible to free the returned string.
-
-**/
-CHAR16*
-BOpt_AppendFileName (
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- );
-
-/**
-
- Check whether current FileName point to a valid
- Efi Image File.
-
- @param FileName File need to be checked.
-
- @retval TRUE Is Efi Image
- @retval FALSE Not a valid Efi Image
-
-**/
-BOOLEAN
-BOpt_IsEfiImageName (
- IN UINT16 *FileName
- );
-
-/**
-
- Check whether current FileName point to a valid Efi Application
-
- @param Dir Pointer to current Directory
- @param FileName Pointer to current File name.
-
- @retval TRUE Is a valid Efi Application
- @retval FALSE not a valid Efi Application
-
-**/
-BOOLEAN
-BOpt_IsEfiApp (
- IN EFI_FILE_HANDLE Dir,
- IN UINT16 *FileName
- );
-
-/**
-
- Get the Option Number that has not been allocated for use.
-
- @param Type The type of Option.
-
- @return The available Option Number.
-
-**/
-UINT16
-BOpt_GetOptionNumber (
- CHAR16 *Type
- );
-
-/**
-
- Get the Option Number for Boot#### that does not used.
-
- @return The available Option Number.
-
-**/
-UINT16
-BOpt_GetBootOptionNumber (
- VOID
- );
-
-/**
-
-Get the Option Number for Driver#### that does not used.
-
-@return The unused Option Number.
-
-**/
-UINT16
-BOpt_GetDriverOptionNumber (
- VOID
- );
-
-/**
- Create a menu entry give a Menu type.
-
- @param MenuType The Menu type to be created.
-
-
- @retval NULL If failed to create the menu.
- @return The menu.
-
-**/
-BM_MENU_ENTRY *
-BOpt_CreateMenuEntry (
- UINTN MenuType
- );
-
-/**
- Free up all resource allocated for a BM_MENU_ENTRY.
-
- @param MenuEntry A pointer to BM_MENU_ENTRY.
-
-**/
-VOID
-BOpt_DestroyMenuEntry (
- BM_MENU_ENTRY *MenuEntry
- );
-
-/**
- Get the Menu Entry from the list in Menu Entry List.
-
- If MenuNumber is great or equal to the number of Menu
- Entry in the list, then ASSERT.
-
- @param MenuOption The Menu Entry List to read the menu entry.
- @param MenuNumber The index of Menu Entry.
-
- @return The Menu Entry.
-
-**/
-BM_MENU_ENTRY *
-BOpt_GetMenuEntry (
- BM_MENU_OPTION *MenuOption,
- UINTN MenuNumber
- );
-
-//
-// Locate all serial io devices for console
-//
-/**
- Build a list containing all serial devices.
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_UNSUPPORTED No serial ports present.
-
-**/
-EFI_STATUS
-LocateSerialIo (
- VOID
- );
-
-//
-// Initializing Console menu
-//
-/**
- Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
- @retval EFI_SUCCESS The function always complete successfully.
-
-**/
-EFI_STATUS
-GetAllConsoles(
- VOID
- );
-
-//
-// Get current mode information
-//
-/**
- Get mode number according to column and row
-
- @param CallbackData The BMM context data.
-**/
-VOID
-GetConsoleOutMode (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// Cleaning up console menu
-//
-/**
- Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
- @retval EFI_SUCCESS The function always complete successfully.
-**/
-EFI_STATUS
-FreeAllConsoles (
- VOID
- );
-
-/**
- Update the device path that describing a terminal device
- based on the new BaudRate, Data Bits, parity and Stop Bits
- set.
-
- @param DevicePath The devicepath protocol instance wanted to be updated.
-
-**/
-VOID
-ChangeVariableDevicePath (
- IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-/**
- Update the multi-instance device path of Terminal Device based on
- the global TerminalMenu. If ChangeTernimal is TRUE, the terminal
- device path in the Terminal Device in TerminalMenu is also updated.
-
- @param DevicePath The multi-instance device path.
- @param ChangeTerminal TRUE, then device path in the Terminal Device
- in TerminalMenu is also updated; FALSE, no update.
-
- @return EFI_SUCCESS The function completes successfully.
-
-**/
-EFI_STATUS
-ChangeTerminalDevicePath (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- IN BOOLEAN ChangeTerminal
- );
-
-//
-// Variable operation by menu selection
-//
-/**
- This function create a currently loaded Boot Option from
- the BMM. It then appends this Boot Option to the end of
- the "BootOrder" list. It also append this Boot Opotion to the end
- of BootOptionMenu.
-
- @param CallbackData The BMM context data.
- @param NvRamMap The file explorer formset internal state.
-
- @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
- @retval EFI_SUCCESS If function completes successfully.
-
-**/
-EFI_STATUS
-Var_UpdateBootOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN FILE_EXPLORER_NV_DATA *NvRamMap
- );
-
-/**
- Delete Boot Option that represent a Deleted state in BootOptionMenu.
- After deleting this boot option, call Var_ChangeBootOrder to
- make sure BootOrder is in valid state.
-
- @retval EFI_SUCCESS If all boot load option EFI Variables corresponding to
- BM_LOAD_CONTEXT marked for deletion is deleted
- @return Others If failed to update the "BootOrder" variable after deletion.
-
-**/
-EFI_STATUS
-Var_DelBootOption (
- VOID
- );
-
-/**
- After any operation on Boot####, there will be a discrepancy in BootOrder.
- Since some are missing but in BootOrder, while some are present but are
- not reflected by BootOrder. Then a function rebuild BootOrder from
- scratch by content from BootOptionMenu is needed.
-
- @retval EFI_SUCCESS The boot order is updated successfully.
- @return other than EFI_SUCCESS if failed to change the "BootOrder" EFI Variable.
-
-**/
-EFI_STATUS
-Var_ChangeBootOrder (
- VOID
- );
-
-/**
- This function create a currently loaded Drive Option from
- the BMM. It then appends this Driver Option to the end of
- the "DriverOrder" list. It append this Driver Opotion to the end
- of DriverOptionMenu.
-
- @param CallbackData The BMM context data.
- @param HiiHandle The HII handle associated with the BMM formset.
- @param DescriptionData The description of this driver option.
- @param OptionalData The optional load option.
- @param ForceReconnect If to force reconnect.
-
- @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
- @retval EFI_SUCCESS If function completes successfully.
-
-**/
-EFI_STATUS
-Var_UpdateDriverOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN UINT16 *DescriptionData,
- IN UINT16 *OptionalData,
- IN UINT8 ForceReconnect
- );
-
-/**
- Delete Load Option that represent a Deleted state in BootOptionMenu.
- After deleting this Driver option, call Var_ChangeDriverOrder to
- make sure DriverOrder is in valid state.
-
- @retval EFI_SUCCESS Load Option is successfully updated.
- @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI
- Variable.
-
-**/
-EFI_STATUS
-Var_DelDriverOption (
- VOID
- );
-
-/**
- After any operation on Driver####, there will be a discrepancy in
- DriverOrder. Since some are missing but in DriverOrder, while some
- are present but are not reflected by DriverOrder. Then a function
- rebuild DriverOrder from scratch by content from DriverOptionMenu is
- needed.
-
- @retval EFI_SUCCESS The driver order is updated successfully.
- @return other than EFI_SUCCESS if failed to set the "DriverOrder" EFI Variable.
-
-**/
-EFI_STATUS
-Var_ChangeDriverOrder (
- VOID
- );
-
-/**
- This function delete and build multi-instance device path ConIn
- console device.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-**/
-EFI_STATUS
-Var_UpdateConsoleInpOption (
- VOID
- );
-
-/**
- This function delete and build multi-instance device path ConOut console device.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-**/
-EFI_STATUS
-Var_UpdateConsoleOutOption (
- VOID
- );
-
-/**
- This function delete and build multi-instance device path ErrOut console device.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-**/
-EFI_STATUS
-Var_UpdateErrorOutOption (
- VOID
- );
-
-/**
- Update the device path of "ConOut", "ConIn" and "ErrOut" based on the new BaudRate, Data Bits,
- parity and stop Bits set.
-
-**/
-VOID
-Var_UpdateAllConsoleOption (
- VOID
- );
-
-/**
- This function update the "BootNext" EFI Variable. If there is no "BootNex" specified in BMM,
- this EFI Variable is deleted.
- It also update the BMM context data specified the "BootNext" value.
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-
-**/
-EFI_STATUS
-Var_UpdateBootNext (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- This function update the "BootOrder" EFI Variable based on BMM Formset's NV map. It then refresh
- BootOptionMenu with the new "BootOrder" list.
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
- @return not The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-
-**/
-EFI_STATUS
-Var_UpdateBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- This function update the "DriverOrder" EFI Variable based on
- BMM Formset's NV map. It then refresh DriverOptionMenu
- with the new "DriverOrder" list.
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-
-**/
-EFI_STATUS
-Var_UpdateDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Update the legacy BBS boot option. VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid EFI Variable
- is udpated with the new Legacy Boot order. The EFI Variable of "Boot####" and gEfiGlobalVariableGuid
- is also updated.
-
- @param CallbackData The context data for BMM.
- @param FormId The form id.
-
- @return EFI_SUCCESS The function completed successfully.
- @retval EFI_NOT_FOUND If VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid EFI Variable can not be found.
-
-**/
-EFI_STATUS
-Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_FORM_ID FormId
- );
-
-/**
- Update the Text Mode of Console.
-
- @param CallbackData The context data for BMM.
-
- @retval EFI_SUCCSS If the Text Mode of Console is updated.
- @return Other value if the Text Mode of Console is not updated.
-
-**/
-EFI_STATUS
-Var_UpdateConMode (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// Following are page create and refresh functions
-//
-/**
- Refresh the global UpdateData structure.
-
-**/
-VOID
-RefreshUpdateData (
- VOID
- );
-
-/**
- Clean up the dynamic opcode at label and form specified by
- both LabelId.
-
- @param LabelId It is both the Form ID and Label ID for
- opcode deletion.
- @param CallbackData The BMM context data.
-
-**/
-VOID
-CleanUpPage (
- IN UINT16 LabelId,
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create a lit of boot option from global BootOptionMenu. It
- allow user to delete the boot option.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateBootDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create a lit of driver option from global DriverMenu.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateDrvAddHandlePage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create a lit of driver option from global DriverOptionMenu. It
- allow user to delete the driver option.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateDrvDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Prepare the page to allow user to add description for a Driver Option.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateDriverAddHandleDescPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Dispatch the correct update page function to call based on the UpdatePageId.
-
- @param UpdatePageId The form ID.
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdatePageBody (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create the dynamic page to allow user to set the "BootNext" vaule.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateBootNextPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create the dynamic page to allow user to set the "TimeOut" vaule.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateTimeOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
- Parity, Stop Bits, Terminal Type.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateTerminalPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Refresh the text mode page
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateConModePage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create a list of Goto Opcode for all terminal devices logged
- by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateConCOMPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Create a dynamic page so that Legacy Device boot order
- can be set for specified device type.
-
- @param UpdatePageId The form ID. It also spefies the legacy device type.
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateSetLegacyDeviceOrderPage (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-
-/**
- Function opens and returns a file handle to the root directory of a volume.
-
- @param DeviceHandle A handle for a device
- @return A valid file handle or NULL is returned
-**/
-EFI_FILE_HANDLE
-EfiLibOpenRoot (
- IN EFI_HANDLE DeviceHandle
- );
-
-/**
- Function gets the file system information from an open file descriptor,
- and stores it in a buffer allocated from pool.
-
- @param FHand The file handle.
-
- @return A pointer to a buffer with file information.
- NULL is returned if failed to get Vaolume Label Info.
-**/
-EFI_FILE_SYSTEM_VOLUME_LABEL *
-EfiLibFileSystemVolumeLabelInfo (
- IN EFI_FILE_HANDLE FHand
- );
-
-/**
-
- Function gets the file information from an open file descriptor, and stores it
- in a buffer allocated from pool.
-
- @param FHand File Handle.
-
- @return A pointer to a buffer with file information or NULL is returned
-
-**/
-EFI_FILE_INFO *
-EfiLibFileInfo (
- IN EFI_FILE_HANDLE FHand
- );
-
-/**
- Adjusts the size of a previously allocated buffer.
-
- @param OldPool A pointer to the buffer whose size is being adjusted.
- @param OldSize The size of the current buffer.
- @param NewSize The size of the new buffer.
-
- @return The newly allocated buffer. if NULL, allocation failed.
-
-**/
-VOID*
-EfiReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- );
-
-/**
- Function deletes the variable specified by VarName and VarGuid.
-
-
- @param VarName A Null-terminated Unicode string that is
- the name of the vendor's variable.
-
- @param VarGuid A unique identifier for the vendor.
-
- @retval EFI_SUCCESS The variable was found and removed
- @retval EFI_UNSUPPORTED The variable store was inaccessible
- @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available
- @retval EFI_NOT_FOUND The variable was not found
-
-**/
-EFI_STATUS
-EfiLibDeleteVariable (
- IN CHAR16 *VarName,
- IN EFI_GUID *VarGuid
- );
-
-/**
- Duplicate a string.
-
- @param Src The source.
-
- @return A new string which is duplicated copy of the source.
- @retval NULL If there is not enough memory.
-
-**/
-CHAR16 *
-EfiStrDuplicate (
- IN CHAR16 *Src
- );
-
-/**
- Function is used to determine the number of device path instances
- that exist in a device path.
-
-
- @param DevicePath A pointer to a device path data structure.
-
- @return This function counts and returns the number of device path instances
- in DevicePath.
-
-**/
-UINTN
-EfiDevicePathInstanceCount (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-/**
- Create string tokens for a menu from its help strings and display strings
-
-
- @param CallbackData The BMM context data.
- @param HiiHandle Hii Handle of the package to be updated.
- @param MenuOption The Menu whose string tokens need to be created
-
- @retval EFI_SUCCESS string tokens created successfully
- @retval others contain some errors
-
-**/
-EFI_STATUS
-CreateMenuStringToken (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN BM_MENU_OPTION *MenuOption
- );
-
-/**
- Get a string from the Data Hub record based on
- a device path.
-
- @param DevPath The device Path.
-
- @return A string located from the Data Hub records based on
- the device path.
- @retval NULL If failed to get the String from Data Hub.
-
-**/
-UINT16 *
-EfiLibStrFromDatahub (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-/**
- Initialize the Boot Maintenance Utitliy.
-
- @retval EFI_SUCCESS utility ended successfully.
- @retval others contain some errors.
-
-**/
-EFI_STATUS
-InitializeBM (
- VOID
- );
-
-/**
- Start boot maintenance manager
-
- @retval EFI_SUCCESS If BMM is invoked successfully.
- @return Other value if BMM return unsuccessfully.
-
-**/
-EFI_STATUS
-BdsStartBootMaint (
- VOID
- );
-
-/**
- Intialize all the string depositories.
-
-**/
-VOID
-InitializeStringDepository (
- VOID
- );
-
-/**
- Fetch a usable string node from the string depository and return the string token.
-
-
- @param CallbackData The BMM context data.
- @param StringDepository Pointer of the string depository.
-
- @retval EFI_STRING_ID String token.
-
-**/
-EFI_STRING_ID
-GetStringTokenFromDepository (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN STRING_DEPOSITORY *StringDepository
- );
-
-/**
- Reclaim string depositories by moving the current node pointer to list head..
-**/
-VOID
-ReclaimStringDepository (
- VOID
- );
-
-/**
- Release resource for all the string depositories.
-
-**/
-VOID
-CleanUpStringDepository (
- VOID
- );
-
-/**
- Function handling request to apply changes for BMM pages.
-
- @param Private Pointer to callback data buffer.
- @param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
- @param FormId ID of the form which has sent the request to apply change.
-
- @retval EFI_SUCCESS Change successfully applied.
- @retval Other Error occurs while trying to apply changes.
-
-**/
-EFI_STATUS
-ApplyChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
- IN EFI_FORM_ID FormId
- );
-
-/**
- Discard all changes done to the BMM pages such as Boot Order change,
- Driver order change.
-
- @param Private The BMM context data.
- @param CurrentFakeNVMap The current Fack NV Map.
-
-**/
-VOID
-DiscardChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
- );
-
-/**
- Dispatch the display to the next page based on NewPageId.
-
- @param Private The BMM context data.
- @param NewPageId The original page ID.
-
-**/
-VOID
-UpdatePageId (
- BMM_CALLBACK_DATA *Private,
- UINT16 NewPageId
- );
-
-/**
- Boot a file selected by user at File Expoloer of BMM.
-
- @param FileContext The file context data, which contains the device path
- of the file to be boot from.
-
- @retval EFI_SUCCESS The function completed successfull.
- @return Other value if the boot from the file fails.
-
-**/
-EFI_STATUS
-BootThisFile (
- IN BM_FILE_CONTEXT *FileContext
- );
-
-/**
- Update the file explower page with the refershed file system.
-
-
- @param CallbackData BMM context data
- @param KeyValue Key value to identify the type of data to expect.
-
- @retval TRUE Inform the caller to create a callback packet to exit file explorer.
- @retval FALSE Indicate that there is no need to exit file explorer.
-
-**/
-BOOLEAN
-UpdateFileExplorer (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT16 KeyValue
- );
-
-/**
- This function processes the results of changes in configuration.
- When user select a interactive opcode, this callback will be triggered.
- Based on the Question(QuestionId) that triggers the callback, the corresponding
- actions is performed. It handles:
-
- 1) the addition of boot option.
- 2) the addition of driver option.
- 3) exit from file browser
- 4) update of file content if a dir is selected.
- 5) boot the file if a file is selected in "boot from file"
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
-
-**/
-EFI_STATUS
-EFIAPI
-FileExplorerCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- );
-
-/**
- This function applies changes in a driver's configuration.
- Input is a Configuration, which has the routing data for this
- driver followed by name / value configuration pairs. The driver
- must apply those pairs to its configurable storage. If the
- driver's configuration is stored in a linear block of data
- and the driver's name / value pairs are in <BlockConfig>
- format, it may use the ConfigToBlock helper function (above) to
- simplify the job. Currently not implemented.
-
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param[in] Configuration A null-terminated Unicode string in
- <ConfigString> format.
- @param[out] Progress A pointer to a string filled in with the
- offset of the most recent '&' before the
- first failing name / value pair (or the
- beginn ing of the string if the failure
- is in the first name / value pair) or
- the terminating NULL if all was
- successful.
-
- @retval EFI_SUCCESS The results have been distributed or are
- awaiting distribution.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
- parts of the results that must be
- stored awaiting possible future
- protocols.
- @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
- Results parameter would result
- in this type of error.
- @retval EFI_NOT_FOUND Target for the specified routing data
- was not found.
-**/
-EFI_STATUS
-EFIAPI
-FileExplorerRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- );
-
-/**
- Dispatch BMM formset and FileExplorer formset.
-
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS If function complete successfully.
- @return Other value if the Setup Browser process BMM's pages and
- return unsuccessfully.
-
-**/
-EFI_STATUS
-FormSetDispatcher (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Function returns the value of the specified variable.
-
- @param Name A Null-terminated Unicode string that is
- the name of the vendor's variable.
- @param VendorGuid A unique identifier for the vendor.
-
- @return The payload of the variable.
- @retval NULL If the variable can't be read.
-
-**/
-VOID *
-EfiLibGetVariable (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid
- );
-
-/**
- Get option number according to Boot#### and BootOrder variable.
- The value is saved as #### + 1.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-GetBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Get driver option order from globalc DriverOptionMenu.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
- Intall BootMaint and FileExplorer HiiPackages.
-
-**/
-EFI_STATUS
-InitBMPackage (
- VOID
- );
-
-/**
- Remvoe the intalled BootMaint and FileExplorer HiiPackages.
-
-**/
-VOID
-FreeBMPackage (
- VOID
- );
-
-/**
- According to LegacyDevOrder variable to get legacy FD\HD\CD\NET\BEV
- devices list .
-
- @param CallbackData The BMM context data.
-**/
-VOID
-GetLegacyDeviceOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
-
- Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
- in BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetConsoleInCheck (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
-
- Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
- in BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetConsoleOutCheck (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
-
- Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
- in BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetConsoleErrCheck (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
-
- Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
- to BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetTerminalAttribute (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-/**
-
- Find the first instance of this Protocol
- in the system and return it's interface.
-
-
- @param ProtocolGuid Provides the protocol to search for
- @param Interface On return, a pointer to the first interface
- that matches ProtocolGuid
-
- @retval EFI_SUCCESS A protocol instance matching ProtocolGuid was found
- @retval EFI_NOT_FOUND No protocol instances were found that match ProtocolGuid
-
-**/
-EFI_STATUS
-EfiLibLocateProtocol (
- IN EFI_GUID *ProtocolGuid,
- OUT VOID **Interface
- );
-
-//
-// Global variable in this program (defined in data.c)
-//
-extern BM_MENU_OPTION BootOptionMenu;
-extern BM_MENU_OPTION DriverOptionMenu;
-extern BM_MENU_OPTION FsOptionMenu;
-extern BM_MENU_OPTION ConsoleInpMenu;
-extern BM_MENU_OPTION ConsoleOutMenu;
-extern BM_MENU_OPTION ConsoleErrMenu;
-extern BM_MENU_OPTION DirectoryMenu;
-extern BM_MENU_OPTION DriverMenu;
-extern BM_MENU_OPTION TerminalMenu;
-extern BM_MENU_OPTION LegacyFDMenu;
-extern BM_MENU_OPTION LegacyHDMenu;
-extern BM_MENU_OPTION LegacyCDMenu;
-extern BM_MENU_OPTION LegacyNETMenu;
-extern BM_MENU_OPTION LegacyBEVMenu;
-extern UINT16 TerminalType[];
-extern COM_ATTR BaudRateList[19];
-extern COM_ATTR DataBitsList[4];
-extern COM_ATTR ParityList[5];
-extern COM_ATTR StopBitsList[3];
-extern EFI_GUID TerminalTypeGuid[4];
-extern STRING_DEPOSITORY *FileOptionStrDepository;
-extern STRING_DEPOSITORY *ConsoleOptionStrDepository;
-extern STRING_DEPOSITORY *BootOptionStrDepository;
-extern STRING_DEPOSITORY *BootOptionHelpStrDepository;
-extern STRING_DEPOSITORY *DriverOptionStrDepository;
-extern STRING_DEPOSITORY *DriverOptionHelpStrDepository;
-extern STRING_DEPOSITORY *TerminalStrDepository;
-extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
-extern UINT16 mFlowControlType[2];
-extern UINT32 mFlowControlValue[2];
-//
-// Shared IFR form update data
-//
-extern VOID *mStartOpCodeHandle;
-extern VOID *mEndOpCodeHandle;
-extern EFI_IFR_GUID_LABEL *mStartLabel;
-extern EFI_IFR_GUID_LABEL *mEndLabel;
-
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
deleted file mode 100644
index 56bcfab23f..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
+++ /dev/null
@@ -1,1823 +0,0 @@
-/** @file
- Provide boot option support for Application "BootMaint"
-
- Include file system navigation, system handle selection
-
- Boot option manipulation
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "BootMaint.h"
-#include "BBSsupport.h"
-
-/**
- Create a menu entry by given menu type.
-
- @param MenuType The Menu type to be created.
-
- @retval NULL If failed to create the menu.
- @return the new menu entry.
-
-**/
-BM_MENU_ENTRY *
-BOpt_CreateMenuEntry (
- UINTN MenuType
- )
-{
- BM_MENU_ENTRY *MenuEntry;
- UINTN ContextSize;
-
- //
- // Get context size according to menu type
- //
- switch (MenuType) {
- case BM_LOAD_CONTEXT_SELECT:
- ContextSize = sizeof (BM_LOAD_CONTEXT);
- break;
-
- case BM_FILE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_FILE_CONTEXT);
- break;
-
- case BM_CONSOLE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_CONSOLE_CONTEXT);
- break;
-
- case BM_TERMINAL_CONTEXT_SELECT:
- ContextSize = sizeof (BM_TERMINAL_CONTEXT);
- break;
-
- case BM_HANDLE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_HANDLE_CONTEXT);
- break;
-
- case BM_LEGACY_DEV_CONTEXT_SELECT:
- ContextSize = sizeof (BM_LEGACY_DEVICE_CONTEXT);
- break;
-
- default:
- ContextSize = 0;
- break;
- }
-
- if (ContextSize == 0) {
- return NULL;
- }
-
- //
- // Create new menu entry
- //
- MenuEntry = AllocateZeroPool (sizeof (BM_MENU_ENTRY));
- if (MenuEntry == NULL) {
- return NULL;
- }
-
- MenuEntry->VariableContext = AllocateZeroPool (ContextSize);
- if (MenuEntry->VariableContext == NULL) {
- FreePool (MenuEntry);
- return NULL;
- }
-
- MenuEntry->Signature = BM_MENU_ENTRY_SIGNATURE;
- MenuEntry->ContextSelection = MenuType;
- return MenuEntry;
-}
-
-/**
- Free up all resource allocated for a BM_MENU_ENTRY.
-
- @param MenuEntry A pointer to BM_MENU_ENTRY.
-
-**/
-VOID
-BOpt_DestroyMenuEntry (
- BM_MENU_ENTRY *MenuEntry
- )
-{
- BM_LOAD_CONTEXT *LoadContext;
- BM_FILE_CONTEXT *FileContext;
- BM_CONSOLE_CONTEXT *ConsoleContext;
- BM_TERMINAL_CONTEXT *TerminalContext;
- BM_HANDLE_CONTEXT *HandleContext;
- BM_LEGACY_DEVICE_CONTEXT *LegacyDevContext;
-
- //
- // Select by the type in Menu entry for current context type
- //
- switch (MenuEntry->ContextSelection) {
- case BM_LOAD_CONTEXT_SELECT:
- LoadContext = (BM_LOAD_CONTEXT *) MenuEntry->VariableContext;
- FreePool (LoadContext->FilePathList);
- FreePool (LoadContext->LoadOption);
- if (LoadContext->OptionalData != NULL) {
- FreePool (LoadContext->OptionalData);
- }
- FreePool (LoadContext);
- break;
-
- case BM_FILE_CONTEXT_SELECT:
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- if (!FileContext->IsRoot) {
- FreePool (FileContext->DevicePath);
- } else {
- if (FileContext->FHandle != NULL) {
- FileContext->FHandle->Close (FileContext->FHandle);
- }
- }
-
- if (FileContext->FileName != NULL) {
- FreePool (FileContext->FileName);
- }
- if (FileContext->Info != NULL) {
- FreePool (FileContext->Info);
- }
- FreePool (FileContext);
- break;
-
- case BM_CONSOLE_CONTEXT_SELECT:
- ConsoleContext = (BM_CONSOLE_CONTEXT *) MenuEntry->VariableContext;
- FreePool (ConsoleContext->DevicePath);
- FreePool (ConsoleContext);
- break;
-
- case BM_TERMINAL_CONTEXT_SELECT:
- TerminalContext = (BM_TERMINAL_CONTEXT *) MenuEntry->VariableContext;
- FreePool (TerminalContext->DevicePath);
- FreePool (TerminalContext);
- break;
-
- case BM_HANDLE_CONTEXT_SELECT:
- HandleContext = (BM_HANDLE_CONTEXT *) MenuEntry->VariableContext;
- FreePool (HandleContext);
- break;
-
- case BM_LEGACY_DEV_CONTEXT_SELECT:
- LegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) MenuEntry->VariableContext;
- FreePool (LegacyDevContext);
-
- default:
- break;
- }
-
- FreePool (MenuEntry->DisplayString);
- if (MenuEntry->HelpString != NULL) {
- FreePool (MenuEntry->HelpString);
- }
-
- FreePool (MenuEntry);
-}
-
-/**
- Get the Menu Entry from the list in Menu Entry List.
-
- If MenuNumber is great or equal to the number of Menu
- Entry in the list, then ASSERT.
-
- @param MenuOption The Menu Entry List to read the menu entry.
- @param MenuNumber The index of Menu Entry.
-
- @return The Menu Entry.
-
-**/
-BM_MENU_ENTRY *
-BOpt_GetMenuEntry (
- BM_MENU_OPTION *MenuOption,
- UINTN MenuNumber
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
- LIST_ENTRY *List;
-
- ASSERT (MenuNumber < MenuOption->MenuNumber);
-
- List = MenuOption->Head.ForwardLink;
- for (Index = 0; Index < MenuNumber; Index++) {
- List = List->ForwardLink;
- }
-
- NewMenuEntry = CR (List, BM_MENU_ENTRY, Link, BM_MENU_ENTRY_SIGNATURE);
-
- return NewMenuEntry;
-}
-
-/**
- This function build the FsOptionMenu list which records all
- available file system in the system. They includes all instances
- of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM
- and all type of legacy boot device.
-
- @param CallbackData BMM context data
-
- @retval EFI_SUCCESS Success find the file system
- @retval EFI_OUT_OF_RESOURCES Can not create menu entry
-
-**/
-EFI_STATUS
-BOpt_FindFileSystem (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN NoBlkIoHandles;
- UINTN NoSimpleFsHandles;
- UINTN NoLoadFileHandles;
- EFI_HANDLE *BlkIoHandle;
- EFI_HANDLE *SimpleFsHandle;
- EFI_HANDLE *LoadFileHandle;
- UINT16 *VolumeLabel;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- UINTN Index;
- EFI_STATUS Status;
- BM_MENU_ENTRY *MenuEntry;
- BM_FILE_CONTEXT *FileContext;
- UINT16 *TempStr;
- UINTN OptionNumber;
- VOID *Buffer;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINT16 DeviceType;
- BBS_BBS_DEVICE_PATH BbsDevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- BOOLEAN RemovableMedia;
-
-
- NoSimpleFsHandles = 0;
- NoLoadFileHandles = 0;
- OptionNumber = 0;
- InitializeListHead (&FsOptionMenu.Head);
-
- //
- // Locate Handles that support BlockIo protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiBlockIoProtocolGuid,
- NULL,
- &NoBlkIoHandles,
- &BlkIoHandle
- );
- if (!EFI_ERROR (Status)) {
-
- for (Index = 0; Index < NoBlkIoHandles; Index++) {
- Status = gBS->HandleProtocol (
- BlkIoHandle[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
- );
-
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Issue a dummy read to trigger reinstall of BlockIo protocol for removable media
- //
- if (BlkIo->Media->RemovableMedia) {
- Buffer = AllocateZeroPool (BlkIo->Media->BlockSize);
- if (NULL == Buffer) {
- FreePool (BlkIoHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- BlkIo->ReadBlocks (
- BlkIo,
- BlkIo->Media->MediaId,
- 0,
- BlkIo->Media->BlockSize,
- Buffer
- );
- FreePool (Buffer);
- }
- }
- FreePool (BlkIoHandle);
- }
-
- //
- // Locate Handles that support Simple File System protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &NoSimpleFsHandles,
- &SimpleFsHandle
- );
- if (!EFI_ERROR (Status)) {
- //
- // Find all the instances of the File System prototocol
- //
- for (Index = 0; Index < NoSimpleFsHandles; Index++) {
- Status = gBS->HandleProtocol (
- SimpleFsHandle[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
- );
- if (EFI_ERROR (Status)) {
- //
- // If no block IO exists assume it's NOT a removable media
- //
- RemovableMedia = FALSE;
- } else {
- //
- // If block IO exists check to see if it's remobable media
- //
- RemovableMedia = BlkIo->Media->RemovableMedia;
- }
-
- //
- // Allocate pool for this load option
- //
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- FreePool (SimpleFsHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- FileContext->Handle = SimpleFsHandle[Index];
- MenuEntry->OptionNumber = Index;
- FileContext->FHandle = EfiLibOpenRoot (FileContext->Handle);
- if (FileContext->FHandle == NULL) {
- BOpt_DestroyMenuEntry (MenuEntry);
- continue;
- }
-
- MenuEntry->HelpString = DevicePathToStr (DevicePathFromHandle (FileContext->Handle));
- FileContext->Info = EfiLibFileSystemVolumeLabelInfo (FileContext->FHandle);
- FileContext->FileName = EfiStrDuplicate (L"\\");
- FileContext->DevicePath = FileDevicePath (
- FileContext->Handle,
- FileContext->FileName
- );
- FileContext->IsDir = TRUE;
- FileContext->IsRoot = TRUE;
- FileContext->IsRemovableMedia = RemovableMedia;
- FileContext->IsLoadFile = FALSE;
-
- //
- // Get current file system's Volume Label
- //
- if (FileContext->Info == NULL) {
- VolumeLabel = L"NO FILE SYSTEM INFO";
- } else {
- VolumeLabel = FileContext->Info->VolumeLabel;
- if (*VolumeLabel == 0x0000) {
- VolumeLabel = L"NO VOLUME LABEL";
- }
- }
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"%s, [%s]",
- VolumeLabel,
- TempStr
- );
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
-
- if (NoSimpleFsHandles != 0) {
- FreePool (SimpleFsHandle);
- }
- //
- // Searching for handles that support Load File protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiLoadFileProtocolGuid,
- NULL,
- &NoLoadFileHandles,
- &LoadFileHandle
- );
-
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < NoLoadFileHandles; Index++) {
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- FreePool (LoadFileHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = TRUE;
- FileContext->Handle = LoadFileHandle[Index];
- FileContext->IsRoot = TRUE;
-
- FileContext->DevicePath = DevicePathFromHandle (FileContext->Handle);
- FileContext->FileName = DevicePathToStr (FileContext->DevicePath);
-
- MenuEntry->HelpString = DevicePathToStr (FileContext->DevicePath);
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"Load File [%s]",
- TempStr
- );
-
- MenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
-
- if (NoLoadFileHandles != 0) {
- FreePool (LoadFileHandle);
- }
-
- //
- // Add Legacy Boot Option Support Here
- //
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- (VOID **) &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
-
- for (Index = BBS_TYPE_FLOPPY; Index <= BBS_TYPE_EMBEDDED_NETWORK; Index++) {
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = TRUE;
- FileContext->IsBootLegacy = TRUE;
- DeviceType = (UINT16) Index;
- BbsDevicePathNode.Header.Type = BBS_DEVICE_PATH;
- BbsDevicePathNode.Header.SubType = BBS_BBS_DP;
- SetDevicePathNodeLength (
- &BbsDevicePathNode.Header,
- sizeof (BBS_BBS_DEVICE_PATH)
- );
- BbsDevicePathNode.DeviceType = DeviceType;
- BbsDevicePathNode.StatusFlag = 0;
- BbsDevicePathNode.String[0] = 0;
- DevicePath = AppendDevicePathNode (
- EndDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevicePathNode
- );
-
- FileContext->DevicePath = DevicePath;
- MenuEntry->HelpString = DevicePathToStr (FileContext->DevicePath);
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"Boot Legacy [%s]",
- TempStr
- );
- MenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
- //
- // Remember how many file system options are here
- //
- FsOptionMenu.MenuNumber = OptionNumber;
- return EFI_SUCCESS;
-}
-
-/**
- Free resources allocated in Allocate Rountine.
-
- @param FreeMenu Menu to be freed
-**/
-VOID
-BOpt_FreeMenu (
- BM_MENU_OPTION *FreeMenu
- )
-{
- BM_MENU_ENTRY *MenuEntry;
- while (!IsListEmpty (&FreeMenu->Head)) {
- MenuEntry = CR (
- FreeMenu->Head.ForwardLink,
- BM_MENU_ENTRY,
- Link,
- BM_MENU_ENTRY_SIGNATURE
- );
- RemoveEntryList (&MenuEntry->Link);
- BOpt_DestroyMenuEntry (MenuEntry);
- }
- FreeMenu->MenuNumber = 0;
-}
-
-/**
- Find files under current directory
- All files and sub-directories in current directory
- will be stored in DirectoryMenu for future use.
-
- @param CallbackData The BMM context data.
- @param MenuEntry The Menu Entry.
-
- @retval EFI_SUCCESS Get files from current dir successfully.
- @return Other value if can't get files from current dir.
-
-**/
-EFI_STATUS
-BOpt_FindFiles (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_ENTRY *MenuEntry
- )
-{
- EFI_FILE_HANDLE NewDir;
- EFI_FILE_HANDLE Dir;
- EFI_FILE_INFO *DirInfo;
- UINTN BufferSize;
- UINTN DirBufferSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *FileContext;
- BM_FILE_CONTEXT *NewFileContext;
- UINTN Pass;
- EFI_STATUS Status;
- UINTN OptionNumber;
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
- Dir = FileContext->FHandle;
- OptionNumber = 0;
- //
- // Open current directory to get files from it
- //
- Status = Dir->Open (
- Dir,
- &NewDir,
- FileContext->FileName,
- EFI_FILE_READ_ONLY,
- 0
- );
- if (!FileContext->IsRoot) {
- Dir->Close (Dir);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- DirInfo = EfiLibFileInfo (NewDir);
- if (DirInfo == NULL) {
- return EFI_NOT_FOUND;
- }
-
- if ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- FileContext->DevicePath = FileDevicePath (
- FileContext->Handle,
- FileContext->FileName
- );
-
- DirBufferSize = sizeof (EFI_FILE_INFO) + 1024;
- DirInfo = AllocateZeroPool (DirBufferSize);
- if (DirInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Get all files in current directory
- // Pass 1 to get Directories
- // Pass 2 to get files that are EFI images
- //
- for (Pass = 1; Pass <= 2; Pass++) {
- NewDir->SetPosition (NewDir, 0);
- for (;;) {
- BufferSize = DirBufferSize;
- Status = NewDir->Read (NewDir, &BufferSize, DirInfo);
- if (EFI_ERROR (Status) || BufferSize == 0) {
- break;
- }
-
- if (((DirInfo->Attribute & EFI_FILE_DIRECTORY) != 0 && Pass == 2) ||
- ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == 0 && Pass == 1)
- ) {
- //
- // Pass 1 is for Directories
- // Pass 2 is for file names
- //
- continue;
- }
-
- if (!(BOpt_IsEfiImageName (DirInfo->FileName) || (DirInfo->Attribute & EFI_FILE_DIRECTORY) != 0)) {
- //
- // Slip file unless it is a directory entry or a .EFI file
- //
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
- NewFileContext->Handle = FileContext->Handle;
- NewFileContext->FileName = BOpt_AppendFileName (
- FileContext->FileName,
- DirInfo->FileName
- );
- NewFileContext->FHandle = NewDir;
- NewFileContext->DevicePath = FileDevicePath (
- NewFileContext->Handle,
- NewFileContext->FileName
- );
- NewMenuEntry->HelpString = NULL;
-
- MenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- FileOptionStrDepository
- );
-
- NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);
-
- if (NewFileContext->IsDir) {
- BufferSize = StrLen (DirInfo->FileName) * 2 + 6;
- NewMenuEntry->DisplayString = AllocateZeroPool (BufferSize);
-
- UnicodeSPrint (
- NewMenuEntry->DisplayString,
- BufferSize,
- L"<%s>",
- DirInfo->FileName
- );
-
- } else {
- NewMenuEntry->DisplayString = EfiStrDuplicate (DirInfo->FileName);
- }
-
- NewFileContext->IsRoot = FALSE;
- NewFileContext->IsLoadFile = FALSE;
- NewFileContext->IsRemovableMedia = FALSE;
-
- NewMenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&DirectoryMenu.Head, &NewMenuEntry->Link);
- }
- }
-
- DirectoryMenu.MenuNumber = OptionNumber;
- FreePool (DirInfo);
- return EFI_SUCCESS;
-}
-
-/**
- Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_OUT_OF_RESOURCES No enough memory to complete this function.
-
-**/
-EFI_STATUS
-BOpt_GetLegacyOptions (
- VOID
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LEGACY_DEVICE_CONTEXT *NewLegacyDevContext;
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINT16 HddCount;
- HDD_INFO *HddInfo;
- UINT16 BbsCount;
- BBS_TABLE *BbsTable;
- UINT16 Index;
- CHAR16 DescString[100];
- UINTN FDNum;
- UINTN HDNum;
- UINTN CDNum;
- UINTN NETNum;
- UINTN BEVNum;
-
- NewMenuEntry = NULL;
- HddInfo = NULL;
- BbsTable = NULL;
- BbsCount = 0;
-
- //
- // Initialize Bbs Table Context from BBS info data
- //
- InitializeListHead (&LegacyFDMenu.Head);
- InitializeListHead (&LegacyHDMenu.Head);
- InitializeListHead (&LegacyCDMenu.Head);
- InitializeListHead (&LegacyNETMenu.Head);
- InitializeListHead (&LegacyBEVMenu.Head);
-
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- (VOID **) &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
- Status = LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &HddInfo,
- &BbsCount,
- &BbsTable
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- FDNum = 0;
- HDNum = 0;
- CDNum = 0;
- NETNum = 0;
- BEVNum = 0;
-
- for (Index = 0; Index < BbsCount; Index++) {
- if ((BBS_IGNORE_ENTRY == BbsTable[Index].BootPriority) ||
- (BBS_DO_NOT_BOOT_FROM == BbsTable[Index].BootPriority)
- ) {
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LEGACY_DEV_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- break;
- }
-
- NewLegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;
- NewLegacyDevContext->BbsEntry = &BbsTable[Index];
- NewLegacyDevContext->BbsIndex = Index;
- NewLegacyDevContext->BbsCount = BbsCount;
- BdsBuildLegacyDevNameString (
- &BbsTable[Index],
- Index,
- sizeof (DescString),
- DescString
- );
- NewLegacyDevContext->Description = AllocateCopyPool (StrSize (DescString), DescString);
- if (NULL == NewLegacyDevContext->Description) {
- break;
- }
-
- NewMenuEntry->DisplayString = NewLegacyDevContext->Description;
- NewMenuEntry->HelpString = NULL;
-
- switch (BbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link);
- FDNum++;
- break;
-
- case BBS_HARDDISK:
- InsertTailList (&LegacyHDMenu.Head, &NewMenuEntry->Link);
- HDNum++;
- break;
-
- case BBS_CDROM:
- InsertTailList (&LegacyCDMenu.Head, &NewMenuEntry->Link);
- CDNum++;
- break;
-
- case BBS_EMBED_NETWORK:
- InsertTailList (&LegacyNETMenu.Head, &NewMenuEntry->Link);
- NETNum++;
- break;
-
- case BBS_BEV_DEVICE:
- InsertTailList (&LegacyBEVMenu.Head, &NewMenuEntry->Link);
- BEVNum++;
- break;
- }
- }
-
- if (Index != BbsCount) {
- BOpt_FreeLegacyOptions ();
- return EFI_OUT_OF_RESOURCES;
- }
-
- LegacyFDMenu.MenuNumber = FDNum;
- LegacyHDMenu.MenuNumber = HDNum;
- LegacyCDMenu.MenuNumber = CDNum;
- LegacyNETMenu.MenuNumber = NETNum;
- LegacyBEVMenu.MenuNumber = BEVNum;
- return EFI_SUCCESS;
-}
-
-/**
- Free out resouce allocated from Legacy Boot Options.
-
-**/
-VOID
-BOpt_FreeLegacyOptions (
- VOID
- )
-{
- BOpt_FreeMenu (&LegacyFDMenu);
- BOpt_FreeMenu (&LegacyHDMenu);
- BOpt_FreeMenu (&LegacyCDMenu);
- BOpt_FreeMenu (&LegacyNETMenu);
- BOpt_FreeMenu (&LegacyBEVMenu);
-}
-
-/**
-
- Build the BootOptionMenu according to BootOrder Variable.
- This Routine will access the Boot#### to get EFI_LOAD_OPTION.
-
- @param CallbackData The BMM context data.
-
- @return EFI_NOT_FOUND Fail to find "BootOrder" variable.
- @return EFI_SUCESS Success build boot option menu.
-
-**/
-EFI_STATUS
-BOpt_GetBootOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN Index;
- UINT16 BootString[10];
- UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
- UINTN BootOptionSize;
- BOOLEAN BootNextFlag;
- UINT16 *BootOrderList;
- UINTN BootOrderListSize;
- UINT16 *BootNext;
- UINTN BootNextSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT8 *LoadOptionPtr;
- UINTN StringSize;
- UINTN OptionalDataSize;
- UINT8 *LoadOptionEnd;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINTN MenuCount;
- UINT8 *Ptr;
-
- MenuCount = 0;
- BootOrderListSize = 0;
- BootNextSize = 0;
- BootOrderList = NULL;
- BootNext = NULL;
- LoadOptionFromVar = NULL;
- BOpt_FreeMenu (&BootOptionMenu);
- InitializeListHead (&BootOptionMenu.Head);
-
- //
- // Get the BootOrder from the Var
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
- if (BootOrderList == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get the BootNext from the Var
- //
- BootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- if (BootNext != NULL) {
- if (BootNextSize != sizeof (UINT16)) {
- FreePool (BootNext);
- BootNext = NULL;
- }
- }
-
- for (Index = 0; Index < BootOrderListSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", BootOrderList[Index]);
- //
- // Get all loadoptions from the VAR
- //
- LoadOptionFromVar = BdsLibGetVariableAndSize (
- BootString,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (LoadOptionFromVar == NULL) {
- continue;
- }
-
- LoadOption = AllocateZeroPool (BootOptionSize);
- if (LoadOption == NULL) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, BootOptionSize);
- FreePool (LoadOptionFromVar);
-
- if (BootNext != NULL) {
- BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);
- } else {
- BootNextFlag = FALSE;
- }
-
- if (0 == (*((UINT32 *) LoadOption) & LOAD_OPTION_ACTIVE)) {
- FreePool (LoadOption);
- continue;
- }
- //
- // BUGBUG: could not return EFI_OUT_OF_RESOURCES here directly.
- // the buffer allocated already should be freed before returning.
- //
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + BootOptionSize;
-
- NewMenuEntry->OptionNumber = BootOrderList[Index];
- NewLoadContext->LoadOptionModified = FALSE;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->IsBootNext = BootNextFlag;
-
- //
- // Is a Legacy Device?
- //
- Ptr = (UINT8 *) LoadOption;
-
- //
- // Attribute = *(UINT32 *)Ptr;
- //
- Ptr += sizeof (UINT32);
-
- //
- // FilePathSize = *(UINT16 *)Ptr;
- //
- Ptr += sizeof (UINT16);
-
- //
- // Description = (CHAR16 *)Ptr;
- //
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- //
- // Now Ptr point to Device Path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- if ((BBS_DEVICE_PATH == DevicePath->Type) && (BBS_BBS_DP == DevicePath->SubType)) {
- NewLoadContext->IsLegacy = TRUE;
- } else {
- NewLoadContext->IsLegacy = FALSE;
- }
- //
- // LoadOption is a pointer type of UINT8
- // for easy use with following LOAD_OPTION
- // embedded in this struct
- //
- NewLoadContext->LoadOption = LoadOption;
- NewLoadContext->LoadOptionSize = BootOptionSize;
-
- NewLoadContext->Attributes = *(UINT32 *) LoadOptionPtr;
- NewLoadContext->IsActive = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);
-
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- LoadOptionPtr += sizeof (UINT32);
-
- NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;
- LoadOptionPtr += sizeof (UINT16);
-
- StringSize = StrSize((UINT16*)LoadOptionPtr);
-
- NewLoadContext->Description = AllocateCopyPool (StrSize((UINT16*)LoadOptionPtr), LoadOptionPtr);
- ASSERT (NewLoadContext->Description != NULL);
-
- NewMenuEntry->DisplayString = NewLoadContext->Description;
-
- LoadOptionPtr += StringSize;
-
- NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);
- ASSERT (NewLoadContext->FilePathList != NULL);
- CopyMem (
- NewLoadContext->FilePathList,
- (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,
- NewLoadContext->FilePathListLength
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionStrDepository
- );
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionHelpStrDepository
- );
- LoadOptionPtr += NewLoadContext->FilePathListLength;
-
- if (LoadOptionPtr < LoadOptionEnd) {
- OptionalDataSize = BootOptionSize -
- sizeof (UINT32) -
- sizeof (UINT16) -
- StringSize -
- NewLoadContext->FilePathListLength;
-
- NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);
- ASSERT (NewLoadContext->OptionalData != NULL);
- CopyMem (
- NewLoadContext->OptionalData,
- LoadOptionPtr,
- OptionalDataSize
- );
-
- NewLoadContext->OptionalDataSize = OptionalDataSize;
- }
-
- InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
- MenuCount++;
- }
-
- if (BootNext != NULL) {
- FreePool (BootNext);
- }
- if (BootOrderList != NULL) {
- FreePool (BootOrderList);
- }
- BootOptionMenu.MenuNumber = MenuCount;
- return EFI_SUCCESS;
-}
-
-/**
-
- Append file name to existing file name.
-
- @param Str1 The existing file name
- @param Str2 The file name to be appended
-
- @return Allocate a new string to hold the appended result.
- Caller is responsible to free the returned string.
-
-**/
-CHAR16 *
-BOpt_AppendFileName (
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- )
-{
- UINTN Size1;
- UINTN Size2;
- UINTN MaxLen;
- CHAR16 *Str;
- CHAR16 *TmpStr;
- CHAR16 *Ptr;
- CHAR16 *LastSlash;
-
- Size1 = StrSize (Str1);
- Size2 = StrSize (Str2);
- MaxLen = (Size1 + Size2 + sizeof (CHAR16)) / sizeof (CHAR16);
- Str = AllocateZeroPool (MaxLen * sizeof (CHAR16));
- ASSERT (Str != NULL);
-
- TmpStr = AllocateZeroPool (MaxLen * sizeof (CHAR16));
- ASSERT (TmpStr != NULL);
-
- StrCatS (Str, MaxLen, Str1);
- if (!((*Str == '\\') && (*(Str + 1) == 0))) {
- StrCatS (Str, MaxLen, L"\\");
- }
-
- StrCatS (Str, MaxLen, Str2);
-
- Ptr = Str;
- LastSlash = Str;
- while (*Ptr != 0) {
- if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '.' && *(Ptr + 3) == L'\\') {
- //
- // Convert "\Name\..\" to "\"
- // DO NOT convert the .. if it is at the end of the string. This will
- // break the .. behavior in changing directories.
- //
-
- //
- // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings
- // that overlap.
- //
- StrCpyS (TmpStr, MaxLen, Ptr + 3);
- StrCpyS (LastSlash, MaxLen - (UINTN) (LastSlash - Str), TmpStr);
- Ptr = LastSlash;
- } else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {
- //
- // Convert a "\.\" to a "\"
- //
-
- //
- // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings
- // that overlap.
- //
- StrCpyS (TmpStr, MaxLen, Ptr + 2);
- StrCpyS (Ptr, MaxLen - (UINTN) (Ptr - Str), TmpStr);
- Ptr = LastSlash;
- } else if (*Ptr == '\\') {
- LastSlash = Ptr;
- }
-
- Ptr++;
- }
-
- FreePool (TmpStr);
-
- return Str;
-}
-
-/**
-
- Check whether current FileName point to a valid
- Efi Image File.
-
- @param FileName File need to be checked.
-
- @retval TRUE Is Efi Image
- @retval FALSE Not a valid Efi Image
-
-**/
-BOOLEAN
-BOpt_IsEfiImageName (
- IN UINT16 *FileName
- )
-{
- //
- // Search for ".efi" extension
- //
- while (*FileName != L'\0') {
- if (FileName[0] == '.') {
- if (FileName[1] == 'e' || FileName[1] == 'E') {
- if (FileName[2] == 'f' || FileName[2] == 'F') {
- if (FileName[3] == 'i' || FileName[3] == 'I') {
- return TRUE;
- } else if (FileName[3] == 0x0000) {
- return FALSE;
- }
- } else if (FileName[2] == 0x0000) {
- return FALSE;
- }
- } else if (FileName[1] == 0x0000) {
- return FALSE;
- }
- }
-
- FileName += 1;
- }
-
- return FALSE;
-}
-
-/**
-
- Check whether current FileName point to a valid Efi Application
-
- @param Dir Pointer to current Directory
- @param FileName Pointer to current File name.
-
- @retval TRUE Is a valid Efi Application
- @retval FALSE not a valid Efi Application
-
-**/
-BOOLEAN
-BOpt_IsEfiApp (
- IN EFI_FILE_HANDLE Dir,
- IN UINT16 *FileName
- )
-{
- UINTN BufferSize;
- EFI_IMAGE_DOS_HEADER DosHdr;
- UINT16 Subsystem;
- EFI_FILE_HANDLE File;
- EFI_STATUS Status;
- EFI_IMAGE_OPTIONAL_HEADER_UNION PeHdr;
-
- Status = Dir->Open (Dir, &File, FileName, EFI_FILE_MODE_READ, 0);
-
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- BufferSize = sizeof (EFI_IMAGE_DOS_HEADER);
- File->Read (File, &BufferSize, &DosHdr);
- if (DosHdr.e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- File->Close (File);
- return FALSE;
- }
-
- File->SetPosition (File, DosHdr.e_lfanew);
- BufferSize = sizeof (EFI_IMAGE_OPTIONAL_HEADER_UNION);
- File->Read (File, &BufferSize, &PeHdr);
- if (PeHdr.Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
- File->Close (File);
- return FALSE;
- }
- //
- // Determine PE type and read subsytem
- //
- if (PeHdr.Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
- Subsystem = PeHdr.Pe32.OptionalHeader.Subsystem;
- } else if (PeHdr.Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
- Subsystem = PeHdr.Pe32Plus.OptionalHeader.Subsystem;
- } else {
- return FALSE;
- }
-
- if (Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
- File->Close (File);
- return TRUE;
- } else {
- File->Close (File);
- return FALSE;
- }
-}
-
-/**
-
- Find drivers that will be added as Driver#### variables from handles
- in current system environment
- All valid handles in the system except those consume SimpleFs, LoadFile
- are stored in DriverMenu for future use.
-
- @retval EFI_SUCCESS The function complets successfully.
- @return Other value if failed to build the DriverMenu.
-
-**/
-EFI_STATUS
-BOpt_FindDrivers (
- VOID
- )
-{
- UINTN NoDevicePathHandles;
- EFI_HANDLE *DevicePathHandle;
- UINTN Index;
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_HANDLE_CONTEXT *NewHandleContext;
- EFI_HANDLE CurHandle;
- UINTN OptionNumber;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;
- EFI_LOAD_FILE_PROTOCOL *LoadFile;
-
- SimpleFs = NULL;
- LoadFile = NULL;
-
- InitializeListHead (&DriverMenu.Head);
-
- //
- // At first, get all handles that support Device Path
- // protocol which is the basic requirement for
- // Driver####
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDevicePathProtocolGuid,
- NULL,
- &NoDevicePathHandles,
- &DevicePathHandle
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OptionNumber = 0;
- for (Index = 0; Index < NoDevicePathHandles; Index++) {
- CurHandle = DevicePathHandle[Index];
-
- Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID **) &SimpleFs
- );
- if (Status == EFI_SUCCESS) {
- continue;
- }
-
- Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiLoadFileProtocolGuid,
- (VOID **) &LoadFile
- );
- if (Status == EFI_SUCCESS) {
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_HANDLE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- FreePool (DevicePathHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewHandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewHandleContext->Handle = CurHandle;
- NewHandleContext->DevicePath = DevicePathFromHandle (CurHandle);
- NewMenuEntry->DisplayString = DevicePathToStr (NewHandleContext->DevicePath);
- NewMenuEntry->HelpString = NULL;
- NewMenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&DriverMenu.Head, &NewMenuEntry->Link);
-
- }
-
- if (DevicePathHandle != NULL) {
- FreePool (DevicePathHandle);
- }
-
- DriverMenu.MenuNumber = OptionNumber;
- return EFI_SUCCESS;
-}
-
-/**
-
- Get the Option Number that has not been allocated for use.
-
- @param Type The type of Option.
-
- @return The available Option Number.
-
-**/
-UINT16
-BOpt_GetOptionNumber (
- CHAR16 *Type
- )
-{
- UINT16 *OrderList;
- UINTN OrderListSize;
- UINTN Index;
- CHAR16 StrTemp[20];
- UINT16 *OptionBuffer;
- UINT16 OptionNumber;
- UINTN OptionSize;
-
- OrderListSize = 0;
- OrderList = NULL;
- OptionNumber = 0;
- Index = 0;
-
- UnicodeSPrint (StrTemp, sizeof (StrTemp), L"%sOrder", Type);
-
- OrderList = BdsLibGetVariableAndSize (
- StrTemp,
- &gEfiGlobalVariableGuid,
- &OrderListSize
- );
-
- for (OptionNumber = 0; ; OptionNumber++) {
- if (OrderList != NULL) {
- for (Index = 0; Index < OrderListSize / sizeof (UINT16); Index++) {
- if (OptionNumber == OrderList[Index]) {
- break;
- }
- }
- }
-
- if (Index < OrderListSize / sizeof (UINT16)) {
- //
- // The OptionNumber occurs in the OrderList, continue to use next one
- //
- continue;
- }
- UnicodeSPrint (StrTemp, sizeof (StrTemp), L"%s%04x", Type, (UINTN) OptionNumber);
- DEBUG((EFI_D_ERROR,"Option = %s\n", StrTemp));
- OptionBuffer = BdsLibGetVariableAndSize (
- StrTemp,
- &gEfiGlobalVariableGuid,
- &OptionSize
- );
- if (NULL == OptionBuffer) {
- //
- // The Boot[OptionNumber] / Driver[OptionNumber] NOT occurs, we found it
- //
- break;
- }
- }
-
- return OptionNumber;
-}
-
-/**
-
- Get the Option Number for Boot#### that does not used.
-
- @return The available Option Number.
-
-**/
-UINT16
-BOpt_GetBootOptionNumber (
- VOID
- )
-{
- return BOpt_GetOptionNumber (L"Boot");
-}
-
-/**
-
- Get the Option Number for Driver#### that does not used.
-
- @return The unused Option Number.
-
-**/
-UINT16
-BOpt_GetDriverOptionNumber (
- VOID
- )
-{
- return BOpt_GetOptionNumber (L"Driver");
-}
-
-/**
-
- Build up all DriverOptionMenu
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCESS The functin completes successfully.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.
- @retval EFI_NOT_FOUND Fail to get "DriverOrder" variable.
-
-**/
-EFI_STATUS
-BOpt_GetDriverOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN Index;
- UINT16 DriverString[12];
- UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
- UINTN DriverOptionSize;
-
- UINT16 *DriverOrderList;
- UINTN DriverOrderListSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT8 *LoadOptionPtr;
- UINTN StringSize;
- UINTN OptionalDataSize;
- UINT8 *LoadOptionEnd;
-
- DriverOrderListSize = 0;
- DriverOrderList = NULL;
- DriverOptionSize = 0;
- LoadOptionFromVar = NULL;
- BOpt_FreeMenu (&DriverOptionMenu);
- InitializeListHead (&DriverOptionMenu.Head);
- //
- // Get the DriverOrder from the Var
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
- if (DriverOrderList == NULL) {
- return EFI_NOT_FOUND;
- }
-
- for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- DriverOrderList[Index]
- );
- //
- // Get all loadoptions from the VAR
- //
- LoadOptionFromVar = BdsLibGetVariableAndSize (
- DriverString,
- &gEfiGlobalVariableGuid,
- &DriverOptionSize
- );
- if (LoadOptionFromVar == NULL) {
- continue;
- }
-
- LoadOption = AllocateZeroPool (DriverOptionSize);
- if (LoadOption == NULL) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, DriverOptionSize);
- FreePool (LoadOptionFromVar);
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + DriverOptionSize;
- NewMenuEntry->OptionNumber = DriverOrderList[Index];
- NewLoadContext->LoadOptionModified = FALSE;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->IsLegacy = FALSE;
-
- //
- // LoadOption is a pointer type of UINT8
- // for easy use with following LOAD_OPTION
- // embedded in this struct
- //
- NewLoadContext->LoadOption = LoadOption;
- NewLoadContext->LoadOptionSize = DriverOptionSize;
-
- NewLoadContext->Attributes = *(UINT32 *) LoadOptionPtr;
- NewLoadContext->IsActive = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);
-
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- LoadOptionPtr += sizeof (UINT32);
-
- NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;
- LoadOptionPtr += sizeof (UINT16);
-
- StringSize = StrSize ((UINT16 *) LoadOptionPtr);
- NewLoadContext->Description = AllocateZeroPool (StringSize);
- ASSERT (NewLoadContext->Description != NULL);
- CopyMem (
- NewLoadContext->Description,
- (UINT16 *) LoadOptionPtr,
- StringSize
- );
- NewMenuEntry->DisplayString = NewLoadContext->Description;
-
- LoadOptionPtr += StringSize;
-
- NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);
- ASSERT (NewLoadContext->FilePathList != NULL);
- CopyMem (
- NewLoadContext->FilePathList,
- (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,
- NewLoadContext->FilePathListLength
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionStrDepository
- );
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionHelpStrDepository
- );
- LoadOptionPtr += NewLoadContext->FilePathListLength;
-
- if (LoadOptionPtr < LoadOptionEnd) {
- OptionalDataSize = DriverOptionSize -
- sizeof (UINT32) -
- sizeof (UINT16) -
- StringSize -
- NewLoadContext->FilePathListLength;
-
- NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);
- ASSERT (NewLoadContext->OptionalData != NULL);
- CopyMem (
- NewLoadContext->OptionalData,
- LoadOptionPtr,
- OptionalDataSize
- );
-
- NewLoadContext->OptionalDataSize = OptionalDataSize;
- }
-
- InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
-
- }
-
- if (DriverOrderList != NULL) {
- FreePool (DriverOrderList);
- }
- DriverOptionMenu.MenuNumber = Index;
- return EFI_SUCCESS;
-
-}
-
-/**
- Get option number according to Boot#### and BootOrder variable.
- The value is saved as #### + 1.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-GetBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BMM_FAKE_NV_DATA *BmmConfig;
- UINT16 Index;
- UINT16 OptionOrderIndex;
- UINTN DeviceType;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
-
- ASSERT (CallbackData != NULL);
-
- DeviceType = (UINTN) -1;
- BmmConfig = &CallbackData->BmmFakeNvData;
- ZeroMem (BmmConfig->BootOptionOrder, sizeof (BmmConfig->BootOptionOrder));
-
- for (Index = 0, OptionOrderIndex = 0; ((Index < BootOptionMenu.MenuNumber) &&
- (OptionOrderIndex < (sizeof (BmmConfig->BootOptionOrder) / sizeof (BmmConfig->BootOptionOrder[0]))));
- Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewLoadContext->IsLegacy) {
- if (((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType != DeviceType) {
- DeviceType = ((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType;
- } else {
- //
- // Only show one legacy boot option for the same device type
- // assuming the boot options are grouped by the device type
- //
- continue;
- }
- }
- BmmConfig->BootOptionOrder[OptionOrderIndex++] = (UINT32) (NewMenuEntry->OptionNumber + 1);
- }
-}
-
-/**
- According to LegacyDevOrder variable to get legacy FD\HD\CD\NET\BEV
- devices list .
-
- @param CallbackData The BMM context data.
-**/
-VOID
-GetLegacyDeviceOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN Index;
- UINTN OptionIndex;
- UINT16 PageIdList[5];
- UINTN PageNum;
- UINTN VarSize;
- UINT8 *VarData;
- UINT8 *WorkingVarData;
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- UINT16 VarDevOrder;
- UINT8 *DisMap;
- BM_MENU_OPTION *OptionMenu;
- BBS_TYPE BbsType;
- UINT8 *LegacyOrder;
- UINT8 *OldData;
- UINTN Pos;
- UINTN Bit;
-
- ASSERT (CallbackData != NULL);
-
- PageIdList[0] = FORM_SET_FD_ORDER_ID;
- PageIdList[1] = FORM_SET_HD_ORDER_ID;
- PageIdList[2] = FORM_SET_CD_ORDER_ID;
- PageIdList[3] = FORM_SET_NET_ORDER_ID;
- PageIdList[4] = FORM_SET_BEV_ORDER_ID;
- OptionMenu = NULL;
- BbsType = 0;
- LegacyOrder = NULL;
- OldData = NULL;
- DisMap = ZeroMem (CallbackData->BmmFakeNvData.DisableMap, sizeof (CallbackData->BmmFakeNvData.DisableMap));
- PageNum = sizeof (PageIdList) / sizeof (PageIdList[0]);
- VarData = BdsLibGetVariableAndSize (
- VAR_LEGACY_DEV_ORDER,
- &gEfiLegacyDevOrderVariableGuid,
- &VarSize
- );
-
- for (Index = 0; Index < PageNum; Index++) {
- switch (PageIdList[Index]) {
-
- case FORM_SET_FD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
- BbsType = BBS_FLOPPY;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyFD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyFD;
- break;
-
- case FORM_SET_HD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
- BbsType = BBS_HARDDISK;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyHD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyHD;
- break;
-
- case FORM_SET_CD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
- BbsType = BBS_CDROM;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyCD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyCD;
- break;
-
- case FORM_SET_NET_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
- BbsType = BBS_EMBED_NETWORK;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyNET;
- OldData = CallbackData->BmmOldFakeNVData.LegacyNET;
- break;
-
- default:
- ASSERT (PageIdList[Index] == FORM_SET_BEV_ORDER_ID);
- OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
- BbsType = BBS_BEV_DEVICE;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyBEV;
- OldData = CallbackData->BmmOldFakeNVData.LegacyBEV;
- break;
- }
-
- if (NULL != VarData) {
- WorkingVarData = VarData;
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) WorkingVarData;
- while (WorkingVarData < VarData + VarSize) {
- if (DevOrder->BbsType == BbsType) {
- break;
- }
-
- WorkingVarData = (UINT8 *)((UINTN)WorkingVarData + sizeof (BBS_TYPE));
- WorkingVarData += *(UINT16 *) WorkingVarData;
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) WorkingVarData;
- }
- for (OptionIndex = 0; OptionIndex < OptionMenu->MenuNumber; OptionIndex++) {
- VarDevOrder = *(UINT16 *) ((UINTN) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + OptionIndex * sizeof (UINT16));
- if (0xFF00 == (VarDevOrder & 0xFF00)) {
- LegacyOrder[OptionIndex] = 0xFF;
- Pos = (VarDevOrder & 0xFF) / 8;
- Bit = 7 - ((VarDevOrder & 0xFF) % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
- } else {
- LegacyOrder[OptionIndex] = (UINT8) (VarDevOrder & 0xFF);
- }
- }
- CopyMem (OldData, LegacyOrder, 100);
- }
- }
-}
-
-/**
- Get driver option order from globalc DriverOptionMenu.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BMM_FAKE_NV_DATA *BmmConfig;
- UINT16 Index;
- UINT16 OptionOrderIndex;
- UINTN DeviceType;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
-
- ASSERT (CallbackData != NULL);
-
- DeviceType = (UINTN) -1;
- BmmConfig = &CallbackData->BmmFakeNvData;
- ZeroMem (BmmConfig->DriverOptionOrder, sizeof (BmmConfig->DriverOptionOrder));
-
- for (Index = 0, OptionOrderIndex = 0; ((Index < DriverOptionMenu.MenuNumber) &&
- (OptionOrderIndex < (sizeof (BmmConfig->DriverOptionOrder) / sizeof (BmmConfig->DriverOptionOrder[0]))));
- Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewLoadContext->IsLegacy) {
- if (((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType != DeviceType) {
- DeviceType = ((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType;
- } else {
- //
- // Only show one legacy boot option for the same device type
- // assuming the boot options are grouped by the device type
- //
- continue;
- }
- }
- BmmConfig->DriverOptionOrder[OptionOrderIndex++] = (UINT32) (NewMenuEntry->OptionNumber + 1);
- }
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
deleted file mode 100644
index 1854b98c36..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
+++ /dev/null
@@ -1,1198 +0,0 @@
-/** @file
- handles console redirection from boot manager
-
-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.
-
-**/
-
-#include "BootMaint.h"
-
-UART_FLOW_CONTROL_DEVICE_PATH mFlowControlDevicePath =
-{
- {
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- {
- (UINT8)(sizeof(UART_FLOW_CONTROL_DEVICE_PATH)),
- (UINT8)((sizeof(UART_FLOW_CONTROL_DEVICE_PATH)) >> 8)
- }
- },
- DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL,
- UART_FLOW_CONTROL_HARDWARE
-};
-
-/**
- Check the device path node whether it's the Flow Control node or not.
-
- @param[in] FlowControl The device path node to be checked.
-
- @retval TRUE It's the Flow Control node.
- @retval FALSE It's not.
-
-**/
-BOOLEAN
-IsUartFlowControlNode (
- IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl
- )
-{
- return (BOOLEAN) (
- (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&
- (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&
- (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))
- );
-}
-
-/**
- Check whether the device path node is ISA Serial Node.
-
- @param Acpi Device path node to be checked
-
- @retval TRUE It's ISA Serial Node.
- @retval FALSE It's NOT ISA Serial Node.
-
-**/
-BOOLEAN
-IsIsaSerialNode (
- IN ACPI_HID_DEVICE_PATH *Acpi
- )
-{
- return (BOOLEAN) (
- (DevicePathType (Acpi) == ACPI_DEVICE_PATH) &&
- (DevicePathSubType (Acpi) == ACPI_DP) &&
- (ReadUnaligned32 (&Acpi->HID) == EISA_PNP_ID (0x0501))
- );
-}
-
-/**
- Update Com Ports attributes from DevicePath
-
- @param DevicePath DevicePath that contains Com ports
-
- @retval EFI_SUCCESS The update is successful.
-
-**/
-EFI_STATUS
-UpdateComAttributeFromVariable (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-/**
- Update the multi-instance device path of Terminal Device based on
- the global TerminalMenu. If ChangeTernimal is TRUE, the terminal
- device path in the Terminal Device in TerminalMenu is also updated.
-
- @param DevicePath The multi-instance device path.
- @param ChangeTerminal TRUE, then device path in the Terminal Device
- in TerminalMenu is also updated; FALSE, no update.
-
- @return EFI_SUCCESS The function completes successfully.
-
-**/
-EFI_STATUS
-ChangeTerminalDevicePath (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- IN BOOLEAN ChangeTerminal
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *Node1;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UART_DEVICE_PATH *Uart1;
- UINTN Com;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_MENU_ENTRY *NewMenuEntry;
- UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
-
- Node = *DevicePath;
- Node = NextDevicePathNode (Node);
- Com = 0;
- while (!IsDevicePathEnd (Node)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (IsIsaSerialNode (Acpi)) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
-
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- Uart = (UART_DEVICE_PATH *) Node;
- CopyMem (
- &Uart->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
-
- FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Node);
- if (IsUartFlowControlNode (FlowControlNode)) {
- FlowControlNode->FlowControlMap = NewTerminalContext->FlowControl;
- } else {
- //
- // Append the Flow control device node when user enable flow control.
- //
- if (NewTerminalContext->FlowControl != 0) {
- mFlowControlDevicePath.FlowControlMap = NewTerminalContext->FlowControl;
- *DevicePath = AppendDevicePathNode (
- *DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) (&mFlowControlDevicePath)
- );
- }
- }
-
- //
- // Change the device path in the ComPort
- //
- if (ChangeTerminal) {
- Node1 = NewTerminalContext->DevicePath;
- Node1 = NextDevicePathNode (Node1);
- while (!IsDevicePathEnd (Node1)) {
- if ((DevicePathType (Node1) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node1) == MSG_UART_DP)) {
- Uart1 = (UART_DEVICE_PATH *) Node1;
- CopyMem (
- &Uart1->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart1->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart1->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart1->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- break;
- }
- //
- // end if
- //
- Node1 = NextDevicePathNode (Node1);
- }
- //
- // end while
- //
- break;
- }
- }
-
- Node = NextDevicePathNode (Node);
- }
-
- return EFI_SUCCESS;
-
-}
-
-/**
- Update the device path that describing a terminal device
- based on the new BaudRate, Data Bits, parity and Stop Bits
- set.
-
- @param DevicePath terminal device's path
-
-**/
-VOID
-ChangeVariableDevicePath (
- IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UINTN Com;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_MENU_ENTRY *NewMenuEntry;
-
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- Com = 0;
- while (!IsDevicePathEnd (Node)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (IsIsaSerialNode (Acpi)) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
-
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- NewMenuEntry = BOpt_GetMenuEntry (
- &TerminalMenu,
- Com
- );
- ASSERT (NewMenuEntry != NULL);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- Uart = (UART_DEVICE_PATH *) Node;
- CopyMem (
- &Uart->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- }
-
- Node = NextDevicePathNode (Node);
- }
-}
-
-/**
- Retrieve ACPI UID of UART from device path
-
- @param Handle The handle for the UART device.
- @param AcpiUid The ACPI UID on output.
-
- @retval TRUE Find valid UID from device path
- @retval FALSE Can't find
-
-**/
-BOOLEAN
-RetrieveUartUid (
- IN EFI_HANDLE Handle,
- IN OUT UINT32 *AcpiUid
- )
-{
- EFI_STATUS Status;
- ACPI_HID_DEVICE_PATH *Acpi;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath
- );
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Acpi = NULL;
- for (; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
- if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MSG_UART_DP)) {
- break;
- }
- //
- // Acpi points to the node before the Uart node
- //
- Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath;
- }
-
- if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {
- if (AcpiUid != NULL) {
- CopyMem (AcpiUid, &Acpi->UID, sizeof (UINT32));
- }
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-/**
- Sort Uart handles array with Acpi->UID from low to high.
-
- @param Handles EFI_SERIAL_IO_PROTOCOL handle buffer
- @param NoHandles EFI_SERIAL_IO_PROTOCOL handle count
-**/
-VOID
-SortedUartHandle (
- IN EFI_HANDLE *Handles,
- IN UINTN NoHandles
- )
-{
- UINTN Index1;
- UINTN Index2;
- UINTN Position;
- UINT32 AcpiUid1;
- UINT32 AcpiUid2;
- UINT32 TempAcpiUid;
- EFI_HANDLE TempHandle;
-
- for (Index1 = 0; Index1 < NoHandles-1; Index1++) {
- if (!RetrieveUartUid (Handles[Index1], &AcpiUid1)) {
- continue;
- }
- TempHandle = Handles[Index1];
- Position = Index1;
- TempAcpiUid = AcpiUid1;
-
- for (Index2 = Index1+1; Index2 < NoHandles; Index2++) {
- if (!RetrieveUartUid (Handles[Index2], &AcpiUid2)) {
- continue;
- }
- if (AcpiUid2 < TempAcpiUid) {
- TempAcpiUid = AcpiUid2;
- TempHandle = Handles[Index2];
- Position = Index2;
- }
- }
- Handles[Position] = Handles[Index1];
- Handles[Index1] = TempHandle;
- }
-}
-
-/**
- Test whether DevicePath is a valid Terminal
-
-
- @param DevicePath DevicePath to be checked
- @param Termi If DevicePath is valid Terminal, terminal type is returned.
- @param Com If DevicePath is valid Terminal, Com Port type is returned.
-
- @retval TRUE If DevicePath point to a Terminal.
- @retval FALSE If DevicePath does not point to a Terminal.
-
-**/
-BOOLEAN
-IsTerminalDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT TYPE_OF_TERMINAL *Termi,
- OUT UINTN *Com
- );
-
-/**
- Build a list containing all serial devices.
-
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_UNSUPPORTED No serial ports present.
-
-**/
-EFI_STATUS
-LocateSerialIo (
- VOID
- )
-{
- UINTN Index;
- UINTN Index2;
- UINTN NoHandles;
- EFI_HANDLE *Handles;
- EFI_STATUS Status;
- ACPI_HID_DEVICE_PATH *Acpi;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- VENDOR_DEVICE_PATH Vendor;
- UINT32 FlowControl;
- //
- // Get all handles that have SerialIo protocol installed
- //
- InitializeListHead (&TerminalMenu.Head);
- TerminalMenu.MenuNumber = 0;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSerialIoProtocolGuid,
- NULL,
- &NoHandles,
- &Handles
- );
- if (EFI_ERROR (Status)) {
- //
- // No serial ports present
- //
- return EFI_UNSUPPORTED;
- }
-
- //
- // Sort Uart handles array with Acpi->UID from low to high
- // then Terminal menu can be built from low Acpi->UID to high Acpi->UID
- //
- SortedUartHandle (Handles, NoHandles);
-
- for (Index = 0; Index < NoHandles; Index++) {
- //
- // Check to see whether the handle has DevicePath Protocol installed
- //
- gBS->HandleProtocol (
- Handles[Index],
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath
- );
-
- Acpi = NULL;
- for (Node = DevicePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) {
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- break;
- }
- //
- // Acpi points to the node before Uart node
- //
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- }
-
- if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {
- NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);
- if (NewMenuEntry == NULL) {
- FreePool (Handles);
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));
- NewTerminalContext->DevicePath = DuplicateDevicePath (DevicePath);
- //
- // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!
- // coz' the misc data for each platform is not correct, actually it's the device path stored in
- // datahub which is not completed, so a searching for end of device path will enter a
- // dead-loop.
- //
- NewMenuEntry->DisplayString = EfiLibStrFromDatahub (DevicePath);
- if (NULL == NewMenuEntry->DisplayString) {
- NewMenuEntry->DisplayString = DevicePathToStr (DevicePath);
- }
-
- NewMenuEntry->HelpString = NULL;
-
- gBS->HandleProtocol (
- Handles[Index],
- &gEfiSerialIoProtocolGuid,
- (VOID **) &SerialIo
- );
-
- CopyMem (
- &NewTerminalContext->BaudRate,
- &SerialIo->Mode->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &NewTerminalContext->DataBits,
- &SerialIo->Mode->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->Parity,
- &SerialIo->Mode->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->StopBits,
- &SerialIo->Mode->StopBits,
- sizeof (UINT8)
- );
-
- NewTerminalContext->FlowControl = 0;
- SerialIo->GetControl(SerialIo, &FlowControl);
- if ((FlowControl & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) != 0) {
- NewTerminalContext->FlowControl = UART_FLOW_CONTROL_HARDWARE;
- }
-
- InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);
- TerminalMenu.MenuNumber++;
- }
- }
- if (Handles != NULL) {
- FreePool (Handles);
- }
-
- //
- // Get L"ConOut", L"ConIn" and L"ErrOut" from the Var
- //
- OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
- InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
- ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
- if (OutDevicePath != NULL) {
- UpdateComAttributeFromVariable (OutDevicePath);
- }
-
- if (InpDevicePath != NULL) {
- UpdateComAttributeFromVariable (InpDevicePath);
- }
-
- if (ErrDevicePath != NULL) {
- UpdateComAttributeFromVariable (ErrDevicePath);
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- NewTerminalContext->TerminalType = 0;
- NewTerminalContext->IsConIn = FALSE;
- NewTerminalContext->IsConOut = FALSE;
- NewTerminalContext->IsStdErr = FALSE;
-
- Vendor.Header.Type = MESSAGING_DEVICE_PATH;
- Vendor.Header.SubType = MSG_VENDOR_DP;
-
- for (Index2 = 0; Index2 < 4; Index2++) {
- CopyMem (&Vendor.Guid, &TerminalTypeGuid[Index2], sizeof (EFI_GUID));
- SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
- NewDevicePath = AppendDevicePathNode (
- NewTerminalContext->DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Vendor
- );
- if (NewMenuEntry->HelpString != NULL) {
- FreePool (NewMenuEntry->HelpString);
- }
- //
- // NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);
- // NewMenuEntry->DisplayString = NewMenuEntry->HelpString;
- //
- NewMenuEntry->HelpString = NULL;
-
- if (BdsLibMatchDevicePaths (OutDevicePath, NewDevicePath)) {
- NewTerminalContext->IsConOut = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
-
- if (BdsLibMatchDevicePaths (InpDevicePath, NewDevicePath)) {
- NewTerminalContext->IsConIn = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
-
- if (BdsLibMatchDevicePaths (ErrDevicePath, NewDevicePath)) {
- NewTerminalContext->IsStdErr = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Update Com Ports attributes from DevicePath
-
- @param DevicePath DevicePath that contains Com ports
-
- @retval EFI_SUCCESS The update is successful.
- @retval EFI_NOT_FOUND Can not find specific menu entry
-**/
-EFI_STATUS
-UpdateComAttributeFromVariable (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *SerialNode;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UART_DEVICE_PATH *Uart1;
- UINTN TerminalNumber;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- UINTN Index;
- UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
- BOOLEAN HasFlowControlNode;
-
- HasFlowControlNode = FALSE;
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- TerminalNumber = 0;
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- while (!IsDevicePathEnd (Node)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (IsIsaSerialNode (Acpi)) {
- CopyMem (&TerminalNumber, &Acpi->UID, sizeof (UINT32));
- }
-
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- Uart = (UART_DEVICE_PATH *) Node;
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, TerminalNumber);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- CopyMem (
- &NewTerminalContext->BaudRate,
- &Uart->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &NewTerminalContext->DataBits,
- &Uart->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->Parity,
- &Uart->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->StopBits,
- &Uart->StopBits,
- sizeof (UINT8)
- );
-
- FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Node);
- if (IsUartFlowControlNode (FlowControlNode)) {
- HasFlowControlNode = TRUE;
- NewTerminalContext->FlowControl = (UINT8) ReadUnaligned32 (&FlowControlNode->FlowControlMap);
- } else if (NewTerminalContext->FlowControl != 0) {
- //
- // No Flow Control device path node, assumption no Flow control
- //
- NewTerminalContext->FlowControl = 0;
- }
-
- SerialNode = NewTerminalContext->DevicePath;
- SerialNode = NextDevicePathNode (SerialNode);
- while (!IsDevicePathEnd (SerialNode)) {
- if ((DevicePathType (SerialNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (SerialNode) == MSG_UART_DP)) {
- //
- // Update following device paths according to
- // previous acquired uart attributes
- //
- Uart1 = (UART_DEVICE_PATH *) SerialNode;
- CopyMem (
- &Uart1->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart1->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
- CopyMem (
- &Uart1->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
- CopyMem (
- &Uart1->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
-
- FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (SerialNode);
- if (IsUartFlowControlNode (FlowControlNode)) {
- FlowControlNode->FlowControlMap = NewTerminalContext->FlowControl;
- } else {
- if (HasFlowControlNode) {
- mFlowControlDevicePath.FlowControlMap = NewTerminalContext->FlowControl;
- NewTerminalContext->DevicePath = AppendDevicePathNode (
- NewTerminalContext->DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) (&mFlowControlDevicePath)
- );
- }
- }
- break;
- }
-
- SerialNode = NextDevicePathNode (SerialNode);
- }
- //
- // end while
- //
- }
-
- Node = NextDevicePathNode (Node);
- }
- //
- // end while
- //
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Build up Console Menu based on types passed in. The type can
- be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT
- and BM_CONSOLE_ERR_CONTEXT_SELECT.
-
- @param ConsoleMenuType Can be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT
- and BM_CONSOLE_ERR_CONTEXT_SELECT.
-
- @retval EFI_UNSUPPORTED The type passed in is not in the 3 types defined.
- @retval EFI_NOT_FOUND If the EFI Variable defined in UEFI spec with name "ConOutDev",
- "ConInDev" or "ConErrDev" doesn't exists.
- @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operations.
- @retval EFI_SUCCESS Function completes successfully.
-
-**/
-EFI_STATUS
-GetConsoleMenu (
- IN UINTN ConsoleMenuType
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *AllDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *MultiDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- UINTN Size;
- UINTN AllCount;
- UINTN Index;
- UINTN Index2;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- TYPE_OF_TERMINAL Terminal;
- UINTN Com;
- BM_MENU_OPTION *ConsoleMenu;
-
- DevicePath = NULL;
- AllDevicePath = NULL;
- AllCount = 0;
- switch (ConsoleMenuType) {
- case BM_CONSOLE_IN_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleInpMenu;
- DevicePath = EfiLibGetVariable (
- L"ConIn",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ConInDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- case BM_CONSOLE_OUT_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleOutMenu;
- DevicePath = EfiLibGetVariable (
- L"ConOut",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ConOutDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- case BM_CONSOLE_ERR_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleErrMenu;
- DevicePath = EfiLibGetVariable (
- L"ErrOut",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ErrOutDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
-
- if (NULL == AllDevicePath) {
- return EFI_NOT_FOUND;
- }
-
- InitializeListHead (&ConsoleMenu->Head);
-
- AllCount = EfiDevicePathInstanceCount (AllDevicePath);
- ConsoleMenu->MenuNumber = 0;
- //
- // Following is menu building up for Console Devices selected.
- //
- MultiDevicePath = AllDevicePath;
- Index2 = 0;
- for (Index = 0; Index < AllCount; Index++) {
- DevicePathInst = GetNextDevicePathInstance (&MultiDevicePath, &Size);
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_CONSOLE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewMenuEntry->OptionNumber = Index2;
-
- NewConsoleContext->DevicePath = DuplicateDevicePath (DevicePathInst);
- ASSERT (NewConsoleContext->DevicePath != NULL);
- NewMenuEntry->DisplayString = EfiLibStrFromDatahub (NewConsoleContext->DevicePath);
- if (NULL == NewMenuEntry->DisplayString) {
- NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath);
- }
-
- NewConsoleContext->IsTerminal = IsTerminalDevicePath (
- NewConsoleContext->DevicePath,
- &Terminal,
- &Com
- );
-
- NewConsoleContext->IsActive = BdsLibMatchDevicePaths (
- DevicePath,
- NewConsoleContext->DevicePath
- );
-
- if (NewConsoleContext->IsTerminal) {
- BOpt_DestroyMenuEntry (NewMenuEntry);
- } else {
- Index2++;
- ConsoleMenu->MenuNumber++;
- InsertTailList (&ConsoleMenu->Head, &NewMenuEntry->Link);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
- @retval EFI_SUCCESS The function always complete successfully.
-
-**/
-EFI_STATUS
-GetAllConsoles (
- VOID
- )
-{
- GetConsoleMenu (BM_CONSOLE_IN_CONTEXT_SELECT);
- GetConsoleMenu (BM_CONSOLE_OUT_CONTEXT_SELECT);
- GetConsoleMenu (BM_CONSOLE_ERR_CONTEXT_SELECT);
- return EFI_SUCCESS;
-}
-
-/**
- Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
- @retval EFI_SUCCESS The function always complete successfully.
-**/
-EFI_STATUS
-FreeAllConsoles (
- VOID
- )
-{
- BOpt_FreeMenu (&ConsoleOutMenu);
- BOpt_FreeMenu (&ConsoleInpMenu);
- BOpt_FreeMenu (&ConsoleErrMenu);
- BOpt_FreeMenu (&TerminalMenu);
- return EFI_SUCCESS;
-}
-
-/**
- Test whether DevicePath is a valid Terminal
-
-
- @param DevicePath DevicePath to be checked
- @param Termi If DevicePath is valid Terminal, terminal type is returned.
- @param Com If DevicePath is valid Terminal, Com Port type is returned.
-
- @retval TRUE If DevicePath point to a Terminal.
- @retval FALSE If DevicePath does not point to a Terminal.
-
-**/
-BOOLEAN
-IsTerminalDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT TYPE_OF_TERMINAL *Termi,
- OUT UINTN *Com
- )
-{
- BOOLEAN IsTerminal;
- EFI_DEVICE_PATH_PROTOCOL *Node;
- VENDOR_DEVICE_PATH *Vendor;
- UART_DEVICE_PATH *Uart;
- ACPI_HID_DEVICE_PATH *Acpi;
-
- IsTerminal = FALSE;
-
- Uart = NULL;
- Vendor = NULL;
- Acpi = NULL;
- for (Node = DevicePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) {
- //
- // Vendor points to the node before the End node
- //
- Vendor = (VENDOR_DEVICE_PATH *) Node;
-
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- Uart = (UART_DEVICE_PATH *) Node;
- }
-
- if (Uart == NULL) {
- //
- // Acpi points to the node before the UART node
- //
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- }
- }
-
- if (Vendor == NULL ||
- DevicePathType (Vendor) != MESSAGING_DEVICE_PATH ||
- DevicePathSubType (Vendor) != MSG_VENDOR_DP ||
- Uart == NULL) {
- return FALSE;
- }
-
- //
- // There are four kinds of Terminal types
- // check to see whether this devicepath
- // is one of that type
- //
- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[0])) {
- *Termi = TerminalTypePcAnsi;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[1])) {
- *Termi = TerminalTypeVt100;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[2])) {
- *Termi = TerminalTypeVt100Plus;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[3])) {
- *Termi = TerminalTypeVtUtf8;
- IsTerminal = TRUE;
- } else {
- IsTerminal = FALSE;
- }
- }
- }
- }
-
- if (!IsTerminal) {
- return FALSE;
- }
-
- if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {
- CopyMem (Com, &Acpi->UID, sizeof (UINT32));
- } else {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Get mode number according to column and row
-
- @param CallbackData The BMM context data.
-**/
-VOID
-GetConsoleOutMode (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN Col;
- UINTN Row;
- UINTN CurrentCol;
- UINTN CurrentRow;
- UINTN Mode;
- UINTN MaxMode;
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
-
- ConOut = gST->ConOut;
- MaxMode = (UINTN) (ConOut->Mode->MaxMode);
-
- CurrentCol = PcdGet32 (PcdSetupConOutColumn);
- CurrentRow = PcdGet32 (PcdSetupConOutRow);
- for (Mode = 0; Mode < MaxMode; Mode++) {
- Status = ConOut->QueryMode (ConOut, Mode, &Col, &Row);
- if (!EFI_ERROR(Status)) {
- if (CurrentCol == Col && CurrentRow == Row) {
- CallbackData->BmmFakeNvData.ConsoleOutMode = (UINT16) Mode;
- break;
- }
- }
- }
-}
-
-/**
-
- Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
- in BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetConsoleInCheck (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT16 Index;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT8 *ConInCheck;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
-
- ASSERT (CallbackData != NULL);
-
- ConInCheck = &CallbackData->BmmFakeNvData.ConsoleInCheck[0];
- for (Index = 0; ((Index < ConsoleInpMenu.MenuNumber) && \
- (Index < MAX_MENU_NUMBER)) ; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- ConInCheck[Index] = NewConsoleContext->IsActive;
- }
-}
-
-/**
-
- Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
- in BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetConsoleOutCheck (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT16 Index;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT8 *ConOutCheck;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
-
- ASSERT (CallbackData != NULL);
- ConOutCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
- for (Index = 0; ((Index < ConsoleOutMenu.MenuNumber) && \
- (Index < MAX_MENU_NUMBER)) ; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- ConOutCheck[Index] = NewConsoleContext->IsActive;
- }
-}
-
-/**
-
- Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
- in BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetConsoleErrCheck (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT16 Index;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT8 *ConErrCheck;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
-
- ASSERT (CallbackData != NULL);
- ConErrCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0];
- for (Index = 0; ((Index < ConsoleErrMenu.MenuNumber) && \
- (Index < MAX_MENU_NUMBER)) ; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- ConErrCheck[Index] = NewConsoleContext->IsActive;
- }
-}
-
-/**
-
- Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
- to BMM_FAKE_NV_DATA structure.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-GetTerminalAttribute (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BMM_FAKE_NV_DATA *CurrentFakeNVMap;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- UINT16 TerminalIndex;
- UINT8 AttributeIndex;
-
- ASSERT (CallbackData != NULL);
-
- CurrentFakeNVMap = &CallbackData->BmmFakeNvData;
- for (TerminalIndex = 0; ((TerminalIndex < TerminalMenu.MenuNumber) && \
- (TerminalIndex < MAX_MENU_NUMBER)); TerminalIndex++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, TerminalIndex);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- for (AttributeIndex = 0; AttributeIndex < sizeof (BaudRateList) / sizeof (BaudRateList [0]); AttributeIndex++) {
- if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[AttributeIndex].Value)) {
- NewTerminalContext->BaudRateIndex = AttributeIndex;
- break;
- }
- }
- for (AttributeIndex = 0; AttributeIndex < sizeof (DataBitsList) / sizeof (DataBitsList[0]); AttributeIndex++) {
- if (NewTerminalContext->DataBits == (UINT64) (DataBitsList[AttributeIndex].Value)) {
- NewTerminalContext->DataBitsIndex = AttributeIndex;
- break;
- }
- }
-
- for (AttributeIndex = 0; AttributeIndex < sizeof (ParityList) / sizeof (ParityList[0]); AttributeIndex++) {
- if (NewTerminalContext->Parity == (UINT64) (ParityList[AttributeIndex].Value)) {
- NewTerminalContext->ParityIndex = AttributeIndex;
- break;
- }
- }
-
- for (AttributeIndex = 0; AttributeIndex < sizeof (StopBitsList) / sizeof (StopBitsList[0]); AttributeIndex++) {
- if (NewTerminalContext->StopBits == (UINT64) (StopBitsList[AttributeIndex].Value)) {
- NewTerminalContext->StopBitsIndex = AttributeIndex;
- break;
- }
- }
- CurrentFakeNVMap->COMBaudRate[TerminalIndex] = NewTerminalContext->BaudRateIndex;
- CurrentFakeNVMap->COMDataRate[TerminalIndex] = NewTerminalContext->DataBitsIndex;
- CurrentFakeNVMap->COMStopBits[TerminalIndex] = NewTerminalContext->StopBitsIndex;
- CurrentFakeNVMap->COMParity[TerminalIndex] = NewTerminalContext->ParityIndex;
- CurrentFakeNVMap->COMTerminalType[TerminalIndex] = NewTerminalContext->TerminalType;
- CurrentFakeNVMap->COMFlowControl[TerminalIndex] = NewTerminalContext->FlowControl;
- }
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Data.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Data.c
deleted file mode 100644
index 0a3ffbcc30..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Data.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/** @file
- Define some data used for Boot Maint
-
-Copyright (c) 2004 - 2008, 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.
-
-**/
-
-#include "BootMaint.h"
-
-VOID *mStartOpCodeHandle = NULL;
-VOID *mEndOpCodeHandle = NULL;
-EFI_IFR_GUID_LABEL *mStartLabel = NULL;
-EFI_IFR_GUID_LABEL *mEndLabel = NULL;
-
-STRING_DEPOSITORY *FileOptionStrDepository;
-STRING_DEPOSITORY *ConsoleOptionStrDepository;
-STRING_DEPOSITORY *BootOptionStrDepository;
-STRING_DEPOSITORY *BootOptionHelpStrDepository;
-STRING_DEPOSITORY *DriverOptionStrDepository;
-STRING_DEPOSITORY *DriverOptionHelpStrDepository;
-STRING_DEPOSITORY *TerminalStrDepository;
-
-///
-/// Terminal type string token storage
-///
-UINT16 TerminalType[] = {
- STRING_TOKEN(STR_COM_TYPE_0),
- STRING_TOKEN(STR_COM_TYPE_1),
- STRING_TOKEN(STR_COM_TYPE_2),
- STRING_TOKEN(STR_COM_TYPE_3),
-};
-
-///
-/// Flow Control type string token storage
-///
-UINT16 mFlowControlType[2] = {
- STRING_TOKEN(STR_NONE_FLOW_CONTROL),
- STRING_TOKEN(STR_HARDWARE_FLOW_CONTROL)
-};
-
-UINT32 mFlowControlValue[2] = {
- 0,
- UART_FLOW_CONTROL_HARDWARE
-};
-
-///
-/// File system selection menu
-///
-BM_MENU_OPTION FsOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Console Input Device Selection Menu
-///
-BM_MENU_OPTION ConsoleInpMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Console Output Device Selection Menu
-///
-BM_MENU_OPTION ConsoleOutMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Error Output Device Selection Menu
-///
-BM_MENU_OPTION ConsoleErrMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Boot Option from variable Menu
-///
-BM_MENU_OPTION BootOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Driver Option from variable menu
-///
-BM_MENU_OPTION DriverOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Legacy FD Info from LegacyBios.GetBbsInfo()
-///
-BM_MENU_OPTION LegacyFDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Legacy HD Info from LegacyBios.GetBbsInfo()
-///
-BM_MENU_OPTION LegacyHDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Legacy CD Info from LegacyBios.GetBbsInfo()
-///
-BM_MENU_OPTION LegacyCDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Legacy NET Info from LegacyBios.GetBbsInfo()
-///
-BM_MENU_OPTION LegacyNETMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Legacy NET Info from LegacyBios.GetBbsInfo()
-///
-BM_MENU_OPTION LegacyBEVMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Files and sub-directories in current directory menu
-///
-BM_MENU_OPTION DirectoryMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Handles in current system selection menu
-///
-BM_MENU_OPTION DriverMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-BM_MENU_OPTION TerminalMenu = {
- BM_MENU_OPTION_SIGNATURE,
- {NULL},
- 0
-};
-
-///
-/// Value and string token correspondency for BaudRate
-///
-COM_ATTR BaudRateList[19] = {
- {
- 115200,
- STRING_TOKEN(STR_COM_BAUD_RATE_0)
- },
- {
- 57600,
- STRING_TOKEN(STR_COM_BAUD_RATE_1)
- },
- {
- 38400,
- STRING_TOKEN(STR_COM_BAUD_RATE_2)
- },
- {
- 19200,
- STRING_TOKEN(STR_COM_BAUD_RATE_3)
- },
- {
- 9600,
- STRING_TOKEN(STR_COM_BAUD_RATE_4)
- },
- {
- 7200,
- STRING_TOKEN(STR_COM_BAUD_RATE_5)
- },
- {
- 4800,
- STRING_TOKEN(STR_COM_BAUD_RATE_6)
- },
- {
- 3600,
- STRING_TOKEN(STR_COM_BAUD_RATE_7)
- },
- {
- 2400,
- STRING_TOKEN(STR_COM_BAUD_RATE_8)
- },
- {
- 2000,
- STRING_TOKEN(STR_COM_BAUD_RATE_9)
- },
- {
- 1800,
- STRING_TOKEN(STR_COM_BAUD_RATE_10)
- },
- {
- 1200,
- STRING_TOKEN(STR_COM_BAUD_RATE_11)
- },
- {
- 600,
- STRING_TOKEN(STR_COM_BAUD_RATE_12)
- },
- {
- 300,
- STRING_TOKEN(STR_COM_BAUD_RATE_13)
- },
- {
- 150,
- STRING_TOKEN(STR_COM_BAUD_RATE_14)
- },
- {
- 134,
- STRING_TOKEN(STR_COM_BAUD_RATE_15)
- },
- {
- 110,
- STRING_TOKEN(STR_COM_BAUD_RATE_16)
- },
- {
- 75,
- STRING_TOKEN(STR_COM_BAUD_RATE_17)
- },
- {
- 50,
- STRING_TOKEN(STR_COM_BAUD_RATE_18)
- }
-};
-
-///
-/// Value and string token correspondency for DataBits
-///
-COM_ATTR DataBitsList[4] = {
- {
- 5,
- STRING_TOKEN(STR_COM_DATA_BITS_0)
- },
- {
- 6,
- STRING_TOKEN(STR_COM_DATA_BITS_1)
- },
- {
- 7,
- STRING_TOKEN(STR_COM_DATA_BITS_2)
- },
- {
- 8,
- STRING_TOKEN(STR_COM_DATA_BITS_3)
- }
-};
-
-///
-/// Value and string token correspondency for Parity
-///
-COM_ATTR ParityList[5] = {
- {
- NoParity,
- STRING_TOKEN(STR_COM_PAR_0)
- },
- {
- EvenParity,
- STRING_TOKEN(STR_COM_PAR_1)
- },
- {
- OddParity,
- STRING_TOKEN(STR_COM_PAR_2)
- },
- {
- MarkParity,
- STRING_TOKEN(STR_COM_PAR_3)
- },
- {
- SpaceParity,
- STRING_TOKEN(STR_COM_PAR_4)
- }
-};
-
-///
-/// Value and string token correspondency for Baudreate
-///
-COM_ATTR StopBitsList[3] = {
- {
- OneStopBit,
- STRING_TOKEN(STR_COM_STOP_BITS_0)
- },
- {
- OneFiveStopBits,
- STRING_TOKEN(STR_COM_STOP_BITS_1)
- },
- {
- TwoStopBits,
- STRING_TOKEN(STR_COM_STOP_BITS_2)
- }
-};
-
-///
-/// Guid for messaging path, used in Serial port setting.
-///
-EFI_GUID TerminalTypeGuid[4] = {
- DEVICE_PATH_MESSAGING_PC_ANSI,
- DEVICE_PATH_MESSAGING_VT_100,
- DEVICE_PATH_MESSAGING_VT_100_PLUS,
- DEVICE_PATH_MESSAGING_VT_UTF8
-};
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr
deleted file mode 100644
index 056694ebef..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr
+++ /dev/null
@@ -1,127 +0,0 @@
-///** @file
-//
-// File Explorer Formset
-//
-// 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.
-//
-//**/
-
-#include "FormGuid.h"
-
-formset
- guid = FILE_EXPLORE_FORMSET_GUID,
- title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE),
- help = STRING_TOKEN(STR_NULL_STRING),
- classguid = FILE_EXPLORE_FORMSET_GUID,
-
- varstore FILE_EXPLORER_NV_DATA,
- varid = VARSTORE_ID_BOOT_MAINT,
- name = FeData,
- guid = FILE_EXPLORE_FORMSET_GUID;
-
- form formid = FORM_FILE_EXPLORER_ID,
- title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE);
-
- label FORM_FILE_EXPLORER_ID;
- label LABEL_END;
- endform;
-
- form formid = FORM_BOOT_ADD_DESCRIPTION_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_DESC_TITLE);
-
- label FORM_BOOT_ADD_DESCRIPTION_ID;
- label LABEL_END;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- string varid = FeData.BootDescriptionData,
- questionid = KEY_VALUE_BOOT_DESCRIPTION,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
- help = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE,
- minsize = 6,
- maxsize = 75,
- endstring;
-
- string varid = FeData.BootOptionalData,
- questionid = KEY_VALUE_BOOT_OPTION,
- prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
- help = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE,
- minsize = 0,
- maxsize = 120,
- endstring;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- text
- help = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_SAVE_AND_EXIT),
- flags = INTERACTIVE,
- key = KEY_VALUE_SAVE_AND_EXIT_BOOT;
-
- text
- help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- flags = INTERACTIVE,
- key = KEY_VALUE_NO_SAVE_AND_EXIT_BOOT;
-
- endform;
-
- form formid = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
-
- label FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
- label LABEL_END;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- string varid = FeData.DriverDescriptionData,
- questionid = KEY_VALUE_DRIVER_DESCRIPTION,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
- help = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE,
- minsize = 6,
- maxsize = 75,
- endstring;
-
- string varid = FeData.DriverOptionalData,
- questionid = KEY_VALUE_DRIVER_OPTION,
- prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
- help = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE,
- minsize = 0,
- maxsize = 120,
- endstring;
-
- checkbox varid = FeData.ForceReconnect,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
- help = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
- flags = CHECKBOX_DEFAULT,
- key = 0,
- endcheckbox;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- text
- help = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_SAVE_AND_EXIT),
- flags = INTERACTIVE,
- key = KEY_VALUE_SAVE_AND_EXIT_DRIVER; //BUGBUB: allow duplicate key in one formset???
-
- text
- help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- flags = INTERACTIVE,
- key = KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER;
-
- endform;
-
-endformset; \ No newline at end of file
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c
deleted file mode 100644
index f804984fa9..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/** @file
- File explorer related functions.
-
-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.
-
-**/
-
-#include "BootMaint.h"
-
-/**
- Update the File Explore page.
-
- @param CallbackData The BMM context data.
- @param MenuOption Pointer to menu options to display.
-
-**/
-VOID
-UpdateFileExplorePage (
- IN BMM_CALLBACK_DATA *CallbackData,
- BM_MENU_OPTION *MenuOption
- )
-{
- UINTN Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- EFI_FORM_ID FormId;
-
- NewMenuEntry = NULL;
- NewFileContext = NULL;
- FormId = 0;
-
- RefreshUpdateData ();
- mStartLabel->Number = FORM_FILE_EXPLORER_ID;
-
- for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewFileContext->IsBootLegacy) {
- continue;
- }
-
- if ((NewFileContext->IsDir) || (FileExplorerStateBootFromFile == CallbackData->FeCurrentState)) {
- //
- // Create Text opcode for directory, also create Text opcode for file in FileExplorerStateBootFromFile.
- //
- HiiCreateActionOpCode (
- mStartOpCodeHandle,
- (UINT16) (FILE_OPTION_OFFSET + Index),
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_CALLBACK,
- 0
- );
- } else {
- //
- // Create Goto opcode for file in FileExplorerStateAddBootOption or FileExplorerStateAddDriverOptionState.
- //
- if (FileExplorerStateAddBootOption == CallbackData->FeCurrentState) {
- FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
- } else if (FileExplorerStateAddDriverOptionState == CallbackData->FeCurrentState) {
- FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
- }
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FormId,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_CALLBACK,
- (UINT16) (FILE_OPTION_GOTO_OFFSET + Index)
- );
- }
- }
-
- HiiUpdateForm (
- CallbackData->FeHiiHandle,
- &gFileExploreFormSetGuid,
- FORM_FILE_EXPLORER_ID,
- mStartOpCodeHandle, // Label FORM_FILE_EXPLORER_ID
- mEndOpCodeHandle // LABEL_END
- );
-}
-
-/**
- Update the file explower page with the refershed file system.
-
-
- @param CallbackData BMM context data
- @param KeyValue Key value to identify the type of data to expect.
-
- @retval TRUE Inform the caller to create a callback packet to exit file explorer.
- @retval FALSE Indicate that there is no need to exit file explorer.
-
-**/
-BOOLEAN
-UpdateFileExplorer (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT16 KeyValue
- )
-{
- UINT16 FileOptionMask;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- EFI_FORM_ID FormId;
- BOOLEAN ExitFileExplorer;
- EFI_STATUS Status;
-
- NewMenuEntry = NULL;
- NewFileContext = NULL;
- ExitFileExplorer = FALSE;
-
- FileOptionMask = (UINT16) (FILE_OPTION_MASK & KeyValue);
-
- if (FileExplorerDisplayUnknown == CallbackData->FeDisplayContext) {
- //
- // First in, display file system.
- //
- BOpt_FreeMenu (&FsOptionMenu);
- BOpt_FindFileSystem (CallbackData);
- CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &FsOptionMenu);
-
- UpdateFileExplorePage (CallbackData, &FsOptionMenu);
-
- CallbackData->FeDisplayContext = FileExplorerDisplayFileSystem;
- } else {
- if (FileExplorerDisplayFileSystem == CallbackData->FeDisplayContext) {
- NewMenuEntry = BOpt_GetMenuEntry (&FsOptionMenu, FileOptionMask);
- } else if (FileExplorerDisplayDirectory == CallbackData->FeDisplayContext) {
- NewMenuEntry = BOpt_GetMenuEntry (&DirectoryMenu, FileOptionMask);
- }
-
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewFileContext->IsDir ) {
- CallbackData->FeDisplayContext = FileExplorerDisplayDirectory;
-
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_FreeMenu (&DirectoryMenu);
- Status = BOpt_FindFiles (CallbackData, NewMenuEntry);
- if (EFI_ERROR (Status)) {
- ExitFileExplorer = TRUE;
- goto exit;
- }
- CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &DirectoryMenu);
- BOpt_DestroyMenuEntry (NewMenuEntry);
-
- UpdateFileExplorePage (CallbackData, &DirectoryMenu);
-
- } else {
- switch (CallbackData->FeCurrentState) {
- case FileExplorerStateBootFromFile:
- //
- // Restore to original mode before launching boot option.
- //
- BdsSetConsoleMode (FALSE);
-
- //
- // Here boot from file
- //
- BootThisFile (NewFileContext);
- //
- // Set proper video resolution and text mode for setup.
- //
- BdsSetConsoleMode (TRUE);
- ExitFileExplorer = TRUE;
- break;
-
- case FileExplorerStateAddBootOption:
- case FileExplorerStateAddDriverOptionState:
- if (FileExplorerStateAddBootOption == CallbackData->FeCurrentState) {
- FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
- if (!CallbackData->FeFakeNvData.BootOptionChanged) {
- ZeroMem (CallbackData->FeFakeNvData.BootOptionalData, sizeof (CallbackData->FeFakeNvData.BootOptionalData));
- ZeroMem (CallbackData->FeFakeNvData.BootDescriptionData, sizeof (CallbackData->FeFakeNvData.BootDescriptionData));
- }
- } else {
- FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
- if (!CallbackData->FeFakeNvData.DriverOptionChanged) {
- ZeroMem (CallbackData->FeFakeNvData.DriverOptionalData, sizeof (CallbackData->FeFakeNvData.DriverOptionalData));
- ZeroMem (CallbackData->FeFakeNvData.DriverDescriptionData, sizeof (CallbackData->FeFakeNvData.DriverDescriptionData));
- }
- }
-
- CallbackData->MenuEntry = NewMenuEntry;
- CallbackData->LoadContext->FilePathList = ((BM_FILE_CONTEXT *) (CallbackData->MenuEntry->VariableContext))->DevicePath;
-
- //
- // Create Subtitle op-code for the display string of the option.
- //
- RefreshUpdateData ();
- mStartLabel->Number = FormId;
-
- HiiCreateSubTitleOpCode (
- mStartOpCodeHandle,
- NewMenuEntry->DisplayStringToken,
- 0,
- 0,
- 0
- );
-
- HiiUpdateForm (
- CallbackData->FeHiiHandle,
- &gFileExploreFormSetGuid,
- FormId,
- mStartOpCodeHandle, // Label FormId
- mEndOpCodeHandle // LABEL_END
- );
- break;
-
- default:
- break;
- }
- }
- }
- exit:
- return ExitFileExplorer;
-}
-
-/**
- This function applies changes in a driver's configuration.
- Input is a Configuration, which has the routing data for this
- driver followed by name / value configuration pairs. The driver
- must apply those pairs to its configurable storage. If the
- driver's configuration is stored in a linear block of data
- and the driver's name / value pairs are in <BlockConfig>
- format, it may use the ConfigToBlock helper function (above) to
- simplify the job. Currently not implemented.
-
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param[in] Configuration A null-terminated Unicode string in
- <ConfigString> format.
- @param[out] Progress A pointer to a string filled in with the
- offset of the most recent '&' before the
- first failing name / value pair (or the
- beginn ing of the string if the failure
- is in the first name / value pair) or
- the terminating NULL if all was
- successful.
-
- @retval EFI_SUCCESS The results have been distributed or are
- awaiting distribution.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
- parts of the results that must be
- stored awaiting possible future
- protocols.
- @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
- Results parameter would result
- in this type of error.
- @retval EFI_NOT_FOUND Target for the specified routing data
- was not found.
-**/
-EFI_STATUS
-EFIAPI
-FileExplorerRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
- FILE_EXPLORER_NV_DATA *FeData;
- BMM_CALLBACK_DATA *Private;
-
- if (Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Configuration;
-
- if (Configuration == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check routing data in <ConfigHdr>.
- // Note: there is no name for Name/Value storage, only GUID will be checked
- //
- if (!HiiIsConfigHdrMatch (Configuration, &gFileExploreFormSetGuid, mFileExplorerStorageName)) {
- return EFI_NOT_FOUND;
- }
-
- Status = gBS->LocateProtocol (
- &gEfiHiiConfigRoutingProtocolGuid,
- NULL,
- (VOID**) &ConfigRouting
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Private = FE_CALLBACK_DATA_FROM_THIS (This);
- //
- // Get Buffer Storage data from EFI variable
- //
- BufferSize = sizeof (FILE_EXPLORER_NV_DATA );
- FeData = &Private->FeFakeNvData;
-
- //
- // Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
- //
- Status = ConfigRouting->ConfigToBlock (
- ConfigRouting,
- Configuration,
- (UINT8 *) FeData,
- &BufferSize,
- Progress
- );
- ASSERT_EFI_ERROR (Status);
-
- if (FeData->BootDescriptionData[0] != 0x00 || FeData->BootOptionalData[0] != 0x00) {
- Status = Var_UpdateBootOption (Private, FeData);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_GetBootOptions (Private);
- CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);
- }
-
- if (FeData->DriverDescriptionData[0] != 0x00 || FeData->DriverOptionalData[0] != 0x00) {
- Status = Var_UpdateDriverOption (
- Private,
- Private->FeHiiHandle,
- FeData->DriverDescriptionData,
- FeData->DriverOptionalData,
- FeData->ForceReconnect
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_GetDriverOptions (Private);
- CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function processes the results of changes in configuration.
- When user select a interactive opcode, this callback will be triggered.
- Based on the Question(QuestionId) that triggers the callback, the corresponding
- actions is performed. It handles:
-
- 1) the addition of boot option.
- 2) the addition of driver option.
- 3) exit from file browser
- 4) update of file content if a dir is selected.
- 5) boot the file if a file is selected in "boot from file"
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
- @retval EFI_INVALID_PARAMETER If paramter Value or ActionRequest is NULL.
-**/
-EFI_STATUS
-EFIAPI
-FileExplorerCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- )
-{
- BMM_CALLBACK_DATA *Private;
- FILE_EXPLORER_NV_DATA *NvRamMap;
- EFI_STATUS Status;
-
- if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
- }
-
- Status = EFI_SUCCESS;
- Private = FE_CALLBACK_DATA_FROM_THIS (This);
-
- //
- // Retrieve uncommitted data from Form Browser
- //
- NvRamMap = &Private->FeFakeNvData;
- HiiGetBrowserData (&gFileExploreFormSetGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap);
-
- if (Action == EFI_BROWSER_ACTION_CHANGED) {
- if ((Value == NULL) || (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT) {
- NvRamMap->BootOptionChanged = FALSE;
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
- } else if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) {
- NvRamMap->DriverOptionChanged = FALSE;
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
- } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
- //
- // Discard changes and exit formset
- //
- NvRamMap->DriverOptionalData[0] = 0x0000;
- NvRamMap->DriverDescriptionData[0] = 0x0000;
- NvRamMap->DriverOptionChanged = FALSE;
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT) {
- //
- // Discard changes and exit formset
- //
- NvRamMap->BootOptionalData[0] = 0x0000;
- NvRamMap->BootDescriptionData[0] = 0x0000;
- NvRamMap->BootOptionChanged = FALSE;
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- } else if (QuestionId == KEY_VALUE_BOOT_DESCRIPTION || QuestionId == KEY_VALUE_BOOT_OPTION) {
- NvRamMap->BootOptionChanged = TRUE;
- } else if (QuestionId == KEY_VALUE_DRIVER_DESCRIPTION || QuestionId == KEY_VALUE_DRIVER_OPTION) {
- NvRamMap->DriverOptionChanged = TRUE;
- } else if (QuestionId < FILE_OPTION_OFFSET) {
- //
- // Exit File Explorer formset
- //
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- } else if (QuestionId >= FILE_OPTION_OFFSET && QuestionId < FILE_OPTION_GOTO_OFFSET) {
- //
- // Update forms may return TRUE or FALSE, need to check here.
- //
- if (UpdateFileExplorer (Private, QuestionId)) {
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- }
- }
- } else if (Action == EFI_BROWSER_ACTION_CHANGING) {
- if (Value == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (QuestionId >= FILE_OPTION_GOTO_OFFSET) {
- //
- // function will always return FALSE, no need to check here.
- //
- UpdateFileExplorer (Private, QuestionId);
- }
- }
-
- //
- // Pass changed uncommitted data back to Form Browser
- //
- HiiSetBrowserData (&gFileExploreFormSetGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap, NULL);
-
- return Status;
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h
deleted file mode 100644
index bf99999760..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/** @file
- Formset guids, form id and VarStore data structure for Boot Maintenance Manager.
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-#ifndef _FORM_GUID_H_
-#define _FORM_GUID_H_
-
-#include <Guid/BdsHii.h>
-
-#define FORM_MAIN_ID 0x1001
-#define FORM_BOOT_ADD_ID 0x1002
-#define FORM_BOOT_DEL_ID 0x1003
-#define FORM_BOOT_CHG_ID 0x1004
-#define FORM_DRV_ADD_ID 0x1005
-#define FORM_DRV_DEL_ID 0x1006
-#define FORM_DRV_CHG_ID 0x1007
-#define FORM_CON_MAIN_ID 0x1008
-#define FORM_CON_IN_ID 0x1009
-#define FORM_CON_OUT_ID 0x100A
-#define FORM_CON_ERR_ID 0x100B
-#define FORM_FILE_SEEK_ID 0x100C
-#define FORM_FILE_NEW_SEEK_ID 0x100D
-#define FORM_DRV_ADD_FILE_ID 0x100E
-#define FORM_DRV_ADD_HANDLE_ID 0x100F
-#define FORM_DRV_ADD_HANDLE_DESC_ID 0x1010
-#define FORM_BOOT_NEXT_ID 0x1011
-#define FORM_TIME_OUT_ID 0x1012
-#define FORM_RESET 0x1013
-#define FORM_BOOT_SETUP_ID 0x1014
-#define FORM_DRIVER_SETUP_ID 0x1015
-#define FORM_BOOT_LEGACY_DEVICE_ID 0x1016
-#define FORM_CON_COM_ID 0x1017
-#define FORM_CON_COM_SETUP_ID 0x1018
-#define FORM_SET_FD_ORDER_ID 0x1019
-#define FORM_SET_HD_ORDER_ID 0x101A
-#define FORM_SET_CD_ORDER_ID 0x101B
-#define FORM_SET_NET_ORDER_ID 0x101C
-#define FORM_SET_BEV_ORDER_ID 0x101D
-#define FORM_FILE_EXPLORER_ID 0x101E
-#define FORM_BOOT_ADD_DESCRIPTION_ID 0x101F
-#define FORM_DRIVER_ADD_FILE_DESCRIPTION_ID 0x1020
-#define FORM_CON_MODE_ID 0x1021
-#define FORM_BOOT_FROM_FILE_ID 0x1022
-
-#define MAXIMUM_FORM_ID 0x10FF
-
-#define KEY_VALUE_COM_SET_BAUD_RATE 0x1101
-#define KEY_VALUE_COM_SET_DATA_BITS 0x1102
-#define KEY_VALUE_COM_SET_STOP_BITS 0x1103
-#define KEY_VALUE_COM_SET_PARITY 0x1104
-#define KEY_VALUE_COM_SET_TERMI_TYPE 0x1105
-#define KEY_VALUE_MAIN_BOOT_NEXT 0x1106
-#define KEY_VALUE_BOOT_ADD_DESC_DATA 0x1107
-#define KEY_VALUE_BOOT_ADD_OPT_DATA 0x1108
-#define KEY_VALUE_DRIVER_ADD_DESC_DATA 0x1109
-#define KEY_VALUE_DRIVER_ADD_OPT_DATA 0x110A
-#define KEY_VALUE_SAVE_AND_EXIT 0x110B
-#define KEY_VALUE_NO_SAVE_AND_EXIT 0x110C
-#define KEY_VALUE_BOOT_FROM_FILE 0x110D
-#define KEY_VALUE_BOOT_DESCRIPTION 0x110E
-#define KEY_VALUE_BOOT_OPTION 0x110F
-#define KEY_VALUE_DRIVER_DESCRIPTION 0x1110
-#define KEY_VALUE_DRIVER_OPTION 0x1111
-
-#define MAXIMUM_NORMAL_KEY_VALUE 0x11FF
-
-//
-// Varstore ID defined for Buffer Storage
-//
-#define VARSTORE_ID_BOOT_MAINT 0x1000
-#define VARSTORE_ID_FILE_EXPLORER 0x1001
-
-//
-// End Label
-//
-#define LABEL_END 0xffff
-#define MAX_MENU_NUMBER 100
-
-///
-/// This is the structure that will be used to store the
-/// question's current value. Use it at initialize time to
-/// set default value for each question. When using at run
-/// time, this map is returned by the callback function,
-/// so dynamically changing the question's value will be
-/// possible through this mechanism
-///
-typedef struct {
- //
- // Three questions displayed at the main page
- // for Timeout, BootNext Variables respectively
- //
- UINT16 BootTimeOut;
- UINT16 BootNext;
-
- //
- // This is the COM1 Attributes value storage
- //
- UINT8 COM1BaudRate;
- UINT8 COM1DataRate;
- UINT8 COM1StopBits;
- UINT8 COM1Parity;
- UINT8 COM1TerminalType;
-
- //
- // This is the COM2 Attributes value storage
- //
- UINT8 COM2BaudRate;
- UINT8 COM2DataRate;
- UINT8 COM2StopBits;
- UINT8 COM2Parity;
- UINT8 COM2TerminalType;
-
- //
- // Driver Option Add Handle page storage
- //
- UINT16 DriverAddHandleDesc[MAX_MENU_NUMBER];
- UINT16 DriverAddHandleOptionalData[MAX_MENU_NUMBER];
- UINT8 DriverAddActive;
- UINT8 DriverAddForceReconnect;
-
- //
- // Console Input/Output/Errorout using COM port check storage
- //
- UINT8 ConsoleInputCOM1;
- UINT8 ConsoleInputCOM2;
- UINT8 ConsoleOutputCOM1;
- UINT8 ConsoleOutputCOM2;
- UINT8 ConsoleErrorCOM1;
- UINT8 ConsoleErrorCOM2;
-
- //
- // At most 100 input/output/errorout device for console storage
- //
- UINT8 ConsoleCheck[MAX_MENU_NUMBER];
- //
- // At most 100 input/output/errorout device for console storage
- //
- UINT8 ConsoleInCheck[MAX_MENU_NUMBER];
- UINT8 ConsoleOutCheck[MAX_MENU_NUMBER];
- UINT8 ConsoleErrCheck[MAX_MENU_NUMBER];
-
- //
- // Boot Option Order storage
- // The value is the OptionNumber+1 because the order list value cannot be 0
- // Use UINT32 to hold the potential value 0xFFFF+1=0x10000
- //
- UINT32 BootOptionOrder[MAX_MENU_NUMBER];
-
- //
- // Driver Option Order storage
- // The value is the OptionNumber+1 because the order list value cannot be 0
- // Use UINT32 to hold the potential value 0xFFFF+1=0x10000
- //
- UINT32 DriverOptionOrder[MAX_MENU_NUMBER];
-
- //
- // Boot Option Delete storage
- //
- BOOLEAN BootOptionDel[MAX_MENU_NUMBER];
- BOOLEAN BootOptionDelMark[MAX_MENU_NUMBER];
-
- //
- // Driver Option Delete storage
- //
- BOOLEAN DriverOptionDel[MAX_MENU_NUMBER];
- BOOLEAN DriverOptionDelMark[MAX_MENU_NUMBER];
-
- //
- // This is the Terminal Attributes value storage
- //
- UINT8 COMBaudRate[MAX_MENU_NUMBER];
- UINT8 COMDataRate[MAX_MENU_NUMBER];
- UINT8 COMStopBits[MAX_MENU_NUMBER];
- UINT8 COMParity[MAX_MENU_NUMBER];
- UINT8 COMTerminalType[MAX_MENU_NUMBER];
- UINT8 COMFlowControl[MAX_MENU_NUMBER];
-
- //
- // Legacy Device Order Selection Storage
- //
- UINT8 LegacyFD[MAX_MENU_NUMBER];
- UINT8 LegacyHD[MAX_MENU_NUMBER];
- UINT8 LegacyCD[MAX_MENU_NUMBER];
- UINT8 LegacyNET[MAX_MENU_NUMBER];
- UINT8 LegacyBEV[MAX_MENU_NUMBER];
-
- //
- // We use DisableMap array to record the enable/disable state of each boot device
- // It should be taken as a bit array, from left to right there are totally 256 bits
- // the most left one stands for BBS table item 0, and the most right one stands for item 256
- // If the bit is 1, it means the boot device has been disabled.
- //
- UINT8 DisableMap[32];
-
- //
- // Console Output Text Mode
- //
- UINT16 ConsoleOutMode;
-
- //
- // UINT16 PadArea[10];
- //
-} BMM_FAKE_NV_DATA;
-
-//
-// Key used by File Explorer forms
-//
-#define KEY_VALUE_SAVE_AND_EXIT_BOOT 0x1000
-#define KEY_VALUE_NO_SAVE_AND_EXIT_BOOT 0x1001
-#define KEY_VALUE_SAVE_AND_EXIT_DRIVER 0x1002
-#define KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER 0x1003
-
-//
-// Description data and optional data size
-//
-#define DESCRIPTION_DATA_SIZE 75
-#define OPTIONAL_DATA_SIZE 127
-
-///
-/// This is the data structure used by File Explorer formset
-///
-typedef struct {
- UINT16 BootDescriptionData[DESCRIPTION_DATA_SIZE];
- UINT16 BootOptionalData[OPTIONAL_DATA_SIZE];
- UINT16 DriverDescriptionData[DESCRIPTION_DATA_SIZE];
- UINT16 DriverOptionalData[OPTIONAL_DATA_SIZE];
- BOOLEAN BootOptionChanged;
- BOOLEAN DriverOptionChanged;
- UINT8 Active;
- UINT8 ForceReconnect;
-} FILE_EXPLORER_NV_DATA;
-
-#endif
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
deleted file mode 100644
index b13ed11630..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
+++ /dev/null
@@ -1,1391 +0,0 @@
-/** @file
-Dynamically update the pages.
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "BootMaint.h"
-
-/**
- Refresh the global UpdateData structure.
-
-**/
-VOID
-RefreshUpdateData (
- VOID
- )
-{
- //
- // Free current updated date
- //
- if (mStartOpCodeHandle != NULL) {
- HiiFreeOpCodeHandle (mStartOpCodeHandle);
- }
-
- //
- // Create new OpCode Handle
- //
- mStartOpCodeHandle = HiiAllocateOpCodeHandle ();
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mStartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- mStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
-
-}
-
-/**
- Add a "Go back to main page" tag in front of the form when there are no
- "Apply changes" and "Discard changes" tags in the end of the form.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdatePageStart (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- RefreshUpdateData ();
- mStartLabel->Number = CallbackData->BmmCurrentPageId;
-
- if (!(CallbackData->BmmAskSaveOrNot)) {
- //
- // Add a "Go back to main page" tag in front of the form when there are no
- // "Apply changes" and "Discard changes" tags in the end of the form.
- //
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_MAIN_ID,
- STRING_TOKEN (STR_FORM_GOTO_MAIN),
- STRING_TOKEN (STR_FORM_GOTO_MAIN),
- 0,
- FORM_MAIN_ID
- );
- }
-
-}
-
-/**
- Create the "Apply changes" and "Discard changes" tags. And
- ensure user can return to the main page.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdatePageEnd (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- //
- // Create the "Apply changes" and "Discard changes" tags.
- //
- if (CallbackData->BmmAskSaveOrNot) {
- HiiCreateSubTitleOpCode (
- mStartOpCodeHandle,
- STRING_TOKEN (STR_NULL_STRING),
- 0,
- 0,
- 0
- );
-
- HiiCreateActionOpCode (
- mStartOpCodeHandle,
- KEY_VALUE_SAVE_AND_EXIT,
- STRING_TOKEN (STR_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_CALLBACK,
- 0
- );
- }
-
- //
- // Ensure user can return to the main page.
- //
- HiiCreateActionOpCode (
- mStartOpCodeHandle,
- KEY_VALUE_NO_SAVE_AND_EXIT,
- STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_CALLBACK,
- 0
- );
-
- HiiUpdateForm (
- CallbackData->BmmHiiHandle,
- &gBootMaintFormSetGuid,
- CallbackData->BmmCurrentPageId,
- mStartOpCodeHandle, // Label CallbackData->BmmCurrentPageId
- mEndOpCodeHandle // LABEL_END
- );
-}
-
-/**
- Clean up the dynamic opcode at label and form specified by both LabelId.
-
- @param LabelId It is both the Form ID and Label ID for opcode deletion.
- @param CallbackData The BMM context data.
-
-**/
-VOID
-CleanUpPage (
- IN UINT16 LabelId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- RefreshUpdateData ();
-
- //
- // Remove all op-codes from dynamic page
- //
- mStartLabel->Number = LabelId;
- HiiUpdateForm (
- CallbackData->BmmHiiHandle,
- &gBootMaintFormSetGuid,
- LabelId,
- mStartOpCodeHandle, // Label LabelId
- mEndOpCodeHandle // LABEL_END
- );
-}
-
-/**
- Boot a file selected by user at File Expoloer of BMM.
-
- @param FileContext The file context data, which contains the device path
- of the file to be boot from.
-
- @retval EFI_SUCCESS The function completed successfull.
- @return Other value if the boot from the file fails.
-
-**/
-EFI_STATUS
-BootThisFile (
- IN BM_FILE_CONTEXT *FileContext
- )
-{
- EFI_STATUS Status;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- BDS_COMMON_OPTION *Option;
-
- Option = (BDS_COMMON_OPTION *) AllocatePool (sizeof (BDS_COMMON_OPTION));
- ASSERT (Option != NULL);
- Option->Description = (CHAR16 *) AllocateCopyPool (StrSize (FileContext->FileName), FileContext->FileName);
- Option->DevicePath = FileContext->DevicePath;
- Option->LoadOptionsSize = 0;
- Option->LoadOptions = NULL;
-
- //
- // Since current no boot from removable media directly is allowed */
- //
- gST->ConOut->ClearScreen (gST->ConOut);
-
- ExitDataSize = 0;
-
- Status = BdsLibBootViaBootOption (Option, Option->DevicePath, &ExitDataSize, &ExitData);
-
- return Status;
-
-}
-
-/**
- Create a list of Goto Opcode for all terminal devices logged
- by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
-
- @param CallbackData The BMM context data.
-**/
-VOID
-UpdateConCOMPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
-
- CallbackData->BmmAskSaveOrNot = FALSE;
-
- UpdatePageStart (CallbackData);
-
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_CON_COM_SETUP_ID,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_CALLBACK,
- (UINT16) (TERMINAL_OPTION_OFFSET + Index)
- );
- }
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Create a lit of boot option from global BootOptionMenu. It
- allow user to delete the boot option.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateBootDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
-
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData);
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
-
- ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.BootOptionDel) / sizeof (CallbackData->BmmFakeNvData.BootOptionDel[0])));
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewLoadContext->IsLegacy) {
- continue;
- }
-
- NewLoadContext->Deleted = FALSE;
-
- if (CallbackData->BmmFakeNvData.BootOptionDel[Index] && !CallbackData->BmmFakeNvData.BootOptionDelMark[Index]) {
- //
- // CallbackData->BmmFakeNvData.BootOptionDel[Index] == TRUE means browser knows this boot option is selected
- // CallbackData->BmmFakeNvData.BootOptionDelMark[Index] = FALSE means BDS knows the selected boot option has
- // deleted, browser maintains old useless info. So clear this info here, and later update this info to browser
- // through HiiSetBrowserData function.
- //
- CallbackData->BmmFakeNvData.BootOptionDel[Index] = FALSE;
- }
-
- HiiCreateCheckBoxOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (BOOT_OPTION_DEL_QUESTION_ID + Index),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (BOOT_OPTION_DEL_VAR_OFFSET + Index),
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- EFI_IFR_FLAG_CALLBACK,
- 0,
- NULL
- );
- }
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Create a lit of driver option from global DriverMenu.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateDrvAddHandlePage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
-
- CallbackData->BmmAskSaveOrNot = FALSE;
-
- UpdatePageStart (CallbackData);
-
- for (Index = 0; Index < DriverMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index);
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_DRV_ADD_HANDLE_DESC_ID,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_CALLBACK,
- (UINT16) (HANDLE_OPTION_OFFSET + Index)
- );
- }
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Create a lit of driver option from global DriverOptionMenu. It
- allow user to delete the driver option.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateDrvDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
-
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData);
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu);
-
- ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.DriverOptionDel) / sizeof (CallbackData->BmmFakeNvData.DriverOptionDel[0])));
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
-
- if (CallbackData->BmmFakeNvData.DriverOptionDel[Index] && !CallbackData->BmmFakeNvData.DriverOptionDelMark[Index]) {
- //
- // CallbackData->BmmFakeNvData.BootOptionDel[Index] == TRUE means browser knows this boot option is selected
- // CallbackData->BmmFakeNvData.BootOptionDelMark[Index] = FALSE means BDS knows the selected boot option has
- // deleted, browser maintains old useless info. So clear this info here, and later update this info to browser
- // through HiiSetBrowserData function.
- //
- CallbackData->BmmFakeNvData.DriverOptionDel[Index] = FALSE;
- }
-
- HiiCreateCheckBoxOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (DRIVER_OPTION_DEL_QUESTION_ID + Index),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (DRIVER_OPTION_DEL_VAR_OFFSET + Index),
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- EFI_IFR_FLAG_CALLBACK,
- 0,
- NULL
- );
- }
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Prepare the page to allow user to add description for
- a Driver Option.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateDriverAddHandleDescPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
-
- CallbackData->BmmFakeNvData.DriverAddActive = 0x01;
- CallbackData->BmmFakeNvData.DriverAddForceReconnect = 0x00;
- CallbackData->BmmAskSaveOrNot = TRUE;
- NewMenuEntry = CallbackData->MenuEntry;
-
- UpdatePageStart (CallbackData);
-
- HiiCreateSubTitleOpCode (
- mStartOpCodeHandle,
- NewMenuEntry->DisplayStringToken,
- 0,
- 0,
- 0
- );
-
- HiiCreateStringOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) DRV_ADD_HANDLE_DESC_QUESTION_ID,
- VARSTORE_ID_BOOT_MAINT,
- DRV_ADD_HANDLE_DESC_VAR_OFFSET,
- STRING_TOKEN (STR_LOAD_OPTION_DESC),
- STRING_TOKEN (STR_NULL_STRING),
- 0,
- 0,
- 6,
- 75,
- NULL
- );
-
- HiiCreateCheckBoxOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) DRV_ADD_RECON_QUESTION_ID,
- VARSTORE_ID_BOOT_MAINT,
- DRV_ADD_RECON_VAR_OFFSET,
- STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),
- STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),
- 0,
- 0,
- NULL
- );
-
- HiiCreateStringOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) DRIVER_ADD_OPTION_QUESTION_ID,
- VARSTORE_ID_BOOT_MAINT,
- DRIVER_ADD_OPTION_VAR_OFFSET,
- STRING_TOKEN (STR_OPTIONAL_DATA),
- STRING_TOKEN (STR_NULL_STRING),
- 0,
- 0,
- 6,
- 75,
- NULL
- );
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Update console page.
-
- @param UpdatePageId The form ID to be updated.
- @param ConsoleMenu The console menu list.
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateConsolePage (
- IN UINT16 UpdatePageId,
- IN BM_MENU_OPTION *ConsoleMenu,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT8 CheckFlags;
- UINT8 *ConsoleCheck;
- EFI_QUESTION_ID QuestionIdBase;
- UINT16 VariableOffsetBase;
-
- UpdatePageStart (CallbackData);
-
- ConsoleCheck = NULL;
- QuestionIdBase = 0;
- VariableOffsetBase = 0;
-
- switch (UpdatePageId) {
- case FORM_CON_IN_ID:
- ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleInCheck[0];
- QuestionIdBase = CON_IN_DEVICE_QUESTION_ID;
- VariableOffsetBase = CON_IN_DEVICE_VAR_OFFSET;
- break;
-
- case FORM_CON_OUT_ID:
- ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
- QuestionIdBase = CON_OUT_DEVICE_QUESTION_ID;
- VariableOffsetBase = CON_OUT_DEVICE_VAR_OFFSET;
- break;
-
- case FORM_CON_ERR_ID:
- ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0];
- QuestionIdBase = CON_ERR_DEVICE_QUESTION_ID;
- VariableOffsetBase = CON_ERR_DEVICE_VAR_OFFSET;
- break;
- }
- ASSERT (ConsoleCheck != NULL);
-
- for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \
- (Index < MAX_MENU_NUMBER)) ; Index++) {
- CheckFlags = 0;
- if (UpdatePageId != FORM_CON_ERR_ID) {
- CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT;
- }
- NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
- HiiCreateCheckBoxOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (QuestionIdBase + Index),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (VariableOffsetBase + Index),
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- 0,
- CheckFlags,
- NULL
- );
- }
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Update the page's NV Map if user has changed the order
- a list. This list can be Boot Order or Driver Order.
-
- @param UpdatePageId The form ID to be updated.
- @param OptionMenu The new list.
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateOrderPage (
- IN UINT16 UpdatePageId,
- IN BM_MENU_OPTION *OptionMenu,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT16 OptionIndex;
- VOID *OptionsOpCodeHandle;
- BOOLEAN BootOptionFound;
- UINT32 *OptionOrder;
- EFI_QUESTION_ID QuestionId;
- UINT16 VarOffset;
-
-
- UpdatePageStart (CallbackData);
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);
-
- OptionOrder = NULL;
- QuestionId = 0;
- VarOffset = 0;
- switch (UpdatePageId) {
-
- case FORM_BOOT_CHG_ID:
- //GetBootOrder (CallbackData);
- OptionOrder = CallbackData->BmmFakeNvData.BootOptionOrder;
- QuestionId = BOOT_OPTION_ORDER_QUESTION_ID;
- VarOffset = BOOT_OPTION_ORDER_VAR_OFFSET;
- break;
-
- case FORM_DRV_CHG_ID:
- //GetDriverOrder (CallbackData);
- OptionOrder = CallbackData->BmmFakeNvData.DriverOptionOrder;
- QuestionId = DRIVER_OPTION_ORDER_QUESTION_ID;
- VarOffset = DRIVER_OPTION_ORDER_VAR_OFFSET;
- break;
- }
- ASSERT (OptionOrder != NULL);
-
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- NewMenuEntry = NULL;
- for (OptionIndex = 0; (OptionIndex < MAX_MENU_NUMBER && OptionOrder[OptionIndex] != 0); OptionIndex++) {
- BootOptionFound = FALSE;
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- if ((UINT32) (NewMenuEntry->OptionNumber + 1) == OptionOrder[OptionIndex]) {
- BootOptionFound = TRUE;
- break;
- }
- }
- if (BootOptionFound) {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- NewMenuEntry->DisplayStringToken,
- 0,
- EFI_IFR_TYPE_NUM_SIZE_32,
- OptionOrder[OptionIndex]
- );
- }
- }
-
- if (OptionMenu->MenuNumber > 0) {
- HiiCreateOrderedListOpCode (
- mStartOpCodeHandle, // Container for dynamic created opcodes
- QuestionId, // Question ID
- VARSTORE_ID_BOOT_MAINT, // VarStore ID
- VarOffset, // Offset in Buffer Storage
- STRING_TOKEN (STR_CHANGE_ORDER), // Question prompt text
- STRING_TOKEN (STR_CHANGE_ORDER), // Question help text
- 0, // Question flag
- 0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET
- EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question value
- 100, // Maximum container
- OptionsOpCodeHandle, // Option Opcode list
- NULL // Default Opcode is NULL
- );
- }
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Create the dynamic page to allow user to set
- the "BootNext" value.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateBootNextPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINTN NumberOfOptions;
- UINT16 Index;
- VOID *OptionsOpCodeHandle;
-
- NumberOfOptions = BootOptionMenu.MenuNumber;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData);
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
-
- if (NumberOfOptions > 0) {
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- //CallbackData->BmmFakeNvData.BootNext = (UINT16) (BootOptionMenu.MenuNumber);
-
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewLoadContext->IsBootNext) {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- NewMenuEntry->DisplayStringToken,
- EFI_IFR_OPTION_DEFAULT,
- EFI_IFR_TYPE_NUM_SIZE_16,
- Index
- );
- //CallbackData->BmmFakeNvData.BootNext = Index;
- } else {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- NewMenuEntry->DisplayStringToken,
- 0,
- EFI_IFR_TYPE_NUM_SIZE_16,
- Index
- );
- }
- }
-
- if (CallbackData->BmmFakeNvData.BootNext == Index) {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- STRING_TOKEN (STR_NONE),
- EFI_IFR_OPTION_DEFAULT,
- EFI_IFR_TYPE_NUM_SIZE_16,
- Index
- );
- } else {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- STRING_TOKEN (STR_NONE),
- 0,
- EFI_IFR_TYPE_NUM_SIZE_16,
- Index
- );
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) BOOT_NEXT_QUESTION_ID,
- VARSTORE_ID_BOOT_MAINT,
- BOOT_NEXT_VAR_OFFSET,
- STRING_TOKEN (STR_BOOT_NEXT),
- STRING_TOKEN (STR_BOOT_NEXT_HELP),
- 0,
- EFI_IFR_NUMERIC_SIZE_2,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- }
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Create the dynamic page to allow user to set the "TimeOut" value.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateTimeOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT16 BootTimeOut;
- VOID *DefaultOpCodeHandle;
-
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData);
-
- BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
-
- DefaultOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (DefaultOpCodeHandle != NULL);
- HiiCreateDefaultOpCode (DefaultOpCodeHandle, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_NUM_SIZE_16, BootTimeOut);
-
- HiiCreateNumericOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) BOOT_TIME_OUT_QUESTION_ID,
- VARSTORE_ID_BOOT_MAINT,
- BOOT_TIME_OUT_VAR_OFFSET,
- STRING_TOKEN (STR_NUM_AUTO_BOOT),
- STRING_TOKEN (STR_HLP_AUTO_BOOT),
- 0,
- EFI_IFR_NUMERIC_SIZE_2 | EFI_IFR_DISPLAY_UINT_DEC,
- 0,
- 65535,
- 0,
- DefaultOpCodeHandle
- );
-
- HiiFreeOpCodeHandle (DefaultOpCodeHandle);
-
- //CallbackData->BmmFakeNvData.BootTimeOut = BootTimeOut;
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Refresh the text mode page.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateConModePage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN Mode;
- UINTN Index;
- UINTN Col;
- UINTN Row;
- CHAR16 ModeString[50];
- CHAR16 *PStr;
- UINTN MaxMode;
- UINTN ValidMode;
- EFI_STRING_ID *ModeToken;
- EFI_STATUS Status;
- VOID *OptionsOpCodeHandle;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
-
- ConOut = gST->ConOut;
- Index = 0;
- ValidMode = 0;
- MaxMode = (UINTN) (ConOut->Mode->MaxMode);
-
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData);
-
- //
- // Check valid mode
- //
- for (Mode = 0; Mode < MaxMode; Mode++) {
- Status = ConOut->QueryMode (ConOut, Mode, &Col, &Row);
- if (EFI_ERROR (Status)) {
- continue;
- }
- ValidMode++;
- }
-
- if (ValidMode == 0) {
- return;
- }
-
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- ModeToken = AllocateZeroPool (sizeof (EFI_STRING_ID) * ValidMode);
- ASSERT(ModeToken != NULL);
-
- //
- // Determin which mode should be the first entry in menu
- //
- // GetConsoleOutMode (CallbackData);
-
- //
- // Build text mode options
- //
- for (Mode = 0; Mode < MaxMode; Mode++) {
- Status = ConOut->QueryMode (ConOut, Mode, &Col, &Row);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Build mode string Column x Row
- //
- UnicodeValueToString (ModeString, 0, Col, 0);
- PStr = &ModeString[0];
- StrCatS (PStr, sizeof (ModeString) / sizeof (ModeString[0]), L" x ");
- PStr = PStr + StrLen (PStr);
- UnicodeValueToString (PStr , 0, Row, 0);
-
- ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);
-
- if (Mode == CallbackData->BmmFakeNvData.ConsoleOutMode) {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- ModeToken[Index],
- EFI_IFR_OPTION_DEFAULT,
- EFI_IFR_TYPE_NUM_SIZE_16,
- (UINT16) Mode
- );
- } else {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- ModeToken[Index],
- 0,
- EFI_IFR_TYPE_NUM_SIZE_16,
- (UINT16) Mode
- );
- }
- Index++;
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) CON_MODE_QUESTION_ID,
- VARSTORE_ID_BOOT_MAINT,
- CON_MODE_VAR_OFFSET,
- STRING_TOKEN (STR_CON_MODE_SETUP),
- STRING_TOKEN (STR_CON_MODE_SETUP),
- EFI_IFR_FLAG_RESET_REQUIRED,
- EFI_IFR_NUMERIC_SIZE_2,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- FreePool (ModeToken);
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
- Parity, Stop Bits, Terminal Type.
-
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdateTerminalPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT8 Index;
- UINT8 CheckFlags;
- BM_MENU_ENTRY *NewMenuEntry;
- VOID *OptionsOpCodeHandle;
- UINTN CurrentTerminal;
-
- UpdatePageStart (CallbackData);
-
- CurrentTerminal = CallbackData->CurrentTerminal;
- NewMenuEntry = BOpt_GetMenuEntry (
- &TerminalMenu,
- CurrentTerminal
- );
-
- if (NewMenuEntry == NULL) {
- return ;
- }
-
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- for (Index = 0; Index < sizeof (BaudRateList) / sizeof (BaudRateList [0]); Index++) {
- CheckFlags = 0;
- if (BaudRateList[Index].Value == 115200) {
- CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- }
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- BaudRateList[Index].StringToken,
- CheckFlags,
- EFI_IFR_TYPE_NUM_SIZE_8,
- Index
- );
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (COM_BAUD_RATE_QUESTION_ID + CurrentTerminal),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (COM_BAUD_RATE_VAR_OFFSET + CurrentTerminal),
- STRING_TOKEN (STR_COM_BAUD_RATE),
- STRING_TOKEN (STR_COM_BAUD_RATE),
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) {
- CheckFlags = 0;
-
- if (DataBitsList[Index].Value == 8) {
- CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- }
-
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- DataBitsList[Index].StringToken,
- CheckFlags,
- EFI_IFR_TYPE_NUM_SIZE_8,
- Index
- );
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (COM_DATA_RATE_QUESTION_ID + CurrentTerminal),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (COM_DATA_RATE_VAR_OFFSET + CurrentTerminal),
- STRING_TOKEN (STR_COM_DATA_BITS),
- STRING_TOKEN (STR_COM_DATA_BITS),
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) {
- CheckFlags = 0;
- if (ParityList[Index].Value == NoParity) {
- CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- }
-
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- ParityList[Index].StringToken,
- CheckFlags,
- EFI_IFR_TYPE_NUM_SIZE_8,
- Index
- );
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (COM_PARITY_QUESTION_ID + CurrentTerminal),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (COM_PARITY_VAR_OFFSET + CurrentTerminal),
- STRING_TOKEN (STR_COM_PARITY),
- STRING_TOKEN (STR_COM_PARITY),
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) {
- CheckFlags = 0;
- if (StopBitsList[Index].Value == OneStopBit) {
- CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- }
-
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- StopBitsList[Index].StringToken,
- CheckFlags,
- EFI_IFR_TYPE_NUM_SIZE_8,
- Index
- );
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (COM_STOP_BITS_QUESTION_ID + CurrentTerminal),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (COM_STOP_BITS_VAR_OFFSET + CurrentTerminal),
- STRING_TOKEN (STR_COM_STOP_BITS),
- STRING_TOKEN (STR_COM_STOP_BITS),
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- for (Index = 0; Index < 4; Index++) {
- CheckFlags = 0;
- if (Index == 0) {
- CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- }
-
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- (EFI_STRING_ID) TerminalType[Index],
- CheckFlags,
- EFI_IFR_TYPE_NUM_SIZE_8,
- Index
- );
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (COM_TERMINAL_QUESTION_ID + CurrentTerminal),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (COM_TERMINAL_VAR_OFFSET + CurrentTerminal),
- STRING_TOKEN (STR_COM_TERMI_TYPE),
- STRING_TOKEN (STR_COM_TERMI_TYPE),
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {
- CheckFlags = 0;
- if (Index == 0) {
- CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- }
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- (EFI_STRING_ID) mFlowControlType[Index],
- CheckFlags,
- EFI_IFR_TYPE_NUM_SIZE_8,
- mFlowControlValue[Index]
- );
- }
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (COM_FLOWCONTROL_QUESTION_ID + CurrentTerminal),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (COM_FLOWCONTROL_VAR_OFFSET + CurrentTerminal),
- STRING_TOKEN (STR_COM_FLOW_CONTROL),
- STRING_TOKEN (STR_COM_FLOW_CONTROL),
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
-
- UpdatePageEnd (CallbackData);
-}
-
-/**
- Dispatch the correct update page function to call based on
- the UpdatePageId.
-
- @param UpdatePageId The form ID.
- @param CallbackData The BMM context data.
-
-**/
-VOID
-UpdatePageBody (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- CleanUpPage (UpdatePageId, CallbackData);
- switch (UpdatePageId) {
- case FORM_CON_IN_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleInpMenu, CallbackData);
- break;
-
- case FORM_CON_OUT_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleOutMenu, CallbackData);
- break;
-
- case FORM_CON_ERR_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleErrMenu, CallbackData);
- break;
-
- case FORM_BOOT_CHG_ID:
- UpdateOrderPage (UpdatePageId, &BootOptionMenu, CallbackData);
- break;
-
- case FORM_DRV_CHG_ID:
- UpdateOrderPage (UpdatePageId, &DriverOptionMenu, CallbackData);
- break;
-
- default:
- break;
- }
-}
-
-/**
- Create a dynamic page so that Legacy Device boot order
- can be set for specified device type.
-
- @param UpdatePageId The form ID. It also spefies the legacy device type.
- @param CallbackData The BMM context data.
-
-
-**/
-VOID
-UpdateSetLegacyDeviceOrderPage (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- BM_MENU_OPTION *OptionMenu;
- BM_MENU_ENTRY *NewMenuEntry;
- EFI_STRING_ID StrRef;
- EFI_STRING_ID StrRefHelp;
- BBS_TYPE BbsType;
- UINTN VarSize;
- UINTN Pos;
- UINTN Bit;
- UINT16 Index;
- UINT16 Key;
- CHAR16 String[100];
- CHAR16 *TypeStr;
- CHAR16 *TypeStrHelp;
- UINT16 VarDevOrder;
- UINT8 *VarData;
- UINT8 *LegacyOrder;
- UINT8 *OldData;
- UINT8 *DisMap;
- VOID *OptionsOpCodeHandle;
-
- OptionMenu = NULL;
- Key = 0;
- StrRef = 0;
- StrRefHelp = 0;
- TypeStr = NULL;
- TypeStrHelp = NULL;
- BbsType = BBS_FLOPPY;
- LegacyOrder = NULL;
- OldData = NULL;
- DisMap = NULL;
-
- CallbackData->BmmAskSaveOrNot = TRUE;
- UpdatePageStart (CallbackData);
-
- DisMap = ZeroMem (CallbackData->BmmOldFakeNVData.DisableMap, sizeof (CallbackData->BmmOldFakeNVData.DisableMap));
-
- //
- // Create oneof option list
- //
- switch (UpdatePageId) {
- case FORM_SET_FD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
- Key = (UINT16) LEGACY_FD_QUESTION_ID;
- TypeStr = STR_FLOPPY;
- TypeStrHelp = STR_FLOPPY_HELP;
- BbsType = BBS_FLOPPY;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyFD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyFD;
- break;
-
- case FORM_SET_HD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
- Key = (UINT16) LEGACY_HD_QUESTION_ID;
- TypeStr = STR_HARDDISK;
- TypeStrHelp = STR_HARDDISK_HELP;
- BbsType = BBS_HARDDISK;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyHD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyHD;
- break;
-
- case FORM_SET_CD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
- Key = (UINT16) LEGACY_CD_QUESTION_ID;
- TypeStr = STR_CDROM;
- TypeStrHelp = STR_CDROM_HELP;
- BbsType = BBS_CDROM;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyCD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyCD;
- break;
-
- case FORM_SET_NET_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
- Key = (UINT16) LEGACY_NET_QUESTION_ID;
- TypeStr = STR_NET;
- TypeStrHelp = STR_NET_HELP;
- BbsType = BBS_EMBED_NETWORK;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyNET;
- OldData = CallbackData->BmmOldFakeNVData.LegacyNET;
- break;
-
- case FORM_SET_BEV_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
- Key = (UINT16) LEGACY_BEV_QUESTION_ID;
- TypeStr = STR_BEV;
- TypeStrHelp = STR_BEV_HELP;
- BbsType = BBS_BEV_DEVICE;
- LegacyOrder = CallbackData->BmmFakeNvData.LegacyBEV;
- OldData = CallbackData->BmmOldFakeNVData.LegacyBEV;
- break;
-
- default:
- DEBUG ((EFI_D_ERROR, "Invalid command ID for updating page!\n"));
- return;
- }
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);
-
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- //
- // Create OneOf for each legacy device
- //
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- NewMenuEntry->DisplayStringToken,
- 0,
- EFI_IFR_TYPE_NUM_SIZE_8,
- (UINT8) ((BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext)->BbsIndex
- );
- }
-
- //
- // Create OneOf for item "Disabled"
- //
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- STRING_TOKEN (STR_DISABLE_LEGACY_DEVICE),
- 0,
- EFI_IFR_TYPE_NUM_SIZE_8,
- 0xFF
- );
-
- //
- // Get Device Order from variable
- //
- VarData = BdsLibGetVariableAndSize (
- VAR_LEGACY_DEV_ORDER,
- &gEfiLegacyDevOrderVariableGuid,
- &VarSize
- );
-
- if (NULL != VarData) {
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData;
- while (VarData < VarData + VarSize) {
- if (DevOrder->BbsType == BbsType) {
- break;
- }
-
- VarData = (UINT8 *)((UINTN)VarData + sizeof (BBS_TYPE));
- VarData += *(UINT16 *) VarData;
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData;
- }
- //
- // Create oneof tag here for FD/HD/CD #1 #2
- //
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- //
- // Create the string for oneof tag
- //
- UnicodeSPrint (String, sizeof (String), TypeStr, Index);
- StrRef = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
-
- UnicodeSPrint (String, sizeof (String), TypeStrHelp, Index);
- StrRefHelp = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
-
- HiiCreateOneOfOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (Key + Index),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (Key + Index - CONFIG_OPTION_OFFSET),
- StrRef,
- StrRefHelp,
- EFI_IFR_FLAG_CALLBACK,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- VarDevOrder = *(UINT16 *) ((UINTN) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16));
-
- if (0xFF00 == (VarDevOrder & 0xFF00)) {
- LegacyOrder[Index] = 0xFF;
- Pos = (VarDevOrder & 0xFF) / 8;
- Bit = 7 - ((VarDevOrder & 0xFF) % 8);
- DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
- } else {
- LegacyOrder[Index] = (UINT8) (VarDevOrder & 0xFF);
- }
- }
- }
-
- CopyMem (OldData, LegacyOrder, 100);
-
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
-
- UpdatePageEnd (CallbackData);
-}
-
-
-/**
- Dispatch the display to the next page based on NewPageId.
-
- @param Private The BMM context data.
- @param NewPageId The original page ID.
-
-**/
-VOID
-UpdatePageId (
- BMM_CALLBACK_DATA *Private,
- UINT16 NewPageId
- )
-{
- //
- // For the question don't impact the page update, just ignore it.
- //
- if (((NewPageId >= BOOT_OPTION_DEL_QUESTION_ID) && (NewPageId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) ||
- ((NewPageId >= DRIVER_OPTION_DEL_QUESTION_ID) && (NewPageId < DRIVER_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER))) {
- return;
- }
-
- if ((NewPageId < FILE_OPTION_OFFSET) && (NewPageId >= HANDLE_OPTION_OFFSET)) {
- //
- // If we select a handle to add driver option, advance to the add handle description page.
- //
- NewPageId = FORM_DRV_ADD_HANDLE_DESC_ID;
- } else if ((NewPageId == KEY_VALUE_SAVE_AND_EXIT) || (NewPageId == KEY_VALUE_NO_SAVE_AND_EXIT)) {
- //
- // Return to main page after "Save Changes" or "Discard Changes".
- //
- NewPageId = FORM_MAIN_ID;
- } else if ((NewPageId >= TERMINAL_OPTION_OFFSET) && (NewPageId < CONSOLE_OPTION_OFFSET)) {
- NewPageId = FORM_CON_COM_SETUP_ID;
- }
-
- if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
- Private->BmmPreviousPageId = Private->BmmCurrentPageId;
- Private->BmmCurrentPageId = NewPageId;
- }
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
deleted file mode 100644
index 616549e64a..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
+++ /dev/null
@@ -1,1378 +0,0 @@
-/** @file
- Variable operation that will be used by bootmaint
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "BootMaint.h"
-
-/**
- Delete Boot Option that represent a Deleted state in BootOptionMenu.
- After deleting this boot option, call Var_ChangeBootOrder to
- make sure BootOrder is in valid state.
-
- @retval EFI_SUCCESS If all boot load option EFI Variables corresponding to
- BM_LOAD_CONTEXT marked for deletion is deleted.
- @retval EFI_NOT_FOUND If can not find the boot option want to be deleted.
- @return Others If failed to update the "BootOrder" variable after deletion.
-
-**/
-EFI_STATUS
-Var_DelBootOption (
- VOID
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 BootString[10];
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
-
- Status = EFI_SUCCESS;
- Index2 = 0;
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, (Index - Index2));
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (!NewLoadContext->Deleted) {
- continue;
- }
-
- UnicodeSPrint (
- BootString,
- sizeof (BootString),
- L"Boot%04x",
- NewMenuEntry->OptionNumber
- );
-
- EfiLibDeleteVariable (BootString, &gEfiGlobalVariableGuid);
- Index2++;
- //
- // If current Load Option is the same as BootNext,
- // must delete BootNext in order to make sure
- // there will be no panic on next boot
- //
- if (NewLoadContext->IsBootNext) {
- EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
- }
-
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_DestroyMenuEntry (NewMenuEntry);
- NewMenuEntry = NULL;
- }
-
- BootOptionMenu.MenuNumber -= Index2;
-
- Status = Var_ChangeBootOrder ();
- return Status;
-}
-
-/**
- After any operation on Boot####, there will be a discrepancy in BootOrder.
- Since some are missing but in BootOrder, while some are present but are
- not reflected by BootOrder. Then a function rebuild BootOrder from
- scratch by content from BootOptionMenu is needed.
-
-
-
-
- @retval EFI_SUCCESS The boot order is updated successfully.
- @return EFI_STATUS other than EFI_SUCCESS if failed to
- Set the "BootOrder" EFI Variable.
-
-**/
-EFI_STATUS
-Var_ChangeBootOrder (
- VOID
- )
-{
-
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *BootOrderList;
- UINT16 *BootOrderListPtr;
- UINTN BootOrderListSize;
- UINTN Index;
-
- BootOrderList = NULL;
- BootOrderListSize = 0;
-
- //
- // First check whether BootOrder is present in current configuration
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- //
- // If exists, delete it to hold new BootOrder
- //
- if (BootOrderList != NULL) {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- FreePool (BootOrderList);
- BootOrderList = NULL;
- }
- //
- // Maybe here should be some check method to ensure that
- // no new added boot options will be added
- // but the setup engine now will give only one callback
- // that is to say, user are granted only one chance to
- // decide whether the boot option will be added or not
- // there should be no indictor to show whether this
- // is a "new" boot option
- //
- BootOrderListSize = BootOptionMenu.MenuNumber;
-
- if (BootOrderListSize > 0) {
- BootOrderList = AllocateZeroPool (BootOrderListSize * sizeof (UINT16));
- ASSERT (BootOrderList != NULL);
- BootOrderListPtr = BootOrderList;
-
- //
- // Get all current used Boot#### from BootOptionMenu.
- // OptionNumber in each BM_LOAD_OPTION is really its
- // #### value.
- //
- for (Index = 0; Index < BootOrderListSize; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- *BootOrderList = (UINT16) NewMenuEntry->OptionNumber;
- BootOrderList++;
- }
-
- BootOrderList = BootOrderListPtr;
-
- //
- // After building the BootOrderList, write it back
- //
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BootOrderListSize * sizeof (UINT16),
- BootOrderList
- );
- //
- // Changing variable without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
- return EFI_SUCCESS;
-}
-
-/**
- Delete Load Option that represent a Deleted state in BootOptionMenu.
- After deleting this Driver option, call Var_ChangeDriverOrder to
- make sure DriverOrder is in valid state.
-
- @retval EFI_SUCCESS Load Option is successfully updated.
- @retval EFI_NOT_FOUND Fail to find the driver option want to be deleted.
- @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI
- Variable.
-
-**/
-EFI_STATUS
-Var_DelDriverOption (
- VOID
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 DriverString[12];
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
-
- Status = EFI_SUCCESS;
- Index2 = 0;
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, (Index - Index2));
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (!NewLoadContext->Deleted) {
- continue;
- }
-
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- NewMenuEntry->OptionNumber
- );
-
- EfiLibDeleteVariable (DriverString, &gEfiGlobalVariableGuid);
- Index2++;
-
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_DestroyMenuEntry (NewMenuEntry);
- NewMenuEntry = NULL;
- }
-
- DriverOptionMenu.MenuNumber -= Index2;
-
- Status = Var_ChangeDriverOrder ();
- return Status;
-}
-
-/**
- After any operation on Driver####, there will be a discrepancy in
- DriverOrder. Since some are missing but in DriverOrder, while some
- are present but are not reflected by DriverOrder. Then a function
- rebuild DriverOrder from scratch by content from DriverOptionMenu is
- needed.
-
- @retval EFI_SUCCESS The driver order is updated successfully.
- @return Other status than EFI_SUCCESS if failed to set the "DriverOrder" EFI Variable.
-
-**/
-EFI_STATUS
-Var_ChangeDriverOrder (
- VOID
- )
-{
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *DriverOrderList;
- UINT16 *DriverOrderListPtr;
- UINTN DriverOrderListSize;
- UINTN Index;
-
- DriverOrderList = NULL;
- DriverOrderListSize = 0;
-
- //
- // First check whether DriverOrder is present in current configuration
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- //
- // If exists, delete it to hold new DriverOrder
- //
- if (DriverOrderList != NULL) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- FreePool (DriverOrderList);
- DriverOrderList = NULL;
- }
-
- DriverOrderListSize = DriverOptionMenu.MenuNumber;
-
- if (DriverOrderListSize > 0) {
- DriverOrderList = AllocateZeroPool (DriverOrderListSize * sizeof (UINT16));
- ASSERT (DriverOrderList != NULL);
- DriverOrderListPtr = DriverOrderList;
-
- //
- // Get all current used Driver#### from DriverOptionMenu.
- // OptionNumber in each BM_LOAD_OPTION is really its
- // #### value.
- //
- for (Index = 0; Index < DriverOrderListSize; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
- *DriverOrderList = (UINT16) NewMenuEntry->OptionNumber;
- DriverOrderList++;
- }
-
- DriverOrderList = DriverOrderListPtr;
-
- //
- // After building the DriverOrderList, write it back
- //
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- DriverOrderListSize * sizeof (UINT16),
- DriverOrderList
- );
- //
- // Changing variable without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
- return EFI_SUCCESS;
-}
-
-/**
- Update the device path of "ConOut", "ConIn" and "ErrOut"
- based on the new BaudRate, Data Bits, parity and Stop Bits
- set.
-
-**/
-VOID
-Var_UpdateAllConsoleOption (
- VOID
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
- EFI_STATUS Status;
-
- OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
- InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
- ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
- if (OutDevicePath != NULL) {
- ChangeVariableDevicePath (OutDevicePath);
- Status = gRT->SetVariable (
- L"ConOut",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- GetDevicePathSize (OutDevicePath),
- OutDevicePath
- );
- //
- // Changing variable without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
-
- if (InpDevicePath != NULL) {
- ChangeVariableDevicePath (InpDevicePath);
- Status = gRT->SetVariable (
- L"ConIn",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- GetDevicePathSize (InpDevicePath),
- InpDevicePath
- );
- //
- // Changing variable without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
-
- if (ErrDevicePath != NULL) {
- ChangeVariableDevicePath (ErrDevicePath);
- Status = gRT->SetVariable (
- L"ErrOut",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- GetDevicePathSize (ErrDevicePath),
- ErrDevicePath
- );
- //
- // Changing variable without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-/**
- This function delete and build multi-instance device path for
- specified type of console device.
-
- This function clear the EFI variable defined by ConsoleName and
- gEfiGlobalVariableGuid. It then build the multi-instance device
- path by appending the device path of the Console (In/Out/Err) instance
- in ConsoleMenu. Then it scan all corresponding console device by
- scanning Terminal (built from device supporting Serial I/O instances)
- devices in TerminalMenu. At last, it save a EFI variable specifed
- by ConsoleName and gEfiGlobalVariableGuid.
-
- @param ConsoleName The name for the console device type. They are
- usually "ConIn", "ConOut" and "ErrOut".
- @param ConsoleMenu The console memu which is a list of console devices.
- @param UpdatePageId The flag specifying which type of console device
- to be processed.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-
-**/
-EFI_STATUS
-Var_UpdateConsoleOption (
- IN UINT16 *ConsoleName,
- IN BM_MENU_OPTION *ConsoleMenu,
- IN UINT16 UpdatePageId
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- EFI_STATUS Status;
- VENDOR_DEVICE_PATH Vendor;
- EFI_DEVICE_PATH_PROTOCOL *TerminalDevicePath;
- UINTN Index;
-
- ConDevicePath = EfiLibGetVariable (ConsoleName, &gEfiGlobalVariableGuid);
- if (ConDevicePath != NULL) {
- EfiLibDeleteVariable (ConsoleName, &gEfiGlobalVariableGuid);
- FreePool (ConDevicePath);
- ConDevicePath = NULL;
- };
-
- //
- // First add all console input device from console input menu
- //
- for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
-
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewConsoleContext->IsActive) {
- ConDevicePath = AppendDevicePathInstance (
- ConDevicePath,
- NewConsoleContext->DevicePath
- );
- }
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- if (((NewTerminalContext->IsConIn != 0) && (UpdatePageId == FORM_CON_IN_ID)) ||
- ((NewTerminalContext->IsConOut != 0) && (UpdatePageId == FORM_CON_OUT_ID)) ||
- ((NewTerminalContext->IsStdErr != 0) && (UpdatePageId == FORM_CON_ERR_ID))
- ) {
- Vendor.Header.Type = MESSAGING_DEVICE_PATH;
- Vendor.Header.SubType = MSG_VENDOR_DP;
-
- ASSERT (NewTerminalContext->TerminalType < (sizeof (TerminalTypeGuid) / sizeof (TerminalTypeGuid[0])));
- CopyMem (
- &Vendor.Guid,
- &TerminalTypeGuid[NewTerminalContext->TerminalType],
- sizeof (EFI_GUID)
- );
- SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
- TerminalDevicePath = AppendDevicePathNode (
- NewTerminalContext->DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Vendor
- );
- ASSERT (TerminalDevicePath != NULL);
- ChangeTerminalDevicePath (&TerminalDevicePath, TRUE);
- ConDevicePath = AppendDevicePathInstance (
- ConDevicePath,
- TerminalDevicePath
- );
- }
- }
-
- if (ConDevicePath != NULL) {
- Status = gRT->SetVariable (
- ConsoleName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- GetDevicePathSize (ConDevicePath),
- ConDevicePath
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-
-}
-
-/**
- This function delete and build multi-instance device path ConIn
- console device.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-**/
-EFI_STATUS
-Var_UpdateConsoleInpOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ConIn", &ConsoleInpMenu, FORM_CON_IN_ID);
-}
-
-/**
- This function delete and build multi-instance device path ConOut
- console device.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-**/
-EFI_STATUS
-Var_UpdateConsoleOutOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ConOut", &ConsoleOutMenu, FORM_CON_OUT_ID);
-}
-
-/**
- This function delete and build multi-instance device path ErrOut
- console device.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-**/
-EFI_STATUS
-Var_UpdateErrorOutOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ErrOut", &ConsoleErrMenu, FORM_CON_ERR_ID);
-}
-
-/**
- This function create a currently loaded Drive Option from
- the BMM. It then appends this Driver Option to the end of
- the "DriverOrder" list. It append this Driver Opotion to the end
- of DriverOptionMenu.
-
- @param CallbackData The BMM context data.
- @param HiiHandle The HII handle associated with the BMM formset.
- @param DescriptionData The description of this driver option.
- @param OptionalData The optional load option.
- @param ForceReconnect If to force reconnect.
-
- @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
- @retval EFI_SUCCESS If function completes successfully.
-
-**/
-EFI_STATUS
-Var_UpdateDriverOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN UINT16 *DescriptionData,
- IN UINT16 *OptionalData,
- IN UINT8 ForceReconnect
- )
-{
- UINT16 Index;
- UINT16 *DriverOrderList;
- UINT16 *NewDriverOrderList;
- UINT16 DriverString[12];
- UINTN DriverOrderListSize;
- VOID *Buffer;
- UINTN BufferSize;
- UINT8 *Ptr;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BOOLEAN OptionalDataExist;
- EFI_STATUS Status;
-
- OptionalDataExist = FALSE;
-
- Index = BOpt_GetDriverOptionNumber ();
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- Index
- );
-
- if (*DescriptionData == 0x0000) {
- StrCpyS (DescriptionData, DESCRIPTION_DATA_SIZE, DriverString);
- }
-
- BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescriptionData);
- BufferSize += GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- if (*OptionalData != 0x0000) {
- OptionalDataExist = TRUE;
- BufferSize += StrSize (OptionalData);
- }
-
- Buffer = AllocateZeroPool (BufferSize);
- if (NULL == Buffer) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- FreePool (Buffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->LoadOptionSize = BufferSize;
- Ptr = (UINT8 *) Buffer;
- NewLoadContext->LoadOption = Ptr;
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE | (ForceReconnect << 1);
- NewLoadContext->Attributes = *((UINT32 *) Ptr);
- NewLoadContext->IsActive = TRUE;
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- Ptr += sizeof (UINT32);
- *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);
-
- Ptr += sizeof (UINT16);
- CopyMem (
- Ptr,
- DescriptionData,
- StrSize (DescriptionData)
- );
-
- NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData));
- ASSERT (NewLoadContext->Description != NULL);
- NewMenuEntry->DisplayString = NewLoadContext->Description;
- CopyMem (
- NewLoadContext->Description,
- (VOID *) Ptr,
- StrSize (DescriptionData)
- );
-
- Ptr += StrSize (DescriptionData);
- CopyMem (
- Ptr,
- CallbackData->LoadContext->FilePathList,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
- ASSERT (NewLoadContext->FilePathList != NULL);
-
- CopyMem (
- NewLoadContext->FilePathList,
- (VOID *) Ptr,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->OptionNumber = Index;
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionStrDepository
- );
- NewMenuEntry->DisplayStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->DisplayString, NULL);
-
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionHelpStrDepository
- );
- NewMenuEntry->HelpStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->HelpString, NULL);
-
- if (OptionalDataExist) {
- Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- CopyMem (
- Ptr,
- OptionalData,
- StrSize (OptionalData)
- );
- }
-
- Status = gRT->SetVariable (
- DriverString,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BufferSize,
- Buffer
- );
- if (!EFI_ERROR (Status)) {
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
- NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));
- ASSERT (NewDriverOrderList != NULL);
- if (DriverOrderList != NULL) {
- CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- }
- NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
-
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- DriverOrderListSize + sizeof (UINT16),
- NewDriverOrderList
- );
- if (DriverOrderList != NULL) {
- FreePool (DriverOrderList);
- }
- DriverOrderList = NULL;
- FreePool (NewDriverOrderList);
- if (!EFI_ERROR (Status)) {
- InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
- DriverOptionMenu.MenuNumber++;
-
- //
- // Update "change boot order" page used data, append the new add boot
- // option at the end.
- //
- Index = 0;
- while (CallbackData->BmmFakeNvData.DriverOptionOrder[Index] != 0) {
- Index++;
- }
- CallbackData->BmmFakeNvData.DriverOptionOrder[Index] = (UINT32) (NewMenuEntry->OptionNumber + 1);
-
- *DescriptionData = 0x0000;
- *OptionalData = 0x0000;
- }
- }
- return EFI_SUCCESS;
-}
-
-/**
- This function create a currently loaded Boot Option from
- the BMM. It then appends this Boot Option to the end of
- the "BootOrder" list. It also append this Boot Opotion to the end
- of BootOptionMenu.
-
- @param CallbackData The BMM context data.
- @param NvRamMap The file explorer formset internal state.
-
- @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
- @retval EFI_SUCCESS If function completes successfully.
-
-**/
-EFI_STATUS
-Var_UpdateBootOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN FILE_EXPLORER_NV_DATA *NvRamMap
- )
-{
- UINT16 *BootOrderList;
- UINT16 *NewBootOrderList;
- UINTN BootOrderListSize;
- UINT16 BootString[10];
- VOID *Buffer;
- UINTN BufferSize;
- UINT8 *Ptr;
- UINT16 Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BOOLEAN OptionalDataExist;
- EFI_STATUS Status;
-
- OptionalDataExist = FALSE;
-
- Index = BOpt_GetBootOptionNumber () ;
- UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);
-
- if (NvRamMap->BootDescriptionData[0] == 0x0000) {
- StrCpyS (
- NvRamMap->BootDescriptionData,
- sizeof (NvRamMap->BootDescriptionData) / sizeof (NvRamMap->BootDescriptionData[0]),
- BootString
- );
- }
-
- BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (NvRamMap->BootDescriptionData);
- BufferSize += GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- if (NvRamMap->BootOptionalData[0] != 0x0000) {
- OptionalDataExist = TRUE;
- BufferSize += StrSize (NvRamMap->BootOptionalData);
- }
-
- Buffer = AllocateZeroPool (BufferSize);
- if (NULL == Buffer) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->LoadOptionSize = BufferSize;
- Ptr = (UINT8 *) Buffer;
- NewLoadContext->LoadOption = Ptr;
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;
- NewLoadContext->Attributes = *((UINT32 *) Ptr);
- NewLoadContext->IsActive = TRUE;
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- Ptr += sizeof (UINT32);
- *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);
- Ptr += sizeof (UINT16);
-
- CopyMem (
- Ptr,
- NvRamMap->BootDescriptionData,
- StrSize (NvRamMap->BootDescriptionData)
- );
-
- NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->BootDescriptionData));
- ASSERT (NewLoadContext->Description != NULL);
-
- NewMenuEntry->DisplayString = NewLoadContext->Description;
- CopyMem (
- NewLoadContext->Description,
- (VOID *) Ptr,
- StrSize (NvRamMap->BootDescriptionData)
- );
-
- Ptr += StrSize (NvRamMap->BootDescriptionData);
- CopyMem (
- Ptr,
- CallbackData->LoadContext->FilePathList,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
- ASSERT (NewLoadContext->FilePathList != NULL);
-
- CopyMem (
- NewLoadContext->FilePathList,
- (VOID *) Ptr,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->OptionNumber = Index;
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionStrDepository
- );
- NewMenuEntry->DisplayStringToken = HiiSetString (CallbackData->FeHiiHandle, 0, NewMenuEntry->DisplayString, NULL);
-
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionHelpStrDepository
- );
- NewMenuEntry->HelpStringToken = HiiSetString (CallbackData->FeHiiHandle, 0, NewMenuEntry->HelpString, NULL);
-
- if (OptionalDataExist) {
- Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- CopyMem (Ptr, NvRamMap->BootOptionalData, StrSize (NvRamMap->BootOptionalData));
- }
-
- Status = gRT->SetVariable (
- BootString,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BufferSize,
- Buffer
- );
- if (!EFI_ERROR (Status)) {
-
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
- ASSERT (BootOrderList != NULL);
- NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
- ASSERT (NewBootOrderList != NULL);
- CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
- NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;
-
- if (BootOrderList != NULL) {
- FreePool (BootOrderList);
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BootOrderListSize + sizeof (UINT16),
- NewBootOrderList
- );
- if (!EFI_ERROR (Status)) {
-
- FreePool (NewBootOrderList);
- NewBootOrderList = NULL;
- InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
- BootOptionMenu.MenuNumber++;
-
- //
- // Update "change driver order" page used data, append the new add driver
- // option at the end.
- //
- Index = 0;
- while (CallbackData->BmmFakeNvData.BootOptionOrder[Index] != 0) {
- Index++;
- }
- CallbackData->BmmFakeNvData.BootOptionOrder[Index] = (UINT32) (NewMenuEntry->OptionNumber + 1);
-
- NvRamMap->BootDescriptionData[0] = 0x0000;
- NvRamMap->BootOptionalData[0] = 0x0000;
- }
- }
- return EFI_SUCCESS;
-}
-
-/**
- This function update the "BootNext" EFI Variable. If there is
- no "BootNext" specified in BMM, this EFI Variable is deleted.
- It also update the BMM context data specified the "BootNext"
- vaule.
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS The function complete successfully.
- @return The EFI variable can be saved. See gRT->SetVariable
- for detail return information.
-
-**/
-EFI_STATUS
-Var_UpdateBootNext (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BMM_FAKE_NV_DATA *CurrentFakeNVMap;
- UINT16 Index;
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
- CurrentFakeNVMap = &CallbackData->BmmFakeNvData;
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- ASSERT (NULL != NewMenuEntry);
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->IsBootNext = FALSE;
- }
-
- if (CurrentFakeNVMap->BootNext == BootOptionMenu.MenuNumber) {
- EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
- return EFI_SUCCESS;
- }
-
- NewMenuEntry = BOpt_GetMenuEntry (
- &BootOptionMenu,
- CurrentFakeNVMap->BootNext
- );
- ASSERT (NewMenuEntry != NULL);
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- Status = gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT16),
- &NewMenuEntry->OptionNumber
- );
- NewLoadContext->IsBootNext = TRUE;
- CallbackData->BmmOldFakeNVData.BootNext = CurrentFakeNVMap->BootNext;
- return Status;
-}
-
-/**
- This function update the "BootOrder" EFI Variable based on
- BMM Formset's NV map. It then refresh BootOptionMenu
- with the new "BootOrder" list.
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-
-**/
-EFI_STATUS
-Var_UpdateBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- UINT16 OrderIndex;
- UINT16 *BootOrderList;
- UINTN BootOrderListSize;
- UINT16 OptionNumber;
-
- BootOrderList = NULL;
- BootOrderListSize = 0;
-
- //
- // First check whether BootOrder is present in current configuration
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
- if (BootOrderList == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.BootOptionOrder) / sizeof (CallbackData->BmmFakeNvData.BootOptionOrder[0])));
-
- for (OrderIndex = 0; (OrderIndex < BootOptionMenu.MenuNumber) && (CallbackData->BmmFakeNvData.BootOptionOrder[OrderIndex] != 0); OrderIndex++) {
- for (Index = OrderIndex; Index < BootOrderListSize / sizeof (UINT16); Index++) {
- if ((BootOrderList[Index] == (UINT16) (CallbackData->BmmFakeNvData.BootOptionOrder[OrderIndex] - 1)) && (OrderIndex != Index)) {
- OptionNumber = BootOrderList[Index];
- CopyMem (&BootOrderList[OrderIndex + 1], &BootOrderList[OrderIndex], (Index - OrderIndex) * sizeof (UINT16));
- BootOrderList[OrderIndex] = OptionNumber;
- }
- }
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BootOrderListSize,
- BootOrderList
- );
- //
- // Changing the content without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- FreePool (BootOrderList);
-
- GroupMultipleLegacyBootOption4SameType ();
-
- BOpt_FreeMenu (&BootOptionMenu);
- BOpt_GetBootOptions (CallbackData);
-
- return Status;
-
-}
-
-/**
- This function update the "DriverOrder" EFI Variable based on
- BMM Formset's NV map. It then refresh DriverOptionMenu
- with the new "DriverOrder" list.
-
- @param CallbackData The BMM context data.
-
- @retval EFI_SUCCESS The function complete successfully.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
- @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
-
-**/
-EFI_STATUS
-Var_UpdateDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- UINT16 *DriverOrderList;
- UINT16 *NewDriverOrderList;
- UINTN DriverOrderListSize;
-
- DriverOrderList = NULL;
- DriverOrderListSize = 0;
-
- //
- // First check whether DriverOrder is present in current configuration
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- NewDriverOrderList = AllocateZeroPool (DriverOrderListSize);
-
- if (NewDriverOrderList == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // If exists, delete it to hold new DriverOrder
- //
- if (DriverOrderList != NULL) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- FreePool (DriverOrderList);
- }
-
- ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.DriverOptionOrder) / sizeof (CallbackData->BmmFakeNvData.DriverOptionOrder[0])));
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewDriverOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.DriverOptionOrder[Index] - 1);
- }
-
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- DriverOrderListSize,
- NewDriverOrderList
- );
- //
- // Changing the content without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
-
- BOpt_FreeMenu (&DriverOptionMenu);
- BOpt_GetDriverOptions (CallbackData);
- return EFI_SUCCESS;
-}
-
-/**
- Update the legacy BBS boot option. VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid EFI Variable
- is udpated with the new Legacy Boot order. The EFI Variable of "Boot####" and gEfiGlobalVariableGuid
- is also updated.
-
- @param CallbackData The context data for BMM.
- @param FormId The form id.
-
- @return EFI_SUCCESS The function completed successfully.
- @retval EFI_NOT_FOUND If VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid EFI Variable can be found.
- @retval EFI_OUT_OF_RESOURCES Fail to allocate memory resource
-**/
-EFI_STATUS
-Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_FORM_ID FormId
- )
-{
- UINTN Index;
- UINTN Index2;
- VOID *BootOptionVar;
- CHAR16 VarName[100];
- UINTN OptionSize;
- EFI_STATUS Status;
- UINT32 *Attribute;
- BM_MENU_OPTION *OptionMenu;
- UINT8 *LegacyDev;
- UINT8 *VarData;
- UINTN VarSize;
- LEGACY_DEV_ORDER_ENTRY *DevOrder;
- UINT8 *OriginalPtr;
- UINT8 *DisMap;
- UINTN Pos;
- UINTN Bit;
- UINT16 *NewOrder;
- UINT16 Tmp;
- UINT16 *EnBootOption;
- UINTN EnBootOptionCount;
- UINT16 *DisBootOption;
- UINTN DisBootOptionCount;
-
- DisMap = NULL;
- NewOrder = NULL;
-
- switch (FormId) {
- case FORM_SET_FD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
- LegacyDev = CallbackData->BmmFakeNvData.LegacyFD;
- CallbackData->BbsType = BBS_FLOPPY;
- break;
-
- case FORM_SET_HD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
- LegacyDev = CallbackData->BmmFakeNvData.LegacyHD;
- CallbackData->BbsType = BBS_HARDDISK;
- break;
-
- case FORM_SET_CD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
- LegacyDev = CallbackData->BmmFakeNvData.LegacyCD;
- CallbackData->BbsType = BBS_CDROM;
- break;
-
- case FORM_SET_NET_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
- LegacyDev = CallbackData->BmmFakeNvData.LegacyNET;
- CallbackData->BbsType = BBS_EMBED_NETWORK;
- break;
-
- default:
- ASSERT (FORM_SET_BEV_ORDER_ID == CallbackData->BmmPreviousPageId);
- OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
- LegacyDev = CallbackData->BmmFakeNvData.LegacyBEV;
- CallbackData->BbsType = BBS_BEV_DEVICE;
- break;
- }
-
- DisMap = CallbackData->BmmOldFakeNVData.DisableMap;
- Status = EFI_SUCCESS;
-
-
- //
- // Update the Variable "LegacyDevOrder"
- //
- VarData = (UINT8 *) BdsLibGetVariableAndSize (
- VAR_LEGACY_DEV_ORDER,
- &gEfiLegacyDevOrderVariableGuid,
- &VarSize
- );
-
- if (VarData == NULL) {
- return EFI_NOT_FOUND;
- }
-
- OriginalPtr = VarData;
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData;
-
- while (VarData < OriginalPtr + VarSize) {
- if (DevOrder->BbsType == CallbackData->BbsType) {
- break;
- }
-
- VarData += sizeof (BBS_TYPE) + DevOrder->Length;
- DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData;
- }
-
- if (VarData >= OriginalPtr + VarSize) {
- FreePool (OriginalPtr);
- return EFI_NOT_FOUND;
- }
-
- NewOrder = AllocateZeroPool (DevOrder->Length - sizeof (DevOrder->Length));
- if (NewOrder == NULL) {
- FreePool (OriginalPtr);
- return EFI_OUT_OF_RESOURCES;
- }
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- if (0xFF == LegacyDev[Index]) {
- break;
- }
-
- NewOrder[Index] = LegacyDev[Index];
- }
- //
- // Only the enable/disable state of each boot device with same device type can be changed,
- // so we can count on the index information in DevOrder.
- // DisMap bit array is the only reliable source to check a device's en/dis state,
- // so we use DisMap to set en/dis state of each item in NewOrder array
- //
- for (Index2 = 0; Index2 < OptionMenu->MenuNumber; Index2++) {
- Tmp = (UINT16) (DevOrder->Data[Index2] & 0xFF);
- Pos = Tmp / 8;
- Bit = 7 - (Tmp % 8);
- if ((DisMap[Pos] & (1 << Bit)) != 0) {
- NewOrder[Index] = (UINT16) (0xFF00 | Tmp);
- Index++;
- }
- }
-
- CopyMem (
- DevOrder->Data,
- NewOrder,
- DevOrder->Length - sizeof (DevOrder->Length)
- );
- FreePool (NewOrder);
-
- Status = gRT->SetVariable (
- VAR_LEGACY_DEV_ORDER,
- &gEfiLegacyDevOrderVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- VarSize,
- OriginalPtr
- );
-
-
- //
- // Update BootOrder and Boot####.Attribute
- //
- // 1. Re-order the Option Number in BootOrder according to Legacy Dev Order
- //
- ASSERT (OptionMenu->MenuNumber == DevOrder->Length / sizeof (UINT16) - 1);
-
- OrderLegacyBootOption4SameType (
- DevOrder->Data,
- DevOrder->Length / sizeof (UINT16) - 1,
- &EnBootOption,
- &EnBootOptionCount,
- &DisBootOption,
- &DisBootOptionCount
- );
-
- //
- // 2. Deactivate the DisBootOption and activate the EnBootOption
- //
- for (Index = 0; Index < DisBootOptionCount; Index++) {
- UnicodeSPrint (VarName, sizeof (VarName), L"Boot%04x", DisBootOption[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- VarName,
- &gEfiGlobalVariableGuid,
- &OptionSize
- );
- if (BootOptionVar != NULL) {
- Attribute = (UINT32 *) BootOptionVar;
- *Attribute &= ~LOAD_OPTION_ACTIVE;
-
- Status = gRT->SetVariable (
- VarName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- OptionSize,
- BootOptionVar
- );
- //
- // Changing the content without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
-
- FreePool (BootOptionVar);
- }
- }
-
- for (Index = 0; Index < EnBootOptionCount; Index++) {
- UnicodeSPrint (VarName, sizeof (VarName), L"Boot%04x", EnBootOption[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- VarName,
- &gEfiGlobalVariableGuid,
- &OptionSize
- );
- if (BootOptionVar != NULL) {
- Attribute = (UINT32 *) BootOptionVar;
- *Attribute |= LOAD_OPTION_ACTIVE;
-
- Status = gRT->SetVariable (
- VarName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- OptionSize,
- BootOptionVar
- );
- //
- // Changing the content without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
-
- FreePool (BootOptionVar);
- }
- }
-
- BOpt_GetBootOptions (CallbackData);
-
- FreePool (OriginalPtr);
- FreePool (EnBootOption);
- FreePool (DisBootOption);
- return Status;
-}
-
-/**
- Update the Text Mode of Console.
-
- @param CallbackData The context data for BMM.
-
- @retval EFI_SUCCSS If the Text Mode of Console is updated.
- @return Other value if the Text Mode of Console is not updated.
-
-**/
-EFI_STATUS
-Var_UpdateConMode (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- UINTN Mode;
- CONSOLE_OUT_MODE ModeInfo;
-
- Mode = CallbackData->BmmFakeNvData.ConsoleOutMode;
-
- Status = gST->ConOut->QueryMode (gST->ConOut, Mode, &(ModeInfo.Column), &(ModeInfo.Row));
- if (!EFI_ERROR(Status)) {
- PcdSet32 (PcdSetupConOutColumn, (UINT32) ModeInfo.Column);
- PcdSet32 (PcdSetupConOutRow, (UINT32) ModeInfo.Row);
- }
-
- return EFI_SUCCESS;
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
deleted file mode 100644
index 6efd783ab2..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/** @file
- The platform boot manager reference implementation
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "BootManager.h"
-
-UINT16 mKeyInput;
-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 = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- BOOT_MANAGER_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-BOOT_MANAGER_CALLBACK_DATA gBootManagerPrivate = {
- BOOT_MANAGER_CALLBACK_DATA_SIGNATURE,
- NULL,
- NULL,
- {
- FakeExtractConfig,
- FakeRouteConfig,
- BootManagerCallback
- }
-};
-
-/**
- This call back function is registered with Boot Manager formset.
- When user selects a boot option, this call back function will
- be triggered. The boot option is saved for later processing.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
-
-**/
-EFI_STATUS
-EFIAPI
-BootManagerCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- )
-{
- BDS_COMMON_OPTION *Option;
- LIST_ENTRY *Link;
- UINT16 KeyCount;
-
- if (Action == EFI_BROWSER_ACTION_CHANGED) {
- if ((Value == NULL) || (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Initialize the key count
- //
- KeyCount = 0;
-
- for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- KeyCount++;
-
- gOption = Option;
-
- //
- // 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;
-
- //
- // Request to exit SendForm(), so that we could boot the selected option
- //
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- break;
- }
- }
-
- return EFI_SUCCESS;
- }
-
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
-}
-
-/**
-
- Registers HII packages for the Boot Manger to HII Database.
- It also registers the browser call back function.
-
- @retval EFI_SUCCESS HII packages for the Boot Manager were registered successfully.
- @retval EFI_OUT_OF_RESOURCES HII packages for the Boot Manager failed to be registered.
-
-**/
-EFI_STATUS
-InitializeBootManager (
- VOID
- )
-{
- EFI_STATUS Status;
-
- //
- // Install Device Path Protocol and Config Access protocol to driver handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &gBootManagerPrivate.DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mBootManagerHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &gBootManagerPrivate.ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Publish our HII data
- //
- gBootManagerPrivate.HiiHandle = HiiAddPackages (
- &gBootManagerFormSetGuid,
- gBootManagerPrivate.DriverHandle,
- BootManagerVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (gBootManagerPrivate.HiiHandle == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- } else {
- Status = EFI_SUCCESS;
- }
- return Status;
-}
-
-/**
- This function invokes Boot Manager. If all devices have not a chance to be connected,
- the connect all will be triggered. It then enumerate all boot options. If
- a boot option from the Boot Manager page is selected, Boot Manager will boot
- from this boot option.
-
-**/
-VOID
-CallBootManager (
- VOID
- )
-{
- EFI_STATUS Status;
- BDS_COMMON_OPTION *Option;
- LIST_ENTRY *Link;
- CHAR16 *ExitData;
- UINTN ExitDataSize;
- EFI_STRING_ID Token;
- EFI_INPUT_KEY Key;
- CHAR16 *HelpString;
- UINTN HelpSize;
- EFI_STRING_ID HelpToken;
- UINT16 *TempStr;
- EFI_HII_HANDLE HiiHandle;
- EFI_BROWSER_ACTION_REQUEST ActionRequest;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *EndLabel;
- UINT16 DeviceType;
- BOOLEAN IsLegacyOption;
- BOOLEAN NeedEndOp;
-
- DeviceType = (UINT16) -1;
- gOption = NULL;
- InitializeListHead (&mBootOptionsList);
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
-
- BdsLibEnumerateAllBootOption (&mBootOptionsList);
-
- //
- // Group the legacy boot options for the same device type
- //
- GroupMultipleLegacyBootOption4SameType ();
-
- InitializeListHead (&mBootOptionsList);
- BdsLibBuildOptionFromVar (&mBootOptionsList, L"BootOrder");
-
- HiiHandle = gBootManagerPrivate.HiiHandle;
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandle != NULL);
-
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandle != NULL);
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = LABEL_BOOT_OPTION;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = LABEL_BOOT_OPTION_END;
-
- mKeyInput = 0;
- NeedEndOp = FALSE;
- for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- //
- // At this stage we are creating a menu entry, thus the Keys are reproduceable
- //
- mKeyInput++;
-
- //
- // Don't display the hidden/inactive boot option
- //
- if (((Option->Attribute & LOAD_OPTION_HIDDEN) != 0) || ((Option->Attribute & LOAD_OPTION_ACTIVE) == 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);
-
- TempStr = DevicePathToStr (Option->DevicePath);
- HelpSize = StrSize (TempStr) + StrSize (L"Device Path : ");
- HelpString = AllocateZeroPool (HelpSize);
- ASSERT (HelpString != NULL);
- StrCatS (HelpString, HelpSize / sizeof (CHAR16), L"Device Path : ");
- StrCatS (HelpString, HelpSize / sizeof (CHAR16), TempStr);
-
- HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);
-
- HiiCreateActionOpCode (
- StartOpCodeHandle,
- mKeyInput,
- Token,
- HelpToken,
- EFI_IFR_FLAG_CALLBACK,
- 0
- );
- }
-
- if (NeedEndOp) {
- HiiCreateEndOpCode (StartOpCodeHandle);
- }
-
- HiiUpdateForm (
- HiiHandle,
- &gBootManagerFormSetGuid,
- BOOT_MANAGER_FORM_ID,
- StartOpCodeHandle,
- EndOpCodeHandle
- );
-
- HiiFreeOpCodeHandle (StartOpCodeHandle);
- HiiFreeOpCodeHandle (EndOpCodeHandle);
-
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &HiiHandle,
- 1,
- &gBootManagerFormSetGuid,
- 0,
- NULL,
- &ActionRequest
- );
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- if (gOption == NULL) {
- return ;
- }
-
- //
- // Will leave browser, check any reset required change is applied? if yes, reset system
- //
- SetupResetReminder ();
-
- //
- // Restore to original mode before launching boot option.
- //
- BdsSetConsoleMode (FALSE);
-
- //
- // parse the selected option
- //
- Status = BdsLibBootViaBootOption (gOption, gOption->DevicePath, &ExitDataSize, &ExitData);
-
- if (!EFI_ERROR (Status)) {
- gOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
- PlatformBdsBootSuccess (gOption);
- } else {
- gOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
- PlatformBdsBootFail (gOption, Status, ExitData, ExitDataSize);
- gST->ConOut->OutputString (
- gST->ConOut,
- GetStringById (STRING_TOKEN (STR_ANY_KEY_CONTINUE))
- );
- gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- }
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.h b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.h
deleted file mode 100644
index e26147183a..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- The platform boot manager reference implement
-
-Copyright (c) 2004 - 2011, 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.
-
-**/
-
-#ifndef _EFI_BOOT_MANAGER_H_
-#define _EFI_BOOT_MANAGER_H_
-
-#include "Bds.h"
-#include "FrontPage.h"
-
-#define BOOT_MANAGER_FORM_ID 0x1000
-
-#define LABEL_BOOT_OPTION 0x00
-#define LABEL_BOOT_OPTION_END 0x01
-
-//
-// These are the VFR compiler generated data representing our VFR data.
-//
-extern UINT8 BootManagerVfrBin[];
-
-#define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'M', 'C', 'B')
-
-typedef struct {
- UINTN Signature;
-
- //
- // HII relative handles
- //
- EFI_HII_HANDLE HiiHandle;
- EFI_HANDLE DriverHandle;
-
- //
- // Produced protocols
- //
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
-} BOOT_MANAGER_CALLBACK_DATA;
-
-/**
- This call back function is registered with Boot Manager formset.
- When user selects a boot option, this call back function will
- be triggered. The boot option is saved for later processing.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
-
-**/
-EFI_STATUS
-EFIAPI
-BootManagerCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- );
-
-/**
-
- Registers HII packages for the Boot Manger to HII Database.
- It also registers the browser call back function.
-
- @retval EFI_SUCCESS HII packages for the Boot Manager were registered successfully.
- @retval EFI_OUT_OF_RESOURCES HII packages for the Boot Manager failed to be registered.
-
-**/
-EFI_STATUS
-InitializeBootManager (
- VOID
- );
-
-/**
- This function invokes Boot Manager. If all devices have not a chance to be connected,
- the connect all will be triggered. It then enumerate all boot options. If
- a boot option from the Boot Manager page is selected, Boot Manager will boot
- from this boot option.
-
-**/
-VOID
-CallBootManager (
- VOID
- );
-
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerStrings.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerStrings.uni
deleted file mode 100644
index e62c264da3..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerStrings.uni
+++ /dev/null
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerVfr.Vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerVfr.Vfr
deleted file mode 100644
index 0d8142c17d..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManagerVfr.Vfr
+++ /dev/null
@@ -1,50 +0,0 @@
-///** @file
-//
-// Browser formset.
-//
-// Copyright (c) 2004 - 2011, 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.
-//
-//**/
-
-#include <Guid/BdsHii.h>
-
-#define BOOT_MANAGER_FORM_ID 0x1000
-
-#define LABEL_BOOT_OPTION 0x00
-#define LABEL_BOOT_OPTION_END 0x01
-
-#define BOOT_MANAGER_CLASS 0x00
-#define BOOT_MANAGER_SUBCLASS 0x00
-
-formset
- guid = BOOT_MANAGER_FORMSET_GUID,
- title = STRING_TOKEN(STR_BM_BANNER),
- help = STRING_TOKEN(STR_LAST_STRING),
- classguid = BOOT_MANAGER_FORMSET_GUID,
-
- form formid = BOOT_MANAGER_FORM_ID,
- title = STRING_TOKEN(STR_BM_BANNER);
-
- subtitle text = STRING_TOKEN(STR_LAST_STRING);
- subtitle text = STRING_TOKEN(STR_BOOT_OPTION_BANNER);
- subtitle text = STRING_TOKEN(STR_LAST_STRING);
-
- //
- // This is where we will dynamically add choices for the Boot Manager
- //
- label LABEL_BOOT_OPTION;
- label LABEL_BOOT_OPTION_END;
-
- subtitle text = STRING_TOKEN(STR_LAST_STRING);
- subtitle text = STRING_TOKEN(STR_HELP_FOOTER);
-
- endform;
-
-endformset;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c
deleted file mode 100644
index 6c7fc7ced4..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/** @file
- BDS routines to handle capsules.
-
-Copyright (c) 2004 - 2013, 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.
-
-**/
-#include "Bds.h"
-
-/**
-
- This routine is called to see if there are any capsules we need to process.
- If the boot mode is not UPDATE, then we do nothing. Otherwise find the
- capsule HOBS and produce firmware volumes for them via the DXE service.
- Then call the dispatcher to dispatch drivers from them. Finally, check
- the status of the updates.
-
- This function should be called by BDS in case we need to do some
- sort of processing even if there is no capsule to process. We
- need to do this if an earlier update went away and we need to
- clear the capsule variable so on the next reset PEI does not see it and
- think there is a capsule available.
-
- @param BootMode the current boot mode
-
- @retval EFI_INVALID_PARAMETER boot mode is not correct for an update
- @retval EFI_SUCCESS There is no error when processing capsule
-
-**/
-EFI_STATUS
-EFIAPI
-BdsProcessCapsules (
- EFI_BOOT_MODE BootMode
- )
-{
- EFI_STATUS Status;
- EFI_PEI_HOB_POINTERS HobPointer;
- EFI_CAPSULE_HEADER *CapsuleHeader;
- UINT32 Size;
- UINT32 CapsuleNumber;
- UINT32 CapsuleTotalNumber;
- EFI_CAPSULE_TABLE *CapsuleTable;
- UINT32 Index;
- UINT32 CacheIndex;
- UINT32 CacheNumber;
- VOID **CapsulePtr;
- VOID **CapsulePtrCache;
- EFI_GUID *CapsuleGuidCache;
- BOOLEAN NeedReset;
-
- CapsuleNumber = 0;
- CapsuleTotalNumber = 0;
- CacheIndex = 0;
- CacheNumber = 0;
- CapsulePtr = NULL;
- CapsulePtrCache = NULL;
- CapsuleGuidCache = NULL;
- NeedReset = FALSE;
-
- //
- // We don't do anything else if the boot mode is not flash-update
- //
- if (BootMode != BOOT_ON_FLASH_UPDATE) {
- DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update.\n"));
- return EFI_INVALID_PARAMETER;
- }
-
- Status = EFI_SUCCESS;
- //
- // Find all capsule images from hob
- //
- HobPointer.Raw = GetHobList ();
- while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, HobPointer.Raw)) != NULL) {
- CapsuleTotalNumber ++;
- HobPointer.Raw = GET_NEXT_HOB (HobPointer);
- }
-
- if (CapsuleTotalNumber == 0) {
- //
- // We didn't find a hob, so had no errors.
- //
- DEBUG ((EFI_D_ERROR, "We can not find capsule data in capsule update boot mode.\n"));
- DEBUG ((EFI_D_ERROR, "Please check the followings are correct if unexpected capsule update error happens.\n"));
- DEBUG ((EFI_D_ERROR, "1. CapsuleX64 is built as X64 module when PEI is IA32 and DXE is X64\n"));
- DEBUG ((EFI_D_ERROR, "2. Capsule data should persist in memory across a system reset.\n"));
- PlatformBdsLockNonUpdatableFlash ();
- return EFI_SUCCESS;
- }
-
- //
- // Init temp Capsule Data table.
- //
- CapsulePtr = (VOID **) AllocateZeroPool (sizeof (VOID *) * CapsuleTotalNumber);
- ASSERT (CapsulePtr != NULL);
- CapsulePtrCache = (VOID **) AllocateZeroPool (sizeof (VOID *) * CapsuleTotalNumber);
- ASSERT (CapsulePtrCache != NULL);
- CapsuleGuidCache = (EFI_GUID *) AllocateZeroPool (sizeof (EFI_GUID) * CapsuleTotalNumber);
- ASSERT (CapsuleGuidCache != NULL);
-
- //
- // Find all capsule images from hob
- //
- HobPointer.Raw = GetHobList ();
- while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, HobPointer.Raw)) != NULL) {
- CapsulePtr [CapsuleNumber++] = (VOID *) (UINTN) HobPointer.Capsule->BaseAddress;
- HobPointer.Raw = GET_NEXT_HOB (HobPointer);
- }
-
- //
- //Check the capsule flags,if contains CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE, install
- //capsuleTable to configure table with EFI_CAPSULE_GUID
- //
-
- //
- // Capsules who have CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE always are used for operating
- // System to have information persist across a system reset. EFI System Table must
- // point to an array of capsules that contains the same CapsuleGuid value. And agents
- // searching for this type capsule will look in EFI System Table and search for the
- // capsule's Guid and associated pointer to retrieve the data. Two steps below describes
- // how to sorting the capsules by the unique guid and install the array to EFI System Table.
- // Firstly, Loop for all coalesced capsules, record unique CapsuleGuids and cache them in an
- // array for later sorting capsules by CapsuleGuid.
- //
- for (Index = 0; Index < CapsuleTotalNumber; Index++) {
- CapsuleHeader = (EFI_CAPSULE_HEADER*) CapsulePtr [Index];
- if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0) {
- //
- // For each capsule, we compare it with known CapsuleGuid in the CacheArray.
- // If already has the Guid, skip it. Whereas, record it in the CacheArray as
- // an additional one.
- //
- CacheIndex = 0;
- while (CacheIndex < CacheNumber) {
- if (CompareGuid(&CapsuleGuidCache[CacheIndex],&CapsuleHeader->CapsuleGuid)) {
- break;
- }
- CacheIndex++;
- }
- if (CacheIndex == CacheNumber) {
- CopyMem(&CapsuleGuidCache[CacheNumber++],&CapsuleHeader->CapsuleGuid,sizeof(EFI_GUID));
- }
- }
- }
-
- //
- // Secondly, for each unique CapsuleGuid in CacheArray, gather all coalesced capsules
- // whose guid is the same as it, and malloc memory for an array which preceding
- // with UINT32. The array fills with entry point of capsules that have the same
- // CapsuleGuid, and UINT32 represents the size of the array of capsules. Then install
- // this array into EFI System Table, so that agents searching for this type capsule
- // will look in EFI System Table and search for the capsule's Guid and associated
- // pointer to retrieve the data.
- //
- CacheIndex = 0;
- while (CacheIndex < CacheNumber) {
- CapsuleNumber = 0;
- for (Index = 0; Index < CapsuleTotalNumber; Index++) {
- CapsuleHeader = (EFI_CAPSULE_HEADER*) CapsulePtr [Index];
- if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0) {
- if (CompareGuid (&CapsuleGuidCache[CacheIndex], &CapsuleHeader->CapsuleGuid)) {
- //
- // Cache Caspuleheader to the array, this array is uniqued with certain CapsuleGuid.
- //
- CapsulePtrCache[CapsuleNumber++] = (VOID*)CapsuleHeader;
- }
- }
- }
- if (CapsuleNumber != 0) {
- Size = sizeof(EFI_CAPSULE_TABLE) + (CapsuleNumber - 1) * sizeof(VOID*);
- CapsuleTable = AllocateRuntimePool (Size);
- ASSERT (CapsuleTable != NULL);
- CapsuleTable->CapsuleArrayNumber = CapsuleNumber;
- CopyMem(&CapsuleTable->CapsulePtr[0], CapsulePtrCache, CapsuleNumber * sizeof(VOID*));
- Status = gBS->InstallConfigurationTable (&CapsuleGuidCache[CacheIndex], (VOID*)CapsuleTable);
- ASSERT_EFI_ERROR (Status);
- }
- CacheIndex++;
- }
-
- //
- // Besides ones with CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flag, all capsules left are
- // recognized by platform with CapsuleGuid. For general platform driver, UpdateFlash
- // type is commonly supported, so here only deal with encapsuled FVs capsule. Additional
- // type capsule transaction could be extended. It depends on platform policy.
- //
- for (Index = 0; Index < CapsuleTotalNumber; Index++) {
- CapsuleHeader = (EFI_CAPSULE_HEADER*) CapsulePtr [Index];
- if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
- //
- // Always reset system after all capsule processed if FMP capsule exist
- //
- if (CompareGuid (&gEfiFmpCapsuleGuid, &CapsuleHeader->CapsuleGuid)){
- NeedReset = TRUE;
- }
-
- //
- // Call capsule library to process capsule image.
- //
- ProcessCapsuleImage (CapsuleHeader);
- }
- }
-
- if (NeedReset) {
- Print(L"Capsule Request Cold Reboot.\n");
-
- for (Index = 5; Index > 0; Index--) {
- Print(L"\rResetting system in %d seconds ...", Index);
- gBS->Stall (1000000);
- }
-
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
-
- CpuDeadLoop ();
- }
-
- PlatformBdsLockNonUpdatableFlash ();
-
- //
- // Free the allocated temp memory space.
- //
- FreePool (CapsuleGuidCache);
- FreePool (CapsulePtrCache);
- FreePool (CapsulePtr);
-
- return Status;
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
deleted file mode 100644
index af2b18a047..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
+++ /dev/null
@@ -1,2591 +0,0 @@
-/** @file
- The platform device manager reference implementation
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "DeviceManager.h"
-
-DEVICE_MANAGER_CALLBACK_DATA gDeviceManagerPrivate = {
- DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE,
- NULL,
- NULL,
- NULL,
- NULL,
- {
- FakeExtractConfig,
- FakeRouteConfig,
- DeviceManagerCallback
- },
- {
- FakeExtractConfig,
- FakeRouteConfig,
- DriverHealthCallback
- }
-};
-
-#define MAX_MAC_ADDRESS_NODE_LIST_LEN 10
-
-//
-// Which Mac Address string is select
-// it will decide what menu need to show in the NETWORK_DEVICE_FORM_ID form.
-//
-EFI_STRING mSelectedMacAddrString;
-
-//
-// Which form Id need to be show.
-//
-EFI_FORM_ID mNextShowFormId = DEVICE_MANAGER_FORM_ID;
-
-//
-// The Mac Address show in the NETWORK_DEVICE_LIST_FORM_ID
-//
-MAC_ADDRESS_NODE_LIST mMacDeviceList;
-
-DEVICE_MANAGER_MENU_ITEM mDeviceManagerMenuItemTable[] = {
- { STRING_TOKEN (STR_DISK_DEVICE), EFI_DISK_DEVICE_CLASS },
- { STRING_TOKEN (STR_VIDEO_DEVICE), EFI_VIDEO_DEVICE_CLASS },
- { STRING_TOKEN (STR_NETWORK_DEVICE), EFI_NETWORK_DEVICE_CLASS },
- { STRING_TOKEN (STR_INPUT_DEVICE), EFI_INPUT_DEVICE_CLASS },
- { STRING_TOKEN (STR_ON_BOARD_DEVICE), EFI_ON_BOARD_DEVICE_CLASS },
- { STRING_TOKEN (STR_OTHER_DEVICE), EFI_OTHER_DEVICE_CLASS }
-};
-
-HII_VENDOR_DEVICE_PATH mDeviceManagerHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- DEVICE_MANAGER_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-HII_VENDOR_DEVICE_PATH mDriverHealthHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- DRIVER_HEALTH_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-/**
- This function is invoked if user selected a interactive opcode from Device Manager's
- Formset. The decision by user is saved to gCallbackKey for later processing. If
- user set VBIOS, the new value is saved to EFI variable.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceManagerCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- )
-{
- UINTN CurIndex;
-
- if (Action != EFI_BROWSER_ACTION_CHANGING) {
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
- }
-
- if (Value == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- gCallbackKey = QuestionId;
- if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {
- //
- // If user select the mac address, need to record mac address string to support next form show.
- //
- for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex ++) {
- if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) {
- mSelectedMacAddrString = HiiGetString (gDeviceManagerPrivate.HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId, NULL);
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
-
- This function registers HII packages to HII database.
-
- @retval EFI_SUCCESS HII packages for the Device Manager were registered successfully.
- @retval EFI_OUT_OF_RESOURCES HII packages for the Device Manager failed to be registered.
-
-**/
-EFI_STATUS
-InitializeDeviceManager (
- VOID
- )
-{
- EFI_STATUS Status;
-
- //
- // Install Device Path Protocol and Config Access protocol to driver handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &gDeviceManagerPrivate.DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mDeviceManagerHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &gDeviceManagerPrivate.ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &gDeviceManagerPrivate.DriverHealthHandle,
- &gEfiDevicePathProtocolGuid,
- &mDriverHealthHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &gDeviceManagerPrivate.DriverHealthConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- mMacDeviceList.CurListLen = 0;
- mMacDeviceList.MaxListLen = 0;
-
- return Status;
-}
-
-/**
- Extract the displayed formset for given HII handle and class guid.
-
- @param Handle The HII handle.
- @param SetupClassGuid The class guid specifies which form set will be displayed.
- @param SkipCount Skip some formsets which has processed before.
- @param FormSetTitle Formset title string.
- @param FormSetHelp Formset help string.
- @param FormSetGuid Return the formset guid for this formset.
-
- @retval TRUE The formset for given HII handle will be displayed.
- @return FALSE The formset for given HII handle will not be displayed.
-
-**/
-BOOLEAN
-ExtractDisplayedHiiFormFromHiiHandle (
- IN EFI_HII_HANDLE Handle,
- IN EFI_GUID *SetupClassGuid,
- IN UINTN SkipCount,
- OUT EFI_STRING_ID *FormSetTitle,
- OUT EFI_STRING_ID *FormSetHelp,
- OUT EFI_GUID **FormSetGuid
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
- UINT8 *Package;
- UINT8 *OpCodeData;
- UINT32 Offset;
- UINT32 Offset2;
- UINT32 PackageListLength;
- EFI_HII_PACKAGE_HEADER PackageHeader;
- EFI_GUID *ClassGuid;
- UINT8 ClassGuidNum;
-
- ASSERT (Handle != NULL);
- ASSERT (SetupClassGuid != NULL);
- ASSERT (FormSetTitle != NULL);
- ASSERT (FormSetHelp != NULL);
-
- *FormSetTitle = 0;
- *FormSetHelp = 0;
- ClassGuidNum = 0;
- ClassGuid = NULL;
-
- //
- // Get HII PackageList
- //
- BufferSize = 0;
- HiiPackageList = NULL;
- Status = gHiiDatabase->ExportPackageLists (gHiiDatabase, Handle, &BufferSize, HiiPackageList);
- //
- // Handle is a invalid handle. Check if Handle is corrupted.
- //
- ASSERT (Status != EFI_NOT_FOUND);
- //
- // The return status should always be EFI_BUFFER_TOO_SMALL as input buffer's size is 0.
- //
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
-
- HiiPackageList = AllocatePool (BufferSize);
- ASSERT (HiiPackageList != NULL);
-
- Status = gHiiDatabase->ExportPackageLists (gHiiDatabase, Handle, &BufferSize, HiiPackageList);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- //
- // Get Form package from this HII package List
- //
- Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
- Offset2 = 0;
- PackageListLength = ReadUnaligned32 (&HiiPackageList->PackageLength);
-
- while (Offset < PackageListLength) {
- Package = ((UINT8 *) HiiPackageList) + Offset;
- CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
-
- if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
- //
- // Search FormSet Opcode in this Form Package
- //
- Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);
- while (Offset2 < PackageHeader.Length) {
- OpCodeData = Package + Offset2;
- Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
-
- if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {
- if (SkipCount != 0) {
- SkipCount --;
- continue;
- }
-
- if (((EFI_IFR_OP_HEADER *) OpCodeData)->Length > OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {
- //
- // Find FormSet OpCode
- //
- ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3);
- ClassGuid = (EFI_GUID *) (VOID *)(OpCodeData + sizeof (EFI_IFR_FORM_SET));
- while (ClassGuidNum-- > 0) {
- if (CompareGuid (SetupClassGuid, ClassGuid)) {
- CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
- CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));
- *FormSetGuid = AllocateCopyPool (sizeof (EFI_GUID), &((EFI_IFR_FORM_SET *) OpCodeData)->Guid);
- ASSERT (*FormSetGuid != NULL);
- FreePool (HiiPackageList);
- return TRUE;
- }
- ClassGuid ++;
- }
- } else {
- CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
- CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));
- *FormSetGuid = AllocateCopyPool (sizeof (EFI_GUID), &((EFI_IFR_FORM_SET *) OpCodeData)->Guid);
- ASSERT (*FormSetGuid != NULL);
- FreePool (HiiPackageList);
- return TRUE;
- }
- }
- }
- }
-
- //
- // Go to next package
- //
- Offset += PackageHeader.Length;
- }
-
- FreePool (HiiPackageList);
-
- return FALSE;
-}
-
-/**
- Get the mac address string from the device path.
- if the device path has the vlan, get the vanid also.
-
- @param MacAddressNode Device path begin with mac address
- @param PBuffer Output string buffer contain mac address.
-
-**/
-BOOLEAN
-GetMacAddressString(
- IN MAC_ADDR_DEVICE_PATH *MacAddressNode,
- OUT CHAR16 **PBuffer
- )
-{
- UINTN HwAddressSize;
- UINTN Index;
- UINT8 *HwAddress;
- EFI_DEVICE_PATH_PROTOCOL *Node;
- UINT16 VlanId;
- CHAR16 *String;
- UINTN BufferLen;
-
- VlanId = 0;
- String = NULL;
- ASSERT(MacAddressNode != NULL);
-
- HwAddressSize = sizeof (EFI_MAC_ADDRESS);
- if (MacAddressNode->IfType == 0x01 || MacAddressNode->IfType == 0x00) {
- HwAddressSize = 6;
- }
-
- //
- // The output format is MAC:XX:XX:XX:...\XXXX
- // The size is the Number size + ":" size + Vlan size(\XXXX) + End
- //
- BufferLen = (4 + 2 * HwAddressSize + (HwAddressSize - 1) + 5 + 1) * sizeof (CHAR16);
- String = AllocateZeroPool (BufferLen);
- if (String == NULL) {
- return FALSE;
- }
-
- *PBuffer = String;
- StrCpyS (String, BufferLen / sizeof (CHAR16), L"MAC:");
- String += 4;
-
- //
- // Convert the MAC address into a unicode string.
- //
- HwAddress = &MacAddressNode->MacAddress.Addr[0];
- for (Index = 0; Index < HwAddressSize; Index++) {
- String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);
- if (Index < HwAddressSize - 1) {
- *String++ = L':';
- }
- }
-
- //
- // If VLAN is configured, it will need extra 5 characters like "\0005".
- // Plus one unicode character for the null-terminator.
- //
- Node = (EFI_DEVICE_PATH_PROTOCOL *)MacAddressNode;
- while (!IsDevicePathEnd (Node)) {
- if (Node->Type == MESSAGING_DEVICE_PATH && Node->SubType == MSG_VLAN_DP) {
- VlanId = ((VLAN_DEVICE_PATH *) Node)->VlanId;
- }
- Node = NextDevicePathNode (Node);
- }
-
- if (VlanId != 0) {
- *String++ = L'\\';
- String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, VlanId, 4);
- }
-
- //
- // Null terminate the Unicode string
- //
- *String = L'\0';
-
- return TRUE;
-}
-
-/**
- Save question id and prompt id to the mac device list.
- If the same mac address has saved yet, no need to add more.
-
- @param MacAddrString Mac address string.
-
- @retval EFI_SUCCESS Add the item is successful.
- @return Other values if failed to Add the item.
-**/
-BOOLEAN
-AddIdToMacDeviceList (
- IN EFI_STRING MacAddrString
- )
-{
- MENU_INFO_ITEM *TempDeviceList;
- UINTN Index;
- EFI_STRING StoredString;
- EFI_STRING_ID PromptId;
- EFI_HII_HANDLE HiiHandle;
-
- HiiHandle = gDeviceManagerPrivate.HiiHandle;
- TempDeviceList = NULL;
-
- for (Index = 0; Index < mMacDeviceList.CurListLen; Index ++) {
- StoredString = HiiGetString (HiiHandle, mMacDeviceList.NodeList[Index].PromptId, NULL);
- if (StoredString == NULL) {
- return FALSE;
- }
-
- //
- // Already has save the same mac address to the list.
- //
- if (StrCmp (MacAddrString, StoredString) == 0) {
- return FALSE;
- }
- }
-
- PromptId = HiiSetString(HiiHandle, 0, MacAddrString, NULL);
- //
- // If not in the list, save it.
- //
- if (mMacDeviceList.MaxListLen > mMacDeviceList.CurListLen + 1) {
- mMacDeviceList.NodeList[mMacDeviceList.CurListLen].PromptId = PromptId;
- mMacDeviceList.NodeList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
- } else {
- mMacDeviceList.MaxListLen += MAX_MAC_ADDRESS_NODE_LIST_LEN;
- if (mMacDeviceList.CurListLen != 0) {
- TempDeviceList = (MENU_INFO_ITEM *)AllocateCopyPool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen, (VOID *)mMacDeviceList.NodeList);
- } else {
- TempDeviceList = (MENU_INFO_ITEM *)AllocatePool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen);
- }
-
- if (TempDeviceList == NULL) {
- return FALSE;
- }
- TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId;
- TempDeviceList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
-
- if (mMacDeviceList.CurListLen > 0) {
- FreePool(mMacDeviceList.NodeList);
- }
-
- mMacDeviceList.NodeList = TempDeviceList;
- }
- mMacDeviceList.CurListLen ++;
-
- return TRUE;
-}
-
-/**
- Check the devcie path, try to find whether it has mac address path.
-
- In this function, first need to check whether this path has mac address path.
- second, when the mac address device path has find, also need to deicide whether
- need to add this mac address relate info to the menu.
-
- @param *Node Input device which need to be check.
- @param *NeedAddItem Whether need to add the menu in the network device list.
-
- @retval TRUE Has mac address device path.
- @retval FALSE NOT Has mac address device path.
-
-**/
-BOOLEAN
-IsMacAddressDevicePath (
- IN VOID *Node,
- OUT BOOLEAN *NeedAddItem
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- CHAR16 *Buffer;
- BOOLEAN ReturnVal;
-
- ASSERT (Node != NULL);
- *NeedAddItem = FALSE;
- ReturnVal = FALSE;
- Buffer = NULL;
-
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;
-
- //
- // find the partition device path node
- //
- while (!IsDevicePathEnd (DevicePath)) {
- if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&
- (DevicePathSubType (DevicePath) == MSG_MAC_ADDR_DP)) {
- ReturnVal = TRUE;
-
- if (DEVICE_MANAGER_FORM_ID == mNextShowFormId) {
- *NeedAddItem = TRUE;
- break;
- }
-
- if (!GetMacAddressString((MAC_ADDR_DEVICE_PATH*)DevicePath, &Buffer)) {
- break;
- }
-
- if (NETWORK_DEVICE_FORM_ID == mNextShowFormId) {
- if (StrCmp (Buffer, mSelectedMacAddrString) == 0) {
- *NeedAddItem = TRUE;
- }
- break;
- }
-
- if (NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId) {
- //
- // Same handle may has two network child handle, so the questionid
- // has the offset of SAME_HANDLE_KEY_OFFSET.
- //
- if (AddIdToMacDeviceList (Buffer)) {
- *NeedAddItem = TRUE;
- }
- break;
- }
- }
- DevicePath = NextDevicePathNode (DevicePath);
- }
-
- if (Buffer != NULL) {
- FreePool (Buffer);
- }
-
- return ReturnVal;
-}
-
-/**
- Check to see if the device path is for the network device.
-
- @param Handle The HII handle which include the mac address device path.
- @param ItemCount The new add Mac address item count.
-
- @retval TRUE Need to add new item in the menu.
- @return FALSE Do not need to add the menu about the network.
-
-**/
-BOOLEAN
-IsNeedAddNetworkMenu (
- IN EFI_HII_HANDLE Handle,
- OUT UINTN *ItemCount
- )
-{
- EFI_STATUS Status;
- UINTN EntryCount;
- UINTN Index;
- EFI_HANDLE DriverHandle;
- EFI_HANDLE ControllerHandle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- BOOLEAN IsNeedAdd;
-
- IsNeedAdd = FALSE;
- OpenInfoBuffer = NULL;
- if ((Handle == NULL) || (ItemCount == NULL)) {
- return FALSE;
- }
- *ItemCount = 0;
-
- Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- //
- // Get the device path by the got Driver handle .
- //
- Status = gBS->HandleProtocol (DriverHandle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- TmpDevicePath = DevicePath;
-
- //
- // Check whether this device path include mac address device path.
- // If this path has mac address path, get the value whether need
- // add this info to the menu and return.
- // Else check more about the child handle devcie path.
- //
- if (IsMacAddressDevicePath(TmpDevicePath, &IsNeedAdd)) {
- if ((NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId) && IsNeedAdd) {
- (*ItemCount) = 1;
- }
- return IsNeedAdd;
- }
-
- //
- // Search whether this path is the controller path, not he child handle path.
- // And the child handle has the network devcie connected.
- //
- TmpDevicePath = DevicePath;
- Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &TmpDevicePath, &ControllerHandle);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (!IsDevicePathEnd (TmpDevicePath)) {
- return FALSE;
- }
-
- //
- // Retrieve the list of agents that are consuming the specific protocol
- // on ControllerHandle.
- // The buffer point by OpenInfoBuffer need be free at this function.
- //
- Status = gBS->OpenProtocolInformation (
- ControllerHandle,
- &gEfiPciIoProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- //
- // Inspect if ChildHandle is one of the agents.
- //
- Status = EFI_UNSUPPORTED;
- for (Index = 0; Index < EntryCount; Index++) {
- //
- // Query all the children created by the controller handle's driver
- //
- if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = gBS->OpenProtocol (
- OpenInfoBuffer[Index].ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ChildDevicePath,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Check whether this device path include mac address device path.
- //
- if (!IsMacAddressDevicePath(ChildDevicePath, &IsNeedAdd)) {
- //
- // If this path not has mac address path, check the other.
- //
- continue;
- } else {
- //
- // If need to update the NETWORK_DEVICE_LIST_FORM, try to get more.
- //
- if ((NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId)) {
- if (IsNeedAdd) {
- (*ItemCount) += 1;
- }
- continue;
- } else {
- //
- // If need to update other form, return whether need to add to the menu.
- //
- goto Done;
- }
- }
- }
- }
-
-Done:
- if (OpenInfoBuffer != NULL) {
- FreePool (OpenInfoBuffer);
- }
- return IsNeedAdd;
-}
-
-/**
- Get HiiHandle total number.
-
- @param HiiHandles The input HiiHandle array.
-
- @retval the Hiihandle count.
-
-**/
-UINTN
-GetHiiHandleCount (
- IN EFI_HII_HANDLE *HiiHandles
- )
-{
- UINTN Index;
-
- for (Index = 0; HiiHandles[Index] != NULL; Index++) {
- }
-
- return Index;
-}
-
-/**
- Insert the new HiiHandle + FormsetGuid at the NewPair[InsertOffset].
-
- @param HiiHandles The input HiiHandle array.
- @param GuidLists The input form set guid lists.
- @param ArrayCount The input array count, new array will be arraycount + 1 size.
- @param Offset The current used HiiHandle's Offset.
- @param FormSetGuid The new found formset guid.
-
-**/
-VOID
-AdjustArrayData (
- IN OUT EFI_HII_HANDLE **HiiHandles,
- IN OUT EFI_GUID ***GuidLists,
- IN UINTN ArrayCount,
- IN UINTN Offset,
- IN EFI_GUID *FormSetGuid
- )
-{
- EFI_HII_HANDLE *NewHiiHandles;
- EFI_GUID **NewGuidLists;
-
- //
- // +2 means include the new HiiHandle and the last empty NULL pointer.
- //
- NewHiiHandles = AllocateZeroPool ((ArrayCount + 2) * sizeof (EFI_HII_HANDLE));
- ASSERT (NewHiiHandles != NULL);
-
- CopyMem (NewHiiHandles, *HiiHandles, Offset * sizeof (EFI_HII_HANDLE));
- NewHiiHandles[Offset] = NewHiiHandles[Offset - 1];
- CopyMem (NewHiiHandles + Offset + 1, *HiiHandles + Offset, (ArrayCount - Offset) * sizeof (EFI_HII_HANDLE));
-
- NewGuidLists = AllocateZeroPool ((ArrayCount + 2) * sizeof (EFI_GUID *));
- ASSERT (NewGuidLists != NULL);
-
- CopyMem (NewGuidLists, *GuidLists, Offset * sizeof (EFI_GUID *));
- NewGuidLists[Offset] = FormSetGuid;
-
- FreePool (*HiiHandles);
- *HiiHandles = NewHiiHandles;
- FreePool (*GuidLists);
- *GuidLists = NewGuidLists;
-}
-
-/**
- Call the browser and display the device manager to allow user
- to configure the platform.
-
- This function create the dynamic content for device manager. It includes
- section header for all class of devices, one-of opcode to set VBIOS.
-
- @retval EFI_SUCCESS Operation is successful.
- @return Other values if failed to clean up the dynamic content from HII
- database.
-
-**/
-EFI_STATUS
-CallDeviceManager (
- VOID
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_STRING String;
- EFI_STRING_ID Token;
- EFI_STRING_ID TokenHelp;
- EFI_HII_HANDLE *HiiHandles;
- EFI_HII_HANDLE HiiHandle;
- EFI_STRING_ID FormSetTitle;
- EFI_STRING_ID FormSetHelp;
- EFI_BROWSER_ACTION_REQUEST ActionRequest;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *EndLabel;
- UINTN NumHandles;
- EFI_HANDLE *DriverHealthHandles;
- BOOLEAN AddNetworkMenu;
- UINTN AddItemCount;
- UINTN NewStringLen;
- EFI_STRING NewStringTitle;
- EFI_GUID **GuidLists;
- UINTN HandleNum;
- UINTN SkipCount;
- EFI_GUID *FormSetGuid;
-
- GuidLists = NULL;
- HiiHandles = NULL;
- Status = EFI_SUCCESS;
- gCallbackKey = 0;
- NumHandles = 0;
- DriverHealthHandles = NULL;
- AddNetworkMenu = FALSE;
- AddItemCount = 0;
- SkipCount = 0;
- FormSetGuid = NULL;
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
-
- HiiHandle = gDeviceManagerPrivate.HiiHandle;
- if (HiiHandle == NULL) {
- //
- // Publish our HII data.
- //
- HiiHandle = HiiAddPackages (
- &gDeviceManagerFormSetGuid,
- gDeviceManagerPrivate.DriverHandle,
- DeviceManagerVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (HiiHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- gDeviceManagerPrivate.HiiHandle = HiiHandle;
- }
-
- //
- // If need show the Network device list form, clear the old save list first.
- //
- if ((mNextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) && (mMacDeviceList.CurListLen > 0)) {
- mMacDeviceList.CurListLen = 0;
- }
-
- //
- // Update the network device form titile.
- //
- if (mNextShowFormId == NETWORK_DEVICE_FORM_ID) {
- String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);
- NewStringLen = StrLen(mSelectedMacAddrString) * 2;
- NewStringLen += (StrLen(String) + 2) * 2;
- NewStringTitle = AllocatePool (NewStringLen);
- UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
- HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);
- FreePool (String);
- FreePool (NewStringTitle);
- }
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandle != NULL);
-
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandle != NULL);
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- //
- // According to the next show Form id(mNextShowFormId) to decide which form need to update.
- //
- StartLabel->Number = (UINT16) (LABEL_FORM_ID_OFFSET + mNextShowFormId);
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = LABEL_END;
-
- //
- // Get all the Hii handles
- //
- HiiHandles = HiiGetHiiHandles (NULL);
- ASSERT (HiiHandles != NULL);
-
- HandleNum = GetHiiHandleCount (HiiHandles);
- GuidLists = AllocateZeroPool ((HandleNum + 1) * sizeof (EFI_GUID *));
- ASSERT (GuidLists != NULL);
-
- //
- // Search for formset of each class type
- //
- for (Index = 0; HiiHandles[Index] != NULL; Index++) {
- //
- // The QuestionId in the form which will call the driver form has this asssumption.
- // QuestionId = Handle Index + NETWORK_DEVICE_LIST_KEY_OFFSET;
- // Different QuestionId at least has the section of NETWORK_DEVICE_LIST_KEY_OFFSET.
- //
- ASSERT(Index < MAX_KEY_SECTION_LEN);
-
- if (!ExtractDisplayedHiiFormFromHiiHandle (HiiHandles[Index], &gEfiHiiPlatformSetupFormsetGuid, SkipCount, &FormSetTitle, &FormSetHelp, &FormSetGuid)) {
- SkipCount = 0;
- continue;
- }
-
- //
- // One HiiHandle has more than one formset can be shown,
- // Insert a new pair of HiiHandle + Guid to the HiiHandles and GuidLists list.
- //
- if (SkipCount > 0) {
- AdjustArrayData (&HiiHandles, &GuidLists, HandleNum, Index + 1, FormSetGuid);
- HandleNum ++;
- Index ++;
- }
-
- String = HiiGetString (HiiHandles[Index], FormSetTitle, NULL);
- if (String == NULL) {
- String = HiiGetString (HiiHandle, STR_MISSING_STRING, NULL);
- ASSERT (String != NULL);
- }
- Token = HiiSetString (HiiHandle, 0, String, NULL);
- FreePool (String);
-
- String = HiiGetString (HiiHandles[Index], FormSetHelp, NULL);
- if (String == NULL) {
- String = HiiGetString (HiiHandle, STR_MISSING_STRING, NULL);
- ASSERT (String != NULL);
- }
- TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
- FreePool (String);
-
- //
- // Network device process
- //
- if (IsNeedAddNetworkMenu (HiiHandles[Index], &AddItemCount)) {
- if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) {
- //
- // Only show one menu item "Network Config" in the device manger form.
- //
- if (!AddNetworkMenu) {
- AddNetworkMenu = TRUE;
- HiiCreateGotoOpCode (
- StartOpCodeHandle,
- INVALID_FORM_ID,
- STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_TITLE),
- STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_HELP),
- EFI_IFR_FLAG_CALLBACK,
- (EFI_QUESTION_ID) QUESTION_NETWORK_DEVICE_ID
- );
- }
- } else if (mNextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) {
- //
- // In network device list form, same mac address device only show one menu.
- //
- while (AddItemCount > 0) {
- HiiCreateGotoOpCode (
- StartOpCodeHandle,
- INVALID_FORM_ID,
- mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,
- STRING_TOKEN (STR_NETWORK_DEVICE_HELP),
- EFI_IFR_FLAG_CALLBACK,
- mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].QuestionId
- );
- AddItemCount -= 1;
- }
- } else if (mNextShowFormId == NETWORK_DEVICE_FORM_ID) {
- //
- // In network device form, only the selected mac address device need to be show.
- //
- HiiCreateGotoOpCode (
- StartOpCodeHandle,
- INVALID_FORM_ID,
- Token,
- TokenHelp,
- EFI_IFR_FLAG_CALLBACK,
- (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET)
- );
- }
- } else {
- //
- //
- // Not network device process, only need to show at device manger form.
- //
- if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) {
- HiiCreateGotoOpCode (
- StartOpCodeHandle,
- INVALID_FORM_ID,
- Token,
- TokenHelp,
- EFI_IFR_FLAG_CALLBACK,
- (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET)
- );
- }
- }
-
- //
- // Try to find more formset in this HiiHandle.
- //
- SkipCount++;
- Index--;
- }
-
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDriverHealthProtocolGuid,
- NULL,
- &NumHandles,
- &DriverHealthHandles
- );
-
- //
- // If there are no drivers installed driver health protocol, do not create driver health entry in UI
- //
- if (NumHandles != 0) {
- //
- // If driver health protocol is installed, create Driver Health subtitle and entry
- //
- HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_DM_DRIVER_HEALTH_TITLE), 0, 0, 0);
- HiiCreateGotoOpCode (
- StartOpCodeHandle,
- DRIVER_HEALTH_FORM_ID,
- STRING_TOKEN(STR_DRIVER_HEALTH_ALL_HEALTHY), // Prompt text
- STRING_TOKEN(STR_DRIVER_HEALTH_STATUS_HELP), // Help text
- EFI_IFR_FLAG_CALLBACK,
- DEVICE_MANAGER_KEY_DRIVER_HEALTH // Question ID
- );
-
- //
- // Check All Driver health status
- //
- if (!PlaformHealthStatusCheck ()) {
- //
- // At least one driver in the platform are not in healthy status
- //
- HiiSetString (HiiHandle, STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY), GetStringById (STRING_TOKEN (STR_DRIVER_NOT_HEALTH)), NULL);
- } else {
- //
- // For the string of STR_DRIVER_HEALTH_ALL_HEALTHY previously has been updated and we need to update it while re-entry.
- //
- HiiSetString (HiiHandle, STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY), GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY)), NULL);
- }
- }
-
- HiiUpdateForm (
- HiiHandle,
- &gDeviceManagerFormSetGuid,
- mNextShowFormId,
- StartOpCodeHandle,
- EndOpCodeHandle
- );
-
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &HiiHandle,
- 1,
- &gDeviceManagerFormSetGuid,
- mNextShowFormId,
- NULL,
- &ActionRequest
- );
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- //
- // We will have returned from processing a callback, selected
- // a target to display
- //
- if ((gCallbackKey >= DEVICE_KEY_OFFSET)) {
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &HiiHandles[gCallbackKey - DEVICE_KEY_OFFSET],
- 1,
- GuidLists[gCallbackKey - DEVICE_KEY_OFFSET],
- 0,
- NULL,
- &ActionRequest
- );
-
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- //
- // Force return to Device Manager
- //
- gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
- goto Done;
- }
-
- //
- // Driver Health item chose.
- //
- if (gCallbackKey == DEVICE_MANAGER_KEY_DRIVER_HEALTH) {
- CallDriverHealth ();
- //
- // Force return to Device Manager
- //
- gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
- goto Done;
- }
-
- //
- // Enter from device manager and into the network device list.
- //
- if (gCallbackKey == QUESTION_NETWORK_DEVICE_ID) {
- mNextShowFormId = NETWORK_DEVICE_LIST_FORM_ID;
- gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
- goto Done;
- }
-
- //
- // In this case, go from the network device list to the specify device.
- //
- if ((gCallbackKey < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET ) && (gCallbackKey >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {
- mNextShowFormId = NETWORK_DEVICE_FORM_ID;
- gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
- goto Done;
- }
-
- //
- // Select the ESC, the gCallbackKey == 0.
- //
- if(mNextShowFormId - 1 < DEVICE_MANAGER_FORM_ID) {
- mNextShowFormId = DEVICE_MANAGER_FORM_ID;
- } else {
- mNextShowFormId = (UINT16) (mNextShowFormId - 1);
- gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
- }
-
-Done:
- //
- // Remove our packagelist from HII database.
- //
- HiiRemovePackages (HiiHandle);
- gDeviceManagerPrivate.HiiHandle = NULL;
-
- HiiFreeOpCodeHandle (StartOpCodeHandle);
- HiiFreeOpCodeHandle (EndOpCodeHandle);
- FreePool (HiiHandles);
-
- for (Index = 0; Index < HandleNum; Index++) {
- if (GuidLists[Index] != NULL) {
- FreePool (GuidLists[Index]);
- }
- }
- FreePool (GuidLists);
-
- return Status;
-}
-
-/**
- This function is invoked if user selected a interactive opcode from Driver Health's
- Formset. The decision by user is saved to gCallbackKey for later processing.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
-
-**/
-EFI_STATUS
-EFIAPI
-DriverHealthCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- )
-{
- if (Action == EFI_BROWSER_ACTION_CHANGED) {
- if ((Value == NULL) || (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- gCallbackKey = QuestionId;
-
- //
- // Request to exit SendForm(), so as to switch to selected form
- //
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
-
- return EFI_SUCCESS;
- }
-
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
-}
-
-/**
- Collect and display the platform's driver health relative information, allow user to do interactive
- operation while the platform is unhealthy.
-
- This function display a form which divided into two parts. The one list all modules which has installed
- driver health protocol. The list usually contain driver name, controller name, and it's health info.
- While the driver name can't be retrieved, will use device path as backup. The other part of the form provide
- a choice to the user to repair all platform.
-
-**/
-VOID
-CallDriverHealth (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_HII_HANDLE HiiHandle;
- EFI_BROWSER_ACTION_REQUEST ActionRequest;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *StartLabelRepair;
- EFI_IFR_GUID_LABEL *EndLabel;
- EFI_IFR_GUID_LABEL *EndLabelRepair;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- VOID *StartOpCodeHandleRepair;
- VOID *EndOpCodeHandleRepair;
- UINTN Index;
- EFI_STRING_ID Token;
- EFI_STRING_ID TokenHelp;
- EFI_STRING String;
- EFI_STRING TmpString;
- EFI_STRING DriverName;
- EFI_STRING ControllerName;
- LIST_ENTRY DriverHealthList;
- DRIVER_HEALTH_INFO *DriverHealthInfo;
- LIST_ENTRY *Link;
- EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath;
- BOOLEAN RebootRequired;
- BOOLEAN IsControllerNameEmpty;
- UINTN StringSize;
-
- Index = 0;
- DriverHealthInfo = NULL;
- DriverDevicePath = NULL;
- IsControllerNameEmpty = FALSE;
- InitializeListHead (&DriverHealthList);
-
- HiiHandle = gDeviceManagerPrivate.DriverHealthHiiHandle;
- if (HiiHandle == NULL) {
- //
- // Publish Driver Health HII data.
- //
- HiiHandle = HiiAddPackages (
- &gDeviceManagerFormSetGuid,
- gDeviceManagerPrivate.DriverHealthHandle,
- DriverHealthVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (HiiHandle == NULL) {
- return;
- }
-
- gDeviceManagerPrivate.DriverHealthHiiHandle = HiiHandle;
- }
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandle != NULL);
-
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandle != NULL);
-
- StartOpCodeHandleRepair = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandleRepair != NULL);
-
- EndOpCodeHandleRepair = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandleRepair != NULL);
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = LABEL_DRIVER_HEALTH;
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabelRepair = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandleRepair, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabelRepair->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabelRepair->Number = LABEL_DRIVER_HEALTH_REAPIR_ALL;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = LABEL_DRIVER_HEALTH_END;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabelRepair = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandleRepair, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabelRepair->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabelRepair->Number = LABEL_DRIVER_HEALTH_REAPIR_ALL_END;
-
- HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_DH_STATUS_LIST), 0, 0, 1);
-
- Status = GetAllControllersHealthStatus (&DriverHealthList);
- ASSERT (Status != EFI_OUT_OF_RESOURCES);
-
- Link = GetFirstNode (&DriverHealthList);
-
- while (!IsNull (&DriverHealthList, Link)) {
- DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);
-
- Status = DriverHealthGetDriverName (DriverHealthInfo->DriverHandle, &DriverName);
- if (EFI_ERROR (Status)) {
- //
- // Can not get the Driver name, so use the Device path
- //
- DriverDevicePath = DevicePathFromHandle (DriverHealthInfo->DriverHandle);
- DriverName = DevicePathToStr (DriverDevicePath);
- }
- StringSize = StrSize (DriverName);
-
- Status = DriverHealthGetControllerName (
- DriverHealthInfo->DriverHandle,
- DriverHealthInfo->ControllerHandle,
- DriverHealthInfo->ChildHandle,
- &ControllerName
- );
-
- if (!EFI_ERROR (Status)) {
- IsControllerNameEmpty = FALSE;
- StringSize += StrLen (L" ") * sizeof(CHAR16);
- StringSize += StrLen (ControllerName) * sizeof(CHAR16);
- } else {
- IsControllerNameEmpty = TRUE;
- }
-
- //
- // Add the message of the Module itself provided after the string item.
- //
- if ((DriverHealthInfo->MessageList != NULL) && (DriverHealthInfo->MessageList->StringId != 0)) {
- TmpString = HiiGetString (
- DriverHealthInfo->MessageList->HiiHandle,
- DriverHealthInfo->MessageList->StringId,
- NULL
- );
- ASSERT (TmpString != NULL);
-
- StringSize += StrLen (L" ") * sizeof(CHAR16);
- StringSize += StrLen (TmpString) * sizeof(CHAR16);
-
- String = (EFI_STRING) AllocateZeroPool (StringSize);
- ASSERT (String != NULL);
-
- StrCpyS (String, StringSize / sizeof(CHAR16), DriverName);
- if (!IsControllerNameEmpty) {
- StrCatS (String, StringSize / sizeof(CHAR16), L" ");
- StrCatS (String, StringSize / sizeof(CHAR16), ControllerName);
- }
-
- StrCatS (String, StringSize / sizeof(CHAR16), L" ");
- StrCatS (String, StringSize / sizeof(CHAR16), TmpString);
-
- } else {
- //
- // Update the string will be displayed base on the driver's health status
- //
- switch(DriverHealthInfo->HealthStatus) {
- case EfiDriverHealthStatusRepairRequired:
- TmpString = GetStringById (STRING_TOKEN (STR_REPAIR_REQUIRED));
- break;
- case EfiDriverHealthStatusConfigurationRequired:
- TmpString = GetStringById (STRING_TOKEN (STR_CONFIGURATION_REQUIRED));
- break;
- case EfiDriverHealthStatusFailed:
- TmpString = GetStringById (STRING_TOKEN (STR_OPERATION_FAILED));
- break;
- case EfiDriverHealthStatusReconnectRequired:
- TmpString = GetStringById (STRING_TOKEN (STR_RECONNECT_REQUIRED));
- break;
- case EfiDriverHealthStatusRebootRequired:
- TmpString = GetStringById (STRING_TOKEN (STR_REBOOT_REQUIRED));
- break;
- default:
- TmpString = GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_HEALTHY));
- break;
- }
- ASSERT (TmpString != NULL);
-
- StringSize += StrLen (TmpString) * sizeof(CHAR16);
-
- String = (EFI_STRING) AllocateZeroPool (StringSize);
- ASSERT (String != NULL);
-
- StrCpyS (String, StringSize / sizeof (CHAR16), DriverName);
- if (!IsControllerNameEmpty) {
- StrCatS (String, StringSize / sizeof (CHAR16), L" ");
- StrCatS (String, StringSize / sizeof (CHAR16), ControllerName);
- }
-
- StrCatS (String, StringSize / sizeof (CHAR16), TmpString);
- }
-
- FreePool (TmpString);
-
- Token = HiiSetString (HiiHandle, 0, String, NULL);
- FreePool (String);
-
- TokenHelp = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DH_REPAIR_SINGLE_HELP)), NULL);
-
- HiiCreateActionOpCode (
- StartOpCodeHandle,
- (EFI_QUESTION_ID) (Index + DRIVER_HEALTH_KEY_OFFSET),
- Token,
- TokenHelp,
- EFI_IFR_FLAG_CALLBACK,
- 0
- );
- Index++;
- Link = GetNextNode (&DriverHealthList, Link);
- }
-
- //
- // Add End Opcode for Subtitle
- //
- HiiCreateEndOpCode (StartOpCodeHandle);
-
- HiiCreateSubTitleOpCode (StartOpCodeHandleRepair, STRING_TOKEN (STR_DRIVER_HEALTH_REPAIR_ALL), 0, 0, 1);
- TokenHelp = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DH_REPAIR_ALL_HELP)), NULL);
-
- if (PlaformHealthStatusCheck ()) {
- //
- // No action need to do for the platform
- //
- Token = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY)), NULL);
- HiiCreateActionOpCode (
- StartOpCodeHandleRepair,
- 0,
- Token,
- TokenHelp,
- EFI_IFR_FLAG_READ_ONLY,
- 0
- );
- } else {
- //
- // Create ActionOpCode only while the platform need to do health related operation.
- //
- Token = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DH_REPAIR_ALL_TITLE)), NULL);
- HiiCreateActionOpCode (
- StartOpCodeHandleRepair,
- (EFI_QUESTION_ID) DRIVER_HEALTH_REPAIR_ALL_KEY,
- Token,
- TokenHelp,
- EFI_IFR_FLAG_CALLBACK,
- 0
- );
- }
-
- HiiCreateEndOpCode (StartOpCodeHandleRepair);
-
- Status = HiiUpdateForm (
- HiiHandle,
- &gDriverHealthFormSetGuid,
- DRIVER_HEALTH_FORM_ID,
- StartOpCodeHandle,
- EndOpCodeHandle
- );
- ASSERT (Status != EFI_NOT_FOUND);
- ASSERT (Status != EFI_BUFFER_TOO_SMALL);
-
- Status = HiiUpdateForm (
- HiiHandle,
- &gDriverHealthFormSetGuid,
- DRIVER_HEALTH_FORM_ID,
- StartOpCodeHandleRepair,
- EndOpCodeHandleRepair
- );
- ASSERT (Status != EFI_NOT_FOUND);
- ASSERT (Status != EFI_BUFFER_TOO_SMALL);
-
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &HiiHandle,
- 1,
- &gDriverHealthFormSetGuid,
- DRIVER_HEALTH_FORM_ID,
- NULL,
- &ActionRequest
- );
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- //
- // We will have returned from processing a callback - user either hit ESC to exit, or selected
- // a target to display.
- // Process the diver health status states here.
- //
- if (gCallbackKey >= DRIVER_HEALTH_KEY_OFFSET && gCallbackKey != DRIVER_HEALTH_REPAIR_ALL_KEY) {
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
-
- Link = GetFirstNode (&DriverHealthList);
- Index = 0;
-
- while (!IsNull (&DriverHealthList, Link)) {
- //
- // Got the item relative node in the List
- //
- if (Index == (gCallbackKey - DRIVER_HEALTH_KEY_OFFSET)) {
- DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);
- //
- // Process the driver's healthy status for the specify module
- //
- RebootRequired = FALSE;
- ProcessSingleControllerHealth (
- DriverHealthInfo->DriverHealth,
- DriverHealthInfo->ControllerHandle,
- DriverHealthInfo->ChildHandle,
- DriverHealthInfo->HealthStatus,
- &(DriverHealthInfo->MessageList),
- DriverHealthInfo->HiiHandle,
- &RebootRequired
- );
- if (RebootRequired) {
- gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
- }
- break;
- }
- Index++;
- Link = GetNextNode (&DriverHealthList, Link);
- }
-
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- //
- // Force return to the form of Driver Health in Device Manager
- //
- gCallbackKey = DRIVER_HEALTH_RETURN_KEY;
- }
-
- //
- // Repair the whole platform
- //
- if (gCallbackKey == DRIVER_HEALTH_REPAIR_ALL_KEY) {
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
-
- PlatformRepairAll (&DriverHealthList);
-
- gCallbackKey = DRIVER_HEALTH_RETURN_KEY;
- }
-
- //
- // Remove driver health packagelist from HII database.
- //
- HiiRemovePackages (HiiHandle);
- gDeviceManagerPrivate.DriverHealthHiiHandle = NULL;
-
- //
- // Free driver health info list
- //
- while (!IsListEmpty (&DriverHealthList)) {
-
- Link = GetFirstNode(&DriverHealthList);
- DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);
- RemoveEntryList (Link);
-
- if (DriverHealthInfo->MessageList != NULL) {
- FreePool(DriverHealthInfo->MessageList);
- FreePool (DriverHealthInfo);
- }
- }
-
- HiiFreeOpCodeHandle (StartOpCodeHandle);
- HiiFreeOpCodeHandle (EndOpCodeHandle);
- HiiFreeOpCodeHandle (StartOpCodeHandleRepair);
- HiiFreeOpCodeHandle (EndOpCodeHandleRepair);
-
- if (gCallbackKey == DRIVER_HEALTH_RETURN_KEY) {
- //
- // Force return to Driver Health Form
- //
- gCallbackKey = DEVICE_MANAGER_KEY_DRIVER_HEALTH;
- CallDriverHealth ();
- }
-}
-
-
-/**
- Check the Driver Health status of a single controller and try to process it if not healthy.
-
- This function called by CheckAllControllersHealthStatus () function in order to process a specify
- contoller's health state.
-
- @param DriverHealthList A Pointer to the list contain all of the platform driver health information.
- @param DriverHandle The handle of driver.
- @param ControllerHandle The class guid specifies which form set will be displayed.
- @param ChildHandle The handle of the child controller to retrieve the health
- status on. This is an optional parameter that may be NULL.
- @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.
- @param HealthStatus The health status of the controller.
-
- @retval EFI_INVALID_PARAMETER HealthStatus or DriverHealth is NULL.
- @retval HealthStatus The Health status of specify controller.
- @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.
- @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.
- @retval EFI_SUCCESS The Health related operation has been taken successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-GetSingleControllerHealthStatus (
- IN OUT LIST_ENTRY *DriverHealthList,
- IN EFI_HANDLE DriverHandle,
- IN EFI_HANDLE ControllerHandle, OPTIONAL
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,
- IN EFI_DRIVER_HEALTH_STATUS *HealthStatus
- )
-{
- EFI_STATUS Status;
- EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;
- EFI_HII_HANDLE FormHiiHandle;
- DRIVER_HEALTH_INFO *DriverHealthInfo;
-
- if (HealthStatus == NULL) {
- //
- // If HealthStatus is NULL, then return EFI_INVALID_PARAMETER
- //
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Assume the HealthStatus is healthy
- //
- *HealthStatus = EfiDriverHealthStatusHealthy;
-
- if (DriverHealth == NULL) {
- //
- // If DriverHealth is NULL, then return EFI_INVALID_PARAMETER
- //
- return EFI_INVALID_PARAMETER;
- }
-
- if (ControllerHandle == NULL) {
- //
- // If ControllerHandle is NULL, the return the cumulative health status of the driver
- //
- Status = DriverHealth->GetHealthStatus (DriverHealth, NULL, NULL, HealthStatus, NULL, NULL);
- if (*HealthStatus == EfiDriverHealthStatusHealthy) {
- //
- // Add the driver health related information into the list
- //
- DriverHealthInfo = AllocateZeroPool (sizeof (DRIVER_HEALTH_INFO));
- if (DriverHealthInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- DriverHealthInfo->Signature = DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE;
- DriverHealthInfo->DriverHandle = DriverHandle;
- DriverHealthInfo->ControllerHandle = NULL;
- DriverHealthInfo->ChildHandle = NULL;
- DriverHealthInfo->HiiHandle = NULL;
- DriverHealthInfo->DriverHealth = DriverHealth;
- DriverHealthInfo->MessageList = NULL;
- DriverHealthInfo->HealthStatus = *HealthStatus;
-
- InsertTailList (DriverHealthList, &DriverHealthInfo->Link);
- }
- return Status;
- }
-
- MessageList = NULL;
- FormHiiHandle = NULL;
-
- //
- // Collect the health status with the optional HII message list
- //
- Status = DriverHealth->GetHealthStatus (DriverHealth, ControllerHandle, ChildHandle, HealthStatus, &MessageList, &FormHiiHandle);
-
- if (EFI_ERROR (Status)) {
- //
- // If the health status could not be retrieved, then return immediately
- //
- return Status;
- }
-
- //
- // Add the driver health related information into the list
- //
- DriverHealthInfo = AllocateZeroPool (sizeof (DRIVER_HEALTH_INFO));
- if (DriverHealthInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- DriverHealthInfo->Signature = DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE;
- DriverHealthInfo->DriverHandle = DriverHandle;
- DriverHealthInfo->ControllerHandle = ControllerHandle;
- DriverHealthInfo->ChildHandle = ChildHandle;
- DriverHealthInfo->HiiHandle = FormHiiHandle;
- DriverHealthInfo->DriverHealth = DriverHealth;
- DriverHealthInfo->MessageList = MessageList;
- DriverHealthInfo->HealthStatus = *HealthStatus;
-
- InsertTailList (DriverHealthList, &DriverHealthInfo->Link);
-
- return EFI_SUCCESS;
-}
-
-/**
- Collects all the EFI Driver Health Protocols currently present in the EFI Handle Database,
- and queries each EFI Driver Health Protocol to determine if one or more of the controllers
- managed by each EFI Driver Health Protocol instance are not healthy.
-
- @param DriverHealthList A Pointer to the list contain all of the platform driver health
- information.
-
- @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.
- @retval EFI_SUCCESS All the controllers in the platform are healthy.
- @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.
-
-**/
-EFI_STATUS
-GetAllControllersHealthStatus (
- IN OUT LIST_ENTRY *DriverHealthList
- )
-{
- EFI_STATUS Status;
- UINTN NumHandles;
- EFI_HANDLE *DriverHealthHandles;
- EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;
- EFI_DRIVER_HEALTH_STATUS HealthStatus;
- UINTN DriverHealthIndex;
- EFI_HANDLE *Handles;
- UINTN HandleCount;
- UINTN ControllerIndex;
- UINTN ChildIndex;
-
- //
- // Initialize local variables
- //
- Handles = NULL;
- DriverHealthHandles = NULL;
- NumHandles = 0;
- HandleCount = 0;
-
- HealthStatus = EfiDriverHealthStatusHealthy;
-
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDriverHealthProtocolGuid,
- NULL,
- &NumHandles,
- &DriverHealthHandles
- );
-
- if (Status == EFI_NOT_FOUND || NumHandles == 0) {
- //
- // If there are no Driver Health Protocols handles, then return EFI_NOT_FOUND
- //
- return EFI_NOT_FOUND;
- }
-
- if (EFI_ERROR (Status) || DriverHealthHandles == NULL) {
- //
- // If the list of Driver Health Protocol handles can not be retrieved, then
- // return EFI_OUT_OF_RESOURCES
- //
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Check the health status of all controllers in the platform
- // Start by looping through all the Driver Health Protocol handles in the handle database
- //
- for (DriverHealthIndex = 0; DriverHealthIndex < NumHandles; DriverHealthIndex++) {
- //
- // Skip NULL Driver Health Protocol handles
- //
- if (DriverHealthHandles[DriverHealthIndex] == NULL) {
- continue;
- }
-
- //
- // Retrieve the Driver Health Protocol from DriverHandle
- //
- Status = gBS->HandleProtocol (
- DriverHealthHandles[DriverHealthIndex],
- &gEfiDriverHealthProtocolGuid,
- (VOID **)&DriverHealth
- );
- if (EFI_ERROR (Status)) {
- //
- // If the Driver Health Protocol can not be retrieved, then skip to the next
- // Driver Health Protocol handle
- //
- continue;
- }
-
- //
- // Check the health of all the controllers managed by a Driver Health Protocol handle
- //
- Status = GetSingleControllerHealthStatus (DriverHealthList, DriverHealthHandles[DriverHealthIndex], NULL, NULL, DriverHealth, &HealthStatus);
-
- //
- // If Status is an error code, then the health information could not be retrieved, so assume healthy
- // and skip to the next Driver Health Protocol handle
- //
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // If all the controllers managed by this Driver Health Protocol are healthy, then skip to the next
- // Driver Health Protocol handle
- //
- if (HealthStatus == EfiDriverHealthStatusHealthy) {
- continue;
- }
-
- //
- // See if the list of all handles in the handle database has been retrieved
- //
- //
- if (Handles == NULL) {
- //
- // Retrieve the list of all handles from the handle database
- //
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &Handles
- );
- if (EFI_ERROR (Status) || Handles == NULL) {
- //
- // If all the handles in the handle database can not be retrieved, then
- // return EFI_OUT_OF_RESOURCES
- //
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
- }
- //
- // Loop through all the controller handles in the handle database
- //
- for (ControllerIndex = 0; ControllerIndex < HandleCount; ControllerIndex++) {
- //
- // Skip NULL controller handles
- //
- if (Handles[ControllerIndex] == NULL) {
- continue;
- }
-
- Status = GetSingleControllerHealthStatus (DriverHealthList, DriverHealthHandles[DriverHealthIndex], Handles[ControllerIndex], NULL, DriverHealth, &HealthStatus);
- if (EFI_ERROR (Status)) {
- //
- // If Status is an error code, then the health information could not be retrieved, so assume healthy
- //
- HealthStatus = EfiDriverHealthStatusHealthy;
- }
-
- //
- // If CheckHealthSingleController() returned an error on a terminal state, then do not check the health of child controllers
- //
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Loop through all the child handles in the handle database
- //
- for (ChildIndex = 0; ChildIndex < HandleCount; ChildIndex++) {
- //
- // Skip NULL child handles
- //
- if (Handles[ChildIndex] == NULL) {
- continue;
- }
-
- Status = GetSingleControllerHealthStatus (DriverHealthList, DriverHealthHandles[DriverHealthIndex], Handles[ControllerIndex], Handles[ChildIndex], DriverHealth, &HealthStatus);
- if (EFI_ERROR (Status)) {
- //
- // If Status is an error code, then the health information could not be retrieved, so assume healthy
- //
- HealthStatus = EfiDriverHealthStatusHealthy;
- }
-
- //
- // If CheckHealthSingleController() returned an error on a terminal state, then skip to the next child
- //
- if (EFI_ERROR (Status)) {
- continue;
- }
- }
- }
- }
-
- Status = EFI_SUCCESS;
-
-Done:
- if (Handles != NULL) {
- gBS->FreePool (Handles);
- }
- if (DriverHealthHandles != NULL) {
- gBS->FreePool (DriverHealthHandles);
- }
-
- return Status;
-}
-
-
-/**
- Check the healthy status of the platform, this function will return immediately while found one driver
- in the platform are not healthy.
-
- @retval FALSE at least one driver in the platform are not healthy.
- @retval TRUE No controller install Driver Health Protocol,
- or all controllers in the platform are in healthy status.
-**/
-BOOLEAN
-PlaformHealthStatusCheck (
- VOID
- )
-{
- EFI_DRIVER_HEALTH_STATUS HealthStatus;
- EFI_STATUS Status;
- UINTN Index;
- UINTN NoHandles;
- EFI_HANDLE *DriverHealthHandles;
- EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;
- BOOLEAN AllHealthy;
-
- //
- // Initialize local variables
- //
- DriverHealthHandles = NULL;
- DriverHealth = NULL;
-
- HealthStatus = EfiDriverHealthStatusHealthy;
-
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDriverHealthProtocolGuid,
- NULL,
- &NoHandles,
- &DriverHealthHandles
- );
- //
- // There are no handles match the search for Driver Health Protocol has been installed.
- //
- if (Status == EFI_NOT_FOUND) {
- return TRUE;
- }
- //
- // Assume all modules are healthy.
- //
- AllHealthy = TRUE;
-
- //
- // Found one or more Handles.
- //
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < NoHandles; Index++) {
- Status = gBS->HandleProtocol (
- DriverHealthHandles[Index],
- &gEfiDriverHealthProtocolGuid,
- (VOID **) &DriverHealth
- );
- if (!EFI_ERROR (Status)) {
- Status = DriverHealth->GetHealthStatus (
- DriverHealth,
- NULL,
- NULL,
- &HealthStatus,
- NULL,
- NULL
- );
- }
- //
- // Get the healthy status of the module
- //
- if (!EFI_ERROR (Status)) {
- if (HealthStatus != EfiDriverHealthStatusHealthy) {
- //
- // Return immediately one driver's status not in healthy.
- //
- return FALSE;
- }
- }
- }
- }
- return AllHealthy;
-}
-
-/**
- Processes a single controller using the EFI Driver Health Protocol associated with
- that controller. This algorithm continues to query the GetHealthStatus() service until
- one of the legal terminal states of the EFI Driver Health Protocol is reached. This may
- require the processing of HII Messages, HII Form, and invocation of repair operations.
-
- @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.
- @param ControllerHandle The class guid specifies which form set will be displayed.
- @param ChildHandle The handle of the child controller to retrieve the health
- status on. This is an optional parameter that may be NULL.
- @param HealthStatus The health status of the controller.
- @param MessageList An array of warning or error messages associated
- with the controller specified by ControllerHandle and
- ChildHandle. This is an optional parameter that may be NULL.
- @param FormHiiHandle The HII handle for an HII form associated with the
- controller specified by ControllerHandle and ChildHandle.
- @param RebootRequired Indicate whether a reboot is required to repair the controller.
-**/
-VOID
-ProcessSingleControllerHealth (
- IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,
- IN EFI_HANDLE ControllerHandle, OPTIONAL
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN EFI_DRIVER_HEALTH_STATUS HealthStatus,
- IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList, OPTIONAL
- IN EFI_HII_HANDLE FormHiiHandle,
- IN OUT BOOLEAN *RebootRequired
- )
-{
- EFI_STATUS Status;
- EFI_DRIVER_HEALTH_STATUS LocalHealthStatus;
-
- LocalHealthStatus = HealthStatus;
- //
- // If the module need to be repaired or reconfiguration, will process it until
- // reach a terminal status. The status from EfiDriverHealthStatusRepairRequired after repair
- // will be in (Health, Failed, Configuration Required).
- //
- while(LocalHealthStatus == EfiDriverHealthStatusConfigurationRequired ||
- LocalHealthStatus == EfiDriverHealthStatusRepairRequired) {
-
- if (LocalHealthStatus == EfiDriverHealthStatusRepairRequired) {
- Status = DriverHealth->Repair (
- DriverHealth,
- ControllerHandle,
- ChildHandle,
- RepairNotify
- );
- }
- //
- // Via a form of the driver need to do configuration provided to process of status in
- // EfiDriverHealthStatusConfigurationRequired. The status after configuration should be in
- // (Healthy, Reboot Required, Failed, Reconnect Required, Repair Required).
- //
- if (LocalHealthStatus == EfiDriverHealthStatusConfigurationRequired) {
- if (FormHiiHandle != NULL) {
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &FormHiiHandle,
- 1,
- &gEfiHiiDriverHealthFormsetGuid,
- 0,
- NULL,
- NULL
- );
- ASSERT( !EFI_ERROR (Status));
- } else {
- //
- // Exit the loop in case no FormHiiHandle is supplied to prevent dead-loop
- //
- break;
- }
- }
-
- Status = DriverHealth->GetHealthStatus (
- DriverHealth,
- ControllerHandle,
- ChildHandle,
- &LocalHealthStatus,
- NULL,
- &FormHiiHandle
- );
- ASSERT_EFI_ERROR (Status);
-
- if (*MessageList != NULL) {
- ProcessMessages (*MessageList);
- }
- }
-
- //
- // Health status in {Healthy, Failed} may also have Messages need to process
- //
- if (LocalHealthStatus == EfiDriverHealthStatusHealthy || LocalHealthStatus == EfiDriverHealthStatusFailed) {
- if (*MessageList != NULL) {
- ProcessMessages (*MessageList);
- }
- }
- //
- // Check for RebootRequired or ReconnectRequired
- //
- if (LocalHealthStatus == EfiDriverHealthStatusRebootRequired) {
- *RebootRequired = TRUE;
- }
-
- //
- // Do reconnect if need.
- //
- if (LocalHealthStatus == EfiDriverHealthStatusReconnectRequired) {
- Status = gBS->DisconnectController (ControllerHandle, NULL, NULL);
- if (EFI_ERROR (Status)) {
- //
- // Disconnect failed. Need to promote reconnect to a reboot.
- //
- *RebootRequired = TRUE;
- } else {
- gBS->ConnectController (ControllerHandle, NULL, NULL, TRUE);
- }
- }
-}
-
-
-/**
- Reports the progress of a repair operation.
-
- @param[in] Value A value between 0 and Limit that identifies the current
- progress of the repair operation.
-
- @param[in] Limit The maximum value of Value for the current repair operation.
- For example, a driver that wants to specify progress in
- percent would use a Limit value of 100.
-
- @retval EFI_SUCCESS The progress of a repair operation is reported successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-RepairNotify (
- IN UINTN Value,
- IN UINTN Limit
- )
-{
- UINTN Percent;
-
- if (Limit == 0) {
- Print(L"Repair Progress Undefined\n\r");
- } else {
- Percent = Value * 100 / Limit;
- Print(L"Repair Progress = %3d%%\n\r", Percent);
- }
- return EFI_SUCCESS;
-}
-
-/**
- Processes a set of messages returned by the GetHealthStatus ()
- service of the EFI Driver Health Protocol
-
- @param MessageList The MessageList point to messages need to processed.
-
-**/
-VOID
-ProcessMessages (
- IN EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList
- )
-{
- UINTN MessageIndex;
- EFI_STRING MessageString;
-
- for (MessageIndex = 0;
- MessageList[MessageIndex].HiiHandle != NULL;
- MessageIndex++) {
-
- MessageString = HiiGetString (
- MessageList[MessageIndex].HiiHandle,
- MessageList[MessageIndex].StringId,
- NULL
- );
- if (MessageString != NULL) {
- //
- // User can customize the output. Just simply print out the MessageString like below.
- // Also can use the HiiHandle to display message on the front page.
- //
- // Print(L"%s\n",MessageString);
- // gBS->Stall (100000);
- }
- }
-
-}
-
-/**
- Repair the whole platform.
-
- This function is the main entry for user choose "Repair All" in the front page.
- It will try to do recovery job till all the driver health protocol installed modules
- reach a terminal state.
-
- @param DriverHealthList A Pointer to the list contain all of the platform driver health
- information.
-
-**/
-VOID
-PlatformRepairAll (
- IN LIST_ENTRY *DriverHealthList
- )
-{
- DRIVER_HEALTH_INFO *DriverHealthInfo;
- LIST_ENTRY *Link;
- BOOLEAN RebootRequired;
-
- ASSERT (DriverHealthList != NULL);
-
- RebootRequired = FALSE;
-
- for ( Link = GetFirstNode (DriverHealthList)
- ; !IsNull (DriverHealthList, Link)
- ; Link = GetNextNode (DriverHealthList, Link)
- ) {
- DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);
- //
- // Do driver health status operation by each link node
- //
- ASSERT (DriverHealthInfo != NULL);
-
- ProcessSingleControllerHealth (
- DriverHealthInfo->DriverHealth,
- DriverHealthInfo->ControllerHandle,
- DriverHealthInfo->ChildHandle,
- DriverHealthInfo->HealthStatus,
- &(DriverHealthInfo->MessageList),
- DriverHealthInfo->HiiHandle,
- &RebootRequired
- );
- }
-
- if (RebootRequired) {
- gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
- }
-}
-
-/**
-
- Select the best matching language according to front page policy for best user experience.
-
- This function supports both ISO 639-2 and RFC 4646 language codes, but language
- code types may not be mixed in a single call to this function.
-
- @param SupportedLanguages A pointer to a Null-terminated ASCII string that
- contains a set of language codes in the format
- specified by Iso639Language.
- @param Iso639Language If TRUE, then all language codes are assumed to be
- in ISO 639-2 format. If FALSE, then all language
- codes are assumed to be in RFC 4646 language format.
-
- @retval NULL The best matching language could not be found in SupportedLanguages.
- @retval NULL There are not enough resources available to return the best matching
- language.
- @retval Other A pointer to a Null-terminated ASCII string that is the best matching
- language in SupportedLanguages.
-**/
-CHAR8 *
-DriverHealthSelectBestLanguage (
- IN CHAR8 *SupportedLanguages,
- IN BOOLEAN Iso639Language
- )
-{
- CHAR8 *LanguageVariable;
- CHAR8 *BestLanguage;
-
- GetEfiGlobalVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", (VOID**)&LanguageVariable, NULL);
-
- BestLanguage = GetBestLanguage(
- SupportedLanguages,
- Iso639Language,
- (LanguageVariable != NULL) ? LanguageVariable : "",
- Iso639Language ? "eng" : "en-US",
- NULL
- );
- if (LanguageVariable != NULL) {
- FreePool (LanguageVariable);
- }
-
- return BestLanguage;
-}
-
-
-
-/**
-
- This is an internal worker function to get the Component Name (2) protocol interface
- and the language it supports.
-
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param ComponentName A pointer to the Component Name (2) protocol interface.
- @param SupportedLanguage The best suitable language that matches the SupportedLangues interface for the
- located Component Name (2) instance.
-
- @retval EFI_SUCCESS The Component Name (2) protocol instance is successfully located and we find
- the best matching language it support.
- @retval EFI_UNSUPPORTED The input Language is not supported by the Component Name (2) protocol.
- @retval Other Some error occurs when locating Component Name (2) protocol instance or finding
- the supported language.
-
-**/
-EFI_STATUS
-GetComponentNameWorker (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_HANDLE DriverBindingHandle,
- OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,
- OUT CHAR8 **SupportedLanguage
- )
-{
- EFI_STATUS Status;
-
- //
- // Locate Component Name (2) protocol on the driver binging handle.
- //
- Status = gBS->OpenProtocol (
- DriverBindingHandle,
- ProtocolGuid,
- (VOID **) ComponentName,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Apply shell policy to select the best language.
- //
- *SupportedLanguage = DriverHealthSelectBestLanguage (
- (*ComponentName)->SupportedLanguages,
- (BOOLEAN) (ProtocolGuid == &gEfiComponentNameProtocolGuid)
- );
- if (*SupportedLanguage == NULL) {
- Status = EFI_UNSUPPORTED;
- }
-
- return Status;
-}
-
-/**
-
- This is an internal worker function to get driver name from Component Name (2) protocol interface.
-
-
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param DriverName A pointer to the Unicode string to return. This Unicode string is the name
- of the driver specified by This.
-
- @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The driver name cannot be retrieved from Component Name (2) protocol
- interface.
-
-**/
-EFI_STATUS
-GetDriverNameWorker (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_HANDLE DriverBindingHandle,
- OUT CHAR16 **DriverName
- )
-{
- EFI_STATUS Status;
- CHAR8 *BestLanguage;
- EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
-
- //
- // Retrieve Component Name (2) protocol instance on the driver binding handle and
- // find the best language this instance supports.
- //
- Status = GetComponentNameWorker (
- ProtocolGuid,
- DriverBindingHandle,
- &ComponentName,
- &BestLanguage
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the driver name from Component Name (2) protocol instance on the driver binging handle.
- //
- Status = ComponentName->GetDriverName (
- ComponentName,
- BestLanguage,
- DriverName
- );
- FreePool (BestLanguage);
-
- return Status;
-}
-
-/**
-
- This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.
- If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward
- compatibility support.
-
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param DriverName A pointer to the Unicode string to return. This Unicode string is the name
- of the driver specified by This.
-
- @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The driver name cannot be retrieved from Component Name (2) protocol
- interface.
-
-**/
-EFI_STATUS
-DriverHealthGetDriverName (
- IN EFI_HANDLE DriverBindingHandle,
- OUT CHAR16 **DriverName
- )
-{
- EFI_STATUS Status;
-
- //
- // Get driver name from UEFI 2.0 Component Name 2 protocol interface.
- //
- Status = GetDriverNameWorker (&gEfiComponentName2ProtocolGuid, DriverBindingHandle, DriverName);
- if (EFI_ERROR (Status)) {
- //
- // If it fails to get the driver name from Component Name protocol interface, we should fall back on
- // EFI 1.1 Component Name protocol interface.
- //
- Status = GetDriverNameWorker (&gEfiComponentNameProtocolGuid, DriverBindingHandle, DriverName);
- }
-
- return Status;
-}
-
-
-
-/**
- This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.
- If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward
- compatibility support.
-
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param ControllerHandle The handle of a controller that the driver specified by This is managing.
- This handle specifies the controller whose name is to be returned.
- @param ChildHandle The handle of the child controller to retrieve the name of. This is an
- optional parameter that may be NULL. It will be NULL for device drivers.
- It will also be NULL for bus drivers that attempt to retrieve the name
- of the bus controller. It will not be NULL for a bus driver that attempts
- to retrieve the name of a child controller.
- @param ControllerName A pointer to the Unicode string to return. This Unicode string
- is the name of the controller specified by ControllerHandle and ChildHandle.
-
- @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The controller name cannot be retrieved from Component Name (2) protocol.
-
-**/
-EFI_STATUS
-GetControllerNameWorker (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_HANDLE DriverBindingHandle,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_STATUS Status;
- CHAR8 *BestLanguage;
- EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
-
- //
- // Retrieve Component Name (2) protocol instance on the driver binding handle and
- // find the best language this instance supports.
- //
- Status = GetComponentNameWorker (
- ProtocolGuid,
- DriverBindingHandle,
- &ComponentName,
- &BestLanguage
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the controller name from Component Name (2) protocol instance on the driver binging handle.
- //
- Status = ComponentName->GetControllerName (
- ComponentName,
- ControllerHandle,
- ChildHandle,
- BestLanguage,
- ControllerName
- );
- FreePool (BestLanguage);
-
- return Status;
-}
-
-/**
-
- This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.
- If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward
- compatibility support.
-
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param ControllerHandle The handle of a controller that the driver specified by This is managing.
- This handle specifies the controller whose name is to be returned.
- @param ChildHandle The handle of the child controller to retrieve the name of. This is an
- optional parameter that may be NULL. It will be NULL for device drivers.
- It will also be NULL for bus drivers that attempt to retrieve the name
- of the bus controller. It will not be NULL for a bus driver that attempts
- to retrieve the name of a child controller.
- @param ControllerName A pointer to the Unicode string to return. This Unicode string
- is the name of the controller specified by ControllerHandle and ChildHandle.
-
- @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The controller name cannot be retrieved from Component Name (2) protocol.
-
-**/
-EFI_STATUS
-DriverHealthGetControllerName (
- IN EFI_HANDLE DriverBindingHandle,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_STATUS Status;
-
- //
- // Get controller name from UEFI 2.0 Component Name 2 protocol interface.
- //
- Status = GetControllerNameWorker (
- &gEfiComponentName2ProtocolGuid,
- DriverBindingHandle,
- ControllerHandle,
- ChildHandle,
- ControllerName
- );
- if (EFI_ERROR (Status)) {
- //
- // If it fails to get the controller name from Component Name protocol interface, we should fall back on
- // EFI 1.1 Component Name protocol interface.
- //
- Status = GetControllerNameWorker (
- &gEfiComponentNameProtocolGuid,
- DriverBindingHandle,
- ControllerHandle,
- ChildHandle,
- ControllerName
- );
- }
-
- return Status;
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
deleted file mode 100644
index 95bde8de5a..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
+++ /dev/null
@@ -1,523 +0,0 @@
-/** @file
- The platform device manager reference implement
-
-Copyright (c) 2004 - 2013, 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.
-
-**/
-
-#ifndef _DEVICE_MANAGER_H_
-#define _DEVICE_MANAGER_H_
-
-#include "Bds.h"
-#include "FrontPage.h"
-#include "DeviceManagerVfr.h"
-#include <Protocol/PciIo.h>
-
-#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')
-#define DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE SIGNATURE_32 ('D', 'M', 'D', 'H')
-
-
-typedef struct {
- UINTN Signature;
-
- ///
- /// Device Manager HII relative handles
- ///
- EFI_HII_HANDLE HiiHandle;
-
- ///
- /// Driver Health HII relative handles
- ///
- EFI_HII_HANDLE DriverHealthHiiHandle;
-
- EFI_HANDLE DriverHandle;
- EFI_HANDLE DriverHealthHandle;
-
- ///
- /// Device Manager Produced protocols
- ///
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
-
- ///
- /// Driver Health Produced protocols
- ///
- EFI_HII_CONFIG_ACCESS_PROTOCOL DriverHealthConfigAccess;
-
- ///
- /// Configuration data
- ///
- UINT8 VideoBios;
-} DEVICE_MANAGER_CALLBACK_DATA;
-
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- ///
- /// HII relative handles
- ///
- EFI_HII_HANDLE HiiHandle;
-
- ///
- /// Driver relative handles
- ///
- EFI_HANDLE DriverHandle;
- EFI_HANDLE ControllerHandle;
- EFI_HANDLE ChildHandle;
-
- EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;
- ///
- /// Driver health messages of the specify Driver
- ///
- EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;
-
- ///
- /// Driver Health status
- ///
- EFI_DRIVER_HEALTH_STATUS HealthStatus;
-} DRIVER_HEALTH_INFO;
-
-typedef struct {
- EFI_STRING_ID PromptId;
- EFI_QUESTION_ID QuestionId;
-}MENU_INFO_ITEM;
-
-typedef struct {
- UINTN CurListLen;
- UINTN MaxListLen;
- MENU_INFO_ITEM *NodeList;
-} MAC_ADDRESS_NODE_LIST;
-
-#define DEVICE_MANAGER_HEALTH_INFO_FROM_LINK(a) \
- CR (a, \
- DRIVER_HEALTH_INFO, \
- Link, \
- DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE \
- )
-
-#define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \
- CR (a, \
- DEVICE_MANAGER_CALLBACK_DATA, \
- ConfigAccess, \
- DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \
- )
-typedef struct {
- EFI_STRING_ID StringId;
- UINT16 Class;
-} DEVICE_MANAGER_MENU_ITEM;
-
-/**
- This function is invoked if user selected a interactive opcode from Device Manager's
- Formset. The decision by user is saved to gCallbackKey for later processing. If
- user set VBIOS, the new value is saved to EFI variable.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceManagerCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- );
-
-/**
- This function is invoked if user selected a interactive opcode from Driver Health's
- Formset. The decision by user is saved to gCallbackKey for later processing.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
-
-**/
-EFI_STATUS
-EFIAPI
-DriverHealthCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- );
-
-
-/**
-
- This function registers HII packages to HII database.
-
- @retval EFI_SUCCESS HII packages for the Device Manager were registered successfully.
- @retval EFI_OUT_OF_RESOURCES HII packages for the Device Manager failed to be registered.
-
-**/
-EFI_STATUS
-InitializeDeviceManager (
- VOID
- );
-
-/**
-
- Call the browser and display the device manager to allow user
- to configure the platform.
-
- This function create the dynamic content for device manager. It includes
- section header for all class of devices, one-of opcode to set VBIOS.
-
- @retval EFI_SUCCESS Operation is successful.
- @retval Other values if failed to clean up the dynamic content from HII
- database.
-
-**/
-EFI_STATUS
-CallDeviceManager (
- VOID
- );
-
-
-/**
- Check the Driver Health status of a single controller and try to process it if not healthy.
-
- This function called by CheckAllControllersHealthStatus () function in order to process a specify
- contoller's health state.
-
- @param DriverHealthList A Pointer to the list contain all of the platform driver health information.
- @param DriverHandle The handle of driver.
- @param ControllerHandle The class guid specifies which form set will be displayed.
- @param ChildHandle The handle of the child controller to retrieve the health
- status on. This is an optional parameter that may be NULL.
- @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.
- @param HealthStatus The health status of the controller.
-
- @retval EFI_INVALID_PARAMETER HealthStatus or DriverHealth is NULL.
- @retval HealthStatus The Health status of specify controller.
- @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.
- @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.
- @retval EFI_SUCCESS The Health related operation has been taken successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-GetSingleControllerHealthStatus (
- IN OUT LIST_ENTRY *DriverHealthList,
- IN EFI_HANDLE DriverHandle,
- IN EFI_HANDLE ControllerHandle, OPTIONAL
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,
- IN EFI_DRIVER_HEALTH_STATUS *HealthStatus
- );
-
-/**
- Collects all the EFI Driver Health Protocols currently present in the EFI Handle Database,
- and queries each EFI Driver Health Protocol to determine if one or more of the controllers
- managed by each EFI Driver Health Protocol instance are not healthy.
-
- @param DriverHealthList A Pointer to the list contain all of the platform driver health
- information.
-
- @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.
- @retval EFI_SUCCESS All the controllers in the platform are healthy.
- @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.
-
-**/
-EFI_STATUS
-GetAllControllersHealthStatus (
- IN OUT LIST_ENTRY *DriverHealthList
- );
-
-/**
- Check the healthy status of the platform, this function will return immediately while found one driver
- in the platform are not healthy.
-
- @retval FALSE at least one driver in the platform are not healthy.
- @retval TRUE No controller install Driver Health Protocol,
- or all controllers in the platform are in healthy status.
-**/
-BOOLEAN
-PlaformHealthStatusCheck (
- VOID
- );
-
-/**
- Repair the whole platform.
-
- This function is the main entry for user choose "Repair All" in the front page.
- It will try to do recovery job till all the driver health protocol installed modules
- reach a terminal state.
-
- @param DriverHealthList A Pointer to the list contain all of the platform driver health
- information.
-
-**/
-VOID
-PlatformRepairAll (
- IN LIST_ENTRY *DriverHealthList
- );
-
-/**
- Processes a single controller using the EFI Driver Health Protocol associated with
- that controller. This algorithm continues to query the GetHealthStatus() service until
- one of the legal terminal states of the EFI Driver Health Protocol is reached. This may
- require the processing of HII Messages, HII Form, and invocation of repair operations.
-
- @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.
- @param ControllerHandle The class guid specifies which form set will be displayed.
- @param ChildHandle The handle of the child controller to retrieve the health
- status on. This is an optional parameter that may be NULL.
- @param HealthStatus The health status of the controller.
- @param MessageList An array of warning or error messages associated
- with the controller specified by ControllerHandle and
- ChildHandle. This is an optional parameter that may be NULL.
- @param FormHiiHandle The HII handle for an HII form associated with the
- controller specified by ControllerHandle and ChildHandle.
- @param RebootRequired Indicate whether a reboot is required to repair the controller.
-**/
-VOID
-ProcessSingleControllerHealth (
- IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,
- IN EFI_HANDLE ControllerHandle, OPTIONAL
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN EFI_DRIVER_HEALTH_STATUS HealthStatus,
- IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList, OPTIONAL
- IN EFI_HII_HANDLE FormHiiHandle,
- IN OUT BOOLEAN *RebootRequired
- );
-
-/**
- Reports the progress of a repair operation.
-
- @param[in] Value A value between 0 and Limit that identifies the current
- progress of the repair operation.
-
- @param[in] Limit The maximum value of Value for the current repair operation.
- For example, a driver that wants to specify progress in
- percent would use a Limit value of 100.
-
- @retval EFI_SUCCESS The progress of a repair operation is reported successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-RepairNotify (
- IN UINTN Value,
- IN UINTN Limit
- );
-
-/**
- Processes a set of messages returned by the GetHealthStatus ()
- service of the EFI Driver Health Protocol
-
- @param MessageList The MessageList point to messages need to processed.
-
-**/
-VOID
-ProcessMessages (
- IN EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList
- );
-
-
-/**
- Collect and display the platform's driver health relative information, allow user to do interactive
- operation while the platform is unhealthy.
-
- This function display a form which divided into two parts. The one list all modules which has installed
- driver health protocol. The list usually contain driver name, controller name, and it's health info.
- While the driver name can't be retrieved, will use device path as backup. The other part of the form provide
- a choice to the user to repair all platform.
-
-**/
-VOID
-CallDriverHealth (
- VOID
- );
-
-/**
-
- Select the best matching language according to front page policy for best user experience.
-
- This function supports both ISO 639-2 and RFC 4646 language codes, but language
- code types may not be mixed in a single call to this function.
-
- @param SupportedLanguages A pointer to a Null-terminated ASCII string that
- contains a set of language codes in the format
- specified by Iso639Language.
- @param Iso639Language If TRUE, then all language codes are assumed to be
- in ISO 639-2 format. If FALSE, then all language
- codes are assumed to be in RFC 4646 language format.
-
- @retval NULL The best matching language could not be found in SupportedLanguages.
- @retval NULL There are not enough resources available to return the best matching
- language.
- @retval Other A pointer to a Null-terminated ASCII string that is the best matching
- language in SupportedLanguages.
-**/
-CHAR8 *
-DriverHealthSelectBestLanguage (
- IN CHAR8 *SupportedLanguages,
- IN BOOLEAN Iso639Language
- );
-
-/**
-
- This is an internal worker function to get the Component Name (2) protocol interface
- and the language it supports.
-
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param ComponentName A pointer to the Component Name (2) protocol interface.
- @param SupportedLanguage The best suitable language that matches the SupportedLangues interface for the
- located Component Name (2) instance.
-
- @retval EFI_SUCCESS The Component Name (2) protocol instance is successfully located and we find
- the best matching language it support.
- @retval EFI_UNSUPPORTED The input Language is not supported by the Component Name (2) protocol.
- @retval Other Some error occurs when locating Component Name (2) protocol instance or finding
- the supported language.
-
-**/
-EFI_STATUS
-GetComponentNameWorker (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_HANDLE DriverBindingHandle,
- OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,
- OUT CHAR8 **SupportedLanguage
- );
-
-/**
-
- This is an internal worker function to get driver name from Component Name (2) protocol interface.
-
-
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param DriverName A pointer to the Unicode string to return. This Unicode string is the name
- of the driver specified by This.
-
- @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The driver name cannot be retrieved from Component Name (2) protocol
- interface.
-
-**/
-EFI_STATUS
-GetDriverNameWorker (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_HANDLE DriverBindingHandle,
- OUT CHAR16 **DriverName
- );
-
-/**
-
- This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.
- If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward
- compatibility support.
-
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param DriverName A pointer to the Unicode string to return. This Unicode string is the name
- of the driver specified by This.
-
- @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The driver name cannot be retrieved from Component Name (2) protocol
- interface.
-
-**/
-EFI_STATUS
-DriverHealthGetDriverName (
- IN EFI_HANDLE DriverBindingHandle,
- OUT CHAR16 **DriverName
- );
-
-/**
- This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.
- If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward
- compatibility support.
-
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param ControllerHandle The handle of a controller that the driver specified by This is managing.
- This handle specifies the controller whose name is to be returned.
- @param ChildHandle The handle of the child controller to retrieve the name of. This is an
- optional parameter that may be NULL. It will be NULL for device drivers.
- It will also be NULL for bus drivers that attempt to retrieve the name
- of the bus controller. It will not be NULL for a bus driver that attempts
- to retrieve the name of a child controller.
- @param ControllerName A pointer to the Unicode string to return. This Unicode string
- is the name of the controller specified by ControllerHandle and ChildHandle.
-
- @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The controller name cannot be retrieved from Component Name (2) protocol.
-
-**/
-EFI_STATUS
-GetControllerNameWorker (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_HANDLE DriverBindingHandle,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle,
- OUT CHAR16 **ControllerName
- );
-
-/**
- This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.
- If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward
- compatibility support.
-
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.
- @param ControllerHandle The handle of a controller that the driver specified by This is managing.
- This handle specifies the controller whose name is to be returned.
- @param ChildHandle The handle of the child controller to retrieve the name of. This is an
- optional parameter that may be NULL. It will be NULL for device drivers.
- It will also be NULL for bus drivers that attempt to retrieve the name
- of the bus controller. It will not be NULL for a bus driver that attempts
- to retrieve the name of a child controller.
- @param ControllerName A pointer to the Unicode string to return. This Unicode string
- is the name of the controller specified by ControllerHandle and ChildHandle.
-
- @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol
- interface.
- @retval Other The controller name cannot be retrieved from Component Name (2) protocol.
-
-**/
-EFI_STATUS
-DriverHealthGetControllerName (
- IN EFI_HANDLE DriverBindingHandle,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni
deleted file mode 100644
index 1553f10bf9..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni
+++ /dev/null
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr
deleted file mode 100644
index 0ad671bdca..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr
+++ /dev/null
@@ -1,93 +0,0 @@
-///** @file
-//
-// Device Manager formset.
-//
-// Copyright (c) 2004 - 2011, 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.
-//
-//**/
-
-#include "DeviceManagerVfr.h"
-
-#define EFI_DISK_DEVICE_CLASS 0x0001
-#define EFI_VIDEO_DEVICE_CLASS 0x0002
-#define EFI_NETWORK_DEVICE_CLASS 0x0004
-#define EFI_INPUT_DEVICE_CLASS 0x0008
-#define EFI_ON_BOARD_DEVICE_CLASS 0x0010
-#define EFI_OTHER_DEVICE_CLASS 0x0020
-
-#define DEVICE_MANAGER_CLASS 0x0000
-#define FRONT_PAGE_SUBCLASS 0x0003
-
-formset
- guid = DEVICE_MANAGER_FORMSET_GUID,
- title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),
- help = STRING_TOKEN(STR_EMPTY_STRING),
- classguid = DEVICE_MANAGER_FORMSET_GUID,
-
- form formid = DEVICE_MANAGER_FORM_ID,
- title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);
-
- subtitle text = STRING_TOKEN(STR_DEVICES_LIST);
- //
- // This is where devices get added to the device manager hierarchy
- //
- label EFI_DISK_DEVICE_CLASS;
-// label LABEL_END; // Since next opcode is a label, so this one could be omitted to save code size
-
- label EFI_VIDEO_DEVICE_CLASS;
-// label LABEL_END;
-
- label EFI_NETWORK_DEVICE_CLASS;
-// label LABEL_END;
-
- label EFI_INPUT_DEVICE_CLASS;
-// label LABEL_END;
-
- label EFI_ON_BOARD_DEVICE_CLASS;
-// label LABEL_END;
-
-// label EFI_OTHER_DEVICE_CLASS;
-
- label LABEL_DEVICES_LIST;
- label LABEL_END;
-
- subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
-
- label LABEL_VBIOS;
- label LABEL_END;
-
- subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
- subtitle text = STRING_TOKEN(STR_EXIT_STRING);
-
- endform;
-
- form formid = NETWORK_DEVICE_LIST_FORM_ID,
- title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_LIST_TITLE);
-
- subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_LIST_STRING);
-
- label LABEL_NETWORK_DEVICE_LIST_ID;
- label LABEL_END;
- subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
- subtitle text = STRING_TOKEN(STR_EXIT_STRING);
- endform;
-
- form formid = NETWORK_DEVICE_FORM_ID,
- title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_TITLE);
-
- subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_STRING);
-
- label LABEL_NETWORK_DEVICE_ID;
- label LABEL_END;
- subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
- subtitle text = STRING_TOKEN(STR_EXIT_STRING);
- endform;
-endformset;
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.h b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.h
deleted file mode 100644
index b6b086600f..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- The platform device manager reference implement
-
-Copyright (c) 2011, 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.
-
-**/
-
-#ifndef _DEVICE_MANAGER_VFR_H_
-#define _DEVICE_MANAGER_VFR_H_
-
-#include <Guid/BdsHii.h>
-
-#define LABEL_DEVICES_LIST 0x1100
-#define LABEL_NETWORK_DEVICE_LIST_ID 0x1101
-#define LABEL_NETWORK_DEVICE_ID 0x1102
-#define LABEL_END 0xffff
-#define LABEL_FORM_ID_OFFSET 0x0100
-
-#define LABEL_DRIVER_HEALTH 0x2000
-#define LABEL_DRIVER_HEALTH_END 0x2001
-
-#define LABEL_DRIVER_HEALTH_REAPIR_ALL 0x3000
-#define LABEL_DRIVER_HEALTH_REAPIR_ALL_END 0x3001
-
-#define LABEL_VBIOS 0x0040
-
-#define INVALID_FORM_ID 0x0FFF
-#define DEVICE_MANAGER_FORM_ID 0x1000
-#define NETWORK_DEVICE_LIST_FORM_ID 0x1001
-#define NETWORK_DEVICE_FORM_ID 0x1002
-#define DRIVER_HEALTH_FORM_ID 0x1003
-#define DEVICE_KEY_OFFSET 0x4000
-#define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000
-#define DEVICE_MANAGER_KEY_VBIOS 0x3000
-#define MAX_KEY_SECTION_LEN 0x1000
-
-#define DEVICE_MANAGER_KEY_DRIVER_HEALTH 0x1111
-#define DRIVER_HEALTH_KEY_OFFSET 0x2000
-#define DRIVER_HEALTH_REPAIR_ALL_KEY 0x3000
-#define DRIVER_HEALTH_RETURN_KEY 0x4000
-
-#define QUESTION_NETWORK_DEVICE_ID 0x3FFF
-//
-// These are the VFR compiler generated data representing our VFR data.
-//
-extern UINT8 DeviceManagerVfrBin[];
-extern UINT8 DriverHealthVfrBin[];
-
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DriverHealthVfr.Vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DriverHealthVfr.Vfr
deleted file mode 100644
index cb1a8f887b..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DriverHealthVfr.Vfr
+++ /dev/null
@@ -1,38 +0,0 @@
-///** @file
-//
-// Driver Health formset.
-//
-// Copyright (c) 2004 - 2011, 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.
-//
-//**/
-
-#include "DeviceManagerVfr.h"
-
-formset
- guid = DRIVER_HEALTH_FORMSET_GUID,
- title = STRING_TOKEN(STR_DH_BANNER),
- help = STRING_TOKEN(STR_EMPTY_STRING),
- classguid = DRIVER_HEALTH_FORMSET_GUID,
-
- form formid = DRIVER_HEALTH_FORM_ID,
- title = STRING_TOKEN(STR_DH_BANNER);
-
- label LABEL_DRIVER_HEALTH;
- label LABEL_DRIVER_HEALTH_END;
-
- subtitle text = STRING_TOKEN(STR_LAST_STRING);
- label LABEL_DRIVER_HEALTH_REAPIR_ALL;
- label LABEL_DRIVER_HEALTH_REAPIR_ALL_END;
-
- subtitle text = STRING_TOKEN(STR_LAST_STRING);
- subtitle text = STRING_TOKEN(STR_HELP_FOOTER);
- subtitle text = STRING_TOKEN(STR_LAST_STRING);
- endform;
-endformset;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
deleted file mode 100644
index 14a7ae29f4..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ /dev/null
@@ -1,1472 +0,0 @@
-/** @file
- FrontPage routines to handle the callbacks and browser calls
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "Bds.h"
-#include "FrontPage.h"
-#include "Language.h"
-#include "Hotkey.h"
-
-BOOLEAN mModeInitialized = FALSE;
-
-BOOLEAN gConnectAllHappened = FALSE;
-UINTN gCallbackKey;
-CHAR8 *mLanguageString;
-
-//
-// Boot video resolution and text mode.
-//
-UINT32 mBootHorizontalResolution = 0;
-UINT32 mBootVerticalResolution = 0;
-UINT32 mBootTextModeColumn = 0;
-UINT32 mBootTextModeRow = 0;
-//
-// BIOS setup video resolution and text mode.
-//
-UINT32 mSetupTextModeColumn = 0;
-UINT32 mSetupTextModeRow = 0;
-UINT32 mSetupHorizontalResolution = 0;
-UINT32 mSetupVerticalResolution = 0;
-
-EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
-
-FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate = {
- FRONT_PAGE_CALLBACK_DATA_SIGNATURE,
- NULL,
- NULL,
- NULL,
- {
- FakeExtractConfig,
- FakeRouteConfig,
- FrontPageCallback
- }
-};
-
-HII_VENDOR_DEVICE_PATH mFrontPageHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- FRONT_PAGE_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-/**
- This function allows a caller to extract the current configuration for one
- or more named elements from the target driver.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Request A null-terminated Unicode string in <ConfigRequest> format.
- @param Progress On return, points to a character in the Request string.
- Points to the string's null terminator if request was successful.
- Points to the most recent '&' before the first failing name/value
- pair (or the beginning of the string if the failure is in the
- first name/value pair) if the request was not successful.
- @param Results A null-terminated Unicode string in <ConfigAltResp> format which
- has all values filled in for the names in the Request string.
- String to be allocated by the called function.
-
- @retval EFI_SUCCESS The Results is filled with the requested values.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
-
-**/
-EFI_STATUS
-EFIAPI
-FakeExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Request;
- return EFI_NOT_FOUND;
-}
-
-/**
- This function processes the results of changes in configuration.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Configuration A null-terminated Unicode string in <ConfigResp> format.
- @param Progress A pointer to a string filled in with the offset of the most
- recent '&' before the first failing name/value pair (or the
- beginning of the string if the failure is in the first
- name/value pair) or the terminating NULL if all was successful.
-
- @retval EFI_SUCCESS The Results is processed successfully.
- @retval EFI_INVALID_PARAMETER Configuration is NULL.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
-
-**/
-EFI_STATUS
-EFIAPI
-FakeRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- if (Configuration == NULL || Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Progress = Configuration;
- if (!HiiIsConfigHdrMatch (Configuration, &gBootMaintFormSetGuid, mBootMaintStorageName)
- && !HiiIsConfigHdrMatch (Configuration, &gFileExploreFormSetGuid, mFileExplorerStorageName)) {
- return EFI_NOT_FOUND;
- }
-
- *Progress = Configuration + StrLen (Configuration);
- return EFI_SUCCESS;
-}
-
-/**
- This function processes the results of changes in configuration.
-
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original exporting driver.
- @param ActionRequest On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
-
-**/
-EFI_STATUS
-EFIAPI
-FrontPageCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- )
-{
- CHAR8 *LangCode;
- CHAR8 *Lang;
- UINTN Index;
-
- if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
- }
-
- gCallbackKey = QuestionId;
-
- if (Action == EFI_BROWSER_ACTION_CHANGED) {
- if ((Value == NULL) || (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (QuestionId) {
- case FRONT_PAGE_KEY_CONTINUE:
- //
- // This is the continue - clear the screen and return an error to get out of FrontPage loop
- //
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- break;
-
- case FRONT_PAGE_KEY_LANGUAGE:
- //
- // Allocate working buffer for RFC 4646 language in supported LanguageString.
- //
- Lang = AllocatePool (AsciiStrSize (mLanguageString));
- ASSERT (Lang != NULL);
-
- Index = 0;
- LangCode = mLanguageString;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
-
- if (Index == Value->u8) {
- break;
- }
-
- Index++;
- }
-
- if (Index == Value->u8) {
- BdsDxeSetVariableAndReportStatusCodeOnError (
- L"PlatformLang",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrSize (Lang),
- Lang
- );
- } else {
- ASSERT (FALSE);
- }
-
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
-
- FreePool (Lang);
- break;
-
- default:
- break;
- }
- } else if (Action == EFI_BROWSER_ACTION_CHANGING) {
- if (Value == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
- // describe to their customers in documentation how to find their setup information (namely
- // under the device manager and specific buckets)
- //
- switch (QuestionId) {
- case FRONT_PAGE_KEY_BOOT_MANAGER:
- //
- // Boot Manager
- //
- break;
-
- case FRONT_PAGE_KEY_DEVICE_MANAGER:
- //
- // Device Manager
- //
- break;
-
- case FRONT_PAGE_KEY_BOOT_MAINTAIN:
- //
- // Boot Maintenance Manager
- //
- break;
-
- default:
- gCallbackKey = 0;
- break;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Initialize HII information for the FrontPage
-
-
- @param InitializeHiiData TRUE if HII elements need to be initialized.
-
- @retval EFI_SUCCESS The operation is successful.
- @retval EFI_DEVICE_ERROR If the dynamic opcode creation failed.
-
-**/
-EFI_STATUS
-InitializeFrontPage (
- IN BOOLEAN InitializeHiiData
- )
-{
- EFI_STATUS Status;
- CHAR8 *LangCode;
- CHAR8 *Lang;
- CHAR8 *CurrentLang;
- UINTN OptionCount;
- CHAR16 *StringBuffer;
- EFI_HII_HANDLE HiiHandle;
- VOID *OptionsOpCodeHandle;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *EndLabel;
- EFI_HII_STRING_PROTOCOL *HiiString;
- UINTN StringSize;
-
- Lang = NULL;
- StringBuffer = NULL;
-
- if (InitializeHiiData) {
- //
- // Initialize the Device Manager
- //
- InitializeDeviceManager ();
-
- //
- // Initialize the Device Manager
- //
- InitializeBootManager ();
-
- gCallbackKey = 0;
-
- //
- // Locate Hii relative protocols
- //
- Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &gFormBrowser2);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Install Device Path Protocol and Config Access protocol to driver handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &gFrontPagePrivate.DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mFrontPageHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &gFrontPagePrivate.ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Publish our HII data
- //
- gFrontPagePrivate.HiiHandle = HiiAddPackages (
- &gFrontPageFormSetGuid,
- gFrontPagePrivate.DriverHandle,
- FrontPageVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (gFrontPagePrivate.HiiHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
-
-
- //
- // Init OpCode Handle and Allocate space for creation of UpdateData Buffer
- //
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandle != NULL);
-
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandle != NULL);
-
- OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (OptionsOpCodeHandle != NULL);
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = LABEL_SELECT_LANGUAGE;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = LABEL_END;
-
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- HiiHandle = gFrontPagePrivate.HiiHandle;
-
- GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
-
- //
- // Get Support language list from variable.
- //
- if (mLanguageString == NULL){
- GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&mLanguageString, NULL);
- if (mLanguageString == NULL) {
- mLanguageString = AllocateCopyPool (
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
- (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
- );
- ASSERT (mLanguageString != NULL);
- }
- }
-
- if (gFrontPagePrivate.LanguageToken == NULL) {
- //
- // Count the language list number.
- //
- LangCode = mLanguageString;
- Lang = AllocatePool (AsciiStrSize (mLanguageString));
- ASSERT (Lang != NULL);
- OptionCount = 0;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
- OptionCount ++;
- }
-
- //
- // Allocate extra 1 as the end tag.
- //
- gFrontPagePrivate.LanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
- ASSERT (gFrontPagePrivate.LanguageToken != NULL);
-
- Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
- ASSERT_EFI_ERROR (Status);
-
- LangCode = mLanguageString;
- OptionCount = 0;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
-
- StringSize = 0;
- Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- StringBuffer = AllocateZeroPool (StringSize);
- ASSERT (StringBuffer != NULL);
- Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
- ASSERT_EFI_ERROR (Status);
- }
-
- if (EFI_ERROR (Status)) {
- StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));
- ASSERT (StringBuffer != NULL);
- AsciiStrToUnicodeStr (Lang, StringBuffer);
- }
-
- ASSERT (StringBuffer != NULL);
- gFrontPagePrivate.LanguageToken[OptionCount] = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
- FreePool (StringBuffer);
-
- OptionCount++;
- }
- }
-
- ASSERT (gFrontPagePrivate.LanguageToken != NULL);
- LangCode = mLanguageString;
- OptionCount = 0;
- if (Lang == NULL) {
- Lang = AllocatePool (AsciiStrSize (mLanguageString));
- ASSERT (Lang != NULL);
- }
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
-
- if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- gFrontPagePrivate.LanguageToken[OptionCount],
- EFI_IFR_OPTION_DEFAULT,
- EFI_IFR_NUMERIC_SIZE_1,
- (UINT8) OptionCount
- );
- } else {
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- gFrontPagePrivate.LanguageToken[OptionCount],
- 0,
- EFI_IFR_NUMERIC_SIZE_1,
- (UINT8) OptionCount
- );
- }
-
- OptionCount++;
- }
-
- if (CurrentLang != NULL) {
- FreePool (CurrentLang);
- }
- FreePool (Lang);
-
- HiiCreateOneOfOpCode (
- StartOpCodeHandle,
- FRONT_PAGE_KEY_LANGUAGE,
- 0,
- 0,
- STRING_TOKEN (STR_LANGUAGE_SELECT),
- STRING_TOKEN (STR_LANGUAGE_SELECT_HELP),
- EFI_IFR_FLAG_CALLBACK,
- EFI_IFR_NUMERIC_SIZE_1,
- OptionsOpCodeHandle,
- NULL
- );
-
- Status = HiiUpdateForm (
- HiiHandle,
- &gFrontPageFormSetGuid,
- FRONT_PAGE_FORM_ID,
- StartOpCodeHandle, // LABEL_SELECT_LANGUAGE
- EndOpCodeHandle // LABEL_END
- );
-
- HiiFreeOpCodeHandle (StartOpCodeHandle);
- HiiFreeOpCodeHandle (EndOpCodeHandle);
- HiiFreeOpCodeHandle (OptionsOpCodeHandle);
- return Status;
-}
-
-/**
- Call the browser and display the front page
-
- @return Status code that will be returned by
- EFI_FORM_BROWSER2_PROTOCOL.SendForm ().
-
-**/
-EFI_STATUS
-CallFrontPage (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_BROWSER_ACTION_REQUEST ActionRequest;
-
- //
- // Begin waiting for USER INPUT
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)
- );
-
- ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
- Status = gFormBrowser2->SendForm (
- gFormBrowser2,
- &gFrontPagePrivate.HiiHandle,
- 1,
- &gFrontPageFormSetGuid,
- 0,
- NULL,
- &ActionRequest
- );
- //
- // Check whether user change any option setting which needs a reset to be effective
- //
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- EnableResetRequired ();
- }
-
- return Status;
-}
-
-/**
- Acquire the string associated with the ProducerGuid and return it.
-
-
- @param ProducerGuid The Guid to search the HII database for
- @param Token The token value of the string to extract
- @param String The string that is extracted
-
- @retval EFI_SUCCESS The function returns EFI_SUCCESS always.
-
-**/
-EFI_STATUS
-GetProducerString (
- IN EFI_GUID *ProducerGuid,
- IN EFI_STRING_ID Token,
- OUT CHAR16 **String
- )
-{
- EFI_STRING TmpString;
-
- TmpString = HiiGetPackageString (ProducerGuid, Token, NULL);
- if (TmpString == NULL) {
- *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
- } else {
- *String = TmpString;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Convert Processor Frequency Data to a string.
-
- @param ProcessorFrequency The frequency data to process
- @param Base10Exponent The exponent based on 10
- @param String The string that is created
-
-**/
-VOID
-ConvertProcessorToString (
- IN UINT16 ProcessorFrequency,
- IN UINT16 Base10Exponent,
- OUT CHAR16 **String
- )
-{
- CHAR16 *StringBuffer;
- UINTN Index;
- UINT32 FreqMhz;
-
- if (Base10Exponent >= 6) {
- FreqMhz = ProcessorFrequency;
- for (Index = 0; Index < (UINTN) (Base10Exponent - 6); Index++) {
- FreqMhz *= 10;
- }
- } else {
- FreqMhz = 0;
- }
-
- StringBuffer = AllocateZeroPool (0x20);
- ASSERT (StringBuffer != NULL);
- Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);
- StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L".");
- UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);
- StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" GHz");
- *String = (CHAR16 *) StringBuffer;
- return ;
-}
-
-
-/**
- Convert Memory Size to a string.
-
- @param MemorySize The size of the memory to process
- @param String The string that is created
-
-**/
-VOID
-ConvertMemorySizeToString (
- IN UINT32 MemorySize,
- OUT CHAR16 **String
- )
-{
- CHAR16 *StringBuffer;
-
- StringBuffer = AllocateZeroPool (0x20);
- ASSERT (StringBuffer != NULL);
- UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6);
- StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" MB RAM");
-
- *String = (CHAR16 *) StringBuffer;
-
- return ;
-}
-
-/**
-
- Acquire the string associated with the Index from smbios structure and return it.
- The caller is responsible for free the string buffer.
-
- @param OptionalStrStart The start position to search the string
- @param Index The index of the string to extract
- @param String The string that is extracted
-
- @retval EFI_SUCCESS The function returns EFI_SUCCESS always.
-
-**/
-EFI_STATUS
-GetOptionalStringByIndex (
- IN CHAR8 *OptionalStrStart,
- IN UINT8 Index,
- OUT CHAR16 **String
- )
-{
- UINTN StrSize;
-
- if (Index == 0) {
- *String = AllocateZeroPool (sizeof (CHAR16));
- return EFI_SUCCESS;
- }
-
- StrSize = 0;
- do {
- Index--;
- OptionalStrStart += StrSize;
- StrSize = AsciiStrSize (OptionalStrStart);
- } while (OptionalStrStart[StrSize] != 0 && Index != 0);
-
- if ((Index != 0) || (StrSize == 1)) {
- //
- // Meet the end of strings set but Index is non-zero, or
- // Find an empty string
- //
- *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
- } else {
- *String = AllocatePool (StrSize * sizeof (CHAR16));
- AsciiStrToUnicodeStr (OptionalStrStart, *String);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Update the banner information for the Front Page based on DataHub information.
-
-**/
-VOID
-UpdateFrontPageStrings (
- VOID
- )
-{
- UINT8 StrIndex;
- CHAR16 *NewString;
- BOOLEAN Find[5];
- EFI_STATUS Status;
- EFI_STRING_ID TokenToUpdate;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- EFI_SMBIOS_PROTOCOL *Smbios;
- SMBIOS_TABLE_TYPE0 *Type0Record;
- SMBIOS_TABLE_TYPE1 *Type1Record;
- SMBIOS_TABLE_TYPE4 *Type4Record;
- SMBIOS_TABLE_TYPE19 *Type19Record;
- EFI_SMBIOS_TABLE_HEADER *Record;
-
- ZeroMem (Find, sizeof (Find));
-
- //
- // Update Front Page strings
- //
- Status = gBS->LocateProtocol (
- &gEfiSmbiosProtocolGuid,
- NULL,
- (VOID **) &Smbios
- );
- if (!EFI_ERROR (Status)) {
- SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- do {
- Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
- if (EFI_ERROR(Status)) {
- break;
- }
-
- if (Record->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) {
- Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
- StrIndex = Type0Record->BiosVersion;
- GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
- Find[0] = TRUE;
- }
-
- if (Record->Type == EFI_SMBIOS_TYPE_SYSTEM_INFORMATION) {
- Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;
- StrIndex = Type1Record->ProductName;
- GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
- Find[1] = TRUE;
- }
-
- if (Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) {
- Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
- StrIndex = Type4Record->ProcessorVersion;
- GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
- Find[2] = TRUE;
- }
-
- if (Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) {
- Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
- ConvertProcessorToString(Type4Record->CurrentSpeed, 6, &NewString);
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
- Find[3] = TRUE;
- }
-
- if ( Record->Type == EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
- Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;
- ConvertMemorySizeToString (
- (UINT32)(RShiftU64((Type19Record->EndingAddress - Type19Record->StartingAddress + 1), 10)),
- &NewString
- );
- TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE);
- HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
- FreePool (NewString);
- Find[4] = TRUE;
- }
- } while ( !(Find[0] && Find[1] && Find[2] && Find[3] && Find[4]));
- }
- return ;
-}
-
-
-/**
- Function waits for a given event to fire, or for an optional timeout to expire.
-
- @param Event The event to wait for
- @param Timeout An optional timeout value in 100 ns units.
-
- @retval EFI_SUCCESS Event fired before Timeout expired.
- @retval EFI_TIME_OUT Timout expired before Event fired..
-
-**/
-EFI_STATUS
-WaitForSingleEvent (
- IN EFI_EVENT Event,
- IN UINT64 Timeout OPTIONAL
- )
-{
- UINTN Index;
- EFI_STATUS Status;
- EFI_EVENT TimerEvent;
- EFI_EVENT WaitList[2];
-
- if (Timeout != 0) {
- //
- // Create a timer event
- //
- Status = gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &TimerEvent);
- if (!EFI_ERROR (Status)) {
- //
- // Set the timer event
- //
- gBS->SetTimer (
- TimerEvent,
- TimerRelative,
- Timeout
- );
-
- //
- // Wait for the original event or the timer
- //
- WaitList[0] = Event;
- WaitList[1] = TimerEvent;
- Status = gBS->WaitForEvent (2, WaitList, &Index);
- gBS->CloseEvent (TimerEvent);
-
- //
- // If the timer expired, change the return to timed out
- //
- if (!EFI_ERROR (Status) && Index == 1) {
- Status = EFI_TIMEOUT;
- }
- }
- } else {
- //
- // No timeout... just wait on the event
- //
- Status = gBS->WaitForEvent (1, &Event, &Index);
- ASSERT (!EFI_ERROR (Status));
- ASSERT (Index == 0);
- }
-
- return Status;
-}
-
-/**
- Function show progress bar to wait for user input.
-
-
- @param TimeoutDefault The fault time out value before the system continue to boot.
-
- @retval EFI_SUCCESS User pressed some key except "Enter"
- @retval EFI_TIME_OUT Timeout expired or user press "Enter"
-
-**/
-EFI_STATUS
-ShowProgress (
- IN UINT16 TimeoutDefault
- )
-{
- CHAR16 *TmpStr;
- UINT16 TimeoutRemain;
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
-
- if (TimeoutDefault != 0) {
- DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));
-
- SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
-
- TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));
-
- if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
- //
- // Clear the progress status bar first
- //
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0);
- }
- }
-
-
- TimeoutRemain = TimeoutDefault;
- while (TimeoutRemain != 0) {
- DEBUG ((EFI_D_INFO, "Showing progress bar...Remaining %d second!\n", TimeoutRemain));
-
- Status = WaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND);
- if (Status != EFI_TIMEOUT) {
- break;
- }
- TimeoutRemain--;
-
- if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
- //
- // Show progress
- //
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- ((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault),
- 0
- );
- }
- }
- }
-
- if (TmpStr != NULL) {
- gBS->FreePool (TmpStr);
- }
-
- //
- // Timeout expired
- //
- if (TimeoutRemain == 0) {
- return EFI_TIMEOUT;
- }
- }
-
- //
- // User pressed some key
- //
- if (!PcdGetBool (PcdConInConnectOnDemand)) {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
- //
- // User pressed enter, equivalent to select "continue"
- //
- return EFI_TIMEOUT;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is the main entry of the platform setup entry.
- The function will present the main menu of the system setup,
- this is the platform reference part and can be customize.
-
-
- @param TimeoutDefault The fault time out value before the system
- continue to boot.
- @param ConnectAllHappened The indicater to check if the connect all have
- already happened.
-
-**/
-VOID
-PlatformBdsEnterFrontPage (
- IN UINT16 TimeoutDefault,
- IN BOOLEAN ConnectAllHappened
- )
-{
- EFI_STATUS Status;
- EFI_STATUS StatusHotkey;
- EFI_BOOT_LOGO_PROTOCOL *BootLogo;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
- UINTN BootTextColumn;
- UINTN BootTextRow;
- UINT64 OsIndication;
- UINTN DataSize;
- EFI_INPUT_KEY Key;
-
- GraphicsOutput = NULL;
- SimpleTextOut = NULL;
-
- PERF_START (NULL, "BdsTimeOut", "BDS", 0);
- //
- // Indicate if we need connect all in the platform setup
- //
- if (ConnectAllHappened) {
- gConnectAllHappened = TRUE;
- }
-
- if (!mModeInitialized) {
- //
- // After the console is ready, get current video resolution
- // and text mode before launching setup at first time.
- //
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID**)&GraphicsOutput
- );
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
- }
-
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID**)&SimpleTextOut
- );
- if (EFI_ERROR (Status)) {
- SimpleTextOut = NULL;
- }
-
- if (GraphicsOutput != NULL) {
- //
- // Get current video resolution and text mode.
- //
- mBootHorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
- mBootVerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
- }
-
- if (SimpleTextOut != NULL) {
- Status = SimpleTextOut->QueryMode (
- SimpleTextOut,
- SimpleTextOut->Mode->Mode,
- &BootTextColumn,
- &BootTextRow
- );
- mBootTextModeColumn = (UINT32)BootTextColumn;
- mBootTextModeRow = (UINT32)BootTextRow;
- }
-
- //
- // Get user defined text mode for setup.
- //
- mSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
- mSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
- mSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
- mSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
-
- mModeInitialized = TRUE;
- }
-
-
- //
- // goto FrontPage directly when EFI_OS_INDICATIONS_BOOT_TO_FW_UI is set
- //
- OsIndication = 0;
- DataSize = sizeof(UINT64);
- Status = gRT->GetVariable (
- L"OsIndications",
- &gEfiGlobalVariableGuid,
- NULL,
- &DataSize,
- &OsIndication
- );
-
- //
- // goto FrontPage directly when EFI_OS_INDICATIONS_BOOT_TO_FW_UI is set. Skip HotkeyBoot
- //
- if (!EFI_ERROR(Status) && ((OsIndication & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0)) {
- //
- // Clear EFI_OS_INDICATIONS_BOOT_TO_FW_UI to acknowledge OS
- //
- OsIndication &= ~((UINT64)EFI_OS_INDICATIONS_BOOT_TO_FW_UI);
- Status = gRT->SetVariable (
- L"OsIndications",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof(UINT64),
- &OsIndication
- );
- //
- // Changing the content without increasing its size with current variable implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
-
- //
- // Follow generic rule, Call ReadKeyStroke to connect ConIn before enter UI
- //
- if (PcdGetBool (PcdConInConnectOnDemand)) {
- gST->ConIn->ReadKeyStroke(gST->ConIn, &Key);
- }
-
- //
- // Ensure screen is clear when switch Console from Graphics mode to Text mode
- //
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- gST->ConOut->ClearScreen (gST->ConOut);
-
- } else {
-
- HotkeyBoot ();
- if (TimeoutDefault != 0xffff) {
- Status = ShowProgress (TimeoutDefault);
- StatusHotkey = HotkeyBoot ();
-
- if (!FeaturePcdGet(PcdBootlogoOnlyEnable) || !EFI_ERROR(Status) || !EFI_ERROR(StatusHotkey)){
- //
- // Ensure screen is clear when switch Console from Graphics mode to Text mode
- // Skip it in normal boot
- //
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- gST->ConOut->ClearScreen (gST->ConOut);
- }
-
- if (EFI_ERROR (Status)) {
- //
- // Timeout or user press enter to continue
- //
- goto Exit;
- }
- }
- }
-
- //
- // Boot Logo is corrupted, report it using Boot Logo protocol.
- //
- Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);
- if (!EFI_ERROR (Status) && (BootLogo != NULL)) {
- BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
- }
-
- //
- // Install BM HiiPackages.
- // Keep BootMaint HiiPackage, so that it can be covered by global setting.
- //
- InitBMPackage ();
-
- Status = EFI_SUCCESS;
- do {
- //
- // Set proper video resolution and text mode for setup
- //
- BdsSetConsoleMode (TRUE);
-
- InitializeFrontPage (FALSE);
-
- //
- // Update Front Page strings
- //
- UpdateFrontPageStrings ();
-
- gCallbackKey = 0;
- CallFrontPage ();
-
- //
- // If gCallbackKey is greater than 1 and less or equal to 5,
- // it will launch configuration utilities.
- // 2 = set language
- // 3 = boot manager
- // 4 = device manager
- // 5 = boot maintenance manager
- //
- if (gCallbackKey != 0) {
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP)
- );
- }
- //
- // Based on the key that was set, we can determine what to do
- //
- switch (gCallbackKey) {
- //
- // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
- // describe to their customers in documentation how to find their setup information (namely
- // under the device manager and specific buckets)
- //
- // These entries consist of the Continue, Select language, Boot Manager, and Device Manager
- //
- case FRONT_PAGE_KEY_CONTINUE:
- //
- // User hit continue
- //
- break;
-
- case FRONT_PAGE_KEY_LANGUAGE:
- //
- // User made a language setting change - display front page again
- //
- break;
-
- case FRONT_PAGE_KEY_BOOT_MANAGER:
- //
- // Remove the installed BootMaint HiiPackages when exit.
- //
- FreeBMPackage ();
-
- //
- // User chose to run the Boot Manager
- //
- CallBootManager ();
-
- //
- // Reinstall BootMaint HiiPackages after exiting from Boot Manager.
- //
- InitBMPackage ();
- break;
-
- case FRONT_PAGE_KEY_DEVICE_MANAGER:
- //
- // Display the Device Manager
- //
- do {
- CallDeviceManager ();
- } while (gCallbackKey == FRONT_PAGE_KEY_DEVICE_MANAGER);
- break;
-
- case FRONT_PAGE_KEY_BOOT_MAINTAIN:
- //
- // Display the Boot Maintenance Manager
- //
- BdsStartBootMaint ();
- break;
- }
-
- } while ((Status == EFI_SUCCESS) && (gCallbackKey != FRONT_PAGE_KEY_CONTINUE));
-
- if (mLanguageString != NULL) {
- FreePool (mLanguageString);
- mLanguageString = NULL;
- }
- //
- //Will leave browser, check any reset required change is applied? if yes, reset system
- //
- SetupResetReminder ();
-
- //
- // Remove the installed BootMaint HiiPackages when exit.
- //
- FreeBMPackage ();
-
-Exit:
- //
- // Automatically load current entry
- // Note: The following lines of code only execute when Auto boot
- // takes affect
- //
- PERF_END (NULL, "BdsTimeOut", "BDS", 0);
-}
-
-/**
- This function will change video resolution and text mode
- according to defined setup mode or defined boot mode
-
- @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
-
- @retval EFI_SUCCESS Mode is changed successfully.
- @retval Others Mode failed to be changed.
-
-**/
-EFI_STATUS
-EFIAPI
-BdsSetConsoleMode (
- BOOLEAN IsSetupMode
- )
-{
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
- UINTN SizeOfInfo;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
- UINT32 MaxGopMode;
- UINT32 MaxTextMode;
- UINT32 ModeNumber;
- UINT32 NewHorizontalResolution;
- UINT32 NewVerticalResolution;
- UINT32 NewColumns;
- UINT32 NewRows;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- EFI_STATUS Status;
- UINTN Index;
- UINTN CurrentColumn;
- UINTN CurrentRow;
-
- MaxGopMode = 0;
- MaxTextMode = 0;
-
- //
- // Get current video resolution and text mode
- //
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID**)&GraphicsOutput
- );
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
- }
-
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID**)&SimpleTextOut
- );
- if (EFI_ERROR (Status)) {
- SimpleTextOut = NULL;
- }
-
- if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {
- return EFI_UNSUPPORTED;
- }
-
- if (IsSetupMode) {
- //
- // The requried resolution and text mode is setup mode.
- //
- NewHorizontalResolution = mSetupHorizontalResolution;
- NewVerticalResolution = mSetupVerticalResolution;
- NewColumns = mSetupTextModeColumn;
- NewRows = mSetupTextModeRow;
- } else {
- //
- // The required resolution and text mode is boot mode.
- //
- NewHorizontalResolution = mBootHorizontalResolution;
- NewVerticalResolution = mBootVerticalResolution;
- NewColumns = mBootTextModeColumn;
- NewRows = mBootTextModeRow;
- }
-
- if (GraphicsOutput != NULL) {
- MaxGopMode = GraphicsOutput->Mode->MaxMode;
- }
-
- if (SimpleTextOut != NULL) {
- MaxTextMode = SimpleTextOut->Mode->MaxMode;
- }
-
- //
- // 1. If current video resolution is same with required video resolution,
- // video resolution need not be changed.
- // 1.1. If current text mode is same with required text mode, text mode need not be changed.
- // 1.2. If current text mode is different from required text mode, text mode need be changed.
- // 2. If current video resolution is different from required video resolution, we need restart whole console drivers.
- //
- for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
- Status = GraphicsOutput->QueryMode (
- GraphicsOutput,
- ModeNumber,
- &SizeOfInfo,
- &Info
- );
- if (!EFI_ERROR (Status)) {
- if ((Info->HorizontalResolution == NewHorizontalResolution) &&
- (Info->VerticalResolution == NewVerticalResolution)) {
- if ((GraphicsOutput->Mode->Info->HorizontalResolution == NewHorizontalResolution) &&
- (GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution)) {
- //
- // Current resolution is same with required resolution, check if text mode need be set
- //
- Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);
- ASSERT_EFI_ERROR (Status);
- if (CurrentColumn == NewColumns && CurrentRow == NewRows) {
- //
- // If current text mode is same with required text mode. Do nothing
- //
- FreePool (Info);
- return EFI_SUCCESS;
- } else {
- //
- // If current text mode is different from requried text mode. Set new video mode
- //
- for (Index = 0; Index < MaxTextMode; Index++) {
- Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);
- if (!EFI_ERROR(Status)) {
- if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
- //
- // Required text mode is supported, set it.
- //
- Status = SimpleTextOut->SetMode (SimpleTextOut, Index);
- ASSERT_EFI_ERROR (Status);
- //
- // Update text mode PCD.
- //
- PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);
- PcdSet32 (PcdConOutRow, mSetupTextModeRow);
- FreePool (Info);
- return EFI_SUCCESS;
- }
- }
- }
- if (Index == MaxTextMode) {
- //
- // If requried text mode is not supported, return error.
- //
- FreePool (Info);
- return EFI_UNSUPPORTED;
- }
- }
- } else {
- //
- // If current video resolution is not same with the new one, set new video resolution.
- // In this case, the driver which produces simple text out need be restarted.
- //
- Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
- if (!EFI_ERROR (Status)) {
- FreePool (Info);
- break;
- }
- }
- }
- FreePool (Info);
- }
- }
-
- if (ModeNumber == MaxGopMode) {
- //
- // If the resolution is not supported, return error.
- //
- return EFI_UNSUPPORTED;
- }
-
- //
- // Set PCD to Inform GraphicsConsole to change video resolution.
- // Set PCD to Inform Consplitter to change text mode.
- //
- PcdSet32 (PcdVideoHorizontalResolution, NewHorizontalResolution);
- PcdSet32 (PcdVideoVerticalResolution, NewVerticalResolution);
- PcdSet32 (PcdConOutColumn, NewColumns);
- PcdSet32 (PcdConOutRow, NewRows);
-
-
- //
- // Video mode is changed, so restart graphics console driver and higher level driver.
- // Reconnect graphics console driver and higher level driver.
- // Locate all the handles with GOP protocol and reconnect it.
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleTextOutProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < HandleCount; Index++) {
- gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
- }
- for (Index = 0; Index < HandleCount; Index++) {
- gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
- }
- if (HandleBuffer != NULL) {
- FreePool (HandleBuffer);
- }
- }
-
- return EFI_SUCCESS;
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h
deleted file mode 100644
index a7b1c5bca0..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/** @file
- FrontPage routines to handle the callbacks and browser calls
-
-Copyright (c) 2004 - 2012, 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.
-
-**/
-
-#ifndef _FRONT_PAGE_H_
-#define _FRONT_PAGE_H_
-
-#include "DeviceMngr/DeviceManager.h"
-#include "BootMaint/BootMaint.h"
-#include "BootMngr/BootManager.h"
-#include "String.h"
-
-
-//
-// These are the VFR compiler generated data representing our VFR data.
-//
-extern UINT8 FrontPageVfrBin[];
-
-extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
-
-extern UINTN gCallbackKey;
-extern BOOLEAN gConnectAllHappened;
-
-//
-// Boot video resolution and text mode.
-//
-extern UINT32 mBootHorizontalResolution;
-extern UINT32 mBootVerticalResolution;
-extern UINT32 mBootTextModeColumn;
-extern UINT32 mBootTextModeRow;
-//
-// BIOS setup video resolution and text mode.
-//
-extern UINT32 mSetupTextModeColumn;
-extern UINT32 mSetupTextModeRow;
-extern UINT32 mSetupHorizontalResolution;
-extern UINT32 mSetupVerticalResolution;
-
-
-#define ONE_SECOND 10000000
-
-///
-/// The size of a 3 character ISO639 language code.
-///
-#define ISO_639_2_ENTRY_SIZE 3
-
-//
-// This is the VFR compiler generated header file which defines the
-// string identifiers.
-//
-#define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
-
-//
-// These are defined as the same with vfr file
-//
-#define FRONT_PAGE_FORM_ID 0x1000
-
-#define FRONT_PAGE_KEY_CONTINUE 0x1000
-#define FRONT_PAGE_KEY_LANGUAGE 0x1234
-#define FRONT_PAGE_KEY_BOOT_MANAGER 0x1064
-#define FRONT_PAGE_KEY_DEVICE_MANAGER 0x8567
-#define FRONT_PAGE_KEY_BOOT_MAINTAIN 0x9876
-
-#define LABEL_SELECT_LANGUAGE 0x1000
-#define LABEL_END 0xffff
-
-#define FRONT_PAGE_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('F', 'P', 'C', 'B')
-
-typedef struct {
- UINTN Signature;
-
- //
- // HII relative handles
- //
- EFI_HII_HANDLE HiiHandle;
- EFI_HANDLE DriverHandle;
- EFI_STRING_ID *LanguageToken;
-
- //
- // Produced protocols
- //
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
-} FRONT_PAGE_CALLBACK_DATA;
-
-#define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
- CR (a, \
- FRONT_PAGE_CALLBACK_DATA, \
- ConfigAccess, \
- FRONT_PAGE_CALLBACK_DATA_SIGNATURE \
- )
-
-/**
- This function allows a caller to extract the current configuration for one
- or more named elements from the target driver.
-
-
- @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Request - A null-terminated Unicode string in <ConfigRequest> format.
- @param Progress - On return, points to a character in the Request string.
- Points to the string's null terminator if request was successful.
- Points to the most recent '&' before the first failing name/value
- pair (or the beginning of the string if the failure is in the
- first name/value pair) if the request was not successful.
- @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
- has all values filled in for the names in the Request string.
- String to be allocated by the called function.
-
- @retval EFI_SUCCESS The Results is filled with the requested values.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
- @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
-
-**/
-EFI_STATUS
-EFIAPI
-FakeExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- );
-
-/**
- This function processes the results of changes in configuration.
-
-
- @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
- @param Progress - A pointer to a string filled in with the offset of the most
- recent '&' before the first failing name/value pair (or the
- beginning of the string if the failure is in the first
- name/value pair) or the terminating NULL if all was successful.
-
- @retval EFI_SUCCESS The Results is processed successfully.
- @retval EFI_INVALID_PARAMETER Configuration is NULL.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
-
-**/
-EFI_STATUS
-EFIAPI
-FakeRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- );
-
-/**
- This function processes the results of changes in configuration.
-
-
- @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action - Specifies the type of action taken by the browser.
- @param QuestionId - A unique value which is sent to the original exporting driver
- so that it can identify the type of data to expect.
- @param Type - The type of value for the question.
- @param Value - A pointer to the data being sent to the original exporting driver.
- @param ActionRequest - On return, points to the action requested by the callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
-
-**/
-EFI_STATUS
-EFIAPI
-FrontPageCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- );
-
-/**
- Initialize HII information for the FrontPage
-
-
- @param InitializeHiiData TRUE if HII elements need to be initialized.
-
- @retval EFI_SUCCESS The operation is successful.
- @retval EFI_DEVICE_ERROR If the dynamic opcode creation failed.
-
-**/
-EFI_STATUS
-InitializeFrontPage (
- IN BOOLEAN InitializeHiiData
- );
-
-/**
- Acquire the string associated with the ProducerGuid and return it.
-
-
- @param ProducerGuid - The Guid to search the HII database for
- @param Token - The token value of the string to extract
- @param String - The string that is extracted
-
- @retval EFI_SUCCESS The function returns EFI_SUCCESS always.
-
-**/
-EFI_STATUS
-GetProducerString (
- IN EFI_GUID *ProducerGuid,
- IN EFI_STRING_ID Token,
- OUT CHAR16 **String
- );
-
-/**
- This function is the main entry of the platform setup entry.
- The function will present the main menu of the system setup,
- this is the platform reference part and can be customize.
-
-
- @param TimeoutDefault - The fault time out value before the system
- continue to boot.
- @param ConnectAllHappened - The indicater to check if the connect all have
- already happened.
-
-**/
-VOID
-PlatformBdsEnterFrontPage (
- IN UINT16 TimeoutDefault,
- IN BOOLEAN ConnectAllHappened
- );
-
-/**
- This function will change video resolution and text mode
- according to defined setup mode or defined boot mode
-
- @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
-
- @retval EFI_SUCCESS Mode is changed successfully.
- @retval Others Mode failed to be changed.
-
-**/
-EFI_STATUS
-EFIAPI
-BdsSetConsoleMode (
- BOOLEAN IsSetupMode
- );
-
-#endif // _FRONT_PAGE_H_
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.uni
deleted file mode 100644
index 3c083b4998..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageStrings.uni
+++ /dev/null
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr
deleted file mode 100644
index a2d92dff51..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPageVfr.Vfr
+++ /dev/null
@@ -1,137 +0,0 @@
-///** @file
-//
-// Browser formset.
-//
-// Copyright (c) 2007 - 2015, 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.
-//
-//**/
-
-#include <Guid/BdsHii.h>
-
-#define FRONT_PAGE_CLASS 0x0000
-#define FRONT_PAGE_SUBCLASS 0x0002
-
-#define FRONT_PAGE_FORM_ID 0x1000
-
-#define FRONT_PAGE_ITEM_ONE 0x0001
-#define FRONT_PAGE_ITEM_TWO 0x0002
-#define FRONT_PAGE_ITEM_THREE 0x0003
-#define FRONT_PAGE_ITEM_FOUR 0x0004
-#define FRONT_PAGE_ITEM_FIVE 0x0005
-
-#define FRONT_PAGE_KEY_CONTINUE 0x1000
-#define FRONT_PAGE_KEY_LANGUAGE 0x1234
-#define FRONT_PAGE_KEY_BOOT_MANAGER 0x1064
-#define FRONT_PAGE_KEY_DEVICE_MANAGER 0x8567
-#define FRONT_PAGE_KEY_BOOT_MAINTAIN 0x9876
-
-#define LABEL_SELECT_LANGUAGE 0x1000
-#define LABEL_TIMEOUT 0x2000
-#define LABEL_END 0xffff
-
-formset
- guid = FRONT_PAGE_FORMSET_GUID,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
- help = STRING_TOKEN(STR_NULL_STRING),
- classguid = FRONT_PAGE_FORMSET_GUID,
-
- form formid = FRONT_PAGE_FORM_ID,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),
- line 1,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),
- line 2,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),
- line 2,
- align right;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),
- line 3,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),
- line 3,
- align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_LEFT),
-// line 0,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_RIGHT),
-// line 0,
-// align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_LEFT),
-// line 1,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_RIGHT),
-// line 1,
-// align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_2_LEFT),
-// line 2,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_3_LEFT),
-// line 3,
-// align left;
-
-
- text
- help = STRING_TOKEN(STR_CONTINUE_HELP),
- text = STRING_TOKEN(STR_CONTINUE_PROMPT),
- flags = INTERACTIVE,
- key = FRONT_PAGE_KEY_CONTINUE;
-
- label LABEL_SELECT_LANGUAGE;
- //
- // This is where we will dynamically add a OneOf type op-code to select
- // Languages from the currently available choices
- //
- label LABEL_END;
-
- goto FRONT_PAGE_ITEM_THREE,
- prompt = STRING_TOKEN(STR_BOOT_MANAGER),
- help = STRING_TOKEN(STR_BOOT_MANAGER_HELP),
- flags = INTERACTIVE,
- key = FRONT_PAGE_KEY_BOOT_MANAGER;
-
- goto FRONT_PAGE_ITEM_FOUR,
- prompt = STRING_TOKEN(STR_DEVICE_MANAGER),
- help = STRING_TOKEN(STR_DEVICE_MANAGER_HELP),
- flags = INTERACTIVE,
- key = FRONT_PAGE_KEY_DEVICE_MANAGER;
-
- goto FRONT_PAGE_ITEM_FIVE,
- prompt = STRING_TOKEN(STR_BOOT_MAINT_MANAGER),
- help = STRING_TOKEN(STR_BOOT_MAINT_MANAGER_HELP),
- flags = INTERACTIVE,
- key = FRONT_PAGE_KEY_BOOT_MAINTAIN;
-
- endform;
-
-endformset;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
deleted file mode 100644
index e061991ea2..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/** @file
- Provides a way for 3rd party applications to register themselves for launch by the
- Boot Manager based on hot key
-
-Copyright (c) 2007 - 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.
-
-**/
-
-#include "Hotkey.h"
-
-
-LIST_ENTRY mHotkeyList = INITIALIZE_LIST_HEAD_VARIABLE (mHotkeyList);
-BDS_COMMON_OPTION *mHotkeyBootOption = NULL;
-EFI_EVENT mHotkeyEvent;
-VOID *mHotkeyRegistration;
-
-
-/**
- Check if the Key Option is valid or not.
-
- @param KeyOption The Hot Key Option to be checked.
-
- @retval TRUE The Hot Key Option is valid.
- @retval FALSE The Hot Key Option is invalid.
-
-**/
-BOOLEAN
-IsKeyOptionValid (
- IN EFI_KEY_OPTION *KeyOption
-)
-{
- UINT16 BootOptionName[10];
- UINT8 *BootOptionVar;
- UINTN BootOptionSize;
- UINT32 Crc;
-
- //
- // Check whether corresponding Boot Option exist
- //
- UnicodeSPrint (BootOptionName, sizeof (BootOptionName), L"Boot%04x", KeyOption->BootOption);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOptionName,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
-
- if (BootOptionVar == NULL || BootOptionSize == 0) {
- return FALSE;
- }
-
- //
- // Check CRC for Boot Option
- //
- gBS->CalculateCrc32 (BootOptionVar, BootOptionSize, &Crc);
- FreePool (BootOptionVar);
-
- return (BOOLEAN) ((KeyOption->BootOptionCrc == Crc) ? TRUE : FALSE);
-}
-
-/**
- Try to boot the boot option triggered by hotkey.
- @retval EFI_SUCCESS There is HotkeyBootOption & it is processed
- @retval EFI_NOT_FOUND There is no HotkeyBootOption
-**/
-EFI_STATUS
-HotkeyBoot (
- VOID
- )
-{
- EFI_STATUS Status;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
-
- if (mHotkeyBootOption == NULL) {
- return EFI_NOT_FOUND;
- }
-
- BdsLibConnectDevicePath (mHotkeyBootOption->DevicePath);
-
- //
- // Clear the screen before launch this BootOption
- //
- gST->ConOut->Reset (gST->ConOut, FALSE);
-
- Status = BdsLibBootViaBootOption (mHotkeyBootOption, mHotkeyBootOption->DevicePath, &ExitDataSize, &ExitData);
-
- if (EFI_ERROR (Status)) {
- //
- // Call platform action to indicate the boot fail
- //
- mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
- PlatformBdsBootFail (mHotkeyBootOption, Status, ExitData, ExitDataSize);
- } else {
- //
- // Call platform action to indicate the boot success
- //
- mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
- PlatformBdsBootSuccess (mHotkeyBootOption);
- }
- FreePool (mHotkeyBootOption->Description);
- FreePool (mHotkeyBootOption->DevicePath);
- FreePool (mHotkeyBootOption->LoadOptions);
- FreePool (mHotkeyBootOption);
-
- mHotkeyBootOption = NULL;
-
- return EFI_SUCCESS;
-}
-
-/**
-
- This is the common notification function for HotKeys, it will be registered
- with SimpleTextInEx protocol interface - RegisterKeyNotify() of ConIn handle.
-
- @param KeyData A pointer to a buffer that is filled in with the keystroke
- information for the key that was pressed.
-
- @retval EFI_SUCCESS KeyData is successfully processed.
- @return EFI_NOT_FOUND Fail to find boot option variable.
-**/
-EFI_STATUS
-EFIAPI
-HotkeyCallback (
- IN EFI_KEY_DATA *KeyData
-)
-{
- BOOLEAN HotkeyCatched;
- LIST_ENTRY BootLists;
- LIST_ENTRY *Link;
- BDS_HOTKEY_OPTION *Hotkey;
- UINT16 Buffer[10];
- EFI_STATUS Status;
- EFI_KEY_DATA *HotkeyData;
-
- if (mHotkeyBootOption != NULL) {
- //
- // Do not process sequential hotkey stroke until the current boot option returns
- //
- return EFI_SUCCESS;
- }
-
- Status = EFI_SUCCESS;
-
- for ( Link = GetFirstNode (&mHotkeyList)
- ; !IsNull (&mHotkeyList, Link)
- ; Link = GetNextNode (&mHotkeyList, Link)
- ) {
- HotkeyCatched = FALSE;
- Hotkey = BDS_HOTKEY_OPTION_FROM_LINK (Link);
-
- //
- // Is this Key Stroke we are waiting for?
- //
- ASSERT (Hotkey->WaitingKey < (sizeof (Hotkey->KeyData) / sizeof (Hotkey->KeyData[0])));
- HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey];
- if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) &&
- (KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) &&
- (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) ?
- (KeyData->KeyState.KeyShiftState == HotkeyData->KeyState.KeyShiftState) : TRUE
- )
- ) {
- //
- // For hotkey of key combination, transit to next waiting state
- //
- Hotkey->WaitingKey++;
-
- if (Hotkey->WaitingKey == Hotkey->CodeCount) {
- //
- // Received the whole key stroke sequence
- //
- HotkeyCatched = TRUE;
- }
- } else {
- //
- // Receive an unexpected key stroke, reset to initial waiting state
- //
- Hotkey->WaitingKey = 0;
- }
-
- if (HotkeyCatched) {
- //
- // Reset to initial waiting state
- //
- Hotkey->WaitingKey = 0;
-
- //
- // Launch its BootOption
- //
- InitializeListHead (&BootLists);
-
- UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", Hotkey->BootOptionNumber);
- mHotkeyBootOption = BdsLibVariableToOption (&BootLists, Buffer);
- }
- }
-
- return Status;
-}
-
-/**
- Register the common HotKey notify function to given SimpleTextInEx protocol instance.
-
- @param SimpleTextInEx Simple Text Input Ex protocol instance
-
- @retval EFI_SUCCESS Register hotkey notification function successfully.
- @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
-
-**/
-EFI_STATUS
-HotkeyRegisterNotify (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEx
-)
-{
- UINTN Index;
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- BDS_HOTKEY_OPTION *Hotkey;
-
- //
- // Register notification function for each hotkey
- //
- Link = GetFirstNode (&mHotkeyList);
-
- while (!IsNull (&mHotkeyList, Link)) {
- Hotkey = BDS_HOTKEY_OPTION_FROM_LINK (Link);
-
- Index = 0;
- do {
- Status = SimpleTextInEx->RegisterKeyNotify (
- SimpleTextInEx,
- &Hotkey->KeyData[Index],
- HotkeyCallback,
- &Hotkey->NotifyHandle
- );
- if (EFI_ERROR (Status)) {
- //
- // some of the hotkey registry failed
- //
- return Status;
- }
- Index ++;
- } while ((Index < Hotkey->CodeCount) && (Index < (sizeof (Hotkey->KeyData) / sizeof (EFI_KEY_DATA))));
-
- Link = GetNextNode (&mHotkeyList, Link);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Callback function for SimpleTextInEx protocol install events
-
- @param Event the event that is signaled.
- @param Context not used here.
-
-**/
-VOID
-EFIAPI
-HotkeyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEx;
-
- while (TRUE) {
- BufferSize = sizeof (EFI_HANDLE);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- NULL,
- mHotkeyRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // If no more notification events exist
- //
- return ;
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiSimpleTextInputExProtocolGuid,
- (VOID **) &SimpleTextInEx
- );
- ASSERT_EFI_ERROR (Status);
-
- HotkeyRegisterNotify (SimpleTextInEx);
- }
-}
-
-/**
- Insert Key Option to hotkey list.
-
- @param KeyOption The Hot Key Option to be added to hotkey list.
-
- @retval EFI_SUCCESS Add to hotkey list success.
- @retval EFI_OUT_OF_RESOURCES Fail to allocate memory resource.
-**/
-EFI_STATUS
-HotkeyInsertList (
- IN EFI_KEY_OPTION *KeyOption
-)
-{
- BDS_HOTKEY_OPTION *HotkeyLeft;
- BDS_HOTKEY_OPTION *HotkeyRight;
- UINTN Index;
- EFI_BOOT_KEY_DATA KeyOptions;
- UINT32 KeyShiftStateLeft;
- UINT32 KeyShiftStateRight;
- EFI_INPUT_KEY *InputKey;
- EFI_KEY_DATA *KeyData;
-
- HotkeyLeft = AllocateZeroPool (sizeof (BDS_HOTKEY_OPTION));
- if (HotkeyLeft == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- HotkeyLeft->Signature = BDS_HOTKEY_OPTION_SIGNATURE;
- HotkeyLeft->BootOptionNumber = KeyOption->BootOption;
-
- KeyOptions = KeyOption->KeyData;
-
- HotkeyLeft->CodeCount = (UINT8) KeyOptions.Options.InputKeyCount;
-
- //
- // Map key shift state from KeyOptions to EFI_KEY_DATA.KeyState
- //
- KeyShiftStateRight = EFI_SHIFT_STATE_VALID;
- if (KeyOptions.Options.ShiftPressed) {
- KeyShiftStateRight |= EFI_RIGHT_SHIFT_PRESSED;
- }
- if (KeyOptions.Options.ControlPressed) {
- KeyShiftStateRight |= EFI_RIGHT_CONTROL_PRESSED;
- }
- if (KeyOptions.Options.AltPressed) {
- KeyShiftStateRight |= EFI_RIGHT_ALT_PRESSED;
- }
- if (KeyOptions.Options.LogoPressed) {
- KeyShiftStateRight |= EFI_RIGHT_LOGO_PRESSED;
- }
- if (KeyOptions.Options.MenuPressed) {
- KeyShiftStateRight |= EFI_MENU_KEY_PRESSED;
- }
- if (KeyOptions.Options.SysReqPressed) {
- KeyShiftStateRight |= EFI_SYS_REQ_PRESSED;
- }
-
- KeyShiftStateLeft = (KeyShiftStateRight & 0xffffff00) | ((KeyShiftStateRight & 0xff) << 1);
-
- InputKey = (EFI_INPUT_KEY *) (((UINT8 *) KeyOption) + sizeof (EFI_KEY_OPTION));
-
- Index = 0;
- KeyData = &HotkeyLeft->KeyData[0];
- do {
- //
- // If Key CodeCount is 0, then only KeyData[0] is used;
- // if Key CodeCount is n, then KeyData[0]~KeyData[n-1] are used
- //
- KeyData->Key.ScanCode = InputKey[Index].ScanCode;
- KeyData->Key.UnicodeChar = InputKey[Index].UnicodeChar;
- KeyData->KeyState.KeyShiftState = KeyShiftStateLeft;
-
- Index++;
- KeyData++;
- } while (Index < HotkeyLeft->CodeCount);
- InsertTailList (&mHotkeyList, &HotkeyLeft->Link);
-
- if (KeyShiftStateLeft != KeyShiftStateRight) {
- //
- // Need an extra hotkey for shift key on right
- //
- HotkeyRight = AllocateCopyPool (sizeof (BDS_HOTKEY_OPTION), HotkeyLeft);
- if (HotkeyRight == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Index = 0;
- KeyData = &HotkeyRight->KeyData[0];
- do {
- //
- // Key.ScanCode and Key.UnicodeChar have already been initialized,
- // only need to update KeyState.KeyShiftState
- //
- KeyData->KeyState.KeyShiftState = KeyShiftStateRight;
-
- Index++;
- KeyData++;
- } while (Index < HotkeyRight->CodeCount);
- InsertTailList (&mHotkeyList, &HotkeyRight->Link);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Return TRUE when the variable pointed by Name and Guid is a Key#### variable.
-
- @param Name The name of the variable.
- @param Guid The GUID of the variable.
- @param OptionNumber Return the option number parsed from the Name.
-
- @retval TRUE The variable pointed by Name and Guid is a Key#### variable.
- @retval FALSE The variable pointed by Name and Guid isn't a Key#### variable.
-**/
-BOOLEAN
-IsKeyOptionVariable (
- CHAR16 *Name,
- EFI_GUID *Guid,
- UINT16 *OptionNumber
- )
-{
- UINTN Index;
-
- if (!CompareGuid (Guid, &gEfiGlobalVariableGuid) ||
- (StrSize (Name) != sizeof (L"Key####")) ||
- (StrnCmp (Name, L"Key", 3) != 0)
- ) {
- return FALSE;
- }
-
- *OptionNumber = 0;
- for (Index = 3; Index < 7; Index++) {
- if ((Name[Index] >= L'0') && (Name[Index] <= L'9')) {
- *OptionNumber = *OptionNumber * 16 + Name[Index] - L'0';
- } else if ((Name[Index] >= L'A') && (Name[Index] <= L'F')) {
- *OptionNumber = *OptionNumber * 16 + Name[Index] - L'A' + 10;
- } else {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/**
- Return an array of key option numbers.
-
- @param Count Return the count of key option numbers.
-
- @return UINT16* Pointer to an array of key option numbers;
-**/
-UINT16 *
-EFIAPI
-HotkeyGetOptionNumbers (
- OUT UINTN *Count
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- CHAR16 *Name;
- EFI_GUID Guid;
- UINTN NameSize;
- UINTN NewNameSize;
- UINT16 *OptionNumbers;
- UINT16 OptionNumber;
-
- if (Count == NULL) {
- return NULL;
- }
-
- *Count = 0;
- OptionNumbers = NULL;
-
- NameSize = sizeof (CHAR16);
- Name = AllocateZeroPool (NameSize);
- ASSERT (Name != NULL);
- while (TRUE) {
- NewNameSize = NameSize;
- Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- Name = ReallocatePool (NameSize, NewNameSize, Name);
- ASSERT (Name != NULL);
- Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
- NameSize = NewNameSize;
- }
-
- if (Status == EFI_NOT_FOUND) {
- break;
- }
- ASSERT_EFI_ERROR (Status);
-
- if (IsKeyOptionVariable (Name ,&Guid, &OptionNumber)) {
- OptionNumbers = ReallocatePool (
- *Count * sizeof (UINT16),
- (*Count + 1) * sizeof (UINT16),
- OptionNumbers
- );
- ASSERT (OptionNumbers != NULL);
- for (Index = 0; Index < *Count; Index++) {
- if (OptionNumber < OptionNumbers[Index]) {
- break;
- }
- }
- CopyMem (&OptionNumbers[Index + 1], &OptionNumbers[Index], (*Count - Index) * sizeof (UINT16));
- OptionNumbers[Index] = OptionNumber;
- (*Count)++;
- }
- }
-
- FreePool (Name);
-
- return OptionNumbers;
-}
-
-/**
-
- Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.
-
- @retval EFI_SUCCESS Hotkey services successfully initialized.
-**/
-EFI_STATUS
-InitializeHotkeyService (
- VOID
- )
-{
- EFI_STATUS Status;
- UINT32 BootOptionSupport;
- UINT16 *KeyOptionNumbers;
- UINTN KeyOptionCount;
- UINTN Index;
- CHAR16 KeyOptionName[8];
- EFI_KEY_OPTION *KeyOption;
-
- //
- // Export our capability - EFI_BOOT_OPTION_SUPPORT_KEY and EFI_BOOT_OPTION_SUPPORT_APP.
- // with maximum number of key presses of 3
- // Do not report the hotkey capability if PcdConInConnectOnDemand is enabled.
- //
- BootOptionSupport = EFI_BOOT_OPTION_SUPPORT_APP;
- if (!PcdGetBool (PcdConInConnectOnDemand)) {
- BootOptionSupport |= EFI_BOOT_OPTION_SUPPORT_KEY;
- SET_BOOT_OPTION_SUPPORT_KEY_COUNT (BootOptionSupport, 3);
- }
-
- Status = gRT->SetVariable (
- L"BootOptionSupport",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (UINT32),
- &BootOptionSupport
- );
- //
- // Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
-
- KeyOptionNumbers = HotkeyGetOptionNumbers (&KeyOptionCount);
- for (Index = 0; Index < KeyOptionCount; Index ++) {
- UnicodeSPrint (KeyOptionName, sizeof (KeyOptionName), L"Key%04x", KeyOptionNumbers[Index]);
- GetEfiGlobalVariable2 (KeyOptionName, (VOID **) &KeyOption, NULL);
- ASSERT (KeyOption != NULL);
- if (IsKeyOptionValid (KeyOption)) {
- HotkeyInsertList (KeyOption);
- }
- FreePool (KeyOption);
- }
-
- if (KeyOptionNumbers != NULL) {
- FreePool (KeyOptionNumbers);
- }
-
- //
- // Register Protocol notify for Hotkey service
- //
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- HotkeyEvent,
- NULL,
- &mHotkeyEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Register for protocol notifications on this event
- //
- Status = gBS->RegisterProtocolNotify (
- &gEfiSimpleTextInputExProtocolGuid,
- mHotkeyEvent,
- &mHotkeyRegistration
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
deleted file mode 100644
index 4ee5563a22..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
- Provides a way for 3rd party applications to register themselves for launch by the
- Boot Manager based on hot key
-
-Copyright (c) 2007 - 2013, 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.
-
-**/
-
-#ifndef _HOTKEY_H_
-#define _HOTKEY_H_
-
-#include "Bds.h"
-#include "String.h"
-
-#define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \
- (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \
- }
-
-#define BDS_HOTKEY_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'K', 'O')
-
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- VOID *NotifyHandle;
- UINT16 BootOptionNumber;
- UINT8 CodeCount;
- UINT8 WaitingKey;
- EFI_KEY_DATA KeyData[3];
-} BDS_HOTKEY_OPTION;
-
-#define BDS_HOTKEY_OPTION_FROM_LINK(a) CR (a, BDS_HOTKEY_OPTION, Link, BDS_HOTKEY_OPTION_SIGNATURE)
-
-/**
-
- Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.
-
-
- @param VOID
-
- @retval EFI_SUCCESS Hotkey services successfully initialized.
-
-**/
-EFI_STATUS
-InitializeHotkeyService (
- VOID
- );
-
-/**
- Try to boot the boot option triggered by hotkey.
- @retval EFI_SUCCESS There is HotkeyBootOption & it is processed
- @retval EFI_NOT_FOUND There is no HotkeyBootOption
-**/
-EFI_STATUS
-HotkeyBoot (
- VOID
- );
-
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c b/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
deleted file mode 100644
index ddb2f93980..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
- Set the level of support for Hardware Error Record Persistence that is
- implemented by the platform.
-
-Copyright (c) 2007 - 2013, 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.
-
-**/
-
-#include "HwErrRecSupport.h"
-
-/**
- Set the HwErrRecSupport variable contains a binary UINT16 that supplies the
- level of support for Hardware Error Record Persistence that is implemented
- by the platform.
-
-**/
-VOID
-InitializeHwErrRecSupport (
- VOID
- )
-{
- EFI_STATUS Status;
- UINT16 HardwareErrorRecordLevel;
-
- HardwareErrorRecordLevel = PcdGet16 (PcdHardwareErrorRecordLevel);
-
- if (HardwareErrorRecordLevel != 0) {
- //
- // If level value equal 0, no need set to 0 to variable area because UEFI specification
- // define same behavior between no value or 0 value for L"HwErrRecSupport".
- //
- Status = gRT->SetVariable (
- L"HwErrRecSupport",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT16),
- &HardwareErrorRecordLevel
- );
- ASSERT_EFI_ERROR(Status);
- }
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.h b/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.h
deleted file mode 100644
index 0cf597acc7..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
- Set the level of support for Hardware Error Record Persistence that is
- implemented by the platform.
-
-Copyright (c) 2007 - 2008, 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.
-
-**/
-
-#ifndef _HW_ERR_REC_SUPPORT_H_
-#define _HW_ERR_REC_SUPPORT_H_
-
-#include "Bds.h"
-
-/**
- Set the HwErrRecSupport variable contains a binary UINT16 that supplies the
- level of support for Hardware Error Record Persistence that is implemented
- by the platform.
-
-**/
-VOID
-InitializeHwErrRecSupport (
- VOID
- );
-
-#endif
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c
deleted file mode 100644
index 39455e44da..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/** @file
- Language settings
-
-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.
-
-**/
-
-#include "Language.h"
-#include "FrontPage.h"
-
-EFI_GUID mFontPackageGuid = {
- 0x78941450, 0x90ab, 0x4fb1, {0xb7, 0x5f, 0x58, 0x92, 0x14, 0xe2, 0x4a, 0xc}
-};
-
-#define NARROW_GLYPH_NUMBER 8
-#define WIDE_GLYPH_NUMBER 75
-
-typedef struct {
- ///
- /// This 4-bytes total array length is required by HiiAddPackages()
- ///
- UINT32 Length;
-
- //
- // This is the Font package definition
- //
- EFI_HII_PACKAGE_HEADER Header;
- UINT16 NumberOfNarrowGlyphs;
- UINT16 NumberOfWideGlyphs;
- EFI_NARROW_GLYPH NarrowArray[NARROW_GLYPH_NUMBER];
- EFI_WIDE_GLYPH WideArray[WIDE_GLYPH_NUMBER];
-} FONT_PACK_BIN;
-
-FONT_PACK_BIN mFontBin = {
- sizeof (FONT_PACK_BIN),
- {
- sizeof (FONT_PACK_BIN) - sizeof (UINT32),
- EFI_HII_PACKAGE_SIMPLE_FONTS,
- },
- NARROW_GLYPH_NUMBER,
- 0,
- { // Narrow Glyphs
- {
- 0x05d0,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x4E,
- 0x6E,
- 0x62,
- 0x32,
- 0x32,
- 0x3C,
- 0x68,
- 0x4C,
- 0x4C,
- 0x46,
- 0x76,
- 0x72,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d1,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x78,
- 0x7C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x7E,
- 0x7E,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d2,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x78,
- 0x7C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x1C,
- 0x3E,
- 0x66,
- 0x66,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d3,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x7E,
- 0x7E,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d4,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x7C,
- 0x7E,
- 0x06,
- 0x06,
- 0x06,
- 0x06,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d5,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x3C,
- 0x3C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d6,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x38,
- 0x38,
- 0x1E,
- 0x1E,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x0000,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- }
- }
-};
-
-/**
- Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver.
-
-**/
-VOID
-ExportFonts (
- VOID
- )
-{
- EFI_HII_HANDLE HiiHandle;
-
- HiiHandle = HiiAddPackages (
- &mFontPackageGuid,
- gImageHandle,
- &mFontBin,
- NULL
- );
- ASSERT (HiiHandle != NULL);
-}
-
-/**
- Get next language from language code list (with separator ';').
-
- If LangCode is NULL, then ASSERT.
- If Lang is NULL, then ASSERT.
-
- @param LangCode On input: point to first language in the list. On
- output: point to next language in the list, or
- NULL if no more language in the list.
- @param Lang The first language in the list.
-
-**/
-VOID
-EFIAPI
-GetNextLanguage (
- IN OUT CHAR8 **LangCode,
- OUT CHAR8 *Lang
- )
-{
- UINTN Index;
- CHAR8 *StringPtr;
-
- ASSERT (LangCode != NULL);
- ASSERT (*LangCode != NULL);
- ASSERT (Lang != NULL);
-
- Index = 0;
- StringPtr = *LangCode;
- while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
- Index++;
- }
-
- CopyMem (Lang, StringPtr, Index);
- Lang[Index] = 0;
-
- if (StringPtr[Index] == ';') {
- Index++;
- }
- *LangCode = StringPtr + Index;
-}
-
-/**
- Check if lang is in supported language codes according to language string.
-
- This code is used to check if lang is in in supported language codes. It can handle
- RFC4646 and ISO639 language tags.
- In ISO639 language tags, take 3-characters as a delimitation to find matched string.
- In RFC4646 language tags, take semicolon as a delimitation to find matched string.
-
- For example:
- SupportedLang = "engfraengfra"
- Iso639Language = TRUE
- Lang = "eng", the return value is "TRUE", or
- Lang = "chs", the return value is "FALSE".
- Another example:
- SupportedLang = "en;fr;en-US;fr-FR"
- Iso639Language = FALSE
- Lang = "en", the return value is "TRUE", or
- Lang = "zh", the return value is "FALSE".
-
- @param SupportedLang Platform supported language codes.
- @param Lang Configured language.
- @param Iso639Language A bool value to signify if the handler is operated on ISO639 or RFC4646.
-
- @retval TRUE lang is in supported language codes.
- @retval FALSE lang is not in supported language codes.
-
-**/
-BOOLEAN
-IsLangInSupportedLangCodes(
- IN CHAR8 *SupportedLang,
- IN CHAR8 *Lang,
- IN BOOLEAN Iso639Language
- )
-{
- UINTN Index;
- UINTN CompareLength;
- UINTN LanguageLength;
-
- if (Iso639Language) {
- CompareLength = ISO_639_2_ENTRY_SIZE;
- for (Index = 0; Index < AsciiStrLen (SupportedLang); Index += CompareLength) {
- if (AsciiStrnCmp (Lang, SupportedLang + Index, CompareLength) == 0) {
- //
- // Successfully find the Lang string in SupportedLang string.
- //
- return TRUE;
- }
- }
- return FALSE;
- } else {
- //
- // Compare RFC4646 language code
- //
- for (LanguageLength = 0; Lang[LanguageLength] != '\0'; LanguageLength++);
-
- for (; *SupportedLang != '\0'; SupportedLang += CompareLength) {
- //
- // Skip ';' characters in SupportedLang
- //
- for (; *SupportedLang != '\0' && *SupportedLang == ';'; SupportedLang++);
- //
- // Determine the length of the next language code in SupportedLang
- //
- for (CompareLength = 0; SupportedLang[CompareLength] != '\0' && SupportedLang[CompareLength] != ';'; CompareLength++);
-
- if ((CompareLength == LanguageLength) &&
- (AsciiStrnCmp (Lang, SupportedLang, CompareLength) == 0)) {
- //
- // Successfully find the Lang string in SupportedLang string.
- //
- return TRUE;
- }
- }
- return FALSE;
- }
-}
-
-/**
- Initialize Lang or PlatformLang variable, if Lang or PlatformLang variable is not found,
- or it has been set to an unsupported value(not one of platform supported language codes),
- set the default language code to it.
-
- @param LangName Language name, L"Lang" or L"PlatformLang".
- @param SupportedLang Platform supported language codes.
- @param DefaultLang Default language code.
- @param Iso639Language A bool value to signify if the handler is operated on ISO639 or RFC4646,
- TRUE for L"Lang" LangName or FALSE for L"PlatformLang" LangName.
-
-**/
-VOID
-InitializeLangVariable (
- IN CHAR16 *LangName,
- IN CHAR8 *SupportedLang,
- IN CHAR8 *DefaultLang,
- IN BOOLEAN Iso639Language
- )
-{
- CHAR8 *Lang;
-
- //
- // Find current Lang or PlatformLang from EFI Variable.
- //
- GetEfiGlobalVariable2 (LangName, (VOID **) &Lang, NULL);
- //
- // If Lang or PlatformLang variable is not found,
- // or it has been set to an unsupported value(not one of the supported language codes),
- // set the default language code to it.
- //
- if ((Lang == NULL) || !IsLangInSupportedLangCodes (SupportedLang, Lang, Iso639Language)) {
- //
- // The default language code should be one of the supported language codes.
- //
- ASSERT (IsLangInSupportedLangCodes (SupportedLang, DefaultLang, Iso639Language));
- BdsDxeSetVariableAndReportStatusCodeOnError (
- LangName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrSize (DefaultLang),
- DefaultLang
- );
- }
-
- if (Lang != NULL) {
- FreePool (Lang);
- }
-}
-
-/**
- Determine the current language that will be used
- based on language related EFI Variables.
-
- @param LangCodesSettingRequired - If required to set LangCodes variable
-
-**/
-VOID
-InitializeLanguage (
- BOOLEAN LangCodesSettingRequired
- )
-{
- EFI_STATUS Status;
- CHAR8 *LangCodes;
- CHAR8 *PlatformLangCodes;
-
- ExportFonts ();
-
- LangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLangCodes);
- PlatformLangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes);
- if (LangCodesSettingRequired) {
- if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {
- //
- // UEFI 2.0 depricated this variable so we support turning it off
- //
- Status = gRT->SetVariable (
- L"LangCodes",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrSize (LangCodes),
- LangCodes
- );
- //
- // Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
-
- Status = gRT->SetVariable (
- L"PlatformLangCodes",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrSize (PlatformLangCodes),
- PlatformLangCodes
- );
- //
- // Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
- }
-
- if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {
- //
- // UEFI 2.0 depricated this variable so we support turning it off
- //
- InitializeLangVariable (L"Lang", LangCodes, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultLang), TRUE);
- }
- InitializeLangVariable (L"PlatformLang", PlatformLangCodes, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang), FALSE);
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.h
deleted file mode 100644
index 31c65f1824..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @file
- Language setting
-
-Copyright (c) 2004 - 2008, 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.
-
-**/
-
-#ifndef _LANGUAGE_H_
-#define _LANGUAGE_H_
-
-#include "String.h"
-
-/**
- Get next language from language code list (with separator ';').
-
- If LangCode is NULL, then ASSERT.
- If Lang is NULL, then ASSERT.
-
- @param LangCode On input: point to first language in the list. On
- output: point to next language in the list, or
- NULL if no more language in the list.
- @param Lang The first language in the list.
-
-**/
-VOID
-EFIAPI
-GetNextLanguage (
- IN OUT CHAR8 **LangCode,
- OUT CHAR8 *Lang
- );
-
-/**
- Determine the current language that will be used
- based on language related EFI Variables.
-
- @param LangCodesSettingRequired If required to set LangCode variable
-
-**/
-VOID
-InitializeLanguage (
- BOOLEAN LangCodesSettingRequired
- );
-
-#endif // _LANGUAGE_H_
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
deleted file mode 100644
index fedb151a0c..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/** @file
- Perform the platform memory test
-
-Copyright (c) 2004 - 2015, 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.
-
-**/
-
-#include "Bds.h"
-#include "String.h"
-
-//
-// BDS Platform Functions
-//
-/**
-
- Show progress bar with title above it. It only works in Graphics mode.
-
-
- @param TitleForeground Foreground color for Title.
- @param TitleBackground Background color for Title.
- @param Title Title above progress bar.
- @param ProgressColor Progress bar color.
- @param Progress Progress (0-100)
- @param PreviousValue The previous value of the progress.
-
- @retval EFI_STATUS Success update the progress bar
-
-**/
-EFI_STATUS
-PlatformBdsShowProgress (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- IN CHAR16 *Title,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- IN UINTN Progress,
- IN UINTN PreviousValue
- )
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 SizeOfX;
- UINT32 SizeOfY;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- UINTN BlockHeight;
- UINTN BlockWidth;
- UINTN BlockNum;
- UINTN PosX;
- UINTN PosY;
- UINTN Index;
-
- if (Progress > 100) {
- return EFI_INVALID_PARAMETER;
- }
-
- UgaDraw = NULL;
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput
- );
- if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
- GraphicsOutput = NULL;
-
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw
- );
- }
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- SizeOfX = 0;
- SizeOfY = 0;
- if (GraphicsOutput != NULL) {
- SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
- SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
- } else if (UgaDraw != NULL) {
- Status = UgaDraw->GetMode (
- UgaDraw,
- &SizeOfX,
- &SizeOfY,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- } else {
- return EFI_UNSUPPORTED;
- }
-
- BlockWidth = SizeOfX / 100;
- BlockHeight = SizeOfY / 50;
-
- BlockNum = Progress;
-
- PosX = 0;
- PosY = SizeOfY * 48 / 50;
-
- if (BlockNum == 0) {
- //
- // Clear progress area
- //
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
-
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &Color,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- PosY - EFI_GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &Color,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- PosY - EFI_GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_UGA_PIXEL)
- );
- } else {
- return EFI_UNSUPPORTED;
- }
- }
- //
- // Show progress by drawing blocks
- //
- for (Index = PreviousValue; Index < BlockNum; Index++) {
- PosX = Index * BlockWidth;
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &ProgressColor,
- EfiBltVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &ProgressColor,
- EfiUgaVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_UGA_PIXEL)
- );
- } else {
- return EFI_UNSUPPORTED;
- }
- }
-
- PrintXY (
- (SizeOfX - StrLen (Title) * EFI_GLYPH_WIDTH) / 2,
- PosY - EFI_GLYPH_HEIGHT - 1,
- &TitleForeground,
- &TitleBackground,
- Title
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Perform the memory test base on the memory test intensive level,
- and update the memory resource.
-
- @param Level The memory test intensive level.
-
- @retval EFI_STATUS Success test all the system memory and update
- the memory resource
-
-**/
-EFI_STATUS
-EFIAPI
-BdsMemoryTest (
- IN EXTENDMEM_COVERAGE_LEVEL Level
- )
-{
- EFI_STATUS Status;
- EFI_STATUS KeyStatus;
- EFI_STATUS InitStatus;
- EFI_STATUS ReturnStatus;
- BOOLEAN RequireSoftECCInit;
- EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenMemoryTest;
- UINT64 TestedMemorySize;
- UINT64 TotalMemorySize;
- UINTN TestPercent;
- UINT64 PreviousValue;
- BOOLEAN ErrorOut;
- BOOLEAN TestAbort;
- EFI_INPUT_KEY Key;
- CHAR16 StrPercent[80];
- CHAR16 *StrTotalMemory;
- CHAR16 *Pos;
- CHAR16 *TmpStr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- BOOLEAN IsFirstBoot;
- UINT32 TempData;
- UINTN StrTotalMemorySize;
-
- ReturnStatus = EFI_SUCCESS;
- ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
-
- StrTotalMemorySize = 128;
- Pos = AllocateZeroPool (StrTotalMemorySize);
-
- if (Pos == NULL) {
- return ReturnStatus;
- }
-
- StrTotalMemory = Pos;
-
- TestedMemorySize = 0;
- TotalMemorySize = 0;
- PreviousValue = 0;
- ErrorOut = FALSE;
- TestAbort = FALSE;
-
- SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
-
- RequireSoftECCInit = FALSE;
-
- Status = gBS->LocateProtocol (
- &gEfiGenericMemTestProtocolGuid,
- NULL,
- (VOID **) &GenMemoryTest
- );
- if (EFI_ERROR (Status)) {
- FreePool (Pos);
- return EFI_SUCCESS;
- }
-
- InitStatus = GenMemoryTest->MemoryTestInit (
- GenMemoryTest,
- Level,
- &RequireSoftECCInit
- );
- if (InitStatus == EFI_NO_MEDIA) {
- //
- // The PEI codes also have the relevant memory test code to check the memory,
- // it can select to test some range of the memory or all of them. If PEI code
- // checks all the memory, this BDS memory test will has no not-test memory to
- // do the test, and then the status of EFI_NO_MEDIA will be returned by
- // "MemoryTestInit". So it does not need to test memory again, just return.
- //
- FreePool (Pos);
- return EFI_SUCCESS;
- }
-
- if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
- TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
-
- if (TmpStr != NULL) {
- PrintXY (10, 10, NULL, NULL, TmpStr);
- FreePool (TmpStr);
- }
- } else {
- DEBUG ((EFI_D_INFO, "Enter memory test.\n"));
- }
- do {
- Status = GenMemoryTest->PerformMemoryTest (
- GenMemoryTest,
- &TestedMemorySize,
- &TotalMemorySize,
- &ErrorOut,
- TestAbort
- );
- if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {
- TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR));
- if (TmpStr != NULL) {
- PrintXY (10, 10, NULL, NULL, TmpStr);
- FreePool (TmpStr);
- }
-
- ASSERT (0);
- }
-
- if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
- TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);
- TestPercent = (UINTN) DivU64x32 (
- DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
- TempData
- );
- if (TestPercent != PreviousValue) {
- UnicodeValueToString (StrPercent, 0, TestPercent, 0);
- TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
- if (TmpStr != NULL) {
- //
- // TmpStr size is 64, StrPercent is reserved to 16.
- //
- StrnCatS (
- StrPercent,
- sizeof (StrPercent) / sizeof (CHAR16),
- TmpStr,
- sizeof (StrPercent) / sizeof (CHAR16) - StrLen (StrPercent) - 1
- );
- PrintXY (10, 10, NULL, NULL, StrPercent);
- FreePool (TmpStr);
- }
-
- TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- TestPercent,
- (UINTN) PreviousValue
- );
- FreePool (TmpStr);
- }
- }
-
- PreviousValue = TestPercent;
- } else {
- DEBUG ((EFI_D_INFO, "Perform memory test (ESC to skip).\n"));
- }
-
- if (!PcdGetBool (PcdConInConnectOnDemand)) {
- KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) {
- if (!RequireSoftECCInit) {
- if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
- TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- 100,
- (UINTN) PreviousValue
- );
- FreePool (TmpStr);
- }
-
- PrintXY (10, 10, NULL, NULL, L"100");
- }
- Status = GenMemoryTest->Finished (GenMemoryTest);
- goto Done;
- }
-
- TestAbort = TRUE;
- }
- }
- } while (Status != EFI_NOT_FOUND);
-
- Status = GenMemoryTest->Finished (GenMemoryTest);
-
-Done:
- if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
- UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);
- if (StrTotalMemory[0] == L',') {
- StrTotalMemory++;
- StrTotalMemorySize -= sizeof (CHAR16);
- }
-
- TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));
- if (TmpStr != NULL) {
- StrnCatS (
- StrTotalMemory,
- StrTotalMemorySize / sizeof (CHAR16),
- TmpStr,
- StrTotalMemorySize / sizeof (CHAR16) - StrLen (StrTotalMemory) - 1
- );
- FreePool (TmpStr);
- }
-
- PrintXY (10, 10, NULL, NULL, StrTotalMemory);
- PlatformBdsShowProgress (
- Foreground,
- Background,
- StrTotalMemory,
- Color,
- 100,
- (UINTN) PreviousValue
- );
-
- } else {
- DEBUG ((EFI_D_INFO, "%d bytes of system memory tested OK\r\n", TotalMemorySize));
- }
-
- FreePool (Pos);
-
-
- //
- // Use a DynamicHii type pcd to save the boot status, which is used to
- // control configuration mode, such as FULL/MINIMAL/NO_CHANGES configuration.
- //
- IsFirstBoot = PcdGetBool(PcdBootState);
- if (IsFirstBoot) {
- PcdSetBool(PcdBootState, FALSE);
- }
-
- return ReturnStatus;
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/String.c b/IntelFrameworkModulePkg/Universal/BdsDxe/String.c
deleted file mode 100644
index d02001b4d1..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/String.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/** @file
- String support
-
-Copyright (c) 2004 - 2010, 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.
-
-**/
-
-#include "Bds.h"
-#include "Language.h"
-#include "FrontPage.h"
-
-EFI_HII_HANDLE gStringPackHandle;
-
-EFI_GUID mBdsStringPackGuid = {
- 0x7bac95d3, 0xddf, 0x42f3, {0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a}
-};
-
-/**
- Initialize HII global accessor for string support.
-
-**/
-VOID
-InitializeStringSupport (
- VOID
- )
-{
- gStringPackHandle = HiiAddPackages (
- &mBdsStringPackGuid,
- gImageHandle,
- BdsDxeStrings,
- NULL
- );
- ASSERT (gStringPackHandle != NULL);
-}
-
-/**
- Get string by string id from HII Interface
-
-
- @param Id String ID.
-
- @retval CHAR16 * String from ID.
- @retval NULL If error occurs.
-
-**/
-CHAR16 *
-GetStringById (
- IN EFI_STRING_ID Id
- )
-{
- return HiiGetString (gStringPackHandle, Id, NULL);
-}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/String.h b/IntelFrameworkModulePkg/Universal/BdsDxe/String.h
deleted file mode 100644
index 005b2bdbd2..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/String.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/** @file
- String support
-
-Copyright (c) 2004 - 2009, 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.
-
-**/
-
-#ifndef _STRING_H_
-#define _STRING_H_
-
-#include "Bds.h"
-
-extern EFI_HII_HANDLE gStringPackHandle;
-
-//
-// This is the VFR compiler generated header file which defines the
-// string identifiers.
-//
-
-extern UINT8 BdsDxeStrings[];
-
-/**
- Get string by string id from HII Interface
-
-
- @param Id String ID.
-
- @retval CHAR16 * String from ID.
- @retval NULL If error occurs.
-
-**/
-CHAR16 *
-GetStringById (
- IN EFI_STRING_ID Id
- );
-
-/**
- Initialize HII global accessor for string support.
-
-**/
-VOID
-InitializeStringSupport (
- VOID
- );
-
-/**
- Call the browser and display the front page
-
- @return Status code that will be returned by
- EFI_FORM_BROWSER2_PROTOCOL.SendForm ().
-
-**/
-EFI_STATUS
-CallFrontPage (
- VOID
- );
-
-#endif // _STRING_H_
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni
deleted file mode 100644
index 040ed92c36..0000000000
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni
+++ /dev/null
Binary files differ