Legacy Boot Maintenance UI part code split from IntelFrameworkModulePkg/Universal/BdsDxe driver.

This is the legacy part of the old BdsDxe driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18112 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong 2015-07-30 03:43:14 +00:00 committed by ydong10
parent 143f0b1de8
commit 5a673ab299
7 changed files with 1947 additions and 0 deletions

View File

@ -140,6 +140,7 @@
IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.inf IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.inf
IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,255 @@
/** @file
Legacy boot maintainence Ui definition.
Copyright (c) 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 _EFI_LEGACY_BOOT_OPTION_H_
#define _EFI_LEGACY_BOOT_OPTION_H_
#include <PiDxe.h>
#include <Guid/GlobalVariable.h>
#include <Guid/LegacyDevOrder.h>
#include <Guid/MdeModuleHii.h>
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/LegacyBios.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/DevicePathLib.h>
#include <Library/DebugLib.h>
#include <Library/HiiLib.h>
#include <Library/UefiBootManagerLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiLib.h>
#include <Library/PrintLib.h>
#include <Library/BaseMemoryLib.h>
#include "LegacyBootMaintUiVfr.h"
#define CONFIG_OPTION_OFFSET 0x1200
//
// VarOffset that will be used to create question
// all these values are computed from the structure
// defined below
//
#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_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 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)
//
// 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"
#define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"
#define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"
#define STR_CDROM_TITLE L"Set Legacy CDROM Drive Order"
#define STR_NET_TITLE L"Set Legacy NET Drive Order"
#define STR_BEV_TITLE L"Set Legacy BEV Drive Order"
//
// These are the VFR compiler generated data representing our VFR data.
//
extern UINT8 LegacyBootMaintUiVfrBin[];
#pragma pack(1)
///
/// HII specific Vendor Device Path definition.
///
typedef struct {
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
} HII_VENDOR_DEVICE_PATH;
//
// Variable created with this flag will be "Efi:...."
//
#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
#define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')
typedef struct {
UINTN Signature;
//
// HII relative handles
//
EFI_HII_HANDLE HiiHandle;
EFI_HANDLE DriverHandle;
//
// Produced protocols
//
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
//
// Maintain the data.
//
LEGACY_BOOT_MAINTAIN_DATA *MaintainMapData;
} LEGACY_BOOT_OPTION_CALLBACK_DATA;
//
// All of the signatures that will be used in list structure
//
#define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
#define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
#define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9
typedef struct {
UINTN Signature;
LIST_ENTRY Head;
UINTN MenuNumber;
} LEGACY_MENU_OPTION;
typedef struct {
UINT16 BbsIndex;
CHAR16 *Description;
} LEGACY_DEVICE_CONTEXT;
typedef struct {
UINTN Signature;
LIST_ENTRY Link;
UINTN OptionNumber;
UINT16 *DisplayString;
UINT16 *HelpString;
EFI_STRING_ID DisplayStringToken;
EFI_STRING_ID HelpStringToken;
VOID *VariableContext;
} LEGACY_MENU_ENTRY;
typedef struct {
UINT16 BbsIndex;
} LEGACY_BOOT_OPTION_BBS_DATA;
#pragma pack()
/**
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
LegacyBootOptionCallback (
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 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
LegacyBootOptionExtractConfig (
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
LegacyBootOptionRouteConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
);
#endif

View File

@ -0,0 +1,68 @@
## @file
# Legacy Boot Maintainence UI module is library for BDS phase.
#
# Copyright (c) 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 = LegacyBootMaintUiLib
FILE_GUID = e6f7f038-3ed9-401a-af1f-5ea7bf644d34
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION
CONSTRUCTOR = LegacyBootMaintUiLibConstructor
DESTRUCTOR = LegacyBootMaintUiLibDestructor
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources]
LegacyBootMaintUiVfr.h
LegacyBootMaintUi.h
LegacyBootMaintUiVfr.Vfr
LegacyBootMaintUiStrings.uni
LegacyBootMaintUi.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
DevicePathLib
BaseLib
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
DebugLib
HiiLib
MemoryAllocationLib
UefiBootManagerLib
UefiLib
PrintLib
BaseMemoryLib
[Guids]
gEfiIfrTianoGuid
gEfiIfrBootMaintenanceGuid
gEfiLegacyDevOrderVariableGuid
[Protocols]
gEfiHiiConfigAccessProtocolGuid ## PROTOCOL CONSUMES
gEfiLegacyBiosProtocolGuid
gEfiHiiConfigRoutingProtocolGuid
[Depex]
gEfiHiiDatabaseProtocolGuid

View File

@ -0,0 +1,73 @@
///** @file
//
// Browser formset.
//
// Copyright (c) 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 "LegacyBootMaintUiVfr.h"
formset
guid = LEGACY_BOOT_OPTION_FORMSET_GUID,
title = STRING_TOKEN(STR_LEGACY_BOOT_PROMPT),
help = STRING_TOKEN(STR_LEGACY_BOOT_HELP),
classguid = EFI_IFR_BOOT_MAINTENANCE_GUID,
varstore LEGACY_BOOT_NV_DATA,
varid = VARSTORE_ID_LEGACY_BOOT,
name = LegacyBootData,
guid = LEGACY_BOOT_OPTION_FORMSET_GUID;
form formid = LEGACY_BOOT_FORM_ID,
title = STRING_TOKEN(STR_LEGACY_BOOT_PROMPT);
goto LEGACY_ORDER_CHANGE_FORM_ID,
prompt = STRING_TOKEN(STR_FORM_FLOPPY_BOOT_TITLE),
help = STRING_TOKEN(STR_FORM_FLOPPY_BOOT_HELP),
flags = INTERACTIVE,
key = FORM_FLOPPY_BOOT_ID;
goto LEGACY_ORDER_CHANGE_FORM_ID,
prompt = STRING_TOKEN(STR_FORM_HARDDISK_BOOT_TITLE),
help = STRING_TOKEN(STR_FORM_HARDDISK_BOOT_HELP),
flags = INTERACTIVE,
key = FORM_HARDDISK_BOOT_ID;
goto LEGACY_ORDER_CHANGE_FORM_ID,
prompt = STRING_TOKEN(STR_FORM_CDROM_BOOT_TITLE),
help = STRING_TOKEN(STR_FORM_CDROM_BOOT_HELP),
flags = INTERACTIVE,
key = FORM_CDROM_BOOT_ID;
goto LEGACY_ORDER_CHANGE_FORM_ID,
prompt = STRING_TOKEN(STR_FORM_NET_BOOT_TITLE),
help = STRING_TOKEN(STR_FORM_NET_BOOT_HELP),
flags = INTERACTIVE,
key = FORM_NET_BOOT_ID;
goto LEGACY_ORDER_CHANGE_FORM_ID,
prompt = STRING_TOKEN(STR_FORM_BEV_BOOT_TITLE),
help = STRING_TOKEN(STR_FORM_BEV_BOOT_HELP),
flags = INTERACTIVE,
key = FORM_BEV_BOOT_ID;
endform;
form formid = LEGACY_ORDER_CHANGE_FORM_ID,
title = STRING_TOKEN(STR_ORDER_CHANGE_PROMPT);
label FORM_BOOT_LEGACY_DEVICE_ID;
label FORM_BOOT_LEGACY_LABEL_END;
endform;
endformset;

View File

@ -0,0 +1,85 @@
/** @file
Legacy Boot Maintainence UI definition.
Copyright (c) 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 _EFI_LEGACY_BOOT_OPTION_VFR_H_
#define _EFI_LEGACY_BOOT_OPTION_VFR_H_
#include <Guid/HiiBootMaintenanceFormset.h>
#define MAX_MENU_NUMBER 100
#define LEGACY_BOOT_OPTION_FORMSET_GUID { 0x6bc75598, 0x89b4, 0x483d, 0x91, 0x60, 0x7f, 0x46, 0x9a, 0x96, 0x35, 0x31 }
#define VARSTORE_ID_LEGACY_BOOT 0x0001
#define LEGACY_BOOT_FORM_ID 0x1000
#define LEGACY_ORDER_CHANGE_FORM_ID 0x1001
#define FORM_FLOPPY_BOOT_ID 0x2000
#define FORM_HARDDISK_BOOT_ID 0x2001
#define FORM_CDROM_BOOT_ID 0x2002
#define FORM_NET_BOOT_ID 0x2003
#define FORM_BEV_BOOT_ID 0x2004
#define FORM_BOOT_LEGACY_DEVICE_ID 0x9000
#define FORM_BOOT_LEGACY_LABEL_END 0x9001
#pragma pack(1)
///
/// 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 {
//
// Legacy Device Order Selection Storage
//
UINT16 LegacyFD[MAX_MENU_NUMBER];
UINT16 LegacyHD[MAX_MENU_NUMBER];
UINT16 LegacyCD[MAX_MENU_NUMBER];
UINT16 LegacyNET[MAX_MENU_NUMBER];
UINT16 LegacyBEV[MAX_MENU_NUMBER];
} LEGACY_BOOT_NV_DATA;
///
/// 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 {
//
// Legacy Device Order Selection Storage
//
LEGACY_BOOT_NV_DATA InitialNvData;
LEGACY_BOOT_NV_DATA CurrentNvData;
LEGACY_BOOT_NV_DATA LastTimeNvData;
UINT8 DisableMap[32];
} LEGACY_BOOT_MAINTAIN_DATA;
#pragma pack()
#endif