Update Browser to provide the customization possibilities.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14540 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong
2013-08-12 02:19:56 +00:00
committed by ydong10
parent 2536161545
commit 7c6c064ca8
25 changed files with 13669 additions and 2310 deletions

View File

@@ -0,0 +1,356 @@
/** @file
This library class defines a set of interfaces to customize Display module
Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that 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 __CUSTOMIZED_DISPLAY_LIB_H__
#define __CUSTOMIZED_DISPLAY_LIB_H__
#include <Protocol/DisplayProtocol.h>
/**
+------------------------------------------------------------------------------+
? Setup Page ?
+------------------------------------------------------------------------------+
Statement
Statement
Statement
+------------------------------------------------------------------------------+
?F1=Scroll Help F9=Reset to Defaults F10=Save and Exit ?
| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Discard Changes |
+------------------------------------------------------------------------------+
StatusBar
**/
/**
This funtion defines Page Frame and Backgroud.
Based on the above layout, it will be responsible for HeaderHeight, FooterHeight,
StatusBarHeight and Backgroud. And, it will reserve Screen for Statement.
@param[in] FormData Form Data to be shown in Page.
@param[out] ScreenForStatement Screen to be used for Statement. (Prompt, Value and Help)
@return Status
**/
EFI_STATUS
EFIAPI
DisplayPageFrame (
IN FORM_DISPLAY_ENGINE_FORM *FormData,
OUT EFI_SCREEN_DESCRIPTOR *ScreenForStatement
);
/**
Clear Screen to the initial state.
**/
VOID
EFIAPI
ClearDisplayPage (
VOID
);
/**
This function updates customized key panel's help information.
The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-.
and arrange them in Footer panel.
@param[in] FormData Form Data to be shown in Page. FormData has the highlighted statement.
@param[in] Statement The statement current selected.
@param[in] Selected Whether or not a tag be selected. TRUE means Enter has hit this question.
**/
VOID
EFIAPI
RefreshKeyHelp (
IN FORM_DISPLAY_ENGINE_FORM *FormData,
IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
IN BOOLEAN Selected
);
/**
Update status bar.
This function updates the status bar on the bottom of menu screen. It just shows StatusBar.
Original logic in this function should be splitted out.
@param[in] MessageType The type of message to be shown. InputError or Configuration Changed.
@param[in] State Show or Clear Message.
**/
VOID
EFIAPI
UpdateStatusBar (
IN UINTN MessageType,
IN BOOLEAN State
);
/**
Create popup window.
This function draws OEM/Vendor specific pop up windows.
@param[out] Key User Input Key
@param ... String to be shown in Popup. The variable argument list is terminated by a NULL.
**/
VOID
EFIAPI
CreateDialog (
OUT EFI_INPUT_KEY *Key, OPTIONAL
...
);
/**
Confirm how to handle the changed data.
@return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values.
**/
UINTN
EFIAPI
ConfirmDataChange (
VOID
);
/**
OEM specifies whether Setup exits Page by ESC key.
This function customized the behavior that whether Setup exits Page so that
system able to boot when configuration is not changed.
@retval TRUE Exits FrontPage
@retval FALSE Don't exit FrontPage.
**/
BOOLEAN
EFIAPI
FormExitPolicy (
VOID
);
/**
Set Timeout value for a ceratain Form to get user response.
This function allows to set timeout value on a ceratain form if necessary.
If timeout is not zero, the form will exit if user has no response in timeout.
@param[in] FormData Form Data to be shown in Page
@return 0 No timeout for this form.
@return > 0 Timeout value in 100 ns units.
**/
UINT64
EFIAPI
FormExitTimeout (
IN FORM_DISPLAY_ENGINE_FORM *FormData
);
//
// Print Functions
//
/**
Prints a unicode string to the default console, at
the supplied cursor position, using L"%s" format.
@param Column The cursor position to print the string at. When it is -1, use current Position.
@param Row The cursor position to print the string at. When it is -1, use current Position.
@param String String pointer.
@return Length of string printed to the console
**/
UINTN
EFIAPI
PrintStringAt (
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *String
);
/**
Prints a unicode string with the specified width to the default console, at
the supplied cursor position, using L"%s" format.
@param Column The cursor position to print the string at. When it is -1, use current Position.
@param Row The cursor position to print the string at. When it is -1, use current Position.
@param String String pointer.
@param Width Width for String to be printed. If the print length of String < Width,
Space char (L' ') will be used to append String.
@return Length of string printed to the console
**/
UINTN
EFIAPI
PrintStringAtWithWidth (
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *String,
IN UINTN Width
);
/**
Prints a chracter to the default console, at
the supplied cursor position, using L"%c" format.
@param Column The cursor position to print the string at. When it is -1, use current Position.
@param Row The cursor position to print the string at. When it is -1, use current Position.
@param Character Character to print.
@return Length of string printed to the console.
**/
UINTN
EFIAPI
PrintCharAt (
IN UINTN Column,
IN UINTN Row,
CHAR16 Character
);
/**
Clear retangle with specified text attribute.
@param LeftColumn Left column of retangle.
@param RightColumn Right column of retangle.
@param TopRow Start row of retangle.
@param BottomRow End row of retangle.
@param TextAttribute The character foreground and background.
**/
VOID
EFIAPI
ClearLines (
IN UINTN LeftColumn,
IN UINTN RightColumn,
IN UINTN TopRow,
IN UINTN BottomRow,
IN UINTN TextAttribute
);
//
// Color Setting Functions
//
/**
Get OEM/Vendor specific popup attribute colors.
@retval Byte code color setting for popup color.
**/
UINT8
EFIAPI
GetPopupColor (
VOID
);
/**
Get OEM/Vendor specific popup attribute colors.
@retval Byte code color setting for popup inverse color.
**/
UINT8
EFIAPI
GetPopupInverseColor (
VOID
);
/**
Get OEM/Vendor specific PickList color attribute.
@retval Byte code color setting for pick list color.
**/
UINT8
EFIAPI
GetPickListColor (
VOID
);
/**
Get OEM/Vendor specific arrow color attribute.
@retval Byte code color setting for arrow color.
**/
UINT8
EFIAPI
GetArrowColor (
VOID
);
/**
Get OEM/Vendor specific info text color attribute.
@retval Byte code color setting for info text color.
**/
UINT8
EFIAPI
GetInfoTextColor (
VOID
);
/**
Get OEM/Vendor specific help text color attribute.
@retval Byte code color setting for help text color.
**/
UINT8
EFIAPI
GetHelpTextColor (
VOID
);
/**
Get OEM/Vendor specific grayed out text color attribute.
@retval Byte code color setting for grayed out text color.
**/
UINT8
EFIAPI
GetGrayedTextColor (
VOID
);
/**
Get OEM/Vendor specific highlighted text color attribute.
@retval Byte code color setting for highlight text color.
**/
UINT8
EFIAPI
GetHighlightTextColor (
VOID
);
/**
Get OEM/Vendor specific field text color attribute.
@retval Byte code color setting for field text color.
**/
UINT8
EFIAPI
GetFieldTextColor (
VOID
);
/**
Get OEM/Vendor specific subtitle text color attribute.
@retval Byte code color setting for subtitle text color.
**/
UINT8
EFIAPI
GetSubTitleTextColor (
VOID
);
#endif

View File

@@ -0,0 +1,350 @@
/** @file
FormDiplay protocol to show Form
Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that 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 __DISPLAY_PROTOCOL_H__
#define __DISPLAY_PROTOCOL_H__
#include <Protocol/FormBrowser2.h>
#define EDKII_FORM_DISPLAY_ENGINE_PROTOCOL_GUID \
{ 0x9bbe29e9, 0xfda1, 0x41ec, { 0xad, 0x52, 0x45, 0x22, 0x13, 0x74, 0x2d, 0x2e } }
//
// Do nothing.
//
#define BROWSER_ACTION_NONE BIT16
//
// ESC Exit
//
#define BROWSER_ACTION_FORM_EXIT BIT17
#define BROWSER_SUCCESS 0x0
#define BROWSER_ERROR BIT31
#define BROWSER_SUBMIT_FAIL BROWSER_ERROR | 0x01
#define BROWSER_NO_SUBMIT_IF BROWSER_ERROR | 0x02
#define BROWSER_FORM_NOT_FOUND BROWSER_ERROR | 0x03
#define BROWSER_FORM_SUPPRESS BROWSER_ERROR | 0x04
#define BROWSER_PROTOCOL_NOT_FOUND BROWSER_ERROR | 0x05
#define FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1 0x10000
#define FORM_DISPLAY_ENGINE_VERSION_1 0x10000
typedef struct {
//
// HII Data Type
//
UINT8 Type;
//
// Buffer Data and Length if Type is EFI_IFR_TYPE_BUFFER or EFI_IFR_TYPE_STRING
//
UINT8 *Buffer;
UINT16 BufferLen;
EFI_IFR_TYPE_VALUE Value;
} EFI_HII_VALUE;
#define DISPLAY_QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
typedef struct {
UINTN Signature;
LIST_ENTRY Link;
//
// OneOfOption Data
//
EFI_IFR_ONE_OF_OPTION *OptionOpCode;
//
// Option ImageId and AnimationId
//
EFI_IMAGE_ID ImageId;
EFI_ANIMATION_ID AnimationId;
} DISPLAY_QUESTION_OPTION;
#define DISPLAY_QUESTION_OPTION_FROM_LINK(a) CR (a, DISPLAY_QUESTION_OPTION, Link, DISPLAY_QUESTION_OPTION_SIGNATURE)
typedef struct _FORM_DISPLAY_ENGINE_STATEMENT FORM_DISPLAY_ENGINE_STATEMENT;
typedef struct _FORM_DISPLAY_ENGINE_FORM FORM_DISPLAY_ENGINE_FORM;
#define STATEMENT_VALID 0x0
#define STATEMENT_INVALID BIT31
#define INCOSISTENT_IF_TRUE STATEMENT_INVALID | 0x01
#define WARNING_IF_TRUE STATEMENT_INVALID | 0x02
#define STRING_TOO_LONG STATEMENT_INVALID | 0x03
// ... to be extended.
typedef struct {
//
// StringId for INCONSITENT_IF or WARNING_IF
//
EFI_STRING_ID StringId;
//
// TimeOut for WARNING_IF
//
UINT8 TimeOut;
} STATEMENT_ERROR_INFO;
/**
Perform value check for a question.
@param Form Form where Statement is in.
@param Statement Value will check for it.
@param Value New value will be checked.
@retval Status Value Status
**/
typedef
UINT32
(EFIAPI *VALIDATE_QUESTION) (
IN FORM_DISPLAY_ENGINE_FORM *Form,
IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
IN EFI_HII_VALUE *Value,
OUT STATEMENT_ERROR_INFO *ErrorInfo
);
/**
Perform Password check.
Passwork may be encrypted by driver that requires the specific check.
@param Form Form where Password Statement is in.
@param Statement Password statement
@param PasswordString Password string to be checked. It may be NULL.
NULL means to restore password.
"" string can be used to checked whether old password does exist.
@return Status Status of Password check.
**/
typedef
EFI_STATUS
(EFIAPI *PASSWORD_CHECK) (
IN FORM_DISPLAY_ENGINE_FORM *Form,
IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
IN EFI_STRING PasswordString OPTIONAL
);
#define FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
//
// Attribute for Statement and Form
//
#define HII_DISPLAY_GRAYOUT BIT0
#define HII_DISPLAY_LOCK BIT1
#define HII_DISPLAY_READONLY BIT2
#define HII_DISPLAY_MODAL BIT3
struct _FORM_DISPLAY_ENGINE_STATEMENT{
UINTN Signature;
//
// Version for future structure extension
//
UINTN Version;
//
// link to all the statement which will show in the display form.
//
LIST_ENTRY DisplayLink;
//
// Pointer to statement opcode.
// for Guided Opcode. All buffers will be here if GUIDED opcode scope is set.
//
EFI_IFR_OP_HEADER *OpCode;
//
// Question CurrentValue
//
EFI_HII_VALUE CurrentValue;
//
// Flag to describe whether setting is changed or not.
// Displayer may depend on it to show it with the different color.
//
BOOLEAN SettingChangedFlag;
//
// nested Statement list inside of EFI_IFR_SUBTITLE
//
LIST_ENTRY NestStatementList;
//
// nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
//
LIST_ENTRY OptionListHead;
//
// Statement attributes: GRAYOUT, LOCK and READONLY
//
UINT32 Attribute;
//
// ValidateQuestion to do InconsistIf check
// It may be NULL if any value is valid.
//
VALIDATE_QUESTION ValidateQuestion;
//
// Password additional check. It may be NULL when the additional check is not required.
//
PASSWORD_CHECK PasswordCheck;
//
// Statement ImageId and AnimationId
//
EFI_IMAGE_ID ImageId;
EFI_ANIMATION_ID AnimationId;
};
#define FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK(a) CR (a, FORM_DISPLAY_ENGINE_STATEMENT, DisplayLink, FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE)
#define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')
typedef struct {
UINTN Signature;
LIST_ENTRY Link;
EFI_INPUT_KEY *KeyData;
//
// Action is Discard, Default, Submit, Reset and Exit.
//
UINT32 Action;
UINT16 DefaultId;
//
// HotKey Help String
//
EFI_STRING HelpString;
} BROWSER_HOT_KEY;
#define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)
#define FORM_DISPLAY_ENGINE_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
struct _FORM_DISPLAY_ENGINE_FORM {
UINTN Signature;
//
// Version for future structure extension
//
UINTN Version;
//
// Statement List inside of Form
//
LIST_ENTRY StatementListHead;
//
// Statement List outside of Form
//
LIST_ENTRY StatementListOSF;
//
// The input screen dimenstions info.
//
EFI_SCREEN_DESCRIPTOR *ScreenDimensions;
//
// FormSet information
//
EFI_GUID FormSetGuid;
//
// HiiHandle can be used to get String, Image or Animation
//
EFI_HII_HANDLE HiiHandle;
//
// Form ID and Title.
//
UINT16 FormId;
EFI_STRING_ID FormTitle;
//
// Form Attributes: Lock, Modal.
//
UINT32 Attribute;
//
// Flag to describe whether setting is changed or not.
// Displayer depends on it to show ChangedFlag.
//
BOOLEAN SettingChangedFlag;
//
// Statement to be HighLighted
//
FORM_DISPLAY_ENGINE_STATEMENT *HighLightedStatement;
//
// Event to notify Displayer that FormData is updated to be refreshed.
//
EFI_EVENT FormRefreshEvent;
//
// Additional Hotkey registered by BrowserEx protocol.
//
LIST_ENTRY HotKeyListHead;
//
// Form ImageId and AnimationId
//
EFI_IMAGE_ID ImageId;
EFI_ANIMATION_ID AnimationId;
//
// If Status is error, display needs to handle it.
//
UINT32 BrowserStatus;
//
// String for error status. It may be NULL.
//
EFI_STRING ErrorString;
};
#define FORM_DISPLAY_ENGINE_FORM_FROM_LINK(a) CR (a, FORM_DISPLAY_ENGINE_FORM, Link, FORM_DISPLAY_ENGINE_FORM_SIGNATURE)
typedef struct {
FORM_DISPLAY_ENGINE_STATEMENT *SelectedStatement; // Selected Statement and InputValue
EFI_HII_VALUE InputValue;
UINT32 Action; // If SelectedStatement is NULL, Action will be used.
// Trig Action (Discard, Default, Submit, Reset and Exit)
UINT16 DefaultId;
} USER_INPUT;
/**
Display one form, and return user input.
@param FormData Form Data to be shown.
@param UserInputData User input data.
@retval EFI_SUCCESS Form Data is shown, and user input is got.
**/
typedef
EFI_STATUS
(EFIAPI *FORM_DISPLAY) (
IN FORM_DISPLAY_ENGINE_FORM *FormData,
OUT USER_INPUT *UserInputData
);
/**
Exit Display and Clear Screen to the original state.
**/
typedef
VOID
(EFIAPI *EXIT_DISPLAY) (
VOID
);
/**
Confirm how to handle the changed data.
@return Action of Submit, Discard and None
**/
typedef
UINTN
(EFIAPI *CONFIRM_DATA_CHANGE) (
VOID
);
typedef struct {
FORM_DISPLAY FormDisplay;
EXIT_DISPLAY ExitDisplay;
CONFIRM_DATA_CHANGE ConfirmDataChange;
} EDKII_FORM_DISPLAY_ENGINE_PROTOCOL;
extern EFI_GUID gEdkiiFormDisplayEngineProtocolGuid;
#endif

View File

@@ -0,0 +1,90 @@
/** @file
Extension Form Browser Protocol provides the services that can be used to
register the different hot keys for the standard Browser actions described in UEFI specification.
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __FORM_BROWSER_EXTENSION2_H__
#define __FORM_BROWSER_EXTENSION2_H__
#include <Protocol/FormBrowserEx.h>
#define EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL_GUID \
{ 0xa770c357, 0xb693, 0x4e6d, { 0xa6, 0xcf, 0xd2, 0x1c, 0x72, 0x8e, 0x55, 0xb }}
typedef struct _EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL;
#define BROWSER_EXTENSION2_VERSION_1 0x10000
/**
Check whether the browser data has been modified.
@retval TRUE Browser data is modified.
@retval FALSE No browser data is modified.
**/
typedef
BOOLEAN
(EFIAPI *IS_BROWSER_DATA_MODIFIED) (
VOID
);
/**
Execute the action requested by the Action parameter.
@param[in] Action Execute the request action.
@param[in] DefaultId The default Id info when need to load default value.
@retval EFI_SUCCESS Execute the request action succss.
**/
typedef
EFI_STATUS
(EFIAPI *EXECUTE_ACTION) (
IN UINT32 Action,
IN UINT16 DefaultId
);
#define FORM_ENTRY_INFO_SIGNATURE SIGNATURE_32 ('f', 'e', 'i', 's')
typedef struct {
UINTN Signature;
LIST_ENTRY Link;
EFI_HII_HANDLE HiiHandle;
EFI_GUID FormSetGuid;
UINT16 FormId;
UINT16 QuestionId;
} FORM_ENTRY_INFO;
#define FORM_ENTRY_INFO_FROM_LINK(a) CR (a, FORM_ENTRY_INFO, Link, FORM_ENTRY_INFO_SIGNATURE)
struct _EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL {
///
/// Version for protocol future extension.
///
UINT32 Version;
SET_SCOPE SetScope;
REGISTER_HOT_KEY RegisterHotKey;
REGISTER_EXIT_HANDLER RegiserExitHandler;
IS_BROWSER_DATA_MODIFIED IsBrowserDataModified;
EXECUTE_ACTION ExecuteAction;
///
/// A list of type FORMID_INFO is Browser View Form History List.
///
LIST_ENTRY FormViewHistoryHead;
};
extern EFI_GUID gEdkiiFormBrowserEx2ProtocolGuid;
#endif