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

View File

@ -0,0 +1,44 @@
/** @file
MACRO definitions for color used in Setup Browser.
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
//
// Unicode collation protocol in
#ifndef _COLORS_H_
#define _COLORS_H_
//
// Screen Color Settings
//
#define PICKLIST_HIGHLIGHT_TEXT EFI_WHITE
#define PICKLIST_HIGHLIGHT_BACKGROUND EFI_BACKGROUND_CYAN
#define TITLE_TEXT EFI_WHITE
#define TITLE_BACKGROUND EFI_BACKGROUND_BLUE
#define KEYHELP_TEXT EFI_LIGHTGRAY
#define KEYHELP_BACKGROUND EFI_BACKGROUND_BLACK
#define SUBTITLE_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
#define BANNER_TEXT EFI_BLUE
#define BANNER_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
#define FIELD_TEXT_GRAYED EFI_DARKGRAY
#define FIELD_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
#define POPUP_TEXT EFI_LIGHTGRAY
#define POPUP_BACKGROUND EFI_BACKGROUND_BLUE
#define POPUP_INVERSE_TEXT EFI_LIGHTGRAY
#define POPUP_INVERSE_BACKGROUND EFI_BACKGROUND_BLACK
#define HELP_TEXT EFI_BLUE
#define ERROR_TEXT EFI_RED | EFI_BRIGHT
#define INFO_TEXT EFI_YELLOW | EFI_BRIGHT
#define ARROW_TEXT EFI_RED | EFI_BRIGHT
#define ARROW_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
#endif

View File

@ -0,0 +1,936 @@
/** @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.
**/
#include "CustomizedDisplayLibInternal.h"
EFI_GUID gCustomizedDisplayLibGuid = { 0x99fdc8fd, 0x849b, 0x4eba, { 0xad, 0x13, 0xfb, 0x96, 0x99, 0xc9, 0xa, 0x4d } };
EFI_HII_HANDLE mCDLStringPackHandle;
UINT16 gClassOfVfr; // Formset class information
UINT16 gLastClassOfVfr = 0;
BANNER_DATA *gBannerData;
UINTN gFooterHeight;
/**
+------------------------------------------------------------------------------+
| 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
)
{
EFI_STATUS Status;
ASSERT (FormData != NULL && ScreenForStatement != NULL);
if (FormData == NULL || ScreenForStatement == NULL) {
return EFI_INVALID_PARAMETER;
}
Status = ScreenDiemensionInfoValidate (FormData);
if (EFI_ERROR (Status)) {
return Status;
}
gClassOfVfr = FORMSET_CLASS_PLATFORM_SETUP;
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
gClassOfVfr = FORMSET_CLASS_MODEL_PAGE;
}
ProcessExternedOpcode(FormData);
//
// Calculate the ScreenForStatement.
//
ScreenForStatement->BottomRow = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight;
if ((gClassOfVfr & FORMSET_CLASS_FRONT_PAGE) == FORMSET_CLASS_FRONT_PAGE) {
ScreenForStatement->TopRow = gScreenDimensions.TopRow + FRONT_PAGE_HEADER_HEIGHT;
} else {
ScreenForStatement->TopRow = gScreenDimensions.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT;
}
ScreenForStatement->LeftColumn = gScreenDimensions.LeftColumn;
ScreenForStatement->RightColumn = gScreenDimensions.RightColumn;
//
// If Last Vfr Class is same to current Vfr Class,
// they will have the same page frame. So, Page Frame is not required to be repainted.
//
if (gLastClassOfVfr == gClassOfVfr) {
UpdateStatusBar(NV_UPDATE_REQUIRED, FormData->SettingChangedFlag);
PrintFormTitle(FormData);
return EFI_SUCCESS;
}
//
// Record last ClassOfVfr and Streen Information.
//
gLastClassOfVfr = gClassOfVfr;
//
// Ensure we are in Text mode
//
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
ClearLines (0, gScreenDimensions.RightColumn, 0, gScreenDimensions.BottomRow, KEYHELP_BACKGROUND);
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
return EFI_SUCCESS;
}
if ((gClassOfVfr & FORMSET_CLASS_FRONT_PAGE) == FORMSET_CLASS_FRONT_PAGE) {
PrintBannerInfo (FormData);
}
PrintFramework ();
UpdateStatusBar(NV_UPDATE_REQUIRED, FormData->SettingChangedFlag);
PrintFormTitle(FormData);
return EFI_SUCCESS;
}
/**
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
)
{
UINTN SecCol;
UINTN ThdCol;
UINTN LeftColumnOfHelp;
UINTN RightColumnOfHelp;
UINTN TopRowOfHelp;
UINTN BottomRowOfHelp;
UINTN StartColumnOfHelp;
EFI_IFR_NUMERIC *NumericOp;
EFI_IFR_DATE *DateOp;
EFI_IFR_TIME *TimeOp;
BOOLEAN HexDisplay;
ASSERT (FormData != NULL);
if (FormData == NULL) {
return;
}
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
return;
}
SecCol = gScreenDimensions.LeftColumn + (gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn) / 3;
ThdCol = gScreenDimensions.LeftColumn + (gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn) / 3 * 2;
StartColumnOfHelp = gScreenDimensions.LeftColumn + 2;
LeftColumnOfHelp = gScreenDimensions.LeftColumn + 1;
RightColumnOfHelp = gScreenDimensions.RightColumn - 2;
TopRowOfHelp = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight + 1;
BottomRowOfHelp = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 2;
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
if (Statement == NULL) {
//
// Print Key for Form without showable statement.
//
PrintHotKeyHelpString (FormData);
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
return;
}
HexDisplay = FALSE;
NumericOp = NULL;
DateOp = NULL;
TimeOp = NULL;
if (Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP) {
NumericOp = (EFI_IFR_NUMERIC *) Statement->OpCode;
HexDisplay = (NumericOp->Flags & EFI_IFR_DISPLAY_UINT_HEX) == EFI_IFR_DISPLAY_UINT_HEX;
} else if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP) {
DateOp = (EFI_IFR_DATE *) Statement->OpCode;
HexDisplay = (DateOp->Flags & EFI_IFR_DISPLAY_UINT_HEX) == EFI_IFR_DISPLAY_UINT_HEX;
} else if (Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
TimeOp = (EFI_IFR_TIME *) Statement->OpCode;
HexDisplay = (TimeOp->Flags & EFI_IFR_DISPLAY_UINT_HEX) == EFI_IFR_DISPLAY_UINT_HEX;
}
switch (Statement->OpCode->OpCode) {
case EFI_IFR_ORDERED_LIST_OP:
case EFI_IFR_ONE_OF_OP:
case EFI_IFR_NUMERIC_OP:
case EFI_IFR_TIME_OP:
case EFI_IFR_DATE_OP:
if (!Selected) {
PrintHotKeyHelpString (FormData);
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
}
if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) ||
(Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) {
PrintAt (
0,
StartColumnOfHelp,
BottomRowOfHelp,
L"%c%c%c%c%s",
ARROW_UP,
ARROW_DOWN,
ARROW_RIGHT,
ARROW_LEFT,
gMoveHighlight
);
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber);
} else {
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
if (Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP && NumericOp != NULL && LibGetFieldFromNum(Statement->OpCode) != 0) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber);
}
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
}
} else {
PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString);
//
// If it is a selected numeric with manual input, display different message
//
if ((Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP) ||
(Statement->OpCode->OpCode == EFI_IFR_DATE_OP) ||
(Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) {
PrintStringAt (
SecCol,
TopRowOfHelp,
HexDisplay ? gHexNumericInput : gDecNumericInput
);
} else if (Statement->OpCode->OpCode != EFI_IFR_ORDERED_LIST_OP) {
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
}
if (Statement->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gPlusString);
PrintStringAt (ThdCol, TopRowOfHelp, gMinusString);
}
PrintStringAt (ThdCol, BottomRowOfHelp, gEnterEscapeString);
}
break;
case EFI_IFR_CHECKBOX_OP:
PrintHotKeyHelpString (FormData);
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
}
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
PrintStringAt (SecCol, BottomRowOfHelp, gToggleCheckBox);
break;
case EFI_IFR_REF_OP:
case EFI_IFR_PASSWORD_OP:
case EFI_IFR_STRING_OP:
case EFI_IFR_TEXT_OP:
case EFI_IFR_ACTION_OP:
case EFI_IFR_RESET_BUTTON_OP:
case EFI_IFR_SUBTITLE_OP:
if (!Selected) {
PrintHotKeyHelpString (FormData);
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
}
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
if (Statement->OpCode->OpCode != EFI_IFR_TEXT_OP && Statement->OpCode->OpCode != EFI_IFR_SUBTITLE_OP) {
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
}
} else {
if (Statement->OpCode->OpCode != EFI_IFR_REF_OP) {
PrintStringAt (
(gScreenDimensions.RightColumn - LibGetStringWidth (gEnterCommitString) / 2) / 2,
BottomRowOfHelp,
gEnterCommitString
);
PrintStringAt (ThdCol, BottomRowOfHelp, gEnterEscapeString);
}
}
break;
default:
break;
}
}
/**
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
)
{
UINTN Index;
CHAR16 OptionWidth;
OptionWidth = (CHAR16) ((gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn) / 3);
switch (MessageType) {
case INPUT_ERROR:
if (State) {
gST->ConOut->SetAttribute (gST->ConOut, ERROR_TEXT);
PrintStringAt (
gScreenDimensions.LeftColumn + OptionWidth,
gScreenDimensions.BottomRow - 1,
gInputErrorMessage
);
} else {
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_BACKGROUND);
for (Index = 0; Index < (LibGetStringWidth (gInputErrorMessage) - 2) / 2; Index++) {
PrintStringAt (gScreenDimensions.LeftColumn + OptionWidth + Index, gScreenDimensions.BottomRow - 1, L" ");
}
}
break;
case NV_UPDATE_REQUIRED:
//
// Global setting support. Show configuration change on every form.
//
if (State) {
gST->ConOut->SetAttribute (gST->ConOut, INFO_TEXT);
PrintStringAt (
gScreenDimensions.LeftColumn + OptionWidth * 2,
gScreenDimensions.BottomRow - 1,
gNvUpdateMessage
);
} else {
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_BACKGROUND);
for (Index = 0; Index < (LibGetStringWidth (gNvUpdateMessage) - 2) / 2; Index++) {
PrintStringAt (
(gScreenDimensions.LeftColumn + OptionWidth * 2 + Index),
gScreenDimensions.BottomRow - 1,
L" "
);
}
}
break;
default:
break;
}
}
/**
Create popup window. It will replace CreateDialog().
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
...
)
{
VA_LIST Marker;
EFI_INPUT_KEY KeyValue;
EFI_STATUS Status;
UINTN LargestString;
UINTN LineNum;
UINTN Index;
UINTN Count;
CHAR16 Character;
UINTN Start;
UINTN End;
UINTN Top;
UINTN Bottom;
CHAR16 *String;
UINTN DimensionsWidth;
UINTN DimensionsHeight;
UINTN CurrentAttribute;
//
// If screen dimension info is not ready, get it from console.
//
if (gScreenDimensions.RightColumn == 0 || gScreenDimensions.BottomRow == 0) {
ZeroMem (&gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
gST->ConOut->QueryMode (
gST->ConOut,
gST->ConOut->Mode->Mode,
&gScreenDimensions.RightColumn,
&gScreenDimensions.BottomRow
);
}
DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn;
DimensionsHeight = gScreenDimensions.BottomRow - gScreenDimensions.TopRow;
LargestString = 0;
LineNum = 0;
VA_START (Marker, Key);
while ((String = VA_ARG (Marker, CHAR16 *)) != NULL) {
LineNum ++;
if ((LibGetStringWidth (String) / 2) > LargestString) {
LargestString = (LibGetStringWidth (String) / 2);
}
}
VA_END (Marker);
if ((LargestString + 2) > DimensionsWidth) {
LargestString = DimensionsWidth - 2;
}
CurrentAttribute = gST->ConOut->Mode->Attribute;
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
//
// Subtract the PopUp width from total Columns, allow for one space extra on
// each end plus a border.
//
Start = (DimensionsWidth - LargestString - 2) / 2 + gScreenDimensions.LeftColumn + 1;
End = Start + LargestString + 1;
Top = ((DimensionsHeight - LineNum - 2) / 2) + gScreenDimensions.TopRow - 1;
Bottom = Top + LineNum + 2;
Character = BOXDRAW_DOWN_RIGHT;
PrintCharAt (Start, Top, Character);
Character = BOXDRAW_HORIZONTAL;
for (Index = Start; Index + 2 < End; Index++) {
PrintCharAt ((UINTN)-1, (UINTN)-1, Character);
}
Character = BOXDRAW_DOWN_LEFT;
PrintCharAt ((UINTN)-1, (UINTN)-1, Character);
Character = BOXDRAW_VERTICAL;
Count = 0;
VA_START (Marker, Key);
for (Index = Top; Index + 2 < Bottom; Index++, Count++) {
String = VA_ARG (Marker, CHAR16*);
if (String[0] == CHAR_NULL) {
//
// Passing in a NULL results in a blank space
//
ClearLines (Start, End, Index + 1, Index + 1, GetPopupColor ());
} else if (String[0] == L' ') {
//
// Passing in a space results in the assumption that this is where typing will occur
//
ClearLines (Start + 1, End - 1, Index + 1, Index + 1, POPUP_INVERSE_TEXT | POPUP_INVERSE_BACKGROUND);
PrintStringAt (
((DimensionsWidth - LibGetStringWidth (String) / 2) / 2) + gScreenDimensions.LeftColumn + 1,
Index + 1,
String + 1
);
} else {
//
// This will clear the background of the line - we never know who might have been
// here before us. This differs from the next clear in that it used the non-reverse
// video for normal printing.
//
ClearLines (Start, End, Index + 1, Index + 1, GetPopupColor ());
PrintStringAt (
((DimensionsWidth - LibGetStringWidth (String) / 2) / 2) + gScreenDimensions.LeftColumn + 1,
Index + 1,
String
);
}
gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
PrintCharAt (Start, Index + 1, Character);
PrintCharAt (End - 1, Index + 1, Character);
}
VA_END (Marker);
Character = BOXDRAW_UP_RIGHT;
PrintCharAt (Start, Bottom - 1, Character);
Character = BOXDRAW_HORIZONTAL;
for (Index = Start; Index + 2 < End; Index++) {
PrintCharAt ((UINTN)-1, (UINTN) -1, Character);
}
Character = BOXDRAW_UP_LEFT;
PrintCharAt ((UINTN)-1, (UINTN) -1, Character);
if (Key != NULL) {
Status = WaitForKeyStroke (&KeyValue);
ASSERT_EFI_ERROR (Status);
CopyMem (Key, &KeyValue, sizeof (EFI_INPUT_KEY));
}
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
}
/**
Confirm how to handle the changed data.
@return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values.
**/
UINTN
EFIAPI
ConfirmDataChange (
VOID
)
{
CHAR16 YesResponse;
CHAR16 NoResponse;
EFI_INPUT_KEY Key;
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
YesResponse = gYesResponse[0];
NoResponse = gNoResponse[0];
//
// If NV flag is up, prompt user
//
do {
CreateDialog (&Key, gLibEmptyString, gSaveChanges, gAreYouSure, gLibEmptyString, NULL);
} while
(
(Key.ScanCode != SCAN_ESC) &&
((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (NoResponse | UPPER_LOWER_CASE_OFFSET)) &&
((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (YesResponse | UPPER_LOWER_CASE_OFFSET))
);
if (Key.ScanCode == SCAN_ESC) {
return BROWSER_ACTION_NONE;
} else if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (YesResponse | UPPER_LOWER_CASE_OFFSET)) {
return BROWSER_ACTION_SUBMIT;
} else {
return BROWSER_ACTION_DISCARD;
}
}
/**
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
)
{
return (gClassOfVfr & FORMSET_CLASS_FRONT_PAGE) == FORMSET_CLASS_FRONT_PAGE ? FALSE : TRUE;
}
/**
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
)
{
return 0;
}
//
// 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
)
{
return PrintAt (0, Column, Row, L"%s", String);
}
/**
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.
@param Width Width for String.
@return Length of string printed to the console
**/
UINTN
EFIAPI
PrintStringAtWithWidth (
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *String,
IN UINTN Width
)
{
return PrintAt (Width, Column, Row, L"%s", String);
}
/**
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
)
{
return PrintAt (0, Column, Row, L"%c", 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
)
{
CHAR16 *Buffer;
UINTN Row;
//
// For now, allocate an arbitrarily long buffer
//
Buffer = AllocateZeroPool (0x10000);
ASSERT (Buffer != NULL);
//
// Set foreground and background as defined
//
gST->ConOut->SetAttribute (gST->ConOut, TextAttribute);
//
// Much faster to buffer the long string instead of print it a character at a time
//
LibSetUnicodeMem (Buffer, RightColumn - LeftColumn, L' ');
//
// Clear the desired area with the appropriate foreground/background
//
for (Row = TopRow; Row <= BottomRow; Row++) {
PrintStringAt (LeftColumn, Row, Buffer);
}
gST->ConOut->SetCursorPosition (gST->ConOut, LeftColumn, TopRow);
FreePool (Buffer);
}
//
// Color Setting Functions
//
/**
Get OEM/Vendor specific popup attribute colors.
@retval Byte code color setting for popup color.
**/
UINT8
EFIAPI
GetPopupColor (
VOID
)
{
return POPUP_TEXT | POPUP_BACKGROUND;
}
/**
Get OEM/Vendor specific popup attribute colors.
@retval Byte code color setting for popup inverse color.
**/
UINT8
EFIAPI
GetPopupInverseColor (
VOID
)
{
return POPUP_INVERSE_TEXT | POPUP_INVERSE_BACKGROUND;
}
/**
Get OEM/Vendor specific PickList color attribute.
@retval Byte code color setting for pick list color.
**/
UINT8
EFIAPI
GetPickListColor (
VOID
)
{
return PICKLIST_HIGHLIGHT_TEXT | PICKLIST_HIGHLIGHT_BACKGROUND;
}
/**
Get OEM/Vendor specific arrow color attribute.
@retval Byte code color setting for arrow color.
**/
UINT8
EFIAPI
GetArrowColor (
VOID
)
{
return ARROW_TEXT | ARROW_BACKGROUND;
}
/**
Get OEM/Vendor specific info text color attribute.
@retval Byte code color setting for info text color.
**/
UINT8
EFIAPI
GetInfoTextColor (
VOID
)
{
return INFO_TEXT | FIELD_BACKGROUND;
}
/**
Get OEM/Vendor specific help text color attribute.
@retval Byte code color setting for help text color.
**/
UINT8
EFIAPI
GetHelpTextColor (
VOID
)
{
return HELP_TEXT | FIELD_BACKGROUND;
}
/**
Get OEM/Vendor specific grayed out text color attribute.
@retval Byte code color setting for grayed out text color.
**/
UINT8
EFIAPI
GetGrayedTextColor (
VOID
)
{
return FIELD_TEXT_GRAYED | FIELD_BACKGROUND;
}
/**
Get OEM/Vendor specific highlighted text color attribute.
@retval Byte code color setting for highlight text color.
**/
UINT8
EFIAPI
GetHighlightTextColor (
VOID
)
{
return PcdGet8 (PcdBrowserFieldTextHighlightColor) | PcdGet8 (PcdBrowserFieldBackgroundHighlightColor);
}
/**
Get OEM/Vendor specific field text color attribute.
@retval Byte code color setting for field text color.
**/
UINT8
EFIAPI
GetFieldTextColor (
VOID
)
{
return PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND;
}
/**
Get OEM/Vendor specific subtitle text color attribute.
@retval Byte code color setting for subtitle text color.
**/
UINT8
EFIAPI
GetSubTitleTextColor (
VOID
)
{
return PcdGet8 (PcdBrowserSubtitleTextColor) | FIELD_BACKGROUND;
}
/**
Clear Screen to the initial state.
**/
VOID
EFIAPI
ClearDisplayPage (
VOID
)
{
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->ClearScreen (gST->ConOut);
gLastClassOfVfr = 0;
}
/**
Constructor of Customized Display Library Instance.
@param ImageHandle The firmware allocated handle for the EFI image.
@param SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
**/
EFI_STATUS
EFIAPI
CustomizedDisplayLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
mCDLStringPackHandle = HiiAddPackages (&gCustomizedDisplayLibGuid, ImageHandle, CustomizedDisplayLibStrings, NULL);
ASSERT (mCDLStringPackHandle != NULL);
InitializeLibStrings();
return EFI_SUCCESS;
}
/**
Destructor of Customized Display Library Instance.
@param ImageHandle The firmware allocated handle for the EFI image.
@param SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The destructor completed successfully.
@retval Other value The destructor did not complete successfully.
**/
EFI_STATUS
EFIAPI
CustomizedDisplayLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
HiiRemovePackages(mCDLStringPackHandle);
FreeLibStrings ();
return EFI_SUCCESS;
}

View File

@ -0,0 +1,74 @@
##
# This file contains an 'Intel Peripheral Driver' and is
# licensed for Intel CPUs and chipsets under the terms of your
# license agreement with Intel or your vendor. This file may
# be modified by the user, subject to additional terms of the
# license agreement
##
## @file
#
# General BDS defines and produce general interfaces for platform BDS driver including:
# 1) BDS boot policy interface;
# 2) BDS boot device connect interface;
# 3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# This software and associated documentation (if any) is furnished
# under a license and may only be used or copied in accordance
# with the terms of the license. Except as permitted by such
# license, no part of this software or documentation may be
# reproduced, stored in a retrieval system, or transmitted in any
# form or by any means without the express written consent of
# Intel Corporation.
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = CustomizedDisplayLib
FILE_GUID = 80B92017-EC64-4923-938D-94FAEE85832E
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = CustomizedDisplayLib|DXE_DRIVER UEFI_APPLICATION
CONSTRUCTOR = CustomizedDisplayLibConstructor
DESTRUCTOR = CustomizedDisplayLibDestructor
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources]
CustomizedDisplayLib.c
Colors.h
CustomizedDisplayLibInternal.h
CustomizedDisplayLibInternal.c
CustomizedDisplayLib.uni
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
MemoryAllocationLib
BaseLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiRuntimeServicesTableLib
BaseMemoryLib
DebugLib
PrintLib
HiiLib
DevicePathLib
PcdLib
[Guids]
gEfiIfrTianoGuid
[Protocols]
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserSubtitleTextColor ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextColor ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextHighlightColor ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundHighlightColor ## CONSUMES

View File

@ -0,0 +1,937 @@
/** @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.
**/
#include "CustomizedDisplayLibInternal.h"
EFI_SCREEN_DESCRIPTOR gScreenDimensions;
CHAR16 *mLibUnknownString;
extern EFI_HII_HANDLE mCDLStringPackHandle;
CHAR16 *mSpaceBuffer;
#define SPACE_BUFFER_SIZE 1000
//
// Browser Global Strings
//
CHAR16 *gEnterString;
CHAR16 *gEnterCommitString;
CHAR16 *gEnterEscapeString;
CHAR16 *gEscapeString;
CHAR16 *gMoveHighlight;
CHAR16 *gDecNumericInput;
CHAR16 *gHexNumericInput;
CHAR16 *gToggleCheckBox;
CHAR16 *gLibEmptyString;
CHAR16 *gAreYouSure;
CHAR16 *gYesResponse;
CHAR16 *gNoResponse;
CHAR16 *gPlusString;
CHAR16 *gMinusString;
CHAR16 *gAdjustNumber;
CHAR16 *gSaveChanges;
CHAR16 *gNvUpdateMessage;
CHAR16 *gInputErrorMessage;
/**
Print banner info for front page.
@param[in] FormData Form Data to be shown in Page
**/
VOID
PrintBannerInfo (
IN FORM_DISPLAY_ENGINE_FORM *FormData
)
{
UINT8 Line;
UINT8 Alignment;
CHAR16 *StrFrontPageBanner;
UINT8 RowIdx;
UINT8 ColumnIdx;
//
// ClearLines(0, LocalScreen.RightColumn, 0, BANNER_HEIGHT-1, BANNER_TEXT | BANNER_BACKGROUND);
//
ClearLines (
gScreenDimensions.LeftColumn,
gScreenDimensions.RightColumn,
gScreenDimensions.TopRow,
FRONT_PAGE_HEADER_HEIGHT - 1 + gScreenDimensions.TopRow,
BANNER_TEXT | BANNER_BACKGROUND
);
//
// for (Line = 0; Line < BANNER_HEIGHT; Line++) {
//
for (Line = (UINT8) gScreenDimensions.TopRow; Line < BANNER_HEIGHT + (UINT8) gScreenDimensions.TopRow; Line++) {
//
// for (Alignment = 0; Alignment < BANNER_COLUMNS; Alignment++) {
//
for (Alignment = (UINT8) gScreenDimensions.LeftColumn;
Alignment < BANNER_COLUMNS + (UINT8) gScreenDimensions.LeftColumn;
Alignment++
) {
RowIdx = (UINT8) (Line - (UINT8) gScreenDimensions.TopRow);
ColumnIdx = (UINT8) (Alignment - (UINT8) gScreenDimensions.LeftColumn);
ASSERT (RowIdx < BANNER_HEIGHT && ColumnIdx < BANNER_COLUMNS);
if (gBannerData!= NULL && gBannerData->Banner[RowIdx][ColumnIdx] != 0x0000) {
StrFrontPageBanner = LibGetToken (gBannerData->Banner[RowIdx][ColumnIdx], FormData->HiiHandle);
} else {
continue;
}
switch (Alignment - gScreenDimensions.LeftColumn) {
case 0:
//
// Handle left column
//
PrintStringAt (gScreenDimensions.LeftColumn + BANNER_LEFT_COLUMN_INDENT, Line, StrFrontPageBanner);
break;
case 1:
//
// Handle center column
//
PrintStringAt (
gScreenDimensions.LeftColumn + (gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn) / 3,
Line,
StrFrontPageBanner
);
break;
case 2:
//
// Handle right column
//
PrintStringAt (
gScreenDimensions.LeftColumn + (gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn) * 2 / 3,
Line,
StrFrontPageBanner
);
break;
}
FreePool (StrFrontPageBanner);
}
}
}
/**
Print framework for a page.
**/
VOID
PrintFramework (
VOID
)
{
UINTN Index;
CHAR16 Character;
CHAR16 *Buffer;
UINTN Row;
Buffer = AllocateZeroPool (0x10000);
ASSERT (Buffer != NULL);
Character = BOXDRAW_HORIZONTAL;
for (Index = 0; Index + 2 < (gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn); Index++) {
Buffer[Index] = Character;
}
ClearLines (
gScreenDimensions.LeftColumn,
gScreenDimensions.RightColumn,
gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight,
gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 1,
KEYHELP_TEXT | KEYHELP_BACKGROUND
);
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) == FORMSET_CLASS_PLATFORM_SETUP) {
ClearLines (
gScreenDimensions.LeftColumn,
gScreenDimensions.RightColumn,
gScreenDimensions.TopRow,
gScreenDimensions.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 1,
TITLE_TEXT | TITLE_BACKGROUND
);
//
// Print Top border line
// +------------------------------------------------------------------------------+
// ? ?
// +------------------------------------------------------------------------------+
//
Character = BOXDRAW_DOWN_RIGHT;
PrintCharAt ((UINTN) -1, (UINTN) -1, Character);
PrintStringAt ((UINTN) -1, (UINTN) -1, Buffer);
Character = BOXDRAW_DOWN_LEFT;
PrintCharAt ((UINTN) -1, (UINTN) -1, Character);
Character = BOXDRAW_VERTICAL;
for (Row = gScreenDimensions.TopRow + 1; Row <= gScreenDimensions.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 2; Row++) {
PrintCharAt (gScreenDimensions.LeftColumn, Row, Character);
PrintCharAt (gScreenDimensions.RightColumn - 1, Row, Character);
}
Character = BOXDRAW_UP_RIGHT;
PrintCharAt (gScreenDimensions.LeftColumn, gScreenDimensions.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 1, Character);
PrintStringAt ((UINTN) -1, (UINTN) -1, Buffer);
Character = BOXDRAW_UP_LEFT;
PrintCharAt ((UINTN) -1, (UINTN) -1, Character);
//
// Print Bottom border line
// +------------------------------------------------------------------------------+
// ? ?
// +------------------------------------------------------------------------------+
//
Character = BOXDRAW_DOWN_RIGHT;
PrintCharAt (gScreenDimensions.LeftColumn, gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight, Character);
PrintStringAt ((UINTN) -1, (UINTN) -1, Buffer);
Character = BOXDRAW_DOWN_LEFT;
PrintCharAt ((UINTN) -1, (UINTN) -1, Character);
Character = BOXDRAW_VERTICAL;
for (Row = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight + 1;
Row <= gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 2;
Row++
) {
PrintCharAt (gScreenDimensions.LeftColumn, Row, Character);
PrintCharAt (gScreenDimensions.RightColumn - 1, Row, Character);
}
Character = BOXDRAW_UP_RIGHT;
PrintCharAt (gScreenDimensions.LeftColumn, gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 1, Character);
PrintStringAt ((UINTN) -1, (UINTN) -1, Buffer);
Character = BOXDRAW_UP_LEFT;
PrintCharAt ((UINTN) -1, (UINTN) -1, Character);
}
FreePool (Buffer);
}
/**
Print the form title.
@param[in] FormData Form Data to be shown in Page
**/
VOID
PrintFormTitle (
IN FORM_DISPLAY_ENGINE_FORM *FormData
)
{
CHAR16 *TitleStr;
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) != FORMSET_CLASS_PLATFORM_SETUP) {
//
// Only Setup Page need Title.
//
return;
}
TitleStr = LibGetToken (FormData->FormTitle, FormData->HiiHandle);
ASSERT (TitleStr != NULL);
gST->ConOut->SetAttribute (gST->ConOut, TITLE_TEXT | TITLE_BACKGROUND);
ClearLines (
gScreenDimensions.LeftColumn + 1,
gScreenDimensions.RightColumn - 1,
gScreenDimensions.TopRow + 1,
gScreenDimensions.TopRow + 1,
TITLE_TEXT | TITLE_BACKGROUND
);
PrintStringAt (
(gScreenDimensions.RightColumn + gScreenDimensions.LeftColumn - LibGetStringWidth (TitleStr) / 2) / 2,
gScreenDimensions.TopRow + 1,
TitleStr
);
FreePool (TitleStr);
}
/**
Process some op code which is not recognized by browser core.
@param OpCodeData The pointer to the op code buffer.
@return EFI_SUCCESS Pass the statement success.
**/
VOID
ProcessUserOpcode(
IN EFI_IFR_OP_HEADER *OpCodeData
)
{
switch (OpCodeData->OpCode) {
case EFI_IFR_GUID_OP:
if (CompareGuid (&gEfiIfrTianoGuid, (EFI_GUID *)((CHAR8*) OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
//
// Tiano specific GUIDed opcodes
//
switch (((EFI_IFR_GUID_LABEL *) OpCodeData)->ExtendOpCode) {
case EFI_IFR_EXTEND_OP_LABEL:
//
// just ignore label
//
break;
case EFI_IFR_EXTEND_OP_BANNER:
//
// Only in front page form set, we care about the banner data.
//
if ((gClassOfVfr & FORMSET_CLASS_FRONT_PAGE) == FORMSET_CLASS_FRONT_PAGE) {
//
// Initialize Driver private data
//
if (gBannerData == NULL) {
gBannerData = AllocateZeroPool (sizeof (BANNER_DATA));
ASSERT (gBannerData != NULL);
}
CopyMem (
&gBannerData->Banner[((EFI_IFR_GUID_BANNER *) OpCodeData)->LineNumber][
((EFI_IFR_GUID_BANNER *) OpCodeData)->Alignment],
&((EFI_IFR_GUID_BANNER *) OpCodeData)->Title,
sizeof (EFI_STRING_ID)
);
}
break;
case EFI_IFR_EXTEND_OP_SUBCLASS:
if (((EFI_IFR_GUID_SUBCLASS *) OpCodeData)->SubClass == EFI_FRONT_PAGE_SUBCLASS) {
gClassOfVfr = FORMSET_CLASS_FRONT_PAGE;
}
break;
default:
break;
}
}
break;
default:
break;
}
}
/**
Process some op codes which is out side of current form.
@param FormData Pointer to the form data.
@return EFI_SUCCESS Pass the statement success.
**/
VOID
ProcessExternedOpcode (
IN FORM_DISPLAY_ENGINE_FORM *FormData
)
{
LIST_ENTRY *Link;
FORM_DISPLAY_ENGINE_STATEMENT *Statement;
Link = GetFirstNode (&FormData->StatementListOSF);
while (!IsNull (&FormData->StatementListOSF, Link)) {
Statement = FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&FormData->StatementListOSF, Link);
ProcessUserOpcode(Statement->OpCode);
}
Link = GetFirstNode (&FormData->StatementListHead);
while (!IsNull (&FormData->StatementListHead, Link)) {
Statement = FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&FormData->StatementListHead, Link);
ProcessUserOpcode(Statement->OpCode);
}
}
/**
Validate the input screen diemenstion info.
@param FormData The input form data info.
@return EFI_SUCCESS The input screen info is acceptable.
@return EFI_INVALID_PARAMETER The input screen info is not acceptable.
**/
EFI_STATUS
ScreenDiemensionInfoValidate (
IN FORM_DISPLAY_ENGINE_FORM *FormData
)
{
LIST_ENTRY *Link;
UINTN Index;
//
// Calculate total number of Register HotKeys.
//
Index = 0;
if (!IsListEmpty (&FormData->HotKeyListHead)){
Link = GetFirstNode (&FormData->HotKeyListHead);
while (!IsNull (&FormData->HotKeyListHead, Link)) {
Link = GetNextNode (&FormData->HotKeyListHead, Link);
Index ++;
}
}
//
// Show three HotKeys help information on one row.
//
gFooterHeight = FOOTER_HEIGHT + (Index / 3);
ZeroMem (&gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
gST->ConOut->QueryMode (
gST->ConOut,
gST->ConOut->Mode->Mode,
&gScreenDimensions.RightColumn,
&gScreenDimensions.BottomRow
);
//
// Check local dimension vs. global dimension.
//
if (FormData->ScreenDimensions != NULL) {
if ((gScreenDimensions.RightColumn < FormData->ScreenDimensions->RightColumn) ||
(gScreenDimensions.BottomRow < FormData->ScreenDimensions->BottomRow)
) {
return EFI_INVALID_PARAMETER;
} else {
//
// Local dimension validation.
//
if ((FormData->ScreenDimensions->RightColumn > FormData->ScreenDimensions->LeftColumn) &&
(FormData->ScreenDimensions->BottomRow > FormData->ScreenDimensions->TopRow) &&
((FormData->ScreenDimensions->RightColumn - FormData->ScreenDimensions->LeftColumn) > 2) &&
((FormData->ScreenDimensions->BottomRow - FormData->ScreenDimensions->TopRow) > STATUS_BAR_HEIGHT +
FRONT_PAGE_HEADER_HEIGHT + gFooterHeight + 3)) {
CopyMem (&gScreenDimensions, (VOID *) FormData->ScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
} else {
return EFI_INVALID_PARAMETER;
}
}
}
return EFI_SUCCESS;
}
/**
Get the string based on the StringId and HII Package List Handle.
@param Token The String's ID.
@param HiiHandle The package list in the HII database to search for
the specified string.
@return The output string.
**/
CHAR16 *
LibGetToken (
IN EFI_STRING_ID Token,
IN EFI_HII_HANDLE HiiHandle
)
{
EFI_STRING String;
String = HiiGetString (HiiHandle, Token, NULL);
if (String == NULL) {
String = AllocateCopyPool (StrSize (mLibUnknownString), mLibUnknownString);
ASSERT (String != NULL);
}
return (CHAR16 *) String;
}
/**
Count the storage space of a Unicode string.
This function handles the Unicode string with NARROW_CHAR
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
does not count in the resultant output. If a WIDE_CHAR is
hit, then 2 Unicode character will consume an output storage
space with size of CHAR16 till a NARROW_CHAR is hit.
If String is NULL, then ASSERT ().
@param String The input string to be counted.
@return Storage space for the input string.
**/
UINTN
LibGetStringWidth (
IN CHAR16 *String
)
{
UINTN Index;
UINTN Count;
UINTN IncrementValue;
ASSERT (String != NULL);
if (String == NULL) {
return 0;
}
Index = 0;
Count = 0;
IncrementValue = 1;
do {
//
// Advance to the null-terminator or to the first width directive
//
for (;
(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0);
Index++, Count = Count + IncrementValue
)
;
//
// We hit the null-terminator, we now have a count
//
if (String[Index] == 0) {
break;
}
//
// We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
// and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
//
if (String[Index] == NARROW_CHAR) {
//
// Skip to the next character
//
Index++;
IncrementValue = 1;
} else {
//
// Skip to the next character
//
Index++;
IncrementValue = 2;
}
} while (String[Index] != 0);
//
// Increment by one to include the null-terminator in the size
//
Count++;
return Count * sizeof (CHAR16);
}
/**
Show all registered HotKey help strings on bottom Rows.
@param FormData The curent input form data info.
**/
VOID
PrintHotKeyHelpString (
IN FORM_DISPLAY_ENGINE_FORM *FormData
)
{
UINTN CurrentCol;
UINTN CurrentRow;
UINTN BottomRowOfHotKeyHelp;
UINTN ColumnWidth;
UINTN Index;
EFI_SCREEN_DESCRIPTOR LocalScreen;
LIST_ENTRY *Link;
BROWSER_HOT_KEY *HotKey;
if (IsListEmpty (&FormData->HotKeyListHead)) {
return;
}
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
ColumnWidth = (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3;
BottomRowOfHotKeyHelp = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 3;
//
// Calculate total number of Register HotKeys.
//
Index = 0;
Link = GetFirstNode (&FormData->HotKeyListHead);
while (!IsNull (&FormData->HotKeyListHead, Link)) {
HotKey = BROWSER_HOT_KEY_FROM_LINK (Link);
//
// Help string can't exceed ColumnWidth. One Row will show three Help information.
//
if (StrLen (HotKey->HelpString) > ColumnWidth) {
HotKey->HelpString[ColumnWidth] = L'\0';
}
//
// Calculate help information Column and Row.
//
if ((Index % 3) != 2) {
CurrentCol = LocalScreen.LeftColumn + (2 - Index % 3) * ColumnWidth;
} else {
CurrentCol = LocalScreen.LeftColumn + 2;
}
CurrentRow = BottomRowOfHotKeyHelp - Index / 3;
//
// Print HotKey help string on bottom Row.
//
PrintStringAt (CurrentCol, CurrentRow, HotKey->HelpString);
//
// Get Next Hot Key.
//
Link = GetNextNode (&FormData->HotKeyListHead, Link);
Index ++;
}
return;
}
/**
Get step info from numeric opcode.
@param[in] OpCode The input numeric op code.
@return step info for this opcode.
**/
UINT64
LibGetFieldFromNum (
IN EFI_IFR_OP_HEADER *OpCode
)
{
EFI_IFR_NUMERIC *NumericOp;
UINT64 Step;
NumericOp = (EFI_IFR_NUMERIC *) OpCode;
switch (NumericOp->Flags & EFI_IFR_NUMERIC_SIZE) {
case EFI_IFR_NUMERIC_SIZE_1:
Step = NumericOp->data.u8.Step;
break;
case EFI_IFR_NUMERIC_SIZE_2:
Step = NumericOp->data.u16.Step;
break;
case EFI_IFR_NUMERIC_SIZE_4:
Step = NumericOp->data.u32.Step;
break;
case EFI_IFR_NUMERIC_SIZE_8:
Step = NumericOp->data.u64.Step;
break;
default:
Step = 0;
break;
}
return Step;
}
/**
Initialize the HII String Token to the correct values.
**/
VOID
InitializeLibStrings (
VOID
)
{
mLibUnknownString = L"!";
gEnterString = LibGetToken (STRING_TOKEN (ENTER_STRING), mCDLStringPackHandle);
gEnterCommitString = LibGetToken (STRING_TOKEN (ENTER_COMMIT_STRING), mCDLStringPackHandle);
gEnterEscapeString = LibGetToken (STRING_TOKEN (ENTER_ESCAPE_STRING), mCDLStringPackHandle);
gEscapeString = LibGetToken (STRING_TOKEN (ESCAPE_STRING), mCDLStringPackHandle);
gMoveHighlight = LibGetToken (STRING_TOKEN (MOVE_HIGHLIGHT), mCDLStringPackHandle);
gDecNumericInput = LibGetToken (STRING_TOKEN (DEC_NUMERIC_INPUT), mCDLStringPackHandle);
gHexNumericInput = LibGetToken (STRING_TOKEN (HEX_NUMERIC_INPUT), mCDLStringPackHandle);
gToggleCheckBox = LibGetToken (STRING_TOKEN (TOGGLE_CHECK_BOX), mCDLStringPackHandle);
gAreYouSure = LibGetToken (STRING_TOKEN (ARE_YOU_SURE), mCDLStringPackHandle);
gYesResponse = LibGetToken (STRING_TOKEN (ARE_YOU_SURE_YES), mCDLStringPackHandle);
gNoResponse = LibGetToken (STRING_TOKEN (ARE_YOU_SURE_NO), mCDLStringPackHandle);
gPlusString = LibGetToken (STRING_TOKEN (PLUS_STRING), mCDLStringPackHandle);
gMinusString = LibGetToken (STRING_TOKEN (MINUS_STRING), mCDLStringPackHandle);
gAdjustNumber = LibGetToken (STRING_TOKEN (ADJUST_NUMBER), mCDLStringPackHandle);
gSaveChanges = LibGetToken (STRING_TOKEN (SAVE_CHANGES), mCDLStringPackHandle);
gLibEmptyString = LibGetToken (STRING_TOKEN (EMPTY_STRING), mCDLStringPackHandle);
gNvUpdateMessage = LibGetToken (STRING_TOKEN (NV_UPDATE_MESSAGE), mCDLStringPackHandle);
gInputErrorMessage = LibGetToken (STRING_TOKEN (INPUT_ERROR_MESSAGE), mCDLStringPackHandle);
//
// SpaceBuffer;
//
mSpaceBuffer = AllocatePool ((SPACE_BUFFER_SIZE + 1) * sizeof (CHAR16));
ASSERT (mSpaceBuffer != NULL);
LibSetUnicodeMem (mSpaceBuffer, SPACE_BUFFER_SIZE, L' ');
mSpaceBuffer[SPACE_BUFFER_SIZE] = L'\0';
}
/**
Free the HII String.
**/
VOID
FreeLibStrings (
VOID
)
{
FreePool (gEnterString);
FreePool (gEnterCommitString);
FreePool (gEnterEscapeString);
FreePool (gEscapeString);
FreePool (gMoveHighlight);
FreePool (gDecNumericInput);
FreePool (gHexNumericInput);
FreePool (gToggleCheckBox);
FreePool (gAreYouSure);
FreePool (gYesResponse);
FreePool (gNoResponse);
FreePool (gPlusString);
FreePool (gMinusString);
FreePool (gAdjustNumber);
FreePool (gSaveChanges);
FreePool (gLibEmptyString);
FreePool (gNvUpdateMessage);
FreePool (gInputErrorMessage);
FreePool (mSpaceBuffer);
}
/**
Wait for a key to be pressed by user.
@param Key The key which is pressed by user.
@retval EFI_SUCCESS The function always completed successfully.
**/
EFI_STATUS
WaitForKeyStroke (
OUT EFI_INPUT_KEY *Key
)
{
EFI_STATUS Status;
UINTN Index;
while (TRUE) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
if (!EFI_ERROR (Status)) {
break;
}
if (Status != EFI_NOT_READY) {
continue;
}
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &Index);
}
return Status;
}
/**
Set Buffer to Value for Size bytes.
@param Buffer Memory to set.
@param Size Number of bytes to set
@param Value Value of the set operation.
**/
VOID
LibSetUnicodeMem (
IN VOID *Buffer,
IN UINTN Size,
IN CHAR16 Value
)
{
CHAR16 *Ptr;
Ptr = Buffer;
while ((Size--) != 0) {
*(Ptr++) = Value;
}
}
/**
The internal function prints to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
protocol instance.
@param Width Width of string to be print.
@param Column The position of the output string.
@param Row The position of the output string.
@param Out The EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.
@param Fmt The format string.
@param Args The additional argument for the variables in the format string.
@return Number of Unicode character printed.
**/
UINTN
PrintInternal (
IN UINTN Width,
IN UINTN Column,
IN UINTN Row,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Out,
IN CHAR16 *Fmt,
IN VA_LIST Args
)
{
CHAR16 *Buffer;
CHAR16 *BackupBuffer;
UINTN Index;
UINTN PreviousIndex;
UINTN Count;
UINTN PrintWidth;
UINTN CharWidth;
//
// For now, allocate an arbitrarily long buffer
//
Buffer = AllocateZeroPool (0x10000);
BackupBuffer = AllocateZeroPool (0x10000);
ASSERT (Buffer);
ASSERT (BackupBuffer);
if (Column != (UINTN) -1) {
Out->SetCursorPosition (Out, Column, Row);
}
UnicodeVSPrint (Buffer, 0x10000, Fmt, Args);
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
Out->SetAttribute (Out, Out->Mode->Attribute);
Index = 0;
PreviousIndex = 0;
Count = 0;
PrintWidth = 0;
CharWidth = 1;
do {
for (; (Buffer[Index] != NARROW_CHAR) && (Buffer[Index] != WIDE_CHAR) && (Buffer[Index] != 0); Index++) {
BackupBuffer[Index] = Buffer[Index];
}
if (Buffer[Index] == 0) {
break;
}
//
// Null-terminate the temporary string
//
BackupBuffer[Index] = 0;
//
// Print this out, we are about to switch widths
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count += StrLen (&BackupBuffer[PreviousIndex]);
PrintWidth += Count * CharWidth;
//
// Preserve the current index + 1, since this is where we will start printing from next
//
PreviousIndex = Index + 1;
//
// We are at a narrow or wide character directive. Set attributes and strip it and print it
//
if (Buffer[Index] == NARROW_CHAR) {
//
// Preserve bits 0 - 6 and zero out the rest
//
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
Out->SetAttribute (Out, Out->Mode->Attribute);
CharWidth = 1;
} else {
//
// Must be wide, set bit 7 ON
//
Out->Mode->Attribute = Out->Mode->Attribute | EFI_WIDE_ATTRIBUTE;
Out->SetAttribute (Out, Out->Mode->Attribute);
CharWidth = 2;
}
Index++;
} while (Buffer[Index] != 0);
//
// We hit the end of the string - print it
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count += StrLen (&BackupBuffer[PreviousIndex]);
PrintWidth += Count * CharWidth;
if (PrintWidth < Width) {
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
Out->SetAttribute (Out, Out->Mode->Attribute);
Out->OutputString (Out, &mSpaceBuffer[SPACE_BUFFER_SIZE - Width + PrintWidth]);
}
FreePool (Buffer);
FreePool (BackupBuffer);
return Count;
}
/**
Prints a formatted unicode string to the default console, at
the supplied cursor position.
@param Width Width of String to be printed.
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at.
@param Fmt Format string.
@param ... Variable argument list for format string.
@return Length of string printed to the console
**/
UINTN
EFIAPI
PrintAt (
IN UINTN Width,
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *Fmt,
...
)
{
VA_LIST Args;
UINTN LengthOfPrinted;
VA_START (Args, Fmt);
LengthOfPrinted = PrintInternal (Width, Column, Row, gST->ConOut, Fmt, Args);
VA_END (Args);
return LengthOfPrinted;
}

View File

@ -0,0 +1,307 @@
/** @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_INTERNAL_H__
#define __CUSTOMIZED_DISPLAY_LIB_INTERNAL_H__
#include <PiDxe.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/FormBrowser2.h>
#include <Protocol/FormBrowserEx2.h>
#include <Protocol/DisplayProtocol.h>
#include <Protocol/DevicePath.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiString.h>
#include <Protocol/UserManager.h>
#include <Protocol/DevicePathFromText.h>
#include <Guid/MdeModuleHii.h>
#include <Guid/HiiPlatformSetupFormset.h>
#include <Guid/HiiFormMapMethodGuid.h>
#include <Library/PrintLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/HiiLib.h>
#include <Library/PcdLib.h>
#include <Library/DevicePathLib.h>
#include <Library/CustomizedDisplayLib.h>
#include "Colors.h"
#define FORMSET_CLASS_PLATFORM_SETUP 0x0001
#define FORMSET_CLASS_FRONT_PAGE 0x0002
#define FORMSET_CLASS_MODEL_PAGE 0x0004
#define FRONT_PAGE_HEADER_HEIGHT 6
#define NONE_FRONT_PAGE_HEADER_HEIGHT 3
#define FOOTER_HEIGHT 4
#define STATUS_BAR_HEIGHT 1
//
// Screen definitions
//
#define BANNER_HEIGHT 6
#define BANNER_COLUMNS 3
#define BANNER_LEFT_COLUMN_INDENT 1
//
// Character definitions
//
#define UPPER_LOWER_CASE_OFFSET 0x20
//
// This is the Input Error Message
//
#define INPUT_ERROR 1
//
// This is the NV RAM update required Message
//
#define NV_UPDATE_REQUIRED 2
typedef struct {
EFI_STRING_ID Banner[BANNER_HEIGHT][BANNER_COLUMNS];
} BANNER_DATA;
extern UINT16 gClassOfVfr; // Formset class information
extern BANNER_DATA *gBannerData;
extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
extern UINTN gFooterHeight;
//
// Browser Global Strings
//
extern CHAR16 *gEnterString;
extern CHAR16 *gEnterCommitString;
extern CHAR16 *gEnterEscapeString;
extern CHAR16 *gEscapeString;
extern CHAR16 *gMoveHighlight;
extern CHAR16 *gDecNumericInput;
extern CHAR16 *gHexNumericInput;
extern CHAR16 *gToggleCheckBox;
extern CHAR16 *gLibEmptyString;
extern CHAR16 *gAreYouSure;
extern CHAR16 *gYesResponse;
extern CHAR16 *gNoResponse;
extern CHAR16 *gPlusString;
extern CHAR16 *gMinusString;
extern CHAR16 *gAdjustNumber;
extern CHAR16 *gSaveChanges;
extern CHAR16 *gNvUpdateMessage;
extern CHAR16 *gInputErrorMessage;
/**
Print banner info for front page.
@param[in] FormData Form Data to be shown in Page
**/
VOID
PrintBannerInfo (
IN FORM_DISPLAY_ENGINE_FORM *FormData
);
/**
Print framework for a page.
**/
VOID
PrintFramework (
VOID
);
/**
Print the form title.
@param[in] FormData Form Data to be shown in Page
**/
VOID
PrintFormTitle (
IN FORM_DISPLAY_ENGINE_FORM *FormData
);
/**
Validate the input screen diemenstion info.
@param FormData The input form data info.
@return EFI_SUCCESS The input screen info is acceptable.
@return EFI_INVALID_PARAMETER The input screen info is not acceptable.
**/
EFI_STATUS
ScreenDiemensionInfoValidate (
IN FORM_DISPLAY_ENGINE_FORM *FormData
);
/**
Get the string based on the StringId and HII Package List Handle.
@param Token The String's ID.
@param HiiHandle The package list in the HII database to search for
the specified string.
@return The output string.
**/
CHAR16 *
LibGetToken (
IN EFI_STRING_ID Token,
IN EFI_HII_HANDLE HiiHandle
);
/**
Count the storage space of a Unicode string.
This function handles the Unicode string with NARROW_CHAR
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
does not count in the resultant output. If a WIDE_CHAR is
hit, then 2 Unicode character will consume an output storage
space with size of CHAR16 till a NARROW_CHAR is hit.
If String is NULL, then ASSERT ().
@param String The input string to be counted.
@return Storage space for the input string.
**/
UINTN
LibGetStringWidth (
IN CHAR16 *String
);
/**
Show all registered HotKey help strings on bottom Rows.
@param FormData The curent input form data info.
**/
VOID
PrintHotKeyHelpString (
IN FORM_DISPLAY_ENGINE_FORM *FormData
);
/**
Get step info from numeric opcode.
@param[in] OpCode The input numeric op code.
@return step info for this opcode.
**/
UINT64
LibGetFieldFromNum (
IN EFI_IFR_OP_HEADER *OpCode
);
/**
Initialize the HII String Token to the correct values.
**/
VOID
InitializeLibStrings (
VOID
);
/**
Free the HII String.
**/
VOID
FreeLibStrings (
VOID
);
/**
Wait for a key to be pressed by user.
@param Key The key which is pressed by user.
@retval EFI_SUCCESS The function always completed successfully.
**/
EFI_STATUS
WaitForKeyStroke (
OUT EFI_INPUT_KEY *Key
);
/**
Set Buffer to Value for Size bytes.
@param Buffer Memory to set.
@param Size Number of bytes to set
@param Value Value of the set operation.
**/
VOID
LibSetUnicodeMem (
IN VOID *Buffer,
IN UINTN Size,
IN CHAR16 Value
);
/**
Prints a formatted unicode string to the default console, at
the supplied cursor position.
@param Width Width of String to be printed.
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at.
@param Fmt Format string.
@param ... Variable argument list for format string.
@return Length of string printed to the console
**/
UINTN
EFIAPI
PrintAt (
IN UINTN Width,
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *Fmt,
...
);
/**
Process some op codes which is out side of current form.
@param FormData Pointer to the form data.
**/
VOID
ProcessExternedOpcode (
IN FORM_DISPLAY_ENGINE_FORM *FormData
);
#endif

View File

@ -98,6 +98,10 @@
#
CpuExceptionHandlerLib|Include/Library/CpuExceptionHandlerLib.h
## @libraryclass Provides platform specific display interface.
#
CustomizedDisplayLib|Include/Library/CustomizedDisplayLib.h
[Guids]
## MdeModule package token space guid
# Include/Guid/MdeModulePkgTokenSpace.h
@ -361,6 +365,12 @@
## Include/Protocol/BootLogo.h
gEfiBootLogoProtocolGuid = { 0xcdea2bd3, 0xfc25, 0x4c1c, { 0xb9, 0x7c, 0xb3, 0x11, 0x86, 0x6, 0x49, 0x90 } }
## Include/Protocol/DisplayProtocol.h
gEdkiiFormDisplayEngineProtocolGuid = { 0x9bbe29e9, 0xfda1, 0x41ec, { 0xad, 0x52, 0x45, 0x22, 0x13, 0x74, 0x2d, 0x2e } }
## Include/Protocol/FormBrowserEx2.h
gEdkiiFormBrowserEx2ProtocolGuid = { 0xa770c357, 0xb693, 0x4e6d, { 0xa6, 0xcf, 0xd2, 0x1c, 0x72, 0x8e, 0x55, 0xb } }
[PcdsFeatureFlag]
## Indicate whether platform can support update capsule across a system reset
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset|FALSE|BOOLEAN|0x0001001d

View File

@ -76,6 +76,7 @@
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PalLib|MdePkg/Library/BasePalLibNull/BasePalLibNull.inf
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
#
# Misc
#
@ -293,6 +294,7 @@
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Application/VariableInfo/VariableInfo.inf
MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf

View File

@ -0,0 +1,70 @@
## @file
# The DXE driver produces FORM BROWSER protocols defined in UEFI HII 2.1 specificatin.
#
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = DisplayEngine
FILE_GUID = E660EA85-058E-4b55-A54B-F02F83A24707
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = InitializeDisplayEngine
UNLOAD_IMAGE = UnloadDisplayEngine
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources]
FormDisplayStr.uni
FormDisplay.c
FormDisplay.h
Print.c
ProcessOptions.c
InputHandler.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
DebugLib
BaseMemoryLib
BaseLib
PrintLib
HiiLib
MemoryAllocationLib
CustomizedDisplayLib
[Protocols]
gEdkiiFormDisplayEngineProtocolGuid
gEdkiiFormBrowserEx2ProtocolGuid
[Guids]
gEfiIfrTianoGuid ## CONSUMES ## GUID
[Depex]
gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid AND gEdkiiFormBrowserEx2ProtocolGuid
[FeaturePcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserGrayOutTextStatement ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu ## CONSUMES
[BuildOptions]
MSFT:*_*_*_CC_FLAGS = /Od

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,580 @@
/** @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 __FORM_DISPLAY_H__
#define __FORM_DISPLAY_H__
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseLib.h>
#include <Library/HiiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/CustomizedDisplayLib.h>
#include <Protocol/FormBrowserEx2.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/DisplayProtocol.h>
#include <Guid/MdeModuleHii.h>
//
// This is the generated header file which includes whatever needs to be exported (strings + IFR)
//
extern UINT8 DisplayEngineStrings[];
extern EFI_SCREEN_DESCRIPTOR gStatementDimensions;
extern USER_INPUT *gUserInput;
extern FORM_DISPLAY_ENGINE_FORM *gFormData;
extern EFI_HII_HANDLE gHiiHandle;
extern UINT16 gDirection;
extern LIST_ENTRY gMenuOption;
//
// Browser Global Strings
//
extern CHAR16 *gSaveFailed;
extern CHAR16 *gPromptForData;
extern CHAR16 *gPromptForPassword;
extern CHAR16 *gPromptForNewPassword;
extern CHAR16 *gConfirmPassword;
extern CHAR16 *gConfirmError;
extern CHAR16 *gPassowordInvalid;
extern CHAR16 *gPressEnter;
extern CHAR16 *gEmptyString;
extern CHAR16 *gMiniString;
extern CHAR16 *gOptionMismatch;
extern CHAR16 *gFormSuppress;
extern CHAR16 *gProtocolNotFound;
extern CHAR16 gPromptBlockWidth;
extern CHAR16 gOptionBlockWidth;
extern CHAR16 gHelpBlockWidth;
extern CHAR16 *mUnknownString;
//
// Screen definitions
//
#define LEFT_SKIPPED_COLUMNS 3
#define SCROLL_ARROW_HEIGHT 1
#define POPUP_PAD_SPACE_COUNT 5
#define POPUP_FRAME_WIDTH 2
//
// Display definitions
//
#define LEFT_ONEOF_DELIMITER L'<'
#define RIGHT_ONEOF_DELIMITER L'>'
#define LEFT_NUMERIC_DELIMITER L'['
#define RIGHT_NUMERIC_DELIMITER L']'
#define LEFT_CHECKBOX_DELIMITER L'['
#define RIGHT_CHECKBOX_DELIMITER L']'
#define CHECK_ON L'X'
#define CHECK_OFF L' '
#define TIME_SEPARATOR L':'
#define DATE_SEPARATOR L'/'
#define SUBTITLE_INDENT 2
//
// This is the Input Error Message
//
#define INPUT_ERROR 1
//
// This is the NV RAM update required Message
//
#define NV_UPDATE_REQUIRED 2
//
// Time definitions
//
#define ONE_SECOND 10000000
//
// It take 23 characters including the NULL to print a 64 bits number with "[" and "]".
// pow(2, 64) = [18446744073709551616]
//
#define MAX_NUMERIC_INPUT_WIDTH 23
#define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
#define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
#define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
#define EFI_HII_EXPRESSION_SUPPRESS_IF 3
#define EFI_HII_EXPRESSION_DISABLE_IF 4
//
// Character definitions
//
#define CHAR_SPACE 0x0020
#define FORM_DISPLAY_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'D', 'D', 'V')
typedef struct {
UINT32 Signature;
EFI_HANDLE Handle;
//
// Produced protocol
//
EDKII_FORM_DISPLAY_ENGINE_PROTOCOL FromDisplayProt;
} FORM_DISPLAY_DRIVER_PRIVATE_DATA;
typedef enum {
UiNoOperation,
UiSelect,
UiUp,
UiDown,
UiLeft,
UiRight,
UiReset,
UiPrevious,
UiPageUp,
UiPageDown,
UiHotKey,
UiMaxOperation
} UI_SCREEN_OPERATION;
typedef enum {
CfInitialization,
CfCheckSelection,
CfRepaint,
CfRefreshHighLight,
CfUpdateHelpString,
CfPrepareToReadKey,
CfReadKey,
CfScreenOperation,
CfUiSelect,
CfUiReset,
CfUiLeft,
CfUiRight,
CfUiUp,
CfUiPageUp,
CfUiPageDown,
CfUiDown,
CfUiDefault,
CfUiNoOperation,
CfExit,
CfUiHotKey,
CfMaxControlFlag
} UI_CONTROL_FLAG;
typedef enum {
UIEventNone,
UIEventKey,
UIEventTimeOut,
UIEventDriver
} UI_EVENT_TYPE;
typedef struct {
UINT16 ScanCode;
UI_SCREEN_OPERATION ScreenOperation;
} SCAN_CODE_TO_SCREEN_OPERATION;
typedef struct {
UI_SCREEN_OPERATION ScreenOperation;
UI_CONTROL_FLAG ControlFlag;
} SCREEN_OPERATION_T0_CONTROL_FLAG;
typedef struct {
EFI_QUESTION_ID QuestionId;
UINT16 DisplayRow;
} DISPLAY_HIGHLIGHT_MENU_INFO;
#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')
typedef struct {
UINTN Signature;
LIST_ENTRY Link;
EFI_HII_HANDLE Handle;
FORM_DISPLAY_ENGINE_STATEMENT *ThisTag;
UINT16 EntryNumber;
UINTN Row;
UINTN Col;
UINTN OptCol;
CHAR16 *Description;
UINTN Skip; // Number of lines
//
// Display item sequence for date/time
// Date: Month/Day/Year
// Sequence: 0 1 2
//
// Time: Hour : Minute : Second
// Sequence: 0 1 2
//
//
UINTN Sequence;
BOOLEAN GrayOut;
BOOLEAN ReadOnly;
//
// Whether user could change value of this item
//
BOOLEAN IsQuestion;
BOOLEAN NestInStatement;
} UI_MENU_OPTION;
#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
/**
Print Question Value according to it's storage width and display attributes.
@param Question The Question to be printed.
@param FormattedNumber Buffer for output string.
@param BufferSize The FormattedNumber buffer size in bytes.
@retval EFI_SUCCESS Print success.
@retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.
**/
EFI_STATUS
PrintFormattedNumber (
IN FORM_DISPLAY_ENGINE_STATEMENT *Question,
IN OUT CHAR16 *FormattedNumber,
IN UINTN BufferSize
);
/**
Set value of a data element in an Array by its Index.
@param Array The data array.
@param Type Type of the data in this array.
@param Index Zero based index for data in this array.
@param Value The value to be set.
**/
VOID
SetArrayData (
IN VOID *Array,
IN UINT8 Type,
IN UINTN Index,
IN UINT64 Value
);
/**
Return data element in an Array by its Index.
@param Array The data array.
@param Type Type of the data in this array.
@param Index Zero based index for data in this array.
@retval Value The data to be returned
**/
UINT64
GetArrayData (
IN VOID *Array,
IN UINT8 Type,
IN UINTN Index
);
/**
Search an Option of a Question by its value.
@param Question The Question
@param OptionValue Value for Option to be searched.
@retval Pointer Pointer to the found Option.
@retval NULL Option not found.
**/
DISPLAY_QUESTION_OPTION *
ValueToOption (
IN FORM_DISPLAY_ENGINE_STATEMENT *Question,
IN EFI_HII_VALUE *OptionValue
);
/**
Compare two Hii value.
@param Value1 Expression value to compare on left-hand.
@param Value2 Expression value to compare on right-hand.
@param Result Return value after compare.
retval 0 Two operators equal.
return Positive value if Value1 is greater than Value2.
retval Negative value if Value1 is less than Value2.
@param HiiHandle Only required for string compare.
@retval other Could not perform compare on two values.
@retval EFI_SUCCESS Compare the value success.
**/
EFI_STATUS
CompareHiiValue (
IN EFI_HII_VALUE *Value1,
IN EFI_HII_VALUE *Value2,
OUT INTN *Result,
IN EFI_HII_HANDLE HiiHandle OPTIONAL
);
/**
Draw a pop up windows based on the dimension, number of lines and
strings specified.
@param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines.
@param ... A series of text strings that displayed in the pop-up.
**/
VOID
EFIAPI
CreateMultiStringPopUp (
IN UINTN RequestedWidth,
IN UINTN NumberOfLines,
...
);
/**
Will copy LineWidth amount of a string in the OutputString buffer and return the
number of CHAR16 characters that were copied into the OutputString buffer.
The output string format is:
Glyph Info + String info + '\0'.
In the code, it deals \r,\n,\r\n same as \n\r, also it not process the \r or \g.
@param InputString String description for this option.
@param LineWidth Width of the desired string to extract in CHAR16
characters
@param GlyphWidth The glyph width of the begin of the char in the string.
@param Index Where in InputString to start the copy process
@param OutputString Buffer to copy the string into
@return Returns the number of CHAR16 characters that were copied into the OutputString
buffer, include extra glyph info and '\0' info.
**/
UINT16
GetLineByWidth (
IN CHAR16 *InputString,
IN UINT16 LineWidth,
IN OUT UINT16 *GlyphWidth,
IN OUT UINTN *Index,
OUT CHAR16 **OutputString
);
/**
Get the string based on the StringId and HII Package List Handle.
@param Token The String's ID.
@param HiiHandle The Hii handle for this string package.
@return The output string.
**/
CHAR16 *
GetToken (
IN EFI_STRING_ID Token,
IN EFI_HII_HANDLE HiiHandle
);
/**
Count the storage space of a Unicode string.
This function handles the Unicode string with NARROW_CHAR
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
does not count in the resultant output. If a WIDE_CHAR is
hit, then 2 Unicode character will consume an output storage
space with size of CHAR16 till a NARROW_CHAR is hit.
If String is NULL, then ASSERT ().
@param String The input string to be counted.
@return Storage space for the input string.
**/
UINTN
GetStringWidth (
IN CHAR16 *String
);
/**
This routine reads a numeric value from the user input.
@param MenuOption Pointer to the current input menu.
@retval EFI_SUCCESS If numerical input is read successfully
@retval EFI_DEVICE_ERROR If operation fails
**/
EFI_STATUS
GetNumericInput (
IN UI_MENU_OPTION *MenuOption
);
/**
Get string or password input from user.
@param MenuOption Pointer to the current input menu.
@param Prompt The prompt string shown on popup window.
@param StringPtr Old user input and destination for use input string.
@retval EFI_SUCCESS If string input is read successfully
@retval EFI_DEVICE_ERROR If operation fails
**/
EFI_STATUS
ReadString (
IN UI_MENU_OPTION *MenuOption,
IN CHAR16 *Prompt,
IN OUT CHAR16 *StringPtr
);
/**
Draw a pop up windows based on the dimension, number of lines and
strings specified.
@param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines.
@param Marker The variable argument list for the list of string to be printed.
**/
VOID
CreateSharedPopUp (
IN UINTN RequestedWidth,
IN UINTN NumberOfLines,
IN VA_LIST Marker
);
/**
Wait for a key to be pressed by user.
@param Key The key which is pressed by user.
@retval EFI_SUCCESS The function always completed successfully.
**/
EFI_STATUS
WaitForKeyStroke (
OUT EFI_INPUT_KEY *Key
);
/**
Get selection for OneOf and OrderedList (Left/Right will be ignored).
@param MenuOption Pointer to the current input menu.
@retval EFI_SUCCESS If Option input is processed successfully
@retval EFI_DEVICE_ERROR If operation fails
**/
EFI_STATUS
GetSelectionInputPopUp (
IN UI_MENU_OPTION *MenuOption
);
/**
Process the help string: Split StringPtr to several lines of strings stored in
FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.
@param StringPtr The entire help string.
@param FormattedString The oupput formatted string.
@param EachLineWidth The max string length of each line in the formatted string.
@param RowCount TRUE: if Question is selected.
**/
UINTN
ProcessHelpString (
IN CHAR16 *StringPtr,
OUT CHAR16 **FormattedString,
OUT UINT16 *EachLineWidth,
IN UINTN RowCount
);
/**
Process a Question's Option (whether selected or un-selected).
@param MenuOption The MenuOption for this Question.
@param Selected TRUE: if Question is selected.
@param OptionString Pointer of the Option String to be displayed.
@param SkipErrorValue Whether need to return when value without option for it.
@retval EFI_SUCCESS Question Option process success.
@retval Other Question Option process fail.
**/
EFI_STATUS
ProcessOptions (
IN UI_MENU_OPTION *MenuOption,
IN BOOLEAN Selected,
OUT CHAR16 **OptionString,
IN BOOLEAN SkipErrorValue
);
/**
Set Buffer to Value for Size bytes.
@param Buffer Memory to set.
@param Size Number of bytes to set
@param Value Value of the set operation.
**/
VOID
SetUnicodeMem (
IN VOID *Buffer,
IN UINTN Size,
IN CHAR16 Value
);
/**
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.
**/
EFI_STATUS
EFIAPI
FormDisplay (
IN FORM_DISPLAY_ENGINE_FORM *FormData,
OUT USER_INPUT *UserInputData
);
/**
Exit Display and Clear Screen to the original state.
**/
VOID
EFIAPI
ExitDisplay (
VOID
);
/**
Process validate for one question.
@param Question The question which need to validate.
@retval EFI_SUCCESS Question Option process success.
@retval Other Question Option process fail.
**/
EFI_STATUS
ValidateQuestion (
IN FORM_DISPLAY_ENGINE_STATEMENT *Question
);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
/** @file
Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
simple implemenation of SPrint() and Print() to support debug.
You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
time. This makes the implementation very simple.
VSPrint, Print, SPrint format specification has the follwoing form
%type
type:
'S','s' - argument is an Unicode string
'c' - argument is an ascii character
'%' - Print a %
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "FormDisplay.h"
/**
Set Buffer to Value for Size bytes.
@param Buffer Memory to set.
@param Size Number of bytes to set
@param Value Value of the set operation.
**/
VOID
SetUnicodeMem (
IN VOID *Buffer,
IN UINTN Size,
IN CHAR16 Value
)
{
CHAR16 *Ptr;
Ptr = Buffer;
while ((Size--) != 0) {
*(Ptr++) = Value;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -787,7 +787,7 @@ FORM_BROWSER_FORM *
IdToForm (
IN FORM_BROWSER_FORMSET *FormSet,
IN UINT16 FormId
)
)
{
LIST_ENTRY *Link;
FORM_BROWSER_FORM *Form;
@ -2105,7 +2105,7 @@ GetQuestionValueFromForm (
//
FormSet = AllocateZeroPool (sizeof (FORM_BROWSER_FORMSET));
ASSERT (FormSet != NULL);
Status = InitializeFormSet(HiiHandle, FormSetGuid, FormSet, FALSE);
Status = InitializeFormSet(HiiHandle, FormSetGuid, FormSet);
if (EFI_ERROR (Status)) {
GetTheVal = FALSE;
goto Done;
@ -2800,7 +2800,7 @@ EvaluateExpression (
for (Index = 0; Index < OpCode->ValueWidth; Index ++, TempBuffer --) {
StrPtr += UnicodeValueToString (StrPtr, PREFIX_ZERO | RADIX_HEX, *TempBuffer, 2);
}
Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer);
Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer, NULL);
FreePool (NameValue);
if (!EFI_ERROR (Status)) {
Data1.Value.b = TRUE;

View File

@ -0,0 +1,265 @@
/** @file
Private structure, MACRO and function definitions for User Interface related functionalities.
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _EXPRESSION_H_
#define _EXPRESSION_H_
/**
Get the expression list count.
@param Level Which type this expression belong to. Form,
statement or option?
@retval >=0 The expression count
@retval -1 Input parameter error.
**/
INTN
GetConditionalExpressionCount (
IN EXPRESS_LEVEL Level
);
/**
Reset stack pointer to begin of the stack.
**/
VOID
ResetCurrentExpressionStack (
VOID
);
/**
Reset stack pointer to begin of the stack.
**/
VOID
ResetMapExpressionListStack (
VOID
);
/**
Reset stack pointer to begin of the stack.
**/
VOID
ResetScopeStack (
VOID
);
/**
Push an Operand onto the Stack
@param Operand Operand to push.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
stack.
**/
EFI_STATUS
PushScope (
IN UINT8 Operand
);
/**
Get the expression Buffer pointer.
@param Level Which type this expression belong to. Form,
statement or option?
@retval The start pointer of the expression buffer or NULL.
**/
FORM_EXPRESSION **
GetConditionalExpressionList (
IN EXPRESS_LEVEL Level
);
/**
Pop an Operand from the Stack
@param Operand Operand to pop.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
stack.
**/
EFI_STATUS
PopScope (
OUT UINT8 *Operand
);
/**
Push the list of map expression onto the Stack
@param Pointer Pointer to the list of map expression to be pushed.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
PushMapExpressionList (
IN VOID *Pointer
);
/**
Push current expression onto the Stack
@param Pointer Pointer to current expression.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
PushCurrentExpression (
IN VOID *Pointer
);
/**
Zero extend integer/boolean/date/time to UINT64 for comparing.
@param Value HII Value to be converted.
**/
VOID
ExtendValueToU64 (
IN EFI_HII_VALUE *Value
);
/**
Push the expression options onto the Stack.
@param Pointer Pointer to the current expression.
@param Level Which type this expression belong to. Form,
statement or option?
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
PushConditionalExpression (
IN FORM_EXPRESSION *Pointer,
IN EXPRESS_LEVEL Level
);
/**
Pop the expression options from the Stack
@param Level Which type this expression belong to. Form,
statement or option?
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
PopConditionalExpression (
IN EXPRESS_LEVEL Level
);
/**
Pop the list of map expression from the Stack
@param Pointer Pointer to the list of map expression to be pop.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
PopMapExpressionList (
OUT VOID **Pointer
);
/**
Pop current expression from the Stack
@param Pointer Pointer to current expression to be pop.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
**/
EFI_STATUS
PopCurrentExpression (
OUT VOID **Pointer
);
/**
Evaluate the result of a HII expression.
If Expression is NULL, then ASSERT.
@param FormSet FormSet associated with this expression.
@param Form Form associated with this expression.
@param Expression Expression to be evaluated.
@retval EFI_SUCCESS The expression evaluated successfuly
@retval EFI_NOT_FOUND The Question which referenced by a QuestionId
could not be found.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
stack.
@retval EFI_ACCESS_DENIED The pop operation underflowed the stack
@retval EFI_INVALID_PARAMETER Syntax error with the Expression
**/
EFI_STATUS
EvaluateExpression (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN OUT FORM_EXPRESSION *Expression
);
/**
Return the result of the expression list. Check the expression list and
return the highest priority express result.
Priority: DisableIf > SuppressIf > GrayOutIf > FALSE
@param ExpList The input expression list.
@param Evaluate Whether need to evaluate the expression first.
@param FormSet FormSet associated with this expression.
@param Form Form associated with this expression.
@retval EXPRESS_RESULT Return the higher priority express result.
DisableIf > SuppressIf > GrayOutIf > FALSE
**/
EXPRESS_RESULT
EvaluateExpressionList (
IN FORM_EXPRESSION_LIST *ExpList,
IN BOOLEAN Evaluate,
IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL
IN FORM_BROWSER_FORM *Form OPTIONAL
);
/**
Get Form given its FormId.
@param FormSet The formset which contains this form.
@param FormId Id of this form.
@retval Pointer The form.
@retval NULL Specified Form is not found in the formset.
**/
FORM_BROWSER_FORM *
IdToForm (
IN FORM_BROWSER_FORMSET *FormSet,
IN UINT16 FormId
);
#endif // _EXPRESSION_H

View File

@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
UINT16 mStatementIndex;
UINT16 mExpressionOpCodeIndex;
EFI_QUESTION_ID mUsedQuestionId;
BOOLEAN mInScopeSubtitle;
extern LIST_ENTRY gBrowserStorageList;
/**
@ -42,9 +42,9 @@ CreateStatement (
if (Form == NULL) {
//
// We are currently not in a Form Scope, so just skip this Statement
// Only guid op may out side the form level.
//
return NULL;
ASSERT (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_GUID_OP);
}
Statement = &FormSet->StatementBuffer[mStatementIndex];
@ -58,6 +58,7 @@ CreateStatement (
Statement->Signature = FORM_BROWSER_STATEMENT_SIGNATURE;
Statement->Operand = ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode;
Statement->OpCode = (EFI_IFR_OP_HEADER *) OpCodeData;
StatementHdr = (EFI_IFR_STATEMENT_HEADER *) (OpCodeData + sizeof (EFI_IFR_OP_HEADER));
CopyMem (&Statement->Prompt, &StatementHdr->Prompt, sizeof (EFI_STRING_ID));
@ -82,8 +83,11 @@ CreateStatement (
//
// Insert this Statement into current Form
//
InsertTailList (&Form->StatementListHead, &Statement->Link);
if (Form == NULL) {
InsertTailList (&FormSet->StatementListOSF, &Statement->Link);
} else {
InsertTailList (&Form->StatementListHead, &Statement->Link);
}
return Statement;
}
@ -1133,6 +1137,7 @@ ParseOpCodes (
CountOpCodes (FormSet, &NumberOfStatement, &NumberOfExpression);
mStatementIndex = 0;
mUsedQuestionId = 1;
FormSet->StatementBuffer = AllocateZeroPool (NumberOfStatement * sizeof (FORM_BROWSER_STATEMENT));
if (FormSet->StatementBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
@ -1144,6 +1149,7 @@ ParseOpCodes (
return EFI_OUT_OF_RESOURCES;
}
InitializeListHead (&FormSet->StatementListOSF);
InitializeListHead (&FormSet->StorageListHead);
InitializeListHead (&FormSet->DefaultStoreListHead);
InitializeListHead (&FormSet->FormListHead);
@ -1502,7 +1508,6 @@ ParseOpCodes (
InitializeListHead (&CurrentForm->ConfigRequestHead);
CurrentForm->FormType = STANDARD_MAP_FORM_TYPE;
CurrentForm->NvUpdateRequired = FALSE;
CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
CopyMem (&CurrentForm->FormTitle, &((EFI_IFR_FORM *) OpCodeData)->FormTitle, sizeof (EFI_STRING_ID));
@ -1539,7 +1544,6 @@ ParseOpCodes (
CurrentForm = AllocateZeroPool (sizeof (FORM_BROWSER_FORM));
ASSERT (CurrentForm != NULL);
CurrentForm->Signature = FORM_BROWSER_FORM_SIGNATURE;
CurrentForm->NvUpdateRequired = FALSE;
InitializeListHead (&CurrentForm->ExpressionListHead);
InitializeListHead (&CurrentForm->StatementListHead);
InitializeListHead (&CurrentForm->ConfigRequestHead);
@ -1653,7 +1657,7 @@ ParseOpCodes (
ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;
CurrentStatement->FakeQuestionId = mUsedQuestionId++;
if (Scope != 0) {
mInScopeSubtitle = TRUE;
}
@ -1662,13 +1666,14 @@ ParseOpCodes (
case EFI_IFR_TEXT_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
ASSERT (CurrentStatement != NULL);
CurrentStatement->FakeQuestionId = mUsedQuestionId++;
CopyMem (&CurrentStatement->TextTwo, &((EFI_IFR_TEXT *) OpCodeData)->TextTwo, sizeof (EFI_STRING_ID));
break;
case EFI_IFR_RESET_BUTTON_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
ASSERT (CurrentStatement != NULL);
CurrentStatement->FakeQuestionId = mUsedQuestionId++;
CopyMem (&CurrentStatement->DefaultId, &((EFI_IFR_RESET_BUTTON *) OpCodeData)->DefaultId, sizeof (EFI_DEFAULT_ID));
break;
@ -1913,6 +1918,7 @@ ParseOpCodes (
CurrentOption = AllocateZeroPool (sizeof (QUESTION_OPTION));
ASSERT (CurrentOption != NULL);
CurrentOption->Signature = QUESTION_OPTION_SIGNATURE;
CurrentOption->OpCode = (EFI_IFR_ONE_OF_OPTION *) OpCodeData;
CurrentOption->Flags = ((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Flags;
CurrentOption->Value.Type = ((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Type;
@ -2270,45 +2276,8 @@ ParseOpCodes (
//
// Vendor specific
//
case EFI_IFR_GUID_OP:
if (CompareGuid (&gEfiIfrTianoGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
//
// Tiano specific GUIDed opcodes
//
switch (((EFI_IFR_GUID_LABEL *) OpCodeData)->ExtendOpCode) {
case EFI_IFR_EXTEND_OP_LABEL:
//
// just ignore label
//
break;
case EFI_IFR_EXTEND_OP_BANNER:
//
// By SubClass to get Banner Data from Front Page
//
if (FormSet->SubClass == EFI_FRONT_PAGE_SUBCLASS) {
CopyMem (
&gBannerData->Banner[((EFI_IFR_GUID_BANNER *) OpCodeData)->LineNumber][
((EFI_IFR_GUID_BANNER *) OpCodeData)->Alignment],
&((EFI_IFR_GUID_BANNER *) OpCodeData)->Title,
sizeof (EFI_STRING_ID)
);
}
break;
case EFI_IFR_EXTEND_OP_CLASS:
CopyMem (&FormSet->Class, &((EFI_IFR_GUID_CLASS *) OpCodeData)->Class, sizeof (UINT16));
break;
case EFI_IFR_EXTEND_OP_SUBCLASS:
CopyMem (&FormSet->SubClass, &((EFI_IFR_GUID_SUBCLASS *) OpCodeData)->SubClass, sizeof (UINT16));
break;
default:
break;
}
}
case EFI_IFR_GUID_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
break;
//

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

View File

@ -19,7 +19,7 @@
BASE_NAME = SetupBrowser
FILE_GUID = EBf342FE-B1D3-4EF8-957C-8048606FF671
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
VERSION_STRING = 2.0
ENTRY_POINT = InitializeSetup
#
@ -29,19 +29,12 @@
#
[Sources]
SetupBrowserStr.uni
Setup.c
Setup.h
IfrParse.c
Expression.c
InputHandler.c
Print.c
Presentation.c
ProcessOptions.c
Ui.c
Ui.h
Colors.h
Expression.h
[Packages]
MdePkg/MdePkg.dec
@ -59,36 +52,31 @@
HiiLib
DevicePathLib
PcdLib
UefiLib
[Guids]
gEfiIfrTianoGuid ## CONSUMES ## GUID
gEfiIfrFrameworkGuid ## CONSUMES ## GUID
gEfiHiiPlatformSetupFormsetGuid
gEfiHiiStandardFormGuid ## SOMETIMES_CONSUMES ## GUID
[Protocols]
gEfiHiiConfigAccessProtocolGuid ## CONSUMES
gEfiHiiStringProtocolGuid ## CONSUMES
gEfiFormBrowser2ProtocolGuid ## PRODUCES
gEfiFormBrowserExProtocolGuid ## PRODUCES
gEdkiiFormBrowserEx2ProtocolGuid ## PRODUCES
gEfiHiiConfigRoutingProtocolGuid ## CONSUMES
gEfiHiiDatabaseProtocolGuid ## CONSUMES
gEfiUnicodeCollation2ProtocolGuid ## CONSUMES
gEfiUserManagerProtocolGuid ## SOMETIMES_CONSUMES
gEfiDevicePathFromTextProtocolGuid ## SOMETIMES_CONSUMES
gEdkiiFormDisplayEngineProtocolGuid ## PRODUCE
gEfiFormBrowserExProtocolGuid ## PRODUCE
[FeaturePcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserGrayOutTextStatement ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu ## CONSUMES
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserSubtitleTextColor ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextColor ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextHighlightColor ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundHighlightColor ## CONSUMES
[Depex]
gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid
[BuildOptions]
MSFT:*_*_*_CC_FLAGS = /Od