mirror of https://github.com/acidanthera/audk.git
UEFI HII: Merge UEFI HII support changes from branch.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4599 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f79314fa8f
commit
93e3992d1e
|
@ -140,4 +140,5 @@
|
|||
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeCoreHandoffToBds | 0x3041001 # EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT
|
||||
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueBootServiceExit | 0x3100019 # EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES
|
||||
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverBegin | 0x3040002 # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN
|
||||
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverEnd | 0x3040003 # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END
|
||||
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverEnd | 0x3040003 # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END
|
||||
|
||||
|
|
|
@ -0,0 +1,565 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
GenericBdsLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Generic BDS library definition, include the file and data structure
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _GENERIC_BDS_LIB_H_
|
||||
#define _GENERIC_BDS_LIB_H_
|
||||
|
||||
//
|
||||
// WQBugBug: These Macro will be handled properly later.
|
||||
//
|
||||
//#undef EFI_SPECIFICATION_VERSION
|
||||
//#define EFI_SPECIFICATION_VERSION 0x0002000A
|
||||
|
||||
#define PI_SPECIFICATION_VERSION 0x00010000
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
|
||||
|
||||
extern EFI_HANDLE mBdsImageHandle;
|
||||
|
||||
//
|
||||
// Constants which are variable names used to access variables
|
||||
//
|
||||
#define VarLegacyDevOrder L"LegacyDevOrder"
|
||||
|
||||
//
|
||||
// Data structures and defines
|
||||
//
|
||||
#define FRONT_PAGE_QUESTION_ID 0x0000
|
||||
#define FRONT_PAGE_DATA_WIDTH 0x01
|
||||
|
||||
//
|
||||
// ConnectType
|
||||
//
|
||||
#define CONSOLE_OUT 0x00000001
|
||||
#define STD_ERROR 0x00000002
|
||||
#define CONSOLE_IN 0x00000004
|
||||
#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
||||
|
||||
//
|
||||
// Load Option Attributes defined in EFI Specification
|
||||
//
|
||||
#define LOAD_OPTION_ACTIVE 0x00000001
|
||||
#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||
#define LOAD_OPTION_HIDDEN 0x00000008
|
||||
#define LOAD_OPTION_CATEGORY 0x00001F00
|
||||
|
||||
#define LOAD_OPTION_CATEGORY_BOOT 0x00000000
|
||||
#define LOAD_OPTION_CATEGORY_APP 0x00000100
|
||||
|
||||
#define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001
|
||||
#define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002
|
||||
#endif
|
||||
|
||||
#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)
|
||||
|
||||
//
|
||||
// Define Maxmim characters that will be accepted
|
||||
//
|
||||
#define MAX_CHAR 480
|
||||
#define MAX_CHAR_SIZE (MAX_CHAR * 2)
|
||||
|
||||
#define MIN_ALIGNMENT_SIZE 4
|
||||
#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
|
||||
|
||||
//
|
||||
// Define maximum characters for boot option variable "BootXXXX"
|
||||
//
|
||||
#define BOOT_OPTION_MAX_CHAR 10
|
||||
|
||||
//
|
||||
// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.
|
||||
//
|
||||
#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')
|
||||
|
||||
typedef struct {
|
||||
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
CHAR16 *OptionName;
|
||||
UINTN OptionNumber;
|
||||
UINT16 BootCurrent;
|
||||
UINT32 Attribute;
|
||||
CHAR16 *Description;
|
||||
VOID *LoadOptions;
|
||||
UINT32 LoadOptionsSize;
|
||||
CHAR16 *StatusString;
|
||||
|
||||
} BDS_COMMON_OPTION;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN ConnectType;
|
||||
} BDS_CONSOLE_CONNECT_ENTRY;
|
||||
|
||||
//
|
||||
// Lib Functions
|
||||
//
|
||||
|
||||
//
|
||||
// Bds boot relate lib functions
|
||||
//
|
||||
EFI_STATUS
|
||||
BdsLibUpdateBootOrderList (
|
||||
IN LIST_ENTRY *BdsOptionList,
|
||||
IN CHAR16 *VariableName
|
||||
);
|
||||
|
||||
VOID
|
||||
BdsLibBootNext (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibBootViaBootOption (
|
||||
IN BDS_COMMON_OPTION * Option,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
|
||||
OUT UINTN *ExitDataSize,
|
||||
OUT CHAR16 **ExitData OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibEnumerateAllBootOption (
|
||||
IN OUT LIST_ENTRY *BdsBootOptionList
|
||||
);
|
||||
|
||||
VOID
|
||||
BdsLibBuildOptionFromHandle (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN LIST_ENTRY *BdsBootOptionList,
|
||||
IN CHAR16 *String
|
||||
);
|
||||
|
||||
VOID
|
||||
BdsLibBuildOptionFromShell (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN LIST_ENTRY *BdsBootOptionList
|
||||
);
|
||||
|
||||
//
|
||||
// Bds misc lib functions
|
||||
//
|
||||
UINT16
|
||||
BdsLibGetTimeout (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibGetBootMode (
|
||||
OUT EFI_BOOT_MODE *BootMode
|
||||
);
|
||||
|
||||
VOID
|
||||
BdsLibLoadDrivers (
|
||||
IN LIST_ENTRY *BdsDriverLists
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibBuildOptionFromVar (
|
||||
IN LIST_ENTRY *BdsCommonOptionList,
|
||||
IN CHAR16 *VariableName
|
||||
);
|
||||
|
||||
VOID *
|
||||
BdsLibGetVariableAndSize (
|
||||
IN CHAR16 *Name,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINTN *VariableSize
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibOutputStrings (
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,
|
||||
...
|
||||
);
|
||||
|
||||
BDS_COMMON_OPTION *
|
||||
BdsLibVariableToOption (
|
||||
IN OUT LIST_ENTRY *BdsCommonOptionList,
|
||||
IN CHAR16 *VariableName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibRegisterNewOption (
|
||||
IN LIST_ENTRY *BdsOptionList,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CHAR16 *String,
|
||||
IN CHAR16 *VariableName
|
||||
);
|
||||
|
||||
//
|
||||
// Bds connect or disconnect driver lib funcion
|
||||
//
|
||||
VOID
|
||||
BdsLibConnectAllDriversToAllControllers (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
BdsLibConnectAll (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibConnectDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibConnectAllEfi (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibDisconnectAllEfi (
|
||||
VOID
|
||||
);
|
||||
|
||||
//
|
||||
// Bds console relate lib functions
|
||||
//
|
||||
VOID
|
||||
BdsLibConnectAllConsoles (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibConnectAllDefaultConsoles (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibUpdateConsoleVariable (
|
||||
IN CHAR16 *ConVarName,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibConnectConsoleVariable (
|
||||
IN CHAR16 *ConVarName
|
||||
);
|
||||
|
||||
//
|
||||
// Bds device path relate lib functions
|
||||
//
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
BdsLibUnpackDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
BdsLibDelPartMatchInstance (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *Single
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
BdsLibMatchDevicePaths (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *Single
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
DevicePathToStr (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
);
|
||||
|
||||
VOID *
|
||||
EfiLibGetVariable (
|
||||
IN CHAR16 *Name,
|
||||
IN EFI_GUID *VendorGuid
|
||||
);
|
||||
|
||||
//
|
||||
// Internal definitions
|
||||
//
|
||||
typedef struct {
|
||||
CHAR16 *str;
|
||||
UINTN len;
|
||||
UINTN maxlen;
|
||||
} POOL_PRINT;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
VOID (*Function) (POOL_PRINT *, VOID *);
|
||||
} DEVICE_PATH_STRING_TABLE;
|
||||
|
||||
extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
} VENDOR_DEVICE_PATH_WITH_DATA;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
|
||||
extern EFI_GUID mEfiDevicePathMessagingSASGuid;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
UINT16 NetworkProtocol;
|
||||
UINT16 LoginOption;
|
||||
UINT64 Lun;
|
||||
UINT16 TargetPortalGroupTag;
|
||||
CHAR16 iSCSITargetName[1];
|
||||
} ISCSI_DEVICE_PATH_WITH_NAME;
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Internal functions
|
||||
//
|
||||
EFI_STATUS
|
||||
BdsBootByDiskSignatureAndPartition (
|
||||
IN BDS_COMMON_OPTION * Option,
|
||||
IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,
|
||||
IN UINT32 LoadOptionsSize,
|
||||
IN VOID *LoadOptions,
|
||||
OUT UINTN *ExitDataSize,
|
||||
OUT CHAR16 **ExitData OPTIONAL
|
||||
);
|
||||
|
||||
//
|
||||
// Notes: EFI 64 shadow all option rom
|
||||
//
|
||||
#if defined (MDE_CPU_IPF)
|
||||
#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();
|
||||
VOID
|
||||
ShadowAllOptionRom();
|
||||
#else
|
||||
#define EFI64_SHADOW_ALL_LEGACY_ROM()
|
||||
#endif
|
||||
|
||||
//
|
||||
// BBS support macros and functions
|
||||
//
|
||||
|
||||
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
|
||||
#define REFRESH_LEGACY_BOOT_OPTIONS \
|
||||
BdsDeleteAllInvalidLegacyBootOptions ();\
|
||||
BdsAddNonExistingLegacyBootOptions (); \
|
||||
BdsUpdateLegacyDevOrder ()
|
||||
#else
|
||||
#define REFRESH_LEGACY_BOOT_OPTIONS
|
||||
#endif
|
||||
|
||||
EFI_STATUS
|
||||
BdsDeleteAllInvalidLegacyBootOptions (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsAddNonExistingLegacyBootOptions (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsUpdateLegacyDevOrder (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsRefreshBbsTableForBoot (
|
||||
IN BDS_COMMON_OPTION *Entry
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsDeleteBootOption (
|
||||
IN UINTN OptionNumber,
|
||||
IN OUT UINT16 *BootOrder,
|
||||
IN OUT UINTN *BootOrderSize
|
||||
);
|
||||
|
||||
//
|
||||
//The interface functions relate with Setup Browser Reset Reminder feature
|
||||
//
|
||||
VOID
|
||||
EnableResetReminderFeature (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
DisableResetReminderFeature (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
EnableResetRequired (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
DisableResetRequired (
|
||||
VOID
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsResetReminderFeatureEnable (
|
||||
VOID
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsResetRequired (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
SetupResetReminder (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibGetImageHeader (
|
||||
IN EFI_HANDLE Device,
|
||||
IN CHAR16 *FileName,
|
||||
OUT EFI_IMAGE_DOS_HEADER *DosHeader,
|
||||
OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibGetHiiHandles (
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||
IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase,
|
||||
#else
|
||||
IN EFI_HII_PROTOCOL *Hii,
|
||||
#endif
|
||||
IN OUT UINT16 *HandleBufferLength,
|
||||
OUT EFI_HII_HANDLE **HiiHandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// Define the boot type which to classify the boot option type
|
||||
// Different boot option type could have different boot behavior
|
||||
// Use their device path node (Type + SubType) as type value
|
||||
// The boot type here can be added according to requirement
|
||||
//
|
||||
//
|
||||
// ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value
|
||||
//
|
||||
#define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201
|
||||
//
|
||||
// Message boot type
|
||||
// If a device path of boot option only point to a message node, the boot option is message boot type
|
||||
//
|
||||
#define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01
|
||||
#define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02
|
||||
#define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05
|
||||
#define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF
|
||||
//
|
||||
// Media boot type
|
||||
// If a device path of boot option contain a media node, the boot option is media boot type
|
||||
//
|
||||
#define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01
|
||||
#define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02
|
||||
//
|
||||
// BBS boot type
|
||||
// If a device path of boot option contain a BBS node, the boot option is BBS boot type
|
||||
//
|
||||
#define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01
|
||||
|
||||
#define BDS_EFI_UNSUPPORT 0xFFFF
|
||||
|
||||
//
|
||||
// USB host controller Programming Interface.
|
||||
//
|
||||
#define PCI_CLASSC_PI_UHCI 0x00
|
||||
#define PCI_CLASSC_PI_EHCI 0x20
|
||||
|
||||
BOOLEAN
|
||||
MatchPartitionDevicePathNode (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath,
|
||||
IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
BdsExpandPartitionPartialDevicePathToFull (
|
||||
IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath
|
||||
);
|
||||
|
||||
EFI_HANDLE
|
||||
BdsLibGetBootableHandle (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
BdsLibIsValidEFIBootOptDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath,
|
||||
IN BOOLEAN CheckMedia
|
||||
);
|
||||
|
||||
UINT32
|
||||
BdsGetBootTypeFromDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
BdsLibSaveMemoryTypeInformation (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BdsLibUpdateFvFileDevicePath (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,
|
||||
IN EFI_GUID *FileGuid
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibConnectUsbDevByShortFormDP (
|
||||
IN CHAR8 HostControllerPI,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_TPL
|
||||
BdsLibGetCurrentTpl (
|
||||
VOID
|
||||
);
|
||||
|
||||
//
|
||||
// The implementation of this function is provided by Platform code.
|
||||
//
|
||||
VOID
|
||||
DevPathVendor (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN VOID *DevPath
|
||||
)
|
||||
;
|
||||
|
||||
CHAR16 *
|
||||
CatPrint (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
;
|
||||
#endif // _BDS_LIB_H_
|
|
@ -0,0 +1,98 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PlatformBdsLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Platform BDS library definition, include the file and data structure
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef __PLATFORM_BDS_LIB_H_
|
||||
#define __PLATFORM_BDS_LIB_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Protocol/Bds.h>
|
||||
#include <Protocol/GenericMemoryTest.h>
|
||||
|
||||
//
|
||||
// Bds AP Context data
|
||||
//
|
||||
#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 's', 'A')
|
||||
typedef struct _EFI_BDS_ARCH_PROTOCOL_INSTANCE EFI_BDS_ARCH_PROTOCOL_INSTANCE;
|
||||
|
||||
struct _EFI_BDS_ARCH_PROTOCOL_INSTANCE {
|
||||
UINTN Signature;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_BDS_ARCH_PROTOCOL Bds;
|
||||
//
|
||||
// Save the current boot mode
|
||||
//
|
||||
EFI_BOOT_MODE BootMode;
|
||||
//
|
||||
// Set true if boot with default settings
|
||||
//
|
||||
BOOLEAN DefaultBoot;
|
||||
//
|
||||
// The system default timeout for choose the boot option
|
||||
//
|
||||
UINT16 TimeoutDefault;
|
||||
//
|
||||
// Memory Test Level
|
||||
//
|
||||
EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel;
|
||||
};
|
||||
|
||||
//
|
||||
// Platform BDS Functions
|
||||
//
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBdsInit (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBdsPolicyBehavior (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData,
|
||||
IN LIST_ENTRY *DriverOptionList,
|
||||
IN LIST_ENTRY *BootOptionList
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
VOID
|
||||
PlatformBdsBootFail (
|
||||
IN BDS_COMMON_OPTION *Option,
|
||||
IN EFI_STATUS Status,
|
||||
IN CHAR16 *ExitData,
|
||||
IN UINTN ExitDataSize
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
PlatformBdsBootSuccess (
|
||||
IN BDS_COMMON_OPTION *Option
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatformBdsLockNonUpdatableFlash (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
#endif
|
|
@ -0,0 +1,125 @@
|
|||
/* @file
|
||||
|
||||
EDK II specific HII relative definition.
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _MDEMODULE_HII_H
|
||||
#define _MDEMODULE_HII_H
|
||||
|
||||
#define NARROW_CHAR 0xFFF0
|
||||
#define WIDE_CHAR 0xFFF1
|
||||
#define NON_BREAKING_CHAR 0xFFF2
|
||||
|
||||
#define GLYPH_WIDTH EFI_GLYPH_WIDTH
|
||||
#define GLYPH_HEIGHT EFI_GLYPH_HEIGHT
|
||||
|
||||
//
|
||||
// State defined for password statemachine
|
||||
//
|
||||
#define BROWSER_STATE_VALIDATE_PASSWORD 0
|
||||
#define BROWSER_STATE_SET_PASSWORD 1
|
||||
|
||||
|
||||
//
|
||||
// Tiano Implementation specific Device Path definition.
|
||||
//
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
UINT32 MonotonicCount;
|
||||
} HII_VENDOR_DEVICE_PATH_NODE;
|
||||
|
||||
typedef struct {
|
||||
HII_VENDOR_DEVICE_PATH_NODE Node;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} HII_VENDOR_DEVICE_PATH;
|
||||
|
||||
|
||||
//
|
||||
// References to string tokens must use this macro to enable scanning for
|
||||
// token usages.
|
||||
//
|
||||
#define STRING_TOKEN(t) t
|
||||
|
||||
//
|
||||
// GUIDed opcodes defined for Tiano
|
||||
//
|
||||
#define EFI_IFR_TIANO_GUID \
|
||||
{ 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce} }
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#define EFI_IFR_EXTEND_OP_LABEL 0x0
|
||||
#define EFI_IFR_EXTEND_OP_BANNER 0x1
|
||||
#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
|
||||
#define EFI_IFR_EXTEND_OP_CLASS 0x3
|
||||
#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
|
||||
|
||||
typedef struct _EFI_IFR_GUID_LABEL {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 Number;
|
||||
} EFI_IFR_GUID_LABEL;
|
||||
|
||||
#define EFI_IFR_BANNER_ALIGN_LEFT 0
|
||||
#define EFI_IFR_BANNER_ALIGN_CENTER 1
|
||||
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
|
||||
|
||||
typedef struct _EFI_IFR_GUID_BANNER {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 ExtendOpCode; // Extended opcode is EFI_IFR_EXTEND_OP_BANNER
|
||||
EFI_STRING_ID Title; // The string token for the banner title
|
||||
UINT16 LineNumber; // 1-based line number
|
||||
UINT8 Alignment; // left, center, or right-aligned
|
||||
} EFI_IFR_GUID_BANNER;
|
||||
|
||||
typedef struct _EFI_IFR_GUID_TIMEOUT {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 TimeOut;
|
||||
} EFI_IFR_GUID_TIMEOUT;
|
||||
|
||||
#define EFI_NON_DEVICE_CLASS 0x00
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
|
||||
typedef struct _EFI_IFR_GUID_CLASS {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 Class;
|
||||
} EFI_IFR_GUID_CLASS;
|
||||
|
||||
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
|
||||
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
|
||||
#define EFI_FRONT_PAGE_SUBCLASS 0x02
|
||||
#define EFI_SINGLE_USE_SUBCLASS 0x03
|
||||
|
||||
typedef struct _EFI_IFR_GUID_SUBCLASS {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 SubClass;
|
||||
} EFI_IFR_GUID_SUBCLASS;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,424 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BdsConnect.c
|
||||
|
||||
Abstract:
|
||||
|
||||
BDS Lib functions which relate with connect the device
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "InternalBdsLib.h"
|
||||
|
||||
|
||||
/**
|
||||
This function will connect all the system driver to controller
|
||||
first, and then special connect the default console, this make
|
||||
sure all the system controller avialbe and the platform default
|
||||
console connected.
|
||||
|
||||
None
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
BdsLibConnectAll (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// Connect the platform console first
|
||||
//
|
||||
BdsLibConnectAllDefaultConsoles ();
|
||||
|
||||
//
|
||||
// Generic way to connect all the drivers
|
||||
//
|
||||
BdsLibConnectAllDriversToAllControllers ();
|
||||
|
||||
//
|
||||
// Here we have the assumption that we have already had
|
||||
// platform default console
|
||||
//
|
||||
BdsLibConnectAllDefaultConsoles ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function will connect all the system drivers to all controllers
|
||||
first, and then connect all the console devices the system current
|
||||
have. After this we should get all the device work and console avariable
|
||||
if the system have console device.
|
||||
|
||||
None
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
BdsLibGenericConnectAll (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// Most generic way to connect all the drivers
|
||||
//
|
||||
BdsLibConnectAllDriversToAllControllers ();
|
||||
BdsLibConnectAllConsoles ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function will create all handles associate with every device
|
||||
path node. If the handle associate with one device path node can not
|
||||
be created success, then still give one chance to do the dispatch,
|
||||
which load the missing drivers if possible.
|
||||
|
||||
@param DevicePathToConnect The device path which will be connected, it can be
|
||||
a multi-instance device path
|
||||
|
||||
@retval EFI_SUCCESS All handles associate with every device path node
|
||||
have been created
|
||||
@retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
|
||||
@retval EFI_NOT_FOUND Create the handle associate with one device path
|
||||
node failed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsLibConnectDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Instance;
|
||||
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Next;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_HANDLE PreviousHandle;
|
||||
UINTN Size;
|
||||
|
||||
if (DevicePathToConnect == NULL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
DevicePath = DuplicateDevicePath (DevicePathToConnect);
|
||||
CopyOfDevicePath = DevicePath;
|
||||
if (DevicePath == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
do {
|
||||
//
|
||||
// The outer loop handles multi instance device paths.
|
||||
// Only console variables contain multiple instance device paths.
|
||||
//
|
||||
// After this call DevicePath points to the next Instance
|
||||
//
|
||||
Instance = GetNextDevicePathInstance (&DevicePath, &Size);
|
||||
Next = Instance;
|
||||
while (!IsDevicePathEndType (Next)) {
|
||||
Next = NextDevicePathNode (Next);
|
||||
}
|
||||
|
||||
SetDevicePathEndNode (Next);
|
||||
|
||||
//
|
||||
// Start the real work of connect with RemainingDevicePath
|
||||
//
|
||||
PreviousHandle = NULL;
|
||||
do {
|
||||
//
|
||||
// Find the handle that best matches the Device Path. If it is only a
|
||||
// partial match the remaining part of the device path is returned in
|
||||
// RemainingDevicePath.
|
||||
//
|
||||
RemainingDevicePath = Instance;
|
||||
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (Handle == PreviousHandle) {
|
||||
//
|
||||
// If no forward progress is made try invoking the Dispatcher.
|
||||
// A new FV may have been added to the system an new drivers
|
||||
// may now be found.
|
||||
// Status == EFI_SUCCESS means a driver was dispatched
|
||||
// Status == EFI_NOT_FOUND means no new drivers were dispatched
|
||||
//
|
||||
Status = gDS->Dispatch ();
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
PreviousHandle = Handle;
|
||||
//
|
||||
// Connect all drivers that apply to Handle and RemainingDevicePath,
|
||||
// the Recursive flag is FALSE so only one level will be expanded.
|
||||
//
|
||||
// Do not check the connect status here, if the connect controller fail,
|
||||
// then still give the chance to do dispatch, because partial
|
||||
// RemainingDevicepath may be in the new FV
|
||||
//
|
||||
// 1. If the connect fail, RemainingDevicepath and handle will not
|
||||
// change, so next time will do the dispatch, then dispatch's status
|
||||
// will take effect
|
||||
// 2. If the connect success, the RemainingDevicepath and handle will
|
||||
// change, then avoid the dispatch, we have chance to continue the
|
||||
// next connection
|
||||
//
|
||||
gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Loop until RemainingDevicePath is an empty device path
|
||||
//
|
||||
} while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));
|
||||
|
||||
} while (DevicePath != NULL);
|
||||
|
||||
if (CopyOfDevicePath != NULL) {
|
||||
gBS->FreePool (CopyOfDevicePath);
|
||||
}
|
||||
//
|
||||
// All handle with DevicePath exists in the handle database
|
||||
//
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function will connect all current system handles recursively. The
|
||||
connection will finish until every handle's child handle created if it have.
|
||||
|
||||
None
|
||||
|
||||
@retval EFI_SUCCESS All handles and it's child handle have been
|
||||
connected
|
||||
@retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsLibConnectAllEfi (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
AllHandles,
|
||||
NULL,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
gBS->FreePool (HandleBuffer);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function will disconnect all current system handles. The disconnection
|
||||
will finish until every handle have been disconnected.
|
||||
|
||||
None
|
||||
|
||||
@retval EFI_SUCCESS All handles have been disconnected
|
||||
@retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsLibDisconnectAllEfi (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// Disconnect all
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
AllHandles,
|
||||
NULL,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
|
||||
}
|
||||
|
||||
gBS->FreePool (HandleBuffer);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Connects all drivers to all controllers.
|
||||
This function make sure all the current system driver will manage
|
||||
the correspoinding controllers if have. And at the same time, make
|
||||
sure all the system controllers have driver to manage it if have.
|
||||
|
||||
None
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
BdsLibConnectAllDriversToAllControllers (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
do {
|
||||
//
|
||||
// Connect All EFI 1.10 drivers following EFI 1.10 algorithm
|
||||
//
|
||||
BdsLibConnectAllEfi ();
|
||||
|
||||
//
|
||||
// Check to see if it's possible to dispatch an more DXE drivers.
|
||||
// The BdsLibConnectAllEfi () may have made new DXE drivers show up.
|
||||
// If anything is Dispatched Status == EFI_SUCCESS and we will try
|
||||
// the connect again.
|
||||
//
|
||||
Status = gDS->Dispatch ();
|
||||
|
||||
} while (!EFI_ERROR (Status));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Connect the specific Usb device which match the short form device path,
|
||||
and whose bus is determined by Host Controller (Uhci or Ehci)
|
||||
|
||||
@param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci
|
||||
(0xFF)
|
||||
@param RemainingDevicePath a short-form device path that starts with the first
|
||||
element being a USB WWID or a USB Class device
|
||||
path
|
||||
|
||||
@return EFI_INVALID_PARAMETER
|
||||
@return EFI_SUCCESS
|
||||
@return EFI_NOT_FOUND
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsLibConnectUsbDevByShortFormDP(
|
||||
IN CHAR8 HostControllerPI,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE *HandleArray;
|
||||
UINTN HandleArrayCount;
|
||||
UINTN Index;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT8 Class[3];
|
||||
BOOLEAN AtLeastOneConnected;
|
||||
|
||||
//
|
||||
// Check the passed in parameters
|
||||
//
|
||||
if (RemainingDevicePath == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if ((DevicePathType (RemainingDevicePath) != MESSAGING_DEVICE_PATH) ||
|
||||
((DevicePathSubType (RemainingDevicePath) != MSG_USB_CLASS_DP)
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
&& (DevicePathSubType (RemainingDevicePath) != MSG_USB_WWID_DP)
|
||||
#endif
|
||||
)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (HostControllerPI != 0xFF &&
|
||||
HostControllerPI != 0x00 &&
|
||||
HostControllerPI != 0x20) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Find the usb host controller firstly, then connect with the remaining device path
|
||||
//
|
||||
AtLeastOneConnected = FALSE;
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
NULL,
|
||||
&HandleArrayCount,
|
||||
&HandleArray
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
for (Index = 0; Index < HandleArrayCount; Index++) {
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleArray[Index],
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Check whether the Pci device is the wanted usb host controller
|
||||
//
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if ((PCI_CLASS_SERIAL == Class[2]) &&
|
||||
(PCI_CLASS_SERIAL_USB == Class[1])) {
|
||||
if (HostControllerPI == Class[0] || HostControllerPI == 0xFF) {
|
||||
Status = gBS->ConnectController (
|
||||
HandleArray[Index],
|
||||
NULL,
|
||||
RemainingDevicePath,
|
||||
FALSE
|
||||
);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
AtLeastOneConnected = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AtLeastOneConnected) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
|
@ -0,0 +1,399 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BdsConsole.c
|
||||
|
||||
Abstract:
|
||||
|
||||
BDS Lib functions which contain all the code to connect console device
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "InternalBdsLib.h"
|
||||
//@MT:#include "EfiPrintLib.h"
|
||||
|
||||
BOOLEAN
|
||||
IsNvNeed (
|
||||
IN CHAR16 *ConVarName
|
||||
)
|
||||
{
|
||||
CHAR16 *Ptr;
|
||||
|
||||
Ptr = ConVarName;
|
||||
|
||||
//
|
||||
// If the variable includes "Dev" at last, we consider
|
||||
// it does not support NV attribute.
|
||||
//
|
||||
while (*Ptr) {
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
if ((*(Ptr-3) == 'D') && (*(Ptr-2) == 'e') && (*(Ptr-1) == 'v')) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function update console variable based on ConVarName, it can
|
||||
add or remove one specific console device path from the variable
|
||||
|
||||
@param ConVarName Console related variable name, ConIn, ConOut,
|
||||
ErrOut.
|
||||
@param CustomizedConDevicePath The console device path which will be added to
|
||||
the console variable ConVarName, this parameter
|
||||
can not be multi-instance.
|
||||
@param ExclusiveDevicePath The console device path which will be removed
|
||||
from the console variable ConVarName, this
|
||||
parameter can not be multi-instance.
|
||||
|
||||
@retval EFI_UNSUPPORTED Add or remove the same device path.
|
||||
@retval EFI_SUCCESS Success add or remove the device path from the
|
||||
console variable.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsLibUpdateConsoleVariable (
|
||||
IN CHAR16 *ConVarName,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *VarConsole;
|
||||
UINTN DevicePathSize;
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
|
||||
UINT32 Attributes;
|
||||
|
||||
VarConsole = NULL;
|
||||
DevicePathSize = 0;
|
||||
|
||||
//
|
||||
// Notes: check the device path point, here should check
|
||||
// with compare memory
|
||||
//
|
||||
if (CustomizedConDevicePath == ExclusiveDevicePath) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Delete the ExclusiveDevicePath from current default console
|
||||
//
|
||||
VarConsole = BdsLibGetVariableAndSize (
|
||||
ConVarName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&DevicePathSize
|
||||
);
|
||||
|
||||
//
|
||||
// Initialize NewDevicePath
|
||||
//
|
||||
NewDevicePath = VarConsole;
|
||||
|
||||
//
|
||||
// If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.
|
||||
// In the end, NewDevicePath is the final device path.
|
||||
//
|
||||
if (ExclusiveDevicePath != NULL && VarConsole != NULL) {
|
||||
NewDevicePath = BdsLibDelPartMatchInstance (VarConsole, ExclusiveDevicePath);
|
||||
}
|
||||
//
|
||||
// Try to append customized device path to NewDevicePath.
|
||||
//
|
||||
if (CustomizedConDevicePath != NULL) {
|
||||
if (!BdsLibMatchDevicePaths (NewDevicePath, CustomizedConDevicePath)) {
|
||||
//
|
||||
// Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.
|
||||
//
|
||||
NewDevicePath = BdsLibDelPartMatchInstance (NewDevicePath, CustomizedConDevicePath);
|
||||
//
|
||||
// In the first check, the default console variable will be _ModuleEntryPoint,
|
||||
// just append current customized device path
|
||||
//
|
||||
TempNewDevicePath = NewDevicePath;
|
||||
NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);
|
||||
SafeFreePool(TempNewDevicePath);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.
|
||||
//
|
||||
if (IsNvNeed(ConVarName)) {
|
||||
//
|
||||
// ConVarName has NV attribute.
|
||||
//
|
||||
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
|
||||
} else {
|
||||
//
|
||||
// ConVarName does not have NV attribute.
|
||||
//
|
||||
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Finally, Update the variable of the default console by NewDevicePath
|
||||
//
|
||||
gRT->SetVariable (
|
||||
ConVarName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
Attributes,
|
||||
GetDevicePathSize (NewDevicePath),
|
||||
NewDevicePath
|
||||
);
|
||||
|
||||
if (VarConsole == NewDevicePath) {
|
||||
SafeFreePool(VarConsole);
|
||||
} else {
|
||||
SafeFreePool(VarConsole);
|
||||
SafeFreePool(NewDevicePath);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Connect the console device base on the variable ConVarName, if
|
||||
device path of the ConVarName is multi-instance device path, if
|
||||
anyone of the instances is connected success, then this function
|
||||
will return success.
|
||||
|
||||
@param ConVarName Console related variable name, ConIn, ConOut,
|
||||
ErrOut.
|
||||
|
||||
@retval EFI_NOT_FOUND There is not any console devices connected
|
||||
success
|
||||
@retval EFI_SUCCESS Success connect any one instance of the console
|
||||
device path base on the variable ConVarName.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsLibConnectConsoleVariable (
|
||||
IN CHAR16 *ConVarName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *StartDevicePath;
|
||||
UINTN VariableSize;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Instance;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Next;
|
||||
EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
|
||||
UINTN Size;
|
||||
BOOLEAN DeviceExist;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
DeviceExist = FALSE;
|
||||
|
||||
//
|
||||
// Check if the console variable exist
|
||||
//
|
||||
StartDevicePath = BdsLibGetVariableAndSize (
|
||||
ConVarName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&VariableSize
|
||||
);
|
||||
if (StartDevicePath == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
CopyOfDevicePath = StartDevicePath;
|
||||
do {
|
||||
//
|
||||
// Check every instance of the console variable
|
||||
//
|
||||
Instance = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);
|
||||
Next = Instance;
|
||||
while (!IsDevicePathEndType (Next)) {
|
||||
Next = NextDevicePathNode (Next);
|
||||
}
|
||||
|
||||
SetDevicePathEndNode (Next);
|
||||
//
|
||||
// Check USB1.1 console
|
||||
//
|
||||
if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) &&
|
||||
((DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
|| (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
|
||||
#endif
|
||||
)) {
|
||||
//
|
||||
// Check the Usb console in Usb2.0 bus firstly, then Usb1.1 bus
|
||||
//
|
||||
Status = BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_EHCI, Instance);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DeviceExist = TRUE;
|
||||
}
|
||||
|
||||
Status = BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_UHCI, Instance);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DeviceExist = TRUE;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Connect the instance device path
|
||||
//
|
||||
Status = BdsLibConnectDevicePath (Instance);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Delete the instance from the console varialbe
|
||||
//
|
||||
BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);
|
||||
} else {
|
||||
DeviceExist = TRUE;
|
||||
}
|
||||
}
|
||||
SafeFreePool(Instance);
|
||||
} while (CopyOfDevicePath != NULL);
|
||||
|
||||
gBS->FreePool (StartDevicePath);
|
||||
|
||||
if (DeviceExist == FALSE) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function will search every simpletxt devive in current system,
|
||||
and make every simpletxt device as pertantial console device.
|
||||
|
||||
None
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
BdsLibConnectAllConsoles (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
|
||||
UINTN HandleCount;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
|
||||
Index = 0;
|
||||
HandleCount = 0;
|
||||
HandleBuffer = NULL;
|
||||
ConDevicePath = NULL;
|
||||
|
||||
//
|
||||
// Update all the console varables
|
||||
//
|
||||
gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ConDevicePath
|
||||
);
|
||||
BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);
|
||||
}
|
||||
|
||||
SafeFreePool(HandleBuffer);
|
||||
|
||||
gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ConDevicePath
|
||||
);
|
||||
BdsLibUpdateConsoleVariable (L"ConOut", ConDevicePath, NULL);
|
||||
BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);
|
||||
}
|
||||
|
||||
SafeFreePool(HandleBuffer);
|
||||
|
||||
//
|
||||
// Connect all console variables
|
||||
//
|
||||
BdsLibConnectAllDefaultConsoles ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function will connect console device base on the console
|
||||
device variable ConIn, ConOut and ErrOut.
|
||||
|
||||
None
|
||||
|
||||
@retval EFI_SUCCESS At least one of the ConIn and ConOut device have
|
||||
been connected success.
|
||||
@retval EFI_STATUS Return the status of
|
||||
BdsLibConnectConsoleVariable ().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsLibConnectAllDefaultConsoles (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Connect all default console variables
|
||||
//
|
||||
|
||||
//
|
||||
// It seems impossible not to have any ConOut device on platform,
|
||||
// so we check the status here.
|
||||
//
|
||||
Status = BdsLibConnectConsoleVariable (L"ConOut");
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Insert the performance probe for Console Out
|
||||
//
|
||||
PERF_START (NULL, "ConOut", "BDS", 1);
|
||||
PERF_END (NULL, "ConOut", "BDS", 0);
|
||||
|
||||
//
|
||||
// Because possibly the platform is legacy free, in such case,
|
||||
// ConIn devices (Serial Port and PS2 Keyboard ) does not exist,
|
||||
// so we need not check the status.
|
||||
//
|
||||
BdsLibConnectConsoleVariable (L"ConIn");
|
||||
|
||||
//
|
||||
// The _ModuleEntryPoint err out var is legal.
|
||||
//
|
||||
BdsLibConnectConsoleVariable (L"ErrOut");
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,35 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BmMachine.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Boot Manager Machine type
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BM_MACHINE_H
|
||||
#define _BM_MACHINE_H
|
||||
|
||||
//
|
||||
// NOTE: This is not defined in UEFI spec.
|
||||
//
|
||||
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,119 @@
|
|||
#/** @file
|
||||
# Component name for module GenericBdsLib
|
||||
#
|
||||
# FIX ME!
|
||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = GenericBdsLib
|
||||
FILE_GUID = e405ec31-ccaa-4dd4-83e8-0aec01703f7e
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = GenericBdsLib|DXE_DRIVER
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x0002000A
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
DevicePath.c
|
||||
Performance.c
|
||||
BdsConnect.c
|
||||
BdsMisc.c
|
||||
R8Lib.c
|
||||
BdsConsole.c
|
||||
BdsBoot.c
|
||||
InternalBdsLib.h
|
||||
R8Lib.h
|
||||
|
||||
[Sources.Ia32]
|
||||
Ia32\ClearDr.asm
|
||||
Ia32\BmMachine.h
|
||||
|
||||
[Sources.X64]
|
||||
x64\ClearDr.asm
|
||||
x64\BmMachine.h
|
||||
|
||||
[Sources.IPF]
|
||||
Ipf\ShadowRom.c
|
||||
Ipf\BmMachine.h
|
||||
|
||||
[Sources.EBC]
|
||||
Ebc\BmMachine.h
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
#
|
||||
#This dependency is because of gEfiLegacyBiosProtocolGuid. It may be removed if a Library class is created to
|
||||
#abstract away definition in Framework specification or PI spec incorporates the Legacy Booting Protocols.
|
||||
#
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
PeCoffGetEntryPointLib
|
||||
BaseLib
|
||||
HobLib
|
||||
UefiRuntimeServicesTableLib
|
||||
DxeServicesTableLib
|
||||
MemoryAllocationLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PrintLib
|
||||
PcdLib
|
||||
PerformanceLib
|
||||
TimerLib
|
||||
|
||||
|
||||
[Guids]
|
||||
gEfiVT100PlusGuid # ALWAYS_CONSUMED
|
||||
gEfiMemoryTypeInformationGuid # ALWAYS_CONSUMED
|
||||
gEfiVTUTF8Guid # ALWAYS_CONSUMED
|
||||
gEfiHobListGuid # ALWAYS_CONSUMED
|
||||
gEfiShellFileGuid # ALWAYS_CONSUMED
|
||||
gEfiGlobalVariableGuid # ALWAYS_CONSUMED
|
||||
gEfiVT100Guid # ALWAYS_CONSUMED
|
||||
gEfiFileInfoGuid # ALWAYS_CONSUMED
|
||||
gEfiPcAnsiGuid # ALWAYS_CONSUMED
|
||||
gEfiGenericPlatformVariableGuid # ALWAYS_CONSUMED
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiSimpleFileSystemProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSimpleTextOutProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDevicePathToTextProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDebugPortProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSimpleTextInProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiBlockIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformBootTimeOutDefault
|
|
@ -0,0 +1,159 @@
|
|||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>GenericBdsLib</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>e405ec31-ccaa-4dd4-83e8-0aec01703f7e</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component name for module GenericBdsLib</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2007, Intel Corporation. All rights reserved.</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>GenericBdsLib</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DxeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>HobLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename SupArchList="IPF">Ipf\BmMachine.h</Filename>
|
||||
<Filename>R8Lib.h</Filename>
|
||||
<Filename SupArchList="X64">x64\BmMachine.h</Filename>
|
||||
<Filename>BdsLib.h</Filename>
|
||||
<Filename>BdsBoot.c</Filename>
|
||||
<Filename SupArchList="IA32">Ia32\BmMachine.h</Filename>
|
||||
<Filename SupArchList="X64">x64\ClearDr.asm</Filename>
|
||||
<Filename SupArchList="EBC">Ebc\BmMachine.h</Filename>
|
||||
<Filename>BdsConsole.c</Filename>
|
||||
<Filename>R8Lib.c</Filename>
|
||||
<Filename SupArchList="IA32">Ia32\ClearDr.asm</Filename>
|
||||
<Filename>BdsMisc.c</Filename>
|
||||
<Filename>BdsConnect.c</Filename>
|
||||
<Filename>Performance.c</Filename>
|
||||
<Filename>DevicePath.c</Filename>
|
||||
<Filename SupArchList="IPF">Ipf\ShadowRom.c</Filename>
|
||||
<Filename>Performance.h</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiLegacyBiosProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDevicePathToTextProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiPcAnsiGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiFileInfoGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiVT100Guid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiGlobalVariableGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiShellFileGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiHobListGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiVTUTF8Guid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiMemoryTypeInformationGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiVT100PlusGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,34 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BmMachine.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Boot Manager Machine type
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BM_MACHINE_H
|
||||
#define _BM_MACHINE_H
|
||||
|
||||
//@MT:#include "CpuIA32.h"
|
||||
|
||||
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA32.EFI"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
title ClearDr.asm
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2004, Intel Corporation
|
||||
; All rights reserved. This program and the accompanying materials
|
||||
; are licensed and made available under the terms and conditions of the BSD License
|
||||
; which accompanies this distribution. The full text of the license may be found at
|
||||
; http://opensource.org/licenses/bsd-license.php
|
||||
;
|
||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; ClearDr.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Clear dr0 dr1 register
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.686
|
||||
.MODEL FLAT,C
|
||||
.CODE
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; ClearDebugRegisters (
|
||||
; VOID
|
||||
; )
|
||||
;------------------------------------------------------------------------------
|
||||
ClearDebugRegisters PROC PUBLIC
|
||||
push eax
|
||||
xor eax, eax
|
||||
mov dr0, eax
|
||||
mov dr1, eax
|
||||
pop eax
|
||||
ret
|
||||
ClearDebugRegisters ENDP
|
||||
|
||||
END
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
InternalBdsLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
BDS library definition, include the file and data structure
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _INTERNAL_BDS_LIB_H_
|
||||
#define _INTERNAL_BDS_LIB_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <IndustryStandard/Pci22.h>
|
||||
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/Cpu.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
#include <Protocol/DebugPort.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Protocol/LegacyBios.h>
|
||||
#include <Protocol/SimpleTextOut.h>
|
||||
#include <Protocol/SimpleNetwork.h>
|
||||
#include <Protocol/DevicePathToText.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/AcpiS3Save.h>
|
||||
#include <Protocol/Performance.h>
|
||||
|
||||
#include <Guid/MemoryTypeInformation.h>
|
||||
#include <Guid/FileInfo.h>
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Guid/PcAnsi.h>
|
||||
#include <Guid/ShellFile.h>
|
||||
#include <Guid/HobList.h>
|
||||
#include <Guid/GenericPlatformVariable.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/DxeServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/PerformanceLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/IfrSupportLib.h>
|
||||
#include <Library/PeCoffGetEntryPointLib.h>
|
||||
#include <Library/GenericBdsLib.h>
|
||||
#include <Library/TimerLib.h>
|
||||
|
||||
#include "BmMachine.h"
|
||||
|
||||
#include "R8Lib.h"
|
||||
|
||||
#define PERFORMANCE_SIGNATURE EFI_SIGNATURE_32 ('P', 'e', 'r', 'f')
|
||||
#define PERF_TOKEN_SIZE 28
|
||||
#define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)
|
||||
#define PERF_PEI_ENTRY_MAX_NUM 50
|
||||
|
||||
typedef struct {
|
||||
CHAR8 Token[PERF_TOKEN_SIZE];
|
||||
UINT32 Duration;
|
||||
} PERF_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT64 BootToOs;
|
||||
UINT64 S3Resume;
|
||||
UINT32 S3EntryNum;
|
||||
PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];
|
||||
UINT64 CpuFreq;
|
||||
UINT64 BDSRaw;
|
||||
UINT32 Count;
|
||||
UINT32 Signiture;
|
||||
} PERF_HEADER;
|
||||
|
||||
VOID
|
||||
WriteBootToOsPerformanceData (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // _BDS_LIB_H_
|
|
@ -0,0 +1,34 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BmMachine.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Boot Manager Machine type
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BM_MACHINE_H
|
||||
#define _BM_MACHINE_H
|
||||
|
||||
//@MT:#include "CpuIA64.h"
|
||||
|
||||
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA64.EFI"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,56 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
ShadowRom.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Shadow all option rom
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
//@MT:#include "Tiano.h"
|
||||
//@MT:#include "EfiDriverLib.h"
|
||||
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (LegacyBios)
|
||||
|
||||
#include "InternalBdsLib.h"
|
||||
|
||||
UINT8 mShadowRomFlag = 0;
|
||||
|
||||
VOID
|
||||
ShadowAllOptionRom()
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||
//
|
||||
// Rom shadow only do once.
|
||||
//
|
||||
if (mShadowRomFlag == 0) {
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiLegacyBiosProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &LegacyBios
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
LegacyBios->PrepareToBootEfi (LegacyBios, NULL, NULL);
|
||||
}
|
||||
|
||||
mShadowRomFlag = 1;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
|
@ -0,0 +1,326 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Performance.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file include the file which can help to get the system
|
||||
performance, all the function will only include if the performance
|
||||
switch is set.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "InternalBdsLib.h"
|
||||
|
||||
STATIC PERF_HEADER mPerfHeader;
|
||||
STATIC PERF_DATA mPerfData;
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
GetShortPdbFileName (
|
||||
CHAR8 *PdbFileName,
|
||||
CHAR8 *GaugeString
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index1;
|
||||
UINTN StartIndex;
|
||||
UINTN EndIndex;
|
||||
|
||||
if (PdbFileName == NULL) {
|
||||
AsciiStrCpy (GaugeString, " ");
|
||||
} else {
|
||||
StartIndex = 0;
|
||||
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
|
||||
;
|
||||
|
||||
for (Index = 0; PdbFileName[Index] != 0; Index++) {
|
||||
if (PdbFileName[Index] == '\\') {
|
||||
StartIndex = Index + 1;
|
||||
}
|
||||
|
||||
if (PdbFileName[Index] == '.') {
|
||||
EndIndex = Index;
|
||||
}
|
||||
}
|
||||
|
||||
Index1 = 0;
|
||||
for (Index = StartIndex; Index < EndIndex; Index++) {
|
||||
GaugeString[Index1] = PdbFileName[Index];
|
||||
Index1++;
|
||||
if (Index1 == PERF_TOKEN_LENGTH - 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GaugeString[Index1] = 0;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
GetNameFromHandle (
|
||||
IN EFI_HANDLE Handle,
|
||||
OUT CHAR8 *GaugeString
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *Image;
|
||||
CHAR8 *PdbFileName;
|
||||
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
|
||||
|
||||
AsciiStrCpy (GaugeString, " ");
|
||||
|
||||
//
|
||||
// Get handle name from image protocol
|
||||
//
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &Image
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **) &DriverBinding,
|
||||
NULL,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Get handle name from image protocol
|
||||
//
|
||||
Status = gBS->HandleProtocol (
|
||||
DriverBinding->ImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &Image
|
||||
);
|
||||
}
|
||||
|
||||
PdbFileName = PeCoffLoaderGetPdbPointer (Image->ImageBase);
|
||||
|
||||
if (PdbFileName != NULL) {
|
||||
GetShortPdbFileName (PdbFileName, GaugeString);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID
|
||||
WriteBootToOsPerformanceData (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Allocates a block of memory and writes performance data of booting to OS into it.
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase;
|
||||
UINT32 AcpiLowMemoryLength;
|
||||
UINT32 LimitCount;
|
||||
EFI_HANDLE *Handles;
|
||||
UINTN NoHandles;
|
||||
CHAR8 GaugeString[PERF_TOKEN_LENGTH];
|
||||
UINT8 *Ptr;
|
||||
UINT32 Index;
|
||||
UINT64 Ticker;
|
||||
UINT64 Freq;
|
||||
UINT32 Duration;
|
||||
UINTN LogEntryKey;
|
||||
CONST VOID *Handle;
|
||||
CONST CHAR8 *Token;
|
||||
CONST CHAR8 *Module;
|
||||
UINT64 StartTicker;
|
||||
UINT64 EndTicker;
|
||||
UINT64 StartValue;
|
||||
UINT64 EndValue;
|
||||
BOOLEAN CountUp;
|
||||
|
||||
//
|
||||
// Retrive time stamp count as early as possilbe
|
||||
//
|
||||
Ticker = GetPerformanceCounter ();
|
||||
|
||||
Freq = GetPerformanceCounterProperties (&StartValue, &EndValue);
|
||||
|
||||
Freq = DivU64x32 (Freq, 1000);
|
||||
|
||||
mPerfHeader.CpuFreq = Freq;
|
||||
|
||||
//
|
||||
// Record BDS raw performance data
|
||||
//
|
||||
if (EndValue >= StartValue) {
|
||||
mPerfHeader.BDSRaw = Ticker - StartValue;
|
||||
CountUp = TRUE;
|
||||
} else {
|
||||
mPerfHeader.BDSRaw = StartValue - Ticker;
|
||||
CountUp = FALSE;
|
||||
}
|
||||
|
||||
AcpiLowMemoryLength = 0x2000;
|
||||
|
||||
//
|
||||
// Allocate a block of memory that contain performance data to OS
|
||||
//
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiACPIReclaimMemory,
|
||||
EFI_SIZE_TO_PAGES (AcpiLowMemoryLength),
|
||||
&AcpiLowMemoryBase
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
Ptr = (UINT8 *) ((UINT32) AcpiLowMemoryBase + sizeof (PERF_HEADER));
|
||||
LimitCount = (AcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);
|
||||
|
||||
//
|
||||
// Put Detailed performance data into memory
|
||||
//
|
||||
Handles = NULL;
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
AllHandles,
|
||||
NULL,
|
||||
NULL,
|
||||
&NoHandles,
|
||||
&Handles
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePages (AcpiLowMemoryBase, 1);
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Get DXE drivers performance
|
||||
//
|
||||
for (Index = 0; Index < NoHandles; Index++) {
|
||||
Ticker = 0;
|
||||
LogEntryKey = 0;
|
||||
while ((LogEntryKey = GetPerformanceMeasurement (
|
||||
LogEntryKey,
|
||||
&Handle,
|
||||
&Token,
|
||||
&Module,
|
||||
&StartTicker,
|
||||
&EndTicker)) != 0) {
|
||||
if ((Handle == Handles[Index]) && (EndTicker != 0)) {
|
||||
Ticker += CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker);
|
||||
}
|
||||
}
|
||||
|
||||
Duration = (UINT32) DivU64x32 (Ticker, (UINT32) Freq);
|
||||
|
||||
if (Duration > 0) {
|
||||
|
||||
GetNameFromHandle (Handles[Index], GaugeString);
|
||||
|
||||
AsciiStrCpy (mPerfData.Token, GaugeString);
|
||||
mPerfData.Duration = Duration;
|
||||
|
||||
CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
|
||||
Ptr += sizeof (PERF_DATA);
|
||||
|
||||
mPerfHeader.Count++;
|
||||
if (mPerfHeader.Count == LimitCount) {
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (Handles);
|
||||
|
||||
//
|
||||
// Get inserted performance data
|
||||
//
|
||||
LogEntryKey = 0;
|
||||
while ((LogEntryKey = GetPerformanceMeasurement (
|
||||
LogEntryKey,
|
||||
&Handle,
|
||||
&Token,
|
||||
&Module,
|
||||
&StartTicker,
|
||||
&EndTicker)) != 0) {
|
||||
if (Handle == NULL && EndTicker != 0) {
|
||||
|
||||
ZeroMem (&mPerfData, sizeof (PERF_DATA));
|
||||
|
||||
AsciiStrnCpy (mPerfData.Token, Token, PERF_TOKEN_LENGTH);
|
||||
Ticker = CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker);
|
||||
|
||||
mPerfData.Duration = (UINT32) DivU64x32 (Ticker, (UINT32) Freq);
|
||||
|
||||
CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
|
||||
Ptr += sizeof (PERF_DATA);
|
||||
|
||||
mPerfHeader.Count++;
|
||||
if (mPerfHeader.Count == LimitCount) {
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Done:
|
||||
|
||||
mPerfHeader.Signiture = PERFORMANCE_SIGNATURE;
|
||||
|
||||
//
|
||||
// Put performance data to memory
|
||||
//
|
||||
CopyMem (
|
||||
(UINTN *) (UINTN) AcpiLowMemoryBase,
|
||||
&mPerfHeader,
|
||||
sizeof (PERF_HEADER)
|
||||
);
|
||||
|
||||
gRT->SetVariable (
|
||||
L"PerfDataMemAddr",
|
||||
&gEfiGenericPlatformVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (EFI_PHYSICAL_ADDRESS),
|
||||
&AcpiLowMemoryBase
|
||||
);
|
||||
|
||||
return ;
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
/**@file
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "InternalBdsLib.h"
|
||||
|
||||
/**
|
||||
Get current boot mode.
|
||||
|
||||
@param HobStart Start pointer of hob list
|
||||
@param BootMode Current boot mode recorded in PHIT hob
|
||||
|
||||
@retval EFI_NOT_FOUND Invalid hob header
|
||||
@retval EFI_SUCCESS Boot mode found
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_GetHobBootMode (
|
||||
IN VOID *HobStart,
|
||||
OUT EFI_BOOT_MODE *BootMode
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is simply obsolete.
|
||||
// Include the source code to user code.
|
||||
// In fact, since EFI_HANDOFF_HOB must be the first Hob,
|
||||
// the following code can retrieve boot mode.
|
||||
//
|
||||
// EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
||||
//
|
||||
// HandOffHob = GetHobList ();
|
||||
// ASSERT (HandOffHob->Header.HobType == EFI_HOB_TYPE_HANDOFF);
|
||||
//
|
||||
// BootMode = HandOffHob->BootMode;
|
||||
//
|
||||
EFI_PEI_HOB_POINTERS Hob;
|
||||
|
||||
Hob.Raw = HobStart;
|
||||
if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
*BootMode = Hob.HandoffInformationTable->BootMode;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get the next guid hob.
|
||||
|
||||
@param HobStart A pointer to the start hob.
|
||||
@param Guid A pointer to a guid.
|
||||
@param Buffer A pointer to the buffer.
|
||||
@param BufferSize Buffer size.
|
||||
|
||||
@retval EFI_NOT_FOUND Next Guid hob not found
|
||||
@retval EFI_SUCCESS Next Guid hob found and data for this Guid got
|
||||
@retval EFI_INVALID_PARAMETER invalid parameter
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_GetNextGuidHob (
|
||||
IN OUT VOID **HobStart,
|
||||
IN EFI_GUID * Guid,
|
||||
OUT VOID **Buffer,
|
||||
OUT UINTN *BufferSize OPTIONAL
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is changed substantially with R9 counerpart GetNextGuidHob ().
|
||||
// 1. R9 GetNextGuidHob has two parameters and returns the matched GUID HOB from the StartHob.
|
||||
// 2. R9 GetNextGuidHob does not strip the HOB header, so caller is required to apply
|
||||
// GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its
|
||||
// size info respectively.
|
||||
// 3. this function does not skip the starting HOB pointer unconditionally:
|
||||
// it returns HobStart back if HobStart itself meets the requirement;
|
||||
// caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
|
||||
//
|
||||
EFI_PEI_HOB_POINTERS GuidHob;
|
||||
|
||||
if (Buffer == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
GuidHob.Raw = GetNextGuidHob (Guid, *HobStart);
|
||||
if (GuidHob.Raw == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
*Buffer = GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
if (BufferSize != NULL) {
|
||||
*BufferSize = GET_GUID_HOB_DATA_SIZE (GuidHob.Guid);
|
||||
}
|
||||
|
||||
*HobStart = GET_NEXT_HOB (GuidHob);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**@file
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get current boot mode.
|
||||
|
||||
@param HobStart Start pointer of hob list
|
||||
@param BootMode Current boot mode recorded in PHIT hob
|
||||
|
||||
@retval EFI_NOT_FOUND Invalid hob header
|
||||
@retval EFI_SUCCESS Boot mode found
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_GetHobBootMode (
|
||||
IN VOID *HobStart,
|
||||
OUT EFI_BOOT_MODE *BootMode
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get the next guid hob.
|
||||
|
||||
@param HobStart A pointer to the start hob.
|
||||
@param Guid A pointer to a guid.
|
||||
@param Buffer A pointer to the buffer.
|
||||
@param BufferSize Buffer size.
|
||||
|
||||
@retval EFI_NOT_FOUND Next Guid hob not found
|
||||
@retval EFI_SUCCESS Next Guid hob found and data for this Guid got
|
||||
@retval EFI_INVALID_PARAMETER invalid parameter
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_GetNextGuidHob (
|
||||
IN OUT VOID **HobStart,
|
||||
IN EFI_GUID * Guid,
|
||||
OUT VOID **Buffer,
|
||||
OUT UINTN *BufferSize OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2005 - 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BmMachine.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Boot Manager Machine type
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _BM_MACHINE_H
|
||||
#define _BM_MACHINE_H
|
||||
|
||||
//@MT:#include "CpuIA32.h"
|
||||
|
||||
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTX64.EFI"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,41 @@
|
|||
title ClearDr.asm
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2005, Intel Corporation
|
||||
; All rights reserved. This program and the accompanying materials
|
||||
; are licensed and made available under the terms and conditions of the BSD License
|
||||
; which accompanies this distribution. The full text of the license may be found at
|
||||
; http://opensource.org/licenses/bsd-license.php
|
||||
;
|
||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; ClearDr.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Clear dr0 dr1 register
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
text SEGMENT
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; ClearDebugRegisters (
|
||||
; VOID
|
||||
; )
|
||||
;------------------------------------------------------------------------------
|
||||
ClearDebugRegisters PROC PUBLIC
|
||||
push rax
|
||||
xor rax, rax
|
||||
mov dr0, rax
|
||||
mov dr1, rax
|
||||
pop rax
|
||||
ret
|
||||
ClearDebugRegisters ENDP
|
||||
|
||||
END
|
||||
|
|
@ -0,0 +1,892 @@
|
|||
/**@file
|
||||
Support for Basic Graphics operations.
|
||||
|
||||
BugBug: Currently *.BMP files are supported. This will be replaced
|
||||
when Tiano graphics format is supported.
|
||||
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/SimpleTextOut.h>
|
||||
#include <Protocol/OEMBadging.h>
|
||||
#include <Protocol/ConsoleControl.h>
|
||||
#include <Protocol/GraphicsOutput.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/UgaDraw.h>
|
||||
#include <Protocol/HiiFont.h>
|
||||
#include <Protocol/HiiImage.h>
|
||||
|
||||
#include <Guid/Bmp.h>
|
||||
|
||||
#include <Library/GraphicsLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DxePiLib.h>
|
||||
|
||||
STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
|
||||
{ 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x98, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x98, 0x00, 0x00 },
|
||||
{ 0x98, 0x98, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x98, 0x00 },
|
||||
{ 0x98, 0x00, 0x98, 0x00 },
|
||||
{ 0x00, 0x98, 0x98, 0x00 },
|
||||
{ 0x98, 0x98, 0x98, 0x00 },
|
||||
{ 0x10, 0x10, 0x10, 0x00 },
|
||||
{ 0xff, 0x10, 0x10, 0x00 },
|
||||
{ 0x10, 0xff, 0x10, 0x00 },
|
||||
{ 0xff, 0xff, 0x10, 0x00 },
|
||||
{ 0x10, 0x10, 0xff, 0x00 },
|
||||
{ 0xf0, 0x10, 0xff, 0x00 },
|
||||
{ 0x10, 0xff, 0xff, 0x00 },
|
||||
{ 0xff, 0xff, 0xff, 0x00 }
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
GetGraphicsBitMapFromFV (
|
||||
IN EFI_GUID *FileNameGuid,
|
||||
OUT VOID **Image,
|
||||
OUT UINTN *ImageSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Return the graphics image file named FileNameGuid into Image and return it's
|
||||
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
|
||||
file name.
|
||||
|
||||
Arguments:
|
||||
|
||||
FileNameGuid - File Name of graphics file in the FV(s).
|
||||
|
||||
Image - Pointer to pointer to return graphics image. If NULL, a
|
||||
buffer will be allocated.
|
||||
|
||||
ImageSize - Size of the graphics Image in bytes. Zero if no image found.
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Image and ImageSize are valid.
|
||||
EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
|
||||
EFI_NOT_FOUND - FileNameGuid not found
|
||||
|
||||
--*/
|
||||
{
|
||||
return GetGraphicsBitMapFromFVEx (NULL, FileNameGuid, Image, ImageSize);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetGraphicsBitMapFromFVEx (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_GUID *FileNameGuid,
|
||||
OUT VOID **Image,
|
||||
OUT UINTN *ImageSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Return the graphics image file named FileNameGuid into Image and return it's
|
||||
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
|
||||
file name.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - The driver image handle of the caller. The parameter is used to
|
||||
optimize the loading of the image file so that the FV from which
|
||||
the driver image is loaded will be tried first.
|
||||
|
||||
FileNameGuid - File Name of graphics file in the FV(s).
|
||||
|
||||
Image - Pointer to pointer to return graphics image. If NULL, a
|
||||
buffer will be allocated.
|
||||
|
||||
ImageSize - Size of the graphics Image in bytes. Zero if no image found.
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Image and ImageSize are valid.
|
||||
EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
|
||||
EFI_NOT_FOUND - FileNameGuid not found
|
||||
|
||||
--*/
|
||||
{
|
||||
return PiLibGetSectionFromCurrentFv (
|
||||
FileNameGuid,
|
||||
EFI_SECTION_RAW,
|
||||
0,
|
||||
Image,
|
||||
ImageSize
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
ConvertBmpToGopBlt (
|
||||
IN VOID *BmpImage,
|
||||
IN UINTN BmpImageSize,
|
||||
IN OUT VOID **GopBlt,
|
||||
IN OUT UINTN *GopBltSize,
|
||||
OUT UINTN *PixelHeight,
|
||||
OUT UINTN *PixelWidth
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert a *.BMP graphics image to a GOP/UGA blt buffer. If a NULL Blt buffer
|
||||
is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
|
||||
buffer is passed in it will be used if it is big enough.
|
||||
|
||||
Arguments:
|
||||
|
||||
BmpImage - Pointer to BMP file
|
||||
|
||||
BmpImageSize - Number of bytes in BmpImage
|
||||
|
||||
GopBlt - Buffer containing GOP version of BmpImage.
|
||||
|
||||
GopBltSize - Size of GopBlt in bytes.
|
||||
|
||||
PixelHeight - Height of GopBlt/BmpImage in pixels
|
||||
|
||||
PixelWidth - Width of GopBlt/BmpImage in pixels
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GopBlt and GopBltSize are returned.
|
||||
EFI_UNSUPPORTED - BmpImage is not a valid *.BMP image
|
||||
EFI_BUFFER_TOO_SMALL - The passed in GopBlt buffer is not big enough.
|
||||
GopBltSize will contain the required size.
|
||||
EFI_OUT_OF_RESOURCES - No enough buffer to allocate
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 *Image;
|
||||
UINT8 *ImageHeader;
|
||||
BMP_IMAGE_HEADER *BmpHeader;
|
||||
BMP_COLOR_MAP *BmpColorMap;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
|
||||
UINTN BltBufferSize;
|
||||
UINTN Index;
|
||||
UINTN Height;
|
||||
UINTN Width;
|
||||
UINTN ImageIndex;
|
||||
BOOLEAN IsAllocated;
|
||||
|
||||
BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;
|
||||
if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (BmpHeader->CompressionType != 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Color Map offset in the image.
|
||||
//
|
||||
Image = BmpImage;
|
||||
BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));
|
||||
|
||||
//
|
||||
// Calculate graphics image data address in the image
|
||||
//
|
||||
Image = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
|
||||
ImageHeader = Image;
|
||||
|
||||
BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
|
||||
IsAllocated = FALSE;
|
||||
if (*GopBlt == NULL) {
|
||||
*GopBltSize = BltBufferSize;
|
||||
*GopBlt = AllocatePool (*GopBltSize);
|
||||
IsAllocated = TRUE;
|
||||
if (*GopBlt == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
} else {
|
||||
if (*GopBltSize < BltBufferSize) {
|
||||
*GopBltSize = BltBufferSize;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
}
|
||||
|
||||
*PixelWidth = BmpHeader->PixelWidth;
|
||||
*PixelHeight = BmpHeader->PixelHeight;
|
||||
|
||||
//
|
||||
// Convert image from BMP to Blt buffer format
|
||||
//
|
||||
BltBuffer = *GopBlt;
|
||||
for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
|
||||
Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
|
||||
for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
|
||||
switch (BmpHeader->BitPerPixel) {
|
||||
case 1:
|
||||
//
|
||||
// Convert 1bit BMP to 24-bit color
|
||||
//
|
||||
for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
|
||||
Blt->Red = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;
|
||||
Blt->Green = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;
|
||||
Blt->Blue = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;
|
||||
Blt++;
|
||||
Width++;
|
||||
}
|
||||
|
||||
Blt --;
|
||||
Width --;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
//
|
||||
// Convert BMP Palette to 24-bit color
|
||||
//
|
||||
Index = (*Image) >> 4;
|
||||
Blt->Red = BmpColorMap[Index].Red;
|
||||
Blt->Green = BmpColorMap[Index].Green;
|
||||
Blt->Blue = BmpColorMap[Index].Blue;
|
||||
if (Width < (BmpHeader->PixelWidth - 1)) {
|
||||
Blt++;
|
||||
Width++;
|
||||
Index = (*Image) & 0x0f;
|
||||
Blt->Red = BmpColorMap[Index].Red;
|
||||
Blt->Green = BmpColorMap[Index].Green;
|
||||
Blt->Blue = BmpColorMap[Index].Blue;
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
//
|
||||
// Convert BMP Palette to 24-bit color
|
||||
//
|
||||
Blt->Red = BmpColorMap[*Image].Red;
|
||||
Blt->Green = BmpColorMap[*Image].Green;
|
||||
Blt->Blue = BmpColorMap[*Image].Blue;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
Blt->Blue = *Image++;
|
||||
Blt->Green = *Image++;
|
||||
Blt->Red = *Image;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (IsAllocated) {
|
||||
gBS->FreePool (*GopBlt);
|
||||
*GopBlt = NULL;
|
||||
}
|
||||
return EFI_UNSUPPORTED;
|
||||
break;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
ImageIndex = (UINTN) (Image - ImageHeader);
|
||||
if ((ImageIndex % 4) != 0) {
|
||||
//
|
||||
// Bmp Image starts each row on a 32-bit boundary!
|
||||
//
|
||||
Image = Image + (4 - (ImageIndex % 4));
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
LockKeyboards (
|
||||
IN CHAR16 *Password
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Use Console Control Protocol to lock the Console In Spliter virtual handle.
|
||||
This is the ConInHandle and ConIn handle in the EFI system table. All key
|
||||
presses will be ignored until the Password is typed in. The only way to
|
||||
disable the password is to type it in to a ConIn device.
|
||||
|
||||
Arguments:
|
||||
Password - Password used to lock ConIn device
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
|
||||
displayed.
|
||||
EFI_UNSUPPORTED - Logo not found
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = ConsoleControl->LockStdIn (ConsoleControl, Password);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EnableQuietBoot (
|
||||
IN EFI_GUID *LogoFile
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Use Console Control to turn off UGA based Simple Text Out consoles from going
|
||||
to the UGA device. Put up LogoFile on every UGA device that is a console
|
||||
|
||||
Arguments:
|
||||
|
||||
LogoFile - File name of logo to display on the center of the screen.
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
|
||||
displayed.
|
||||
EFI_UNSUPPORTED - Logo not found
|
||||
|
||||
--*/
|
||||
{
|
||||
return EnableQuietBootEx (LogoFile, NULL);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EnableQuietBootEx (
|
||||
IN EFI_GUID *LogoFile,
|
||||
IN EFI_HANDLE ImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Use Console Control to turn off GOP/UGA based Simple Text Out consoles from going
|
||||
to the GOP/UGA device. Put up LogoFile on every GOP/UGA device that is a console
|
||||
|
||||
Arguments:
|
||||
|
||||
LogoFile - File name of logo to display on the center of the screen.
|
||||
ImageHandle - The driver image handle of the caller. The parameter is used to
|
||||
optimize the loading of the logo file so that the FV from which
|
||||
the driver image is loaded will be tried first.
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
|
||||
displayed.
|
||||
EFI_UNSUPPORTED - Logo not found
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
|
||||
EFI_OEM_BADGING_PROTOCOL *Badging;
|
||||
UINT32 SizeOfX;
|
||||
UINT32 SizeOfY;
|
||||
INTN DestX;
|
||||
INTN DestY;
|
||||
UINT8 *ImageData;
|
||||
UINTN ImageSize;
|
||||
UINTN BltSize;
|
||||
UINT32 Instance;
|
||||
EFI_BADGING_FORMAT Format;
|
||||
EFI_BADGING_DISPLAY_ATTRIBUTE Attribute;
|
||||
UINTN CoordinateX;
|
||||
UINTN CoordinateY;
|
||||
UINTN Height;
|
||||
UINTN Width;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
|
||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID**)&ConsoleControl);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
UgaDraw = NULL;
|
||||
//
|
||||
// Try to open GOP first
|
||||
//
|
||||
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID**)&GraphicsOutput);
|
||||
if (EFI_ERROR (Status)) {
|
||||
GraphicsOutput = NULL;
|
||||
//
|
||||
// Open GOP failed, try to open UGA
|
||||
//
|
||||
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID**)&UgaDraw);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
Badging = NULL;
|
||||
Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID**)&Badging);
|
||||
|
||||
ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
|
||||
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
|
||||
} else {
|
||||
Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
Instance = 0;
|
||||
while (1) {
|
||||
ImageData = NULL;
|
||||
ImageSize = 0;
|
||||
|
||||
if (Badging != NULL) {
|
||||
Status = Badging->GetImage (
|
||||
Badging,
|
||||
&Instance,
|
||||
&Format,
|
||||
&ImageData,
|
||||
&ImageSize,
|
||||
&Attribute,
|
||||
&CoordinateX,
|
||||
&CoordinateY
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Currently only support BMP format
|
||||
//
|
||||
if (Format != EfiBadgingFormatBMP) {
|
||||
gBS->FreePool (ImageData);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
Status = GetGraphicsBitMapFromFVEx (ImageHandle, LogoFile, (VOID **) &ImageData, &ImageSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
CoordinateX = 0;
|
||||
CoordinateY = 0;
|
||||
Attribute = EfiBadgingDisplayAttributeCenter;
|
||||
}
|
||||
|
||||
Blt = NULL;
|
||||
Status = ConvertBmpToGopBlt (
|
||||
ImageData,
|
||||
ImageSize,
|
||||
(VOID**)&Blt,
|
||||
&BltSize,
|
||||
&Height,
|
||||
&Width
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (ImageData);
|
||||
if (Badging == NULL) {
|
||||
return Status;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Attribute) {
|
||||
case EfiBadgingDisplayAttributeLeftTop:
|
||||
DestX = CoordinateX;
|
||||
DestY = CoordinateY;
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeCenterTop:
|
||||
DestX = (SizeOfX - Width) / 2;
|
||||
DestY = CoordinateY;
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeRightTop:
|
||||
DestX = (SizeOfX - Width - CoordinateX);
|
||||
DestY = CoordinateY;;
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeCenterRight:
|
||||
DestX = (SizeOfX - Width - CoordinateX);
|
||||
DestY = (SizeOfY - Height) / 2;
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeRightBottom:
|
||||
DestX = (SizeOfX - Width - CoordinateX);
|
||||
DestY = (SizeOfY - Height - CoordinateY);
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeCenterBottom:
|
||||
DestX = (SizeOfX - Width) / 2;
|
||||
DestY = (SizeOfY - Height - CoordinateY);
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeLeftBottom:
|
||||
DestX = CoordinateX;
|
||||
DestY = (SizeOfY - Height - CoordinateY);
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeCenterLeft:
|
||||
DestX = CoordinateX;
|
||||
DestY = (SizeOfY - Height) / 2;
|
||||
break;
|
||||
|
||||
case EfiBadgingDisplayAttributeCenter:
|
||||
DestX = (SizeOfX - Width) / 2;
|
||||
DestY = (SizeOfY - Height) / 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
DestX = CoordinateX;
|
||||
DestY = CoordinateY;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((DestX >= 0) && (DestY >= 0)) {
|
||||
if (GraphicsOutput != NULL) {
|
||||
Status = GraphicsOutput->Blt (
|
||||
GraphicsOutput,
|
||||
Blt,
|
||||
EfiBltBufferToVideo,
|
||||
0,
|
||||
0,
|
||||
(UINTN) DestX,
|
||||
(UINTN) DestY,
|
||||
Width,
|
||||
Height,
|
||||
Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
);
|
||||
} else {
|
||||
Status = UgaDraw->Blt (
|
||||
UgaDraw,
|
||||
(EFI_UGA_PIXEL *) Blt,
|
||||
EfiUgaBltBufferToVideo,
|
||||
0,
|
||||
0,
|
||||
(UINTN) DestX,
|
||||
(UINTN) DestY,
|
||||
Width,
|
||||
Height,
|
||||
Width * sizeof (EFI_UGA_PIXEL)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (ImageData);
|
||||
gBS->FreePool (Blt);
|
||||
|
||||
if (Badging == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
DisableQuietBoot (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Use Console Control to turn on GOP/UGA based Simple Text Out consoles. The GOP/UGA
|
||||
Simple Text Out screens will now be synced up with all non GOP/UGA output devices
|
||||
|
||||
Arguments:
|
||||
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GOP/UGA devices are back in text mode and synced up.
|
||||
EFI_UNSUPPORTED - Logo not found
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
|
||||
}
|
||||
|
||||
UINTN
|
||||
_IPrint (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
|
||||
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw,
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto,
|
||||
IN UINTN X,
|
||||
IN UINTN Y,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
|
||||
IN CHAR16 *fmt,
|
||||
IN VA_LIST args
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Display string worker for: Print, PrintAt, IPrint, IPrintAt
|
||||
|
||||
Arguments:
|
||||
|
||||
GraphicsOutput - Graphics output protocol interface
|
||||
|
||||
UgaDraw - UGA draw protocol interface
|
||||
|
||||
Sto - Simple text out protocol interface
|
||||
|
||||
X - X coordinate to start printing
|
||||
|
||||
Y - Y coordinate to start printing
|
||||
|
||||
Foreground - Foreground color
|
||||
|
||||
Background - Background color
|
||||
|
||||
fmt - Format string
|
||||
|
||||
args - Print arguments
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - success
|
||||
EFI_OUT_OF_RESOURCES - out of resources
|
||||
|
||||
--*/
|
||||
{
|
||||
VOID *Buffer;
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
CHAR16 *UnicodeWeight;
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
UINTN BufferLen;
|
||||
UINTN LineBufferLen;
|
||||
EFI_HII_FONT_PROTOCOL *HiiFont;
|
||||
EFI_IMAGE_OUTPUT *Blt;
|
||||
EFI_FONT_DISPLAY_INFO *FontInfo;
|
||||
|
||||
//
|
||||
// For now, allocate an arbitrarily long buffer
|
||||
//
|
||||
Buffer = AllocateZeroPool (0x10000);
|
||||
if (Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
|
||||
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
|
||||
} else {
|
||||
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
|
||||
}
|
||||
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
||||
|
||||
Blt = NULL;
|
||||
FontInfo = NULL;
|
||||
ASSERT (GraphicsOutput != NULL);
|
||||
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
UnicodeVSPrint (Buffer, 0x10000, fmt, args);
|
||||
|
||||
UnicodeWeight = (CHAR16 *) Buffer;
|
||||
|
||||
for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
|
||||
if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
|
||||
UnicodeWeight[Index] == CHAR_LINEFEED ||
|
||||
UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
|
||||
UnicodeWeight[Index] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
BufferLen = StrLen (Buffer);
|
||||
|
||||
|
||||
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;
|
||||
if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
||||
if (Blt == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Blt->Width = (UINT16) (HorizontalResolution);
|
||||
Blt->Height = (UINT16) (VerticalResolution);
|
||||
Blt->Image.Screen = GraphicsOutput;
|
||||
|
||||
FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
|
||||
if (FontInfo == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Error;
|
||||
}
|
||||
if (Foreground != NULL) {
|
||||
CopyMem (&FontInfo->ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
} else {
|
||||
CopyMem (
|
||||
&FontInfo->ForegroundColor,
|
||||
&mEfiColors[Sto->Mode->Attribute & 0x0f],
|
||||
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
);
|
||||
}
|
||||
if (Background != NULL) {
|
||||
CopyMem (&FontInfo->BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
} else {
|
||||
CopyMem (
|
||||
&FontInfo->BackgroundColor,
|
||||
&mEfiColors[Sto->Mode->Attribute >> 4],
|
||||
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
);
|
||||
}
|
||||
|
||||
Status = HiiFont->StringToImage (
|
||||
HiiFont,
|
||||
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
|
||||
Buffer,
|
||||
FontInfo,
|
||||
&Blt,
|
||||
X,
|
||||
Y,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
||||
Error:
|
||||
SafeFreePool (Blt);
|
||||
SafeFreePool (FontInfo);
|
||||
gBS->FreePool (Buffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UINTN
|
||||
PrintXY (
|
||||
IN UINTN X,
|
||||
IN UINTN Y,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
|
||||
IN CHAR16 *Fmt,
|
||||
...
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Prints a formatted unicode string to the default console
|
||||
|
||||
Arguments:
|
||||
|
||||
X - X coordinate to start printing
|
||||
|
||||
Y - Y coordinate to start printing
|
||||
|
||||
ForeGround - Foreground color
|
||||
|
||||
BackGround - Background color
|
||||
|
||||
Fmt - Format string
|
||||
|
||||
... - Print arguments
|
||||
|
||||
Returns:
|
||||
|
||||
Length of string printed to the console
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HANDLE Handle;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
|
||||
EFI_STATUS Status;
|
||||
VA_LIST Args;
|
||||
|
||||
VA_START (Args, Fmt);
|
||||
|
||||
Handle = gST->ConsoleOutHandle;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
(VOID**)&GraphicsOutput
|
||||
);
|
||||
|
||||
UgaDraw = NULL;
|
||||
if (EFI_ERROR (Status)) {
|
||||
GraphicsOutput = NULL;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
(VOID**)&UgaDraw
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID**)&Sto
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args);
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
#/** @file
|
||||
# Graphics Library for UEFI drivers
|
||||
#
|
||||
# This library provides supports for basic graphic functions.
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = EdkGraphicsLib
|
||||
FILE_GUID = 08c1a0e4-1208-47f8-a2c5-f42eabee653a
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = GraphicsLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
Graphics.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
BaseLib
|
||||
PrintLib
|
||||
DebugLib
|
||||
DxePiLib
|
||||
BaseMemoryLib
|
||||
|
||||
[Protocols]
|
||||
gEfiSimpleTextOutProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiGraphicsOutputProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiUgaDrawProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiConsoleControlProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>EdkGraphicsLib</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>08c1a0e4-1208-47f8-a2c5-f42eabee653a</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Graphics Library for UEFI drivers</Abstract>
|
||||
<Description>This library provides supports for basic graphic functions.</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>EdkGraphicsLib</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
|
||||
<Keyword>EdkGraphicsLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>Graphics.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiOEMBadgingProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,71 @@
|
|||
#/** @file
|
||||
# Component name for module UefiEfiIfrSupportLib
|
||||
#
|
||||
# FIX ME!
|
||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = IfrSupportLib
|
||||
FILE_GUID = bf38668e-e231-4baa-99e4-8c0e4c35dca6
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = IfrSupportLib
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
UefiIfrCommon.c
|
||||
UefiIfrForm.c
|
||||
UefiIfrLibraryInternal.h
|
||||
UefiIfrOpCodeCreation.c
|
||||
UefiIfrString.c
|
||||
R8Lib.h
|
||||
R8Lib.c
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
BaseLib
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PcdLib
|
||||
|
||||
[Guids]
|
||||
gEfiGlobalVariableGuid # ALWAYS_CONSUMED
|
||||
|
||||
[Protocols]
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiDatabaseProtocolGuid
|
||||
gEfiHiiStringProtocolGuid
|
||||
gEfiHiiConfigRoutingProtocolGuid
|
||||
gEfiFormBrowser2ProtocolGuid
|
||||
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
|
|
@ -0,0 +1,74 @@
|
|||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>UefiEfiIfrSupportLib</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>bf38668e-e231-4baa-99e4-8c0e4c35dca6</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component name for module UefiEfiIfrSupportLib</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2007, Intel Corporation. All rights reserved.</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>UefiEfiIfrSupportLib</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>R8Lib.c</Filename>
|
||||
<Filename>R8Lib.h</Filename>
|
||||
<Filename>UefiIfrString.c</Filename>
|
||||
<Filename>UefiIfrOpCodeCreation.c</Filename>
|
||||
<Filename>UefiIfrLibraryInternal.h</Filename>
|
||||
<Filename>UefiIfrForm.c</Filename>
|
||||
<Filename>UefiIfrCommon.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiGlobalVariableGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,241 @@
|
|||
/**@file
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UefiIfrLibraryInternal.h"
|
||||
|
||||
|
||||
CHAR16
|
||||
InternalNibbleToHexChar (
|
||||
IN UINT8 Nibble
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Converts the low nibble of a byte to hex unicode character.
|
||||
|
||||
Arguments:
|
||||
Nibble - lower nibble of a byte.
|
||||
|
||||
Returns:
|
||||
Hex unicode character.
|
||||
|
||||
--*/
|
||||
{
|
||||
Nibble &= 0x0F;
|
||||
if (Nibble <= 0x9) {
|
||||
return (CHAR16)(Nibble + L'0');
|
||||
}
|
||||
|
||||
return (CHAR16)(Nibble - 0xA + L'A');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts binary buffer to Unicode string.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Str Pointer to the string.
|
||||
@param HexStringBufferLength Length in bytes of buffer to hold the hex string.
|
||||
Includes tailing '\0' character. If routine return
|
||||
with EFI_SUCCESS, containing length of hex string
|
||||
buffer. If routine return with
|
||||
EFI_BUFFER_TOO_SMALL, containg length of hex
|
||||
string buffer desired.
|
||||
@param Buf Buffer to be converted from.
|
||||
@param Len Length in bytes of the buffer to be converted.
|
||||
|
||||
@retval EFI_SUCCESS Routine success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_BufToHexString (
|
||||
IN OUT CHAR16 *Str,
|
||||
IN OUT UINTN *HexStringBufferLength,
|
||||
IN UINT8 *Buf,
|
||||
IN UINTN Len
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is simply obsolete.
|
||||
// Include the source code to user code.
|
||||
//
|
||||
UINTN Idx;
|
||||
UINT8 Byte;
|
||||
UINTN StrLen;
|
||||
|
||||
//
|
||||
// Make sure string is either passed or allocate enough.
|
||||
// It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.
|
||||
// Plus the Unicode termination character.
|
||||
//
|
||||
StrLen = Len * 2;
|
||||
if (StrLen > ((*HexStringBufferLength) - 1)) {
|
||||
*HexStringBufferLength = StrLen + 1;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
*HexStringBufferLength = StrLen + 1;
|
||||
//
|
||||
// Ends the string.
|
||||
//
|
||||
Str[StrLen] = L'\0';
|
||||
|
||||
for (Idx = 0; Idx < Len; Idx++) {
|
||||
|
||||
Byte = Buf[Idx];
|
||||
Str[StrLen - 1 - Idx * 2] = InternalNibbleToHexChar (Byte);
|
||||
Str[StrLen - 2 - Idx * 2] = InternalNibbleToHexChar ((UINT8)(Byte >> 4));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Converts Unicode string to binary buffer.
|
||||
The conversion may be partial.
|
||||
The first character in the string that is not hex digit stops the conversion.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Buf Pointer to buffer that receives the data.
|
||||
@param Len Length in bytes of the buffer to hold converted
|
||||
data. If routine return with EFI_SUCCESS,
|
||||
containing length of converted data. If routine
|
||||
return with EFI_BUFFER_TOO_SMALL, containg length
|
||||
of buffer desired.
|
||||
@param Str String to be converted from.
|
||||
@param ConvertedStrLen Length of the Hex String consumed.
|
||||
|
||||
@retval EFI_SUCCESS Routine Success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_HexStringToBuf (
|
||||
IN OUT UINT8 *Buf,
|
||||
IN OUT UINTN *Len,
|
||||
IN CHAR16 *Str,
|
||||
OUT UINTN *ConvertedStrLen OPTIONAL
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is simply obsolete.
|
||||
// Include the source code to user code.
|
||||
//
|
||||
|
||||
UINTN HexCnt;
|
||||
UINTN Idx;
|
||||
UINTN BufferLength;
|
||||
UINT8 Digit;
|
||||
UINT8 Byte;
|
||||
|
||||
//
|
||||
// Find out how many hex characters the string has.
|
||||
//
|
||||
for (Idx = 0, HexCnt = 0; R8_IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);
|
||||
|
||||
if (HexCnt == 0) {
|
||||
*Len = 0;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// Two Unicode characters make up 1 buffer byte. Round up.
|
||||
//
|
||||
BufferLength = (HexCnt + 1) / 2;
|
||||
|
||||
//
|
||||
// Test if buffer is passed enough.
|
||||
//
|
||||
if (BufferLength > (*Len)) {
|
||||
*Len = BufferLength;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
*Len = BufferLength;
|
||||
|
||||
for (Idx = 0; Idx < HexCnt; Idx++) {
|
||||
|
||||
R8_IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);
|
||||
|
||||
//
|
||||
// For odd charaters, write the lower nibble for each buffer byte,
|
||||
// and for even characters, the upper nibble.
|
||||
//
|
||||
if ((Idx & 1) == 0) {
|
||||
Byte = Digit;
|
||||
} else {
|
||||
Byte = Buf[Idx / 2];
|
||||
Byte &= 0x0F;
|
||||
Byte = (UINT8) (Byte | Digit << 4);
|
||||
}
|
||||
|
||||
Buf[Idx / 2] = Byte;
|
||||
}
|
||||
|
||||
if (ConvertedStrLen != NULL) {
|
||||
*ConvertedStrLen = HexCnt;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Determines if a Unicode character is a hexadecimal digit.
|
||||
The test is case insensitive.
|
||||
|
||||
@param Digit Pointer to byte that receives the value of the hex
|
||||
character.
|
||||
@param Char Unicode character to test.
|
||||
|
||||
@retval TRUE If the character is a hexadecimal digit.
|
||||
@retval FALSE Otherwise.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
R8_IsHexDigit (
|
||||
OUT UINT8 *Digit,
|
||||
IN CHAR16 Char
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is simply obsolete.
|
||||
// Include the source code to user code.
|
||||
//
|
||||
|
||||
if ((Char >= L'0') && (Char <= L'9')) {
|
||||
*Digit = (UINT8) (Char - L'0');
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((Char >= L'A') && (Char <= L'F')) {
|
||||
*Digit = (UINT8) (Char - L'A' + 0x0A);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((Char >= L'a') && (Char <= L'f')) {
|
||||
*Digit = (UINT8) (Char - L'a' + 0x0A);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/**@file
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Converts binary buffer to Unicode string.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Str Pointer to the string.
|
||||
@param HexStringBufferLength Length in bytes of buffer to hold the hex string.
|
||||
Includes tailing '\0' character. If routine return
|
||||
with EFI_SUCCESS, containing length of hex string
|
||||
buffer. If routine return with
|
||||
EFI_BUFFER_TOO_SMALL, containg length of hex
|
||||
string buffer desired.
|
||||
@param Buf Buffer to be converted from.
|
||||
@param Len Length in bytes of the buffer to be converted.
|
||||
|
||||
@retval EFI_SUCCESS Routine success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_BufToHexString (
|
||||
IN OUT CHAR16 *Str,
|
||||
IN OUT UINTN *HexStringBufferLength,
|
||||
IN UINT8 *Buf,
|
||||
IN UINTN Len
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Converts Unicode string to binary buffer.
|
||||
The conversion may be partial.
|
||||
The first character in the string that is not hex digit stops the conversion.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Buf Pointer to buffer that receives the data.
|
||||
@param Len Length in bytes of the buffer to hold converted
|
||||
data. If routine return with EFI_SUCCESS,
|
||||
containing length of converted data. If routine
|
||||
return with EFI_BUFFER_TOO_SMALL, containg length
|
||||
of buffer desired.
|
||||
@param Str String to be converted from.
|
||||
@param ConvertedStrLen Length of the Hex String consumed.
|
||||
|
||||
@retval EFI_SUCCESS Routine Success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_HexStringToBuf (
|
||||
IN OUT UINT8 *Buf,
|
||||
IN OUT UINTN *Len,
|
||||
IN CHAR16 *Str,
|
||||
OUT UINTN *ConvertedStrLen OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Determines if a Unicode character is a hexadecimal digit.
|
||||
The test is case insensitive.
|
||||
|
||||
@param Digit Pointer to byte that receives the value of the hex
|
||||
character.
|
||||
@param Char Unicode character to test.
|
||||
|
||||
@retval TRUE If the character is a hexadecimal digit.
|
||||
@retval FALSE Otherwise.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
R8_IsHexDigit (
|
||||
OUT UINT8 *Digit,
|
||||
IN CHAR16 Char
|
||||
)
|
||||
;
|
||||
|
|
@ -0,0 +1,369 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UefiIfrCommon.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Common Library Routines to assist handle HII elements.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UefiIfrLibraryInternal.h"
|
||||
|
||||
//
|
||||
// Hii relative protocols
|
||||
//
|
||||
BOOLEAN mHiiProtocolsInitialized = FALSE;
|
||||
|
||||
EFI_HII_DATABASE_PROTOCOL *gIfrLibHiiDatabase;
|
||||
EFI_HII_STRING_PROTOCOL *gIfrLibHiiString;
|
||||
|
||||
|
||||
/**
|
||||
This function locate Hii relative protocols for later usage.
|
||||
|
||||
None.
|
||||
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
LocateHiiProtocols (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (mHiiProtocolsInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gIfrLibHiiDatabase);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gIfrLibHiiString);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mHiiProtocolsInitialized = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.
|
||||
|
||||
@param NumberOfPackages Number of packages.
|
||||
@param GuidId Package GUID.
|
||||
|
||||
@return Pointer of EFI_HII_PACKAGE_LIST_HEADER.
|
||||
|
||||
**/
|
||||
EFI_HII_PACKAGE_LIST_HEADER *
|
||||
PreparePackageList (
|
||||
IN UINTN NumberOfPackages,
|
||||
IN EFI_GUID *GuidId,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
||||
UINT8 *PackageListData;
|
||||
UINT32 PackageListLength;
|
||||
UINT32 PackageLength;
|
||||
EFI_HII_PACKAGE_HEADER PackageHeader;
|
||||
UINT8 *PackageArray;
|
||||
UINTN Index;
|
||||
|
||||
PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
||||
|
||||
VA_START (Marker, GuidId);
|
||||
for (Index = 0; Index < NumberOfPackages; Index++) {
|
||||
CopyMem (&PackageLength, VA_ARG (Marker, VOID *), sizeof (UINT32));
|
||||
PackageListLength += (PackageLength - sizeof (UINT32));
|
||||
}
|
||||
VA_END (Marker);
|
||||
|
||||
//
|
||||
// Include the lenght of EFI_HII_PACKAGE_END
|
||||
//
|
||||
PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
|
||||
PackageListHeader = AllocateZeroPool (PackageListLength);
|
||||
ASSERT (PackageListHeader != NULL);
|
||||
CopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID));
|
||||
PackageListHeader->PackageLength = PackageListLength;
|
||||
|
||||
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
||||
|
||||
VA_START (Marker, GuidId);
|
||||
for (Index = 0; Index < NumberOfPackages; Index++) {
|
||||
PackageArray = (UINT8 *) VA_ARG (Marker, VOID *);
|
||||
CopyMem (&PackageLength, PackageArray, sizeof (UINT32));
|
||||
PackageLength -= sizeof (UINT32);
|
||||
PackageArray += sizeof (UINT32);
|
||||
CopyMem (PackageListData, PackageArray, PackageLength);
|
||||
PackageListData += PackageLength;
|
||||
}
|
||||
VA_END (Marker);
|
||||
|
||||
//
|
||||
// Append EFI_HII_PACKAGE_END
|
||||
//
|
||||
PackageHeader.Type = EFI_HII_PACKAGE_END;
|
||||
PackageHeader.Length = sizeof (EFI_HII_PACKAGE_HEADER);
|
||||
CopyMem (PackageListData, &PackageHeader, PackageHeader.Length);
|
||||
|
||||
return PackageListHeader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Find HII Handle associated with given Device Path.
|
||||
|
||||
@param HiiDatabase Point to EFI_HII_DATABASE_PROTOCOL instance.
|
||||
@param DevicePath Device Path associated with the HII package list
|
||||
handle.
|
||||
|
||||
@retval Handle HII package list Handle associated with the Device
|
||||
Path.
|
||||
@retval NULL Hii Package list handle is not found.
|
||||
|
||||
**/
|
||||
EFI_HII_HANDLE
|
||||
DevicePathToHiiHandle (
|
||||
IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
|
||||
UINTN BufferSize;
|
||||
UINTN HandleCount;
|
||||
UINTN Index;
|
||||
EFI_HANDLE *Handles;
|
||||
EFI_HANDLE Handle;
|
||||
UINTN Size;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_HII_HANDLE *HiiHandles;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
|
||||
//
|
||||
// Locate Device Path Protocol handle buffer
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&Handles
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Search Driver Handle by Device Path
|
||||
//
|
||||
DriverHandle = NULL;
|
||||
BufferSize = GetDevicePathSize (DevicePath);
|
||||
for(Index = 0; Index < HandleCount; Index++) {
|
||||
Handle = Handles[Index];
|
||||
gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **) &TmpDevicePath);
|
||||
|
||||
//
|
||||
// Check whether DevicePath match
|
||||
//
|
||||
Size = GetDevicePathSize (TmpDevicePath);
|
||||
if ((Size == BufferSize) && CompareMem (DevicePath, TmpDevicePath, Size) == 0) {
|
||||
DriverHandle = Handle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gBS->FreePool (Handles);
|
||||
|
||||
if (DriverHandle == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve all Hii Handles from HII database
|
||||
//
|
||||
BufferSize = 0x1000;
|
||||
HiiHandles = AllocatePool (BufferSize);
|
||||
ASSERT (HiiHandles != NULL);
|
||||
Status = HiiDatabase->ListPackageLists (
|
||||
HiiDatabase,
|
||||
EFI_HII_PACKAGE_TYPE_ALL,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
HiiHandles
|
||||
);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
gBS->FreePool (HiiHandles);
|
||||
HiiHandles = AllocatePool (BufferSize);
|
||||
ASSERT (HiiHandles != NULL);
|
||||
|
||||
Status = HiiDatabase->ListPackageLists (
|
||||
HiiDatabase,
|
||||
EFI_HII_PACKAGE_TYPE_ALL,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
HiiHandles
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (HiiHandles);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Search Hii Handle by Driver Handle
|
||||
//
|
||||
HiiHandle = NULL;
|
||||
HandleCount = BufferSize / sizeof (EFI_HII_HANDLE);
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
Status = HiiDatabase->GetPackageListHandle (
|
||||
HiiDatabase,
|
||||
HiiHandles[Index],
|
||||
&Handle
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (Handle == DriverHandle)) {
|
||||
HiiHandle = HiiHandles[Index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (HiiHandles);
|
||||
return HiiHandle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Determines the handles that are currently active in the database.
|
||||
It's the caller's responsibility to free handle buffer.
|
||||
|
||||
@param HiiDatabase A pointer to the EFI_HII_DATABASE_PROTOCOL
|
||||
instance.
|
||||
@param HandleBufferLength On input, a pointer to the length of the handle
|
||||
buffer. On output, the length of the handle buffer
|
||||
that is required for the handles found.
|
||||
@param HiiHandleBuffer Pointer to an array of Hii Handles returned.
|
||||
|
||||
@retval EFI_SUCCESS Get an array of Hii Handles successfully.
|
||||
@retval EFI_INVALID_PARAMETER Hii is NULL.
|
||||
@retval EFI_NOT_FOUND Database not found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetHiiHandles (
|
||||
IN OUT UINTN *HandleBufferLength,
|
||||
OUT EFI_HII_HANDLE **HiiHandleBuffer
|
||||
)
|
||||
{
|
||||
UINTN BufferLength;
|
||||
EFI_STATUS Status;
|
||||
|
||||
BufferLength = 0;
|
||||
|
||||
LocateHiiProtocols ();
|
||||
|
||||
//
|
||||
// Try to find the actual buffer size for HiiHandle Buffer.
|
||||
//
|
||||
Status = gIfrLibHiiDatabase->ListPackageLists (
|
||||
gIfrLibHiiDatabase,
|
||||
EFI_HII_PACKAGE_TYPE_ALL,
|
||||
NULL,
|
||||
&BufferLength,
|
||||
*HiiHandleBuffer
|
||||
);
|
||||
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
*HiiHandleBuffer = AllocateZeroPool (BufferLength);
|
||||
Status = gIfrLibHiiDatabase->ListPackageLists (
|
||||
gIfrLibHiiDatabase,
|
||||
EFI_HII_PACKAGE_TYPE_ALL,
|
||||
NULL,
|
||||
&BufferLength,
|
||||
*HiiHandleBuffer
|
||||
);
|
||||
//
|
||||
// we should not fail here.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
*HandleBufferLength = BufferLength;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Extract Hii package list GUID for given HII handle.
|
||||
|
||||
@param HiiHandle Hii handle
|
||||
@param Guid Package list GUID
|
||||
|
||||
@retval EFI_SUCCESS Successfully extract GUID from Hii database.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ExtractGuidFromHiiHandle (
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
OUT EFI_GUID *Guid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
|
||||
|
||||
//
|
||||
// Locate HII Database protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiHiiDatabaseProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &HiiDatabase
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get HII PackageList
|
||||
//
|
||||
BufferSize = 0;
|
||||
HiiPackageList = NULL;
|
||||
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
HiiPackageList = AllocatePool (BufferSize);
|
||||
ASSERT (HiiPackageList != NULL);
|
||||
|
||||
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||
}
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract GUID
|
||||
//
|
||||
CopyMem (Guid, &HiiPackageList->PackageListGuid, sizeof (EFI_GUID));
|
||||
|
||||
gBS->FreePool (HiiPackageList);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,64 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UefiIfrLibraryInternal
|
||||
|
||||
Abstract:
|
||||
|
||||
The file contain all library function for Ifr Operations.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _IFRLIBRARY_INTERNAL_H
|
||||
#define _IFRLIBRARY_INTERNAL_H
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/IfrSupportLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
#include <MdeModuleHii.h>
|
||||
|
||||
#include "R8Lib.h"
|
||||
|
||||
VOID
|
||||
LocateHiiProtocols (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function locate Hii relative protocols for later usage.
|
||||
|
||||
Arguments:
|
||||
None.
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,639 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UefiIfrOpCodeCreation.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Library Routines to create IFR independent of string data - assume tokens already exist
|
||||
Primarily to be used for exporting op-codes at a label in pre-defined forms.
|
||||
|
||||
Revision History:
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UefiIfrLibraryInternal.h"
|
||||
|
||||
STATIC EFI_GUID mIfrVendorGuid = EFI_IFR_TIANO_GUID;
|
||||
|
||||
STATIC
|
||||
BOOLEAN
|
||||
IsValidQuestionFlags (
|
||||
IN UINT8 Flags
|
||||
)
|
||||
{
|
||||
return (BOOLEAN) ((Flags & (~QUESTION_FLAGS)) ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
STATIC
|
||||
BOOLEAN
|
||||
IsValidValueType (
|
||||
IN UINT8 Type
|
||||
)
|
||||
{
|
||||
return (BOOLEAN) ((Type <= EFI_IFR_TYPE_OTHER) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
STATIC
|
||||
BOOLEAN
|
||||
IsValidNumricFlags (
|
||||
IN UINT8 Flags
|
||||
)
|
||||
{
|
||||
if (Flags & ~(EFI_IFR_NUMERIC_SIZE | EFI_IFR_DISPLAY)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((Flags & EFI_IFR_DISPLAY) > EFI_IFR_DISPLAY_UINT_HEX) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STATIC
|
||||
BOOLEAN
|
||||
IsValidCheckboxFlags (
|
||||
IN UINT8 Flags
|
||||
)
|
||||
{
|
||||
return (BOOLEAN) ((Flags <= EFI_IFR_CHECKBOX_DEFAULT_MFG) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateEndOpCode (
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_END End;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_END) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
End.Header.Length = sizeof (EFI_IFR_END);
|
||||
End.Header.OpCode = EFI_IFR_END_OP;
|
||||
End.Header.Scope = 0;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &End, sizeof (EFI_IFR_END));
|
||||
Data->Offset += sizeof (EFI_IFR_END);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateDefaultOpCode (
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
IN UINT8 Type,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_DEFAULT Default;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if ((Value == NULL) || !IsValidValueType (Type)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_DEFAULT) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Default.Header.OpCode = EFI_IFR_DEFAULT_OP;
|
||||
Default.Header.Length = sizeof (EFI_IFR_DEFAULT);
|
||||
Default.Header.Scope = 0;
|
||||
Default.Type = Type;
|
||||
Default.DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
|
||||
CopyMem (&Default.Value, Value, sizeof(EFI_IFR_TYPE_VALUE));
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &Default, sizeof (EFI_IFR_DEFAULT));
|
||||
Data->Offset += sizeof (EFI_IFR_DEFAULT);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateActionOpCode (
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 QuestionFlags,
|
||||
IN EFI_STRING_ID QuestionConfig,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_ACTION Action;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (!IsValidQuestionFlags (QuestionFlags)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_ACTION) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Action.Header.OpCode = EFI_IFR_ACTION_OP;
|
||||
Action.Header.Length = sizeof (EFI_IFR_ACTION);
|
||||
Action.Header.Scope = 0;
|
||||
Action.Question.QuestionId = QuestionId;
|
||||
Action.Question.Header.Prompt = Prompt;
|
||||
Action.Question.Header.Help = Help;
|
||||
Action.Question.VarStoreId = INVALID_VARSTORE_ID;
|
||||
Action.Question.Flags = QuestionFlags;
|
||||
Action.QuestionConfig = QuestionConfig;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &Action, sizeof (EFI_IFR_ACTION));
|
||||
Data->Offset += sizeof (EFI_IFR_ACTION);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateSubTitleOpCode (
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 Flags,
|
||||
IN UINT8 Scope,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_SUBTITLE Subtitle;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_SUBTITLE) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
|
||||
Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
|
||||
Subtitle.Header.Scope = Scope;
|
||||
Subtitle.Statement.Prompt = Prompt;
|
||||
Subtitle.Statement.Help = Help;
|
||||
Subtitle.Flags = Flags;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &Subtitle, sizeof (EFI_IFR_SUBTITLE));
|
||||
Data->Offset += sizeof (EFI_IFR_SUBTITLE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
CreateTextOpCode (
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN EFI_STRING_ID TextTwo,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_TEXT Text;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_TEXT) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Text.Header.OpCode = EFI_IFR_TEXT_OP;
|
||||
Text.Header.Length = sizeof (EFI_IFR_TEXT);
|
||||
Text.Header.Scope = 0;
|
||||
Text.Statement.Prompt = Prompt;
|
||||
Text.Statement.Help = Help;
|
||||
Text.TextTwo = TextTwo;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &Text, sizeof (EFI_IFR_TEXT));
|
||||
Data->Offset += sizeof (EFI_IFR_TEXT);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateGotoOpCode (
|
||||
IN EFI_FORM_ID FormId,
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 QuestionFlags,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_REF Goto;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (!IsValidQuestionFlags (QuestionFlags)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_REF) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Goto.Header.OpCode = EFI_IFR_REF_OP;
|
||||
Goto.Header.Length = sizeof (EFI_IFR_REF);
|
||||
Goto.Header.Scope = 0;
|
||||
Goto.Question.Header.Prompt = Prompt;
|
||||
Goto.Question.Header.Help = Help;
|
||||
Goto.Question.VarStoreId = INVALID_VARSTORE_ID;
|
||||
Goto.Question.QuestionId = QuestionId;
|
||||
Goto.Question.Flags = QuestionFlags;
|
||||
Goto.FormId = FormId;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &Goto, sizeof (EFI_IFR_REF));
|
||||
Data->Offset += sizeof (EFI_IFR_REF);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateOneOfOptionOpCode (
|
||||
IN UINTN OptionCount,
|
||||
IN IFR_OPTION *OptionsList,
|
||||
IN UINT8 Type,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINT8 *LocalBuffer;
|
||||
EFI_IFR_ONE_OF_OPTION OneOfOption;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if ((OptionCount != 0) && (OptionsList == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Data->Offset + OptionCount * sizeof (EFI_IFR_ONE_OF_OPTION) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < OptionCount; Index++) {
|
||||
OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
|
||||
OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||
OneOfOption.Header.Scope = 0;
|
||||
|
||||
OneOfOption.Option = OptionsList[Index].StringToken;
|
||||
OneOfOption.Value = OptionsList[Index].Value;
|
||||
OneOfOption.Flags = (UINT8) (OptionsList[Index].Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG));
|
||||
OneOfOption.Type = Type;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &OneOfOption, sizeof (EFI_IFR_ONE_OF_OPTION));
|
||||
Data->Offset += sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateOneOfOpCode (
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN EFI_VARSTORE_ID VarStoreId,
|
||||
IN UINT16 VarOffset,
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 QuestionFlags,
|
||||
IN UINT8 OneOfFlags,
|
||||
IN IFR_OPTION *OptionsList,
|
||||
IN UINTN OptionCount,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
UINTN Length;
|
||||
EFI_IFR_ONE_OF OneOf;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (!IsValidNumricFlags (OneOfFlags) ||
|
||||
!IsValidQuestionFlags (QuestionFlags) ||
|
||||
((OptionCount != 0) && (OptionsList == NULL))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Length = sizeof (EFI_IFR_ONE_OF) + OptionCount * sizeof (EFI_IFR_ONE_OF_OPTION) + sizeof (EFI_IFR_END);
|
||||
if (Data->Offset + Length > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
|
||||
OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
|
||||
OneOf.Header.Scope = 1;
|
||||
OneOf.Question.Header.Prompt = Prompt;
|
||||
OneOf.Question.Header.Help = Help;
|
||||
OneOf.Question.QuestionId = QuestionId;
|
||||
OneOf.Question.VarStoreId = VarStoreId;
|
||||
OneOf.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||
OneOf.Question.Flags = QuestionFlags;
|
||||
OneOf.Flags = OneOfFlags;
|
||||
ZeroMem ((VOID *) &OneOf.data, sizeof (MINMAXSTEP_DATA));
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &OneOf, sizeof (EFI_IFR_ONE_OF));
|
||||
Data->Offset += sizeof (EFI_IFR_ONE_OF);
|
||||
|
||||
CreateOneOfOptionOpCode (OptionCount, OptionsList, (UINT8) (OneOfFlags & EFI_IFR_NUMERIC_SIZE), Data);
|
||||
|
||||
CreateEndOpCode (Data);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateOrderedListOpCode (
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN EFI_VARSTORE_ID VarStoreId,
|
||||
IN UINT16 VarOffset,
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 QuestionFlags,
|
||||
IN UINT8 OrderedListFlags,
|
||||
IN UINT8 DataType,
|
||||
IN UINT8 MaxContainers,
|
||||
IN IFR_OPTION *OptionsList,
|
||||
IN UINTN OptionCount,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
UINTN Length;
|
||||
EFI_IFR_ORDERED_LIST OrderedList;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (!IsValidQuestionFlags (QuestionFlags) ||
|
||||
((OptionCount != 0) && (OptionsList == NULL))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if ((OrderedListFlags != 0) &&
|
||||
(OrderedListFlags != EFI_IFR_UNIQUE_SET) &&
|
||||
(OrderedListFlags != EFI_IFR_NO_EMPTY_SET)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Length = sizeof (EFI_IFR_ORDERED_LIST) + OptionCount * sizeof (EFI_IFR_ONE_OF_OPTION) + sizeof (EFI_IFR_END);
|
||||
if (Data->Offset + Length > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
|
||||
OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
|
||||
OrderedList.Header.Scope = 1;
|
||||
OrderedList.Question.Header.Prompt = Prompt;
|
||||
OrderedList.Question.Header.Help = Help;
|
||||
OrderedList.Question.QuestionId = QuestionId;
|
||||
OrderedList.Question.VarStoreId = VarStoreId;
|
||||
OrderedList.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||
OrderedList.Question.Flags = QuestionFlags;
|
||||
OrderedList.MaxContainers = MaxContainers;
|
||||
OrderedList.Flags = OrderedListFlags;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &OrderedList, sizeof (EFI_IFR_ORDERED_LIST));
|
||||
Data->Offset += sizeof (EFI_IFR_ORDERED_LIST);
|
||||
|
||||
CreateOneOfOptionOpCode (OptionCount, OptionsList, DataType, Data);
|
||||
|
||||
CreateEndOpCode (Data);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateCheckBoxOpCode (
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN EFI_VARSTORE_ID VarStoreId,
|
||||
IN UINT16 VarOffset,
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 QuestionFlags,
|
||||
IN UINT8 CheckBoxFlags,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_CHECKBOX CheckBox;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (!IsValidQuestionFlags (QuestionFlags) || !IsValidCheckboxFlags (CheckBoxFlags)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_CHECKBOX) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
|
||||
CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);
|
||||
CheckBox.Header.Scope = 0;
|
||||
CheckBox.Question.QuestionId = QuestionId;
|
||||
CheckBox.Question.VarStoreId = VarStoreId;
|
||||
CheckBox.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||
CheckBox.Question.Header.Prompt = Prompt;
|
||||
CheckBox.Question.Header.Help = Help;
|
||||
CheckBox.Question.Flags = QuestionFlags;
|
||||
CheckBox.Flags = CheckBoxFlags;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &CheckBox, sizeof (EFI_IFR_CHECKBOX));
|
||||
Data->Offset += sizeof (EFI_IFR_CHECKBOX);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateNumericOpCode (
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN EFI_VARSTORE_ID VarStoreId,
|
||||
IN UINT16 VarOffset,
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 QuestionFlags,
|
||||
IN UINT8 NumericFlags,
|
||||
IN UINT64 Minimum,
|
||||
IN UINT64 Maximum,
|
||||
IN UINT64 Step,
|
||||
IN UINT64 Default,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_IFR_NUMERIC Numeric;
|
||||
MINMAXSTEP_DATA MinMaxStep;
|
||||
EFI_IFR_TYPE_VALUE DefaultValue;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (!IsValidQuestionFlags (QuestionFlags) || !IsValidNumricFlags (NumericFlags)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_CHECKBOX) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
|
||||
Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
|
||||
Numeric.Header.Scope = 1;
|
||||
Numeric.Question.QuestionId = QuestionId;
|
||||
Numeric.Question.VarStoreId = VarStoreId;
|
||||
Numeric.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||
Numeric.Question.Header.Prompt = Prompt;
|
||||
Numeric.Question.Header.Help = Help;
|
||||
Numeric.Question.Flags = QuestionFlags;
|
||||
Numeric.Flags = NumericFlags;
|
||||
|
||||
switch (NumericFlags & EFI_IFR_NUMERIC_SIZE) {
|
||||
case EFI_IFR_NUMERIC_SIZE_1:
|
||||
MinMaxStep.u8.MinValue = (UINT8) Minimum;
|
||||
MinMaxStep.u8.MaxValue = (UINT8) Maximum;
|
||||
MinMaxStep.u8.Step = (UINT8) Step;
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_SIZE_2:
|
||||
MinMaxStep.u16.MinValue = (UINT16) Minimum;
|
||||
MinMaxStep.u16.MaxValue = (UINT16) Maximum;
|
||||
MinMaxStep.u16.Step = (UINT16) Step;
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_SIZE_4:
|
||||
MinMaxStep.u32.MinValue = (UINT32) Minimum;
|
||||
MinMaxStep.u32.MaxValue = (UINT32) Maximum;
|
||||
MinMaxStep.u32.Step = (UINT32) Step;
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_SIZE_8:
|
||||
MinMaxStep.u64.MinValue = Minimum;
|
||||
MinMaxStep.u64.MaxValue = Maximum;
|
||||
MinMaxStep.u64.Step = Step;
|
||||
break;
|
||||
}
|
||||
|
||||
CopyMem (&Numeric.data, &MinMaxStep, sizeof (MINMAXSTEP_DATA));
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &Numeric, sizeof (EFI_IFR_NUMERIC));
|
||||
Data->Offset += sizeof (EFI_IFR_NUMERIC);
|
||||
|
||||
DefaultValue.u64 = Default;
|
||||
Status = CreateDefaultOpCode (&DefaultValue, (UINT8) (NumericFlags & EFI_IFR_NUMERIC_SIZE), Data);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
CreateEndOpCode (Data);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateStringOpCode (
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN EFI_VARSTORE_ID VarStoreId,
|
||||
IN UINT16 VarOffset,
|
||||
IN EFI_STRING_ID Prompt,
|
||||
IN EFI_STRING_ID Help,
|
||||
IN UINT8 QuestionFlags,
|
||||
IN UINT8 StringFlags,
|
||||
IN UINT8 MinSize,
|
||||
IN UINT8 MaxSize,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_STRING String;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (!IsValidQuestionFlags (QuestionFlags) || (StringFlags & (~EFI_IFR_STRING_MULTI_LINE))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_STRING) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
String.Header.OpCode = EFI_IFR_STRING_OP;
|
||||
String.Header.Length = sizeof (EFI_IFR_STRING);
|
||||
String.Header.Scope = 0;
|
||||
String.Question.Header.Prompt = Prompt;
|
||||
String.Question.Header.Help = Help;
|
||||
String.Question.QuestionId = QuestionId;
|
||||
String.Question.VarStoreId = VarStoreId;
|
||||
String.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||
String.Question.Flags = QuestionFlags;
|
||||
String.MinSize = MinSize;
|
||||
String.MaxSize = MaxSize;
|
||||
String.Flags = StringFlags;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &String, sizeof (EFI_IFR_STRING));
|
||||
Data->Offset += sizeof (EFI_IFR_STRING);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateBannerOpCode (
|
||||
IN EFI_STRING_ID Title,
|
||||
IN UINT16 LineNumber,
|
||||
IN UINT8 Alignment,
|
||||
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
{
|
||||
EFI_IFR_GUID_BANNER Banner;
|
||||
UINT8 *LocalBuffer;
|
||||
|
||||
ASSERT (Data != NULL && Data->Data != NULL);
|
||||
|
||||
if (Data->Offset + sizeof (EFI_IFR_GUID_BANNER) > Data->BufferSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
Banner.Header.OpCode = EFI_IFR_GUID_OP;
|
||||
Banner.Header.Length = sizeof (EFI_IFR_GUID_BANNER);
|
||||
Banner.Header.Scope = 0;
|
||||
CopyMem (&Banner.Guid, &mIfrVendorGuid, sizeof (EFI_IFR_GUID));
|
||||
Banner.ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;
|
||||
Banner.Title = Title;
|
||||
Banner.LineNumber = LineNumber;
|
||||
Banner.Alignment = Alignment;
|
||||
|
||||
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||
CopyMem (LocalBuffer, &Banner, sizeof (EFI_IFR_GUID_BANNER));
|
||||
Data->Offset += sizeof (EFI_IFR_GUID_BANNER);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,681 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UefiIfrString.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Common Library Routines to assist to handle String and Language.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UefiIfrLibraryInternal.h"
|
||||
|
||||
//
|
||||
// Lookup table of ISO639-2 3 character language codes to ISO 639-1 2 character language codes
|
||||
// Each entry is 5 CHAR8 values long. The first 3 CHAR8 values are the ISO 639-2 code.
|
||||
// The last 2 CHAR8 values are the ISO 639-1 code.
|
||||
//
|
||||
CHAR8 Iso639ToRfc3066ConversionTable[] =
|
||||
"\
|
||||
aaraa\
|
||||
abkab\
|
||||
afraf\
|
||||
amham\
|
||||
araar\
|
||||
asmas\
|
||||
aymay\
|
||||
azeaz\
|
||||
bakba\
|
||||
belbe\
|
||||
benbn\
|
||||
bihbh\
|
||||
bisbi\
|
||||
bodbo\
|
||||
brebr\
|
||||
bulbg\
|
||||
catca\
|
||||
cescs\
|
||||
corkw\
|
||||
cosco\
|
||||
cymcy\
|
||||
danda\
|
||||
deude\
|
||||
dzodz\
|
||||
ellel\
|
||||
engen\
|
||||
epoeo\
|
||||
estet\
|
||||
euseu\
|
||||
faofo\
|
||||
fasfa\
|
||||
fijfj\
|
||||
finfi\
|
||||
frafr\
|
||||
fryfy\
|
||||
gaiga\
|
||||
gdhgd\
|
||||
glggl\
|
||||
grngn\
|
||||
gujgu\
|
||||
hauha\
|
||||
hebhe\
|
||||
hinhi\
|
||||
hrvhr\
|
||||
hunhu\
|
||||
hyehy\
|
||||
ikuiu\
|
||||
ileie\
|
||||
inaia\
|
||||
indid\
|
||||
ipkik\
|
||||
islis\
|
||||
itait\
|
||||
jawjw\
|
||||
jpnja\
|
||||
kalkl\
|
||||
kankn\
|
||||
kasks\
|
||||
katka\
|
||||
kazkk\
|
||||
khmkm\
|
||||
kinrw\
|
||||
kirky\
|
||||
korko\
|
||||
kurku\
|
||||
laolo\
|
||||
latla\
|
||||
lavlv\
|
||||
linln\
|
||||
litlt\
|
||||
ltzlb\
|
||||
malml\
|
||||
marmr\
|
||||
mkdmk\
|
||||
mlgmg\
|
||||
mltmt\
|
||||
molmo\
|
||||
monmn\
|
||||
mrimi\
|
||||
msams\
|
||||
myamy\
|
||||
nauna\
|
||||
nepne\
|
||||
nldnl\
|
||||
norno\
|
||||
ocioc\
|
||||
ormom\
|
||||
panpa\
|
||||
polpl\
|
||||
porpt\
|
||||
pusps\
|
||||
quequ\
|
||||
rohrm\
|
||||
ronro\
|
||||
runrn\
|
||||
rusru\
|
||||
sagsg\
|
||||
sansa\
|
||||
sinsi\
|
||||
slksk\
|
||||
slvsl\
|
||||
smise\
|
||||
smosm\
|
||||
snasn\
|
||||
sndsd\
|
||||
somso\
|
||||
sotst\
|
||||
spaes\
|
||||
sqisq\
|
||||
srpsr\
|
||||
sswss\
|
||||
sunsu\
|
||||
swasw\
|
||||
swesv\
|
||||
tamta\
|
||||
tattt\
|
||||
telte\
|
||||
tgktg\
|
||||
tgltl\
|
||||
thath\
|
||||
tsnts\
|
||||
tuktk\
|
||||
twitw\
|
||||
uigug\
|
||||
ukruk\
|
||||
urdur\
|
||||
uzbuz\
|
||||
vievi\
|
||||
volvo\
|
||||
wolwo\
|
||||
xhoxh\
|
||||
yidyi\
|
||||
zhaza\
|
||||
zhozh\
|
||||
zulzu\
|
||||
";
|
||||
|
||||
|
||||
/**
|
||||
Convert language code from RFC3066 to ISO639-2.
|
||||
|
||||
@param LanguageRfc3066 RFC3066 language code.
|
||||
@param LanguageIso639 ISO639-2 language code.
|
||||
|
||||
@retval EFI_SUCCESS Language code converted.
|
||||
@retval EFI_NOT_FOUND Language code not found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConvertRfc3066LanguageToIso639Language (
|
||||
CHAR8 *LanguageRfc3066,
|
||||
CHAR8 *LanguageIso639
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if ((LanguageRfc3066[2] != '-') && (LanguageRfc3066[2] != 0)) {
|
||||
CopyMem (LanguageIso639, LanguageRfc3066, 3);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) {
|
||||
if (CompareMem (LanguageRfc3066, &Iso639ToRfc3066ConversionTable[Index + 3], 2) == 0) {
|
||||
CopyMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will
|
||||
be converted to "engfra".
|
||||
|
||||
@param SupportedLanguages The RFC3066 language list.
|
||||
|
||||
@return The ISO639-2 language list.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
Rfc3066ToIso639 (
|
||||
CHAR8 *SupportedLanguages
|
||||
)
|
||||
{
|
||||
CHAR8 *Languages;
|
||||
CHAR8 *ReturnValue;
|
||||
CHAR8 *LangCodes;
|
||||
CHAR8 LangRfc3066[RFC_3066_ENTRY_SIZE];
|
||||
CHAR8 LangIso639[ISO_639_2_ENTRY_SIZE];
|
||||
EFI_STATUS Status;
|
||||
|
||||
ReturnValue = AllocateZeroPool (AsciiStrSize (SupportedLanguages));
|
||||
if (ReturnValue == NULL) {
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
Languages = ReturnValue;
|
||||
LangCodes = SupportedLanguages;
|
||||
while (*LangCodes != 0) {
|
||||
GetNextLanguage (&LangCodes, LangRfc3066);
|
||||
|
||||
Status = ConvertRfc3066LanguageToIso639Language (LangRfc3066, LangIso639);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CopyMem (Languages, LangIso639, 3);
|
||||
Languages = Languages + 3;
|
||||
}
|
||||
}
|
||||
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Determine what is the current language setting
|
||||
|
||||
@param Lang Pointer of system language
|
||||
|
||||
@return Status code
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetCurrentLanguage (
|
||||
OUT CHAR8 *Lang
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// Get current language setting
|
||||
//
|
||||
Size = RFC_3066_ENTRY_SIZE;
|
||||
Status = gRT->GetVariable (
|
||||
L"PlatformLang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
Lang
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
AsciiStrCpy (Lang, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get next language from language code list (with separator ';').
|
||||
|
||||
@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.
|
||||
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
GetNextLanguage (
|
||||
IN OUT CHAR8 **LangCode,
|
||||
OUT CHAR8 *Lang
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
CHAR8 *StringPtr;
|
||||
|
||||
if (LangCode == NULL || *LangCode == NULL) {
|
||||
*Lang = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function returns the list of supported languages, in the format specified
|
||||
in UEFI specification Appendix M.
|
||||
|
||||
@param HiiHandle The HII package list handle.
|
||||
|
||||
@return The supported languages.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
GetSupportedLanguages (
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
CHAR8 *LanguageString;
|
||||
|
||||
LocateHiiProtocols ();
|
||||
|
||||
//
|
||||
// Collect current supported Languages for given HII handle
|
||||
//
|
||||
BufferSize = 0x1000;
|
||||
LanguageString = AllocatePool (BufferSize);
|
||||
Status = gIfrLibHiiString->GetLanguages (gIfrLibHiiString, HiiHandle, LanguageString, &BufferSize);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
gBS->FreePool (LanguageString);
|
||||
LanguageString = AllocatePool (BufferSize);
|
||||
Status = gIfrLibHiiString->GetLanguages (gIfrLibHiiString, HiiHandle, LanguageString, &BufferSize);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
LanguageString = NULL;
|
||||
}
|
||||
|
||||
return LanguageString;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function returns the number of supported languages
|
||||
|
||||
@param HiiHandle The HII package list handle.
|
||||
|
||||
@return The number of supported languages.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
GetSupportedLanguageNumber (
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
)
|
||||
{
|
||||
CHAR8 *Languages;
|
||||
CHAR8 *LanguageString;
|
||||
UINT16 LangNumber;
|
||||
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||
|
||||
Languages = GetSupportedLanguages (HiiHandle);
|
||||
if (Languages == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
LangNumber = 0;
|
||||
LanguageString = Languages;
|
||||
while (*LanguageString != 0) {
|
||||
GetNextLanguage (&LanguageString, Lang);
|
||||
LangNumber++;
|
||||
}
|
||||
gBS->FreePool (Languages);
|
||||
|
||||
return LangNumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get string specified by StringId form the HiiHandle.
|
||||
|
||||
@param HiiHandle The HII handle of package list.
|
||||
@param StringId The String ID.
|
||||
@param String The output string.
|
||||
|
||||
@retval EFI_NOT_FOUND String is not found.
|
||||
@retval EFI_SUCCESS Operation is successful.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
|
||||
@retval EFI_INVALID_PARAMETER The String is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetStringFromHandle (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_STRING_ID StringId,
|
||||
OUT EFI_STRING *String
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN StringSize;
|
||||
|
||||
if (String == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
StringSize = IFR_LIB_DEFAULT_STRING_SIZE;
|
||||
*String = AllocateZeroPool (StringSize);
|
||||
if (*String == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Status = IfrLibGetString (HiiHandle, StringId, *String, &StringSize);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
gBS->FreePool (*String);
|
||||
*String = AllocateZeroPool (StringSize);
|
||||
if (*String == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
Status = IfrLibGetString (HiiHandle, StringId, *String, &StringSize);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the string given the StringId and String package Producer's Guid.
|
||||
|
||||
@param ProducerGuid The Guid of String package list.
|
||||
@param StringId The String ID.
|
||||
@param String The output string.
|
||||
|
||||
@retval EFI_NOT_FOUND String is not found.
|
||||
@retval EFI_SUCCESS Operation is successful.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetStringFromToken (
|
||||
IN EFI_GUID *ProducerGuid,
|
||||
IN EFI_STRING_ID StringId,
|
||||
OUT EFI_STRING *String
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
UINTN HandleBufferLen;
|
||||
EFI_HII_HANDLE *HiiHandleBuffer;
|
||||
EFI_GUID Guid;
|
||||
|
||||
Status = GetHiiHandles (&HandleBufferLen, &HiiHandleBuffer);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
for (Index = 0; Index < (HandleBufferLen / sizeof (EFI_HII_HANDLE)); Index++) {
|
||||
Status = ExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
if (CompareGuid (&Guid, ProducerGuid) == TRUE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Index >= (HandleBufferLen / sizeof (EFI_HII_HANDLE))) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto Out;
|
||||
}
|
||||
|
||||
Status = GetStringFromHandle (HiiHandleBuffer[Index], StringId, String);
|
||||
|
||||
Out:
|
||||
if (HiiHandleBuffer != NULL) {
|
||||
gBS->FreePool (HiiHandleBuffer);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function adds the string into String Package of each language.
|
||||
|
||||
@param PackageList Handle of the package list where this string will
|
||||
be added.
|
||||
@param StringId On return, contains the new strings id, which is
|
||||
unique within PackageList.
|
||||
@param String Points to the new null-terminated string.
|
||||
|
||||
@retval EFI_SUCCESS The new string was added successfully.
|
||||
@retval EFI_NOT_FOUND The specified PackageList could not be found in
|
||||
database.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
|
||||
@retval EFI_INVALID_PARAMETER String is NULL or StringId is NULL is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IfrLibNewString (
|
||||
IN EFI_HII_HANDLE PackageList,
|
||||
OUT EFI_STRING_ID *StringId,
|
||||
IN CONST EFI_STRING String
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR8 *Languages;
|
||||
CHAR8 *LangStrings;
|
||||
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
LocateHiiProtocols ();
|
||||
|
||||
Languages = GetSupportedLanguages (PackageList);
|
||||
|
||||
LangStrings = Languages;
|
||||
while (*LangStrings != 0) {
|
||||
GetNextLanguage (&LangStrings, Lang);
|
||||
|
||||
Status = gIfrLibHiiString->NewString (
|
||||
gIfrLibHiiString,
|
||||
PackageList,
|
||||
StringId,
|
||||
Lang,
|
||||
NULL,
|
||||
String,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (Languages);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function try to retrieve string from String package of current language.
|
||||
If fail, it try to retrieve string from String package of first language it support.
|
||||
|
||||
@param PackageList The package list in the HII database to search for
|
||||
the specified string.
|
||||
@param StringId The string's id, which is unique within
|
||||
PackageList.
|
||||
@param String Points to the new null-terminated string.
|
||||
@param StringSize On entry, points to the size of the buffer pointed
|
||||
to by String, in bytes. On return, points to the
|
||||
length of the string, in bytes.
|
||||
|
||||
@retval EFI_SUCCESS The string was returned successfully.
|
||||
@retval EFI_NOT_FOUND The string specified by StringId is not available.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer specified by StringLength is too small
|
||||
to hold the string.
|
||||
@retval EFI_INVALID_PARAMETER The String or StringSize was NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IfrLibGetString (
|
||||
IN EFI_HII_HANDLE PackageList,
|
||||
IN EFI_STRING_ID StringId,
|
||||
OUT EFI_STRING String,
|
||||
IN OUT UINTN *StringSize
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR8 *Languages;
|
||||
CHAR8 *LangStrings;
|
||||
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||
CHAR8 CurrentLang[RFC_3066_ENTRY_SIZE];
|
||||
|
||||
LocateHiiProtocols ();
|
||||
|
||||
GetCurrentLanguage (CurrentLang);
|
||||
|
||||
Status = gIfrLibHiiString->GetString (
|
||||
gIfrLibHiiString,
|
||||
CurrentLang,
|
||||
PackageList,
|
||||
StringId,
|
||||
String,
|
||||
StringSize,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||
Languages = GetSupportedLanguages (PackageList);
|
||||
LangStrings = Languages;
|
||||
GetNextLanguage (&LangStrings, Lang);
|
||||
gBS->FreePool (Languages);
|
||||
|
||||
Status = gIfrLibHiiString->GetString (
|
||||
gIfrLibHiiString,
|
||||
Lang,
|
||||
PackageList,
|
||||
StringId,
|
||||
String,
|
||||
StringSize,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function updates the string in String package of each language.
|
||||
|
||||
@param PackageList The package list containing the strings.
|
||||
@param StringId The string's id, which is unique within
|
||||
PackageList.
|
||||
@param String Points to the new null-terminated string.
|
||||
|
||||
@retval EFI_SUCCESS The string was updated successfully.
|
||||
@retval EFI_NOT_FOUND The string specified by StringId is not in the
|
||||
database.
|
||||
@retval EFI_INVALID_PARAMETER The String was NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The system is out of resources to accomplish the
|
||||
task.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IfrLibSetString (
|
||||
IN EFI_HII_HANDLE PackageList,
|
||||
IN EFI_STRING_ID StringId,
|
||||
IN CONST EFI_STRING String
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR8 *Languages;
|
||||
CHAR8 *LangStrings;
|
||||
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
LocateHiiProtocols ();
|
||||
|
||||
Languages = GetSupportedLanguages (PackageList);
|
||||
|
||||
LangStrings = Languages;
|
||||
while (*LangStrings != 0) {
|
||||
GetNextLanguage (&LangStrings, Lang);
|
||||
|
||||
Status = gIfrLibHiiString->SetString (
|
||||
gIfrLibHiiString,
|
||||
PackageList,
|
||||
StringId,
|
||||
Lang,
|
||||
String,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (Languages);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BdsPlatform.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file include all platform action which can be customized
|
||||
by IBV/OEM.
|
||||
|
||||
--*/
|
||||
|
||||
#include "BdsPlatform.h"
|
||||
|
||||
//
|
||||
// BDS Platform Functions
|
||||
//
|
||||
VOID
|
||||
PlatformBdsInit (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Platform Bds init. Incude the platform firmware vendor, revision
|
||||
and so crc check.
|
||||
|
||||
Arguments:
|
||||
|
||||
PrivateData - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PlatformBdsConnectConsole (
|
||||
IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Connect the predefined platform default console device. Always try to find
|
||||
and enable the vga device if have.
|
||||
|
||||
Arguments:
|
||||
|
||||
PlatformConsole - Predfined platform default console device array.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Success connect at least one ConIn and ConOut
|
||||
device, there must have one ConOut device is
|
||||
active vga device.
|
||||
|
||||
EFI_STATUS - Return the status of
|
||||
BdsLibConnectAllDefaultConsoles ()
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsConnectSequence (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Connect with predeined platform connect sequence,
|
||||
the OEM/IBV can customize with their own connect sequence.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsGetDriverOption (
|
||||
IN OUT LIST_ENTRY *BdsDriverLists
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Load the predefined driver option, OEM/IBV can customize this
|
||||
to load their own drivers
|
||||
|
||||
Arguments:
|
||||
|
||||
BdsDriverLists - The header of the driver option link list.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsDiagnostics (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,
|
||||
IN BOOLEAN QuietBoot
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Perform the platform diagnostic, such like test memory. OEM/IBV also
|
||||
can customize this fuction to support specific platform diagnostic.
|
||||
|
||||
Arguments:
|
||||
|
||||
MemoryTestLevel - The memory test intensive level
|
||||
|
||||
QuietBoot - Indicate if need to enable the quiet boot
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsPolicyBehavior (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData,
|
||||
IN OUT LIST_ENTRY *DriverOptionList,
|
||||
IN OUT LIST_ENTRY *BootOptionList
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The function will excute with as the platform policy, current policy
|
||||
is driven by boot mode. IBV/OEM can customize this code for their specific
|
||||
policy action.
|
||||
|
||||
Arguments:
|
||||
|
||||
PrivateData - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance
|
||||
|
||||
DriverOptionList - The header of the driver option link list
|
||||
|
||||
BootOptionList - The header of the boot option link list
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsBootSuccess (
|
||||
IN BDS_COMMON_OPTION *Option
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Hook point after a boot attempt succeeds. We don't expect a boot option to
|
||||
return, so the EFI 1.0 specification defines that you will default to an
|
||||
interactive mode and stop processing the BootOrder list in this case. This
|
||||
is alos a platform implementation and can be customized by IBV/OEM.
|
||||
|
||||
Arguments:
|
||||
|
||||
Option - Pointer to Boot Option that succeeded to boot.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsBootFail (
|
||||
IN BDS_COMMON_OPTION *Option,
|
||||
IN EFI_STATUS Status,
|
||||
IN CHAR16 *ExitData,
|
||||
IN UINTN ExitDataSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Hook point after a boot attempt fails.
|
||||
|
||||
Arguments:
|
||||
|
||||
Option - Pointer to Boot Option that failed to boot.
|
||||
|
||||
Status - Status returned from failed boot.
|
||||
|
||||
ExitData - Exit data returned from failed boot.
|
||||
|
||||
ExitDataSize - Exit data size returned from failed boot.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PlatformBdsNoConsoleAction (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function is remained for IBV/OEM to do some platform action,
|
||||
if there no console device can be connected.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Direct return success now.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatformBdsLockNonUpdatableFlash (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BdsPlatform.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Head file for BDS Platform specific code
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _BDS_PLATFORM_H
|
||||
#define _BDS_PLATFORM_H
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/GenericBdsLib.h>
|
||||
#include <Library/PlatformBdsLib.h>
|
||||
#include <Library/GraphicsLib.h>
|
||||
|
||||
#endif // _BDS_PLATFORM_H
|
|
@ -0,0 +1,55 @@
|
|||
#/** @file
|
||||
# Component name for module GenericBdsLib
|
||||
#
|
||||
# FIX ME!
|
||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PlatformBdsLib
|
||||
FILE_GUID = 143B5044-7C1B-4904-9778-EA16F1F3D554
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PlatformBdsLib|DXE_DRIVER
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x0002000A
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
BdsPlatform.c
|
||||
PlatformData.c
|
||||
BdsPlatform.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
MemoryAllocationLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PcdLib
|
||||
GraphicsLib
|
||||
GenericBdsLib
|
||||
|
||||
[Guids]
|
||||
gEfiDefaultBmpLogoGuid
|
|
@ -0,0 +1,52 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PlatformData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Defined the platform specific device path which will be used by
|
||||
platform Bbd to perform the platform policy connect.
|
||||
|
||||
--*/
|
||||
|
||||
#include "BdsPlatform.h"
|
||||
|
||||
//
|
||||
// Predefined platform default time out value
|
||||
//
|
||||
UINT16 gPlatformBootTimeOutDefault = 10;
|
||||
|
||||
//
|
||||
// Platform specific keyboard device path
|
||||
//
|
||||
|
||||
//
|
||||
// Predefined platform default console device path
|
||||
//
|
||||
BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
||||
{
|
||||
NULL,
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Predefined platform specific driver option
|
||||
//
|
||||
EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption[] = { NULL };
|
||||
|
||||
//
|
||||
// Predefined platform connect sequence
|
||||
//
|
||||
EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[] = { NULL };
|
|
@ -33,6 +33,7 @@
|
|||
UdpIoLib|Include/Library/UdpIoLib.h
|
||||
S3Lib|Include/Library/S3Lib.h
|
||||
RecoveryLib|Include/Library/RecoveryLib.h
|
||||
GenericBdsLib.h|Include/Library/GenericBdsLib.h
|
||||
PlatDriOverLib|Include/Library/PlatDriOverLib.h
|
||||
|
||||
[Guids.common]
|
||||
|
@ -123,6 +124,7 @@
|
|||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE|BOOLEAN|0x00010042
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE|BOOLEAN|0x00010043
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|TRUE|BOOLEAN|0x00010044
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010044
|
||||
|
||||
[PcdsFixedAtBuild.common]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f
|
||||
|
@ -141,6 +143,8 @@
|
|||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0|UINT32|0x30000014
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0|UINT32|0x30000010
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x0|UINT32|0x30000011
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformBootTimeOutDefault|10|UINT16|0x40000001
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|1|UINT16|0x40000002
|
||||
|
||||
[PcdsDynamic.common]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001
|
||||
|
@ -149,6 +153,8 @@
|
|||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0|UINT32|0x30000014
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0|UINT32|0x30000010
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x0|UINT32|0x30000011
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformBootTimeOutDefault|10|UINT16|0x40000001
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|1|UINT16|0x40000002
|
||||
|
||||
[PcdsPatchableInModule.common]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|40|UINT8|0x0001002f
|
||||
|
@ -158,7 +164,8 @@
|
|||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0|UINT32|0x30000014
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0|UINT32|0x30000010
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x0|UINT32|0x30000011
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformBootTimeOutDefault|10|UINT16|0x40000001
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|1|UINT16|0x40000002
|
||||
|
||||
[PcdsFeatureFlag.IA32]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE|BOOLEAN|0x0001003b
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
|
||||
PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
FrameworkIfrSupportLib|IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf
|
||||
|
||||
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
|
||||
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
|
||||
PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf
|
||||
|
@ -64,14 +62,24 @@
|
|||
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
|
||||
FvbServiceLib|MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
|
||||
ScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
FrameworkHiiLib|IntelFrameworkPkg/Library/FrameworkHiiLib/HiiLib.inf
|
||||
HiiLib|MdePkg/Library/HiiLib/HiiLib.inf
|
||||
UsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
|
||||
NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
|
||||
IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
|
||||
UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
|
||||
DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
GraphicsLib|MdeModulepkg/Library/GraphicsLib/GraphicsLib.inf
|
||||
IfrSupportLib|MdeModulePkg/Library/IfrSupportLib/IfrSupportLib.inf
|
||||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
DxePiLib|MdePkg/Library/DxePiLib/DxePiLib.inf
|
||||
PlatformBdsLib|MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf
|
||||
GenericBdsLib|MdeModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
|
||||
GraphicsLib|MdeModulepkg/Library/GraphicsLib/GraphicsLib.inf
|
||||
IfrSupportLib|MdeModulePkg/Library/IfrSupportLib/IfrSupportLib.inf
|
||||
DxePiLib|MdePkg/Library/DxePiLib/DxePiLib.inf
|
||||
PlatformBdsLib|MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf
|
||||
GenericBdsLib|MdeModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
|
||||
PlatDriOverLib|MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf
|
||||
|
||||
[LibraryClasses.IA32]
|
||||
|
@ -261,9 +269,16 @@
|
|||
MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf
|
||||
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
|
||||
|
||||
MdeModulePkg/Library/IfrSupportLib/IfrSupportLib.inf
|
||||
MdeModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
|
||||
MdeModulepkg/Library/GraphicsLib/GraphicsLib.inf
|
||||
|
||||
MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf
|
||||
|
||||
MdeModulePkg/Universal/iScsi/IScsi.inf
|
||||
|
||||
MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
|
||||
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
|
||||
MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
|
||||
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
|
||||
|
@ -317,6 +332,10 @@
|
|||
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||
MdeModulePkg/Universal/Variable/Application/VariableInfo.inf
|
||||
|
||||
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
|
||||
|
||||
[Components.IA32]
|
||||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
|
@ -324,6 +343,7 @@
|
|||
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
|
||||
MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
||||
MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf
|
||||
MdeModulepkg/Library/GraphicsLib/GraphicsLib.inf
|
||||
|
||||
[Components.X64]
|
||||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Bds.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Head file for BDS Architectural Protocol implementation
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _BDS_MODULE_H_
|
||||
#define _BDS_MODULE_H_
|
||||
|
||||
#undef EFI_SPECIFICATION_VERSION
|
||||
#define EFI_SPECIFICATION_VERSION 0x0002000A
|
||||
#include <PiDxe.h>
|
||||
#include <MdeModuleHii.h>
|
||||
|
||||
#include <Guid/FileSystemVolumeLabelInfo.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Guid/BootState.h>
|
||||
#include <Guid/DataHubRecords.h>
|
||||
#include <Protocol/LoadFile.h>
|
||||
#include <Protocol/CpuIo.h>
|
||||
#include <Guid/HobList.h>
|
||||
#include <Guid/FileInfo.h>
|
||||
#include <Protocol/HiiConfigRouting.h>
|
||||
#include <Protocol/Bds.h>
|
||||
#include <Protocol/DataHub.h>
|
||||
#include <Protocol/UgaDraw.h>
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Guid/GenericPlatformVariable.h>
|
||||
#include <Guid/CapsuleVendor.h>
|
||||
#include <Protocol/ConsoleControl.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/Performance.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/GraphicsLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
#include <Library/PerformanceLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/IfrSupportLib.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/GenericBdsLib.h>
|
||||
#include <Library/PlatformBdsLib.h>
|
||||
|
||||
#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS(_this) \
|
||||
CR (_this, \
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE, \
|
||||
Bds, \
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE \
|
||||
)
|
||||
|
||||
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
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BdsInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
BdsEntry (
|
||||
IN EFI_BDS_ARCH_PROTOCOL *This
|
||||
);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,154 @@
|
|||
#/** @file
|
||||
# Component discription file for Bds module
|
||||
#
|
||||
# N/A
|
||||
# Copyright (c) 2008, Intel Corporation
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Bds
|
||||
FILE_GUID = FC5C7020-1A48-4198-9BE2-EAD5ABC8CF2F
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = BdsInitialize
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
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.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
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
BaseLib
|
||||
HobLib
|
||||
UefiRuntimeServicesTableLib
|
||||
IfrSupportLib
|
||||
GenericBdsLib
|
||||
ReportStatusCodeLib
|
||||
PerformanceLib
|
||||
DxeServicesTableLib
|
||||
MemoryAllocationLib
|
||||
GraphicsLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PrintLib
|
||||
HiiLib
|
||||
UefiDriverEntryPoint
|
||||
PlatformBdsLib
|
||||
CapsuleLib
|
||||
|
||||
[Guids]
|
||||
gEfiGlobalVariableGuid # ALWAYS_CONSUMED
|
||||
gEfiHobListGuid # ALWAYS_CONSUMED
|
||||
gEfiBootStateGuid # ALWAYS_CONSUMED
|
||||
gEfiFileSystemVolumeLabelInfoIdGuid # ALWAYS_CONSUMED
|
||||
gEfiFileInfoGuid # ALWAYS_CONSUMED
|
||||
gEfiGenericPlatformVariableGuid
|
||||
gEfiMiscSubClassGuid
|
||||
gEfiMemorySubClassGuid
|
||||
gEfiProcessorSubClassGuid
|
||||
gEfiCapsuleVendorGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiHiiStringProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSimpleFileSystemProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiLoadFileProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiCpuIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiBdsArchProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiGenericMemTestProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiConsoleControlProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiUgaDrawProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiBlockIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiGraphicsOutputProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSimpleTextInputExProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiFormBrowser2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSerialIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiAcpiS3SaveProtocolGuid
|
||||
|
||||
[FeaturePcd.common]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDepricate
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord
|
||||
|
||||
[Pcd.common]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel
|
||||
|
||||
[Depex]
|
||||
gEfiHiiDatabaseProtocolGuid
|
||||
|
|
@ -0,0 +1,238 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>BdsDxe</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>FC5C7020-1A48-4198-9BE2-EAD5ABC8CF2F</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component discription file for Bds module</Abstract>
|
||||
<Description>N/A</Description>
|
||||
<Copyright>Copyright (c) 2008, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>Bds</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EfiShellLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EdkGenericPlatformBdsLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EdkGraphicsLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DxeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PerformanceLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>ReportStatusCodeLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EdkGenericBdsLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EdkIfrSupportLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>HobLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>BdsEntry.c</Filename>
|
||||
<Filename>FrontPage.c</Filename>
|
||||
<Filename>FrontPageStrings.uni</Filename>
|
||||
<Filename>FrontPageVfr.Vfr</Filename>
|
||||
<Filename>Language.c</Filename>
|
||||
<Filename>String.c</Filename>
|
||||
<Filename>Strings.uni</Filename>
|
||||
<Filename>Capsules.c</Filename>
|
||||
<Filename>MemoryTest.c</Filename>
|
||||
<Filename>Hotkey.c</Filename>
|
||||
<Filename>BootMaint/Bmstring.uni</Filename>
|
||||
<Filename>BootMaint/Bm.vfr</Filename>
|
||||
<Filename>BootMaint/BmLib.c</Filename>
|
||||
<Filename>BootMaint/BootOption.c</Filename>
|
||||
<Filename>BootMaint/ConsoleOption.c</Filename>
|
||||
<Filename>BootMaint/Data.c</Filename>
|
||||
<Filename>BootMaint/Variable.c</Filename>
|
||||
<Filename>BootMaint/UpdatePage.c</Filename>
|
||||
<Filename>BootMaint/BBSsupport.c</Filename>
|
||||
<Filename>BootMaint/BootMaint.c</Filename>
|
||||
<Filename>BootMaint/FileExplorer.c</Filename>
|
||||
<Filename>BootMaint/FE.vfr</Filename>
|
||||
<Filename>BootMngr/BootManager.c</Filename>
|
||||
<Filename>BootMngr/BootManagerStrings.uni</Filename>
|
||||
<Filename>BootMngr/BootManagerVfr.Vfr</Filename>
|
||||
<Filename>DeviceMngr/DeviceManager.c</Filename>
|
||||
<Filename>DeviceMngr/DeviceManagerStrings.uni</Filename>
|
||||
<Filename>DeviceMngr/DeviceManagerVfr.Vfr</Filename>
|
||||
<Filename>Bds.dxs</Filename>
|
||||
<Filename>DeviceMngr/DeviceManager.h</Filename>
|
||||
<Filename>BootMaint/FormGuid.h</Filename>
|
||||
<Filename>String.h</Filename>
|
||||
<Filename>BootMaint/BootMaint.h</Filename>
|
||||
<Filename>BootMngr/BootManager.h</Filename>
|
||||
<Filename>BootMaint/BBSsupport.h</Filename>
|
||||
<Filename>Hotkey.h</Filename>
|
||||
<Filename>Bds.h</Filename>
|
||||
<Filename>Language.h</Filename>
|
||||
<Filename>FrontPage.h</Filename>
|
||||
<Filename>EdkILib.c</Filename>
|
||||
</SourceFiles>
|
||||
<NonProcessedFiles>
|
||||
<Filename>DeviceMngr/PlatOverMngr/PlatOverMngr.c</Filename>
|
||||
<Filename>DeviceMngr/PlatOverMngr/PlatOverMngr.dxs</Filename>
|
||||
<Filename>DeviceMngr/PlatOverMngr/PlatOverMngr.h</Filename>
|
||||
<Filename>DeviceMngr/PlatOverMngr/Vfr.vfr</Filename>
|
||||
<Filename>DeviceMngr/PlatOverMngr/VfrStrings.uni</Filename>
|
||||
<Filename>DeviceMngr/SetOptions/GetInfo.c</Filename>
|
||||
<Filename>DeviceMngr/SetOptions/GetInfo.h</Filename>
|
||||
<Filename>DeviceMngr/SetOptions/SetOptions.c</Filename>
|
||||
<Filename>DeviceMngr/SetOptions/SetOptions.h</Filename>
|
||||
<Filename>DeviceMngr/SetOptions/Vfr.vfr</Filename>
|
||||
<Filename>DeviceMngr/SetOptions/VfrStrings.uni</Filename>
|
||||
<Filename>HwErrRecSupport.c</Filename>
|
||||
<Filename>HwErrRecSupport.h</Filename>
|
||||
</NonProcessedFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
<Package PackageGuid="3bd11b88-bf8b-4d90-9e04-77c97e58bbdd"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiFormBrowser2ProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiConfigAccessProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiConfigRoutingProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSimpleTextInputExProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiDatabaseProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiLegacyBiosProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiGenericMemTestProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiBdsArchProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiCpuIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiStringProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiFlashMapHobGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gTerminalDriverGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiFileInfoGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiFileSystemVolumeLabelInfoIdGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiBootStateGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiHobListGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiGenericVariableGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiGlobalVariableGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>BdsInitialize</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,375 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BdsEntry.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The entry of the bds
|
||||
|
||||
--*/
|
||||
|
||||
#include "Bds.h"
|
||||
#include "Language.h"
|
||||
#include "FrontPage.h"
|
||||
#include "Hotkey.h"
|
||||
#include "HwErrRecSupport.h"
|
||||
|
||||
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE gBdsInstanceTemplate = {
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE,
|
||||
NULL,
|
||||
{BdsEntry},
|
||||
0xFFFF,
|
||||
TRUE,
|
||||
EXTENSIVE
|
||||
};
|
||||
|
||||
UINT16 *mBootNext = NULL;
|
||||
|
||||
EFI_HANDLE mBdsImageHandle;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BdsInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Install Boot Device Selection Protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - BDS has finished initializing.
|
||||
Rerun the
|
||||
dispatcher and recall BDS.Entry
|
||||
|
||||
Other - Return value from AllocatePool()
|
||||
or gBS->InstallProtocolInterface
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
mBdsImageHandle = ImageHandle;
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&gBdsInstanceTemplate.Handle,
|
||||
&gEfiBdsArchProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&gBdsInstanceTemplate.Bds
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
BdsBootDeviceSelect (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
In the loop of attempt to boot for the boot order
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
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;
|
||||
|
||||
//
|
||||
// Got the latest boot option
|
||||
//
|
||||
BootNextExist = FALSE;
|
||||
LinkBootNext = NULL;
|
||||
InitializeListHead (&BootLists);
|
||||
|
||||
//
|
||||
// First check the boot next option
|
||||
//
|
||||
ZeroMem (Buffer, sizeof (Buffer));
|
||||
|
||||
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
|
||||
//
|
||||
gRT->SetVariable (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
0,
|
||||
mBootNext
|
||||
);
|
||||
|
||||
//
|
||||
// Add the boot next boot option
|
||||
//
|
||||
UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);
|
||||
BootOption = BdsLibVariableToOption (&BootLists, Buffer);
|
||||
BootOption->BootCurrent = *mBootNext;
|
||||
}
|
||||
//
|
||||
// Parse the boot order to get boot option
|
||||
//
|
||||
BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
|
||||
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) {
|
||||
//
|
||||
// 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, becuase 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);
|
||||
}
|
||||
//
|
||||
// All the driver options should have been processed since
|
||||
// now boot will be performed.
|
||||
//
|
||||
Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// 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
|
||||
//
|
||||
Timeout = 0xffff;
|
||||
PlatformBdsEnterFrontPage (Timeout, FALSE);
|
||||
|
||||
//
|
||||
// Rescan the boot option list, avoid pertential 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
BdsEntry (
|
||||
IN EFI_BDS_ARCH_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Service routine for BdsInstance->Entry(). Devices are connected, the
|
||||
consoles are initialized, and the boot options are tried.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol Instance structure.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - BDS->Entry has finished executing.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData;
|
||||
LIST_ENTRY DriverOptionList;
|
||||
LIST_ENTRY BootOptionList;
|
||||
UINTN BootNextSize;
|
||||
|
||||
//
|
||||
// Insert the performance probe
|
||||
//
|
||||
PERF_END (0, DXE_TOK, NULL, 0);
|
||||
PERF_START (0, BDS_TOK, NULL, 0);
|
||||
|
||||
//
|
||||
// Initialize the global system boot option and driver option
|
||||
//
|
||||
InitializeListHead (&DriverOptionList);
|
||||
InitializeListHead (&BootOptionList);
|
||||
|
||||
//
|
||||
// Initialize hotkey service
|
||||
//
|
||||
InitializeHotkeyService ();
|
||||
|
||||
//
|
||||
// Get the BDS private data
|
||||
//
|
||||
PrivateData = EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS (This);
|
||||
|
||||
//
|
||||
// Do the platform init, can be customized by OEM/IBV
|
||||
//
|
||||
PERF_START (0, "PlatformBds", "BDS", 0);
|
||||
PlatformBdsInit (PrivateData);
|
||||
|
||||
if (FeaturePcdGet (PcdSupportHardwareErrorRecord)) {
|
||||
InitializeHwErrRecSupport (PcdGet16 (PcdHardwareErrorRecordLevel));
|
||||
}
|
||||
//
|
||||
// bugbug: platform specific code
|
||||
// Initialize the platform specific string and language
|
||||
//
|
||||
InitializeStringSupport ();
|
||||
InitializeLanguage (TRUE);
|
||||
InitializeFrontPage (FALSE);
|
||||
|
||||
//
|
||||
// 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 (PrivateData, &DriverOptionList, &BootOptionList);
|
||||
PERF_END (0, "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 ;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,78 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BBSsupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
declares interface functions
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_BDS_BBS_SUPPORT_H
|
||||
#define _EFI_BDS_BBS_SUPPORT_H
|
||||
|
||||
#include "BootMaint.h"
|
||||
//
|
||||
// Bugbug: Candidate for a PCD entries
|
||||
//
|
||||
#define MAX_BBS_ENTRIES 0x100
|
||||
|
||||
VOID
|
||||
BdsBuildLegacyDevNameString (
|
||||
IN BBS_TABLE *CurBBSEntry,
|
||||
IN UINTN Index,
|
||||
IN UINTN BufSize,
|
||||
OUT CHAR16 *BootString
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsDeleteAllInvalidLegacyBootOptions (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsAddNonExistingLegacyBootOptions (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Add the legacy boot options from BBS table if they do not exist.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The boot options are added successfully or they are already in boot options.
|
||||
others - An error occurred when creating legacy boot options.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
BdsUpdateLegacyDevOrder (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsRefreshBbsTableForBoot (
|
||||
IN BDS_COMMON_OPTION *Entry
|
||||
);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,391 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2004 - 2007, Intel Corporation
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// bm.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Boot Maintenance Utility Formset
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "FormGuid.h"
|
||||
|
||||
#define LABEL_END 0xffff
|
||||
|
||||
formset
|
||||
guid = BOOT_MAINT_FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FORM_MAIN_TITLE),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
class = 0,
|
||||
subclass = 0,
|
||||
|
||||
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);
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),
|
||||
text = STRING_TOKEN(STR_BOOT_FROM_FILE),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
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);
|
||||
|
||||
goto FORM_MAIN_ID,
|
||||
prompt = STRING_TOKEN(STR_RESET),
|
||||
help = 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_NEXT_BOOT_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_NEXT_BOOT_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_ADD_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
|
||||
|
||||
label FORM_BOOT_ADD_ID;
|
||||
label LABEL_END;
|
||||
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_FILE_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE);
|
||||
|
||||
label FORM_DRV_ADD_FILE_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;
|
|
@ -0,0 +1,563 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
bmlib.c
|
||||
|
||||
AgBStract:
|
||||
|
||||
Boot Maintainence Helper functions
|
||||
|
||||
--*/
|
||||
|
||||
#include "BootMaint.h"
|
||||
|
||||
VOID *
|
||||
EfiAllocateZeroPool (
|
||||
IN UINTN Size
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Wrap original AllocatePool gBS call
|
||||
and ZeroMem gBS call into a single
|
||||
function in order to decrease code length
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
Valid pointer to the allocated buffer
|
||||
Null for failure
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Ptr;
|
||||
Status = gBS->AllocatePool (EfiBootServicesData, Size, &Ptr);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Ptr = NULL;
|
||||
return Ptr;
|
||||
}
|
||||
|
||||
ZeroMem (Ptr, Size);
|
||||
return Ptr;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EfiLibLocateProtocol (
|
||||
IN EFI_GUID *ProtocolGuid,
|
||||
OUT VOID **Interface
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Find the first instance of this Protocol
|
||||
in the system and return it's interface
|
||||
|
||||
Arguments:
|
||||
|
||||
ProtocolGuid - Provides the protocol to search for
|
||||
Interface - On return, a pointer to the first interface
|
||||
that matches ProtocolGuid
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - A protocol instance matching ProtocolGuid was found
|
||||
|
||||
EFI_NOT_FOUND - No protocol instances were found that match ProtocolGuid
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
ProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) Interface
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_FILE_HANDLE
|
||||
EfiLibOpenRoot (
|
||||
IN EFI_HANDLE DeviceHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Function opens and returns a file handle to the root directory of a volume.
|
||||
|
||||
Arguments:
|
||||
|
||||
DeviceHandle - A handle for a device
|
||||
|
||||
Returns:
|
||||
|
||||
A valid file handle or NULL is returned
|
||||
|
||||
--*/
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EfiGrowBuffer (
|
||||
IN OUT EFI_STATUS *Status,
|
||||
IN OUT VOID **Buffer,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Helper function called as part of the code needed
|
||||
to allocate the proper sized buffer for various
|
||||
EFI interfaces.
|
||||
|
||||
Arguments:
|
||||
|
||||
Status - Current status
|
||||
|
||||
Buffer - Current allocated buffer, or NULL
|
||||
|
||||
BufferSize - Current buffer size needed
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE - if the buffer was reallocated and the caller
|
||||
should try the API again.
|
||||
|
||||
--*/
|
||||
{
|
||||
BOOLEAN TryAgain;
|
||||
|
||||
//
|
||||
// If this is an initial request, buffer will be null with a new buffer size
|
||||
//
|
||||
if (!*Buffer && BufferSize) {
|
||||
*Status = EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
//
|
||||
// If the status code is "buffer too small", resize the buffer
|
||||
//
|
||||
TryAgain = FALSE;
|
||||
if (*Status == EFI_BUFFER_TOO_SMALL) {
|
||||
|
||||
SafeFreePool (*Buffer);
|
||||
|
||||
*Buffer = EfiAllocateZeroPool (BufferSize);
|
||||
|
||||
if (*Buffer) {
|
||||
TryAgain = TRUE;
|
||||
} else {
|
||||
*Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
//
|
||||
// If there's an error, free the buffer
|
||||
//
|
||||
if (!TryAgain && EFI_ERROR (*Status) && *Buffer) {
|
||||
SafeFreePool (*Buffer);
|
||||
*Buffer = NULL;
|
||||
}
|
||||
|
||||
return TryAgain;
|
||||
}
|
||||
|
||||
VOID *
|
||||
EfiLibGetVariable (
|
||||
IN CHAR16 *Name,
|
||||
IN EFI_GUID *VendorGuid
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function returns the value of the specified variable.
|
||||
|
||||
Arguments:
|
||||
Name - A Null-terminated Unicode string that is
|
||||
the name of the vendor's variable.
|
||||
|
||||
VendorGuid - A unique identifier for the vendor.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN VarSize;
|
||||
|
||||
return BdsLibGetVariableAndSize (Name, VendorGuid, &VarSize);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EfiLibDeleteVariable (
|
||||
IN CHAR16 *VarName,
|
||||
IN EFI_GUID *VarGuid
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function deletes the variable specified by VarName and VarGuid.
|
||||
|
||||
Arguments:
|
||||
VarName - A Null-terminated Unicode string that is
|
||||
the name of the vendor's variable.
|
||||
|
||||
VendorGuid - A unique identifier for the vendor.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The variable was found and removed
|
||||
|
||||
EFI_UNSUPPORTED - The variable store was inaccessible
|
||||
|
||||
EFI_OUT_OF_RESOURCES - The temporary buffer was not available
|
||||
|
||||
EFI_NOT_FOUND - The variable was not found
|
||||
|
||||
--*/
|
||||
{
|
||||
VOID *VarBuf;
|
||||
EFI_STATUS Status;
|
||||
|
||||
VarBuf = EfiLibGetVariable (VarName, VarGuid);
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
||||
if (VarBuf) {
|
||||
//
|
||||
// Delete variable from Storage
|
||||
//
|
||||
Status = gRT->SetVariable (VarName, VarGuid, VAR_FLAG, 0, NULL);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
SafeFreePool (VarBuf);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
|
||||
EfiLibFileSystemVolumeLabelInfo (
|
||||
IN EFI_FILE_HANDLE FHand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Function gets the file system information from an open file descriptor,
|
||||
and stores it in a buffer allocated from pool.
|
||||
|
||||
Arguments:
|
||||
|
||||
Fhand - A file handle
|
||||
|
||||
Returns:
|
||||
|
||||
A pointer to a buffer with file information or NULL is returned
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Buffer;
|
||||
UINTN BufferSize;
|
||||
//
|
||||
// Initialize for GrowBuffer loop
|
||||
//
|
||||
Buffer = NULL;
|
||||
BufferSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + 200;
|
||||
|
||||
//
|
||||
// Call the real function
|
||||
//
|
||||
while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
|
||||
Status = FHand->GetInfo (
|
||||
FHand,
|
||||
&gEfiFileSystemVolumeLabelInfoIdGuid,
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
}
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
CHAR16 *
|
||||
EfiStrDuplicate (
|
||||
IN CHAR16 *Src
|
||||
)
|
||||
{
|
||||
CHAR16 *Dest;
|
||||
UINTN Size;
|
||||
|
||||
Size = StrSize (Src);
|
||||
Dest = EfiAllocateZeroPool (Size);
|
||||
ASSERT (Dest != NULL);
|
||||
if (Dest) {
|
||||
CopyMem (Dest, Src, Size);
|
||||
}
|
||||
|
||||
return Dest;
|
||||
}
|
||||
|
||||
EFI_FILE_INFO *
|
||||
EfiLibFileInfo (
|
||||
IN EFI_FILE_HANDLE FHand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Function gets the file information from an open file descriptor, and stores it
|
||||
in a buffer allocated from pool.
|
||||
|
||||
Arguments:
|
||||
|
||||
Fhand - A file handle
|
||||
|
||||
Returns:
|
||||
|
||||
A pointer to a buffer with file information or NULL is returned
|
||||
|
||||
--*/
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
UINTN
|
||||
EfiDevicePathInstanceCount (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function is used to determine the number of device path instances
|
||||
that exist in a device path.
|
||||
|
||||
Arguments:
|
||||
DevicePath - A pointer to a device path data structure.
|
||||
|
||||
Returns:
|
||||
|
||||
This function counts and returns the number of device path instances
|
||||
in DevicePath.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Count;
|
||||
UINTN Size;
|
||||
|
||||
Count = 0;
|
||||
while (GetNextDevicePathInstance (&DevicePath, &Size)) {
|
||||
Count += 1;
|
||||
}
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
VOID *
|
||||
EfiReallocatePool (
|
||||
IN VOID *OldPool,
|
||||
IN UINTN OldSize,
|
||||
IN UINTN NewSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Adjusts the size of a previously allocated buffer.
|
||||
|
||||
Arguments:
|
||||
OldPool - A pointer to the buffer whose size is being adjusted.
|
||||
OldSize - The size of the current buffer.
|
||||
NewSize - The size of the new buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - The requested number of bytes were allocated.
|
||||
|
||||
EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
|
||||
|
||||
EFI_INVALID_PARAMETER - The buffer was invalid.
|
||||
|
||||
--*/
|
||||
{
|
||||
VOID *NewPool;
|
||||
|
||||
NewPool = NULL;
|
||||
if (NewSize) {
|
||||
NewPool = EfiAllocateZeroPool (NewSize);
|
||||
}
|
||||
|
||||
if (OldPool) {
|
||||
if (NewPool) {
|
||||
CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
|
||||
}
|
||||
|
||||
SafeFreePool (OldPool);
|
||||
}
|
||||
|
||||
return NewPool;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
TimeCompare (
|
||||
IN EFI_TIME *FirstTime,
|
||||
IN EFI_TIME *SecondTime
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Compare two EFI_TIME data.
|
||||
|
||||
Arguments:
|
||||
|
||||
FirstTime - A pointer to the first EFI_TIME data.
|
||||
SecondTime - A pointer to the second EFI_TIME data.
|
||||
|
||||
Returns:
|
||||
TRUE The FirstTime is not later than the SecondTime.
|
||||
FALSE The FirstTime is later than the SecondTime.
|
||||
|
||||
--*/
|
||||
{
|
||||
if (FirstTime->Year != SecondTime->Year) {
|
||||
return (BOOLEAN) (FirstTime->Year < SecondTime->Year);
|
||||
} else if (FirstTime->Month != SecondTime->Month) {
|
||||
return (BOOLEAN) (FirstTime->Month < SecondTime->Month);
|
||||
} else if (FirstTime->Day != SecondTime->Day) {
|
||||
return (BOOLEAN) (FirstTime->Day < SecondTime->Day);
|
||||
} else if (FirstTime->Hour != SecondTime->Hour) {
|
||||
return (BOOLEAN) (FirstTime->Hour < SecondTime->Hour);
|
||||
} else if (FirstTime->Minute != SecondTime->Minute) {
|
||||
return (BOOLEAN) (FirstTime->Minute < FirstTime->Minute);
|
||||
} else if (FirstTime->Second != SecondTime->Second) {
|
||||
return (BOOLEAN) (FirstTime->Second < SecondTime->Second);
|
||||
}
|
||||
|
||||
return (BOOLEAN) (FirstTime->Nanosecond <= SecondTime->Nanosecond);
|
||||
}
|
||||
|
||||
UINT16 *
|
||||
EfiLibStrFromDatahub (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 *Desc;
|
||||
EFI_DATA_HUB_PROTOCOL *Datahub;
|
||||
UINT64 Count;
|
||||
EFI_DATA_RECORD_HEADER *Record;
|
||||
EFI_SUBCLASS_TYPE1_HEADER *DataHdr;
|
||||
EFI_GUID MiscGuid = EFI_MISC_SUBCLASS_GUID;
|
||||
EFI_MISC_ONBOARD_DEVICE_DATA *ob;
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *Port;
|
||||
EFI_TIME CurTime;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDataHubProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &Datahub
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = gRT->GetTime (&CurTime, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Count = 0;
|
||||
do {
|
||||
Status = Datahub->GetNextRecord (Datahub, &Count, NULL, &Record);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA && CompareGuid (&Record->DataRecordGuid, &MiscGuid)) {
|
||||
//
|
||||
// This record is what we need
|
||||
//
|
||||
DataHdr = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
|
||||
if (EFI_MISC_ONBOARD_DEVICE_RECORD_NUMBER == DataHdr->RecordType) {
|
||||
ob = (EFI_MISC_ONBOARD_DEVICE_DATA *) (DataHdr + 1);
|
||||
if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &ob->OnBoardDevicePath, DevPath)) {
|
||||
GetProducerString (&Record->ProducerName, ob->OnBoardDeviceDescription, &Desc);
|
||||
return Desc;
|
||||
}
|
||||
}
|
||||
|
||||
if (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER == DataHdr->RecordType) {
|
||||
Port = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) (DataHdr + 1);
|
||||
if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &Port->PortPath, DevPath)) {
|
||||
GetProducerString (&Record->ProducerName, Port->PortExternalConnectorDesignator, &Desc);
|
||||
return Desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while (TimeCompare (&Record->LogTime, &CurTime) && Count != 0);
|
||||
|
||||
return NULL;
|
||||
}
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,992 @@
|
|||
/*++
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
consoleoption.c
|
||||
|
||||
Abstract:
|
||||
|
||||
handles console redirection from boot manager
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "BootMaint.h"
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
DevicePathInstanceDup (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UpdateComAttributeFromVariable (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
ChangeTerminalDevicePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
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;
|
||||
UINT32 Match;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
Node = DevicePath;
|
||||
Node = NextDevicePathNode (Node);
|
||||
Com = 0;
|
||||
while (!IsDevicePathEnd (Node)) {
|
||||
if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Node;
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
|
||||
}
|
||||
}
|
||||
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);
|
||||
if (NULL == NewMenuEntry) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
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)
|
||||
);
|
||||
//
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
ChangeVariableDevicePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
UINTN Com;
|
||||
UINT32 Match;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
Node = DevicePath;
|
||||
Node = NextDevicePathNode (Node);
|
||||
Com = 0;
|
||||
while (!IsDevicePathEnd (Node)) {
|
||||
if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Node;
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
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);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
RetrieveUartUid (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN OUT UINT32 *AcpiUid
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieve ACPI UID of UART from device path
|
||||
|
||||
Arguments:
|
||||
Handles - EFI_SERIAL_IO_PROTOCOL handle
|
||||
|
||||
Returns:
|
||||
TRUE - Find valid UID from device path
|
||||
FALSE - Can't find
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 Match;
|
||||
UINT8 *Ptr;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath
|
||||
);
|
||||
Ptr = (UINT8 *) DevicePath;
|
||||
|
||||
while (*Ptr != END_DEVICE_PATH_TYPE) {
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
if (AcpiUid != NULL) {
|
||||
*AcpiUid = Acpi->UID;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
SortedUartHandle (
|
||||
IN EFI_HANDLE *Handles,
|
||||
IN UINTN NoHandles
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Sort Uart handles array with Acpi->UID from low to high
|
||||
|
||||
Arguments:
|
||||
Handles - EFI_SERIAL_IO_PROTOCOL handle buffer
|
||||
NoHandles - EFI_SERIAL_IO_PROTOCOL handle count
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsTerminalDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT TYPE_OF_TERMINAL *Termi,
|
||||
OUT UINTN *Com
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LocateSerialIo (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Build a list containing all serial devices
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 *Ptr;
|
||||
UINTN Index;
|
||||
UINTN Index2;
|
||||
UINTN NoHandles;
|
||||
EFI_HANDLE *Handles;
|
||||
EFI_STATUS Status;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINT32 Match;
|
||||
EFI_SERIAL_IO_PROTOCOL *SerialIo;
|
||||
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;
|
||||
//
|
||||
// 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
|
||||
);
|
||||
Ptr = (UINT8 *) DevicePath;
|
||||
while (*Ptr != END_DEVICE_PATH_TYPE) {
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);
|
||||
if (!NewMenuEntry) {
|
||||
SafeFreePool (Handles);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));
|
||||
NewTerminalContext->DevicePath = DevicePathInstanceDup (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)
|
||||
);
|
||||
InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);
|
||||
TerminalMenu.MenuNumber++;
|
||||
}
|
||||
}
|
||||
SafeFreePool (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) {
|
||||
UpdateComAttributeFromVariable (OutDevicePath);
|
||||
}
|
||||
|
||||
if (InpDevicePath) {
|
||||
UpdateComAttributeFromVariable (InpDevicePath);
|
||||
}
|
||||
|
||||
if (ErrDevicePath) {
|
||||
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, &Guid[Index2], sizeof (EFI_GUID));
|
||||
SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
|
||||
NewDevicePath = AppendDevicePathNode (
|
||||
NewTerminalContext->DevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &Vendor
|
||||
);
|
||||
SafeFreePool (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;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
UpdateComAttributeFromVariable (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Update Com Ports attributes from DevicePath
|
||||
|
||||
Arguments:
|
||||
DevicePath - DevicePath that contains Com ports
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
EFI_DEVICE_PATH_PROTOCOL *SerialNode;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
UART_DEVICE_PATH *Uart1;
|
||||
UINT32 Match;
|
||||
UINTN TerminalNumber;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
UINTN Index;
|
||||
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
Node = DevicePath;
|
||||
Node = NextDevicePathNode (Node);
|
||||
TerminalNumber = 0;
|
||||
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
|
||||
while (!IsDevicePathEnd (Node)) {
|
||||
if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Node;
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
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)
|
||||
);
|
||||
|
||||
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)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
SerialNode = NextDevicePathNode (SerialNode);
|
||||
}
|
||||
//
|
||||
// end while
|
||||
//
|
||||
}
|
||||
|
||||
Node = NextDevicePathNode (Node);
|
||||
}
|
||||
//
|
||||
// end while
|
||||
//
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
DevicePathInstanceDup (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function creates a device path data structure that identically matches the
|
||||
device path passed in.
|
||||
|
||||
Arguments:
|
||||
DevPath - A pointer to a device path data structure.
|
||||
|
||||
Returns:
|
||||
|
||||
The new copy of DevPath is created to identically match the input.
|
||||
Otherwise, NULL is returned.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Temp;
|
||||
UINT8 *Ptr;
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// get the size of an instance from the input
|
||||
//
|
||||
Temp = DevPath;
|
||||
DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);
|
||||
|
||||
//
|
||||
// Make a copy and set proper end type
|
||||
//
|
||||
NewDevPath = NULL;
|
||||
if (Size) {
|
||||
NewDevPath = EfiAllocateZeroPool (Size);
|
||||
ASSERT (NewDevPath != NULL);
|
||||
}
|
||||
|
||||
if (NewDevPath) {
|
||||
CopyMem (NewDevPath, DevicePathInst, Size);
|
||||
Ptr = (UINT8 *) NewDevPath;
|
||||
Ptr += Size - sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
Temp = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
|
||||
SetDevicePathEndNode (Temp);
|
||||
}
|
||||
|
||||
return NewDevPath;
|
||||
}
|
||||
|
||||
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 Out Devices
|
||||
//
|
||||
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 = DevicePathInstanceDup (DevicePathInst);
|
||||
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;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetAllConsoles (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS
|
||||
Others
|
||||
|
||||
--*/
|
||||
{
|
||||
GetConsoleMenu (BM_CONSOLE_IN_CONTEXT_SELECT);
|
||||
GetConsoleMenu (BM_CONSOLE_OUT_CONTEXT_SELECT);
|
||||
GetConsoleMenu (BM_CONSOLE_ERR_CONTEXT_SELECT);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
FreeAllConsoles (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS
|
||||
Others
|
||||
|
||||
--*/
|
||||
{
|
||||
BOpt_FreeMenu (&ConsoleOutMenu);
|
||||
BOpt_FreeMenu (&ConsoleInpMenu);
|
||||
BOpt_FreeMenu (&ConsoleErrMenu);
|
||||
BOpt_FreeMenu (&TerminalMenu);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsTerminalDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT TYPE_OF_TERMINAL *Termi,
|
||||
OUT UINTN *Com
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Test whether DevicePath is a valid Terminal
|
||||
|
||||
Arguments:
|
||||
DevicePath - DevicePath to be checked
|
||||
Termi - If is terminal, give its type
|
||||
Com - If is Com Port, give its type
|
||||
|
||||
Returns:
|
||||
TRUE - If DevicePath point to a Terminal
|
||||
FALSE
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 *Ptr;
|
||||
BOOLEAN IsTerminal;
|
||||
VENDOR_DEVICE_PATH *Vendor;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
UINT32 Match;
|
||||
EFI_GUID TempGuid;
|
||||
|
||||
IsTerminal = FALSE;
|
||||
|
||||
//
|
||||
// Parse the Device Path, should be change later!!!
|
||||
//
|
||||
Ptr = (UINT8 *) DevicePath;
|
||||
while (*Ptr != END_DEVICE_PATH_TYPE) {
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
Ptr = Ptr - sizeof (VENDOR_DEVICE_PATH);
|
||||
Vendor = (VENDOR_DEVICE_PATH *) Ptr;
|
||||
|
||||
//
|
||||
// There are four kinds of Terminal types
|
||||
// check to see whether this devicepath
|
||||
// is one of that type
|
||||
//
|
||||
CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));
|
||||
|
||||
if (CompareGuid (&TempGuid, &Guid[0])) {
|
||||
*Termi = PC_ANSI;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
if (CompareGuid (&TempGuid, &Guid[1])) {
|
||||
*Termi = VT_100;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
if (CompareGuid (&TempGuid, &Guid[2])) {
|
||||
*Termi = VT_100_PLUS;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
if (CompareGuid (&TempGuid, &Guid[3])) {
|
||||
*Termi = VT_UTF8;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
IsTerminal = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsTerminal) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
CopyMem (Com, &Acpi->UID, sizeof (UINT32));
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID
|
||||
GetConsoleOutMode (
|
||||
IN BMM_CALLBACK_DATA *CallbackData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Get mode number according to column and row
|
||||
|
||||
Arguments:
|
||||
CallbackData - BMM_CALLBACK_DATA
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Col;
|
||||
UINTN Row;
|
||||
UINTN CurrentCol;
|
||||
UINTN CurrentRow;
|
||||
UINTN Mode;
|
||||
UINTN MaxMode;
|
||||
EFI_STATUS Status;
|
||||
CONSOLE_OUT_MODE *ModeInfo;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
|
||||
|
||||
ConOut = gST->ConOut;
|
||||
MaxMode = (UINTN) (ConOut->Mode->MaxMode);
|
||||
ModeInfo = EfiLibGetVariable (VarConOutMode, &gEfiGenericPlatformVariableGuid);
|
||||
|
||||
if (ModeInfo != NULL) {
|
||||
CurrentCol = ModeInfo->Column;
|
||||
CurrentRow = ModeInfo->Row;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SafeFreePool (ModeInfo);
|
||||
}
|
|
@ -0,0 +1,324 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Data.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Define some data used for Boot Maint
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "BootMaint.h"
|
||||
|
||||
EFI_HII_UPDATE_DATA gUpdateData;
|
||||
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),
|
||||
};
|
||||
|
||||
//
|
||||
// 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 Guid[4] = {
|
||||
DEVICE_PATH_MESSAGING_PC_ANSI,
|
||||
DEVICE_PATH_MESSAGING_VT_100,
|
||||
DEVICE_PATH_MESSAGING_VT_100_PLUS,
|
||||
DEVICE_PATH_MESSAGING_VT_UTF8
|
||||
};
|
|
@ -0,0 +1,134 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2004 - 2007, Intel Corporation
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// FE.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// File Explorer Formset
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "FormGuid.h"
|
||||
|
||||
#define LABEL_END 0xffff
|
||||
|
||||
formset
|
||||
guid = FILE_EXPLORE_FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
class = 0,
|
||||
subclass = 0,
|
||||
|
||||
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.DescriptionData,
|
||||
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
minsize = 6,
|
||||
maxsize = 75,
|
||||
endstring;
|
||||
|
||||
string varid = FeData.OptionalData,
|
||||
prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
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),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
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),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
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.DescriptionData,
|
||||
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
minsize = 6,
|
||||
maxsize = 75,
|
||||
endstring;
|
||||
|
||||
string varid = FeData.OptionalData,
|
||||
prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
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),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
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),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER;
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
|
@ -0,0 +1,327 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
FileExplorer.c
|
||||
|
||||
Abstract:
|
||||
|
||||
File explorer related functions.
|
||||
|
||||
--*/
|
||||
|
||||
#include "BootMaint.h"
|
||||
|
||||
VOID
|
||||
UpdateFileExplorePage (
|
||||
IN BMM_CALLBACK_DATA *CallbackData,
|
||||
BM_MENU_OPTION *MenuOption
|
||||
)
|
||||
/*++
|
||||
Routine Description:
|
||||
Update the File Explore page.
|
||||
|
||||
Arguments:
|
||||
MenuOption - Pointer to menu options to display.
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
BM_FILE_CONTEXT *NewFileContext;
|
||||
EFI_FORM_ID FormId;
|
||||
|
||||
NewMenuEntry = NULL;
|
||||
NewFileContext = NULL;
|
||||
FormId = 0;
|
||||
|
||||
RefreshUpdateData ();
|
||||
|
||||
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) || (BOOT_FROM_FILE_STATE == CallbackData->FeCurrentState)) {
|
||||
//
|
||||
// Create Text opcode for directory, also create Text opcode for file in BOOT_FROM_FILE_STATE.
|
||||
//
|
||||
CreateActionOpCode (
|
||||
(UINT16) (FILE_OPTION_OFFSET + Index),
|
||||
NewMenuEntry->DisplayStringToken,
|
||||
STRING_TOKEN (STR_NULL_STRING),
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
0,
|
||||
&gUpdateData
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Create Goto opcode for file in ADD_BOOT_OPTION_STATE or ADD_DRIVER_OPTION_STATE.
|
||||
//
|
||||
if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
|
||||
FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
|
||||
} else if (ADD_DRIVER_OPTION_STATE == CallbackData->FeCurrentState) {
|
||||
FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
|
||||
}
|
||||
|
||||
CreateGotoOpCode (
|
||||
FormId,
|
||||
NewMenuEntry->DisplayStringToken,
|
||||
STRING_TOKEN (STR_NULL_STRING),
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
(UINT16) (FILE_OPTION_OFFSET + Index),
|
||||
&gUpdateData
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
IfrLibUpdateForm (
|
||||
CallbackData->FeHiiHandle,
|
||||
&mFileExplorerGuid,
|
||||
FORM_FILE_EXPLORER_ID,
|
||||
FORM_FILE_EXPLORER_ID,
|
||||
FALSE,
|
||||
&gUpdateData
|
||||
);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
UpdateFileExplorer (
|
||||
IN BMM_CALLBACK_DATA *CallbackData,
|
||||
IN UINT16 KeyValue
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Update the file explower page with the refershed file system.
|
||||
|
||||
Arguments:
|
||||
CallbackData - BMM context data
|
||||
KeyValue - Key value to identify the type of data to expect.
|
||||
|
||||
Returns:
|
||||
TRUE - Inform the caller to create a callback packet to exit file explorer.
|
||||
FALSE - Indicate that there is no need to exit file explorer.
|
||||
|
||||
--*/
|
||||
{
|
||||
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 (UNKNOWN_CONTEXT == CallbackData->FeDisplayContext) {
|
||||
//
|
||||
// First in, display file system.
|
||||
//
|
||||
BOpt_FreeMenu (&FsOptionMenu);
|
||||
BOpt_FindFileSystem (CallbackData);
|
||||
CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &FsOptionMenu);
|
||||
|
||||
UpdateFileExplorePage (CallbackData, &FsOptionMenu);
|
||||
|
||||
CallbackData->FeDisplayContext = FILE_SYSTEM;
|
||||
} else {
|
||||
if (FILE_SYSTEM == CallbackData->FeDisplayContext) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&FsOptionMenu, FileOptionMask);
|
||||
} else if (DIRECTORY == CallbackData->FeDisplayContext) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&DirectoryMenu, FileOptionMask);
|
||||
}
|
||||
|
||||
CallbackData->FeDisplayContext = DIRECTORY;
|
||||
|
||||
NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
|
||||
if (NewFileContext->IsDir ) {
|
||||
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 BOOT_FROM_FILE_STATE:
|
||||
//
|
||||
// Here boot from file
|
||||
//
|
||||
BootThisFile (NewFileContext);
|
||||
ExitFileExplorer = TRUE;
|
||||
break;
|
||||
|
||||
case ADD_BOOT_OPTION_STATE:
|
||||
case ADD_DRIVER_OPTION_STATE:
|
||||
if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
|
||||
FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
|
||||
} else {
|
||||
FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
|
||||
}
|
||||
|
||||
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 ();
|
||||
|
||||
CreateSubTitleOpCode (
|
||||
NewMenuEntry->DisplayStringToken,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&gUpdateData
|
||||
);
|
||||
|
||||
IfrLibUpdateForm (
|
||||
CallbackData->FeHiiHandle,
|
||||
&mFileExplorerGuid,
|
||||
FormId,
|
||||
FormId,
|
||||
FALSE,
|
||||
&gUpdateData
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit:
|
||||
return ExitFileExplorer;
|
||||
}
|
||||
|
||||
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
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
Arguments:
|
||||
This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
Action - Specifies the type of action taken by the browser.
|
||||
QuestionId - A unique value which is sent to the original exporting driver
|
||||
so that it can identify the type of data to expect.
|
||||
Type - The type of value for the question.
|
||||
Value - A pointer to the data being sent to the original exporting driver.
|
||||
ActionRequest - On return, points to the action requested by the callback function.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The callback successfully handled the action.
|
||||
EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.
|
||||
EFI_DEVICE_ERROR - The variable could not be saved.
|
||||
EFI_UNSUPPORTED - The specified Action is not supported by the callback.
|
||||
|
||||
--*/
|
||||
{
|
||||
BMM_CALLBACK_DATA *Private;
|
||||
FILE_EXPLORER_NV_DATA *NvRamMap;
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
|
||||
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Private = FE_CALLBACK_DATA_FROM_THIS (This);
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
|
||||
|
||||
//
|
||||
// Retrive uncommitted data from Form Browser
|
||||
//
|
||||
NvRamMap = &Private->FeFakeNvData;
|
||||
BufferSize = sizeof (FILE_EXPLORER_NV_DATA);
|
||||
Status = GetBrowserData (NULL, NULL, &BufferSize, (UINT8 *) NvRamMap);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) {
|
||||
//
|
||||
// Apply changes and exit formset
|
||||
//
|
||||
if (ADD_BOOT_OPTION_STATE == Private->FeCurrentState) {
|
||||
Status = Var_UpdateBootOption (Private, NvRamMap);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOpt_GetBootOptions (Private);
|
||||
CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);
|
||||
} else if (ADD_DRIVER_OPTION_STATE == Private->FeCurrentState) {
|
||||
Status = Var_UpdateDriverOption (
|
||||
Private,
|
||||
Private->FeHiiHandle,
|
||||
NvRamMap->DescriptionData,
|
||||
NvRamMap->OptionalData,
|
||||
NvRamMap->ForceReconnect
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOpt_GetDriverOptions (Private);
|
||||
CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);
|
||||
}
|
||||
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
} else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
|
||||
//
|
||||
// Discard changes and exit formset
|
||||
//
|
||||
NvRamMap->OptionalData[0] = 0x0000;
|
||||
NvRamMap->DescriptionData[0] = 0x0000;
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
} else if (QuestionId < FILE_OPTION_OFFSET) {
|
||||
//
|
||||
// Exit File Explorer formset
|
||||
//
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
} else {
|
||||
if (UpdateFileExplorer (Private, QuestionId)) {
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
FormGuid.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Formset guids, form id and VarStore data structure for Boot Maintenance Manager.
|
||||
|
||||
--*/
|
||||
#ifndef _FORM_GUID_H
|
||||
#define _FORM_GUID_H
|
||||
|
||||
#define BOOT_MAINT_FORMSET_GUID \
|
||||
{ \
|
||||
0x642237c7, 0x35d4, 0x472d, {0x83, 0x65, 0x12, 0xe0, 0xcc, 0xf2, 0x7a, 0x22} \
|
||||
}
|
||||
|
||||
#define FILE_EXPLORE_FORMSET_GUID \
|
||||
{ \
|
||||
0x1f2d63e1, 0xfebd, 0x4dc7, {0x9c, 0xc5, 0xba, 0x2b, 0x1c, 0xef, 0x9c, 0x5b} \
|
||||
}
|
||||
|
||||
#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 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 MAXIMUM_NORMAL_KEY_VALUE 0x11FF
|
||||
|
||||
//
|
||||
// Varstore ID defined for Buffer Stoarge
|
||||
//
|
||||
#define VARSTORE_ID_BOOT_MAINT 0x1000
|
||||
#define VARSTORE_ID_FILE_EXPLORER 0x1001
|
||||
|
||||
//
|
||||
// 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[100];
|
||||
UINT16 DriverAddHandleOptionalData[100];
|
||||
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[100];
|
||||
|
||||
//
|
||||
// Boot or Driver Option Order storage
|
||||
//
|
||||
UINT8 OptionOrder[100];
|
||||
UINT8 DriverOptionToBeDeleted[100];
|
||||
|
||||
//
|
||||
// Boot Option Delete storage
|
||||
//
|
||||
UINT8 BootOptionDel[100];
|
||||
UINT8 DriverOptionDel[100];
|
||||
|
||||
//
|
||||
// This is the Terminal Attributes value storage
|
||||
//
|
||||
UINT8 COMBaudRate;
|
||||
UINT8 COMDataRate;
|
||||
UINT8 COMStopBits;
|
||||
UINT8 COMParity;
|
||||
UINT8 COMTerminalType;
|
||||
|
||||
//
|
||||
// Legacy Device Order Selection Storage
|
||||
//
|
||||
UINT8 LegacyFD[100];
|
||||
UINT8 LegacyHD[100];
|
||||
UINT8 LegacyCD[100];
|
||||
UINT8 LegacyNET[100];
|
||||
UINT8 LegacyBEV[100];
|
||||
|
||||
//
|
||||
// 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
|
||||
|
||||
//
|
||||
// This is the data structure used by File Explorer formset
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 DescriptionData[75];
|
||||
UINT16 OptionalData[127];
|
||||
UINT8 Active;
|
||||
UINT8 ForceReconnect;
|
||||
} FILE_EXPLORER_NV_DATA;
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,335 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BootManager.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform boot manager reference implement
|
||||
|
||||
--*/
|
||||
|
||||
#include "BootManager.h"
|
||||
|
||||
UINT16 mKeyInput;
|
||||
EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
|
||||
LIST_ENTRY *mBootOptionsList;
|
||||
BDS_COMMON_OPTION *gOption;
|
||||
|
||||
BOOT_MANAGER_CALLBACK_DATA gBootManagerPrivate = {
|
||||
BOOT_MANAGER_CALLBACK_DATA_SIGNATURE,
|
||||
NULL,
|
||||
NULL,
|
||||
{
|
||||
FakeExtractConfig,
|
||||
FakeRouteConfig,
|
||||
BootManagerCallback
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
Arguments:
|
||||
This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
Action - Specifies the type of action taken by the browser.
|
||||
QuestionId - A unique value which is sent to the original exporting driver
|
||||
so that it can identify the type of data to expect.
|
||||
Type - The type of value for the question.
|
||||
Value - A pointer to the data being sent to the original exporting driver.
|
||||
ActionRequest - On return, points to the action requested by the callback function.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The callback successfully handled the action.
|
||||
EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.
|
||||
EFI_DEVICE_ERROR - The variable could not be saved.
|
||||
EFI_UNSUPPORTED - The specified Action is not supported by the callback.
|
||||
|
||||
--*/
|
||||
{
|
||||
BDS_COMMON_OPTION *Option;
|
||||
LIST_ENTRY *Link;
|
||||
UINT16 KeyCount;
|
||||
|
||||
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the key count
|
||||
//
|
||||
KeyCount = 0;
|
||||
|
||||
for (Link = mBootOptionsList->ForwardLink; Link != mBootOptionsList; Link = Link->ForwardLink) {
|
||||
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;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
InitializeBootManager (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize HII information for the FrontPage
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||
|
||||
//
|
||||
// Create driver handle used by HII database
|
||||
//
|
||||
Status = HiiLibCreateHiiDriverHandle (&gBootManagerPrivate.DriverHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Install Config Access protocol to driver handle
|
||||
//
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&gBootManagerPrivate.DriverHandle,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&gBootManagerPrivate.ConfigAccess
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Publish our HII data
|
||||
//
|
||||
PackageList = PreparePackageList (2, &mBootManagerGuid, BootManagerVfrBin, BdsStrings);
|
||||
ASSERT (PackageList != NULL);
|
||||
|
||||
Status = gHiiDatabase->NewPackageList (
|
||||
gHiiDatabase,
|
||||
PackageList,
|
||||
gBootManagerPrivate.DriverHandle,
|
||||
&gBootManagerPrivate.HiiHandle
|
||||
);
|
||||
FreePool (PackageList);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
CallBootManager (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Hook to enable UI timeout override behavior.
|
||||
|
||||
Arguments:
|
||||
BdsDeviceList - Device List that BDS needs to connect.
|
||||
|
||||
Entry - Pointer to current Boot Entry.
|
||||
|
||||
Returns:
|
||||
NONE
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BDS_COMMON_OPTION *Option;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_HII_UPDATE_DATA UpdateData;
|
||||
CHAR16 *ExitData;
|
||||
UINTN ExitDataSize;
|
||||
EFI_STRING_ID Token;
|
||||
EFI_INPUT_KEY Key;
|
||||
LIST_ENTRY BdsBootOptionList;
|
||||
CHAR16 *HelpString;
|
||||
EFI_STRING_ID HelpToken;
|
||||
UINT16 *TempStr;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_BROWSER_ACTION_REQUEST ActionRequest;
|
||||
UINTN TempSize;
|
||||
|
||||
gOption = NULL;
|
||||
InitializeListHead (&BdsBootOptionList);
|
||||
|
||||
//
|
||||
// Connect all prior to entering the platform setup menu.
|
||||
//
|
||||
if (!gConnectAllHappened) {
|
||||
BdsLibConnectAllDriversToAllControllers ();
|
||||
gConnectAllHappened = TRUE;
|
||||
}
|
||||
//
|
||||
// BugBug: Here we can not remove the legacy refresh macro, so we need
|
||||
// get the boot order every time from "BootOrder" variable.
|
||||
// Recreate the boot option list base on the BootOrder variable
|
||||
//
|
||||
BdsLibEnumerateAllBootOption (&BdsBootOptionList);
|
||||
|
||||
mBootOptionsList = &BdsBootOptionList;
|
||||
|
||||
HiiHandle = gBootManagerPrivate.HiiHandle;
|
||||
|
||||
//
|
||||
// Allocate space for creation of UpdateData Buffer
|
||||
//
|
||||
UpdateData.BufferSize = 0x1000;
|
||||
UpdateData.Offset = 0;
|
||||
UpdateData.Data = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData.Data != NULL);
|
||||
|
||||
mKeyInput = 0;
|
||||
|
||||
for (Link = BdsBootOptionList.ForwardLink; Link != &BdsBootOptionList; Link = Link->ForwardLink) {
|
||||
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 boot option marked as LOAD_OPTION_HIDDEN
|
||||
//
|
||||
if (Option->Attribute & LOAD_OPTION_HIDDEN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IfrLibNewString (HiiHandle, &Token, Option->Description);
|
||||
|
||||
TempStr = DevicePathToStr (Option->DevicePath);
|
||||
TempSize = StrSize (TempStr);
|
||||
HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : "));
|
||||
StrCat (HelpString, L"Device Path : ");
|
||||
StrCat (HelpString, TempStr);
|
||||
|
||||
IfrLibNewString (HiiHandle, &HelpToken, HelpString);
|
||||
|
||||
CreateActionOpCode (
|
||||
mKeyInput,
|
||||
Token,
|
||||
HelpToken,
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
0,
|
||||
&UpdateData
|
||||
);
|
||||
}
|
||||
|
||||
IfrLibUpdateForm (
|
||||
HiiHandle,
|
||||
&mBootManagerGuid,
|
||||
BOOT_MANAGER_FORM_ID,
|
||||
LABEL_BOOT_OPTION,
|
||||
FALSE,
|
||||
&UpdateData
|
||||
);
|
||||
FreePool (UpdateData.Data);
|
||||
|
||||
//
|
||||
// Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION
|
||||
//
|
||||
gBS->RestoreTPL (TPL_APPLICATION);
|
||||
|
||||
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
|
||||
Status = gFormBrowser2->SendForm (
|
||||
gFormBrowser2,
|
||||
&HiiHandle,
|
||||
1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
&ActionRequest
|
||||
);
|
||||
if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
|
||||
EnableResetRequired ();
|
||||
}
|
||||
|
||||
if (gOption == NULL) {
|
||||
gBS->RaiseTPL (TPL_APPLICATION);
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
//Will leave browser, check any reset required change is applied? if yes, reset system
|
||||
//
|
||||
SetupResetReminder ();
|
||||
|
||||
//
|
||||
// Raise the TPL level back to TPL_APPLICATION
|
||||
//
|
||||
gBS->RaiseTPL (TPL_APPLICATION);
|
||||
|
||||
//
|
||||
// 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))
|
||||
);
|
||||
gBS->RestoreTPL (TPL_APPLICATION);
|
||||
//
|
||||
// BdsLibUiWaitForSingleEvent (gST->ConIn->WaitForKey, 0);
|
||||
//
|
||||
gBS->RaiseTPL (TPL_APPLICATION);
|
||||
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
BootManager.h
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform boot manager reference implement
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_BOOT_MANAGER_H
|
||||
#define _EFI_BOOT_MANAGER_H
|
||||
|
||||
#include "Bds.h"
|
||||
#include "FrontPage.h"
|
||||
|
||||
//
|
||||
// These are defined as the same with vfr file
|
||||
//
|
||||
#define BOOT_MANAGER_FORMSET_GUID \
|
||||
{ \
|
||||
0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
|
||||
}
|
||||
|
||||
#define BOOT_MANAGER_FORM_ID 0x1000
|
||||
|
||||
#define LABEL_BOOT_OPTION 0x00
|
||||
|
||||
//
|
||||
// These are the VFR compiler generated data representing our VFR data.
|
||||
//
|
||||
extern UINT8 BootManagerVfrBin[];
|
||||
|
||||
#define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE EFI_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;
|
||||
|
||||
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
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeBootManager (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
CallBootManager (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
Binary file not shown.
|
@ -0,0 +1,59 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2004 - 2007, Intel Corporation
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// BootManager.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Browser formset.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b }
|
||||
|
||||
#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 = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_BM_BANNER),
|
||||
help = STRING_TOKEN(STR_LAST_STRING),
|
||||
class = BOOT_MANAGER_CLASS,
|
||||
subclass = BOOT_MANAGER_SUBCLASS,
|
||||
|
||||
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;
|
|
@ -0,0 +1,264 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Capsules.c
|
||||
|
||||
Abstract:
|
||||
|
||||
BDS routines to handle capsules.
|
||||
|
||||
--*/
|
||||
#include "Bds.h"
|
||||
|
||||
VOID
|
||||
BdsLockFv (
|
||||
IN EFI_CPU_IO_PROTOCOL *CpuIo,
|
||||
IN EFI_PHYSICAL_ADDRESS Base
|
||||
)
|
||||
{
|
||||
EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
|
||||
EFI_PHYSICAL_ADDRESS BaseAddress;
|
||||
UINT8 Data;
|
||||
UINT32 BlockLength;
|
||||
UINTN Index;
|
||||
|
||||
BaseAddress = Base - 0x400000 + 2;
|
||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) (Base));
|
||||
BlockMap = &(FvHeader->BlockMap[0]);
|
||||
|
||||
while ((BlockMap->NumBlocks != 0) && (BlockMap->Length != 0)) {
|
||||
BlockLength = BlockMap->Length;
|
||||
for (Index = 0; Index < BlockMap->NumBlocks; Index++) {
|
||||
CpuIo->Mem.Read (
|
||||
CpuIo,
|
||||
EfiCpuIoWidthUint8,
|
||||
BaseAddress,
|
||||
1,
|
||||
&Data
|
||||
);
|
||||
Data = (UINT8) (Data | 0x3);
|
||||
CpuIo->Mem.Write (
|
||||
CpuIo,
|
||||
EfiCpuIoWidthUint8,
|
||||
BaseAddress,
|
||||
1,
|
||||
&Data
|
||||
);
|
||||
BaseAddress += BlockLength;
|
||||
}
|
||||
|
||||
BlockMap++;
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ProcessCapsules (
|
||||
EFI_BOOT_MODE BootMode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
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.
|
||||
|
||||
Arguments:
|
||||
|
||||
BootMode - the current boot mode
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_INVALID_PARAMETER - boot mode is not correct for an update
|
||||
|
||||
Note:
|
||||
|
||||
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 awry 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.
|
||||
|
||||
--*/
|
||||
{
|
||||
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;
|
||||
CAPSULE_HOB_INFO *CapsuleHobInfo;
|
||||
|
||||
CapsuleNumber = 0;
|
||||
CapsuleTotalNumber = 0;
|
||||
CacheIndex = 0;
|
||||
CacheNumber = 0;
|
||||
CapsulePtr = NULL;
|
||||
CapsulePtrCache = NULL;
|
||||
CapsuleGuidCache = NULL;
|
||||
|
||||
//
|
||||
// We don't do anything else if the boot mode is not flash-update
|
||||
//
|
||||
if (BootMode != BOOT_ON_FLASH_UPDATE) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
//
|
||||
// Find all capsule images from hob
|
||||
//
|
||||
HobPointer.Raw = GetHobList ();
|
||||
while ((HobPointer.Raw = GetNextGuidHob (&gEfiCapsuleVendorGuid, HobPointer.Raw)) != NULL) {
|
||||
CapsuleTotalNumber ++;
|
||||
|
||||
HobPointer.Raw = GET_NEXT_HOB (HobPointer);
|
||||
}
|
||||
|
||||
if (CapsuleTotalNumber == 0) {
|
||||
//
|
||||
// We didn't find a hob, so had no errors.
|
||||
//
|
||||
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 = GetNextGuidHob (&gEfiCapsuleVendorGuid, HobPointer.Raw)) != NULL) {
|
||||
CapsuleHobInfo = GET_GUID_HOB_DATA (HobPointer.Guid);
|
||||
CapsulePtr [CapsuleNumber++] = (VOID *)(UINTN)(CapsuleHobInfo->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) {
|
||||
//
|
||||
// Call capsule library to process capsule image.
|
||||
//
|
||||
ProcessCapsuleImage (CapsuleHeader);
|
||||
}
|
||||
}
|
||||
|
||||
PlatformBdsLockNonUpdatableFlash ();
|
||||
|
||||
//
|
||||
// Free the allocated temp memory space.
|
||||
//
|
||||
FreePool (CapsuleGuidCache);
|
||||
FreePool (CapsulePtrCache);
|
||||
FreePool (CapsulePtr);
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -0,0 +1,434 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
DeviceManager.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform device manager reference implement
|
||||
|
||||
--*/
|
||||
|
||||
#include "DeviceManager.h"
|
||||
|
||||
DEVICE_MANAGER_CALLBACK_DATA gDeviceManagerPrivate = {
|
||||
DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE,
|
||||
NULL,
|
||||
NULL,
|
||||
{
|
||||
FakeExtractConfig,
|
||||
FakeRouteConfig,
|
||||
DeviceManagerCallback
|
||||
}
|
||||
};
|
||||
|
||||
EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID;
|
||||
|
||||
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 }
|
||||
};
|
||||
|
||||
#define MENU_ITEM_NUM \
|
||||
(sizeof (mDeviceManagerMenuItemTable) / sizeof (DEVICE_MANAGER_MENU_ITEM))
|
||||
|
||||
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
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
Arguments:
|
||||
This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
Action - Specifies the type of action taken by the browser.
|
||||
QuestionId - A unique value which is sent to the original exporting driver
|
||||
so that it can identify the type of data to expect.
|
||||
Type - The type of value for the question.
|
||||
Value - A pointer to the data being sent to the original exporting driver.
|
||||
ActionRequest - On return, points to the action requested by the callback function.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The callback successfully handled the action.
|
||||
EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.
|
||||
EFI_DEVICE_ERROR - The variable could not be saved.
|
||||
EFI_UNSUPPORTED - The specified Action is not supported by the callback.
|
||||
|
||||
--*/
|
||||
{
|
||||
DEVICE_MANAGER_CALLBACK_DATA *PrivateData;
|
||||
|
||||
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PrivateData = DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS (This);
|
||||
|
||||
switch (QuestionId) {
|
||||
case DEVICE_MANAGER_KEY_VBIOS:
|
||||
PrivateData->VideoBios = Value->u8;
|
||||
gRT->SetVariable (
|
||||
L"VBIOS",
|
||||
&gEfiGenericPlatformVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof (UINT8),
|
||||
&PrivateData->VideoBios
|
||||
);
|
||||
|
||||
//
|
||||
// Tell browser not to ask for confirmation of changes,
|
||||
// since we have already applied.
|
||||
//
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// The key corresponds the Handle Index which was requested to be displayed
|
||||
//
|
||||
gCallbackKey = QuestionId;
|
||||
|
||||
//
|
||||
// Request to exit SendForm(), so as to switch to selected form
|
||||
//
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
break;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
InitializeDeviceManager (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize HII information for the FrontPage
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||
|
||||
//
|
||||
// Create driver handle used by HII database
|
||||
//
|
||||
Status = HiiLibCreateHiiDriverHandle (&gDeviceManagerPrivate.DriverHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Install Config Access protocol to driver handle
|
||||
//
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&gDeviceManagerPrivate.DriverHandle,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&gDeviceManagerPrivate.ConfigAccess
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Publish our HII data
|
||||
//
|
||||
PackageList = PreparePackageList (2, &mDeviceManagerGuid, DeviceManagerVfrBin, BdsStrings);
|
||||
ASSERT (PackageList != NULL);
|
||||
|
||||
Status = gHiiDatabase->NewPackageList (
|
||||
gHiiDatabase,
|
||||
PackageList,
|
||||
gDeviceManagerPrivate.DriverHandle,
|
||||
&gDeviceManagerPrivate.HiiHandle
|
||||
);
|
||||
FreePool (PackageList);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CallDeviceManager (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Call the browser and display the device manager
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Operation is successful.
|
||||
EFI_INVALID_PARAMETER - If the inputs to SendForm function is not valid.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Count;
|
||||
UINTN Index;
|
||||
CHAR16 *String;
|
||||
UINTN StringLength;
|
||||
EFI_HII_UPDATE_DATA UpdateData[MENU_ITEM_NUM];
|
||||
EFI_STRING_ID Token;
|
||||
EFI_STRING_ID TokenHelp;
|
||||
IFR_OPTION *IfrOptionList;
|
||||
UINT8 *VideoOption;
|
||||
UINTN VideoOptionSize;
|
||||
EFI_HII_HANDLE *HiiHandles;
|
||||
UINTN HandleBufferLength;
|
||||
UINTN NumberOfHiiHandles;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
UINT16 FormSetClass;
|
||||
EFI_STRING_ID FormSetTitle;
|
||||
EFI_STRING_ID FormSetHelp;
|
||||
EFI_BROWSER_ACTION_REQUEST ActionRequest;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||
|
||||
IfrOptionList = NULL;
|
||||
VideoOption = NULL;
|
||||
HiiHandles = NULL;
|
||||
HandleBufferLength = 0;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
gCallbackKey = 0;
|
||||
|
||||
//
|
||||
// Connect all prior to entering the platform setup menu.
|
||||
//
|
||||
if (!gConnectAllHappened) {
|
||||
BdsLibConnectAllDriversToAllControllers ();
|
||||
gConnectAllHappened = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Create Subtitle OpCodes
|
||||
//
|
||||
for (Index = 0; Index < MENU_ITEM_NUM; Index++) {
|
||||
//
|
||||
// Allocate space for creation of UpdateData Buffer
|
||||
//
|
||||
UpdateData[Index].BufferSize = 0x1000;
|
||||
UpdateData[Index].Offset = 0;
|
||||
UpdateData[Index].Data = AllocatePool (0x1000);
|
||||
ASSERT (UpdateData[Index].Data != NULL);
|
||||
|
||||
CreateSubTitleOpCode (mDeviceManagerMenuItemTable[Index].StringId, 0, 0, 1, &UpdateData[Index]);
|
||||
}
|
||||
|
||||
//
|
||||
// Get all the Hii handles
|
||||
//
|
||||
Status = GetHiiHandles (&HandleBufferLength, &HiiHandles);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
HiiHandle = gDeviceManagerPrivate.HiiHandle;
|
||||
|
||||
StringLength = 0x1000;
|
||||
String = AllocateZeroPool (StringLength);
|
||||
ASSERT (String != NULL);
|
||||
|
||||
//
|
||||
// Search for formset of each class type
|
||||
//
|
||||
NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
|
||||
for (Index = 0; Index < NumberOfHiiHandles; Index++) {
|
||||
HiiLibExtractClassFromHiiHandle (HiiHandles[Index], &FormSetClass, &FormSetTitle, &FormSetHelp);
|
||||
|
||||
if (FormSetClass == EFI_NON_DEVICE_CLASS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Token = 0;
|
||||
*String = 0;
|
||||
StringLength = 0x1000;
|
||||
IfrLibGetString (HiiHandles[Index], FormSetTitle, String, &StringLength);
|
||||
IfrLibNewString (HiiHandle, &Token, String);
|
||||
|
||||
TokenHelp = 0;
|
||||
*String = 0;
|
||||
StringLength = 0x1000;
|
||||
IfrLibGetString (HiiHandles[Index], FormSetHelp, String, &StringLength);
|
||||
IfrLibNewString (HiiHandle, &TokenHelp, String);
|
||||
|
||||
for (Count = 0; Count < MENU_ITEM_NUM; Count++) {
|
||||
if (FormSetClass & mDeviceManagerMenuItemTable[Count].Class) {
|
||||
CreateActionOpCode (
|
||||
(EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),
|
||||
Token,
|
||||
TokenHelp,
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
0,
|
||||
&UpdateData[Count]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
FreePool (String);
|
||||
|
||||
for (Index = 0; Index < MENU_ITEM_NUM; Index++) {
|
||||
//
|
||||
// Add End Opcode for Subtitle
|
||||
//
|
||||
CreateEndOpCode (&UpdateData[Index]);
|
||||
|
||||
IfrLibUpdateForm (
|
||||
HiiHandle,
|
||||
&mDeviceManagerGuid,
|
||||
DEVICE_MANAGER_FORM_ID,
|
||||
mDeviceManagerMenuItemTable[Index].Class,
|
||||
FALSE,
|
||||
&UpdateData[Index]
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Add oneof for video BIOS selection
|
||||
//
|
||||
VideoOption = BdsLibGetVariableAndSize (
|
||||
L"VBIOS",
|
||||
&gEfiGenericPlatformVariableGuid,
|
||||
&VideoOptionSize
|
||||
);
|
||||
if (NULL == VideoOption) {
|
||||
gDeviceManagerPrivate.VideoBios = 0;
|
||||
} else {
|
||||
gDeviceManagerPrivate.VideoBios = VideoOption[0];
|
||||
FreePool (VideoOption);
|
||||
}
|
||||
|
||||
ASSERT (gDeviceManagerPrivate.VideoBios <= 1);
|
||||
|
||||
IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION));
|
||||
ASSERT (IfrOptionList != NULL);
|
||||
IfrOptionList[0].Flags = 0;
|
||||
IfrOptionList[0].StringToken = STRING_TOKEN (STR_ONE_OF_PCI);
|
||||
IfrOptionList[0].Value.u8 = 0;
|
||||
IfrOptionList[1].Flags = 0;
|
||||
IfrOptionList[1].StringToken = STRING_TOKEN (STR_ONE_OF_AGP);
|
||||
IfrOptionList[1].Value.u8 = 1;
|
||||
IfrOptionList[gDeviceManagerPrivate.VideoBios].Flags |= EFI_IFR_OPTION_DEFAULT;
|
||||
|
||||
UpdateData[0].Offset = 0;
|
||||
CreateOneOfOpCode (
|
||||
DEVICE_MANAGER_KEY_VBIOS,
|
||||
0,
|
||||
0,
|
||||
STRING_TOKEN (STR_ONE_OF_VBIOS),
|
||||
STRING_TOKEN (STR_ONE_OF_VBIOS_HELP),
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
EFI_IFR_NUMERIC_SIZE_1,
|
||||
IfrOptionList,
|
||||
2,
|
||||
&UpdateData[0]
|
||||
);
|
||||
|
||||
IfrLibUpdateForm (
|
||||
HiiHandle,
|
||||
&mDeviceManagerGuid,
|
||||
DEVICE_MANAGER_FORM_ID,
|
||||
LABEL_VBIOS,
|
||||
FALSE,
|
||||
&UpdateData[0]
|
||||
);
|
||||
|
||||
//
|
||||
// Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION
|
||||
//
|
||||
gBS->RestoreTPL (TPL_APPLICATION);
|
||||
|
||||
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
|
||||
Status = gFormBrowser2->SendForm (
|
||||
gFormBrowser2,
|
||||
&HiiHandle,
|
||||
1,
|
||||
NULL,
|
||||
0,
|
||||
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
|
||||
//
|
||||
if (gCallbackKey != 0) {
|
||||
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
|
||||
Status = gFormBrowser2->SendForm (
|
||||
gFormBrowser2,
|
||||
&HiiHandles[gCallbackKey - DEVICE_KEY_OFFSET],
|
||||
1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
&ActionRequest
|
||||
);
|
||||
|
||||
if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
|
||||
EnableResetRequired ();
|
||||
}
|
||||
|
||||
//
|
||||
// Force return to Device Manager
|
||||
//
|
||||
gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup dynamic created strings in HII database by reinstall the packagelist
|
||||
//
|
||||
gHiiDatabase->RemovePackageList (gHiiDatabase, HiiHandle);
|
||||
PackageList = PreparePackageList (2, &mDeviceManagerGuid, DeviceManagerVfrBin, BdsStrings);
|
||||
ASSERT (PackageList != NULL);
|
||||
Status = gHiiDatabase->NewPackageList (
|
||||
gHiiDatabase,
|
||||
PackageList,
|
||||
gDeviceManagerPrivate.DriverHandle,
|
||||
&gDeviceManagerPrivate.HiiHandle
|
||||
);
|
||||
FreePool (PackageList);
|
||||
|
||||
for (Index = 0; Index < MENU_ITEM_NUM; Index++) {
|
||||
FreePool (UpdateData[Index].Data);
|
||||
}
|
||||
FreePool (HiiHandles);
|
||||
|
||||
gBS->RaiseTPL (TPL_APPLICATION);
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
DeviceManager.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform device manager reference implement
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _DEVICE_MANAGER_H
|
||||
#define _DEVICE_MANAGER_H
|
||||
|
||||
#include "Bds.h"
|
||||
#include "FrontPage.h"
|
||||
|
||||
//
|
||||
// These are defined as the same with vfr file
|
||||
//
|
||||
#define DEVICE_MANAGER_FORMSET_GUID \
|
||||
{ \
|
||||
0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \
|
||||
}
|
||||
|
||||
#define LABEL_VBIOS 0x0040
|
||||
|
||||
#define DEVICE_MANAGER_FORM_ID 0x1000
|
||||
|
||||
#define DEVICE_KEY_OFFSET 0x1000
|
||||
#define DEVICE_MANAGER_KEY_VBIOS 0x2000
|
||||
|
||||
//
|
||||
// These are the VFR compiler generated data representing our VFR data.
|
||||
//
|
||||
extern UINT8 DeviceManagerVfrBin[];
|
||||
|
||||
#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE EFI_SIGNATURE_32 ('D', '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;
|
||||
|
||||
//
|
||||
// Configuration data
|
||||
//
|
||||
UINT8 VideoBios;
|
||||
} DEVICE_MANAGER_CALLBACK_DATA;
|
||||
|
||||
#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;
|
||||
|
||||
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
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeDeviceManager (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CallDeviceManager (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
Binary file not shown.
|
@ -0,0 +1,82 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2004 - 2007, Intel Corporation
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// DeviceManagerVfr.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Device Manager formset.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#define FORMSET_GUID { 0x3ebfa8e6, 0x511d, 0x4b5b, 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 }
|
||||
|
||||
#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 LABEL_VBIOS 0x0040
|
||||
|
||||
#define LABEL_END 0xffff
|
||||
|
||||
#define DEVICE_MANAGER_CLASS 0x0000
|
||||
#define FRONT_PAGE_SUBCLASS 0x0003
|
||||
|
||||
#define DEVICE_MANAGER_FORM_ID 0x1000
|
||||
|
||||
formset
|
||||
guid = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),
|
||||
help = STRING_TOKEN(STR_EMPTY_STRING),
|
||||
class = DEVICE_MANAGER_CLASS,
|
||||
subclass = FRONT_PAGE_SUBCLASS,
|
||||
|
||||
form formid = DEVICE_MANAGER_FORM_ID,
|
||||
title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);
|
||||
|
||||
//
|
||||
// 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_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;
|
||||
endformset;
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,149 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
FrontPage.h
|
||||
|
||||
Abstract:
|
||||
|
||||
FrontPage routines to handle the callbacks and browser calls
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _FRONT_PAGE_H
|
||||
#define _FRONT_PAGE_H
|
||||
|
||||
#include "DeviceMngr/DeviceManager.h"
|
||||
#include "BootMaint/BootMaint.h"
|
||||
#include "BootMngr/BootManager.h"
|
||||
#include "String.h"
|
||||
|
||||
#define ONE_SECOND 10000000
|
||||
|
||||
//
|
||||
// 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 FRONT_PAGE_FORMSET_GUID \
|
||||
{ \
|
||||
0x9e0c30bc, 0x3f06, 0x4ba6, 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe \
|
||||
}
|
||||
|
||||
#define FRONT_PAGE_CALLBACK_DATA_SIGNATURE EFI_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 \
|
||||
)
|
||||
|
||||
//
|
||||
// These are the VFR compiler generated data representing our VFR data.
|
||||
//
|
||||
extern UINT8 FrontPageVfrBin[];
|
||||
|
||||
extern EFI_HII_DATABASE_PROTOCOL *gHiiDatabase;
|
||||
extern EFI_HII_STRING_PROTOCOL *gHiiString;
|
||||
extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
||||
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting;
|
||||
|
||||
extern UINTN gCallbackKey;
|
||||
extern BOOLEAN gConnectAllHappened;
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FakeRouteConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
);
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
InitializeFrontPage (
|
||||
IN BOOLEAN ReInitializeStrings
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
GetProducerString (
|
||||
IN EFI_GUID *ProducerGuid,
|
||||
IN EFI_STRING_ID Token,
|
||||
OUT CHAR16 **String
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
TimeCompare (
|
||||
IN EFI_TIME *FirstTime,
|
||||
IN EFI_TIME *SecondTime
|
||||
);
|
||||
|
||||
VOID
|
||||
PlatformBdsEnterFrontPage (
|
||||
IN UINT16 TimeoutDefault,
|
||||
IN BOOLEAN ConnectAllHappened
|
||||
);
|
||||
|
||||
#endif // _FRONT_PAGE_H_
|
||||
|
Binary file not shown.
|
@ -0,0 +1,145 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2007, Intel Corporation
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// FrontPageVfr.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Browser formset.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#define FORMSET_GUID { 0x9e0c30bc, 0x3f06, 0x4ba6, 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe }
|
||||
|
||||
#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 = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
class = FRONT_PAGE_CLASS,
|
||||
subclass = FRONT_PAGE_SUBCLASS,
|
||||
|
||||
form formid = FRONT_PAGE_FORM_ID,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),
|
||||
line 0,
|
||||
align left;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),
|
||||
line 1,
|
||||
align left;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),
|
||||
line 1,
|
||||
align right;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),
|
||||
line 2,
|
||||
align left;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),
|
||||
line 2,
|
||||
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;
|
||||
|
||||
goto FRONT_PAGE_ITEM_ONE,
|
||||
prompt = STRING_TOKEN(STR_CONTINUE_PROMPT),
|
||||
help = STRING_TOKEN(STR_CONTINUE_HELP),
|
||||
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;
|
|
@ -0,0 +1,769 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Hotkey.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Provides a way for 3rd party applications to register themselves for launch by the
|
||||
Boot Manager based on hot key
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "Hotkey.h"
|
||||
|
||||
|
||||
LIST_ENTRY mHotkeyList = INITIALIZE_LIST_HEAD_VARIABLE (mHotkeyList);
|
||||
BOOLEAN mHotkeyCallbackPending = FALSE;
|
||||
EFI_EVENT mHotkeyEvent;
|
||||
VOID *mHotkeyRegistration;
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsKeyOptionValid (
|
||||
IN EFI_KEY_OPTION *KeyOption
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Check if the Key Option is valid or not.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyOption - The Hot Key Option to be checked.
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE - The Hot Key Option is valid.
|
||||
FALSE - The Hot Key Option is invalid.
|
||||
|
||||
--*/
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
RegisterHotkey (
|
||||
IN EFI_KEY_OPTION *KeyOption,
|
||||
OUT UINT16 *KeyOptionNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Create Key#### for the given hotkey.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyOption - The Hot Key Option to be added.
|
||||
KeyOptionNumber - The key option number for Key#### (optional).
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Register hotkey successfully.
|
||||
EFI_INVALID_PARAMETER - The hotkey option is invalid.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT16 KeyOptionName[10];
|
||||
UINT16 *KeyOrder;
|
||||
UINTN KeyOrderSize;
|
||||
UINT16 *NewKeyOrder;
|
||||
UINTN Index;
|
||||
UINT16 MaxOptionNumber;
|
||||
UINT16 RegisterOptionNumber;
|
||||
EFI_KEY_OPTION *TempOption;
|
||||
UINTN TempOptionSize;
|
||||
EFI_STATUS Status;
|
||||
UINTN KeyOptionSize;
|
||||
BOOLEAN UpdateBootOption;
|
||||
|
||||
//
|
||||
// Validate the given key option
|
||||
//
|
||||
if (!IsKeyOptionValid (KeyOption)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
KeyOptionSize = sizeof (EFI_KEY_OPTION) + GET_KEY_CODE_COUNT (KeyOption->KeyOptions.PackedValue) * sizeof (EFI_INPUT_KEY);
|
||||
UpdateBootOption = FALSE;
|
||||
|
||||
//
|
||||
// check whether HotKey conflict with keys used by Setup Browser
|
||||
//
|
||||
|
||||
KeyOrder = BdsLibGetVariableAndSize (
|
||||
VarKeyOrder,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&KeyOrderSize
|
||||
);
|
||||
if (KeyOrder == NULL) {
|
||||
KeyOrderSize = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Find free key option number
|
||||
//
|
||||
MaxOptionNumber = 0;
|
||||
TempOption = NULL;
|
||||
for (Index = 0; Index < KeyOrderSize / sizeof (UINT16); Index++) {
|
||||
if (MaxOptionNumber < KeyOrder[Index]) {
|
||||
MaxOptionNumber = KeyOrder[Index];
|
||||
}
|
||||
|
||||
UnicodeSPrint (KeyOptionName, sizeof (KeyOptionName), L"Key%04x", KeyOrder[Index]);
|
||||
TempOption = BdsLibGetVariableAndSize (
|
||||
KeyOptionName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&TempOptionSize
|
||||
);
|
||||
|
||||
if (CompareMem (TempOption, KeyOption, TempOptionSize) == 0) {
|
||||
//
|
||||
// Got the option, so just return
|
||||
//
|
||||
FreePool (TempOption);
|
||||
FreePool (KeyOrder);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (KeyOption->KeyOptions.PackedValue == TempOption->KeyOptions.PackedValue) {
|
||||
if (GET_KEY_CODE_COUNT (KeyOption->KeyOptions.PackedValue) == 0 ||
|
||||
CompareMem (
|
||||
((UINT8 *) TempOption) + sizeof (EFI_KEY_OPTION),
|
||||
((UINT8 *) KeyOption) + sizeof (EFI_KEY_OPTION),
|
||||
KeyOptionSize - sizeof (EFI_KEY_OPTION)
|
||||
) == 0) {
|
||||
//
|
||||
// Hotkey is the same but BootOption changed, need update
|
||||
//
|
||||
UpdateBootOption = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (TempOption);
|
||||
}
|
||||
|
||||
if (UpdateBootOption) {
|
||||
RegisterOptionNumber = KeyOrder[Index];
|
||||
FreePool (TempOption);
|
||||
} else {
|
||||
RegisterOptionNumber = (UINT16) (MaxOptionNumber + 1);
|
||||
}
|
||||
|
||||
if (KeyOptionNumber != NULL) {
|
||||
*KeyOptionNumber = RegisterOptionNumber;
|
||||
}
|
||||
|
||||
//
|
||||
// Create variable Key####
|
||||
//
|
||||
UnicodeSPrint (KeyOptionName, sizeof (KeyOptionName), L"Key%04x", RegisterOptionNumber);
|
||||
Status = gRT->SetVariable (
|
||||
KeyOptionName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
KeyOptionSize,
|
||||
KeyOption
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (KeyOrder);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Update the key order variable - "KeyOrder"
|
||||
//
|
||||
if (!UpdateBootOption) {
|
||||
Index = KeyOrderSize / sizeof (UINT16);
|
||||
KeyOrderSize += sizeof (UINT16);
|
||||
}
|
||||
|
||||
NewKeyOrder = AllocatePool (KeyOrderSize);
|
||||
if (NewKeyOrder == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (KeyOrder != NULL) {
|
||||
CopyMem (NewKeyOrder, KeyOrder, KeyOrderSize);
|
||||
}
|
||||
|
||||
NewKeyOrder[Index] = RegisterOptionNumber;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
VarKeyOrder,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
KeyOrderSize,
|
||||
NewKeyOrder
|
||||
);
|
||||
|
||||
FreePool (KeyOrder);
|
||||
FreePool (NewKeyOrder);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
UnregisterHotkey (
|
||||
IN UINT16 KeyOptionNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Delete Key#### for the given Key Option number.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyOptionNumber - Key option number for Key####
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Unregister hotkey successfully.
|
||||
EFI_NOT_FOUND - No Key#### is found for the given Key Option number.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT16 KeyOption[10];
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
UINTN Index2Del;
|
||||
UINT16 *KeyOrder;
|
||||
UINTN KeyOrderSize;
|
||||
|
||||
//
|
||||
// Delete variable Key####
|
||||
//
|
||||
UnicodeSPrint (KeyOption, sizeof (KeyOption), L"Key%04x", KeyOptionNumber);
|
||||
gRT->SetVariable (
|
||||
KeyOption,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// Adjust key order array
|
||||
//
|
||||
KeyOrder = BdsLibGetVariableAndSize (
|
||||
VarKeyOrder,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&KeyOrderSize
|
||||
);
|
||||
if (KeyOrder == NULL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Index2Del = 0;
|
||||
for (Index = 0; Index < KeyOrderSize / sizeof (UINT16); Index++) {
|
||||
if (KeyOrder[Index] == KeyOptionNumber) {
|
||||
Index2Del = Index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Index != KeyOrderSize / sizeof (UINT16)) {
|
||||
//
|
||||
// KeyOptionNumber found in "KeyOrder", delete it
|
||||
//
|
||||
for (Index = Index2Del; Index < KeyOrderSize / sizeof (UINT16) - 1; Index++) {
|
||||
KeyOrder[Index] = KeyOrder[Index + 1];
|
||||
}
|
||||
|
||||
KeyOrderSize -= sizeof (UINT16);
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
VarKeyOrder,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
KeyOrderSize,
|
||||
KeyOrder
|
||||
);
|
||||
|
||||
FreePool (KeyOrder);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
HotkeyCallback (
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This is the common notification function for HotKeys, it will be registered
|
||||
with SimpleTextInEx protocol interface - RegisterKeyNotify() of ConIn handle.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
||||
information for the key that was pressed.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - KeyData is successfully processed.
|
||||
|
||||
--*/
|
||||
{
|
||||
BOOLEAN HotkeyCatched;
|
||||
LIST_ENTRY BootLists;
|
||||
LIST_ENTRY *Link;
|
||||
BDS_HOTKEY_OPTION *Hotkey;
|
||||
UINT16 Buffer[10];
|
||||
BDS_COMMON_OPTION *BootOption;
|
||||
UINTN ExitDataSize;
|
||||
CHAR16 *ExitData;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
EFI_KEY_DATA *HotkeyData;
|
||||
|
||||
if (mHotkeyCallbackPending) {
|
||||
//
|
||||
// When responsing to a Hotkey, ignore sequential hotkey stroke until
|
||||
// the current Boot#### load option returned
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Link = GetFirstNode (&mHotkeyList);
|
||||
|
||||
while (!IsNull (&mHotkeyList, Link)) {
|
||||
HotkeyCatched = FALSE;
|
||||
Hotkey = BDS_HOTKEY_OPTION_FROM_LINK (Link);
|
||||
|
||||
//
|
||||
// Is this Key Stroke we are waiting for?
|
||||
//
|
||||
HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey];
|
||||
if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) &&
|
||||
(KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) &&
|
||||
((HotkeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) ? (KeyData->KeyState.KeyShiftState == HotkeyData->KeyState.KeyShiftState) : 1)) {
|
||||
//
|
||||
// Receive an expecting key stroke
|
||||
//
|
||||
if (Hotkey->CodeCount > 1) {
|
||||
//
|
||||
// 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 {
|
||||
//
|
||||
// For hotkey of single key stroke
|
||||
//
|
||||
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);
|
||||
BootOption = BdsLibVariableToOption (&BootLists, Buffer);
|
||||
BootOption->BootCurrent = Hotkey->BootOptionNumber;
|
||||
BdsLibConnectDevicePath (BootOption->DevicePath);
|
||||
|
||||
//
|
||||
// Clear the screen before launch this BootOption
|
||||
//
|
||||
gST->ConOut->Reset (gST->ConOut, FALSE);
|
||||
|
||||
//
|
||||
// BdsLibBootViaBootOption() is expected to be invoked at TPL level TPL_APPLICATION,
|
||||
// so raise the TPL to TPL_APPLICATION first, then restore it
|
||||
//
|
||||
OldTpl = gBS->RaiseTPL (TPL_APPLICATION);
|
||||
|
||||
mHotkeyCallbackPending = TRUE;
|
||||
Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
|
||||
mHotkeyCallbackPending = FALSE;
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Call platform action to indicate the boot fail
|
||||
//
|
||||
BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
|
||||
PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);
|
||||
} else {
|
||||
//
|
||||
// Call platform action to indicate the boot success
|
||||
//
|
||||
BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
|
||||
PlatformBdsBootSuccess (BootOption);
|
||||
}
|
||||
}
|
||||
|
||||
Link = GetNextNode (&mHotkeyList, Link);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
HotkeyRegisterNotify (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEx
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Register the common HotKey notify function to given SimpleTextInEx protocol instance.
|
||||
|
||||
Arguments:
|
||||
|
||||
SimpleTextInEx - Simple Text Input Ex protocol instance
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Register hotkey notification function successfully.
|
||||
EFI_OUT_OF_RESOURCES - Unable to allocate necessary data structures.
|
||||
|
||||
--*/
|
||||
{
|
||||
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);
|
||||
|
||||
Link = GetNextNode (&mHotkeyList, Link);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
HotkeyEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Callback function for SimpleTextInEx protocol install events
|
||||
|
||||
Arguments:
|
||||
|
||||
Standard event notification function arguments:
|
||||
Event - the event that is signaled.
|
||||
Context - not used here.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
HotkeyInsertList (
|
||||
IN EFI_KEY_OPTION *KeyOption
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Insert Key Option to hotkey list.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyOption - The Hot Key Option to be added to hotkey list.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Add to hotkey list success.
|
||||
|
||||
--*/
|
||||
{
|
||||
BDS_HOTKEY_OPTION *HotkeyLeft;
|
||||
BDS_HOTKEY_OPTION *HotkeyRight;
|
||||
UINTN Index;
|
||||
UINT32 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->KeyOptions.PackedValue;
|
||||
|
||||
HotkeyLeft->CodeCount = (UINT8) GET_KEY_CODE_COUNT (KeyOptions);
|
||||
|
||||
//
|
||||
// Map key shift state from KeyOptions to EFI_KEY_DATA.KeyState
|
||||
//
|
||||
KeyShiftStateRight = (KeyOptions & EFI_KEY_OPTION_SHIFT) |
|
||||
((KeyOptions & EFI_KEY_OPTION_CONTROL) << 1) |
|
||||
((KeyOptions & EFI_KEY_OPTION_ALT) << 2) |
|
||||
((KeyOptions & EFI_KEY_OPTION_LOGO) << 3) |
|
||||
((KeyOptions & (EFI_KEY_OPTION_MENU | EFI_KEY_OPTION_SYSREQ)) << 4) |
|
||||
EFI_SHIFT_STATE_VALID;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
InitializeHotkeyService (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Hotkey services successfully initialized.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 BootOptionSupport;
|
||||
UINT16 *KeyOrder;
|
||||
UINTN KeyOrderSize;
|
||||
UINTN Index;
|
||||
UINT16 KeyOptionName[8];
|
||||
UINTN KeyOptionSize;
|
||||
EFI_KEY_OPTION *KeyOption;
|
||||
|
||||
//
|
||||
// Export our capability - EFI_BOOT_OPTION_SUPPORT_KEY and EFI_BOOT_OPTION_SUPPORT_APP
|
||||
//
|
||||
BootOptionSupport = EFI_BOOT_OPTION_SUPPORT_KEY | EFI_BOOT_OPTION_SUPPORT_APP;
|
||||
Status = gRT->SetVariable (
|
||||
L"BootOptionSupport",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof (UINT32),
|
||||
&BootOptionSupport
|
||||
);
|
||||
|
||||
//
|
||||
// Get valid Key Option List from private EFI variable "KeyOrder"
|
||||
//
|
||||
KeyOrder = BdsLibGetVariableAndSize (
|
||||
VarKeyOrder,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&KeyOrderSize
|
||||
);
|
||||
|
||||
if (KeyOrder == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < KeyOrderSize / sizeof (UINT16); Index ++) {
|
||||
UnicodeSPrint (KeyOptionName, sizeof (KeyOptionName), L"Key%04x", KeyOrder[Index]);
|
||||
KeyOption = BdsLibGetVariableAndSize (
|
||||
KeyOptionName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&KeyOptionSize
|
||||
);
|
||||
|
||||
if (KeyOption == NULL || !IsKeyOptionValid (KeyOption)) {
|
||||
UnregisterHotkey (KeyOrder[Index]);
|
||||
} else {
|
||||
HotkeyInsertList (KeyOption);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Hotkey.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Provides a way for 3rd party applications to register themselves for launch by the
|
||||
Boot Manager based on hot key
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _HOTKEY_H
|
||||
#define _HOTKEY_H
|
||||
|
||||
#include "Bds.h"
|
||||
#include "String.h"
|
||||
|
||||
#define GET_KEY_CODE_COUNT(KeyOptions) (((KeyOptions) & EFI_KEY_CODE_COUNT) >> 8)
|
||||
|
||||
#define BDS_HOTKEY_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'K', 'O')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_HANDLE 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)
|
||||
|
||||
#define VarKeyOrder L"KeyOrder"
|
||||
|
||||
EFI_STATUS
|
||||
RegisterHotkey (
|
||||
IN EFI_KEY_OPTION *KeyOption,
|
||||
OUT UINT16 *KeyOptionNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Create Key#### for the given hotkey.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyOption - The Hot Key Option to be added.
|
||||
KeyOptionNumber - The key option number for Key#### (optional).
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Register hotkey successfully.
|
||||
EFI_INVALID_PARAMETER - The hotkey option is invalid.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UnregisterHotkey (
|
||||
IN UINT16 KeyOptionNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Delete Key#### for the given Key Option number.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyOptionNumber - Key option number for Key####
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Unregister hotkey successfully.
|
||||
EFI_NOT_FOUND - No Key#### is found for the given Key Option number.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
InitializeHotkeyService (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Hotkey services successfully initialized.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,62 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
HwErrRecSupport.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Set the level of support for Hardware Error Record Persistence that is
|
||||
implemented by the platform.
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "HwErrRecSupport.h"
|
||||
|
||||
VOID
|
||||
InitializeHwErrRecSupport (
|
||||
IN UINT16 HwErrRecSupportLevel
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
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.
|
||||
|
||||
Arguments:
|
||||
HwErrRecSupportLevel
|
||||
zero value - Indicates that the platform implements no support for
|
||||
Hardware Error Record Persistence.
|
||||
non-zero value - Indicates that the platform implements Hardware Error
|
||||
Record Persistence.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"HwErrRecSupport",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (UINT16),
|
||||
&HwErrRecSupportLevel
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "HwErrRecSupport: Can not set the variable\n"));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
HwErrRecSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Set the level of support for Hardware Error Record Persistence that is
|
||||
implemented by the platform.
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _HW_ERR_REC_SUPPORT_H
|
||||
#define _HW_ERR_REC_SUPPORT_H
|
||||
|
||||
#include "Bds.h"
|
||||
|
||||
VOID
|
||||
InitializeHwErrRecSupport (
|
||||
IN UINT16 HwErrRecSupportLevel
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
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.
|
||||
|
||||
Arguments:
|
||||
HwErrRecSupportLevel
|
||||
zero value - Indicates that the platform implements no support for
|
||||
Hardware Error Record Persistence.
|
||||
non-zero value - Indicates that the platform implements Hardware Error
|
||||
Record Persistence.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,420 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Language.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Language settings
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "Language.h"
|
||||
#include "FrontPage.h"
|
||||
|
||||
#define NARROW_GLYPH_NUMBER 8
|
||||
#define WIDE_GLYPH_NUMBER 75
|
||||
|
||||
EFI_GUID mFontPackageGuid = {
|
||||
0x78941450, 0x90ab, 0x4fb1, {0xb7, 0x5f, 0x58, 0x92, 0x14, 0xe2, 0x4a, 0xc}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
//
|
||||
// This 4-bytes total array length is required by PreparePackageList()
|
||||
//
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
VOID
|
||||
ExportFonts (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver.
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||
|
||||
//
|
||||
// Create driver handle used by HII database
|
||||
//
|
||||
Status = HiiLibCreateHiiDriverHandle (&DriverHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
PackageList = PreparePackageList (1, &mFontPackageGuid, &mFontBin);
|
||||
ASSERT (PackageList != NULL);
|
||||
|
||||
gHiiDatabase->NewPackageList (gHiiDatabase, PackageList, DriverHandle, &HiiHandle);
|
||||
FreePool (PackageList);
|
||||
}
|
||||
|
||||
VOID
|
||||
InitializeLanguage (
|
||||
BOOLEAN LangCodesSettingRequired
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Determine the current language that will be used
|
||||
based on language related EFI Variables
|
||||
|
||||
Arguments:
|
||||
LangCodesSettingRequired - If required to set LangCode variable
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
CHAR8 *Lang;
|
||||
CHAR8 LangCode[ISO_639_2_ENTRY_SIZE];
|
||||
CHAR8 *LangCodes;
|
||||
CHAR8 *PlatformLang;
|
||||
CHAR8 *PlatformLangCodes;
|
||||
UINTN Index;
|
||||
BOOLEAN Invalid;
|
||||
|
||||
ExportFonts ();
|
||||
|
||||
LangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLangCodes);
|
||||
if (LangCodesSettingRequired) {
|
||||
if (!FeaturePcdGet (PcdUefiVariableDefaultLangDepricate)) {
|
||||
//
|
||||
// UEFI 2.1 depricated this variable so we support turning it off
|
||||
//
|
||||
Status = gRT->SetVariable (
|
||||
L"LangCodes",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
AsciiStrLen (LangCodes),
|
||||
LangCodes
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
PlatformLangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes);
|
||||
Status = gRT->SetVariable (
|
||||
L"PlatformLangCodes",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
AsciiStrSize (PlatformLangCodes),
|
||||
PlatformLangCodes
|
||||
);
|
||||
}
|
||||
|
||||
if (!FeaturePcdGet (PcdUefiVariableDefaultLangDepricate)) {
|
||||
//
|
||||
// UEFI 2.1 depricated this variable so we support turning it off
|
||||
//
|
||||
|
||||
//
|
||||
// Find current LangCode from Lang NV Variable
|
||||
//
|
||||
Size = ISO_639_2_ENTRY_SIZE;
|
||||
Status = gRT->GetVariable (
|
||||
L"Lang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
&LangCode
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
for (Index = 0; LangCodes[Index] != 0; Index += ISO_639_2_ENTRY_SIZE) {
|
||||
if (CompareMem (&LangCodes[Index], LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If we cannot get language code from Lang variable,
|
||||
// or LangCode cannot be found from language table,
|
||||
// set the mDefaultLangCode to Lang variable.
|
||||
//
|
||||
if (EFI_ERROR (Status)) {
|
||||
Lang = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLang);
|
||||
Status = gRT->SetVariable (
|
||||
L"Lang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
ISO_639_2_ENTRY_SIZE,
|
||||
Lang
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Invalid = FALSE;
|
||||
PlatformLang = BdsLibGetVariableAndSize (L"PlatformLang", &gEfiGlobalVariableGuid, &Size);
|
||||
if (PlatformLang != NULL) {
|
||||
//
|
||||
// Check Current PlatformLang value against PlatformLangCode. Need a library that is TBD
|
||||
// Set Invalid based on state of PlatformLang.
|
||||
//
|
||||
|
||||
FreePool (PlatformLang);
|
||||
} else {
|
||||
// No valid variable is set
|
||||
Invalid = TRUE;
|
||||
}
|
||||
|
||||
if (Invalid) {
|
||||
PlatformLang = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLang);
|
||||
Status = gRT->SetVariable (
|
||||
L"PlatformLang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
AsciiStrSize (PlatformLang),
|
||||
PlatformLang
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Language.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Language setting
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _LANGUAGE_H
|
||||
#define _LANGUAGE_H
|
||||
|
||||
#include "String.h"
|
||||
|
||||
VOID
|
||||
InitializeLanguage (
|
||||
BOOLEAN LangCodesSettingRequired
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Determine the current language that will be used
|
||||
based on language related EFI Variables
|
||||
|
||||
Arguments:
|
||||
LangCodesSettingRequired - If required to set LangCode variable
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif // _LANGUAGE_H_
|
|
@ -0,0 +1,431 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
MemoryTest.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Perform the platform memory test
|
||||
|
||||
--*/
|
||||
|
||||
#include "Bds.h"
|
||||
#include "String.h"
|
||||
|
||||
//
|
||||
// BDS Platform Functions
|
||||
//
|
||||
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
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Show progress bar with title above it. It only works in Graphics mode.
|
||||
|
||||
Arguments:
|
||||
|
||||
TitleForeground - Foreground color for Title.
|
||||
TitleBackground - Background color for Title.
|
||||
Title - Title above progress bar.
|
||||
ProgressColor - Progress bar color.
|
||||
Progress - Progress (0-100)
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_STATUS - Success update the progress bar
|
||||
|
||||
--*/
|
||||
{
|
||||
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)) {
|
||||
GraphicsOutput = NULL;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
(VOID **) &UgaDraw
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
|
||||
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
|
||||
} else {
|
||||
Status = UgaDraw->GetMode (
|
||||
UgaDraw,
|
||||
&SizeOfX,
|
||||
&SizeOfY,
|
||||
&ColorDepth,
|
||||
&RefreshRate
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
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 - GLYPH_HEIGHT - 1,
|
||||
SizeOfX,
|
||||
SizeOfY - (PosY - GLYPH_HEIGHT - 1),
|
||||
SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
);
|
||||
} else {
|
||||
Status = UgaDraw->Blt (
|
||||
UgaDraw,
|
||||
(EFI_UGA_PIXEL *) &Color,
|
||||
EfiUgaVideoFill,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
PosY - GLYPH_HEIGHT - 1,
|
||||
SizeOfX,
|
||||
SizeOfY - (PosY - GLYPH_HEIGHT - 1),
|
||||
SizeOfX * sizeof (EFI_UGA_PIXEL)
|
||||
);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 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 {
|
||||
Status = UgaDraw->Blt (
|
||||
UgaDraw,
|
||||
(EFI_UGA_PIXEL *) &ProgressColor,
|
||||
EfiUgaVideoFill,
|
||||
0,
|
||||
0,
|
||||
PosX,
|
||||
PosY,
|
||||
BlockWidth - 1,
|
||||
BlockHeight,
|
||||
(BlockWidth) * sizeof (EFI_UGA_PIXEL)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PrintXY (
|
||||
(SizeOfX - StrLen (Title) * GLYPH_WIDTH) / 2,
|
||||
PosY - GLYPH_HEIGHT - 1,
|
||||
&TitleForeground,
|
||||
&TitleBackground,
|
||||
Title
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
BdsMemoryTest (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL Level
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Perform the memory test base on the memory test intensive level,
|
||||
and update the memory resource.
|
||||
|
||||
Arguments:
|
||||
|
||||
Level - The memory test intensive level.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_STATUS - Success test all the system memory and update
|
||||
the memory resource
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
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[16];
|
||||
CHAR16 *StrTotalMemory;
|
||||
CHAR16 *Pos;
|
||||
CHAR16 *TmpStr;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
|
||||
UINT8 Value;
|
||||
UINTN DataSize;
|
||||
UINT32 Attributes;
|
||||
UINT32 TempData;
|
||||
|
||||
ReturnStatus = EFI_SUCCESS;
|
||||
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
|
||||
|
||||
Pos = AllocatePool (128);
|
||||
|
||||
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;
|
||||
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
|
||||
gST->ConOut->EnableCursor (gST->ConOut, 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;
|
||||
}
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
|
||||
|
||||
if (TmpStr != NULL) {
|
||||
gST->ConOut->OutputString (gST->ConOut, TmpStr);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
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);
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4);
|
||||
gST->ConOut->OutputString (gST->ConOut, TmpStr);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);
|
||||
TestPercent = (UINTN) DivU64x32 (
|
||||
DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
|
||||
TempData
|
||||
);
|
||||
if (TestPercent != PreviousValue) {
|
||||
UnicodeValueToString (StrPercent, 0, TestPercent, 0);
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
|
||||
if (TmpStr != NULL) {
|
||||
BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL);
|
||||
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;
|
||||
|
||||
if (Key.ScanCode == SCAN_ESC) {
|
||||
if (!RequireSoftECCInit) {
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
|
||||
if (TmpStr != NULL) {
|
||||
PlatformBdsShowProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
TmpStr,
|
||||
Color,
|
||||
100,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
|
||||
gST->ConOut->OutputString (gST->ConOut, L"100");
|
||||
Status = GenMemoryTest->Finished (GenMemoryTest);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
TestAbort = TRUE;
|
||||
}
|
||||
} while (Status != EFI_NOT_FOUND);
|
||||
|
||||
Status = GenMemoryTest->Finished (GenMemoryTest);
|
||||
|
||||
Done:
|
||||
UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);
|
||||
if (StrTotalMemory[0] == L',') {
|
||||
StrTotalMemory++;
|
||||
}
|
||||
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));
|
||||
if (TmpStr != NULL) {
|
||||
StrCat (StrTotalMemory, TmpStr);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
|
||||
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
|
||||
gST->ConOut->OutputString (gST->ConOut, StrTotalMemory);
|
||||
PlatformBdsShowProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
StrTotalMemory,
|
||||
Color,
|
||||
100,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
|
||||
FreePool (Pos);
|
||||
|
||||
DataSize = sizeof (Value);
|
||||
Status = gRT->GetVariable (
|
||||
L"BootState",
|
||||
&gEfiBootStateGuid,
|
||||
&Attributes,
|
||||
&DataSize,
|
||||
&Value
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Value = 1;
|
||||
gRT->SetVariable (
|
||||
L"BootState",
|
||||
&gEfiBootStateGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (Value),
|
||||
&Value
|
||||
);
|
||||
}
|
||||
|
||||
return ReturnStatus;
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
String.c
|
||||
|
||||
Abstract:
|
||||
|
||||
String support
|
||||
|
||||
--*/
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
InitializeStringSupport (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Initialize HII global accessor for string support
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - String support initialize success.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Create driver handle used by HII database
|
||||
//
|
||||
Status = HiiLibCreateHiiDriverHandle (&DriverHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
PackageList = PreparePackageList (1, &mBdsStringPackGuid, &BdsStrings);
|
||||
ASSERT (PackageList != NULL);
|
||||
|
||||
Status = gHiiDatabase->NewPackageList (
|
||||
gHiiDatabase,
|
||||
PackageList,
|
||||
DriverHandle,
|
||||
&gStringPackHandle
|
||||
);
|
||||
|
||||
FreePool (PackageList);
|
||||
return Status;
|
||||
}
|
||||
|
||||
CHAR16 *
|
||||
GetStringById (
|
||||
IN EFI_STRING_ID Id
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Get string by string id from HII Interface
|
||||
|
||||
Arguments:
|
||||
Id - String ID.
|
||||
|
||||
Returns:
|
||||
CHAR16 * - String from ID.
|
||||
NULL - If error occurs.
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *String;
|
||||
|
||||
String = NULL;
|
||||
GetStringFromHandle (gStringPackHandle, Id, &String);
|
||||
|
||||
return String;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
String.h
|
||||
|
||||
Abstract:
|
||||
|
||||
String support
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#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 BdsStrings[];
|
||||
|
||||
//
|
||||
// String Definition Guid for BDS Platform
|
||||
//
|
||||
#define EFI_BDS_PLATFORM_GUID \
|
||||
{ \
|
||||
0x7777E939, 0xD57E, 0x4DCB, 0xA0, 0x8E, 0x64, 0xD7, 0x98, 0x57, 0x1E, 0x0F \
|
||||
}
|
||||
|
||||
CHAR16 *
|
||||
GetStringById (
|
||||
IN EFI_STRING_ID Id
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
InitializeStringSupport (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
CallFrontPage (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // _STRING_H_
|
Binary file not shown.
|
@ -83,10 +83,19 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
|
|||
{ 0, 0, 0, 0, 0, 0 } // Mode 3
|
||||
},
|
||||
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
|
||||
(EFI_HII_HANDLE) 0
|
||||
(EFI_HII_HANDLE ) 0
|
||||
};
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||
EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
|
||||
EFI_HII_FONT_PROTOCOL *mHiiFont;
|
||||
BOOLEAN mFirstAccessFlag = TRUE;
|
||||
|
||||
STATIC EFI_GUID mFontPackageListGuid = {0xf5f219d3, 0x7006, 0x4648, 0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad};
|
||||
|
||||
#else
|
||||
EFI_HII_PROTOCOL *mHii;
|
||||
#endif
|
||||
|
||||
static CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
|
||||
|
||||
|
@ -194,6 +203,7 @@ GraphicsConsoleControllerDriverSupported (
|
|||
} else {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// Does Hii Exist? If not, we aren't ready to run
|
||||
//
|
||||
|
@ -249,8 +259,6 @@ GraphicsConsoleControllerDriverStart (
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
GRAPHICS_CONSOLE_DEV *Private;
|
||||
EFI_HII_PACKAGES *Package;
|
||||
EFI_HII_FONT_PACK *FontPack;
|
||||
UINTN NarrowFontSize;
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
|
@ -259,9 +267,8 @@ GraphicsConsoleControllerDriverStart (
|
|||
UINTN MaxMode;
|
||||
UINTN Columns;
|
||||
UINTN Rows;
|
||||
UINT8 *Location;
|
||||
UINT32 ModeNumber;
|
||||
|
||||
|
||||
ModeNumber = 0;
|
||||
|
||||
//
|
||||
|
@ -301,17 +308,14 @@ GraphicsConsoleControllerDriverStart (
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the HII protocol. If Supported() succeeds, do we really
|
||||
// need to get HII protocol again?
|
||||
//
|
||||
Status = EfiLocateHiiProtocol ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
NarrowFontSize = ReturnNarrowFontSize ();
|
||||
|
||||
#if 1
|
||||
if (mFirstAccessFlag) {
|
||||
HiiLibAddFontPackageToHiiDatabase (NarrowFontSize, (UINT8 *) UsStdNarrowGlyphData, &mFontPackageListGuid, &(Private->HiiHandle));
|
||||
mFirstAccessFlag = FALSE;
|
||||
}
|
||||
#else
|
||||
FontPack = AllocateZeroPool (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);
|
||||
ASSERT (FontPack);
|
||||
|
||||
|
@ -333,7 +337,7 @@ GraphicsConsoleControllerDriverStart (
|
|||
// Free the font database
|
||||
//
|
||||
FreePool (FontPack);
|
||||
|
||||
#endif
|
||||
//
|
||||
// If the current mode information can not be retrieved, then attemp to set the default mode
|
||||
// of 800x600, 32 bit colot, 60 Hz refresh.
|
||||
|
@ -614,7 +618,14 @@ GraphicsConsoleControllerDriverStop (
|
|||
//
|
||||
// Remove the font pack
|
||||
//
|
||||
#if 1
|
||||
Status = HiiLibRemovePackagesFromHiiDatabase (Private->HiiHandle);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
mFirstAccessFlag = TRUE;
|
||||
}
|
||||
#else
|
||||
mHii->RemovePack (mHii, Private->HiiHandle);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Free our instance data
|
||||
|
@ -678,7 +689,7 @@ EfiLocateHiiProtocol (
|
|||
/*++
|
||||
|
||||
Routine Description:
|
||||
Find if the HII protocol is available. If yes, locate the HII protocol
|
||||
Locate HII protocols for future usage.
|
||||
|
||||
Arguments:
|
||||
|
||||
|
@ -690,6 +701,43 @@ EfiLocateHiiProtocol (
|
|||
UINTN Size;
|
||||
EFI_STATUS Status;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||
|
||||
//
|
||||
// There should only be one - so buffer size is this
|
||||
//
|
||||
Size = sizeof (EFI_HANDLE);
|
||||
|
||||
Status = gBS->LocateHandle (
|
||||
ByProtocol,
|
||||
&gEfiHiiDatabaseProtocolGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
(VOID **) &Handle
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiHiiDatabaseProtocolGuid,
|
||||
(VOID **) &mHiiDatabase
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiHiiFontProtocolGuid,
|
||||
(VOID **) &mHiiFont
|
||||
);
|
||||
return Status;
|
||||
#else
|
||||
|
||||
//
|
||||
// There should only be one - so buffer size is this
|
||||
//
|
||||
|
@ -710,11 +758,13 @@ EfiLocateHiiProtocol (
|
|||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiHiiProtocolGuid,
|
||||
(VOID **)&mHii
|
||||
&mHii
|
||||
);
|
||||
|
||||
return Status;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Body of the STO functions
|
||||
//
|
||||
|
@ -1090,15 +1140,31 @@ GraphicsConsoleConOutTestString (
|
|||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 GlyphWidth;
|
||||
UINT32 GlyphStatus;
|
||||
UINT16 Count;
|
||||
GLYPH_UNION *Glyph;
|
||||
|
||||
GlyphStatus = 0;
|
||||
Count = 0;
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||
EFI_IMAGE_OUTPUT *Blt = NULL;
|
||||
#else
|
||||
UINT16 GlyphWidth;
|
||||
UINT32 GlyphStatus = 0;
|
||||
GLYPH_UNION *Glyph;
|
||||
#endif
|
||||
|
||||
while (WString[Count]) {
|
||||
Count = 0;
|
||||
|
||||
while (WString[Count] != 0) {
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||
Status = mHiiFont->GetGlyph (
|
||||
mHiiFont,
|
||||
WString[Count],
|
||||
NULL,
|
||||
&Blt,
|
||||
NULL
|
||||
);
|
||||
SafeFreePool (Blt);
|
||||
Blt = NULL;
|
||||
Count++;
|
||||
#else
|
||||
Status = mHii->GetGlyph (
|
||||
mHii,
|
||||
WString,
|
||||
|
@ -1107,7 +1173,7 @@ GraphicsConsoleConOutTestString (
|
|||
&GlyphWidth,
|
||||
&GlyphStatus
|
||||
);
|
||||
|
||||
#endif
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -1654,6 +1720,69 @@ GetTextColors (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||
EFI_STATUS
|
||||
DrawUnicodeWeightAtCursorN (
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
|
||||
IN CHAR16 *UnicodeWeight,
|
||||
IN UINTN Count
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
GRAPHICS_CONSOLE_DEV *Private;
|
||||
EFI_IMAGE_OUTPUT *Blt;
|
||||
EFI_STRING String;
|
||||
EFI_FONT_DISPLAY_INFO *FontInfo;
|
||||
|
||||
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
||||
//
|
||||
// GOP protocol is required in UEFI mode.
|
||||
//
|
||||
ASSERT (Private->GraphicsOutput != NULL);
|
||||
|
||||
Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
||||
if (Blt == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Blt->Width = (UINT16) (Private->ModeData[This->Mode->Mode].GopWidth);
|
||||
Blt->Height = (UINT16) (Private->ModeData[This->Mode->Mode].GopHeight);
|
||||
Blt->Image.Screen = Private->GraphicsOutput;
|
||||
|
||||
String = AllocateCopyPool ((Count + 1) * sizeof (CHAR16), UnicodeWeight);
|
||||
if (String == NULL) {
|
||||
SafeFreePool (Blt);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
*(String + Count) = 0;
|
||||
|
||||
FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
|
||||
if (FontInfo == NULL) {
|
||||
SafeFreePool (Blt);
|
||||
SafeFreePool (String);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
GetTextColors (This, &FontInfo->ForegroundColor, &FontInfo->BackgroundColor);
|
||||
|
||||
Status = mHiiFont->StringToImage (
|
||||
mHiiFont,
|
||||
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
|
||||
String,
|
||||
FontInfo,
|
||||
&Blt,
|
||||
This->Mode->CursorColumn * GLYPH_WIDTH + Private->ModeData[This->Mode->Mode].DeltaX,
|
||||
This->Mode->CursorRow * GLYPH_HEIGHT + Private->ModeData[This->Mode->Mode].DeltaY,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
SafeFreePool (Blt);
|
||||
SafeFreePool (String);
|
||||
SafeFreePool (FontInfo);
|
||||
return Status;
|
||||
}
|
||||
#else
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
DrawUnicodeWeightAtCursorN (
|
||||
|
@ -1794,6 +1923,7 @@ DrawUnicodeWeightAtCursorN (
|
|||
|
||||
return ReturnStatus;
|
||||
}
|
||||
#endif
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
|
|
|
@ -24,7 +24,7 @@ Revision History
|
|||
#define _GRAPHICS_CONSOLE_H
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Protocol/FrameworkHii.h>
|
||||
//#include <Protocol/FrameworkHii.h>
|
||||
#include <Protocol/SimpleTextOut.h>
|
||||
#include <Protocol/GraphicsOutput.h>
|
||||
#include <Protocol/UgaDraw.h>
|
||||
|
@ -32,10 +32,17 @@ Revision History
|
|||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/FrameworkHiiLib.h>
|
||||
//#include <Library/FrameworkHiiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
|
||||
#include <MdeModuleHii.h>
|
||||
|
||||
#include <Protocol/HiiFont.h>
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
|
||||
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;
|
||||
|
@ -174,8 +181,8 @@ GraphicsConsoleComponentNameGetControllerName (
|
|||
//
|
||||
// Glyph database
|
||||
//
|
||||
#define GLYPH_WIDTH 8
|
||||
#define GLYPH_HEIGHT 19
|
||||
//#define GLYPH_WIDTH 8
|
||||
//#define GLYPH_HEIGHT 19
|
||||
|
||||
//
|
||||
// User can define valid graphic resolution here
|
||||
|
@ -306,11 +313,6 @@ GraphicsConsoleConOutEnableCursor (
|
|||
IN BOOLEAN Visible
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EfiLocateHiiProtocol (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GraphicsConsoleControllerDriverSupported (
|
||||
|
@ -336,4 +338,11 @@ GraphicsConsoleControllerDriverStop (
|
|||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EfiLocateHiiProtocol (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x0002000A
|
||||
|
||||
ENTRY_POINT = InitializeGraphicsConsole
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
|||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
# currently use Hii for glyph lookup, need to change to UEFI scheme
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
|
@ -52,12 +53,13 @@
|
|||
UefiLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
FrameworkHiiLib
|
||||
HiiLib
|
||||
|
||||
[Protocols]
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSimpleTextOutProtocolGuid # PROTOCOL BY_START
|
||||
gEfiHiiProtocolGuid # PROTOCOL TO_START
|
||||
gEfiGraphicsOutputProtocolGuid # PROTOCOL TO_START
|
||||
gEfiUgaDrawProtocolGuid # PROTOCOL TO_START
|
||||
gEfiHiiFontProtocolGuid
|
||||
gEfiHiiDatabaseProtocolGuid
|
||||
|
||||
|
|
|
@ -65,9 +65,6 @@
|
|||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
|
|
|
@ -2359,14 +2359,14 @@ DevPathFromTextSata (
|
|||
MSG_SATA_DP,
|
||||
sizeof (SATA_DEVICE_PATH)
|
||||
);
|
||||
Sata->HbaPortNumber = (UINT16) Xtoi (Param1);
|
||||
Sata->HBAPortNumber = (UINT16) Xtoi (Param1);
|
||||
if (Param3 != NULL) {
|
||||
Sata->PortMultiplierPort = (UINT16) Xtoi (Param2);
|
||||
Sata->PortMultiplierPortNumber = (UINT16) Xtoi (Param2);
|
||||
Param2 = Param3;
|
||||
} else {
|
||||
Sata->PortMultiplierPort = 0;
|
||||
Sata->PortMultiplierPortNumber = 0;
|
||||
}
|
||||
Sata->LogicalUnitNumber = (UINT16) Xtoi (Param2);
|
||||
Sata->Lun = (UINT16) Xtoi (Param2);
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *) Sata;
|
||||
}
|
||||
|
|
|
@ -830,9 +830,9 @@ DevPathToTextSata (
|
|||
CatPrint (
|
||||
Str,
|
||||
L"Sata(0x%x,0x%x,0x%x)",
|
||||
(UINTN) Sata->HbaPortNumber,
|
||||
(UINTN) Sata->PortMultiplierPort,
|
||||
(UINTN) Sata->LogicalUnitNumber
|
||||
(UINTN) Sata->HBAPortNumber,
|
||||
(UINTN) Sata->PortMultiplierPortNumber,
|
||||
(UINTN) Sata->Lun
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,788 @@
|
|||
/** @file
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
DriverSample.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This is an example of how a driver might export data to the HII protocol to be
|
||||
later utilized by the Setup Protocol
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "DriverSample.h"
|
||||
|
||||
#define DISPLAY_ONLY_MY_ITEM 0x0002
|
||||
|
||||
EFI_GUID mFormSetGuid = FORMSET_GUID;
|
||||
EFI_GUID mInventoryGuid = INVENTORY_GUID;
|
||||
|
||||
CHAR16 VariableName[] = L"MyIfrNVData";
|
||||
|
||||
VOID
|
||||
EncodePassword (
|
||||
IN CHAR16 *Password,
|
||||
IN UINT8 MaxSize
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Loop;
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *Key;
|
||||
|
||||
Key = L"MAR10648567";
|
||||
Buffer = AllocateZeroPool (MaxSize);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
for (Index = 0; Key[Index] != 0; Index++) {
|
||||
for (Loop = 0; Loop < (UINT8) (MaxSize / 2); Loop++) {
|
||||
Buffer[Loop] = (CHAR16) (Password[Loop] ^ Key[Index]);
|
||||
}
|
||||
}
|
||||
|
||||
CopyMem (Password, Buffer, MaxSize);
|
||||
|
||||
gBS->FreePool (Buffer);
|
||||
return ;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ValidatePassword (
|
||||
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData,
|
||||
EFI_STRING_ID StringId
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
UINTN BufferSize;
|
||||
CHAR16 *Password;
|
||||
CHAR16 *EncodedPassword;
|
||||
BOOLEAN OldPassword;
|
||||
|
||||
//
|
||||
// Get encoded password first
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = gRT->GetVariable (
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Old password not exist, prompt for new password
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
OldPassword = FALSE;
|
||||
//
|
||||
// Check whether we have any old password set
|
||||
//
|
||||
for (Index = 0; Index < 20; Index++) {
|
||||
if (PrivateData->Configuration.WhatIsThePassword2[Index] != 0) {
|
||||
OldPassword = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!OldPassword) {
|
||||
//
|
||||
// Old password not exist, return EFI_SUCCESS to prompt for new password
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Get user input password
|
||||
//
|
||||
BufferSize = 21 * sizeof (CHAR16);
|
||||
Password = AllocateZeroPool (BufferSize);
|
||||
ASSERT (Password != NULL);
|
||||
|
||||
Status = IfrLibGetString (PrivateData->HiiHandle[0], StringId, Password, &BufferSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (Password);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate old password
|
||||
//
|
||||
EncodedPassword = AllocateCopyPool (21 * sizeof (CHAR16), Password);
|
||||
ASSERT (EncodedPassword != NULL);
|
||||
EncodePassword (EncodedPassword, 20 * sizeof (CHAR16));
|
||||
if (CompareMem (EncodedPassword, PrivateData->Configuration.WhatIsThePassword2, 20 * sizeof (CHAR16)) != 0) {
|
||||
//
|
||||
// Old password mismatch, return EFI_NOT_READY to prompt for error message
|
||||
//
|
||||
Status = EFI_NOT_READY;
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
gBS->FreePool (Password);
|
||||
gBS->FreePool (EncodedPassword);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
SetPassword (
|
||||
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData,
|
||||
EFI_STRING_ID StringId
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
CHAR16 *Password;
|
||||
DRIVER_SAMPLE_CONFIGURATION *Configuration;
|
||||
|
||||
//
|
||||
// Get Buffer Storage data from EFI variable
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = gRT->GetVariable (
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get user input password
|
||||
//
|
||||
Password = &PrivateData->Configuration.WhatIsThePassword2[0];
|
||||
ZeroMem (Password, 20 * sizeof (CHAR16));
|
||||
Status = IfrLibGetString (PrivateData->HiiHandle[0], StringId, Password, &BufferSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrive uncommitted data from Browser
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Configuration = AllocateZeroPool (sizeof (DRIVER_SAMPLE_PRIVATE_DATA));
|
||||
ASSERT (Configuration != NULL);
|
||||
Status = GetBrowserData (&mFormSetGuid, VariableName, &BufferSize, (UINT8 *) Configuration);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Update password's clear text in the screen
|
||||
//
|
||||
CopyMem (Configuration->PasswordClearText, Password, 20 * sizeof (CHAR16));
|
||||
|
||||
//
|
||||
// Update uncommitted data of Browser
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = SetBrowserData (
|
||||
&mFormSetGuid,
|
||||
VariableName,
|
||||
BufferSize,
|
||||
(UINT8 *) Configuration,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
gBS->FreePool (Configuration);
|
||||
|
||||
//
|
||||
// Set password
|
||||
//
|
||||
EncodePassword (Password, 20 * sizeof (CHAR16));
|
||||
Status = gRT->SetVariable(
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (DRIVER_SAMPLE_CONFIGURATION),
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
ExtractConfig (
|
||||
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;
|
||||
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
HiiConfigRouting = PrivateData->HiiConfigRouting;
|
||||
|
||||
//
|
||||
// Get Buffer Storage data from EFI variable
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = gRT->GetVariable (
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
Status = HiiConfigRouting->BlockToConfig (
|
||||
HiiConfigRouting,
|
||||
Request,
|
||||
(UINT8 *) &PrivateData->Configuration,
|
||||
BufferSize,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
RouteConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
HiiConfigRouting = PrivateData->HiiConfigRouting;
|
||||
|
||||
//
|
||||
// Get Buffer Storage data from EFI variable
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = gRT->GetVariable (
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = HiiConfigRouting->ConfigToBlock (
|
||||
HiiConfigRouting,
|
||||
Configuration,
|
||||
(UINT8 *) &PrivateData->Configuration,
|
||||
&BufferSize,
|
||||
Progress
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Store Buffer Storage back to EFI variable
|
||||
//
|
||||
Status = gRT->SetVariable(
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (DRIVER_SAMPLE_CONFIGURATION),
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
DriverCallback (
|
||||
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
|
||||
)
|
||||
{
|
||||
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_UPDATE_DATA UpdateData;
|
||||
IFR_OPTION *IfrOptionList;
|
||||
|
||||
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
|
||||
switch (QuestionId) {
|
||||
case 0x1234:
|
||||
//
|
||||
// Create dynamic page for this interactive goto
|
||||
//
|
||||
UpdateData.BufferSize = 0x1000;
|
||||
UpdateData.Offset = 0;
|
||||
UpdateData.Data = AllocatePool (0x1000);
|
||||
ASSERT (UpdateData.Data != NULL);
|
||||
|
||||
IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION));
|
||||
ASSERT (IfrOptionList != NULL);
|
||||
|
||||
IfrOptionList[0].Flags = 0;
|
||||
IfrOptionList[0].StringToken = STRING_TOKEN (STR_BOOT_OPTION1);
|
||||
IfrOptionList[0].Value.u8 = 1;
|
||||
IfrOptionList[1].Flags = EFI_IFR_OPTION_DEFAULT;
|
||||
IfrOptionList[1].StringToken = STRING_TOKEN (STR_BOOT_OPTION2);
|
||||
IfrOptionList[1].Value.u8 = 2;
|
||||
|
||||
CreateActionOpCode (
|
||||
0x1237,
|
||||
STRING_TOKEN(STR_EXIT_TEXT),
|
||||
STRING_TOKEN(STR_EXIT_TEXT),
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
0,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
CreateOneOfOpCode (
|
||||
0x8001,
|
||||
0,
|
||||
0,
|
||||
STRING_TOKEN (STR_ONE_OF_PROMPT),
|
||||
STRING_TOKEN (STR_ONE_OF_HELP),
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
EFI_IFR_NUMERIC_SIZE_1,
|
||||
IfrOptionList,
|
||||
2,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
CreateOrderedListOpCode (
|
||||
0x8002,
|
||||
0,
|
||||
0,
|
||||
STRING_TOKEN (STR_BOOT_OPTIONS),
|
||||
STRING_TOKEN (STR_BOOT_OPTIONS),
|
||||
EFI_IFR_FLAG_RESET_REQUIRED,
|
||||
0,
|
||||
EFI_IFR_NUMERIC_SIZE_1,
|
||||
10,
|
||||
IfrOptionList,
|
||||
2,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
CreateGotoOpCode (
|
||||
1,
|
||||
STRING_TOKEN (STR_GOTO_FORM1),
|
||||
STRING_TOKEN (STR_GOTO_HELP),
|
||||
0,
|
||||
0x8003,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
Status = IfrLibUpdateForm (
|
||||
PrivateData->HiiHandle[0],
|
||||
&mFormSetGuid,
|
||||
0x1234,
|
||||
0x1234,
|
||||
TRUE,
|
||||
&UpdateData
|
||||
);
|
||||
gBS->FreePool (IfrOptionList);
|
||||
gBS->FreePool (UpdateData.Data);
|
||||
break;
|
||||
|
||||
case 0x1237:
|
||||
//
|
||||
// User press "Exit now", request Browser to exit
|
||||
//
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
break;
|
||||
|
||||
case 0x1238:
|
||||
//
|
||||
// User press "Save now", request Browser to save the uncommitted data.
|
||||
//
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
|
||||
break;
|
||||
|
||||
case 0x2000:
|
||||
//
|
||||
// When try to set a new password, user will be chanlleged with old password.
|
||||
// The Callback is responsible for validating old password input by user,
|
||||
// If Callback return EFI_SUCCESS, it indicates validation pass.
|
||||
//
|
||||
switch (PrivateData->PasswordState) {
|
||||
case BROWSER_STATE_VALIDATE_PASSWORD:
|
||||
Status = ValidatePassword (PrivateData, Value->string);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
PrivateData->PasswordState = BROWSER_STATE_SET_PASSWORD;
|
||||
}
|
||||
break;
|
||||
|
||||
case BROWSER_STATE_SET_PASSWORD:
|
||||
Status = SetPassword (PrivateData, Value->string);
|
||||
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DriverSampleInit (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS SavedStatus;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||
EFI_HII_HANDLE HiiHandle[2];
|
||||
EFI_HANDLE DriverHandle[2];
|
||||
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
|
||||
EFI_SCREEN_DESCRIPTOR Screen;
|
||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||
EFI_HII_STRING_PROTOCOL *HiiString;
|
||||
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
CHAR16 *NewString;
|
||||
UINTN BufferSize;
|
||||
DRIVER_SAMPLE_CONFIGURATION *Configuration;
|
||||
BOOLEAN ExtractIfrDefault;
|
||||
|
||||
//
|
||||
// Initialize the library and our protocol.
|
||||
//
|
||||
//@MT: EfiInitializeDriverLib (ImageHandle, SystemTable);
|
||||
|
||||
//
|
||||
// Initialize screen dimensions for SendForm().
|
||||
// Remove 3 characters from top and bottom
|
||||
//
|
||||
ZeroMem (&Screen, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Screen.RightColumn, &Screen.BottomRow);
|
||||
|
||||
Screen.TopRow = 3;
|
||||
Screen.BottomRow = Screen.BottomRow - 3;
|
||||
|
||||
//
|
||||
// Initialize driver private data
|
||||
//
|
||||
PrivateData = AllocatePool (sizeof (DRIVER_SAMPLE_PRIVATE_DATA));
|
||||
if (PrivateData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
PrivateData->Signature = DRIVER_SAMPLE_PRIVATE_SIGNATURE;
|
||||
|
||||
PrivateData->ConfigAccess.ExtractConfig = ExtractConfig;
|
||||
PrivateData->ConfigAccess.RouteConfig = RouteConfig;
|
||||
PrivateData->ConfigAccess.Callback = DriverCallback;
|
||||
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
|
||||
|
||||
//
|
||||
// Locate Hii Database protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &HiiDatabase);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->HiiDatabase = HiiDatabase;
|
||||
|
||||
//
|
||||
// Locate HiiString protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->HiiString = HiiString;
|
||||
|
||||
//
|
||||
// Locate Formbrowser2 protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &FormBrowser2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->FormBrowser2 = FormBrowser2;
|
||||
|
||||
//
|
||||
// Locate ConfigRouting protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &HiiConfigRouting);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->HiiConfigRouting = HiiConfigRouting;
|
||||
|
||||
//
|
||||
// Install Config Access protocol
|
||||
//
|
||||
Status = HiiLibCreateHiiDriverHandle (&DriverHandle[0]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->DriverHandle[0] = DriverHandle[0];
|
||||
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&DriverHandle[0],
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&PrivateData->ConfigAccess
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Publish our HII data
|
||||
//
|
||||
PackageList = PreparePackageList (
|
||||
2,
|
||||
&mFormSetGuid,
|
||||
DriverSampleStrings,
|
||||
VfrBin
|
||||
);
|
||||
if (PackageList == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Status = HiiDatabase->NewPackageList (
|
||||
HiiDatabase,
|
||||
PackageList,
|
||||
DriverHandle[0],
|
||||
&HiiHandle[0]
|
||||
);
|
||||
gBS->FreePool (PackageList);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->HiiHandle[0] = HiiHandle[0];
|
||||
|
||||
//
|
||||
// Publish another Fromset
|
||||
//
|
||||
Status = HiiLibCreateHiiDriverHandle (&DriverHandle[1]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->DriverHandle[1] = DriverHandle[1];
|
||||
|
||||
PackageList = PreparePackageList (
|
||||
2,
|
||||
&mInventoryGuid,
|
||||
DriverSampleStrings,
|
||||
InventoryBin
|
||||
);
|
||||
if (PackageList == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Status = HiiDatabase->NewPackageList (
|
||||
HiiDatabase,
|
||||
PackageList,
|
||||
DriverHandle[1],
|
||||
&HiiHandle[1]
|
||||
);
|
||||
gBS->FreePool (PackageList);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
PrivateData->HiiHandle[1] = HiiHandle[1];
|
||||
|
||||
//
|
||||
// Very simple example of how one would update a string that is already
|
||||
// in the HII database
|
||||
//
|
||||
NewString = L"700 Mhz";
|
||||
|
||||
Status = IfrLibSetString (HiiHandle[0], STRING_TOKEN (STR_CPU_STRING2), NewString);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize configuration data
|
||||
//
|
||||
Configuration = &PrivateData->Configuration;
|
||||
ZeroMem (Configuration, sizeof (DRIVER_SAMPLE_CONFIGURATION));
|
||||
|
||||
//
|
||||
// Try to read NV config EFI variable first
|
||||
//
|
||||
ExtractIfrDefault = TRUE;
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = gRT->GetVariable (VariableName, &mFormSetGuid, NULL, &BufferSize, Configuration);
|
||||
if (!EFI_ERROR (Status) && (BufferSize == sizeof (DRIVER_SAMPLE_CONFIGURATION))) {
|
||||
ExtractIfrDefault = FALSE;
|
||||
}
|
||||
|
||||
if (ExtractIfrDefault) {
|
||||
//
|
||||
// EFI variable for NV config doesn't exit, we should build this variable
|
||||
// based on default values stored in IFR
|
||||
//
|
||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||
Status = ExtractDefault (Configuration, &BufferSize, 1, VfrMyIfrNVDataDefault0000);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gRT->SetVariable(
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (DRIVER_SAMPLE_CONFIGURATION),
|
||||
Configuration
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Example of how to display only the item we sent to HII
|
||||
//
|
||||
if (DISPLAY_ONLY_MY_ITEM == 0x0001) {
|
||||
//
|
||||
// Have the browser pull out our copy of the data, and only display our data
|
||||
//
|
||||
// Status = FormConfig->SendForm (FormConfig, TRUE, HiiHandle, NULL, NULL, NULL, &Screen, NULL);
|
||||
//
|
||||
Status = FormBrowser2->SendForm (
|
||||
FormBrowser2,
|
||||
HiiHandle,
|
||||
1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
SavedStatus = Status;
|
||||
|
||||
Status = HiiDatabase->RemovePackageList (HiiDatabase, HiiHandle[0]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = HiiDatabase->RemovePackageList (HiiDatabase, HiiHandle[1]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return SavedStatus;
|
||||
} else {
|
||||
//
|
||||
// Have the browser pull out all the data in the HII Database and display it.
|
||||
//
|
||||
// Status = FormConfig->SendForm (FormConfig, TRUE, 0, NULL, NULL, NULL, NULL, NULL);
|
||||
//
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
DriverSample.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _DRIVER_SAMPLE_H
|
||||
#define _DRIVER_SAMPLE_H
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/HiiConfigRouting.h>
|
||||
#include <Protocol/FormBrowser2.h>
|
||||
#include <Protocol/HiiConfigAccess.h>
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
#include <Protocol/HiiString.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/IfrSupportLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
|
||||
#include <MdeModuleHii.h>
|
||||
|
||||
|
||||
#include "NVDataStruc.h"
|
||||
|
||||
//
|
||||
// This is the generated <AltResp> for defaults defined in VFR
|
||||
//
|
||||
extern UINT8 VfrMyIfrNVDataDefault0000[];
|
||||
|
||||
//
|
||||
// This is the generated IFR binary data for each formset defined in VFR.
|
||||
// This data array is ready to be used as input of PreparePackageList() to
|
||||
// create a packagelist (which contains Form packages, String packages, etc).
|
||||
//
|
||||
extern UINT8 VfrBin[];
|
||||
extern UINT8 InventoryBin[];
|
||||
|
||||
//
|
||||
// This is the generated String package data for all .UNI files.
|
||||
// This data array is ready to be used as input of PreparePackageList() to
|
||||
// create a packagelist (which contains Form packages, String packages, etc).
|
||||
//
|
||||
extern UINT8 DriverSampleStrings[];
|
||||
|
||||
#define SAMPLE_STRING L"This is an error!"
|
||||
|
||||
#define DRIVER_SAMPLE_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('D', 'S', 'p', 's')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HANDLE DriverHandle[2];
|
||||
EFI_HII_HANDLE HiiHandle[2];
|
||||
DRIVER_SAMPLE_CONFIGURATION Configuration;
|
||||
UINT8 PasswordState;
|
||||
|
||||
//
|
||||
// Consumed protocol
|
||||
//
|
||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||
EFI_HII_STRING_PROTOCOL *HiiString;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
||||
|
||||
//
|
||||
// Produced protocol
|
||||
//
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
||||
} DRIVER_SAMPLE_PRIVATE_DATA;
|
||||
|
||||
#define DRIVER_SAMPLE_PRIVATE_FROM_THIS(a) CR (a, DRIVER_SAMPLE_PRIVATE_DATA, ConfigAccess, DRIVER_SAMPLE_PRIVATE_SIGNATURE)
|
||||
|
||||
#endif
|
|
@ -0,0 +1,72 @@
|
|||
#/** @file
|
||||
# Component name for module DriverSample
|
||||
#
|
||||
# FIX ME!
|
||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = DriverSample
|
||||
FILE_GUID = FE3542FE-C1D3-4EF8-657C-8048606FF671
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x0002000A
|
||||
|
||||
ENTRY_POINT = DriverSampleInit
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
DriverSample.c
|
||||
inventorystrings.uni
|
||||
NVDataStruc.h
|
||||
VfrStrings.uni
|
||||
DriverSample.h
|
||||
Inventory.vfr
|
||||
Vfr.vfr
|
||||
VfrStrings.uni
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
UefiBootServicesTableLib
|
||||
UefiDriverEntryPoint
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
HiiLib
|
||||
IfrSupportLib
|
||||
BaseLib
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiHiiStringProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiFormBrowser2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
|
||||
[Depex]
|
||||
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>DriverSample</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>FE3542FE-C1D3-4EF8-657C-8048606FF671</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component name for module DriverSample</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2007, Intel Corporation. All rights reserved.</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>DriverSample</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>DriverSample.h</Filename>
|
||||
<Filename>VfrStrings.uni</Filename>
|
||||
<Filename>NVDataStruc.h</Filename>
|
||||
<Filename>inventorystrings.uni</Filename>
|
||||
<Filename>DriverSample.c</Filename>
|
||||
<Filename>DriverSample.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiDatabaseProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiFormBrowser2ProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiConfigAccessProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiConfigRoutingProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiStringProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>DriverSampleInit</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,64 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
NVDataStruc.h
|
||||
|
||||
Abstract:
|
||||
|
||||
NVData structure used by the sample driver
|
||||
|
||||
Revision History:
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _NVDATASTRUC_H
|
||||
#define _NVDATASTRUC_H
|
||||
|
||||
#define FORMSET_GUID \
|
||||
{ \
|
||||
0xA04A27f4, 0xDF00, 0x4D42, 0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D \
|
||||
}
|
||||
|
||||
#define INVENTORY_GUID \
|
||||
{ \
|
||||
0xb3f56470, 0x6141, 0x4621, 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 \
|
||||
}
|
||||
|
||||
#define VAR_EQ_TEST_NAME 0x100
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT16 WhatIsThePassword[20];
|
||||
UINT16 WhatIsThePassword2[20];
|
||||
UINT16 MyStringData[20];
|
||||
UINT16 PasswordClearText[20];
|
||||
UINT16 SomethingHiddenForHtml;
|
||||
UINT8 HowOldAreYouInYearsManual;
|
||||
UINT16 HowTallAreYouManual;
|
||||
UINT8 HowOldAreYouInYears;
|
||||
UINT16 HowTallAreYou;
|
||||
UINT8 MyFavoriteNumber;
|
||||
UINT8 TestLateCheck;
|
||||
UINT8 TestLateCheck2;
|
||||
UINT8 QuestionAboutTreeHugging;
|
||||
UINT8 ChooseToActivateNuclearWeaponry;
|
||||
UINT8 SuppressGrayOutSomething;
|
||||
UINT8 OrderedList[8];
|
||||
UINT8 BootOrder[8];
|
||||
UINT8 BootOrderLarge;
|
||||
UINT8 DynamicCheck;
|
||||
} DRIVER_SAMPLE_CONFIGURATION;
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
|
@ -0,0 +1,504 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2007, Intel Corporation
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// Vfr.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Sample Setup formset
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
|
||||
#include "NVDataStruc.h"
|
||||
|
||||
//
|
||||
// Formset class used by Device Manager
|
||||
//
|
||||
#define EFI_NON_DEVICE_CLASS 0x00
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
|
||||
//
|
||||
// Formset subclass
|
||||
//
|
||||
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
|
||||
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
|
||||
#define EFI_FRONT_PAGE_SUBCLASS 0x02
|
||||
#define EFI_SINGLE_USE_SUBCLASS 0x03
|
||||
|
||||
//
|
||||
// EFI Variable attributes
|
||||
//
|
||||
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
|
||||
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
|
||||
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
|
||||
#define EFI_VARIABLE_READ_ONLY 0x00000008
|
||||
|
||||
//
|
||||
// NV data structure definition
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Field8;
|
||||
UINT16 Field16;
|
||||
UINT8 OrderedList[3];
|
||||
} MY_DATA2;
|
||||
|
||||
//
|
||||
// Labels definition
|
||||
//
|
||||
#define LABEL_1_VALUE 0x01
|
||||
#define LABEL_2_VALUE 0x1000
|
||||
#define LABEL_UPDATE_BBS 0x2222
|
||||
#define LABEL_END 0x2223
|
||||
|
||||
formset
|
||||
guid = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FORM_SET_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
|
||||
class = EFI_ON_BOARD_DEVICE_CLASS,
|
||||
subclass = EFI_SETUP_APPLICATION_SUBCLASS,
|
||||
|
||||
//
|
||||
// Define a Buffer Storage (EFI_IFR_VARSTORE)
|
||||
//
|
||||
varstore DRIVER_SAMPLE_CONFIGURATION, // This is the data structure type
|
||||
varid = 0x1234, // Optional VarStore ID
|
||||
name = MyIfrNVData, // Define referenced name in vfr
|
||||
guid = FORMSET_GUID; // GUID of this buffer storage
|
||||
|
||||
//
|
||||
// Define another Buffer Storage
|
||||
//
|
||||
varstore MY_DATA2,
|
||||
name = MyIfrNVData2,
|
||||
guid = FORMSET_GUID;
|
||||
|
||||
//
|
||||
// Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
|
||||
//
|
||||
efivarstore MyEfiVar, // Define referenced name in vfr
|
||||
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS, // EFI variable attribures
|
||||
name = STRING_TOKEN(STR_VAR_NAME), // EFI variable name
|
||||
varsize = 1, // Size of the EFI variable
|
||||
guid = FORMSET_GUID; // EFI variable GUID
|
||||
|
||||
//
|
||||
// Define a Form (EFI_IFR_FORM)
|
||||
//
|
||||
form formid = 1, // Form ID
|
||||
title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
|
||||
|
||||
//
|
||||
// Define a display only text (EFI_IFR_TEXT)
|
||||
//
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP), // Help string
|
||||
text = STRING_TOKEN(STR_CPU_STRING), // Prompt string
|
||||
text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_EXIT_TEXT),
|
||||
text = STRING_TOKEN(STR_EXIT_TEXT),
|
||||
text = STRING_TOKEN(STR_EXIT_TEXT),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1237;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_SAVE_TEXT),
|
||||
text = STRING_TOKEN(STR_SAVE_TEXT),
|
||||
text = STRING_TOKEN(STR_SAVE_TEXT),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1238;
|
||||
|
||||
//
|
||||
// Define oneof (EFI_IFR_ONE_OF)
|
||||
//
|
||||
oneof varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage
|
||||
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
//
|
||||
// Define an option (EFI_IFR_ONE_OF_OPTION)
|
||||
//
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
|
||||
//
|
||||
// DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
|
||||
//
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
|
||||
endoneof;
|
||||
|
||||
oneof varid = MyIfrNVData.BootOrderLarge,
|
||||
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
|
||||
option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
|
||||
endoneof;
|
||||
|
||||
grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
|
||||
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
|
||||
|
||||
checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
|
||||
prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
|
||||
help = STRING_TOKEN(STR_CHECK_BOX_HELP),
|
||||
//
|
||||
// CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
|
||||
//
|
||||
flags = CHECKBOX_DEFAULT,
|
||||
key = 0,
|
||||
|
||||
endcheckbox;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//
|
||||
// Ordered list:
|
||||
// sizeof(MyIfrNVData) storage must be UINT8 array, and
|
||||
// size written for the variable must be size of the entire
|
||||
// variable.
|
||||
//
|
||||
//
|
||||
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
|
||||
|
||||
//
|
||||
// label is defined as an anchor where you want to insert some dynamic
|
||||
// opcodes created on-the-fly
|
||||
//
|
||||
label LABEL_UPDATE_BBS;
|
||||
|
||||
orderedlist
|
||||
varid = MyIfrNVData.BootOrder,
|
||||
prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
|
||||
suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = 0;
|
||||
endif
|
||||
endlist;
|
||||
|
||||
//
|
||||
// label should be paired with each other
|
||||
//
|
||||
label LABEL_END;
|
||||
|
||||
endif; // end suppressif
|
||||
|
||||
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
|
||||
orderedlist
|
||||
varid = MyIfrNVData.OrderedList,
|
||||
prompt = STRING_TOKEN(STR_TEST_OPCODE),
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
|
||||
endlist;
|
||||
endif;
|
||||
|
||||
label 100;
|
||||
|
||||
//
|
||||
// Define a hyperlink (EFI_IFR_REF)
|
||||
//
|
||||
goto 0x1234, // Destination Form ID
|
||||
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
|
||||
help = STRING_TOKEN(STR_GOTO_HELP), // Help string
|
||||
flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
|
||||
key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
|
||||
|
||||
goto 0x1234,
|
||||
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
|
||||
help = STRING_TOKEN(STR_GOTO_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1235;
|
||||
|
||||
oneof varid = MyIfrNVData.TestLateCheck,
|
||||
prompt = STRING_TOKEN(STR_TEST_OPCODE),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
|
||||
|
||||
endoneof;
|
||||
|
||||
oneof varid = MyIfrNVData.TestLateCheck2,
|
||||
prompt = STRING_TOKEN(STR_TEST_OPCODE2),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
|
||||
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
|
||||
endif
|
||||
|
||||
endoneof;
|
||||
|
||||
oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
|
||||
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
|
||||
|
||||
endoneof;
|
||||
|
||||
//
|
||||
// Define a string (EFI_IFR_STRING)
|
||||
//
|
||||
string varid = MyIfrNVData.MyStringData,
|
||||
prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
|
||||
help = STRING_TOKEN(STR_MY_STRING_HELP2),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1236,
|
||||
minsize = 6,
|
||||
maxsize = 20,
|
||||
endstring;
|
||||
|
||||
//
|
||||
// Define a numeric (EFI_IFR_NUMERIC)
|
||||
//
|
||||
numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
|
||||
prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP0),
|
||||
flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
|
||||
minimum = 0,
|
||||
maximum = 0xf0,
|
||||
step = 0, // Stepping of 0 equates to a manual entering
|
||||
// of a value, otherwise it will be adjusted by "+"/"-"
|
||||
default = 20,
|
||||
|
||||
endnumeric;
|
||||
|
||||
numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
|
||||
prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP0),
|
||||
minimum = 0,
|
||||
maximum = 0xf0,
|
||||
step = 0,
|
||||
default = 21,
|
||||
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
|
||||
OR
|
||||
ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
|
||||
OR
|
||||
ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
|
||||
endif
|
||||
|
||||
endnumeric;
|
||||
|
||||
numeric varid = MyEfiVar, // Reference of EFI variable storage
|
||||
prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP1),
|
||||
flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format)
|
||||
minimum = 0,
|
||||
maximum = 250,
|
||||
default = 175,
|
||||
|
||||
endnumeric;
|
||||
|
||||
label LABEL_1_VALUE;
|
||||
label LABEL_2_VALUE;
|
||||
|
||||
grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
|
||||
numeric varid = MyIfrNVData.HowOldAreYouInYears,
|
||||
prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP2),
|
||||
minimum = 0,
|
||||
maximum = 243,
|
||||
step = 1,
|
||||
default = 18,
|
||||
|
||||
endnumeric;
|
||||
endif;
|
||||
|
||||
//
|
||||
// Non-interactive password, validate by Setup Browser
|
||||
//
|
||||
password varid = MyIfrNVData.WhatIsThePassword,
|
||||
prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
|
||||
help = STRING_TOKEN(STR_PASSWORD_HELP),
|
||||
minsize = 6,
|
||||
maxsize = 20, // new opcode
|
||||
endpassword;
|
||||
|
||||
string varid = MyIfrNVData.PasswordClearText,
|
||||
prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
|
||||
help = STRING_TOKEN(STR_MY_STRING_HELP),
|
||||
minsize = 6,
|
||||
maxsize = 0x14,
|
||||
endstring;
|
||||
|
||||
//
|
||||
// Interactive password, validate via ConfigAccess.Callback()
|
||||
//
|
||||
password varid = MyIfrNVData.WhatIsThePassword2,
|
||||
prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
|
||||
help = STRING_TOKEN(STR_PASSWORD_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x2000,
|
||||
minsize = 6,
|
||||
maxsize = 20, // new opcode
|
||||
endpassword;
|
||||
|
||||
goto 2,
|
||||
prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
|
||||
help = STRING_TOKEN(STR_GOTO_HELP);
|
||||
|
||||
goto 3,
|
||||
prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
|
||||
help = STRING_TOKEN(STR_GOTO_HELP);
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 2, // SecondSetupPage,
|
||||
title = STRING_TOKEN(STR_FORM2_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
|
||||
date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_YEAR_HELP),
|
||||
minimum = 1998,
|
||||
maximum = 2099,
|
||||
step = 1,
|
||||
default = 2004,
|
||||
|
||||
month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_MONTH_HELP),
|
||||
minimum = 1,
|
||||
maximum = 12,
|
||||
step = 1,
|
||||
default = 1,
|
||||
|
||||
day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_DAY_HELP),
|
||||
minimum = 1,
|
||||
maximum = 31,
|
||||
step = 0x1,
|
||||
default = 1,
|
||||
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval Date.Day == 31
|
||||
AND
|
||||
ideqvallist Date.Month == 2 4 6 9 11
|
||||
endif
|
||||
|
||||
//
|
||||
// If the day is 30 AND month is 2
|
||||
//
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval Date.Day == 30
|
||||
AND
|
||||
ideqval Date.Month == 2
|
||||
endif
|
||||
|
||||
//
|
||||
// If the day is 29 AND month is 2 AND it year is NOT a leapyear
|
||||
//
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval Date.Day == 0x1D
|
||||
AND
|
||||
ideqval Date.Month == 2
|
||||
AND
|
||||
NOT
|
||||
ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
|
||||
endif
|
||||
|
||||
enddate;
|
||||
|
||||
time hour varid = Time.Hours, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_HOUR_HELP),
|
||||
minimum = 0,
|
||||
maximum = 23,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
minute varid = Time.Minutes, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
|
||||
minimum = 0,
|
||||
maximum = 59,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
second varid = Time.Seconds, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_SECOND_HELP),
|
||||
minimum = 0,
|
||||
maximum = 59,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
endtime;
|
||||
|
||||
checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
|
||||
prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
|
||||
help = STRING_TOKEN(STR_CHECK_BOX_HELP),
|
||||
flags = CHECKBOX_DEFAULT,
|
||||
key = 0,
|
||||
endcheckbox;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_1);
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_1),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_2);
|
||||
|
||||
goto 1,
|
||||
prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
|
||||
help = STRING_TOKEN(STR_GOTO_HELP);
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 3, title = STRING_TOKEN(STR_FORM3_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_1);
|
||||
endif;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 0x1234, // Dynamically created page,
|
||||
title = STRING_TOKEN(STR_DYNAMIC_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
label 0x1234;
|
||||
//
|
||||
// This is where we will insert dynamic created opcodes
|
||||
//
|
||||
label LABEL_END;
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
Binary file not shown.
|
@ -0,0 +1,121 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2007, Intel Corporation
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// Inventory.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Sample Inventory Data.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#define INVENTORY_GUID { 0xb3f56470, 0x6141, 0x4621, 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 }
|
||||
|
||||
formset
|
||||
guid = INVENTORY_GUID,
|
||||
title = STRING_TOKEN(STR_INV_FORM_SET_TITLE),
|
||||
help = STRING_TOKEN(STR_INV_FORM_SET_HELP),
|
||||
class = 0x04,
|
||||
subclass = 0x03,
|
||||
|
||||
form formid = 1,
|
||||
title = STRING_TOKEN(STR_INV_FORM1_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_VERSION_HELP),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT2),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT3),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT4),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT5),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT6),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT7),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT8),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT9),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT10),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT11),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_INV_VERSION_TEXT12);
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue