summaryrefslogtreecommitdiff
path: root/EDK/MiniSetup/TseLite
diff options
context:
space:
mode:
Diffstat (limited to 'EDK/MiniSetup/TseLite')
-rw-r--r--EDK/MiniSetup/TseLite/Action.c365
-rw-r--r--EDK/MiniSetup/TseLite/AddBootOption.c2548
-rw-r--r--EDK/MiniSetup/TseLite/Date.c1397
-rw-r--r--EDK/MiniSetup/TseLite/Date.h181
-rw-r--r--EDK/MiniSetup/TseLite/Label.c523
-rw-r--r--EDK/MiniSetup/TseLite/Label.h160
-rw-r--r--EDK/MiniSetup/TseLite/ListBox.c1436
-rw-r--r--EDK/MiniSetup/TseLite/ListBox.h186
-rw-r--r--EDK/MiniSetup/TseLite/Memo.c764
-rw-r--r--EDK/MiniSetup/TseLite/Memo.h195
-rw-r--r--EDK/MiniSetup/TseLite/Menu.c1069
-rw-r--r--EDK/MiniSetup/TseLite/Menu.h179
-rw-r--r--EDK/MiniSetup/TseLite/MessageBox.c1192
-rw-r--r--EDK/MiniSetup/TseLite/MessageBox.h207
-rw-r--r--EDK/MiniSetup/TseLite/PopupEdit.c890
-rw-r--r--EDK/MiniSetup/TseLite/PopupEdit.h192
-rw-r--r--EDK/MiniSetup/TseLite/PopupPassword.c1377
-rw-r--r--EDK/MiniSetup/TseLite/PopupPassword.h178
-rw-r--r--EDK/MiniSetup/TseLite/PopupSel.c1646
-rw-r--r--EDK/MiniSetup/TseLite/PopupSel.h229
-rw-r--r--EDK/MiniSetup/TseLite/PopupString.c1283
-rw-r--r--EDK/MiniSetup/TseLite/PopupString.h200
-rw-r--r--EDK/MiniSetup/TseLite/ResetButton.c297
-rw-r--r--EDK/MiniSetup/TseLite/ResetButton.h106
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/StyleHook.cif49
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/StyleHook.h147
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/StyleHook.mak114
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/StyleHook.sdl24
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook1.c99
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook10.c97
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook11.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook12.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook13.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook14.c99
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook15.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook16.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook17.c99
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook18.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook19.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook2.c102
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook20.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook21.c100
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook22.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook23.c95
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook24.c96
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook25.c94
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook26.c94
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook27.c95
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook28.c94
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook29.c94
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook3.c101
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook30.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook31.c96
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook32.c96
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook33.c97
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook34.c97
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook35.c93
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook36.c97
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook37.c96
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook38.c96
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook39.c96
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook4.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook5.c99
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook6.c96
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook7.c98
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook8.c97
-rw-r--r--EDK/MiniSetup/TseLite/StyleHook/styleHook9.c96
-rw-r--r--EDK/MiniSetup/TseLite/SubMenu.c876
-rw-r--r--EDK/MiniSetup/TseLite/SubMenu.h197
-rw-r--r--EDK/MiniSetup/TseLite/Text.c587
-rw-r--r--EDK/MiniSetup/TseLite/Text.h154
-rw-r--r--EDK/MiniSetup/TseLite/Time.h180
-rw-r--r--EDK/MiniSetup/TseLite/TseLite.cif73
-rw-r--r--EDK/MiniSetup/TseLite/TseLite.mak124
-rw-r--r--EDK/MiniSetup/TseLite/TseLite.sdl40
-rw-r--r--EDK/MiniSetup/TseLite/TseLiteCommon.c433
-rw-r--r--EDK/MiniSetup/TseLite/TseLitehelper.c1310
-rw-r--r--EDK/MiniSetup/TseLite/UefiAction.c498
-rw-r--r--EDK/MiniSetup/TseLite/UefiAction.h119
-rw-r--r--EDK/MiniSetup/TseLite/action.h163
-rw-r--r--EDK/MiniSetup/TseLite/application.c436
-rw-r--r--EDK/MiniSetup/TseLite/application.h180
-rw-r--r--EDK/MiniSetup/TseLite/callback.c1341
-rw-r--r--EDK/MiniSetup/TseLite/callback.h189
-rw-r--r--EDK/MiniSetup/TseLite/control.c337
-rw-r--r--EDK/MiniSetup/TseLite/control.h171
-rw-r--r--EDK/MiniSetup/TseLite/edit.c636
-rw-r--r--EDK/MiniSetup/TseLite/edit.h166
-rw-r--r--EDK/MiniSetup/TseLite/frame.c2563
-rw-r--r--EDK/MiniSetup/TseLite/frame.h221
-rw-r--r--EDK/MiniSetup/TseLite/hotclick.c230
-rw-r--r--EDK/MiniSetup/TseLite/hotclick.h120
-rw-r--r--EDK/MiniSetup/TseLite/hotkey.c237
-rw-r--r--EDK/MiniSetup/TseLite/hotkey.h157
-rw-r--r--EDK/MiniSetup/TseLite/minisetupext.c2378
-rw-r--r--EDK/MiniSetup/TseLite/minisetupext.h537
-rw-r--r--EDK/MiniSetup/TseLite/numeric.c1430
-rw-r--r--EDK/MiniSetup/TseLite/numeric.h224
-rw-r--r--EDK/MiniSetup/TseLite/object.c211
-rw-r--r--EDK/MiniSetup/TseLite/object.h144
-rw-r--r--EDK/MiniSetup/TseLite/ordlistbox.c1080
-rw-r--r--EDK/MiniSetup/TseLite/ordlistbox.h202
-rw-r--r--EDK/MiniSetup/TseLite/page.c1079
-rw-r--r--EDK/MiniSetup/TseLite/page.h185
-rw-r--r--EDK/MiniSetup/TseLite/popup.c613
-rw-r--r--EDK/MiniSetup/TseLite/popup.h161
-rw-r--r--EDK/MiniSetup/TseLite/time.c1121
-rw-r--r--EDK/MiniSetup/TseLite/variable.c1488
108 files changed, 43512 insertions, 0 deletions
diff --git a/EDK/MiniSetup/TseLite/Action.c b/EDK/MiniSetup/TseLite/Action.c
new file mode 100644
index 0000000..a73171c
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Action.c
@@ -0,0 +1,365 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Action.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 9 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Action.c $
+//
+// 9 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 7 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 9/21/12 12:34p Premkumara
+// [TAG] EIP99022
+// [Category] Improvement
+// [Description] Tokenize the feature of flushing keyboard after every
+// key read
+// [Files] AMITSE.sdl, CommonHelper.c, TseAdvanced.c, Action.c
+//
+// 6 1/20/12 4:09a Rajashakerg
+// [TAG] EIP78929, 77467
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Control selection using Mouse is not user friendly.
+// [RootCause] Updating the buffer with mouse click information provided
+// by mouse driver is improper.
+// [Solution] Updated the mouse click information properly to the buffer
+// which is used by tse to do action.
+// [Files] Action.c, frame.c ListBox.c
+//
+// 5 11/20/11 7:38a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 4 2/04/11 11:12a Mallikarjunanv
+// AmiKey structure data is initialized with zero to aviod garbage values.
+//
+// 3 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 4 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Action.c
+//
+// Description: This file contains code to handle different actions.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+///////////////////////////////////
+//VARIABLES DECLARATION
+//////////////////////////////////
+ACTION_METHODS gAction =
+{
+ ActionCreate,
+ ActionDestroy,
+ ActionGetAction,
+ ActionClearAction
+};
+///////////////////////////////////
+//FUNCTIONS DECLARATION
+//////////////////////////////////
+EFI_STATUS _ActionReadMouse(MOUSE_INFO *MouseInfo);
+BOOLEAN FlushKeysAfterRead(void);
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ActionCreate
+//
+// Description: Function to create an action.
+//
+// Input: ACTION_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ActionCreate( ACTION_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ *object = EfiLibAllocateZeroPool( sizeof(ACTION_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ (*object)->Methods = &gAction;
+
+ _ActionInstallTimer( *object, ONE_SEC / 10 );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ActionDestroy
+//
+// Description: Function to destroy an action.
+//
+// Input: ACTION_DATA *action, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ActionDestroy( ACTION_DATA *action, BOOLEAN freeMem )
+{
+ TimerStopTimer( &action->TimerEvent );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&action );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ActionGetAction
+//
+// Description: Function to get an action.
+//
+// Input: ACTION_DATA *action
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ActionGetAction( ACTION_DATA *action )
+{
+ EFI_STATUS Status;
+ AMI_EFI_KEY_DATA AmiKey;
+ MOUSE_INFO MouseInfo;
+
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ return EFI_SUCCESS;
+
+ if ( action->TimerCount > 0 )
+ {
+ action->Input.Type = ACTION_TYPE_TIMER;
+ action->Input.Data.TimerCount = action->TimerCount;
+ action->TimerCount = 0;
+ return EFI_SUCCESS;
+ }
+
+ MemSet(&AmiKey, sizeof(AMI_EFI_KEY_DATA), 0); //makesure AmiKey does not have any garbage data
+ Status = ActionReadKey( &AmiKey, TIMER_ONE_SECOND / 20 );
+
+ if ( ! EFI_ERROR( Status ) )
+ { //If Key press return that first.
+ action->Input.Type = ACTION_TYPE_KEY;
+ MemCopy( &action->Input.Data.AmiKey, &AmiKey, sizeof(AMI_EFI_KEY_DATA) );
+ return Status;
+ }
+
+ //Read the Mouse Movement Co-ordinates and the Mouse Click
+ Status = _ActionReadMouse(&MouseInfo);
+ if ( ! EFI_ERROR( Status ) )
+ {
+ //EIP77467 & 78929: Not updating the action data for TSEMOUSE_RIGHT_DOWN and TSEMOUSE_RIGHT_UP
+ if((MouseInfo.ButtonStatus!=TSEMOUSE_NULL_CLICK)&&(MouseInfo.ButtonStatus != TSEMOUSE_RIGHT_DOWN)&&(MouseInfo.ButtonStatus != TSEMOUSE_RIGHT_UP))
+ {
+ action->Input.Type = ACTION_TYPE_MOUSE;
+ MemCopy( &action->Input.Data.MouseInfo, &MouseInfo, sizeof(MOUSE_INFO) );
+ return Status;
+ }
+ }
+
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ActionClearAction
+//
+// Description: Function to clear actions
+//
+// Input: ACTION_DATA *action
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ActionClearAction( ACTION_DATA *action )
+{
+ MemSet( &action->Input, sizeof(ACTION_INPUT), 0 );
+ return EFI_SUCCESS;
+}
+
+//
+// Internal functions
+//
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _ActionReadKey
+//
+// Description: Function to read a key.
+//
+// Input: AMI_EFI_KEY_DATA *pAmiKey, UINT64 Timeout
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _ActionReadKey( AMI_EFI_KEY_DATA *pAmiKey, UINT64 Timeout )
+{
+ EFI_STATUS Status;
+ EFI_STATUS StatusFlush;
+ EFI_EVENT EventList[2] = { NULL, NULL };
+ UINTN Count = 1, Index = 1;
+ AMI_EFI_KEY_DATA KeyFlush;
+
+ if ( Timeout )
+ {
+ EventList[0] = gST->ConIn->WaitForKey;
+
+ Status = TimerCreateTimer( &EventList[1], NULL, NULL, TimerRelative, Timeout, EFI_TPL_CALLBACK );
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ Count++;
+
+ gBS->WaitForEvent( Count, EventList, &Index );
+
+ TimerStopTimer( &EventList[1] );
+
+ if ( Index == 1 )
+ return EFI_NOT_READY;
+ }
+
+ Status = gST->ConIn->ReadKeyStroke( gST->ConIn, (EFI_INPUT_KEY*)pAmiKey);
+
+ if ( ! EFI_ERROR( Status ) && FlushKeysAfterRead())//EIP 99022 :check for the FLUSH_KEYS_AFTER_READ token before flushing the keys
+ {
+ do
+ {
+ StatusFlush = gST->ConIn->ReadKeyStroke( gST->ConIn, &KeyFlush.Key );
+ } while ( ! EFI_ERROR( StatusFlush ) );
+
+ }
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _ActionTimer
+//
+// Description: Function action timer
+//
+// Input: EFI_EVENT Event, VOID *Context
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _ActionTimer( EFI_EVENT Event, VOID *Context )
+{
+ (*(UINT32 *)Context)++;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _ActionInstallTimer
+//
+// Description: Function to install action timer
+//
+// Input: ACTION_DATA *action, UINT64 TriggerTime
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _ActionInstallTimer( ACTION_DATA *action, UINT64 TriggerTime )
+{
+ TimerCreateTimer( &action->TimerEvent, _ActionTimer, &action->TimerCount, TimerPeriodic, TriggerTime, EFI_TPL_CALLBACK );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _ActionReadMouse
+//
+// Description: Function to get mouse action
+//
+// Input: MOUSE_INFO *MouseInfo
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+//Function Which gets the Mouse action
+EFI_STATUS _ActionReadMouse(MOUSE_INFO *MouseInfo)
+{
+ return MouseReadInfo(MouseInfo);
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/AddBootOption.c b/EDK/MiniSetup/TseLite/AddBootOption.c
new file mode 100644
index 0000000..331bf33
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/AddBootOption.c
@@ -0,0 +1,2548 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2013, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/AddBootOption.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 29 $
+//
+// $Date: 5/21/14 6:28p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/AddBootOption.c $
+//
+// 29 5/21/14 6:28p Arunsb
+// [TAG] EIP170152
+// [Category] Bug Fix
+// [Severity:] Normal
+// [Symptom:] Add boot option failed to add the boot option
+// [Root Cause] If boot order is not there then TSE not allowing to add
+// boot options
+// [Solution] If boot order not presents also allowing to add boot option
+// [Files] AddBootOption.c
+//
+// 28 5/02/14 12:56p Premkumara
+// [TAG] EIP131549
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] After adding boot/driver options and Loading defaults causes
+// crashing issue.
+// [Root Cause] While discarding boot/driver options the boot order get
+// corrupted by copying extra data because of wrong size.
+// [Solution] Handled proper size to copy boot/driver options while
+// loading defaults
+// [Files] AddBootOption.c, Special.c
+//
+// 27 2/11/14 8:46p Arunsb
+//
+// 26 1/30/14 10:58a Arunsb
+// [TAG] EIP132762
+// [Category] Bug Fix
+// [Severity:] Normal
+// [Symptom:] Adding UEFI bootable RHEL OS(Bootx64.efi) from UEFI REHL6.4
+// DVD disk causes setup hang
+// [Root Cause] The DevicePath is not created properly while adding boot
+// options
+// [Solution] Added '\' before file path name e.g \EFI\Boot\Bootx64.efi
+// instead of EFI\Boot\Bootx64.efi
+// [Files] AddBootOption.c
+//
+// 25 12/04/13 2:22p Premkumara
+// [TAG] EIP131549
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] After adding boot/driver options and Loading defaults causes
+// crashing issue.
+// [Root Cause] While discarding boot/driver options the boot order get
+// corrupted by copying extra data because of wrong size.
+// [Solution] Handled proper size to copy boot/driver options while
+// loading defaults
+// [Files] AddBootOption.c, Special.c
+//
+// 24 5/22/13 10:56a Premkumara
+// [TAG] EIP123432
+// [Category] Bug Fix
+// [Issue Faced] Take print screen for save & Exit msg box. OK
+// of msg box is consumed by Save & Exit msg box.
+// - Cursor is missing after taking print screen of popupedit box in
+// string control
+// - Printscreen support is not given for Filebrowser feature
+// [RootCause] - When msg box for Save&Exit is popped and printscreen
+// event is called and displaying msg box over Save&Exit. Then msgbox
+// handleaction for printscreen event will change the result value in
+// _CallbackMsgbox() function so it will break the while loop in
+// _CallbackGetValue() function so destroy the next msg box in
+// CallbackShowMessageBox() function.
+// - DrawCursor variable is not set to TRUE after printscreen event
+// [Solution] - Returning EFI_UNSUPPORTED for printscreen event handling
+// function for messgebox and change the result value to 0xff
+// - Support given for file browser feature
+// [Files] Callback.c, MessageBox.c, Minisetupext.c, PopupString.c,
+// AddBootOption.c
+// AmiTSEStr.uni, FakeToken.c
+//
+// 23 5/22/13 10:51a Arunsb
+// EfiLibAllocateCopyPool leads to memory crash so changed it to
+// EfiLibAllocateZeroPool
+//
+// 22 4/16/13 12:59p Arunsb
+// [TAG] EIP113590
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Can't load default boot priorities if enable token
+// "SETUP_SUPPORT_ADD_BOOT_OPTION"
+// [RootCause] Size calculated wrongly
+// [Solution] Defaults will be formed only if size is 0, otherwise
+// current buffer will be overwritten.
+// [Files] AddBootOption.c
+//
+// 21 3/29/13 12:23p Premkumara
+// [TAG] EIP97611
+// [Category] New Feature
+// [Description] PrintScreen Support in TSE
+// [Files] AMITSE.sdl, CommonHelper.c, HotKeyBin.h, AddBootOption.c,
+// Page.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 20 12/01/12 6:46a Premkumara
+// [TAG] EIP105725
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Setup hangs on BBS Menu having string more than 200
+// characters
+// [RootCause] File path string is not handled properly
+// [Solution] Handled FilePath strings based on length of string and
+// allocate memory based on length dynamically
+// [Files] AddBootOption.c, AMIVfr.h
+//
+// 19 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 15 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 18 5/29/12 4:37a Arunsb
+// [TAG] EIP91109
+// [Category] Improvement
+// [Description] Sync the Aptio IV source for AptioV
+//
+// 17 1/24/12 4:37a Arunsb
+// [TAG] EIP81581
+// [Category] Improvement
+// [Description] Default driver order support
+// [Files] globals.c, addbootoption.c, callback.c, minisetupext.h and
+// variable.c
+//
+// 16 1/19/12 10:49a Arunsb
+// [TAG] EIP79956
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Two boot option entries displayed with the single name
+// value
+// [RootCause] If defaults are loaded then boot order is trying to load
+// the improper boot order due to add boot option feature
+// [Solution] Boot order formed properly for add boot option case.
+// If no tsedefaultbootorder module present then gOptimalDefaults
+// [VARIABLE_ID_BOOT_ORDER] are saved properly in SaveAddDelBootOptions at
+// first time.
+// At first time optimal buffer is empty so it was filled with some junk
+// value so it is changed to fill the current variable list at first time
+// of saving with add boot option feature.
+// [Files] Addbootoption.c and callback.c
+//
+// 15 1/09/12 1:50a Arunsb
+// [TAG] EIP79952
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Add driver option displays select boot option as title
+// [RootCause] Title problem
+// [Solution] Title changes
+// [Files] Faketokens.c, amitsestr.uni, addbootoption.c,
+// uefi2.0\hiicallback.c and uefi21wapper.c
+//
+// 14 11/30/11 1:34p Premkumara
+// [TAG] EIP75352
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] Boot.c, bbs.c, TseAdvanced.c, Special.c, Variable.c,
+// TseLiteHelper.c, PopupSel.c, AddBootOption.c, Hii.c, FormBrowser2.c
+//
+// 13 11/13/11 12:54p Arunsb
+// [TAG] EIP70421
+// [Category] New Feature
+// [Description] Support for driver order in TSE
+// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
+// boot.c,
+// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
+// addbootoption.c,
+// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
+// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
+// TseElink.h, variable.h,
+// setup.h, Boot.vfr and Setup.uni
+//
+// 12 1/10/11 3:55p Mallikarjunanv
+// Updated to work with respect to EDK Libraries
+//
+// 11 1/07/11 12:09a Mallikarjunanv
+// [TAG] EIP51378
+// [Description] Global variable gHandleBuffer changed to
+// gSmplFileSysHndlBuf because of the conflict with HddSecurity module,
+// which already using gHandleBuffer.
+//
+// 10 1/06/11 11:14p Mallikarjunanv
+// [TAG] EIP41615
+// [Description] Updated the files with respect to File Browser support.
+//
+// 9 12/28/10 6:20p Mallikarjunanv
+// [TAG] EIP41615
+// [Description] Added the file browser support for the Add boot option
+// reated controls
+// [Files] AmiVfr.h, AmiTse.sdl, AmiTseStr.uni, CommonHelper.c,
+// Faketokens.c, TseElinks.h, EdkHelper.h, minisetup.h, TseAdvanced.c,
+// AddBootOption.c
+//
+// 8 3/26/10 5:25p Madhans
+// EIP 35562: Support To create Boot option in Capital letters.
+//
+// 7 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 11 2/25/10 8:04a Mallikarjunanv
+// Updated the memory corruptions in case of add delete boot options
+//
+// 10 2/19/10 8:19a Mallikarjunanv
+// updated year in copyright message
+//
+// 9 1/28/10 1:10p Mallikarjunanv
+// //EIP:34119 - Fix to solve issues, if the boot option name is set with
+// max number of characters allowed.
+//
+// 8 1/09/10 7:12a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 7 1/04/10 10:40a Mallikarjunanv
+// EIPs 27161/29095 - Added support for reserved boot option names and
+// added support not to create empty boot option names
+//
+// 6 12/18/09 2:27p Madhans
+// EIP: 32350/32445 To fix the Add/Delete Boot option issues with TSE 2.0.
+//
+// 5 8/18/09 5:34p Madhans
+// EIP 25367: To resolve the build issue and to avoid redefinition.
+//
+// 4 8/13/09 7:39a Mallikarjunanv
+// eip:24971 - supporting tse features without tse sources
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 4/29/09 9:02p Madhans
+// Bug Fixes after unit Testing..
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 1 4/28/09 9:39p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//
+//
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AddBootOption.c
+//
+// Description: This file contains code to handle the Add boot option operation.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+
+///////////////////////////////////////////////////////
+/// MACRO DEFINITIONS
+///////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////
+/// VARIABLE DECLARATIONS
+///////////////////////////////////////////////////////
+
+typedef struct// EIP-41615: Start
+{
+ UINT64 Type;
+ UINTN Size;
+ CHAR16 *Name;
+ STRING_REF Token;
+} FILE_TYPE;
+EFI_FILE_PROTOCOL *gFs = NULL;
+EFI_GUID gSimpleFileSystemGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
+AMI_POST_MANAGER_PROTOCOL *mPostMgr = NULL;
+static EFI_HANDLE *gSmplFileSysHndlBuf = NULL; //EIP:51378 Global variable gHandleBuffer changed to gSmplFileSysHndlBuf because of the conflict with HddSecurity module, which already using gHandleBuffer.
+BOOLEAN gValidOption = FALSE;
+UINT16 gSelIdx = 0;/// EIP-41615: End
+UINTN gDelOptionCount;
+BOOT_DATA *gDelBootData;
+UINTN gFsCount;
+FS_DATA *gFsList;
+UINTN gDriverDelOptionCount; //EIP70421 & 70422 Support for driver order
+BOOT_DATA *gDelDriverData; //EIP70421 & 70422 Support for driver order
+///////////////////////////////////////////////////////
+/// EXTERN VARIABLES
+///////////////////////////////////////////////////////
+extern UINTN gDelBootOptionReserved;
+extern UINTN gAddBootOptionEmpty;
+extern UINTN gAddDriverOptionEmpty;
+///////////////////////////////////////////////////////
+/// FUNCTION DECLARATIONS
+///////////////////////////////////////////////////////
+EFI_DEVICE_PATH_PROTOCOL *_BootBuildFileDevicePath( UINT32 *index, CHAR16 *fileName );
+VOID BbsStrnCpy ( CHAR16 *Dst, CHAR16 *Src, UINTN Length );
+VOID _GetFsLists (VOID);
+UINT16 *_DevicePathToStr(EFI_DEVICE_PATH_PROTOCOL *Path);
+VOID FixHiddenOptions (BOOLEAN, UINT16 **, UINTN);
+UINT16 _BootSetBootNowCount(VOID);
+EFI_STATUS ShowPostMsgBox(IN CHAR16 *MsgBoxTitle,IN CHAR16 *Message,IN UINT8 MsgBoxType, UINT8 *pSelection);//EIP:41615
+EFI_STATUS FileBrowserLaunchFilePath(UINT32 Variable);
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TseUpdateAddDeleteBootVar
+//
+// Description: Function to update add and delete boot variables
+//
+// Input: None
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+void TseUpdateAddDeleteBootVar(void)
+{
+ UINT16 u16DelOption;
+ EFI_GUID DelBootOptionGuid = DEL_BOOT_OPTION_GUID;
+ EFI_GUID AddBootOptionGuid = ADD_BOOT_OPTION_GUID;
+ NEW_BOOT_OPTION AddBootOption;
+
+ //Set del boot option var
+ u16DelOption = DISABLED_BOOT_OPTION;
+ VarSetNvramName( L"DelBootOption", &DelBootOptionGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS, &u16DelOption, sizeof(UINT16) );
+
+ //Set AddBootOption variable
+ _GetFsLists ();
+ MemSet(&AddBootOption, sizeof(NEW_BOOT_OPTION),0);
+ AddBootOption.FsCount = (UINT16)gFsCount;
+ VarSetNvramName( L"AddBootOption", &AddBootOptionGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS, &AddBootOption, sizeof(NEW_BOOT_OPTION) );
+
+}
+
+//EIP70421 & 70422 Support for driver order
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TseUpdateAddDeleteDriverVar
+//
+// Description: Function to update add and delete driver variables
+//
+// Input: None
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+void TseUpdateAddDeleteDriverVar (void)
+{
+ UINT16 u16DelOption;
+ EFI_GUID DelDriverOptionGuid = DEL_DRIVER_OPTION_GUID;
+ EFI_GUID AddDriverOptionGuid = ADD_DRIVER_OPTION_GUID;
+ NEW_DRIVER_OPTION AddDriverOption;
+
+ //Set del driver option var
+ u16DelOption = DISABLED_DRIVER_OPTION;
+ VarSetNvramName (L"DelDriverOption", &DelDriverOptionGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS, &u16DelOption, sizeof (UINT16));
+
+ //Set AddDriverOption variable
+ _GetFsLists();
+ MemSet (&AddDriverOption, sizeof (NEW_DRIVER_OPTION), 0);
+ AddDriverOption.FsCount = (UINT16)gFsCount;
+ VarSetNvramName (L"AddDriverOption", &AddDriverOptionGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS, &AddDriverOption, sizeof (NEW_DRIVER_OPTION));
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _GetFsLists
+//
+// Description: function to get the file system details
+//
+// Input: None
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _GetFsLists (VOID)
+{
+ UINTN Count,i;
+ EFI_HANDLE *HandleBuffer;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *Str;
+ EFI_STATUS Status;
+
+ //Find all handles supporting Simple File Sys Protocol
+ if (0 == gFsCount) //EIP70421 Support for driver order; No need of calling continuously boot then driver, one call is enough to set gFsCount
+ {
+ Status = gBS->LocateHandleBuffer(
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &Count,
+ &HandleBuffer
+ );
+ if(EFI_ERROR(Status))
+ return;
+
+ for(i=0;i<Count;i++)
+ {
+ DevicePath = NULL;
+ Status = gBS->OpenProtocol (
+ HandleBuffer[i],
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ NULL,
+ HandleBuffer[i],
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if(EFI_ERROR(Status))
+ continue;
+ if(!DevicePath)
+ continue;
+ Str = NULL;
+ Str = _DevicePathToStr(DevicePath);
+
+ gFsList = MemReallocateZeroPool(gFsList, gFsCount * sizeof(FS_DATA), (gFsCount + 1) * sizeof(FS_DATA));
+ gFsList[gFsCount].FsId = Str ? Str : StrDup(L"Unknown");
+ gFsList[gFsCount].FsPath = DevicePath;
+
+ gFsCount++;
+ }
+ }
+}
+
+static UINT16 DefaultDevicePath[]=L"DevicePath(Type %x, SubType %x)";
+
+static UINT16 *HWDP[] = {
+ L"PCI(%X|%X)\\", //HW_PCI_DP
+ L"Pccard(Socket %x)\\", //HW_PCCARD_DP
+ L"VenHw(%g)\\" //HW_VENDOR_DP
+};
+
+/*Uncomment if ACPI details are necessary
+static UINT16 *ACPIDP[] = {
+ L"Acpi(%x, %x)\\" //ACPI_DP
+};*/
+
+static UINT16 *MSGDP[] = {
+ L"ATA(%s,%s)\\", //MSG_ATAPI_DP
+ L"SCSI(%x,%x)\\", //MSG_SCSI_DP
+ L"VenMsg(%g)\\" //MSG_VENDOR_DP
+};
+
+static UINT16 *MEDIADP[] = {
+ L"CDROM(Entry%x)\\", //MEDIA_CDROM_DP
+ L"VenMedia(%g)\\", //MEDIA_VENDOR_DP
+ L"%g\\" //MEDIA_FILEPATH_DP
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _HWToStr
+//
+// Description: Convert Device Path of type to string.
+//
+// Input:
+// IN EFI_DEVICE_PATH_PROTOCOL *Path - Device Path
+// OUT UINT16 *Str - String form of device path.
+//
+// Output:
+// int - number of characters not including \0 or -1 if error.
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _HWToStr(
+ EFI_DEVICE_PATH_PROTOCOL *Path,
+ UINT16 *Str
+ )
+{
+ switch(Path->SubType)
+ {
+ case HW_PCI_DP:
+ return SPrint(Str,0,HWDP[0],((PCI_DEVICE_PATH*)Path)->Device,((PCI_DEVICE_PATH*)Path)->Function);
+ case HW_PCCARD_DP:
+ return SPrint(Str,0,HWDP[1],((AMITSE_PCCARD_DEVICE_PATH*)Path)->FunctionNumber);
+ case HW_VENDOR_DP:
+ return SPrint(Str,0,HWDP[2],&((VENDOR_DEVICE_PATH*)Path)->Guid);
+ }
+
+ return SPrint(Str,0,DefaultDevicePath,Path->Type,Path->SubType);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ACPIToStr
+//
+// Description: Convert Device Path of type to string.
+//
+// Input:
+// IN EFI_DEVICE_PATH_PROTOCOL *Path - Device Path
+// OUT UINT16 *Str - String form of device path.
+//
+// Output:
+// int - number of characters not including \0 or -1 if error.
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+/*
+Uncomment below code if ACPI details are necessary.
+CAUTION: If ACPI details are included then the string becomes too big
+to display
+*/
+/*
+UINTN ACPIToStr(
+ EFI_DEVICE_PATH_PROTOCOL *Path,
+ UINT16 *Str
+ )
+{
+ switch(Path->SubType)
+ {
+ case ACPI_DP:
+ return SPrint(Str,0,ACPIDP[0], ((ACPI_HID_DEVICE_PATH*)Path)->HID, ((ACPI_HID_DEVICE_PATH*)Path)->UID);
+ }
+ return SPrint(Str,0,DefaultDevicePath,Path->Type,Path->SubType);
+}
+*/
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _MSGToStr
+//
+// Description: Convert Device Path of type to string.
+//
+// Input:
+// IN EFI_DEVICE_PATH_PROTOCOL *Path - Device Path
+// OUT UINT16 *Str - String form of device path.
+//
+// Output:
+// int - number of characters not including \0 or -1 if error.
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _MSGToStr(
+ EFI_DEVICE_PATH_PROTOCOL *Path,
+ UINT16 *Str
+ )
+{
+ switch(Path->SubType)
+ {
+ case MSG_ATAPI_DP:
+ return SPrint(Str,0,MSGDP[0],
+ ((ATAPI_DEVICE_PATH*)Path)->PrimarySecondary ? L"Sec" : L"Pri",
+ ((ATAPI_DEVICE_PATH*)Path)->SlaveMaster ? L"Sl" :L"Ma");
+ case MSG_SCSI_DP:
+ return SPrint(Str,0,MSGDP[1], ((SCSI_DEVICE_PATH*)Path)->Pun, ((SCSI_DEVICE_PATH*)Path)->Lun);
+ case MSG_VENDOR_DP:
+ return SPrint(Str,0,MSGDP[2], ((VENDOR_DEVICE_PATH*)Path)->Guid);
+ case MSG_USB_DP:
+ return SPrint(Str,0,L"USB(%x,%x)\\",
+ ((USB_DEVICE_PATH*)Path)->ParentPortNumber,((USB_DEVICE_PATH*)Path)->InterfaceNumber);
+
+ }
+ return SPrint(Str,0,DefaultDevicePath,Path->Type,Path->SubType);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _MEDIAToStr
+//
+// Description: Convert Device Path of type to string.
+//
+// Input:
+// IN EFI_DEVICE_PATH_PROTOCOL *Path - Device Path
+// OUT UINT16 *Str - String form of device path.
+//
+// Output:
+// int - number of characters not including \0 or -1 if error.
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _MEDIAToStr(
+ EFI_DEVICE_PATH_PROTOCOL *Path,
+ UINT16 *Str
+ )
+{
+ switch(Path->SubType)
+ {
+ case MEDIA_HARDDRIVE_DP:
+ {
+ HARDDRIVE_DEVICE_PATH *Hd = (HARDDRIVE_DEVICE_PATH *)Path;
+ switch(Hd->SignatureType)
+ {
+ case SIGNATURE_TYPE_MBR:
+ return SPrint(Str,0,L"HD(Part%d,Sig%08X)", Hd->PartitionNumber, *((UINT32 *)(&(Hd->Signature[0]))));
+ case SIGNATURE_TYPE_GUID:
+ return SPrint(Str,0, L"HD(Part%d,Sig%g)", Hd->PartitionNumber, (EFI_GUID *) &(Hd->Signature[0]));
+ default:
+ return SPrint(Str,0,L"HD(Part%d,MBRType=%02x,SigType=%02x)",
+ Hd->PartitionNumber,
+ Hd->MBRType,
+ Hd->SignatureType
+ );
+ }
+ }
+ case MEDIA_CDROM_DP:
+ return SPrint(Str,0,MEDIADP[0], ((CDROM_DEVICE_PATH*)Path)->BootEntry);
+ case MEDIA_VENDOR_DP:
+ return SPrint(Str,0,MEDIADP[1], ((VENDOR_DEVICE_PATH*)Path)->Guid);
+ case MEDIA_FILEPATH_DP:
+ return SPrint(Str,0,MEDIADP[2], &((AMITSE_MEDIA_FW_VOL_FILEPATH_DEVICE_PATH*)Path)->FvFileName);
+ }
+ return SPrint(Str,0,DefaultDevicePath,Path->Type,Path->SubType);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _UnknownToStr
+//
+// Description: Convert Device Path of type to string.
+//
+// Input:
+// IN EFI_DEVICE_PATH_PROTOCOL *Path - Device Path
+// OUT UINT16 *Str - String form of device path.
+//
+// Output:
+// int - number of characters not including \0 or -1 if error.
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _UnknownToStr(
+ EFI_DEVICE_PATH_PROTOCOL *Path,
+ UINT16 *Str
+ )
+{
+ return SPrint(Str,0,DefaultDevicePath,Path->Type,Path->SubType);
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DevicePathToStr
+//
+// Description: Convert Device Path of type to string. Str is allocated by
+// this routine. It must be freed by the caller.
+//
+// Input:
+// IN EFI_DEVICE_PATH_PROTOCOL *Path - Device Path
+//
+//
+// Output:
+// OUT UINT16 *Str - String form of device path.
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT16 *_DevicePathToStr(EFI_DEVICE_PATH_PROTOCOL *Path)
+{
+ CHAR16 Buffer[512];
+ CHAR16 *p = Buffer, *Str = NULL;
+ UINTN Count = 0;
+ UINTN Length;
+
+ MemSet(Buffer,sizeof(Buffer),0);
+ for(;;)
+ {
+ switch(Path->Type)
+ {
+ case HARDWARE_DEVICE_PATH:
+ Count = _HWToStr(Path, p);
+ break;
+ case ACPI_DEVICE_PATH:
+/*
+Uncomment below code if ACPI details are necessary.
+CAUTION: If ACPI details are included then the string becomes too big
+to display
+*/
+/*
+ Count = SPrint(p,0,L"Acpi\\");
+ ACPIToStr(Path, p);
+*/
+ break;
+ case MESSAGING_DEVICE_PATH:
+ Count = _MSGToStr(Path, p);
+ break;
+ case MEDIA_DEVICE_PATH:
+ Count = _MEDIAToStr(Path, p);
+ break;
+ case END_DEVICE_PATH_TYPE:
+ Count = 0;
+ break;
+ case END_ENTIRE_DEVICE_PATH_SUBTYPE:
+ *p = L'|';
+ *(p+1) = L'\0';
+ Count = 1;
+ break;
+ default:
+ Count = _UnknownToStr(Path, p);
+ }
+
+ p += EfiStrLen(p);
+
+ if (Count == -1) return NULL;
+ if (IsDevicePathEnd(Path)) break;
+
+ Path = NextDevicePathNode(Path);
+ }
+
+ Length = (UINTN)p - (UINTN)Buffer;
+
+ Str = (UINT16 *)EfiLibAllocateZeroPool(Length+sizeof(UINT16));
+
+ MemCopy(Str, Buffer, Length);
+
+ return Str;
+}
+
+//EIP70421 & 70422 Support for driver order
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------------------------
+// Procedure: _DisableRestorePrevOptions
+//
+// Description: Function to make the boot/driver option as disable in bootorder/driverorder
+// if it is inactive and non hidden
+//
+//
+// Input: BOOLEAN , UINT16 **, UINTN
+//
+// Output: VOID
+//
+//-------------------------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _DisableRestorePrevOptions (BOOLEAN Option, UINT16 **Order, UINTN OptionCount)
+{
+ UINTN iIndex = 0;
+ BOOT_DATA *pBootData;
+
+ if (0 == OptionCount)
+ {
+ return;
+ }
+ for (iIndex = 0; iIndex < OptionCount; iIndex ++)
+ {
+ if (BOOT_ORDER_OPTION == Option)
+ {
+ pBootData = BootGetBootData ((*Order) [iIndex]);
+ }
+ else
+ {
+ pBootData = DriverGetDriverData ((*Order) [iIndex]);
+ }
+ if (pBootData)
+ {
+ if ( (!(pBootData->Active & LOAD_OPTION_ACTIVE)) && (!(pBootData->Active & LOAD_OPTION_HIDDEN)) )
+ {
+ (*Order) [iIndex] = DISABLED_BOOT_OPTION;
+ }
+ }
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: BootAddBootOption
+//
+// Description: Function to add boot option
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID BootAddBootOption( VOID )
+{
+ UINTN i,size;
+ UINT16 u16Option;
+ NEW_BOOT_OPTION *newBoot = NULL, *tmpPtr;
+ CHAR16 *fileName;
+ UINT32 index;
+ EFI_DEVICE_PATH_PROTOCOL *devicePath;
+ UINT16 *NewBootOrder = NULL, *CurrBootOrder = NULL;
+ UINT16 BootCountVal;
+ CHAR16 *BootNameBuf = NULL; //EIP:34119
+ EFI_STATUS Status;
+ //Get input
+ size = 0;
+ Status = gBS->LocateProtocol(&gAmiPostManagerProtocolGuid, NULL,(void**) &mPostMgr);
+ if(Status != EFI_SUCCESS)
+ return;
+ newBoot = VarGetVariable( VARIABLE_ID_ADD_BOOT_OPTION, &size );
+ //EIP-75352 Suppress the warnings from static code analyzer
+ if (NULL == newBoot){
+ return;
+ }
+
+//EIP:34119 - Start
+ //Fix EIP:29095 - not to create boot option with out a name
+ if (( EfiStrLen( newBoot->Path ) == 0 ) || ( EfiStrLen(newBoot->Label) == 0 ))
+ {
+ // CallbackShowMessageBox( (UINTN)gAddBootOptionEmpty, MSGBOX_TYPE_OK );
+
+ mPostMgr->DisplayMsgBox( L"WARNING", L"Please set Boot Option Name and File Path", MSGBOX_TYPE_OK,NULL);
+ return;
+ }
+ BootNameBuf = EfiLibAllocateZeroPool( sizeof(newBoot->Label)+2 );
+ BbsStrnCpy( BootNameBuf, newBoot->Label, (sizeof(newBoot->Label))/2 );
+//EIP:34119 - End
+
+ // cleanup old data
+ tmpPtr = EfiLibAllocateZeroPool( size );
+ tmpPtr->FsCount = (UINT16)gFsCount;
+ VarSetValue( VARIABLE_ID_ADD_BOOT_OPTION, 0, size, tmpPtr );
+ MemFreePointer( (VOID **)&tmpPtr );
+
+ fileName = newBoot->Path;
+
+ index = newBoot->SelFs;
+
+ devicePath = _BootBuildFileDevicePath( &index, fileName );
+ if ( devicePath != NULL )
+ {
+ EFI_DEVICE_PATH_PROTOCOL *TmpDevPath, *HddMediaPath;
+
+ //Find a free option number
+ for ( u16Option = 0; u16Option < MAX_BOOT_OPTIONS; u16Option++ )
+ {
+ for(i=0;i<gBootOptionCount;i++)
+ {
+ if(gBootData[i].Option == u16Option)
+ break;
+ }
+ if(i<gBootOptionCount)
+ continue;
+ for(i=0;i<gDelOptionCount;i++)
+ {
+ if(gDelBootData[i].Option == u16Option)
+ break;
+ }
+ if(i<gDelOptionCount)
+ continue;
+
+ break;//The desired option number is in u16Option
+ }
+
+ if ( u16Option == MAX_BOOT_OPTIONS ) //Not possible
+ return;
+
+ gBootData = MemReallocateZeroPool(gBootData, gBootOptionCount * sizeof(BOOT_DATA), (gBootOptionCount + 1) * sizeof(BOOT_DATA) );
+
+ gBootData[gBootOptionCount].Option = u16Option;
+ gBootData[gBootOptionCount].Active |= LOAD_OPTION_ACTIVE;
+//EIP:34119 - Fix to solve issues, if the boot option name is set with max number of characters allowed.
+ //gBootData[gBootOptionCount].Name = StrDup( newBoot->Label );
+ gBootData[gBootOptionCount].Name = BootNameBuf;
+//EIP:34119 - End
+
+ //For a hard drive start the dev path from the partition
+ for( TmpDevPath = devicePath;
+ !IsDevicePathEndType(TmpDevPath);
+ TmpDevPath=NextDevicePathNode(TmpDevPath)
+ )
+ {
+ if(TmpDevPath->Type==MEDIA_DEVICE_PATH && TmpDevPath->SubType==MEDIA_HARDDRIVE_DP)
+ {
+ HddMediaPath = EfiLibAllocateZeroPool(EfiDevicePathSize(TmpDevPath));
+ MemCopy(HddMediaPath, TmpDevPath, EfiDevicePathSize(TmpDevPath));
+ MemFreePointer((VOID **)&devicePath);
+ devicePath = HddMediaPath;
+ break;
+ }
+ }
+ gBootData[gBootOptionCount].DevicePath = devicePath;
+ gBootData[gBootOptionCount].bNewOption = TRUE;
+
+ size = 0;
+ CurrBootOrder = VarGetVariable(VARIABLE_ID_BOOT_ORDER, &size);
+ //EIP-75352 Suppress the warnings from static code analyzer
+/* if (NULL == CurrBootOrder){ //If file system available and no boot option presents then add boot option always fails so commenting it.
+ return;
+ }*/
+ NewBootOrder = EfiLibAllocateZeroPool((gBootOptionCount+1) * sizeof(UINT16));
+
+ for(i=0;i<gBootOptionCount;i++)
+ {
+ if(DISABLED_BOOT_OPTION == CurrBootOrder[i])
+ break;
+ NewBootOrder[i] = CurrBootOrder[i];
+ }
+ if (i < gBootOptionCount) //Preserve the hidden options at last
+ {
+ MemCpy (NewBootOrder+i+1, CurrBootOrder+i, (gBootOptionCount-i)*2);
+ }
+ NewBootOrder [i] = u16Option;
+ //i ++;
+ MemFreePointer ((VOID **) &CurrBootOrder);
+ gBootOptionCount ++;
+ MemFreePointer ((VOID **)&newBoot);
+
+ //Update boot manager vars in memory
+ //1. TSE Boot order
+ MemFreePointer((VOID **) &gVariableList[VARIABLE_ID_BOOT_ORDER].Buffer);
+ if (gLoadOptionHidden) //Move hidden options to last
+ {
+ FixHiddenOptions (BOOT_ORDER_OPTION, &NewBootOrder, gBootOptionCount);
+ }
+ gVariableList[VARIABLE_ID_BOOT_ORDER].Buffer = (UINT8 *)NewBootOrder;
+ gVariableList[VARIABLE_ID_BOOT_ORDER].Size = gBootOptionCount * sizeof(UINT16);
+
+ //2. BootManager
+ BootCountVal = (UINT16)gBootOptionCount;
+ VarSetValue(VARIABLE_ID_BOOT_MANAGER, 0, sizeof(UINT16), (VOID *)(&BootCountVal));
+
+ //3. Set Boot now count
+ if(gShowAllBbsDev)
+ BootCountVal = _BootSetBootNowCount();
+
+ Status = VarSetValue(VARIABLE_ID_BOOT_NOW, 0, sizeof(UINT16), (VOID *)(&BootCountVal));
+ if(Status == EFI_SUCCESS)
+ mPostMgr->DisplayMsgBox( L"SUCCESS", L"Boot Option Created Successfully", MSGBOX_TYPE_OK,NULL);
+ }
+}
+
+//EIP70421 & 70422 Support for driver order
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DriverAddDriverOption
+//
+// Description: Function to add driver options
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DriverAddDriverOption(VOID)
+{
+ UINTN i,size;
+ UINT16 u16Option;
+ NEW_DRIVER_OPTION *newDriver = NULL, *tmpPtr;
+ CHAR16 *fileName;
+ UINT32 index;
+ EFI_DEVICE_PATH_PROTOCOL *devicePath;
+ UINT16 *NewDriverOrder = NULL, *CurrDriverOrder = NULL;
+ UINT16 DriverCountVal;
+ CHAR16 *BootNameBuf = NULL;
+ EFI_STATUS Status;
+ //Get input
+ size = 0;
+ Status = gBS->LocateProtocol(&gAmiPostManagerProtocolGuid, NULL,(void**) &mPostMgr);
+ if(Status != EFI_SUCCESS)
+ return;
+ newDriver = VarGetVariable( VARIABLE_ID_ADD_DRIVER_OPTION, &size );
+ if (( EfiStrLen (newDriver->DriverPath) == 0 ) || (EfiStrLen (newDriver->Label) == 0))
+ {
+ //CallbackShowMessageBox( (UINTN)gAddDriverOptionEmpty, MSGBOX_TYPE_OK );
+
+ mPostMgr->DisplayMsgBox( L"WARNING", L"Please set Driver Option Name and File Path", MSGBOX_TYPE_OK,NULL);
+ return;
+ }
+
+ BootNameBuf = EfiLibAllocateZeroPool( sizeof(newDriver->Label)+2 );
+ BbsStrnCpy( BootNameBuf, newDriver->Label, (sizeof(newDriver->Label))/2 );
+
+ // cleanup old data
+ tmpPtr = EfiLibAllocateZeroPool( size );
+ tmpPtr->FsCount = (UINT16)gFsCount;
+ VarSetValue( VARIABLE_ID_ADD_DRIVER_OPTION, 0, size, tmpPtr );
+ MemFreePointer( (VOID **)&tmpPtr );
+
+ fileName = newDriver->DriverPath;
+
+ index = newDriver->SelFs;
+
+ devicePath = _BootBuildFileDevicePath( &index, fileName );
+
+ if ( devicePath != NULL )
+ {
+// EFI_DEVICE_PATH_PROTOCOL *TmpDevPath, *HddMediaPath;
+
+ //Find a free option number
+ for ( u16Option = 0; u16Option < MAX_BOOT_OPTIONS; u16Option++ )
+ {
+ for(i=0;i<gDriverOptionCount;i++)
+ {
+ if(gDriverData[i].Option == u16Option)
+ break;
+ }
+ if(i<gDriverOptionCount)
+ continue;
+ for(i=0;i<gDriverDelOptionCount;i++)
+ {
+ if(gDelDriverData[i].Option == u16Option)
+ break;
+ }
+ if(i<gDriverDelOptionCount)
+ continue;
+
+ break;//The desired option number is in u16Option
+ }
+
+ if ( u16Option == MAX_BOOT_OPTIONS ) //Not possible
+ return;
+
+ gDriverData = MemReallocateZeroPool(gDriverData, gDriverOptionCount * sizeof(BOOT_DATA), (gDriverOptionCount + 1) * sizeof(BOOT_DATA) );
+
+ gDriverData[gDriverOptionCount].Option = u16Option;
+ gDriverData[gDriverOptionCount].Active |= LOAD_OPTION_ACTIVE;
+//EIP:34119 - Fix to solve issues, if the boot option name is set with max number of characters allowed.
+ //gBootData[gBootOptionCount].Name = StrDup( newDriver->Label );
+ gDriverData[gDriverOptionCount].Name = BootNameBuf;
+//EIP:34119 - End
+
+ /*
+ //TSE will append hard drive device path at front if it is MEDIA_DEVICE_PATH but core needs fullpath so commented below
+ //For a hard drive start the dev path from the partition
+ for( TmpDevPath = devicePath;
+ !IsDevicePathEndType(TmpDevPath);
+ TmpDevPath=NextDevicePathNode(TmpDevPath)
+ )
+ {
+ if(TmpDevPath->Type==MEDIA_DEVICE_PATH && TmpDevPath->SubType==MEDIA_HARDDRIVE_DP)
+ {
+ HddMediaPath = EfiLibAllocateZeroPool(EfiDevicePathSize(TmpDevPath));
+ MemCopy(HddMediaPath, TmpDevPath, EfiDevicePathSize(TmpDevPath));
+ MemFreePointer((VOID **)&devicePath);
+ devicePath = HddMediaPath;
+ break;
+ }
+ }*/
+
+ gDriverData[gDriverOptionCount].DevicePath = devicePath;
+ gDriverData[gDriverOptionCount].bNewOption = TRUE;
+
+ size = 0;
+ CurrDriverOrder = VarGetVariable(VARIABLE_ID_DRIVER_ORDER, &size);
+ NewDriverOrder = EfiLibAllocateZeroPool((gDriverOptionCount+1) * sizeof(UINT16));
+
+ for(i=0;i<gDriverOptionCount;i++)
+ {
+ if(DISABLED_DRIVER_OPTION == CurrDriverOrder[i])
+ break;
+ NewDriverOrder[i] = CurrDriverOrder[i];
+ }
+ if (i < gDriverOptionCount) //Preserve the hidden options at last
+ {
+ MemCpy (NewDriverOrder+i+1, CurrDriverOrder+i, (gDriverOptionCount-i)*2);
+ }
+
+ NewDriverOrder[i] = u16Option;
+ //i++;
+
+ MemFreePointer((VOID **) &CurrDriverOrder);
+
+ gDriverOptionCount ++;
+
+ MemFreePointer( (VOID **)&newDriver );
+
+ //Update boot manager vars in memory
+ //1. TSE driver order
+ MemFreePointer((VOID **) &gVariableList[VARIABLE_ID_DRIVER_ORDER].Buffer);
+ if (gLoadOptionHidden) //Move the hidden options to last
+ {
+ FixHiddenOptions (DRIVER_ORDER_OPTION, &NewDriverOrder, gDriverOptionCount);
+ }
+ gVariableList[VARIABLE_ID_DRIVER_ORDER].Buffer = (UINT8 *)NewDriverOrder;
+ gVariableList[VARIABLE_ID_DRIVER_ORDER].Size = gDriverOptionCount * sizeof(UINT16);
+
+ //2. DriverManager
+ DriverCountVal = (UINT16)gDriverOptionCount;
+ Status = VarSetValue(VARIABLE_ID_DRIVER_MANAGER, 0, sizeof(UINT16), (VOID *)(&DriverCountVal));
+ if(Status == EFI_SUCCESS)
+ mPostMgr->DisplayMsgBox( L"SUCCESS", L"Driver Option Created Successfully", MSGBOX_TYPE_OK,NULL);
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: BootDelBootOption
+//
+// Description: Function to handle the del boot option
+//
+// Input: UINT16 index
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID BootDelBootOption( UINT16 index )
+{
+ UINTN i,j,k, size;
+ BOOT_DATA *pBootData = NULL;
+ UINT16 BootCountVal;
+ UINT16 *NewBootOrder = NULL, *CurrBootOrder = NULL;
+ EFI_STATUS Status=EFI_UNSUPPORTED;
+ VOID * UnicodeInterface;
+ CHAR16 *ResStr = NULL;
+ CHAR16 *TmpStr = NULL;
+
+ // If it BBS device we should not delete it.
+ // FIX......to check for the correct Boot option.
+ Status = gBS->LocateProtocol(&gAmiPostManagerProtocolGuid, NULL,(void**) &mPostMgr);
+ if(Status != EFI_SUCCESS)
+ return;
+ for(i=0; i<gBootOptionCount; i++)
+ {
+ if(index == gBootData[i].Option)
+ {
+ if(gBootData[i].DevicePath->Type == BBS_DEVICE_PATH && gBootData[i].DevicePath->SubType == BBS_BBS_DP)
+ return;
+
+ ///Fix: Eip-27161 - not to allow Reserved boot options to delete
+ if( ( IsReservedBootOptionNamesEnable() ) &&
+ ( gBootData[i].Name ) )
+ {
+ ResStr = CONVERT_TO_WSTRING(RESERVED_ADD_DEL_BOOT_OPTION_NAME);
+ TmpStr = EfiLibAllocateZeroPool( EfiStrLen(ResStr)+1 );
+ BbsStrnCpy(TmpStr, gBootData[i].Name, (EfiStrLen(ResStr)+1) );
+ TmpStr[EfiStrLen(ResStr)]= L'\0';
+ Status = InitUnicodeCollectionProtocol(&UnicodeInterface);
+ if(!EFI_ERROR(Status)) {
+ if( StringColl( UnicodeInterface, TmpStr, ResStr) == 0 )
+ {
+ //CallbackShowMessageBox( (UINTN)gDelBootOptionReserved, MSGBOX_TYPE_OK );
+ mPostMgr->DisplayMsgBox( L"WARNING", L"Reserved Boot Option, can not be Deleted", MSGBOX_TYPE_OK,NULL);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ //Remove option from gBootData and add to gDelBootData
+ //Remove option from BootOrder
+ if(gBootOptionCount - 1)
+ {
+ pBootData = EfiLibAllocateZeroPool(sizeof(BOOT_DATA) * (gBootOptionCount - 1));
+ NewBootOrder = EfiLibAllocateZeroPool(sizeof(UINT16) * (gBootOptionCount - 1));
+ }
+
+ size = 0;
+ CurrBootOrder = VarGetVariable(VARIABLE_ID_BOOT_ORDER, &size);
+ //EIP-75352 Suppress the warnings from static code analyzer
+ if (NULL == CurrBootOrder){
+ return;
+ }
+
+ gDelBootData = MemReallocateZeroPool(gDelBootData, sizeof(BOOT_DATA) * gDelOptionCount, sizeof(BOOT_DATA) * (gDelOptionCount + 1));
+
+ for(i=0,j=0,k=0; i<gBootOptionCount; i++)
+ {
+ if(index == gBootData[i].Option)
+ {
+ MemCopy(gDelBootData + gDelOptionCount, gBootData + i, sizeof(BOOT_DATA));
+ }
+ else
+ {
+ MemCopy(pBootData + j, gBootData + i, sizeof(BOOT_DATA));
+ j++;
+ }
+
+ if(index != CurrBootOrder[i])
+ {
+ if(k<(gBootOptionCount-1))
+ {
+ NewBootOrder[k] = CurrBootOrder[i];
+ k++;
+ }
+ }
+ }
+
+ gDelOptionCount++;
+ gBootOptionCount--;
+
+ MemFreePointer((VOID **)&gBootData);
+ gBootData = pBootData;
+
+ MemFreePointer((VOID **)&CurrBootOrder);
+
+ //Update boot manager vars in memory
+ //1. TSE Boot order
+ MemFreePointer((VOID **) &gVariableList[VARIABLE_ID_BOOT_ORDER].Buffer);
+ if (gLoadOptionHidden) //Move the hidden options to last
+ {
+ FixHiddenOptions (BOOT_ORDER_OPTION, &NewBootOrder, gBootOptionCount);
+ }
+ gVariableList[VARIABLE_ID_BOOT_ORDER].Buffer = (UINT8 *)NewBootOrder;
+ gVariableList[VARIABLE_ID_BOOT_ORDER].Size = gBootOptionCount * sizeof(UINT16);
+
+ //2. BootManager
+ BootCountVal = (UINT16)gBootOptionCount;
+ VarSetValue(VARIABLE_ID_BOOT_MANAGER,0,sizeof(UINT16),(VOID *)(&BootCountVal));
+
+ //3. Set Boot now count
+ if(gShowAllBbsDev)
+ BootCountVal = _BootSetBootNowCount();
+
+ Status = VarSetValue(VARIABLE_ID_BOOT_NOW,0,sizeof(UINT16),(VOID *)(&BootCountVal));
+ if(EFI_SUCCESS == Status)
+ mPostMgr->DisplayMsgBox( L"SUCCESS", L"Boot Option Deleted Successfully", MSGBOX_TYPE_OK,NULL);
+}
+
+//EIP70421 & 70422 Support for driver order
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DriverDelDriverOption
+//
+// Description: Function to handle the del Driver option
+//
+// Input: UINT16 index
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DriverDelDriverOption( UINT16 index )
+{
+ UINTN i,j,k, size;
+ BOOT_DATA *pDriverData = NULL;
+ UINT16 DriverCountVal;
+ UINT16 *NewDriverOrder = NULL, *CurrDriverOrder = NULL;
+ EFI_STATUS Status=EFI_UNSUPPORTED;
+// VOID * UnicodeInterface;
+ CHAR16 *ResStr = NULL;
+ CHAR16 *TmpStr = NULL;
+
+ if ((NULL == gDriverData) || (0 == gDriverOptionCount))
+ return;
+ Status = gBS->LocateProtocol(&gAmiPostManagerProtocolGuid, NULL,(void**) &mPostMgr);
+ if(Status != EFI_SUCCESS)
+ return;
+ for(i=0; i<gDriverOptionCount; i++)
+ {
+ if(index == gDriverData[i].Option)
+ {
+ if(gDriverData[i].DevicePath->Type == BBS_DEVICE_PATH && gDriverData[i].DevicePath->SubType == BBS_BBS_DP)
+ return;
+ break;
+ }
+ }
+
+ //Remove option from gDriverData and add to gDelDriverData
+ //Remove option from DriverOrder
+ if(gDriverOptionCount - 1)
+ {
+ pDriverData = EfiLibAllocateZeroPool(sizeof(BOOT_DATA) * (gDriverOptionCount - 1));
+ NewDriverOrder = EfiLibAllocateZeroPool(sizeof(UINT16) * (gDriverOptionCount - 1));
+ }
+
+ size = 0;
+ CurrDriverOrder = VarGetVariable(VARIABLE_ID_DRIVER_ORDER, &size);
+
+ gDelDriverData = MemReallocateZeroPool(gDelDriverData, sizeof(BOOT_DATA) * gDriverDelOptionCount, sizeof(BOOT_DATA) * (gDriverDelOptionCount + 1));
+
+ for(i=0,j=0,k=0; i<gDriverOptionCount; i++)
+ {
+ if(index == gDriverData[i].Option)
+ {
+ MemCopy(gDelDriverData + gDriverDelOptionCount, gDriverData + i, sizeof(BOOT_DATA));
+ }
+ else
+ {
+ MemCopy(pDriverData + j, gDriverData + i, sizeof(BOOT_DATA));
+ j++;
+ }
+
+ if(index != CurrDriverOrder[i])
+ {
+ if(k<(gDriverOptionCount-1))
+ {
+ NewDriverOrder[k] = CurrDriverOrder[i];
+ k++;
+ }
+ }
+ }
+
+ gDriverDelOptionCount++;
+ gDriverOptionCount--;
+
+ MemFreePointer((VOID **)&gDriverData);
+ gDriverData = pDriverData;
+
+ MemFreePointer((VOID **)&CurrDriverOrder);
+
+ //Update boot manager vars in memory
+ //1. TSE Driver Order
+ MemFreePointer((VOID **) &gVariableList[VARIABLE_ID_DRIVER_ORDER].Buffer);
+ if (gLoadOptionHidden)
+ {
+ FixHiddenOptions (DRIVER_ORDER_OPTION, &NewDriverOrder, gDriverOptionCount);
+ }
+ gVariableList[VARIABLE_ID_DRIVER_ORDER].Buffer = (UINT8 *)NewDriverOrder;
+ gVariableList[VARIABLE_ID_DRIVER_ORDER].Size = gDriverOptionCount * sizeof(UINT16);
+
+ //2. DriverManager
+ DriverCountVal = (UINT16)gDriverOptionCount;
+ Status = VarSetValue(VARIABLE_ID_DRIVER_MANAGER,0,sizeof(UINT16),(VOID *)(&DriverCountVal));
+ if(EFI_SUCCESS == Status)
+ mPostMgr->DisplayMsgBox( L"SUCCESS", L"Driver Deleted Successfully", MSGBOX_TYPE_OK,NULL);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DiscardAddDelBootOptions
+//
+// Description: Function to discarding the add/del boot option
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DiscardAddDelBootOptions(VOID)
+{
+ UINTN count,i,j;
+ BOOT_DATA *pBootData;
+ UINT16 *AddOptionList=NULL,*DelOptionList=NULL;
+ UINTN AddOptionListCount=0, DelOptionListCount=0;
+ UINT16 *NewBootOrder = NULL, *CurrBootOrder = NULL;
+ UINTN size, tempsize = 0;
+
+ //find no. of boot options
+ count = 0;
+ for(i=0;i<gBootOptionCount;i++)
+ {
+ if(!gBootData[i].bNewOption)
+ count++;
+ else
+ AddOptionListCount++;
+ }
+ for(i=0;i<gDelOptionCount;i++)
+ {
+ if(!gDelBootData[i].bNewOption)
+ count++;
+ else
+ DelOptionListCount++;
+ }
+
+ //Allocate for boot options
+ pBootData = NULL;
+ if(count)
+ pBootData = EfiLibAllocateZeroPool(count * sizeof(BOOT_DATA));
+ if(AddOptionListCount)
+ AddOptionList=EfiLibAllocateZeroPool(AddOptionListCount * sizeof(UINT16));
+ if(DelOptionListCount)
+ DelOptionList=EfiLibAllocateZeroPool(DelOptionListCount * sizeof(UINT16));
+
+ count = 0;
+ AddOptionListCount=0;
+ DelOptionListCount=0;
+
+ //Copy old options
+ for(i=0;i<gBootOptionCount;i++)
+ {
+ if(!gBootData[i].bNewOption)
+ {
+ MemCopy(pBootData+count, gBootData+i, sizeof(BOOT_DATA));
+ count++;
+ }
+ else
+ { // Newly added option that need to removed.
+ AddOptionList[AddOptionListCount++] = gBootData[i].Option;
+ }
+ }
+
+ for(i=0;i<gDelOptionCount;i++)
+ {
+ if(!gDelBootData[i].bNewOption)
+ {
+ MemCopy(pBootData+count, gDelBootData+i, sizeof(BOOT_DATA));
+ count++;
+
+ // deleted option that need to added.
+ DelOptionList[DelOptionListCount++] = gDelBootData[i].Option;
+ }
+ }
+
+ MemFreePointer((VOID **) &gBootData);
+ gBootData = pBootData;
+ gBootOptionCount = count;
+
+ MemFreePointer((VOID **) &gDelBootData);
+ gDelOptionCount = 0;
+
+// EIP 32445
+// Update BootOrderVar Cache after discarding the changes.
+// If newly add/Del option discorded.
+ if(AddOptionListCount || DelOptionListCount)
+ {
+ CurrBootOrder = VarGetVariable(VARIABLE_ID_BOOT_ORDER, &size);
+ NewBootOrder = EfiLibAllocateZeroPool((gBootOptionCount) * sizeof(UINT16));
+ count = size/2;
+
+ // Defaults might be load Move the disabled boot option to the end
+ for(j=0;j<count;j++)
+ {
+ if(DISABLED_BOOT_OPTION == CurrBootOrder[j])
+ {
+ if (size < ((j+1)*sizeof(UINT16))) //EIP-131549
+ tempsize = ((j+1)*sizeof(UINT16)) - size;
+ else
+ tempsize = size - ((j+1)*sizeof(UINT16));
+
+ MemCopy(&CurrBootOrder[j], &CurrBootOrder[j+1], tempsize);
+ size-=sizeof(UINT16);
+ }
+ }
+
+ // remove the Newly added boot options
+ count = size/2;
+ for(i=0;i<AddOptionListCount;i++)
+ {
+ for(j=0;j<count;j++)
+ {
+ if(CurrBootOrder[j] == AddOptionList[i])
+ {
+ if (size < ((j+1)*sizeof(UINT16))) //EIP-131549
+ tempsize = ((j+1)*sizeof(UINT16)) - size;
+ else
+ tempsize = size - ((j+1)*sizeof(UINT16));
+
+ MemCopy(&CurrBootOrder[j], &CurrBootOrder[j+1], tempsize);
+ size-=sizeof(UINT16);
+ }
+ }
+ }
+ count = size/2;
+ // Add the DelOptions
+ MemCopy(NewBootOrder, CurrBootOrder, size);
+ MemCopy(&NewBootOrder[count],DelOptionList,DelOptionListCount*sizeof(UINT16) );
+
+ // Make the remailing options as disabled.
+ for(i=count+DelOptionListCount;i<gBootOptionCount;i++)
+ NewBootOrder[i] = DISABLED_BOOT_OPTION;
+
+ MemFreePointer((VOID **) &CurrBootOrder);
+ MemFreePointer((VOID **) &DelOptionList);
+ MemFreePointer((VOID **) &AddOptionList);
+
+ //Update boot manager vars in memory
+ //1. TSE Boot order
+ MemFreePointer((VOID **) &gVariableList[VARIABLE_ID_BOOT_ORDER].Buffer);
+ if (gLoadOptionHidden)
+ {
+ FixHiddenOptions (BOOT_ORDER_OPTION, &NewBootOrder, gBootOptionCount);
+ }
+ _DisableRestorePrevOptions (BOOT_ORDER_OPTION, &NewBootOrder, gBootOptionCount); //Disable options after discarding changes to active so fixed it
+ gVariableList[VARIABLE_ID_BOOT_ORDER].Buffer = (UINT8 *)NewBootOrder;
+ gVariableList[VARIABLE_ID_BOOT_ORDER].Size = gBootOptionCount * sizeof(UINT16);
+ }
+}
+
+//EIP70421 & 70422 Support for driver order
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DiscardAddDelDriverOptions
+//
+// Description: Function to discarding the add/del driver option
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DiscardAddDelDriverOptions(VOID)
+{
+ UINTN count,i,j;
+ BOOT_DATA *pDriverData;
+ UINT16 *AddOptionList=NULL,*DelOptionList=NULL;
+ UINTN AddOptionListCount=0, DelOptionListCount=0;
+ UINT16 *NewDriverOrder = NULL, *CurrDriverOrder = NULL;
+ UINTN size = 0, tempsize = 0;
+
+ //find no. of boot options
+ count = 0;
+ for(i=0;i<gDriverOptionCount;i++)
+ {
+ if(!gDriverData[i].bNewOption)
+ count++;
+ else
+ AddOptionListCount++;
+ }
+ for(i=0;i<gDriverDelOptionCount;i++)
+ {
+ if(!gDelDriverData[i].bNewOption)
+ count++;
+ else
+ DelOptionListCount++;
+ }
+
+ //Allocate for boot options
+ pDriverData = NULL;
+ if(count)
+ pDriverData = EfiLibAllocateZeroPool(count * sizeof(BOOT_DATA));
+ if(AddOptionListCount)
+ AddOptionList=EfiLibAllocateZeroPool(AddOptionListCount * sizeof(UINT16));
+ if(DelOptionListCount)
+ DelOptionList=EfiLibAllocateZeroPool(DelOptionListCount * sizeof(UINT16));
+
+ count = 0;
+ AddOptionListCount=0;
+ DelOptionListCount=0;
+
+ //Copy old options
+ for(i=0;i<gDriverOptionCount;i++)
+ {
+ if(!gDriverData[i].bNewOption)
+ {
+ MemCopy(pDriverData+count, gDriverData+i, sizeof(BOOT_DATA));
+ count++;
+ }
+ else
+ { // Newly added option that need to removed.
+ AddOptionList[AddOptionListCount++] = gDriverData[i].Option;
+ }
+ }
+
+ for(i=0;i<gDriverDelOptionCount;i++)
+ {
+ if(!gDelDriverData[i].bNewOption)
+ {
+ MemCopy(pDriverData+count, gDelDriverData+i, sizeof(BOOT_DATA));
+ count++;
+
+ // deleted option that need to added.
+ DelOptionList[DelOptionListCount++] = gDelDriverData[i].Option;
+ }
+ }
+
+ MemFreePointer((VOID **) &gDriverData);
+ gDriverData = pDriverData;
+ gDriverOptionCount = count;
+
+ MemFreePointer((VOID **) &gDelDriverData);
+ gDriverDelOptionCount = 0;
+
+// Update DriverOrderVar Cache after discarding the changes.
+// If newly add/Del option discorded.
+ if(AddOptionListCount || DelOptionListCount)
+ {
+ CurrDriverOrder = VarGetVariable(VARIABLE_ID_DRIVER_ORDER, &size);
+ NewDriverOrder = EfiLibAllocateZeroPool((gDriverOptionCount) * sizeof(UINT16));
+ count = size/2;
+
+ // Defaults might be load Move the disabled driver option to the end
+ for(j=0;j<count;j++)
+ {
+ if(DISABLED_BOOT_OPTION == CurrDriverOrder[j])
+ {
+ if (size > ((j+1)*sizeof(UINT16))) //EIP-131549
+ tempsize = size - ((j+1)*sizeof(UINT16));
+ else
+ tempsize = ((j+1)*sizeof(UINT16)) - size;
+
+ MemCopy(&CurrDriverOrder[j], &CurrDriverOrder[j+1], tempsize );
+ size-=sizeof(UINT16);
+ }
+ }
+
+ // remove the Newly added driver options
+ count = size/2;
+ for(i=0;i<AddOptionListCount;i++)
+ {
+ for(j=0;j<count;j++)
+ {
+ if(CurrDriverOrder[j] == AddOptionList[i])
+ {
+ if ((UINTN)size >= ((j+1)*sizeof (UINT16)) ) //Check added bcoz, If only added driver presents and loading defaults will lead to crash
+ {
+ if (size > ((j+1)*sizeof(UINT16))) //EIP-131549
+ tempsize = size - ((j+1)*sizeof(UINT16));
+ else
+ tempsize = ((j+1)*sizeof(UINT16)) - size;
+
+ MemCopy (&CurrDriverOrder [j], &CurrDriverOrder[j+1], tempsize );
+ size-=sizeof(UINT16);
+ }
+ }
+ }
+ }
+
+ count = size/2;
+ // Add the DelOptions
+ MemCopy(NewDriverOrder, CurrDriverOrder, size);
+ MemCopy(&NewDriverOrder[count],DelOptionList,DelOptionListCount*sizeof(UINT16) );
+
+ // Make the remaining options as disabled.
+ for(i=count+DelOptionListCount;i<gDriverOptionCount;i++)
+ NewDriverOrder[i] = DISABLED_BOOT_OPTION;
+
+ MemFreePointer((VOID **) &CurrDriverOrder);
+ MemFreePointer((VOID **) &DelOptionList);
+ MemFreePointer((VOID **) &AddOptionList);
+
+ //Update driver manager vars in memory
+ //1. TSE Driver Order
+ MemFreePointer((VOID **) &gVariableList[VARIABLE_ID_DRIVER_ORDER].Buffer);
+ if (gLoadOptionHidden)
+ {
+ FixHiddenOptions (DRIVER_ORDER_OPTION, &NewDriverOrder, gDriverOptionCount);
+ }
+ _DisableRestorePrevOptions (DRIVER_ORDER_OPTION, &NewDriverOrder, gDriverOptionCount);
+ gVariableList[VARIABLE_ID_DRIVER_ORDER].Buffer = (UINT8 *)NewDriverOrder;
+ gVariableList[VARIABLE_ID_DRIVER_ORDER].Size = gDriverOptionCount * sizeof(UINT16);
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SaveAddDelBootOptions
+//
+// Description: function to save the added/deleted boot option
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SaveAddDelBootOptions(VOID)
+{
+ UINTN i,OptimalIndex,FailsafeIndex,size;
+ UINT16 dpLength,*pNewOptimal, *pOldOptimal, *pNewFailsafe, *pOldFailsafe;
+ BOOT_OPTION *pOption;
+ CHAR16 *varName = L"BootXXXX";
+ UINT16 BootCountVal;
+
+ //Old Boot order defaults are not valid any more. Form the new
+ //defaults by removing deleted options and adding the new options at the end.
+ pNewOptimal = EfiLibAllocateZeroPool( gBootOptionCount * sizeof(UINT16) );
+ pNewFailsafe = EfiLibAllocateZeroPool( gBootOptionCount * sizeof(UINT16) );
+ pOldOptimal = (UINT16 *)gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer;
+ pOldFailsafe = (UINT16 *)gFailsafeDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer;
+ size = gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Size;
+ OptimalIndex = FailsafeIndex = 0;
+
+ //Add existing options first
+ for(i=0;i<size/sizeof(UINT16);i++)
+ {
+ if(BootGetBootData(pOldOptimal[i]))
+ {
+ pNewOptimal[OptimalIndex] = pOldOptimal[i];
+ OptimalIndex++;
+ }
+ if(BootGetBootData(pOldFailsafe[i]))
+ {
+ pNewFailsafe[FailsafeIndex] = pOldFailsafe[i];
+ FailsafeIndex++;
+ }
+ }
+ //Save New boot options
+ for(i=0;i<gBootOptionCount;i++)
+ {
+ if(gBootData[i].bNewOption)
+ {
+ dpLength = (UINT16)EfiDevicePathSize( gBootData[i].DevicePath );
+ size = sizeof(BOOT_OPTION) + sizeof(CHAR16)*EfiStrLen(gBootData[i].Name) + dpLength;
+ pOption = EfiLibAllocateZeroPool( size );
+ pOption->Active = gBootData[i].Active;
+ pOption->PathLength = dpLength;
+ EfiStrCpy( pOption->Name, gBootData[i].Name );
+ MemCopy( (UINT8 *)pOption + size - dpLength, gBootData[i].DevicePath, dpLength );
+
+ SPrint( varName, sizeof(CHAR16) * (EfiStrLen( varName )+1), gBootFormarSpecifier, gBootData[i].Option );
+ VarSetNvramName( varName,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ pOption,
+ size );
+
+ gBootData[i].bNewOption = 0;
+
+ //Append this option in defaults
+ pNewOptimal[OptimalIndex] = gBootData[i].Option;
+ pNewFailsafe[FailsafeIndex] = gBootData[i].Option;
+ OptimalIndex++;
+ FailsafeIndex++;
+ }
+ }
+
+ //Put new defaults in global default repository
+ //If Default order is not found in first time then will take current order.
+ //If any boot options added after that then new boot option always follow the first saved optimized buffer
+ //Removed EIP81581 fixes All the time changing the default buffer is not good
+ if (0 == gOptimalDefaults [VARIABLE_ID_BOOT_ORDER].Size) //EIP79956 Defaults not loading properly
+ {
+ UINT8 *pOptWithOutDefaultBootOrder = EfiLibAllocateZeroPool (gVariableList [VARIABLE_ID_BOOT_ORDER].Size);
+ if (NULL != pOptWithOutDefaultBootOrder)
+ {
+ MemCopy (pOptWithOutDefaultBootOrder, gVariableList [VARIABLE_ID_BOOT_ORDER].Buffer, gVariableList [VARIABLE_ID_BOOT_ORDER].Size);
+ gOptimalDefaults [VARIABLE_ID_BOOT_ORDER].Buffer = pOptWithOutDefaultBootOrder;
+ gOptimalDefaults [VARIABLE_ID_BOOT_ORDER].Size = gVariableList [VARIABLE_ID_BOOT_ORDER].Size;
+ }
+ }
+ else
+ {
+ MemFreePointer( (VOID **) &gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer );
+ gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer = (UINT8 *)pNewOptimal;
+ gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Size = OptimalIndex * sizeof(UINT16);
+ }
+
+ MemFreePointer( (VOID **) &gFailsafeDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer );
+ gFailsafeDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer = (UINT8 *)pNewFailsafe;
+ gFailsafeDefaults[ VARIABLE_ID_BOOT_ORDER ].Size = FailsafeIndex * sizeof(UINT16);
+
+ //Delete removed options
+ for(i=0;i<gDelOptionCount;i++)
+ {
+ if(!gDelBootData[i].bNewOption)
+ {
+ SPrint( varName, sizeof(CHAR16) * (EfiStrLen( varName )+1), gBootFormarSpecifier, gDelBootData[i].Option );
+ VarSetNvramName( varName,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ varName,
+ 0);
+ }
+ }
+ MemFreePointer((VOID **)&gDelBootData);
+ gDelOptionCount = 0;
+
+ //Update default value for Boot Manager and Boot Now count
+ BootCountVal = (UINT16) gBootOptionCount;
+ _VarGetSetValue (VAR_COMMAND_SET_VALUE, gOptimalDefaults, VARIABLE_ID_BOOT_MANAGER, 0, sizeof(UINT16), (VOID *)(&BootCountVal));
+ _VarGetSetValue (VAR_COMMAND_SET_VALUE, gFailsafeDefaults, VARIABLE_ID_BOOT_MANAGER, 0, sizeof(UINT16), (VOID *)(&BootCountVal));
+
+ if (gShowAllBbsDev)
+ BootCountVal = _BootSetBootNowCount ();
+
+ _VarGetSetValue (VAR_COMMAND_SET_VALUE, gOptimalDefaults, VARIABLE_ID_BOOT_NOW, 0, sizeof(UINT16), (VOID *)(&BootCountVal));
+ _VarGetSetValue (VAR_COMMAND_SET_VALUE, gFailsafeDefaults, VARIABLE_ID_BOOT_NOW, 0, sizeof(UINT16), (VOID *)(&BootCountVal));
+}
+
+//EIP70421 & 70422 Support for driver order
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SaveAddDelDriverOptions
+//
+// Description: Function to save the added/deleted Driver option
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SaveAddDelDriverOptions(VOID)
+{
+ UINTN i,OptimalIndex,FailsafeIndex,size;
+ UINT16 dpLength,*pNewOptimal, *pOldOptimal, *pNewFailsafe, *pOldFailsafe;
+ BOOT_OPTION *pOption;
+ CHAR16 *varName = L"DriverXXXX";
+ UINT16 DriverCountVal;
+
+ //Old Driver order defaults are not valid any more. Form the new
+ //defaults by removing deleted options and adding the new options at the end.
+ pNewOptimal = EfiLibAllocateZeroPool( gDriverOptionCount * sizeof(UINT16) );
+ pNewFailsafe = EfiLibAllocateZeroPool( gDriverOptionCount * sizeof(UINT16) );
+ pOldOptimal = (UINT16 *)gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer;
+ pOldFailsafe = (UINT16 *)gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer;
+ size = gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Size;
+ OptimalIndex = FailsafeIndex = 0;
+
+ //Add existing options first
+ for(i=0;i<size/sizeof(UINT16);i++)
+ {
+ if (DriverGetDriverData (pOldOptimal [i]))
+ {
+ pNewOptimal[OptimalIndex] = pOldOptimal[i];
+ OptimalIndex++;
+ }
+ if(DriverGetDriverData (pOldFailsafe[i]))
+ {
+ pNewFailsafe[FailsafeIndex] = pOldFailsafe[i];
+ FailsafeIndex++;
+ }
+ }
+ //Save New driver options
+ for(i=0;i<gDriverOptionCount;i++)
+ {
+ if(gDriverData[i].bNewOption)
+ {
+ dpLength = (UINT16)EfiDevicePathSize( gDriverData[i].DevicePath );
+ size = sizeof(BOOT_OPTION) + sizeof(CHAR16)*EfiStrLen(gDriverData[i].Name) + dpLength;
+ pOption = EfiLibAllocateZeroPool( size );
+ pOption->Active = gDriverData[i].Active;
+ pOption->PathLength = dpLength;
+ EfiStrCpy( pOption->Name, gDriverData[i].Name );
+ MemCopy( (UINT8 *)pOption + size - dpLength, gDriverData[i].DevicePath, dpLength );
+
+ SPrint( varName, sizeof(CHAR16) * (EfiStrLen( varName )+1), gDriverFormarSpecifier, gDriverData[i].Option );
+ VarSetNvramName( varName,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ pOption,
+ size );
+
+ gDriverData[i].bNewOption = 0;
+ //Append this option in defaults
+ pNewOptimal[OptimalIndex] = gDriverData[i].Option;
+ pNewFailsafe[FailsafeIndex] = gDriverData[i].Option;
+ OptimalIndex++;
+ FailsafeIndex++;
+ }
+ }
+
+ //Put new defaults in global default repository
+ //Default order is not found in first time then will take current order.
+ //If any driver options added after that then new driver option always follow the first saved optimized buffer
+ //Removed EIP81581 fixes All the time changing the default buffer is not good
+ if (0 == gOptimalDefaults [VARIABLE_ID_DRIVER_ORDER].Size)
+ {
+ UINT8 *pOptWithOutDefaultDriverOrder = EfiLibAllocateZeroPool (gVariableList [VARIABLE_ID_DRIVER_ORDER].Size);
+ if (NULL != pOptWithOutDefaultDriverOrder)
+ {
+ MemCopy (pOptWithOutDefaultDriverOrder, gVariableList [VARIABLE_ID_DRIVER_ORDER].Buffer, gVariableList [VARIABLE_ID_DRIVER_ORDER].Size);
+ gOptimalDefaults [VARIABLE_ID_DRIVER_ORDER].Buffer = pOptWithOutDefaultDriverOrder;
+ gOptimalDefaults [VARIABLE_ID_DRIVER_ORDER].Size = gVariableList [VARIABLE_ID_DRIVER_ORDER].Size;
+ }
+ }
+ else
+ {
+ MemFreePointer( (VOID **) &gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer );
+ gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer = (UINT8 *)pNewOptimal;
+ gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Size = OptimalIndex * sizeof(UINT16);
+ }
+ MemFreePointer( (VOID **) &gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer );
+ gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer = (UINT8 *)pNewFailsafe;
+ gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Size = FailsafeIndex * sizeof(UINT16);
+
+ //Delete removed options
+ for(i=0;i<gDriverDelOptionCount;i++)
+ {
+ if(!gDelDriverData[i].bNewOption)
+ {
+ SPrint( varName, sizeof(CHAR16) * (EfiStrLen( varName )+1), gDriverFormarSpecifier, gDelDriverData[i].Option );
+ VarSetNvramName (varName,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ varName,
+ 0);
+ }
+ }
+ MemFreePointer((VOID **)&gDelDriverData);
+ gDriverDelOptionCount = 0;
+
+ //Update default value for Driver Manager
+ DriverCountVal = (UINT16) gDriverOptionCount;
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gOptimalDefaults, VARIABLE_ID_DRIVER_MANAGER, 0, sizeof(UINT16), (VOID *)(&DriverCountVal) );
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gFailsafeDefaults, VARIABLE_ID_DRIVER_MANAGER, 0, sizeof(UINT16), (VOID *)(&DriverCountVal) );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSELiteFixAddBootOptionFileList
+//
+// Description: Function to fix Add Boot Option file list
+//
+// Input: CONTROL_DATA *ControlData
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID TSELiteFixAddBootOptionFileList(CONTROL_DATA *ControlData)
+{
+ POPUPSEL_DATA *popupSel = (POPUPSEL_DATA *)ControlData;
+ UINT16 i=0;
+ if(gFsCount >= popupSel->ItemCount) // If the filesystem found
+ {
+ for(i=0;i<popupSel->ItemCount;i++)
+ {
+ popupSel->PtrTokens[i].Option = HiiAddString( popupSel->ControlData.ControlHandle, gFsList[i].FsId );
+ popupSel->PtrTokens[i].Value = i;
+ }
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSELiteFixAddBootOptionFileList
+//
+// Description: Function to fix Delete Boot option file list
+//
+// Input: CONTROL_DATA *ControlData
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID TSELiteFixDelBootOptionFileList(CONTROL_DATA *ControlData)
+{
+ POPUPSEL_DATA *popupSel = (POPUPSEL_DATA *)ControlData;
+ UINT16 i=0;
+
+ for(i=0;i<popupSel->ItemCount;i++)
+ {
+ if((UINT16)popupSel->PtrTokens[i].Value != 0xFFFF)
+ {
+ popupSel->PtrTokens[i].Value = gBootData[i-1].Option;
+ popupSel->PtrTokens[i].Option = HiiAddString( popupSel->ControlData.ControlHandle, BootGetOptionName( &(gBootData[i-1]) ) );
+ }
+ }
+}
+
+/// EIP-41615: START - File Browser related functions for Add Boot Option..
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: CleanFileTypes
+//
+// Description: Frees all allocated memory associated with the FILE_TYPE structure
+// and resets the InternalString current strings next available string token
+// to be the first dynamically added string
+//
+// Input: FILE_TYPE **FileList - The array of FILE_TYPE structures found in
+// a directory
+// UINTN *FileCount - pointer to the number of entries in the FileList
+//
+// Output:
+//
+// Returns:
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID CleanFileTypes(FILE_TYPE **FileList, UINTN *FileCount)
+{
+ UINTN i;
+ for(i = 0; i<*FileCount; i++) gBS->FreePool((*FileList)[i].Name);
+ if(FileList!=NULL && (*FileList!=NULL) && (*FileCount>0)) gBS->FreePool(*FileList);
+ if(FileList!=NULL) *FileList = NULL;
+ *FileCount = 0;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: CheckDirectoryType
+//
+// Description: Checks if the EFI_FILE_INFO is a directory (and not the current directory)
+//
+// Input: EFI_FILE_INFO *File
+//
+// Output:
+//
+// Returns: BOOLEAN - TRUE - item is a directory, and not the current directory
+// FALSE - item is not a directory, or is the current directory
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN CheckDirectoryType(EFI_FILE_INFO *File)
+{
+ BOOLEAN Status = FALSE;
+
+ if((File->Attribute & EFI_FILE_DIRECTORY) && (EfiStrCmp(File->FileName, L".") != 0)) {
+
+ Status = TRUE;
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: CheckExtension
+//
+// Description: Check is the EFI_FILE_INFO has the same extension as the
+// extension passed in the second parameter
+//
+// Input: EFI_FILE_INFO *File - The file entry whose extension should be checked
+// CHAR16 *ExtensionEfi - the extension
+//
+// Output:
+//
+// Returns: BOOLEAN - TRUE - The extension matches
+// FALSE - the extension does not match
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN CheckExtension(EFI_FILE_INFO *File, CHAR16 *ExtensionEfi)
+{
+ BOOLEAN Status = FALSE;
+ UINTN Length = EfiStrLen(File->FileName);
+
+ if((File->Attribute & EFI_FILE_DIRECTORY) != EFI_FILE_DIRECTORY && Length > 3)
+ if((((File->FileName[Length-1])&0xdf) == ((ExtensionEfi[2])&0xdf)) &&
+ (((File->FileName[Length-2])&0xdf) == ((ExtensionEfi[1])&0xdf)) &&
+ (((File->FileName[Length-3])&0xdf) == ((ExtensionEfi[0])&0xdf)))
+ Status = TRUE;
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: FindInsertionIndex
+//
+// Description: Finds the inded where directories items turn into file items
+//
+// Input: FILE_TYPE *List - the current array of File Type structures
+// UINTN FileCount - the count of File Type structures in the array
+//
+// Output:
+//
+// Returns: the index to insert a new item
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN FindInsertionIndex(FILE_TYPE *List, UINTN FileCount)
+{
+ UINTN i = 0;
+
+ if(FileCount <= 1) return 0;
+
+ for(i = 1; i < (FileCount-1); i++)
+ {
+ if(List[i-1].Type != List[i].Type)
+ break;
+ }
+
+ return i;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: AddFileTypeEntry
+//
+// Description: Creates a new entry in the FILE_TYPE array and adds the current File into
+// the array.
+//
+// Input: FILE_TYPE **List - Array of FILE_TYPE structures alread found
+// UINTN *FileCount - number of entries in the FILE_TYPE array
+// EFI_FILE_INFO *FileInfo - file info of the file that should be added
+//
+// Output:
+//
+// Returns:
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+static VOID AddFileTypeEntry(FILE_TYPE **List, UINTN *FileCount, EFI_FILE_INFO *FileInfo)
+{
+ FILE_TYPE *NewList=NULL;
+ UINTN Length;
+ UINTN Index = 0;
+
+ Length = (EfiStrLen(FileInfo->FileName)+3)*sizeof(CHAR16);
+
+ // Allocate space for a new list entry plus all the previous list items
+ NewList = EfiLibAllocateZeroPool(sizeof(FILE_TYPE)*(++(*FileCount)));
+ if (NewList != NULL)
+ {
+ // Clear the memory of the entire list
+ MemSet(NewList, sizeof(FILE_TYPE)*(*FileCount), 0);
+
+ // Copy the old entries (if there are any old entries to copy)
+ if(*List != NULL)
+ {
+ Index = FindInsertionIndex(*List, *FileCount);
+
+ MemCopy(NewList, *List, sizeof(FILE_TYPE)*(Index));
+ MemCopy(&(NewList[Index+1]), &((*List)[Index]), sizeof(FILE_TYPE)*((*FileCount)-Index-1));
+
+ gBS->FreePool(*List);
+ }
+
+ // Store the type of this FILE_TYPE entry (non-zero is directory)
+ NewList[Index].Type = ((FileInfo->Attribute) & EFI_FILE_DIRECTORY);
+
+ // Store the size of the file
+ NewList[Index].Size = (UINTN)FileInfo->FileSize;
+
+ // Allocate space for the string
+ NewList[Index].Name = EfiLibAllocateZeroPool (Length);
+ if((NewList[Index].Name) != NULL )
+ {
+ // Clear the allocated memory
+ MemSet(NewList[Index].Name, Length, 0);
+
+ // Create either a Dir string or a File string for addition to the HiiDataBase
+ if(NewList[Index].Type == EFI_FILE_DIRECTORY)
+ SPrint(NewList[Index].Name, (sizeof(CHAR16)*EfiStrLen(FileInfo->FileName)+1), L"<%s>", FileInfo->FileName);
+ else
+ SPrint(NewList[Index].Name, (sizeof(CHAR16)*EfiStrLen(FileInfo->FileName)+1), L"%s", FileInfo->FileName);
+
+ // Add the string to the HiiDataBase
+ ///NewList[Index].Token = AddStringToHii(FileInfo->FileName, &gInternalStrings); ///Just by trying using the following line
+ NewList[Index].Token = HiiAddString(gHiiHandle, NewList[Index].Name );
+
+ // Clear the memory and create the string for the File Structure
+ MemSet(NewList[Index].Name, Length, 0);
+ SPrint(NewList[Index].Name, (sizeof(CHAR16)*EfiStrLen(FileInfo->FileName)+1), L"%s", FileInfo->FileName);
+ }
+ *List = NewList;
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: CreateFileList
+//
+// Description: Parse all the files in the current directory and add valid files to the
+// FILE_TYPE list and update the filecount
+//
+// Input: EFI_FILE_PROTOCOL *FileProtocol - the current direcotry to parse
+//
+// Output: FILE_TYPE **FileList - pointer in which to return the array of FileType items
+// UINTN *FileCount - the count of filetype items discovered
+//
+// Returns: EFI_STATUS
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+static EFI_STATUS CreateFileList(EFI_FILE_PROTOCOL *FileProtocol, FILE_TYPE **FileList, UINTN *FileCount)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ UINTN BufferSize = 1;
+ EFI_FILE_INFO *File = NULL;
+
+ CHAR16 ExtensionEfi[] = L"EFI";
+
+ // Continue parsing the directory until we no longer read valid files
+ while(BufferSize != 0 && !EFI_ERROR(Status))
+ {
+ BufferSize = 0;
+ Status = FileProtocol->Read(FileProtocol, &BufferSize, NULL);
+
+ if(!EFI_ERROR(Status)) break;
+
+ if(Status == EFI_BUFFER_TOO_SMALL)
+ {
+ File = EfiLibAllocateZeroPool (BufferSize);
+ if(File != NULL) {
+ MemSet(File, BufferSize, 0);
+ }
+ }
+
+ Status = FileProtocol->Read(FileProtocol, &BufferSize, File);
+
+ // Check if a valid file was read
+ if(!EFI_ERROR(Status) && BufferSize != 0)
+ {
+ // check if the file read was a directory or a ".efi" extension
+ if(CheckDirectoryType(File) || CheckExtension(File, ExtensionEfi))
+ {
+ // the file was valid, add it to the file list
+ AddFileTypeEntry(FileList, FileCount, File);
+ }
+ }
+
+ // free the space allocated for readin the file info structure
+ gBS->FreePool(File);
+
+ // set the pointer to null to prevent the chance of memory corruption
+ File = NULL;
+ }
+
+ if(*FileCount == 0) Status = EFI_NOT_FOUND;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: DisplayFileListMenu
+//
+// Description: Display a menu of the FILE_TYPE items and return the selected item
+// in the Selection
+//
+// Input: FILE_TYPE *FileList - List of FILE_TYPE items to display in the menu
+// UINTN FileCount - the number of FILE_TYPE items in the list
+//
+// Output: UINT16 *Selection - The index of the selected FILE_TYPE item
+//
+// Returns:
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+static EFI_STATUS DisplayFileListMenu(FILE_TYPE *FileList, UINTN FileCount, UINT16 *Selection, UINT32 Variable)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ UINT16 i = 0;
+
+ POSTMENU_TEMPLATE *List = NULL;
+
+ // Check there are any files to display
+ if(FileCount != 0 && FileList != NULL)
+ {
+ // allocate space for the POSTMENU_TEMPLATE items
+ List = EfiLibAllocateZeroPool (sizeof(POSTMENU_TEMPLATE)*FileCount);
+ if(List != NULL)
+ {
+ // Clear the memory allocated
+ MemSet(List, sizeof(POSTMENU_TEMPLATE)*FileCount, 0);
+
+ // Add the STRING_REF tokens to the POSTMENU_TEMPLATE structures
+ for(i = 0; i < FileCount; i++)
+ List[i].ItemToken = FileList[i].Token;
+ }
+
+ // Call post manager to display the menu
+ Status = mPostMgr->DisplayPostMenu(gHiiHandle,
+ (VARIABLE_ID_ADD_BOOT_OPTION == Variable) ? STRING_TOKEN (STR_FILE_PATH) : STRING_TOKEN (STR_DRIVER_PATH),
+ 0,
+ List,
+ (UINT16)FileCount,
+ Selection);
+ }
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: UpdateFilePathString
+//
+// Description: To create the File Path string based on the file selected.
+//
+// Input: CHAR16 *FilePath - Buffer to fill with the file path
+// CHAR16 * CurFile - current file selected
+// UINT16 idx - Index of the file in the current directory
+//
+// Output: CHAR16 *FilePath - Updated File Path
+//
+// Returns:
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID UpdateFilePathString(CHAR16 *FilePath, CHAR16 * CurFile, UINT16 idx)
+{
+ UINTN Length=0;
+
+ if(EfiStrLen(FilePath))
+ {
+ if( idx==0 ) {
+ if(EfiStrCmp(CurFile,L"..")) {
+ EfiStrCat(FilePath,L"\\");
+ EfiStrCat(FilePath,CurFile);
+ }
+ else {
+
+ for ( Length = EfiStrLen(FilePath); ( Length!= 0 ) && (FilePath[Length-1] != L'\\') ; Length -- );
+ if ( Length )
+ FilePath[Length-1] = L'\0';
+ else
+ FilePath[Length] = L'\0';
+ }
+ }
+ else {
+ EfiStrCat(FilePath,L"\\");
+ EfiStrCat(FilePath,CurFile);
+ }
+ }
+ else {
+ EfiStrCpy(FilePath,L"\\");
+ EfiStrCat(FilePath,CurFile);
+ //EfiStrCpy(FilePath,CurFile);
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: FileBrowserLaunchFileSystem
+//
+// Description: To select the File System for the new boot option with the help of file browser.
+//
+// Input: VOID
+//
+// Output: Selected File System Index
+//
+// Returns: EFI_STATUS
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS FileBrowserLaunchFileSystem(UINT32 Variable)
+{
+ EFI_STATUS Status;
+ UINTN Count = 0;
+ UINT16 i = 0;
+
+ EFI_GUID DevicePathGuid = EFI_DEVICE_PATH_PROTOCOL_GUID;
+ EFI_DEVICE_PATH_PROTOCOL *Dp = NULL;
+
+ POSTMENU_TEMPLATE *PossibleFileSystems = NULL;
+
+ Status = gBS->LocateProtocol(&gAmiPostManagerProtocolGuid, NULL, &mPostMgr);
+ if(EFI_ERROR(Status)) {
+ return EFI_UNSUPPORTED;
+ }
+ // Locate all the simple file system devices in the system
+ Status = gBS->LocateHandleBuffer(ByProtocol, &gSimpleFileSystemGuid, NULL, &Count, &gSmplFileSysHndlBuf);
+ if(!EFI_ERROR(Status))
+ {
+ // allocate space to display all the simple file system devices
+ PossibleFileSystems = EfiLibAllocateZeroPool (sizeof(POSTMENU_TEMPLATE)*Count);
+ if(PossibleFileSystems != NULL)
+ {
+ // clear the allocated space
+ MemSet(PossibleFileSystems, sizeof(POSTMENU_TEMPLATE)*Count, 0);
+ for(i = 0; i < Count; i++)
+ {
+ // get the device path for each handle with a simple file system
+ Status = gBS->HandleProtocol(gSmplFileSysHndlBuf[i], &DevicePathGuid, &Dp);
+ if(!EFI_ERROR(Status))
+ {
+ CHAR16 *Name = NULL;
+
+ // Get the name of the driver installed on the handle
+ // GetControllerName(gHandleBuffer[i],&Name);
+
+ Name = NULL;
+ Name = _DevicePathToStr(Dp);
+
+ // Add the name to the Hii Database
+ ///PossibleFileSystems[i].ItemToken = AddStringToHii(Name);
+ PossibleFileSystems[i].ItemToken = HiiAddString(gHiiHandle, Name );
+
+ PossibleFileSystems[i].Attribute = AMI_POSTMENU_ATTRIB_FOCUS;
+ }
+ else
+ {
+ PossibleFileSystems[i].ItemToken = 0;
+ PossibleFileSystems[i].Attribute = AMI_POSTMENU_ATTRIB_HIDDEN;
+ }
+ }
+ // Reset the item selected to be the first item
+ gSelIdx = 0;
+
+ // Display the post menu and wait for user input
+ Status = mPostMgr->DisplayPostMenu(gHiiHandle,
+ (Variable != 0xffff)? STRING_TOKEN(STR_FILE_SYSTEM) : STRING_TOKEN(STR_FILE_SYSTEM_TO_SAVE_IMG),//EIP-123432
+ 0,
+ PossibleFileSystems,
+ (UINT16)Count,
+ &gSelIdx);
+
+
+ // A valid item was selected by the user
+ if(!EFI_ERROR(Status))
+ {
+ gValidOption = TRUE;
+ }
+ }
+ }
+
+ else {
+ ShowPostMsgBox( L"No Valid File System", L"No Valid File System Available", MSGBOX_TYPE_OK, NULL );//EIP:41615 To display Warning message when there is no file system connected.
+
+ }
+ // Free the allocated menu list space
+ if(PossibleFileSystems != NULL)
+ gBS->FreePool(PossibleFileSystems);
+ if(Variable == VARIABLE_ID_ADD_BOOT_OPTION)
+ {
+ // Set the File System Index for the new boot option added
+ VarSetValue(VARIABLE_ID_ADD_BOOT_OPTION, STRUCT_OFFSET(NEW_BOOT_OPTION,SelFs), sizeof(UINT16), (VOID*)&gSelIdx);
+ }
+ if(Variable == VARIABLE_ID_ADD_DRIVER_OPTION) //EIP70421 & 70422 Support for driver order
+ {
+ VarSetValue(VARIABLE_ID_ADD_DRIVER_OPTION, STRUCT_OFFSET(NEW_DRIVER_OPTION,SelFs), sizeof(UINT16), (VOID*)&gSelIdx);
+ }
+ return Status;
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: FileBrowserLaunchFilePath
+//
+// Description: To select the Boot file for the new boot option with the help of file browser.
+//
+// Input: VOID
+//
+// Output: File Path string
+//
+// Returns: EFI_STATUS
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS FileBrowserLaunchFilePath(UINT32 Variable)
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle = 0;
+
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs = NULL;
+ EFI_FILE_PROTOCOL *NewFs = NULL;
+ FILE_TYPE *FileList = NULL;
+ UINTN FileCount = 0;
+ UINT16 i = 0;
+ //CHAR16 FilePath[120];
+ CHAR16 *FilePath=NULL;
+ UINTN filenamelength = 0, Length = 0;
+
+ // Attempt to locate the post manager protocol
+ Status = gBS->LocateProtocol(&gAmiPostManagerProtocolGuid, NULL, &mPostMgr);
+ if(!EFI_ERROR(Status))
+ {
+ if( gValidOption == TRUE )
+ {
+ gValidOption = FALSE;
+
+ // Get the simple file system protocol
+ Status = gBS->HandleProtocol(gSmplFileSysHndlBuf[gSelIdx], &gSimpleFileSystemGuid, &SimpleFs);
+ if(!EFI_ERROR(Status))
+ {
+ // And open it and return the efi file protocol
+ Status = SimpleFs->OpenVolume(SimpleFs, &gFs);
+ }
+ }
+ else {
+ return EFI_UNSUPPORTED;
+ }
+
+ // Free handle buffer space (auto allocated by the called function)
+ if(gSmplFileSysHndlBuf != NULL)
+ gBS->FreePool(gSmplFileSysHndlBuf);
+
+ // clean up the file list and strings used in getting the file system
+ CleanFileTypes(&FileList, &FileCount);
+ }
+
+ //MemSet(FilePath, 120, 0);
+ if ( NULL == FilePath ) //EIP-105725
+ {
+ FilePath = (CHAR16*)EfiLibAllocateZeroPool(sizeof(CHAR16));
+ }
+
+ while(!EFI_ERROR(Status) && gFs != NULL)
+ {
+ i = 0;
+
+ // Create a list of the files in the current directory
+ Status = CreateFileList(gFs, &FileList, &FileCount);
+ if(!EFI_ERROR(Status))
+ {
+ // Display the list in a menu and allow the user to select
+ Status = DisplayFileListMenu(FileList, FileCount, &i, Variable);
+ if(!EFI_ERROR(Status))
+ {
+ // The user selected something, attempt to open it
+ Status = gFs->Open( gFs,
+ &NewFs,
+ FileList[i].Name,
+ EFI_FILE_MODE_READ,
+ 0);
+
+ // close the old file system protocol and set it to null
+ gFs->Close(gFs);
+ gFs = NULL;
+
+ Length = EfiStrLen(FilePath) + 3; // adding 2 more character for \ and null termination
+ filenamelength = EfiStrLen(FileList[i].Name);
+ if ( NULL != FilePath )
+ {
+ ////EIP-105725 Re-allocating based on filePath string length
+ FilePath = MemReallocateZeroPool( FilePath, (Length * sizeof (CHAR16)), ( (Length * sizeof (CHAR16)) + (filenamelength * sizeof (CHAR16)) ) );
+ }
+
+
+ // Create the File Path based on the file selected
+ UpdateFilePathString(FilePath, FileList[i].Name, i);
+
+ // the newly selected item was opened correctly
+ if(!EFI_ERROR(Status))
+ {
+ // check what type was opened
+ if(FileList[i].Type != EFI_FILE_DIRECTORY)
+ {
+ // the file was read, close the file system protocol and set it to null
+ NewFs->Close(NewFs);
+ NewFs = NULL;
+
+ //SPrint (FileName, 50, L"%s", FileList[i].Name);
+ //ShowPostMsgBox( L"Selected Boot File Name", FileName, MSGBOX_TYPE_OK, &SelOpt );
+ }
+ gFs = NewFs;
+ }
+ }
+ }
+
+ if(FileCount <= 0) {
+ ShowPostMsgBox( L"No Valid File", L"No Valid File Available in the Selected File System", MSGBOX_TYPE_OK, NULL );//EIP:41615 Warning message to show unavailability of the selected file
+ }
+ // clean the strings that were used and free allocated space
+ CleanFileTypes(&FileList, &FileCount);
+
+ if(Status == EFI_ABORTED) {
+ return Status;//EIP:41615 Returning the status if its aborted.
+ }
+ }
+ // Set the File path for the new boot option added.
+ if(!EFI_ERROR(Status))
+ {
+ if (VARIABLE_ID_ADD_BOOT_OPTION == Variable)
+ VarSetValue(VARIABLE_ID_ADD_BOOT_OPTION, STRUCT_OFFSET(NEW_BOOT_OPTION,Path), ((EfiStrLen(FilePath)+1)*sizeof(CHAR16)), FilePath);
+ if (VARIABLE_ID_ADD_DRIVER_OPTION == Variable) //EIP70421 & 70422 Support for driver order
+ VarSetValue(VARIABLE_ID_ADD_DRIVER_OPTION, STRUCT_OFFSET(NEW_DRIVER_OPTION,DriverPath), ((EfiStrLen(FilePath)+1)*sizeof(CHAR16)), FilePath);
+ }
+ MemFreePointer((VOID**)&FilePath);
+ return Status;
+}
+//EIP-41615: END..
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Date.c b/EDK/MiniSetup/TseLite/Date.c
new file mode 100644
index 0000000..812244f
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Date.c
@@ -0,0 +1,1397 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2012, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Date.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 32 $
+//
+// $Date: 5/01/14 3:39p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Date.c $
+//
+// 32 5/01/14 3:39p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 31 11/20/12 12:41a Arunsb
+// [TAG] EIP107049
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] If set Token "STYLE_DATE_FORMAT" to change the date display
+// type to [yyyy/mm/dd], it can't key-in correct value to set the date
+// value, only use the +/- command to set the date value
+// [Files] Date.c
+//
+// 30 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 14 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 29 4/05/12 7:13a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 28 2/02/12 1:16p Premkumara
+// [TAG] EIP75351,75352,75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] String.c, boot.c, TseAdvanced.c,Time.c, PopupEdit.c,
+// MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 27 1/18/12 7:27a Rajashakerg
+// [TAG] EIPEIP 79487:
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Decreasing YEAR field displayed yearr with XX before 2005
+// and after 2098.
+// [RootCause] Improper handling of the date and year field of the date
+// control.
+// [Solution] Global variable DateTempNum is handled properly while
+// updating the date and year field of the date control.
+// [Files] Date.c
+//
+// 26 1/18/12 6:22a Rajashakerg
+// [TAG] EIP79961
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] "Non RTC date control - decreasing from year value 0001
+// displayed 65535 without closing bracket.
+// [RootCause] In date draw function we are providing only 4 digits for
+// year. But Tm.year value when decremented after least value its drawing
+// the 65535 which is the maximum.
+// [Solution] Restricted maximum value for year to 9999 such that it
+// wont erase the ']' when incremented over 9999.
+// When incremented over 9999 provided 0 to it.
+// [Files] Date.c
+//
+// 25 1/11/12 7:42a Arunsb
+// [TAG] EIP79965
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Unable to set the date and time with the soft keyboard and
+// mouse
+// [RootCause] Softkbd disabled even the control is active
+// [Solution] Disabled the softkbd only when control is inactive
+// [Files] Date.c and time.c
+//
+// 24 1/05/12 1:10p Blaines
+// [TAG] EIP 80092
+// [Category] Defect
+// [Symptom] Day of week is not properly calculated for 2012 in Setup
+// [RootCause] Local variables are declared type UINT.
+// [Solution] Change the local variable type from UINT to INTN.
+//
+// [Files Changed]
+// - date.c
+//
+// [Functions Changed]
+// - _DateGetWeekDay
+//
+// 23 12/07/11 9:02a Rajashakerg
+// TAG] EIP73231
+// [Category] Improvement
+// [Description] Moved the UefiPreControlUpdate function call in time.c
+// and date.c to the appropriate place.
+// [Files] time.c, date.c
+//
+// 22 11/30/11 11:51p Rajashakerg
+//
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Callback handling :For interactive controls updating
+// the currnet vaule in cache even when hii callback returns error status.
+// [Files] Date.c, SubMenu.c, ordlistbox.c, time.c, UefiAction.c,
+// hii.h, uefi20Wapper.c, HiiCallback.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 21 11/30/11 12:49a Premkumara
+// [TAG] EIP75351
+// [Category] Improvement
+// [Description] Static code analysis.Suppress the warnings from static
+// code analyzer
+// [Files] String.c, HiiString21.c, TseAdvanced.c, Special.c,
+// UefiAction., Time.c, PopupEdit.c, MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 20 11/28/11 4:55a Rajashakerg
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Callback handling :For interactive controls updating
+// the currnet vaule in cache even when hii callback returns error status.
+// [Files] Date.c, SubMenu.c, ordlistbox.c, time.c, UefiAction.c,
+// hii.h, uefi20Wapper.c, HiiCallback.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 19 11/28/11 2:02a Premkumara
+// [TAG] EIP75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] UefiWapper.c, Hii.c, Expression.c, CtrlCond.c, PopupSel.c,
+// Minisetupext.c, Menu.c, Date.c, Ezport\Stylecommon.c,
+// EzportPlus\StyleCommon.c,
+//
+// 18 11/21/11 12:12p Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 17 11/20/11 7:44a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 16 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 15 8/26/11 6:34p Blaines
+// [TAG] EIP68354
+// [Category] Bug Fix
+// [Severity] Normal
+// [RootCause] Callback was invoked during periodic update for time and
+// date controls without EFI_IFR_REFRESH_OP.
+// [Solution] Callback is only invoked for interactive controls.
+// [Files] TseLite: Time.c, Date.c,
+// Uefi21: Parese.c, Uefi21Wrapper.c
+//
+// 14 6/15/11 4:46p Arunsb
+// [TAG] EIP61650
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] Cannot edit time field when using new "time" format
+// [RootCause] Default refresh interval set to all the time variables
+// [Solution] Control refreshed only if refresh flag set.
+// [Files] time.c, date.c, parse.c and uefihpktool.exe
+//
+// 13 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 12 12/02/10 2:34p Madhans
+// [TAG] - EIP 48169
+// [Category]- Enhancement
+// [Severity]- Mordarate
+// [Symptom]- Code Cleanup and Compiler Warning need to resolved.
+// [Rootcause] Warnings reported when we build AMI higher Warning level.
+// [Solution]- 1. Fix the warnings and do the code cleanup.
+// 2. Introduce proper checks.
+// 3. change the popupSel.c to not change the Option/variable
+// cache to default or first option
+// when the variable cache is not matching with any of
+// option.
+// [Files] - commonoem.c bbs.c boot.c hiistring.c resource.c
+// popuppassword.c popupsel.c
+// expression.c hii.c parse.c
+//
+// 11 11/30/10 2:07p Blaines
+// [TAG] - EIP 48979
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- Both Date & Time controls of setup menu do not display
+// gray-out color when the controls are in the gray-out state.
+//
+// [Rootcause] - Improper use of color variable for Date and Time controls
+// in the draw function.
+// [Solution] - Proper use of color variables to handle normal and
+// gray-out state for these controls.
+// [Files] - date.c and time.c
+//
+// 10 11/17/10 3:09p Madhans
+// [TAG] - EIP 48433
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- While editing Date and Time control pressing
+// Pageup/PageDown/Home keys
+// causes to leave Date&Time in the Edit state but changes foucs.
+// [Rootcause] - Default case of Action handling not done for Date and
+// Time controls.
+// [Solution] - Add the Default action handle caes for this controls.
+// [Files] - date.c and time.c
+//
+// 8 11/10/10 6:59p Blaines
+// Fix issue with date control not calling the proper uefi2.1 funtion to
+// set date.
+//
+// 7 6/04/10 12:53p Blaines
+// Add support for UEFI 2.1 date and time controls
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 7 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 6 2/17/10 7:03p Madhans
+// To suppor readonly control
+//
+// 5 1/09/10 6:48a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 8/18/09 6:35p Blaines
+// Support additional date styles
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 5/20/09 3:42p Blaines
+// Update support for date format
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 5 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 3/31/09 4:07p Madhans
+// Fix for EDK version
+//
+// 3 2/05/09 10:15a Madhans
+// Style Module created.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Date.c
+//
+// Description: This file contains code to handle Date control operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+
+DATE_METHODS gDate =
+{
+ DateCreate,
+ DateDestroy,
+ DateInitialize,
+ DateDraw,
+ DateHandleAction,
+ DateSetCallback,
+ DateSetFocus,
+ DateSetPosition,
+ DateSetDimensions,
+ DateSetAttributes,
+ DateGetControlHeight
+
+};
+BOOLEAN CheckKeyinHotKeysList(AMI_EFI_KEY_DATA Key);
+VOID _DateUpdateEntry(DATE_DATA *time);
+EFI_STATUS _DateHandleActionKeyMouse(DATE_DATA *date, ACTION_DATA *Data);
+UINT16 DayNames[] =
+{
+ STRING_TOKEN(STR_DAY_SUNDAY),
+ STRING_TOKEN(STR_DAY_MONDAY),
+ STRING_TOKEN(STR_DAY_TUESDAY),
+ STRING_TOKEN(STR_DAY_WEDNESDAY),
+ STRING_TOKEN(STR_DAY_THURSDAY),
+ STRING_TOKEN(STR_DAY_FRIDAY),
+ STRING_TOKEN(STR_DAY_SATURDAY),
+};
+
+CHAR16 DateTempNum[5];
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateCreate
+//
+// Description: Function to create the date, which uses the Control fucntions.
+//
+// Input: DATE_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateCreate( DATE_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(DATE_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gDate;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateDestroy
+//
+// Description: Function to destroy the date, which uses the Control fucntions.
+//
+// Input: DATE_DATA *date, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateDestroy( DATE_DATA *date, BOOLEAN freeMem )
+{
+ if(NULL == date)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( date, FALSE );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&date );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateInitialize
+//
+// Description: Function to initialize the date, which uses the Control fucntions.
+//
+// Input: DATE_DATA *date, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateInitialize( DATE_DATA *date, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( date, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ date->ControlData.ControlHelp = UefiGetHelpField(date->ControlData.ControlPtr);
+ date->Interval = (UINT8)date->ControlData.ControlFlags.ControlRefresh;
+ date->LabelMargin = (UINT8)gControlLeftMargin;
+ date->Sel = 0;
+ date->ControlFocus = FALSE;
+ date->ControlActive = FALSE;
+
+ SetControlColorsHook(NULL, NULL,
+ NULL, &(date->FGColor),
+ &(date->SelBGColor), &(date->SelFGColor),
+ &(date->BGColor), &(date->NSelFGColor),
+ NULL, &(date->LabelFGColor),
+ &(date->NSelLabelFGColor),
+ NULL, NULL,
+ NULL, NULL );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateInitialize
+//
+// Description: Function to draw the date.
+//
+// Input: DATE_DATA *date
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateDraw( DATE_DATA *date )
+{
+ CHAR16 *t,text[50],txt[5];
+ UINTN day;
+ EFI_TIME Tm;
+ UINTN nIndex,nDateLen,nEFIDateLen,i = 0;
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 ColorDate = date->NSelFGColor /*date->FGColor*/ , NScolor,SColor;
+ UINT16 MarginLeft = date->Left + date->LabelMargin;
+ UINT8 ColorLabelDate = (date->ControlFocus) ? date->LabelFGColor:date->NSelLabelFGColor ;
+ BOOLEAN bShowDay = StyleShowDay() ;
+ UINTN dateFormat = StyleGetDateFormat() ;
+ //gRT->GetTime(&Tm,NULL);
+ UefiGetTime(&date->ControlData, &Tm);
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if ( date->ControlData.ControlConditionalPtr != 0x0 )
+ //{
+ switch( CheckControlCondition( &date->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorDate = ColorLabelDate = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ NScolor = date->BGColor | ColorDate;
+ SColor = date->SelBGColor | date->SelFGColor;
+
+ // label
+ t = HiiGetString( date->ControlData.ControlHandle, UefiGetPromptField(date->ControlData.ControlPtr));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == t){
+ t = EfiLibAllocateZeroPool(2*sizeof(CHAR16));
+ if(!t)
+ return EFI_NOT_FOUND;
+ EfiStrCpy(t,L" ");
+ }
+ // boundary overflow check
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(date->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( date->Left , date->Top,
+ (UINTN)(date->LabelMargin - date->Left ),(UINTN) date->Height,
+ t, date->BGColor | ColorLabelDate );
+ }
+ else
+ {
+ if ( (TestPrintLength(t) / (NG_SIZE)) > (UINTN)(date->LabelMargin - date->Left )/*21*/ )
+ t[date->LabelMargin - date->Left ] = L'\0';
+
+ DrawStringWithAttribute( date->Left , date->Top, (CHAR16*)t,
+ date->BGColor | ColorLabelDate );
+ }
+ MemFreePointer ((VOID **)&t);
+
+ day = _DateGetWeekDay( &Tm );
+
+ t = HiiGetString( gHiiHandle, (bShowDay)? DayNames[day]:STRING_TOKEN(STR_EMPTY_STRING));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == t){
+ t = EfiLibAllocateZeroPool(2*sizeof(CHAR16));
+ if(!t)
+ return EFI_NOT_FOUND;
+ EfiStrCpy(t,L" ");
+ }
+
+ nIndex = TestPrintLength(t) / (NG_SIZE);
+ nDateLen = TestPrintLength(t) / (NG_SIZE);
+ nEFIDateLen = EfiStrLen(t);
+
+ if ( t != NULL )
+ {
+ SPrint( text, sizeof(text), L"[%s ", t );
+ text[nEFIDateLen + 1] = L' ';
+ i = (bShowDay)? (nEFIDateLen + 2):(nEFIDateLen + 1);
+
+ if ((dateFormat == DATE_STYLE_MMDDYYYY) || (dateFormat == DATE_STYLE_DDMMYYYY))
+ EfiStrCpy(text+(i),L"XX/XX/XXXX]");
+ else
+ EfiStrCpy(text+(i),L"XXXX/XX/XX]");
+ }
+ MemFreePointer( (VOID **)&t );
+ i = (bShowDay)? (nDateLen + 2):(nDateLen + 1) ; //(StyleShowDay()==TRUE)?2:1;
+ DrawStringWithAttribute( MarginLeft/*date->Left + date->LabelMargin*/ , date->Top, (CHAR16*)text,
+ date->BGColor | ColorDate );
+
+ nIndex = i;
+
+ if ((dateFormat == DATE_STYLE_MMDDYYYY)||(dateFormat == DATE_STYLE_DDMMYYYY))
+ {
+ DrawStringWithAttribute( MarginLeft/*date->Left + date->LabelMargin*/ + nIndex , date->Top,
+ ( (date->Sel==0) && (date->ControlActive == TRUE ) ) ? DateTempNum :StrZeroPad((dateFormat == DATE_STYLE_MMDDYYYY)?Tm.Month:Tm.Day,txt),
+ (UINT8)((((date->Sel == 0) && (date->ControlFocus)) ?
+ SColor/*date->SelBGColor | date->SelFGColor*/ :
+ NScolor/*date->BGColor | ColorDate*/ )) );
+
+ nIndex+=3;
+ DrawStringWithAttribute( MarginLeft/*date->Left + date->LabelMargin*/ + nIndex , date->Top,
+ ( (date->Sel==1) && (date->ControlActive == TRUE ) ) ? DateTempNum :StrZeroPad((dateFormat == DATE_STYLE_MMDDYYYY)?Tm.Day:Tm.Month,txt),
+ (UINT8)( (((date->Sel == 1) && (date->ControlFocus)) ?
+ SColor/*date->SelBGColor | date->SelFGColor*/ :
+ NScolor/*date->BGColor | ColorDate*/ )) );
+
+ nIndex+=3;
+ if((Tm.Year < 1000) &&( atoi(DateTempNum, 10) < 1000))
+ SPrint(txt,sizeof(txt),L"%04d",Tm.Year); //Update the date string when year is ZERO.
+
+ DrawStringWithAttribute( MarginLeft/*date->Left + date->LabelMargin*/ + nIndex , date->Top,
+ ( (date->Sel==2) && (date->ControlActive == TRUE ) ) ? DateTempNum :((Tm.Year < 1000) ? txt : StrZeroPad( Tm.Year,txt)),
+ (UINT8)( (((date->Sel == 2) && (date->ControlFocus)) ?
+ SColor/*date->SelBGColor | date->SelFGColor*/ :
+ NScolor/*date->BGColor | ColorDate*/ )) );
+ }
+ else
+ {
+
+ if((Tm.Year < 1000) &&( atoi(DateTempNum, 10) < 1000))
+ SPrint(txt,sizeof(txt),L"%04d",Tm.Year); //Update the date string when year is ZERO.
+ DrawStringWithAttribute( MarginLeft/*date->Left + date->LabelMargin*/ + nIndex , date->Top,
+ ( (date->Sel==0) && (date->ControlActive == TRUE ) ) ? DateTempNum :((Tm.Year < 1000) ? txt : StrZeroPad( Tm.Year,txt)),
+ (UINT8)( (((date->Sel == 0) && (date->ControlFocus)) ?
+ SColor/*date->SelBGColor | date->SelFGColor*/ :
+ NScolor/*date->BGColor | ColorDate*/ )) );
+
+ nIndex+=5;
+ DrawStringWithAttribute( MarginLeft/*date->Left + date->LabelMargin*/ + nIndex , date->Top,
+ ( (date->Sel==1) && (date->ControlActive == TRUE ) ) ? DateTempNum :StrZeroPad((dateFormat == DATE_STYLE_YYYYDDMM)?Tm.Day:Tm.Month,txt),
+ (UINT8)( (((date->Sel == 1) && (date->ControlFocus)) ?
+ SColor/*date->SelBGColor | date->SelFGColor*/ :
+ NScolor/*date->BGColor | ColorDate*/ )) );
+
+ nIndex+=3;
+ DrawStringWithAttribute( MarginLeft/*date->Left + date->LabelMargin*/ + nIndex , date->Top,
+ ( (date->Sel==2) && (date->ControlActive == TRUE ) ) ? DateTempNum :StrZeroPad((dateFormat == DATE_STYLE_YYYYDDMM)?Tm.Month:Tm.Day,txt),
+ (UINT8)((((date->Sel == 2) && (date->ControlFocus)) ?
+ SColor/*date->SelBGColor | date->SelFGColor*/ :
+ NScolor/*date->BGColor | ColorDate*/ )) );
+ }
+
+ FlushLines(date->Top, date->Top);
+ return Status;
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateInitialize
+//
+// Description: Function to handle the date actions.
+//
+// Input: DATE_DATA *date, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateHandleAction( DATE_DATA *date, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ if(date->ControlActive)
+ return Status;
+
+ if (0 == date->ControlData.ControlFlags.ControlRefresh) //EIP61650 If control not has refresh no need of proceeding
+ return Status;
+
+ if(IsActiveControlPresent(gApp->PageList[gApp->CurrentPage]))
+ return Status;
+
+ if ( --(date->Interval) == 0 )
+ {
+ // initialize the interval
+ date->Interval = (UINT8)(date->ControlData.ControlFlags.ControlRefresh);
+ return UefiRefershQuestionValueNvRAM(&(date->ControlData));
+ }
+ else
+ return Status;
+ }
+
+ if ( ! date->ControlFocus )
+ return Status;
+
+ if (( Data->Input.Type == ACTION_TYPE_KEY )||(Data->Input.Type == ACTION_TYPE_MOUSE))
+ return _DateHandleActionKeyMouse(date, Data);
+
+ return Status;
+}
+
+EFI_STATUS _DateHandleActionKeyMouse(DATE_DATA *date, ACTION_DATA *Data)
+{
+ CONTROL_ACTION Action;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ EFI_TIME Tm;
+ AMI_EFI_KEY_DATA key = Data->Input.Data.AmiKey;
+ UINTN dateFormat = StyleGetDateFormat() ;
+
+ if(date->ControlData.ControlFlags.ControlReadOnly)
+ return EFI_UNSUPPORTED;
+
+ //Get time
+ //gRT->GetTime( &Tm, NULL );
+ UefiGetTime(&date->ControlData, &Tm);
+
+ //Get mapping
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ {
+ Action = MapControlKeysHook(key);
+ }
+ else if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ if(ControlActionSelect == MapControlMouseActionHook(&Data->Input.Data.MouseInfo))
+ {
+
+ //EIP-123727 check whether MouseTop is within the Height and Width of Date Control or not
+ if((Data->Input.Data.MouseInfo.Top >= (UINT32)date->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(date->Top+date->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)date->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(date->Left+date->Width)))//EIP-123727
+ {
+ Action = ControlActionSelect;
+ }
+ }
+ }
+
+ switch(Action)
+ {
+ case ControlActionNextLeft:
+#if SETUP_STYLE_AWARD
+ if ( date->ControlActive )
+ _DateUpdateEntry(date);
+
+ if ( date->Sel == 0 )
+ date->Sel = 2;
+ else
+ date->Sel--;
+
+ Status = EFI_SUCCESS;
+ break;
+#endif
+
+ case ControlActionNextRight:
+ if ( date->ControlActive )
+ _DateUpdateEntry(date);
+
+#if SETUP_STYLE_AWARD
+ if ( date->Sel == 2 )
+ date->Sel = 0;
+ else
+ date->Sel++;
+
+ Status = EFI_SUCCESS;
+#endif
+ break;
+
+ case ControlActionNextUp:
+ case ControlActionNextDown:
+ if ( date->ControlActive )
+ _DateUpdateEntry(date);
+ break;
+
+ case ControlActionAbort:
+ if ( date->ControlActive )
+ {
+ date->ControlActive = FALSE;
+ Status = EFI_SUCCESS;
+ }
+ break;
+
+ case ControlActionSelect:
+ if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ NumericSoftKbdInit();
+ _DateUpdateEntry(date);
+// for EZPORT: expressely to go to next entry in date control after hitting enter
+#if SETUP_STYLE_AWARD
+ break;
+#endif
+
+ case ControlActionNextSelection:
+ if ( date->ControlActive )
+ _DateUpdateEntry(date);
+
+ if ( date->Sel == 2 )
+ date->Sel = 0;
+ else
+ date->Sel++;
+
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionPrevSelection:
+ if ( date->ControlActive )
+ _DateUpdateEntry(date);
+
+ if ( date->Sel == 0 )
+ date->Sel = 2;
+ else
+ date->Sel--;
+
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionDecreament:
+ if(date->ControlActive)
+ {
+ _DateUpdateEntry(date);
+ }
+ _DateDecrease( date );
+ date->ControlActive = TRUE;
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionIncreament:
+ if(date->ControlActive)
+ {
+ _DateUpdateEntry(date);
+ }
+ _DateIncrease( date );
+ date->ControlActive = TRUE;
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionNumeric:
+ if( !(date->ControlActive) )
+ {
+ MemSet(DateTempNum, 10, 0x0);
+ date->ControlActive = TRUE;
+ switch(date->Sel)
+ {
+ case 0:
+ if((dateFormat == DATE_STYLE_YYYYDDMM) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year );
+ else if(dateFormat == DATE_STYLE_DDMMYYYY)
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%d",Tm.Day);
+ else
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%d",Tm.Month);
+ break;
+ case 1:
+ if((dateFormat == DATE_STYLE_DDMMYYYY) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%d",Tm.Month);
+ else
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%d",Tm.Day);
+ break;
+ case 2:
+ if(dateFormat == DATE_STYLE_YYYYDDMM)
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%d",Tm.Month);
+ else if(dateFormat == DATE_STYLE_YYYYMMDD)
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%d",Tm.Day);
+ else
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year );
+ break;
+ }
+ }
+
+ if(EfiStrLen(DateTempNum)>1)
+ DateTempNum[0] =DateTempNum[1];
+
+ if (
+ ( (2 == date->Sel) && (DATE_STYLE_MMDDYYYY == dateFormat || DATE_STYLE_DDMMYYYY == dateFormat) ) ||
+ ( (0 == date->Sel) && (DATE_STYLE_YYYYDDMM == dateFormat || DATE_STYLE_YYYYMMDD == dateFormat) )
+ )
+ {
+ DateTempNum[1] =DateTempNum[2];
+ DateTempNum[2] =DateTempNum[3];
+ DateTempNum[3] = key.Key.UnicodeChar;
+ }else
+ DateTempNum[1] = key.Key.UnicodeChar;
+
+ Status = gDate.Draw(date);
+ break;
+
+ default:
+ if ( date->ControlActive )
+ _DateUpdateEntry(date);
+ break;
+ }
+
+ if( (((!date->ControlActive)||(!IsMouseClickedonSoftkbd())) && (TSEMouseIgnoreMouseActionHook() == TRUE) )&&
+ (((Data->Input.Type == ACTION_TYPE_KEY) &&
+ ((Action == ControlActionNextLeft) ||(Action == ControlActionNextRight) ||(Action == ControlActionNextUp) ||(Action == ControlActionNextDown) ||(Action == ControlActionPageUp) ||(Action == ControlActionPageDown) ||(Action == ControlActionAbort) ||(Action == ControlActionHome) ||(Action == ControlActionEnd) ||(CheckKeyinHotKeysList(key))) ) ||
+ ((Data->Input.Type == ACTION_TYPE_MOUSE)&&((!((Data->Input.Data.MouseInfo.Top >= (UINT32)date->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(date->Top+date->Height))&&(Data->Input.Data.MouseInfo.Left >= (UINT32)date->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(date->Left+date->Width))))||(Action == ControlActionAbort))))
+ )
+ {
+ NumericSoftKbdExit();//EIP62763 : Check for softkbd presence and existing the numeric softkbd
+ }
+
+ _DateUpdateHelp( date );
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: DATE_DATA *date, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateSetCallback( DATE_DATA *date, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateSetFocus
+//
+// Description: Function to set the Date focus.
+//
+// Input: DATE_DATA *date, BOOLEAN focus
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateSetFocus( DATE_DATA *date, BOOLEAN focus)
+{
+ if(focus != FALSE)
+ {
+ if ( CheckControlCondition( &date->ControlData ) )
+ return EFI_UNSUPPORTED;
+ }
+
+ if( !(date->ControlFocus && focus) )
+ {
+ date->ControlFocus = focus;
+
+ // set the selected field to Month
+ date->Sel = 0;
+ _DateUpdateHelp( date );
+ }
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateSetPosition
+//
+// Description: Function to set the date position.
+//
+// Input: DATE_DATA *date, UINT16 Left, UINT16 Top
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateSetPosition( DATE_DATA *date, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( date, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateSetDimensions
+//
+// Description: Function to set the date dimensions.
+//
+// Input: DATE_DATA *date, UINT16 Width, UINT16 Height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateSetDimensions( DATE_DATA *date, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( date, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateSetAttributes
+//
+// Description: Function to set the date attributes.
+//
+// Input: DATE_DATA *date, UINT8 FGColor, UINT8 BGColor
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateSetAttributes( DATE_DATA *date, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( date, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DateGetControlHeight
+//
+// Description: Function to get the data label height.
+//
+// Input: DATE_DATA *date, frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS DateGetControlHeight(DATE_DATA *date, VOID * frame, UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width;
+
+ *height = 1;
+ Width = (UINT16)(date->LabelMargin - (((FRAME_DATA*)frame)->FrameData.Left + (UINT8)gControlLeftPad));
+
+ text = HiiGetString( date->ControlData.ControlHandle, UefiGetPromptField(date->ControlData.ControlPtr) );
+ newText = StringWrapText( text, Width, height );
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+ }
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DateGetWeekDay
+//
+// Description: Function to get weekday.
+//
+// Input: EFI_TIME *tm
+//
+// Output: UINTN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _DateGetWeekDay( EFI_TIME *tm )
+{
+ //EIP-75384 Static Code
+ //EIP-80092
+ INTN d, m, y, c;
+ INTN w;
+
+ d = tm->Day;
+ m = tm->Month - 2;
+ y = tm->Year;
+
+ if ( m <= 0 )
+ {
+ m += 12;
+ y--;
+ }
+
+ c = y / 100;
+ y %= 100;
+
+ w = d + y + (5 * c) + ((13 * m - 1) / 5) + (y / 4) + (c / 4);
+
+ return w % 7;
+
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DateDecrease
+//
+// Description: Function to decrement date.
+//
+// Input: DATE_DATA *date
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _DateDecrease( DATE_DATA *date )
+{
+ EFI_TIME Tm;
+ BOOLEAN Case_day = FALSE;
+ UINTN dateFormat = StyleGetDateFormat() ;
+
+ //gRT->GetTime( &Tm, NULL );
+ UefiGetTime(&date->ControlData, &Tm);
+
+ switch ( date->Sel )
+ {
+ case 0:
+ if((dateFormat == DATE_STYLE_YYYYDDMM) || (dateFormat == DATE_STYLE_YYYYMMDD)){
+ Tm.Year--;
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year); //Update the static date string
+ }else if(dateFormat == DATE_STYLE_DDMMYYYY)
+ {
+ if ( Tm.Day > 1 )
+ Tm.Day--;
+ else
+ Tm.Day = 31; // this is to find out wich is the highest day for the month.
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ Case_day = TRUE;
+ }else{
+ if ( Tm.Month > 1 )
+ Tm.Month--;
+ else
+ Tm.Month = 12;
+ StrZeroPad(Tm.Month, DateTempNum); //Update the static date string
+ }
+ break;
+ case 1:
+ if((dateFormat == DATE_STYLE_DDMMYYYY) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ {
+ if ( Tm.Month > 1 )
+ Tm.Month--;
+ else
+ Tm.Month = 12;
+ StrZeroPad(Tm.Month, DateTempNum); //Update the static date string
+ }else{
+ if ( Tm.Day > 1 )
+ Tm.Day--;
+ else
+ Tm.Day = 31; // this is to find out wich is the highest day for the month.
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ Case_day = TRUE;
+ }
+ break;
+ case 2:
+ if(dateFormat == DATE_STYLE_YYYYDDMM)
+ {
+ if ( Tm.Month > 1 )
+ Tm.Month--;
+ else
+ Tm.Month = 12;
+ StrZeroPad(Tm.Month, DateTempNum); //Update the static date string
+ }else if(dateFormat == DATE_STYLE_YYYYMMDD){
+ if ( Tm.Day > 1 )
+ Tm.Day--;
+ else
+ Tm.Day = 31; // this is to find out wich is the highest day for the month.
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ Case_day = TRUE;
+ }else{
+ Tm.Year--;
+ if(Tm.Year > 9999)
+ Tm.Year = 9999;
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year); //Update the static date string
+ }
+ break;
+ }
+
+ while ( UefiSetTime(&date->ControlData, &Tm) != EFI_SUCCESS )
+ {
+ if(Tm.Day > 28){
+ Tm.Day--; //May be this month does not support days greater than 28
+ if(Case_day == TRUE)
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ } else{
+ //EIP 79487:SetTime failed due to year decremented beyound the range
+ Tm.Year++;
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year); //Update the static date string
+ UefiSetTime(&date->ControlData, &Tm);
+ break; //SetTime failed due to some other error keep time unchanged.
+ }
+ }
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DateIncrease
+//
+// Description: Function to increment date.
+//
+// Input: DATE_DATA *date
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _DateIncrease( DATE_DATA *date )
+{
+ EFI_TIME Tm;
+ UINTN dateFormat = StyleGetDateFormat() ;
+ BOOLEAN Case_day = FALSE;
+
+ //gRT->GetTime( &Tm, NULL );
+ UefiGetTime(&date->ControlData, &Tm);
+
+ switch ( date->Sel )
+ {
+ case 0:
+ if((dateFormat == DATE_STYLE_YYYYDDMM) || (dateFormat == DATE_STYLE_YYYYMMDD)){
+ Tm.Year++;
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year); //Update the static date string
+ } else if(dateFormat == DATE_STYLE_DDMMYYYY){
+ if(Tm.Day < 31){
+ Tm.Day++;
+ } else{
+ Tm.Day = 1;
+ }
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ Case_day = TRUE;
+ } else{
+ if ( Tm.Month < 12 )
+ Tm.Month++;
+ else
+ Tm.Month = 1;
+ StrZeroPad(Tm.Month, DateTempNum); //Update the static date string
+ }
+ break;
+ case 1:
+ if((dateFormat == DATE_STYLE_DDMMYYYY) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ {
+ if ( Tm.Month < 12 )
+ Tm.Month++;
+ else
+ Tm.Month = 1;
+ StrZeroPad(Tm.Month, DateTempNum); //Update the static date string
+ } else{
+ if(Tm.Day < 31){
+ Tm.Day++;
+ } else{
+ Tm.Day = 1;
+ }
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ Case_day = TRUE;
+ }
+ break;
+ case 2:
+ if(dateFormat == DATE_STYLE_YYYYDDMM)
+ {
+ if ( Tm.Month < 12 )
+ Tm.Month++;
+ else
+ Tm.Month = 1;
+ StrZeroPad(Tm.Month, DateTempNum); //Update the static date string
+ }else if(dateFormat == DATE_STYLE_YYYYMMDD){
+ if(Tm.Day < 31){
+ Tm.Day++;
+ } else{
+ Tm.Day = 1;
+ }
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ Case_day = TRUE;
+ }else{
+ Tm.Year++;
+ if(Tm.Year > 9999)
+ Tm.Year = 0;
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year); //Update the static date string
+ }
+ break;
+ }
+
+ //if ( gRT->SetTime( &Tm ) != EFI_SUCCESS )
+ if ( UefiSetTime(&date->ControlData, &Tm) != EFI_SUCCESS )
+ {
+ //SetTime may be failed because of invalid day try with
+ //day = 1
+ Tm.Day = 1;
+ if(Case_day == TRUE)//EIP 79487
+ StrZeroPad(Tm.Day, DateTempNum); //Update the static date string
+ if(UefiSetTime(&date->ControlData, &Tm) != EFI_SUCCESS)
+ {
+ Tm.Year--;
+ SPrint(DateTempNum,sizeof(DateTempNum),L"%04d",Tm.Year); //EIP 79487:Update the static date string
+ UefiSetTime(&date->ControlData, &Tm); //If this second SetTime also fails dont worry the time didnt change
+ }
+
+ }
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DateUpdateEntry
+//
+// Description: Function to update entry.
+//
+// Input: DATE_DATA *date
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _DateUpdateEntry(DATE_DATA *date)
+{
+ EFI_TIME Tm = {0};
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINTN dateFormat = StyleGetDateFormat() ;
+
+ //gRT->GetTime( &Tm, NULL );
+ UefiGetTime(&date->ControlData, &Tm);
+
+ if(date->ControlActive)
+ {
+ // focus stays on the selection becuase we just edited it
+ switch(date->Sel)
+ {
+ case 0:
+ if((dateFormat == DATE_STYLE_YYYYDDMM) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ Tm.Year = (UINT16)atoi(DateTempNum, 10);
+ else if(dateFormat == DATE_STYLE_DDMMYYYY)
+ Tm.Day = (UINT8)atoi(DateTempNum, 10);
+ else
+ Tm.Month = (UINT8)atoi(DateTempNum, 10);
+ break;
+ case 1:
+ if((dateFormat == DATE_STYLE_DDMMYYYY) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ Tm.Month = (UINT8)atoi(DateTempNum, 10);
+ else
+ Tm.Day = (UINT8)atoi(DateTempNum, 10);
+ break;
+ case 2:
+ if(dateFormat == DATE_STYLE_YYYYDDMM)
+ Tm.Month = (UINT8)atoi(DateTempNum, 10);
+ else if(dateFormat == DATE_STYLE_YYYYMMDD)
+ Tm.Day = (UINT8)atoi(DateTempNum, 10);
+ else
+ Tm.Year = (UINT16)atoi(DateTempNum, 10);
+ break;
+ }
+
+ UefiPreControlUpdate(&(date->ControlData));
+ UefiSetTime(&date->ControlData, &Tm);
+ //For interactive date control invoke the formcallback functions
+ if(UefiIsInteractive(&date->ControlData)){
+ UINT8 Flags = UefiGetFlagsField(date->ControlData.ControlPtr) ;
+
+ if(CheckDateFlags(Flags))
+ {
+ //for storage type QF_DATE_STORAGE_NORMAL generate time in EFI_HII_DATE format
+
+ //Call the callbacks passing the generated input value and value size
+ Status = CallFormCallBack(&date->ControlData, UefiGetControlKey(&date->ControlData), 0, AMI_CALLBACK_CONTROL_UPDATE);
+ }// else {
+ //This case would be handled by UefiSetTime() outside using runtime services
+ //}
+ }
+
+ date->ControlActive = FALSE;
+ }
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DateUpdateHelp
+//
+// Description: Function to update help.
+//
+// Input: DATE_DATA *date
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _DateUpdateHelp( DATE_DATA *date )
+{
+ UINT16 helpToken = date->ControlData.ControlHelp;
+ UINT16 Min,Max;
+ UINTN dateFormat = StyleGetDateFormat() ;
+
+ switch ( date->Sel )
+ {
+ case 0:
+ if((dateFormat == DATE_STYLE_YYYYDDMM) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_YEAR,&helpToken,&Min,&Max);
+ else if(dateFormat == DATE_STYLE_DDMMYYYY)
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_DAY,&helpToken,&Min,&Max);
+ else
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_MONTH,&helpToken,&Min,&Max);
+ break;
+ case 1:
+ if((dateFormat == DATE_STYLE_DDMMYYYY) || (dateFormat == DATE_STYLE_YYYYMMDD))
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_MONTH,&helpToken,&Min,&Max);
+ else
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_DAY,&helpToken,&Min,&Max);
+ break;
+ case 2:
+ if(dateFormat == DATE_STYLE_YYYYDDMM)
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_MONTH,&helpToken,&Min,&Max);
+ else if(dateFormat == DATE_STYLE_YYYYMMDD)
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_DAY,&helpToken,&Min,&Max);
+ else
+ UefiGetDateTimeDetails(date->ControlData.ControlPtr,AMI_DATE_YEAR,&helpToken,&Min,&Max);
+ break;
+ default:
+ break;
+ }
+
+ date->ControlData.ControlHelp = helpToken;
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Date.h b/EDK/MiniSetup/TseLite/Date.h
new file mode 100644
index 0000000..d833eb8
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Date.h
@@ -0,0 +1,181 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Date.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 9 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Date.h $
+//
+// 9 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 8 11/21/11 12:10p Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 7 6/04/10 12:53p Blaines
+// Add support for UEFI 2.1 date and time controls
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 5/20/09 3:42p Blaines
+// Update support for date format
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Date.h
+//
+// Description: Header file for Date controls
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _DATE_H_
+#define _DATE_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+
+#define DATE_MEMBER_VARIABLES \
+ UINT8 LabelFGColor; \
+ UINT8 NSelLabelFGColor; \
+ UINT8 LabelMargin; \
+ UINT8 Sel; \
+ UINT8 SelFGColor; \
+ UINT8 SelBGColor; \
+ UINT8 NSelFGColor; \
+ UINT16 Min; \
+ UINT16 Max; \
+ UINT8 Interval;
+
+typedef struct _DATE_METHODS DATE_METHODS;
+
+typedef struct _DATE_DATA
+{
+ DATE_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ DATE_MEMBER_VARIABLES
+
+}
+DATE_DATA;
+
+
+struct _DATE_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+};
+
+extern DATE_METHODS gDate;
+
+extern EFI_STATUS UefiGetTime(CONTROL_INFO *control, EFI_TIME *Tm);
+extern EFI_STATUS UefiSetTime(CONTROL_INFO *control, EFI_TIME *Tm);
+
+// Object Methods
+EFI_STATUS DateCreate( VOID **object );
+EFI_STATUS DateDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS DateInitialize( VOID *object, VOID *data );
+EFI_STATUS DateDraw( VOID *object );
+EFI_STATUS DateHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS DateSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS DateSetFocus( VOID *object, BOOLEAN focus);
+EFI_STATUS DateSetPosition( VOID *object, UINT16 Left, UINT16 Top );
+EFI_STATUS DateSetDimensions( VOID *object, UINT16 Width, UINT16 Height );
+EFI_STATUS DateSetAttributes( VOID *object, UINT8 FGColor, UINT8 BGColor );
+EFI_STATUS DateGetControlHeight(VOID *object, VOID *frame, UINT16 *height);
+
+UINTN _DateGetWeekDay( EFI_TIME *tm );
+VOID _DateDecrease( DATE_DATA *date );
+VOID _DateIncrease( DATE_DATA *date );
+VOID _DateUpdateHelp( DATE_DATA *date );
+
+#define DATE_STYLE_MMDDYYYY 0
+#define DATE_STYLE_YYYYDDMM 1
+#endif /* _DATE_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Label.c b/EDK/MiniSetup/TseLite/Label.c
new file mode 100644
index 0000000..0b4c151
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Label.c
@@ -0,0 +1,523 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2012, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Label.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 15 $
+//
+// $Date: 9/05/14 6:25a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Label.c $
+//
+// 15 9/05/14 6:25a Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 14 5/02/14 9:32p Arunsb
+// EIP141986 changes reverted.
+//
+// 13 5/02/14 11:00a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 12 2/11/14 9:01p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 11 12/03/13 1:07p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 10 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 7 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 9 2/02/12 1:17p Premkumara
+// [TAG] EIP75351,75352,75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] String.c, boot.c, TseAdvanced.c,Time.c, PopupEdit.c,
+// MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 8 11/30/11 12:44a Premkumara
+// [TAG] EIP75351
+// [Category] Improvement
+// [Description] Static code analysis.Suppress the warnings from static
+// code analyzer
+// [Files] String.c, HiiString21.c, TseAdvanced.c, Special.c,
+// UefiAction., Time.c, PopupEdit.c, MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 7 11/21/11 11:26a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 6 11/21/11 8:52a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupSel.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 5 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 4 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 3 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 4 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Label.c
+//
+// Description: This file contains code to handle Label operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+LABEL_METHODS gLabel =
+{
+ LabelCreate,
+ LabelDestroy,
+ LabelInitialize,
+ LabelDraw,
+ LabelHandleAction,
+ LabelSetCallback,
+ LabelSetFocus,
+ LabelSetPosition,
+ LabelSetDimensions,
+ LabelSetAttributes,
+ LabelGetControlHeight
+
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelCreate
+//
+// Description: Function to create a Label, which uses the Control functions.
+//
+// Input: LABEL_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelCreate( LABEL_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(LABEL_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gLabel;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelDestroy
+//
+// Description: Function to destroy a Label, which uses the Control functions.
+//
+// Input: LABEL_DATA *label, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelDestroy( LABEL_DATA *label, BOOLEAN freeMem )
+{
+ if(NULL == label)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( label, FALSE );
+
+ MemFreePointer( (VOID **)&label->Text );
+
+ if( freeMem )
+ MemFreePointer( (VOID **)&label );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelInitialize
+//
+// Description: Function to Initialize a Label, which uses the Control functions.
+//
+// Input: LABEL_DATA *label, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelInitialize( LABEL_DATA *label, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( label, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ label->ControlData.ControlHelp = ((AMI_IFR_LABEL *)label->ControlData.ControlPtr)->Help;
+
+ SetControlColorsHook(NULL, NULL ,
+ NULL, NULL ,
+ &(label->SelBGColor), &(label->SelFGColor),
+ &(label->BGColor), &(label->FGColor),
+ NULL,NULL ,
+ NULL,NULL ,NULL,NULL,NULL );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelDraw
+//
+// Description: Function to draw a Label.
+//
+// Input: LABEL_DATA *label
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelDraw(LABEL_DATA *label )
+{
+ CHAR16 *text;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ UINT8 ColorLabel = label->FGColor;
+ // check conditional ptr if necessary
+
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( label->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &label->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ text = HiiGetString( label->ControlData.ControlHandle, (UINT16)((AMI_IFR_LABEL*)(label->ControlData.ControlPtr))->Text );
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == text){
+ text = EfiLibAllocateZeroPool(2*sizeof(CHAR16));
+ if(!text)
+ return EFI_NOT_FOUND;
+ EfiStrCpy(text,L" ");
+ }
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(label->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( label->Left , label->Top,
+ (UINTN)(label->Width),(UINTN) label->Height,
+ text,(UINT8)( (label->ControlFocus) ?
+ label->SelBGColor | label->SelFGColor :
+ label->BGColor | ColorLabel ));
+ }
+ else
+ {
+ // use frame width minus margins as available space
+ // boundary overflow check
+ if ( (TestPrintLength( text) / (NG_SIZE)) > (UINTN)(label->Width))
+ text[HiiFindStrPrintBoundary(text,(UINTN)(label->Width))] = L'\0';
+
+ DrawStringWithAttribute( label->Left , label->Top, text,
+ (UINT8)( (label->ControlFocus) ?
+ label->SelBGColor | label->SelFGColor :
+ label->BGColor | ColorLabel /*label->FGColor*/ ));
+ }
+
+ MemFreePointer( (VOID **)&text );
+ FlushLines( label->Top , label->Top );
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: LABEL_DATA *label, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelSetCallback( LABEL_DATA *label, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( label, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelHandleAction
+//
+// Description: Function to handle the Label actions.
+//
+// Input: LABEL_DATA *label, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelHandleAction( LABEL_DATA *label, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+
+ if ( Data->Input.Type == ACTION_TYPE_KEY )
+ {
+ CONTROL_ACTION Action;
+
+ //Get mapping
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+
+ if(ControlActionSelect == Action)
+ {
+ // this notifies container to display a msgbox or boot, etc depending on cookie
+ if(label->Callback != NULL)
+ label->Callback( label->Container,label, label->Cookie );
+
+ Status = EFI_SUCCESS;
+ }
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelSetFocus
+//
+// Description: Function to set the Label focus.
+//
+// Input: LABEL_DATA *label, BOOLEAN focus
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelSetFocus(LABEL_DATA *label, BOOLEAN focus)
+{
+ UINT8 u8ChkResult;
+
+ if(focus != FALSE)
+ {
+ u8ChkResult = CheckControlCondition( &label->ControlData );
+
+ //Setting focus to control which has no control-condtion and token TSE_SETUP_GRAYOUT_SELECTABLE is enable to make GrayoutIf control to focus and selectable
+ if ( ((u8ChkResult != COND_NONE) && (u8ChkResult != COND_GRAYOUT)) ||
+ (!IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT))
+ ){
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+
+
+ if( !(label->ControlFocus && focus) )
+ label->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelSetPosition
+//
+// Description: Function to set position.
+//
+// Input: LABEL_DATA *label, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelSetPosition(LABEL_DATA *label, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( label, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: LABEL_DATA *label, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelSetDimensions(LABEL_DATA *label, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( label, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: LABEL_DATA *label, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelSetAttributes(LABEL_DATA *label, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( label, FGColor, BGColor );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LabelGetLabelHeight
+//
+// Description: Function to get label height.
+//
+// Input: LABEL_DATA *label, UINT16 Width, UINT16 *height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS LabelGetControlHeight(LABEL_DATA *label, VOID * frame, UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width;
+
+ *height = 1;
+ Width = ((FRAME_DATA*)frame)->FrameData.Width - 2;
+
+ text = HiiGetString( label->ControlData.ControlHandle, (UINT16)((AMI_IFR_LABEL*)(label->ControlData.ControlPtr))->Text );
+ newText = StringWrapText( text, Width, height );
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+ }
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Label.h b/EDK/MiniSetup/TseLite/Label.h
new file mode 100644
index 0000000..6dffb0a
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Label.h
@@ -0,0 +1,160 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Label.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 7 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Label.h $
+//
+// 7 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Label.h
+//
+// Description: Header file for Label controls.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _LABEL_H_
+#define _LABEL_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+#include "action.h"
+#include "MessageBox.h"
+
+typedef struct _IFR_LABEL
+{
+ // this structure is, in some way, following EFI_IFR structures
+ UINT8 Opcode, Length;
+ UINT16 Text;
+ UINT16 Help;
+}
+AMI_IFR_LABEL;
+
+#define LABEL_MEMBER_VARIABLES \
+ UINT8 SelFGColor; \
+ UINT8 SelBGColor; \
+ CHAR16 *Text;
+
+typedef struct _LABEL_METHODS LABEL_METHODS;
+
+typedef struct _LABEL_DATA
+{
+ LABEL_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ LABEL_MEMBER_VARIABLES
+
+}
+LABEL_DATA;
+
+#define LABEL_METHOD_FUNCTIONS
+
+struct _LABEL_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ LABEL_METHOD_FUNCTIONS
+
+};
+
+extern LABEL_METHODS gLabel;
+
+// Object Methods
+EFI_STATUS LabelCreate( VOID **object );
+EFI_STATUS LabelDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS LabelInitialize( VOID *object, VOID *data );
+EFI_STATUS LabelDraw( VOID *object );
+EFI_STATUS LabelHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS LabelSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS LabelSetFocus( VOID *object, BOOLEAN focus);
+EFI_STATUS LabelSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS LabelSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS LabelSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS LabelGetControlHeight(VOID *object, VOID *frame, UINT16 *height);
+#endif /* _LABEL_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/ListBox.c b/EDK/MiniSetup/TseLite/ListBox.c
new file mode 100644
index 0000000..fa7282c
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/ListBox.c
@@ -0,0 +1,1436 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ListBox.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 32 $
+//
+// $Date: 5/03/14 3:11p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ListBox.c $
+//
+// 32 5/03/14 3:11p Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 31 5/02/14 3:54a Arunsb
+// [TAG] EIP155965
+// [Category] Improvement
+// [Description] MessageBox, ListBox cannot be canceled by Mouse
+// Right-Click
+// [Files] MessageBox.c, ListBox.c and minisetupext.c
+//
+// 30 2/11/14 9:03p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 29 12/05/13 1:25a Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 28 12/03/13 2:11p Premkumara
+// [TAG] EIP130420
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] String is getting truncated
+// [RootCause] The string for messagebox, Popup controls is getting
+// truncated
+// [Solution] Used temp variable to store original string and modify the
+// string temp and used to avoid changing org string.
+// [Files] String.c
+//
+// 27 1/22/13 12:21a Rajashakerg
+// [TAG] EIP103449
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] In Setup click\Touch from navigation window, option are not
+// displayed properly
+// [RootCause] Latest mouse driver providing LEFT_DOWN when we hold the
+// mouse left down button.
+// [Solution] Provided fix resolves the issue.
+// [Files] ezport.c, PopupEdit.c, ListBox.c, MessageBox.c
+//
+// 26 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 26 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 24 9/21/12 8:40a Arunsb
+// Build error corrected
+//
+// 23 9/18/12 6:31a Arunsb
+// [TAG] EIP93686
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] When string too long will hang on bbs menu
+// [RootCause] listbox->Width is not within the limit
+// [Solution] listbox->Width handled properly
+// [Files] ListBox.c
+//
+// 22 5/28/12 12:32p Premkumara
+// [TAG] EIP67049 & 90224
+// [Category] New Feature
+// [Description] Support mouse drag operation in frame and list box
+// [Files] CommonHelper.c, Frame.c, ListBox.c, Minisetupext.h
+//
+// 21 5/21/12 3:09a Arunsb
+// [TAG] EIP87658
+// [Category] Improvement
+// [Description] Baudrate 9600 refresh sreen twice. Removed screen
+// saving and restoring.
+// [Files] Listbox.c
+//
+// 20 1/20/12 4:11a Rajashakerg
+// [TAG] EIP78929
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Control selection using Mouse is not user friendly.
+// [RootCause] Updating the buffer with mouse click information provided
+// by mouse driver is improper.
+// [Solution] Updated the mouse click information properly to the buffer
+// which is used by tse to do action.
+// [Files] Action.c, frame.c ListBox.c
+//
+// 19 11/01/11 5:47a Arunsb
+// [Category] Improvement
+// [Description] To change the single click behaviour as like double
+// click
+// [Files] amitse.sdl, commonhelper.c, commonoem.c and listbox.c
+//
+// 18 10/19/11 1:00p Madhans
+// Fix to check for Listbox is NOT NULL before free the controls.
+//
+// 17 1/24/11 1:38p Blaines
+// [TAG] - EIP 48316
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- The keys "Caps Lock", "Scroll Lock" and "Num Lock" have
+// function and the function is the same as the key "Enter".
+// [Solution] - Check for valid listbox hot-keys before calling listbox
+// callback function.
+// [Function] - ListBoxHandleAction
+// [File] - listbox.c.
+//
+// 16 12/24/10 3:46p Mallikarjunanv
+// [TAG] EIP 45949
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] BIOS Setup hang when the control string length is long
+// [RootCause] List box title string is not truncated if it exceeds the
+// limit.
+// [Solution] Truncating the list box title string if it exceeds the
+// limit
+//
+// [Files] ListBox.c
+//
+// 15 12/24/10 11:38a Mallikarjunanv
+// [TAG] EIP48384
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Unable to select options in "Delete boot option", "Boot
+// [RootCause] In case of Listbox with scroll bar control is returned
+// without updating the selected control
+// [Solution] Fixed the issue with respect to List box selection using
+// mouse by commenting the return statement before selecting/highliting
+// the clicked control.
+// [Files] ListBox.c
+//
+// 14 11/18/10 7:24p Blaines
+// [TAG] - EIP 45374
+// [Category]- Function Request
+// [Synopsis]- Need method to configure Post Menu programmatically, Items
+// requested
+// - Exit Keys
+// - Font Colors
+// - Background Colors.
+// [Solution]
+// - Create hook to set window color,
+// - Add AMI_POSTMENU_ATTRIB_EXIT_KEY attribute to POSTMENU_TEMPLATE to
+// configure exit keys.
+// [Files] - stylecommon.c, style.h, listbox.c, minisetupext.c,
+// AMIPostMgr.h
+//
+//
+// [TAG] - EIP 48417
+// [Category]- Defect
+// [Symptom]- PostManagerDisplayMenu does not dynamically update Menu
+// Title on language change.
+//
+// [Solution]- Update listbox title string by calling HiiGetString
+// whenever a selection is made. redraws.
+// [Files] - listbox.c, minisetupext.c,
+//
+//
+//
+// 13 10/20/10 1:40p Mallikarjunanv
+// reverting back to v25
+//
+// 11 9/07/10 12:25a Mallikarjunanv
+// EIP-42124: Added Page up and Page down key in List box
+//
+// 10 8/12/10 11:30a Blaines
+// EIP-41614 : Change to allow DisplayPostMenu protocol to dynamically
+// update menu items modified from the callback functions.
+//
+// 9 6/15/10 10:47a Blaines
+// Fix issue where Listbox->PtrItems[] is refered in places even if the
+// style is not POPUP_STYLE_BBS.
+//
+// 8 6/04/10 12:58p Blaines
+// Add support for displaying menu list with (ALL) non-focusable items.
+//
+// 7 5/24/10 6:06p Blaines
+// Make sure selectable items are not hidden or non-focused in the
+// function ListBoxHandleAction.
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 9 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 8 2/15/10 10:13p Madhans
+// To avoid warnings
+//
+// 7 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 6 1/09/10 6:51a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 5 8/26/09 4:11p Blaines
+// To fix issue with BBS popup when more then 20 bootoptions are present
+//
+// 4 8/19/09 12:54p Madhans
+// To return failure on invalid action.
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:08p Madhans
+// UefiGetOption Interface change..
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: ListBox.c
+//
+// Description: This file contains code to handle Listbox controls
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+//EIP-67049
+static INT32 lButtonVaryingPosition = 0;
+static INT32 lButtonInitialPosition = 0;
+BOOLEAN lButtonOnListBoxScroll = FALSE;
+BOOLEAN ScrollBarMoveAction = FALSE;
+static UINT32 gListBoxScrollBarTop = 0, gListBoxScrollBarBottom = 0;
+//EIP-67049 End
+LISTBOX_METHODS gListBox =
+{
+ ListBoxCreate,
+ ListBoxDestroy,
+ ListBoxInitialize,
+ ListBoxDraw,
+ ListBoxHandleAction,
+ ListBoxSetCallback,
+ ListBoxSetFocus,
+ ListBoxSetPosition,
+ ListBoxSetDimensions,
+ ListBoxSetAttributes,
+ ListBoxGetControlHight,
+ ListBoxInitializeBBSPopup
+};
+BOOLEAN SingleClickActivation (VOID); //EIP74141 providing select option for single click too
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxCreate
+//
+// Description: Function to create a List Box, which uses the popup controls.
+//
+// Input: LISTBOX_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxCreate( LISTBOX_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(LISTBOX_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gPopup.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gListBox;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxDestroy
+//
+// Description: Function to Destroy a List Box, which uses the popup controls.
+//
+// Input: LISTBOX_DATA *listbox, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxDestroy( LISTBOX_DATA *listbox, BOOLEAN freeMem )
+{
+ if(listbox == NULL)
+ return EFI_SUCCESS;
+
+ gPopup.Destroy( listbox, FALSE );
+
+ RestoreScreen( listbox->ScreenBuf );
+
+ if( freeMem )
+ {
+ MemFreePointer((VOID **)&listbox->Title);
+ MemFreePointer((VOID **)&listbox->PtrTokens);
+ MemFreePointer((VOID **)&listbox->PtrItems);
+ MemFreePointer((VOID **)&listbox->Help1);
+ MemFreePointer((VOID **)&listbox->Help2);
+ MemFreePointer((VOID **)&listbox->Help3);
+ MemFreePointer( (VOID **)&listbox );
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SetListBoxString
+//
+// Description: Function to set a string in List Box.
+//
+// Input: LISTBOX_DATA *listbox, CHAR16 **pStr,UINT16 Toke
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SetListBoxString(LISTBOX_DATA *listbox, CHAR16 **pStr,UINT16 Token)
+{
+ CHAR16 *TempStr=NULL;
+ UINT16 TitleLength;
+
+ TempStr = HiiGetString( listbox->ControlData.ControlHandle, Token );
+
+ if ( TempStr != NULL )
+ {
+ TitleLength = (UINT16)((TestPrintLength( TempStr ) / (NG_SIZE)) + 3);
+
+ //EIP_45949 - Truncate the list box title if it exceeds the limit
+ if( TitleLength > gMaxCols-9 ){
+ TempStr[gMaxCols-9] = L'\0';
+ TitleLength = (UINT16)((TestPrintLength( TempStr ) / (NG_SIZE)) + 3);
+ }
+
+ if( listbox->Width < TitleLength + 4 )
+ listbox->Width = TitleLength + 4;
+ }
+ *pStr = TempStr;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: GetLineCount
+//
+// Description: function to get line count and max width.
+//
+// Input: CHAR16 *line, UINT8 *Width
+//
+//
+// Output: UINTN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN GetLineCount(CHAR16 *line, UINT8 *Width )
+{
+ CHAR16 * text;
+ UINTN i=1;
+ CHAR16 * String=line;
+ UINT8 length;
+
+ while(1)
+ {
+ CHAR16 save;
+
+ text = String;
+ if ( *String == L'\0' )
+ break;
+
+ while ( ( *String != L'\n' ) &&( *String != L'\r' ) && ( *String != L'\0' ) )
+ String++;
+
+ save = *String;
+ *String = L'\0';
+
+ length = 0 ;
+ length = (UINT8)((TestPrintLength(text) / (NG_SIZE))) ;
+ if(length > *Width)
+ *Width = length ;
+
+ if ( ( *String = save ) != L'\0' )
+ {
+ if ( *String == L'\r' )
+ { String++;
+ i--;
+ }
+ if ( *String == L'\n' )
+ {
+ String++;
+
+ if ( *(String - sizeof(CHAR16)) == L'\r' )
+ i++;
+ }
+ }
+ else
+ break;
+ i++;
+ }
+ return i;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SetListBoxHelpString
+//
+// Description: Function to set a string in List Box.
+//
+// Input: LISTBOX_DATA *listbox, CHAR16 **pStr,UINT16 Toke
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SetListBoxHelpString(LISTBOX_DATA *listbox, CHAR16 **pStr,UINT16 Token)
+{
+ CHAR16 *TempStr=NULL;
+ UINT8 Width=0 ;
+
+ TempStr = HiiGetString( listbox->ControlData.ControlHandle, Token );
+
+ if ( TempStr != NULL )
+ {
+ GetLineCount(TempStr, &Width);
+
+ if( listbox->Width < Width + 4 )
+ listbox->Width = Width + 4;
+ }
+ *pStr = TempStr;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SetListBoxString
+//
+// Description: Function to set the common fields in a List Box.
+//
+// Input: LISTBOX_DATA *listbox
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SetListBoxCommonFields(LISTBOX_DATA *listbox)
+{
+
+ listbox->Width += 4;
+ listbox->Sel = 0;
+
+ // check if we need to use do srollbar
+ if(listbox->Height > MAX_VISIBLE_SELECTIONS )
+ {
+ listbox->Height = (UINT16)MAX_VISIBLE_SELECTIONS;
+ listbox->Width++; // ad space for the scrollbar.
+ listbox->FirstVisibleSel = 0;
+ listbox->LastVisibleSel = listbox->Height-3; // 2 for borders and 1 more because is zero based.
+
+ }
+ else
+ {
+ listbox->FirstVisibleSel = 0;
+ listbox->LastVisibleSel = listbox->Height-3;
+ }
+ SetControlColorsHook(NULL, NULL, NULL, NULL ,NULL, NULL,
+ NULL , NULL,NULL, NULL, NULL,NULL ,NULL,
+ &(listbox->FGColor),&(listbox->BGColor));
+
+ listbox->Border =TRUE;
+ listbox->Shadow = TRUE;
+ if(listbox->ScreenBuf == NULL)
+ listbox->ScreenBuf = SaveScreen();
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SetListBoxString
+//
+// Description: Function to initialize a List Box, which uses the Popup controls.
+//
+// Input: LISTBOX_DATA *listbox, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxInitialize( LISTBOX_DATA *listbox, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 TempLength=0;
+ UINT16 TitleToken;
+ UINT16 Index= 0 ;
+
+ Status = gPopup.Initialize( listbox, data );
+ if (EFI_ERROR(Status))
+ return Status;
+ // add extra initialization here...
+ listbox->ControlData.ControlHelp = UefiGetHelpField(listbox->ControlData.ControlPtr);
+
+ listbox->ListHandle = listbox->ControlData.ControlHandle;
+ listbox->HiddenItemCount = 0;
+ Status = UefiGetOneOfOptions(&listbox->ControlData,&listbox->ListHandle,&listbox->PtrTokens, NULL, &listbox->ItemCount,NULL,NULL);
+
+ if ( ! EFI_ERROR(Status) )
+ {
+
+ for ( Index = 0; Index < listbox->ItemCount; Index++ )
+ {
+ TempLength = (UINT16)HiiMyGetStringLength( listbox->ListHandle, listbox->PtrTokens[Index] );
+
+ if ( TempLength > listbox->Width )
+ listbox->Width = TempLength;
+ }
+ if (listbox->Width > (gMaxCols-6))
+ listbox->Width = (UINT16)(gMaxCols-6);
+
+ listbox->ItemCount = Index;
+ listbox->Height = Index + 2;
+
+ //pad title
+ TitleToken = UefiGetPromptField(listbox->ControlData.ControlPtr);
+ SetListBoxString(listbox,&listbox->Title ,TitleToken);
+ SetListBoxCommonFields(listbox);
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SetListBoxString
+//
+// Description: Function to initialize the BBS Popup in a List Box.
+//
+// Input: LISTBOX_DATA *listbox, LISTBOX_BSS_POPUP_DATA *listboxBBSPopupData
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxInitializeBBSPopup( LISTBOX_DATA *listbox, LISTBOX_BSS_POPUP_DATA *listboxBBSPopupData )
+{
+ UINT16 Index= 0 ;
+ UINT16 TempLength=0;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ listbox->Style = POPUP_STYLE_BBS;
+
+ if(listboxBBSPopupData->pControlData != NULL )
+ MemCopy( &listbox->ControlData, listboxBBSPopupData->pControlData, sizeof(CONTROL_INFO) );
+
+ listbox->ListHandle = listbox->ControlData.ControlHandle;
+ listbox->ItemCount = listboxBBSPopupData->ItemCount;
+ listbox->HiddenItemCount = listboxBBSPopupData->HiddenItemCount;
+ listbox->Height = listbox->ItemCount - listbox->HiddenItemCount + 2;
+
+ listbox->PtrItems = EfiLibAllocatePool( listbox->ItemCount * sizeof(POSTMENU_TEMPLATE) );
+ if ( listbox->PtrItems == NULL )
+ Status = EFI_OUT_OF_RESOURCES;
+ else
+ {
+ for ( Index = 0; Index < listbox->ItemCount; Index++ )
+ {
+ listbox->PtrItems[Index] = listboxBBSPopupData->PtrItems[Index] ;
+
+ if((listbox->PtrItems[Index].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN)&&
+ (listbox->PtrItems[Index].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY))
+ {
+ TempLength = (UINT16)HiiMyGetStringLength( listbox->ListHandle, listbox->PtrItems[Index].ItemToken );
+
+ if ( TempLength > listbox->Width )
+ listbox->Width = TempLength;
+ }
+ }
+ if (listbox->Width > (gMaxCols-6))
+ listbox->Width = (UINT16)(gMaxCols-6);
+
+ if(listboxBBSPopupData->TitleToken)
+ SetListBoxString(listbox,&listbox->Title ,listboxBBSPopupData->TitleToken);
+ if(listboxBBSPopupData->Help1Token)
+ SetListBoxHelpString(listbox,&listbox->Help1 ,listboxBBSPopupData->Help1Token);
+ //SetListBoxString(listbox,&listbox->Help2 ,listboxBBSPopupData->Help2Token);
+ //SetListBoxString(listbox,&listbox->Help3 ,listboxBBSPopupData->Help3Token);
+ SetListBoxCommonFields(listbox);
+ }
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure : ListBoxDrawSeperator
+//
+// Description : function to draw the border
+//
+// Input : UINTN Left, UINTN Top, UINTN Width, UINTN Height
+//
+// Output : void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID ListBoxDrawSeperator( LISTBOX_DATA *listbox, UINTN Left, UINTN Top, UINTN Width, UINTN Height )
+{
+ UINTN Index;
+ CHAR16 *Line;
+
+ UINTN Right, Bottom;
+
+ Line = EfiLibAllocateZeroPool( (Width + 6) * sizeof(CHAR16) );
+
+ if ( Line == NULL )
+ return;
+
+ Right = Left + Width - 1;
+ Bottom = Top + Height - 1;
+
+ for ( Index = 1; Index < Width - 1; Index++ )
+ Line[Index] = BOXDRAW_HORIZONTAL;
+
+ if(listbox->Border)
+ {
+ Line[0] = BOXDRAW_VERTICAL_RIGHT;
+
+ if(!listbox->UseScrollbar)
+ Line[Index] = BOXDRAW_VERTICAL_LEFT;
+
+ DrawString( Left, Top, Line );
+ }
+
+
+
+ MemFreePointer( (VOID **)&Line );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxDraw
+//
+// Description: Function to draw a List Box.
+//
+// Input: LISTBOX_DATA *listbox
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxDraw( LISTBOX_DATA *listbox )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINTN Index;
+ CHAR16 *text = NULL;
+ UINT32 FirstLine = 0, LastLine = 0;
+ CHAR16 ArrUp[2]={{GEOMETRICSHAPE_UP_TRIANGLE},{0x0000}},ArrDown[2]={{GEOMETRICSHAPE_DOWN_TRIANGLE},{0x0000}},ScrlSel[2]={{BLOCKELEMENT_FULL_BLOCK/*L'N'*/},{0x0000}},ScrlNSel[2]={{BLOCKELEMENT_LIGHT_SHADE/*L'S'*/},{0x0000}};
+ UINT16 BorderWidth = 4;
+ UINT8 FGColor = listbox->FGColor;
+ UINT8 BGColor = listbox->BGColor;
+
+
+ Status = gPopup.Draw( listbox );
+ if (Status != EFI_SUCCESS)
+ return Status;
+
+ listbox->UseScrollbar = FALSE;
+
+
+ // check if we need to use do scrollbar
+ if((listbox->ItemCount-listbox->HiddenItemCount) > (UINT16)(MAX_VISIBLE_SELECTIONS - 2))
+ {
+ listbox->UseScrollbar = TRUE ;
+ BorderWidth = 5;
+ //EIP-67049
+ if (!ScrollBarMoveAction)
+ {
+ if( listbox->Sel < listbox->FirstVisibleSel)
+ {
+ if((listbox->Sel != 0) && (listbox->Sel < listbox->LastVisibleSel -1))
+ {
+ listbox->FirstVisibleSel = listbox->Sel;
+ listbox->LastVisibleSel = listbox->Sel + listbox->Height -3 ;
+ }
+ else
+ {
+ if( listbox->Sel !=0)
+ {
+ listbox->FirstVisibleSel = listbox->Sel /*--*/;
+ listbox->LastVisibleSel = listbox->FirstVisibleSel + listbox->Height -3;
+ }
+ else
+ {
+ listbox->FirstVisibleSel = 0 ;
+ listbox->LastVisibleSel = listbox->Height -3;
+ }
+ }
+ }
+
+ if(listbox->Sel > listbox->LastVisibleSel )
+ {
+ if( (( listbox->Sel +listbox->Height-3) <= (listbox->ItemCount-listbox->HiddenItemCount-1) ) && (listbox->Sel > listbox->LastVisibleSel +1))
+ {
+ listbox->FirstVisibleSel = listbox->Sel;
+ listbox->LastVisibleSel = listbox->Sel + listbox->Height -3 ;
+ }
+ else
+ {
+ if( (listbox->Sel ) < (listbox->ItemCount-listbox->HiddenItemCount-1))
+ {
+ listbox->FirstVisibleSel = listbox->Sel - listbox->Height +3 /*--*/;
+ listbox->LastVisibleSel = listbox->Sel;
+ }
+ else
+ {
+ listbox->FirstVisibleSel = listbox->ItemCount-listbox->HiddenItemCount-1 - listbox->Height +3 ;
+ listbox->LastVisibleSel = listbox->ItemCount-listbox->HiddenItemCount-1;
+ }
+ }
+ }
+ }
+
+ // draw the scrollbar
+ DrawStringWithAttribute( listbox->Left + listbox->Width -2 , listbox->Top+1, ArrUp,
+ listbox->FGColor | listbox->BGColor );
+
+ DrawStringWithAttribute( listbox->Left+ listbox->Width -2, listbox->Top + listbox->Height-2, ArrDown,
+ listbox->FGColor | listbox->BGColor );
+
+ FirstLine = ((listbox->Height-2)* listbox->FirstVisibleSel/(listbox->ItemCount-listbox->HiddenItemCount) )+ listbox->Top+2;
+ LastLine = ((listbox->Height-2)* listbox->LastVisibleSel/(listbox->ItemCount-listbox->HiddenItemCount) )+ listbox->Top+2;
+
+ gListBoxScrollBarTop = FirstLine; //EIP-67049 To store Scrollbar Top positon
+ gListBoxScrollBarBottom = LastLine; //EIP-67049 To store Scrollbar Bottom positon
+
+ for(Index = (listbox->Top + 2); Index < (UINTN)(listbox->Top + listbox->Height -2) ;Index++)
+ {
+ if( (Index >= FirstLine) && (Index < LastLine))
+ DrawStringWithAttribute( listbox->Left+ listbox->Width-2, Index, ScrlSel,
+ listbox->FGColor | listbox->BGColor );
+ else
+ DrawStringWithAttribute( listbox->Left+ listbox->Width-2, Index, ScrlNSel,
+ listbox->FGColor | listbox->BGColor );
+ }
+
+ }
+
+
+ // highlight selected item
+ for ( Index = listbox->FirstVisibleSel/*0*/; Index <= listbox->LastVisibleSel/*listbox->ItemCount*/; Index++ )
+ {
+ if ( Index == listbox->Sel )
+ {
+ FGColor = EFI_WHITE ;
+ BGColor = EFI_BACKGROUND_BLACK ;
+
+ if(listbox->Style == POPUP_STYLE_BBS)
+ {
+ text = HiiGetString( listbox->ListHandle, listbox->PtrItems[Index].ItemToken );
+
+ // Check condition if item is non-focusable
+ // This may occur if all menu items are set non-focusable
+ if( listbox->PtrItems[Index].Attribute == AMI_POSTMENU_ATTRIB_NON_FOCUS)
+ {
+ FGColor = EFI_LIGHTGRAY;
+ BGColor = listbox->BGColor;
+ }
+ }
+ else
+ text = HiiGetString( listbox->ListHandle, listbox->PtrTokens[Index]);
+
+ if(!text)
+ text = EfiLibAllocateZeroPool(2);
+ if((TestPrintLength( text) / (NG_SIZE)) >(UINTN) (listbox->Width - BorderWidth) )
+ text[HiiFindStrPrintBoundary(text ,listbox->Width - BorderWidth)] = L'\0';
+ DrawStringWithAttribute( listbox->Left + 2, listbox->Top + Index - listbox->FirstVisibleSel + 1,
+ text, BGColor | FGColor);
+ }
+ else
+ {
+ if(listbox->Style == POPUP_STYLE_BBS)
+ text = HiiGetString( listbox->ListHandle, listbox->PtrItems[Index].ItemToken );
+ else
+ text = HiiGetString( listbox->ListHandle, listbox->PtrTokens[Index] );
+
+
+ if(listbox->Style == POPUP_STYLE_BBS)
+ {
+ if (listbox->PtrItems[Index].ItemToken)
+ {
+
+ //if(!text)
+ // text = EfiLibAllocateZeroPool(2);
+ if((TestPrintLength( text) / (NG_SIZE)) > (UINTN) (listbox->Width - BorderWidth) )
+ text[HiiFindStrPrintBoundary(text ,listbox->Width - BorderWidth)] = L'\0';
+
+ // check conditional ptr if necessary
+ if( listbox->PtrItems[Index].Attribute == AMI_POSTMENU_ATTRIB_NON_FOCUS)
+ FGColor = EFI_LIGHTGRAY;
+ else
+ FGColor = listbox->FGColor ;
+
+ DrawStringWithAttribute( listbox->Left + 2, listbox->Top + Index - listbox->FirstVisibleSel + 1,
+ text, listbox->BGColor | FGColor /*popupmenu->FGColor*/ );
+ }else
+ ListBoxDrawSeperator( listbox, listbox->Left , listbox->Top + Index - listbox->FirstVisibleSel + 1,
+ listbox->UseScrollbar?(listbox->Width-2):listbox->Width, 1);
+
+ }
+ else
+ {
+
+ if(!text)
+ text = EfiLibAllocateZeroPool(2);
+ if((TestPrintLength( text) / (NG_SIZE)) > (UINTN) (listbox->Width - BorderWidth) )
+ text[HiiFindStrPrintBoundary(text ,listbox->Width - BorderWidth)] = L'\0';
+ DrawStringWithAttribute( listbox->Left + 2, listbox->Top + Index - listbox->FirstVisibleSel + 1,
+ text, listbox->BGColor | listbox->FGColor );
+ }
+ }
+ MemFreePointer( (VOID **)&text );
+ }
+
+ FlushLines( listbox->Top-2, listbox->Top+listbox->Height/*PtrTokens[0]*/ + 1+2);
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxHandleAction
+//
+// Description: Function to handle the List Box actions.
+//
+// Input: LISTBOX_DATA *listbox, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxHandleAction( LISTBOX_DATA *listbox, ACTION_DATA *Data)
+{
+ EFI_STATUS Status=EFI_SUCCESS;
+ ACTION_DATA TempData;
+ UINT16 i, start, end ;
+ VOID *ScreenBuf = NULL;
+
+ if(Data->Input.Type == ACTION_TYPE_TIMER)
+ Status = EFI_UNSUPPORTED;
+
+ if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ Status = MouseListBoxHandleAction( listbox, Data);
+ }
+
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ {
+ CONTROL_ACTION Action;
+
+ ScrollBarMoveAction = FALSE; //EIP-67049
+
+ //Get mapping
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+
+ switch(Action)
+ {
+ //EIP-42124: Add Page up and Page down key in List box
+ case ControlActionPageUp:
+ if(listbox->Style == POPUP_STYLE_NORMAL)
+ {
+ if (listbox->Sel < (listbox->Height-3))
+ listbox->Sel = 0;
+ else
+ listbox->Sel= listbox->Sel - (listbox->Height-3);
+ }
+ break;
+ case ControlActionPageDown:
+ if(listbox->Style == POPUP_STYLE_NORMAL)
+ {
+ if ((listbox->Sel+(listbox->Height-3)) > (listbox->ItemCount-1))
+ listbox->Sel = (listbox->ItemCount-1);
+ else
+ listbox->Sel= listbox->Sel + (listbox->Height-3);
+ }
+ break;
+ case ControlActionNextUp:
+ if ( listbox->Sel > 0 )
+ {
+ listbox->Sel--;
+
+ if(listbox->Style == POPUP_STYLE_BBS)
+ {
+
+ if ( (listbox->PtrItems[listbox->Sel].ItemToken==0) || (listbox->PtrItems[listbox->Sel].Attribute == AMI_POSTMENU_ATTRIB_NON_FOCUS))
+ {
+ //Send Fake Action...
+ MemCopy(&TempData,Data,sizeof(ACTION_DATA));
+ TempData.Input.Data.AmiKey.Key.ScanCode = SCAN_UP;
+ TempData.Input.Data.AmiKey.Key.UnicodeChar = CHAR_NULL ;
+ gListBox.HandleAction(listbox, &TempData);
+ }
+ }
+ }
+ else
+ {
+ if(listbox->Style == POPUP_STYLE_BBS)
+ {
+ //Rollover, find the first focusable item
+ for ( i = listbox->ItemCount-1; i > -1 ; i-- )
+ {
+ if((listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_NON_FOCUS)&&
+ (listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY)&&
+ (listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN))
+ {
+ listbox->Sel=i;
+ break;
+ }
+ }
+ }
+ else
+ listbox->Sel = listbox->ItemCount - 1;
+ }
+ break;
+
+ case ControlActionNextDown:
+ if ( (INTN)(listbox->Sel) < listbox->ItemCount-listbox->HiddenItemCount - 1 )
+ {
+ listbox->Sel++;
+
+ if(listbox->Style == POPUP_STYLE_BBS)
+ {
+
+ if ( (listbox->PtrItems[listbox->Sel].ItemToken==0) || (listbox->PtrItems[listbox->Sel].Attribute == AMI_POSTMENU_ATTRIB_NON_FOCUS))
+ {
+ //Send Fake Action...
+ MemCopy(&TempData,Data,sizeof(ACTION_DATA));
+ TempData.Input.Data.AmiKey.Key.ScanCode = SCAN_DOWN;
+ TempData.Input.Data.AmiKey.Key.UnicodeChar = CHAR_NULL ;
+ gListBox.HandleAction(listbox, &TempData);
+ }
+ }
+
+ }
+ else
+ { //Rollover, find the first focusable item
+ listbox->Sel=0;
+ if(listbox->Style == POPUP_STYLE_BBS)
+ {
+ for ( i = 0; i < listbox->ItemCount; i++ )
+ {
+ if((listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_NON_FOCUS)&&
+ (listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY)&&
+ (listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN))
+ {
+ listbox->Sel=i;
+ break;
+ }
+ }
+ }
+
+ }
+ break;
+
+ case ControlActionAbort:
+//EIP:47962 - Start
+// ScreenBuf = SaveScreen();
+ listbox->Callback( listbox->Container, listbox, NULL );
+// RestoreScreen( ScreenBuf );
+//EIP:47962 - End
+ break;
+
+ case ControlActionSelect:
+//EIP:47962 - Start
+// ScreenBuf = SaveScreen();
+ listbox->Callback( listbox->Container, listbox, &(listbox->Sel) );
+// RestoreScreen( ScreenBuf );
+//EIP:47962 - End
+ break;
+
+ default:
+ if(listbox->Style == POPUP_STYLE_BBS)
+ {
+ //Start from current selection
+ start = listbox->Sel ;
+ end = listbox->ItemCount ;
+
+ Search:
+ for ( i = start; i < end; i++ )
+ {
+ if( (listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_NON_FOCUS)&&
+ (listbox->PtrItems[i].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY))
+ {
+
+
+//EIP:48316 - Start
+ if( (listbox->PtrItems[i].Key.Key.ScanCode != 0) ||
+ (listbox->PtrItems[i].Key.Key.UnicodeChar != 0) ||
+ (listbox->PtrItems[i].Key.KeyShiftState != 0) )
+ {
+//EIP:48316 - End
+ if( (listbox->PtrItems[i].Key.Key.ScanCode == Data->Input.Data.AmiKey.Key.ScanCode) &&
+ (listbox->PtrItems[i].Key.Key.UnicodeChar == Data->Input.Data.AmiKey.Key.UnicodeChar) &&
+ TseCheckShiftState((Data->Input.Data.AmiKey), listbox->PtrItems[i].Key.KeyShiftState) )
+ {
+
+ if(listbox->PtrItems[i].Attribute == AMI_POSTMENU_ATTRIB_HIDDEN)
+ {
+ listbox->Callback( listbox->Container, listbox, &i );
+ }
+ else
+ {
+ listbox->Sel = i ;
+ listbox->Callback( listbox->Container, listbox, &(listbox->Sel) );
+ }
+
+ //Send Fake Action...
+ /*
+ MemCopy(&TempData,Data,sizeof(ACTION_DATA));
+ TempData.Input.Data.AmiKey.Key.ScanCode = 0;
+ TempData.Input.Data.AmiKey.Key.UnicodeChar = CHAR_CARRIAGE_RETURN;
+ gListBox.HandleAction(listbox, &TempData);
+ */
+
+ break;
+ }
+ }
+ }
+ }
+
+ //Wrap and Search remaining items for match
+ if(i==listbox->ItemCount && (start != 0))
+ {
+ start = 0 ;
+ end = listbox->Sel ;
+ goto Search ;
+ }
+ }
+ }
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: LISTBOX_DATA *listbox, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxSetCallback( LISTBOX_DATA *listbox, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( listbox, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: LISTBOX_DATA *listbox, BOOLEAN focus
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxSetFocus(LISTBOX_DATA *listbox, BOOLEAN focus)
+{
+ listbox->ControlFocus =focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxSetPosition
+//
+// Description: Function to set position.
+//
+// Input: LISTBOX_DATA *listbox, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxSetPosition(LISTBOX_DATA *listbox, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( listbox, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: LISTBOX_DATA *listbox, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxSetDimensions(LISTBOX_DATA *listbox, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( listbox, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: LISTBOX_DATA *listbox, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxSetAttributes(LISTBOX_DATA *listbox, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( listbox, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSEMouseListBoxHandleAction
+//
+// Description: Function to hadnle List Box using mouse
+//
+// Input: LISTBOX_DATA *listbox,
+// ACTION_DATA *action,
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TSEMouseListBoxHandleAction( LISTBOX_DATA *listbox, ACTION_DATA *Data)
+{
+ UINT16 i;
+ UINT32 Action;
+
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+ //Exit listbox if clicked outside listbox
+ //EIP 103449 : In Setup click\Touch from navigation window, option are not displayed properly
+ if( (
+ (Data->Input.Data.MouseInfo.Top < listbox->Top) ||
+ (Data->Input.Data.MouseInfo.Top > (UINT32)(listbox->Top + listbox->Height)) ||
+ (Data->Input.Data.MouseInfo.Left < listbox->Left) ||
+ (Data->Input.Data.MouseInfo.Left > (UINT32)(listbox->Left + listbox->Width))
+ ) && (!lButtonOnListBoxScroll) // Check for lButtonDown on ScrollBar
+ && ( (SingleClickActivation() && (ControlActionSelect ==Action)) || //If singleClickActivation is enabled/Disable
+ (ControlActionAbort == Action) || (ControlActionChoose ==Action ) //EIP-139608 Closing listbox whn mouse action happens outside listbox.
+ )
+ )
+ {
+ listbox->Callback( listbox->Container, listbox, NULL );
+ }
+ //Reset lbutton positions
+ if (ControlMouseActionLeftUp == Action
+ || ControlActionChoose == Action
+ || ControlActionSelect == Action)
+ {
+ lButtonOnListBoxScroll = FALSE;
+ lButtonInitialPosition = 0;
+ lButtonVaryingPosition = 0;
+ }
+ //If scrollbar present
+ if ( listbox->UseScrollbar )
+ {
+ //Check if clicked on scroll bar area
+ if( ( Data->Input.Data.MouseInfo.Top > (UINT32)listbox->Top && (Data->Input.Data.MouseInfo.Top < (UINT32)(listbox->Top + listbox->Height)) ) //Clicked inside listbox area
+ && (Data->Input.Data.MouseInfo.Left == (UINT32)(listbox->Left + listbox->Width - 2)) //Clicked on scrollbar area
+ )
+ {
+ //If clicked on UP_ARROW
+ if(((Data->Input.Data.MouseInfo.Top == (UINT32)(listbox->Top + 1)) &&(Data->Input.Data.MouseInfo.Left == (UINT32) (listbox->Left + listbox->Width -2))) //Clicked on UP_ARROW
+ &&((TSEMOUSE_LEFT_CLICK == Data->Input.Data.MouseInfo.ButtonStatus)||(TSEMOUSE_LEFT_DCLICK == Data->Input.Data.MouseInfo.ButtonStatus))//EIP 78929 : Check for left click and left double click to scroll the frame if click on arrow buttons of scroll bar.
+ )
+ {
+ ScrollBarMoveAction = TRUE;
+ MouseListBoxScrollBarMove( listbox, TRUE, 1 );
+ return EFI_SUCCESS;//EIP 78929 : Returning by consuming the click when the clicked on the arrow buttons of scroll bar
+ }
+ //If clicked on DOWN_ARROW
+ else if(((Data->Input.Data.MouseInfo.Top == (UINT32) (listbox->Top + listbox->Height-2)) &&(Data->Input.Data.MouseInfo.Left == (UINT32) (listbox->Left + listbox->Width-2))) //Clicked on DOWN_ARROW
+ &&((TSEMOUSE_LEFT_CLICK == Data->Input.Data.MouseInfo.ButtonStatus)||(TSEMOUSE_LEFT_DCLICK == Data->Input.Data.MouseInfo.ButtonStatus))//EIP 78929 : Check for left click and left double click to scroll the frame if click on arrow buttons of scroll bar.
+ )
+ {
+ ScrollBarMoveAction = TRUE;
+ MouseListBoxScrollBarMove( listbox, FALSE, 1 );
+ return EFI_SUCCESS;//EIP 78929 : Returning by consuming the click when the clicked on the arrow buttons of scroll bar
+ }
+ //If clicked on scrollbar
+ else if( ((Data->Input.Data.MouseInfo.Top < gListBoxScrollBarBottom) && (Data->Input.Data.MouseInfo.Top > gListBoxScrollBarTop)) //Scrollbar area
+ && (ControlMouseActionLeftDown == Action) //Mouse lbutton down
+ && ((ControlActionChoose != Action) || (ControlActionSelect != Action)) //Neglecting LEFT_DCLICK and LEFT_CLICK on scrollbar area
+ )
+ {
+ lButtonOnListBoxScroll = TRUE;
+ ScrollBarMoveAction = TRUE;
+ if ( lButtonInitialPosition == 0 )//To get initial lButtonDown position
+ {
+ lButtonInitialPosition = Data->Input.Data.MouseInfo.Top;
+ }
+ if ( lButtonInitialPosition != Data->Input.Data.MouseInfo.Top )
+ {
+ lButtonVaryingPosition = Data->Input.Data.MouseInfo.Top;
+ //Move scrollbar upwards
+ if( lButtonInitialPosition > lButtonVaryingPosition )
+ MouseListBoxScrollBarMove( listbox, TRUE, lButtonInitialPosition - lButtonVaryingPosition );
+
+ //Move scrollbar downwards
+ else
+ MouseListBoxScrollBarMove( listbox, FALSE, lButtonVaryingPosition - lButtonInitialPosition );
+ lButtonInitialPosition = lButtonVaryingPosition;
+ }
+ return EFI_SUCCESS;
+ }
+ //If mouse clicked above DOWN_ARROW and below ScrollBar
+ else if( (Data->Input.Data.MouseInfo.Top < (UINT32) (listbox->Top + listbox->Height-3)) //Clicked above DOWN_ARROW
+ && (Data->Input.Data.MouseInfo.Top >= gListBoxScrollBarBottom) //Clicked below ScrollBar
+ && (ControlMouseActionLeftDown == Action) //Action is LEFT_DOWN
+ )
+ {
+ ScrollBarMoveAction = TRUE;
+ MouseListBoxScrollBarMove( listbox, FALSE, Data->Input.Data.MouseInfo.Top - gListBoxScrollBarBottom );
+ return EFI_SUCCESS;
+ }
+ //If mouse clicked below UP_ARROW and above ScrollBar
+ else if( (Data->Input.Data.MouseInfo.Top > (UINT32)(listbox->Top + 1)) //Clicked below UP_ARROW
+ && (Data->Input.Data.MouseInfo.Top <= gListBoxScrollBarTop) //Clicked above ScrollBar
+ && (ControlMouseActionLeftDown == Action) //Action is LEFT_DOWN
+ )
+ {
+ ScrollBarMoveAction = TRUE;
+ MouseListBoxScrollBarMove( listbox, TRUE, gListBoxScrollBarTop - Data->Input.Data.MouseInfo.Top);
+ return EFI_SUCCESS;
+ }
+ return EFI_SUCCESS;
+ }
+ //If mouse button clicked on scrollbar and moved outside the scroll area
+ else if( ControlMouseActionLeftDown == Action //Action is LEFT_DOWN
+ && (lButtonInitialPosition != 0)
+ && ((ControlActionChoose != Action) || (ControlActionSelect != Action)) //Neglecting LEFT_CLICK and LEFT_DCLICK
+ )
+ {
+ lButtonVaryingPosition = Data->Input.Data.MouseInfo.Top;
+ //Move scrollbar upwards
+ if( lButtonInitialPosition > lButtonVaryingPosition )
+ MouseListBoxScrollBarMove( listbox, TRUE, lButtonInitialPosition - lButtonVaryingPosition );
+
+ //Move scrollbar downwards
+ else
+ MouseListBoxScrollBarMove( listbox, FALSE, lButtonVaryingPosition - lButtonInitialPosition );
+ lButtonInitialPosition = lButtonVaryingPosition;
+
+ //Reset lButtonDown position when lButton releases
+ if (ControlMouseActionLeftUp == Action)
+ {
+ lButtonInitialPosition = lButtonVaryingPosition = 0;
+ }
+ return EFI_SUCCESS;
+ }
+ }
+ //If clicked Inside listbox area other than scroll area to handle highlight or selection of the option
+ if( ( Data->Input.Data.MouseInfo.Top > (UINT32)listbox->Top && (Data->Input.Data.MouseInfo.Top < (UINT32)(listbox->Top + listbox->Height)) ) //Clicked inside ListBox area
+ && ( (Data->Input.Data.MouseInfo.Left > listbox->Left) && (Data->Input.Data.MouseInfo.Left < (listbox->Left + (UINT32)(listbox->Width - 2))) ) //Width calculation
+ && (ControlActionChoose == Action || ControlActionSelect == Action) //check LEFT_DCLICK or LEFT_CLICK
+ )
+ {
+ for (i = listbox->FirstVisibleSel; i <= listbox->LastVisibleSel; i++ )
+ {
+ if(Data->Input.Data.MouseInfo.Top == (UINT32) (listbox->Top + i - listbox->FirstVisibleSel + 1))
+ {
+ switch( MapControlMouseActionHook(&Data->Input.Data.MouseInfo) )
+ {
+ case ControlActionChoose:
+ listbox->Sel=i;
+ break;
+
+ case ControlActionSelect:
+ if (SingleClickActivation ()) //EIP74141 providing select option for single click too
+ {
+ listbox->Sel=i;
+ }
+ listbox->Callback( listbox->Container, listbox, &(listbox->Sel) );
+ break;
+ }
+ }
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ListBoxGetControlHight
+//
+// Description: Function unsupported.
+//
+// Input: VOID *object,VOID *frame, UINT16 *height
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ListBoxGetControlHight( VOID *object,VOID *frame, UINT16 *height )
+{
+ return EFI_UNSUPPORTED;
+}
+
+//EIP-67049 Start
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: TSEMouseListBoxScrollBarMove
+//
+// Description: Adds scroll bar functionality for frames with many controls
+//
+// Input: FRAME_DATA *frame - Pointer to the frame data
+// BOOLEAN bScrollUp - Go up is TRUE, else to down one control
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else
+// EFI_UNSUPPORTED
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS TSEMouseListBoxScrollBarMove( LISTBOX_DATA *listbox, BOOLEAN bScrollUp, UINT16 Size )
+{
+ if ( listbox->ItemCount == 0 )
+ return EFI_UNSUPPORTED;
+
+ switch ( bScrollUp )
+ {
+ case TRUE:
+
+ if( Size >= listbox->FirstVisibleSel )
+ Size = listbox->FirstVisibleSel;
+
+ //If FirstVisibleCtrl is not equal to first control then move scrollbar till it reaches top
+ if(listbox->FirstVisibleSel > 0)
+ {
+ listbox->FirstVisibleSel = listbox->FirstVisibleSel - Size;
+ listbox->LastVisibleSel = listbox->LastVisibleSel - Size;
+ }
+ break;
+
+ case FALSE:
+ //If the size of scroll to move exceeds the remaining control count then change the size value based on the remaining control count
+ if( Size >= (listbox->ItemCount - listbox->LastVisibleSel) )
+ Size = listbox->ItemCount - listbox->LastVisibleSel - 1;
+
+ //If LastVisibleCtrl is not equal to last control then move scrollbar till it reaches bottom
+ if(listbox->LastVisibleSel < listbox->ItemCount - 1)
+ {
+ listbox->FirstVisibleSel = listbox->FirstVisibleSel + Size;
+ listbox->LastVisibleSel = listbox->LastVisibleSel + Size;
+ }
+ break;
+ }
+ return EFI_SUCCESS;
+}
+//EIP-67049 End
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/ListBox.h b/EDK/MiniSetup/TseLite/ListBox.h
new file mode 100644
index 0000000..cbe2a06
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/ListBox.h
@@ -0,0 +1,186 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ListBox.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 8 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ListBox.h $
+//
+// 8 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 12 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 6 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 8 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 7 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 6 10/28/09 5:38p Madhans
+//
+// 5 8/26/09 4:11p Blaines
+// To fix issue with BBS popup when more then 20 bootoptions are present
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: ListBox.h
+//
+// Description: Header file for Listbox controls.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _LISTBOX_H_
+#define _LISTBOX_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "popup.h"
+
+#define MAX_VISIBLE_SELECTIONS (gMaxRows -10)
+
+#define LISTBOX_MEMBER_VARIABLES \
+ VOID *ScreenBuf; \
+ /*EFI_HII_HANDLE*/VOID *ListHandle; \
+ UINT16 Sel; \
+ UINT16 FirstVisibleSel; \
+ UINT16 LastVisibleSel ; \
+ UINT16 ItemCount; \
+ UINT16 *PtrTokens; \
+ POSTMENU_TEMPLATE *PtrItems; \
+ BOOLEAN UseScrollbar; \
+ UINT16 QuitPopupLoop ; \
+ UINT16 HiddenItemCount;
+
+typedef struct _LISTBOX_METHODS LISTBOX_METHODS;
+
+typedef struct _LISTBOX_DATA
+{
+ LISTBOX_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ POPUP_MEMBER_VARIABLES
+ LISTBOX_MEMBER_VARIABLES
+
+}
+LISTBOX_DATA;
+
+
+typedef struct _LISTBOX_BSS_POPUP_DATA
+{
+ UINT16 TitleToken;
+ UINT16 ItemCount;
+ POSTMENU_TEMPLATE *PtrItems;
+ UINT16 Help1Token;
+ UINT16 Help2Token;
+ UINT16 Help3Token;
+ CONTROL_INFO *pControlData;
+ UINT16 HiddenItemCount;
+}
+LISTBOX_BSS_POPUP_DATA;
+
+typedef EFI_STATUS (*LISTBOX_METHOD_INITIALIZE_BBS_POPUP) ( VOID *object, VOID *data );
+
+// Don't Call Initialize if you call InitializeBBSPopup...
+#define LISTBOX_METHOD_FUNCTIONS \
+ LISTBOX_METHOD_INITIALIZE_BBS_POPUP InitializeBBSPopup;
+
+struct _LISTBOX_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ LISTBOX_METHOD_FUNCTIONS
+};
+
+extern LISTBOX_METHODS gListBox;
+
+// Object Methods
+EFI_STATUS ListBoxCreate( VOID **object );
+EFI_STATUS ListBoxDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS ListBoxInitialize( VOID *object, VOID *data );
+EFI_STATUS ListBoxDraw( VOID *object );
+EFI_STATUS ListBoxHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS ListBoxSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS ListBoxSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS ListBoxSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS ListBoxSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS ListBoxSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS ListBoxGetControlHight( VOID *object,VOID *frame, UINT16 *height );
+
+//Listbox Methods
+EFI_STATUS ListBoxInitializeBBSPopup( LISTBOX_DATA *listbox, LISTBOX_BSS_POPUP_DATA *listboxBBSPopupData );
+
+#endif /* _LISTBOX_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Memo.c b/EDK/MiniSetup/TseLite/Memo.c
new file mode 100644
index 0000000..222f8f8
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Memo.c
@@ -0,0 +1,764 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Memo.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 15 $
+//
+// $Date: 3/18/13 1:24a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Memo.c $
+//
+// 15 3/18/13 1:24a Arunsb
+// [TAG] EIP118306
+// [Category] Improvement
+// [Description] Support for grayout subtitle control
+// [Files] Memo.c
+//
+// 14 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 12 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 13 4/04/12 12:34a Rajashakerg
+// [TAG] EIP83705
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] Help page scroll bar not moving till end for the "Setup
+// question completion timeout" control in "Advanced -> PCI Express GEN2
+// settings".
+// [RootCause] Scrollbar calculation for the help frame are improper.
+// [Solution] provided proper value for the scrollbar.
+// [Files] Memo.c
+//
+// 12 12/01/11 1:45a Premkumara
+// [TAG] EIP73236
+// [Category] Improvement
+// [Description] Large amounts of allocated memory are not freed
+// [Files] Expression.c, PopupEdit.c, Popup.c, MessageBox.c, Menu.c,
+// Memo.c,
+//
+// 11 11/21/11 8:52a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupSel.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 10 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 9 6/29/11 12:49p Rajashakerg
+// [TAG] EIP47086
+// [Category] New Feature
+// [Description] Right clicking from the Main page is not exiting from
+// BIOS setup.
+//
+// [Files] minisetup.h, Ezport\style.h,Ezport\EzportBin.sdl,
+// Ezport\EzportBin.mak, Ezport\ezport.c, Ezport\EzportBin.cif,
+// EzportPlus\style.h, EzportPlus\EzportPlusBin.sdl, EzportPlusBin.mak,
+// EzportPlus\EzportPlusBin.cif, EzportPlus\ezportplus.c, Legacy\style.h,
+// Legacy\EzportPlusBin.sdl, Legacy\LegacyBin.mak, Legacy\LegacyBin.cif,
+// Legacy\legacy.c, TseLiteBin.sdl, TseLite.cif, Memo.c, frame.c,
+// application.h, application.c, commonoem.h, CommonHelper.c
+//
+// 8 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 7 2/03/11 8:20p Madhans
+// [TAG] - EIP 50956
+// [Category]- defect
+// [Severity]- Mordarate
+// [Symptom]- If we leave the Setup page for 2 or more days. The system
+// may hang/Crash.
+// [Rootcause] - Memory leaks
+// [Solution]- Memeory freed.
+// [Files] - ctrlcond.c, memo.c and expression.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 7 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 6 1/22/10 6:14p Blaines
+// EIP #33837 - Setup appearance corrupted if additional subtitles added
+// Fix - Prevent memo draw if supressed condition
+//
+// 5 1/09/10 6:40a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 10/28/09 5:38p Madhans
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 5 5/18/09 12:21p Blaines
+// Fix Help Frame (memo) text scroll
+//
+// 4 5/12/09 5:14p Blaines
+// Patch for help text scroll issue
+//
+// 3 5/07/09 10:36a Madhans
+// Changes after Bin module
+//
+// 2 4/29/09 9:02p Madhans
+// Bug Fixes after unit Testing..
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+#include "minisetup.h"
+
+MEMO_METHODS gMemo =
+{
+ MemoCreate,
+ MemoDestroy,
+ MemoInitialize,
+ MemoDraw,
+ MemoHandleAction,
+ MemoSetCallback,
+ MemoSetFocus,
+ MemoSetPosition,
+ MemoSetDimensions,
+ MemoSetAttributes,
+ MemoGetControlHeight,
+ MemoSetJustify
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoCreate
+//
+// Description: Function to create a Memo, which uses the Control Functions.
+//
+// Input: MEMO_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoCreate( MEMO_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(MEMO_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gMemo;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoDestroy
+//
+// Description: Function to Destroy a Memo, which uses the Control Functions.
+//
+// Input: MEMO_DATA *memo, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoDestroy( MEMO_DATA *memo, BOOLEAN freeMem )
+{
+ if(NULL == memo)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( memo, FALSE );
+
+ if( freeMem ){
+ MemFreePointer( (VOID **)&memo->EmptyString ); //EIP-73236 Free the allocated memory for the EmptyString field
+ MemFreePointer( (VOID **)&memo );
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoInitialize
+//
+// Description: Function to Initialize a Memo, which uses the Control Functions.
+//
+// Input: MEMO_DATA *memo, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoInitialize( MEMO_DATA *memo, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( memo, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ SetControlColorsHook( &(memo->BGColor), &(memo->FGColor), NULL, NULL ,NULL, NULL ,
+ NULL , NULL,
+ NULL, NULL ,
+ NULL,NULL ,NULL,NULL, NULL );
+ StyleGetSpecialColor( CONTROL_TYPE_MEMO, &(memo->FGColor)) ;
+ memo->Interval = (UINT8)(memo->ControlData.ControlFlags.ControlRefresh);
+
+ memo->Justify = JUSTIFY_LEFT;
+
+ //[EIP:19479]RB:<Add>
+ // initialization of ScrollBarPosition
+ memo->ScrollBarPosition = 0;
+ //[EIP:19479]RB:<Add>
+
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoDraw
+//
+// Description: Function to draw a Memo.
+//
+// Input: MEMO_DATA *memo
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoDraw( MEMO_DATA *memo )
+{
+ CHAR16 *text = NULL, *newText = NULL;
+ CHAR16 *line;
+ UINT16 pos, height = 0;
+
+ UINT16 TempPos = 0;
+ BOOLEAN bScrollBar = FALSE;
+
+ // check conditional ptr if necessary
+ //EIP #33837 - Setup appearance corrupted if additional subtitles added
+ // Fix - Prevent memo draw if supressed condition
+
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( memo->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &memo->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ //Status = EFI_WARN_WRITE_FAILURE;
+ memo->FGColor = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ text = HiiGetString( memo->ControlData.ControlHandle,UefiGetTitleField( (VOID *)memo->ControlData.ControlPtr));
+
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ if ( EfiStrLen(text) == 0)
+ {
+ // String is empty but memory is allocated.
+ MemFreePointer( (VOID **)&text );
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ // clear out old wrapped string
+ for ( pos = 0; pos < memo->Height; pos++ )
+ DrawStringWithAttribute( memo->Left, memo->Top + pos, memo->EmptyString, memo->FGColor | memo->BGColor );
+
+ // XXX: this wrapping code is probably not compatible with all languages
+ newText = StringWrapText( text, memo->Width, &height );
+ if(height == 0)
+ return EFI_OUT_OF_RESOURCES;
+
+
+ // where height is the total number of Lines if it is greater than memo->Height(14)
+ // then scroll bar need or not needed.
+
+ bScrollBar = ( (height > memo->Height) && (memo->ParentFrameType == HELP_FRAME /*memo->Top == MAIN_TOP*/) ) ? 1 : 0;
+
+ if( memo->ScrollBarPosition > (height - memo->Height) )
+ memo->ScrollBarPosition = (height - memo->Height);
+
+ if ( newText != text )
+ MemFreePointer( (VOID **)&text );
+
+ line = newText;
+
+ // Draw complete strings in a help frame. Limits upto height of the string.
+ for ( pos = 0; pos < height; pos++ )
+ {
+ CHAR16 save;
+
+ text = line;
+ if ( *line == L'\0' )
+ break;
+
+ while ( ( *line != L'\n' ) &&( *line != L'\r' ) && ( *line != L'\0' ) )
+ line++;
+
+ save = *line;
+ *line = L'\0';
+
+ if( (memo->ScrollBarPosition > pos) && ((height - memo->Height) > pos) )
+ {
+ TempPos++;
+ }
+ else
+ {
+ // If height exceeds memo->Height
+ // Drawing alternative 14 lines in help frame.
+ if( bScrollBar )
+ {
+ if( (pos-TempPos) < memo->Height )
+ {
+ DrawStringJustifiedWithAttribute( memo->Left, memo->Left + memo->Width, memo->Top + (pos-TempPos),
+ memo->Justify, text, memo->FGColor | memo->BGColor );
+
+ }
+ }
+ // If No of Lines is less than Memo->Height
+ // Drawing a string in a help frame
+ else
+ {
+ memo->ScrollBarPosition = 0;
+ DrawStringJustifiedWithAttribute( memo->Left, memo->Left + memo->Width, memo->Top + pos,
+ memo->Justify, text, memo->FGColor | memo->BGColor );
+ }
+
+ }
+
+ if ( ( *line = save ) != L'\0' )
+ {
+ line++;
+ if ( ( *line == L'\r' ) || ( *line == L'\n' ) )
+ line++;
+ }
+ }
+
+
+ // Drawing Scrollbar For Help Frame.
+ if( memo->ParentFrameType == HELP_FRAME )
+ {
+ // If scrollbar needed draw the scroll bar
+ if( bScrollBar )
+ StyleDrawHelpScrollBar(memo, height) ;
+ else
+ MemoEraseScrollBar(memo) ;
+ }
+
+ if ( pos < height )
+ height = pos;
+
+ memo->DisplayLines = height;
+
+ FlushLines( memo->Top, memo->Top + memo->Height -1 );
+ if( ( memo->ParentFrameType == HELP_FRAME ) && ( bScrollBar ))
+ DoRealFlushLines();
+ MemFreePointer( (VOID **)&newText );
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoDrawScrollBar
+//
+// Description: Function to draw memo scrollbar
+//
+// Input: MEMO_DATA *memo, UINT16 height
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID MemoDrawScrollBar( MEMO_DATA *memo, UINT16 height)
+{
+ #define VISIBLE_AREA_HEIGHT (memo->Height - 1)
+ #define SCROLLBAR_AREA_HEIGHT (memo->Height)
+
+ UINT16 pos=0 ;
+ UINT32 FirstLine=0,LastLine=0,ScrollbarHeight = 0,j = 0;
+ CHAR16 ArrUp[2]={{GEOMETRICSHAPE_UP_TRIANGLE},{0x0000}},ArrDown[2]={{GEOMETRICSHAPE_DOWN_TRIANGLE},{0x0000}},ScrlSel[2]={{BLOCKELEMENT_FULL_BLOCK/*L'N'*/},{0x0000}},ScrlNSel[2]={{BLOCKELEMENT_LIGHT_SHADE/*L'S'*/},{0x0000}};
+
+ // Calculated scrollbar length based upon the height of the Lines.
+ ScrollbarHeight = ( (SCROLLBAR_AREA_HEIGHT - 2) * VISIBLE_AREA_HEIGHT ) / height;
+
+ // Calculated the First line of the scroll bar and last line of the scrollbar.
+ FirstLine = memo->ScrollBarPosition * ( (SCROLLBAR_AREA_HEIGHT - 2) - ScrollbarHeight ) / ( height - VISIBLE_AREA_HEIGHT ) + memo->Top + 1;
+
+ LastLine = FirstLine + ScrollbarHeight;
+
+ for ( pos = 1,j = memo->Top; pos <= (UINT32)SCROLLBAR_AREA_HEIGHT ; pos++, j++ )
+ {
+ // Drawing Up Arrow
+ if (pos == 1){
+ DrawStringWithAttribute( memo->Left + memo->Width , memo->Top, ArrUp,
+ StyleGetScrollBarUpArrowColor() );
+ }
+ // Drawing Down Arrow
+ else if ( pos == (UINT32 )( SCROLLBAR_AREA_HEIGHT )){
+ DrawStringWithAttribute( memo->Left + memo->Width , memo->Top + (memo->Height-1), ArrDown,
+ StyleGetScrollBarDownArrowColor() );
+ }
+ // Drawing Scroll Bar(Scroll selector)
+ else if ( (j >= FirstLine) && (j <= LastLine) ){
+ DrawStringWithAttribute( memo->Left + memo->Width, j, ScrlSel,
+ StyleGetScrollBarColor() );
+ }
+ // Drawing scroll Not Selector bar
+ else{
+ DrawStringWithAttribute( memo->Left + memo->Width, j, ScrlNSel,
+ StyleGetScrollBarColor() );
+ }
+
+ }
+
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoEraseScrollBar
+//
+// Description: Function to erase memo scrollbar
+//
+// Input: MEMO_DATA *memo
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID MemoEraseScrollBar( MEMO_DATA *memo)
+{
+ UINT16 pos=0 ;
+ UINT32 j=0 ;
+
+ for ( pos = 0,j = memo->Top; pos < memo->Height; pos++,j++ )
+ DrawStringWithAttribute( memo->Left + memo->Width, j , L" ",
+ memo->FGColor | memo->BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuHandleAction
+//
+// Description: Function to set callback.
+//
+// Input: MEMO_DATA *memo, ACTION_DATA *Data
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoHandleAction( MEMO_DATA *memo, ACTION_DATA *Data)
+{
+ //[EIP:19479]RB:<Add>
+ // Handling action for help frame.
+
+ CONTROL_ACTION Action;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ if (memo->Interval == 0)
+ return Status;
+ if ( --(memo->Interval) == 0 )
+ {
+ // initialize the interval
+ memo->Interval = (UINT8)(memo->ControlData.ControlFlags.ControlRefresh);
+ return EFI_SUCCESS;
+ }
+ else
+ return Status;
+ }
+
+ if ( Data->Input.Type != ACTION_TYPE_KEY )
+ return EFI_UNSUPPORTED;
+
+ //Get Key
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+
+
+ switch ( Action )
+ {
+ case ControlActionHelpPageDown:
+
+ // Identify the help frame by identifying the height of the help frame
+ if( memo->ParentFrameType == HELP_FRAME)
+ {
+ // Incrementing the ScrollBarPosition.
+ memo->ScrollBarPosition++;
+ // Based upon ScrollBarPosition drawing the Memo again.
+ gMemo.Draw(memo);
+ }
+ break;
+
+ case ControlActionHelpPageUp:
+ if( memo->ParentFrameType == HELP_FRAME)
+ {
+ // Decrementing ScrollBarPosition
+ if( memo->ScrollBarPosition != 0 )
+ memo->ScrollBarPosition--;
+ else
+ memo->ScrollBarPosition = 0;
+ gMemo.Draw(memo);
+ }
+ break;
+
+ default:
+ Status = EFI_UNSUPPORTED;
+ }
+
+
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: MEMO_DATA *memo, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoSetCallback( MEMO_DATA *memo, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: MEMO_DATA *memo, BOOLEAN focus
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoSetFocus(MEMO_DATA *memo, BOOLEAN focus)
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoSetPosition
+//
+// Description: Function to set position.
+//
+// Input: MEMO_DATA *memo, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoSetPosition(MEMO_DATA *memo, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( memo, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: MEMO_DATA *memo, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoSetAttributes(MEMO_DATA *memo, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( memo, FGColor, BGColor );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: MEMO_DATA *memo, UINT16 width, UINT16 height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoSetDimensions( MEMO_DATA *memo, UINT16 width, UINT16 height )
+{
+ memo->Width = width;
+ memo->Height = height;
+
+ MemFreePointer( (VOID **)&memo->EmptyString );
+ memo->EmptyString = EfiLibAllocateZeroPool( (width + 1) * sizeof(CHAR16) );
+ if ( memo->EmptyString == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ MemFillUINT16Buffer( memo->EmptyString, width, L' ' );
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoSetJustify
+//
+// Description: Function to set justify.
+//
+// Input: MEMO_DATA *memo, UINT8 justify
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoSetJustify( MEMO_DATA *memo, UINT8 justify )
+{
+ if ( justify <= JUSTIFY_MAX )
+ {
+ memo->Justify = justify;
+ return EFI_SUCCESS;
+ }
+
+ return EFI_INVALID_PARAMETER;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MemoGetControlHeight
+//
+// Description: Function to get the memo text height.
+//
+// Input: MEMO_DATA *memo, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MemoGetControlHeight( MEMO_DATA *memo, VOID *frame, UINT16 *height )
+{
+ CHAR16 *text = NULL, *newText = NULL;
+
+ if(frame != NULL)
+ { // Memo control from Frame
+ memo->Width = ((FRAME_DATA*)frame)->FrameData.Width - (UINT8)gLabelLeftMargin - 2;
+ }
+ // else messagebox memo
+
+ text = HiiGetString( memo->ControlData.ControlHandle,UefiGetTitleField( (VOID *)memo->ControlData.ControlPtr));
+
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ // XXX: this wrapping code is probably not compatible with all languages
+ newText = StringWrapText( text, memo->Width, height );
+ if ( newText != text )
+ MemFreePointer( (VOID **)&text );
+
+ MemFreePointer( (VOID **)&newText );
+
+ return EFI_SUCCESS;
+}
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Norcross, Suite 200, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+
diff --git a/EDK/MiniSetup/TseLite/Memo.h b/EDK/MiniSetup/TseLite/Memo.h
new file mode 100644
index 0000000..90b6f1e
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Memo.h
@@ -0,0 +1,195 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Memo.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 8 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Memo.h $
+//
+// 8 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 5/18/09 12:21p Blaines
+// Fix Help Frame (memo) text scroll
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Memo.h
+//
+// Description: Header file for Memo controls.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _MEMO_H_
+#define _MEMO_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+
+#define MEMO_MEMBER_VARIABLES \
+ UINT8 Justify; \
+ UINT16 DisplayLines; \
+ CHAR16 *EmptyString; \
+ UINT16 ScrollBarPosition; \
+ UINT8 Interval;
+
+
+typedef struct _MEMO_METHODS MEMO_METHODS;
+
+typedef struct _MEMO_DATA
+{
+ MEMO_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ MEMO_MEMBER_VARIABLES
+
+}
+MEMO_DATA;
+
+typedef EFI_STATUS (*MEMO_METHOD_SET_JUSTIFY) ( VOID *object, UINT8 justify );
+typedef EFI_STATUS (*MEMO_METHOD_GET_TEXT_HEIGHT) ( MEMO_DATA *memo, UINT16 *height );
+
+#define MEMO_METHOD_FUNCTIONS \
+ MEMO_METHOD_SET_JUSTIFY SetJustify;
+
+
+struct _MEMO_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ MEMO_METHOD_FUNCTIONS
+};
+
+extern MEMO_METHODS gMemo;
+
+// Object Methods
+EFI_STATUS MemoCreate( VOID **object );
+EFI_STATUS MemoDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS MemoInitialize( VOID *object, VOID *data );
+EFI_STATUS MemoDraw( VOID *object );
+EFI_STATUS MemoHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS MemoSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS MemoSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS MemoSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS MemoSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS MemoGetControlHeight( VOID *object,VOID *frame, UINT16 *height );
+
+// Memo Methods
+EFI_STATUS MemoSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS MemoSetJustify( VOID *object, UINT8 justify );
+VOID MemoDrawScrollBar( MEMO_DATA *memo, UINT16 height);
+VOID MemoEraseScrollBar( MEMO_DATA *memo);
+#endif /* _MEMO_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Menu.c b/EDK/MiniSetup/TseLite/Menu.c
new file mode 100644
index 0000000..2220de8
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Menu.c
@@ -0,0 +1,1069 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2012, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Menu.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 26 $
+//
+// $Date: 3/14/13 11:47a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Menu.c $
+//
+// 26 3/14/13 11:47a Premkumara
+// [TAG] EIP85745 & 109814
+// [Category] Improvement
+// [Description] Support for Modal Form Support as per UEFI 2.3.1
+// [Files] Parse.c, Page.c, Menu.c, Hotclick.c
+//
+// 25 10/19/12 5:06a Rajashakerg
+// Provided support for menu scroll for only action choose and select.
+//
+// 24 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 14 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 22 9/25/12 12:31p Rajashakerg
+// [TAG] EIP92053
+// [Category] Improvement
+// [Description] Need support define Root page order using elinks
+// [Files] AMITSE.sdl, Menu.c, AMIVfr.h, AMITSE.mak, commonoem.c
+//
+// 21 9/25/12 9:33a Rajashakerg
+// [TAG] EIP92053
+// [Category] Improvement
+// [Description] Need support define Root page order using elinks
+// [Files] AMITSE.sdl, Menu.c, AMIVfr.h, AMITSE.mak, commonoem.c
+//
+// 20 12/01/11 1:43a Premkumara
+// [TAG] EIP73236
+// [Category] Improvement
+// [Description] Large amounts of allocated memory are not freed
+// [Files] Expression.c, PopupEdit.c, Popup.c, MessageBox.c, Menu.c,
+// Memo.c,
+//
+// 19 11/21/11 8:53a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupSel.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 18 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 17 11/09/11 6:05p Blaines
+// [TAG] EIP 72333
+// [Category] Sighting
+// [Symptom] Some SAS controller card HII Screen Titles are displaying
+// the wrong information
+//
+// [RootCause] Menu tab always displays the root page title when
+// navigating submenu pages. TSE did not support the display of Formset
+// Help.
+//
+// [Solution] Display Formset Help for Dynamic page, Display page title of
+// submenu pages in the menu tab. Fix the ASSERT seen in Menu.c when
+// serial redirection is enabled.
+//
+// [Files Changed] - AMITSE.sdl, CommonHelper.c, special.c, Menu.c,
+// minisetupext.h,TseUefiHii.h, Uefi21Wapper.c
+//
+// 16 10/31/11 2:44a Rajashakerg
+// [TAG] EIP73377
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Setup page Menu tab gets selected even when the click is
+// below the menu separator line
+// [RootCause] Menu tab selection was not handled properly using mouse.
+// [Solution] Provided exact menu tab co-ordinates for selection using
+// mouse
+// [Files] Menu.c
+//
+// 15 10/21/11 6:26p Blaines
+// [TAG] EIP 72333
+// [Category] Sighting
+// [Symptom] Some SAS controller card HII Screen Titles are displaying
+// the wrong information
+// [RootCause] Menu tab always displays the root page title when
+// navigating submenu pages. TSE did not support the display of Formset
+// Help.
+//
+// [Solution] Display Formset Help for Dynamic page, Display page title of
+// submenu pages in the menu tab.
+//
+// [Files Changed]
+// - AMITSE.sdl, CommonHelper.c, special.c, Menu.c, minisetupext.h,
+// TseUefiHii.h, Uefi21Wapper.c
+//
+// 14 10/20/11 12:03p Madhans
+// Checkin comments corrected.
+//
+// 12 10/04/11 5:28p Blaines
+// [TAG] EIP 68920
+// [Category] Defect
+// [Symptom] SOME SAS controller card HII menus hang when selecting "Clear
+// Configuration" when DEBUG_MODE=0
+// [RootCause] Menu is not re-initialize from SetupData after dynamic
+// page update. MenuInitialize enters an infinite loop on some SAS controller cards.
+//
+//
+// PopupSelGetControlHeight() causes an assert if popupSel has an item
+// with an invalid string token.
+//
+// [Solution] Due to dynamic updates, SetupData (most current data) is
+// given priority when re-initializing menu.
+// Check for invalid string token in PopupSelGetControlHeight.
+//
+// [Files Changed]
+// - Menu.c, Popupsel.c
+//
+// 11 9/19/11 11:50a Blaines
+// [TAG] EIP 68920
+// [Category] Defect
+// [Symptom] SOME SAS controller card menus hang when selecting "Clear
+// Configuration" when DEBUG_MODE=0
+// [RootCause] Menu is not re-initialize from SetupData after dynamic
+// page update.
+// PopupSelGetControlHeight() causes an assert if popupSel has an item
+// with an invalid string token.
+//
+// [Solution] Due to dynamic updates, SetupData (most current data) is
+// given priority when re-initializing menu.
+// Check for invalid string token in PopupSelGetControlHeight.
+//
+// [Files Changed]
+// - Menu.c, Popupsel.c
+//
+// 10 8/26/11 4:10p Blaines
+// [TAG] - EIP 68341
+// [Category]- Action Item
+// [Synopsis]- Dynamic Pages need to List FormSet title instead of Form
+// Title..
+// [Files] - Parse.c, Menu.c
+//
+// 9 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 8 6/15/10 10:49a Blaines
+// Fix for EIP:39570: Adding to length may create additional pages to
+// accommodate extra space.
+//
+// 7 5/24/10 11:11a Mallikarjunanv
+// EIP-38215: Fix for Setup corruption issue with mouse
+//
+// 6 5/24/10 11:02a Mallikarjunanv
+// EIP-38555 : Spacing issue in Menu display
+//
+// 5 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 7 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 6 2/15/10 10:15p Madhans
+// To support root page hiding based on page flag
+//
+// 5 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 4 1/09/10 6:38a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 5/07/09 10:36a Madhans
+// Changes after Bin module
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:09p Madhans
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Menu.c
+//
+// Description: This file contains code to handle Menu operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+extern BOOLEAN gIsRootPageOrderPresent;
+
+MENU_METHODS gMenu =
+{
+ MenuCreate,
+ MenuDestroy,
+ MenuInitialize,
+ MenuDraw,
+ MenuHandleAction,
+ MenuSetCallback,
+ MenuSetFocus,
+ MenuSetPosition,
+ MenuSetDimensions,
+ MenuSetAttributes,
+ MenuGetControlHight,
+ MenuSetWidth
+
+};
+
+#define ItemPerPage 6
+typedef struct _HII_FORM_ADDRESS
+{
+ EFI_GUID formsetGuid; // Required
+ UINT16 formId; // Required
+ VOID * Handle; // Optional
+}HII_FORM_ADDRESS;
+extern UINT16 gRootPageOrderIndex;
+extern HII_FORM_ADDRESS *gRootPageOrder;
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuCreate
+//
+// Description: Function to create Menu, Which uses the control functions.
+//
+// Input: MENU_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuCreate( MENU_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(MENU_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gMenu;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuDestroy
+//
+// Description: Function to Destroy Menu, Which uses the control functions.
+//
+// Input: MENU_DATA *menu, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuDestroy( MENU_DATA *menu, BOOLEAN freeMem )
+{
+ if(NULL == menu)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( menu, FALSE );
+
+ if( freeMem ){
+ MemFreePointer( (VOID **)&menu->Entries);//EIP-73236
+ MemFreePointer( (VOID **)&menu );
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuInitialize
+//
+// Description: Function to Initialize Menu, Which uses the control functions.
+//
+// Input: MENU_DATA *menu, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuInitialize( MENU_DATA *menu, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 i,j=0,k=0;
+ PAGE_INFO *info,*tempPage=NULL;
+ UINT32 count = 0 ,PageCount=0;
+
+ // data is NULL when only reinitialization of the menu entries is needed.
+ // this assumes the control was initialized before.
+ if(data !=NULL)
+ {
+ Status = gControl.Initialize( menu, data );
+ if (EFI_ERROR(Status))
+ return Status;
+ }
+ menu->IsSubMenu = 0;
+ // add extra initialization here...
+ if(menu->Entries !=NULL)
+ {
+ gBS->FreePool(menu->Entries);
+ menu->Entries =NULL;
+ menu->NumEntries=menu->CurrEntry=0;
+ }
+
+ menu->Entries = EfiLibAllocateZeroPool( sizeof(AMI_MENU_ENTRY) *(gPages->PageCount) );
+ count = ( gPages->PageCount > gApp->PageCount ) ? gPages->PageCount : gApp->PageCount ;
+
+ if(gIsRootPageOrderPresent)
+ {
+ //for( k=0 ; (gRootPageOrder[k] != 0); k++ );
+ for( j=0 ; j < gRootPageOrderIndex ; j++ )
+ {
+ for ( i = 0; i < (UINT16)count; i++ )
+ {
+ if(i > gPages->PageCount )
+ {
+ if(gApp->PageList[i] == NULL)
+ continue;
+ info = (PAGE_INFO*)&( gApp->PageList[i]->PageData);
+ PageCount = gApp->PageCount;
+ }
+ else
+ {
+ info = (PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[i]);
+ PageCount = gPages->PageCount;
+ }
+
+ if( (info->PageHandle == NULL ) || (info->PageHandle == (VOID*)(UINTN)0xffff ))
+ continue;
+
+ if (!( info->PageID == 0) && (info->PageParentID == 0) &&
+ (gRootPageOrder[j].formId == info->PageFormID) )
+ {
+ PAGE_ID_INFO *pageIdInfo;
+ pageIdInfo = (PAGE_ID_INFO *)(((UINT8 *) gPageIdList) + gPageIdList->PageIdList[info->PageIdIndex]);
+
+ if(gRootPageOrder[j].Handle)
+ if(gRootPageOrder[j].Handle != info->PageHandle)
+ continue;
+
+ if(!EfiCompareGuid(&pageIdInfo->PageGuid, &gRootPageOrder[j].formsetGuid) )//Compare Guid
+ {
+ continue;
+ }
+
+ if(info->PageFlags.PageVisible)
+ continue; //To Control the root page not to show.
+
+ menu->Entries[menu->NumEntries].PageHandle = info->PageHandle;
+ menu->Entries[menu->NumEntries].PageID = info->PageID;
+ menu->Entries[menu->NumEntries].StringToken = info->PageSubTitle;
+
+ if( menu->ControlData.ControlPageID == info->PageID )
+ menu->CurrEntry = menu->NumEntries;
+
+ if(menu->Entries[menu->NumEntries].PageHandle != 0)
+ menu->NumEntries++;
+ }
+
+
+ }
+ }
+ }
+
+ for ( i = 0; i < (UINT16)count; i++ )
+ {
+ // EIP 68920: Due to dynamic updates, SetupData (most current data)
+ // is given priority when re-initializing menu.
+ if(i > gPages->PageCount )
+ {
+ if(gApp->PageList[i] == NULL)
+ continue;
+ info = (PAGE_INFO*)&( gApp->PageList[i]->PageData);
+ PageCount = gApp->PageCount;
+ }
+ else
+ {
+ info = (PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[i]);
+ PageCount = gPages->PageCount;
+ }
+
+ if( (info->PageHandle == NULL ) || (info->PageHandle == (VOID*)(UINTN)0xffff ))
+ continue;
+
+ if( info->PageID == 0)
+ {
+ }
+ else
+ {
+ if((info->PageParentID ==0) /*&& (info->PageFlags.PageVisible)*/)
+ {
+ if(info->PageFlags.PageVisible || gIsRootPageOrderPresent)
+ continue; //To Control the root page not to show.
+
+ menu->Entries[menu->NumEntries].PageHandle = info->PageHandle;
+ menu->Entries[menu->NumEntries].PageID = info->PageID;
+ menu->Entries[menu->NumEntries].StringToken = info->PageSubTitle;
+
+ if( menu->ControlData.ControlPageID == info->PageID )
+ menu->CurrEntry = menu->NumEntries;
+
+ if(menu->Entries[menu->NumEntries].PageHandle != 0)
+ menu->NumEntries++;
+
+ }
+ else
+ {
+ if( menu->ControlData.ControlPageID == info->PageID )
+ {
+ tempPage =info;
+ while(tempPage->PageParentID!=0)
+ {
+ for(j=0;j < PageCount;j++)
+ {
+
+ // EIP 68920: Due to dynamic updates, SetupData (most current data)
+ // is given priority when re-initializing menu.
+ if(j < gPages->PageCount)
+ {
+ if( tempPage->PageParentID == ((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[j]))->PageID)
+ {
+ menu->IsSubMenu = 1;
+ tempPage =((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[j]));
+ j=0;
+ if(tempPage->PageParentID ==0)
+ break;
+
+ }
+
+ }
+ else
+ {
+ if(gApp->PageList[j] == NULL)
+ continue;
+
+ if( tempPage->PageParentID == gApp->PageList[j]->PageData.PageID)
+ {
+ menu->IsSubMenu = 1;
+ tempPage =&(gApp->PageList[j]->PageData);
+ j=0;
+ if(tempPage->PageParentID ==0)
+ break;
+
+ }
+
+ }
+ }
+ }
+
+ // find the item number for the parent in the menu
+ for(j=0;j<menu->NumEntries;j++)
+ {
+ if( (tempPage !=NULL) && ( tempPage->PageID == menu->Entries[j].PageID) )
+ {
+ menu->CurrEntry = j;
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ }
+
+ menu->ControlData.ControlHelp = UefiGetHelpField((VOID *)menu->ControlData.ControlPtr);
+ menu->ControlFocus = FALSE;
+
+ // initialize default colors
+ SetControlColorsHook(NULL, NULL,
+ &(menu->SelFGColor),&(menu->SelBGColor),
+ NULL, NULL,
+ NULL, NULL,
+ NULL,NULL,
+ NULL,
+ NULL ,NULL,
+ &(menu->FGColor),&(menu->BGColor));
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuDraw
+//
+// Description: Function to draw a Menu.
+//
+// Input: MENU_DATA *menu
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuDraw( MENU_DATA *menu )
+{
+ CHAR16 *text=NULL, *tmp=NULL;
+ UINTN offset=0,length;
+ UINT16 StartItem=0,PageNum=0,ActualPage=0,ItemsInPage=0,ItemFound=0,k=0;
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 ColorMenu = menu->FGColor;
+ UINT8 Pos=(UINT8) menu->Left;
+ UINT16 i=0,j=0;
+ PAGE_DATA *Page ;
+ BOOLEAN Overflow = FALSE ;
+
+ Page = gApp->PageList[gApp->CurrentPage];
+
+
+ //erase menu line
+ for(i=1;i <= /*MAX_COLS*/menu->MenuWidth; i++, Pos++ )
+ DrawStringWithAttribute( Pos , menu->Top,L" ",menu->BGColor | menu->FGColor );
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( menu->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &menu->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorMenu = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ tmp = EfiLibAllocateZeroPool( 256 );
+ if ( tmp == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ Pos = (UINT8)menu->Left;
+
+ //loop to find which menu entries to draw
+ for( k = 0 ; k < menu->NumEntries ; k++ )
+ {
+ //get string from hii
+ text = HiiGetString(menu->Entries[k].PageHandle , menu->Entries[k].StringToken );
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ length = (UINT16)((TestPrintLength( text ) / (NG_SIZE)) + 2); // take in account added space on either side of menu below.
+
+ //EIP:68341 Dynamic pages may contain lengthy FormSet Title strings, truncate if necessary.
+ //EIP# 72333, Display page title of submenu pages in the menu tab.
+ if(length >(UINTN) (menu->MenuWidth-2) )
+ {
+ EfiStrCpy( &text[HiiFindStrPrintBoundary(text,(menu->MenuWidth-5))],L"...");
+ length = menu->MenuWidth-2 ;
+ }
+
+ //EIP:39570 Adding to length may create additional pages to accommodate extra space.
+ if ((offset + length /*+2*/) >= /*MAX_COLS*/(UINTN)(menu->MenuWidth-2))
+ {
+ PageNum ++;
+ if(!ItemFound)
+ {
+ ActualPage++;
+ StartItem = k;
+ ItemsInPage=0;
+ offset=length+2;
+ }
+ else
+ {
+ MemFreePointer( (VOID **)&text );
+ break;
+ }
+ }
+ else
+ offset += length /*+2*/;
+
+ if(k == menu->CurrEntry)
+ ItemFound=1;
+
+ ItemsInPage++;
+ MemFreePointer( (VOID **)&text );
+ }
+
+ menu->StartItem = StartItem;
+ menu->ActualPage = ActualPage;
+ menu->PageNum = PageNum;
+ menu->ItemsInPage = ItemsInPage;
+
+ if(ActualPage > 0 )
+ {
+ if(!( menu->IsSubMenu ))
+ {
+ SPrint( tmp, 6, L"%c ", GEOMETRICSHAPE_LEFT_TRIANGLE );
+ DrawStringWithAttribute( menu->Left, menu->Top ,tmp, menu->BGColor | menu->FGColor );
+ }
+ //Pos += 2;
+ }
+ Pos += 1; // always leave space for the arrow even if it is not drawn
+ j = (UINT16)StartItem;
+
+ for(i=0;(i < ItemsInPage) && ( i+j < menu->NumEntries) ;i++)
+ {
+ UINTN StrPrntLen=0; //to fill with the length of the string to draw.
+
+ //get string from hii
+
+ //EIP# 72333, Display page title of submenu pages in the menu tab.
+ if ( i+j == menu->CurrEntry && menu->IsSubMenu && IsSubMenuDisplayTitle())
+ {
+ text = HiiGetString(Page->PageData.PageHandle, Page->PageData.PageSubTitle );
+ }
+ else
+ {
+ text = HiiGetString(menu->Entries[i+j].PageHandle , menu->Entries[i+j].StringToken );
+ }
+
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ length = (UINT16)(TestPrintLength( text ) / (NG_SIZE));
+
+ //EIP:68341 Dynamic pages may contain lengthy FormSet Title strings, truncate if necessary.
+ //EIP# 72333, Display page title of submenu pages in the menu tab.
+ if( (Pos-2+length) >(UINTN) (menu->MenuWidth-2) )
+ {
+ EfiStrCpy( &text[HiiFindStrPrintBoundary(text,(menu->MenuWidth-5-Pos-2))],L"...");
+ length = menu->MenuWidth-2 ;
+ Overflow = TRUE ;
+ }
+
+ // the size of the string plus additional characters(2 spaces + Null character)
+ StrPrntLen = length+3;
+ // The Menu title length should be less than Max display size.
+ if(length >= gMaxCols) {
+ StrPrntLen = gMaxCols-2;
+ }
+
+ // print the string for the lenth uptained
+ SPrint( tmp, StrPrntLen*sizeof(CHAR16), L" %s ", text );
+ if ( i+j == menu->CurrEntry )
+ {
+ DrawStringWithAttribute( Pos , menu->Top , tmp, menu->SelFGColor | menu->SelBGColor);
+ Pos += 2+(UINT8)length;
+ }
+ else
+ {
+ if( !(menu->IsSubMenu))
+ DrawStringWithAttribute( Pos , menu->Top, tmp, menu->BGColor | menu->FGColor );
+ Pos += 2+(UINT8)length;
+ }
+ MemFreePointer( (VOID **)&text );
+
+ if(Overflow)
+ break ;
+ }
+
+ if( (ActualPage < PageNum) && !(menu->IsSubMenu))
+ {
+ SPrint( tmp, 6, L"%c",GEOMETRICSHAPE_RIGHT_TRIANGLE );
+ DrawStringWithAttribute( gMaxCols-1, menu->Top ,tmp, menu->BGColor | menu->FGColor );
+ }
+
+ MemFreePointer( (VOID **)&tmp );
+ FlushLines( menu->Top, menu->Top );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _MenuCallCallback
+//
+// Description: Internal Helper Function to Call the callback
+//
+// Input: MENU_DATA *menu, UINT8 MenuEntry
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _MenuCallCallback(MENU_DATA *menu,UINT16 MenuEntry)
+{
+ if ( ( menu->Callback != NULL ) && (menu->Cookie != NULL) )
+ {
+ CALLBACK_MENU *callbackData = (CALLBACK_MENU *)menu->Cookie;
+ callbackData->DestPage = menu->Entries[MenuEntry].PageID;
+ menu->Callback( menu->Container, menu, menu->Cookie );
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuHandleAction
+//
+// Description: Function to handle actions.
+//
+// Input: MENU_DATA *menu, ACTION_DATA *Data
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuHandleAction( MENU_DATA *menu, ACTION_DATA *Data)
+{
+ // control is in separate frame for ezport.
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 TempEntry;
+ PAGE_DATA *page = NULL ;
+ page = gApp->PageList[gApp->CurrentPage];
+
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ return Status;
+ if(!page){
+ return Status;
+ }
+ if(page->PageData.PageFlags.PageModal){
+ return Status;
+ }
+ if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ Status = MouseMenuHandleAction( menu, Data );
+ }
+
+ if ( Data->Input.Type == ACTION_TYPE_KEY )
+ {
+ CONTROL_ACTION Action;
+
+ //Get mapping
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+
+ switch(Action)
+ {
+ case ControlActionNextLeft:
+ if(!(menu->IsSubMenu))
+ {
+ if ( menu->CurrEntry > 0 )
+ TempEntry = menu->CurrEntry - 1;
+ else
+ TempEntry = menu->NumEntries - 1;
+
+ _MenuCallCallback(menu,TempEntry);
+ }
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionNextRight:
+ if(!(menu->IsSubMenu))
+ {
+ if ( menu->CurrEntry < menu->NumEntries - 1 )
+ TempEntry = menu->CurrEntry + 1;
+ else
+ TempEntry = 0;
+
+ _MenuCallCallback(menu,TempEntry);
+ }
+ Status = EFI_SUCCESS;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: MENU_DATA *menu, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuSetCallback( MENU_DATA *menu, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( menu, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: MENU_DATA *menu, BOOLEAN focus
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuSetFocus(MENU_DATA *menu, BOOLEAN focus)
+{
+
+ if( !(menu->ControlFocus && focus) )
+ menu->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuSetPosition
+//
+// Description: Function to set position.
+//
+// Input: MENU_DATA *menu, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuSetPosition(MENU_DATA *menu, UINT16 Left, UINT16 Top )
+{
+ // Width -> is the container frame width the menu width is that minus 2 spaces.
+ // Left and rigth menu spaces will contain arrows in case that there are multiple pages for the menu.
+ return gControl.SetPosition( menu, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: MENU_DATA *menu, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuSetDimensions(MENU_DATA *menu, UINT16 Width, UINT16 Height )
+{
+ MenuSetWidth(menu, (UINT8)Width);
+ return gControl.SetDimensions( menu, Width-2, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: MENU_DATA *menu, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuSetAttributes(MENU_DATA *menu, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( menu, FGColor, BGColor );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuSetWidth
+//
+// Description: Function to set width.
+//
+// Input: VOID *menu, UINT8 Width
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuSetWidth(VOID *menu, UINT8 Width)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ // Width -> is the container frame width the menu width is that minus 2 spaces.
+ // Left and rigth menu spaces will contain arrows in case that there are multiple pages for the menu.
+ ((MENU_DATA*)menu)->MenuWidth = Width-2;
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSEMouseMenuHandleAction
+//
+// Description: Function to hadnle Menu using mouse
+//
+// Input: MENU_DATA *menu,
+// ACTION_DATA *Data
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TSEMouseMenuHandleAction( MENU_DATA *menu, ACTION_DATA *Data )
+{
+ // control is in separate frame for ezport.
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 TempEntry;
+ UINTN i;
+ UINTN Pos = menu->Left, StartPos, StrLen;
+ CHAR16 *text=NULL;
+ CONTROL_ACTION Action;
+ //If a sub menu is being displayed no need to handle action
+ if(menu->IsSubMenu)
+ return EFI_UNSUPPORTED;
+
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+
+
+ //Check if left arrow is displayed
+ if(menu->ActualPage > 0)
+ {
+ //Check if left arrow clicked
+ if(
+ (Data->Input.Data.MouseInfo.Left == menu->Left) &&
+ (Data->Input.Data.MouseInfo.Top == menu->Top) &&
+ ( (Action == ControlActionChoose ) || (Action == ControlActionSelect) )//Performing menu scroll for only action choose and select
+ )
+ {
+ //Handle left arrow click
+ if ( menu->CurrEntry > 0 )
+ TempEntry = menu->CurrEntry - 1;
+ else
+ TempEntry = menu->NumEntries - 1;
+
+ _MenuCallCallback(menu,TempEntry);
+ Status = EFI_SUCCESS;
+ }
+ }
+
+ //Check if right arrow is displayed
+ if(menu->ActualPage < menu->PageNum)
+ {
+ //Check if right arrow clicked
+ if(
+ (Data->Input.Data.MouseInfo.Left == gMaxCols-1) &&
+ (Data->Input.Data.MouseInfo.Top == menu->Top) &&
+ ( (Action == ControlActionChoose ) || (Action == ControlActionSelect) )//Performing menu scroll for only action choose and select
+ )
+ {
+ //Handle right arrow click
+ if ( menu->CurrEntry < menu->NumEntries - 1 )
+ TempEntry = menu->CurrEntry + 1;
+ else
+ TempEntry = 0;
+
+ _MenuCallCallback(menu,TempEntry);
+ Status = EFI_SUCCESS;
+ }
+ }
+
+ //Handle individual Page selections
+ Pos++;
+ for(i = menu->StartItem; i < (UINTN)(menu->StartItem + menu->ItemsInPage); i++)
+ {
+ StartPos = Pos;
+ text = HiiGetString(menu->Entries[i].PageHandle , menu->Entries[ i ].StringToken );
+ StrLen = (TestPrintLength( text ) / (NG_SIZE));
+ MemFreePointer( (VOID **)&text );
+ Pos = StartPos + StrLen + 2;
+
+ if(
+ (Data->Input.Data.MouseInfo.Left >= StartPos) &&
+ (Data->Input.Data.MouseInfo.Left < Pos) &&
+ (Data->Input.Data.MouseInfo.Top == (UINT32)(menu->Top)) //EIP-73377: Check for the exact menu tab co-ordinates.
+ )
+ {
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+ if( (Action == ControlActionChoose ) || (Action == ControlActionSelect) )
+ {
+ if(i != menu->CurrEntry)
+ {
+ _MenuCallCallback(menu,(UINT16)i);
+ }
+ Status=EFI_SUCCESS;
+ }
+ break;
+ }
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MenuGetControlHight
+//
+// Description: Function unsupported.
+//
+// Input: VOID *object,VOID *frame, UINT16 *height
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MenuGetControlHight( VOID *object,VOID *frame, UINT16 *height )
+{
+ return EFI_UNSUPPORTED;
+}
+
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Norcross, Suite 200, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+
diff --git a/EDK/MiniSetup/TseLite/Menu.h b/EDK/MiniSetup/TseLite/Menu.h
new file mode 100644
index 0000000..d8b21bc
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Menu.h
@@ -0,0 +1,179 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Menu.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 7 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Menu.h $
+//
+// 7 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 11 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 7 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 1/09/10 6:39a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Menu.h
+//
+// Description: Header file for Menu controls
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _MENU_H_
+#define _MENU_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+
+typedef struct _IFR_MENU
+{ // this structure is, in some way, following EFI_IFR structures
+ UINT8 Opcode, Length;
+}AMI_IFR_MENU;
+
+typedef struct _MENU_ENTRY
+{
+ /*EFI_HII_HANDLE*/VOID* PageHandle;
+ UINT16 PageID;
+ UINT16 StringToken; // page title to use in menu
+}AMI_MENU_ENTRY;
+
+
+#define MENU_MEMBER_VARIABLES \
+ UINT8 SelFGColor; \
+ UINT8 SelBGColor; \
+ UINT16 NumEntries; \
+ UINT16 CurrEntry; \
+ UINT8 IsSubMenu; \
+ UINT8 MenuWidth; \
+ UINT16 StartItem; \
+ UINT16 ActualPage; \
+ UINT16 PageNum; \
+ UINT16 ItemsInPage; \
+ AMI_MENU_ENTRY *Entries;
+
+
+typedef struct _MENU_METHODS MENU_METHODS;
+
+typedef struct _MENU_DATA
+{
+ MENU_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ MENU_MEMBER_VARIABLES
+
+}
+MENU_DATA;
+
+typedef EFI_STATUS (*MENU_METHOD_SET_WIDTH) ( VOID *object, UINT8 Width );
+
+#define MENU_METHOD_FUNCTIONS \
+ MENU_METHOD_SET_WIDTH SetWidth;
+
+struct _MENU_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ MENU_METHOD_FUNCTIONS
+};
+
+extern MENU_METHODS gMenu;
+
+// Object Methods
+EFI_STATUS MenuCreate( VOID **object );
+EFI_STATUS MenuDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS MenuInitialize( VOID *object, VOID *data );
+EFI_STATUS MenuDraw( VOID *object );
+EFI_STATUS MenuHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS MenuSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS MenuSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS MenuSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS MenuSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS MenuSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS MenuGetControlHight( VOID *object,VOID *frame, UINT16 *height );
+//menu methods
+EFI_STATUS MenuSetWidth(VOID *menu,UINT8 Width);
+
+#endif /* _MENU_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/MessageBox.c b/EDK/MiniSetup/TseLite/MessageBox.c
new file mode 100644
index 0000000..22a5014
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/MessageBox.c
@@ -0,0 +1,1192 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/MessageBox.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 31 $
+//
+// $Date: 8/28/14 8:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/MessageBox.c $
+//
+// 31 8/28/14 8:02a Premkumara
+// [TAG] EIP107833, 125388
+// [Category] Improvement
+// [Symptom:] Setting best text and GOP mode while using TSEPostinterfaces
+// before TSE or after TSE.
+// [Files] Protocol.c, AMITSE.sdl, CommonHelper.c, MiniSetup.sdl,
+// PostMgmtc, PostmgmtExt.c, MessagBox.c
+//
+// 30 5/03/14 3:13p Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 29 5/02/14 3:51a Arunsb
+// [TAG] EIP155965
+// [Category] Improvement
+// [Description] MessageBox, ListBox cannot be canceled by Mouse
+// Right-Click
+// [Files] MessageBox.c, ListBox.c and minisetupext.c
+//
+// 28 2/11/14 8:35p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 27 12/05/13 1:29a Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 26 5/22/13 10:59a Premkumara
+// [TAG] EIP123432
+// [Category] Bug Fix
+// [Issue Faced] Take print screen for save & Exit msg box. OK
+// of msg box is consumed by Save & Exit msg box.
+// - Cursor is missing after taking print screen of popupedit box in
+// string control
+// - Printscreen support is not given for Filebrowser feature
+// [RootCause] - When msg box for Save&Exit is popped and printscreen
+// event is called and displaying msg box over Save&Exit. Then msgbox
+// handleaction for printscreen event will change the result value in
+// _CallbackMsgbox() function so it will break the while loop in
+// _CallbackGetValue() function so destroy the next msg box in
+// CallbackShowMessageBox() function.
+// - DrawCursor variable is not set to TRUE after printscreen event
+// [Solution] - Returning EFI_UNSUPPORTED for printscreen event handling
+// function for messgebox and change the result value to 0xff
+// - Support given for file browser feature
+// [Files] Callback.c, MessageBox.c, Minisetupext.c, PopupString.c,
+// AddBootOption.c
+// AmiTSEStr.uni, FakeToken.c
+//
+// 25 1/22/13 12:20a Rajashakerg
+// [TAG] EIP103449
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] In Setup click\Touch from navigation window, option are not
+// displayed properly
+// [RootCause] Latest mouse driver providing LEFT_DOWN when we hold the
+// mouse left down button.
+// [Solution] Provided fix resolves the issue.
+// [Files] ezport.c, PopupEdit.c, ListBox.c, MessageBox.c
+//
+// 24 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 22 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 23 5/24/12 9:02a Arunsb
+// [TAG] EIP90379
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] UefiBootFailHook asserts when it is trying to call
+// MsgBoxDestroy
+// [RootCause] Tried to free the NULL pointer
+// [Solution] Checked NULL before freeing
+// [Files] TseAdvanced.c and MessageBox.c
+//
+// 22 5/24/12 7:31a Rajashakerg
+// [TAG] EIP88811
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] When pop-up window is invoked in setup and Click on ESC
+// icon or ESC/Right Click, it will respond as two times ESC is clicked
+// [RootCause] ESC functionality provided for left click on the ESC
+// sting navigation frame .
+// [Solution] Now providing the ESC sequence for left down and double
+// click
+// [Files] ezport.c, numeric.c, MessageBox.c
+//
+// 21 2/02/12 1:17p Premkumara
+// [TAG] EIP75351,75352,75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] String.c, boot.c, TseAdvanced.c,Time.c, PopupEdit.c,
+// MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 20 12/01/11 5:43a Rajashakerg
+// [TAG] EIP74963
+// [Category] Improvement
+// [Description] MAX_MSGBOX_WIDTH cannot be overridden
+// [Files] AMITSE.sdl, CommonHelper.c, minisetup.h, legacy.c,
+// MessageBox.c, MessageBox.h, FormBrowser.c
+//
+// 19 12/01/11 1:42a Premkumara
+// [TAG] EIP73236
+// [Category] Improvement
+// [Description] Large amounts of allocated memory are not freed
+// [Files] Expression.c, PopupEdit.c, Popup.c, MessageBox.c, Menu.c,
+// Memo.c,
+//
+// 18 11/30/11 12:42a Premkumara
+// [TAG] EIP75351
+// [Category] Improvement
+// [Description] Static code analysis.Suppress the warnings from static
+// code analyzer
+// [Files] String.c, HiiString21.c, TseAdvanced.c, Special.c,
+// UefiAction., Time.c, PopupEdit.c, MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 17 11/20/11 7:50a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 16 11/10/11 8:30a Rajashakerg
+// [TAG] EIP74965
+// [Category] Improvement
+// [Description] Progress bar in MSGBOX_TYPE_PROGRESS never displays the
+// full 100%
+// [Files] MessageBox.c
+//
+// 15 12/28/10 9:06a Mallikarjunanv
+// Removing the changes of EIP:48381 which are not required.
+//
+// 14 12/24/10 12:50p Mallikarjunanv
+//
+// 13 12/24/10 12:48p Mallikarjunanv
+// [TAG] EIP 46143
+// [Category] Bug Fix
+// [Severity]- Medium
+// [Symptom]- In Boot tab, "Add boot option" -> "Add boot option" option,
+// adding string displayed "invalid string" message , on clicking OK in
+// the message box using mouse not closing msg box.
+// [RootCause] In case of message box selection with mouse the
+// coordinates are improper.
+// [Solution] Message box coordinates are updated with respect to
+// selection with mouse.
+// [Files] MessageBox.c
+//
+// 12 12/24/10 10:49a Mallikarjunanv
+// [TAG] EIP48381
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Mouse click operation not working properly in the warning
+// [RootCause] In TSEMouseMsgBoxHandleAction function coordinates for
+// mouse click are improper
+// [Solution] Fixed the issue by updating the coordinates for mouse
+// click
+// operation
+// [Files] MessageBox.c
+//
+// 11 10/20/10 1:42p Mallikarjunanv
+// reverting back to v25
+//
+// 9 9/16/10 8:38p Madhans
+// Update for TSE 2.10. Refer Changelog.log for more details.
+//
+// 16 7/07/10 7:37p Madhans
+// To avoid Warning.
+//
+// 15 5/19/10 4:13p Blaines
+// Added length boundry check for legend string
+//
+// 14 4/22/10 6:23p Blaines
+// Adjust Messagebox width if required to display legend string.
+//
+// 13 4/20/10 7:02p Blaines
+// Add mouse support for custom messagebox type
+//
+// 12 4/20/10 6:20p Blaines
+// Support custom messagebox type in MsgBoxHandleAction
+//
+// 11 4/09/10 12:26p Madhans
+// To freeup the strings
+//
+// 10 3/26/10 6:53p Madhans
+// Support to Map the do the Control Mapping from gTseControlMap Table. So
+// no changes need in Frame.c, With this feature gTseControlMap Can be
+// customized to add/customize the TSE controls.
+//
+// 9 3/24/10 12:00p Blaines
+// Message box color can be configured based on message box type
+// (help, error, etc)
+//
+// This change corrects the selected button FG/BG color.
+//
+// 8 3/23/10 5:20p Blaines
+// Extend Message Box support
+// Adds Custom Type
+// Adds Progress Bar Type
+//
+// 7 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 6 2/15/10 10:13p Madhans
+// To avoid warnings
+//
+// 5 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 4 1/09/10 6:39a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: MessageBox.c
+//
+// Description: This file contains code to handle Message Box operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+
+MSGBOX_METHODS gMsgBox =
+{
+ MsgBoxCreate,
+ MsgBoxDestroy,
+ MsgBoxInitialize,
+ MsgBoxDraw,
+ MsgBoxHandleAction,
+ MsgBoxSetCallback,
+ MsgBoxSetFocus,
+ MsgBoxSetPosition,
+ MsgBoxSetDimensions,
+ MsgBoxSetAttributes,
+ MsgBoxGetControlHight,
+ MsgBoxSetType
+};
+
+/////////////////////////////////////////////////
+///// Extern variables and functions
+/////////////////////////////////////////////////
+void ClearGrphxScreen (void);
+BOOLEAN SingleClickActivation (VOID); //EIP-139608
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxCreate
+//
+// Description: Function to Create Message Box, which uses the Popup functions.
+//
+// Input: MSGBOX_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxCreate( MSGBOX_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(MSGBOX_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gPopup.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gMsgBox;
+
+ // create the memo
+ gMemo.Create(&((*object)->Memo));
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxDestroy
+//
+// Description: Function to Destroy Message Box, which uses the Popup functions.
+//
+// Input: MSGBOX_DATA *msgbox, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxDestroy( MSGBOX_DATA *msgbox, BOOLEAN freeMem )
+{
+ EFI_STATUS Status;
+
+ if(NULL == msgbox)
+ return EFI_SUCCESS;
+
+ Status = gPopup.Destroy( msgbox, FALSE );
+ MemFreePointer( (VOID **)&(msgbox->Memo->ControlData.ControlPtr) );
+ Status = gMemo.Destroy( msgbox->Memo, FALSE );
+
+ if(msgbox->Title)
+ MemFreePointer( (VOID **)&msgbox->Title );
+
+ //Restore saved screen only inside TSE
+ if (TSE_POST_STATUS_IN_TSE == gPostStatus)
+ {
+ if (msgbox->ScreenBuf) //Restore If it has valid data
+ RestoreScreen( msgbox->ScreenBuf );
+ }
+
+ if (freeMem)
+ {
+ if (NULL != msgbox->Legend) //EIP 90379
+ {
+ MemFreePointer ((VOID **)&msgbox->Legend);//EIP-73236
+ }
+ if (NULL != msgbox->PtrTokens)
+ {
+ MemFreePointer ((VOID **)&msgbox->PtrTokens);
+ }
+ // MemFreePointer( (VOID **)&msgbox->HotKeyList );
+ // MemFreePointer( (VOID **)&msgbox->OutKey );
+ MemFreePointer( (VOID **)&msgbox );
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxInitialize
+//
+// Description: Function to Initialize Message Box, which uses the Popup functions.
+//
+// Input: MSGBOX_DATA *msgbox, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxInitialize( MSGBOX_DATA *msgbox, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 Length =0 ;
+ VOID *buff;
+ CONTROL_INFO MemoCtrlData;
+ MEMO_DATA *memo;
+ UINT8 Color ;
+
+ UINT16 titleToken;
+ VOID* TextHandle =((AMI_IFR_MSGBOX*)(((CONTROL_INFO*)data)->ControlPtr))->TextHandle;
+
+ // initializes the heigth and width
+ Status = gPopup.Initialize( msgbox, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ Status = StyleGetMessageboxColor(msgbox->MsgBoxCatagory, &Color) ;
+
+ if ( EFI_ERROR( Status ) == EFI_SUCCESS)
+ {
+ msgbox->FGColor = Color & 0x0f ;
+ msgbox->BGColor = Color & 0xf0 ;
+ }else
+ // add extra initialization here...
+ SetControlColorsHook( NULL, NULL, NULL , NULL, NULL , NULL, NULL ,
+ NULL , NULL, NULL,NULL ,
+ NULL,NULL ,&(msgbox->FGColor),&(msgbox->BGColor) );
+
+
+ msgbox->Container = NULL;
+
+ msgbox->Border =TRUE;
+
+ titleToken = (UINT16)(((AMI_IFR_MSGBOX*)(msgbox->ControlData.ControlPtr))->Title);
+ if ( titleToken != 0 ) {
+ msgbox->Title = HiiGetString(msgbox->ControlData.ControlHandle, titleToken);
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if(NULL == msgbox->Title){
+ msgbox->Title = EfiLibAllocateZeroPool(2*sizeof(CHAR16));
+ if(!msgbox->Title)
+ return EFI_OUT_OF_RESOURCES;
+ EfiStrCpy(msgbox->Title,L" ");
+ }
+ }
+
+ Length = (UINT16)HiiMyGetMultiLineStringLength(msgbox->ControlData.ControlHandle, (UINT16)(((AMI_IFR_MSGBOX*)(msgbox->ControlData.ControlPtr))->Text));
+
+ if ( ( msgbox->Title != NULL) && ( Length < (TestPrintLength( msgbox->Title )/ (NG_SIZE)) ) )
+ Length = (UINT16)(TestPrintLength( msgbox->Title ) / (NG_SIZE));
+
+ msgbox->Width = (UINT16)(Length + 4);
+
+ if(( msgbox->MsgBoxType == MSGBOX_TYPE_NULL ) && ( msgbox->Legend != NULL ))
+ {
+ if ( msgbox->Width < (UINT16)(TestPrintLength( msgbox->Legend )/ (NG_SIZE)) )
+ msgbox->Width = (UINT16)(TestPrintLength( msgbox->Legend ) / (NG_SIZE)) + 8;
+ }
+//EIP74963 : MAX_MSGBOX_WIDTH macro changed as token and handled from binary
+ if ( msgbox->Width > GetMsgboxWidth())
+ msgbox->Width = GetMsgboxWidth();
+
+ //Save the screen only insied TSE not for PostInterfaces outside TSE
+ if (TSE_POST_STATUS_IN_TSE == gPostStatus)
+ msgbox->ScreenBuf = SaveScreen();
+
+ //Clear screen before displaying msgbox when PROCEED_TO_BOOT not inside TSE
+ if (TSE_POST_STATUS_PROCEED_TO_BOOT == gPostStatus)
+ {
+ ClearGrphxScreen(); //Clearing full screen when image is drawn in quietBoot mode
+ ClearScreen(EFI_BACKGROUND_BLACK | EFI_LIGHTGRAY);
+ }
+
+ // initialize memo control
+ memo = msgbox->Memo;
+
+ buff = UefiCreateSubTitleTemplate(((AMI_IFR_MSGBOX*)(msgbox->ControlData.ControlPtr))->Text );
+
+
+ MemSet( &MemoCtrlData, sizeof(MemoCtrlData), 0 );
+ MemoCtrlData.ControlPtr = (VOID*)buff;
+ MemoCtrlData.ControlHandle = TextHandle;
+ MemoCtrlData.ControlFlags.ControlVisible = TRUE;
+ gMemo.Initialize(memo,(VOID *)&(MemoCtrlData));
+ memo->Width = msgbox->Width - 2;
+ gMemo.GetControlHeight( memo, NULL, &msgbox->Height );
+ msgbox->Height += 4;
+
+ gMemo.SetAttributes(memo,msgbox->FGColor ,msgbox->BGColor);
+ gMemo.SetDimensions( memo, msgbox->Width-2 , msgbox->Height-3 );
+ gMemo.SetJustify( memo, JUSTIFY_CENTER );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _MsgBoxOptSize
+//
+// Description: Function returns and fix the option string
+//
+// Input: MSGBOX_DATA *msgbox
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _MsgBoxOptSize(CHAR16 *txt)
+{
+ UINTN Size = (TestPrintLength( txt ) / (NG_SIZE));
+ if( Size > 10)
+ {
+ txt[HiiFindStrPrintBoundary(txt,10)] = L'\0';
+ Size = (TestPrintLength( txt ) / (NG_SIZE)); // Need to do this. instead of assigning 10;
+ }
+ return Size;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _MsgBoxDrawOpts
+//
+// Description: Function to Draw Message box options
+//
+// Input: MSGBOX_DATA *msgbox
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _MsgBoxDrawOpts(MSGBOX_DATA *msgbox)
+{
+ UINT16 Index, W;
+ CHAR16 Line[MAX_COLS] ,*txt;
+ UINTN printLength, pos ;
+
+ if ( msgbox->MsgBoxType != MSGBOX_TYPE_NULL )
+ {
+ for ( Index = 1; Index < msgbox->Width -1 ; Index++ )
+ Line[Index] = BOXDRAW_HORIZONTAL;
+
+ Line[0] = BOXDRAW_VERTICAL_RIGHT;
+ Line[Index] = BOXDRAW_VERTICAL_LEFT;
+ Line[Index+1] = 0x0;
+
+ DrawString( msgbox->Left, msgbox->Top + msgbox->Height - 3, Line );
+
+ // draw the buttons
+ switch ( msgbox->MsgBoxType & MSGBOX_TYPE_MASK )
+ {
+
+ case MSGBOX_TYPE_YESNO:
+ txt = HiiGetString( msgbox->ControlData.ControlHandle, STRING_TOKEN(STR_CTRL_YES));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == txt){
+ break;
+ }
+
+ msgbox->Button1Len = (UINT8)_MsgBoxOptSize(txt );
+ DrawStringWithAttribute((UINTN) (msgbox->Left + msgbox->Width/3 -2) , (UINTN)(msgbox->Top + msgbox->Height -2), txt, (UINT8) (((msgbox->MsgboxSel==0)? EFI_BACKGROUND_BLACK|EFI_WHITE : msgbox->BGColor|msgbox->FGColor)));
+ MemFreePointer( (VOID **)&txt);
+
+ txt = HiiGetString( msgbox->ControlData.ControlHandle, STRING_TOKEN(STR_CTRL_NO));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == txt){
+ break;
+ }
+
+ msgbox->Button2Len = (UINT8)_MsgBoxOptSize(txt );
+
+ DrawStringWithAttribute((UINTN)( msgbox->Left + 2*(msgbox->Width/3) -2) ,(UINTN)(msgbox->Top + msgbox->Height -2), txt, (UINT8) (((msgbox->MsgboxSel==1)? EFI_BACKGROUND_BLACK|EFI_WHITE : msgbox->BGColor|msgbox->FGColor)));
+ MemFreePointer( (VOID **)&txt);
+
+ break;
+ case MSGBOX_TYPE_OKCANCEL:
+ txt = HiiGetString( msgbox->ControlData.ControlHandle, STRING_TOKEN(STR_CTRL_OK));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == txt){
+ break;
+ }
+ msgbox->Button1Len = (UINT8)_MsgBoxOptSize(txt );
+ DrawStringWithAttribute((UINTN) (msgbox->Left + msgbox->Width/3 -2) , (UINTN)(msgbox->Top + msgbox->Height -2), txt, (UINT8) (((msgbox->MsgboxSel==0)? EFI_BACKGROUND_BLACK|EFI_WHITE : msgbox->BGColor|msgbox->FGColor)));
+ MemFreePointer( (VOID **)&txt);
+
+ txt = HiiGetString( msgbox->ControlData.ControlHandle, STRING_TOKEN(STR_CTRL_CANCEL));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == txt){
+ break;
+ }
+ msgbox->Button2Len = (UINT8)_MsgBoxOptSize(txt );
+ DrawStringWithAttribute((UINTN)( msgbox->Left + 2*(msgbox->Width/3) -2) ,(UINTN)(msgbox->Top + msgbox->Height -2), txt, (UINT8) (((msgbox->MsgboxSel==1)? EFI_BACKGROUND_BLACK|EFI_WHITE : msgbox->BGColor|msgbox->FGColor)));
+ MemFreePointer( (VOID **)&txt);
+ break;
+
+ case MSGBOX_TYPE_CUSTOM:
+
+ if ( (msgbox->OptionCount != 0) && (msgbox->PtrTokens != NULL ))
+ {
+ W = ( msgbox->Width)/(msgbox->OptionCount) ;
+
+
+ for ( Index = 0; Index < msgbox->OptionCount ; Index++ )
+ {
+ txt = HiiGetString( msgbox->ControlData.ControlHandle, msgbox->PtrTokens[Index]);
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == txt){
+ break;
+ }
+ pos = (UINTN) (msgbox->Left + (Index * W) ) ;
+
+ printLength = (TestPrintLength( txt ) / (NG_SIZE));
+
+ if( printLength > W)
+ {
+ txt[HiiFindStrPrintBoundary(txt, W)] = L'\0';
+ printLength = (TestPrintLength( txt ) / (NG_SIZE));
+ }
+
+ DrawStringWithAttribute(pos + (W-printLength)/2 , (UINTN)(msgbox->Top + msgbox->Height -2 ), txt, (UINT8) (((msgbox->MsgboxSel==Index)? EFI_BACKGROUND_BLACK|EFI_WHITE : msgbox->BGColor|msgbox->FGColor)));
+ MemFreePointer( (VOID **)&txt);
+ }
+ }
+
+ break;
+
+ case MSGBOX_TYPE_PROGRESS:
+ //Draw the progress bar based on percent complete, for example
+
+ //----------------------- Title ------------------------//
+ // //
+ // Message Body will be printerd here //
+ // //
+ //------------------------------------------------------//
+ // ##################### 10% #### // <--- This section is where to use DrawStringWithAttribute
+ //--------------------- Legend -------------------------//
+
+ {
+ CHAR16 Box[2] = {0};
+ CHAR16 PercentStr[5] = {0};
+ UINT16 Index = 0;
+ UINT16 ChrIdx=msgbox->Left;
+ UINT16 ProgPos=0;
+
+ //symbol character to show during progress update
+ Box[0] = (CHAR16)BLOCKELEMENT_FULL_BLOCK ; //L'#';
+ Box[1] = (CHAR16)L'\0';
+
+
+ //max percentage should be 100
+ if( msgbox->Percent > 100) {
+ msgbox->Percent = 100;
+ }
+
+ //percentage to update on the progress bar
+ if( msgbox->Percent / 100)
+ {
+ PercentStr[Index++] = (CHAR16)(msgbox->Percent / 100) + L'0';
+ PercentStr[Index++] = (CHAR16)((msgbox->Percent % 100) / 10) + L'0';
+
+ }
+ if( (msgbox->Percent % 100) / 10)
+ PercentStr[Index++] = (CHAR16)((msgbox->Percent % 100) / 10) + L'0';
+
+ PercentStr[Index++] = (CHAR16)((msgbox->Percent % 100) % 10) + L'0';
+ PercentStr[Index] = L'%';
+
+ /// some sample logic to fill the progress bar symbol character properly without hard coded values...
+ ProgPos = msgbox->Width - 2;
+ while ( ProgPos < 100 )
+ {
+ if ( 100 % ProgPos != 0){
+ if ( 99 % ProgPos != 0){
+ if ( 98 % ProgPos != 0) {
+ ProgPos--;
+ }
+ else
+ break;//EIP74965 : Progress bar now can show the 100% status
+ }
+ else
+ break;
+ }
+ else
+ break;
+ }
+
+ ProgPos = 100/ProgPos;
+
+
+ //Fill progress bar for the given percentage
+ for( Index = 0; Index < msgbox->Percent; Index++ ) {
+ //fill the symbol character based on the segment value for the given percentage
+ if( ( msgbox->Percent != 0 ) && ( Index % ProgPos == 0 ) && (ChrIdx < msgbox->Left+msgbox->Width-2) )
+ DrawStringWithAttribute((UINTN) ++ChrIdx, (UINTN)(msgbox->Top + msgbox->Height - 2), Box, (UINT8) msgbox->BGColor|EFI_CYAN/*| msgbox->FGColor*/);
+ }
+
+ if( msgbox->Percent == 100 ) {
+ //to fill the progress bar completely for the box width in case of 100 percentage.
+ for( ; (ChrIdx - msgbox->Left) < (msgbox->Width - 2); )
+ DrawStringWithAttribute((UINTN) ++ChrIdx, (UINTN)(msgbox->Top + msgbox->Height - 2), Box, (UINT8) msgbox->BGColor|EFI_CYAN/*| msgbox->FGColor*/);
+ }
+
+ //draw percentage string on the progress bar
+ DrawStringWithAttribute( msgbox->Left + msgbox->Width / 2 - EfiStrLen(PercentStr)/2, msgbox->Top + msgbox->Height - 3,PercentStr, (UINT8) /*msgbox->BGColor|EFI_RED */msgbox->BGColor | msgbox->FGColor);
+
+ //Draw the given legend
+ DrawStringWithAttribute( msgbox->Left + msgbox->Width / 2 - EfiStrLen(msgbox->Legend)/2, msgbox->Top + msgbox->Height - 1,msgbox->Legend, (UINT8) msgbox->BGColor | msgbox->FGColor);
+ }
+
+ break;
+
+ case MSGBOX_TYPE_OK:
+
+ default:
+ txt = HiiGetString(msgbox->ControlData.ControlHandle, STRING_TOKEN(STR_CTRL_OK));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == txt){
+ break;
+ }
+
+ msgbox->Button1Len = (UINT8)_MsgBoxOptSize(txt );
+ msgbox->Button2Len = 0;
+ DrawStringWithAttribute( msgbox->Left + msgbox->Width/2 , msgbox->Top + msgbox->Height -2, txt, EFI_BACKGROUND_BLACK|EFI_WHITE );
+ MemFreePointer( (VOID **)&txt);
+ break;
+ }
+
+ FlushLines( msgbox->Top + msgbox->Height -3, msgbox->Top + msgbox->Height);
+ }
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxDraw
+//
+// Description: Function to Draw Message box
+//
+// Input: MSGBOX_DATA *msgbox
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxDraw( MSGBOX_DATA *msgbox )
+{
+ EFI_STATUS Status;
+ CHAR16 *PadTitle = NULL, *Str = NULL;
+ Str = msgbox->Legend ;
+
+ MouseFreeze();
+
+ Status = gPopup.Draw( msgbox );
+ if(EFI_ERROR(Status))
+ return Status;
+
+ _MsgBoxDrawOpts(msgbox);
+
+ // draw memo
+ gMemo.SetPosition( msgbox->Memo, msgbox->Left + 1, msgbox->Top + 2 );
+ gMemo.SetJustify( msgbox->Memo, (msgbox->MsgBoxType & MSGBOX_STYLE_MASK) >> 4 );
+ gMemo.Draw( msgbox->Memo );
+
+
+
+ if ((Str != NULL) && ( msgbox->MsgBoxType == MSGBOX_TYPE_NULL ) )
+ {
+ PadTitle = EfiLibAllocateZeroPool( (msgbox->Width + 3) * sizeof(CHAR16) );
+
+ if( (UINT16)(TestPrintLength( Str ) / (NG_SIZE)) > (UINT16)(msgbox->Width-2))
+ EfiStrCpy( &Str[HiiFindStrPrintBoundary(Str,(msgbox->Width-5))],L"...");
+
+ if ( PadTitle != NULL )
+ SPrint( PadTitle, msgbox->Width * sizeof(CHAR16), L" %s ",Str );
+ }
+
+ if ( PadTitle )
+ {
+ DrawStringJustified( 0, gMaxCols, msgbox->Top+msgbox->Height-1, JUSTIFY_CENTER, PadTitle );
+ //DrawStringJustified( msgbox->Left+1, msgbox->Left+msgbox->Width-1, msgbox->Top+msgbox->Height, JUSTIFY_CENTER, PadTitle );
+ MemFreePointer((VOID **)&PadTitle);
+ }
+
+ FlushLines( msgbox->Top, msgbox->Top + msgbox->Height );
+ DoRealFlushLines();
+
+ MouseRefresh();
+
+ return EFI_SUCCESS;
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _MsgBoxCallCallback
+//
+// Description: Internal Helper Function to Call the callback
+//
+// Input: MENU_DATA *menu, UINT8 MenuEntry
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _MsgBoxCallCallback(MSGBOX_DATA *msgbox,UINT8 MsgboxSel)
+{
+ if ( ( msgbox->Callback != NULL ) && (msgbox->Cookie != NULL) )
+ {
+ CALLBACK_MESSAGEBOX *callbackData = (CALLBACK_MESSAGEBOX *)msgbox->Cookie;
+ callbackData->Result = MsgboxSel;
+ msgbox->Callback( msgbox->Container, msgbox, msgbox->Cookie );
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxHandleAction
+//
+// Description: Function to Handle the Message Box Actions.
+//
+// Input: MSGBOX_DATA *msgbox
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxHandleAction( MSGBOX_DATA *msgbox, ACTION_DATA *Data)
+{
+ EFI_STATUS Status;
+ BOOLEAN Redraw = FALSE;
+ //Always return success to consume the message, the messagebox is always modal.
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ return EFI_UNSUPPORTED;
+
+ if ( Data->Input.Type == ACTION_TYPE_MOUSE )
+ {
+ Status = MouseMsgBoxHandleAction( msgbox, Data,&Redraw);
+ }
+
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ {
+ CONTROL_ACTION Action;
+
+ //Get mapping
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+
+ if( TsePrintScreenEventSupport(Data->Input.Data.AmiKey.Key.ScanCode))
+ {
+ gApplication.HandleAction( gApp, Data );
+ return EFI_UNSUPPORTED;//EIP-123432
+ }
+
+ switch(Action)
+ {
+ case ControlActionSelect:
+ // EIP 34545 : If MSGBOX_TYPE_NULL, nothing to select Only Esc can control
+ if (msgbox->MsgBoxType == MSGBOX_TYPE_NULL)
+ break;
+ _MsgBoxCallCallback(msgbox,msgbox->MsgboxSel);
+ break;
+
+ case ControlActionNextLeft:
+ if( ( (msgbox->MsgBoxType & MSGBOX_TYPE_MASK) != MSGBOX_TYPE_OK )&&
+ ( (msgbox->MsgBoxType & MSGBOX_TYPE_MASK) != MSGBOX_TYPE_CUSTOM ))
+ {
+ if ( msgbox->MsgboxSel == 1 )
+ msgbox->MsgboxSel = 0;
+
+ }
+ else if((msgbox->MsgBoxType & MSGBOX_TYPE_MASK) == MSGBOX_TYPE_CUSTOM )
+ {
+ if ( msgbox->MsgboxSel > 0 )
+ msgbox->MsgboxSel--;
+
+ }
+
+ Redraw = TRUE;
+ break;
+
+ case ControlActionNextRight:
+ if( ( (msgbox->MsgBoxType & MSGBOX_TYPE_MASK) != MSGBOX_TYPE_OK )&&
+ ( (msgbox->MsgBoxType & MSGBOX_TYPE_MASK) != MSGBOX_TYPE_CUSTOM ))
+ {
+ if ( msgbox->MsgboxSel == 0 )
+ msgbox->MsgboxSel = 1;
+
+ }
+ else if((msgbox->MsgBoxType & MSGBOX_TYPE_MASK) == MSGBOX_TYPE_CUSTOM )
+ {
+ if ( msgbox->MsgboxSel < msgbox->OptionCount-1 )
+ msgbox->MsgboxSel++;
+ }
+
+ Redraw = TRUE;
+ break;
+
+ case ControlActionAbort:
+ msgbox->MsgboxSel = MSGBOX_CANCEL;
+ _MsgBoxCallCallback(msgbox,msgbox->MsgboxSel);
+ gAction.ClearAction( Data );
+ break;
+ }
+ }
+
+ if ( Redraw == TRUE )
+ gMsgBox.Draw( msgbox );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: MSGBOX_DATA *msgbox, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxSetCallback( MSGBOX_DATA *msgbox, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( msgbox, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxSetType
+//
+// Description: Function to set message box type.
+//
+// Input: MSGBOX_DATA *msgbox, UINT8 Type
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxSetType( MSGBOX_DATA *msgbox, UINT8 Type )
+{
+ msgbox->MsgBoxType = Type;
+ if ( (Type & MSGBOX_TYPE_MASK) != MSGBOX_TYPE_NULL )
+ msgbox->Height += 2;
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: MSGBOX_DATA *msgbox, BOOLEAN focus
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxSetFocus(MSGBOX_DATA *msgbox, BOOLEAN focus)
+{
+ msgbox->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxSetPosition
+//
+// Description: Function to set position.
+//
+// Input: MSGBOX_DATA *msgbox, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxSetPosition(MSGBOX_DATA *msgbox, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( msgbox, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxSetDimensions
+//
+// Description: Function to set dimensions.
+//
+// Input: MSGBOX_DATA *msgbox, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxSetDimensions(MSGBOX_DATA *msgbox, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( msgbox, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxSetAttributes
+//
+// Description: Function to set attrinutes.
+//
+// Input: MSGBOX_DATA *msgbox, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxSetAttributes(MSGBOX_DATA *msgbox, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( msgbox, FGColor, BGColor );
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSEMouseMsgBoxHandleAction
+//
+// Description: Function to hadnle Message Box using mouse
+//
+// Input: MSGBOX_DATA *msgbox,
+// ACTION_DATA *action,
+// BOOLEAN * pRedraw
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TSEMouseMsgBoxHandleAction( MSGBOX_DATA *msgbox, ACTION_DATA *Data,BOOLEAN * pRedraw)
+{
+ BOOLEAN ButtonClicked = FALSE;
+ CONTROL_ACTION Action;
+
+ UINT16 Index, W;
+ CHAR16 *txt=NULL;
+ UINTN printLength, pos ;
+
+ //EIP 103449 : In Setup click\Touch from navigation window, option are not displayed properly
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+
+ if((
+ (Data->Input.Data.MouseInfo.Top < msgbox->Top) ||
+ (Data->Input.Data.MouseInfo.Top > (UINT32)(msgbox->Top + msgbox->Height)) ||
+ (Data->Input.Data.MouseInfo.Left < msgbox->Left) ||
+ (Data->Input.Data.MouseInfo.Left > (UINT32)(msgbox->Left + msgbox->Width))
+ )&&( (SingleClickActivation() && (ControlActionSelect ==Action)) || //If singleClickActivation is enabled/Disable
+ (ControlActionAbort == Action) || (ControlActionChoose ==Action ) //EIP-139608 Closing listbox whn mouse action happens outside listbox
+ )
+ )
+ {
+ msgbox->MsgboxSel = MSGBOX_CANCEL;
+ _MsgBoxCallCallback(msgbox,msgbox->MsgboxSel);
+ gAction.ClearAction( Data );
+ return EFI_SUCCESS;
+ }
+
+
+ if( (Action == ControlActionChoose ) || (Action == ControlActionSelect) )
+ {
+ if(Data->Input.Data.MouseInfo.Top == (UINT32)(msgbox->Top + msgbox->Height -2))
+ {
+ switch(msgbox->MsgBoxType & MSGBOX_TYPE_MASK)
+ {
+ case MSGBOX_TYPE_CUSTOM:
+
+ if ( (msgbox->OptionCount != 0) && (msgbox->PtrTokens != NULL ))
+ {
+ W = ( msgbox->Width)/(msgbox->OptionCount) ;
+
+ for ( Index = 0; Index < msgbox->OptionCount ; Index++ )
+ {
+ txt = HiiGetString( msgbox->ControlData.ControlHandle, msgbox->PtrTokens[Index]);
+ pos = (UINTN) (msgbox->Left + (Index * W) ) ;
+
+ printLength = (TestPrintLength( txt ) / (NG_SIZE));
+
+ if( printLength > W)
+ {
+ txt[HiiFindStrPrintBoundary(txt, W)] = L'\0';
+ printLength = (TestPrintLength( txt ) / (NG_SIZE));
+ }
+
+ MemFreePointer( (VOID **)&txt);
+
+ if( (Data->Input.Data.MouseInfo.Left)>=(UINT32)(pos + (W-printLength)/2 -2) &&
+ (Data->Input.Data.MouseInfo.Left)<=(UINT32)((pos + (W-printLength)/2 -2)+printLength))
+ {
+ msgbox->MsgboxSel = (UINT8)Index;
+ ButtonClicked = TRUE;
+ break;
+ }
+ }
+ }
+
+ break;
+
+ case MSGBOX_TYPE_YESNO:
+ case MSGBOX_TYPE_OKCANCEL:
+
+ if( (Data->Input.Data.MouseInfo.Left)>=(UINT32)(msgbox->Left + msgbox->Width/3 -2) &&
+ (Data->Input.Data.MouseInfo.Left)<=(UINT32)((msgbox->Left + msgbox->Width/3 -2)+msgbox->Button1Len))
+ {
+ msgbox->MsgboxSel = 0;
+ ButtonClicked = TRUE;
+ }
+
+ if( (Data->Input.Data.MouseInfo.Left)>=(UINT32)( msgbox->Left + 2*(msgbox->Width/3) -2) &&
+ (Data->Input.Data.MouseInfo.Left)<=(UINT32)(( msgbox->Left + 2*(msgbox->Width/3) -2)+msgbox->Button2Len) )
+ {
+ msgbox->MsgboxSel = 1;
+ ButtonClicked = TRUE;
+ }
+ break;
+ case MSGBOX_TYPE_OK:
+ default:
+ // EIP 46143 - Updated the msg box position to slect with click properly
+ if( (Data->Input.Data.MouseInfo.Left)>=(UINT32)(msgbox->Left + msgbox->Width/2 -1) &&
+ (Data->Input.Data.MouseInfo.Left)<=(UINT32)((msgbox->Left + msgbox->Width/2 -1)+msgbox->Button1Len) )
+ {
+ msgbox->MsgboxSel = 0;
+ ButtonClicked = TRUE;
+ }
+ break;
+ }
+
+ if(ButtonClicked)
+ {
+ if(ControlActionChoose == MapControlMouseActionHook(&Data->Input.Data.MouseInfo))
+ *pRedraw = TRUE;
+ else
+ _MsgBoxCallCallback(msgbox,msgbox->MsgboxSel);
+ }
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MsgBoxGetControlHight
+//
+// Description: Function unsupported.
+//
+// Input: VOID *object,VOID *frame, UINT16 *height
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MsgBoxGetControlHight( VOID *object,VOID *frame, UINT16 *height )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Norcross, Suite 200, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+
diff --git a/EDK/MiniSetup/TseLite/MessageBox.h b/EDK/MiniSetup/TseLite/MessageBox.h
new file mode 100644
index 0000000..7e5781a
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/MessageBox.h
@@ -0,0 +1,207 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/MessageBox.h $
+//
+// $Author: Premkumara $
+//
+// $Revision: 10 $
+//
+// $Date: 8/28/14 6:05a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/MessageBox.h $
+//
+// 10 8/28/14 6:05a Premkumara
+// EIP-135253 Updating file name proper in #include
+//
+// 9 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 11 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 8 12/01/11 5:42a Rajashakerg
+// [TAG] EIP74963
+// [Category] Improvement
+// [Description] MAX_MSGBOX_WIDTH cannot be overridden
+// [Files] AMITSE.sdl, CommonHelper.c, minisetup.h, legacy.c,
+// MessageBox.c, MessageBox.h, FormBrowser.c
+//
+// 7 4/21/10 12:01p Madhans
+// Tse 2.02
+//
+// 9 4/20/10 6:22p Blaines
+// Define MSGBOX_MAX_OPTIONS
+//
+// 8 3/26/10 6:53p Madhans
+// Support to Map the do the Control Mapping from gTseControlMap Table. So
+// no changes need in Frame.c, With this feature gTseControlMap Can be
+// customized to add/customize the TSE controls.
+//
+// 7 3/23/10 5:20p Blaines
+// Extend Message Box support
+// Adds Custom Type
+// Adds Progress Bar Type
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 3 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+#ifndef _MSGBOX_H_
+#define _MSGBOX_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "popup.h"
+#include "Memo.h"
+
+//EIP74963 : MAX_MSGBOX_WIDTH macro changed as token and handled from binary
+//#define MAX_MSGBOX_WIDTH 45
+// messagebox constants
+#define MSGBOX_TYPE_NULL 0
+#define MSGBOX_TYPE_OK 1
+#define MSGBOX_TYPE_OKCANCEL 2
+#define MSGBOX_TYPE_YESNO 3
+#define MSGBOX_TYPE_CUSTOM 4
+#define MSGBOX_TYPE_PROGRESS 5 // internal use only (NOT PUBLISHED)
+#define MSGBOX_TYPE_MASK 0x0F
+#define MSGBOX_TYPE_MAXTYPE MSGBOX_TYPE_MASK
+#define MSGBOX_STYLE_CENTER (UINT8)(JUSTIFY_CENTER << 4)
+#define MSGBOX_STYLE_RIGHT (UINT8)(JUSTIFY_RIGHT << 4)
+#define MSGBOX_STYLE_LEFT (UINT8)(JUSTIFY_LEFT << 4)
+#define MSGBOX_STYLE_MASK 0xF0
+#define MSGBOX_OK 0
+#define MSGBOX_CANCEL 1
+#define MSGBOX_YES 0
+#define MSGBOX_NO 1
+
+#define MSGBOX_MAX_OPTIONS 4
+typedef struct _IFR_MSGBOX
+{ // this structure is, in some way, following EFI_IFR structures
+ UINT8 Opcode, Length;
+ UINT16 Title;
+ /*EFI_HII_HANDLE*/VOID * TextHandle;
+ UINT16 Text;
+}AMI_IFR_MSGBOX;
+
+#define MSGBOX_MEMBER_VARIABLES \
+ VOID *ScreenBuf; \
+ MEMO_DATA *Memo; \
+ UINT8 MsgBoxType; \
+ UINT8 MsgboxSel; \
+ UINT8 Button1Len; \
+ UINT8 Button2Len; \
+ CHAR16 *Legend; \
+ MSGBOX_EX_CATAGORY MsgBoxCatagory; \
+ UINT16 *PtrTokens; \
+ UINT16 OptionCount; \
+ AMI_POST_MGR_KEY *HotKeyList; \
+ UINT16 HotKeyListCount; \
+ AMI_POST_MGR_KEY *OutKey; \
+ UINTN Percent; // 0 - 100
+
+
+typedef struct _MSGBOX_METHODS MSGBOX_METHODS;
+
+typedef struct _MSGBOX_DATA
+{
+ MSGBOX_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ POPUP_MEMBER_VARIABLES
+ MSGBOX_MEMBER_VARIABLES
+}
+MSGBOX_DATA;
+
+typedef EFI_STATUS (*MSGBOX_METHOD_SET_TYPE) ( VOID *object, UINT8 Type );
+
+#define MSGBOX_METHOD_FUNCTIONS \
+ MSGBOX_METHOD_SET_TYPE SetType;
+
+struct _MSGBOX_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ MSGBOX_METHOD_FUNCTIONS
+};
+
+extern MSGBOX_METHODS gMsgBox;
+
+
+// Object Methods
+EFI_STATUS MsgBoxCreate( VOID **object );
+EFI_STATUS MsgBoxDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS MsgBoxInitialize( VOID *object, VOID *data );
+EFI_STATUS MsgBoxDraw( VOID *object );
+EFI_STATUS MsgBoxHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS MsgBoxSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+EFI_STATUS MsgBoxSetType(VOID *object, UINT8 Type );
+
+// Control Methods
+EFI_STATUS MsgBoxSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS MsgBoxSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS MsgBoxSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS MsgBoxSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS MsgBoxGetControlHight( VOID *object,VOID *frame, UINT16 *height );
+
+#endif /* _MSGBOX_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/PopupEdit.c b/EDK/MiniSetup/TseLite/PopupEdit.c
new file mode 100644
index 0000000..071cbb9
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupEdit.c
@@ -0,0 +1,890 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupEdit.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 28 $
+//
+// $Date: 5/03/14 4:02p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupEdit.c $
+//
+// 28 5/03/14 4:02p Premkumara
+// [TAG] EIP135665
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE get hangs, when long string is given as title for
+// password
+// [Root Cause] TSE is not handling properl when PasswordTitle length
+// exceeds screen width
+// [Solution] Handled password title length based on screen width and
+// given support to display title in multiple lines.
+// [Files] postmgmtext.c, Popup.c, PopupEdit.c, PopupPassword.c
+//
+// 27 5/01/14 3:53p Premkumara
+// [TAG] EIP158293
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Closing Password popup window displaying invalid password
+// msg box, when SINGLE_CLICK_ACTIVATION token is enabled.
+// [RootCause] Once clicked outside password popup window,
+// ControlActionAbort action is not setting so it returning EFFI_SUCCESS
+// status. If status is not success invalid password will display.
+// [Solution] When mouse is clicked outside password/string popup
+// window, ControlActionAbort action will be set so finally it will return
+// EFI_SUCCESS and "invalid password" msg box will not display.
+// [Files] PopupEdit.c
+//
+// 26 2/11/14 8:40p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 25 12/03/13 8:57a Premkumara
+// [TAG] EIP135665
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE get hangs, when long string is given as title for
+// password
+// [Root Cause] TSE is not handling properl when PasswordTitle length
+// exceeds screen width
+// [Solution] Handled password title length based on screen width and
+// given support to display title in multiple lines.
+// [Files] postmgmtext.c, Popup.c, PopupEdit.c, PopupPassword.c
+//
+// 24 5/15/13 4:06a Premkumara
+// [TAG] EIP123311
+// [Issue Faced] Popup string control accepts ENTER character while
+// pressing CTRL+ENTER. So causing page corruption
+// [Root Cause] When CTRL+ENTER is pressed valid shift key is set and
+// unicode char set with carriage return. But action get as unknown so for
+// unknow case we are simply filling text with unicode char value. So this
+// cause issue.
+// [Solution] Accepting character other than carriage return in popup
+// edit for string controls
+// [Modified files] PopupEdit.c
+//
+// 23 1/22/13 12:23a Rajashakerg
+// [TAG] EIP103449
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] In Setup click\Touch from navigation window, option are not
+// displayed properly
+// [RootCause] Latest mouse driver providing LEFT_DOWN when we hold the
+// mouse left down button.
+// [Solution] Provided fix resolves the issue.
+// [Files] ezport.c, PopupEdit.c, ListBox.c, MessageBox.c
+//
+// 22 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 18 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 21 4/27/12 2:02p Arunsb
+// Build error rectified
+//
+// 20 4/27/12 2:40a Rajashakerg
+// [TAG] EIP86346
+// [Category] Improvement
+// [Description] Cursor visibility is not proper in multiline string
+// controls
+// [Files] PopupEdit.c, PopupString.c
+//
+// 19 4/05/12 7:19a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 18 2/02/12 1:18p Premkumara
+// [TAG] EIP75351,75352,75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] String.c, boot.c, TseAdvanced.c,Time.c, PopupEdit.c,
+// MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 17 12/27/11 12:37p Arunsb
+// [TAG] EIP79486
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Cursor is not blinking when "Softkbd" support enabled
+// [RootCause] Unknown action also consumed
+// [Solution] Unknow action not consumed.
+// Mouse stopped instead of freezing when the mouse pointer is over the
+// cursor.
+// [Files] popupedit.c and popuppassword.c
+//
+// 16 12/01/11 1:38a Premkumara
+// [TAG] EIP73236
+// [Category] Improvement
+// [Description] Large amounts of allocated memory are not freed
+// [Files] Expression.c, PopupEdit.c, Popup.c, MessageBox.c, Menu.c,
+// Memo.c,
+//
+// 15 11/30/11 12:38a Premkumara
+// [TAG] EIP75351
+// [Category] Improvement
+// [Description] Static code analysis.Suppress the warnings from static
+// code analyzer
+// [Files] String.c, HiiString21.c, TseAdvanced.c, Special.c,
+// UefiAction., Time.c, PopupEdit.c, MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 14 11/28/11 1:42a Premkumara
+// [TAG] EIP75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] UefiWapper.c, Hii.c, Expression.c, CtrlCond.c, PopupSel.c,
+// Minisetupext.c, Menu.c, Date.c, Ezport\Stylecommon.c,
+// EzportPlus\StyleCommon.c,
+//
+// 13 11/20/11 8:08a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 12 11/10/11 12:49a Arunsb
+// [TAG] EIP67735
+// [Category] Improvement
+// [Description] Zeroing password buffers before freeing
+// [Files] mem.c, mem.h, popupedit.c, popuppassword.c and tseadvanced.c
+//
+// 11 10/19/11 3:52p Blaines
+// [TAG] - EIP 66860
+// [Category]- Function Request
+// [Synopsis]- AmiPostManager interface for text entry. Add cursor
+// support.
+// [Files] - LogoLib.h, AMIPostMgr.h, protocol.c, protocol.h,
+// TseAdvanced.c, TseLitehelper.c, TseUefiHii.h, Uefi21Wapper.c,
+// uefi20Wapper.c, PopupEdit.c
+//
+// 10 12/24/10 12:37p Mallikarjunanv
+// [TAG] EIP 46144
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] String exceeds the msg dialog boundry in "Path for boot
+// [RootCause] The width coordinate of the popup edit is not handled
+// propely.
+// [Solution] Updated the width to write the string with in the
+// boundary.
+// [Files] PopupEdit.c
+//
+// 9 10/20/10 1:44p Mallikarjunanv
+// reverting back to v25
+//
+// 7 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 6 5/07/10 6:40p Madhans
+// EIP: 38197 To make the Scan code support work correctly with 9 and =
+// Keys.
+//
+// 5 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 8 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 7 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 6 1/09/10 7:01a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 5 8/19/09 6:34p Madhans
+// InValidActionHook Added. for PopupEdit case
+//
+// 4 7/20/09 1:22p Mallikarjunanv
+// updated the code with token PASSWORD_WITH_SPECIAL_CHAR_SUPPORT
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PopupEdit.c
+//
+// Description: This file contains code to handle Popup Edit operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+extern UINTN gCursorLeft,gCursorTop ;
+
+POPUPEDIT_METHODS gPopupEdit =
+{
+ PopupEditCreate,
+ PopupEditDestroy,
+ PopupEditInitialize,
+ PopupEditDraw,
+ PopupEditHandleAction,
+ PopupEditSetCallback,
+ PopupEditSetFocus,
+ PopupEditSetPosition,
+ PopupEditSetDimensions,
+ PopupEditSetAttributes,
+ PopupEditGetControlHight,
+ PopupEditSetType,
+ PopupEditSetText
+};
+
+BOOLEAN CheckIsAllowedPasswordChar(CHAR16 Char);
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditCreate
+//
+// Description: this function uses the create function of control
+// and creates the Popup Edit
+//
+// Input: POPUPEDIT_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditCreate( POPUPEDIT_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(POPUPEDIT_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gPopup.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gPopupEdit;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys the Popup Edit
+//
+// Input: POPUPEDIT_DATA **object, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditDestroy( POPUPEDIT_DATA *PopupEdit, BOOLEAN freeMem )
+{
+ EFI_STATUS Status;
+
+ if(NULL == PopupEdit)
+ return EFI_SUCCESS;
+
+ Status = gPopup.Destroy( PopupEdit, FALSE );
+
+ if(PopupEdit->Title)
+ MemFreePointer( (VOID **)&PopupEdit->Title);
+
+ RestoreScreen( PopupEdit->ScreenBuf );
+ if (freeMem)
+ {
+ if (POPUPEDIT_TYPE_PASSWORD == PopupEdit->PopupEditType)
+ {
+ gBS->SetMem (PopupEdit->Text, EfiStrLen (PopupEdit->Text) * sizeof (CHAR16), 0); //EIP67735 zeroing the password prompt memories
+ }
+ MemFreePointer( (VOID **)&PopupEdit->Text );//EIP-73236 Memory leak
+ MemFreePointer( (VOID **)&PopupEdit->TempText );
+ MemFreePointer( (VOID **)&PopupEdit->EmptyString ); //Free the allocated memory for the EmptyString field
+ MemFreePointer( (VOID **)&PopupEdit );
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditInitialize
+//
+// Description: this function uses the Initialize function of control
+// and initializes the Popup Edit
+//
+// Input: POPUPEDIT_DATA *PopupEdit, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditInitialize( POPUPEDIT_DATA *PopupEdit, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 Length =0/*,height=0*/, Size =0;
+ CHAR16 *TempText;
+
+ // initializes the heigth and width
+ Status = gPopup.Initialize( PopupEdit, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ SetControlColorsHook( NULL, NULL , NULL, NULL , NULL, NULL ,
+ NULL , NULL, NULL,NULL ,
+ NULL,NULL ,NULL,&(PopupEdit->FGColor),&(PopupEdit->BGColor) );
+
+
+ PopupEdit->Container = NULL;
+
+ PopupEdit->Border =TRUE;
+ PopupEdit->Shadow = TRUE;
+ PopupEdit->Title = HiiGetString(PopupEdit->ControlData.ControlHandle, UefiGetPromptField(PopupEdit->ControlData.ControlPtr));
+
+ if ( Length < (TestPrintLength( PopupEdit->Title ) / (NG_SIZE)))
+ Length = (UINT16)TestPrintLength( PopupEdit->Title ) / (NG_SIZE);
+
+ if ( Length < (UINT16)UefiGetMaxValue(PopupEdit->ControlData.ControlPtr) )
+ Length = (UINT16)UefiGetMaxValue(PopupEdit->ControlData.ControlPtr);
+
+ PopupEdit->Width = (UINT16)(Length + 4);
+ if ( PopupEdit->Width > MAX_POPUPEDIT_WIDTH )
+ {
+ //EIP-135665 If multiline is supported
+ if ( IsTSEMultilineControlSupported() )
+ PopupEdit->Height += (UINT16)(PopupEdit->Width / MAX_POPUPEDIT_WIDTH )+(((PopupEdit->Width % MAX_POPUPEDIT_WIDTH) > 0)?1:0)-1;
+ PopupEdit->Width = (UINT16)MAX_POPUPEDIT_WIDTH;
+ }
+ PopupEdit->TextWidth = (UINT16)UefiGetMaxValue(((CONTROL_INFO *)data)->ControlPtr);
+
+
+ // create text memory area with max available size
+ TempText = EfiLibAllocateZeroPool(PopupEdit->TextWidth*2+2);
+ EfiStrCpy(TempText,PopupEdit->Text);
+ MemFreePointer((CHAR16**)&PopupEdit->Text);
+ PopupEdit->Text =TempText;
+
+ PopupEdit->ScreenBuf = SaveScreen();
+
+ PopupEdit->TempText = EfiLibAllocateZeroPool( PopupEdit->TextWidth*2 +2 );
+
+ PopupEdit->Height += 2+ (PopupEdit->TextWidth/PopupEdit->Width +1)/*height*/;
+ gPopupEdit.SetDimensions( PopupEdit, PopupEdit->Width , PopupEdit->Height );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditDraw
+//
+// Description: function to draw the popup to edit with attributes
+//
+// Input: POPUPEDIT_DATA *PopupEdit
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditDraw( POPUPEDIT_DATA *PopupEdit )
+{
+ EFI_STATUS Status;
+ CHAR16 *text = NULL, *newText = NULL;
+ CHAR16 *line;
+ UINT16 pos, height=1,i;
+ UINTN Wrappedtextlen= 0;
+
+ text = StrDup(PopupEdit->Text);
+
+ Status = gPopup.Draw( PopupEdit );
+ if(EFI_ERROR(Status))
+ {
+ //EIP-75384 Static code
+ MemFreePointer( (VOID **)&text );
+ return Status;
+ }
+
+ // clear out old wrapped string
+ for ( pos = PopupEdit->Height- (2+ (PopupEdit->TextWidth/PopupEdit->Width +1))+1; pos < PopupEdit->Height-2; pos++ )
+ DrawStringWithAttribute( PopupEdit->Left+1, PopupEdit->Top + pos, PopupEdit->EmptyString, PopupEdit->FGColor | PopupEdit->BGColor );
+
+ if(PopupEdit->PopupEditType != POPUPEDIT_TYPE_PASSWORD ) {
+ //EIP_46144 - Updated the width to write the string with in the boundary.
+ newText = StringWrapText( text, PopupEdit->Width-2, &height );
+ }
+ else {
+ newText = text;
+ }
+
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (newText == NULL)
+ {
+ MemFreePointer( (VOID **)&text );
+ return EFI_NOT_FOUND;
+ }
+
+ if ( newText != text )
+ MemFreePointer( (VOID **)&text );
+
+ line = newText;
+
+ for ( pos = PopupEdit->Height- (2+ (PopupEdit->TextWidth/PopupEdit->Width +1))+1; pos < PopupEdit->Height; pos++ )
+ {
+ CHAR16 save;
+
+ text = line;
+ if ( *line == L'\0' )
+ break;
+
+ if(PopupEdit->PopupEditType != POPUPEDIT_TYPE_PASSWORD )
+ {
+ while ( ( *line != L'\n' ) &&( *line != L'\r' ) && ( *line != L'\0' ) )
+ line++;
+ }
+ else
+ {
+ while ( *line != L'\0' )
+ line++;
+ }
+
+ save = *line;
+ *line = L'\0';
+ i=0;
+ while( (text[i] != L'\0') && (PopupEdit->Chr !=0x0 ) )
+ {
+// if(text[i] != L' ') //all chars should be treated the same
+ text[i] = PopupEdit->Chr;
+ i++;
+ }
+
+ DrawStringWithAttribute( PopupEdit->Left+1, PopupEdit->Top + pos, text, PopupEdit->FGColor | PopupEdit->BGColor );
+
+ if ( ( *line = save ) != L'\0' )
+ {
+ line++;
+ if ( ( *line == L'\r' ) || ( *line == L'\n' ) )
+ line++;
+ }
+
+ if(L'\0' == *line)
+ Wrappedtextlen = EfiStrLen(text);//EIP 86346 : Getting the wrapped text length
+
+ }
+ MemFreePointer( (VOID **)&newText );
+
+ if ( pos < height )
+ height = pos;
+
+ gCursorLeft = PopupEdit->Left + Wrappedtextlen;
+ gCursorTop = PopupEdit->Top + (pos-1);//EIP 86346 : Providing the Cursor Postion depending on the lenght of string
+ if((Wrappedtextlen == 0)||(((UINT16)Wrappedtextlen) > (PopupEdit->Width-2)))
+ {
+ gCursorLeft = PopupEdit->Left+1;
+ gCursorTop++;
+ }
+ PopupEdit->DisplayLines = height;
+ FlushLines( PopupEdit->Top, PopupEdit->Top + PopupEdit->Height );
+ return EFI_SUCCESS;
+
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditHandleAction
+//
+// Description: function to handle the Popup Edit actions
+//
+// Input: POPUPEDIT_DATA *PopupEdit, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditHandleAction( POPUPEDIT_DATA *PopupEdit, ACTION_DATA *Data)
+{
+ UINT8 Redraw =0;
+ //Always return success to consume the message, the popupedit is always modal.
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ CONTROL_ACTION Action=ControlActionUnknown;
+
+ if ( (Data->Input.Type == ACTION_TYPE_TIMER) || (Data->Input.Type == ACTION_TYPE_NULL) ) //EIP79486 cursor not blinking when mouse driver presents
+ return Status;
+
+ if ( Data->Input.Type == ACTION_TYPE_MOUSE )
+ {
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+
+ //EIP 103449 : In Setup click\Touch from navigation window, option are not displayed properly
+ if( (
+ (Data->Input.Data.MouseInfo.Top < PopupEdit->Top) ||
+ (Data->Input.Data.MouseInfo.Top > (UINT32)(PopupEdit->Top + PopupEdit->Height)) ||
+ (Data->Input.Data.MouseInfo.Left < PopupEdit->Left) ||
+ (Data->Input.Data.MouseInfo.Left > (UINT32)(PopupEdit->Left + PopupEdit->Width)) )
+ && ( (ControlActionChoose == Action) || (ControlActionSelect == Action) )
+ )
+ { // Any action outside the popupedit about
+ Action = ControlActionAbort;
+ }
+
+ }
+
+ if (Data->Input.Type == ACTION_TYPE_KEY)
+ {
+ //Get mapping
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+ }
+
+ switch(Action)
+ {
+ case ControlActionNextUp:
+ case ControlActionNextDown:
+ case ControlActionNextLeft:
+ case ControlActionNextRight:
+ case ControlActionNextSelection:
+ Redraw = TRUE;
+ break;
+
+ case ControlActionAbort:
+ if(PopupEdit->ControlActive == TRUE)
+ {
+ MemCopy(PopupEdit->Text,PopupEdit->TempText,PopupEdit->TextWidth*sizeof(UINT16)); //UNICODE CHARS
+ }
+ if(PopupEdit->Callback != NULL)
+ {
+ if ( PopupEdit->Cookie != NULL )
+ {
+ VOID *ifrData = (VOID *)PopupEdit->ControlData.ControlPtr;
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)PopupEdit->Cookie;
+
+ callbackData->Variable = PopupEdit->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ifrData);
+ callbackData->Length = UefiGetWidth(ifrData);
+ callbackData->Data = (VOID *)PopupEdit->Text;
+
+ PopupEdit->Callback( PopupEdit->Container,PopupEdit, NULL );
+ }
+ }
+
+ PopupEdit->ControlActive = FALSE;
+ Redraw = 1;
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionSelect:
+ if(PopupEdit->Callback != NULL)
+ {
+ if ( PopupEdit->Cookie != NULL )
+ {
+ VOID *ifrData = PopupEdit->ControlData.ControlPtr;
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)PopupEdit->Cookie;
+
+ callbackData->Variable = PopupEdit->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ifrData);
+ callbackData->Length = UefiGetWidth(ifrData);
+ callbackData->Data = (VOID *)PopupEdit->Text;
+
+ PopupEdit->Callback( PopupEdit->Container,PopupEdit, PopupEdit->Cookie );
+ }
+
+ }
+
+ Redraw =1;
+ PopupEdit->ControlActive =FALSE;
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionBackSpace:
+ if(EfiStrLen(PopupEdit->Text)>0)
+ {
+ if(PopupEdit->ControlActive ==FALSE)
+ {
+ MemCopy(PopupEdit->TempText,PopupEdit->Text,PopupEdit->TextWidth * sizeof(UINT16)); //UNICODE CHARS
+ PopupEdit->ControlActive = TRUE;
+ }
+ PopupEdit->Text[EfiStrLen(PopupEdit->Text)-1] = 0x0;
+ Redraw =1;
+ }
+ break;
+
+ default:
+ if ( Data->Input.Type == ACTION_TYPE_MOUSE )
+ break;
+
+ if(PopupEditHandlePassword( PopupEdit, Data) == EFI_SUCCESS)
+ Redraw =1;
+ else
+ {
+ if ((Data->Input.Data.AmiKey.Key.UnicodeChar) && (CHAR_CARRIAGE_RETURN != Data->Input.Data.AmiKey.Key.UnicodeChar)) //EIP-123306 Avoid carriage return when press CTRL+ENTER in popupedit controls.
+ {
+ if ( ( CheckIsAllowedPasswordChar(Data->Input.Data.AmiKey.Key.UnicodeChar) || ( PopupEdit->PopupEditType != POPUPEDIT_TYPE_PASSWORD ) ) &&
+ ( EfiStrLen(PopupEdit->Text) < PopupEdit->TextWidth ) )
+ {
+ if(PopupEdit->ControlActive ==FALSE)
+ {
+ MemCopy(PopupEdit->TempText,PopupEdit->Text,PopupEdit->TextWidth* sizeof(UINT16));
+ PopupEdit->ControlActive = TRUE;
+ }
+
+ PopupEdit->Text[EfiStrLen(PopupEdit->Text)] = Data->Input.Data.AmiKey.Key.UnicodeChar ;
+ PopupEdit->Text[EfiStrLen(PopupEdit->Text)] = 0x0 ;
+ Redraw =1;
+ }
+ else {
+ InvalidActionHookHook(); ///
+ }
+ }
+ else if(!IsToggleStateKey(Data))
+ {
+ InvalidActionHookHook();
+ }
+
+ }
+ break;
+ }
+
+ if ( Redraw == TRUE )
+ {
+ MouseFreeze();
+
+ gPopupEdit.Draw( PopupEdit );
+
+ MouseRefresh();
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditSetCallback
+//
+// Description: Function to set the PopupSel callback
+//
+// Input: POPUPEDIT_DATA *PopupEdit, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditSetCallback( POPUPEDIT_DATA *PopupEdit, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( PopupEdit, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditSetType
+//
+// Description: Function to set the PopupEdit type
+//
+// Input: POPUPEDIT_DATA *PopupEdit, UINT8 Type
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditSetType( POPUPEDIT_DATA *PopupEdit, UINT8 Type )
+{
+ PopupEdit->PopupEditType = Type;
+ if ( Type == POPUPEDIT_TYPE_PASSWORD )
+ PopupEdit->Chr = PASSWORD_CHAR;
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditSetText
+//
+// Description: Function to set the PopupEdit text
+//
+// Input: POPUPEDIT_DATA *PopupEdit, CHAR16 *String
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditSetText(POPUPEDIT_DATA *PopupEdit, CHAR16 *String )
+{
+ if(PopupEdit->Text==NULL)
+ {
+ if(String != NULL)
+ {
+ PopupEdit->Text = EfiLibAllocateZeroPool( (EfiStrLen(String )+1) * sizeof(CHAR16) );
+ EfiStrCpy(PopupEdit->Text, String);
+ }
+ else
+ {
+ PopupEdit->Text = EfiLibAllocateZeroPool( (2) * sizeof(CHAR16) );
+ EfiStrCpy(PopupEdit->Text, L"");
+ }
+ }
+ else
+ {
+ if(String != NULL)
+ EfiStrCpy(PopupEdit->Text,String);
+ else
+ EfiStrCpy(PopupEdit->Text, L"");
+
+ }
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditSetFocus
+//
+// Description: Function to set focus
+//
+// Input: POPUPEDIT_DATA *PopupEdit, BOOLEAN focus
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditSetFocus(POPUPEDIT_DATA *PopupEdit, BOOLEAN focus)
+{
+ PopupEdit->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditSetPosition
+//
+// Description: Function to set focus
+//
+// Input: POPUPEDIT_DATA *PopupEdit, UINT16 Left, UINT16 Top
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditSetPosition(POPUPEDIT_DATA *PopupEdit, UINT16 Left, UINT16 Top )
+{
+ return gPopup.SetPosition( PopupEdit, Left, Top );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditSetDimensions
+//
+// Description: function to set the dimentions of the editable popup menu
+//
+// Input: POPUPEDIT_DATA *PopupEdit, UINT16 Width, UINT16 Height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditSetDimensions(POPUPEDIT_DATA *PopupEdit, UINT16 Width, UINT16 Height )
+{
+ EFI_STATUS Status= EFI_SUCCESS;
+
+ // dimensions include top, bottom, left and right lines for popup
+ Status = gPopup.SetDimensions( PopupEdit, Width, Height );
+
+ MemFreePointer( (VOID **)&PopupEdit->EmptyString );
+ PopupEdit->EmptyString = EfiLibAllocateZeroPool( (Width-1 ) * sizeof(CHAR16) );
+ if ( PopupEdit->EmptyString == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ MemFillUINT16Buffer( PopupEdit->EmptyString, Width-2, L' ' );
+
+ return(Status);
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditSetAttributes
+//
+// Description: Function to set the dimentions of the editable popup menu
+//
+// Input: POPUPEDIT_DATA *PopupEdit, UINT8 FGColor, UINT8 BGColor
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditSetAttributes(POPUPEDIT_DATA *PopupEdit, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( PopupEdit, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditGetControlHight
+//
+// Description: Function unsuppored.
+//
+// Input: VOID *object,VOID *frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditGetControlHight( VOID *object,VOID *frame, UINT16 *height )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Norcross, Suite 200, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+
diff --git a/EDK/MiniSetup/TseLite/PopupEdit.h b/EDK/MiniSetup/TseLite/PopupEdit.h
new file mode 100644
index 0000000..93221df
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupEdit.h
@@ -0,0 +1,192 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupEdit.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 9 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupEdit.h $
+//
+// 9 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 8 4/05/12 7:25a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 7 11/20/11 8:10a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 5 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 4 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PopupEdit.h
+//
+// Description: This file contains definitions to handle Popup Edit operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _POPUPEDIT_H_
+#define _POPUPEDIT_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "popup.h"
+//#include "memo.h"
+
+#define PASSWORD_CHAR L'*'
+// popupedit constants
+#define MAX_POPUPEDIT_WIDTH (gMaxCols - 10)
+#define POPUPEDIT_TYPE_STRING 0
+#define POPUPEDIT_TYPE_PASSWORD 1
+#define POPUPEDIT_CANCEL 1
+
+#define POPUPEDIT_MEMBER_VARIABLES \
+ VOID *ScreenBuf; \
+ UINT8 PopupEditType; \
+ UINT8 Justify; \
+ UINT16 DisplayLines; \
+ CHAR16 *EmptyString; \
+ UINT16 MinSize; \
+ UINT16 MaxSize; \
+ UINT16 TextWidth; \
+ CHAR16 *Text; \
+ CHAR16 *TempText; \
+ CHAR16 Chr; /* character used to display instead of real chars */
+ /* mainly used for password entry.*/
+
+typedef struct _POPUPEDIT_METHODS POPUPEDIT_METHODS;
+
+typedef struct _POPUPEDIT_DATA
+{
+ POPUPEDIT_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ POPUP_MEMBER_VARIABLES
+ POPUPEDIT_MEMBER_VARIABLES
+}
+POPUPEDIT_DATA;
+
+typedef EFI_STATUS (*POPUPEDIT_METHOD_SET_TEXT) ( VOID *object, CHAR16 *String);
+typedef EFI_STATUS (*POPUPEDIT_METHOD_SET_TYPE) ( VOID *object, UINT8 Type);
+
+#define POPUPEDIT_METHOD_FUNCTIONS \
+ POPUPEDIT_METHOD_SET_TYPE SetType; \
+ POPUPEDIT_METHOD_SET_TEXT SetText;
+
+struct _POPUPEDIT_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ POPUPEDIT_METHOD_FUNCTIONS
+};
+
+extern POPUPEDIT_METHODS gPopupEdit;
+
+
+// Object Methods
+EFI_STATUS PopupEditCreate( VOID **object );
+EFI_STATUS PopupEditDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS PopupEditInitialize( VOID *object, VOID *data );
+EFI_STATUS PopupEditDraw( VOID *object );
+EFI_STATUS PopupEditHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS PopupEditSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+EFI_STATUS PopupEditSetType(VOID *object, UINT8 Type );
+//EFI_STATUS PopupEditSetTitle(VOID *object, CHAR16 *String );
+EFI_STATUS PopupEditSetText(VOID *object, CHAR16 *String );
+
+// Control Methods
+EFI_STATUS PopupEditSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS PopupEditSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS PopupEditSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS PopupEditSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS PopupEditGetControlHight( VOID *object,VOID *frame, UINT16 *height );
+
+#endif /* _POPUPEDIT_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/PopupPassword.c b/EDK/MiniSetup/TseLite/PopupPassword.c
new file mode 100644
index 0000000..8914766
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupPassword.c
@@ -0,0 +1,1377 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupPassword.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 43 $
+//
+// $Date: 8/28/14 3:08p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupPassword.c $
+//
+// 43 8/28/14 3:08p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 42 5/03/14 4:03p Premkumara
+// [TAG] EIP135665
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE get hangs, when long string is given as title for
+// password
+// [Root Cause] TSE is not handling properl when PasswordTitle length
+// exceeds screen width
+// [Solution] Handled password title length based on screen width and
+// given support to display title in multiple lines.
+// [Files] postmgmtext.c, Popup.c, PopupEdit.c, PopupPassword.c
+//
+// 41 5/02/14 9:35p Arunsb
+// EIP141986 changes reverted.
+//
+// 40 5/02/14 10:56a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 39 5/02/14 6:49a Premkumara
+// [TAG] EIP164232
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] When password keyboard is launched and mouse pointer is
+// placed on softkbd mouse will flickers continously.
+// [RootCause] MouseRefresh and MouseStop is calling contiously in loop
+// so mouse pointer get flickers
+// [Solution] When mouse pointer is on softkbd and is static then stop
+// calling MouseRefresh and MouseFreeze
+// [Files] PopupPassword.c, CommonHelper.c, Mouse.c
+//
+// 38 5/01/14 3:44p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 37 2/11/14 8:37p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 32 7/01/13 6:15a Premkumara
+// [TAG] EIP127023
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Empty password causes setup crashing
+// [RootCause] After entering empty password in first attempt and no
+// confirm password is given so the variable ConfirmNewPswd is NULL. Since
+// ConfirmNewPswd is NULL TSE is trying to compare and find length for
+// this NULL string and so it caused this issue.
+// [Solution] Handled NULL check for ConfirmNewPswd variable before and
+// after getting password
+// [Files] PopupPassword.c
+//
+// 31 3/25/13 8:38a Premkumara
+// [TAG] EIP116315
+// [Category] Improvement
+// [Description] Display control prompt string for password control.
+// (for String on CHAP secret popup)
+// [Files] - AMITSE.sdl
+// - CommonHelper.c
+// - FakeToken.c
+// - AmiTSEStr.uni
+// - TseLite\PopupPassword.c
+// - uefi2.1\UefiWapper21.c
+// - uefi2.0\UefiWapper20.c
+// - uefi2.0\HiiCallback.c
+// - uefi2.0\hii.h
+// - uefi2.0\hii.c
+//
+// 30 3/08/13 1:34a Rajashakerg
+// [TAG] EIP113085
+// [Category] Improvement
+// [Description] Modify callback function behavior to match UEFI SPEC.
+// [Files] HiiCallback.c, PopupPassword.c, SubMenu.c
+//
+// 29 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 17 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 27 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 25 8/29/12 8:31a Premkumara
+// [TAG] EIP 91364
+// [Category] Improvement
+// [Description] Token to disable the Cursor of TSE Password Dialog
+// [Files] AMITSE.sdl, CommonHelper.c, Postmgmtext.c, PopupPassword.c,
+// PopupString.c
+//
+// 24 5/28/12 11:35a Premkumara
+// [TAG] EIP88912
+// [Category] Improvement
+// [Description] On password window display the softkbd with only with
+// valid key's
+// [Files] CommonHelper.c, Postmgmtext.c, Mouse.c, PopupPassword.c
+//
+// 23 1/02/12 11:49a Arunsb
+// EIP79486
+// Build error resolved for 32 bit.
+//
+// 22 12/27/11 12:41p Arunsb
+// [TAG] EIP79486
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Cursor is not blinking when "Softkbd" support enabled
+// [RootCause] Unknown action also consumed
+// [Solution] Unknow action not consumed.
+// Mouse stopped instead of freezing when the mouse pointer is over the
+// cursor.
+// [Files] popupedit.c and popuppassword.c
+//
+// 21 12/14/11 12:43p Arunsb
+// EIP63190 => Moving password support from TSELite to BootOnly
+//
+// 20 12/01/11 5:13a Rajashakerg
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Callback handling :For interactive controls updating
+// the currnet vaule in cache even when hii callback returns error status.
+// [Files] Date.c, SubMenu.c, ordlistbox.c, time.c, UefiAction.c,
+// hii.h, uefi20Wapper.c, HiiCallback.c, TseUefiHii.h, Uefi21Wapper.c
+// ,PopupPassword.c
+//
+// 19 11/30/11 12:20p Premkumara
+// Updated with review comments.
+//
+// 18 11/30/11 11:57a Premkumara
+// [TAG] EIP75521
+// [Category] Improvement
+// [Description] Need to support interactive password controls
+// [Files] PopupPassword.c, PopupPassword.h, TsetAdvanced.c
+//
+// 17 11/30/11 11:32a Premkumara
+// [TAG] EIP67695
+// [Category] Improvement
+// [Description] No cursor visible in setup, while editing text input
+// box
+// [Files] Buffer.c, Postmgmtext.c, PopupString.c, PopupPassword.c
+//
+// 16 11/21/11 11:15a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 15 11/20/11 8:12a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 14 11/20/11 7:40a Premkumara
+// [TAG] EIP73226
+// [Category] New Feature
+// [Description] Extended support for password prompt
+// [Files] FakeToken.c, Uefi21Wapper.c, AmiTSEStr.uni, PopupPassword.c,
+//
+// 13 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 12 11/10/11 12:48a Arunsb
+// [TAG] EIP67735
+// [Category] Improvement
+// [Description] Zeroing password buffers before freeing
+// [Files] mem.c, mem.h, popupedit.c, popuppassword.c and tseadvanced.c
+//
+// 11 3/28/11 9:25p Madhans
+// [TAG] EIP41744
+// [Category] Improvement
+// [Description] SoftKeyBoard Support in TSE. and Support to Work with
+// new mouse driver(Label 07).
+// [Files] HookAnchor.h
+// AMITSE.sdl
+// CommonHelper.c
+// commonoem.c
+// commonoem.h
+// HookList.c
+// HookAnchor.c
+// Mouse.c
+// minisetupext.c
+// postmgmtext.c
+// minisetupext.h
+// PopupPassword.c
+// PopupString.c
+// TseLiteCommon.c
+//
+// 10 12/02/10 2:34p Madhans
+// [TAG] - EIP 48169
+// [Category]- Enhancement
+// [Severity]- Mordarate
+// [Symptom]- Code Cleanup and Compiler Warning need to resolved.
+// [Rootcause] Warnings reported when we build AMI higher Warning level.
+// [Solution]- 1. Fix the warnings and do the code cleanup.
+// 2. Introduce proper checks.
+// 3. change the popupSel.c to not change the Option/variable
+// cache to default or first option
+// when the variable cache is not matching with any of
+// option.
+// [Files] - commonoem.c bbs.c boot.c hiistring.c resource.c
+// popuppassword.c popupsel.c
+// expression.c hii.c parse.c
+//
+// 9 10/04/10 4:26p Blaines
+// In the function _DoPopupEdit, call gPopupEdit.SetType before calling
+// gPopupEdit.Initialize. This is useful in case the function
+// gPopupEdit.Initialize is overriden.
+//
+// 8 9/16/10 8:38p Madhans
+// Update for TSE 2.10. Refer Changelog.log for more details.
+//
+// 13 8/27/10 4:43a Mallikarjunanv
+// EIP-39764: Setup password non-case sensitive support and password
+// encode support updated
+//
+// 12 4/09/10 12:26p Madhans
+//
+// 11 3/26/10 6:53p Madhans
+// Support to Map the do the Control Mapping from gTseControlMap Table. So
+// no changes need in Frame.c, With this feature gTseControlMap Can be
+// customized to add/customize the TSE controls.
+//
+// 10 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 9 2/05/10 6:05p Madhans
+// To fix the Screen corruption if mouse pointer is on the popup.
+//
+// 8 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 7 1/09/10 6:54a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 6 8/13/09 1:20p Blaines
+// Fix color initialization
+//
+// 5 7/09/09 12:29p Mallikarjunanv
+// updated the password encoding fix
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PopupPassword.c
+//
+// Description: This file contains code to handle Popup Passwords
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+////////////////////////////////////////////////////////////////
+//// Extern Variables
+////////////////////////////////////////////////////////////////
+extern UINTN gInvalidPasswordFailMsgBox;
+//EIP-73226 Extended Password support
+extern UINTN gClearPasswordMsgBox;
+extern UINTN gInvalidRangeFailMsgBox;
+extern UINTN gClearLabelPasswordMsgBox;
+
+CALLBACK_VARIABLE gPopupEditCb = { { CALLBACK_TYPE_VARIABLE, sizeof(CALLBACK_VARIABLE) }, 0,0,0,NULL };
+UINT8 res = (UINT8)-1;
+
+POPUP_PASSWORD_METHODS gPopupPassword =
+{
+ PopupPasswordCreate,
+ PopupPasswordDestroy,
+ PopupPasswordInitialize,
+ PopupPasswordDraw,
+ PopupPasswordHandleAction,
+ PopupPasswordSetCallback,
+ PopupPasswordSetFocus,
+ PopupPasswordSetPosition,
+ PopupPasswordSetDimensions,
+ PopupPasswordSetAttributes,
+ PopupPasswordGetControlHeight
+
+};
+VOID GetCoordinates(INT32 *x, INT32 *y, INT32 *z);
+VOID SetPwdKeyboardLayout(VOID);//EIP-88912
+VOID ResetPwdKeyboardLayout(VOID);//EIP-88912
+BOOLEAN IsTSECursorSupport(); //EIP-91364
+VOID SavePswdString (CONTROL_INFO *ControlData, CHAR16 *String);
+BOOLEAN IsPasswordSupportNonCaseSensitive();
+BOOLEAN IsShowPromptStringAsTitle(VOID);//EIP-116315 password string
+BOOLEAN IsMouseOnSoftkbd(VOID); //EIP-164232
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordCreate
+//
+// Description: this function uses the create function of control
+// and creates the popup password
+//
+// Input: POPUP_PASSWORD_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordCreate( POPUP_PASSWORD_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(POPUP_PASSWORD_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gPopupPassword;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys the popup password
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordDestroy( POPUP_PASSWORD_DATA *popuppassword, BOOLEAN freeMem )
+{
+ if(NULL == popuppassword)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( popuppassword, FALSE );
+
+ MemFreePointer( (VOID **)&popuppassword->Text );
+
+ if( freeMem )
+ MemFreePointer( (VOID **)&popuppassword );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordInitialize
+//
+// Description: this function uses the initialize function of control
+// and initializes the popup password
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordInitialize( POPUP_PASSWORD_DATA *popuppassword, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( popuppassword, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ SetControlColorsHook(NULL, NULL,
+ NULL, NULL,
+ &(popuppassword->SelBGColor), &(popuppassword->SelFGColor),
+ &(popuppassword->BGColor), &(popuppassword->FGColor),
+ NULL, NULL,
+ NULL,
+ NULL ,NULL,
+ NULL,NULL );
+
+ popuppassword->ControlData.ControlHelp = UefiGetHelpField(popuppassword->ControlData.ControlPtr);
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordDraw
+//
+// Description: function to draw the popup password with attributes
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordDraw(POPUP_PASSWORD_DATA *popuppassword )
+{
+ CHAR16 *text;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ UINT8 ColorLabel = popuppassword->FGColor;
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( popuppassword->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &popuppassword->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ text = HiiGetString( popuppassword->ControlData.ControlHandle, UefiGetPromptField(popuppassword->ControlData.ControlPtr));
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(popuppassword->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( popuppassword->Left , popuppassword->Top,
+ (UINTN)(popuppassword->Width),(UINTN) popuppassword->Height,
+ text,(UINT8)( (popuppassword->ControlFocus) ?
+ popuppassword->SelBGColor | popuppassword->SelFGColor :
+ popuppassword->BGColor | ColorLabel));
+ }
+ else
+ {
+ // use frame width minus margins as available space
+ // boundary overflow check
+ if ( (TestPrintLength( text ) / (NG_SIZE)) > (UINTN)(popuppassword->Width ))
+ text[HiiFindStrPrintBoundary(text,(UINTN)(popuppassword->Width ))] = L'\0';
+
+ DrawStringWithAttribute( popuppassword->Left , popuppassword->Top, text,
+ (UINT8)( (popuppassword->ControlFocus) ?
+ popuppassword->SelBGColor | popuppassword->SelFGColor :
+ popuppassword->BGColor | ColorLabel ));
+ }
+
+ MemFreePointer( (VOID **)&text );
+ FlushLines( popuppassword->Top , popuppassword->Top );
+
+ return Status;
+}
+
+EFI_STATUS PopupPasswordSetCallback( POPUP_PASSWORD_DATA *popuppassword, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( popuppassword, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordCheckInstalledLocal
+//
+// Description: function to check the local installation of popup password
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword
+//
+// Output: True/False
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT32 PopupPasswordCheckInstalledLocal(POPUP_PASSWORD_DATA *popuppassword)
+{
+ VOID *data = popuppassword->ControlData.ControlPtr;
+ CHAR16 *RealPassword=NULL;
+ UINT32 Installed=0;
+ // read real password from nvram
+ RealPassword = EfiLibAllocateZeroPool( ((UINT8)UefiGetMaxValue(data)+1) * sizeof(CHAR16) );
+ if ( RealPassword == NULL )
+ return Installed;
+ MemSet( RealPassword, ((UINT8)UefiGetMaxValue(data)+1) * sizeof(CHAR16), 0 );
+
+ VarGetValue( popuppassword->ControlData.ControlVariable,
+ UefiGetQuestionOffset(data),
+ (UINT8)UefiGetMaxValue(data)*2, RealPassword );
+
+ if ( RealPassword[0] != L'\0' )
+ Installed = 1;
+ MemFreePointer( (VOID **)&RealPassword );
+
+ return Installed;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordAuthenticateLocal
+//
+// Description: function to check authentication of the password
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, CHAR16 *Password
+//
+// Output: TRUE/FALSE
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN PopupPasswordAuthenticateLocal( POPUP_PASSWORD_DATA *popuppassword, CHAR16 *Password )
+{
+ VOID *data = popuppassword->ControlData.ControlPtr;
+ CHAR16 *RealPassword=NULL,*TempEncoded=NULL;
+ BOOLEAN AuthenticateStatus=FALSE;
+ UINTN ii;
+
+ // read real password from nvram
+ RealPassword = EfiLibAllocateZeroPool( ((UINT8)UefiGetMaxValue(data)+1) * sizeof(CHAR16) );
+ if ( RealPassword == NULL )
+ return AuthenticateStatus;
+ MemSet( RealPassword, ((UINT8)UefiGetMaxValue(data)+1) * sizeof(CHAR16), 0 );
+
+ VarGetValue( popuppassword->ControlData.ControlVariable,
+ UefiGetQuestionOffset(data),
+ (UINT8)UefiGetMaxValue(data)*2, RealPassword );
+
+ TempEncoded = EfiLibAllocateZeroPool( ((UINT8)UefiGetMaxValue(data)+1) * sizeof(CHAR16) );
+ if ( TempEncoded == NULL )
+ return AuthenticateStatus;
+
+ MemSet( TempEncoded, ((UINT8)UefiGetMaxValue(data)+1) * sizeof(CHAR16), 0 );
+ EfiStrCpy(TempEncoded,Password);
+
+//EIP106950
+ if (
+ (IsPasswordSupportNonCaseSensitive ()) &&
+ ( (VARIABLE_ID_AMITSESETUP == popuppassword->ControlData.ControlVariable) || (VARIABLE_ID_IDE_SECURITY == popuppassword->ControlData.ControlVariable) )
+ )
+ {
+ for (ii = 0; ii < (UefiGetMaxValue(data)); ii++)
+ TempEncoded [ii] = ((TempEncoded [ii]>=L'a')&&(TempEncoded [ii]<=L'z'))?(TempEncoded [ii]+L'A'-L'a'):TempEncoded [ii];
+ }
+//EIP106950
+//EIP 23354 : Start
+ //PasswordEncodeHook( TempEncoded, (UINT8)UefiGetMaxValue(data) * sizeof(CHAR16));
+ if( IsPasswordEncodeEnabled( &popuppassword->ControlData )){
+ PasswordEncodeHook( TempEncoded, (UINT8)UefiGetMaxValue(data) * sizeof(CHAR16));
+ }
+//EIP 23354 : END
+ if( EfiCompareMem(TempEncoded,RealPassword,(UINT8)UefiGetMaxValue(data) * sizeof(CHAR16)))
+ AuthenticateStatus = FALSE;
+ else
+ AuthenticateStatus = TRUE;
+
+ MemFreePointer( (VOID **)&RealPassword );
+ MemFreePointer( (VOID **)&TempEncoded );
+
+ return AuthenticateStatus;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdatePasswordToNonCaseSensitive
+//
+// Description: function to update the given password to non case sensitive
+//
+// Input: CHAR16 *Password, UINTN PwdLength
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID UpdatePasswordToNonCaseSensitive(CHAR16 *Password, UINTN PwdLength)
+{
+ UINTN Idx;
+ for ( Idx = 0; Idx < PwdLength; Idx++ )
+ Password[Idx] = ((Password[Idx]>=L'a')&&(Password[Idx]<=L'z'))?(Password[Idx]+L'A'-L'a'):Password[Idx];
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PopupPasswordActivate
+//
+// Description: function to set and activate a password
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _PopupPasswordActivate(POPUP_PASSWORD_DATA *popuppassword)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ BOOLEAN AbortUpdate = FALSE;
+ CHAR16 *Text=NULL,*NewPswd=NULL,*ConfirmNewPswd=NULL;
+ VOID *data = popuppassword->ControlData.ControlPtr;
+ UINTN NewPwLen = 0;
+ UINT16 orgtext = 0;
+ UINT16 newtoken = 0;
+
+ if( PopupPwdAuthenticateIDEPwd(popuppassword,&AbortUpdate,data) != EFI_SUCCESS)
+ {
+ AbortUpdate = FALSE;
+
+ if(PopupPasswordCheckInstalled(popuppassword))
+ {
+ // ask for old password (popupedit)
+ Status = _DoPopupEdit( popuppassword, (IsShowPromptStringAsTitle() ? STRING_TOKEN(STR_OLD_PSWD_LABEL): STRING_TOKEN(STR_OLD_PSWD)), &Text);
+ if( Status )
+ AbortUpdate = TRUE;
+ else
+ {
+ if(!PopupPasswordAuthenticate( popuppassword, Text ))
+ {
+ // optional message to user: "wrong password" and exit
+ CallbackShowMessageBox( (UINTN)gInvalidPasswordFailMsgBox, MSGBOX_TYPE_OK );
+ AbortUpdate = TRUE;
+ }
+ }
+ }
+ }
+ if(AbortUpdate == FALSE)
+ {
+Password:
+ //ask for new password(1)
+ Status = _DoPopupEdit( popuppassword, (IsShowPromptStringAsTitle() ? STRING_TOKEN(STR_NEW_PSWD_LABEL): STRING_TOKEN(STR_NEW_PSWD)), &NewPswd);
+
+ if(!Status)
+ {
+ NewPwLen = EfiStrLen(NewPswd);
+ //EIP-39764 : non case sensitive support during setting password
+ //EIP106950
+ if (
+ (IsPasswordSupportNonCaseSensitive ()) &&
+ (NewPwLen != 0) &&
+ ( (VARIABLE_ID_AMITSESETUP == popuppassword->ControlData.ControlVariable) || (VARIABLE_ID_IDE_SECURITY == popuppassword->ControlData.ControlVariable) )
+ )
+ {
+ UpdatePasswordToNonCaseSensitive (NewPswd, NewPwLen);
+ }
+ if (VARIABLE_ID_IDE_SECURITY != popuppassword->ControlData.ControlVariable)
+ {
+ if (PopupPasswordCheckInstalled (popuppassword))
+ {
+ // Override the minmax validation for password clearing
+ if(NewPwLen == 0)
+ {
+ //EIP-116315 password string Starts
+ if ( IsShowPromptStringAsTitle() )
+ {
+ CHAR16 *temptext = NULL, *tText = NULL;
+ CHAR16 *tempTitle = NULL;
+ UINTN strlen = 0;
+
+ //Taking backup of original StringID
+ orgtext = ((AMI_IFR_MSGBOX*)(gClearLabelPasswordMsgBox))->Text;
+
+ //Get TSE string
+ temptext = HiiGetString( (VOID*)(UINTN)INVALID_HANDLE, orgtext);
+ strlen = EfiStrLen(temptext);
+
+ tempTitle = EfiLibAllocateZeroPool((strlen+2)*sizeof(CHAR16));
+
+ if (NULL == tempTitle)
+ return EFI_OUT_OF_RESOURCES;
+
+ EfiStrCpy (tempTitle,temptext);
+ strlen = EfiStrLen(tempTitle);
+
+ MemFreePointer( (VOID **)&temptext );
+
+ //Get prompt string from controlptr
+ temptext = HiiGetString( popuppassword->ControlData.ControlHandle, UefiGetPromptField(popuppassword->ControlData.ControlPtr));
+ strlen = EfiStrLen(temptext+2);
+
+ tempTitle = MemReallocateZeroPool (
+ tempTitle,
+ ( (EfiStrLen (tempTitle) + 2) * sizeof (CHAR16) ),
+ ( ((EfiStrLen (tempTitle) + 2) * sizeof (CHAR16)) + ((EfiStrLen (temptext) + 2) * sizeof (CHAR16)) ) //2 for /n and NULL character
+ );
+
+ if (NULL == tempTitle)
+ return EFI_OUT_OF_RESOURCES;
+
+ //Eliminate white space character if any precedes
+ tText = temptext;
+ while(*temptext == L' ')
+ {
+ temptext++;
+ }
+
+ //Appending tse string with controlptr prompt string
+ EfiStrCat (tempTitle,temptext);
+ EfiStrCat (tempTitle,L"?");
+
+ //Adding string to hiistring
+ newtoken = HiiAddString( gHiiHandle, tempTitle );
+
+ //Setting new stringID as current stringID
+ ((AMI_IFR_MSGBOX*)(gClearLabelPasswordMsgBox))->Text = newtoken;
+
+ MemFreePointer( (VOID **)&tText );
+ MemFreePointer( (VOID **)&tempTitle );
+ }
+ //EIP-116315 password string. Ends
+
+ //Report Message box for Clearing Old password
+ if(CallbackShowMessageBox( (IsShowPromptStringAsTitle() ? (UINTN)gClearLabelPasswordMsgBox : (UINTN)gClearPasswordMsgBox), MSGBOX_TYPE_YESNO )!= MSGBOX_YES)
+ {
+ if ( IsShowPromptStringAsTitle() )
+ {
+ //Resetting original token
+ ((AMI_IFR_MSGBOX*)(gClearLabelPasswordMsgBox))->Text = orgtext;
+ //Delete created token
+ HiiRemoveString(gHiiHandle, newtoken);
+ }
+
+ goto Password;
+ //Status = EFI_UNSUPPORTED; //Do not clear the password
+ }
+ else
+ {
+ if ( IsShowPromptStringAsTitle() )
+ {
+ //Resetting original token
+ ((AMI_IFR_MSGBOX*)(gClearLabelPasswordMsgBox))->Text = orgtext;
+ //Delete created token
+ HiiRemoveString(gHiiHandle, newtoken);
+ }
+
+ ConfirmNewPswd = EfiLibAllocateZeroPool( sizeof(CHAR16) );
+
+ if(ConfirmNewPswd)
+ {
+ *ConfirmNewPswd = L'\0'; //Set confirmation password to null string
+ }
+ else
+ {
+ Status = EFI_OUT_OF_RESOURCES;
+ }
+ }
+ }
+ }
+ }
+ if(
+ NewPwLen &&
+ ( (NewPwLen < (UINT8)UefiGetMinValue (popuppassword->ControlData.ControlPtr)) ||
+ (NewPwLen > (UINT8)UefiGetMaxValue (popuppassword->ControlData.ControlPtr)) )
+ )
+ {
+ //Report Message box
+ CallbackShowMessageBox( (UINTN)gInvalidRangeFailMsgBox, MSGBOX_TYPE_OK );
+ Status = EFI_UNSUPPORTED;
+ }
+ }
+ // ask for new password(2)again
+ if ( ((!Status) && (NewPwLen != 0)) || ((VARIABLE_ID_IDE_SECURITY == popuppassword->ControlData.ControlVariable) && (!Status)) )
+ {
+ Status = _DoPopupEdit( popuppassword, (IsShowPromptStringAsTitle() ? STRING_TOKEN(STR_CONFIRM_NEW_PSWD_LABEL) : STRING_TOKEN(STR_CONFIRM_NEW_PSWD)), &ConfirmNewPswd);
+ }
+
+ if ( !Status )
+ {
+ //EIP-39764 : non case sensitive support during setting password
+ //EIP106950
+ if (
+ (IsPasswordSupportNonCaseSensitive ()) &&
+ ( NULL!=ConfirmNewPswd ) && (EfiStrLen (ConfirmNewPswd)) && //EIP-127023 Avoid crashing when give empty password
+ ( (VARIABLE_ID_AMITSESETUP == popuppassword->ControlData.ControlVariable) || (VARIABLE_ID_IDE_SECURITY == popuppassword->ControlData.ControlVariable) )
+ )
+ {
+ NewPwLen = EfiStrLen (ConfirmNewPswd);
+ UpdatePasswordToNonCaseSensitive (ConfirmNewPswd, NewPwLen);
+ }
+ if ( ( NULL!=ConfirmNewPswd ) && EfiStrCmp(NewPswd, ConfirmNewPswd)==0 ) //EIP-127023 Avoid crashing when give empty password
+ {
+ //EIP-75521 Support for Interactive Password control
+ if(popuppassword->Text != NULL){
+ MemFreePointer( (VOID **)&popuppassword->Text );
+ }
+ popuppassword->Text = (CHAR16 *) EfiLibAllocateZeroPool((NewPwLen + 1) * sizeof(CHAR16));
+ EfiStrCpy(popuppassword->Text, NewPswd);
+
+ //save new password
+ if ( ( popuppassword->Callback != NULL ) && ( popuppassword->Cookie != NULL ) )
+ {
+ VOID *ifrData = popuppassword->ControlData.ControlPtr;
+ CALLBACK_PASSWORD *callbackData = (CALLBACK_PASSWORD *)popuppassword->Cookie;
+
+ callbackData->Variable = popuppassword->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ifrData);
+ callbackData->Length = (UINT8)UefiGetMaxValue(ifrData) * sizeof(CHAR16);
+ callbackData->Data = (VOID *)NewPswd;
+ SavePswdString(&(popuppassword->ControlData),NewPswd);
+ UefiPreControlUpdate(&(popuppassword->ControlData));
+ popuppassword->Callback( popuppassword->Container,popuppassword, popuppassword->Cookie );
+
+ PopupPwdUpdateIDEPwd ();
+ }
+
+
+ //For interactive control invoke the formcallback function.
+ if(UefiIsInteractive(&popuppassword->ControlData))
+ {
+ VOID *Handle = popuppassword->ControlData.ControlHandle;
+ UINT16 Key = UefiGetControlKey(&(popuppassword->ControlData));
+ CONTROL_DATA *Control = (CONTROL_DATA *)NULL;
+
+ //Call the callback passing the input value and value size.
+ Status = CallFormCallBack( &(popuppassword->ControlData),Key,0,AMI_CALLBACK_CONTROL_UPDATE);
+
+ Control = GetUpdatedControlData((CONTROL_DATA*)popuppassword, CONTROL_TYPE_PASSWORD, Handle, Key);
+ if(Control == NULL){ //Control deleted.
+ return EFI_SUCCESS;
+ }
+ if(Control != (CONTROL_DATA *)popuppassword){
+ popuppassword = (POPUP_PASSWORD_DATA *)Control; //Control Updated.
+ }
+ }
+
+ popuppassword->ControlActive = FALSE;
+ }
+ else
+ {
+ CallbackShowMessageBox( (UINTN)gInvalidPasswordFailMsgBox, MSGBOX_TYPE_OK );
+ }
+ }
+ }
+ StringZeroFreeMemory ((VOID **)&Text); //EIP67735 zeroing the password prompt memories
+ StringZeroFreeMemory ((VOID **)&NewPswd);
+ StringZeroFreeMemory ((VOID **)&ConfirmNewPswd);
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PopupPasswordHandleAction
+//
+// Description: function to handle the password actions
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, , ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _PopupPasswordHandleAction( POPUP_PASSWORD_DATA *popuppassword, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT8 u8ChkResult;
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ return Status;
+
+ u8ChkResult = CheckControlCondition( &popuppassword->ControlData );
+
+ //Not to perform action for control when token TSE_SETUP_GRAYOUT_SELECTABLE is enable to set focus for GrayoutIf control
+ if ( IsGrayoutSelectable() && (COND_GRAYOUT == u8ChkResult) ) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if ( Data->Input.Type == ACTION_TYPE_KEY )
+ {
+ CONTROL_ACTION Action;
+
+ //Get mapping
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+
+ if(ControlActionSelect == Action)
+ {
+ if(UefiIsInteractive(&popuppassword->ControlData))
+ if(PopupPasswordFormCallback(&(popuppassword->ControlData),UefiGetControlKey(&(popuppassword->ControlData)),0) == EFI_SUCCESS)
+ return EFI_SUCCESS;
+
+ return _PopupPasswordActivate(popuppassword);
+ }
+ }
+
+ if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ if(ControlActionSelect == MapControlMouseActionHook(&Data->Input.Data.MouseInfo))
+ {
+
+ //EIP-123727 check whether MouseTop is within the Height and Width of Password Control or not
+ if((Data->Input.Data.MouseInfo.Top >= (UINT32)popuppassword->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(popuppassword->Top+popuppassword->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)popuppassword->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(popuppassword->Left+popuppassword->Width))
+ )
+ {
+ if(UefiIsInteractive(&popuppassword->ControlData))
+ if(PopupPasswordFormCallback(&(popuppassword->ControlData),UefiGetControlKey(&(popuppassword->ControlData)),0) == EFI_SUCCESS)
+ return EFI_SUCCESS;
+
+ return _PopupPasswordActivate(popuppassword);
+ }
+ }
+ }
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordHandleAction
+//
+// Description: Function to handle the PopupPassword Actions
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, ACTION_DATA *Data
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordHandleAction( POPUP_PASSWORD_DATA *popuppassword, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = PopupPwdHandleActionOverRide(popuppassword, Data);
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordSetFocus
+//
+// Description: Function to set focus
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, BOOLEAN focus
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordSetFocus(POPUP_PASSWORD_DATA *popuppassword, BOOLEAN focus)
+{
+ UINT8 u8ChkResult;
+
+ if(focus != FALSE)
+ {
+ u8ChkResult = CheckControlCondition( &popuppassword->ControlData );
+ if ( ((u8ChkResult != COND_NONE) && (u8ChkResult != COND_GRAYOUT)) ||
+ (!IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT)) )
+ return EFI_UNSUPPORTED;
+ }
+
+ if( !(popuppassword->ControlFocus && focus) )
+ popuppassword->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordSetPosition
+//
+// Description: Function to set position.
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordSetPosition(POPUP_PASSWORD_DATA *popuppassword, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( popuppassword, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordSetDimensions(POPUP_PASSWORD_DATA *popuppassword, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( popuppassword, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordSetAttributes(POPUP_PASSWORD_DATA *popuppassword, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( popuppassword, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordGetControlHeight
+//
+// Description: function to get the height of the label
+//
+// Input: POPUP_PASSWORD_DATA *popuppassword, frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordGetControlHeight(POPUP_PASSWORD_DATA *popuppassword, VOID *frame, UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width;
+
+ Width = ((FRAME_DATA*)frame)->FrameData.Width - 2;
+
+ text = HiiGetString( popuppassword->ControlData.ControlHandle, UefiGetPromptField(popuppassword->ControlData.ControlPtr));
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ newText = StringWrapText( text, Width, height );
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+ }
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+}
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _CBPopupEdit
+//
+// Description: Function for PopupEdit callback.
+//
+// Input: VOID *container, VOID *object, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _CBPopupEdit(VOID *container, VOID *object, VOID *cookie)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ if(cookie!=NULL)
+ {
+
+ res=0;
+ }
+ else
+ res=1; // exit with no changes to string
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PopupEditGetValue
+//
+// Description: Function to get edit value.
+//
+// Input: POPUPEDIT_DATA *popupedit
+//
+// Output: UINTN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _PopupEditGetValue( POPUPEDIT_DATA *popupedit )
+{
+ ACTION_DATA *action = gApp->Action;
+ EFI_STATUS Status = EFI_SUCCESS;//EIP:67695
+ BOOLEAN DrawCursor = TRUE;//EIP:67695
+ UINT32 MousePointerX = 0,MousePointerY = 0,MousePointerZ = 0;
+
+ gPopupEdit.SetCallback( popupedit, NULL, _CBPopupEdit, &gPopupEditCb );
+ gPopupEdit.SetDimensions( popupedit, popupedit->Width , popupedit->Height );
+ res = (UINT8)-1;
+
+ SetPwdKeyboardLayout();//EIP-88912
+ TSEStringReadLoopEntryHook();
+
+ while ( res == (UINT8)-1 )
+ {
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ gAction.ClearAction( action );
+
+ GetCoordinates (&MousePointerX, &MousePointerY, &MousePointerZ);
+ if (gST->ConOut)
+ {
+ if (
+ ( ((MousePointerX/HiiGetGlyphWidth ()) <= (UINT32)gST->ConOut->Mode->CursorColumn+1) && ((MousePointerX/HiiGetGlyphWidth ()) >= (UINT32)gST->ConOut->Mode->CursorColumn-1) ) &&
+ ( ((MousePointerY/HiiGetGlyphHeight ()) <= (UINT32)gST->ConOut->Mode->CursorRow+1) && ((MousePointerY/HiiGetGlyphHeight ()) >= (UINT32)gST->ConOut->Mode->CursorRow-1) ) //EIP79486 Stop the mouse if mouse poiner is over the text cursor useful for avoiding corruption
+ )
+ MouseStop ();
+ else
+ {
+ if ( !IsMouseOnSoftkbd() ) //EIP-164232 checking for mouse pointer position
+ MouseFreeze ();
+ }
+ }
+
+ gPopupEdit.Draw( popupedit );
+ DoRealFlushLines();
+
+ if (IsTSECursorSupport())//EIP-91364
+ {
+ if (TRUE == DrawCursor) //EIP:67695 Enabling at valid times
+ {
+ gST->ConOut->SetAttribute (gST->ConOut, popupedit->FGColor | popupedit->BGColor);
+ gST->ConOut->SetCursorPosition (gST->ConOut, popupedit->Left + EfiStrLen (popupedit->Text)+1, popupedit->Height- (2+ (popupedit->TextWidth/popupedit->Width +1))+popupedit->Top+1);
+ gST->ConOut->EnableCursor (gST->ConOut, TRUE);
+ DrawCursor = FALSE;
+ }
+ }
+ if ( !IsMouseOnSoftkbd() ) //EIP-164232 Avoid mouse flickers If mouse pointer is on softkbd area
+ MouseRefresh();
+
+
+ if ( gAction.GetAction( action ) != EFI_SUCCESS )
+ continue;
+ Status = gPopupEdit.HandleAction( popupedit, action );
+ if (IsTSECursorSupport() && !(EFI_ERROR (Status)))//EIP:67695
+ {
+ DrawCursor = TRUE; //EIP:67695 If any valid action performed then draw the cursor, usefull for blinking
+ }
+ }
+ TSEStringReadLoopExitHook();
+ ResetPwdKeyboardLayout();//EIP-88912
+
+ return res;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DoPopupEdit
+//
+// Description: function to perform the edit operations on popup
+//
+// Input: POPUP_PASSWORD_DATA *PopupPassword, UINT16 Title, CHAR16 **Text
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _DoPopupEdit( POPUP_PASSWORD_DATA *PopupPassword, UINT16 Title, CHAR16 **Text)
+{
+ static UINT8 gIFRPopupEdit[50];
+ EFI_STATUS Status= EFI_SUCCESS;
+ UINT8 retValue = (UINT8)-1;
+ UINT16 newtoken = 0;
+
+ POPUPEDIT_DATA *popupedit = NULL;
+
+ CONTROL_INFO dummy;
+ BOOLEAN PreviousCursorState = gST->ConOut->Mode->CursorVisible;//EIP:67695
+
+ Status = gPopupEdit.Create( &popupedit );
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ MemSet( &dummy, sizeof(dummy), 0 );
+
+ MemCopy( &gIFRPopupEdit, (VOID*)PopupPassword->ControlData.ControlPtr, UefiGetIfrLength(PopupPassword->ControlData.ControlPtr) );
+
+ //EIP-116315 password string. Starts
+ //To show Control prompt string as PopupPassword String instead from AMITSEStr.uni file
+ if (IsShowPromptStringAsTitle())
+ {
+ UINTN strlen = 0;
+ CHAR16 *temptext, *tempTitle = NULL, *tText = NULL;
+ dummy.ControlHandle = PopupPassword->ControlData.ControlHandle;
+
+ //Get TSE string
+ temptext = HiiGetString( (VOID*)(UINTN)INVALID_HANDLE, Title);
+ strlen = EfiStrLen(temptext);
+
+ tempTitle = EfiLibAllocateZeroPool((strlen+2)*sizeof(CHAR16));
+
+ if (NULL == tempTitle)
+ return EFI_OUT_OF_RESOURCES;
+
+ EfiStrCpy (tempTitle,temptext);
+ strlen = EfiStrLen(tempTitle);
+
+ MemFreePointer( (VOID **)&temptext );
+
+ //Get Prompt String from ControlPtr
+ temptext = HiiGetString( PopupPassword->ControlData.ControlHandle, UefiGetPromptField(PopupPassword->ControlData.ControlPtr));
+ strlen = EfiStrLen(temptext+2);
+
+ tempTitle = MemReallocateZeroPool (
+ tempTitle,
+ ( (EfiStrLen (tempTitle) + 2) * sizeof (CHAR16) ),
+ ( ((EfiStrLen (tempTitle) + 2) * sizeof (CHAR16)) + ((EfiStrLen (temptext) + 2) * sizeof (CHAR16)) ) //2 for /n and NULL character
+ );
+
+ if (NULL == tempTitle)
+ return EFI_OUT_OF_RESOURCES;
+
+ //Eliminate white space character if any precedes
+ tText = temptext;
+ while(*temptext == L' ')
+ {
+ temptext++;
+ }
+
+ //Appending TSE string with controlptr string
+ EfiStrCat (tempTitle,temptext);
+
+ //Create new token for newly created string
+ newtoken = HiiAddString( PopupPassword->ControlData.ControlHandle, tempTitle );
+
+ //Set control prompt with newly created token
+ UefiSetPromptField ((VOID*)&gIFRPopupEdit,newtoken);
+
+ MemFreePointer( (VOID **)&tText );
+ MemFreePointer( (VOID **)&tempTitle );
+ }
+ else
+ {
+ dummy.ControlHandle = (VOID*)(UINTN)INVALID_HANDLE;
+ UefiSetPromptField ((VOID*)&gIFRPopupEdit,Title);
+ }
+ //EIP-116315 password string. Ends
+
+ dummy.ControlPtr = (VOID*)&gIFRPopupEdit;
+ dummy.ControlFlags.ControlVisible = TRUE;
+
+ //gPopupEdit.SetTitle(popupedit,Title);
+ gPopupEdit.SetText(popupedit,*Text);
+ gPopupEdit.SetType( popupedit, POPUPEDIT_TYPE_PASSWORD );
+ Status = gPopupEdit.Initialize( popupedit, &dummy );
+ if ( EFI_ERROR( Status ) )
+ goto Done;
+
+ //gPopupEdit.SetType( popupedit, POPUPEDIT_TYPE_PASSWORD );
+ retValue = (UINT8)_PopupEditGetValue( popupedit );
+ if (IsTSECursorSupport())//EIP-91364
+ {
+ gST->ConOut->EnableCursor (gST->ConOut, PreviousCursorState);//EIP:67695
+ }
+ if(retValue ==0)
+ {
+ // string changed, save to nvram or do whatever needs to be done
+ MemFreePointer( (VOID **)Text );
+ *Text = EfiLibAllocateZeroPool( (gPopupEditCb.Length+1) * sizeof(CHAR16) );
+ if ( Text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ EfiStrCpy( *Text, gPopupEditCb.Data );
+
+ }
+ else
+ Status = EFI_UNSUPPORTED;
+Done:
+ gPopupEdit.Destroy( popupedit, TRUE );
+ if ( IsShowPromptStringAsTitle() )
+ HiiRemoveString(gHiiHandle, newtoken);//Delete created token
+ return Status;
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/PopupPassword.h b/EDK/MiniSetup/TseLite/PopupPassword.h
new file mode 100644
index 0000000..2987967
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupPassword.h
@@ -0,0 +1,178 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2012, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupPassword.h $
+//
+// $Author: Premkumara $
+//
+// $Revision: 10 $
+//
+// $Date: 8/28/14 6:07a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupPassword.h $
+//
+// 10 8/28/14 6:07a Premkumara
+// EIP-135253 Updating file name proper in #include
+//
+// 9 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 8 5/18/12 6:56a Rajashakerg
+// [TAG] EIP85220
+// [Category] Improvement
+// [Description] TSE - Extend Popup password customization options
+// [Files] Popuppassword.h
+//
+// 7 11/30/11 11:58a Premkumara
+// [TAG] EIP75521
+// [Category] Improvement
+// [Description] Need to support interactive password controls
+// [Files] PopupPassword.c, PopupPassword.h, TsetAdvanced.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 7 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 1/09/10 6:53a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PopupPassword.h
+//
+// Description: Header file for Popup Passwords
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _POPUP_PASSWORD_H_
+#define _POPUP_PASSWORD_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+#include "action.h"
+#include "Label.h"
+#include "PopupEdit.h"
+
+
+#define POPUP_PASSWORD_MEMBER_VARIABLES \
+UINT16 TextMargin; \
+UINT16 TextWidth; \
+UINT16 TextAreaWidth;
+
+
+typedef struct _POPUP_PASSWORD_METHODS POPUP_PASSWORD_METHODS;
+
+typedef struct _POPUP_PASSWORD_DATA
+{
+ POPUP_PASSWORD_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ LABEL_MEMBER_VARIABLES
+ POPUP_PASSWORD_MEMBER_VARIABLES
+
+}
+POPUP_PASSWORD_DATA;
+
+#define POPUP_PASSWORD_METHOD_FUNCTIONS
+
+
+struct _POPUP_PASSWORD_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ POPUP_PASSWORD_METHOD_FUNCTIONS
+
+};
+
+extern POPUP_PASSWORD_METHODS gPopupPassword;
+
+// Object Methods
+EFI_STATUS PopupPasswordCreate( VOID **object );
+EFI_STATUS PopupPasswordDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS PopupPasswordInitialize( VOID *object, VOID *data );
+EFI_STATUS PopupPasswordDraw( VOID *object );
+EFI_STATUS PopupPasswordHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS PopupPasswordSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS PopupPasswordSetFocus( VOID *object, BOOLEAN focus);
+EFI_STATUS PopupPasswordSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS PopupPasswordSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS PopupPasswordSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS PopupPasswordGetControlHeight(VOID *object, VOID *frame, UINT16 *height);
+
+EFI_STATUS _DoPopupEdit( POPUP_PASSWORD_DATA *PopupPassword, UINT16 Title, CHAR16 **Text);//EIP-75521 Support Interactive Password control
+
+#endif /* _POPUP_PASSWORD_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/PopupSel.c b/EDK/MiniSetup/TseLite/PopupSel.c
new file mode 100644
index 0000000..dd81c20
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupSel.c
@@ -0,0 +1,1646 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupSel.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 40 $
+//
+// $Date: 8/28/14 3:09p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupSel.c $
+//
+// 40 8/28/14 3:09p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 39 5/02/14 9:36p Arunsb
+// EIP141986 changes reverted.
+//
+// 38 5/02/14 10:54a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 37 5/01/14 3:45p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 36 2/11/14 8:37p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 35 12/03/13 1:12p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 34 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 17 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 32 9/25/12 11:44a Blaines
+// [TAG] - EIP 101903
+// [Category] - Defect
+// [Synopsis] - Enabling Multiline in TSE cause a crash when entering in
+// TSE
+// [Root cause] If SPrint is called with a string that exceeds the
+// buffersize, overflow occurs and exception happens.
+// [Solution] Call Sprint using only the printable length copy of the
+// original string.
+// [Files] - Popupsel.c
+// [Function] - PopupSelGetControlHeight
+//
+// 31 9/18/12 5:08a Arunsb
+// [TAG] EIP95139
+// [Category] Bug Fix
+// [Severity] Normal
+// [RootCause] BootOrder and DriverOrder cases are not handled preoperly
+// in _PopupSelGetSelection() function
+// [Files] PopupSel.c
+//
+// 30 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 28 9/06/12 1:02a Rajashakerg
+// [TAG] EIP91410
+// [Category] Improvement
+// [Description] TSE_MULTILINE_CONTROLS=1 makes one of option with max
+// string looks not good.
+// [Files] PopupSel.c, COmmonHelper.c, AMITSE.sdl
+//
+// 27 2/01/12 8:05p Blaines
+// [TAG] - EIP 81631
+// [Category]- Sighting
+// [Synopsis]- In some SAS cards, HII Adapter Settings screen is not
+// wrapping the text correctly
+// [Solution] - Use the proper control width calculation to determine
+// control height in PopupSelGetControlHeight.
+// The string length calculation used to determine control height in
+// SubMenuGetControlHeight needs to be consistent with the same in
+// SubMenuDraw.
+//
+// [Files]
+// Submenu.c, PopupSel.c,
+//
+// 26 2/01/12 3:33a Arunsb
+// [TAG] EIP81603
+// [Category] Improvement
+// [Description] If any option is not obtained then default option is
+// used
+// [Files] PopupSel.c
+//
+// 25 1/31/12 7:04p Blaines
+// [TAG] - EIP 81631
+// [Category]- Sighting
+// [Synopsis]- In some SAS cards, HII Adapter Settings screen is not
+// wrapping the text correctly
+// [Solution] - Allow max space when creating controls in the functions
+// FrameAddControl, FrameDraw.
+// Allow max space for computing height in PopupSelGetControlHeight,
+// TextGetControlHeight PopupSelDraw, TextDraw.
+//
+// [Files]
+// Text.c, PopupSel.c, frame.c
+//
+// 24 1/18/12 6:37a Rajashakerg
+// [TAG] EIP79949
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Text srting is not wrapped in "Advanced -> Super IO config.
+// -> Floppy disk controller config. -> Change settings" option when
+// TSE_MULTILINE_CONTROLS token enabled.
+// [RootCause] The calculation was not proper to show maximum string in
+// the left control area for popupsel control.
+// [Solution] Adjusted the cordinates to show maximum string in control
+// left area
+// [Files] PopupSel.c
+//
+// 23 1/05/12 12:27a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupString.c, SubMenu.c, Text.c,PopupSel.c.
+//
+// 22 12/07/11 8:18a Rajashakerg
+// [TAG] EIP75118
+// [Category] Improvement
+// [Description] xtractConfig() fail since BrowserCallback() cannot find
+// the variable to process
+// [Files] FormBrowser2.c, FormBrowser2.h, HiiCallback.c,
+// Uefi21Wapper.c, PopupSel.c
+//
+// 21 12/05/11 7:05p Blaines
+// [TAG] - EIP 77040
+// [Category]- Sighting
+// [Synopsis]- Setup: Boot Option Priority list items truncated, until you
+// move within the tab.
+// [Solution] - In the function PopupSelGetControlHeight, call the
+// function _PopupSelGetSelection to get the current selection before
+// computing the control height.
+//
+// [Files]
+// PopupSel.c
+//
+// 20 11/30/11 1:33p Premkumara
+// [TAG] EIP75352
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] Boot.c, bbs.c, TseAdvanced.c, Special.c, Variable.c,
+// TseLiteHelper.c, PopupSel.c, AddBootOption.c, Hii.c, FormBrowser2.c
+//
+// 19 11/21/11 11:12a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 18 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 17 11/13/11 1:05p Arunsb
+// [TAG] EIP70421
+// [Category] New Feature
+// [Description] Support for driver order in TSE
+// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
+// boot.c,
+// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
+// addbootoption.c,
+// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
+// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
+// TseElink.h, variable.h,
+// setup.h, Boot.vfr and Setup.uni
+//
+// 16 10/20/11 12:03p Madhans
+// Check in comment corrected.
+//
+// 15 9/19/11 11:50a Blaines
+// [TAG] EIP 68920
+// [Category] Defect
+// [Symptom] SOME SAS controller card HII menus hang when selecting "Clear
+// Configuration" when DEBUG_MODE=0
+// [RootCause] Menu is not re-initialize from SetupData after dynamic
+// page update.
+// PopupSelGetControlHeight() causes an assert if popupSel has an item
+// with an invalid string token.
+//
+// [Solution] Due to dynamic updates, SetupData (most current data) is
+// given priority when re-initializing menu.
+// Check for invalid string token in PopupSelGetControlHeight.
+//
+// [Files Changed]
+// - Menu.c, Popupsel.c
+//
+// 14 8/26/11 2:10p Blaines
+// [TAG] EIP 67487
+// [Category] Defect
+// [Symptom] TSE_MULTILINE_CONTROLS does not work for all control types
+// [RootCause] The controls (PopupSel, PopupString) ONLY check for
+// string wrapping in the label value (control prompt) when calling the
+// methods GetControlHeight and Draw.
+// [Solution] The controls (PopupSel, PopupString) should check for
+// string wrapping in the label (control prompt) and the control's value
+// when calling the methods GetControlHeight and Draw. For Dynamic pages,
+// adjust the width calculation for Submenu in the function
+// GetControlHeight.
+// [Files] PopupSel.c, PopupString.c, Submenu.c
+//
+// 13 3/28/11 11:40p Madhans
+// [TAG] EIP50878
+// [Category] Improvement
+// [Description] Support to move the Control With Boot Order Change.
+// [Files] AMITSE.sdl
+// commonoem.c
+// minisetup.h
+// popupsel.c
+//
+// 12 3/21/11 12:40a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 11 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 10 12/02/10 6:08p Madhans
+// [TAG] - EIP49562
+// [Category]- Improvment.
+// [Severity]- Mordarate
+// [Symptom]- Need to support UEFI 2.2 requirements related to Calling
+// Formcallback with
+// EFI_BROWSER_ACTION_CHANGING and EFI_BROWSER_ACTION_CHANGED action.
+// [Solution]- Implemented the support.
+// [Files] - submenu.c, numeric.c, popupsel.c, popupString.c,
+// uefi20\hii.h, uefi20\uefi20wrapper.c
+// uefi21\hiicalback.c, uefi21\tseuefihii.h
+//
+// 9 12/02/10 2:34p Madhans
+// [TAG] - EIP 48169
+// [Category]- Enhancement
+// [Severity]- Mordarate
+// [Symptom]- Code Cleanup and Compiler Warning need to resolved.
+// [Rootcause] Warnings reported when we build AMI higher Warning level.
+// [Solution]- 1. Fix the warnings and do the code cleanup.
+// 2. Introduce proper checks.
+// 3. change the popupSel.c to not change the Option/variable
+// cache to default or first option
+// when the variable cache is not matching with any of
+// option.
+// [Files] - commonoem.c bbs.c boot.c hiistring.c resource.c
+// popuppassword.c popupsel.c
+// expression.c hii.c parse.c
+//
+// 8 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 7 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 6 3/26/10 5:06p Madhans
+// EIP 36704 : Fix for Making sure to make the Variable to NULL after it
+// is Freed up.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 11 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 10 2/17/10 7:03p Madhans
+// To suppor readonly control
+//
+// 9 2/15/10 10:15p Madhans
+// To avoid warnings
+//
+// 8 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 7 1/09/10 6:57a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 6 9/15/09 9:48a Sudhirv
+// updated the Add Del Boot Option support
+//
+// 5 8/13/09 1:20p Blaines
+// EIP #24980 Fix to properly display right area text
+//
+// 4 8/13/09 7:40a Mallikarjunanv
+// eip:24971 - supporting tse features without tse sources
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:12p Madhans
+// TSE Lite Special control support
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PopupSel.c
+//
+// Description: This file contains code to handle Popup selections
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+BOOLEAN OneofMultilineDisable(POPUPSEL_DATA *popupSel);
+VOID _PopupSelGetSelection( POPUPSEL_DATA *popupSel );
+static BOOLEAN bSelectionChanged = FALSE;
+
+extern EFI_STATUS _FrameScroll( FRAME_DATA *frame, BOOLEAN bScrollUp );
+extern UINT16 _gHDOrderPageID;
+extern UINT16 _gCDOrderPageID;
+extern UINT16 _gFDOrderPageID;
+extern UINT16 _gNetOrderPageID;
+extern UINT16 _gBevOrderPageID;
+
+POPUPSEL_METHODS gPopupSel =
+{
+ PopupSelCreate,
+ PopupSelDestroy,
+ PopupSelInitialize,
+ PopupSelDraw,
+ PopupSelHandleAction,
+ PopupSelSetCallback,
+ PopupSelSetFocus,
+ PopupSelSetPosition,
+ PopupSelSetDimensions,
+ PopupSelSetAttributes,
+ PopupSelGetControlHeight
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelCreate
+//
+// Description: this function uses the create function of control
+// and creates the Popup Selected
+//
+// Input: POPUPSEL_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelCreate( POPUPSEL_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(POPUPSEL_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gPopupSel;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys the Popup Selected
+//
+// Input: POPUPSEL_DATA *popupSel, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelDestroy( POPUPSEL_DATA *popupSel, BOOLEAN freeMem )
+{
+ if(NULL == popupSel)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( popupSel, FALSE );
+
+ if ( popupSel->ListBoxCtrl )
+ gListBox.Destroy( popupSel->ListBoxCtrl, TRUE );
+
+ popupSel->ListBoxCtrl = NULL;
+
+ if( freeMem )
+ {
+ MemFreePointer( (VOID **)&(popupSel->PtrTokens) );
+ MemFreePointer( (VOID **)&popupSel );
+
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelInitialize
+//
+// Description: this function uses the initialize function of control
+// and initializes the Popup Selected
+//
+// Input: POPUPSEL_DATA *popupSel, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelInitialize( POPUPSEL_DATA *popupSel, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 Index = 0;
+ UINT16 *OptionList=NULL;
+ UINT64 *ValueList=NULL;
+
+
+ Status = gControl.Initialize( popupSel, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ popupSel->PopupSelHandle = popupSel->ControlData.ControlHandle;
+ popupSel->Title = UefiGetPromptField(popupSel->ControlData.ControlPtr);
+
+ // add extra initialization here...
+ Status = UefiGetOneOfOptions(&popupSel->ControlData,&popupSel->PopupSelHandle,
+ &OptionList, &ValueList, &popupSel->ItemCount,&popupSel->bInteractive,&popupSel->CallBackKey);
+
+ if (EFI_ERROR(Status))
+ return Status;
+
+ popupSel->Interval = (UINT8)(popupSel->ControlData.ControlFlags.ControlRefresh);
+
+ if( popupSel->PtrTokens != NULL )
+ MemFreePointer( (VOID **)&(popupSel->PtrTokens));
+ popupSel->PtrTokens = EfiLibAllocatePool( popupSel->ItemCount * sizeof(PTRTOKENS) );
+ if ( popupSel->PtrTokens == NULL )
+ Status = EFI_OUT_OF_RESOURCES;
+ else
+ {
+ for( Index = 0; Index < popupSel->ItemCount; Index++ )
+ {
+ popupSel->PtrTokens[Index].Option = OptionList[Index];
+ popupSel->PtrTokens[Index].Value = ValueList[Index];
+ }
+
+ MemFreePointer( (VOID **)&(OptionList));
+ MemFreePointer( (VOID **)&(ValueList));
+
+ if(popupSel->ControlData.ControlFlags.ControlInteractive)
+ {
+ popupSel->bInteractive = TRUE;
+ popupSel->CallBackKey = popupSel->ControlData.ControlKey;
+ }
+
+ // boundary overflow check
+
+ popupSel->ListBoxCtrl = NULL;
+ popupSel->ListBoxEnd = FALSE;
+ popupSel->LabelMargin = (UINT8)gControlLeftMargin;
+
+ // We dont have to do Get selection here it is done before we draw a page
+ //_PopupSelGetSelection( popupSel );
+
+ SetControlColorsHook(&(popupSel->BGColor), &(popupSel->FGColor), NULL, NULL ,&(popupSel->SelBGColor), &(popupSel->SelFGColor),
+ NULL , &(popupSel->NSelFGColor),NULL,&(popupSel->LabelFGColor) ,
+ &(popupSel->NSelLabelFGColor),NULL ,NULL,NULL, NULL );
+
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelDraw
+//
+// Description: function to draw the specific popup window
+//
+// Input: POPUPSEL_DATA *popupSel
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelDraw( POPUPSEL_DATA *popupSel )
+{
+ CHAR16 *text=NULL,*text1=NULL;
+ UINTN i=0,Len=0;
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT16 Index = 0, TempHeight=0;
+ UINT16 *OptionList=NULL;
+ UINT64 *ValueList=NULL;
+
+ UINT16 tmpHeight=0;
+
+ UINT8 ColorNSel = popupSel->NSelFGColor;
+ UINT8 ColorLabel = (popupSel->ControlFocus) ? popupSel->LabelFGColor : popupSel->NSelLabelFGColor ;
+
+ if( popupSel->ListBoxCtrl != NULL)
+ {
+ gListBox.Draw( popupSel->ListBoxCtrl );
+ }
+ else
+ {
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( popupSel->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &popupSel->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorNSel = ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+ // If not Special
+ if(TseLiteIsSpecialOptionList((CONTROL_DATA *)popupSel) != TRUE)
+ {
+ Status = UefiGetOneOfOptions(&popupSel->ControlData,&popupSel->PopupSelHandle,
+ &OptionList, &ValueList, &popupSel->ItemCount,NULL,NULL);
+ if (EFI_ERROR(Status))
+ return Status;
+ for( Index = 0; Index < popupSel->ItemCount; Index++ )
+ {
+ popupSel->PtrTokens[Index].Option = OptionList[Index];
+ popupSel->PtrTokens[Index].Value = ValueList[Index];
+ }
+ MemFreePointer( (VOID **)&(OptionList));
+ MemFreePointer( (VOID **)&(ValueList));
+ }
+
+ _PopupSelGetSelection( popupSel );
+ text1 = HiiGetString( popupSel->ControlData.ControlHandle, popupSel->Title );
+ if ( text1 != NULL )
+ {
+ //Eip TSE_MULTILINE_CONTROLS moved to binary
+ if(popupSel->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( (UINTN)popupSel->Left, (UINTN) popupSel->Top,
+ (UINTN)(popupSel->LabelMargin - popupSel->Left),(UINTN) popupSel->Height,
+ text1, popupSel->BGColor | ColorLabel );
+ }
+ else
+ {
+ // boundary overflow check
+ if((TestPrintLength( text1) / (NG_SIZE))> (UINTN)(popupSel->LabelMargin - popupSel->Left ))
+ text1[HiiFindStrPrintBoundary(text1 ,(UINTN)(popupSel->LabelMargin - popupSel->Left ))] = L'\0';
+
+ DrawStringWithAttribute( popupSel->Left , popupSel->Top, (CHAR16*)text1,
+ popupSel->BGColor | ColorLabel );
+
+ }
+ MemFreePointer( (VOID **)&text1 );
+ }
+
+ /*EfiStrCpy(text, L"[");
+ DrawStringWithAttribute( popupSel->Left + popupSel->LabelMargin , popupSel->Top, (CHAR16*)text,
+ (UINT8)( (popupSel->ControlFocus) ?
+ popupSel->SelBGColor | popupSel->SelFGColor :
+ popupSel->BGColor | ColorNSel ));
+*/
+
+ text1 = HiiGetString( popupSel->PopupSelHandle, popupSel->PtrTokens[popupSel->Sel].Option);
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(popupSel->Height>1 && OneofMultilineDisable(popupSel))
+ {
+ TempHeight = popupSel->Height;
+ popupSel->Height = 1;
+ }
+
+ if(popupSel->Height>1 && IsTSEMultilineControlSupported())
+ {
+ Len = TestPrintLength( text1 ) / (NG_SIZE);
+ text = EfiLibAllocateZeroPool( (Len+3)*2 );
+ SPrint( text,(UINTN)( (Len+3)*2 )/*(popupSel->Width - popupSel->Left - popupSel->LabelMargin +2)*/, L"[%s]", text1 );
+ MemFreePointer( (VOID **)&text1 );
+
+ text1 = StringWrapText( (CHAR16*)text, (popupSel->Width - popupSel->LabelMargin ), &tmpHeight );
+
+ if(tmpHeight == 1)
+ DrawStringWithAttribute( popupSel->Left + popupSel->LabelMargin , popupSel->Top, (CHAR16*)text,
+ (UINT8)( (popupSel->ControlFocus) ? popupSel->SelBGColor | popupSel->SelFGColor : popupSel->BGColor | ColorNSel ));
+ else
+ DrawMultiLineStringWithAttribute( (UINTN)popupSel->Left + (UINTN)popupSel->LabelMargin, (UINTN) popupSel->Top,
+ (UINTN)(popupSel->Width - popupSel->LabelMargin ),(UINTN)&tmpHeight/*popupSel->Height*/, (CHAR16*)text,
+ (UINT8)( (popupSel->ControlFocus)? popupSel->SelBGColor | popupSel->SelFGColor :
+ popupSel->BGColor | ColorNSel ));
+
+ MemFreePointer( (VOID **)&text1 );
+
+ }
+ else
+ {
+
+ if(!text1)
+ text1 = EfiLibAllocateZeroPool(2);
+
+ //MemSet( text, sizeof(text), 0 );
+ Len = TestPrintLength( text1 ) / (NG_SIZE);
+ // XXX: may be broken for wide character languages !!!
+ if ( Len /*StringDisplayLen( text1 )*/ > /*19*/(UINTN)(popupSel->Width + popupSel->Left - popupSel->LabelMargin -4)/*gControlRightAreaWidth*/ ) //EIP 79949 : Adjusted the cordinates to show maximum string in control left area
+ EfiStrCpy(&text1[HiiFindStrPrintBoundary(text1 ,(UINTN)(popupSel->Width + popupSel->Left - popupSel->LabelMargin /*gControlRightAreaWidth*/-7/*16*/))],L"..." );
+
+
+ text = EfiLibAllocateZeroPool( (Len+3)*2 );
+ SPrint( text,(UINTN)( (Len+3)*2 )/*(popupSel->Width - popupSel->Left - popupSel->LabelMargin +2)*/, L"[%s]", text1 );
+ MemFreePointer( (VOID **)&text1 );
+ DrawStringWithAttribute( popupSel->Left + popupSel->LabelMargin , popupSel->Top, (CHAR16*)text,
+ (UINT8)( (popupSel->ControlFocus) ?
+ popupSel->SelBGColor | popupSel->SelFGColor :
+ popupSel->BGColor | ColorNSel ));
+
+ }
+
+ if((TempHeight > 0) && OneofMultilineDisable(popupSel))
+ {
+ popupSel->Height = TempHeight;
+ }
+ i=TestPrintLength(text) / (NG_SIZE);
+ MemFreePointer( (VOID **)&text );
+ /*EfiStrCpy(text, L"]");
+ DrawStringWithAttribute( popupSel->Left + popupSel->LabelMargin +i +1, popupSel->Top, (CHAR16*)text,
+ (UINT8)( (popupSel->ControlFocus) ?
+ popupSel->SelBGColor | popupSel->SelFGColor :
+ popupSel->BGColor | ColorNSel ));
+*/
+ // erase extra spaces if neccessary
+ for(;(UINT16)(popupSel->Left + popupSel->LabelMargin + i) <= (popupSel->Width-1);i++)
+ DrawStringWithAttribute( popupSel->Left + popupSel->LabelMargin +i, popupSel->Top, L" ",
+ popupSel->BGColor | ColorNSel );
+
+ FlushLines( popupSel->Top, popupSel->Top+popupSel->Height );
+ }
+
+ return Status;
+
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelSetCallback
+//
+// Description: Function to handle the PopupString actions
+//
+// Input: POPUPSEL_DATA *popupSel, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelSetCallback( POPUPSEL_DATA *popupSel, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( popupSel, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DoBootDelBootOption
+//
+// Description: Function to delete the boot option
+//
+// Input: POPUPSEL_DATA *
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN DoBootDelBootOption (POPUPSEL_DATA *popupSel)
+{
+ if( popupSel->ControlData.ControlVariable == VARIABLE_ID_DEL_BOOT_OPTION )
+ {
+ //delete selected option
+ BootDelBootOption( (UINT16) popupSel->PtrTokens[popupSel->Sel].Value );
+
+ //Complete redraw
+ gApp->CompleteRedraw = TRUE;
+
+ //Variable should not be set so return
+ return 1;
+ }
+ return 0;
+}
+
+//EIP70421 & 70422 Support for driver order
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DoDriverDelDriverOption
+//
+// Description: Function to delete the driver option
+//
+// Input: POPUPSEL_DATA *
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN DoDriverDelDriverOption(POPUPSEL_DATA * popupSel)
+{
+ if (VARIABLE_ID_DEL_DRIVER_OPTION == popupSel->ControlData.ControlVariable)
+ {
+ //delete selected option
+ DriverDelDriverOption ((UINT16) popupSel->PtrTokens[popupSel->Sel].Value);
+
+ //Complete redraw
+ gApp->CompleteRedraw = TRUE;
+
+ //Variable should not be set so return
+ return 1;
+ }
+ return 0;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DoPopupSelCallBack
+//
+// Description: Callback function of the PopupSel
+//
+// Input: POPUPSEL_DATA *popupSel
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DoPopupSelCallBack(POPUPSEL_DATA **popupSel)
+{
+//#if SETUP_SUPPORT_ADD_BOOT_OPTION
+ if( TseDoBootDelBootOption(*popupSel) )
+ return;
+//#endif
+
+ if( TseDoDriverDelDriverOption(*popupSel) ) //EIP70421 & 70422 Support for driver order
+ return;
+
+ if ( (*popupSel)->Cookie != NULL )
+ {
+ VOID *ifrData = (VOID *)(*popupSel)->ControlData.ControlPtr;
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)(*popupSel)->Cookie;
+
+ callbackData->Variable = (*popupSel)->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ifrData);
+ callbackData->Length = UefiGetWidth(ifrData);
+ callbackData->Data = (VOID*)&((*popupSel)->PtrTokens[(*popupSel)->Sel].Value);
+ }
+ // To support UEFI 2.1.C spec to Not to update the control when Callback fails.
+ UefiPreControlUpdate(&((*popupSel)->ControlData));
+ (*popupSel)->Callback( (*popupSel)->Container, (*popupSel), (*popupSel)->Cookie );
+
+ if((*popupSel)->bInteractive)
+ {
+ EFI_STATUS Status;
+ VOID * Handle=(*popupSel)->ControlData.ControlHandle;
+ UINT16 Key = (*popupSel)->CallBackKey;
+ CONTROL_DATA *Control;
+
+ Status = CallFormCallBack(&((*popupSel)->ControlData),(*popupSel)->CallBackKey,0, AMI_CALLBACK_CONTROL_UPDATE);//EIP-53480: Updated the action to AMI_CALLBACK_CONTROL_UPDATE
+ Control = GetUpdatedControlData((CONTROL_DATA*)(*popupSel),(*popupSel)->ControlData.ControlType,Handle,Key);
+
+
+ if(Control == NULL){ // Control deleted ?
+ *popupSel = NULL;
+ return;
+ }
+ if(Control != (CONTROL_DATA*)(*popupSel))
+ *popupSel = (POPUPSEL_DATA*)Control; //control Updated
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PopupSelHandleActionKey
+//
+// Description: function to handle the PopupSel Action keys
+//
+// Input: POPUPSEL_DATA *popupSel, AMI_EFI_KEY_DATA key
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _PopupSelHandleActionKeyMouse(POPUPSEL_DATA *popupSel, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ CONTROL_ACTION Action=ControlActionUnknown;
+ AMI_EFI_KEY_DATA key=Data->Input.Data.AmiKey;
+
+ if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ //EIP-123727 check whether MouseTop is within the Height and Width of PopupSel or not
+ if((Data->Input.Data.MouseInfo.Top >= (UINT32)popupSel->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(popupSel->Top+popupSel->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)popupSel->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(popupSel->Left+popupSel->Width))
+ )
+ {
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+ }
+
+ }
+
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ Action = MapControlKeysHook(key);
+
+ switch(Action)
+ {
+ case ControlActionDecreament:
+ //Handle special case for boot order & Legacy dev order
+ if (
+ (VARIABLE_ID_BOOT_ORDER == popupSel->ControlData.ControlVariable) ||
+ (VARIABLE_ID_BBS_ORDER == popupSel->ControlData.ControlVariable) ||
+ (VARIABLE_ID_DRIVER_ORDER == popupSel->ControlData.ControlVariable) //EIP70421 & 70422 Support for driver order
+ )
+ {
+ RearrangeBootDriverOrderVariable (popupSel, FALSE);
+ }
+ else if( ( CheckForAddDelBootOption() ) &&
+ (popupSel->ControlData.ControlVariable == VARIABLE_ID_DEL_BOOT_OPTION ) )
+ {
+ }
+ else
+ {
+ if ( popupSel->Sel > 0 )
+ popupSel->Sel--;
+ else
+ popupSel->Sel = popupSel->ItemCount - 1;
+ DoPopupSelCallBack(&popupSel);
+ if(popupSel == NULL)
+ return EFI_SUCCESS;
+ }
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionIncreament:
+ //Handle special case for boot order & Legacy dev order
+ if (
+ (VARIABLE_ID_BOOT_ORDER == popupSel->ControlData.ControlVariable) ||
+ (VARIABLE_ID_BBS_ORDER == popupSel->ControlData.ControlVariable) ||
+ (VARIABLE_ID_DRIVER_ORDER == popupSel->ControlData.ControlVariable) //EIP70421 & 70422 Support for driver order
+ )
+ {
+ RearrangeBootDriverOrderVariable (popupSel, TRUE);
+ }
+ else if( ( CheckForAddDelBootOption() ) &&
+ (popupSel->ControlData.ControlVariable == VARIABLE_ID_DEL_BOOT_OPTION ) )
+ {
+ }
+ else
+ {
+ if ( popupSel->Sel < (UINTN)(popupSel->ItemCount - 1) )
+ popupSel->Sel++;
+ else
+ popupSel->Sel = 0;
+ DoPopupSelCallBack(&popupSel);
+ if(popupSel == NULL)
+ return EFI_SUCCESS;
+ }
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionSelect:
+ if ( gListBox.Create( &(popupSel->ListBoxCtrl) ) == EFI_SUCCESS )
+ {
+ popupSel->ControlActive = TRUE;
+ gListBox.Initialize( popupSel->ListBoxCtrl, &(popupSel->ControlData) );
+ if(TseLiteIsSpecialOptionList((CONTROL_DATA *)popupSel) == TRUE)
+ {
+ UINT16 TempLength=0, i;
+ //Need fix the ListBox options
+ for( i = 0 ; i < popupSel->ItemCount; i++ )
+ {
+ popupSel->ListBoxCtrl->PtrTokens[i] = popupSel->PtrTokens[i].Option;
+ TempLength = (UINT16)HiiMyGetStringLength( popupSel->ListBoxCtrl->ListHandle, popupSel->ListBoxCtrl->PtrTokens[i] );
+ TempLength+=5; // to included barders
+ if ( TempLength > popupSel->ListBoxCtrl->Width )
+ popupSel->ListBoxCtrl->Width = TempLength;
+ }
+
+ }
+
+ if(popupSel->ListBoxCtrl->Width > (UINT16)(gMaxCols-5))
+ popupSel->ListBoxCtrl->Width = (UINT16)(gMaxCols-5);
+ popupSel->ListBoxCtrl->Sel = popupSel->Sel;
+ gListBox.SetCallback(popupSel->ListBoxCtrl, popupSel, _PopupSelCallback, NULL);
+
+ MouseStop();
+
+ gListBox.Draw( popupSel->ListBoxCtrl );
+
+ MouseRefresh();
+ }
+ Status = EFI_SUCCESS;
+ break;
+
+ default:
+ break;
+ }
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelHandleAction
+//
+// Description: function to handle the PopupSel Actions
+//
+// Input: POPUPSEL_DATA *popupSel, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelHandleAction( POPUPSEL_DATA *popupSel, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT8 u8ChkResult;
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ // List box is active don't refresh
+ if ( popupSel->ListBoxCtrl != NULL )
+ return Status;
+
+ if (popupSel->Interval == 0)
+ return Status;
+
+ if(IsActiveControlPresent(gApp->PageList[gApp->CurrentPage]))
+ return Status;
+
+ if ( --(popupSel->Interval) == 0 )
+ {
+ // initialize the interval
+ popupSel->Interval = (UINT8)(popupSel->ControlData.ControlFlags.ControlRefresh);
+ return UefiRefershQuestionValueNvRAM(&(popupSel->ControlData));
+ }
+ else
+ return Status;
+ }
+
+ u8ChkResult = CheckControlCondition( &popupSel->ControlData );
+
+ //Not to perform action for control when token TSE_SETUP_GRAYOUT_SELECTABLE is enable to set focus for GrayoutIf control
+ if ( IsGrayoutSelectable() && (COND_GRAYOUT == u8ChkResult) ) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if(popupSel->ControlData.ControlFlags.ControlReadOnly)
+ return EFI_UNSUPPORTED;
+
+ if(!popupSel->ControlFocus)
+ return Status;
+
+ if ( popupSel->ListBoxCtrl != NULL )
+ {
+ Status = gListBox.HandleAction(popupSel->ListBoxCtrl,Data);
+ if ( popupSel->ListBoxEnd )
+ {
+ if(bSelectionChanged)
+ {
+ if(popupSel->Sel != popupSel->ListBoxCtrl->Sel)
+ {
+ popupSel->Sel = popupSel->ListBoxCtrl->Sel;
+ DoPopupSelCallBack(&popupSel);
+ if(popupSel == NULL)
+ return EFI_SUCCESS;
+
+ }
+ bSelectionChanged = FALSE;
+ }
+
+ gListBox.Destroy(popupSel->ListBoxCtrl,TRUE);
+ popupSel->ListBoxCtrl = NULL;
+ popupSel->ListBoxEnd = FALSE;
+ popupSel->ControlActive = FALSE;
+ }
+ }
+ else
+ {
+ if((Data->Input.Type == ACTION_TYPE_KEY) || (Data->Input.Type == ACTION_TYPE_MOUSE))
+ {
+ return _PopupSelHandleActionKeyMouse(popupSel, Data);
+ }
+ }
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelSetFocus
+//
+// Description: Function to set focus
+//
+// Input: POPUPSEL_DATA *popupSel, BOOLEAN focus
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelSetFocus(POPUPSEL_DATA *popupSel, BOOLEAN focus)
+{
+ UINT8 u8ChkResult;
+
+ if(focus != FALSE)
+ {
+ u8ChkResult = CheckControlCondition( &popupSel->ControlData );
+
+ //Setting focus to control which has no condtion and token TSE_SETUP_GRAYOUT_SELECTABLE is enable to make GrayoutIf control to focus and selectable
+ if ( ((u8ChkResult != COND_NONE) && (u8ChkResult != COND_GRAYOUT)) ||
+ (!IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT))
+ ){
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ if( !(popupSel->ControlFocus && focus) )
+ popupSel->ControlFocus = focus;
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelSetPosition
+//
+// Description: Function to set position.
+//
+// Input: POPUPSEL_DATA *popupSel, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelSetPosition(POPUPSEL_DATA *popupSel, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( popupSel, Left, Top );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: POPUPSEL_DATA *popupSel, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelSetDimensions(POPUPSEL_DATA *popupSel, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( popupSel, Width, Height );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: POPUPSEL_DATA *popupSel, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelSetAttributes(POPUPSEL_DATA *popupSel, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( popupSel, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PopupSelCallback
+//
+// Description: PopupSel callback function.
+//
+// Input: POPUPSEL_DATA *container, CONTROL_DATA *popupSel, VOID *cookie
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PopupSelCallback( POPUPSEL_DATA *container, CONTROL_DATA *popupSel, VOID *cookie )
+{
+ container->ListBoxEnd = TRUE;
+ if ( cookie != NULL )
+ {
+ bSelectionChanged = TRUE;
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelHandleAction
+//
+// Description: function to handle the PopupSel set and get operations
+//
+// Input: POPUPSEL_DATA *popupSel
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PopupSelGetSelection( POPUPSEL_DATA *popupSel )
+{
+ VOID *temp;
+ VOID *ifrData = popupSel->ControlData.ControlPtr;
+ int i=0;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ popupSel->Sel = 0;
+ temp = EfiLibAllocateZeroPool( 8 * 2 );
+ if ( temp == NULL )
+ return;
+
+ if ( VarGetValue( popupSel->ControlData.ControlVariable, UefiGetQuestionOffset(ifrData), UefiGetWidth(ifrData), temp ) == EFI_SUCCESS )
+ {
+ while( i< popupSel->ItemCount)
+ {
+ if(popupSel->PtrTokens[i].Value == *(UINT64 *)temp)
+ {
+ popupSel->Sel = (UINT16)i;
+ break;
+ }
+ i++;
+ }
+ if( i == popupSel->ItemCount)
+ {
+ //EIP92783 Boot order and driver order are special controls, so TSE is forming the one of with the current boot/driver options.
+ //So no need of checking error case.
+ if ( (VARIABLE_ID_BOOT_ORDER == popupSel->ControlData.ControlVariable) || (VARIABLE_ID_DRIVER_ORDER == popupSel->ControlData.ControlVariable) )
+ {
+ popupSel->Sel = 0;
+ }
+ else
+ {
+ // The data does not correspond to the available selections
+ if(popupSel->ControlData.ControlDataWidth != 0) //Uncommented for EIP81603 One-of forced to new value but new value not passed to RouteConfig
+ {
+ //Try to set selection to the default option
+ VarGetDefaults( popupSel->ControlData.ControlVariable,
+ UefiGetQuestionOffset(popupSel->ControlData.ControlPtr),
+ popupSel->ControlData.ControlDataWidth, temp );
+
+ i=0;
+ while( i< popupSel->ItemCount)
+ {
+ if(popupSel->PtrTokens[i].Value == *(UINT16 *)temp)
+ {
+ popupSel->Sel = (UINT16)i;
+ Status = VarSetValue( popupSel->ControlData.ControlVariable,
+ UefiGetQuestionOffset(popupSel->ControlData.ControlPtr),
+ (UefiGetWidth(popupSel->ControlData.ControlPtr) > sizeof(UINT16) )?sizeof(UINT16):UefiGetWidth(popupSel->ControlData.ControlPtr),
+ temp );
+ break;
+ }
+ i++;
+ }
+ }
+ if( (i == popupSel->ItemCount) || (EFI_ERROR(Status)) )
+ {
+ //Try to set selection to the option with smallest value
+ UINT16 TempoptIndex = 0; //holds index of option with smalleset value
+ i = 0;
+ while (i< popupSel->ItemCount) //Trying for least option
+ {
+ if (popupSel->PtrTokens [i].Value < popupSel->PtrTokens [TempoptIndex].Value)
+ {
+ TempoptIndex = (UINT16)i;
+ }
+ i++;
+ }
+ popupSel->Sel = (UINT16)TempoptIndex; // if nothing else works, revert to the option with smallest value
+ Status = VarSetValue (popupSel->ControlData.ControlVariable,
+ UefiGetQuestionOffset (popupSel->ControlData.ControlPtr),
+ (UefiGetWidth (popupSel->ControlData.ControlPtr) > sizeof (UINT16)) ? sizeof (UINT16) : UefiGetWidth (popupSel->ControlData.ControlPtr),
+ &(popupSel->PtrTokens[TempoptIndex].Value) );
+ }
+ // either case (found default, reverted to first value)we have changed the variable so notify application
+ }
+ }
+ }
+ MemFreePointer( (VOID **)&temp );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: RearrangeBootDriverOrderVariable
+//
+// Description: Function to rearrange the boot/driver order variables
+//
+// Input: POPUPSEL_DATA *popupSel, UINT8 bIncrease
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID RearrangeBootDriverOrderVariable (POPUPSEL_DATA *popupSel, UINT8 bIncrease)
+{
+ UINTN optionNumber,size;
+ UINT16 newOption, *optionList = NULL;
+ VOID *ifrData = popupSel->ControlData.ControlPtr;
+ FRAME_DATA *MainFrame = NULL ;
+ UINTN OptionCount = 0;
+
+ MainFrame = gApp->PageList[gApp->CurrentPage]->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+ //Find newOption
+ if (
+ (VARIABLE_ID_BOOT_ORDER == popupSel->ControlData.ControlVariable) ||
+ (VARIABLE_ID_DRIVER_ORDER == popupSel->ControlData.ControlVariable) //EIP70421 & 70422 Support for driver order
+ )
+ {
+ (VARIABLE_ID_BOOT_ORDER == popupSel->ControlData.ControlVariable) ? (OptionCount = gBootOptionCount) : (OptionCount = gDriverOptionCount);
+ optionNumber = UefiGetQuestionOffset (ifrData) / sizeof(UINT16);
+ size = 0;
+ optionList = (UINT16 *)VarGetVariable (popupSel->ControlData.ControlVariable, &size);
+ //EIP-75352 Suppress the warnings from static code analyzer
+ if (NULL == optionList){
+ return;
+ }
+
+ if(optionList[optionNumber] == DISABLED_BOOT_OPTION)
+ newOption = DISABLED_BOOT_OPTION;
+ else
+ {
+ if(bIncrease)
+ {
+ if(0 == optionNumber)
+ {
+ //MAY CHANGE: cant increase priority further
+ newOption = optionList [optionNumber];
+ }
+ else
+ {
+ newOption = optionList [optionNumber - 1];
+ //EIP:50878
+ if (IsUpdateBootOrderCursor ())
+ _FrameScroll (MainFrame, TRUE);
+ }
+ }
+ else
+ {
+ if ( (optionNumber+1) >= OptionCount )
+ {
+ //MAY CHANGE: cant decrease priority further
+ newOption = optionList [optionNumber];
+ }
+ else if ( DISABLED_BOOT_OPTION == optionList[optionNumber+1] )
+ {
+ //MAY CHANGE: cant decrease priority further
+ newOption = optionList [optionNumber];
+ }
+ else
+ {
+ newOption = optionList [optionNumber + 1];
+ //EIP:50878
+ if (IsUpdateBootOrderCursor ())
+ _FrameScroll ( MainFrame, FALSE);
+ }
+ }
+ }
+
+ //Free Optionlist
+ MemFreePointer((VOID **) &optionList);
+ }
+//#if TSE_CSM_SUPPORT
+ else if(popupSel->ControlData.ControlVariable == VARIABLE_ID_BBS_ORDER)
+ {
+ CsmRearrangeBBSOrderVariable(popupSel, bIncrease, &newOption);
+ }
+//#endif //TSE_CSM_SUPPORT
+
+ //Call callback to the container to record this change in gVariableList(cached copy)
+ if ( popupSel->Cookie != NULL )
+ {
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)popupSel->Cookie;
+
+ callbackData->Variable = popupSel->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ifrData);
+ callbackData->Length = UefiGetWidth(ifrData);
+ callbackData->Data = (VOID *)&newOption;
+
+ popupSel->Callback( popupSel->Container, popupSel, popupSel->Cookie );
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: RearrangeBBSOrderVariable
+//
+// Description: Function to reorder the BBS order variable
+//
+// Input: POPUPSEL_DATA *popupSel, UINT8 bIncrease,UINT16 *newOption
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID RearrangeBBSOrderVariable(POPUPSEL_DATA *popupSel, UINT8 bIncrease,UINT16 *newOption)
+{
+ UINTN optionNumber,size;
+ UINT16 *optionList = NULL;
+ VOID *ifrData = popupSel->ControlData.ControlPtr;
+ UINT8 *pDevOrder;
+ UINT16 count = 0;
+ UINTN offset = UefiGetQuestionOffset(ifrData);
+ FRAME_DATA *MainFrame = NULL ;
+ MainFrame = gApp->PageList[gApp->CurrentPage]->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+
+ size = 0;
+ pDevOrder = VarGetVariable( VARIABLE_ID_BBS_ORDER, &size );
+
+ offset -= (sizeof(UINT32) + sizeof(UINT16));
+
+ count = gCurrLegacyBootData->LegacyDevCount;
+ offset -= gCurrLegacyBootData->LegacyEntryOffset;
+ optionList = (UINT16 *)(pDevOrder + gCurrLegacyBootData->LegacyEntryOffset + sizeof(UINT32) + sizeof(UINT16));
+
+ optionNumber = offset / sizeof(UINT16);
+
+ if(optionList[optionNumber] == DISABLED_BOOT_OPTION)
+ *newOption = DISABLED_BOOT_OPTION;
+ else
+ {
+ if(bIncrease)
+ {
+ if(0 == optionNumber)
+ {
+ //MAY CHANGE: cant increase priority further
+ *newOption = optionList[optionNumber];
+ }
+ else
+ {
+ *newOption = optionList[optionNumber - 1];
+ //EIP:50878
+ if(IsUpdateBootOrderCursor())
+ _FrameScroll( MainFrame, TRUE);
+ }
+
+ }
+ else
+ {
+ if( (optionNumber+1) >= count )
+ {
+ //MAY CHANGE: cant decrease priority further
+ *newOption = optionList[optionNumber];
+ }
+ else if( DISABLED_BOOT_OPTION == optionList[optionNumber+1] )
+ {
+ //MAY CHANGE: cant decrease priority further
+ *newOption = optionList[optionNumber];
+ }
+ else
+ {
+ *newOption = optionList[optionNumber + 1];
+ //EIP:50878
+ if(IsUpdateBootOrderCursor())
+ _FrameScroll( MainFrame, FALSE);
+ }
+ }
+ }
+ //Free Order
+ MemFreePointer((VOID **) &pDevOrder);
+}
+
+//EIP81603 Starts
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------------------------------------------------
+// Procedure: _GetPopUpSelectionFromVariable
+//
+// Description: Fucntion to return the current selection based on the variable. If not matched with variable value
+// Selection will be 0
+//
+// Input: POPUPSEL_DATA *
+//
+// Output: VOID
+//
+//-----------------------------------------------------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _GetPopUpSelectionFromVariable (POPUPSEL_DATA *popupSel)
+{
+ VOID *temp;
+ VOID *ifrData = popupSel->ControlData.ControlPtr;
+ int i = 0;
+
+ popupSel->Sel = 0;
+ temp = EfiLibAllocateZeroPool (8 * 2);
+ if (NULL == temp)
+ return;
+
+ if (VarGetValue (popupSel->ControlData.ControlVariable, UefiGetQuestionOffset (ifrData), UefiGetWidth (ifrData), temp) == EFI_SUCCESS)
+ {
+ while (i< popupSel->ItemCount)
+ {
+ if (popupSel->PtrTokens [i].Value == *(UINT64 *)temp)
+ {
+ popupSel->Sel = (UINT16)i;
+ break;
+ }
+ i++;
+ }
+ }
+}
+//EIP81603 Ends
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSelGetControlHeight
+//
+// Description: function to get the height of the label
+//
+// Input: POPUPSEL_DATA *popupSel,Frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSelGetControlHeight(POPUPSEL_DATA *popupSel,VOID * frame, UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *text=NULL, *text1=NULL, *newtext=NULL ;
+ UINT16 Width ;
+ UINT16 tmpHeight=0;
+ UINTN Len=0;
+
+ UINT16 Index = 0;
+ UINT16 *OptionList=NULL;
+ UINT64 *ValueList=NULL;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+
+ if(TseLiteIsSpecialOptionList((CONTROL_DATA *)popupSel) != TRUE)
+ {
+ Status = UefiGetOneOfOptions(&popupSel->ControlData,&popupSel->PopupSelHandle,
+ &OptionList, &ValueList, &popupSel->ItemCount,NULL,NULL);
+ if (EFI_ERROR(Status))
+ return Status;
+ for( Index = 0; Index < popupSel->ItemCount; Index++ )
+ {
+ popupSel->PtrTokens[Index].Option = OptionList[Index];
+ popupSel->PtrTokens[Index].Value = ValueList[Index];
+ }
+ MemFreePointer( (VOID **)&(OptionList));
+ MemFreePointer( (VOID **)&(ValueList));
+ }
+
+ Width = (UINT16)(popupSel->LabelMargin - (((FRAME_DATA*)frame)->FrameData.Left + (UINT8)gLabelLeftMargin));
+
+ *height = 1 ;
+
+// _PopupSelGetSelection( popupSel ); //EIP81603 One-of forced to new value but new value not passed to RouteConfig
+ _GetPopUpSelectionFromVariable (popupSel); //In _PopupSelGetSelection fnc, boot manager variable behaving wrongly so introduced _GetPopUpSelectionFromVariable fnc
+ //to read simply value from variable and set the option and not setting any value to variable
+
+ text1 = HiiGetString( popupSel->PopupSelHandle, popupSel->PtrTokens[popupSel->Sel].Option);
+
+ //EIP 68920: Check for invalid string token
+ if (text1 != NULL)
+ {
+ //Len = TestPrintLength( text1 ) / (NG_SIZE);
+ Len = (3 + (TestPrintLength( text1 ) / (NG_SIZE))) * sizeof(CHAR16);
+
+ text = EfiLibAllocateZeroPool(Len);
+ newtext = EfiLibAllocateZeroPool(Len);
+
+ if ( text == NULL || newtext == NULL)
+ return EFI_OUT_OF_RESOURCES;
+
+ MemCpy(newtext, text1, Len);
+
+ SPrint( text,(UINTN)( Len ), L"[%s]", newtext );
+
+ MemFreePointer( (VOID **)&text1 );
+ MemFreePointer( (VOID **)&newtext );
+
+ text1 = StringWrapText( (CHAR16*)text, (UINT16)(((FRAME_DATA *)frame)->FrameData.Width - gLabelLeftMargin - 2 - popupSel->LabelMargin), &tmpHeight );
+ MemFreePointer( (VOID **)&text1 );
+
+ *height = tmpHeight;
+
+ MemFreePointer( (VOID **)&text );
+ }
+
+ text = HiiGetString( popupSel->ControlData.ControlHandle, popupSel->Title ) ;
+
+ if(text == NULL)
+ return EFI_OUT_OF_RESOURCES;
+
+ text1 = StringWrapText(text, Width, &tmpHeight );
+
+ if ((tmpHeight >= 1) && ( OneofMultilineDisable(popupSel)))
+ {
+ *height = tmpHeight;
+ }
+ else if(tmpHeight > *height)
+ *height = tmpHeight;
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&text );
+ MemFreePointer( (VOID **)&text1 );
+ }
+
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+}
+BOOLEAN TseSuppressOneofMultilineSupport(VOID);
+BOOLEAN OneofMultilineDisable(POPUPSEL_DATA *popupSel)
+{
+ if((UefiIsOneOfControl(popupSel->ControlData.ControlPtr))&&(TseSuppressOneofMultilineSupport()))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/PopupSel.h b/EDK/MiniSetup/TseLite/PopupSel.h
new file mode 100644
index 0000000..7b4050d
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupSel.h
@@ -0,0 +1,229 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupSel.h $
+//
+// $Author: Premkumara $
+//
+// $Revision: 11 $
+//
+// $Date: 8/28/14 6:08a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupSel.h $
+//
+// 11 8/28/14 6:08a Premkumara
+// EIP-135253 Updating file name proper in #include
+//
+// 10 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 9 11/21/11 11:10a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 8 11/13/11 1:06p Arunsb
+// [TAG] EIP70421
+// [Category] New Feature
+// [Description] Support for driver order in TSE
+// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
+// boot.c,
+// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
+// addbootoption.c,
+// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
+// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
+// TseElink.h, variable.h,
+// setup.h, Boot.vfr and Setup.uni
+//
+// 7 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PopupSel.h
+//
+// Description: Header file for Popup selections
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _POPUPSEL_H_
+#define _POPUPSEL_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+#include "ListBox.h"
+
+#define POPUPSEL_VALUE_BASE UINT64
+#define POPUPSEL_MAX_WIDTH (gControlRightAreaWidth)
+typedef struct _PTRTOKENS
+{
+ UINT16 Option;
+ POPUPSEL_VALUE_BASE Value;
+}PTRTOKENS;
+
+#define POPUPSEL_MEMBER_VARIABLES \
+ UINT16 Title; \
+ UINT8 LabelFGColor; \
+ UINT8 NSelLabelFGColor; \
+ UINT16 LabelMargin; \
+ UINT8 SelFGColor; \
+ UINT8 SelBGColor; \
+ UINT8 NSelFGColor; \
+ LISTBOX_DATA *ListBoxCtrl; \
+ BOOLEAN ListBoxEnd; \
+ /*EFI_HII_HANDLE*/VOID * PopupSelHandle; \
+ UINT16 Sel; \
+ UINT16 ItemCount; \
+ UINT16 bInteractive; \
+ UINT16 CallBackKey; \
+ PTRTOKENS *PtrTokens; \
+ UINT8 Interval;
+
+
+typedef struct _POPUPSEL_METHODS POPUPSEL_METHODS;
+
+typedef struct _POPUPSEL_DATA
+{
+ POPUPSEL_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ POPUPSEL_MEMBER_VARIABLES
+
+}
+POPUPSEL_DATA;
+
+
+struct _POPUPSEL_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+};
+
+extern POPUPSEL_METHODS gPopupSel;
+
+// Object Methods
+EFI_STATUS PopupSelCreate( VOID **object );
+EFI_STATUS PopupSelDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS PopupSelInitialize( VOID *object, VOID *data );
+EFI_STATUS PopupSelDraw( VOID *object );
+EFI_STATUS PopupSelHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS PopupSelSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS PopupSelSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS PopupSelSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS PopupSelSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS PopupSelSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS PopupSelGetControlHeight( VOID *object,VOID *frame, UINT16 *height );
+
+VOID _PopupSelCallback( POPUPSEL_DATA *container, CONTROL_DATA *popupSel, VOID *cookie );
+VOID RearrangeBootDriverOrderVariable (POPUPSEL_DATA *popupSel, UINT8 bIncrease); //EIP70421 & 70422 Support for driver order
+
+#endif /* _POPUPSEL_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/PopupString.c b/EDK/MiniSetup/TseLite/PopupString.c
new file mode 100644
index 0000000..35fb02e
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupString.c
@@ -0,0 +1,1283 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupString.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 42 $
+//
+// $Date: 8/28/14 3:04p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupString.c $
+//
+// 42 8/28/14 3:04p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 41 8/28/14 12:44p Premkumara
+// [TAG] EIP177886
+// [Category] Bug Fix
+// [Severity:] Normal
+// [Symptom:] Mouse pointer flicker continuously when softkbd is launched
+// for string control
+// [Root Cause] MouseRefresh() function is been called continuously when
+// popupedit is launched
+// [Solution] Calling MouseRefresh() function only when mouse pointer is
+// on Edit area or over cursor
+// [Files] PopupString.c
+//
+// 40 5/02/14 9:41p Arunsb
+// EIP141986 changes reverted.
+//
+// 39 5/02/14 10:52a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 38 5/01/14 3:45p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 37 2/11/14 8:39p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 36 12/03/13 2:15p Premkumara
+// [TAG] EIP130420
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] String is getting truncated
+// [RootCause] The string for messagebox, Popup controls is getting
+// truncated
+// [Solution] Used temp variable to store original string and modify the
+// string temp and used to avoid changing org string.
+// [Files] String.c
+//
+// 35 12/03/13 1:13p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 34 7/01/13 9:41a Premkumara
+// [TAG] EIP127021
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Clearing string in interactive String control causes setup
+// crash
+// [RootCause] Memory for PopupString->Text is allocated with length of
+// typed string and trying to get current string using PopupString max
+// value size in VarGetValue() function
+// [Solution] Allocating PopupString->Text properly based on popupstring
+// max value once string is cleared
+// [Files] PopupString.c
+//
+// 33 5/22/13 11:03a Premkumara
+// [TAG] EIP123432
+// [Category] Bug Fix
+// [Issue Faced] Take print screen for save & Exit msg box. OK
+// of msg box is consumed by Save & Exit msg box.
+// - Cursor is missing after taking print screen of popupedit box in
+// string control
+// - Printscreen support is not given for Filebrowser feature
+// [RootCause] - When msg box for Save&Exit is popped and printscreen
+// event is called and displaying msg box over Save&Exit. Then msgbox
+// handleaction for printscreen event will change the result value in
+// _CallbackMsgbox() function so it will break the while loop in
+// _CallbackGetValue() function so destroy the next msg box in
+// CallbackShowMessageBox() function.
+// - DrawCursor variable is not set to TRUE after printscreen event
+// [Solution] - Returning EFI_UNSUPPORTED for printscreen event handling
+// function for messgebox and change the result value to 0xff
+// - Support given for file browser feature
+// [Files] Callback.c, MessageBox.c, Minisetupext.c, PopupString.c,
+// AddBootOption.c
+// AmiTSEStr.uni, FakeToken.c
+//
+// 32 4/17/13 12:04p Arunsb
+// EIP118949; Commented error messagebox in interactive callback failure
+// case.
+//
+// 31 2/22/13 12:46p Blaines
+// [TAG] - EIP 115724
+// [Category]- Defect
+// [Symptom]- Multiline support for Hii String control does not wrap the
+// string in some cases issues.
+//
+// [Root cause]
+// In the functions PopupStringGetControlHeight and PopupStringDraw,
+// the computed width of the right column is incorrect,
+// causing the height to be 1, defaulting to string truncation.
+//
+// [Files]
+// - PopupString.c
+//
+// [Functions]
+// - PopupStringDraw
+// - PopupStringGetControlHeight
+//
+// 30 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 19 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 28 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 26 8/29/12 8:32a Premkumara
+// [TAG] EIP 91364
+// [Category] Improvement
+// [Description] Token to disable the Cursor of TSE Password Dialog
+// [Files] AMITSE.sdl, CommonHelper.c, Postmgmtext.c, PopupPassword.c,
+// PopupString.c
+//
+// 25 5/25/12 2:42a Premkumara
+// [TAG] EIP90894
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Assert happening in Add/Del Boot/Driver option
+// [RootCause] PopupString->Textwidth is not handled properly when empty
+// string is entered
+// [Solution] Handled PopupString->Textwidth properly
+// [Files] PopupString.c
+//
+// 24 4/27/12 2:42a Rajashakerg
+// [TAG] EIP86346
+// [Category] Improvement
+// [Description] Cursor visibility is not proper in multiline string
+// controls
+// [Files] PopupEdit.c, PopupString.c
+//
+// 23 11/30/11 11:28a Premkumara
+// [TAG] EIP67695
+// [Category] Improvement
+// [Description] No cursor visible in setup, while editing text input
+// box
+// [Files] Buffer.c, Postmgmtext.c, PopupString.c, PopupPassword.c
+//
+// 22 11/21/11 11:08a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 21 11/21/11 8:58a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 20 11/16/11 7:58a Premkumara
+// [TAG] EIP75522 & 75517
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Accepts invalid String for string control, mismatch in
+// string length
+// [RootCause] Invalid strings are not validated using
+// CallbackShowMessageBox() function.
+// Improper in PopupString->textwidth before and after string entered.
+// Previous string is not retained.
+// [Solution] - Displaying Invalid error message for invalid string by
+// calling CallbackShowMessageBox() function
+// - PopupString->Textwidth is handled proper
+//
+// [Files] PopupString.c
+//
+// 19 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 18 8/26/11 2:10p Blaines
+// [TAG] EIP 67487
+// [Category] Defect
+// [Symptom] TSE_MULTILINE_CONTROLS does not work for all control types
+// [RootCause] The controls (PopupSel, PopupString) ONLY check for
+// string wrapping in the label value (control prompt) when calling the
+// methods GetControlHeight and Draw.
+// [Solution] The controls (PopupSel, PopupString) should check for
+// string wrapping in the label (control prompt) and the control's value
+// when calling the methods GetControlHeight and Draw. For Dynamic pages,
+// adjust the width calculation for Submenu in the function
+// GetControlHeight.
+// [Files] PopupSel.c, PopupString.c, Submenu.c
+//
+// 17 6/23/11 3:52p Rajashakerg
+// [TAG] EIP55762, 58925, 59971
+// [Category] New Feature
+// [Description] Support REF2,REF3 and REF4 in AMITSE
+// Support direct form navigation path
+// Improper layout of controls in the root page when Dynamic pages are
+// added using the Legacy Setup Style
+//
+// [Files] setupdata.h, CommonHelper.c, AMITSE.sdl, Legacy\Legacy.c,
+// Legacy\style.h, Legacy\style.h, frame.c, minisetupext.c,
+// minisetupext.h, numeric.c, page.c Popupstring.c, Hii.c,
+// Uefi21Wrapper.c, Parse.c Hii.c
+//
+// 16 3/28/11 9:25p Madhans
+// [TAG] EIP41744
+// [Category] Improvement
+// [Description] SoftKeyBoard Support in TSE. and Support to Work with
+// new mouse driver(Label 07).
+// [Files] HookAnchor.h
+// AMITSE.sdl
+// CommonHelper.c
+// commonoem.c
+// commonoem.h
+// HookList.c
+// HookAnchor.c
+// Mouse.c
+// minisetupext.c
+// postmgmtext.c
+// minisetupext.h
+// PopupPassword.c
+// PopupString.c
+// TseLiteCommon.c
+//
+// 15 3/21/11 12:42a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 14 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 13 12/29/10 9:40a Mallikarjunanv
+// [TAG] EIP51143
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] popup string value field is not grayed out even if the
+// grayoutif condition satisfies.
+// [RootCause] Not handled the color selection for grayout control in
+// case of popupstring.
+// [Solution] Fixed the issue by setting the color to grayout in case of
+// a grayout popupsting control.
+//
+// [Files] PopupString.c
+//
+// 11 12/26/10 4:16p Mallikarjunanv
+// [TAG] EIP48387
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Displayed message as "Invalid input range" for the
+// specified string as boot option name (for eg., "aaaa").
+// [RootCause] In case of pressing ECS key the string length of Popup
+// string is not considered.
+// [Solution] Fixed the issue by handling Report message box display
+// with
+// respect to Popup string text.
+// [Files] PopupString.c
+//
+// 10 12/02/10 6:08p Madhans
+// [TAG] - EIP49562
+// [Category]- Improvment.
+// [Severity]- Mordarate
+// [Symptom]- Need to support UEFI 2.2 requirements related to Calling
+// Formcallback with
+// EFI_BROWSER_ACTION_CHANGING and EFI_BROWSER_ACTION_CHANGED action.
+// [Solution]- Implemented the support.
+// [Files] - submenu.c, numeric.c, popupsel.c, popupString.c,
+// uefi20\hii.h, uefi20\uefi20wrapper.c
+// uefi21\hiicalback.c, uefi21\tseuefihii.h
+//
+// 9 12/02/10 2:34p Madhans
+// [TAG] - EIP 48169
+// [Category]- Enhancement
+// [Severity]- Mordarate
+// [Symptom]- Code Cleanup and Compiler Warning need to resolved.
+// [Rootcause] Warnings reported when we build AMI higher Warning level.
+// [Solution]- 1. Fix the warnings and do the code cleanup.
+// 2. Introduce proper checks.
+// 3. change the popupSel.c to not change the Option/variable
+// cache to default or first option
+// when the variable cache is not matching with any of
+// option.
+// [Files] - commonoem.c bbs.c boot.c hiistring.c resource.c
+// popuppassword.c popupsel.c
+// expression.c hii.c parse.c
+//
+// 8 10/04/10 4:24p Blaines
+// In the function _DoPopupStringEdit, call gPopupEdit.SetType before
+// calling gPopupEdit.Initialize. This is useful in case the function
+// gPopupEdit.Initialize is overriden.
+//
+// 7 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 11 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 10 2/17/10 7:03p Madhans
+// To suppor readonly control
+//
+// 9 2/15/10 10:15p Madhans
+// To avoid warnings
+//
+// 8 2/05/10 6:05p Madhans
+// To fix the Screen corruption if mouse pointer is on the popup.
+//
+// 7 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 6 1/09/10 6:58a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 5 1/04/10 10:40a Mallikarjunanv
+// EIPs 27161/29095 - Added support for reserved boot option names and
+// added support not to create empty boot option names
+//
+// 4 8/13/09 1:20p Blaines
+// EIP #24980 Fix to properly display right area text
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 5/07/09 10:36a Madhans
+// Changes after Bin module
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PopupStirng.c
+//
+// Description: This file contains code to handle Popup Stirngs
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+UINTN gCursorLeft,gCursorTop ;
+POPUP_STRING_METHODS gPopupString =
+{
+ PopupStringCreate,
+ PopupStringDestroy,
+ PopupStringInitialize,
+ PopupStringDraw,
+ PopupStringHandleAction,
+ PopupStringSetCallback,
+ PopupStringSetFocus,
+ PopupStringSetPosition,
+ PopupStringSetDimensions,
+ PopupStringSetAttributes,
+ PopupStringGetControlHeight
+
+};
+extern UINTN gInvalidRangeFailMsgBox;
+extern UINTN gAddBootOptionReserved;
+extern CALLBACK_VARIABLE gPopupEditCb ;
+extern UINT8 res ;
+
+VOID BbsStrnCpy ( CHAR16 *Dst, CHAR16 *Src, UINTN Length );
+BOOLEAN IsTSECursorSupport(); //EIP-91364
+BOOLEAN IsMouseOnSoftkbd(VOID); //EIP-177886
+VOID GetCoordinates(INT32 *x, INT32 *y, INT32 *z);
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringCreate
+//
+// Description: this function uses the create function of control
+// and creates popup strings
+//
+// Input: TPOPUP_STRING_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringCreate( POPUP_STRING_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(POPUP_STRING_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gPopupString;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys popup strings
+//
+// Input: POPUP_STRING_DATA *popupstring, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringDestroy( POPUP_STRING_DATA *popupstring, BOOLEAN freeMem )
+{
+ if(NULL == popupstring)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( popupstring, FALSE );
+
+ MemFreePointer( (VOID **)&popupstring->Text );
+
+ if( freeMem )
+ MemFreePointer( (VOID **)&popupstring );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringDestroy
+//
+// Description: this function uses the Initialize function of control
+// and initializes popup strings
+//
+// Input: POPUP_STRING_DATA *popupstring, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringInitialize( POPUP_STRING_DATA *popupstring, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( popupstring, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ SetControlColorsHook(NULL, NULL,
+ NULL, NULL,
+ &(popupstring->SelBGColor), &(popupstring->SelFGColor),
+ &(popupstring->BGColor), &(popupstring->FGColor),
+ NULL,&(popupstring->LabelFGColor),
+ &(popupstring->NSelLabelFGColor),
+ NULL,NULL,
+ NULL,NULL );
+
+ popupstring->ControlData.ControlHelp = UefiGetHelpField(popupstring->ControlData.ControlPtr);
+ popupstring->Interval = (UINT8)popupstring->ControlData.ControlFlags.ControlRefresh;
+
+ popupstring->TextMargin = (UINT8)gControlLeftMargin;
+ if ( popupstring->TextWidth == 0 )
+ popupstring->TextWidth = UefiGetWidth(((CONTROL_INFO *)data)->ControlPtr) /2;
+
+ popupstring->TextAreaWidth = (popupstring->TextWidth </*10*/(UINT16)(popupstring->Width - popupstring->TextMargin -2) ) ? popupstring->TextWidth:/*10*/(UINT16)(popupstring->Width - popupstring->TextMargin -2);
+
+ popupstring->Text = EfiLibAllocateZeroPool((popupstring->TextWidth +1)* sizeof(CHAR16));
+ MemSet( popupstring->Text, (popupstring->TextWidth +1)* sizeof(CHAR16), 0 );
+
+
+ popupstring->TempText = EfiLibAllocateZeroPool((popupstring->TextWidth +1)* sizeof(CHAR16));
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringDraw
+//
+// Description: this function is to draw the popup strings
+//
+// Input: POPUP_STRING_DATA *popupstring
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringDraw(POPUP_STRING_DATA *popupstring )
+{
+ CHAR16 *text, *text1=NULL;
+ UINT16 tmpHeight=0;
+ UINTN Len = 0;
+ UINT8 BGClr,FGClr;
+ EFI_STATUS Status = EFI_SUCCESS;
+ //UINT8 ColorNSel = popupstring->FGColor;
+ UINT8 ColorLabel = (popupstring->ControlFocus) ? popupstring->LabelFGColor : popupstring->NSelLabelFGColor ;
+ VOID *ifrData = popupstring->ControlData.ControlPtr;
+
+ if(popupstring->ControlFocus)
+ {
+ BGClr = popupstring->SelBGColor;
+ FGClr = popupstring->SelFGColor;
+ }
+ else
+ {
+ BGClr = popupstring->BGColor;
+ FGClr = popupstring->FGColor;
+ }
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( popupstring->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &popupstring->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ FGClr = ColorLabel = CONTROL_GRAYOUT_COLOR; //EIP_51143 - to display the control value in grayout color
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ text = HiiGetString( popupstring->ControlData.ControlHandle, UefiGetPromptField(popupstring->ControlData.ControlPtr));
+
+ if ( text != NULL )
+ {
+ CHAR16 *temptxt = NULL;
+
+ temptxt = (CHAR16 *)EfiLibAllocateZeroPool( (UefiGetWidth(ifrData)+1) * sizeof(CHAR16) );
+
+ //get the string value to check for string length
+ VarGetValue( popupstring->ControlData.ControlVariable, UefiGetQuestionOffset(ifrData), UefiGetWidth(ifrData), (VOID *)temptxt );
+ if (temptxt){
+ Len = TestPrintLength( temptxt ) / (NG_SIZE);
+ MemFreePointer( (VOID **)&temptxt );
+ }
+
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(popupstring->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( popupstring->Left , popupstring->Top,
+ (UINTN)(popupstring->TextMargin - popupstring->Left),(UINTN) popupstring->Height, text,
+ (UINT8)( (!Len && popupstring->ControlFocus) ? (popupstring->SelBGColor | popupstring->SelFGColor) : (popupstring->BGColor | ColorLabel) ) //make it to focus when no string is given
+ );
+ }
+ else
+ {
+ // use frame width minus margins as available space
+ // boundary overflow check
+ if (( TestPrintLength( text ) / (NG_SIZE)) > (UINTN)(popupstring->TextMargin - popupstring->Left) )
+ //EfiStrCpy(&text[HiiFindStrPrintBoundary(text,(UINTN)(popupstring->Width - 5))],L"...");
+ text[HiiFindStrPrintBoundary(text,(UINTN)(popupstring->TextMargin - popupstring->Left ))] = L'\0';
+
+ DrawStringWithAttribute( popupstring->Left ,
+ popupstring->Top, text,
+ (UINT8)( (!Len && popupstring->ControlFocus) ? (popupstring->SelBGColor | popupstring->SelFGColor) : (popupstring->BGColor | ColorLabel) ) //Make it to focus when no string is given
+ );
+ }
+ //PopUpString has to display the string besides the title; need not fill with space here
+ //for(i=(UINT16)(popupstring->Left + EfiStrLen( text )/*popupstring->TextWidth*/); i < popupstring->Width; i++)
+ // DrawStringWithAttribute( i, popupstring->Top, L" ", BGClr | FGClr );
+
+ MemFreePointer( (VOID **)&text );
+ }
+
+ if(ifrData)
+ {
+ //get the string value
+ VarGetValue( popupstring->ControlData.ControlVariable, UefiGetQuestionOffset(ifrData), UefiGetWidth(ifrData), (VOID *)popupstring->Text );
+
+ Len = TestPrintLength( popupstring->Text ) / (NG_SIZE);
+
+ if(Len)
+ {
+ text = EfiLibAllocateZeroPool((Len+1)*2);
+ EfiStrCpy(text, popupstring->Text);
+
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(popupstring->Height>1 && IsTSEMultilineControlSupported())
+ {
+ text1 = StringWrapText( (CHAR16*)text, (popupstring->Width - popupstring->TextMargin ), &tmpHeight );
+
+ if(tmpHeight > 1)
+ {
+ DrawMultiLineStringWithAttribute( (UINTN)popupstring->Left + (UINTN)popupstring->TextMargin,
+ (UINTN) popupstring->Top,
+ (UINTN)(popupstring->Width - popupstring->TextMargin ),
+ (UINTN)popupstring->Height, (CHAR16*)text,
+ (UINT8) (popupstring->ControlFocus ? (popupstring->SelBGColor | popupstring->SelFGColor) : (popupstring->BGColor | ColorLabel) )
+ );
+ }
+ else
+ {
+ DrawStringWithAttribute( popupstring->Left + popupstring->TextMargin,
+ popupstring->Top, text,
+ (UINT8) (popupstring->ControlFocus ? (popupstring->SelBGColor | popupstring->SelFGColor) : (popupstring->BGColor | ColorLabel) )
+ );
+ }
+
+ MemFreePointer( (VOID **)&text1 );
+ MemFreePointer( (VOID **)&text );
+
+ }
+ else
+ {
+ if ( Len > (UINTN)(popupstring->Width - popupstring->TextMargin) )
+ {
+ Len = popupstring->Width - popupstring->TextMargin;
+ EfiStrCpy( &(text[Len-3 /*3 for "..."*/]), L"..." );
+ }
+
+ DrawStringWithAttribute ( popupstring->Left + popupstring->TextMargin , popupstring->Top, text,
+ (UINT8) (popupstring->ControlFocus ? (popupstring->SelBGColor | popupstring->SelFGColor) : (popupstring->BGColor | ColorLabel) )
+ );
+
+ MemFreePointer( (VOID **)&text );
+ }
+
+ }
+
+
+ // erase extra spaces if neccessary
+ //for(;(UINT16)(popupstring->Left + popupstring->TextMargin + Len) < (popupstring->Width);Len++)
+ // DrawStringWithAttribute( popupstring->Left + popupstring->TextMargin +Len , popupstring->Top, L" ",
+ // BGClr | FGClr);
+ }
+
+ FlushLines( popupstring->Top , popupstring->Top );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringSetCallback
+//
+// Description: function to handle the PopupString actions
+//
+// Input: POPUP_STRING_DATA *popupstring, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringSetCallback( POPUP_STRING_DATA *popupstring, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( popupstring, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringHandleAction
+//
+// Description: function to handle the Popup string actions.
+//
+// Input: POPUP_STRING_DATA *popupstring, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringHandleAction( POPUP_STRING_DATA *popupstring, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ CONTROL_ACTION Action=ControlActionUnknown;
+ VOID * UnicodeInterface;
+ CHAR16 *TmpStr = NULL;
+ CHAR16 *ResStr = NULL;
+ CHAR16 *TmpPopupStringText = NULL;
+ UINT16 TmpPopupStringTextWidth = 0;
+ UINT8 u8ChkResult;
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ if (popupstring->Interval == 0)
+ return Status;
+
+ if(IsActiveControlPresent(gApp->PageList[gApp->CurrentPage]))
+ return Status;
+
+ if ( --(popupstring->Interval) == 0 )
+ {
+ // initialize the interval
+ popupstring->Interval = (UINT8)(popupstring->ControlData.ControlFlags.ControlRefresh);
+ return UefiRefershQuestionValueNvRAM(&(popupstring->ControlData));
+ }
+ else
+ return Status;
+ }
+
+ u8ChkResult = CheckControlCondition( &popupstring->ControlData );
+
+ //Not to perform action for grayoutif-control when token TSE_SETUP_GRAYOUT_SELECTABLE is enable to set focus for GrayoutIf control
+ if ( IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT) ) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if(popupstring->ControlData.ControlFlags.ControlReadOnly)
+ return EFI_UNSUPPORTED;
+
+ if ( Data->Input.Type == ACTION_TYPE_MOUSE )
+ {
+ //Get mapping
+
+ //EIP-123727 check whether MouseTop is within the Height and Width of popupstring or not
+ if( (Data->Input.Data.MouseInfo.Top >= (UINT32)popupstring->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(popupstring->Top+popupstring->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)popupstring->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(popupstring->Left+popupstring->Width))
+ )
+ {
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+ }
+ }
+
+ if ( Data->Input.Type == ACTION_TYPE_KEY )
+ {
+ //Get mapping
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+ }
+
+ if(ControlActionSelect == Action)
+ {
+ //Taking backup of original string.
+ TmpPopupStringText = EfiLibAllocateZeroPool((popupstring->TextWidth + 1) * sizeof(CHAR16));
+ if(NULL == TmpPopupStringText){
+ return EFI_OUT_OF_RESOURCES;
+ }
+ EfiStrCpy(TmpPopupStringText, popupstring->Text);
+
+ //Taking backup of initial string length EIP-75522
+ TmpPopupStringTextWidth = popupstring->TextWidth; //EIP-90894
+
+ // Reading string
+ if(_DoPopupStringEdit( popupstring,UefiGetPromptField(popupstring->ControlData.ControlPtr), &(popupstring->Text)) == EFI_SUCCESS)
+ {
+ UINTN MinVal=0, MaxVal=0;
+ MinVal = (UINTN)UefiGetMinValue(popupstring->ControlData.ControlPtr);
+ MaxVal = (UINTN)UefiGetMaxValue(popupstring->ControlData.ControlPtr);
+
+ //Find length of entered string EIP-75522
+ popupstring->TextWidth = (UINT16)EfiStrLen(popupstring->Text);
+
+ // Check for Range. If its a valid string annd not between min and max report invalid error msg
+ if((popupstring->Text) &&((popupstring->TextWidth < MinVal) || (popupstring->TextWidth > MaxVal)))
+ {
+ //Reset popupstring->Text with initial string EIP-75522
+ if(TmpPopupStringText) {
+ MemFreePointer((VOID **)&popupstring->Text);
+ popupstring->Text = EfiLibAllocateZeroPool((MaxVal + 1) * sizeof(CHAR16)); //EIP-127021 Allocating PopupString->Text based on max size of control
+ if(NULL == popupstring->Text){
+ MemFreePointer((VOID **)&TmpPopupStringText);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ EfiStrCpy(popupstring->Text, TmpPopupStringText);
+ MemFreePointer((VOID **)&TmpPopupStringText);
+ popupstring->TextWidth = TmpPopupStringTextWidth; ////EIP-90894 Resetting width with old one
+ }
+ //Report Message box EIP-75522
+ CallbackShowMessageBox( (UINTN)gInvalidRangeFailMsgBox, MSGBOX_TYPE_OK );
+ return EFI_ABORTED;
+ }
+
+ ///Fix: Eip-27161 - not to allow Reserved boot options to delete
+ if( (popupstring->Text) && (IsReservedBootOptionNamesEnable()) )
+ {
+ ResStr = CONVERT_TO_WSTRING(RESERVED_ADD_DEL_BOOT_OPTION_NAME);
+ TmpStr = EfiLibAllocateZeroPool( EfiStrLen(ResStr)+1);
+ BbsStrnCpy(TmpStr, popupstring->Text, (EfiStrLen(ResStr)+1));
+ TmpStr[EfiStrLen(ResStr)]= L'\0';
+
+ Status = InitUnicodeCollectionProtocol(&UnicodeInterface);
+ if(!EFI_ERROR(Status))
+ {
+ if( StringColl( UnicodeInterface, TmpStr, ResStr) == 0 )
+ {
+ CallbackShowMessageBox( (UINTN)gAddBootOptionReserved, MSGBOX_TYPE_OK );
+ return EFI_ABORTED;
+
+ }
+ }
+ }
+
+ if(popupstring->Callback != NULL)
+ {
+ if ( popupstring->Cookie != NULL )
+ {
+ VOID *ifrData = popupstring->ControlData.ControlPtr;
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)popupstring->Cookie;
+
+ callbackData->Variable = popupstring->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ifrData);
+ callbackData->Length = UefiGetWidth(ifrData);
+ callbackData->Data = (VOID *)popupstring->Text;
+
+ // To support UEFI 2.1.C spec to Not to update the control when Callback fails.
+ UefiPreControlUpdate(&(popupstring->ControlData));
+ popupstring->Callback( popupstring->Container,popupstring, popupstring->Cookie );
+ }
+ }
+ if ( UefiIsInteractive(&popupstring->ControlData) )
+ {
+ VOID * Handle=popupstring->ControlData.ControlHandle;
+ UINT16 Key = UefiGetControlKey(&(popupstring->ControlData));
+ CONTROL_DATA *Control;
+
+ Status = CallFormCallBack(&(popupstring->ControlData),Key,0,AMI_CALLBACK_CONTROL_UPDATE);//EIP-53480: Updated the action to AMI_CALLBACK_CONTROL_UPDATE
+ Control = GetUpdatedControlData((CONTROL_DATA*)popupstring,CONTROL_TYPE_POPUP_STRING,Handle,Key);
+
+ if(Control == NULL) // Control deleted ?
+ return EFI_SUCCESS;
+ if(Control != (CONTROL_DATA*)popupstring)
+ popupstring = (POPUP_STRING_DATA*)Control; //control Updated
+
+ //If error status returned by CallFormCallBack(), reset popupstring->Text with the old string.
+ if(EFI_ERROR(Status))
+ {
+ if(popupstring->Text)
+ MemFreePointer((VOID **)&popupstring->Text);
+ popupstring->Text = EfiLibAllocateZeroPool((TmpPopupStringTextWidth + 1) * sizeof(CHAR16));
+ if(popupstring->Text == NULL){
+ return EFI_OUT_OF_RESOURCES;
+ }
+ if(TmpPopupStringText) {
+ //Resetting old PopupstringText with TmpPopupStringText EIP-75522
+ EfiStrCpy(popupstring->Text, TmpPopupStringText);
+ }
+
+ //Reset string length to initial string TmpPopupStringTextWidth length EIP-75522
+ popupstring->TextWidth = TmpPopupStringTextWidth;
+
+ //Report Message box and return without proceeding further. EIP-75522
+ //CallbackShowMessageBox( (UINTN)gInvalidRangeFailMsgBox, MSGBOX_TYPE_OK ); //All other callback not poping up msg box so commented
+ MemFreePointer((VOID **)&TmpPopupStringText);
+ return EFI_ABORTED;
+
+ }
+
+ }
+ }
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringSetFocus
+//
+// Description: Function to handle the PopupString actions
+//
+// Input: POPUP_STRING_DATA *popuppassword, BOOLEAN focus
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringSetFocus(POPUP_STRING_DATA *popuppassword, BOOLEAN focus)
+{
+ UINT8 u8ChkResult;
+
+ if(focus != FALSE)
+ {
+ u8ChkResult = CheckControlCondition( &popuppassword->ControlData );
+
+ //Setting focus to control which has no control-condtion and token TSE_SETUP_GRAYOUT_SELECTABLE is enable to make GrayoutIf control to focus and selectable
+ if ( ((u8ChkResult != COND_NONE) && (u8ChkResult != COND_GRAYOUT)) ||
+ (!IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT))
+ ){
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ if( !(popuppassword->ControlFocus && focus) )
+ popuppassword->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringSetPosition
+//
+// Description: Function to set position.
+//
+// Input: POPUP_STRING_DATA *popuppassword, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringSetPosition(POPUP_STRING_DATA *popuppassword, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( popuppassword, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: POPUP_STRING_DATA *popuppassword, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringSetDimensions(POPUP_STRING_DATA *popuppassword, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( popuppassword, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: POPUP_STRING_DATA *popuppassword, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringSetAttributes(POPUP_STRING_DATA *popuppassword, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( popuppassword, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupStringGetControlHeight
+//
+// Description: Function to get the lable height of the PopupString
+//
+// Input: POPUP_STRING_DATA *popupstring, frame, UINT16 *height
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupStringGetControlHeight(POPUP_STRING_DATA *popupstring, VOID * frame, UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width=0, tmpHeight=0;
+ VOID *ifrData = popupstring->ControlData.ControlPtr;
+
+ if(ifrData)
+ {
+ //get the string value
+ VarGetValue( popupstring->ControlData.ControlVariable, UefiGetQuestionOffset(ifrData), UefiGetWidth(ifrData), (VOID *)popupstring->Text );
+ newText = StringWrapText( popupstring->Text,
+ (UINT16)(((FRAME_DATA *)frame)->FrameData.Width - gLabelLeftMargin - popupstring->TextMargin - 2 ), &tmpHeight );
+
+ *height = tmpHeight;
+ MemFreePointer( (VOID **)&newText );
+ }
+
+ Width = (UINT16)(popupstring->TextMargin - (((FRAME_DATA*)frame)->FrameData.Left + (UINT8)gControlLeftPad));
+ text = HiiGetString( popupstring->ControlData.ControlHandle, UefiGetPromptField(popupstring->ControlData.ControlPtr));
+
+ newText = StringWrapText( text, Width, &tmpHeight );
+
+ if(tmpHeight > *height)
+ *height = tmpHeight;
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+ }
+ else
+ {
+ *height = 1 ;
+ }
+ return EFI_SUCCESS;
+}
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _CBPopupStringEdit
+//
+// Description: Function for PopupStringEdit callback.
+//
+// Input: VOID *container, VOID *object, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _CBPopupStringEdit(VOID *container, VOID *object, VOID *cookie)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ if(cookie!=NULL)
+ {
+
+ res=0;
+ }
+ else
+ res=1; // exit with no changes to string
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PopupStringEditGetValue
+//
+// Description: function to get values for popup menu using edit functions.
+//
+// Input: POPUP_STRING_DATA *popupedit
+//
+// Output: UINTN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _PopupStringEditGetValue( POPUPEDIT_DATA *popupedit )
+{
+ ACTION_DATA *action = gApp->Action;
+ BOOLEAN DrawCursor = TRUE;//EIP:67695
+ EFI_STATUS Status = EFI_SUCCESS;//EIP:67695
+ INT32 MousePointerX = 0,MousePointerY = 0,MousePointerZ = 0;
+
+ gPopupEdit.SetCallback( popupedit, NULL, _CBPopupStringEdit, &gPopupEditCb );
+ gPopupEdit.SetDimensions( popupedit, popupedit->Width , popupedit->Height );
+ res = (UINT8)-1;
+
+ TSEStringReadLoopEntryHook();
+
+ while ( res == (UINT8)-1 )
+ {
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ gAction.ClearAction( action );
+
+ GetCoordinates (&MousePointerX, &MousePointerY, &MousePointerZ); //EIP-177886
+ if (gST->ConOut)
+ {
+ if (
+ ( ((MousePointerX/HiiGetGlyphWidth ()) <= (UINT32)gST->ConOut->Mode->CursorColumn+1) && ((MousePointerX/HiiGetGlyphWidth ()) >= (UINT32)gST->ConOut->Mode->CursorColumn-1) ) &&
+ ( ((MousePointerY/HiiGetGlyphHeight ()) <= (UINT32)gST->ConOut->Mode->CursorRow+1) && ((MousePointerY/HiiGetGlyphHeight ()) >= (UINT32)gST->ConOut->Mode->CursorRow-1) ) //EIP79486 Stop the mouse if mouse poiner is over the text cursor useful for avoiding corruption
+ )
+ MouseStop ();
+ else
+ {
+ if ( !IsMouseOnSoftkbd() )
+ MouseFreeze ();
+ }
+ }
+
+ gPopupEdit.Draw( popupedit );
+ DoRealFlushLines();
+
+ if (IsTSECursorSupport()) //EIP-91364
+ {
+ if (TRUE == DrawCursor) //EIP:67695 Enabling at valid times
+ {
+ gST->ConOut->SetAttribute (gST->ConOut, popupedit->FGColor | popupedit->BGColor);
+ gST->ConOut->SetCursorPosition (gST->ConOut, gCursorLeft, gCursorTop);//EIP 86346 : Providing the calculated Cursor position values.
+ gST->ConOut->EnableCursor (gST->ConOut, TRUE);
+ DrawCursor = FALSE;
+ }
+ }
+ if ( !IsMouseOnSoftkbd() )
+ MouseRefresh();
+
+ if ( gAction.GetAction( action ) != EFI_SUCCESS )
+ continue;
+
+ if( ( action->Input.Type == ACTION_TYPE_KEY ) &&
+ (TsePrintScreenEventSupport(action->Input.Data.AmiKey.Key.ScanCode) ) )
+ {
+ gApplication.HandleAction( gApp, action );
+ DrawCursor = TRUE; //EIP-123432 If print screen is taken then Drawcursor is made true.
+ continue;
+ }
+ Status = gPopupEdit.HandleAction( popupedit, action );
+ if (IsTSECursorSupport() && !((EFI_ERROR (Status))))//EIP:67695
+ {
+ DrawCursor = TRUE; //EIP:67695 If any valid action performed then draw the cursor, useful for blinking
+ }
+ }
+ TSEStringReadLoopExitHook();
+
+ return res;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _DoPopupStringEdit
+//
+// Description: Function to initiate PopupString editing
+//
+// Input: POPUP_STRING_DATA PopupString, UINT16 Title, CHAR16 **Text
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _DoPopupStringEdit( POPUP_STRING_DATA *PopupString, UINT16 Title, CHAR16 **Text)
+{
+ static UINT8 gIFRPopupEdit[50];
+ EFI_STATUS Status= EFI_SUCCESS;
+
+ UINT8 retValue = (UINT8)-1;
+
+ POPUPEDIT_DATA *popupedit = NULL;
+
+ CONTROL_INFO dummy;
+ BOOLEAN PreviousCursorState = gST->ConOut->Mode->CursorVisible;//EIP:67695
+
+ Status = gPopupEdit.Create( &popupedit );
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ MemSet( &dummy, sizeof(dummy), 0 );
+ dummy.ControlHandle = PopupString->ControlData.ControlHandle;
+ MemCopy( &gIFRPopupEdit, (VOID*)PopupString->ControlData.ControlPtr, UefiGetIfrLength(PopupString->ControlData.ControlPtr));
+
+ // gIFRPopupEdit.Prompt = Title;
+ UefiSetPromptField ((VOID*)&gIFRPopupEdit,Title);
+
+ dummy.ControlPtr = (VOID*)&gIFRPopupEdit;
+ dummy.ControlFlags.ControlVisible = TRUE;
+
+ //gPopupEdit.SetTitle(popupedit,Title);
+ gPopupEdit.SetText(popupedit,*Text);
+ gPopupEdit.SetType( popupedit, POPUPEDIT_TYPE_STRING );
+ Status = gPopupEdit.Initialize( popupedit, &dummy );
+ if ( EFI_ERROR( Status ) )
+ goto Done;
+
+ //gPopupEdit.SetType( popupedit, POPUPEDIT_TYPE_STRING );
+ retValue = (UINT8)_PopupStringEditGetValue( popupedit );
+ if (IsTSECursorSupport()) //EIP-91364
+ {
+ gST->ConOut->EnableCursor(gST->ConOut, PreviousCursorState);//EIP:67695
+ }
+ if(retValue ==0)
+ {
+ // string changed, save to nvram or do whatever needs to be done
+ MemFreePointer( (VOID **)Text );
+ *Text = EfiLibAllocateZeroPool( (gPopupEditCb.Length+1) * sizeof(CHAR16) );
+ if ( Text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ EfiStrCpy( *Text, gPopupEditCb.Data );
+ }
+Done:
+ gPopupEdit.Destroy( popupedit, TRUE );
+ return Status;
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/PopupString.h b/EDK/MiniSetup/TseLite/PopupString.h
new file mode 100644
index 0000000..404ac6b
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/PopupString.h
@@ -0,0 +1,200 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupString.h $
+//
+// $Author: Premkumara $
+//
+// $Revision: 9 $
+//
+// $Date: 8/28/14 6:08a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/PopupString.h $
+//
+// 9 8/28/14 6:08a Premkumara
+// EIP-135253 Updating file name proper in #include
+//
+// 8 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 7 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 2/15/10 10:15p Madhans
+// To avoid warnings
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: popupstring.h
+//
+// Description: Header file for popupstring control
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _POPUP_STRING_H_
+#define _POPUP_STRING_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+#include "action.h"
+#include "Label.h"
+#include "PopupEdit.h"
+
+#define POPUP_STRING_MEMBER_VARIABLES \
+ CHAR16 *TempText; \
+ UINT16 TextMargin; \
+ UINT16 MinSize; \
+ UINT16 MaxSize; \
+ UINT16 TextWidth; \
+ UINT16 TextAreaWidth; \
+ UINT8 LabelFGColor; \
+ UINT8 NSelLabelFGColor; \
+ UINT8 LabelMargin; \
+ UINT8 Interval;
+
+typedef struct _POPUP_STRING_METHODS POPUP_STRING_METHODS;
+
+typedef struct _POPUP_STRING_DATA
+{
+ POPUP_STRING_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ LABEL_MEMBER_VARIABLES
+ POPUP_STRING_MEMBER_VARIABLES
+
+}
+POPUP_STRING_DATA;
+
+#define POPUP_STRING_METHOD_FUNCTIONS
+
+
+struct _POPUP_STRING_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ POPUP_STRING_METHOD_FUNCTIONS
+
+};
+
+extern POPUP_STRING_METHODS gPopupString;
+
+// Object Methods
+EFI_STATUS PopupStringCreate( VOID **object );
+EFI_STATUS PopupStringDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS PopupStringInitialize( VOID *object, VOID *data );
+EFI_STATUS PopupStringDraw( VOID *object );
+EFI_STATUS PopupStringHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS PopupStringSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS PopupStringSetFocus( VOID *object, BOOLEAN focus);
+EFI_STATUS PopupStringSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS PopupStringSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS PopupStringSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS PopupStringGetControlHeight(VOID *object, VOID *frame, UINT16 *height);
+
+EFI_STATUS _DoPopupStringEdit( POPUP_STRING_DATA *PopupString, UINT16 Title, CHAR16 **Text);
+
+#endif /* _POPUP_STRING_H_ */
+
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/ResetButton.c b/EDK/MiniSetup/TseLite/ResetButton.c
new file mode 100644
index 0000000..4849c48
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/ResetButton.c
@@ -0,0 +1,297 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ResetButton.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 5 $
+//
+// $Date: 10/18/12 6:03a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ResetButton.c $
+//
+// 5 10/18/12 6:03a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 2 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 4 11/21/11 11:06a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 3 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 2 5/18/11 11:58a Madhans
+// To Avoid Build issue when Multiline support is enabled.
+//
+// 1 3/28/11 4:02p Rajashakerg
+// Added to support reset opcode.
+//
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: ResetButton.c
+//
+// Description: This file contains code to handle the uefi actions
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "Minisetup.h"
+
+RESET_BUTTON_METHODS gResetButton =
+{
+ ResetButtonCreate,
+ LabelDestroy,
+ ResetButtonInitialize,
+ ResetButtonDraw,
+ ResetButtonHandleAction,
+ LabelSetCallback,
+ LabelSetFocus,
+ LabelSetPosition,
+ LabelSetDimensions,
+ LabelSetAttributes,
+ LabelGetControlHeight
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ResetButtonCreate
+//
+// Description: Function to create an ResetButton Control.
+//
+// Input: VOID **object
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ResetButtonCreate( VOID **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(RESET_BUTTON_DATA) );
+
+ if ( *object == NULL )
+ {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ ((RESET_BUTTON_DATA*)(*object))->Methods = &gResetButton;
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ResetButtonInitialize
+//
+// Description: Function to Initialize an Action Control.
+//
+// Input: VOID *object, VOID *data
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ResetButtonInitialize( VOID *object, VOID *data )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ RESET_BUTTON_DATA *ResetButton = (RESET_BUTTON_DATA*) object;
+
+ Status = gControl.Initialize( ResetButton, data );
+ if (EFI_ERROR(Status))
+ {
+ goto DONE;
+ }
+
+ // add extra initialization here...
+ ResetButton->ControlData.ControlHelp = ResetButton->ControlData.ControlHelp? ResetButton->ControlData.ControlHelp :
+ UefiGetHelpField(ResetButton->ControlData.ControlPtr);
+
+ SetControlColorsHook(NULL, NULL, NULL, NULL, &(ResetButton->SelBGColor), &(ResetButton->SelFGColor),
+ &(ResetButton->BGColor), &(ResetButton->FGColor), NULL, NULL, NULL, NULL, NULL, NULL, NULL );
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ResetButtonDraw
+//
+// Description: Function to draw ResetButton.
+//
+// Input: VOID *object
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ResetButtonDraw( VOID *object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ RESET_BUTTON_DATA *ResetButton = (RESET_BUTTON_DATA*) object;
+
+ CHAR16 *text;
+ UINT16 token = 0;
+ UINT8 ColorLabel = ResetButton->FGColor;
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( ResetButton->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &ResetButton->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ Status = EFI_UNSUPPORTED;
+ goto DONE;
+ break;
+ }
+ //}
+
+ token = UefiGetPromptField(ResetButton->ControlData.ControlPtr);
+ text = HiiGetString( ResetButton->ControlData.ControlHandle, token);
+
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(ResetButton->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( ResetButton->Left , ResetButton->Top,
+ (UINTN)(ResetButton->Width),(UINTN) ResetButton->Height,
+ text,(UINT8)( (ResetButton->ControlFocus) ?
+ ResetButton->SelBGColor | ResetButton->SelFGColor :
+ ResetButton->BGColor | ColorLabel ));
+
+
+ }
+ else
+ {
+ // use frame width minus margins as available space
+ // boundary overflow check
+ if ( (TestPrintLength( text) / (NG_SIZE)) > (UINTN)(ResetButton->Width))
+ text[HiiFindStrPrintBoundary(text,(UINTN)(ResetButton->Width))] = L'\0';
+
+ DrawStringWithAttribute( ResetButton->Left , ResetButton->Top, text,
+ (UINT8)( (ResetButton->ControlFocus) ?
+ ResetButton->SelBGColor | ResetButton->SelFGColor :
+ ResetButton->BGColor | ColorLabel /*Action->FGColor*/ ));
+ }
+
+ MemFreePointer( (VOID **)&text );
+ FlushLines( ResetButton->Top , ResetButton->Top );
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ResetButtonHandleAction
+//
+// Description: Function to handle the ResetButton.
+//
+// Input: VOID *object, ACTION_DATA *data
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ResetButtonHandleAction(VOID *object, ACTION_DATA *data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ RESET_BUTTON_DATA *ResetButton = (RESET_BUTTON_DATA*) object;
+ CONTROL_ACTION CtrlAction;
+ UINT16 DefaultId = 0;
+
+ if (( data->Input.Type == ACTION_TYPE_KEY )|| (data->Input.Type == ACTION_TYPE_MOUSE))
+ {
+ if( data->Input.Type == ACTION_TYPE_KEY )
+ CtrlAction = MapControlKeysHook(data->Input.Data.AmiKey);
+ else
+ {
+ CtrlAction = MapControlMouseActionHook(&data->Input.Data.MouseInfo);
+ }
+ switch(CtrlAction)
+ {
+ case ControlActionSelect:
+ //call a wapper function to update the Default vaule
+ DefaultId = UefiGetResetButtonDefaultid( ResetButton->ControlData.ControlPtr );
+
+ if(0xFFFF == DefaultId)
+ return EFI_UNSUPPORTED;
+
+ Status = UefiupdateResetButtonDefault(ResetButton->ControlData,DefaultId);
+ break;
+
+ default:
+ break;
+ }
+ }
+ return Status;
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/ResetButton.h b/EDK/MiniSetup/TseLite/ResetButton.h
new file mode 100644
index 0000000..99e1cc4
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/ResetButton.h
@@ -0,0 +1,106 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ResetButton.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:03a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ResetButton.h $
+//
+// 2 10/18/12 6:03a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 2 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 3/28/11 4:02p Rajashakerg
+// Added to support reset opcode.
+//
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: ResetButton.h
+//
+// Description: Header file for ResetButton data
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _RESET_BUTTON_H_
+#define _RESET_BUTTON_H_
+
+#include "minisetup.h"
+
+#include "control.h"
+#include "action.h"
+
+typedef struct _RESET_BUTTON_METHODS RESET_BUTTON_METHODS;
+
+#define RESET_BUTTON_MEMBER_VARIABLES \
+ LABEL_MEMBER_VARIABLES
+
+typedef struct _RESET_BUTTON_DATA
+{
+ RESET_BUTTON_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ RESET_BUTTON_MEMBER_VARIABLES
+}
+RESET_BUTTON_DATA;
+
+#define RESET_BUTTON_METHOD_FUNCTIONS
+
+struct _RESET_BUTTON_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ RESET_BUTTON_METHOD_FUNCTIONS
+};
+
+extern RESET_BUTTON_METHODS gResetButton;
+
+// Object Methods
+EFI_STATUS ResetButtonCreate( VOID **object );
+EFI_STATUS ResetButtonInitialize( VOID *object, VOID *data );
+EFI_STATUS ResetButtonDraw( VOID *object );
+EFI_STATUS ResetButtonHandleAction(VOID *object, ACTION_DATA *Data);
+
+#endif
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/StyleHook/StyleHook.cif b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.cif
new file mode 100644
index 0000000..6c20309
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.cif
@@ -0,0 +1,49 @@
+<component>
+ name = "TSE Sources - StyleHook"
+ category = ModulePart
+ LocalRoot = "EDK\MiniSetup\TseLite\StyleHook\"
+ RefName = "StyleHook"
+[files]
+"StyleHook.sdl"
+"StyleHook.mak"
+"StyleHook.h"
+"styleHook1.c"
+"styleHook2.c"
+"styleHook3.c"
+"styleHook4.c"
+"styleHook5.c"
+"styleHook6.c"
+"styleHook7.c"
+"styleHook8.c"
+"styleHook9.c"
+"styleHook10.c"
+"styleHook11.c"
+"styleHook12.c"
+"styleHook13.c"
+"styleHook14.c"
+"styleHook15.c"
+"styleHook16.c"
+"styleHook17.c"
+"styleHook18.c"
+"styleHook19.c"
+"styleHook20.c"
+"styleHook21.c"
+"styleHook22.c"
+"styleHook23.c"
+"styleHook24.c"
+"styleHook25.c"
+"styleHook26.c"
+"styleHook27.c"
+"styleHook28.c"
+"styleHook29.c"
+"styleHook30.c"
+"styleHook31.c"
+"styleHook32.c"
+"styleHook33.c"
+"styleHook34.c"
+"styleHook35.c"
+"styleHook36.c"
+"styleHook37.c"
+"styleHook38.c"
+"styleHook39.c"
+<endComponent>
diff --git a/EDK/MiniSetup/TseLite/StyleHook/StyleHook.h b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.h
new file mode 100644
index 0000000..01f1024
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.h
@@ -0,0 +1,147 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/StyleHook.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 3 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/StyleHook.h $
+//
+// 3 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 2 11/09/11 10:07a Premkumara
+// [TAG] EIP74375
+// [Category] Improvement
+// [Description] Control STYLE_HELP_AREA_SCROLLBAR from binary
+// [Files] CommonHelper.c, AMITSE.sdl, StyleHook.h,
+// Legacy\StyleCommon.c, Legacy.sdl,
+// EzportPlus\StyleCommon.c, EzportPlus.sdl, Ezport\StyleCommon.c,
+// Ezport.sdl
+//
+// 1 1/06/11 7:34p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook.h
+//
+// Description: Style Hook List.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "page.h"
+#include "frame.h"
+
+EFI_STATUS StyleGetWindowColor(UINT8 *Color, INTN Level, UINT8 WindowType) ;
+EFI_STATUS StyleGetMessageboxColor( UINT8 MessageBoxType, UINT8 *Color);
+VOID NewStyleHook1(VOID);
+EFI_STATUS StyleControlColor(FRAME_DATA *frame, STYLECOLORS *Colors);
+EFI_STATUS OverRideControlColor(FRAME_DATA *frame, STYLECOLORS *Colors);
+VOID StyleInit( VOID );
+VOID StyleExit( VOID );
+VOID StyleDrawPageBorder( UINT32 page );
+UINT32 StyleGetPageFrames( UINT32 page );
+UINT32 StyleFrameIndexOf( UINT32 frameType );
+VOID StyleBeforeFrame( FRAME_DATA *frame ) ;
+EFI_STATUS StyleFrameDrawable( FRAME_DATA *frame );
+VOID StyleUpdateFrameStrings(PAGE_DATA *page);
+VOID * StyleGetFrameInitData( UINT32 page, UINT32 frame );
+
+EFI_STATUS StyleFrameHandleMouse( FRAME_DATA *frame, MOUSE_INFO MouseInfo);
+EFI_STATUS StyleFrameHandleTimer( FRAME_DATA *frame, ACTION_DATA *action );
+EFI_STATUS StyleFrameHandleKey( FRAME_DATA *frame, EFI_INPUT_KEY Key );
+EFI_STATUS StyleHandleControlOverflow( FRAME_DATA *frame, CONTROL_DATA *control, UINT16 count );
+EFI_STATUS StyleInitializeFrame( FRAME_DATA *frame, UINT32 frameType, PAGE_INFO *data );
+UINT16 StyleGetNavToken( UINT32 page );
+EFI_STATUS StyleAddAdditionalControls( FRAME_DATA *frame, UINT32 controlNumber, BOOLEAN focus );
+
+//EFI_STATUS StyleMenuCallback( FRAME_DATA *frame, MENU_DATA *menu, CALLBACK_MENU *data );
+VOID StyleLabelCallback( FRAME_DATA *frame, LABEL_DATA *label, VOID *cookie );
+
+EFI_STATUS _StyleAddControl( FRAME_DATA *frame, UINT16 type, VOID *data, UINT32 *number, BOOLEAN *focus );
+UINT16 StyleLanguagePage( SUBMENU_DATA *submenu );
+UINT16 StyleBootManagerPage( SUBMENU_DATA *submenu );
+BOOLEAN StyleHelpAreaScrollable(VOID);
+VOID StylePageItemFocus(PAGE_DATA *page, FRAME_DATA *frame );
+VOID StyleSubPageItemFocus(PAGE_DATA *page, FRAME_DATA *frame );
+BOOLEAN StyleGetShadowSupport(VOID);
+VOID StyleDrawScrollBar(FRAME_DATA *frame, UINT32 FirstLine, UINT32 LastLine, UINT32 modVal,
+ UINT32 sizeOfBar, UINT32 numOfBlocks, BOOLEAN bEraseScrollBar);
+
+VOID StyleDrawHelpScrollBar( MEMO_DATA *memo, UINT16 height);
+BOOLEAN IsHelpAreaScrollBarSupport (void);
+
+
+VOID StyleSelectFirstDisplayPage( VOID );
+VOID StyleAddExtraPagesData( VOID );
+EFI_STATUS StyleGetSpecialColor( UINT16 ControlType, UINT8 *Color);
+UINTN StyleGetDateFormat(VOID);
+BOOLEAN StyleShowDay(VOID);
+BOOLEAN StyleGetScrollBehavior(VOID) ;
+
+VOID StyleFrameSetControlPositions(FRAME_DATA *frame, UINT32 *pOtherEnd);
+extern HOTKEY_TEMPLATE gHotKeyInfo[];
+extern UINT32 gHotKeyCount;
+EFI_STATUS StyleFrameAddTitle( FRAME_DATA *frame, UINT32 frameType,CONTROL_INFO * dummy );
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/StyleHook.mak b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.mak
new file mode 100644
index 0000000..cbc2a14
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.mak
@@ -0,0 +1,114 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/StyleHook.mak 2 10/18/12 6:20a Arunsb $
+#
+# $Revision: 2 $
+#
+# $Date: 10/18/12 6:20a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/StyleHook.mak $
+#
+# 2 10/18/12 6:20a Arunsb
+# Updated for 2.16.1235 QA submission
+##
+## 3 10/10/12 12:40p Arunsb
+## Synched the source for v2.16.1232, backup with Aptio
+#
+# 1 1/06/11 7:24p Madhans
+# [TAG] - EIP 51678
+# [Category]- Enhancment
+# [Severity]- Mordarate
+# [Symptom]- If OEMs override the style module parts, If new tse adds
+# new style hook then
+# if the OEM has different style module, even if they don't need use the
+# hook to avoid
+# compilation issue they need touch their style module to add the new
+# hook.
+# [RootCause] - The Original Style Hooks are part of Style module itself.
+# [Solution]- To create Empty style Hook List in TSE core. This will
+# allows the OEM not
+# to change their style module to update newer TSE.
+# [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+# StyleHookx64.lib tselitebin.sdl
+#
+#
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: StyleHook.mak
+#
+# Description:
+# Empty Style Hooks Module part makefile
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+
+STYLEHOOK_INCLUDES = \
+ -I $(TSESRC_DIR) \
+!if "$(TSE_STYLE_SOURCES_SUPPORT)" == "1"
+ -I $(TSE_STYLE_DIR) \
+!endif
+!if "$(TSE_BOARD_SOURCE_SUPPORT)" == "1"
+ -I $(TSE_BOARD_DIR)\
+!endif
+ -I $(TSESRC_DIR)\AMILOGO \
+ -I $(TSELITESRC_DIR) \
+ -I $(UEFISRC_DIR) \
+ -I $(TSEBIN_DIR) \
+ -I $(TSEBIN_DIR)\Inc \
+ -I $(PROJECT_DIR)\Include\Protocol \
+ -I $(PROJECT_DIR) \
+ -I $(PROJECT_DIR)\Include \
+ -I $(BUILD_DIR) \
+
+$(BUILD_DIR)\StyleHook.lib : StyleHook
+
+StyleHook : $(BUILD_DIR)\StyleHook.mak StyleHookBin
+
+$(BUILD_DIR)\StyleHook.mak : $(TSESTYLEHOOK_DIR)\$(@B).cif $(TSESTYLEHOOK_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(TSESTYLEHOOK_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+!if "$(TSE_USE_EDK_LIBRARY)" == "1"
+TSE_DEFAULTS = $(EDK_DEFAULTS)
+!else
+TSE_DEFAULTS = $(BUILD_DEFAULTS)
+!endif
+
+StyleHookBin :
+ $(MAKE) /$(MAKEFLAGS) $(TSE_DEFAULTS)\
+ /f $(BUILD_DIR)\StyleHook.mak all\
+ "MY_INCLUDES=$(STYLEHOOK_INCLUDES)"\
+ "UNI_INCLUDE_PATH=$(TSEBIN_DIR)"\
+ TYPE=LIBRARY \
+ "EXT_HEADERS=$(BUILD_DIR)\token.h"\
+ LIBRARY_NAME=$(BUILD_DIR)\StyleHook.lib\
+ "CFLAGS=$(CFLAGS) /DTSE_FOR_APTIO_4_50"
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/EDK/MiniSetup/TseLite/StyleHook/StyleHook.sdl b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.sdl
new file mode 100644
index 0000000..cb3cf40
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/StyleHook.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = StyleHook_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable StyleHook support in Project"
+End
+
+MODULE
+ Help = "Includes StyleHook.mak to Project"
+ File = "StyleHook.mak"
+End
+
+PATH
+ Name = "TSESTYLEHOOK_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\StyleHook.lib"
+ Parent = "$(TSELITESRC_DIR)\StyleHook\StyleHook$(ARCH).lib"
+ InvokeOrder = ReplaceParent
+End
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook1.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook1.c
new file mode 100644
index 0000000..f076ff5
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook1.c
@@ -0,0 +1,99 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook1.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook1.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:34p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook1.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetPageFrames
+//
+// Description: Function to number of frames
+//
+// Input: UINT32 page
+//
+// Output: UINT32 number of frames
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT32 StyleGetPageFrames( UINT32 page )
+{
+ return 1;
+}
+
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook10.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook10.c
new file mode 100644
index 0000000..2bc80d3
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook10.c
@@ -0,0 +1,97 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook10.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook10.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook10.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleInit
+//
+// Description: Function to initialize style
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleInit( VOID )
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook11.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook11.c
new file mode 100644
index 0000000..61c01f7
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook11.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook11.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook11.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook11.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleDrawPageBorder
+//
+// Description: Function to draw the page border
+//
+// Input: UINT32 page number
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleDrawPageBorder( UINT32 page )
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook12.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook12.c
new file mode 100644
index 0000000..f2b7b6c
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook12.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook12.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook12.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook12.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleSelectFirstDisplayPage
+//
+// Description: Function to set the first display page
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleSelectFirstDisplayPage( VOID )
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook13.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook13.c
new file mode 100644
index 0000000..2aff526
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook13.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook13.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook13.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook13.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleAddExtraPagesData
+//
+// Description: Function to add extra pages
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleAddExtraPagesData(VOID)
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook14.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook14.c
new file mode 100644
index 0000000..62ce22b
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook14.c
@@ -0,0 +1,99 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook14.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook14.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook14.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetWindowColor
+//
+// Description: Function to get window color
+//
+// Input: UINT8 *Color - Window Color
+// INTN Level - Window Level
+// UINT8 Type - Window Type (0->Setup, 1->PostMenu)
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleGetWindowColor(UINT8 *Color, INTN Level, UINT8 WindowType)
+{
+ return EFI_UNSUPPORTED ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook15.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook15.c
new file mode 100644
index 0000000..4d36a59
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook15.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook15.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook15.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook15.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleInitializeFrame
+//
+// Description: Function to Initialize frame
+//
+// Input: FRAME_DATA *frame, UINT32 frameType, PAGE_INFO *data
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleInitializeFrame( FRAME_DATA *frame, UINT32 frameType, PAGE_INFO *data )
+{
+ return EFI_UNSUPPORTED;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook16.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook16.c
new file mode 100644
index 0000000..6539cdb
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook16.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook16.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook16.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook16.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetMessageboxColor
+//
+// Description: Function to get control Messagebox color
+//
+// Input: UINT16 ControlType, UINT8 *Color
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleGetMessageboxColor( UINT8 MessageBoxType, UINT8 *Color)
+{
+ return EFI_UNSUPPORTED;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook17.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook17.c
new file mode 100644
index 0000000..116aed7
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook17.c
@@ -0,0 +1,99 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook17.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook17.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook17.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleDrawScrollBar
+//
+// Description: Function to draw the frame scrollbar
+//
+// Input: FRAME_DATA *frame, UINT32 FirstLine, UINT32 LastLine, UINT32 modVal, UINT32 sizeOfBar, UINT32 numOfBlocks, BOOLEAN bEraseScrollBar
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleDrawScrollBar(FRAME_DATA *frame, UINT32 FirstLine, UINT32 LastLine, UINT32 modVal,
+ UINT32 sizeOfBar, UINT32 numOfBlocks, BOOLEAN bEraseScrollBar)
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook18.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook18.c
new file mode 100644
index 0000000..ebcca35
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook18.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook18.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook18.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook18.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleFrameDrawable
+//
+// Description: Function to determine if frame is drawable
+//
+// Input: FRAME_DATA *frame
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleFrameDrawable( FRAME_DATA *frame )
+{
+ return EFI_SUCCESS ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook19.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook19.c
new file mode 100644
index 0000000..ba9e219
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook19.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook19.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook19.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook19.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetScrollBarColor
+//
+// Description: Function to get scrollbar color
+//
+// Input: VOID
+//
+// Output: FGCOLOR|BGCOLOR
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT8 StyleGetScrollBarColor(VOID)
+{
+ return (EFI_BACKGROUND_BLUE|EFI_WHITE);
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook2.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook2.c
new file mode 100644
index 0000000..4645163
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook2.c
@@ -0,0 +1,102 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook2.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook2.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook2.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: StyleControlColor
+//
+// Description: Adds controls to the frame
+//
+// Input: FRAME_DATA *frame - Pointer to the frame data
+// STYLECOLORS Colors - Color scheme
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else
+// EFI_UNSUPPORTED
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleControlColor(FRAME_DATA *frame, STYLECOLORS *Colors)
+{
+ return EFI_SUCCESS;
+}
+
+
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook20.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook20.c
new file mode 100644
index 0000000..2ccef5a
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook20.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook20.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook20.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook20.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetScrollBarDownArrowColor
+//
+// Description: Function to get scrollbar downarrow color
+//
+// Input: VOID
+//
+// Output: FGCOLOR|BGCOLOR
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT8 StyleGetScrollBarDownArrowColor(VOID)
+{
+ return (EFI_BACKGROUND_BLUE|EFI_WHITE);
+// return (SCROLLBAR_DOWNARROW_FGCOLOR | SCROLLBAR_DOWNARROW_BGCOLOR) ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook21.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook21.c
new file mode 100644
index 0000000..dc629d8
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook21.c
@@ -0,0 +1,100 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook21.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook21.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook21.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleHandleControlOverflow
+//
+// Description: Function to handle control overflow
+//
+// Input: FRAME_DATA *frame, CONTROL_DATA *control, UINT16 count
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleHandleControlOverflow( FRAME_DATA *frame, CONTROL_DATA *control, UINT16 count )
+{
+
+ return EFI_OUT_OF_RESOURCES ;
+}
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook22.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook22.c
new file mode 100644
index 0000000..f41e90b
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook22.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook22.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook22.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook22.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleFrameSetControlPositions
+//
+// Description: Function to set control positioning in a frame
+//
+// Input: FRAME_DATA *frame, UINT32 *pOtherEnd
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleFrameSetControlPositions(FRAME_DATA *frame, UINT32 *pOtherEnd)
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook23.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook23.c
new file mode 100644
index 0000000..ad5c878
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook23.c
@@ -0,0 +1,95 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook23.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook23.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook23.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetScrollBehavior
+//
+// Description: Function to get scroll behavior
+//
+// Input: VOID
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN StyleGetScrollBehavior(VOID)
+{
+ return 1 ;
+}
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook24.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook24.c
new file mode 100644
index 0000000..fbf8be4
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook24.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook24.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook24.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook24.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleFrameHandleTimer
+//
+// Description: Function to handle frame timer action
+//
+// Input: FRAME_DATA *frame, ACTION_DATA *action
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleFrameHandleTimer( FRAME_DATA *frame, ACTION_DATA *action )
+{
+ return EFI_UNSUPPORTED ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook25.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook25.c
new file mode 100644
index 0000000..867a0a8
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook25.c
@@ -0,0 +1,94 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook25.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook25.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook25.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleFrameHandleMouse
+//
+// Description: Function to handle frame using mouse
+//
+// Input: FRAME_DATA *frame,
+// MOUSE_INFO MouseInfo
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleFrameHandleMouse( FRAME_DATA *frame, MOUSE_INFO MouseInfo)
+{
+ return EFI_UNSUPPORTED ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook26.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook26.c
new file mode 100644
index 0000000..bf7dc8b
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook26.c
@@ -0,0 +1,94 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook26.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook26.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook26.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleFrameHandleKey
+//
+// Description: Function to handle frame action keys
+//
+// Input: FRAME_DATA *frame, EFI_INPUT_KEY Key
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleFrameHandleKey( FRAME_DATA *frame, EFI_INPUT_KEY Key )
+{
+ return EFI_UNSUPPORTED ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook27.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook27.c
new file mode 100644
index 0000000..6067aa0
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook27.c
@@ -0,0 +1,95 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook27.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook27.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook27.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetFrameInitData
+//
+// Description: Function to get frame initialization data
+//
+// Input: UINT32 page number, UINT32 frame number
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID *StyleGetFrameInitData( UINT32 page, UINT32 frame )
+{
+ return NULL;
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook28.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook28.c
new file mode 100644
index 0000000..d7ac5ed
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook28.c
@@ -0,0 +1,94 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook28.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook28.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook28.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetNavToken
+//
+// Description: Function to get navigation token
+//
+// Input: UINT32 page
+//
+// Output: UINT16 token number
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT16 StyleGetNavToken( UINT32 page )
+{
+
+ return 0 ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook29.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook29.c
new file mode 100644
index 0000000..8e60ae3
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook29.c
@@ -0,0 +1,94 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook29.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook29.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook29.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleUpdateFrameStrings
+//
+// Description: Function to update frame strings
+//
+// Input: PAGE_DATA *page
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleUpdateFrameStrings( PAGE_DATA *page )
+{
+}
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook3.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook3.c
new file mode 100644
index 0000000..195cbb2
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook3.c
@@ -0,0 +1,101 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook3.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook3.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook3.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetClearScreenColor
+//
+// Description: Function to Get Clear Screen Color
+//
+// Input: VOID
+//
+// Output: STYLE_CLEAR_SCREEN_COLOR
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN StyleGetClearScreenColor(VOID)
+{
+ return (EFI_BACKGROUND_BLUE|EFI_WHITE);
+}
+
+
+
+
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook30.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook30.c
new file mode 100644
index 0000000..30410a3
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook30.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook30.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook30.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook30.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleAddAdditionalControls
+//
+// Description: Function to add additinal controls
+//
+// Input: FRAME_DATA *frame, UINT32 controlNumber, BOOLEAN focus
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleAddAdditionalControls( FRAME_DATA *frame, UINT32 controlNumber, BOOLEAN focus )
+{
+ return EFI_SUCCESS ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook31.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook31.c
new file mode 100644
index 0000000..4fe0f84
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook31.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook31.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook31.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook31.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleSubPageItemFocus
+//
+// Description: This function is called whenever a user returns (or navigates back)
+// from a submenu page causing a complete page redraw. OEMs may use this hook to set item focus.
+// The default behavior sets focus to the previously focused page item.
+//
+// Input: PAGE_DATA *page, FRAME_DATA *frame
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleSubPageItemFocus(PAGE_DATA *page, FRAME_DATA *frame )
+{
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook32.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook32.c
new file mode 100644
index 0000000..7ba48e1
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook32.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook32.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook32.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook32.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StylePageItemFocus
+//
+// Description: This function is called whenever a user navigates to a new page.
+// OEMs may use this hook to set item focus.
+// The default behavior sets focus to the previously focused page item.
+//
+// Input: PAGE_DATA *page, FRAME_DATA *frame
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StylePageItemFocus(PAGE_DATA *page, FRAME_DATA *frame )
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook33.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook33.c
new file mode 100644
index 0000000..cea7ffa
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook33.c
@@ -0,0 +1,97 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook33.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook33.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook33.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleBeforeFrame
+//
+// Description: Function to alter frame styling before frame is drawn
+//
+// Input: FRAME_DATA *frame
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleBeforeFrame( FRAME_DATA *frame )
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook34.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook34.c
new file mode 100644
index 0000000..aa8960a
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook34.c
@@ -0,0 +1,97 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook34.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook34.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook34.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetSpecialColor
+//
+// Description: Function to get control special color
+//
+// Input: UINT16 ControlType, UINT8 *Color
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleGetSpecialColor( UINT16 ControlType, UINT8 *Color)
+{
+ return EFI_UNSUPPORTED ;
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook35.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook35.c
new file mode 100644
index 0000000..40d05dd
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook35.c
@@ -0,0 +1,93 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook35.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook35.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook35.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleDrawHelpScrollBar
+//
+// Description: Function to draw the help frame scrollbar
+//
+// Input: MEMO_DATA *memo, UINT16 height
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleDrawHelpScrollBar( MEMO_DATA *memo, UINT16 height)
+{
+
+}
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook36.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook36.c
new file mode 100644
index 0000000..a3e50fc
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook36.c
@@ -0,0 +1,97 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook36.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook36.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook36.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetShadowSupport
+//
+// Description: Function to get shadow support
+//
+// Input: VOID
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN StyleGetShadowSupport(VOID)
+{
+ return FALSE;
+}
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook37.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook37.c
new file mode 100644
index 0000000..0039684
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook37.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook37.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook37.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook37.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleFrameIndexOf
+//
+// Description: Function to get frame index
+//
+// Input: UINT32 frameType
+//
+// Output: UINT32 index
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT32 StyleFrameIndexOf( UINT32 frameType )
+{
+ return 0 ;
+}
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook38.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook38.c
new file mode 100644
index 0000000..8a4e0db
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook38.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook38.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook38.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook38.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleFrameAddTitle
+//
+// Description: Function to add frame title
+//
+// Input: FRAME_DATA *frame, UINT32 frameType, CONTROL_INFO * dummy
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS StyleFrameAddTitle( FRAME_DATA *frame, UINT32 frameType,CONTROL_INFO * dummy )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook39.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook39.c
new file mode 100644
index 0000000..71ed804
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook39.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook39.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:21a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook39.c $
+//
+// 2 10/18/12 6:21a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:36p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook39.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetScrollBarUpArrowColor
+//
+// Description: Function to get scrollbar UpArrow Color
+//
+// Input: VOID
+//
+// Output: FGCOLOR|BGCOLOR
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT8 StyleGetScrollBarUpArrowColor(VOID)
+{
+ return (EFI_BACKGROUND_BLUE|EFI_WHITE);
+ //return (SCROLLBAR_UPARROW_FGCOLOR | SCROLLBAR_UPARROW_BGCOLOR) ;
+}
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook4.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook4.c
new file mode 100644
index 0000000..3fddbc2
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook4.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook4.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook4.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook4.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleOverRideComponent
+//
+// Description: Function to override component or control functionality
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleOverRideComponent(VOID)
+{
+
+}
+
+
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook5.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook5.c
new file mode 100644
index 0000000..8193683
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook5.c
@@ -0,0 +1,99 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook5.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook5.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook5.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleUpdateVersionString
+//
+// Description: Function to set the version string
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleUpdateVersionString( VOID )
+{
+
+}
+
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook6.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook6.c
new file mode 100644
index 0000000..1ea79a5
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook6.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook6.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook6.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook6.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetStdMaxCols
+//
+// Description: Function to get max number of rows
+//
+// Input: VOID
+//
+// Output: STYLE_STD_MAX_COLS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN StyleGetStdMaxCols(VOID)
+{
+ return 80;
+}
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook7.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook7.c
new file mode 100644
index 0000000..e8b2234
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook7.c
@@ -0,0 +1,98 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook7.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook7.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook7.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetStdMaxRows
+//
+// Description: Function to max number of columns
+//
+// Input: VOID
+//
+// Output: STYLE_STD_MAX_ROWS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN StyleGetStdMaxRows(VOID)
+{
+ return 24;
+}
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook8.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook8.c
new file mode 100644
index 0000000..5a0071b
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook8.c
@@ -0,0 +1,97 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook8.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook8.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook9.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleGetTextMode
+//
+// Description: Function to get text mode
+//
+// Input: UINTN Rows, UINTN Cols
+//
+// Output: UNNTN mode
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN StyleGetTextMode( UINTN Rows, UINTN Cols )
+{
+ return 0;
+}
+
+
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/StyleHook/styleHook9.c b/EDK/MiniSetup/TseLite/StyleHook/styleHook9.c
new file mode 100644
index 0000000..0143163
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/StyleHook/styleHook9.c
@@ -0,0 +1,96 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook9.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:20a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/StyleHook/styleHook9.c $
+//
+// 2 10/18/12 6:20a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 3 10/10/12 12:40p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 1/06/11 7:35p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//
+// Name: StyleHook9.c
+//
+// Description: Contains generic or default style functions.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "minisetup.h"
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: StyleExit
+//
+// Description: Function to do style initialization on exit
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID StyleExit( VOID )
+{
+}
+
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy , Norcross, GA 30071 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/EDK/MiniSetup/TseLite/SubMenu.c b/EDK/MiniSetup/TseLite/SubMenu.c
new file mode 100644
index 0000000..d843ea0
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/SubMenu.c
@@ -0,0 +1,876 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2013, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/SubMenu.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 34 $
+//
+// $Date: 8/28/14 2:50p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/SubMenu.c $
+//
+// 34 8/28/14 2:50p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 33 8/28/14 11:52a Premkumara
+// [TAG] EIP174031
+// [Category] Improvement
+// [Description] Removed TODO comments and added proper comments in those
+// places
+// [Files] commonoem.c, commonhelper.c, special.c, submenu.c,
+// minisetupext.c, uefi21wapper.c and legacy.c
+//
+// 32 5/02/14 9:31p Arunsb
+// EIP141986 changes reverted.
+//
+// 31 5/02/14 10:50a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 30 5/01/14 3:46p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 29 2/11/14 8:33p Arunsb
+// [TAG] EIP146858
+// [Category] Bug Fix
+// [Severity:] Normal
+// [Symptom:] When both MINISETUP_MOUSE_SUPPORT and TSE_MULTILINE_CONTROLS
+// are enabled, only the first line of wrapped controls are clickable
+// [Root Cause] The function SubMenuHandleAction doesn't consider the
+// control’s height when checking mouse select actions.
+// [Solution] The function SubMenuHandleAction includes the controls
+// height when checking mouse select actions
+// [Files] SubMenu.c
+//
+// 28 12/03/13 1:14p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 27 3/12/13 12:28p Rajashakerg
+// [TAG] EIP105167
+// [Category] Improvement
+// [Description] Making the specify setup items departing from F2/F3
+// effect.
+// [Files] AMITSE.sdl, CommonHelper.c, callback.c, minisetupext.h,
+// PopupPassword.c, SubMenu.c, HiiCallback.c
+//
+// 26 3/08/13 1:35a Rajashakerg
+// [TAG] EIP113085
+// [Category] Improvement
+// [Description] Modify callback function behavior to match UEFI SPEC.
+// [Files] HiiCallback.c, PopupPassword.c, SubMenu.c
+//
+// 25 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 13 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 23 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 21 9/06/12 2:18a Rajashakerg
+// [TAG] EIP97333
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Update TSE to V1227, there is a redundant blank line.
+// [RootCause] Co-ordinates calculation was not proper for submenu
+// control
+// [Solution] Provided proper co-ordinates for sub menu control.
+// [Files] SubMenu.c
+//
+// 20 4/19/12 6:09p Blaines
+// [TAG] - EIP 88031
+// [Category]- Defect
+// [Synopsis]- Hii Callbacks may enter infinite loop on
+// BROWSER_ACTION_RETRIEVE
+// [Solution] - Only allow EFI_BROWSER_ACTION_RETRIEVE action for all
+// Interactive controls from MiniSetupEntry.
+// [Files] - Submenu.c, HiiCallback.c,
+//
+// 19 2/01/12 8:05p Blaines
+// [TAG] - EIP 81631
+// [Category]- Sighting
+// [Synopsis]- In some SAS cards, HII Adapter Settings screen is not
+// wrapping the text correctly
+// [Solution] - Use the proper control width calculation to determine
+// control height in PopupSelGetControlHeight.
+// The string length calculation used to determine control height in
+// SubMenuGetControlHeight needs to be consistent with the same in
+// SubMenuDraw.
+//
+// [Files]
+// Submenu.c, PopupSel.c,
+//
+// 18 12/07/11 6:52p Blaines
+// [TAG] - EIP 77046
+// [Category]- Sighting
+// [Synopsis]- In some SAS cards, UEFI Driver submenu entry text are
+// truncated, and do not properly wrap to the next line.
+// [Solution] - In the function SubMenuDraw, truncate string when the
+// length exceeds submenu->Width
+// (when submenu->SubMenuType == 2, and submenu->Height == 1 ).
+//
+// [Files]
+// SubMenu.c
+//
+// [Functions Changed]
+// - SubMenuDraw
+//
+//
+// 17 12/01/11 7:40a Rajashakerg
+// [TAG] EIP75464
+// [Category] Improvement
+// [Description] Improper handling of action controls
+// [Files] SubMenu.c, UefiAction.c, HiiCallback.c, Uefi21Wapper.c
+//
+// 16 11/28/11 4:58a Rajashakerg
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Callback handling :For interactive controls updating
+// the currnet vaule in cache even when hii callback returns error status.
+// [Files] Date.c, SubMenu.c, ordlistbox.c, time.c, UefiAction.c,
+// hii.h, uefi20Wapper.c, HiiCallback.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 15 11/21/11 11:04a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 14 11/21/11 8:58a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 13 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 12 11/08/11 5:10a Rajashakerg
+// Moved the CallFormCallBack() function with retrive action to
+// SubMenuInitialize() function as per the specification.
+//
+// 11 8/26/11 2:10p Blaines
+// [TAG] EIP 67487
+// [Category] Defect
+// [Symptom] TSE_MULTILINE_CONTROLS does not work for all control types
+// [RootCause] The controls (PopupSel, PopupString) ONLY check for
+// string wrapping in the label value (control prompt) when calling the
+// methods GetControlHeight and Draw.
+// [Solution] The controls (PopupSel, PopupString) should check for
+// string wrapping in the label (control prompt) and the control's value
+// when calling the methods GetControlHeight and Draw. For Dynamic pages,
+// adjust the width calculation for Submenu in the function
+// GetControlHeight.
+// [Files] PopupSel.c, PopupString.c, Submenu.c
+//
+// 10 3/21/11 12:44a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 9 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 8 12/02/10 6:08p Madhans
+// [TAG] - EIP49562
+// [Category]- Improvment.
+// [Severity]- Mordarate
+// [Symptom]- Need to support UEFI 2.2 requirements related to Calling
+// Formcallback with
+// EFI_BROWSER_ACTION_CHANGING and EFI_BROWSER_ACTION_CHANGED action.
+// [Solution]- Implemented the support.
+// [Files] - submenu.c, numeric.c, popupsel.c, popupString.c,
+// uefi20\hii.h, uefi20\uefi20wrapper.c
+// uefi21\hiicalback.c, uefi21\tseuefihii.h
+//
+// 7 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 7 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 6 2/15/10 10:15p Madhans
+// To avoid warnings
+//
+// 5 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 4 11/04/09 11:54a Blaines
+// EIP-28247
+//
+// Fix for grayout color menu string not being grayed out.
+//
+//
+//
+// 3 6/23/09 6:53p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Submenu.c
+//
+// Description: This file contains code to handle submenu operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+SUBMENU_METHODS gSubMenu =
+{
+ SubMenuCreate,
+ SubMenuDestroy,
+ SubMenuInitialize,
+ SubMenuDraw,
+ SubMenuHandleAction,
+ SubMenuSetCallback,
+ SubMenuSetFocus,
+ SubMenuSetPosition,
+ SubMenuSetDimensions,
+ SubMenuSetAttributes,
+ SubMenuGetControlHeight
+
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuCreate
+//
+// Description: this function uses the create function of control
+// and create submenu.
+//
+// Input: SUBMENU_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuCreate( SUBMENU_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(SUBMENU_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gSubMenu;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys submenu.
+//
+// Input: SUBMENU_DATA *submenu, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuDestroy( SUBMENU_DATA *submenu, BOOLEAN freeMem )
+{
+ if(NULL == submenu)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( submenu, FALSE );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&submenu );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuDestroy
+//
+// Description: this function uses the initialize function of control
+// and initializes the submenu.
+//
+// Input: SUBMENU_DATA *submenu, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuInitialize( SUBMENU_DATA *submenu, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( submenu, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ if(UefiIsInteractive(&submenu->ControlData))
+ {
+ // EIP88031 : Invoking CallFormCallBackon with AMI_CALLBACK_RETRIEVE
+ // caused infinite loop on FormCallBack when UIUpdateCallback is called during pack update.
+ /*
+ UINT16 Key = UefiGetControlKey(&(submenu->ControlData));
+ UefiPreControlUpdate(NULL);//EIP45464 : Updating the gPrevControlValue buffer to NULLL before invoking CallFormCallBack
+ CallFormCallBack(&(submenu->ControlData),Key,0,AMI_CALLBACK_RETRIEVE);//EIP-53480: Updated the action to AMI_CALLBACK_RETRIEVE
+ */
+ }
+
+ // add extra initialization here...
+ submenu->ControlData.ControlHelp = UefiGetHelpField((VOID *)submenu->ControlData.ControlPtr); //refPtr->Help;
+ submenu->ControlFocus = FALSE;
+ submenu->Interval = (UINT8)submenu->ControlData.ControlFlags.ControlRefresh;
+ submenu->LabelMargin = (UINT8)gControlLeftMargin;
+
+ // initialize default colors
+ SetControlColorsHook(&(submenu->BGColor), &(submenu->FGColor),
+ NULL, NULL,
+ &(submenu->SelBGColor), &(submenu->SelFGColor),
+ &(submenu->NSelBGColor), &(submenu->NSelFGColor),
+ NULL,&(submenu->LabelFGColor) ,
+ &(submenu->NSelLabelFGColor),
+ NULL,NULL,
+ NULL,NULL );
+
+
+
+#if SETUP_STYLE_AWARD
+ submenu->SubMenuType = (UINT8)(submenu->ControlData.ControlPageID != 0);
+#endif
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuDraw
+//
+// Description: function to draw a sub-menu.
+//
+// Input: SUBMENU_DATA *submenu
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuDraw( SUBMENU_DATA *submenu )
+{
+ CHAR16 *text=NULL,*text1;
+ UINTN length;
+ EFI_STATUS Status = EFI_SUCCESS;
+// UINT8 ColorSubMenu = submenu->NSelFGColor;
+ UINT8 ColorLabel = (submenu->ControlFocus) ? submenu->LabelFGColor : submenu->NSelLabelFGColor ;
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( submenu->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &submenu->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ if (!submenu->ControlFocus)//setting grayoutif color for grayoutif control based on token TSE_SETUP_GRAYOUT_SELECTABLE
+ ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ text1 = HiiGetString( submenu->ControlData.ControlHandle, UefiGetPromptField((VOID *)(submenu->ControlData.ControlPtr)));
+ if ( text1 == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ // XXX check to see if text1 is not NULL
+ length = (3 + (TestPrintLength( text1 ) / (NG_SIZE))) * sizeof(CHAR16);
+ text = EfiLibAllocateZeroPool( length );
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ SPrint( text, length, L"%c %s", (submenu->SubMenuType == 2)?L' ':GEOMETRICSHAPE_RIGHT_TRIANGLE, text1 );
+ MemFreePointer( (VOID **)&text1 );
+
+ if ( submenu->SubMenuType != 1 )
+ {
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(submenu->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( submenu->Left , submenu->Top,
+ (UINTN)(submenu->Width),(UINTN) submenu->Height,
+ &text[2], (UINT8)( (submenu->ControlFocus) ?
+ submenu->SelBGColor | ColorLabel /*submenu->SelFGColor*/ :
+ submenu->NSelBGColor | ColorLabel /*ColorSubMenu*/ ) );
+
+ if(submenu->SubMenuType != 2)
+ {
+ text[2]=0;
+ DrawStringWithAttribute( submenu->Left - 2, submenu->Top, (CHAR16*)text,
+ (UINT8)( (submenu->ControlFocus) ?
+ submenu->SelBGColor | ColorLabel /*submenu->SelFGColor*/ :
+ submenu->NSelBGColor | ColorLabel /*ColorSubMenu*/ ) );
+ }
+ }
+ else
+ {
+
+ if(submenu->SubMenuType==0 && !submenu->ControlFocus && ColorLabel != CONTROL_GRAYOUT_COLOR)
+ ColorLabel = StyleGetPageLinkColor();
+
+
+ if(((TestPrintLength( text ) / (NG_SIZE))-2) > (UINTN)(submenu->Width))//EIP 97333 : Check for width corrected since the text already include spaces in it.
+ EfiStrCpy( &text[HiiFindStrPrintBoundary(text,(UINTN)(submenu->Width-2))],L"...");
+
+ DrawStringWithAttribute( submenu->Left - 2, submenu->Top, (CHAR16*)text,
+ (UINT8)( (submenu->ControlFocus) ?
+ submenu->SelBGColor | ColorLabel :
+ submenu->NSelBGColor | ColorLabel ) );
+ }
+ }
+ else
+ {
+ if((TestPrintLength( text ) / (NG_SIZE)) > (UINTN)(submenu->Width-2))
+ EfiStrCpy( &text[HiiFindStrPrintBoundary(text,(UINTN)(submenu->Width-5))],L"...");
+
+ text1 = HiiGetString( gHiiHandle, STRING_TOKEN(STR_SUBMENU_OPTION) );
+ if ( text1 != NULL )
+ {
+ DrawStringWithAttribute( submenu->Left - 2, submenu->Top, (CHAR16*)text,
+ EFI_BACKGROUND_BLUE | EFI_WHITE );
+ MemFreePointer( (VOID **)&text );
+
+ length = (3 + (TestPrintLength( text1 ) / (NG_SIZE))) * sizeof(CHAR16);
+ text = EfiLibAllocatePool( length );
+ if ( text != NULL )
+ {
+ SPrint( text, length, L"[%s]", text1 );
+
+ if ((TestPrintLength( text ) / (NG_SIZE)) > (UINTN)(submenu->Width-2))
+ EfiStrCpy( &text[HiiFindStrPrintBoundary(text,(UINTN)(submenu->Width-5))],L"...");
+
+ DrawStringWithAttribute( submenu->Left + submenu->LabelMargin , submenu->Top, text,
+ (UINT8)(submenu->NSelBGColor | ColorLabel /*ColorSubMenu*/) );
+
+ if ( submenu->ControlFocus )
+ DrawStringWithAttribute( submenu->Left + submenu->LabelMargin + 1,
+ submenu->Top, text1, (UINT8)(submenu->SelBGColor | submenu->SelFGColor) );
+ }
+ }
+ }
+
+ MemFreePointer( (VOID **)&text );
+ MemFreePointer( (VOID **)&text1 );
+
+ FlushLines( submenu->Top, submenu->Top );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuHandleAction
+//
+// Description: function to handle the submenu actions
+//
+// Input: SUBMENU_DATA *submenu, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuHandleAction( SUBMENU_DATA *submenu, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ BOOLEAN Selected = FALSE;
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ if (submenu->Interval == 0)
+ return Status;
+
+ if ( --(submenu->Interval) == 0 )
+ {
+ // initialize the interval
+ submenu->Interval = (UINT8)(submenu->ControlData.ControlFlags.ControlRefresh);
+ return EFI_SUCCESS;
+ }
+ else
+ return Status;
+ }
+
+ if ( ! submenu->ControlFocus )
+ return Status;
+
+ if (Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ //Status = MouseSubMenuHandleAction( submenu, Data);
+ //if ( Data->Input.Data.MouseInfo.ButtonStatus==TSEMOUSE_LEFT_DCLICK )
+
+ if(ControlActionSelect == MapControlMouseActionHook(&Data->Input.Data.MouseInfo))
+ //check whether MouseTop is within the Height and Width of submenu or not
+ if( (Data->Input.Data.MouseInfo.Top >= (UINT32)submenu->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(submenu->Top+submenu->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)submenu->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(submenu->Left+submenu->Width))
+ )//EIP-123727
+ {
+ Selected = TRUE;
+ }
+ }
+
+ if ( Data->Input.Type == ACTION_TYPE_KEY )
+ {
+ if ( ControlActionSelect == MapControlKeysHook(Data->Input.Data.AmiKey) )
+ Selected = TRUE;
+ }
+ if(Selected)
+ {
+ UINT8 u8ChkResult;
+
+ u8ChkResult = CheckControlCondition( &submenu->ControlData );
+
+ //Not to perform action for grayoutif-control when token TSE_SETUP_GRAYOUT_SELECTABLE is enable to set focus for GrayoutIf control
+ if ( IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT) ) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MouseStop();
+
+ if ( submenu->Callback )
+ {
+ if ( submenu->Cookie != NULL )
+ {
+ CALLBACK_SUBMENU *callbackData = (CALLBACK_SUBMENU *)submenu->Cookie;
+ callbackData->DestPage = submenu->ControlData.ControlDestPageID;
+ }
+ UefiPreControlUpdate(NULL);
+ submenu->Callback( submenu->Container, submenu, submenu->Cookie );
+ }
+
+ if(UefiIsInteractive(&submenu->ControlData))
+ {
+ VOID * Handle=submenu->ControlData.ControlHandle;
+ UINT16 Key = UefiGetControlKey(&(submenu->ControlData));
+ CONTROL_DATA *Control;
+
+ Status = CallFormCallBack(&(submenu->ControlData),Key,0,AMI_CALLBACK_CONTROL_UPDATE);//EIP-53480: Updated the action to AMI_CALLBACK_CONTROL_UPDATE
+ // To support UEFI 2.1.C spec to Not to change page when Callback fails.
+ Status = UefiIsProceedWithPageChange(Status);
+ if(Status != EFI_SUCCESS)
+ {
+ if ( submenu->Callback )
+ {
+ if ( submenu->Cookie != NULL )
+ {
+ CALLBACK_SUBMENU *callbackData = (CALLBACK_SUBMENU *)submenu->Cookie;
+ callbackData->DestPage = submenu->ControlData.ControlPageID;
+ }
+ submenu->Callback( submenu->Container, submenu, submenu->Cookie );
+ }
+ // On Error Status Don't Change the Destination page. Skip the user action.
+ return EFI_SUCCESS;
+
+ }
+
+ Control = GetUpdatedControlData((CONTROL_DATA*)submenu,CONTROL_TYPE_SUBMENU,Handle,Key);
+
+ if(Control == NULL) // Control deleted ?
+ return EFI_SUCCESS;
+ if(Control != (CONTROL_DATA*)submenu)
+ submenu = (SUBMENU_DATA*)Control; //control Updated
+ }
+
+ _SubMenuHandleSpecialOp( submenu );
+
+ MouseStart();
+
+
+
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuSetCallback
+//
+// Description: function to handle the submenu actions
+//
+// Input: SUBMENU_DATA *submenu, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuSetCallback( SUBMENU_DATA *submenu, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( submenu, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuSetFocus
+//
+// Description: Function to handle the submenu actions
+//
+// Input: SUBMENU_DATA *submenu, BOOLEAN focus
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuSetFocus(SUBMENU_DATA *submenu, BOOLEAN focus)
+{
+ UINT8 u8ChkResult;
+
+ if(focus != FALSE)
+ {
+ u8ChkResult = CheckControlCondition( &submenu->ControlData );
+
+ //Setting focus to control which has no control-condtion and token TSE_SETUP_GRAYOUT_SELECTABLE is enable to make GrayoutIf control to set focus and selectable
+ if ( ((u8ChkResult != COND_NONE) && (u8ChkResult != COND_GRAYOUT)) ||
+ (!IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT))
+ ){
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ if( !(submenu->ControlFocus && focus) )
+ submenu->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuSetPosition
+//
+// Description: Function to set position.
+//
+// Input: SUBMENU_DATA *submenu, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuSetPosition(SUBMENU_DATA *submenu, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( submenu, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuSetDimensions
+//
+// Description: Function to set dimension.
+//
+// Input: SUBMENU_DATA *submenu, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuSetDimensions(SUBMENU_DATA *submenu, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( submenu, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: SUBMENU_DATA *submenu, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuSetAttributes(SUBMENU_DATA *submenu, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( submenu, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SubMenuGetControlHeight
+//
+// Description: Function to get the label height of the submenu
+//
+// Input: SUBMENU_DATA *submenu, Frame Data, UINT16 *height
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SubMenuGetControlHeight(SUBMENU_DATA *submenu, VOID *frame, UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width;
+ UINTN length=0;
+
+ Width = ((FRAME_DATA *)frame)->FrameData.Width - (UINT8)gLabelLeftMargin - 2 ;
+ text = HiiGetString( submenu->ControlData.ControlHandle, UefiGetPromptField((VOID *)submenu->ControlData.ControlPtr) );
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ length = (3 + (TestPrintLength( text ) / (NG_SIZE))) * sizeof(CHAR16);
+ newText = EfiLibAllocateZeroPool( length );
+
+ if ( newText == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ SPrint( newText, length, L"%c %s", (submenu->SubMenuType == 2)?L' ':GEOMETRICSHAPE_RIGHT_TRIANGLE, text );
+ MemFreePointer( (VOID **)&text);
+
+ text = StringWrapText( newText, Width+2, height );//EIP 97333 : Above we have appeneded the two spaces at begning of sub menu string, so providing proper widht for submenu
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+ }
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+
+}
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/SubMenu.h b/EDK/MiniSetup/TseLite/SubMenu.h
new file mode 100644
index 0000000..491e0da
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/SubMenu.h
@@ -0,0 +1,197 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/SubMenu.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 8 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/SubMenu.h $
+//
+// 8 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: submenu.h
+//
+// Description: Header file for submenu related functionalities
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _SUBMENU_H_
+#define _SUBMENU_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+
+#define SUBMENU_MEMBER_VARIABLES \
+ UINT8 LabelFGColor; \
+ UINT8 NSelLabelFGColor; \
+ UINT8 LabelMargin; \
+ UINT8 SubMenuType; \
+ UINT8 SelFGColor; \
+ UINT8 SelBGColor; \
+ UINT8 NSelFGColor; \
+ UINT8 NSelBGColor; \
+ UINT8 Interval;
+
+typedef struct _SUBMENU_METHODS SUBMENU_METHODS;
+
+typedef struct _SUBMENU_DATA
+{
+ SUBMENU_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ SUBMENU_MEMBER_VARIABLES
+
+}
+SUBMENU_DATA;
+
+#define SUBMENU_METHOD_FUNCTIONS
+
+struct _SUBMENU_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ SUBMENU_METHOD_FUNCTIONS
+};
+
+extern SUBMENU_METHODS gSubMenu;
+
+// Object Methods
+EFI_STATUS SubMenuCreate( VOID **object );
+EFI_STATUS SubMenuDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS SubMenuInitialize( VOID *object, VOID *data );
+EFI_STATUS SubMenuDraw( VOID *object );
+EFI_STATUS SubMenuHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS SubMenuSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS SubMenuSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS SubMenuSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS SubMenuSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS SubMenuSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS SubMenuGetControlHeight(SUBMENU_DATA *submenu, VOID *frame, UINT16 *height);
+
+UINT16 _SubMenuGetSpecialValue( SUBMENU_DATA *submenu );
+BOOLEAN _SubMenuHandleSpecialOp( SUBMENU_DATA *submenu );
+BOOLEAN _SubMenuAmiCallback( UINT16 value );
+
+// find a better place for these
+#define SAVE_AND_EXIT_VALUE 1
+#define DISCARD_AND_EXIT_VALUE 2
+#define SAVE_VALUE 3
+#define DISCARD_VALUE 4
+#define RESTORE_DEFAULTS_VALUE 5
+#define SAVE_USER_DEFAULTS_VALUE 6
+#define RESTORE_USER_DEFAULTS_VALUE 7
+
+
+#endif /* _SUBMENU_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Text.c b/EDK/MiniSetup/TseLite/Text.c
new file mode 100644
index 0000000..a597287
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Text.c
@@ -0,0 +1,587 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Text.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 15 $
+//
+// $Date: 2/11/14 8:34p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Text.c $
+//
+// 15 2/11/14 8:34p Arunsb
+// [TAG] EIP147142
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] text gets truncated
+// [Root Cause] The controls SetText function is called from the function
+// TextDraw to update the properties [text->Label and text->text] using
+// HiiGetString. However, FrameDraw will call each
+// controls->getControlHeight before calling each controls->draw function.
+// It is during this time when text->getControlHeight attempts to use the
+// properties [text->Label and text->text] to compute the height [for
+// multiline] which will be incorrect
+// [Solution] Call the controls SetText function from within the function
+// getControlHeight
+// to ensure the text controls properties [text->Label and text->text]
+// always has valid updated Hii text.
+// [Files] Text.c
+//
+// 14 6/10/13 10:02a Arunsb
+// String retrieval success check in TextInitialize is commented.
+//
+// 13 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 12 2/01/12 5:54p Blaines
+// Rollback to Revision 10
+//
+// 10 11/21/11 10:59a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 9 11/21/11 8:59a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 8 11/15/11 2:28a Rajashakerg
+// [TAG] EIP73391
+// [Category] Improvement
+// [Description] Information displayed in SETUP gets truncated.
+// [Files] Text.c
+//
+// 7 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 6 9/16/10 8:38p Madhans
+// Update for TSE 2.10. Refer Changelog.log for more details.
+//
+// 7 8/18/10 7:17p Madhans
+// [TAG] EIP42199
+// [Category] BUG FIX
+// [Symptom] Text Control does not disply the full string even with
+// multiline TSE support.
+// [RootCause] Bug in TextGetControlHeight()
+// [Solution] Take the Frame width in account instead if Text->Width.
+// [Files] text.c
+//
+// 6 3/26/10 6:53p Madhans
+// Support to Map the do the Control Mapping from gTseControlMap Table. So
+// no changes need in Frame.c, With this feature gTseControlMap Can be
+// customized to add/customize the TSE controls.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/13/09 1:21p Blaines
+// EIP #24980 Fix to properly display right area text
+//
+// 3 6/23/09 6:53p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 5/07/09 10:36a Madhans
+// Changes after Bin module
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: text.c
+//
+// Description: This file contains code to handle text operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+TEXT_METHODS gText =
+{
+ TextCreate,
+ TextDestroy,
+ TextInitialize,
+ TextDraw,
+ TextHandleAction,
+ TextSetCallback,
+ TextSetFocus,
+ TextSetPosition,
+ TextSetDimensions,
+ TextSetAttributes,
+ TextGetControlHeight,
+ TextSetText
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextCreate
+//
+// Description: this function uses the create function of control
+// and creates text
+//
+// Input: TEXT_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextCreate( TEXT_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(TEXT_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gText;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys the text
+//
+// Input: TEXT_DATA *text, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextDestroy( TEXT_DATA *text, BOOLEAN freeMem )
+{
+ if(NULL == text)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( text, FALSE );
+
+ MemFreePointer( (VOID **)&text->LabelText );
+ MemFreePointer( (VOID **)&text->Text );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&text );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextDestroy
+//
+// Description: this function uses the initialize function of control
+// and initializes the text
+//
+// Input: TEXT_DATA *text, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextInitialize( TEXT_DATA *text, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( text, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ SetControlColorsHook(&(text->BGColor), &(text->FGColor),
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL,
+ NULL, NULL,
+ NULL,NULL);
+
+ // add extra initialization here...
+ text->ControlData.ControlHelp = UefiGetHelpField ((VOID*)text->ControlData.ControlPtr);
+ //text->FGColor= EFI_DARKGRAY;
+ StyleGetSpecialColor( CONTROL_TYPE_TEXT, &(text->FGColor)) ;
+
+ text->LabelMargin = (UINT8)gControlLeftMargin;
+
+
+ text->Interval = (UINT8)text->ControlData.ControlFlags.ControlRefresh;
+ text->LabelText = HiiGetString( text->ControlData.ControlHandle, UefiGetTextField((VOID*)text->ControlData.ControlPtr));
+// if ( text->LabelText == NULL ) //EIP122907 In some case in init hiigetstring is failing but in draw its passing so commented this check.
+// return EFI_OUT_OF_RESOURCES;
+
+ text->Text = HiiGetString( text->ControlData.ControlHandle, UefiGetTextTwoField((VOID *)text->ControlData.ControlPtr));
+// if ( text->Text == NULL )
+// return EFI_OUT_OF_RESOURCES;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextDraw
+//
+// Description: function to draw the text with attributes.
+//
+// Input: TEXT_DATA *text
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextDraw( TEXT_DATA *text )
+{
+ CHAR16 *txt =NULL, *txt2 = NULL;
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 ColorText = text->FGColor ;
+
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( text->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &text->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorText = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ txt = HiiGetString( text->ControlData.ControlHandle, UefiGetTextField((VOID*)text->ControlData.ControlPtr));
+ if ( txt == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ txt2 = HiiGetString( text->ControlData.ControlHandle, UefiGetTextTwoField((VOID*)text->ControlData.ControlPtr));
+ if ( txt2 == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ gText.SetText(text,txt,txt2);
+ MemFreePointer ((VOID **)&txt);
+ MemFreePointer ((VOID **)&txt2);
+
+ if ( text->LabelText == NULL )
+ {
+ Status = EFI_UNSUPPORTED;
+ return Status;
+ }
+
+ // labeltext boundary overflow check
+ if(text->Height>1 && IsTSEMultilineControlSupported())//EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ {
+ DrawMultiLineStringWithAttribute( (UINTN)text->Left, (UINTN) text->Top,
+ (UINTN)(text->LabelMargin - text->Left),(UINTN)text->Height,
+ text->LabelText, text->BGColor |ColorText );
+ }
+ else
+ {
+ if ( (TestPrintLength( text->LabelText ) / (NG_SIZE)) > (UINTN)(text->LabelMargin - text->Left )/*21*/ )
+ text->LabelText[HiiFindStrPrintBoundary(text->LabelText ,(UINTN)(text->LabelMargin - text->Left ))] = L'\0';
+
+ DrawStringWithAttribute( text->Left , text->Top, text->LabelText, text->BGColor | ColorText /*text->FGColor*/ );
+ }
+
+ if ( text->Text != NULL )
+ {
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(text->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( (UINTN)text->Left + text->LabelMargin, (UINTN) text->Top,
+ (UINTN)((text->Width + text->Left) - text->LabelMargin -2),(UINTN)text->Height,
+ text->Text, text->BGColor |ColorText );//EIP 73391 : Adjusted the cordinates to show maximum string in control left area
+
+
+ }
+ else
+ {
+ // text boundary overflow check
+ //EIP 73391 : Adjusted the cordinates to show maximum string in control left area
+ if ( (TestPrintLength( text->Text ) / (NG_SIZE)) >= (UINTN)((text->Width + text->Left) - text->LabelMargin -2) )
+ text->Text[HiiFindStrPrintBoundary(text->Text ,(UINTN)((text->Width + text->Left) - text->LabelMargin -2))] = L'\0';
+ DrawStringWithAttribute( text->Left + text->LabelMargin , text->Top, text->Text, text->BGColor |ColorText );
+ }
+ }
+
+ //EIP-72610 if TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ FlushLines(text->Top, text->Top + text->Height - 1);
+ }
+ else
+ {
+ FlushLines(text->Top, text->Top);
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextHandleAction
+//
+// Description: function to handle the text actions
+//
+// Input: TEXT_DATA *text, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextHandleAction( TEXT_DATA *text, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ if ( (Data->Input.Type == ACTION_TYPE_TIMER) && ((UINT8)text->ControlData.ControlFlags.ControlRefresh != 0))
+ {
+ Status = CallTextCallBack(text, Data);
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: TEXT_DATA *text, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextSetCallback( TEXT_DATA *text, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( text, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: TEXT_DATA *text, BOOLEAN focus
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextSetFocus(TEXT_DATA *text, BOOLEAN focus)
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextSetPosition
+//
+// Description: Function to set position.
+//
+// Input: TEXT_DATA *text, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextSetPosition(TEXT_DATA *text, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( text, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextSetDimensions
+//
+// Description: Function to set text dimension.
+//
+// Input: TEXT_DATA *text, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextSetDimensions(TEXT_DATA *text, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( text, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextSetAttributes
+//
+// Description: Function to set text attributes.
+//
+// Input: TEXT_DATA *text, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextSetAttributes(TEXT_DATA *text, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( text, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextSetText
+//
+// Description: function to set the text
+//
+// Input: TEXT_DATA *text, CHAR16 *label, CHAR16 *value
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextSetText( TEXT_DATA *text, CHAR16 *label, CHAR16 *value )
+{
+ if ( label != NULL )
+ {
+ MemFreePointer( &text->LabelText );
+ text->LabelText = StrDup( label );
+ }
+
+ if ( value != NULL )
+ {
+ MemFreePointer( &text->Text );
+ text->Text = StrDup( value );
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TextGetControlHeight
+//
+// Description: function to get the text height
+//
+// Input: TEXT_DATA *text, Frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TextGetControlHeight( TEXT_DATA *text, VOID* frame, UINT16 *height )
+{
+ //EIP-72610 if TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL;
+ UINT16 tmpHeight=0;
+ UINT16 Width;
+
+ //EIP-147142
+ //Make sure text->Label and text->text are updated before computing the control height
+ gText.SetText(text,
+ HiiGetString( text->ControlData.ControlHandle, UefiGetTextField((VOID*)text->ControlData.ControlPtr)),
+ HiiGetString( text->ControlData.ControlHandle, UefiGetTextTwoField((VOID*)text->ControlData.ControlPtr))
+ );
+
+ Width = (UINT16)(text->LabelMargin - (((FRAME_DATA*)frame)->FrameData.Left + (UINT8)gLabelLeftMargin));
+ newText = StringWrapText( text->Text, (UINT16)(((FRAME_DATA *)frame)->FrameData.Width - text->LabelMargin -2), &tmpHeight );
+ *height = tmpHeight;
+ MemFreePointer( (VOID **)&newText );
+
+ newText = StringWrapText( text->LabelText, Width, &tmpHeight );
+
+ if(tmpHeight > *height)
+ *height = tmpHeight;
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ }
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Text.h b/EDK/MiniSetup/TseLite/Text.h
new file mode 100644
index 0000000..8451485
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Text.h
@@ -0,0 +1,154 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Text.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 7 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Text.h $
+//
+// 7 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: text.h
+//
+// Description: Header file for code to handle text operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _TEXT_H_
+#define _TEXT_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+
+#define TEXT_MEMBER_VARIABLES \
+ CHAR16 *LabelText; \
+ UINT16 LabelMargin; \
+ CHAR16 *Text; \
+ UINT8 Interval;
+
+typedef struct _TEXT_METHODS TEXT_METHODS;
+
+typedef struct _TEXT_DATA
+{
+ TEXT_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ TEXT_MEMBER_VARIABLES
+
+}
+TEXT_DATA;
+
+typedef EFI_STATUS (*TEXT_METHOD_SET_TEXT) ( VOID *object, CHAR16 *label, CHAR16 *value );
+#define TEXT_METHOD_FUNCTIONS \
+ TEXT_METHOD_SET_TEXT SetText;
+
+struct _TEXT_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ TEXT_METHOD_FUNCTIONS
+};
+
+extern TEXT_METHODS gText;
+
+// Object Methods
+EFI_STATUS TextCreate( VOID **object );
+EFI_STATUS TextDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS TextInitialize( VOID *object, VOID *data );
+EFI_STATUS TextDraw( VOID *object );
+EFI_STATUS TextHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS TextSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS TextSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS TextSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS TextSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS TextSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+
+// Text Methods
+EFI_STATUS TextSetText( VOID *object, CHAR16 *label, CHAR16 *value );
+EFI_STATUS TextGetControlHeight( VOID *text,VOID *frame, UINT16 *height );
+
+#endif /* _TEXT_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/Time.h b/EDK/MiniSetup/TseLite/Time.h
new file mode 100644
index 0000000..0191381
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/Time.h
@@ -0,0 +1,180 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Time.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 9 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/Time.h $
+//
+// 9 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 8 11/21/11 10:56a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 7 11/10/10 7:02p Blaines
+// EIP 47037: Add range checks to properly edit and update date/time.
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:07p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Time.h
+//
+// Description: Header file for code to handle Time control operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _TIME_H_
+#define _TIME_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+
+typedef struct _TIME
+{
+ UINT8 Hour;
+ UINT8 Min;
+ UINT8 Sec;
+
+}
+TIME;
+
+#define TIME_MEMBER_VARIABLES \
+ UINT8 LabelFGColor; \
+ UINT8 NSelLabelFGColor; \
+ UINT8 LabelMargin; \
+ UINT8 Sel; \
+ UINT8 SelFGColor; \
+ UINT8 SelBGColor; \
+ UINT8 NSelFGColor; \
+ UINT16 Min; \
+ UINT16 Max; \
+ UINT8 Interval; \
+ EFI_TIME *EditTime;
+
+typedef struct _TIME_METHODS TIME_METHODS;
+
+typedef struct _TIME_DATA
+{
+ TIME_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ TIME_MEMBER_VARIABLES
+
+}
+TIME_DATA;
+
+
+
+struct _TIME_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+};
+
+extern TIME_METHODS gTime;
+
+// Object Methods
+EFI_STATUS TimeCreate( VOID **object );
+EFI_STATUS TimeDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS TimeInitialize( VOID *object, VOID *data );
+EFI_STATUS TimeDraw( VOID *object );
+EFI_STATUS TimeHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS TimeSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS TimeSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS TimeSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS TimeSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS TimeSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS TimeGetControlHeight(VOID *object, VOID *frame, UINT16 *height);
+VOID _TimeUpdateHelp( TIME_DATA *time );
+#endif /* _TIME_H_ */
+
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/TseLite.cif b/EDK/MiniSetup/TseLite/TseLite.cif
new file mode 100644
index 0000000..d666012
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/TseLite.cif
@@ -0,0 +1,73 @@
+<component>
+ name = "TSE Sources - TSE Lite"
+ category = ModulePart
+ LocalRoot = "EDK\MiniSetup\TseLite"
+ RefName = "TseLite"
+[files]
+"TseLite.sdl"
+"TseLite.mak"
+"minisetupext.h"
+"application.h"
+"Action.c"
+"action.h"
+"application.c"
+"object.c"
+"object.h"
+"page.c"
+"page.h"
+"control.c"
+"control.h"
+"callback.c"
+"callback.h"
+"hotkey.h"
+"frame.c"
+"frame.h"
+"hotkey.c"
+"SubMenu.h"
+"SubMenu.c"
+"Text.c"
+"Text.h"
+"Menu.c"
+"Menu.h"
+"MessageBox.h"
+"MessageBox.c"
+"Memo.c"
+"Memo.h"
+"popup.c"
+"popup.h"
+"Label.h"
+"Label.c"
+"numeric.c"
+"numeric.h"
+"time.c"
+"Time.h"
+"Date.c"
+"Date.h"
+"edit.c"
+"edit.h"
+"ListBox.c"
+"ListBox.h"
+"PopupPassword.c"
+"PopupPassword.h"
+"PopupSel.c"
+"PopupSel.h"
+"PopupString.c"
+"PopupString.h"
+"PopupEdit.h"
+"PopupEdit.c"
+"ordlistbox.h"
+"ordlistbox.c"
+"TseLitehelper.c"
+"minisetupext.c"
+"variable.c"
+"AddBootOption.c"
+"TseLiteCommon.c"
+"UefiAction.c"
+"UefiAction.h"
+"ResetButton.h"
+"ResetButton.c"
+"hotclick.h"
+"hotclick.c"
+[parts]
+"StyleHook"
+<endComponent>
diff --git a/EDK/MiniSetup/TseLite/TseLite.mak b/EDK/MiniSetup/TseLite/TseLite.mak
new file mode 100644
index 0000000..1feb3d7
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/TseLite.mak
@@ -0,0 +1,124 @@
+##*****************************************************************##
+##*****************************************************************##
+##*****************************************************************##
+##** **##
+##** (C)Copyright 2010, American Megatrends, Inc. **##
+##** **##
+##** All Rights Reserved. **##
+##** **##
+##** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **##
+##** **##
+##** Phone (770)-246-8600 **##
+##** **##
+##*****************************************************************##
+##*****************************************************************##
+##*****************************************************************##
+## $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/TseLite.mak $
+##
+## $Author: Arunsb $
+##
+## $Revision: 7 $
+##
+## $Date: 10/18/12 6:01a $
+##
+##*****************************************************************##
+##*****************************************************************##
+## Revision History
+## ----------------
+## $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/TseLite.mak $
+#
+# 7 10/18/12 6:01a Arunsb
+# Updated for 2.16.1235 QA submission
+##
+## 8 10/10/12 12:38p Arunsb
+## Synched the source for v2.16.1232, backup with Aptio
+#
+# 6 4/23/10 6:05p Madhans
+#
+# 5 2/19/10 1:04p Madhans
+# Updated for TSE 2.01. Refer Changelog.log for File change history.
+##
+## 5 2/19/10 8:18a Mallikarjunanv
+## updated year in copyright message
+##
+## 4 8/17/09 12:27p Presannar
+## Removed include path to Core dir
+##
+## 3 6/24/09 6:11p Madhans
+## Made TSE_USE_EDK_LIBRARY=OFF to not to refer EDK module.
+##
+## 2 6/12/09 7:44p Presannar
+## Initial implementation of coding standards for AMITSE2.0
+##
+## 1 6/04/09 8:05p Madhans
+#
+# 1 4/28/09 11:07p Madhans
+# Tse 2.0 Code complete Checkin.
+##
+## 3 4/28/09 9:40p Madhans
+## Tse 2.0 Code complete Checkin.
+##
+## 2 2/05/09 10:15a Madhans
+## Style Module created.
+##
+## 1 12/18/08 7:59p Madhans
+## Intial version of TSE Lite sources
+##
+##
+##*****************************************************************##
+##*****************************************************************##
+
+# MAK file for the eModule:TseLite
+
+TSELITE_INCLUDES = \
+ -I $(UEFISRC_DIR) \
+ -I $(TSE_STYLE_DIR) \
+ -I $(TSESRC_DIR) \
+ -I $(TSESRC_DIR)\AMILOGO \
+ -I $(TSELITESRC_DIR) \
+ -I $(TSEBIN_DIR) \
+ -I $(TSEBIN_DIR)\Inc \
+!if "$(TSE_BOARD_SOURCE_SUPPORT)" == "1"
+ -I $(TSE_BOARD_DIR)\
+!endif
+ -I $(PROJECT_DIR)\Include\Protocol \
+ -I $(PROJECT_DIR) \
+ -I $(PROJECT_DIR)\Include \
+ -I $(BUILD_DIR) \
+
+$(BUILD_DIR)\TseLiteLocal.lib : TseLiteLib
+
+TseLiteLib : $(BUILD_DIR)\TseLite.mak TseLiteLibBin
+
+$(BUILD_DIR)\TseLite.mak : $(TSELITESRC_DIR)\$(@B).cif $(TSELITESRC_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(TSELITESRC_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+!if "$(TSE_USE_EDK_LIBRARY)" == "1"
+TSE_DEFAULTS = $(EDK_DEFAULTS)
+!else
+TSE_DEFAULTS = $(BUILD_DEFAULTS)
+!endif
+
+TseLiteLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(TSE_DEFAULTS)\
+ /f $(BUILD_DIR)\TseLite.mak all\
+ "MY_INCLUDES=$(TSELITE_INCLUDES)"\
+ "UNI_INCLUDE_PATH=$(TSEBIN_DIR)"\
+ TYPE=LIBRARY \
+ "EXT_HEADERS=$(BUILD_DIR)\token.h"\
+ LIBRARY_NAME=$(BUILD_DIR)\TseLiteLocal.lib\
+ "CFLAGS=$(CFLAGS) /DTSE_FOR_APTIO_4_50"
+
+##*****************************************************************##
+##*****************************************************************##
+##** **##
+##** (C)Copyright 2010, American Megatrends, Inc. **##
+##** **##
+##** All Rights Reserved. **##
+##** **##
+##** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **##
+##** **##
+##** Phone (770)-246-8600 **##
+##** **##
+##*****************************************************************##
+##*****************************************************************##
diff --git a/EDK/MiniSetup/TseLite/TseLite.sdl b/EDK/MiniSetup/TseLite/TseLite.sdl
new file mode 100644
index 0000000..95d74c1
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/TseLite.sdl
@@ -0,0 +1,40 @@
+TOKEN
+ Name = "TseLite_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TseLite sources support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "TSE_LITE_SOURCES_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "POPUP_MENU_ENTER_SETUP"
+ Value = "1"
+ Help = "1 => Allows to enter setup from BBS popup"
+ TokenType = Boolean
+ TargetH = Yes
+End
+
+PATH
+ Name = "TSELITESRC_DIR"
+End
+
+MODULE
+ Help = "Includes TseLite.mak to Project"
+ File = "TseLite.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\TseLiteLocal.lib"
+ Parent = "$(TSELITESRC_DIR)\TseLiteLocal$(ARCH).lib"
+ InvokeOrder = ReplaceParent
+End
+
diff --git a/EDK/MiniSetup/TseLite/TseLiteCommon.c b/EDK/MiniSetup/TseLite/TseLiteCommon.c
new file mode 100644
index 0000000..ac72ff3
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/TseLiteCommon.c
@@ -0,0 +1,433 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2012, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/TseLiteCommon.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 16 $
+//
+// $Date: 8/28/14 9:11a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/TseLiteCommon.c $
+//
+// 16 8/28/14 9:11a Premkumara
+// [TAG] EIP168489
+// [Category] Bug Fix
+// [Severity:] Normal
+// [Symptom:] System will display blue screen after use OEM command to
+// boot to BIOS Setup Utility from Built-in EFI Shell
+// [Files] TseliteCommon.c
+//
+// 15 2/11/14 8:47p Arunsb
+// [TAG] EIP148693
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Slowness in shell performance
+// [Root Cause] Memory fragmentation
+// [Solution] Controlled the TSE destructor with token from sdl file
+// [Files] amitse.sdl, tselitecommon.c
+//
+// 14 6/10/13 10:03a Arunsb
+// gRefreshIdCount made as 0 bcoz exiting from setup and coming back wont
+// reinit it
+//
+// 13 4/18/13 9:31a Arunsb
+// Function moved to avoid build error in 2.0
+//
+// 12 4/15/13 5:40a Arunsb
+// gRefreshIdInfo check added
+//
+// 11 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 9 9/14/12 12:59p Madhans
+// [TAG] EIP101218
+// [Category] Bug Fix
+// [Severity] Critical
+// [Symptom] If Sendform is called more than once from DHP
+// (DriverHealthprotocol Module). It does not enter.
+// [RootCause] SendForm called before postmanagerhandsake was not
+// cleaned gApp correctly.
+// [Solution] Fix to do the cleanup
+// [Files] tselitecommon.c
+//
+// 8 5/28/12 7:29a Rajashakerg
+// [TAG] EIP85564
+// [Category] Improvement
+// [Description] UefiHiiTestPrintLength function needs optimization
+// [Files] TseLiteCommon.c, hiistring21.c
+//
+// 7 4/27/12 7:28a Arunsb
+// [TAG] EIP88449
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] SUT hangs when "Exit Without Saving" prompt is select as
+// 'yes' in setup.
+// [RootCause] gVariablelist freed before calling callback
+// [Solution] gVariablelist freed after calling callback
+// [Files] TseLiteCommon.c
+//
+// 6 3/28/11 9:25p Madhans
+// [TAG] EIP41744
+// [Category] Improvement
+// [Description] SoftKeyBoard Support in TSE. and Support to Work with
+// new mouse driver(Label 07).
+// [Files] HookAnchor.h
+// AMITSE.sdl
+// CommonHelper.c
+// commonoem.c
+// commonoem.h
+// HookList.c
+// HookAnchor.c
+// Mouse.c
+// minisetupext.c
+// postmgmtext.c
+// minisetupext.h
+// PopupPassword.c
+// PopupString.c
+// TseLiteCommon.c
+//
+// 5 3/21/11 12:46a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 6 2/19/10 8:19a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 1/09/10 7:13a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 8/13/09 1:21p Blaines
+// EIP #24980 Fix to properly display right area text
+//
+// 3 6/23/09 6:53p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 5/07/09 10:36a Madhans
+// Changes after Bin module
+//
+// 1 4/28/09 11:07p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 1 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//
+//
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: TseLiteCommon.c
+//
+// Description: This file contains code for the TSE Lite common functions
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+
+SETUP_PKG *gSetupPkg;
+SCREEN_INFO *gScreen;
+PAGE_LIST *gToolPages;
+PAGE_LIST *gPages;
+CONTROL_INFO *gToolControlInfo;
+CONTROL_INFO *gControlInfo;
+VARIABLE_LIST *gToolVariables;
+VARIABLE_LIST *gVariables;
+HPK_INFO *gHpkInfo;
+GUID_LIST *gGuidList;
+PAGE_ID_LIST *gPageIdList;
+PAGE_ID_LIST *gToolPageIdList;
+PAGE_ID_INFO *gPageIdInfo;
+PAGE_ID_INFO *gToolPageIdInfo;
+FRAME_DATA *gActiveFrame = NULL;
+
+UINT16 gCheckboxTokens[] =
+{
+ STRING_TOKEN(STR_CTRL_CHKBOX_DISABLE),
+ STRING_TOKEN(STR_CTRL_CHKBOX_ENABLE)
+};
+
+UINTN gLabelLeftMargin = 2 ;
+UINTN gControlLeftMargin = 24;
+UINTN gControlLeftPad = 2 ;
+UINTN gControlRightAreaWidth = 27 ;
+BOOLEAN gVariableChanged = FALSE;
+BOOLEAN gResetRequired = FALSE;
+UINT32 gStartPage = 0;
+
+APPLICATION_DATA *gApp = NULL;
+UINTN gHpkInfoLength;
+UINT32 GetControlConditionVarId(CONTROL_INFO *control);
+
+extern CHAR8 *GlyphWidthCache;//EIP 85564 : UefiHiiTestPrintLength function needs optimization
+extern UINT32 gRefreshIdCount;
+extern REFRESH_ID_INFO *gRefreshIdInfo;
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MiniSetupUIExit
+//
+// Description: Freesup UI related resources.
+//
+// Input: none
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN TseDebugDisableApplicationDestructor (VOID);
+VOID MiniSetupUIExit(VOID)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINTN index;
+
+ // Don't do the MiniSetupExit if it is not a first call to PostManagerHandshake.
+ if(gPostManagerHandshakeCallIndex>2) //gApp should be preserved when it is not freed.
+ {
+ // to Let Next call not quit.
+ gApp->Quit=FALSE;
+ goto Done;
+ }
+
+ if ( gApp != NULL )
+ {
+ if (!TseDebugDisableApplicationDestructor ())
+ {
+ gApplication.Destroy( gApp, TRUE );
+ }
+ gApp = NULL;
+
+ MouseDestroy();
+ }
+
+Done:
+ //Close the Event and Free the NotifyContext created for Controls with Refresh Id.
+ if(gRefreshIdInfo) {
+ for(index = 0; index < gRefreshIdCount; index++)
+ {
+ if(gRefreshIdInfo[index].pEvent)//Close the event
+ {
+ Status = gBS->CloseEvent(gRefreshIdInfo[index].pEvent);
+ if(Status == EFI_SUCCESS)
+ {
+ gRefreshIdInfo[index].pEvent = NULL;
+ }
+ }
+
+ MemFreePointer( (VOID **)&gRefreshIdInfo[index].pNotifyContext );
+ }
+ MemFreePointer( (VOID **)&gRefreshIdInfo );
+ gRefreshIdCount = 0;
+ }
+
+ UEFICallSetupFormCallBack(AMI_CALLBACK_FORM_CLOSE);//EIP-53480: Calling the Wrapper function with AMI_CALLBACK_FORM_CLOSE action before HiiExit()
+ if ( gVariableList != NULL )
+ {
+ for ( index = 0; index < gVariables->VariableCount; index++ )
+ MemFreePointer( (VOID **)&gVariableList[index] );
+
+ MemFreePointer( (VOID **)&gVariableList );
+ }
+ //Commented and moved above for EIP88449
+ //UEFICallSetupFormCallBack(AMI_CALLBACK_FORM_CLOSE);//EIP-53480: Calling the Wrapper function with AMI_CALLBACK_FORM_CLOSE action before HiiExit()
+ HiiExit( );
+
+
+ if(GlyphWidthCache) {
+ MemFreePointer((VOID **)&GlyphWidthCache);// EIP 85564 :free the memory which was used to store the widths of each possible CHAR16 glyph.
+ }
+
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: GetBootTimeOut
+//
+// Description: Timeout value from the variable.
+//
+// Input: DefaultValue
+//
+// Output: Timeout value
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT16 GetBootTimeOutLocal(UINT16 DefaultValue)
+{
+ UINT16 *TimeOut=NULL, Value = 0;
+ UINTN size = 0;
+
+ // Install boot timeout
+ TimeOut = VarGetNvram( VARIABLE_ID_BOOT_TIMEOUT, &size );
+
+ if ( TimeOut != NULL )
+ {
+ Value = *TimeOut;
+ }
+ else
+ {
+ Value = DefaultValue;
+ VarSetNvram( VARIABLE_ID_BOOT_TIMEOUT, &Value, sizeof(UINT16) );
+ }
+
+ return Value;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _GetControlVariable
+//
+// Description: Function to get control variable.
+//
+// Input: CONTROL_INFO *control
+//
+// Output: UINT32
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT32 _GetControlVariable(CONTROL_INFO *control)
+{
+ return control->ControlVariable;
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: _GetPageInfo
+//
+// Description: Returns pointer to the PAGE_INFO struct of given PgIndex
+//
+// Input: UINT32 PgIndex - Page index
+// PAGE_INFO **PageInfo - Pointer to the page information struct
+//
+// Output: EFI_STATUS status - EFI_SUCCESS if successful, else EFI_ERROR
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _GetPageInfo(UINT32 PgIndex, PAGE_INFO **PageInfo)
+{
+ EFI_STATUS status = EFI_SUCCESS;
+
+ if((gApplicationData == NULL) || (gPages == NULL))
+ {
+ status = EFI_NOT_READY;
+ goto DONE;
+ }
+
+ if(PgIndex > gPages->PageCount)
+ {
+ status = EFI_INVALID_PARAMETER;
+ goto DONE;
+ }
+
+ *PageInfo = (PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[PgIndex]);
+
+DONE:
+ return status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: IsPageModal
+//
+// Description: Is this a modal page
+//
+// Parameter: IN UINT32 PgIndex
+//
+// Return Value: BOOLEAN
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+#define ASSERT_ERROR_STATUS(assertion) if(EFI_ERROR(assertion)) goto DONE
+BOOLEAN IsPageModal(UINT32 PgIndex)
+{
+ EFI_STATUS status = EFI_SUCCESS;
+ BOOLEAN isTrue = FALSE;
+ PAGE_INFO *pageInfo = NULL;
+
+ status = _GetPageInfo(PgIndex, &pageInfo);
+ ASSERT_ERROR_STATUS(status);
+ isTrue = pageInfo->PageFlags.PageModal ? TRUE : FALSE;
+
+DONE:
+ return isTrue;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: GetPageSubTitle
+//
+// Description: Get the Page Subtitle String Index
+//
+// Parameter: IN UINTN PgIndex
+// OUT UINT16 *subtitleToken
+//
+// Return Value: EFI_STATUS
+// EFI_SUCCESS
+// EFI_NOT_READY
+// EFI_INVALID_PARAMETER
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS GetPageSubTitle(UINT32 PgIndex, UINT16 *SubtitleToken)
+{
+ EFI_STATUS status = EFI_SUCCESS;
+ PAGE_INFO *pageInfo = NULL;
+
+ status = _GetPageInfo(PgIndex, &pageInfo);
+ ASSERT_ERROR_STATUS(status);
+
+ *SubtitleToken = pageInfo->PageSubTitle;
+
+DONE:
+ return status;
+}
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/TseLitehelper.c b/EDK/MiniSetup/TseLite/TseLitehelper.c
new file mode 100644
index 0000000..9bb1325
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/TseLitehelper.c
@@ -0,0 +1,1310 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/TseLitehelper.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 18 $
+//
+// $Date: 7/02/13 10:09a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/TseLitehelper.c $
+//
+// 18 7/02/13 10:09a Premkumara
+// [TAG] EIP120011
+// [Category] Improvement
+// [Description] Variable BootOrder and LegacyDevOrder need
+// fool-proofing function when TSE load variabled
+// [Files] Bbs.c, Boot.c, Callback.c, TseLiteHelper.c, Variable.c
+//
+// 17 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 22 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 16 2/03/12 8:43a Arunsb
+// While booting to shell it appears on different colors other than black
+// so setting the background attribute with black color.
+//
+// 15 12/07/11 11:26p Arunsb
+// [TAG] EIP77493
+// [Category] New Feature
+// [Description] Provide the alternative way for _ActionReadKey
+// [Files] AMITSE.sdl and TseLitehelper.c
+//
+// 14 11/30/11 1:32p Premkumara
+// [TAG] EIP75352
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] Boot.c, bbs.c, TseAdvanced.c, Special.c, Variable.c,
+// TseLiteHelper.c, PopupSel.c, AddBootOption.c, Hii.c, FormBrowser2.c
+//
+// 13 11/13/11 1:07p Arunsb
+// [TAG] EIP70421
+// [Category] New Feature
+// [Description] Support for driver order in TSE
+// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
+// boot.c,
+// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
+// addbootoption.c,
+// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
+// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
+// TseElink.h, variable.h,
+// setup.h, Boot.vfr and Setup.uni
+//
+// 12 9/29/11 7:02p Blaines
+// [TAG] - EIP 66860
+// [Category]- Function Request
+// [Synopsis]- AmiPostManager interface for text entry.
+// [Files] - LogoLib.h, AMIPostMgr.h, protocol.c, protocol.h,
+// TseAdvanced.c, TseLitehelper.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 11 2/04/11 4:38p Mallikarjunanv
+// Added dummy function for UpdateBootVariables()
+//
+// 10 2/01/11 7:35p Madhans
+// [TAG] - EIP 50737
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom] - Suppressing the Interactive control does not work
+// correctly.
+// [RootCause] - The control conditional pointer if not set correctly.
+// [Solution]- To fix the Control condition pointer. And identify the
+// suppress if related to UEFI action control
+// [Files] - UefiAction.c TseLiteHelper.c hii.h uefi20wapper.c
+// uefi21wapper.c
+//
+// 9 10/05/10 12:20p Mallikarjunanv
+// added ShowPostProgress function for TSE Lite
+//
+// 8 9/20/10 6:47p Madhans
+// [TAG] EIP44542
+// [Category] BUILD ISSUE FIX
+// [Symptom] Build issues with TSE label (INT)4.6.2_TSE_2_10_1207_TEST
+// when IdeSecurity and FastBoot modules added to the project
+// [RootCause] -
+// [Solution] Build issues resolved
+// [Files] CommonHelper.c, Tsecommon.h, Hiilib.h, Boot.h, minisetup.h,
+// bbs.c, special.c, Bds.c TseLitehelp
+//
+// 7 9/16/10 8:38p Madhans
+// Update for TSE 2.10. Refer Changelog.log for more details.
+//
+// 15 9/16/10 3:13p Madhans
+// To Avoid build issues with TSE_USE_EDK_LIBRARY Building.
+//
+// 14 8/27/10 5:05a Mallikarjunanv
+// EIP-39334: support to build TSE without the CSM module support
+//
+// 13 6/14/10 7:10p Madhans
+// Nt32 build support.
+//
+// 12 3/23/10 5:24p Blaines
+// Add support for PostManager Extentions
+//
+// 11 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 10 1/29/10 4:38p Madhans
+// To iniltize it properly
+//
+// 9 1/09/10 7:05a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 8 9/15/09 9:50a Sudhirv
+// updated the handling of Add Del Boot option
+//
+// 7 8/19/09 6:33p Madhans
+// IsToggleStateKey Function added to findout invalid action keys
+// correctly.
+//
+// 6 8/13/09 7:40a Mallikarjunanv
+// eip:24971 - supporting tse features without tse sources
+//
+// 5 7/20/09 1:22p Mallikarjunanv
+// updated the code with token PASSWORD_WITH_SPECIAL_CHAR_SUPPORT
+//
+// 4 6/23/09 6:53p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 3 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 2 6/08/09 5:36p Madhans
+// Fix for SetupHang issue in TSE Lite.
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:07p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:13p Madhans
+// Add/del boot option and other fixes.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//
+//
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: TSELiteHelper.c
+//
+// Description: This file contains code specific to TSE Lite flavor
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+extern BOOLEAN gQuietBoot;
+
+UINT32 GetControlConditionVarId(CONTROL_INFO *control);
+BOOLEAN CheckIsAllowedPasswordChar(CHAR16 Char);
+extern APPLICATION_DATA *gApp;
+
+// TSELiteMinisetup
+#define SETUP_VARIABLE_GUID \
+ { 0xEC87D643, 0xEBA4, 0x4BB5, { 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 } }
+
+
+static SETUP_PKG _SetupPackageTemplate = {
+ {'$', 'S', 'P', 'F'}, //PackageSignature[4];
+ 0x0102, //StructureRevision;
+ 0x100, //PackageVersion;
+ {0,0,0,0,0,0}, //Reserved[6];
+ SETUP_VARIABLE_GUID, //PackageGuid;
+ 0, //PackageVariable;
+ 0, //PackageScreen;
+ 0, //PackagePageList;
+ 0, //PackageControlOffset;
+ 0, //PackageVariableList;
+ 0, //PackageHpkData;
+ 0, //PackageGuidList;
+ 0, //PackagePageIdList;
+ 0 //PackageIfrData;
+};
+
+static SCREEN_INFO _SetupPackageScreen = {
+ {0}, //MainHandle;
+ STR_MAIN_TITLE, //MainTitle;
+ STR_MAIN_COPYRIGHT, //MainCopyright;
+ STR_EVAL_MSG, //MainHelpTitle;
+ 0, //MainMenuCount;
+ 0 //MainNavCount;
+};
+
+
+static PAGE_INFO _SetupPageInfo =
+{
+ {0}, // PageHandle;
+ 0, // PageIdIndex;
+ 0, // PageFormID;
+ 0, // PageTitle;
+ 0, // PageSubTitle;
+ 0, // PageID;
+ 0, // PageParentID;
+ {0}, // PAGE_FLAGS PageFlags;
+ 0, // PageVariable;
+ {0}, // PageControls;
+};
+
+static CONTROL_INFO _SetupControlInfo_N_N = {
+ {0}, // EFI_HII_HANDLE ControlHandle;
+ 0, // UINT32 ControlVariable;
+ {0}, // UINT32 ControlConditionalVariable[2];
+ 0, // UINT16 ControlType;
+ 0, // UINT16 ControlPageID;
+ 0xFFFF, // UINT16 ControlDestPageID;
+ {0}, // CONTROL_FLAGS ControlFlags;
+ 0, // UINT16 ControlHelp;
+ 0, // UINT16 ControlLabel;
+ 0, // UINT16 ControlIndex;
+ 0, // UINT16 ControlLabelCount;
+ {0}, // union {
+ // UINTN ControlPtr;
+ // UINT64 res1;
+ // };
+ {0}, // union {
+ // INTN ControlConditionalPtr;
+ // UINT64 res2;
+ // };A
+ 0, // UINT16 ControlDataLength;
+ 0, // UINT16 ControlDataWidth;
+ 0 // UINT16 QuestionId;
+};
+
+#define _VARIABLE_COUNT 17
+#define _GUID_COUNT 5
+
+static VARIABLE_INFO _SetupVariableInfo[_VARIABLE_COUNT] = {
+ {SETUP_VARIABLE_GUID , L"Setup", 0x07,0},
+ {EFI_GLOBAL_VARIABLE_GUID , L"Dummy", 0x17,0},
+ {EFI_GLOBAL_VARIABLE_GUID , L"Timeout", 0x07,0},
+ {USER_DEFAULTS_GUID , L"UserDefaults", 0x07,0},
+ {ERROR_MANAGER_GUID , L"ErrorManager", 0x07,0},
+ {AMITSESETUP_GUID , L"AMITSESetup", 0x07,0},
+ {IDE_SECURITY_CONFIG_GUID , L"IDESecDev", 0x07,0},
+ {EFI_GLOBAL_VARIABLE_GUID , L"BootOrder", 0x17,0},
+ {LEGACY_DEV_ORDER_GUID , L"LegacyDevOrder", 0x17,0},
+ {DEL_BOOT_OPTION_GUID , L"DelBootOption", 0x17,0},
+ {ADD_BOOT_OPTION_GUID , L"AddBootOption", 0x17,0},
+ {BOOT_MANAGER_GUID , L"BootManager", 0x07,0},
+ {BOOT_NOW_COUNT_GUID , L"BootNowCount", 0x07,0},
+ {LEGACY_DEV_ORDER_GUID , L"LegacyDev", 0x01,0},
+ {AMI_CALLBACK_GUID , L"AMICallback", 0x01,0},
+ {LEGACY_DEV_ORDER_GUID , L"LegacyGroup", 0x01,0},
+ {BOOT_NOW_COUNT_GUID , L"SetupSaveState", 0x02,0},
+};
+
+static GUID_INFO _SetupGUIDInfo[_GUID_COUNT] = {
+ // Needs to be first on List for patching up later.
+ {EFI_GLOBAL_VARIABLE_GUID , L"Dummy", {1},5}, // For lang codes/platformlangcode
+ {BOOT_MANAGER_GUID , L"BootManager", {1},1},
+ {BOOT_NOW_COUNT_GUID , L"BootNowCount", {1},1},
+ {AMI_CALLBACK_GUID , L"AMICallback", {1},2},
+ {ADD_BOOT_OPTION_GUID , L"AddBootOption", {0},9}
+};
+
+#pragma pack(8)
+typedef struct _TSE_SETUP_PACKAGE
+{
+ SETUP_PKG SetupPkg;
+ SCREEN_INFO ScreenInfo;
+ PAGE_LIST PageList;
+ UINT32 PageOffset[1]; // Increase if you have more pages - Dummy
+ PAGE_INFO PageInfo[1]; // Increase if you have more pages - Dummy
+
+ CONTROL_INFO ControlInfo[1];// Increase if controls - Dummy
+
+ VARIABLE_LIST VariableList;
+ UINT32 VariableOffset[_VARIABLE_COUNT]; // Increase if you have more Variable
+ VARIABLE_INFO VariableInfo[_VARIABLE_COUNT];
+ HPK_INFO HpkInfo[1]; //- Dummy
+ GUID_LIST GuidList;
+ UINT32 GuidOffset[_GUID_COUNT]; // Increase if you have more GUID
+ GUID_INFO GuidInfo[_GUID_COUNT];
+ PAGE_ID_LIST PageIdList;
+ UINT32 PageIdOffset[1]; // Increase if you have more Page - Dummy
+ PAGE_ID_INFO PageIdInfo[1]; // Increase if you have more Page - Dummy
+}TSE_SETUP_PACKAGE;
+
+#pragma pack()
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: InitApplicationData
+//
+// Description: Initlizes the TSE Lite Setupdata.
+//
+// Input: ImageHandle
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS InitApplicationData(EFI_HANDLE ImageHandle)
+{
+ EFI_STATUS Status=EFI_SUCCESS;
+// UINTN FillSize = 0;
+ UINTN i;
+ CHAR16 *name = NULL;
+
+ //TODO
+ // Init the Application data
+ // Hardcoded Application data for the TSE Lite
+ gApplicationData = EfiLibAllocateZeroPool( 0x1000 ); // Allocate more of you add more
+
+ // SETUP_PKG
+ MemCopy(gApplicationData,&_SetupPackageTemplate, sizeof(_SetupPackageTemplate) );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackageVariable = 0;
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackageScreen = STRUCT_OFFSET( TSE_SETUP_PACKAGE, ScreenInfo );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackagePageList = STRUCT_OFFSET( TSE_SETUP_PACKAGE, PageList );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackageControlOffset = STRUCT_OFFSET( TSE_SETUP_PACKAGE, ControlInfo );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackageVariableList = STRUCT_OFFSET( TSE_SETUP_PACKAGE, VariableList );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackageHpkData = STRUCT_OFFSET( TSE_SETUP_PACKAGE, HpkInfo );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackageGuidList = STRUCT_OFFSET( TSE_SETUP_PACKAGE, GuidList );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackagePageIdList = STRUCT_OFFSET( TSE_SETUP_PACKAGE, PageIdList );
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->SetupPkg.PackageIfrData = sizeof(TSE_SETUP_PACKAGE);
+
+ //SCREEN_INFO
+ MemCopy(&((TSE_SETUP_PACKAGE *)gApplicationData)->ScreenInfo,&_SetupPackageScreen,sizeof(SCREEN_INFO));
+
+ //PAGE_INFO
+ MemSet(&_SetupPageInfo,sizeof(_SetupPageInfo),0);
+ MemCopy(&((TSE_SETUP_PACKAGE *)gApplicationData)->PageInfo,&_SetupPageInfo,sizeof(_SetupPageInfo));
+
+ //PAGE_LIST
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->PageList.PageCount = 1;
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->PageList.PageList[0] = (UINT32)((UINTN)(&((TSE_SETUP_PACKAGE *)gApplicationData)->PageInfo[0])-(UINTN)(gApplicationData));
+
+ //CONTROL_INFO
+ MemCopy(&((TSE_SETUP_PACKAGE *)gApplicationData)->ControlInfo,&_SetupControlInfo_N_N,sizeof(CONTROL_INFO));
+
+ //VARIABLE_INFO
+ name = GetVariableNameByID(VARIABLE_ID_LANGUAGE);
+ EfiStrCpy(_SetupVariableInfo[VARIABLE_ID_LANGUAGE].VariableName, name);
+ MemFreePointer(&name);
+ MemCopy(&((TSE_SETUP_PACKAGE *)gApplicationData)->VariableInfo,&_SetupVariableInfo,sizeof(_SetupVariableInfo));
+
+ //VARIABLE_LIST
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->VariableList.VariableCount = _VARIABLE_COUNT;
+ for(i=0;i<_VARIABLE_COUNT;i++)
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->VariableList.VariableList[i] = (UINT32)((UINTN)(&((TSE_SETUP_PACKAGE *)gApplicationData)->VariableInfo[i])-(UINTN)(&((TSE_SETUP_PACKAGE *)gApplicationData)->VariableList));
+
+ //GUID_INFO
+ name = GetGUIDNameByID(VARIABLE_ID_LANGUAGE);
+ EfiStrCpy(_SetupGUIDInfo[0].GuidName , name);
+ MemFreePointer(&name);
+ MemCopy(&((TSE_SETUP_PACKAGE *)gApplicationData)->GuidInfo,_SetupGUIDInfo,sizeof(_SetupGUIDInfo));
+
+ //GUID_LIST
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->GuidList.GuidCount = _GUID_COUNT;
+ for(i=0;i<_GUID_COUNT;i++)
+ ((TSE_SETUP_PACKAGE *)gApplicationData)->GuidList.GuidList[i] = (UINT32)((UINTN)(&((TSE_SETUP_PACKAGE *)gApplicationData)->GuidInfo[i])-(UINTN)(&((TSE_SETUP_PACKAGE *)gApplicationData)->GuidList));
+
+ return Status;
+}
+
+VOID TSELiteFixBootOrder(CONTROL_DATA *ControlData);
+VOID TSELiteFixBBSOrder(CONTROL_DATA *ControlData);
+VOID TSELiteFixBootOrderRide(CONTROL_DATA *ControlData);
+VOID TSELiteFixAddBootOptionFileList(CONTROL_DATA *ControlData);
+VOID TSELiteFixDelBootOptionFileList(CONTROL_DATA *ControlData);
+#ifdef TSE_FOR_APTIO_4_50
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SpecialUpdatePageControls
+//
+// Description: Fix the Boot Order, BBS Order and Boot Override controls.
+//
+// Input: CurrentPage
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SpecialUpdatePageControls(UINT32 CurrentPage)
+{
+ UINT16 j=0;
+ UINT32 CtrlCondVariable=0xFFFF, CtrlVariable=0xFFFF;
+ CONTROL_INFO *control;
+
+ CONTROL_DATA **ControlData;
+ FRAME_DATA *fdata;
+
+ fdata = ((PAGE_DATA*)gApp->PageList[CurrentPage])->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+ ControlData = ((PAGE_DATA*)gApp->PageList[CurrentPage])->FrameList[StyleFrameIndexOf(MAIN_FRAME)]->ControlList;
+
+ for(j=0;j < fdata->ControlCount;j++,ControlData++)
+ {
+ control = &(*ControlData)->ControlData;
+
+ if( CheckControlCondition( control ) != COND_NONE)
+ continue;
+
+ CtrlCondVariable = GetControlConditionVarId(control);
+ CtrlVariable = _GetControlVariable(control);
+
+ switch( CtrlCondVariable)
+ {
+ case VARIABLE_ID_BOOT_MANAGER:
+ // For Boot Order Case
+ if(( CtrlVariable == VARIABLE_ID_BOOT_ORDER) &&
+ ((control->ControlType == CONTROL_TYPE_ORDERED_LIST)||(control->ControlType == CONTROL_TYPE_POPUPSEL)))
+ TSELiteFixBootOrder(*ControlData);
+
+ // For Boot Override Case
+ if( (control->ControlType == CONTROL_TYPE_SUBMENU) &&
+ (control->ControlPageID == control->ControlDestPageID) )
+ {
+ ((SUBMENU_DATA*)(*ControlData))->SubMenuType = 2;
+ TSELiteFixBootOrderRide(*ControlData);
+ }
+ if(( CtrlVariable == VARIABLE_ID_DEL_BOOT_OPTION) && (control->ControlType == CONTROL_TYPE_POPUPSEL))
+ TSELiteFixDelBootOptionFileList(*ControlData);
+ break;
+ case VARIABLE_ID_LEGACY_DEV_INFO:
+ if(( CtrlVariable == VARIABLE_ID_BBS_ORDER) &&
+ ((control->ControlType == CONTROL_TYPE_ORDERED_LIST)||(control->ControlType == CONTROL_TYPE_POPUPSEL)))
+ TSELiteFixBBSOrder(*ControlData);
+ break;
+ case VARIABLE_ID_AMI_CALLBACK:
+ if( (control->ControlType == CONTROL_TYPE_SUBMENU) &&
+ (control->ControlPageID == control->ControlDestPageID) )
+ ((SUBMENU_DATA*)(*ControlData))->SubMenuType = 2;
+ break;
+ case VARIABLE_ID_ADD_BOOT_OPTION:
+ if( (control->ControlType == CONTROL_TYPE_POPUPSEL) )
+ TSELiteFixAddBootOptionFileList(*ControlData);
+ break;
+ default:
+ break;
+ }
+ }
+}
+#endif
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSELiteFixBootOrder
+//
+// Description: Fixes the Boot Order OrderList.
+//
+// Input: ControlData
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID TSELiteFixBootOrder(CONTROL_DATA *ControlData)
+{
+ POPUPSEL_DATA *popupSel = (POPUPSEL_DATA *)ControlData;
+ UINT16 i=0;
+ CHAR16 *BootStr;
+ UINT16 *BootOrder=NULL;
+ UINTN size = 0;
+
+ BootOrder = HelperGetVariable(VARIABLE_ID_BOOT_ORDER, L"BootOrder", &gEfiGlobalVariableGuid, NULL, &size );
+
+ if (NULL != BootOrder)//EIP-75352 Suppress the warnings from static code analyzer
+ {
+ for(i=0;i<popupSel->ItemCount;i++)
+ {
+ BootStr = BootGetBootNowName(i,0,1);
+ popupSel->PtrTokens[i].Option = HiiAddString( popupSel->ControlData.ControlHandle, BootStr );
+ popupSel->PtrTokens[i].Value = BootOrder[i];
+ }
+ MemFreePointer((VOID **) &BootOrder);
+ }
+}
+
+// Fixes the BBS Order Name and Value
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSELiteFixBBSOrder
+//
+// Description: Fixes the BBS Order Orderlist.
+//
+// Input: ControlData
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID TSELiteFixBBSOrder(CONTROL_DATA *ControlData)
+{
+ POPUPSEL_DATA *popupSel = (POPUPSEL_DATA *)ControlData;
+ CONTROL_INFO *control;
+ PAGE_INFO * pageInfo;
+ UINT16 DevType;
+ BBS_ORDER_TABLE *devOrder=NULL,*TempDevOrder=NULL;
+ UINTN size = 0,i,j;
+ BOOT_DATA * bootData=NULL;
+ UINT16 *BootOrder=NULL;
+ UINT16 Count;
+
+
+ control = &(ControlData)->ControlData;
+ pageInfo = (PAGE_INFO *)((UINTN)gApplicationData + gPages->PageList[control->ControlPageID]);
+
+ // to find the Devicetype based on the FORM ID
+ switch(pageInfo->PageFormID)
+ {
+ case HARD_DISK_ORDER_FORM:
+ DevType = BBS_TYPE_HARDDRIVE;break;
+ case CDROM_ORDER_FORM:
+ DevType = BBS_TYPE_CDROM;
+ break;
+ case FLOPPY_DISK_ORDER_FORM:
+ DevType = BBS_TYPE_FLOPPY;
+ break;
+ case NETWORK_ORDER_FORM:
+ DevType = BBS_TYPE_EMBEDDED_NETWORK;
+ break;
+ case BEV_ORDER_FORM:
+ DevType = BBS_TYPE_BEV;
+ break;
+ default:
+ return;
+ }
+
+ devOrder = VarGetVariable( VARIABLE_ID_BBS_ORDER, &size );
+ //EIP-75352 Suppress the warnings from static code analyzer
+ if (NULL == devOrder)
+ return;
+
+ for(i=0;i<size;)
+ {
+ TempDevOrder = (BBS_ORDER_TABLE *)(((UINT8*)devOrder)+i);
+
+ if ( (TempDevOrder->Length >= size) || (0 == TempDevOrder->Length) ) //EIP-120011
+ {
+ return;
+ }
+
+ if(TempDevOrder->Type == DevType)
+ break;
+ i = i+ sizeof(UINT32)+ TempDevOrder->Length;
+ }
+ if(i<size) // If Device type found in LegacydevOrder.
+ {
+ Count = (TempDevOrder->Length/sizeof(UINT16))-1;
+ if(Count==popupSel->ItemCount)
+ {
+ // Find the BOOT data of DevType
+ BootOrder = HelperGetVariable(VARIABLE_ID_BOOT_ORDER, L"BootOrder", &gEfiGlobalVariableGuid, NULL, &size );
+ //EIP-75352 Suppress the warnings from static code analyzer
+ if (NULL == BootOrder)
+ {
+ MemFreePointer((VOID **) &devOrder);
+ return;
+ }
+ for(i=0;i<size/2;i++)
+ {
+ bootData = BootGetBootData(BootOrder[i]);
+ //EIP-75352 Suppress the warnings from static code analyzer
+ if (NULL == bootData)
+ {
+ MemFreePointer((VOID **) &BootOrder);
+ MemFreePointer((VOID **) &devOrder);
+ return;
+ }
+ if ( BBSValidDevicePath(bootData->DevicePath) )
+ {
+ BBS_BBS_DEVICE_PATH *DevPath = (BBS_BBS_DEVICE_PATH *)bootData->DevicePath;
+ if((DevPath->DeviceType == DevType) && (bootData->LegacyDevCount == Count))
+ break;
+ }
+ }
+ if(i<size/2) //if BootData Found Found
+ {
+ for(i=0;i<popupSel->ItemCount;i++)
+ {
+ for(j=0;j<popupSel->ItemCount;j++)
+ {
+ if(TempDevOrder->Data[i]==bootData->OrderList[j].Index)
+ {
+ popupSel->PtrTokens[i].Option = HiiAddString( popupSel->ControlData.ControlHandle, bootData->OrderList[j].Name );
+ popupSel->PtrTokens[i].Value = bootData->OrderList[j].Index;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ MemFreePointer((VOID **) &BootOrder);
+ MemFreePointer((VOID **) &devOrder);
+
+}
+
+#ifdef TSE_FOR_APTIO_4_50
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdateLegacyDevVariable
+//
+// Description: Update the LegacyDev variable with Device count in each BBS type
+//
+// Input: NoOfLegacyGroups
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID UpdateLegacyDevVariable(UINT16 NoOfLegacyGroups)
+{
+ extern EFI_GUID gLegacyDevGuid;
+ LEGACY_DEV_LIST BBSCount = { 0, 0, 0, 0, 0 };
+ BBS_ORDER_TABLE *devOrder,*TempDevOrder;
+ UINTN i;
+ UINTN size = 0;
+ UINT16 Count;
+
+ devOrder = VarGetNvramName( L"LegacyDevOrder", &gLegacyDevGuid, NULL, &size );
+
+ for(i=0;i<size;)
+ {
+ TempDevOrder = (BBS_ORDER_TABLE *)(((UINT8*)devOrder)+i);
+
+ if ( (TempDevOrder->Length >= size) || (0 == TempDevOrder->Length) ) //EIP-120011
+ {
+ return;
+ }
+
+ Count = (TempDevOrder->Length/sizeof(UINT16))-1;
+
+ switch(TempDevOrder->Type)
+ {
+ case BBS_TYPE_FLOPPY:
+ BBSCount.FloppyCount = Count ;
+ break;
+ case BBS_TYPE_HARDDRIVE:
+ BBSCount.HardDiskCount = Count ;
+ break;
+ case BBS_TYPE_CDROM:
+ BBSCount.CDROMCount = Count ;
+ break;
+ case BBS_TYPE_EMBEDDED_NETWORK:
+ BBSCount.NetworkCount = Count ;
+ break;
+ case BBS_TYPE_BEV:
+ BBSCount.BevCount = Count ;
+ break;
+ default:
+ break;
+ }
+ i = i+ sizeof(UINT32)+ TempDevOrder->Length;
+ }
+
+ MemFreePointer( (VOID **)&devOrder );
+ VarSetNvramName( L"LegacyDev", &gLegacyDevGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS, &BBSCount, sizeof(BBSCount) );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: BBSUpdateOrder
+//
+// Description: Updates the Legacydevorder variable base on the user input
+//
+// Input: UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **buffer
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID BBSUpdateOrder(UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **buffer)
+{
+ UINTN i,j,k,l;
+ UINTN varsize = 0;
+ BBS_ORDER_TABLE *devOrder=NULL,*TempDevOrder;
+ UINT16 DevCount;
+
+ // TODO
+ // Rearrange the legacy dev order Based on the new option
+ devOrder = VarGetVariable( VARIABLE_ID_BBS_ORDER, &varsize );
+ //EIP-75352 Suppress the warnings from static code analyzer
+ if (NULL == devOrder)
+ return;
+
+ for(i=0;i<varsize ;)
+ {
+ TempDevOrder = (BBS_ORDER_TABLE *)(((UINT8*)devOrder)+i);
+
+ if ( (TempDevOrder->Length >= varsize) || (0 == TempDevOrder->Length) ) //EIP-120011
+ {
+ return;
+ }
+
+ DevCount = ((TempDevOrder->Length/sizeof(UINT16))-1);
+ for(j=0;j<DevCount;j++)
+ {
+ if(*newOption == TempDevOrder->Data[j]) // Need to update Order for this device type
+ {
+ // Place the Options in the specific Order.
+ for(l=0;l<(*size/sizeof(UINT16));l++)
+ {
+ for(k=0;k<DevCount;k++)
+ {
+ if(TempDevOrder->Data[k] == newOption[l])
+ {
+ TempDevOrder->Data[k] = TempDevOrder->Data[l];
+ TempDevOrder->Data[l] = newOption[l];
+ break;
+ }
+ }
+ }
+ *buffer = devOrder; // return the Real buffer that will be updated.
+ *size = varsize;
+ return;
+ }
+ }
+ i = i+ sizeof(UINT32)+ TempDevOrder->Length;
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: BootUpdateOrder
+//
+// Description: Updates the boot order variable
+//
+// Input: New options, offset, size and Outbuffer
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID BootUpdateOrder(UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **realBuffer)
+{
+ UINTN varsize = 0;
+ UINTN i,j;
+ UINT16 * BootOrder;
+
+ BootOrder = HelperGetVariable(VARIABLE_ID_BOOT_ORDER, L"BootOrder", &gEfiGlobalVariableGuid, NULL, &varsize );
+
+ for(i=0;i<*size/2;i++)
+ {
+ for(j=0;j<varsize/2;j++)
+ {
+ // update the New boot order one by one
+ if(BootOrder[j]==newOption[i])
+ {
+ BootOrder[j]=BootOrder[i];
+ BootOrder[i] = newOption[i];
+ break;
+ }
+ }
+ }
+ *realBuffer = BootOrder;
+ *size = varsize;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DriverUpdateOrder
+//
+// Description: Updates the driver order variable
+//
+// Input: New options, offset, size and Outbuffer
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DriverUpdateOrder (UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **realBuffer)
+{
+ //TSE lite currently not supports driver options
+}
+#endif
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSELiteFixBootOrderRide
+//
+// Description: Function to fix boot override
+//
+// Input: CONTROL_DATA *ControlData
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID TSELiteFixBootOrderRide(CONTROL_DATA *ControlData)
+{
+ CONTROL_INFO *control;
+ UINT16 Index;
+ CHAR16 *BootStr;
+
+ control = &(ControlData)->ControlData;
+
+ // Find Boot override Device Index.
+ Index = UefiTseLiteGetBootOverRideIndex(control->ControlConditionalPtr);
+ if(Index != 0xFFFF)
+ {
+///EIP - 24971
+ BootStr = BootGetBootNowName(Index,(BOOLEAN)gShowAllBbsDev,(BOOLEAN)BootNowInBootOrderSupport());
+///EIP - 24971
+ UefiSetPromptField(control->ControlPtr,HiiAddString( control->ControlHandle, BootStr ));
+ control->ControlHelp = UefiGetPromptField(control->ControlPtr);
+ }
+}
+
+#ifdef TSE_FOR_APTIO_4_50
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _SubMenuHandleSpecialOp
+//
+// Description: Sub menu handle for Special operations.
+//
+// Input: Submenu data
+//
+// Output: Bool - Interpreted by the Caller.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN _SubMenuHandleSpecialOp( SUBMENU_DATA *submenu )
+{
+ BOOLEAN status = FALSE;
+ UINT32 CtrlCondVariable=0xFFFF, CtrlVariable=0xFFFF;
+ CONTROL_INFO *control;
+ UINT16 Index;
+
+ control = &submenu->ControlData;
+
+ CtrlCondVariable = GetControlConditionVarId(control);
+ CtrlVariable = _GetControlVariable(control);
+
+ switch( CtrlCondVariable)
+ {
+ case VARIABLE_ID_BOOT_MANAGER:
+ // For Boot Override Case
+ if( (control->ControlType == CONTROL_TYPE_SUBMENU) &&
+ (control->ControlPageID == control->ControlDestPageID) )
+ {
+ // YES it is boot Over Ride.
+ // Find the Index and Try to Boot to it
+ Index = UefiTseLiteGetBootOverRideIndex(control->ControlConditionalPtr);
+ if(Index != 0xFFFF)
+ {
+ if(!gResetRequired)
+ {
+ if(!gDoNotBoot)
+ {
+ gApp->ClearScreen = TRUE;
+ gST->ConOut->SetAttribute (gST->ConOut, (EFI_BACKGROUND_BLACK | EFI_WHITE));
+ BootLaunchBootNow( Index,(BOOLEAN)gShowAllBbsDev );
+ }
+ }
+ else
+ {
+ gApp->Quit = SaveAndReset();
+ }
+ status = TRUE;
+ }
+ }
+
+ break;
+ case VARIABLE_ID_AMI_CALLBACK:
+ if( (control->ControlType == CONTROL_TYPE_SUBMENU) &&
+ (control->ControlPageID == control->ControlDestPageID) )
+ {
+ Index = UefiTseLiteGetAmiCallbackIndex(control->ControlConditionalPtr, control->ControlPtr);
+ if(Index != 0xFFFF)
+ {
+ status = _SubMenuAmiCallback( Index );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _SubMenuAmiCallback
+//
+// Description: Function to handle the exit page options.
+//
+// Input: UINT16 value
+//
+// Output: TRUE/FALSE.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN _SubMenuAmiCallback( UINT16 value )
+{
+ BOOLEAN status = TRUE;
+
+ gApp->Fixed = TRUE;
+ switch ( value )
+ {
+ case SAVE_AND_EXIT_VALUE:
+ gApp->Quit = SaveAndExit();
+ break;
+ case DISCARD_AND_EXIT_VALUE:
+ gApp->Quit = ExitApplication();
+ break;
+ case SAVE_AND_RESET_VALUE:
+ gApp->Quit = SaveAndReset();
+ break;
+ case DISCARD_AND_RESET_VALUE:
+ gApp->Quit = ResetSys();
+ break;
+ case SAVE_VALUE:
+ SaveWithoutExit();
+ break;
+ case DISCARD_VALUE:
+ LoadPreviousValues( TRUE );
+ break;
+ case RESTORE_DEFAULTS_VALUE:
+ LoadOptimalDefaults();
+ break;
+ case SAVE_BOOT_OPTION:
+ TseBootAddBootOption();
+ break;
+
+ default:
+ status = FALSE;
+ break;
+ }
+
+ return status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupPasswordFormCallback
+//
+// Description: Function to handle PopupPassword form callbacks.
+//
+// Input: CONTROL_INFO * pControlData, UINT16 Key, UINT8 Flags
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupPasswordFormCallback(CONTROL_INFO * pControlData, UINT16 Key, UINT8 Flags)
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupEditHandlePassword
+//
+// Description: Function to handle PopupEdit password.
+//
+// Input: VOID *pPopupEdit, VOID *pData
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupEditHandlePassword( VOID *pPopupEdit, VOID *pData)
+{
+ return EFI_UNSUPPORTED;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TseLiteIsSpecialOptionList
+//
+// Description: Function that decided to re evaluate the option list/Name from the Vfr.
+// For TSE Special Controls it should return TRUE. for other controls it may return FALSE.
+// For UEFI 2.0 it may return TRUE by default.
+//
+// Input: NONE
+//
+// Output: Boolean
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN TseLiteIsSpecialOptionList(CONTROL_DATA *ControlData)
+{
+ UINT32 CtrlCondVariable=0xFFFF, CtrlVariable=0xFFFF;
+ CONTROL_INFO *control;
+
+ control = &(ControlData)->ControlData;
+ CtrlCondVariable = GetControlConditionVarId(control);
+ CtrlVariable = _GetControlVariable(control);
+
+ switch( CtrlCondVariable)
+ {
+ case VARIABLE_ID_ADD_BOOT_OPTION:
+ if( ( CheckForAddDelBootOption() ) && (control->ControlType == CONTROL_TYPE_POPUPSEL) )
+ return TRUE;
+ break;
+ case VARIABLE_ID_BOOT_MANAGER:
+ // For Boot Order Case
+ if(( CtrlVariable == VARIABLE_ID_BOOT_ORDER) &&
+ ((control->ControlType == CONTROL_TYPE_ORDERED_LIST)||(control->ControlType == CONTROL_TYPE_POPUPSEL)))
+ return TRUE;
+
+ if( ( CheckForAddDelBootOption() ) &&
+ ( CtrlVariable == VARIABLE_ID_DEL_BOOT_OPTION ) &&
+ ( control->ControlType == CONTROL_TYPE_POPUPSEL ) )
+ return TRUE;
+ break;
+ case VARIABLE_ID_LEGACY_DEV_INFO:
+ if(( CtrlVariable == VARIABLE_ID_BBS_ORDER) &&
+ ((control->ControlType == CONTROL_TYPE_ORDERED_LIST)||(control->ControlType == CONTROL_TYPE_POPUPSEL)))
+ return TRUE;
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ShowPostMsgBoxEx
+//
+// Description: Function to show messagebox
+//
+// Input: IN CHAR16 *MsgBoxTitle,IN CHAR16 *Message,IN UINT8 MsgBoxType, UINT8 *pSelection
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ShowPostMsgBoxEx(
+IN CHAR16 *Title,
+ IN CHAR16 *Message,
+ IN CHAR16 *Legend,
+ IN MSGBOX_EX_CATAGORY MsgBoxExCatagory,
+ IN UINT8 MsgBoxType,
+ IN UINT16 *OptionPtrTokens,
+ IN UINT16 OptionCount,
+ IN AMI_POST_MGR_KEY *HotKeyList,
+ IN UINT16 HotKeyListCount,
+ OUT UINT8 *MsgBoxSel,
+ OUT AMI_POST_MGR_KEY *OutKey
+)
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ShowPostMsgBox
+//
+// Description: Function to show messagebox
+//
+// Input: IN CHAR16 *MsgBoxTitle,IN CHAR16 *Message,IN UINT8 MsgBoxType, UINT8 *pSelection
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ShowPostMsgBox(IN CHAR16 *MsgBoxTitle,IN CHAR16 *Message,IN UINT8 MsgBoxType, UINT8 *pSelection)
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: ShowPostTextBox
+//
+// Description: Function to display text entry interface
+//
+//
+// Input: IN VOID *HiiHandle,
+// IN UINT16 TitleToken,
+// IN TEXT_INPUT_TEMPLATE *InputData,
+// IN UINT16 ItemCount,
+// IN DISPLAY_TEXT_KEY_VALIDATE ValidateKeyFunc
+//
+// Output: EFI_STATUS
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ShowPostTextBox(
+ IN VOID *HiiHandle,
+ IN UINT16 TitleToken,
+ IN TEXT_INPUT_TEMPLATE *InputData,
+ IN UINT16 ItemCount,
+ IN DISPLAY_TEXT_KEY_VALIDATE FilterKeyFunc
+)
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ShowPostMsgBox
+//
+// Description: Function to show InfoBox
+//
+// Input: IN CHAR16 *InfoBoxTitle, IN CHAR16 *Message, IN UINTN TimeLimit, EFI_EVENT *RetEvent
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ShowInfoBox(IN CHAR16 *InfoBoxTitle, IN CHAR16 *Message, IN UINTN TimeLimit, EFI_EVENT *RetEvent)
+{
+ return EFI_UNSUPPORTED;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ShowPostProgress
+//
+// Description: Function to display the progress bar
+//
+// Input: IN UINT8 ProgressBoxState - Progress bar state
+// IN CHAR16 *Title - Progress bar title
+// IN CHAR16 *Message, - Progress bar message string
+// IN CHAR16 *Legend, - Progress bar legend string
+// IN UINTN Percent, - Percent Complete (0 - 100)
+// IN OUT VOID **Handle, - HANDLE. Valid Handle for update and close
+// OUT AMI_POST_MGR_KEY *OutKey - Out Key
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ShowPostProgress(
+ IN UINT8 ProgressBoxState,
+ IN CHAR16 *Title,
+ IN CHAR16 *Message,
+ IN CHAR16 *Legend,
+ IN UINTN Percent,
+ IN OUT VOID **Handle,
+ OUT AMI_POST_MGR_KEY *OutKey
+)
+{
+ return EFI_UNSUPPORTED;
+}
+
+///AMIKeyCode protocol based...
+EFI_STATUS _ActionReadKey( AMI_EFI_KEY_DATA *pAmiKey, UINT64 Timeout );
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ActionReadKey
+//
+// Description: Function to read action key
+//
+// Input: AMI_EFI_KEY_DATA *pAmiKey, UINT64 Timeout
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ActionReadKey (AMI_EFI_KEY_DATA *pAmiKey, UINT64 Timeout)
+{
+#if TSE_USE_OEM_ACTION_READ_KEY
+ return _OemActionReadKey (pAmiKey, Timeout);
+#else
+ return _ActionReadKey (pAmiKey, Timeout);
+#endif
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: AMIReadKeyStroke
+//
+// Description: Function to read key strokes
+//
+// Input: EFI_INPUT_KEY *Key,AMI_EFI_KEY_DATA *KeyData
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS AMIReadKeyStroke(EFI_INPUT_KEY *Key,AMI_EFI_KEY_DATA *KeyData)
+{
+ return gST->ConIn->ReadKeyStroke( gST->ConIn, Key );
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HelperIsPasswordCharValid
+//
+// Description: Function to check for valid password character
+//
+// Input: EFI_INPUT_KEY *Key,AMI_EFI_KEY_DATA *KeyData,UINTN StrIndex,UINTN PasswordLength, CHAR16 *OutChar
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HelperIsPasswordCharValid(EFI_INPUT_KEY *Key,AMI_EFI_KEY_DATA *KeyData,UINTN StrIndex,UINTN PasswordLength, CHAR16 *OutChar)
+{
+ if ( CheckIsAllowedPasswordChar(Key->UnicodeChar) && ( StrIndex < PasswordLength ) )
+ {
+ *OutChar = Key->UnicodeChar;
+ return EFI_SUCCESS;
+ }
+
+ return EFI_UNSUPPORTED;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: IsToggleStateKey
+//
+// Description: function to check Is any of ToggleStateKey (CapsLock,Numlock ScrollLock) Keys pressed.
+//
+// Input: ACTION_DATA *Data
+//
+// Output: TRUE/FALSE
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN IsToggleStateKey(ACTION_DATA *Data)
+{
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ {
+ // Normal EFI_KEY will return ScanCode and Unicode as 0 for this toggleStateKeys.
+ if(Data->Input.Data.AmiKey.Key.ScanCode || Data->Input.Data.AmiKey.Key.UnicodeChar)
+ return FALSE;
+ else
+ return TRUE;
+ }
+ else
+ return FALSE;
+
+}
+#endif
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdateBootVariables
+//
+// Description: Dummy function for UpdateBootVariables
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID UpdateBootVariables ()
+{
+ // There is some issue with TSE Lite with bellow calls. So adding as a dummy function.
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdateDriverVariables
+//
+// Description: Dummy function for UpdateDriverVariables
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID UpdateDriverVariables () //EIP70421 & 70422 Support for driver order
+{
+ // There is some issue with TSE Lite with bellow calls. So adding as a dummy function.
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/UefiAction.c b/EDK/MiniSetup/TseLite/UefiAction.c
new file mode 100644
index 0000000..5f822a7
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/UefiAction.c
@@ -0,0 +1,498 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/UefiAction.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 17 $
+//
+// $Date: 5/01/14 3:46p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/UefiAction.c $
+//
+// 17 5/01/14 3:46p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 16 4/23/14 2:55a Premkumara
+// [TAG] EIP153045
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] After selecting UEFI action control either by mouse/key and
+// try to exit application, TSE is not prompting "Save and Reset" message
+// to reset the system
+// [RootCause] When RESET_REQUIRED flag is set for text control TSE is
+// not setting gResetRequired flag for Interactive Text control(Action
+// type control).
+// [Solution] Setting gResetRequired flag for action type controls when
+// action type controls is selected or modified either using mouse/Key.
+// [Files] UefiAction.c
+//
+// 15 2/11/14 8:48p Arunsb
+// [TAG] EIP147140
+// [Category] Bug Fix
+// [Severity:] Normal
+// [Symptom:] UefiActionHandleAction() doesnt handle mouse clicks
+// [Root Cause] The function UefiActionHandleAction doesnt handle mouse
+// actions
+// [Solution] Added mouse action handling support to the function
+// UefiActionHandleAction
+// [Files] UefiAction.c
+//
+// 14 10/18/12 6:03a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 13 12/01/11 7:42a Rajashakerg
+// [TAG] EIP75464
+// [Category] Improvement
+// [Description] Improper handling of action controls
+// [Files] SubMenu.c, UefiAction.c, HiiCallback.c, Uefi21Wapper.c
+//
+// 12 11/30/11 12:29a Premkumara
+// [TAG] EIP75351
+// [Category] Improvement
+// [Description] Static code analysis.Suppress the warnings from static
+// code analyzer
+// [Files] String.c, HiiString21.c, TseAdvanced.c, Special.c,
+// UefiAction., Time.c, PopupEdit.c, MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 11 11/28/11 5:01a Rajashakerg
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Callback handling :For interactive controls updating
+// the currnet vaule in cache even when hii callback returns error status.
+// [Files] Date.c, SubMenu.c, ordlistbox.c, time.c, UefiAction.c,
+// hii.h, uefi20Wapper.c, HiiCallback.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 10 11/21/11 10:47a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 9 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 8 3/21/11 12:48a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 7 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 6 2/01/11 7:34p Madhans
+// [TAG] - EIP 50737
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom] - Suppressing the Interactive control does not work
+// correctly.
+// [RootCause] - The control conditional pointer if not set correctly.
+// [Solution]- To fix the Control condition pointer. And identify the
+// suppress if related to UEFI action control
+// [Files] - UefiAction.c TseLiteHelper.c hii.h uefi20wapper.c
+// uefi21wapper.c
+//
+// 5 12/02/10 5:21p Madhans
+// [TAG] - EIP 49557
+// [Category]- defect
+// [Severity]- Mordarate
+// [Symptom]- UEFIAction controls does not work correctly.
+// [Rootcause] - Action controls does not Process the QuestionResp
+// correctly.
+// [Solution]- Fix done UEFIAction to check for QuestionResp and call the
+// callback
+// [Files] - uefiaction.c and uefi21wapper.c
+//
+// 4 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 3 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 4 2/19/10 8:19a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 6/23/09 6:53p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: UefiAction.c
+//
+// Description: This file contains code to handle the uefi actions
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "Minisetup.h"
+
+UEFI_ACTION_METHODS gUefiAction =
+{
+ UefiActionCreate,
+ LabelDestroy,
+ UefiActionInitialize,
+ UefiActionDraw,
+ UefiActionHandleAction,
+ LabelSetCallback,
+ LabelSetFocus,
+ LabelSetPosition,
+ LabelSetDimensions,
+ LabelSetAttributes,
+ LabelGetControlHeight
+};
+
+EFI_STATUS _ProcessActionCallback(CONTROL_INFO * ControlData, BOOLEAN InteractiveText);
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UefiActionCreate
+//
+// Description: Function to create an Action Control.
+//
+// Input: VOID **object
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS UefiActionCreate( VOID **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(UEFI_ACTION_DATA) );
+
+ if ( *object == NULL )
+ {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ ((UEFI_ACTION_DATA*)(*object))->Methods = &gUefiAction;
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UefiActionInitialize
+//
+// Description: Function to Initialize an Action Control.
+//
+// Input: VOID *object, VOID *data
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS UefiActionInitialize( VOID *object, VOID *data )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UEFI_ACTION_DATA *Action = (UEFI_ACTION_DATA*) object;
+
+ Status = gControl.Initialize( Action, data );
+ if (EFI_ERROR(Status))
+ {
+ goto DONE;
+ }
+
+ // add extra initialization here...
+ Action->Interval = (UINT8)Action->ControlData.ControlFlags.ControlRefresh;
+ Action->ControlData.ControlHelp = Action->ControlData.ControlHelp? Action->ControlData.ControlHelp :
+ UefiGetHelpField(Action->ControlData.ControlPtr);
+
+ SetControlColorsHook(NULL, NULL, NULL, NULL, &(Action->SelBGColor), &(Action->SelFGColor),
+ &(Action->BGColor), &(Action->FGColor), NULL, NULL, NULL, NULL, NULL, NULL, NULL );
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UefiActionDraw
+//
+// Description: Function to draw an Action Control.
+//
+// Input: VOID *object
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS UefiActionDraw( VOID *object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UEFI_ACTION_DATA *Action = (UEFI_ACTION_DATA*) object;
+
+ CHAR16 *text;
+ UINT16 token = 0;
+ UINT8 ColorLabel = Action->FGColor;
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( Action->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &Action->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ Status = EFI_UNSUPPORTED;
+ goto DONE;
+ break;
+ }
+ //}
+
+ token = UefiGetPromptField(Action->ControlData.ControlPtr);
+ text = HiiGetString( Action->ControlData.ControlHandle, token);
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == text){
+ text = EfiLibAllocateZeroPool(2*sizeof(CHAR16));
+ if(!text)
+ return EFI_NOT_FOUND;
+ EfiStrCpy(text,L" ");
+ }
+
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(Action->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( Action->Left , Action->Top,
+ (UINTN)(Action->Width),(UINTN) Action->Height,
+ text,(UINT8)( (Action->ControlFocus) ?
+ Action->SelBGColor | Action->SelFGColor :
+ Action->BGColor | ColorLabel ));
+ }
+ else
+ {
+ // use frame width minus margins as available space
+ // boundary overflow check
+ if ( (TestPrintLength( text) / (NG_SIZE)) > (UINTN)(Action->Width))
+ text[HiiFindStrPrintBoundary(text,(UINTN)(Action->Width))] = L'\0';
+
+ DrawStringWithAttribute( Action->Left , Action->Top, text,
+ (UINT8)( (Action->ControlFocus) ?
+ Action->SelBGColor | Action->SelFGColor :
+ Action->BGColor | ColorLabel /*Action->FGColor*/ ));
+ }
+
+ MemFreePointer( (VOID **)&text );
+ FlushLines( Action->Top , Action->Top );
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UefiActionHandleAction
+//
+// Description: Function to handle the Label actions.
+//
+// Input: VOID *object, ACTION_DATA *data
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS UefiActionHandleAction(VOID *object, ACTION_DATA *data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UEFI_ACTION_DATA *Action = (UEFI_ACTION_DATA*) object;
+ UINT16 Value = 0;
+ BOOLEAN Selected = FALSE;
+
+ if (data->Input.Type == ACTION_TYPE_MOUSE) //EIP-147140
+ {
+ if(ControlActionSelect == MapControlMouseActionHook(&data->Input.Data.MouseInfo))
+ //EIP-123727 check whether MouseTop is within the Height and Width of Interactive Text Control or not
+ if((data->Input.Data.MouseInfo.Top >= (UINT32)Action->Top) && (data->Input.Data.MouseInfo.Top < (UINT32)(Action->Top+Action->Height)) &&
+ (data->Input.Data.MouseInfo.Left >= (UINT32)Action->Left) && (data->Input.Data.MouseInfo.Left < (UINT32)(Action->Left+Action->Width))
+ )
+ {
+ Selected = TRUE;
+ }
+ }
+
+ if ( data->Input.Type == ACTION_TYPE_KEY )
+ {
+ if ( ControlActionSelect == MapControlKeysHook(data->Input.Data.AmiKey) )
+ Selected = TRUE;
+ }
+
+ if (Selected )
+ {
+ MouseStop();
+
+ if (Action->ControlData.ControlFlags.ControlReset) //EIP-153045 Showing Save & Reset when Interactive text control is selected and try to exit TSE
+ gResetRequired = TRUE;
+
+ //Process UefiAction QuestionConfig
+ Status = ProcessActionQuestionConfiguration(&Action->ControlData);
+
+ if(EFI_ERROR(Status))
+ {
+ //goto DONE;
+ }
+ //Process UefiAction Callback if any
+ Status = _ProcessActionCallback(&Action->ControlData, FALSE);
+ return EFI_SUCCESS; //EIP75464 :Status from previous functions are already been handled. So return EFI_SUCCESS
+ }
+
+ if ( data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ if(--Action->Interval == 0)
+ {
+ Action->Interval = (UINT8)Action->ControlData.ControlFlags.ControlRefresh;
+ Value = UefiTseLiteGetAmiCallbackIndex(Action->ControlData.ControlConditionalPtr,Action->ControlData.ControlPtr );
+ if(Value == INTERACTIVE_TEXT_VALUE)
+ {
+ //Process UefiAction Callback if any
+ Status = _ProcessActionCallback(&Action->ControlData, TRUE);
+ }
+ else
+ return EFI_SUCCESS; // If it is not Interactive Test just do the Redraw
+ }
+ }
+
+//DONE:
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _ProcessActionCallback
+//
+// Description: Function process action callbacks
+//
+// Input: CONTROL_INFO * ControlData, BOOLEAN InteractiveText
+//
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _ProcessActionCallback(CONTROL_INFO * ControlData, BOOLEAN InteractiveText)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if(UefiIsInteractive(ControlData))
+ {
+ if(InteractiveText)
+ {
+ Status = SpecialActionCallBack(ControlData, UefiGetControlKey(ControlData));
+ }else
+ {
+ UefiPreControlUpdate(NULL);
+ Status = CallFormCallBack(ControlData, UefiGetControlKey(ControlData), FALSE, AMI_CALLBACK_CONTROL_UPDATE);////EIP-53480: Implementation of FormBrowser with actions support
+ }
+ }
+
+ return Status;
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/UefiAction.h b/EDK/MiniSetup/TseLite/UefiAction.h
new file mode 100644
index 0000000..a0f067f
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/UefiAction.h
@@ -0,0 +1,119 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/UefiAction.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 5 $
+//
+// $Date: 10/18/12 6:03a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/UefiAction.h $
+//
+// 5 10/18/12 6:03a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 7 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 5 2/19/10 8:19a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 7/31/09 6:35p Presannar
+// Remove Include Tiano.h and instead include Minisetup.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: UefiAction.h
+//
+// Description: Header file for UefiAction data
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _UEFI_ACTION_H_
+#define _UEFI_ACTION_H_
+
+#include "minisetup.h"
+
+#include "control.h"
+#include "action.h"
+
+typedef struct _UEFI_ACTION_METHODS UEFI_ACTION_METHODS;
+
+#define UEFI_ACTION_MEMBER_VARIABLES \
+ LABEL_MEMBER_VARIABLES \
+ UINT8 Interval;
+
+typedef struct _UEFI_ACTION_DATA
+{
+ UEFI_ACTION_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ UEFI_ACTION_MEMBER_VARIABLES
+}
+UEFI_ACTION_DATA;
+
+#define UEFI_ACTION_METHOD_FUNCTIONS
+
+struct _UEFI_ACTION_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ LABEL_METHOD_FUNCTIONS
+ UEFI_ACTION_METHOD_FUNCTIONS
+};
+
+extern UEFI_ACTION_METHODS gUefiAction;
+
+// Object Methods
+EFI_STATUS UefiActionCreate( VOID **object );
+EFI_STATUS UefiActionInitialize( VOID *object, VOID *data );
+EFI_STATUS UefiActionDraw( VOID *object );
+EFI_STATUS UefiActionHandleAction(VOID *object, ACTION_DATA *Data);
+
+#endif /*#ifndef _UEFI_ACTION_H_*/
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/action.h b/EDK/MiniSetup/TseLite/action.h
new file mode 100644
index 0000000..313f9fd
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/action.h
@@ -0,0 +1,163 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/action.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 5 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/action.h $
+//
+// 5 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 8 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Action.h
+//
+// Description: Header file for code to handle different actions.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _ACTION_H_
+#define _ACTION_H_
+
+#include "Minisetup.h"
+#include "commonoem.h"
+#define ACTION_TYPE_NULL 0
+#define ACTION_TYPE_KEY 1
+#define ACTION_TYPE_TIMER 2
+#define ACTION_TYPE_MOUSE 3
+
+// In terms of 100ns units
+#define ONE_SEC 10000000
+
+typedef struct _ACTION_INPUT
+{
+ UINT16 Type;
+ union
+ {
+ AMI_EFI_KEY_DATA AmiKey;
+ UINT32 TimerCount;
+ MOUSE_INFO MouseInfo;
+ }
+ Data;
+}
+ACTION_INPUT;
+
+#define ACTION_MEMBER_VARIABLES \
+ ACTION_INPUT Input; \
+ UINT32 TimerCount; \
+ EFI_EVENT TimerEvent;
+
+typedef struct _ACTION_METHODS ACTION_METHODS;
+
+typedef struct _ACTION_DATA
+{
+ ACTION_METHODS *Methods;
+
+ ACTION_MEMBER_VARIABLES
+
+}
+ACTION_DATA;
+
+typedef EFI_STATUS (*ACTION_METHOD_CREATE) ( ACTION_DATA **object );
+typedef EFI_STATUS (*ACTION_METHOD_DESTROY) ( ACTION_DATA *object, BOOLEAN freeMem );
+typedef EFI_STATUS (*ACTION_METHOD_GET_ACTION) ( ACTION_DATA *object );
+typedef EFI_STATUS (*ACTION_METHOD_CLEAR_ACTION) ( ACTION_DATA *object );
+
+#define ACTION_METHOD_FUNCTIONS \
+ ACTION_METHOD_CREATE Create; \
+ ACTION_METHOD_DESTROY Destroy; \
+ ACTION_METHOD_GET_ACTION GetAction; \
+ ACTION_METHOD_CLEAR_ACTION ClearAction;
+
+struct _ACTION_METHODS
+{
+ ACTION_METHOD_FUNCTIONS
+};
+
+extern ACTION_METHODS gAction;
+
+// Action Methods
+EFI_STATUS ActionCreate( ACTION_DATA **object );
+EFI_STATUS ActionDestroy( ACTION_DATA *object, BOOLEAN freeMem );
+EFI_STATUS ActionGetAction( ACTION_DATA *object );
+EFI_STATUS ActionClearAction( ACTION_DATA *object );
+
+//
+// Internal functions
+//
+
+EFI_STATUS _ActionReadKey( AMI_EFI_KEY_DATA *pAmiKey, UINT64 Timeout );
+VOID _ActionTimer( EFI_EVENT Event, VOID *Context );
+VOID _ActionInstallTimer( ACTION_DATA *object, UINT64 TriggerTime );
+
+#endif /* _ACTION_H_ */
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/application.c b/EDK/MiniSetup/TseLite/application.c
new file mode 100644
index 0000000..0ede072
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/application.c
@@ -0,0 +1,436 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/application.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 12 $
+//
+// $Date: 5/03/14 4:33p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/application.c $
+//
+// 12 5/03/14 4:33p Arunsb
+// Build error rectified
+//
+// 11 5/03/14 3:38p Arunsb
+// [TAG] EIP154569
+// [Category] Improvement
+// [Description] Handling clicks in application level for 80*25 mode also.
+// [Files] LegacyBin.sdl. EzportBin.sdl, EzportPlusBin.sdl and
+// application.c
+//
+// 10 9/19/13 8:01a Arunsb
+// [TAG] EIP127375
+// [Category] Bug Fix
+// [Severity:] Critical
+// [Symptom:] Legacy boot doesn't work after UEFI Shell is launched from
+// LaunchAppHotkey menu. The system hangs
+// [Root Cause] If ShowPostMsgBoxEx is invoked through postmgr protcol
+// then gMsgBoxAction will be NULL initially,
+// so this time action is assigned and used.
+// ACTION_DATA *action = gMsgBoxAction; so accessing NULL pointer leads to
+// hang.
+// [Solution] gMsgBoxAction is created again inside ShowPostMsgBoxEx,
+// reassign gMsgBoxAction to action.
+// [Files] TseAdvanced.c
+//
+// 9 5/22/13 10:40a Arunsb
+// [TAG] EIP122907
+// [Category] Improvement
+// [Description] For getting name value offset preserving page number
+// then it will be easy to find handle of the hii which published name
+// value.
+//
+// 8 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 6/29/11 6:21p Rajashakerg
+// Updated the file for Hotkey and hotclicks to return their exact status
+//
+// 6 6/29/11 12:52p Rajashakerg
+// [TAG] EIP47086
+// [Category] New Feature
+// [Description] Right clicking from the Main page is not exiting from
+// BIOS setup.
+//
+// [Files] minisetup.h, Ezport\style.h,Ezport\EzportBin.sdl,
+// Ezport\EzportBin.mak, Ezport\ezport.c, Ezport\EzportBin.cif,
+// EzportPlus\style.h, EzportPlus\EzportPlusBin.sdl, EzportPlusBin.mak,
+// EzportPlus\EzportPlusBin.cif, EzportPlus\ezportplus.c, Legacy\style.h,
+// Legacy\EzportPlusBin.sdl, Legacy\LegacyBin.mak, Legacy\LegacyBin.cif,
+// Legacy\legacy.c, TseLiteBin.sdl, TseLite.cif, Memo.c, frame.c,
+// application.h, application.c, commonoem.h, CommonHelper.c
+//
+// 5 3/26/10 5:06p Madhans
+// EIP 36704 : Fix for Making sure to make the Variable to NULL after it
+// is Freed up.
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 1/09/10 6:25a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 8/19/09 12:58p Madhans
+// To handle ToggleStateKeys
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Application.c
+//
+// Description: This file contains code to handle Application.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+APPLICATION_METHODS gApplication =
+{
+ ApplicationCreate,
+ ApplicationDestroy,
+ ApplicationInitialize,
+ ApplicationEmptyMethod,
+ ApplicationHandleAction,
+ ApplicationSetCallback,
+ ApplicationAddPage
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ApplicationCreate
+//
+// Description: Function to create an application, which uses the Object functions.
+//
+// Input: APPLICATION_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ApplicationCreate( APPLICATION_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(APPLICATION_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gObject.Create( object );
+ if ( EFI_ERROR( Status ) )
+ {
+ MemFreePointer( (VOID **)object );
+ return Status;
+ }
+
+ (*object)->Methods = &gApplication;
+ (*object)->CompleteRedraw = TRUE;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ApplicationDestroy
+//
+// Description: Function to destroy an application, which uses the Object functions.
+//
+// Input: APPLICATION_DATA *app, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ApplicationDestroy( APPLICATION_DATA *app, BOOLEAN freeMem )
+{
+ UINT32 i;
+
+ if ( app->Action )
+ gAction.Destroy( app->Action, TRUE );
+
+ app->Action = NULL;
+ gMsgBoxAction = NULL; //EIP127375, if not made NULL here, then TSE will try to use the freed memory in above step.
+
+ for ( i = 0; i < app->PageCount; i++ )
+ if(app->PageList[i] !=NULL)
+ gPage.Destroy( app->PageList[i], TRUE );
+
+ if ( app->PageList )
+ MemFreePointer( (VOID **)&app->PageList );
+
+ for ( i = 0; i < app->HotKeyCount; i++ )
+ gHotKey.Destroy( app->HotKeyList[i], TRUE );
+
+//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+ for ( i = 0; i < app->HotClickCount; i++ )
+ gHotClick.Destroy( app->HotClickList[i], TRUE );
+
+ if ( app->HotKeyList )
+ MemFreePointer( (VOID **)&app->HotKeyList );
+
+//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+ if ( app->HotClickList )
+ MemFreePointer( (VOID **)&app->HotClickList );
+
+
+ gObject.Destroy( app, FALSE );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&app );
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS ApplicationEmptyMethod( APPLICATION_DATA *app )
+{
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ApplicationInitialize
+//
+// Description: Function to initialize an application, which uses the Object functions.
+//
+// Input: APPLICATION_DATA *app, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+extern UINT32 gtempCurrentPage;
+EFI_STATUS ApplicationInitialize( APPLICATION_DATA *app, VOID *data )
+{
+ EFI_STATUS Status;
+
+ UINT32 i;
+
+ Status = gAction.Create( &app->Action );
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ if ( gPages->PageCount == 0 )
+ return EFI_OUT_OF_RESOURCES;
+
+ for ( i = 0; i < gPages->PageCount; i++ )
+ {
+ if (NULL == gApp)
+ {
+ gtempCurrentPage = i; //Will be used in UefiGetQuestionOffset. Since gApp will not be filled but we need handle to find name value variable so
+ } //saving current page
+ else
+ {
+ gApp->CurrentPage = i;
+ }
+ ApplicationAddPage( app, (UINT8 *)data + gPages->PageList[i] );
+ }
+
+ app->HotKeyList = EfiLibAllocateZeroPool( sizeof(HOTKEY_DATA *) * gHotKeyCount );
+
+//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+ app->HotClickList = EfiLibAllocateZeroPool( sizeof(HOTCLICK_DATA *) * gHotClickCount );
+
+ if ( app->HotKeyList == NULL )
+ return Status;
+
+//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+ if ( app->HotClickList == NULL )
+ return Status;
+
+ app->HotKeyCount = gHotKeyCount;
+
+//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+ app->HotClickCount = gHotClickCount;
+
+ for ( i = 0; i < app->HotKeyCount; i++ )
+ {
+ if ( gHotKey.Create( &app->HotKeyList[i] ) != EFI_SUCCESS )
+ continue;
+
+ gHotKey.Initialize( app->HotKeyList[i], &gHotKeyInfo[i] );
+ gHotKey.SetCallback( app->HotKeyList[i], app, gHotKeyInfo[i].Callback, NULL );
+ }
+
+//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+ for ( i = 0; i < app->HotClickCount; i++ )
+ {
+ if ( gHotClick.Create( &app->HotClickList[i] ) != EFI_SUCCESS )
+ continue;
+
+ gHotClick.Initialize( app->HotClickList[i], &gHotClickInfo[i] );
+ gHotClick.SetCallback( app->HotClickList[i], app, gHotClickInfo[i].Callback, NULL );
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ApplicationHandleAction
+//
+// Description: Function to handle the application actions.
+//
+// Input: APPLICATION_DATA *app, ACTION_DATA *action
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ApplicationHandleAction( APPLICATION_DATA *app, ACTION_DATA *action )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT32 i;
+
+ for ( i = 0; i < app->HotKeyCount; i++ )
+ {
+ Status = gHotKey.HandleAction( app->HotKeyList[i], action );
+
+ if ( ! EFI_ERROR(Status) )
+ goto DONE;
+ }
+
+//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+ if ((31 == gMaxRows) && (100 == gMaxCols))
+ {
+ for ( i = 0; i < app->HotClickCount/2; i++ )
+ {
+ Status = gHotClick.HandleAction( app->HotClickList[i], action );
+
+ if ( ! EFI_ERROR(Status) )
+ return Status;
+ }
+ }
+ else if ((24 == gMaxRows) && (80 == gMaxCols))
+ {
+ for ( i = (UINT32)(app->HotClickCount/2); i < (app->HotClickCount-1); i++ )
+ {
+ Status = gHotClick.HandleAction( app->HotClickList[i], action );
+
+ if ( ! EFI_ERROR(Status) )
+ return Status;
+ }
+ }
+DONE:
+ if(Status!=EFI_SUCCESS && IsToggleStateKey(action))
+ Status = EFI_SUCCESS;
+
+ return Status;
+}
+
+EFI_STATUS ApplicationSetCallback( APPLICATION_DATA *app, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gObject.SetCallback( app, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ApplicationAddPage
+//
+// Description: Function to add a page to the application.
+//
+// Input: APPLICATION_DATA *app, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ApplicationAddPage( APPLICATION_DATA *app, VOID *data )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+ PAGE_DATA **page;
+ UINT32 count = app->PageCount;
+
+ page = MemReallocateZeroPool( app->PageList, count * sizeof(PAGE_DATA *), (count + 1) * sizeof(PAGE_DATA *) );
+ if ( page == NULL )
+ return Status;
+
+ app->PageList = page;
+ page = &app->PageList[ count ];
+
+ if( ((PAGE_INFO*)data)->PageHandle == 0)
+ {
+ app->PageCount++;
+ //return EFI_SUCCESS , page space left , but no page to create.
+ return EFI_SUCCESS;
+ }
+
+ Status = gPage.Create( page );
+ if ( ! EFI_ERROR( Status ) )
+ {
+ Status = gPage.Initialize( *page, data );
+ if ( ! EFI_ERROR( Status ) )
+ app->PageCount++;
+ else
+ {
+ gPage.Destroy( *page, TRUE );
+ *page = NULL;
+ }
+ }
+
+ return Status;
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/application.h b/EDK/MiniSetup/TseLite/application.h
new file mode 100644
index 0000000..2ba7b07
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/application.h
@@ -0,0 +1,180 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/application.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 7 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/application.h $
+//
+// 7 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 8 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 6 6/29/11 12:54p Rajashakerg
+// [TAG] EIP47086
+// [Category] New Feature
+// [Description] Right clicking from the Main page is not exiting from
+// BIOS setup.
+//
+// [Files] minisetup.h, Ezport\style.h,Ezport\EzportBin.sdl,
+// Ezport\EzportBin.mak, Ezport\ezport.c, Ezport\EzportBin.cif,
+// EzportPlus\style.h, EzportPlus\EzportPlusBin.sdl, EzportPlusBin.mak,
+// EzportPlus\EzportPlusBin.cif, EzportPlus\ezportplus.c, Legacy\style.h,
+// Legacy\EzportPlusBin.sdl, Legacy\LegacyBin.mak, Legacy\LegacyBin.cif,
+// Legacy\legacy.c, TseLiteBin.sdl, TseLite.cif, Memo.c, frame.c,
+// application.h, application.c, commonoem.h, CommonHelper.c
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Application.h
+//
+// Description: Header file for code to handle Application.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _APPLICATION_H_
+#define _APPLICATION_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "object.h"
+#include "action.h"
+#include "page.h"
+#include "hotkey.h"
+#include "hotclick.h"//EIP:47086 - Right clicking from the Main page is not exiting from BIOS setup.
+
+#define APPLICATION_MEMBER_VARIABLES \
+ ACTION_DATA *Action; \
+ UINT32 CurrentPage; \
+ UINT32 PageCount; \
+ PAGE_DATA **PageList; \
+ UINTN HotKeyCount; \
+ HOTKEY_DATA **HotKeyList; \
+ UINTN HotClickCount; \
+ HOTCLICK_DATA **HotClickList;\
+ BOOLEAN CompleteRedraw; \
+ BOOLEAN ClearScreen; \
+ BOOLEAN Quit; \
+ UINT32 OnRedraw;\
+ BOOLEAN Fixed;
+
+typedef struct _APPLICATION_METHODS APPLICATION_METHODS;
+
+typedef struct _APPLICATION_INFO
+{
+ UINT32 PageCount;
+}
+APPLICATION_INFO;
+
+typedef struct _APPLICATION_DATA
+{
+ APPLICATION_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ APPLICATION_MEMBER_VARIABLES
+
+}
+APPLICATION_DATA;
+
+typedef EFI_STATUS (*APPLICATION_METHOD_ADD_PAGE) ( APPLICATION_DATA *app, VOID *data );
+
+#define APPLICATION_METHOD_FUNCTIONS \
+ APPLICATION_METHOD_ADD_PAGE AddPage;
+
+struct _APPLICATION_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ APPLICATION_METHOD_FUNCTIONS
+};
+
+extern APPLICATION_METHODS gApplication;
+extern APPLICATION_DATA *gApp;
+
+// Object Methods
+EFI_STATUS ApplicationCreate( VOID **object );
+EFI_STATUS ApplicationDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS ApplicationInitialize( VOID *object, VOID *data );
+EFI_STATUS ApplicationEmptyMethod( VOID *object );
+EFI_STATUS ApplicationHandleAction( VOID *object, ACTION_DATA *Data );
+EFI_STATUS ApplicationSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Application Methods
+EFI_STATUS ApplicationAddPage( APPLICATION_DATA *app, VOID *data );
+
+#endif /* _APPLICATION_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/callback.c b/EDK/MiniSetup/TseLite/callback.c
new file mode 100644
index 0000000..1bd6f91
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/callback.c
@@ -0,0 +1,1341 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2013, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/callback.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 39 $
+//
+// $Date: 5/14/14 11:58a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/callback.c $
+//
+// 39 5/14/14 11:58a Arunsb
+// [TAG] EIP168723
+// [Description] Removed RT attribute for LegacyDevOrder variable.
+// [Files] bbs.c and callback.c
+//
+// 38 5/01/14 10:36p Arunsb
+// [TAG] EIP165284
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] System Abnormal when execute Load Default (F9) in BIOS
+// Setup
+// [RootCause] For QF_DATE_STORAGE_TIME and QF_TIME_STORAGE_TIME the
+// offset will be 0xFFFF so trying to load default it hung
+// [Solution] Checked the condition for 0xFFFF
+// [Files] callback.c
+//
+// 37 2/11/14 8:29p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 36 10/07/13 6:40a Premkumara
+// Checked-in proper changes
+//
+// 35 10/07/13 5:29a Premkumara
+// [TAG] EIP126466
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] BBSOrdre is not saving when Customized SetupMenu is used
+// (FixedBootOrder)
+// [RootCause] gBootData is NULL so causing crashing
+// [Solution] Checked for NULL and proceed with next BootData instead of
+// iterating for next boot data
+// [Files] TseLite\Callback.c
+//
+// 34 10/04/13 4:35p Arunsb
+// [TAG] EIP136259
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Restore Optimized Defaults doesn't work with IntelRCSetup
+// Page on TSE Label 5.004_AmiTse_2_16_1242
+// [RootCause] Non interactive controls also tried to get the default
+// through callback
+// [Solution] Interactive controls alone tried to get the default
+// through callback
+// [Files] callback.c
+//
+// 33 8/06/13 11:27p Arunsb
+// [TAG] EIP76394
+// [Category] Improvement
+// [Description] Support TSE Load/SaveUserDefaults call without
+// MesageBox
+// [Files] callback.c
+//
+// 32 7/02/13 10:08a Premkumara
+// [TAG] EIP120011
+// [Category] Improvement
+// [Description] Variable BootOrder and LegacyDevOrder need
+// fool-proofing function when TSE load variabled
+// [Files] Bbs.c, Boot.c, Callback.c, TseLiteHelper.c, Variable.c
+//
+// 31 7/02/13 3:49a Premkumara
+// [TAG] EIP127017
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] On loading optimal defaluts (F3 key) causing setup crash
+// [RootCause] NULL is not checked properly for gCurrLegacyBootData
+// value in LoadDefaults and LoadPreviousValues function
+// [Solution] Handle NULL check for gCurrLegacyBootData
+// [Files] Callback.c
+//
+// 29 6/10/13 10:48a Arunsb
+// Evaluating default in _LoadDefaults supported.
+// Callback as manufacturing changed to standard.
+// Inconsistent and submitif controls handled properly in _LoadDefaults
+//
+// 28 5/22/13 10:58a Premkumara
+// [TAG] EIP123432
+// [Category] Bug Fix
+// [Issue Faced] Take print screen for save & Exit msg box. OK
+// of msg box is consumed by Save & Exit msg box.
+// - Cursor is missing after taking print screen of popupedit box in
+// string control
+// - Printscreen support is not given for Filebrowser feature
+// [RootCause] - When msg box for Save&Exit is popped and printscreen
+// event is called and displaying msg box over Save&Exit. Then msgbox
+// handleaction for printscreen event will change the result value in
+// _CallbackMsgbox() function so it will break the while loop in
+// _CallbackGetValue() function so destroy the next msg box in
+// CallbackShowMessageBox() function.
+// - DrawCursor variable is not set to TRUE after printscreen event
+// [Solution] - Returning EFI_UNSUPPORTED for printscreen event handling
+// function for messgebox and change the result value to 0xff
+// - Support given for file browser feature
+// [Files] Callback.c, MessageBox.c, Minisetupext.c, PopupString.c,
+// AddBootOption.c
+// AmiTSEStr.uni, FakeToken.c
+//
+// 27 3/12/13 12:27p Rajashakerg
+// [TAG] EIP105167
+// [Category] Improvement
+// [Description] Making the specify setup items departing from F2/F3
+// effect.
+// [Files] AMITSE.sdl, CommonHelper.c, callback.c, minisetupext.h,
+// PopupPassword.c, SubMenu.c, HiiCallback.c
+//
+// 26 3/12/13 7:01a Rajashakerg
+// [TAG] EIP105167
+// [Category] Improvement
+// [Description] Making the specify setup items departing from F2/F3
+// effect.
+// [Files] AMITSE.sdl, CommonHelper.c, callback.c, minisetupext.h,
+// PopupPassword.c, SubMenu.c, HiiCallback.c
+//
+// 25 2/12/13 8:38a Arunsb
+// [TAG] EIP114800
+// [Category] Improvement
+// [Description] _SaveValues without MessageBox. If data param passed as
+// NULL then message box wont be displayed.
+// [Files] TseLite\callback.c
+//
+// 24 2/06/13 9:02a Arunsb
+// Checked in properly
+//
+// 24 1/31/13 12:52p Arunsb
+// [TAG] EIP109382
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Boot Device name incorrect when load default
+// [RootCause] Legacy offset in gbootdata corrupted so names displayed
+// improperly.
+// [Solution] Legacy offsets re-calculated properly
+// [Files] CommonHelper.c, BootOnly\bbs.c and callback.c
+//
+// 23 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 18 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 22 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 20 9/10/12 5:02a Rajashakerg
+// [TAG] EIP93881 and 93873
+// [Category] Improvement
+// [Description] need keep system password after Load default and
+// Password saved into NVRAM immediately(not buffer) while it is installed
+// in TSE
+// [Files] frame.c, callback.c, AMITSE.sdl, CommonHelper.c
+//
+// 19 5/29/12 4:38a Arunsb
+// [TAG] EIP91109
+// [Category] Improvement
+// [Description] Sync the Aptio IV source for AptioV
+//
+// 18 1/24/12 4:39a Arunsb
+// [TAG] EIP81581
+// [Category] Improvement
+// [Description] Default driver order support
+// [Files] globals.c, addbootoption.c, callback.c, minisetupext.h and
+// variable.c
+//
+// 17 1/19/12 10:52a Arunsb
+// [TAG] EIP79956
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Two boot option entries displayed with the single name
+// value
+// [RootCause] If defaults are loaded then boot order is trying to load
+// the improper boot order due to add boot option feature
+// [Solution] Boot order formed properly for add boot option case.
+// If no tsedefaultbootorder module present then gOptimalDefaults
+// [VARIABLE_ID_BOOT_ORDER] are saved properly in SaveAddDelBootOptions at
+// first time.
+// At first time optimal buffer is empty so it was filled with some junk
+// value so it is changed to fill the current variable list at first time
+// of saving with add boot option feature.
+// [Files] Addbootoption.c and callback.c
+//
+// 16 12/05/11 5:34a Rajashakerg
+// [TAG] EIP76381
+// [Category] Improvement
+// [Description] Performance: Improving variable data load and usage
+// [Files] callback.c, minisetupext.c, variable.c, variable.h,
+// minisetup.h, Hii.c, FormBrowser2.c
+//
+// 15 11/13/11 12:57p Arunsb
+// [TAG] EIP70421
+// [Category] New Feature
+// [Description] Support for driver order in TSE
+// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
+// boot.c,
+// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
+// addbootoption.c,
+// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
+// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
+// TseElink.h, variable.h,
+// setup.h, Boot.vfr and Setup.uni
+//
+// 14 8/26/11 8:20a Arunsb
+// [TAG] EIP65859
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Default bootorder is not loading for loading defautls
+// [RootCause] Boot device count not updated after restart
+// [Solution] Boot device count updated after restart too
+// [Files] callback.c
+//
+// 13 6/22/11 9:33a Premkumara
+// [TAG] EIP57547
+// [Category] Improvement
+// [Description] TSE Feature to Silently Load Defaults, Including Boot
+// Order Defaults
+// [Files] Callback.c
+//
+// 12 6/20/11 11:52a Rajashakerg
+// [TAG] EIP59417
+// [Category] New Feature
+// [Description] Spport LOAD_OPTION_HIDDEN option in TSE
+// [Files] boot.h, AMITSE.sdl, CommonHelper.c, bbs.c, boot.c,
+// minisetup.h, special.c, callback.c
+//
+// 11 3/28/11 9:11p Premkumara
+// [TAG] EIP56414
+// [Category] Improvement
+// [Description] TSE: Support for EFI_IFR_NO_SUBMIT_IF opcode
+//
+//
+//
+// [Files] Callback.c, FakeToken.c, AMITSEstr.uni, Parse.c, CtrlCond.c,
+// CtrlCond.h, ctrlcond.h, ctrlcond.c
+//
+// 10 3/21/11 12:30a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 9 10/05/10 5:38p Madhans
+// [TAG] - EIP 45299
+// [Category]- Enhancment
+// [Severity]- Minor
+// [Symptom]- TSE by default saves the Disbaled BBS devices device path in
+// NVRAM Varaiable "DisabledDevs" Variable. In Next boots it depend on
+// this variable to consider the device as disabled inaddtion to
+// LegacyDevOrder.
+// Some BDS customized projects don't want this.
+// [Solution]- TSE_SAVE_DISABLED_BBS_DEVICEPATH SDL token created to
+// control this option. Bydefault It is Enabled.
+// [Files] - callback.c bbs.c commonhelper.c minisetup.h AMITSE.sdl
+//
+// 8 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 7 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 6 3/26/10 5:25p Madhans
+// EIP 35562: Support To create Boot option in Capital letters.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 10 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 9 1/09/10 6:30a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 8 12/18/09 2:29p Madhans
+// EIP: 32350/32445 To fix the Add/Delete Boot option issues with TSE 2.0.
+// To load the boot manager variable when defaults are loaded.
+//
+// 7 10/09/09 10:21a Mallikarjunanv
+// updated by removing the PreSystemResetHook, this hook is moved to
+// MinisetupExt.c
+//
+// 6 10/07/09 11:20a Mallikarjunanv
+// Fix to EIP-25987(Load Optimized Defaults(F3) hangs with an empty page):
+// Added a condition to check whether the frame has any controls before
+// doing any operations on a control.
+//
+// 5 9/15/09 9:43a Sudhirv
+// updated the support of handling Add Del boot option and added hook
+// function call during reset
+//
+// 4 8/13/09 7:39a Mallikarjunanv
+// eip:24971 - supporting tse features without tse sources
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:07p Madhans
+// 2.1 language support.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: callback.c
+//
+// Description: This file contains code to handle callbacks
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+ACTION_DATA *gMsgBoxAction;
+
+UINTN _CallbackGetValue( MSGBOX_DATA *msgbox );
+VOID _CallbackMsgbox( VOID *container, VOID *object, VOID *cookie );
+VOID _LoadDefaults( NVRAM_VARIABLE *defaults, UINTN data );
+BOOLEAN _SaveValues( UINTN data );
+BOOLEAN LoadDefaultsFromDefaultBuffer( VOID );
+
+extern UINTN gPreviousMsgBox;
+extern UINTN gFailsafeMsgBox;
+extern UINTN gOptimalMsgBox;
+extern UINTN gSaveMsgBox;
+extern UINTN gSaveExitMsgBox;
+extern UINTN gExitMsgBox;
+extern UINTN gSaveResetMsgBox;
+extern UINTN gResetMsgBox;
+extern UINTN gHelpMsgBox;
+extern UINTN gSaveUserMsgBox;
+extern UINTN gLoadUserMsgBox;
+extern BOOLEAN gBrowserCallbackEnabled;
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LoadPreviousValues
+//
+// Description: Callback function for LoadPreviousValue.
+//
+// Input: Bool ShowMsgBox.
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID LoadPreviousValues( BOOLEAN showMsgBox )
+{
+ UINT8 result = MSGBOX_YES;
+ UINT16 CurrentBootOption=0;
+
+//- Fix for Screen corruption while editing Date/edit controls.
+ FRAME_DATA *MainFrame=NULL;
+//-
+
+ if ( showMsgBox )
+ result = CallbackShowMessageBox( (UINTN)gPreviousMsgBox, MSGBOX_TYPE_YESNO );
+
+ if ( result == MSGBOX_YES )
+ {
+ if(gCurrLegacyBootData)
+ {
+ UINT16 CurLegBootDataValid = 0;
+ UINT32 i;
+
+ // Check is gCurrLegacyBootData valid one
+ for (i = 0; i < gBootOptionCount; i++ )
+ {
+ if ( &gBootData[i] == gCurrLegacyBootData )
+ CurLegBootDataValid = 1;
+ }
+ // If valid
+ if(CurLegBootDataValid)
+ CurrentBootOption = gCurrLegacyBootData->Option;
+ else
+ gCurrLegacyBootData = NULL;
+ }
+
+ CleanTempNvramVariableList(); //EIP 76381 : Reset to read the variable from NVRAM
+ VarLoadVariables( (VOID **)&gVariableList, NULL );
+
+ // special provisions needed for language
+ //VarSetValue( VARIABLE_ID_LANGUAGE, 0, 3, gPrevLanguage );
+ VarSetNvram ( VARIABLE_ID_LANGUAGE, gPrevLanguage,gPrevLangSize );
+
+ ///Hook to Load previous saved values
+ LoadedPreviousValuesHook();
+
+ PasswordCommitChanges( FALSE );
+
+ TseDiscardAddDelBootOptions();
+ TseDiscardAddDelDriverOptions(); //EIP70421 & 70422 Support for driver order
+ // reinit the gCurrLegacyBootData
+ //if(gCurrLegacyBootData)
+ //{
+ gCurrLegacyBootData = BootGetBootData(CurrentBootOption);
+ if(gCurrLegacyBootData) //EIP-127017 Avoid crashing when press F3 to load previous values
+ VarSetValue(VARIABLE_ID_LEGACY_GROUP_INFO, 0, sizeof(UINT16), &(gCurrLegacyBootData->LegacyDevCount));
+ //}
+
+ if ( ! gVariableChanged )
+ gResetRequired = FALSE;
+
+ UEFICallSetupFormCallBack(AMI_CALLBACK_RETRIEVE);//EIP-53480: Calling the Wraper function with action AMI_CALLBACK_RETRIEVE
+
+ //EIP-126057
+ if(gApp!=NULL)
+ {
+ //Recreate the special controls to reflect changes
+ gApp->CompleteRedraw = TRUE;
+
+ //- Fix for Screen corruption while editing Date/edit controls.
+ MainFrame = gApp->PageList[gApp->CurrentPage]->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+ if(MainFrame->ControlCount)
+ if(MainFrame->CurrentControl != FRAME_NONE_FOCUSED)
+ if(MainFrame->ControlList[MainFrame->CurrentControl]->ControlActive == TRUE)
+ MainFrame->ControlList[MainFrame->CurrentControl]->ControlActive = FALSE;
+ // -
+ }
+ }
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LoadOptimalDefaults
+//
+// Description: Loads the optimal defaults.
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID LoadOptimalDefaults( VOID )
+{
+ ///Load optimal defaults modified as a hook
+ LoadSetupDefaultsHook( gOptimalDefaults, (UINTN)gOptimalMsgBox );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LoadFailsafeDefaults
+//
+// Description: Loads the failsafe defaults.
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID LoadFailsafeDefaults( VOID )
+{
+ ///Load Failsafe defaults modified as a hook
+ LoadSetupDefaultsHook( gFailsafeDefaults, (UINTN)gFailsafeMsgBox );
+}
+
+BOOLEAN TSEDonotLoadPasswordOnDefaults(VOID);//EIP 93881 & 93873 : Save pwd to nvram and not loading empty pwd on loading defaults.
+
+//EIP 105167 : START
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _LoadDefaults
+//
+// Description: Loads the defaults with optimal or Failsafe data.
+//
+// Input: Bool ShowMsgBox.
+//
+// Output: none
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID CsmRearrangeBBSOrder (VOID *nvPtr, VOID *DefaultBuffer);
+UINT16 EvaluateControlDefault (CONTROL_INFO *CtrlInfo, UINT64 *Defaults);
+VOID _LoadDefaults( NVRAM_VARIABLE *defaults, UINTN data )
+{
+ UINT32 i;
+ UINT16 CurrentBootOption=0;
+ EFI_STATUS Status;
+//- Fix for Screen corruption while editing Date/edit controls.
+ FRAME_DATA *MainFrame;
+//-
+
+ if ( data == (UINTN)NULL ?1:(CallbackShowMessageBox( data, MSGBOX_TYPE_YESNO ) == MSGBOX_YES) ) //EIP:57547 To avoid draw MessageBox when data is passed as NULL to load Defaults silently
+ {
+ UINT32 page, control;
+ gBrowserCallbackEnabled = TRUE;
+ if(gCurrLegacyBootData)
+ {
+ UINT16 CurLegBootDataValid = 0;
+
+ // Check is gCurrLegacyBootData valid one
+ for ( i = 0; i < gBootOptionCount; i++ )
+ {
+ if ( &gBootData[i] == gCurrLegacyBootData )
+ CurLegBootDataValid = 1;
+ }
+ // If valid
+ if(CurLegBootDataValid)
+ CurrentBootOption = gCurrLegacyBootData->Option;
+ else
+ gCurrLegacyBootData = NULL;
+ }
+
+
+
+ for ( page = 0; page < gPages->PageCount; page++ )
+ {
+ PAGE_INFO *pageInfo = (PAGE_INFO *)((UINTN)gApplicationData + gPages->PageList[page]);
+ UINTN Action;
+
+ if ( (NULL != pageInfo) && (0 == pageInfo->PageHandle) )
+ continue;
+
+ for ( control= 0; control < pageInfo->PageControls.ControlCount; control++ )
+ {
+ CONTROL_INFO *controlInfo = (CONTROL_INFO *)((UINTN)gControlInfo + pageInfo->PageControls.ControlList[control]);
+
+ if( NULL == controlInfo || NULL == controlInfo->ControlPtr) //Suppressing inconsistent and nosubmit controls so added check for ControlPtr
+ continue;
+
+ Status = EFI_SUCCESS;
+ if (UefiIsInteractive (controlInfo))
+ {
+ Action = UefiGetActionWapper (AMI_CALLBACK_FORM_DEFAULT_STANDARD);
+ Status = CallFormCallBack (controlInfo, UefiGetControlKey (controlInfo), FALSE, Action);
+ }
+ if (
+ (!UefiIsInteractive (controlInfo) || (EFI_UNSUPPORTED == Status)) && //if interactive control returned unsupported then load defaults from buffer
+ (!controlInfo->ControlFlags.ControlEvaluateDefault) &&
+ (defaults[controlInfo->ControlVariable].Size > 0)
+ )
+ {
+ UINT32 offset = 0, size = 0;
+
+ if ((!LoadDefaultsFromDefaultBuffer ()) && (controlInfo->ControlDataWidth == 0)) //If defaults not present for a control but if the offset present
+ { //in the variable which has atleast default then
+ continue; //try to load it if TSE_LOAD_DEFAULTS_FROM_DEFAULTS_BUFFER
+ } //is enabled.
+ if (CONTROL_TYPE_ORDERED_LIST != controlInfo->ControlType)
+ {
+ size = UefiGetWidth(controlInfo->ControlPtr);
+ }
+ else
+ {
+ size = controlInfo->ControlDataWidth;
+ }
+ if (0 == size) //For text and submenu skip loading defaults
+ {
+ continue;
+ }
+ offset = UefiGetQuestionOffset(controlInfo->ControlPtr);
+ if ((0xFFFF == offset) || ((offset + size) > defaults [controlInfo->ControlVariable].Size)) //QF_DATE_STORAGE_TIME and QF_TIME_STORAGE_TIME offsets will be 0xFFFF so we need to skip it
+ {
+ continue;
+ }
+ if ( ( controlInfo->ControlVariable == VARIABLE_ID_LANGUAGE) ||
+ ( controlInfo->ControlVariable == VARIABLE_ID_DEL_BOOT_OPTION) ||
+ ( controlInfo->ControlVariable == VARIABLE_ID_ADD_BOOT_OPTION) ||
+ ( controlInfo->ControlVariable == VARIABLE_ID_USER_DEFAULTS) ||
+ ( controlInfo->ControlVariable == VARIABLE_ID_IDE_SECURITY) ||
+ ( controlInfo->ControlVariable == VARIABLE_ID_LEGACY_DEV_INFO) ||
+ ( controlInfo->ControlVariable == VARIABLE_ID_LEGACY_GROUP_INFO) ||
+ ( controlInfo->ControlVariable == VARIABLE_ID_ADD_DRIVER_OPTION) || //EIP70421 & 70422 Support for driver order
+ (controlInfo->ControlVariable == VARIABLE_ID_DEL_DRIVER_OPTION) ||
+ ( (TSEDonotLoadPasswordOnDefaults()) && (controlInfo->ControlVariable == VARIABLE_ID_AMITSESETUP) ) ) //EIP 93881 & 93873 : Save pwd to nvram and not loading empty pwd on loading defaults.
+ continue;
+ else if( ((defaults[controlInfo->ControlVariable].Buffer != NULL) && (defaults[controlInfo->ControlVariable].Size))
+ &&((VARIABLE_ID_BOOT_ORDER == controlInfo->ControlVariable) || (VARIABLE_ID_DRIVER_ORDER == controlInfo->ControlVariable))
+ )
+ {
+ MemCopy (gVariableList[controlInfo->ControlVariable].Buffer, defaults[controlInfo->ControlVariable].Buffer, defaults[controlInfo->ControlVariable].Size);
+ gVariableList[controlInfo->ControlVariable].Size = defaults[controlInfo->ControlVariable].Size;
+ }
+ else if (VARIABLE_ID_BBS_ORDER == controlInfo->ControlVariable) //EIP109382: Since boot order loads first legacydevorder corrupted so restructuring with gbootdata
+ {
+ if((defaults[controlInfo->ControlVariable].Buffer != NULL) && (defaults[controlInfo->ControlVariable].Size))
+ CsmRearrangeBBSOrder (&(gVariableList [controlInfo->ControlVariable]), &(defaults[controlInfo->ControlVariable]));
+ }
+ else
+ {
+ if((defaults[controlInfo->ControlVariable].Buffer != NULL) && (defaults[controlInfo->ControlVariable].Size))
+ MemCopy (gVariableList [controlInfo->ControlVariable].Buffer + offset, defaults[controlInfo->ControlVariable].Buffer + offset, size);
+ }
+ }
+ if(controlInfo->ControlFlags.ControlEvaluateDefault)
+ {
+ UINT64 Defaults = 0 ;
+ UINT16 size = 0;
+ UINT32 offset = 0;
+
+ offset = UefiGetQuestionOffset(controlInfo->ControlPtr);
+
+ //EIP: 57402 Evaluating the Control Default
+ size = EvaluateControlDefault(controlInfo,&Defaults);
+ VarSetValue(controlInfo->ControlVariable, offset, size, &Defaults );
+ // EIP: 57402 Setiing the Evaluated value to the gOptimalDefaults
+ //if(DefaultId == EFI_HII_DEFAULT_CLASS_MANUFACTURING)
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gOptimalDefaults, controlInfo->ControlVariable, offset, size, &Defaults );
+ }
+ }
+ }
+
+ gBrowserCallbackEnabled = FALSE;
+ PasswordCommitChanges( FALSE );
+
+ TseDiscardAddDelBootOptions();
+ TseDiscardAddDelDriverOptions(); //EIP70421 & 70422 Support for driver order
+
+ // reinit the gCurrLegacyBootData
+// if(gCurrLegacyBootData) //(EIP61172) If defaults is loaded, boot order defaults is not loading after a restart. So commented.
+// { //(EIP61172)
+ gCurrLegacyBootData = BootGetBootData(CurrentBootOption);
+ if(gCurrLegacyBootData) //EIP-127017 Avoid crashing when press F3 to load defaults
+ VarSetValue(VARIABLE_ID_LEGACY_GROUP_INFO, 0, sizeof(UINT16), &(gCurrLegacyBootData->LegacyDevCount));
+// } //(EIP61172)
+
+ gResetRequired = TRUE;
+
+ LoadedConfigDefaultsHook();
+
+ //EIP-126057
+ if(gApp!=NULL)
+ {
+ //Recreate the special controls to reflect changes
+ gApp->CompleteRedraw = TRUE;
+
+ //- Fix for Screen corruption while editing Date/edit controls.
+ MainFrame = gApp->PageList[gApp->CurrentPage]->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+
+ //EIP-25987: Load Optimized Defaults(F3)hangs in a empty page || Fix: Check whether the frame has any controls before doing any operation on a control.
+ if(MainFrame->ControlCount)
+ if(MainFrame->CurrentControl != FRAME_NONE_FOCUSED)
+ if(MainFrame->ControlList[MainFrame->CurrentControl]->ControlActive == TRUE)
+ MainFrame->ControlList[MainFrame->CurrentControl]->ControlActive = FALSE;
+ // -
+ }
+ }
+}
+//EIP 105167 : END
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SaveAndExit
+//
+// Description: Function to save and exit
+//
+// Input: VOID
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN SaveAndExit( VOID )
+{
+ if ( _SaveValues( (UINTN)gSaveExitMsgBox ) )
+ {
+ gVariableChanged = TRUE;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SaveWithoutExit
+//
+// Description: Function to save without exit
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SaveWithoutExit( VOID )
+{
+ if ( _SaveValues( (UINTN)gSaveMsgBox ) )
+ gVariableChanged = TRUE;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SaveAndReset
+//
+// Description: Function to save and reset
+//
+// Input: VOID
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN SaveAndReset( VOID )
+{
+ if ( _SaveValues( (UINTN)gSaveResetMsgBox ) )
+ {
+ gVariableChanged = TRUE;
+ gResetRequired = TRUE;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ResetSys
+//
+// Description: Function to reset
+//
+// Input: VOID
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN ResetSys( VOID )
+{
+ if ( CallbackShowMessageBox( (UINTN)gResetMsgBox, MSGBOX_TYPE_YESNO ) == MSGBOX_YES )
+ {
+ gResetRequired = TRUE; // force a reset
+ gVariableChanged = FALSE;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _SaveValues
+//
+// Description: Function to save the given values
+//
+// Input: UINTN data
+//
+// Output: TRUE/FALSE
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN _SaveValues( UINTN data )
+{
+ UINT32 i;
+ NVRAM_VARIABLE *nvPtr;
+ EFI_GUID AmitseNvramUpdateGuid = AMITSE_NVRAM_UPDATE_GUID;
+ EFI_GUID AmitseBootOrderChangeGuid = AMITSE_BOOT_ORDER_CHANGE_GUID;
+
+ if (data == (UINTN)NULL ? 1 : (CallbackShowMessageBox (data, MSGBOX_TYPE_YESNO) == MSGBOX_YES) ) //To avoid draw MessageBox when data is passed as NULL to save data silently EIP114800
+ {
+ //Check for NO_SUBMIT_IF before saving data in every page
+ if(CheckNoSubmitIf())
+ {
+ return FALSE; //cant save Invalid Submit value
+ }
+ //EIP-126057
+ if(gApp!=NULL)
+ {
+ //Check for inconsistency before saving data
+ if(CheckInconsistence((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[gApp->CurrentPage])))
+ {
+ return FALSE; //cant save inconsistent value
+ }
+ }
+
+ if(gResetRequired)
+ { //Let's update the SaveState Variable
+ UINT32 SaveStateVarNum;
+ UINT16 SaveState=SETUP_SAVED_AND_RESET_REQUIRED;
+ if(VarGetVariableInfoId( SETUP_SAVE_STATE_INFO_KEY_ID, &SaveStateVarNum ))
+ VarSetValue(SaveStateVarNum,0,sizeof(UINT16),&SaveState);
+ }
+
+ nvPtr = gVariableList;
+ for ( i = 0; i < gVariables->VariableCount; i++, nvPtr++ )
+ {
+ if(VARIABLE_ID_BOOT_ORDER == i)
+ {
+ UINTN j,k=0,n=0, CurrSize = 0;
+ UINT16 *BootOrder = NULL, *CurrOrder = NULL;
+ BOOT_DATA *pBootData = NULL;
+
+ TseSaveAddDelBootOptions();
+
+ BootOrder = EfiLibAllocateZeroPool(nvPtr->Size);
+ MemCopy(BootOrder,nvPtr->Buffer,nvPtr->Size);
+
+ //Disable all options
+ for(j=0;j<gBootOptionCount;j++)
+ {
+ if (!(gBootData[j].Active & LOAD_OPTION_HIDDEN)) //TSE will not do the option anything if it is hidden
+ {
+ gBootData[j].Active &= ~(LOAD_OPTION_ACTIVE);
+ }
+ }
+ //Enable options in BootOrder
+ for(j=0;j<gBootOptionCount;j++)
+ {
+ pBootData = BootGetBootData(BootOrder[j]);
+ if(pBootData)
+ {
+ if (!(pBootData->Active & LOAD_OPTION_HIDDEN)) //TSE will not do the option anything if it is hidden
+ {
+ pBootData->Active |= LOAD_OPTION_ACTIVE;
+ }
+ }
+ }
+
+ //Save boot options
+ for(j=0;j<gBootOptionCount;j++)
+ {
+ CHAR16 varName[] = L"BootXXXX";
+ BOOT_OPTION *pOption;
+ UINTN OptionSize;
+
+ OptionSize = 0; pOption = NULL;
+ SPrint( varName, sizeof(CHAR16) * (EfiStrLen( varName )+1),gBootFormarSpecifier, gBootData[j].Option );
+ pOption = (BOOT_OPTION *)VarGetNvramName( varName, &gEfiGlobalVariableGuid, NULL, &OptionSize );
+
+ pOption->Active = gBootData[j].Active;
+
+ VarSetNvramName(varName,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ pOption,
+ OptionSize);
+
+ MemFreePointer((VOID **)&pOption);
+ }
+ n=0;
+ //Enabled options first
+ for(k=0;k<gBootOptionCount;k++)
+ {
+ if(DISABLED_BOOT_OPTION == BootOrder[k])
+ {
+ //add Disabled options
+ for(j=n; j < gBootOptionCount; j++ )
+ {
+ if ( (!(gBootData[j].Active & LOAD_OPTION_ACTIVE)) && (!(gBootData[j].Active & LOAD_OPTION_HIDDEN)) )
+ {
+ BootOrder[k] = gBootData[j].Option;
+ n=j;
+ n++;
+ break;
+ }
+ }
+ }
+
+ }
+
+ ASSERT(k==gBootOptionCount);
+
+ //Signal TPM if Boot order has changed
+ CurrOrder = VarGetNvramName(L"BootOrder", &gEfiGlobalVariableGuid, NULL, &CurrSize);
+
+ if( CurrSize != (k*sizeof(UINT16)) )
+ EfiLibNamedEventSignal (&AmitseBootOrderChangeGuid);
+ else if(CurrOrder)
+ {
+ if (MemCmp((UINT8 *)CurrOrder, (UINT8 *)BootOrder, CurrSize))
+ EfiLibNamedEventSignal (&AmitseBootOrderChangeGuid);
+ }
+
+ MemFreePointer((VOID **)&CurrOrder);
+
+ //Save boot order
+ VarSetNvramName(L"BootOrder",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ BootOrder,
+ k * sizeof(UINT16));
+
+ MemFreePointer((VOID **) &BootOrder);
+
+ //Continue to next variable
+ continue;
+ }
+ //EIP70421 & 70422 Support for driver order starts
+ if(VARIABLE_ID_DRIVER_ORDER == i)
+ {
+ UINTN j, k=0, n=0;
+ UINT16 *DriverOrder = NULL;
+ BOOT_DATA *pDriverData = NULL;
+
+ TseSaveAddDelDriverOptions ();
+
+ DriverOrder = EfiLibAllocateZeroPool (nvPtr->Size);
+ MemCopy (DriverOrder,nvPtr->Buffer,nvPtr->Size);
+
+ //Disable all options
+ for (j = 0; j < gDriverOptionCount; j ++)
+ {
+ if (!(gDriverData [j].Active & LOAD_OPTION_HIDDEN)) //TSE will not do the option anything if it is hidden
+ {
+ gDriverData [j].Active &= ~(LOAD_OPTION_ACTIVE);
+ }
+ }
+ //Enable options in DriverOrder
+ for (j = 0; j < gDriverOptionCount; j ++)
+ {
+ pDriverData = DriverGetDriverData (DriverOrder [j]);
+ if(pDriverData)
+ {
+ if (!(pDriverData->Active & LOAD_OPTION_HIDDEN)) //TSE will not do the option anything if it is hidden
+ {
+ pDriverData->Active |= LOAD_OPTION_ACTIVE;
+ }
+ }
+ }
+ //Save driver options
+ for (j = 0; j < gDriverOptionCount; j ++)
+ {
+ CHAR16 varName[] = L"DriverXXXX";
+ BOOT_OPTION *pOption;
+ UINTN OptionSize;
+
+ OptionSize = 0; pOption = NULL;
+ SPrint (varName, sizeof (CHAR16) * (EfiStrLen (varName) + 1), gDriverFormarSpecifier, gDriverData [j].Option );
+ pOption = (BOOT_OPTION *)VarGetNvramName (varName, &gEfiGlobalVariableGuid, NULL, &OptionSize );
+
+ pOption->Active = gDriverData [j].Active;
+
+ VarSetNvramName (varName,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ pOption,
+ OptionSize);
+
+ MemFreePointer((VOID **)&pOption);
+ }
+ n=0;
+ //Enabled options first
+ for (k = 0; k < gDriverOptionCount; k ++)
+ {
+ if(DISABLED_BOOT_OPTION == DriverOrder [k])
+ {
+ //add Disabled options
+ for (j = n; j < gDriverOptionCount; j++ )
+ {
+ if ( (!(gDriverData [j].Active & LOAD_OPTION_ACTIVE)) && (!(gDriverData [j].Active & LOAD_OPTION_HIDDEN)) )
+ {
+ DriverOrder [k] = gDriverData [j].Option;
+ n = j;
+ n ++;
+ break;
+ }
+ }
+ }
+
+ }
+
+ ASSERT (k == gDriverOptionCount);
+
+ //Signal TPM if Boot order has changed //No need of signalling the event for driver order change
+/* CurrOrder = VarGetNvramName (L"DriverOrder", &gEfiGlobalVariableGuid, NULL, &CurrSize);
+
+ if (CurrSize != (k*sizeof(UINT16)))
+ EfiLibNamedEventSignal (&AmitseBootOrderChangeGuid);
+ else if (CurrOrder)
+ {
+ if (MemCmp ((UINT8 *)CurrOrder, (UINT8 *)DriverOrder, CurrSize) )
+ EfiLibNamedEventSignal (&AmitseBootOrderChangeGuid);
+ }
+
+ MemFreePointer((VOID **)&CurrOrder);*/
+
+ //Save boot order
+ VarSetNvramName(L"DriverOrder",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ DriverOrder,
+ k * sizeof(UINT16));
+
+ MemFreePointer((VOID **) &DriverOrder);
+
+ //Continue to next variable
+ continue;
+ }
+ //EIP70421 & 70422 Support for driver order ends
+
+ if(VARIABLE_ID_BBS_ORDER == i)
+ {
+ CsmSaveBBSOrder(nvPtr);
+ //Continue to Next variable
+ continue;
+ }
+
+ VarSetNvram( i, nvPtr->Buffer, nvPtr->Size );
+ }
+
+ PasswordCommitChanges( TRUE );
+
+ TSESetHDDPassword();
+
+ SavedConfigChangesHook();
+
+ EfiLibNamedEventSignal (&AmitseNvramUpdateGuid);
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SaveBBSOrder
+//
+// Description: Function to save the bbs device order
+//
+// Input: NVRAM_VARIABLE *nvPtr
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID SaveBBSOrder(NVRAM_VARIABLE *nvPtr)
+{
+ UINT16 *BootOrder;
+ UINTN BootOrderSize,p;
+ BBS_ORDER_TABLE *NewLegacyOrder, *NewDevEntry, *BufferDevEntry;
+ UINT8 *NewBuffer, *NewBuffEntry;
+ BOOT_DATA *pBootData;
+ BBS_ORDER_LIST *BBSList = NULL;
+ UINT16 count,r,s;
+ UINT8 *CurrOrder = NULL;
+ UINTN CurrSize = 0;
+ UINTN DPSize = 0;
+ VOID *DisDPs = NULL;
+ EFI_GUID BootManGuid = BOOT_MANAGER_GUID;
+ EFI_GUID AmitseBootOrderChangeGuid = AMITSE_BOOT_ORDER_CHANGE_GUID;
+ UINT32 LegDevOrderAttribute = 7;
+
+ BootOrderSize = 0;
+ BootOrder = VarGetNvramName(L"BootOrder", &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
+
+ if (0 == BootOrderSize)
+ return; //continue;
+
+ NewLegacyOrder = EfiLibAllocateZeroPool(nvPtr->Size);
+ NewBuffer = EfiLibAllocateZeroPool(nvPtr->Size);
+
+ //NOTE: Taking advantage of the fact that
+ //VARIABLE_ID_BBS_ORDER is after
+ //VARIABLE_ID_BOOT_ORDER
+ NewDevEntry = NewLegacyOrder;
+ NewBuffEntry = NewBuffer;
+ for(p=0; p<(BootOrderSize/sizeof(UINT16)); p++)
+ {
+ pBootData = BootGetBootData(BootOrder[p]);
+ //EIP:59417 - Error Handling in case of pBootData is NULL. If its NULL the setupgets a CRASH
+ if(pBootData == NULL)
+ goto DONE;
+
+ if(BBSValidDevicePath(pBootData->DevicePath))
+ {
+ BufferDevEntry = (BBS_ORDER_TABLE *)(nvPtr->Buffer + pBootData->LegacyEntryOffset);
+
+ if ( (BufferDevEntry->Length >= nvPtr->Size) || (0 == BufferDevEntry->Length) ) //EIP-120011
+ {
+ goto DONE;
+ }
+
+ BBSList = pBootData->OrderList;
+
+ count = pBootData->LegacyDevCount;
+
+ MemCopy(NewDevEntry, BufferDevEntry, sizeof(UINT32)+(count+1)*sizeof(UINT16));
+ MemCopy(NewBuffEntry, BufferDevEntry, sizeof(UINT32)+(count+1)*sizeof(UINT16));
+
+ //----------------------------------------------------------------------------------//
+ // EIP-35863: This block considers the case of legacy devices being positioned //
+ // anywhere in the LegacyDevOrder (whether enabled or disabled) //
+ //----------------------------------------------------------------------------------//
+ if(count>0) //Disabled boot options exist
+ {
+ for(r=0;r<count;r++)
+ {
+ //See if a given index in BBSList exist in TypeEntry
+ for(s=0;s<count;s++)
+ {
+ if(BBSList[r].Index == NewDevEntry->Data[s])
+ {
+ break;
+ }
+ }
+
+ if(s>=count) //Index Not present
+ {
+ //Find the first disabled slot
+ for(s=0;s<count;s++)
+ {
+ if(NewDevEntry->Data[s] == DISABLED_BOOT_OPTION)
+ {
+ //Add device path to Nvram variable
+ if(gIsSaveDisabledBBSDevicePath)
+ CsmBBSSetDisabled(BBSList[r].Index, &DisDPs, &DPSize);
+ NewDevEntry->Data[s] = BBSList[r].Index;
+ NewDevEntry->Data[s] |= BBS_ORDER_DISABLE_MASK;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ pBootData->LegacyEntryOffset = (UINTN)NewDevEntry - (UINTN)NewLegacyOrder;
+
+ NewDevEntry = (BBS_ORDER_TABLE *)((UINTN)NewDevEntry + sizeof(UINT32)+(count+1)*sizeof(UINT16));
+ NewBuffEntry = NewBuffEntry + sizeof(UINT32)+(count+1)*sizeof(UINT16);
+ }
+ }
+
+DONE:
+ //Update the nv buffer with the re ordered list
+ MemFreePointer((VOID **) &(nvPtr->Buffer));
+ nvPtr->Buffer = NewBuffer;
+
+ //Signal TPM if BBS order has changed
+ CurrOrder = VarGetNvramName( L"LegacyDevOrder", &gLegacyDevGuid, &LegDevOrderAttribute, &CurrSize );
+
+ if(CurrOrder)
+ {
+ if(MemCmp((UINT8 *)CurrOrder, (UINT8 *)NewLegacyOrder, CurrSize))
+ EfiLibNamedEventSignal (&AmitseBootOrderChangeGuid);
+
+ MemFreePointer((VOID **) &CurrOrder);
+ }
+
+ //Save BBS order
+ VarSetNvramName(L"LegacyDevOrder",
+ &gLegacyDevGuid,
+ LegDevOrderAttribute,
+ NewLegacyOrder,
+ nvPtr->Size);
+
+ if(gIsSaveDisabledBBSDevicePath)
+ {
+ //Save disabled device paths
+ VarSetNvramName(L"DisabledDevs",
+ &BootManGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ DisDPs,
+ DPSize);
+
+ MemFreePointer((VOID **) &DisDPs);
+ MemFreePointer((VOID **) &BootOrder);
+ }
+ MemFreePointer((VOID **) &NewLegacyOrder);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ExitApplication
+//
+// Description: Function to exit form the setup application
+//
+// Input: None
+//
+// Output: TRUE/FALSE
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN ExitApplication( VOID )
+{
+ if ( CallbackShowMessageBox( (UINTN)gExitMsgBox, MSGBOX_TYPE_YESNO ) == MSGBOX_YES )
+ {
+ if ( ! gVariableChanged )
+ gResetRequired = FALSE;
+
+ LoadPreviousValues( FALSE );
+ gVariableChanged = FALSE;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ShowHelpMessageBox
+//
+// Description: Function to Display the help message box
+//
+// Input: None
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID ShowHelpMessageBox( VOID )
+{
+ CallbackShowMessageBox( (UINTN)gHelpMsgBox, MSGBOX_TYPE_OK | MSGBOX_STYLE_LEFT );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: CallbackShowMessageBox
+//
+// Description: Callback function to Display the message box
+//
+// Input : UINTN data,
+// UINT8 type
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT8 CallbackShowMessageBox( UINTN data, UINT8 type )
+{
+ EFI_STATUS Status;
+ UINT8 retValue = (UINT8)-1;
+ MSGBOX_DATA *msgbox = NULL;
+
+ CONTROL_INFO dummy;
+
+ Status = gMsgBox.Create( &msgbox );
+ if ( EFI_ERROR( Status ) )
+ return retValue;
+
+ MemSet( &dummy, sizeof(dummy), 0 );
+ dummy.ControlHandle = (VOID*)(UINTN)INVALID_HANDLE;
+ dummy.ControlPtr = (VOID*)data;
+ dummy.ControlFlags.ControlVisible = TRUE;
+
+ Status = gMsgBox.Initialize( msgbox, &dummy );
+ if ( EFI_ERROR( Status ) )
+ goto Done;
+
+ gMsgBox.SetType( msgbox, type );
+ retValue = (UINT8)_CallbackGetValue( msgbox );
+
+Done:
+ gMsgBox.Destroy( msgbox, TRUE );
+
+ return retValue;
+}
+
+static UINT8 result = (UINT8)-1;
+static CALLBACK_MESSAGEBOX gCbMsgBox = { { CALLBACK_TYPE_MESSAGEBOX, sizeof(CALLBACK_MESSAGEBOX) }, 0 };
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _CallbackGetValue
+//
+// Description: Callback function to get the message box return value
+//
+// Input: MSGBOX_DATA *msgbox
+//
+// Output: Message box return value
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN _CallbackGetValue( MSGBOX_DATA *msgbox )
+{
+ ACTION_DATA *action = gMsgBoxAction;
+ EFI_STATUS Status = EFI_SUCCESS;
+ result = (UINT8)-1;
+ gMsgBox.SetCallback( msgbox, NULL, _CallbackMsgbox, &gCbMsgBox );
+
+ while ( result == (UINT8)-1 )
+ {
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ gAction.ClearAction( action );
+
+ gMsgBox.Draw( msgbox );
+
+ if ( gAction.GetAction( action ) != EFI_SUCCESS )
+ continue;
+
+ Status = gMsgBox.HandleAction( msgbox, action );
+
+ if (EFI_ERROR(Status))//EIP-123432
+ result = 0xff;
+
+ DoRealFlushLines();
+ }
+
+ return result;
+}
+
+VOID _CallbackMsgbox( VOID *container, VOID *object, VOID *cookie )
+{
+ if ( (cookie != NULL) && ( ((CALLBACK_MESSAGEBOX*)cookie)->Header.Type == CALLBACK_TYPE_MESSAGEBOX) )
+ result = (UINT8)(((CALLBACK_MESSAGEBOX*)cookie)->Result);
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/callback.h b/EDK/MiniSetup/TseLite/callback.h
new file mode 100644
index 0000000..cf589b2
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/callback.h
@@ -0,0 +1,189 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/callback.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 6 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/callback.h $
+//
+// 6 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 8 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 1/09/10 6:30a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 6/24/09 6:10p Madhans
+// Made TSE_USE_EDK_LIBRARY=OFF to not to refer EDK module.
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: callback.h
+//
+// Description: Header file for code to handle callbacks
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _CALLBACK_H_
+#define _CALLBACK_H_
+
+
+#include "Minisetup.h"
+
+#define CALLBACK_TYPE_UNKNOWN 0
+#define CALLBACK_TYPE_SUBMENU 1
+#define CALLBACK_TYPE_VARIABLE 2
+#define CALLBACK_TYPE_MESSAGEBOX 3
+#define CALLBACK_TYPE_NVRAM 4
+#define CALLBACK_TYPE_DEFAULTS 5
+#define CALLBACK_TYPE_LABEL 6
+#define CALLBACK_TYPE_PASSWORD 7
+#define CALLBACK_TYPE_MENU 8
+#define CALLBACK_TYPE_USER -1
+
+typedef struct _CALLBACK_HEADER
+{
+ UINT32 Type;
+ UINT32 Length;
+}
+CALLBACK_HEADER;
+
+typedef struct _CALLBACK_SUBMENU
+{
+ CALLBACK_HEADER Header;
+ UINT16 DestPage;
+}
+CALLBACK_SUBMENU;
+
+typedef struct _CALLBACK_MENU
+{
+ CALLBACK_HEADER Header;
+ UINT16 DestPage;
+}
+CALLBACK_MENU;
+
+typedef struct _CALLBACK_VARIABLE
+{
+ CALLBACK_HEADER Header;
+ UINT32 Variable;
+ UINT32 Offset;
+ UINT32 Length;
+ VOID *Data;
+}
+CALLBACK_VARIABLE;
+
+typedef struct _CALLBACK_PASSWORD
+{
+ CALLBACK_HEADER Header;
+ UINT32 Variable;
+ UINT32 Offset;
+ UINT32 Length;
+ VOID *Data;
+ BOOLEAN Encoded;
+}
+CALLBACK_PASSWORD;
+
+typedef struct _CALLBACK_MESSAGEBOX
+{
+ CALLBACK_HEADER Header;
+ UINTN Result;
+}
+CALLBACK_MESSAGEBOX;
+
+typedef struct _CALLBACK_NVRAM
+{
+ CALLBACK_HEADER Header;
+ // I can't remember what this type was for
+}
+CALLBACK_NVRAM;
+
+#define DEFAULT_TYPE_UNKNOWN 0
+#define DEFAULT_TYPE_FAILSAFE 1
+#define DEFAULT_TYPE_OPTIMAL 2
+
+typedef struct _CALLBACK_DEFAULTS
+{
+ CALLBACK_HEADER Header;
+ UINT32 Type;
+}
+CALLBACK_DEFAULTS;
+
+typedef struct _CALLBACK_LABEL
+{
+ CALLBACK_HEADER Header;
+ UINT32 Key;
+}
+CALLBACK_LABEL;
+
+typedef struct _CALLBACK_USER
+{
+ CALLBACK_HEADER Header;
+ VOID *UserData;
+}
+CALLBACK_USER;
+
+#endif /* _CALLBACK_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/control.c b/EDK/MiniSetup/TseLite/control.c
new file mode 100644
index 0000000..c5ee5cf
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/control.c
@@ -0,0 +1,337 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/control.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 5 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/control.c $
+//
+// 5 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 6 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 4 11/21/11 8:49a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupSel.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 3 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 4 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: contorl.c
+//
+// Description: This file contains code to handle controls
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+CONTROL_METHODS gControl =
+{
+ ControlCreate,
+ ControlDestroy,
+ ControlInitialize,
+ ControlEmptyMethod,
+ ControlHandleAction,
+ ControlSetCallback,
+ ControlSetFocus,
+ ControlSetPosition,
+ ControlSetDimensions,
+ ControlSetAttributes
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlCreate
+//
+// Description: Function to create the cotrol options using object functions.
+//
+// Input: CONTROL_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlCreate( CONTROL_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(CONTROL_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gObject.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gControl;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlDestroy
+//
+// Description: Function to destroy the cotrol options using object functions.
+//
+// Input: CONTROL_DATA *control, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlDestroy( CONTROL_DATA *control, BOOLEAN freeMem )
+{
+ if(NULL == control)
+ return EFI_SUCCESS;
+
+ gObject.Destroy( control, FALSE );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&control );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlInitialize
+//
+// Description: Function to Initialize the cotrol options using object functions.
+//
+// Input: CONTROL_DATA *control, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlInitialize( CONTROL_DATA *control, VOID *data )
+{
+ EFI_STATUS Status;
+
+ Status = gObject.Initialize( control, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ if ( ((CONTROL_INFO *)data)->ControlPtr == (UINTN)NULL )
+ return EFI_UNSUPPORTED;
+
+ if ( ! ((CONTROL_INFO *)data)->ControlFlags.ControlVisible )
+ Status = EFI_UNSUPPORTED;
+ else
+ MemCopy( &control->ControlData, data, sizeof(CONTROL_INFO) );
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlInitialize
+//
+// Description: Function to draw control.
+//
+// Input: CONTROL_DATA *control
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlDraw( CONTROL_DATA *control )
+{
+ return gObject.Draw( control );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlEmptyMethod
+//
+// Description: Empty control method.
+//
+// Input: CONTROL_DATA *control
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlEmptyMethod( CONTROL_DATA *control )
+{
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: CONTROL_DATA *control, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlSetCallback( CONTROL_DATA *control, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gObject.SetCallback( control, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlHandleAction
+//
+// Description: Function to handle action.
+//
+// Input: CONTROL_DATA *control, ACTION_DATA *Data
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlHandleAction( CONTROL_DATA *control, ACTION_DATA *Data )
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: CONTROL_DATA *control, BOOLEAN focus
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlSetFocus( CONTROL_DATA *control, BOOLEAN focus )
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlSetPosition
+//
+// Description: Function to set the position.
+//
+// Input: CONTROL_DATA *control, UINT16 Left, UINT16 Top
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlSetPosition( CONTROL_DATA *control, UINT16 Left, UINT16 Top )
+{
+ control->Left = Left;
+ control->Top = Top;
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlSetDimensions
+//
+// Description: Function to set dimensions.
+//
+// Input: CONTROL_DATA *control, UINT16 Width, UINT16 Height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlSetDimensions(CONTROL_DATA *control, UINT16 Width, UINT16 Height)
+{
+ control->Width = Width;
+ control->Height = Height;
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ControlSetAttributes
+//
+// Description: Function to set the control attributes
+//
+// Input: CONTROL_DATA *control, UINT8 FGColor, UINT8 BGColor
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ControlSetAttributes( CONTROL_DATA *control, UINT8 FGColor, UINT8 BGColor )
+{
+ if ( FGColor != 0 )
+ control->FGColor = FGColor;
+
+ if ( BGColor != 0 )
+ control->BGColor = BGColor;
+
+ return EFI_SUCCESS;
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/control.h b/EDK/MiniSetup/TseLite/control.h
new file mode 100644
index 0000000..b7111d0
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/control.h
@@ -0,0 +1,171 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/control.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 8 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/control.h $
+//
+// 8 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 5 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 4 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 2/05/09 10:15a Madhans
+// Style Module created.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+#ifndef _CONTROL_H_
+#define _CONTROL_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "object.h"
+#include "setupdata.h"
+#include "action.h"
+#if UEFI_SOURCES_SUPPORT
+#include "ctrlcond.h"
+#endif
+
+#define CONTROL_GRAYOUT_COLOR STYLE_COLOR_GRAYOUT
+
+#define CONTROL_MEMBER_VARIABLES \
+ CONTROL_INFO ControlData; \
+ UINT16 Left; \
+ UINT16 Top; \
+ UINT16 Width; \
+ UINT16 Height; \
+ UINT8 FGColor; \
+ UINT8 BGColor; \
+ BOOLEAN ControlFocus; \
+ BOOLEAN ControlActive; \
+ UINT32 ParentFrameType;
+
+typedef struct _CONTROL_METHODS CONTROL_METHODS;
+
+typedef struct _CONTROL_DATA
+{
+ CONTROL_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+
+}
+CONTROL_DATA;
+
+typedef EFI_STATUS (*CONTROL_METHOD_SET_FOCUS) ( VOID *object, BOOLEAN focus );
+typedef EFI_STATUS (*CONTROL_METHOD_SET_POSITION) ( VOID *object, UINT16 Left, UINT16 Top );
+typedef EFI_STATUS (*CONTROL_METHOD_SET_DIMENSIONS) ( VOID *object, UINT16 Width, UINT16 Height );
+typedef EFI_STATUS (*CONTROL_METHOD_SET_ATTRIBUTES)( VOID *object, UINT8 FGColor, UINT8 BGColor );
+typedef EFI_STATUS (*CONTROL_METHOD_GET_CONTROL_HIGHT)( VOID *object, VOID *frame, UINT16 *height );
+
+#define CONTROL_METHOD_FUNCTIONS \
+ CONTROL_METHOD_SET_FOCUS SetFocus; \
+ CONTROL_METHOD_SET_POSITION SetPosition; \
+ CONTROL_METHOD_SET_DIMENSIONS SetDimensions; \
+ CONTROL_METHOD_SET_ATTRIBUTES SetAttributes; \
+ CONTROL_METHOD_GET_CONTROL_HIGHT GetControlHeight;
+
+struct _CONTROL_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+};
+
+extern CONTROL_METHODS gControl;
+
+// Object Methods
+EFI_STATUS ControlCreate( VOID **object );
+EFI_STATUS ControlDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS ControlInitialize( VOID *object, VOID *data );
+EFI_STATUS ControlEmptyMethod( VOID *object );
+EFI_STATUS ControlDraw( VOID *object );
+EFI_STATUS ControlHandleAction( VOID *object, ACTION_DATA *Data );
+EFI_STATUS ControlSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS ControlSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS ControlSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS ControlSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS ControlSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+CONTROL_DATA * GetUpdatedControlData(CONTROL_DATA * ControlData,UINT16 ControlType,VOID *Handle,UINT16 Key);
+
+
+#endif /* _CONTROL_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/edit.c b/EDK/MiniSetup/TseLite/edit.c
new file mode 100644
index 0000000..d8646e4
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/edit.c
@@ -0,0 +1,636 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/edit.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 12 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/edit.c $
+//
+// 12 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 11 4/05/12 7:14a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 10 11/30/11 12:46a Premkumara
+// [TAG] EIP75351
+// [Category] Improvement
+// [Description] Static code analysis.Suppress the warnings from static
+// code analyzer
+// [Files] String.c, HiiString21.c, TseAdvanced.c, Special.c,
+// UefiAction., Time.c, PopupEdit.c, MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 9 11/21/11 12:09p Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 8 11/21/11 8:50a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupSel.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 7 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 1/09/10 6:50a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 8/13/09 1:17p Blaines
+// EIP #24980 Fix to properly display right area text
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 4/29/09 9:02p Madhans
+// Bug Fixes after unit Testing..
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:08p Madhans
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Edit.c
+//
+// Description: This file contains code to handle Edit control operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+
+EDIT_METHODS gEdit =
+{
+ EditCreate,
+ EditDestroy,
+ EditInitialize,
+ EditDraw,
+ EditHandleAction,
+ EditSetCallback,
+ EditSetFocus,
+ EditSetPosition,
+ EditSetDimensions,
+ EditSetAttributes,
+ EditGetControlHight
+
+};
+
+EFI_STATUS _EditHandleActionKey(EDIT_DATA *edit, AMI_EFI_KEY_DATA key);
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditCreate
+//
+// Description: Function to create Edit Controls, which uses the control functions.
+//
+// Input: EDIT_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditCreate( EDIT_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(EDIT_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gEdit;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditDestroy
+//
+// Description: Function to Destroy Edit Controls, which uses the control functions.
+//
+// Input: EDIT_DATA *edit, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditDestroy( EDIT_DATA *edit, BOOLEAN freeMem )
+{
+ if(NULL == edit)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( edit, FALSE );
+
+ MemFreePointer( (VOID **)&edit->Text );
+ MemFreePointer( (VOID **)&edit->TempText );
+
+ if( freeMem )
+ MemFreePointer( (VOID **)&edit );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditInitialize
+//
+// Description: Function to Initialize Edit Controls, which uses the control functions.
+//
+// Input: EDIT_DATA *edit, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditInitialize( EDIT_DATA *edit, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( edit, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ SetControlColorsHook(NULL, NULL,
+ NULL,NULL,
+ NULL /*&(edit->SelBGColor )*/, &(edit->SelFGColor),
+ &(edit->BGColor), &(edit->FGColor),
+ NULL /*UINT8 *LabelBGColor*/,&(edit->LabelFGColor) /*UINT8 *LabelFGColor*/,
+ &(edit->NSelLabelFGColor)/*UINT8 *NSelLabelFGColor*/,
+ &(edit->SelBGColor )/*EditBGColor*/,&(edit->EditFGColor),
+ NULL, NULL );
+
+
+ // add extra initialization here...
+ edit->TextMargin = (UINT8)gControlLeftMargin;
+ if ( edit->TextWidth == 0 )
+ {
+ edit->TextWidth = UefiGetWidth(((CONTROL_INFO *)data)->ControlPtr);
+ edit->TextWidth = (edit->TextWidth>1)?(3 * (UINT16)edit->TextWidth):4;
+ }
+
+ edit->TextAreaWidth = (edit->TextWidth </*10*/(UINT16)(edit->Width - edit->TextMargin - 2)) ? edit->TextWidth:/*10*/(UINT16)(edit->Width - edit->TextMargin - 2);
+ edit->Text = EfiLibAllocateZeroPool((edit->TextWidth +1)* sizeof(CHAR16));
+ MemSet( edit->Text, (edit->TextWidth +1)* sizeof(CHAR16), 0 );
+
+ if( *((UINT8*)((CONTROL_INFO *)data)->ControlPtr) == IFR_PASSWORD_OP)
+ edit->Chr = L'*';
+
+ if ( edit->Text != NULL )
+ {
+ VarGetValue( edit->ControlData.ControlVariable,
+ UefiGetQuestionOffset(((CONTROL_INFO *)data)->ControlPtr),
+ UefiGetWidth(((CONTROL_INFO *)data)->ControlPtr), edit->Text );
+
+ }
+ edit->TempText = EfiLibAllocateZeroPool((edit->TextWidth +1)* sizeof(CHAR16));
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditDraw
+//
+// Description: Function to draw Edit Controls.
+//
+// Input: EDIT_DATA *edit
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditDraw(EDIT_DATA *edit )
+{
+ CHAR16 *text,*text2;
+ UINT16 i;
+ UINT8 BGClr,FGClr;
+
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 ColorNSel = edit->FGColor;
+ UINT8 ColorLabel = (edit->ControlFocus) ? edit->LabelFGColor : edit->NSelLabelFGColor ;
+
+
+ if(edit->ControlFocus)
+ {
+ BGClr = edit->SelBGColor;
+ if(edit->ControlActive)
+ FGClr = edit->EditFGColor;
+ else
+ FGClr = edit->SelFGColor;
+ }
+ else
+ {
+ BGClr = edit->BGColor;
+ FGClr = /*ColorLabel;*/ edit->FGColor;
+ }
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( edit->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &edit->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ FGClr = ColorNSel = ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+
+ text = HiiGetString( edit->ControlData.ControlHandle, UefiGetPromptField(edit->ControlData.ControlPtr));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == text){
+ text = EfiLibAllocateZeroPool(2*sizeof(CHAR16));
+ if(!text)
+ return EFI_NOT_FOUND;
+ EfiStrCpy(text,L" ");
+ }
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(edit->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( edit->Left , edit->Top,
+ (UINTN)(edit->TextMargin - edit->Left),(UINTN) edit->Height,
+ text, edit->BGColor | ColorLabel );
+ }
+ else
+ {
+ // boundary overflow check
+ if ((TestPrintLength( text ) / (NG_SIZE)) > (UINTN)(edit->TextMargin - edit->Left )/*21*/ )
+ text[HiiFindStrPrintBoundary(text,(UINTN)(edit->TextMargin - edit->Left ))] = L'\0';
+
+ DrawStringWithAttribute( edit->Left , edit->Top, (CHAR16*)text,
+ edit->BGColor | ColorLabel/*((edit->ControlFocus)? edit->LabelFGColor : edit->NSelLabelFGColor )*/ );
+
+ }
+
+ for(i=0; i < edit->TextAreaWidth; i++)
+ DrawStringWithAttribute( edit->Left + edit->TextMargin + i , edit->Top, L" ",
+ BGClr | FGClr );
+
+ if(edit->Chr != 0x0)
+ {
+ text2 = EfiLibAllocateZeroPool( ((TestPrintLength( edit->Text ) / (NG_SIZE))+1) * sizeof(CHAR16));
+ for(i = 0; (i < (TestPrintLength( edit->Text ) / (NG_SIZE))) && (i < edit->TextAreaWidth); i++ )
+ text2[i] = edit->Chr;
+
+ DrawStringWithAttribute( edit->Left + edit->TextMargin, edit->Top, text2,
+ BGClr | FGClr );
+ MemFreePointer((VOID **)&text2);
+ }
+ else
+ DrawStringWithAttribute( edit->Left + edit->TextMargin , edit->Top , edit->Text,
+ BGClr | FGClr );
+
+
+ MemFreePointer((VOID **)&text);
+
+ FlushLines( edit->Top, edit->Top );
+ DoRealFlushLines();
+ MouseRefresh();
+ return Status;
+
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: EDIT_DATA *edit, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditSetCallback( EDIT_DATA *edit, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( edit, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditHandleAction
+//
+// Description: Function to handle Edit actions.
+//
+// Input: EDIT_DATA *edit, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditHandleAction( EDIT_DATA *edit, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+
+ if ( Data->Input.Type == ACTION_TYPE_KEY )
+ return _EditHandleActionKey(edit, Data->Input.Data.AmiKey);
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _EditHandleActionKey
+//
+// Description: Function to handle Edit actions.
+//
+// Input: EDIT_DATA *edit, AMI_EFI_KEY_DATA key
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _EditHandleActionKey(EDIT_DATA *edit, AMI_EFI_KEY_DATA key)
+{
+ UINT8 Redraw =0;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINTN i;
+ CONTROL_ACTION Action;
+
+
+ //Get mapping
+ Action = MapControlKeysHook(key);
+
+ switch(Action)
+ {
+ case ControlActionAbort:
+ if(edit->ControlActive == TRUE)
+ Status = EFI_SUCCESS;
+ case ControlActionNextUp:
+ case ControlActionNextDown:
+ if(edit->ControlActive == TRUE)
+ {
+ MemCopy(edit->Text,edit->TempText,edit->TextWidth*sizeof(UINT16)); //UNICODE CHARS
+ edit->ControlActive = FALSE;
+ Redraw = 1;
+ }
+ break;
+
+ case ControlActionNextLeft:
+ case ControlActionNextRight:
+ if(edit->ControlActive == TRUE)
+ Status = EFI_SUCCESS; // cosume the action if editing
+ break;
+
+ case ControlActionSelect:
+ if(edit->Callback != NULL)
+ {
+ if ( edit->Cookie != NULL )
+ {
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)edit->Cookie;
+
+ callbackData->Variable = edit->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(edit->ControlData.ControlPtr);
+ callbackData->Length = UefiGetWidth(edit->ControlData.ControlPtr);
+ callbackData->Data = (VOID *)edit->Text;
+
+ edit->Callback( edit->Container,edit, edit->Cookie );
+ }
+ }
+
+ Redraw =1;
+ edit->ControlActive = FALSE;
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionBackSpace:
+ if(EfiStrLen(edit->Text)>0)
+ {
+ if(edit->ControlActive == FALSE)
+ {
+ MemCopy(edit->TempText,edit->Text,edit->TextWidth * sizeof(UINT16)); //UNICODE CHARS
+ edit->ControlActive = TRUE;
+ }
+ edit->Text[EfiStrLen(edit->Text)-1] = 0x0;
+ Redraw =1;
+ }
+ break;
+
+ default:
+ if(SCAN_NULL == key.Key.ScanCode)
+ {
+ if((EfiStrLen(edit->Text) < edit->TextWidth) |
+ ( (edit->ControlActive == FALSE) ) && (edit->ControlData.ControlType == CONTROL_TYPE_NUMERIC) )
+ {
+ if(edit->ControlActive ==FALSE)
+ {
+ MemCopy(edit->TempText,edit->Text,edit->TextWidth* sizeof(UINT16));
+ if(edit->ControlData.ControlType == CONTROL_TYPE_NUMERIC)
+ {
+ i = edit->TextWidth;
+ do {
+ edit->Text[i] = 0x0;
+ }while(i-- > 0 );
+ }
+ edit->ControlActive = TRUE;
+ }
+
+ i = EfiStrLen(edit->Text);
+ edit->Text[i] = key.Key.UnicodeChar ;
+ edit->Text[i+1] = 0x0 ;
+ Redraw =1;
+ }
+ }
+ break;
+ }
+
+ if(Redraw)
+ Status = gEdit.Draw(edit);
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditSetFocus
+//
+// Description: Function to set the edit focus.
+//
+// Input: EDIT_DATA *edit, BOOLEAN focus
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditSetFocus(EDIT_DATA *edit, BOOLEAN focus)
+{
+ if(focus != FALSE)
+ {
+ if ( CheckControlCondition( &edit->ControlData ) )
+ return EFI_UNSUPPORTED;
+ }
+
+ if( !(edit->ControlFocus && focus) )
+ edit->ControlFocus = focus;
+
+ if(!focus)
+ edit->ControlActive = 0;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditSetPosition
+//
+// Description: Function to set the edit position.
+//
+// Input: EDIT_DATA *edit, UINT16 Left, UINT16 Top
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditSetPosition(EDIT_DATA *edit, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( edit, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditSetDimensions
+//
+// Description: Function to set the edit dimensions.
+//
+// Input: EDIT_DATA *edit, UINT16 Width, UINT16 Height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditSetDimensions(EDIT_DATA *edit, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( edit, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditSetAttributes
+//
+// Description: Function to set the edit attributes.
+//
+// Input: EDIT_DATA *edit, UINT8 FGColor, UINT8 BGColor
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditSetAttributes(EDIT_DATA *edit, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( edit, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EditGetControlHight
+//
+// Description: Function unsuppored.
+//
+// Input: VOID *object,VOID *frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS EditGetControlHight( VOID *object,VOID *frame, UINT16 *height )
+{
+ return EFI_UNSUPPORTED;
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/edit.h b/EDK/MiniSetup/TseLite/edit.h
new file mode 100644
index 0000000..5f51485
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/edit.h
@@ -0,0 +1,166 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/edit.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 7 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/edit.h $
+//
+// 7 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 7 3/26/10 6:52p Madhans
+// Support to Map the do the Control Mapping from gTseControlMap Table. So
+// no changes need in Frame.c, With this feature gTseControlMap Can be
+// customized to add/customize the TSE controls.
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Edit.h
+//
+// Description: Header file for Edit controls
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _EDIT_H_
+#define _EDIT_H_
+
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+#include "action.h"
+
+#define EDIT_MEMBER_VARIABLES \
+ CHAR16 *Text; \
+ CHAR16 *TempText; \
+ UINT16 TextMargin; \
+ UINT16 MinSize; \
+ UINT16 MaxSize; \
+ UINT16 TextWidth; \
+ UINT16 TextAreaWidth; \
+ UINT8 LabelFGColor; \
+ UINT8 NSelLabelFGColor; \
+ UINT8 LabelMargin; \
+ UINT8 SelFGColor; \
+ UINT8 SelBGColor; \
+ UINT8 EditFGColor; \
+ CHAR16 Chr; /* character used to display instead of real chars from keyboard.*/
+ /* mainly used for password entry.*/
+
+typedef struct _EDIT_METHODS EDIT_METHODS;
+
+typedef struct _EDIT_DATA
+{
+ EDIT_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ EDIT_MEMBER_VARIABLES
+
+}
+EDIT_DATA;
+
+#define EDIT_METHOD_FUNCTIONS
+
+struct _EDIT_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ EDIT_METHOD_FUNCTIONS
+
+};
+
+extern EDIT_METHODS gEdit;
+
+// Object Methods
+EFI_STATUS EditCreate( VOID **object );
+EFI_STATUS EditDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS EditInitialize( VOID *object, VOID *data );
+EFI_STATUS EditDraw( VOID *object );
+EFI_STATUS EditHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS EditSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS EditSetFocus( VOID *object, BOOLEAN focus);
+EFI_STATUS EditSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS EditSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS EditSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS EditGetControlHight( VOID *object,VOID *frame, UINT16 *height );
+
+#endif /* _EDIT_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/frame.c b/EDK/MiniSetup/TseLite/frame.c
new file mode 100644
index 0000000..e196a84
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/frame.c
@@ -0,0 +1,2563 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2013, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/frame.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 63 $
+//
+// $Date: 9/05/14 6:27a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/frame.c $
+//
+// 63 9/05/14 6:27a Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 62 5/02/14 9:30p Arunsb
+// EIP141986 changes reverted.
+//
+// 61 5/02/14 11:01a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 60 5/02/14 2:55a Premkumara
+// [TAG] EIP131547
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] In CPU Config page, controls are going beyond the page
+// while clicking the down arrow in scroll bar in 80*25 mode [when
+// terminal redirection module enabled].
+// [RootCause] TSE was checking for LastVisibleCtrl with the total
+// number of frame ctrl count
+// and accordingly it was modifying FirstVisibleCtrl and LastVisibleCtrl
+// But there are some Suppressed controls at the end of the CPU Config
+// page
+// for which the above check was wrong.
+// [Solution] Added an extra condition to check whether LastVisibleCtrl
+// is equal to the LastNonSupressctrl in the Frame or not and
+// accordingly modify FirstVisibleCtrl and LastVisibleCtrl.
+// [Files] frame.c
+//
+// 59 5/01/14 3:42p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 58 2/11/14 8:32p Arunsb
+// [TAG] EIP131365
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE Help window flickers when Mouse\Touch device used under
+// boot page in Setup
+// [Root Cause] gActiveBuffer->Chars get flushed with EmptyString in
+// TSEMouseHelpFrameHandleAction() every time
+// [Solution] Handled gActiveBuffer properly
+// [Files] frame.c
+//
+// 57 12/03/13 1:07p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 56 12/02/13 12:32p Premkumara
+// [TAG] EIP131547
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Frame is scrolling beyond visible controls when mouse is
+// clicked on down arrow
+// [Root Cause] Frame is scrolling for suppressed controls which are not
+// visble in the frame
+// [Solution] Scrolling frame based on visible controls count.
+// [Files] frame.c
+//
+// 54 3/25/13 8:39a Premkumara
+// [TAG] EIP116315
+// [Category] Improvement
+// [Description] Display control prompt string for password control.
+// (for String on CHAP secret popup)
+// [Files] - AMITSE.sdl
+// - CommonHelper.c
+// - FakeToken.c
+// - AmiTSEStr.uni
+// - TseLite\PopupPassword.c
+// - uefi2.1\UefiWapper21.c
+// - uefi2.0\UefiWapper20.c
+// - uefi2.0\HiiCallback.c
+// - uefi2.0\hii.h
+// - uefi2.0\hii.c
+//
+// 53 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 33 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 51 9/18/12 6:18a Arunsb
+// [TAG] EIP92972
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] System hangs when submenu has no control in it
+// [RootCause] visibleControlHeight is 0, dividing by this causes system
+// hang
+// [Solution] visibleControlHeight handled properly
+// [Files] frame.c
+//
+// 50 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 48 9/10/12 5:02a Rajashakerg
+// [TAG] EIP93881 and 93873
+// [Category] Improvement
+// [Description] need keep system password after Load default and
+// Password saved into NVRAM immediately(not buffer) while it is installed
+// in TSE
+// [Files] frame.c, callback.c, AMITSE.sdl, CommonHelper.c
+//
+// 47 5/28/12 12:31p Premkumara
+// [TAG] EIP67049 & 90224
+// [Category] New Feature
+// [Description] Support mouse drag operation in frame and list box
+// [Files] CommonHelper.c, Frame.c, ListBox.c, Minisetupext.h
+//
+// 46 4/05/12 9:15a Arunsb
+// Unwanted code commented
+//
+// 45 4/05/12 7:15a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 44 2/01/12 6:09p Blaines
+// Rollback
+//
+// 42 1/31/12 6:33p Blaines
+// [TAG] - EIP 79963
+// [Category]- Defect
+// [Synopsis]- Scrollbar functionality with mouse was not working properly
+// and While Clicking the arrow buttons in scroll bar moves the entry up
+// not the scroll bar.
+// [Description]- 1. Build the BIOS project with GTSE and Mouse support,
+// 2. Goto Chipset->South bridge, click on the arrow keys or Move the
+// scrool bar and observe the behaviour.
+// [Root Cause] - Incorrect scrollbar size computed when total
+// lines/controls was 1 greater than a filled frame.
+// [Solution] - Check for special case and adjust visibleControlHeight
+// when total lines is 1 greater than a filled frame (visible controls).
+// [Files changed] - frame.c
+// [Functions changed] - FrameDraw
+//
+// 41 1/20/12 4:10a Rajashakerg
+// [TAG] EIP78929
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Control selection using Mouse is not user friendly.
+// [RootCause] Updating the buffer with mouse click information provided
+// by mouse driver is improper.
+// [Solution] Updated the mouse click information properly to the buffer
+// which is used by tse to do action.
+// [Files] Action.c, frame.c ListBox.c
+//
+// 40 12/07/11 3:32p Arunsb
+// [TAG] EIP75588
+// [Category] New Feature
+// [Description] Support for queuing UpdatePack notifications
+// [Files] frame.c, page.c, formbrowser2.c, hii.c, hiicallback.c,
+// hiinotificationhandler.c, tseuefihii.h and uefi21wapper.c
+//
+// 39 12/07/11 2:10p Rajashakerg
+// [TAG] EIP76810
+// [Category] Improvement
+// [Description] EFI_IFR_INCONSISTENT_IF to follow 28.2.5.9.2 as per efi
+// spec 2.3.1
+// [Files] frame.c
+//
+// 38 11/21/11 12:07p Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 37 11/20/11 7:49a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 36 11/18/11 11:40a Blaines
+// [TAG] - EIP 72349
+// [Category]- Sighting
+// [Synopsis]- In some SAS cards the scroll bar does not function
+// correctly.
+//
+// [Description] - The scroll bar is not accurate, doesn't properly handle
+// multi-line controls. In some SAS cards with a large number of drives,
+// the scroll bar would move down the screen then disappear before
+// reaching the end, giving the appearance that no more items are viewable
+// or selectable.
+//
+// [Files]
+// Frame.c
+//
+// 35 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 34 7/21/11 1:07p Rajashakerg
+// Updated the file to close the popup window when left clicked on help
+// and navigation frame
+//
+// 33 7/21/11 11:24a Rajashakerg
+// Updated the file to restrict the control selection when cliked on help
+// frame with mouse
+//
+// 30 6/30/11 5:18a Rajashakerg
+// Updated the help frame scroll restricted for left click alone.
+//
+// 29 6/29/11 4:34p Rajashakerg
+// Updated for Help frame scroll changes
+//
+// 28 6/29/11 12:58p Rajashakerg
+// [TAG] EIP47086
+// [Category] New Feature
+// [Description] Right clicking from the Main page is not exiting from
+// BIOS setup.
+//
+// [Files] minisetup.h, Ezport\style.h,Ezport\EzportBin.sdl,
+// Ezport\EzportBin.mak, Ezport\ezport.c, Ezport\EzportBin.cif,
+// EzportPlus\style.h, EzportPlus\EzportPlusBin.sdl, EzportPlusBin.mak,
+// EzportPlus\EzportPlusBin.cif, EzportPlus\ezportplus.c, Legacy\style.h,
+// Legacy\EzportPlusBin.sdl, Legacy\LegacyBin.mak, Legacy\LegacyBin.cif,
+// Legacy\legacy.c, TseLiteBin.sdl, TseLite.cif, Memo.c, frame.c,
+// application.h, application.c, commonoem.h, CommonHelper.c
+//
+// 27 6/29/11 12:36p Rajashakerg
+// [TAG] EIP59657
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] [TSE] When change password status, sometimes will miss
+// first item.
+// [RootCause] The frame first visible control is not handled properly
+// [Solution] The first visible control is handled properly by making
+// first visible control as 0 in framescroll
+// [Files] Frame.c
+//
+// 26 6/28/11 2:42p Arunsb
+// Build error resolved by adding UpdateDestiantionQuestion function
+// declaration.
+//
+// 25 6/23/11 3:58p Rajashakerg
+// [TAG] EIP55762, 58925, 59971
+// [Category] New Feature
+// [Description] Support REF2,REF3 and REF4 in AMITSE
+// Support direct form navigation path
+// Improper layout of controls in the root page when Dynamic pages are
+// added using the Legacy Setup Style
+//
+// [Files] setupdata.h, CommonHelper.c, AMITSE.sdl, Legacy\Legacy.c,
+// Legacy\style.h, Legacy\style.h, frame.c, minisetupext.c,
+// minisetupext.h, numeric.c, page.c Popupstring.c, Hii.c,
+// Uefi21Wrapper.c, Parse.c Hii.c
+//
+// 24 4/29/11 4:36p Arunsb
+// For 2.13 public patch release IFR RefX feature is omitted
+//
+// 22 3/29/11 12:15a Madhans
+// [TAG] EIP54968
+// [Category] Improvement
+// [Description] To Support different style modules in TSE generically
+// [Files] Ezport module updated. EzportPlus and Legacy Styles Modules
+// added.
+//
+// 21 12/28/10 9:37a Mallikarjunanv
+// updaed changes regarding EIP:48382
+//
+// 20 12/25/10 7:41a Mallikarjunanv
+// [TAG] EIP 49548 / 48377
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] BIOS gui scroll bar fails to indicate that there are more
+// options available on the Advanced | CPU Configuration page
+// [RootCause] Scrollbar draw is not handled properly
+// [Solution] Updated the scrollbar draw depending on the controls of
+// the frame.
+// [Files] Frame.c
+//
+// 19 12/25/10 4:16a Mallikarjunanv
+// [TAG] EIP 48382
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Clicking somewhere in BIOS Setup selecting the control
+// strings.
+// [RootCause] Co-ordinates are not properly set for mouse click
+// operation
+// [Solution] Co-ordinates are updated properly for mouse click
+// operation
+// [Files] Frame.c
+//
+// 18 12/25/10 3:40a Mallikarjunanv
+// [TAG] EIP 47940
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Scrollbar disappeared while scrolling in the BOOT page
+// [RootCause] Scrollbar support is not handled properly depending on
+// the controls
+// [Solution] Updated the scrollbar support handling depending on the
+// controls.
+// [Files] Frame.c
+//
+// 17 12/02/10 2:44p Madhans
+// [TAG] - EIP 47608
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- If the String length is different in different languages,
+// Changing language causes
+// TSE multiline function to not work correctly.
+// [Rootcause] control dimension are set only with initial language and it
+// is not updated after that.
+// [Solution]- The Control dimentions need to updated when language
+// changes.
+// [Files] - frame.c
+//
+// 16 10/05/10 11:53a Blaines
+// In the function _FrameAddTitle, set the property ParentFrameType before
+// calling gMemo.Initialize. This is useful in case the function
+// gMemo.Initialize is overriden.
+//
+// 15 9/16/10 8:38p Madhans
+// Update for TSE 2.10. Refer Changelog.log for more details.
+//
+// 23 9/15/10 2:05p Madhans
+// If the Dynamic update happens while drawing the control (via Evalutate
+// Condition->VarGetValue->ExtractConfig).
+// The controls may be invalidated. In that case don't proceed with Frame
+// Draw.
+//
+// 22 8/12/10 1:06p Blaines
+// EIP-41817: Fix to allow Help Frame scroll support
+//
+// Use reference to gFrame.AddControl to allow option to customization
+// outside of frame.c.
+//
+// 21 6/17/10 2:46p Madhans
+// Mouse issue fix,
+//
+// 20 6/14/10 7:09p Madhans
+// Dynamic parsing support
+//
+// 19 3/30/10 4:50p Blaines
+// Remove the call to StyleFrameAddControl.
+//
+// 18 3/26/10 6:52p Madhans
+// Support to Map the do the Control Mapping from gTseControlMap Table. So
+// no changes need in Frame.c, With this feature gTseControlMap Can be
+// customized to add/customize the TSE controls.
+//
+// 17 3/23/10 5:13p Blaines
+// Add new style module hook
+//
+// 16 2/24/10 4:37p Madhans
+// EIP 35522 Fix to make Text interactive control to work. Need to send
+// the Timer action to all the controls.
+//
+// 15 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 14 2/15/10 10:13p Madhans
+// To avoid warnings
+//
+// 13 2/05/10 6:04p Madhans
+// Mouse action override from Style Module.
+//
+// 12 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 11 2/01/10 7:38p Madhans
+// EIP 32501 : Fix to handle the Conditional control Focusing , in the Sub
+// form
+//
+// 10 1/29/10 4:34p Madhans
+// To avoid compiler warnings.
+//
+// 9 1/09/10 6:34a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 8 12/04/09 8:49a Mallikarjunanv
+// EIP:31606 - Fix for hanging issue in case of no active controls in a
+// frame
+//
+// 7 8/13/09 1:18p Blaines
+// EIP #24980 Fix to properly display right area text;
+//
+// Properly initialize the control width
+//
+// 6 7/20/09 1:21p Mallikarjunanv
+// error fixed in multiline controls
+//
+// 5 7/09/09 12:28p Mallikarjunanv
+// updated the password encoded fix
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 3 5/20/09 3:44p Blaines
+// Update the way Scroll Behavior token is accessed
+//
+// 2 5/07/09 10:36a Madhans
+// Changes after Bin module
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:08p Madhans
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: frame.c
+//
+// Description: This file contains code to handle frame operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+EFI_STATUS _FrameHandleKey( FRAME_DATA *frame, AMI_EFI_KEY_DATA Key );
+EFI_STATUS _FrameScroll( FRAME_DATA *frame, BOOLEAN bScrollUp );
+BOOLEAN _FrameSetControlFocus( FRAME_DATA *frame, UINT32 index );
+EFI_STATUS _PreviousFrame (FRAME_DATA *frame);
+EFI_STATUS _NextFrame (FRAME_DATA *frame);
+EFI_STATUS _FocusFirst (FRAME_DATA *frame);
+EFI_STATUS _FocusLast (FRAME_DATA *frame);
+EFI_STATUS FrameDrawScrollBar (FRAME_DATA *frame, UINT32 FirstLine, UINT32 LastLine, UINT32 modVal, UINT32 sizeOfBar, UINT32 numOfBlocks, BOOLEAN bEraseScrollBar);
+EFI_STATUS UpdateDestiantionQuestion (UINT32, UINT32, UINT32 *);
+EFI_STATUS TSEMouseHelpFrameHandleAction( FRAME_DATA *frame, ACTION_DATA *action,CONTROL_DATA **control);
+VOID _HelpFrameScroll(MEMO_DATA *memo,BOOLEAN bScrollUp);
+BOOLEAN IsMouseSupported(VOID);
+//EIP-67049 Start
+INT32 lButtonDownVaringPosition = 0;
+INT32 lButtonDownInitialPosition = 0;
+static UINT32 gFrameScrollBarTop = 0, gFrameScrollBarBottom = 0;
+//EIP-67049 End
+//--------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------
+FRAME_METHODS gFrame =
+{
+ FrameCreate,
+ FrameDestroy,
+ FrameInitialize,
+ FrameDraw,
+ FrameHandleAction,
+ FrameSetCallback,
+ FrameAddControl
+};
+//--------------------------------------------------------------------------
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: FrameCreate
+//
+// Description: Allocated memory size and creates frame
+//
+// Input: FRAME_DATA **object
+//
+// Output: EFI_STATUS status -
+// EFI_SUCCESS -
+// EFI_OUT_OF_RESOURCES - if the object is NULL
+// EFI_ERROR - If there are any the error in the object
+// creating process
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS FrameCreate( FRAME_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(FRAME_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gObject.Create( object );
+
+ if (EFI_ERROR(Status))
+ {
+ MemFreePointer( (VOID **)object );
+ return Status;
+ }
+
+ (*object)->Methods = &gFrame;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: FrameDestroy
+//
+// Description: Destroys an existing frame and frees memory
+//
+// Input: FRAME_DATA *frame - Frame to be destroyed
+// BOOLEAN freeMem - Frees frame memory if TRUE, ignores
+// otherwise
+//
+// Output: EFI_STATUS - EFI_SUCCESS
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS FrameDestroy( FRAME_DATA *frame, BOOLEAN freeMem )
+{
+ CONTROL_DATA **control;
+ UINT32 i;
+
+ if(NULL == frame)
+ return EFI_SUCCESS;
+ control = frame->ControlList;
+ for ( i = 0; i < frame->ControlCount; i++, control++ )
+ {
+ if (*control) //Destroy the controls if it is not NULL
+ (*control)->Methods->Destroy( *control, TRUE );
+ }
+
+ frame->ControlCount = 0;
+
+ MemFreePointer( (VOID **)&frame->ControlList );
+ MemFreePointer( (VOID **)&frame->BlankLine );
+ MemFreePointer( (VOID **)&frame->OrigPosition );
+ MemFreePointer( (VOID **)&frame->CurrPosition );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&frame );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: FrameInitialize
+//
+// Description: Initializes the frame data
+//
+// Input: FRAME_DATA *frame - Frame to be intialized
+// FRAME_INFO *data - Related frame data
+//
+// Output: EFI_STATUS - EFI_SUCCESS
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS FrameInitialize( FRAME_DATA *frame, FRAME_INFO *data )
+{
+ if ( data != NULL )
+ {
+ MemCopy( &frame->FrameData, data, sizeof(FRAME_INFO) );
+ if ( frame->PageID != 0 )
+ {
+ frame->BlankLine = EfiLibAllocateZeroPool( sizeof(CHAR16) * (data->Width + 1) );
+ if ( frame->BlankLine != NULL )
+ MemFillUINT16Buffer( frame->BlankLine, data->Width, L' ' );
+ }
+ }
+
+ frame->FirstVisibleCtrl = 0;
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: IsScrollSupportRequired
+//
+// Description: To know whether the scroll supprot required befor drawing the frame
+//
+// Input: FRAME_DATA *frame - Frame information to get frame info
+//
+// Output: BOOLEAN - TRUE/FALSE
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN IsScrollSupportRequired(FRAME_DATA *frame )
+{
+ CONTROL_DATA **control;
+ UINT16 i, Height, Top;
+ UINT8 u8ChkResult;
+
+ control = frame->ControlList;
+ Height = frame->FrameData.Top;
+
+ for ( i = 0; i < frame->ControlCount; i++, control++ )
+ {
+ Top = Height;
+
+ u8ChkResult = CheckControlCondition( &((*control)->ControlData) ); //Check conditional
+
+ if(u8ChkResult == COND_NONE || u8ChkResult == COND_GRAYOUT) {
+ // EIP47608 +>>
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ if(frame->FrameData.FrameType == MAIN_FRAME)
+ {
+ UINT16 height=0;
+ (*control)->Methods->GetControlHeight( *control, (VOID*)frame,&height);
+ height = height ? height:1;
+ (*control)->Methods->SetDimensions( *control,
+ frame->FrameData.Width - (UINT8)gLabelLeftMargin - 2,
+ height );
+ }
+ }
+ // EIP47608 <<+
+ Height = Height + (*control)->Height;
+ }
+ }
+
+ //check whether scroll support required.
+ if((frame->UseScrollbar) && ((frame->FrameData.Top + frame->FrameData.Height) >= Height+1))
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: FrameDraw
+//
+// Description: Draws the controls for the given frame
+//
+// Input: FRAME_DATA *frame - Frame information to draw controls
+//
+// Output: EFI_STATUS - EFI_SUCCESS if successful, else EFI_ERROR
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS FrameDraw( FRAME_DATA *frame )
+{
+ CONTROL_DATA **control;
+ UINT32 i, j,FirstLine=0, LastLine=0, topPos=0, lastPos=0, count, visibleControlHeight=0, visibleControlCount = 0, modVal=0, sizeOfBar = 0, numOfBlocks = 0,CurrentvisibleControlCount = 0,CurrentFirstvisibleControlCount = 0,MltCnt=0,FrameLastVisibleControl=0;//EIP:48377/49548 Needed Local declarations for modification.
+ UINT16 CurrHeight, ControlTop;
+ UINT8 u8ChkResult;
+ UINT8 u8ChkMask;
+
+ BOOLEAN bCurrNotFocused = FALSE,bEraseScrollBar=FALSE;
+
+ if(StyleFrameDrawable(frame))
+ return EFI_UNSUPPORTED;
+
+ if ( frame->ControlCount == 0 )
+ return EFI_UNSUPPORTED;
+
+ //If there is an active control send draw only for that
+ if(frame->CurrentControl == FRAME_NONE_FOCUSED)
+ {
+ control = NULL;
+ bCurrNotFocused = TRUE; // Non is focused
+ }
+ else
+ control = &frame->ControlList[frame->CurrentControl];
+
+ if ( control != NULL )
+ {
+ //If a control is active only draw that
+ if( (*control)->ControlActive == TRUE )
+ {
+ (*control)->Methods->Draw( *control );
+ return EFI_SUCCESS;
+ }
+
+ u8ChkResult = CheckControlCondition( &((*control)->ControlData) );
+
+ //Setting focus to control if no control-condition is present and token TSE_SETUP_GRAYOUT_SELECTABLE is enable to make GrayoutIf control to focus and selectable
+ if ( (COND_NONE == u8ChkResult) || (IsGrayoutSelectable() && (COND_GRAYOUT == u8ChkResult)) )
+ {
+ // Control might be dynamically updated. Get the actual control
+ if(*control == NULL)
+ {
+ gApp->CompleteRedraw = TRUE;
+ return EFI_UNSUPPORTED;
+ }
+
+ // Set the Focus to current control
+ if((*control)->Methods->SetFocus(*control,TRUE) != EFI_SUCCESS)
+ {
+
+ //EIP-41817: Fix to allow Help Frame scroll support
+ if(frame->FrameData.FrameType != HELP_FRAME)
+ {
+ frame->CurrentControl = FRAME_NONE_FOCUSED;
+ bCurrNotFocused = TRUE; // Non is focused
+ }
+ }
+ }
+ }
+
+ //There is no active control we have to draw all in the view.
+
+ // First, clear the frame.
+ if ( frame->BlankLine != NULL )
+ {
+ j = frame->FrameData.Top;
+ for ( i = 1; i < frame->FrameData.Height; i++, j++ )
+ {
+ DrawStringWithAttribute( frame->FrameData.Left, j, frame->BlankLine, frame->FrameData.FGColor | frame->FrameData.BGColor );
+ }
+ }
+
+ //EIP:47940 - Check whether the scroll support required before proceeding.
+ if(!IsScrollSupportRequired( frame )) {
+ //If the scroll is not required, then reset the first visible control.
+ frame->FirstVisibleCtrl = 0;
+ }
+
+ //Set position for all controls begining from FirstVisibleControl.
+ //In the process calculate the correct LastVisibleControl.
+ control = frame->ControlList;
+ ControlTop = CurrHeight = 0;
+ control = control + frame->FirstVisibleCtrl;
+ CurrHeight = frame->FrameData.Top;
+ frame->LastVisibleCtrl = frame->FirstVisibleCtrl;
+
+ for ( i = frame->FirstVisibleCtrl; i < frame->ControlCount; i++, control++ )
+ {
+ ControlTop = CurrHeight;
+
+ //Check conditional
+ u8ChkResult = CheckControlCondition( &((*control)->ControlData) );
+
+ if(*control == NULL)
+ {
+ gApp->CompleteRedraw = TRUE;
+ return EFI_UNSUPPORTED;
+ }
+
+ if(u8ChkResult == COND_NONE || u8ChkResult == COND_GRAYOUT)
+ {
+// EIP47608 +>>
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ if(frame->FrameData.FrameType == MAIN_FRAME)
+ {
+ UINT16 height=0;
+ (*control)->Methods->GetControlHeight( *control, (VOID*)frame,&height);
+ height = height ? height:1;
+ (*control)->Methods->SetDimensions( *control,
+ frame->FrameData.Width - (UINT8)gLabelLeftMargin - 2,
+ height );
+ }
+ }
+// EIP47608 <<+
+
+ //Control is drawn increament height
+ CurrHeight = CurrHeight + (*control)->Height;
+ if((frame->ControlCount > 1) && ((frame->FrameData.Top +frame->FrameData.Height) < CurrHeight+1 ))
+ {
+ break;
+ }
+ else
+ {
+ frame->LastVisibleCtrl = i;
+ }
+ }
+
+ //If token TSE_SETUP_GRAYOUT_SELECTABLE is enable to make GrayoutIf control to focus and selectable
+ if (IsGrayoutSelectable())
+ u8ChkMask = COND_NONE | COND_GRAYOUT;
+ else
+ u8ChkMask = COND_NONE;
+
+ if ((u8ChkResult & ~u8ChkMask) != 0)
+ {
+ //Control grayed out or suppressed
+ if(frame->CurrentControl == i)
+ {
+ //Current control cant be focused
+ (*control)->Methods->SetFocus(*control,FALSE);
+ bCurrNotFocused = TRUE;
+ }
+ }
+
+ (*control)->Methods->SetPosition( *control, (*control)->Left, ControlTop);
+ }
+
+ //Current control can not be focused? Find another one to focus.
+ if(bCurrNotFocused)
+ {
+ control = frame->ControlList;
+ control = control+ frame->FirstVisibleCtrl;
+
+ for ( i = frame->FirstVisibleCtrl; i <= frame->LastVisibleCtrl; i++, control++ )
+ {
+ if ( (*control)->Methods->SetFocus( *control, TRUE ) == EFI_SUCCESS )
+ {
+ frame->CurrentControl = i;
+ break;
+ }
+ }
+
+ if(i > frame->LastVisibleCtrl)
+ frame->CurrentControl = FRAME_NONE_FOCUSED;
+ }
+
+ //Draw controls in the set positions
+ control = frame->ControlList;
+ control = control + frame->FirstVisibleCtrl;
+ for ( i = frame->FirstVisibleCtrl; i <= frame->LastVisibleCtrl; i++, control++ )
+ {
+ (*control)->Methods->Draw( *control );
+ }
+
+ CurrHeight = frame->FrameData.Top;
+ for (count = 0; count < frame->ControlCount; count++)
+ {
+ u8ChkResult = COND_NONE;
+
+ //EIP 75486 Support grayout condition for readonly controls
+ u8ChkResult = CheckControlCondition( &(frame->ControlList[count]->ControlData) );
+
+ if((COND_NONE == u8ChkResult) || (COND_GRAYOUT == u8ChkResult))
+ {
+ visibleControlCount++ ;
+ CurrHeight = CurrHeight + frame->ControlList[count]->Height;
+
+ if(count <= frame->LastVisibleCtrl)//EIP:48377/49548 Calculating the actual vlaue of CurrentvisibleControl when suppressed controls are present
+ CurrentvisibleControlCount++;
+ if(count < frame->FirstVisibleCtrl)//EIP:48377/49548 Calculating the actual vlaue of FirstvisibleControl when suppressed controls are present
+ CurrentFirstvisibleControlCount++;
+ FrameLastVisibleControl = count;
+ }
+ }
+
+ //EIP:72349
+ if(frame->FrameData.FrameType == MAIN_FRAME)
+ {
+ // Total height of all drawable controls, takes care of multi-line issues
+ visibleControlHeight = (UINT32)(CurrHeight - frame->FrameData.Top);
+
+ // if already have a Scroll bar and due some changes (some controls may bedisabled) we don't need a scroll bar in this frame.
+ if((frame->UseScrollbar) && ((frame->FrameData.Top + frame->FrameData.Height) >= CurrHeight+1))
+ {
+ bEraseScrollBar = TRUE;
+ frame->UseScrollbar = FALSE;
+ }
+
+ // if we don't have a Scroll bar and due some changes (some controls may be enabled) we need a scroll bar in this frame.
+ if((frame->ControlCount > 1) && (!frame->UseScrollbar) && ((frame->FrameData.Top + frame->FrameData.Height) < CurrHeight+1))
+ {
+ frame->UseScrollbar = TRUE;
+ }
+
+ if(visibleControlCount==0)visibleControlCount=1;
+
+ //Scroll bar coordinates are updated based on the controls in the frame
+ numOfBlocks = frame->FrameData.Height - 2;
+
+ // Find the top position, considering multi-line controls may be present
+ for(count=0; count < frame->FirstVisibleCtrl; count++)
+ {
+ u8ChkResult = CheckControlCondition( &(frame->ControlList[count]->ControlData) );
+ if((COND_NONE == u8ChkResult) || (COND_GRAYOUT == u8ChkResult))
+ {
+ topPos += frame->ControlList[count]->Height;
+ }
+ }
+
+ // Find the last position, considering multi-line controls may be present
+ for(count=0; count < frame->LastVisibleCtrl; count++)
+ {
+ u8ChkResult = CheckControlCondition( &(frame->ControlList[count]->ControlData) );
+ if((COND_NONE == u8ChkResult) || (COND_GRAYOUT == u8ChkResult))
+ {
+ lastPos += frame->ControlList[count]->Height;
+ }
+ }
+
+ // EIP_79963 Start
+ //Special case, check if total lines is 1 greater than a filled frame (visible controls)
+ if( (visibleControlHeight > (UINT32)(frame->FrameData.Height-1)) &&
+ ((visibleControlHeight - (UINT32)(frame->FrameData.Height-1)) < 2) )
+ {
+ visibleControlHeight += 1 ;
+ MltCnt = 1 ;
+ }
+ //EIP_79963 End
+
+ if (visibleControlHeight)
+ {
+ FirstLine = (((frame->FrameData.Height - 1) * topPos)/visibleControlHeight )+ frame->FrameData.Top;
+ LastLine = (((frame->FrameData.Height - 1) * lastPos)/visibleControlHeight )+ frame->FrameData.Top;
+ sizeOfBar = ((frame->FrameData.Height - 1) * numOfBlocks) / visibleControlHeight;
+ modVal = ((((frame->FrameData.Height - 1) * numOfBlocks) % visibleControlHeight)* numOfBlocks) > (numOfBlocks/2) ? 1 : 0;
+ }
+
+ //EIP_79963 Start
+ if(((frame->LastVisibleCtrl < frame->ControlCount-1 )&&(FirstLine > (UINT32)(frame->FrameData.Height-2) )) || (frame->LastVisibleCtrl == FrameLastVisibleControl) ||
+ ((frame->FirstVisibleCtrl > 0) && (FirstLine == frame->FrameData.Top)) )
+ {
+ if( (frame->FrameData.Top+topPos) < (UINT16)(frame->FrameData.Height-2))
+ {
+ if(MltCnt)
+ {
+ FirstLine = frame->FrameData.Top+topPos; //Providing the top postion value for immediate scroll after the (frame->FrameData.Height-2) reached
+ LastLine = FirstLine + sizeOfBar+1;//Providing the appopriate lastline
+ }
+ }
+ }
+ //EIP_79963 End
+
+ // Minimum scrollbar size is 1
+ if( ((LastLine - FirstLine)< 2) || (sizeOfBar == 0) )
+ {
+ sizeOfBar = 1 ;
+ }
+
+ // Scrollbar size must remain constant
+ if((LastLine - FirstLine - 1) != sizeOfBar)
+ {
+ //Check the maximum scrollbar boundry
+ if((FirstLine + sizeOfBar + 1) > (UINT32)(frame->FrameData.Top + frame->FrameData.Height - 2))
+ {
+ //Set the maximum scrollbar boundry
+ FirstLine = frame->FrameData.Top + frame->FrameData.Height - 2 - sizeOfBar - 1 ;
+ }
+
+ LastLine = FirstLine + sizeOfBar + 1 ;
+ }
+
+ if(MAIN_FRAME == frame->FrameData.FrameType)//EIP-67049 To store Scrollbar Top and Bottom positon
+ {
+ gFrameScrollBarTop = FirstLine;
+ gFrameScrollBarBottom = LastLine;
+ }
+
+ // draw scrollbar if necessary
+ StyleDrawScrollBar(frame, FirstLine, LastLine, modVal, sizeOfBar, numOfBlocks, bEraseScrollBar);
+
+ }//EIP:72349
+
+ FlushLines( frame->FrameData.Top, frame->FrameData.Top + frame->FrameData.Height );
+
+// if((!TSEMouseIgnoreMouseActionHook())&&((frame->ControlList[frame->CurrentControl]->ControlData.ControlType == CONTROL_TYPE_DATE)||(frame->ControlList[frame->CurrentControl]->ControlData.ControlType == CONTROL_TYPE_TIME)))
+// if(MAIN_FRAME == frame->FrameData.FrameType)
+// NumericSoftKbdInit();
+
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: FrameDrawScrollBar
+//
+// Description: Draws the scrollbar controls for the frame..
+//
+// Input: FRAME_DATA *frame - Pointer to the current frame
+// UINT32 FirstLine - FirstLine of the scrollbar
+// UINT32 LastLine - LastLine
+// UINT32 modVal - modVal
+// UINT32 sizeOfBar - Size of the Scrollbar
+// UINT32 numOfBlocks - Number of blocks
+// BOOLEAN bEraseScrollBar - flag to erase the scrollbar
+//
+// Output: EFI_STATUS status -
+// EFI_SUCCESS - If there exists a next page and the
+// function successfully loads it
+// EFI_OUT_PF_RESOURCES - If there are know previous page
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS FrameDrawScrollBar (FRAME_DATA *frame, UINT32 FirstLine, UINT32 LastLine, UINT32 modVal, UINT32 sizeOfBar, UINT32 numOfBlocks, BOOLEAN bEraseScrollBar)
+{
+ UINT32 i, j ;
+ CHAR16 ArrUp[2]={{GEOMETRICSHAPE_UP_TRIANGLE},{0x0000}} ;
+ CHAR16 ArrDown[2]={{GEOMETRICSHAPE_DOWN_TRIANGLE},{0x0000}};
+ CHAR16 ScrlSel[2]={{BLOCKELEMENT_FULL_BLOCK/*L'N'*/},{0x0000}};
+ CHAR16 ScrlNSel[2]={{BLOCKELEMENT_LIGHT_SHADE/*L'S'*/},{0x0000}};
+
+
+ // draw scrollbar if necessary
+ if ( frame->BlankLine != NULL )
+ {
+ j = frame->FrameData.Top;
+ for ( i = 1; i < frame->FrameData.Height; i++, j++ )
+ {
+ // use this loop to draw the scrollbar
+ if(frame->UseScrollbar)
+ {
+ if(i==1)
+ DrawStringWithAttribute( frame->FrameData.Left + frame->FrameData.Width , j, ArrUp,
+ StyleGetScrollBarUpArrowColor() );
+ else if(i==(UINT16)(frame->FrameData.Height - 1))
+ DrawStringWithAttribute( frame->FrameData.Left+ frame->FrameData.Width, j, ArrDown,
+ StyleGetScrollBarDownArrowColor() );
+ else
+ {
+ if( (j > FirstLine) && (j < LastLine) && ((sizeOfBar + modVal) != 0))////EIP:48377/49548 commented based on the draw of scrollbar.
+ {
+ DrawStringWithAttribute( frame->FrameData.Left+ frame->FrameData.Width, j, ScrlSel,
+ StyleGetScrollBarColor() );
+ sizeOfBar--;
+ }
+ else
+ {
+ DrawStringWithAttribute( frame->FrameData.Left+ frame->FrameData.Width, j, ScrlNSel,
+ StyleGetScrollBarColor() );
+ }
+ }
+ }
+ else if (bEraseScrollBar == TRUE)
+ DrawStringWithAttribute( frame->FrameData.Left+ frame->FrameData.Width, j, L" ",
+ StyleGetScrollBarColor() );
+
+ }
+ bEraseScrollBar = FALSE;
+ }
+
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: CheckKeyinHotKeysList
+//
+// Description: For Inconsistence condition checking for Hotkeys pressed to show the popup
+//
+// Input: AMI_EFI_KEY_DATA Key
+//
+// Output: BOOLEAN
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN CheckKeyinHotKeysList(AMI_EFI_KEY_DATA Key)
+{
+ UINT16 index=0;
+ for(index=0; index <= gHotKeyCount; index++)
+ {
+ if( (!EfiCompareMem(&Key, &gHotKeyInfo[index], sizeof(EFI_INPUT_KEY)) ) &&
+ ( TseCheckShiftState( Key, gHotKeyInfo[index].KeySftSte ) ) )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: FrameHandleAction
+//
+// Description: Action handler for specific frame
+//
+// Input: FRAME_DATA *frame - Pointer to the frame data
+// ACTION_DATA *action - Specific action for the frame
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else
+// EFI_UNSUPPORTED
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS FrameHandleAction( FRAME_DATA *frame, ACTION_DATA *action )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ CONTROL_DATA **control;
+
+ if ( frame->ControlCount == 0 )
+ return Status;
+
+ if(frame->CurrentControl == FRAME_NONE_FOCUSED)
+ control = NULL;
+ else
+ control = &frame->ControlList[frame->CurrentControl];
+
+ switch ( action->Input.Type )
+ {
+
+ case ACTION_TYPE_MOUSE:
+ Status = MouseFrameHandleAction(frame,action,control);
+ break;
+
+ case ACTION_TYPE_KEY:
+ if ( control != NULL )
+ Status = (*control)->Methods->HandleAction( *control, action );
+
+ if (EFI_ERROR(Status))
+ Status = StyleFrameHandleKey( frame, action->Input.Data.AmiKey.Key );
+
+ //EIP76810 : Ckecking Inconsistence for the current control
+ if (EFI_ERROR(Status))
+ {
+ if(( ControlActionUnknown != MapControlKeysHook(action->Input.Data.AmiKey))||(CheckKeyinHotKeysList(action->Input.Data.AmiKey)))
+ {//If the control action is known and if its hot key only we are popuping up the ERROR popup
+ if( CheckInconsistence((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[gApp->CurrentPage])) )
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ gAction.ClearAction( action );//Clearing the action if it is valid key pressed
+ }
+ }
+
+ if (EFI_ERROR(Status))
+ Status = _FrameHandleKey( frame, action->Input.Data.AmiKey );
+ break;
+
+ case ACTION_TYPE_TIMER:
+ {
+ UINT32 i;
+ control = frame->ControlList;
+ for ( i = 0; i < frame->ControlCount; i++, control++ )
+ {
+ EFI_STATUS TempStatus = (*control)->Methods->HandleAction( *control, action );
+ if ( Status != EFI_SUCCESS )
+ Status = TempStatus;
+ }
+ // To kill the timer action. Pass it to all the controls and frame.
+ // gAction.ClearAction( action );
+ }
+
+ if (EFI_ERROR(Status))
+ Status = StyleFrameHandleTimer( frame, action);
+ break;
+ default:
+ break;
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: FrameSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: FRAME_DATA *frame, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS FrameSetCallback( FRAME_DATA *frame, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gObject.SetCallback( frame, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: FrameAddControl
+//
+// Description: Adds controls to the frame
+//
+// Input: FRAME_DATA *frame - Pointer to the frame data
+// CONTROL_INFO *controlData - Control date to be added
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else
+// EFI_UNSUPPORTED
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS FrameAddControl( FRAME_DATA *frame, CONTROL_INFO *controlData )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ CONTROL_DATA **control;
+ POSITION_INFO *pos;
+ UINT16 count = (UINT16)frame->ControlCount;
+ UINT16 i;
+ BOOLEAN IsValidControl = FALSE;
+ gActiveFrame = frame;
+ control = MemReallocateZeroPool( frame->ControlList, count * sizeof(CONTROL_INFO *), (count + 1) * sizeof(CONTROL_INFO *) );
+
+ if ( control == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ frame->ControlList = control;
+ control = &frame->ControlList[ count ];
+
+ for(i=0;gTseControlMap[i].ControlType != CONTROL_TYPE_NULL;i++)
+ {
+ if(gTseControlMap[i].ControlType == controlData->ControlType)
+ {
+ Status = gTseControlMap[i].ControlMethods->Create(control);
+ if ( ! EFI_ERROR(Status) )
+ {
+ if(gTseControlMap[i].CallbackSuppored )
+ gTseControlMap[i].ControlMethods->SetCallback(*control, frame,
+ (OBJECT_CALLBACK)(UINTN)gTseControlMap[i].CallbackFunction,
+ (VOID*)gTseControlMap[i].CallbackContext);
+ }
+ IsValidControl = TRUE;
+ }
+ }
+
+ if(!IsValidControl)
+ {
+ if(controlData->ControlType == CONTROL_TYPE_NULL )
+ frame->NullCount++;
+ return Status;
+ }
+
+ if ( ! EFI_ERROR( Status ) )
+ {
+ Status = (*control)->Methods->Initialize( *control, controlData );
+
+ if ( ! EFI_ERROR( Status ) )
+ {
+ UINT16 height = 1;
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+
+ //EIP-127577 Start, commented in order to remove the delay before entering Setup.
+ // For Multi-line support, GetControlHeight is called again during the draw phase.
+ /*
+ if(IsTSEMultilineControlSupported())
+ {
+ Status = (*control)->Methods->GetControlHeight( *control, (VOID*)frame,&height);
+ height = height ? height:1;
+ }
+ */
+ //EIP-127577 End
+
+ if(frame->FrameData.FrameType == SUBTITLE_FRAME)
+ (*control)->Methods->SetDimensions( *control, frame->FrameData.Width , height );
+ else
+ (*control)->Methods->SetDimensions( *control, frame->FrameData.Width - (UINT8)gLabelLeftMargin - 2 , height );
+
+ (*control)->ParentFrameType = frame->FrameData.FrameType ;
+
+ frame->ControlCount++;
+ count++;
+
+ (*control)->Methods->SetPosition( *control, frame->FrameData.Left + (UINT8)gLabelLeftMargin, frame->FrameData.Top + count -1 );
+
+
+ if( EFI_ERROR( StyleHandleControlOverflow( frame, frame->ControlList[ count -1 ], (UINT16)frame->ControlCount )) )
+ {
+ frame->LastVisibleCtrl = frame->ControlCount-1;
+ }
+
+ // set position information
+ pos = MemReallocateZeroPool( frame->OrigPosition, (count-1) * sizeof(POSITION_INFO), (count ) * sizeof(POSITION_INFO) );
+ if ( pos != NULL )
+ {
+ pos[count-1].Left = (*control)->Left;
+ pos[count-1].Top = (*control)->Top;
+ frame->OrigPosition = pos;
+ }
+
+ MemFreePointer( (VOID **)&frame->CurrPosition );
+ frame->CurrPosition = EfiLibAllocateZeroPool( count * sizeof(POSITION_INFO) );
+
+ }
+
+ }
+ return Status;
+}
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _FrameHandleKey
+//
+// Description: Controls Keyboard action for each frame
+//
+// Input: FRAME_DATA *frame - Pointer to the frame data
+// EFI_INPUT_KEY key - Key pressed in the keyboard
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else
+// EFI_UNSUPPORTED
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS _FrameHandleKey( FRAME_DATA *frame, AMI_EFI_KEY_DATA key )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ CONTROL_ACTION Action;
+
+
+ //Get mapping
+ Action = MapControlKeysHook(key);
+
+ switch (Action)
+ {
+ case ControlActionNextUp:
+ Status = _FrameScroll( frame, TRUE);
+ break;
+
+ case ControlActionNextDown:
+ Status = _FrameScroll( frame, FALSE);
+ break;
+
+ case ControlActionPageUp:
+ Status = _PreviousFrame(frame);
+ break;
+
+ case ControlActionPageDown:
+ Status = _NextFrame(frame);
+ break;
+
+ case ControlActionHome:
+ Status = _FocusFirst(frame);
+ break;
+
+ case ControlActionEnd:
+ Status = _FocusLast(frame);
+ break;
+
+ default:
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+// if ( ! EFI_ERROR( Status ) )
+// {
+// if((TSEMouseIgnoreMouseActionHook())&&((frame->ControlList[frame->CurrentControl]->ControlData.ControlType != CONTROL_TYPE_DATE)&&(frame->ControlList[frame->CurrentControl]->ControlData.ControlType != CONTROL_TYPE_TIME)))
+// NumericSoftKbdExit();
+// if((!TSEMouseIgnoreMouseActionHook())&&((frame->ControlList[frame->CurrentControl]->ControlData.ControlType == CONTROL_TYPE_DATE)||(frame->ControlList[frame->CurrentControl]->ControlData.ControlType == CONTROL_TYPE_TIME)))
+// NumericSoftKbdInit();
+// }
+ return Status;
+}
+
+
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _FrameScroll
+//
+// Description: Adds scroll bar functionality for frames with many controls
+//
+// Input: FRAME_DATA *frame - Pointer to the frame data
+// BOOLEAN bScrollUp - Go up is TRUE, else to down one control
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else
+// EFI_UNSUPPORTED
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS _FrameScroll( FRAME_DATA *frame, BOOLEAN bScrollUp )
+{
+ UINT32 thisControl = frame->CurrentControl;
+ BOOLEAN bDone = FALSE;
+ UINT32 *pOtherEnd = NULL;
+ UINT8 u8ChkResult;
+
+ if ( frame->ControlCount == 0 )
+ return EFI_UNSUPPORTED;
+
+ switch ( bScrollUp )
+ {
+ case TRUE:
+ if (thisControl == FRAME_NONE_FOCUSED)
+ thisControl = frame->FirstVisibleCtrl;
+
+ if(thisControl < frame->FirstVisibleCtrl)
+ thisControl = frame->FirstVisibleCtrl;
+
+ //See if there are some controls that can be focused in the screen
+ while (thisControl != frame->FirstVisibleCtrl)
+ {
+ thisControl--;
+ if ( _FrameSetControlFocus( frame, thisControl ) )
+ {
+ bDone = TRUE;
+ break;
+ }
+ }
+
+ if (!bDone)
+ {
+ // No controls that can be focused is left move up til we find a unsuppressed control
+ while(thisControl)
+ {
+ thisControl--;
+
+ //EIP 75486 Support grayout condition for readonly controls
+ u8ChkResult = CheckControlCondition( &(frame->ControlList[thisControl]->ControlData) );
+
+ if((COND_NONE == u8ChkResult) || (COND_GRAYOUT == u8ChkResult))
+ {
+ frame->FirstVisibleCtrl = thisControl;
+ pOtherEnd = &(frame->LastVisibleCtrl);
+ _FrameSetControlFocus( frame, thisControl);
+ bDone = TRUE;
+ break;
+ }
+ }
+
+ // If no control can be found roll to last visible page
+ if (!bDone && StyleGetScrollBehavior())
+ {
+ thisControl = frame->LastVisibleCtrl = frame->ControlCount;
+ do
+ {
+ thisControl--;
+
+ //EIP 75486 Support grayout condition for readonly controls
+ u8ChkResult = CheckControlCondition( &(frame->ControlList[thisControl]->ControlData) );
+
+ if((COND_NONE == u8ChkResult) || (COND_GRAYOUT == u8ChkResult))
+ {
+ frame->LastVisibleCtrl = thisControl;
+ pOtherEnd = &(frame->FirstVisibleCtrl);
+ bDone = TRUE;
+ break;
+ }
+ }while(thisControl);
+ }
+
+ if(!bDone)
+ {
+ //No control can be shown in this whole frame
+ //Blaines EIP#13293
+ if(StyleGetScrollBehavior())
+ frame->FirstVisibleCtrl = frame->LastVisibleCtrl = 0;
+ return EFI_UNSUPPORTED;
+ }
+
+ // Calculate other end
+ StyleFrameSetControlPositions(frame, pOtherEnd);
+
+ if(pOtherEnd == &(frame->FirstVisibleCtrl))
+ {
+ //We rolled to last page; find if we can focus one
+ while (thisControl >= frame->FirstVisibleCtrl)
+ {
+ if ( _FrameSetControlFocus( frame, thisControl ) )
+ {
+ break;
+ }
+ if(thisControl == 0)
+ break;
+ thisControl--;
+ }
+ }
+
+ //De-focus if we have no control that can be focused in the screen
+ if(frame->CurrentControl != FRAME_NONE_FOCUSED)
+ {
+ if((frame->CurrentControl < frame->FirstVisibleCtrl) || (frame->CurrentControl > frame->LastVisibleCtrl))
+ {
+ (frame->ControlList[frame->CurrentControl])->Methods->SetFocus(frame->ControlList[frame->CurrentControl],FALSE);
+ frame->CurrentControl = FRAME_NONE_FOCUSED;
+ }
+ }
+ }
+ break;
+
+ case FALSE:
+ if (thisControl == FRAME_NONE_FOCUSED)
+ thisControl = frame->LastVisibleCtrl;
+
+ if(thisControl > frame->LastVisibleCtrl)
+ thisControl = frame->LastVisibleCtrl;
+
+ //See if there are some controls that can be focused in the screen
+ while (thisControl != frame->LastVisibleCtrl)
+ {
+ thisControl++;
+ if ( _FrameSetControlFocus( frame, thisControl ) )
+ {
+ bDone = TRUE;
+ break;
+ }
+ }
+
+ if (!bDone)
+ {
+ // No controls that can be focused is left move down til we find an unsuppressed control
+ while((frame->ControlCount - 1) != thisControl)
+ {
+ thisControl++;
+
+ //EIP 75486 Support grayout condition for readonly controls
+ u8ChkResult = CheckControlCondition( &(frame->ControlList[thisControl]->ControlData) );
+
+ if((COND_NONE == u8ChkResult) || (COND_GRAYOUT == u8ChkResult))
+ {
+ frame->LastVisibleCtrl = thisControl;
+ pOtherEnd = &(frame->FirstVisibleCtrl);
+ _FrameSetControlFocus( frame, thisControl);
+ bDone = TRUE;
+ break;
+ }
+ }
+
+ // If no control can be found roll to First visible page
+ //EIP#13293
+ if (!bDone && StyleGetScrollBehavior())
+ {
+ thisControl = frame->FirstVisibleCtrl = 0;
+ while(thisControl < frame->ControlCount)
+ {
+ //EIP 75486 Support grayout condition for readonly controls
+ u8ChkResult = CheckControlCondition( &(frame->ControlList[thisControl]->ControlData) );
+
+ if((COND_NONE == u8ChkResult) || (COND_GRAYOUT == u8ChkResult))
+ {
+ //frame->FirstVisibleCtrl = thisControl;
+ pOtherEnd = &(frame->LastVisibleCtrl);
+ bDone = TRUE;
+ break;
+ }
+
+ if((thisControl + 1) == frame->ControlCount) //this while loop breaks here before while statement
+ break;
+ thisControl++;
+ }
+ }
+
+ if(!bDone)
+ {
+ //No control can be shown in this whole frame
+ //Blaines EIP#13293
+ if(StyleGetScrollBehavior())
+ frame->FirstVisibleCtrl = frame->LastVisibleCtrl = 0;
+ return EFI_UNSUPPORTED;
+ }
+
+ //Calculate other end
+ StyleFrameSetControlPositions(frame, pOtherEnd);
+
+ if(pOtherEnd == &(frame->LastVisibleCtrl))
+ {
+ //We rolled to First page; find if we can focus one
+ while (thisControl <= frame->LastVisibleCtrl)
+ {
+ if ( _FrameSetControlFocus( frame, thisControl ) )
+ {
+ break;
+ }
+ thisControl++;
+ }
+ }
+
+ //De-focus if we have no control that can be focused in the screen
+ if(frame->CurrentControl != FRAME_NONE_FOCUSED)
+ {
+ if((frame->CurrentControl < frame->FirstVisibleCtrl) || (frame->CurrentControl > frame->LastVisibleCtrl))
+ {
+ (frame->ControlList[frame->CurrentControl])->Methods->SetFocus(frame->ControlList[frame->CurrentControl],FALSE);
+ frame->CurrentControl = FRAME_NONE_FOCUSED;
+ }
+ }
+ }
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _FrameSubmenuCallback
+//
+// Description: Function to set frame submenu callback.
+//
+// Input: FRAME_DATA *frame, SUBMENU_DATA *submenu, VOID *cookie
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _FrameSubmenuCallback( FRAME_DATA *frame, SUBMENU_DATA *submenu, VOID *cookie )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ CALLBACK_SUBMENU *callbackData = (CALLBACK_SUBMENU *)cookie;
+
+ if ( ( callbackData == NULL ) || ( callbackData->Header.Type != CALLBACK_TYPE_SUBMENU ) )
+ return;
+
+ if ( ! EFI_ERROR( Status ) )
+ {
+ gApp->CurrentPage = callbackData->DestPage;
+//EIP: 55762 Start
+ if(submenu->ControlData.DestQuestionID != 0){
+ UINT32 FocusControlIndex = 0;
+
+ Status = UpdateDestiantionQuestion(gApp->CurrentPage, submenu->ControlData.DestQuestionID, &FocusControlIndex);
+ if(Status == EFI_SUCCESS){
+ UINT32 MainFrameIndex = 0;
+ FRAME_DATA *MainFrame = NULL;
+ PAGE_DATA *pageData = gApp->PageList[gApp->CurrentPage];
+ MainFrameIndex = StyleFrameIndexOf(MAIN_FRAME);
+ MainFrame = pageData->FrameList[MainFrameIndex];
+ _FrameSetControlFocus(MainFrame, FocusControlIndex);
+ }
+ }
+ }
+//EIP: 55762 End
+ gApp->CompleteRedraw = TRUE;
+ gApp->OnRedraw = SUBMENU_COMPLETE_REDRAW;
+
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _FrameMenuCallback
+//
+// Description: Function to set frame menu callback.
+//
+// Input: FRAME_DATA *frame, MENU_DATA *menu, VOID *cookie
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _FrameMenuCallback( FRAME_DATA *frame, MENU_DATA *menu, VOID *cookie )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ CALLBACK_MENU *callbackData = (CALLBACK_MENU *)cookie;
+
+ if ( ( callbackData == NULL ) || ( callbackData->Header.Type != CALLBACK_TYPE_MENU ) )
+ return;
+
+ if ( ! EFI_ERROR( Status ) )
+ gApp->CurrentPage = callbackData->DestPage;
+ gApp->CompleteRedraw = TRUE;
+ gApp->OnRedraw = MENU_COMPLETE_REDRAW;
+//EIP: 58925 Start
+ if(IsLinkHistorySupport())
+ {
+ ResetNavStack();
+ }
+//EIP: 58925 End
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _FrameVariableCallback
+//
+// Description: Function to set frame variable callback.
+//
+// Input: FRAME_DATA *frame, CONTROL_DATA *control, VOID *cookie
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _FrameVariableCallback( FRAME_DATA *frame, CONTROL_DATA *control, VOID *cookie )
+{
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)cookie;
+
+ if ( ( callbackData == NULL ) || ( callbackData->Header.Type != CALLBACK_TYPE_VARIABLE ) )
+ return;
+
+ if ( callbackData->Variable >= gVariables->VariableCount )
+ return;
+
+ VarSetValue( callbackData->Variable, callbackData->Offset, callbackData->Length, callbackData->Data );
+
+ if ( control->ControlData.ControlFlags.ControlReset )
+ gResetRequired = TRUE;
+
+}
+BOOLEAN TSEPwdSavetoNvram(VOID);//EIP 93881 & 93873 : Save pwd to nvram and not loading empty pwd on loading defaults.
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _FramePasswordCallback
+//
+// Description: Function to set frame password callback.
+//
+// Input: FRAME_DATA *frame, CONTROL_DATA *control, VOID *cookie
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _FramePasswordCallback( FRAME_DATA *frame, CONTROL_DATA *control, VOID *cookie )
+{
+ CALLBACK_PASSWORD *callbackData = (CALLBACK_PASSWORD *)cookie;
+ CHAR16 *saveData = NULL;
+
+ if ( ( callbackData == NULL ) || ( callbackData->Header.Type != CALLBACK_TYPE_PASSWORD ) )
+ return;
+
+ if ( callbackData->Variable >= gVariables->VariableCount )
+ return;
+
+ saveData = (CHAR16 *)callbackData->Data;
+
+ if(FramePwdCallbackIdePasswordUpdate ( control,saveData) != EFI_SUCCESS)
+ {
+//EIP 23354 : Start
+ if( IsPasswordEncodeEnabled(&control->ControlData) )
+ saveData = PasswordUpdate( callbackData->Data, callbackData->Length);
+//EIP 23354 : End
+
+ if ( saveData )
+ {
+//EIP 93881 & 93873 : Save pwd to nvram and not loading empty pwd on loading defaults.
+ if((TSEPwdSavetoNvram())&&( VARIABLE_ID_AMITSESETUP == callbackData->Variable ))
+ {
+ AMITSESETUP *TempSaveData = (AMITSESETUP *)NULL;
+ UINTN size=0;
+ TempSaveData = (AMITSESETUP *) EfiLibAllocateZeroPool(sizeof(AMITSESETUP));
+ size = sizeof(AMITSESETUP);
+
+ TempSaveData = VarGetNvram(VARIABLE_ID_AMITSESETUP, &size);
+ MemCopy( ((UINT8*)(TempSaveData))+(callbackData->Offset), saveData, callbackData->Length );
+ VarSetNvram( VARIABLE_ID_AMITSESETUP, TempSaveData, sizeof(AMITSESETUP));
+ MemFreePointer( (VOID **)&TempSaveData );
+ }
+ else
+ VarSetValue( callbackData->Variable, callbackData->Offset, callbackData->Length, saveData );
+
+ FramePasswordAdvancedCallback(callbackData,saveData);
+ }
+
+ if ( saveData != callbackData->Data )
+ MemFreePointer( (VOID **)&saveData );
+ }
+
+ if ( control->ControlData.ControlFlags.ControlReset )
+ gResetRequired = TRUE;
+
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _FrameSetControlFocus
+//
+// Description: Sets focus on a defined control in the frame
+//
+// Input: FRAME_DATA *frame - Date for a specific frame
+// UINT32 index - Index of the control
+//
+// Output: BOOLEAN focusSet - TRUE if focus is set, FALSE otherwise
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+BOOLEAN _FrameSetControlFocus( FRAME_DATA *frame, UINT32 index )
+{
+ CONTROL_DATA *control;
+ BOOLEAN focusSet = FALSE;
+
+ if ( frame->ControlCount <= index )
+ return focusSet;
+
+ control = frame->ControlList[index];
+ focusSet = (BOOLEAN)(control->Methods->SetFocus( control, TRUE ) == EFI_SUCCESS);
+
+ // de-focus all other controls
+ if ( focusSet )
+ {
+ UINT32 i;
+
+ for ( i = 0; i < frame->ControlCount; i++ )
+ {
+ if ( i == index )
+ continue;
+ control = frame->ControlList[i];
+ control->Methods->SetFocus( control, FALSE );
+ }
+
+ frame->CurrentControl = index;
+ }
+
+ return focusSet;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _FrameAddControls
+//
+// Description: Function to add controls in the frame
+//
+// Input: FRAME_DATA *frame, PAGE_INFO *data
+//
+//
+// Output: STATUS
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _FrameAddControls( FRAME_DATA *frame, PAGE_INFO *data )
+{
+ EFI_STATUS Status = EFI_INVALID_PARAMETER;
+ UINT32 i, controlNumber = 0;
+ BOOLEAN focusSet = FALSE;
+
+ for ( i = 0; i < data->PageControls.ControlCount; i++ )
+ {
+ Status = gFrame.AddControl( frame, (CONTROL_INFO *) ((UINT8 *)gControlInfo + data->PageControls.ControlList[i]) );
+ if ( EFI_ERROR(Status) )
+ continue;
+
+ if ( ! focusSet )
+ {
+ if ( _FrameSetControlFocus( frame, controlNumber ) )
+ {
+ frame->CurrentControl = controlNumber;
+ focusSet = TRUE;
+ }
+ }
+ controlNumber++;
+ }
+
+ Status = StyleAddAdditionalControls( frame, controlNumber, focusSet );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _FrameAddTitle
+//
+// Description: Function to add tittle to a frame.
+//
+// Input: FRAME_DATA *frame, UINT32 frameNumber, PAGE_INFO *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _FrameAddTitle( FRAME_DATA *frame, UINT32 frameType, PAGE_INFO *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ CONTROL_DATA **control;
+ CONTROL_INFO dummy;
+ UINT8 BORDER = (frame->FrameData.Border==TRUE)?1:0 ;
+
+ UINT8 SPACER = 0 ;
+
+
+ control = EfiLibAllocateZeroPool( sizeof(CONTROL_INFO *) );
+ if ( control == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ frame->ControlList = control;
+ Status = gMemo.Create( control );
+
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ MemSet( &dummy, sizeof(dummy), 0 );
+ dummy.ControlHandle = (VOID*)(UINTN)INVALID_HANDLE;
+ dummy.ControlFlags.ControlVisible = TRUE;
+ dummy.ControlType = CONTROL_TYPE_MEMO;
+
+ switch ( frameType )
+ {
+ case TITLE_FRAME:
+ dummy.ControlPtr = (VOID*)gTitle;
+ break;
+ case HELP_FRAME:
+ dummy.ControlPtr = (VOID*)gHelp;
+ SPACER = 1 ;
+ break;
+ case SUBTITLE_FRAME:
+ dummy.ControlPtr = (VOID*)gSubTitle;
+ break;
+ case HELPTITLE_FRAME:
+ dummy.ControlPtr = (VOID*)gHelpTitle;
+ break;
+ case NAV_FRAME:
+ dummy.ControlPtr = (VOID*)gNavStrings;
+ break;
+ default:
+ if(StyleFrameAddTitle(frame, frameType,&dummy) != EFI_SUCCESS)
+ {
+ gMemo.Destroy( *control, TRUE );
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ (*control)->ParentFrameType = frame->FrameData.FrameType ;
+ gMemo.Initialize( *control, &dummy );
+ gMemo.SetPosition( *control, frame->FrameData.Left+BORDER, frame->FrameData.Top+BORDER );
+ gMemo.SetDimensions( *control, frame->FrameData.Width-SPACER-2*BORDER, frame->FrameData.Height-2*BORDER );
+ gMemo.SetAttributes( *control, frame->FrameData.FGColor, frame->FrameData.BGColor );
+ if((IsMouseSupported()) && (frameType == NAV_FRAME))
+ {
+ (*control)->FGColor = FOCUS_COLOR;
+ }
+ frame->ControlCount++;
+
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _PreviousFrame
+//
+// Description: Loads the controls from the previous frame into the screen.
+//
+// Input: FRAME_DATA *frame = Pointer to the current frame
+//
+// Output: EFI_STATUS status -
+// EFI_SUCCESS - If there exists a previous page and the
+// function successfully loads it
+// EFI_OUT_PF_RESOURCES - If there are know previous page
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS _PreviousFrame (FRAME_DATA *frame)
+{
+ UINT32 thisControl;
+ BOOLEAN bFocused;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ if(frame->FirstVisibleCtrl > 0)
+ {
+ //return EFI_UNSUPPORTED;
+
+ frame->LastVisibleCtrl = frame->FirstVisibleCtrl-1;
+ StyleFrameSetControlPositions(frame, &(frame->FirstVisibleCtrl));
+
+
+ if(frame->FirstVisibleCtrl<=0)
+ {
+ StyleFrameSetControlPositions(frame, &(frame->LastVisibleCtrl));
+ }
+ }
+
+
+ //Focus a control if possible
+ thisControl = frame->FirstVisibleCtrl;
+ bFocused = FALSE;
+ while (thisControl <= frame->LastVisibleCtrl)
+ {
+ if ( _FrameSetControlFocus( frame, thisControl ) )
+ {
+ bFocused = TRUE;
+ break;
+ }
+ thisControl++;
+ }
+
+ if (!bFocused)
+ frame->CurrentControl = FRAME_NONE_FOCUSED;
+
+ Status = EFI_SUCCESS ;
+
+ return Status;
+}
+
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _NextFrame
+//
+// Description: Loads the controls from the next frame into the screen.
+//
+// Input: FRAME_DATA *frame = Pointer to the current frame
+//
+// Output: EFI_STATUS status -
+// EFI_SUCCESS - If there exists a next page and the
+// function successfully loads it
+// EFI_OUT_PF_RESOURCES - If there are know previous page
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _NextFrame (FRAME_DATA *frame)
+{
+ UINT32 thisControl;
+ BOOLEAN bFocused;
+
+ if(frame->LastVisibleCtrl < (frame->ControlCount-1))
+ {
+ //return EFI_UNSUPPORTED;
+ frame->FirstVisibleCtrl = frame->LastVisibleCtrl + 1;
+
+ StyleFrameSetControlPositions(frame, &(frame->LastVisibleCtrl));
+
+ if(frame->LastVisibleCtrl>=(frame->ControlCount-1))
+ {
+ StyleFrameSetControlPositions(frame, &(frame->FirstVisibleCtrl));
+ }
+ }
+
+
+ //Focus a control if possible
+ /*
+ thisControl = frame->FirstVisibleCtrl;
+ bFocused = FALSE;
+ while (thisControl <= frame->LastVisibleCtrl)
+ {
+ if ( _FrameSetControlFocus( frame, thisControl ) )
+ {
+ bFocused = TRUE;
+ break;
+ }
+ thisControl++;
+ }
+ */
+
+ //EIP#13118 Set Focus to bottom of page on PageDown
+ thisControl = frame->LastVisibleCtrl;
+ bFocused = FALSE;
+ while (thisControl >= frame->FirstVisibleCtrl)
+ {
+ if ( _FrameSetControlFocus( frame, thisControl ) )
+ {
+ bFocused = TRUE;
+ break;
+ }
+ //EIP:31606 - Fix for hanging issue in case of no active controls in a frame
+ if (thisControl == 0)
+ break;
+
+ thisControl--;
+ }
+
+ if (!bFocused)
+ frame->CurrentControl = FRAME_NONE_FOCUSED;
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _FocusFirst
+//
+// Description: Set focus to the first control in the frame (in the first page).
+//
+// Input: FRAME_DATA *frame = Pointer to the current frame
+//
+// Output: EFI_STATUS status -
+// EFI_SUCCESS - If there exists a previous page and the
+// function successfully loads it
+// EFI_OUT_PF_RESOURCES - If there are know previous page
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS _FocusFirst (FRAME_DATA *frame)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ do
+ { //At least once in case there's less than a page
+ Status = _PreviousFrame(frame);
+
+ }while(frame->FirstVisibleCtrl > 0);
+
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: _FocusLast
+//
+// Description: Set focus to the last control in the frame.
+//
+// Input: FRAME_DATA *frame = Pointer to the current frame
+//
+// Output: EFI_STATUS status -
+// EFI_SUCCESS - If there exists a previous page and the
+// function successfully loads it
+// EFI_OUT_PF_RESOURCES - If there are know previous page
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS _FocusLast (FRAME_DATA *frame)
+{
+
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ do
+ { //At least once in case there's less than a page
+ Status = _NextFrame(frame);
+
+ }while(frame->LastVisibleCtrl < (frame->ControlCount-1));
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _FrameHandleMouse
+//
+// Description: Function to hadnle frame using mouse
+//
+// Input: FRAME_DATA *frame,
+// MOUSE_INFO MouseInfo
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _FrameHandleMouse( FRAME_DATA *frame,MOUSE_INFO MouseInfo)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT32 i, Action;
+
+ Action = MapControlMouseActionHook(&MouseInfo);
+ //if(TSEMOUSE_RIGHT_CLICK == MouseInfo.ButtonStatus)
+ if(ControlActionAbort == Action)
+ return Status;
+
+ if ( frame->ControlCount == 0 )
+ return Status;
+
+ //Reset lbutton positions
+ if (ControlMouseActionLeftUp == Action || ControlActionChoose == Action || ControlActionSelect == Action)
+ {
+ lButtonDownInitialPosition = 0;
+ lButtonDownVaringPosition = 0;
+ }
+
+ //For Handling Frame Scroll Bar using Mouse
+ if(frame->UseScrollbar)
+ {
+ //If clicked on scrollbar area
+ if(MouseInfo.Left == (UINT32) frame->FrameData.Left + frame->FrameData.Width)
+ {
+ //If clicked on UP_ARROW
+ if( (MouseInfo.Top == frame->FrameData.Top) /*Arrow Up*/
+ &&((TSEMOUSE_LEFT_CLICK == MouseInfo.ButtonStatus)||(TSEMOUSE_LEFT_DCLICK == MouseInfo.ButtonStatus))//EIP 78929 : Check for left click and left double click to scroll the frame if click on arrow buttons of scroll bar.
+ )
+ MouseScrollBarMove( frame, TRUE, 1 );
+
+ //If clicked on DOWN_ARROW
+ else if( ( MouseInfo.Top == (UINT32) (frame->FrameData.Top + frame->FrameData.Height -2) || MouseInfo.Top == (UINT32) (frame->FrameData.Top + frame->FrameData.Height -3) ) //EIP:48377 Coordinates of Mouse click down arrow operation are updated to work for GTSE and AMITSE.
+ &&((TSEMOUSE_LEFT_CLICK == MouseInfo.ButtonStatus)||(TSEMOUSE_LEFT_DCLICK == MouseInfo.ButtonStatus))//EIP 78929 : Check for left click and left double click to scroll the frame if click on arrow buttons of scroll bar.
+ )
+ MouseScrollBarMove( frame, FALSE, 1 );
+
+ //If mouse clicked below UP_ARROW and above ScrollBar
+ else if( (MouseInfo.Top <= gFrameScrollBarTop) //Clicked above scrollbar
+ && (MouseInfo.Top > frame->FrameData.Top) //Clicked below UP_ARROW
+ && (ControlMouseActionLeftDown == Action)
+ )
+ {
+ MouseScrollBarMove( frame, TRUE, gFrameScrollBarTop-MouseInfo.Top+1 );
+ }
+
+ //If mouse clicked on scrollbar
+ else if( (MouseInfo.Top < gFrameScrollBarBottom) && (MouseInfo.Top > gFrameScrollBarTop) //Clicked on ScrollBar area
+ && (ControlMouseActionLeftDown == Action) // Clicked lbutton down
+ && ((ControlActionChoose != Action) || (ControlActionSelect != Action)) //Neglecting LEFT_DCLICK and LEFT_CLICK on scrollbar area
+ )
+ {
+ if ( lButtonDownInitialPosition == 0 )//To get initial lButtonDown position
+ {
+ lButtonDownInitialPosition = MouseInfo.Top;
+ }
+ if ( lButtonDownInitialPosition != MouseInfo.Top )
+ {
+ lButtonDownVaringPosition = MouseInfo.Top;
+ //Move scrollbar upwards
+ if( lButtonDownInitialPosition > lButtonDownVaringPosition )
+ MouseScrollBarMove( frame, TRUE, lButtonDownInitialPosition - lButtonDownVaringPosition );
+
+ //Move scrollbar downwards
+ else
+ MouseScrollBarMove( frame, FALSE, lButtonDownVaringPosition - lButtonDownInitialPosition );
+ lButtonDownInitialPosition = lButtonDownVaringPosition;
+ }
+ return EFI_SUCCESS;
+ }
+
+ //If mouse clicked above DOWN_ARROW and below ScrollBar
+ else if( (MouseInfo.Top >= gFrameScrollBarBottom)
+ && (MouseInfo.Top < (UINT32) (frame->FrameData.Top + frame->FrameData.Height -2))
+ && (ControlMouseActionLeftDown == Action)
+ )
+ {
+ MouseScrollBarMove( frame, FALSE, MouseInfo.Top-gFrameScrollBarBottom + 1 );
+ }
+ return EFI_SUCCESS;
+ }
+ //If mouse button clicked on scrollbar and moved outside the scroll area
+ else if( ControlMouseActionLeftDown == Action
+ && (lButtonDownInitialPosition != 0)
+ && ((ControlActionChoose != Action) || (ControlActionSelect != Action))
+ )
+ {
+ lButtonDownVaringPosition = MouseInfo.Top;
+ //Move scrollbar upwards
+ if( lButtonDownInitialPosition > lButtonDownVaringPosition )
+ MouseScrollBarMove( frame, TRUE, lButtonDownInitialPosition - lButtonDownVaringPosition );
+
+ //Move scrollbar downwards
+ else
+ MouseScrollBarMove( frame, FALSE, lButtonDownVaringPosition - lButtonDownInitialPosition );
+ lButtonDownInitialPosition = lButtonDownVaringPosition;
+
+ //Reset lButtonDown position when lButton releases
+ if (ControlMouseActionLeftUp == Action)
+ {
+ lButtonDownInitialPosition = lButtonDownVaringPosition = 0;
+ }
+ return EFI_SUCCESS;
+ }
+ }
+
+ //If mouse clicked on frame without scrollbar support
+ if(!((MouseInfo.Top >= (UINT32)frame->FrameData.Top) && (MouseInfo.Left > (UINT32)(frame->FrameData.Width+1) )) //Clicked other than scrollbar area
+ && (ControlMouseActionLeftUp != Action) //Neglecting LEFT_UP action
+ )
+ {
+ //Find control that was clicked
+ for(i=frame->FirstVisibleCtrl; i<=frame->LastVisibleCtrl; i++)
+ {
+ if( (MouseInfo.Top >= frame->ControlList[i]->Top) && (MouseInfo.Top < (UINT32)(frame->ControlList[i]->Top + frame->ControlList[i]->Height)) )
+ {
+ //This is the control; select it.
+ if ( _FrameSetControlFocus( frame, i ) )
+ {
+ // if((TSEMouseIgnoreMouseActionHook())&&((frame->ControlList[i]->ControlData.ControlType != CONTROL_TYPE_DATE)&&(frame->ControlList[i]->ControlData.ControlType != CONTROL_TYPE_TIME)))
+ // NumericSoftKbdExit();
+ // if((!TSEMouseIgnoreMouseActionHook())&&((frame->ControlList[i]->ControlData.ControlType == CONTROL_TYPE_DATE)||(frame->ControlList[i]->ControlData.ControlType == CONTROL_TYPE_TIME)))
+ // NumericSoftKbdInit();
+ Status = EFI_SUCCESS;
+ break;
+ }
+ }
+ }
+ }
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSEMouseFrameHandleAction
+//
+// Description: Function to hadnle frame using mouse
+//
+// Input: FRAME_DATA *frame,
+// ACTION_DATA *action,
+// CONTROL_DATA **control
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TSEMouseFrameHandleAction( FRAME_DATA *frame, ACTION_DATA *action,CONTROL_DATA **control )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ if( (action->Input.Data.MouseInfo.Top >= (UINT32)frame->FrameData.Top) && (action->Input.Data.MouseInfo.Left > (UINT32)(frame->FrameData.Width+1) ) )
+ {
+ TSEMouseHelpFrameHandleAction(frame, action, control);
+ }
+
+ //EIP-123727 check whether Current Control is with in the Visible Area or not.
+ if ( control != NULL && (frame->CurrentControl >= frame->FirstVisibleCtrl && frame->CurrentControl <= frame->LastVisibleCtrl))
+ Status = (*control)->Methods->HandleAction( *control, action );
+
+
+ if (EFI_ERROR(Status))
+ Status = StyleFrameHandleMouse( frame, action->Input.Data.MouseInfo );
+
+ //EIP76810 : Ckecking Inconsistence for the current control
+ if (EFI_ERROR(Status))
+ {
+ if( CheckInconsistence((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[gApp->CurrentPage])) )
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ gAction.ClearAction( action );
+
+ }
+
+ if (EFI_ERROR(Status))
+ Status = _FrameHandleMouse( frame, action->Input.Data.MouseInfo);
+
+ return Status;
+}
+
+//EIP:62098 START
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TSEMouseHelpFrameHandleAction
+//
+// Description: Function to hadnle help frame using mouse
+//
+// Input: FRAME_DATA *frame,
+// ACTION_DATA *action,
+// CONTROL_DATA **control
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TSEMouseHelpFrameHandleAction( FRAME_DATA *frame, ACTION_DATA *action,CONTROL_DATA **control )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ MEMO_DATA *memo;
+ BOOLEAN bScrollBar = FALSE;
+ CHAR16 *text = NULL;
+ UINT16 height = 0;
+
+ control = frame->ControlList;
+ control = control+ frame->FirstVisibleCtrl;
+ memo = (MEMO_DATA *) *control;
+
+ if( memo->ParentFrameType != HELP_FRAME )
+ return Status;
+ else
+ {
+ text = HiiGetString( memo->ControlData.ControlHandle,UefiGetTitleField( (VOID *)memo->ControlData.ControlPtr));
+
+ if ( text == NULL )
+ return Status;
+
+ if ( EfiStrLen(text) == 0)
+ {
+ // String is empty but memory is allocated.
+ MemFreePointer( (VOID **)&text );
+ return Status;
+ }
+
+ // clear out old wrapped string
+ //EIP-131365 Here gActiveBuffer will update with EmptyString and clear HelpFrame characters. This causes help area flickers when mouse action happens.
+ //for ( pos = 0; pos < memo->Height; pos++ )
+ //DrawStringWithAttribute( memo->Left, memo->Top + pos, memo->EmptyString, memo->FGColor | memo->BGColor );
+
+ // XXX: this wrapping code is probably not compatible with all languages
+ StringWrapText( text, memo->Width, &height );
+ if(height == 0)
+ return Status;
+
+ bScrollBar = ( (height > memo->Height) && (memo->ParentFrameType == HELP_FRAME /*memo->Top == MAIN_TOP*/) ) ? 1 : 0;
+
+ if(bScrollBar && (action->Input.Data.MouseInfo.ButtonStatus == TSEMOUSE_LEFT_CLICK))
+ {
+
+ if((action->Input.Data.MouseInfo.Top == (frame->FrameData.Top + frame->FrameData.Height -1))&&(action->Input.Data.MouseInfo.Left == frame->FrameData.Width + frame->FrameData.Left -1 ))
+ _HelpFrameScroll( memo, FALSE);
+
+ if(((action->Input.Data.MouseInfo.Top == frame->FrameData.Top) ||(action->Input.Data.MouseInfo.Top == frame->FrameData.Top -1))
+ && (action->Input.Data.MouseInfo.Left == frame->FrameData.Width + frame->FrameData.Left -1) )
+ _HelpFrameScroll( memo, TRUE);
+
+
+ }
+ else
+ return Status;
+ }
+
+ return Status;
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _HelpFrameScroll
+//
+// Description: Function to hadnle help frame scroll using mouse
+//
+// Input: FRAME_DATA *frame,
+// ACTION_DATA *action,
+// CONTROL_DATA **control
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _HelpFrameScroll(MEMO_DATA *memo,BOOLEAN bScrollUp)
+{
+ switch(bScrollUp)
+ {
+
+ case FALSE:
+ if( memo->ParentFrameType == HELP_FRAME)
+ {
+ // Incrementing the ScrollBarPosition.
+ memo->ScrollBarPosition++;
+ // Based upon ScrollBarPosition drawing the Memo again.
+ gMemo.Draw(memo);
+ }
+ break;
+
+ case TRUE:
+ if( memo->ParentFrameType == HELP_FRAME)
+ {
+ // Decrementing ScrollBarPosition
+ if( memo->ScrollBarPosition != 0 )
+ memo->ScrollBarPosition--;
+ else
+ memo->ScrollBarPosition = 0;
+ gMemo.Draw(memo);
+ }
+ break;
+ default:
+ return ;
+ }
+
+}
+//EIP:62098 END
+
+//EIP-67049 Start
+//<AMI_PHDR_START>
+//--------------------------------------------------------------------------
+//
+// Name: TSEMouseScrollBarMove
+//
+// Description: Adds scroll bar functionality for frames with many controls
+//
+// Input: FRAME_DATA *frame - Pointer to the frame data
+// BOOLEAN bScrollUp - Go up is TRUE, else to down one control
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else
+// EFI_UNSUPPORTED
+//
+//--------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS TSEMouseScrollBarMove( FRAME_DATA *frame, BOOLEAN bScrollUp, UINT32 Size )
+{
+ CONTROL_DATA *control=NULL;
+ UINTN i=0,IndexOfLastNonSupressctrl=0;
+ UINT8 u8ChkResult;
+
+ if ( frame->ControlCount == 0 )
+ return EFI_UNSUPPORTED;
+
+ switch ( bScrollUp )
+ {
+ case TRUE:
+
+ if( Size >= frame->FirstVisibleCtrl )
+ Size = frame->FirstVisibleCtrl;
+ //If FirstVisibleCtrl is not equal to first control then move scrollbar till it reaches top
+ if(frame->FirstVisibleCtrl > 0)
+ {
+ frame->FirstVisibleCtrl = frame->FirstVisibleCtrl - Size;
+ frame->LastVisibleCtrl = frame->LastVisibleCtrl - Size;
+ }
+ break;
+
+ case FALSE:
+ //If the size of scroll to move exceeds the remaining control count then change the size value based on the remaining control count
+ if( Size >= (frame->ControlCount - frame->LastVisibleCtrl) )
+ Size = frame->ControlCount - frame->LastVisibleCtrl - 1;
+ //get the Index of the Last Non Supress Ctrl in the Frame
+ for ( i = 0; i < frame->ControlCount; i++ )
+ {
+
+ control = frame->ControlList[i];
+ if(control != NULL)
+ {
+ //Check conditional
+ u8ChkResult = CheckControlCondition(&(control->ControlData ));
+ if(COND_SUPPRESS != u8ChkResult )
+ IndexOfLastNonSupressctrl=i;
+ else
+ continue;
+ }
+ }
+ //If LastVisibleCtrl is not equal to last control then move scrollbar till it reaches bottom
+ if(frame->LastVisibleCtrl < frame->ControlCount-1 && IndexOfLastNonSupressctrl != frame->LastVisibleCtrl)
+ {
+ frame->FirstVisibleCtrl = frame->FirstVisibleCtrl + Size;
+ frame->LastVisibleCtrl = frame->LastVisibleCtrl + Size;
+ }
+ break;
+ }
+ return EFI_SUCCESS;
+}
+//EIP-67049 End
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/frame.h b/EDK/MiniSetup/TseLite/frame.h
new file mode 100644
index 0000000..a33e4e9
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/frame.h
@@ -0,0 +1,221 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/frame.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 7 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/frame.h $
+//
+// 7 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: frame.h
+//
+// Description: Header file for Frame control related functions
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _FRAME_H_
+#define _FRAME_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "object.h"
+#include "action.h"
+#include "control.h"
+
+#include "submenu.h"
+#include "menu.h"
+#include "text.h"
+
+#define MAIN_FRAME 0
+#define TITLE_FRAME (MAIN_FRAME + 1)
+#define HELP_FRAME (TITLE_FRAME + 1)
+#define NAV_FRAME (HELP_FRAME + 1)
+#define SUBTITLE_FRAME (NAV_FRAME + 1)
+#define HELPTITLE_FRAME (SUBTITLE_FRAME + 1)
+#define MAINTITLE_FRAME (HELPTITLE_FRAME + 1)
+#define SCROLLBAR_FRAME (MAINTITLE_FRAME + 1)
+
+typedef struct _FRAME_INFO
+{
+ UINT32 FrameType;
+ BOOLEAN Drawable;
+ BOOLEAN Border;
+ CHAR16 BorderType;
+ UINT8 Width;
+ UINT8 Height;
+ UINT8 Top;
+ UINT8 Left;
+ UINT8 FGColor;
+ UINT8 BGColor;
+ UINT8 ScrlFGColor;
+ UINT8 ScrlBGColor;
+ UINT8 ScrlUpFGColor;
+ UINT8 ScrlUpBGColor;
+ UINT8 ScrlDnFGColor;
+ UINT8 ScrlDnBGColor;
+
+}
+FRAME_INFO;
+
+typedef struct _AMITSE_CONTROL_MAP
+{
+ UINT16 ControlType;
+ CONTROL_METHODS *ControlMethods;
+ BOOLEAN CallbackSuppored;
+ VOID *CallbackFunction;
+ VOID *CallbackContext;
+}AMITSE_CONTROL_MAP;
+
+typedef struct _POSITION_INFO
+{
+ UINT16 Top;
+ UINT16 Left;
+}
+POSITION_INFO;
+
+#define FRAME_NONE_FOCUSED 0xFFFFFFFF
+
+#define FRAME_MEMBER_VARIABLES \
+ FRAME_INFO FrameData; \
+ UINT32 PageID; \
+ UINT32 ControlCount; \
+ UINT32 NullCount; \
+ UINT32 CurrentControl; \
+ CONTROL_DATA **ControlList; \
+ CHAR16 *BlankLine; \
+ BOOLEAN UseScrollbar; \
+ UINT32 FirstVisibleCtrl; \
+ UINT32 LastVisibleCtrl; \
+ POSITION_INFO *OrigPosition; \
+ POSITION_INFO *CurrPosition;
+
+typedef struct _FRAME_METHODS FRAME_METHODS;
+
+typedef struct _FRAME_DATA
+{
+ FRAME_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ FRAME_MEMBER_VARIABLES
+
+}
+FRAME_DATA;
+
+typedef EFI_STATUS (*FRAME_METHOD_ADD_CONTROL) ( VOID *object, VOID *data );
+
+
+#define FRAME_METHOD_FUNCTIONS \
+ FRAME_METHOD_ADD_CONTROL AddControl;
+
+struct _FRAME_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ FRAME_METHOD_FUNCTIONS
+};
+
+extern FRAME_METHODS gFrame;
+extern AMITSE_CONTROL_MAP gTseControlMap[];
+// Object Methods
+EFI_STATUS FrameCreate( VOID **object );
+EFI_STATUS FrameDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS FrameInitialize( VOID *object, VOID *data );
+EFI_STATUS FrameDraw( VOID *object );
+EFI_STATUS FrameHandleAction( VOID *object, ACTION_DATA *data );
+EFI_STATUS FrameSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Frame Methods
+EFI_STATUS FrameAddControl( VOID *object, VOID *data );
+
+
+VOID _FrameSubmenuCallback( FRAME_DATA *frame, SUBMENU_DATA *submenu, VOID *cookie );
+VOID _FrameVariableCallback( FRAME_DATA *frame, CONTROL_DATA *control, VOID *cookie );
+VOID _FramePasswordCallback( FRAME_DATA *frame, CONTROL_DATA *control, VOID *cookie );
+BOOLEAN _FrameSetControlFocus( FRAME_DATA *frame, UINT32 index );
+EFI_STATUS _FrameAddControls( FRAME_DATA *frame, PAGE_INFO *data );
+EFI_STATUS _FrameAddTitle( FRAME_DATA *frame, UINT32 frameType, PAGE_INFO *data );
+
+#endif /* _FRAME_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/hotclick.c b/EDK/MiniSetup/TseLite/hotclick.c
new file mode 100644
index 0000000..f8dd6b6
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/hotclick.c
@@ -0,0 +1,230 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotclick.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 3 $
+//
+// $Date: 3/14/13 11:47a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotclick.c $
+//
+// 3 3/14/13 11:47a Premkumara
+// [TAG] EIP85745 & 109814
+// [Category] Improvement
+// [Description] Support for Modal Form Support as per UEFI 2.3.1
+// [Files] Parse.c, Page.c, Menu.c, Hotclick.c
+//
+// 2 10/18/12 6:03a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 2 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 6/29/11 5:01a Rajashakerg
+// Added to support Hot clicks
+//
+//
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: hotclick.c
+//
+// Description: This file contains code to handle hotclick operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+extern BOOLEAN IsPageModal(UINT32 PgIndex);
+
+HOTCLICK_METHODS gHotClick =
+{
+ HotClickCreate,
+ HotClickDestroy,
+ HotClickInitialize,
+ HotClickEmptyMethod,
+ HotClickHandleAction,
+ HotClickSetCallback
+};
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotClickCreate
+//
+// Description: Function create a HotClick, which uses the Object functions.
+//
+// Input: HOTCLICK_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotClickCreate( HOTCLICK_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(HOTCLICK_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gObject.Create( object );
+
+ if (EFI_ERROR(Status))
+ {
+ MemFreePointer( (VOID **)object );
+ return Status;
+ }
+
+ (*object)->Methods = &gHotClick;
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotClickDestroy
+//
+// Description: Function destroy a HotClick, which uses the Object functions.
+//
+// Input: HOTCLICK_DATA *hotkey, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotClickDestroy( HOTCLICK_DATA *hotclick, BOOLEAN freeMem )
+{
+
+ gObject.Destroy( hotclick, FALSE );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&hotclick );
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotClickInitialize
+//
+// Description: Function Initialize a Hotclick, which uses the Object functions.
+//
+// Input: HOTCLICK_DATA *hotkey, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotClickInitialize( HOTCLICK_DATA *hotclick, VOID *data )
+{
+ HOTCLICK_TEMPLATE *template = (HOTCLICK_TEMPLATE *)data;
+
+// MemCopy( &hotclick->HotClickData.MouseInfo, &(template->MouseInfo), sizeof(MOUSE_INFO) );
+ hotclick->HotClickData.Xo = template->Xo;
+ hotclick->HotClickData.Yo = template->Yo;
+ hotclick->HotClickData.Xn = template->Xn;
+ hotclick->HotClickData.Yn = template->Yn;
+
+ hotclick->BasePage = template->BasePage;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS HotClickEmptyMethod( HOTCLICK_DATA *hotclick )
+{
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotClickHandleAction
+//
+// Description: Function to handle the HotClick actions.
+//
+// Input: HOTCLICK_DATA *hotkey, ACTION_DATA *action
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotClickHandleAction( HOTCLICK_DATA *hotclick, ACTION_DATA *action )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ PAGE_DATA *page=NULL;
+
+ if ( action->Input.Type != ACTION_TYPE_MOUSE )
+ return Status;
+
+ page = gApp->PageList[gApp->CurrentPage];
+ if(!page)
+ return Status;
+
+ if(IsPageModal(page->PageData.PageID)){
+ return Status;
+ }
+ if (
+ ((action->Input.Data.MouseInfo.Left >= hotclick->HotClickData.Xo) && (action->Input.Data.MouseInfo.Left <= hotclick->HotClickData.Xn)) &&
+ ((action->Input.Data.MouseInfo.Top >= hotclick->HotClickData.Yo) && (action->Input.Data.MouseInfo.Top <= hotclick->HotClickData.Yn))
+ )
+ {
+ if ( hotclick->Callback )
+ hotclick->Callback( hotclick->Container, hotclick, hotclick->Cookie );
+
+ gAction.ClearAction( action );
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotClickSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: HOTCLICK_DATA *hotkey, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotClickSetCallback( HOTCLICK_DATA *hotclick, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gObject.SetCallback( hotclick, container, callback, cookie );
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/hotclick.h b/EDK/MiniSetup/TseLite/hotclick.h
new file mode 100644
index 0000000..988c353
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/hotclick.h
@@ -0,0 +1,120 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotclick.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 2 $
+//
+// $Date: 10/18/12 6:03a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotclick.h $
+//
+// 2 10/18/12 6:03a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 2 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 1 6/29/11 5:01a Rajashakerg
+// Added to support Hot clicks
+//
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: hotclick.h
+//
+// Description: Header file for hotclick code to handling
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _HOTCLICK_H_
+#define _HOTCLICK_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "object.h"
+#include "action.h"
+
+
+typedef struct _HOTCLICK_INFO
+{
+ UINT32 Xo, Yo, Xn, Yn;
+}
+HOTCLICK_INFO;
+
+#define HOTCLICK_MEMBER_VARIABLES \
+ HOTCLICK_INFO HotClickData; \
+ UINT32 BasePage;
+
+typedef struct _HOTCLICK_METHODS HOTCLICK_METHODS;
+
+typedef struct _HOTCLICK_DATA
+{
+ HOTCLICK_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ HOTCLICK_MEMBER_VARIABLES
+
+}
+HOTCLICK_DATA;
+
+#define HOTCLICK_METHOD_FUNCTIONS
+
+struct _HOTCLICK_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ HOTCLICK_METHOD_FUNCTIONS
+};
+
+extern HOTCLICK_METHODS gHotClick;
+
+// Object Methods
+EFI_STATUS HotClickCreate( VOID **object );
+EFI_STATUS HotClickDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS HotClickInitialize( VOID *object, VOID *data );
+EFI_STATUS HotClickEmptyMethod( VOID *object );
+EFI_STATUS HotClickHandleAction( VOID *object, ACTION_DATA *data );
+EFI_STATUS HotClickSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+#endif /* _HOTCLICK_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/hotkey.c b/EDK/MiniSetup/TseLite/hotkey.c
new file mode 100644
index 0000000..3d54674
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/hotkey.c
@@ -0,0 +1,237 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotkey.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 5 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotkey.c $
+//
+// 5 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 7 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 1/09/10 6:34a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:04p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: hotkey.c
+//
+// Description: This file contains code to handle hotkey operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+HOTKEY_METHODS gHotKey =
+{
+ HotKeyCreate,
+ HotKeyDestroy,
+ HotKeyInitialize,
+ HotKeyEmptyMethod,
+ HotKeyHandleAction,
+ HotKeySetCallback
+};
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotKeyCreate
+//
+// Description: Function create a Hotkey, which uses the Object functions.
+//
+// Input: HOTKEY_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotKeyCreate( HOTKEY_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(HOTKEY_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gObject.Create( object );
+
+ if (EFI_ERROR(Status))
+ {
+ MemFreePointer( (VOID **)object );
+ return Status;
+ }
+
+ (*object)->Methods = &gHotKey;
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotKeyDestroy
+//
+// Description: Function destroy a Hotkey, which uses the Object functions.
+//
+// Input: HOTKEY_DATA *hotkey, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotKeyDestroy( HOTKEY_DATA *hotkey, BOOLEAN freeMem )
+{
+
+ gObject.Destroy( hotkey, FALSE );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&hotkey );
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotKeyInitialize
+//
+// Description: Function Initialize a Hotkey, which uses the Object functions.
+//
+// Input: HOTKEY_DATA *hotkey, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotKeyInitialize( HOTKEY_DATA *hotkey, VOID *data )
+{
+ HOTKEY_TEMPLATE *template = (HOTKEY_TEMPLATE *)data;
+
+ MemCopy( &hotkey->HotKeyData.Key, &(template->Key), sizeof(EFI_INPUT_KEY) );
+
+ hotkey->HotKeyData.KeySftSte=template->KeySftSte;
+
+ hotkey->BasePage = template->BasePage;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS HotKeyEmptyMethod( HOTKEY_DATA *hotkey )
+{
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotKeyHandleAction
+//
+// Description: Function to handle the HotKey actions.
+//
+// Input: HOTKEY_DATA *hotkey, ACTION_DATA *action
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotKeyHandleAction( HOTKEY_DATA *hotkey, ACTION_DATA *action )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ if ( action->Input.Type != ACTION_TYPE_KEY )
+ return Status;
+
+ if ( (! EfiCompareMem( &action->Input.Data.AmiKey.Key, &hotkey->HotKeyData.Key, sizeof(EFI_INPUT_KEY) ) )
+ && ( TseCheckShiftState( (action->Input.Data.AmiKey), (hotkey->HotKeyData.KeySftSte) ) ) )
+ {
+ if ( hotkey->Callback )
+ hotkey->Callback( hotkey->Container, hotkey, hotkey->Cookie );
+
+ gAction.ClearAction( action );
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotKeySetCallback
+//
+// Description: Function to set callback.
+//
+// Input: HOTKEY_DATA *hotkey, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS HotKeySetCallback( HOTKEY_DATA *hotkey, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gObject.SetCallback( hotkey, container, callback, cookie );
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/hotkey.h b/EDK/MiniSetup/TseLite/hotkey.h
new file mode 100644
index 0000000..dc7aa64
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/hotkey.h
@@ -0,0 +1,157 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotkey.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 6 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/hotkey.h $
+//
+// 6 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 8 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: hotkey.h
+//
+// Description: Header file for hotkey code to handling
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _HOTKEY_H_
+#define _HOTKEY_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "object.h"
+#include "action.h"
+
+/*
+typedef struct _HOTKEY_TEMPLATE
+{
+ EFI_INPUT_KEY Key;
+ UINT32 KeySftSte;
+ OBJECT_CALLBACK Callback;
+ UINT32 BasePage;
+}
+HOTKEY_TEMPLATE;
+*/
+typedef struct _HOTKEY_INFO
+{
+ EFI_INPUT_KEY Key;
+ UINT32 KeySftSte;
+}
+HOTKEY_INFO;
+
+#define HOTKEY_MEMBER_VARIABLES \
+ HOTKEY_INFO HotKeyData; \
+ UINT32 BasePage;
+
+typedef struct _HOTKEY_METHODS HOTKEY_METHODS;
+
+typedef struct _HOTKEY_DATA
+{
+ HOTKEY_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ HOTKEY_MEMBER_VARIABLES
+
+}
+HOTKEY_DATA;
+
+#define HOTKEY_METHOD_FUNCTIONS
+
+struct _HOTKEY_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ HOTKEY_METHOD_FUNCTIONS
+};
+
+extern HOTKEY_METHODS gHotKey;
+
+// Object Methods
+EFI_STATUS HotKeyCreate( VOID **object );
+EFI_STATUS HotKeyDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS HotKeyInitialize( VOID *object, VOID *data );
+EFI_STATUS HotKeyEmptyMethod( VOID *object );
+EFI_STATUS HotKeyHandleAction( VOID *object, ACTION_DATA *data );
+EFI_STATUS HotKeySetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+#endif /* _HOTKEY_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/minisetupext.c b/EDK/MiniSetup/TseLite/minisetupext.c
new file mode 100644
index 0000000..90e8256
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/minisetupext.c
@@ -0,0 +1,2378 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/minisetupext.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 79 $
+//
+// $Date: 8/28/14 11:52a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/minisetupext.c $
+//
+// 79 8/28/14 11:52a Premkumara
+// [TAG] EIP174031
+// [Category] Improvement
+// [Description] Removed TODO comments and added proper comments in those
+// places
+// [Files] commonoem.c, commonhelper.c, special.c, submenu.c,
+// minisetupext.c, uefi21wapper.c and legacy.c
+//
+// 78 8/28/14 6:50a Premkumara
+// [TAG] EIP93340
+// [Category] Improvement
+// [Description] - Defaults can be given to string type controls using tag
+// "Default = STRING_TOKEN(STR_DEFAULT_STRING)".
+// - New token TSE_SUPPORT_DEFAULT_FOR_STRING_CONTROL is introduced for
+// this support.
+// - Enabling this TSE_SUPPORT_DEFAULT_FOR_STRING_CONTROL token will
+// display default string mention in setup.
+// - On loading optimal defaults also string will load default mentioned
+// in default value tag.
+// [Files] AMITSE.sdl, HiiString21.c, TseAdvanced.c, MiniSetupExt.c, Hii.c
+//
+// 77 5/03/14 3:14p Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 76 5/02/14 1:06p Premkumara
+// [TAG] EIP128526
+// [Category] Improvement
+// [Description] Disable ESC action in BBS popup menu
+// [Files] AMITSE.sdl, CommonHelper.c, TseLite/MinisetupExt.c
+//
+// 75 5/02/14 4:27a Arunsb
+// [TAG] EIP155965
+// [Category] Improvement
+// [Description] MessageBox, ListBox cannot be canceled by Mouse
+// Right-Click
+// Checked for gpoststatus. On clicking outside of the postmenu should not
+// close it.
+// [Files] MessageBox.c, ListBox.c and minisetupext.c
+//
+// 74 5/02/14 3:48a Arunsb
+// [TAG] EIP155965
+// [Category] Improvement
+// [Description] MessageBox, ListBox cannot be canceled by Mouse
+// Right-Click
+// [Files] MessageBox.c, ListBox.c and minisetupext.c
+//
+// 73 5/02/14 12:42a Arunsb
+// [TAG] EIP150526
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE hangs on disconnecting and connecting the RAID driver
+// [Root Cause] Process pack updated on processing the existing pack
+// update
+// [Solution] First we getting remove and new pack. On getting this TSE
+// starts processing the pack(ProcessPackNotification) but on processing
+// the pack itself we getting notification again for remove and add. So
+// again process pack happens inside notification
+// itself(IFRChangeNotifyFn), this processing should not happen inside
+// notification so enabled flag gEnableProcessPack in PageHandleAction.
+// [Files] hii.c, minisetupext.c and page.c
+//
+// 72 2/11/14 8:43p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 71 12/05/13 1:32a Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 70 12/03/13 1:23p Premkumara
+// [TAG] EIP128526
+// [Category] Improvement
+// [Description] Disable ESC action in BBS popup menu
+// [Files] AMITSE.sdl, CommonHelper.c, TseLite/MinisetupExt.c
+//
+// 69 11/01/13 1:45p Arunsb
+// [TAG] EIP136371, 141870
+// [Category] Bug Fix
+// [Severity:] Normal
+// [Symptom:] Menu ordering is not proper when entering into setup through
+// BBS popup menu
+// [Root Cause] Boot flow is not set to normal for after BBS popup, so in
+// root page ordering boot flow is not matched
+// [Solution] After existing from BBS popup menu boot flow set to
+// BOOT_FLOW_CONDITION_NORMAL
+// [Files] minisetupext.c
+//
+// 68 6/10/13 12:06p Premkumara
+// [Issue Faced] In DriverSample, REF setup get crashes after
+// selecting REF5 interactive control
+// [Root Cause] When gApp->CurrentPage is 0 gApp->PageList is
+// NULL
+// [Solution] Return NULL, when gApp->PageListis NULL
+// [Modified Files] Minisetupext.c
+//
+// 67 5/23/13 5:18a Premkumara
+// [TAG] EIP123432
+// [Category] Bug Fix
+// [Issue Faced] Take print screen for save & Exit msg box. OK
+// of msg box is consumed by Save & Exit msg box.
+// - Cursor is missing after taking print screen of popupedit box in
+// string control
+// - Printscreen support is not given for Filebrowser feature
+// [RootCause] - When msg box for Save&Exit is popped and printscreen
+// event is called and displaying msg box over Save&Exit. Then msgbox
+// handleaction for printscreen event will change the result value in
+// _CallbackMsgbox() function so it will break the while loop in
+// _CallbackGetValue() function so destroy the next msg box in
+// CallbackShowMessageBox() function.
+// - DrawCursor variable is not set to TRUE after printscreen event
+// [Solution] - Returning EFI_UNSUPPORTED for printscreen event handling
+// function for messgebox and change the result value to 0xff
+// - Support given for file browser feature
+// [Files] Callback.c, MessageBox.c, Minisetupext.c, PopupString.c,
+// AddBootOption.c
+// AmiTSEStr.uni, FakeToken.c, minisetupext.c
+//
+// 66 5/22/13 11:02a Premkumara
+// [TAG] EIP123432
+// [Category] Bug Fix
+// [Issue Faced] Take print screen for save & Exit msg box. OK
+// of msg box is consumed by Save & Exit msg box.
+// - Cursor is missing after taking print screen of popupedit box in
+// string control
+// - Printscreen support is not given for Filebrowser feature
+// [RootCause] - When msg box for Save&Exit is popped and printscreen
+// event is called and displaying msg box over Save&Exit. Then msgbox
+// handleaction for printscreen event will change the result value in
+// _CallbackMsgbox() function so it will break the while loop in
+// _CallbackGetValue() function so destroy the next msg box in
+// CallbackShowMessageBox() function.
+// - DrawCursor variable is not set to TRUE after printscreen event
+// [Solution] - Returning EFI_UNSUPPORTED for printscreen event handling
+// function for messgebox and change the result value to 0xff
+// - Support given for file browser feature
+// [Files] Callback.c, MessageBox.c, Minisetupext.c, PopupString.c,
+// AddBootOption.c
+// AmiTSEStr.uni, FakeToken.c
+//
+// 65 5/22/13 10:45a Arunsb
+// [TAG] EIP122907
+// [Category] Improvement
+// [Description] For getting name value offset preserving page number
+// then it will be easy to find handle of the hii which published name
+// value. Additional general checks added.
+//
+// 64 3/12/13 7:18a Rajashakerg
+// [TAG] EIP116559
+// [Category] Bug Fix
+// [RootCause] A predicable problem of the ShowPostMenu function on
+// minisetupext.c
+// [Solution] Invoked ProcessProceedToBootHook() function at appropriate
+// place.
+// [Files] minisetupext.c
+//
+// 63 11/19/12 11:38p Arunsb
+// Checked in the source properly
+//
+// 62 10/18/12 11:39a Rajashakerg
+// [TAG] EIP 97951
+// [Category] Bug Fix
+// [Severity] Critical
+// [Symptom] Creation of TSE which does not access NVRAM during recovery
+// [RootCause] TSE get Platform lang every time using VarGetNvramName
+// [Solution] Moved the code accessing PlatformLang to uefi2.1.
+// [Files] hiistring21.c, minisetupext.c, hiistring20.c
+//
+// 58 9/21/12 1:05p Premkumara
+// [TAG] EIP 93639
+// [Category] Improvement
+// [Description] PostMenu called from inside of PostMenu callback will
+// cause both menus to exit
+// [Files] minisetupext.c
+//
+// 57 9/21/12 12:56p Premkumara
+// [TAG] EIP 92891
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] DisplayPostMenu always forces the system to boot
+// [RootCause] TSE is booting even gPostStatus is not
+// TSE_POST_STATUS_IN_BBS_POPUP
+// [Solution] Handled only to boot when gPostStatus is
+// TSE_POST_STATUS_IN_BBS_POPUP
+// [Files] Minisetupext.c
+//
+// 56 9/21/12 3:43a Premkumara
+// [TAG] EIP 97951
+// [Category] Bug Fix
+// [Severity] Critical
+// [Symptom] Creation of TSE which does not access NVRAM during recovery
+// [RootCause] TSE get Platform lang every time using VarGetNvramName
+// [Solution] Created cache to store Platform lang intially and using
+// cached value instead of
+// reading from NVRAM (VarGetNvramName ).
+// [Files] hiistring21.c, minisetupext.c
+//
+// 55 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 53 8/29/12 4:25p Arunsb
+// [TAG] EIP94702
+// [Description] Support for Native Resolution in POST/BOOT
+// [Files] amitse.sdl, commonhelper.c, commonoem.c, boot.c, logo.c,
+// notify.c, postmgmt.c, tselite\minisetupext.c, ezport/stylecommon.c,
+// ezportplus/stylecommon.c andlegacy/stylecommon.c
+//
+// 52 5/29/12 5:32a Premkumara
+// Replaced MouseDestroy() with MouseStop() since mouse destroy is
+// destroying mouse pointer
+//
+// 51 5/29/12 4:39a Arunsb
+// [TAG] EIP91109
+// [Category] Improvement
+// [Description] Sync the Aptio IV source for AptioV
+//
+// 50 5/25/12 1:14a Arunsb
+// [TAG] EIP83105
+// [Category] Improvement
+// [Description] Inconsistency checked only for valid pages
+// [Files] minisetupext.c
+//
+// 49 5/24/12 1:28p Arunsb
+// Hooking MainSetupLoop for special case leads to not setting the
+// gPostStatus properly.
+// So gPostStatus is again set to TSE_POST_STATUS_ENTERING_TSE in
+// mainsetuploop.
+//
+// 48 5/17/12 12:58a Arunsb
+// [TAG] EIP90149
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] TSE 1224 never executes callbacks with
+// EFI_BROWSER_ACTION_FORM_CLOSE when reset is required
+// [RootCause] EFI_BROWSER_ACTION_FORM_CLOSE not invoked when reset is
+// required
+// [Solution] EFI_BROWSER_ACTION_FORM_CLOSE action invoked for reset
+// also
+// [Files] minisetupext.c
+//
+// 47 4/27/12 5:31a Rajashakerg
+// [TAG] EIP88435
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Touch does not have functionality at POST
+// [RootCause] Mouse is initialized after getting notification from
+// mousedriver. So mouse avaliable at post and if we click at post, then
+// the button status is not consumed by any other application and mouse
+// pointer stuck at post
+// [Solution] Provided the changes to init the mouse at setup in the
+// absence of softkbd.
+// [Files] notify.c, minisetupext.c
+//
+// 46 4/25/12 6:07a Rajashakerg
+// [TAG] EIP86827
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] "gBootFlow" variable should be changed to
+// BOOT_FLOW_CONDITION_NORMAL if we press ESC key from pop-pup menu
+// [RootCause] ProcessProceedToBootHook() is not invoked when we press
+// ESC key in the BBS popup Menu.
+// [Solution] Fixed the issue by calling ProcessProceedToBootHook() when
+// we press ESC key in the BBS popup Menu.
+// [Files] BootOlny/minisetupext.c, TseLite/minisetupext.c.
+//
+// 45 4/04/12 12:25a Rajashakerg
+// [TAG] EIP86253
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Mouse and SoftKbd does not work after displaying "No option
+// to boot to" in POST
+// [RootCause] Mouse timer cleared once after displaying the "No option
+// to boot to" in POST
+// [Solution] Mouse timer cleared only when its going to boot.
+// [Files] CommonHelper.c, commonoem.c, minisetupext.c, protocol.c
+//
+// 44 4/03/12 3:11a Premkumara
+// [TAG] EIP84150
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] All the timers for mouse drivers before exiting from setup
+// is not stopped
+// [RootCause] MouseDestroy() is not called StopPointingDevice()
+// function to stop Mouse device
+// [Solution] StopPointingDevice() function is called in MouseDestroy()
+// function
+// [Files] Mouse.c, Protocol.c, Ezport/StyleCommon.c,
+// EzportPlus/StyleCommon.c, Legacy/StyleCommon.c, Minisetupext.c
+//
+// 43 12/08/11 12:51p Rajashakerg
+// [TAG] EIP63190
+// [Category] New Feature
+// [Description] Security operations in BootOnly module instead of
+// TSELite. GetAMITSEVariableLocal moved to tselite.
+//
+// 42 12/08/11 5:17a Arunsb
+// EIP63190 => Moving password support from TSELite to BootOnly. QuietBoot
+// is defaultly enabled in BootOnly so moving CheckEnableQuietBoot
+// function to TSELite to avoid the conflict.
+//
+// 41 12/05/11 5:36a Rajashakerg
+// [TAG] EIP76381
+// [Category] Improvement
+// [Description] Performance: Improving variable data load and usage
+// [Files] callback.c, minisetupext.c, variable.c, variable.h,
+// minisetup.h, Hii.c, FormBrowser2.c
+//
+// 40 12/02/11 6:01a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Mouse is Initialized when mouse is notified so
+// refreshing the mouse.
+//
+// 39 11/30/11 6:40a Premkumara
+// [TAG] EIP71351
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Setup Crash when iSCSI is loaded
+// [RootCause] Aptio giving length as 0xe(matches size of
+// EFI_IFR_ONE_OF_OPTION) but in latest EDKII driver it is 0x1c.
+// [Solution] change the length as j += ((EFI_IFR_OP_HEADER*)(buff + i +
+// j))->Length;
+// [Files] Parse.c, Hii.c, Variable.c, Minisetupext.c
+//
+// 38 11/28/11 1:56a Premkumara
+// [TAG] EIP75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] UefiWapper.c, Hii.c, Expression.c, CtrlCond.c, PopupSel.c,
+// Minisetupext.c, Menu.c, Date.c, Ezport\Stylecommon.c,
+// EzportPlus\StyleCommon.c,
+//
+// 37 11/20/11 7:54a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 36 11/11/11 2:15a Arunsb
+// [TAG] EIP64387
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] In serial redirection set to 9600bps, the BBS Popup menu
+// goes away as soon as it appears.
+// [RootCause] MapControlKeysHook() is called on an action even if
+// gListBox.HandleAction() returns an error or a non-keyboard action.
+// [Solution] MapControlKeysHook() is called only if
+// gListBox.HandleAction() returns success and for keyboard action.
+// [Files] minisetupext.c
+//
+// 35 11/10/11 11:32a Arunsb
+// [TAG] EIP75028
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Pressing esc from main menu is not poping the exit msgbox
+// [RootCause] Navigation stack
+// [Solution] Navigation stack reordered
+// [Files] minisetupext.c
+//
+// 34 10/31/11 9:38a Rajashakerg
+// [TAG] EIP71120, 71512
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] BIOS gets stuck in infinite loop On enabling
+// TSE_LOAD_OPTION_HIDDEN token,In first boot incorrect devices is
+// disabled in Setup & BBS table but in second boot the correct device is
+// disabled in both places.
+// [Solution] Hidden option handled properly.
+// [Files] TseLite\variable.c, TseLite\minisetupext.c, TseAdvanced.c,
+// special.c, BootOnly\minisetup.h,BootOnly\boot.c, BootOnly\bbs.c
+//
+// 33 6/23/11 3:56p Rajashakerg
+// [TAG] EIP55762, 58925, 59971
+// [Category] New Feature
+// [Description] Support REF2,REF3 and REF4 in AMITSE
+// Support direct form navigation path
+// Improper layout of controls in the root page when Dynamic pages are
+// added using the Legacy Setup Style
+//
+// [Files] setupdata.h, CommonHelper.c, AMITSE.sdl, Legacy\Legacy.c,
+// Legacy\style.h, Legacy\style.h, frame.c, minisetupext.c,
+// minisetupext.h, numeric.c, page.c Popupstring.c, Hii.c,
+// Uefi21Wrapper.c, Parse.c Hii.c
+//
+// 32 6/20/11 10:35a Arunsb
+// [TAG] EIP54861
+// [Category] Improvement
+// [Description] Updating string token value dynamically for Title Bar
+// and Copyright messages.
+// [Files] minisetup.c and tselite\minisetupext.c
+//
+// 31 6/15/11 5:18p Arunsb
+// [TAG] EIP62185
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] The Main Page cannot hide when press F2 to enter setup
+// [RootCause] If pagevisible set to TRUE then it is not checked for not
+// showing it
+// [Solution] Pagevisible = TRUE is checked for not showing the page.
+// The next parent page will be shown instead of it.
+// [Files] minisetupext.c
+//
+// 30 5/17/11 6:37p Arunsb
+// StyleExit function added in DrawBbsPopupMenu function to clear the
+// screen after bbs popup menu vanishes.
+//
+// 29 3/28/11 9:25p Madhans
+// [TAG] EIP41744
+// [Category] Improvement
+// [Description] SoftKeyBoard Support in TSE. and Support to Work with
+// new mouse driver(Label 07).
+// [Files] HookAnchor.h
+// AMITSE.sdl
+// CommonHelper.c
+// commonoem.c
+// commonoem.h
+// HookList.c
+// HookAnchor.c
+// Mouse.c
+// minisetupext.c
+// postmgmtext.c
+// minisetupext.h
+// PopupPassword.c
+// PopupString.c
+// TseLiteCommon.c
+//
+// 28 3/21/11 12:34a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 27 3/15/11 5:16a Rajashakerg
+// [TAG] EIP51671
+// [Category] New Feature
+// [Description] Boot overide menu devices are not disable
+// [Files] boot.c, minisetup.h, special.c, minisetupext.c, AMITSE.sdl,
+// boot.h, CommonHelper.c
+//
+// 26 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 25 2/24/11 1:09p Blaines
+// [TAG] - EIP 54517
+// [Category]- Enhancement
+// [Symptom]- When navigating through a postmenu and hitting a seperator
+// item, the menu will exit. Processing of Post Menu Changes is done after
+// the decision to quit the post menu has been made.
+// [Solution] - Check for selected non-focus item immediately after
+// updating menu. Process Post Menu Change in the callback function.
+// [File] - Minisetupext.c
+//
+// 24 2/16/11 12:45p Blaines
+// [TAG] - EIP 52897
+// [Category]- Defect
+// [Symptom]- PostMenu exit from callback item is not correctly exiting
+// the PostMenu loop..
+// [Solution]- In ShowPostMenu, make sure pSelection is updated before
+// callback is handled, and check for menu change due to hotkey.
+// In _PostMenuCallback, allways check menu item callback for NULL to exit
+// properly.
+// [Files] - minisetupext.c,
+//
+// 23 2/10/11 12:32p Blaines
+// [TAG] - EIP 53146
+// [Category]- New Feature
+// [Description] -Add the support to Move the Dynamic IFR Pages under
+// subpages. It should be customizable to move around.
+//
+// 22 2/07/11 7:23a Mallikarjunanv
+// [TAG] EIP51627
+// [Category] New Feature
+// [Description] Provide Mouse support to select file system device
+// entries during "Add boot option" in File browser support.
+// [Files] Minisetupext.c
+//
+// 21 1/24/11 1:10p Blaines
+// [TAG] - EIP 51425
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- "Esc" key and "Enter" key have same effect at BBS popup
+// menu..
+// [Solution] - Check for ABORT status and set default boot index.
+// [Function] - DrawBbsPopupMenu
+// [File] - minisetupext.c.
+//
+// 20 1/20/11 11:50a Blaines
+// [TAG] - EIP 52427
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- Possible memory leak when updating PostMenu title.
+// [Solution] - Check title and free memory before updating title string.
+// [Function] - ShowPostMenu
+//
+// 19 12/25/10 3:47a Mallikarjunanv
+// [TAG] EIP 47939
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Displaying blue screen for a moment and displaying BIOS
+// setup
+// [RootCause] Clear screen is done before style initialzation .
+// [Solution] Style initialization is before screen clear.
+// [Files] Minisetupext.c
+//
+// 18 12/02/10 2:55p Madhans
+// [TAG] - EIP 48169
+// [Category]- Enhancement
+// [Severity]- Mordarate
+// [Symptom]- Then Dynamic page is updated the page cache is updated with
+// defaults. User change is lost.
+// [Rootcause] - UICallback is updated all the contols with default value
+// when page dynamicalled updated.
+// [Solution]- Take care to update the variable cache only to newly added
+// variables.
+// [Files] - tselite\minisetupext.c
+//
+// 17 11/18/10 7:24p Blaines
+// [TAG] - EIP 45374
+// [Category]- Function Request
+// [Synopsis]- Need method to configure Post Menu programmatically, Items
+// requested
+// - Exit Keys
+// - Font Colors
+// - Background Colors.
+// [Solution]
+// - Create hook to set window color,
+// - Add AMI_POSTMENU_ATTRIB_EXIT_KEY attribute to POSTMENU_TEMPLATE to
+// configure exit keys.
+// [Files] - stylecommon.c, style.h, listbox.c, minisetupext.c,
+// AMIPostMgr.h
+//
+//
+// [TAG] - EIP 48417
+// [Category]- Defect
+// [Symptom]- PostManagerDisplayMenu does not dynamically update Menu
+// Title on language change.
+//
+// [Solution]- Update listbox title string by calling HiiGetString
+// whenever a selection is made. redraws.
+// [Files] - listbox.c, minisetupext.c,
+//
+//
+//
+// 16 11/01/10 12:07p Blaines
+// Fix issue in DrawBbsPopupMenu which caused system hang when boot menu
+// ItemCount is zero.
+//
+// 15 10/05/10 12:19p Mallikarjunanv
+// EIP_38553 - corrected the name of the hook function
+// PreSystemResetHookHook
+//
+// 14 9/29/10 1:27p Blaines
+// Function ShowPostMenu was updated to do better error checking, and to
+// return the correct index into the post menu when an item is selected.
+// Since hidden items are moved to the end, ShowPostMenu should return the
+// matching index of the caller's menu.
+//
+// 13 9/16/10 8:38p Madhans
+// Update for TSE 2.10. Refer Changelog.log for more details.
+//
+// 24 8/18/10 6:16p Mallikarjunanv
+// EIP-38089: Hook after pressing F2 key and before showing setup menu.
+//
+// 23 8/12/10 1:08p Blaines
+// EIP-41614 : Change to allow DisplayPostMenu protocol to dynamically
+// update menu items modified from the callback functions.
+//
+// 21 7/07/10 7:47p Madhans
+// To fix the Variables when new forms dynamically added.
+//
+// 20 6/17/10 2:46p Madhans
+//
+// 19 6/14/10 7:09p Madhans
+// Dynamic parsing support
+//
+// 18 6/08/10 5:23p Blaines
+// - Support PostManagerDisplayMenu of menu list with ALL non-focusable
+// items.
+//
+// - Return error status in PostManagerDisplayMenu on <esc> key press.
+//
+// 17 5/24/10 5:57p Blaines
+// Set the correct default selection in function ShowPostMenu, make sure
+// it is not hidden or non-focused.
+//
+// 16 3/30/10 4:59p Blaines
+// Use PostManagerDisplayMenu to display BBS Popup Menu.
+//
+// 15 3/26/10 6:13p Madhans
+// EIP 36704 : Fix for Making sure to make the Variable to NULL after it
+// is Freed up.
+//
+// 14 3/23/10 5:23p Blaines
+// BBS Popup modifications to support new listbox functionality.
+//
+// 13 2/19/10 8:19a Mallikarjunanv
+// updated year in copyright message
+//
+// 12 2/04/10 11:18p Madhans
+// SCAN_EFI reference removed.
+//
+// 11 1/09/10 7:07a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 10 12/04/09 7:12a Mallikarjunanv
+// Fix for EIP:30263 - Gif Logo Issue
+//
+// 9 10/28/09 5:38p Madhans
+//
+// 8 10/09/09 10:22a Mallikarjunanv
+// EIP:26409 - Added Hook function 'PreSystemResetHook' to update setup
+// before resetting the system
+//
+// 7 9/15/09 9:45a Sudhirv
+// added a flag to handle the FlushPause
+//
+// 6 8/19/09 12:56p Madhans
+// To call invalidkeyhook on BBS popup.
+//
+// 5 8/13/09 7:39a Mallikarjunanv
+// eip:24971 - supporting tse features without tse sources
+//
+// 4 6/24/09 6:11p Madhans
+// BBSpopup code should be there always and controlled by the TSE
+// binaries.
+// Fix in BBSpopup booting...
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 5 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 3/31/09 4:11p Madhans
+//
+// 3 2/05/09 5:19p Madhans
+// PostMgrStatus interface added.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: MINISETUP.C
+//
+// Description: This file contains code for entrypoint and setup loop
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+//Internal function definitions
+VOID MainSetupLoopInitHook(VOID);
+VOID InitGlobalPointers( VOID );
+UINT16 _BootSetBootNowCount(VOID);
+BOOLEAN IsSoftKbdSupported(VOID);
+CHAR16 *ReadPlatformLang( UINTN *Size );
+BOOLEAN IsDisableESCinBBSMenu (VOID);
+BOOLEAN SingleClickActivation (VOID); //EIP-139608
+extern BOOLEAN IsSupportDefaultForStringControl (VOID);
+POSTMENU_TEMPLATE *gPostMenuData = NULL ;
+
+UINT16 gPostMenuLevel = 0 ;
+UINT16 gDynamicParentPage=0;
+
+//EIP: 58925 Start
+//---------------------------------------------------------------------------
+// Variables
+//---------------------------------------------------------------------------
+BOOLEAN bSelectionChanged = FALSE;
+UINT32 gPageNavCount = 0;
+UINT32 gNavStartPage = 0;
+static UINT16 gDisplayPageId = 0; //PageId which is currently displaying
+
+#define MAX_NAVIGATION_DEPTH 20 //for breadcrumb trail
+//---------------------------------------------------------------------------
+// Type definitions
+//---------------------------------------------------------------------------
+typedef struct _NAV_PAGE_STACK{
+ VOID *PageHandle; //Varies, HII Handle to the formset that contains this control
+ UINT32 PageFormID; //Varies, Form ID within the formset for this page
+ VOID *ParentPageHandle; //Varies, HII Handle to the formset that contains Parent Page control
+ UINT32 PageParentFormID; //Varies, Pagent Form ID within the formset for this page
+} NAV_PAGE_STACK;
+
+NAV_PAGE_STACK *NavPageStack = (NAV_PAGE_STACK *)NULL;
+UINT32 NavPageStackSize = 0;
+EFI_STATUS GetParentFormID(UINT16 ChildID, UINT16 *ParentID, UINT32 *StackIndex);
+extern CHAR16 gPlatformLang [20]; //EIP97951
+
+//EIP: 58925 End
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MiniSetupEntry
+//
+// Description: This function prepares system so that setup can be
+// launched. Preparation mainly includes Setup data
+// fixup and variable details gathering.
+//
+// Input: VOID
+//
+// Output: Return Status based on errors that occurred in library
+// functions.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS MiniSetupEntry(VOID)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ AMITSESETUP *pSetupVariable = (AMITSESETUP *)NULL;
+ UINTN size = 0;
+
+ RUNTIME_DEBUG( L"nvram" );
+
+ // Update application data information to match that of HII
+ Status = HiiFixupData( );
+ if(EFI_ERROR(Status)){
+ goto DONE;//EIP 76381 : Reset to read the variable from NVRAM
+ }
+
+ UEFICallSetupFormCallBack(AMI_CALLBACK_FORM_OPEN);//EIP-53480: Calling the Wraper function with action AMI_CALLBACK_FORM_OPEN
+
+ Status = VarBuildDefaults();
+ if(EFI_ERROR(Status)){
+ goto DONE;//EIP 76381 : Reset to read the variable from NVRAM
+ }
+
+ Status = VarLoadVariables( (VOID **)&gVariableList, gOptimalDefaults );
+ if(EFI_ERROR(Status)){
+ goto DONE;//EIP 76381 : Reset to read the variable from NVRAM
+ }
+
+ //EIP-71351 Call Retrive callback after loading Current values to variable Cache.
+ UEFICallSetupFormCallBack(AMI_CALLBACK_RETRIEVE);//EIP-53480: Calling the Wraper function with action AMI_CALLBACK_RETRIEVE
+
+ if(!NoVarStoreSupport())
+ {
+ VarGetNvram( VARIABLE_ID_AMITSESETUP, &size );
+ if(size < sizeof(AMITSESETUP))
+ {
+ pSetupVariable = (AMITSESETUP *) EfiLibAllocateZeroPool(sizeof(AMITSESETUP));
+ if(gVariableList[VARIABLE_ID_AMITSESETUP].Buffer)
+ MemCopy( pSetupVariable, gVariableList[VARIABLE_ID_AMITSESETUP].Buffer, gVariableList[VARIABLE_ID_AMITSESETUP].Size );
+ VarSetNvram( VARIABLE_ID_AMITSESETUP, pSetupVariable, sizeof(AMITSESETUP));
+ VarUpdateDefaults(VARIABLE_ID_AMITSESETUP);
+ }
+ }
+
+ Status = EFI_SUCCESS;
+
+DONE:
+ CleanTempNvramVariableList();//EIP 76381 : Reset to read the variable from NVRAM
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: MainSetupLoop
+//
+// Description: This function runs the loop for setup execution. This
+// function is responsible for creating the application
+// hierarchy. It also gathers actions and passes them
+// thru application hierarchy and initiates draw
+// sequence.
+//
+// Input: VOID
+//
+// Output: Return Status based on errors that occurred in library
+// functions.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS MainSetupLoop( VOID )
+{
+ EFI_STATUS Status;
+ ACTION_DATA *action = NULL;
+ BOOLEAN refresh = TRUE;
+ UINT32 ii;
+ UINT32 page,previouspage=1;
+ PAGE_DATA *thisPage;
+ UINT32 SaveStateVarNum;
+ UINT16 SaveState=SETUP_RESET_NOT_REQUIRED;
+ CHAR16 *Language = NULL;
+ UINTN Size = 0;
+
+ // Close the Image related events before loading the setup pages
+ gPostStatus = TSE_POST_STATUS_ENTERING_TSE; //Hooking MainSetupLoop for special case leads to not setting the gPostStatus properly
+ MouseStop (); //Stopping before clearing the screen
+ CleanUpLogo();
+ MouseRefresh (); //Refreshing after clearing the screen
+
+ gEnterSetup = FALSE;
+ MainSetupLoopInitHook();
+// StopClickEvent();//EIP 86253 : Invoking the StopClickEvent function in the mainsetuploophook function
+ Status = MiniSetupEntry();
+ if ( EFI_ERROR( Status ) )
+ return MiniSetupExit( Status );
+
+ //EIP-38089: Hook after pressing F2 key and before showing setup menu.
+ ProcessUIInitHookHook();
+
+ Status = gApplication.Create( &gApp );
+ if ( EFI_ERROR( Status ) )
+ return MiniSetupExit( Status );
+
+#if APTIO_4_00
+ gMaxRows = MAX_ROWS;
+ gMaxCols = MAX_COLS;
+#endif
+// SetDesiredTextMode(); //EIP94702 - StyleInit will set the desired text mode
+ MemSet(gFlushBuffer, sizeof(SCREEN_BUFFER), 0);
+
+ //EIP:47939 - Style initialization before screen clear
+ StyleInit();
+ MouseStop (); //Stopping before clearing the screen
+ ClearScreen (STYLE_CLEAR_SCREEN_COLOR);
+ MouseRefresh (); //Refreshing after clearing the screen
+
+ RUNTIME_DEBUG( L"init" );
+ Status = gApplication.Initialize( gApp, gApplicationData );
+ if (EFI_ERROR(Status))
+ return MiniSetupExit( Status );
+
+ gMsgBoxAction = gApp->Action;
+
+ // add boot manager and language pages
+ StyleAddExtraPagesData();
+
+ //Let's create the SaveState Variable
+ if(VarGetVariableInfoId( SETUP_SAVE_STATE_INFO_KEY_ID, &SaveStateVarNum ))
+ VarSetValue(SaveStateVarNum,0,sizeof(UINT16),&SaveState);
+
+ action = gApp->Action;
+
+ if ( gApp->PageList == NULL )
+ gApp->Quit = TRUE;
+
+ gApp->CurrentPage = gStartPage;
+ if ( gStartPage == 0 )
+ StyleSelectFirstDisplayPage();
+// EIP62185: Not to show the pages with PageVisible = TRUE as root page
+ thisPage = gApp->PageList[gApp->CurrentPage];
+ // Check current page is workable.
+ if (thisPage->PageData.PageFlags.PageVisible == TRUE)
+ {
+ // Find first workable page.
+ for ( ii = 0; ii < gApp->PageCount; ii++ )
+ {
+ thisPage = gApp->PageList[ii];
+ if(thisPage == NULL)
+ continue;
+ if ((thisPage->PageData.PageID != 0) && (thisPage->PageData.PageParentID == 0))
+ {
+ if (thisPage->PageData.PageFlags.PageVisible != TRUE)
+ {
+ gApp->CurrentPage = ii;
+ break;
+ }
+ }
+ }
+ }
+// EIP62185
+ if ( gApp->PageList != NULL )//EIP-75384 Static code
+ {
+ if ( gApp->PageList[gApp->CurrentPage] == NULL )
+ {
+ for ( ii = 0; ii < gApp->PageCount; ii++ )
+ {
+ if ( gApp->PageList[ii] != NULL )
+ {
+ gApp->CurrentPage = ii;
+ break;
+ }
+ }
+ }
+ }
+
+ page = gApp->CurrentPage;
+
+ // Report the Status code DXE_SETUP_INPUT_WAIT
+ EfiLibReportStatusCode(EFI_PROGRESS_CODE, DXE_SETUP_INPUT_WAIT,0,NULL,NULL);
+ gPostStatus = TSE_POST_STATUS_IN_TSE;
+
+ if (IsLinkHistorySupport ()) //EIP75028 Pressing esc from Main menu which has sub menu is entering into sub menu instead of poping the exit msgbox
+ SetParentFormID (0, (UINT16)gApp->CurrentPage);
+
+ while ( ! gApp->Quit )
+ {
+ if ( page != gApp->CurrentPage )
+ {
+ if ( gApp->PageList[gApp->CurrentPage] == NULL )
+ gApp->CurrentPage = page;
+ else
+ {
+ if(((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[page]))->PageHandle != NULL) //EIP 83105 When the page is removed, don't check for inconsistency
+ {
+ if( CheckInconsistence((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[page])) )
+ {
+ //There is inconsistence so do not move from this page
+ gApp->CurrentPage = page;
+ }
+ else
+ {
+ page = gApp->CurrentPage;
+ }
+ }
+ else
+ {
+ page = gApp->CurrentPage;
+ }
+ }
+ }
+
+ thisPage = gApp->PageList[page];
+
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ gAction.ClearAction( action );
+
+ if ( gApp->CompleteRedraw )
+ refresh = TRUE ; //EIP101564: Do refresh in case Refresh Id Group requires redraw
+
+ if ( refresh )
+ {
+ //EIP97951-Start
+ if (NULL != Language)
+ {
+ MemFreePointer ((VOID **)&Language);
+ }
+ Size = 0;
+// Language = VarGetNvramName (L"PlatformLang", &gEfiGlobalVariableGuid, NULL, &Size);
+ Language = ReadPlatformLang(&Size);
+ if (NULL != Language)//EIP-75351 Suppress the warnings from static code analyzer
+ {
+ EfiZeroMem (gPlatformLang, sizeof (gPlatformLang));
+ EfiCopyMem (gPlatformLang, Language, Size);
+ }
+ //EIP97951-End
+ if(page == previouspage)
+ MouseFreeze();
+ else
+ MouseStop();
+
+ if ( gApp->ClearScreen )
+ {
+ gApp->CompleteRedraw = TRUE;
+ MemSet(gFlushBuffer, sizeof(SCREEN_BUFFER), 0);
+ ClearScreen( STYLE_CLEAR_SCREEN_COLOR );
+ gApp->ClearScreen = FALSE;
+ }
+
+ if ( gApp->CompleteRedraw )
+ {
+ StyleDrawPageBorder( page );
+ SpecialUpdatePageControls( page );
+ gPage.Draw( thisPage );
+ gApp->CompleteRedraw = FALSE;
+ }else
+ gPage.Draw( thisPage );
+ DoRealFlushLines();
+
+ previouspage = page;
+ MouseRefresh();
+
+ refresh = FALSE;
+ }
+
+ if ( gAction.GetAction( action ) != EFI_SUCCESS )
+ continue;
+
+ if ( gPage.HandleAction( thisPage, action ) != EFI_SUCCESS )
+ {
+ if ( action->Input.Type == ACTION_TYPE_KEY )
+ {
+ if ( (ControlActionAbort != MapControlKeysHook(action->Input.Data.AmiKey)) && ( thisPage->PageData.PageFlags.PageDisableHotKeys ) )
+ {
+ gAction.ClearAction( action );
+ continue;
+ }
+ }
+
+ if ( gApplication.HandleAction( gApp, action ) == EFI_SUCCESS )
+ {
+ refresh = TRUE;
+ }
+ else if ( action->Input.Type == ACTION_TYPE_KEY )
+ {
+ InvalidActionHookHook();
+ }
+ }
+ else
+ refresh = TRUE;
+
+ }
+ StyleExit();
+
+// MouseDestroy(); //EIP-84150
+
+ if ( gResetRequired ) {
+ MiniSetupExit (Status); //EIP90149; Invoking EFI_BROWSER_ACTION_FORM_CLOSE on reset also
+ ///EIP:26409 - Hook function to update setup before resetting the system
+ PreSystemResetHookHook();
+ gRT->ResetSystem( EfiResetCold, EFI_SUCCESS, 0, NULL );
+ }
+//EIP: 58925 Start
+ if(IsLinkHistorySupport())
+ {
+ ResetNavStack();
+ }
+//EIP: 58925 End
+ return MiniSetupExit( Status );
+}
+
+extern int gNumOfDev ;
+extern UINT16 gBBSPopupSel ;
+UINT16 gQuitBBSLoop=0;
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DrawBbsPopupMenu
+//
+// Description: function for the BBS Popup menu
+//
+// Input: void
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+extern UINT32 gBootFlow;
+EFI_STATUS DrawBbsPopupMenu( VOID )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT16 i=0, ItemCount=0, u16BootCount = (UINT16)gNumOfDev ;
+ CHAR16 *BootStr;
+ POSTMENU_TEMPLATE *BootMenu = NULL;
+ UINT16 Title, Legend, sel = 0 ;
+ EFI_GUID AmiPostManagerProtocolGuid = AMI_POST_MANAGER_PROTOCOL_GUID;
+ AMI_POST_MANAGER_PROTOCOL *pAmiPostMgr = NULL;
+
+ Status = gBS->LocateProtocol( (EFI_GUID *)&AmiPostManagerProtocolGuid,
+ (void*)NULL,
+ (void**)&pAmiPostMgr );
+
+ if(Status != EFI_SUCCESS)
+ return Status;
+// SetDesiredTextMode(); //EIP94702 - StyleInit will set the desired text mode
+ ClearScreen( EFI_BACKGROUND_BLACK | EFI_LIGHTGRAY );
+ StyleInit();
+
+ ItemCount = u16BootCount;
+
+#if POPUP_MENU_ENTER_SETUP
+ ItemCount++;
+#endif
+ BootMenu = EfiLibAllocateZeroPool( sizeof( POSTMENU_TEMPLATE ) * ItemCount);
+
+ for ( i = 0; i < u16BootCount; i++ )
+ {
+///EIP - 24971
+ BootStr = BootGetBootNowName(i, gPopupMenuShowAllBbsDev, BootNowInBootOrderSupport());
+///EIP - 24971
+ // EIP:51671 Start
+ //Depending on the value of the token hide of the disabled boot options is done
+ if((gPopupMenuHideDisableBootOptions && IsBootDeviceEnabled(i,gPopupMenuShowAllBbsDev,BootNowInBootOrderSupport(),0))||
+ (gLoadOptionHidden &&(NULL == BootStr)))
+ {
+
+
+ BootMenu[i].ItemToken = 1;
+ BootMenu[i].Callback = (VOID*)NULL ;
+ BootMenu[i].CallbackContext = (VOID*)NULL;
+ continue;
+ }
+
+ BootMenu[i].ItemToken = HiiAddString( gHiiHandle, BootStr );
+ BootMenu[i].Callback = (VOID*)NULL ;
+ BootMenu[i].CallbackContext = (VOID*)NULL ;
+ BootMenu[i].Attribute = AMI_POSTMENU_ATTRIB_FOCUS;
+ BootMenu[i].Key.Key.ScanCode = 0 ;
+ BootMenu[i].Key.Key.UnicodeChar = 0 ;
+ BootMenu[i].Key.KeyShiftState = 0 ;
+ }
+
+#if POPUP_MENU_ENTER_SETUP
+ BootMenu[u16BootCount].ItemToken = STRING_TOKEN(STR_POPUPMENU_ENTER_SETUP);
+ BootMenu[u16BootCount].Callback = (VOID*)NULL ;
+ BootMenu[u16BootCount].CallbackContext = (VOID*)NULL ;
+ BootMenu[u16BootCount].Attribute = AMI_POSTMENU_ATTRIB_FOCUS;
+ BootMenu[u16BootCount].Key.Key.ScanCode = 0 ;
+ BootMenu[u16BootCount].Key.Key.UnicodeChar = 0 ;
+ BootMenu[u16BootCount].Key.KeyShiftState = 0 ;
+#endif
+
+ Title = STRING_TOKEN(STR_BBS_POPUP_TITLE_STRING) ;
+ Legend = STRING_TOKEN(STR_BBS_POPUP_HELP_STRING) ;
+
+ gBBSPopupSel = 0 ;
+
+// EIP - 46314: Check ItemCount before displaying boot menu
+ if(ItemCount)
+ {
+
+ MouseRefresh();//Mouse is Initialized when mouse is notified so refreshing the mouse.
+ Status = pAmiPostMgr->DisplayPostMenu(gHiiHandle, Title, Legend, BootMenu, ItemCount, &sel);
+ MouseStop();
+
+ // EIP - 51425: Check ESC key before setting boot selection
+ if((Status == EFI_ABORTED)||(Status != EFI_SUCCESS))
+ {
+ if ( EFI_ABORTED == Status )
+ ProcessProceedToBootHook();//EIP 116559 : When ESC pressed in the BBS popup menu
+ gBBSPopupSel = 0 ;
+ goto DONE;
+ }
+
+#if POPUP_MENU_ENTER_SETUP
+ if(BootMenu[sel].ItemToken == STRING_TOKEN(STR_POPUPMENU_ENTER_SETUP))
+ {
+ gEnterSetup = TRUE;
+ }
+ else
+#endif
+ gBBSPopupSel = sel ;
+
+ }// EIP - 46314
+
+DONE:
+ gBootFlow = BOOT_FLOW_CONDITION_NORMAL; //EIP 136371, BBS popup flow also, should behave normally on entering into setup. Fixed for root page ordering
+ Status = pRS->SetVariable (L"BootFlow",
+ &_gBootFlowGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (gBootFlow),
+ &gBootFlow);
+ StyleExit (); //Added to clear the screen after bbs popup menu vanishes.
+ return Status;
+}
+
+
+
+
+
+#ifdef RUNTIME_DEBUG_SUPPORT
+BOOLEAN __RuntimeCheckDebugMode( CHAR16 *string )
+{
+ EFI_STATUS Status;
+ EFI_GUID env = ENVIRONMENT_VARIABLE_ID;
+
+ UINTN size = 0;
+ CHAR16 *buffer = NULL;
+ INTN result = 1;
+
+ Status = gRT->GetVariable(
+ L"debug",
+ &env,
+ NULL,
+ &size,
+ NULL);
+
+ if ( Status == EFI_BUFFER_TOO_SMALL )
+ {
+ buffer = EfiLibAllocateZeroPool( size );
+ if ( buffer != NULL )
+ {
+ Status = gRT->GetVariable(
+ L"debug",
+ &env,
+ NULL,
+ &size,
+ buffer);
+ }
+ }
+
+ if ( ! EFI_ERROR( Status ) )
+ result = EfiStrCmp( string, buffer );
+
+ MemFreePointer( (VOID **)&buffer );
+
+ return (BOOLEAN)( result == 0 );
+}
+#endif
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: InitGlobalPointers
+//
+// Description: function to Initialize all the global pointer declared.
+//
+// Input: void
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID InitGlobalPointers( VOID )
+{
+ UINT8 *data;
+
+ gSetupPkg = (SETUP_PKG *)gApplicationData;
+ data = (UINT8 *)gSetupPkg;
+
+ gScreen = (SCREEN_INFO *)(data + gSetupPkg->PackageScreen);
+ gToolPages = gPages = (PAGE_LIST *)(data + gSetupPkg->PackagePageList);
+ gToolControlInfo = (CONTROL_INFO *) (data + gSetupPkg->PackageControlOffset);
+ gToolVariables = gVariables = (VARIABLE_LIST *)(data + gSetupPkg->PackageVariableList);
+ gHpkInfo = (HPK_INFO *)(data + gSetupPkg->PackageHpkData);
+ gHpkInfoLength = gSetupPkg->PackageGuidList - gSetupPkg->PackageHpkData;
+ gGuidList = (GUID_LIST *)(data + gSetupPkg->PackageGuidList);
+ gToolPageIdList = gPageIdList = (PAGE_ID_LIST *) (data + gSetupPkg->PackagePageIdList);
+ gToolPageIdInfo = gPageIdInfo = (PAGE_ID_INFO *)(((UINT8 *) gToolPageIdList) + gToolPageIdList->PageIdList[0]);
+ InitgProgress();
+}
+
+
+
+EFI_STATUS _PostMenuUpdate( LISTBOX_DATA *ListBox)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 Index= 0, j=0 ;
+ LISTBOX_BSS_POPUP_DATA *listboxBBSPopupData=NULL;
+
+
+ listboxBBSPopupData = EfiLibAllocateZeroPool( sizeof( LISTBOX_BSS_POPUP_DATA ) );
+
+ if(listboxBBSPopupData==NULL)
+ return EFI_OUT_OF_RESOURCES;
+
+ listboxBBSPopupData->pControlData = NULL ;
+ listboxBBSPopupData->ItemCount = ListBox->ItemCount;
+ listboxBBSPopupData->PtrItems = EfiLibAllocateZeroPool( sizeof(POSTMENU_TEMPLATE)* listboxBBSPopupData->ItemCount);
+
+ if ( listboxBBSPopupData->PtrItems == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+
+ // MOVE the Hidden items to the end,
+ // First copy the printable list
+ for ( Index = 0,j=0; Index < listboxBBSPopupData->ItemCount; Index++ )
+ {
+ if( (gPostMenuData[Index].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN)&&
+ (gPostMenuData[Index].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY))
+ {
+ listboxBBSPopupData->PtrItems[j] = gPostMenuData[Index] ;
+ j++;
+ }
+ }
+
+ listboxBBSPopupData->HiddenItemCount = Index - j;
+ // copy the hidden list
+ for ( Index = 0; Index < listboxBBSPopupData->ItemCount; Index++ )
+ {
+ if( (gPostMenuData[Index].Attribute == AMI_POSTMENU_ATTRIB_HIDDEN)||
+ (gPostMenuData[Index].Attribute == AMI_POSTMENU_ATTRIB_EXIT_KEY))
+ {
+ listboxBBSPopupData->PtrItems[j] = gPostMenuData[Index] ;
+ j++;
+ }
+ }
+
+ MemFreePointer((VOID **)&ListBox->PtrTokens);
+ MemFreePointer((VOID **)&ListBox->PtrItems);
+ //RestoreScreen( ListBox->ScreenBuf );
+
+ ListBox->Width = 0 ;
+ ListBox->Height = 0 ;
+
+ Status = gListBox.InitializeBBSPopup( ListBox, listboxBBSPopupData );
+
+ // Free allocated init data
+ MemFreePointer((VOID**)&listboxBBSPopupData->PtrItems);
+ MemFreePointer((VOID**)&listboxBBSPopupData);
+
+ MemCopy( gActiveBuffer, ListBox->ScreenBuf, sizeof(SCREEN_BUFFER) );
+
+
+ return Status ;
+}
+
+EFI_STATUS _PostMenuItemChange( POSTMENU_TEMPLATE MenuItem, UINT16 Count )
+{
+ EFI_STATUS Status = EFI_SUCCESS ;
+ UINT16 Index= 0 ;
+
+ for ( Index = 0; Index < Count; Index++ )
+ {
+ if(gPostMenuData[Index].ItemToken == MenuItem.ItemToken)
+ {
+ if(gPostMenuData[Index].Attribute != MenuItem.Attribute)
+ break;
+
+ if(gPostMenuData[Index].Callback != MenuItem.Callback)
+ break;
+
+ if(gPostMenuData[Index].Key.Key.ScanCode != MenuItem.Key.Key.ScanCode)
+ break;
+
+ if(gPostMenuData[Index].Key.Key.UnicodeChar != MenuItem.Key.Key.UnicodeChar)
+ break;
+
+ if(gPostMenuData[Index].Key.KeyShiftState != MenuItem.Key.KeyShiftState)
+ break;
+
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ return Status ;
+}
+
+EFI_STATUS _PostMenuChange( LISTBOX_DATA *PopupMenu)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 Index= 0 ;
+
+ for ( Index = 0; Index < PopupMenu->ItemCount; Index++ )
+ {
+ Status = _PostMenuItemChange(PopupMenu->PtrItems[Index], PopupMenu->ItemCount) ;
+
+ if(Status == EFI_SUCCESS)
+ return Status ;
+ }
+
+ return Status ;
+}
+
+VOID _ProcessPostMenuChange( LISTBOX_DATA *PopupMenu)
+{
+ ACTION_DATA *action=NULL;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 Sel = PopupMenu->Sel ;
+
+ //Check if Menu has been dynamically changed
+ if(_PostMenuChange(PopupMenu )== EFI_SUCCESS)
+ {
+ //Update and initialize with new menu data
+ //Note: PopupMenu->Sel will be initialized to zero
+ _PostMenuUpdate(PopupMenu);
+
+ if(PopupMenu->PtrItems[Sel].Attribute == AMI_POSTMENU_ATTRIB_NON_FOCUS)
+ {
+ // item has been changed to non-focus
+ PopupMenu->Sel = Sel;
+
+ //Create and Send Fake Action...<Down-Arrow> Key
+ Status = gAction.Create( &action );
+ if ( !EFI_ERROR( Status ) )
+ {
+ action->Input.Type = ACTION_TYPE_KEY ;
+ action->Input.Data.AmiKey.Key.ScanCode = SCAN_DOWN;
+ action->Input.Data.AmiKey.Key.UnicodeChar = CHAR_NULL ;
+ gListBox.HandleAction(PopupMenu, action);
+
+ gAction.Destroy( action, TRUE );
+ }
+ }
+ else if( (PopupMenu->PtrItems[Sel].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN)&&
+ (PopupMenu->PtrItems[Sel].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY))
+ {
+ PopupMenu->Sel = Sel;
+ }
+ //Exit if item callback has been changed to null
+ else if(PopupMenu->PtrItems[Sel].Callback == NULL)
+ {
+ PopupMenu->QuitPopupLoop = 1;
+ }
+ }
+}
+
+VOID _PostMenuCallback( LISTBOX_DATA *container, LISTBOX_DATA *PopupMenu, VOID *cookie )
+{
+ if ( cookie != NULL )
+ {
+ UINT16 Sel = *(UINT16 *) cookie;
+ POSTMENU_TEMPLATE *CurrentPostMenuData = NULL ;
+
+
+ if(PopupMenu->PtrItems[Sel].Callback != NULL)
+ {
+ CurrentPostMenuData = gPostMenuData; //EIP-93639
+ PopupMenu->PtrItems[Sel].Callback(PopupMenu->PtrItems[Sel].CallbackContext);
+ }
+
+ if( NULL != CurrentPostMenuData ) //EIP-93639
+ gPostMenuData = CurrentPostMenuData;
+ // EIP:54517
+ _ProcessPostMenuChange(PopupMenu);
+
+ //EIP:52897, Allways check for NULL to exit properly.
+ if(PopupMenu->PtrItems[Sel].Callback == NULL)
+ PopupMenu->QuitPopupLoop = 1;
+ }
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ShowPostMenu
+//
+// Description: Function to show menu
+//
+// Input: IN CHAR16 *Title, IN POSTMENU_TEMPLATE *MenuData, IN UINT32 menucount, OUT UINT16 *pSelection
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ShowPostMenu(
+ IN VOID *HiiHandle,
+ IN UINT16 TitleToken,
+ IN UINT16 LegendToken,
+ IN POSTMENU_TEMPLATE *MenuData,
+ IN UINT16 MenuCount,
+ OUT UINT16 *pSelection)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT16 Index= 0, j, i, EXIT_KEY_PRESENT=0;
+ CONTROL_INFO *newControlInfo=NULL;
+ LISTBOX_BSS_POPUP_DATA *listboxBBSPopupData=NULL;
+ LISTBOX_DATA *ListBoxCtrl=NULL;
+ ACTION_DATA *action=NULL;
+ UINT8 Color, sel = 0 ;
+ CONTROL_ACTION Action ;
+
+
+ // Error check the input pointers (HiiHandle is allowed to be NULL)
+ if(pSelection == NULL || MenuData == NULL) return EFI_INVALID_PARAMETER;
+
+ newControlInfo = EfiLibAllocateZeroPool( sizeof( CONTROL_INFO ) );
+
+ if(newControlInfo==NULL) return EFI_OUT_OF_RESOURCES;
+
+ newControlInfo->ControlHandle = (HiiHandle!=NULL)?HiiHandle:gHiiHandle;
+ newControlInfo->ControlFlags.ControlVisible = TRUE;
+
+ listboxBBSPopupData = EfiLibAllocateZeroPool( sizeof( LISTBOX_BSS_POPUP_DATA ) );
+
+ if(listboxBBSPopupData==NULL) return EFI_OUT_OF_RESOURCES;
+
+ listboxBBSPopupData->TitleToken = TitleToken;
+ listboxBBSPopupData->Help1Token = LegendToken;
+ listboxBBSPopupData->pControlData = newControlInfo;
+
+ Status = gAction.Create( &action );
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ listboxBBSPopupData->ItemCount = MenuCount;
+ listboxBBSPopupData->PtrItems = EfiLibAllocateZeroPool( sizeof(POSTMENU_TEMPLATE)* listboxBBSPopupData->ItemCount);
+
+ if ( listboxBBSPopupData->PtrItems == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ gPostMenuData = MenuData;
+
+ // MOVE the Hidden items to the end,
+ // First copy the printable list
+ for ( Index = 0,j=0; Index < listboxBBSPopupData->ItemCount; Index++ )
+ {
+ if( (MenuData[Index].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN)&&
+ (MenuData[Index].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY))
+ {
+ //EIP:51671 START
+ //Depending on the value of the token hide of the disabled boot options is done
+ if(gPopupMenuHideDisableBootOptions || gLoadOptionHidden)
+ {
+ if(MenuData[Index].ItemToken == 1)
+ {
+ MenuData[Index].Attribute = AMI_POSTMENU_ATTRIB_HIDDEN;
+ continue;
+ }
+ }
+ // EIP:51671 END
+ listboxBBSPopupData->PtrItems[j] = MenuData[Index] ;
+ j++;
+ }
+ }
+
+ listboxBBSPopupData->HiddenItemCount = Index - j;
+
+ // Then copy the hidden list
+ for ( Index = 0; Index < listboxBBSPopupData->ItemCount; Index++ )
+ {
+ if( (MenuData[Index].Attribute == AMI_POSTMENU_ATTRIB_HIDDEN)||
+ (MenuData[Index].Attribute == AMI_POSTMENU_ATTRIB_EXIT_KEY))
+ {
+ listboxBBSPopupData->PtrItems[j] = MenuData[Index] ;
+ j++;
+ }
+ }
+
+ // Create the list box item
+ if ( gListBox.Create( &ListBoxCtrl ) == EFI_SUCCESS )
+ {
+ Status = gListBox.InitializeBBSPopup( ListBoxCtrl, listboxBBSPopupData );
+ // Free allocated init data
+ MemFreePointer((VOID**)&newControlInfo);
+ MemFreePointer((VOID**)&listboxBBSPopupData->PtrItems);
+ MemFreePointer((VOID**)&listboxBBSPopupData);
+
+ if(Status == EFI_SUCCESS )
+ {
+ //Set default selection, make sure it is not hidden or non-focused
+ if( (ListBoxCtrl->PtrItems[*pSelection].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN)&&
+ (ListBoxCtrl->PtrItems[*pSelection].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY)&&
+ (ListBoxCtrl->PtrItems[*pSelection].Attribute != AMI_POSTMENU_ATTRIB_NON_FOCUS))
+ {
+ ListBoxCtrl->Sel = *pSelection;
+ }
+ else
+ {
+ //Find the next selectable item...
+ for ( Index = 0; Index < ListBoxCtrl->ItemCount; Index++ )
+ {
+ if( (ListBoxCtrl->PtrItems[Index].Attribute != AMI_POSTMENU_ATTRIB_HIDDEN)&&
+ (ListBoxCtrl->PtrItems[Index].Attribute != AMI_POSTMENU_ATTRIB_EXIT_KEY)&&
+ (ListBoxCtrl->PtrItems[Index].Attribute != AMI_POSTMENU_ATTRIB_NON_FOCUS))
+ {
+ ListBoxCtrl->Sel = Index;
+ break;
+ }
+ }
+
+ // if the entire menuy is hidden, get out
+ if(ListBoxCtrl->HiddenItemCount == ListBoxCtrl->ItemCount)
+ {
+ Status = EFI_UNSUPPORTED;
+ goto Done;
+ }
+
+ // If there are no selectable items, go out
+ if(Index == ListBoxCtrl->ItemCount)
+ {
+ //Status = EFI_INVALID_PARAMETER;
+ //goto Done;
+ }
+
+ }
+
+ gPostMenuLevel += 1 ;
+
+ Color = ListBoxCtrl->FGColor | ListBoxCtrl->BGColor ;
+ StyleGetWindowColor(&Color, gPostMenuLevel, TSE_WINDOW_TYPE_POSTMENU);
+ ListBoxCtrl->FGColor = (Color & 0x0F) ;
+ ListBoxCtrl->BGColor = (Color & 0xF0) ;
+
+
+ // Display everything to the internal screen buffer
+ ListBoxCtrl->QuitPopupLoop = 0 ;
+ gListBox.SetCallback(ListBoxCtrl, NULL, _PostMenuCallback, NULL);
+ gListBox.Draw( ListBoxCtrl );
+
+ MouseStop();
+ // Display everything to the screen
+ DoRealFlushLines();
+ MouseRefresh();//EIP:51627 -Provided the mouse support for Add boot option with File browser support
+
+
+ while(!ListBoxCtrl->QuitPopupLoop)
+ {
+ if ( action->Input.Type != ACTION_TYPE_NULL )
+ gAction.ClearAction( action );
+
+ gListBox.Draw( ListBoxCtrl );
+ MouseFreeze();
+ DoRealFlushLines();
+ MouseRefresh();
+
+ if ( gAction.GetAction( action ) != EFI_SUCCESS )
+ continue;
+
+ //EIP-123432 PrintScreen Support work only inside TSE not in post
+ if( (gPostStatus == TSE_POST_STATUS_IN_TSE) && ( action->Input.Type == ACTION_TYPE_KEY ) &&
+ (TsePrintScreenEventSupport(action->Input.Data.AmiKey.Key.ScanCode) ) )
+ {
+ gApplication.HandleAction( gApp, action );
+ continue;
+ }
+
+ //EIP:52897, Make sure pSelection is updated before callback is handled.
+ for(i=0; i < MenuCount; i++)
+ {
+ if( ListBoxCtrl->PtrItems[ListBoxCtrl->Sel].ItemToken == MenuData[i].ItemToken)
+ {
+ *pSelection = i;
+ break;
+ }
+ }
+
+ Status = gListBox.HandleAction( ListBoxCtrl, action );
+ if ( !EFI_ERROR (Status) )//EIP-123432
+ {
+ if (action->Input.Type == ACTION_TYPE_KEY)
+ Action = MapControlKeysHook (action->Input.Data.AmiKey);
+
+ else if( (gPostStatus == TSE_POST_STATUS_IN_TSE) && ( //If mouse is clicked outside menu inside setup
+ (action->Input.Data.MouseInfo.Top < (UINT32)(ListBoxCtrl->Top-2)) || //If clicked above menu title
+ (action->Input.Data.MouseInfo.Top >= (UINT32)(ListBoxCtrl->Top + ListBoxCtrl->Height)) || //if clicked below menu
+ (action->Input.Data.MouseInfo.Left < (UINT32)(ListBoxCtrl->Left)) || //if clicked left outside of menu
+ (action->Input.Data.MouseInfo.Left > (UINT32)(ListBoxCtrl->Left + ListBoxCtrl->Width)) //if clicked right outside of menu
+ ) &&( (SingleClickActivation() && (ControlActionSelect ==MapControlMouseActionHook(&action->Input.Data.MouseInfo))) || //If singleClickActivation is enabled
+ (ControlActionAbort == MapControlMouseActionHook(&action->Input.Data.MouseInfo)) || //If right clicked outside
+ (ControlActionChoose == MapControlMouseActionHook(&action->Input.Data.MouseInfo)) //EIP-139608 Closing postmenu when mouse action happens outside postmenu.
+ )
+ )
+ {
+ Action = ControlActionAbort;
+ }
+ }
+
+
+ //Menu may dynamically update, so init EXIT KEY flag here...
+ EXIT_KEY_PRESENT = 0 ;
+
+ //Since hidden items are moved to the end,
+ //we need to return the matching index of the caller's menu
+ for(i=0; i < MenuCount; i++)
+ {
+ if( ListBoxCtrl->PtrItems[ListBoxCtrl->Sel].ItemToken == MenuData[i].ItemToken)
+ *pSelection = i;
+
+ if(ListBoxCtrl->PtrItems[i].Attribute == AMI_POSTMENU_ATTRIB_EXIT_KEY)
+ {
+ EXIT_KEY_PRESENT = 1 ;
+
+ if( (ListBoxCtrl->PtrItems[i].Key.Key.ScanCode == action->Input.Data.AmiKey.Key.ScanCode ) &&
+ (ListBoxCtrl->PtrItems[i].Key.Key.UnicodeChar == action->Input.Data.AmiKey.Key.UnicodeChar) &&
+ (TseCheckShiftState( action->Input.Data.AmiKey, ListBoxCtrl->PtrItems[i].Key.KeyShiftState) ) )
+ {
+ ListBoxCtrl->QuitPopupLoop = 1;
+ Status = EFI_ABORTED ; //EIP:39415, return error status on esc key
+
+ }
+ }
+ }
+
+ if(ControlActionSelect == Action)
+ {
+
+ //EIP:52427 Start
+ if(TitleToken && ListBoxCtrl->Title != NULL)
+ {
+ //To avoid memory leak, free memory before updating...
+ MemFreePointer((VOID **)&ListBoxCtrl->Title);
+
+ //EIP:48417 Start
+ ListBoxCtrl->Title = HiiGetString( ListBoxCtrl->ListHandle, TitleToken );
+ //EIP:48417 End
+ }
+ //EIP:52427 End
+
+
+ gPostMenuData = MenuData;
+ _ProcessPostMenuChange(ListBoxCtrl) ;
+
+ }else if(!EXIT_KEY_PRESENT && ControlActionAbort == Action)
+ {
+ if (gPostStatus == TSE_POST_STATUS_IN_BBS_POPUP)
+ {
+ if (IsDisableESCinBBSMenu ())//EIP-128526 Disable ESC behaviour in BBS menu and retain till selecting any options
+ continue;
+ else //Enabling ESC key in BBS menu and exit BBS menu on pressing ESC key
+ {
+ ListBoxCtrl->QuitPopupLoop = 1;
+ Status = EFI_ABORTED ; //EIP:39415, return error status on esc key
+ }
+ }
+ else //Handling ESC other than BBSMenu
+ {
+ ListBoxCtrl->QuitPopupLoop = 1;
+ Status = EFI_ABORTED ;
+ }
+ }
+ }
+ }
+ }
+
+
+Done:
+
+ gPostMenuLevel -= 1 ;
+
+ gListBox.Destroy( ListBoxCtrl,TRUE );
+ ListBoxCtrl = NULL;
+
+ gAction.Destroy( action, TRUE );
+ MouseStop();//EIP:51627 -Provided the mouse support for Add boot option with File browser support
+
+ FlushLines( 0, gMaxRows - 1 );
+ DoRealFlushLines();
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _LoadPageDefaults
+//
+// Description: Function to updated defaults for specific page for both Optimal and FailSafe defaults
+//
+// Input: PAGE_INFO, UINT32
+//
+// Output: VOID
+//
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _LoadPageDefaults(PAGE_INFO *pageInfo, UINT32 OldVariableCount)
+{
+ UINT32 control;
+
+ for ( control= 0; control < pageInfo->PageControls.ControlCount; control++ )
+ {
+ CONTROL_INFO *controlInfo = (CONTROL_INFO *)((UINTN)gControlInfo + pageInfo->PageControls.ControlList[control]);
+
+ if ( ( controlInfo->ControlVariable == VARIABLE_ID_LANGUAGE ) || ( controlInfo->ControlVariable == VARIABLE_ID_BOOT_ORDER ) || (controlInfo->ControlVariable == VARIABLE_ID_BBS_ORDER) )
+ continue;
+
+ if ( controlInfo->ControlDataWidth > 0 )
+ {
+ VOID *ifrData = controlInfo->ControlPtr;
+ UINT8 *failValue, *optValue;
+ UINT32 ControlVarOffset;
+
+ if ( ifrData == NULL )
+ continue;
+
+ failValue = (UINT8 *)controlInfo + sizeof(CONTROL_INFO);
+ optValue = failValue + controlInfo->ControlDataWidth;
+
+ ControlVarOffset = UefiGetQuestionOffset(ifrData);
+
+ //EIP-93340 Updating gOptimalDefaults and gFailSafeDefaults for stringType controls based on controlPtr
+ if (IsSupportDefaultForStringControl() && controlInfo->ControlType == CONTROL_TYPE_POPUP_STRING)
+ {
+ if (*(UINT16*)(failValue))
+ {
+ failValue = (VOID*)HiiGetString( controlInfo->ControlHandle, *(UINT16*)(failValue));
+ if (NULL == failValue)
+ continue;
+
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gFailsafeDefaults, controlInfo->ControlVariable, ControlVarOffset, EfiStrLen((CHAR16*)failValue) * sizeof(CHAR16), failValue );
+ }
+
+ if (*(UINT16*)(optValue))
+ {
+ optValue = (VOID*)HiiGetString( controlInfo->ControlHandle, *(UINT16*)(optValue));
+ if (NULL == optValue)
+ continue;
+
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gOptimalDefaults, controlInfo->ControlVariable, ControlVarOffset, EfiStrLen((CHAR16*)optValue) * sizeof(CHAR16), optValue );
+
+ if(controlInfo->ControlVariable > OldVariableCount)
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gVariableList, controlInfo->ControlVariable, ControlVarOffset, EfiStrLen((CHAR16*)optValue) * sizeof(CHAR16), optValue );
+
+ }
+
+ if (failValue)
+ MemFreePointer( (VOID **)&failValue );
+
+ if (optValue)
+ MemFreePointer( (VOID **)&optValue );
+ }
+ //EIP-93340 End
+ else
+ {
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gFailsafeDefaults, controlInfo->ControlVariable, ControlVarOffset, controlInfo->ControlDataWidth, failValue );
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gOptimalDefaults, controlInfo->ControlVariable, ControlVarOffset, controlInfo->ControlDataWidth, optValue );
+ // Dont' Update the cache of exsiting variable.
+ if(controlInfo->ControlVariable > OldVariableCount)
+ _VarGetSetValue( VAR_COMMAND_SET_VALUE, gVariableList, controlInfo->ControlVariable, ControlVarOffset, controlInfo->ControlDataWidth, optValue );
+ }
+ }
+ }
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UIUpdateCallback
+//
+// Description: UI callback function for dynamic form updates.
+//
+// Input: IN Handle of Affected page
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+static AMI_IFR_MENU gMenuData = {CONTROL_TYPE_MENU,2};
+extern UINT32 gtempCurrentPage;
+VOID UIUpdateCallback(VOID * Handle, UINT32 OldVariableCount)
+{
+ UINT32 i,j, CurrentPage,Index;
+ PAGE_INFO *_gPageInfo,*_gappPageInfo,*_tmpPageInfo;
+ UINT32 tmpControlCount,tmpCurrentControl,tmpFirstVisibleCtrl;
+ FRAME_DATA *fdata;
+ PAGE_DATA *PageData;
+
+ if(gApp == NULL)
+ return; // Application data not initilized.
+
+ if(gVariables->VariableCount > OldVariableCount)
+ {
+ // NewVariables Added.
+ // Update the TSE catch and Defaults
+ // Reallocate
+ gVariableList = MemReallocateZeroPool( gVariableList, sizeof(NVRAM_VARIABLE) * OldVariableCount, gVariables->VariableCount * sizeof(NVRAM_VARIABLE));
+ gOptimalDefaults = MemReallocateZeroPool( gOptimalDefaults, sizeof(NVRAM_VARIABLE) * OldVariableCount, gVariables->VariableCount * sizeof(NVRAM_VARIABLE));
+ gFailsafeDefaults = MemReallocateZeroPool( gFailsafeDefaults, sizeof(NVRAM_VARIABLE) * OldVariableCount, gVariables->VariableCount * sizeof(NVRAM_VARIABLE));
+ ASSERT (gVariableList != NULL);
+ ASSERT (gOptimalDefaults != NULL);
+ ASSERT (gFailsafeDefaults != NULL);
+
+ for(Index = OldVariableCount; Index< gVariables->VariableCount; Index++)
+ {
+ gVariableList[Index].Buffer = VarGetNvram( Index, &(gVariableList[Index].Size) );
+ if (gVariableList[Index].Size)
+ {
+ // init std defautls
+ gOptimalDefaults[Index].Buffer = EfiLibAllocateZeroPool( gVariableList[Index].Size );
+ if (NULL == gOptimalDefaults[Index].Buffer)
+ {
+ continue;
+ }
+ if (NULL == gVariableList[Index].Buffer)
+ {
+ gVariableList[Index].Buffer = EfiLibAllocateZeroPool( gVariableList[Index].Size );
+ if (NULL == gVariableList[Index].Buffer)
+ {
+ continue;
+ }
+ }
+ MemCopy(gOptimalDefaults[Index].Buffer, gVariableList[Index].Buffer, gVariableList[Index].Size);
+
+ // init mfg defautls
+ gFailsafeDefaults[Index].Buffer = EfiLibAllocateZeroPool( gVariableList[Index].Size );
+ MemCopy(gFailsafeDefaults[Index].Buffer, gVariableList[Index].Buffer, gVariableList[Index].Size);
+ }
+ else
+ {
+ gFailsafeDefaults[Index].Buffer = NULL;
+ gOptimalDefaults[Index].Buffer = NULL;
+ }
+
+ gFailsafeDefaults[Index].Size = gVariableList[Index].Size;
+ gOptimalDefaults[Index].Size = gVariableList[Index].Size;
+ }
+ }
+
+ CurrentPage = gApp->CurrentPage;
+ fdata = ((PAGE_DATA*)gApp->PageList[gApp->CurrentPage])->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+
+ tmpControlCount = fdata->ControlCount;
+ tmpCurrentControl = fdata->CurrentControl;
+ tmpFirstVisibleCtrl = fdata->FirstVisibleCtrl;
+
+ // Fix gApp Pages
+ for ( i = 1; i < gPages->PageCount; i++ )
+ {
+ // Get the Setupdata's Page Info
+ _gPageInfo = (PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[i]);
+
+ // If page is updated
+ if( (_gPageInfo->PageHandle == Handle) || (_gPageInfo->PageHandle == (VOID *)(UINTN)0xFFFF))
+ {
+ for ( j = 1; j < gApp->PageCount; j++ )
+ {
+ _gappPageInfo = (PAGE_INFO*)&( gApp->PageList[j]->PageData);
+ // If updated handle ?
+ if(_gappPageInfo->PageHandle == Handle)
+ {
+ // Update page
+ if(_gPageInfo->PageFormID == _gappPageInfo->PageFormID)
+ {
+ gPage.Destroy( gApp->PageList[j], FALSE );
+ if(_gPageInfo->PageHandle != (VOID *)(UINTN)0xFFFF)
+ {
+ if((_gPageInfo->PageFlags.PageDynamic == TRUE) && (_gPageInfo->PageParentID == 0))
+ _gPageInfo->PageParentID = gDynamicParentPage;
+ gPage.Initialize( gApp->PageList[j], _gPageInfo );
+ _LoadPageDefaults(_gPageInfo,OldVariableCount);
+ }
+ else
+ _gappPageInfo->PageHandle = NULL;
+
+ break;
+ }
+ }
+ }
+ // New Page - Add Page
+ if(j == gApp->PageCount)
+ {
+ gtempCurrentPage = gApp->CurrentPage;
+ gApp->CurrentPage = j; //Change the current else in UefiGetQuestionOffset page handle will not be matched useful for name value
+ gApplication.AddPage( gApp, _gPageInfo );
+ gApp->CurrentPage = gtempCurrentPage;
+ _LoadPageDefaults(_gPageInfo,OldVariableCount);
+ }
+ }
+ }
+
+ // If Current Page removed ????
+ _gappPageInfo = (PAGE_INFO*)&( gApp->PageList[gApp->CurrentPage]->PageData);
+ if(_gappPageInfo->PageHandle == NULL)
+ {
+ UINT32 rootPage = 0, FirstPage=0;
+ for ( j = 1; j < gApp->PageCount; j++ )
+ {
+ _tmpPageInfo = (PAGE_INFO*)&( gApp->PageList[j]->PageData);
+ if(_tmpPageInfo->PageHandle == Handle)
+ {
+ if(_gappPageInfo->PageFormID == _tmpPageInfo->PageFormID)
+ {
+ //Current Page moved
+ CurrentPage = gApp->CurrentPage = j;
+ break;
+ }
+ if(_tmpPageInfo->PageParentID == 0)
+ rootPage = _tmpPageInfo->PageID;
+ }
+ if((_tmpPageInfo->PageHandle != NULL) && (FirstPage==0) && (!_tmpPageInfo->PageFlags.PageVisible))
+ FirstPage = j;
+ }
+ // Page permently removed.
+ if(j == gApp->PageCount)
+ {
+ if(rootPage)
+ {
+ // Try to go to Root page of Current handle
+ gApp->CurrentPage = rootPage;
+ }
+ else
+ {
+ if(FirstPage)
+ gApp->CurrentPage = FirstPage;
+ else
+ {
+ // NO Valid PAGE Found
+ // HANDLE ERRROR!!!!
+ }
+ }
+ }
+ gApp->CompleteRedraw = TRUE;
+ }
+
+ // Update the Menu control
+ i = StyleFrameIndexOf(SUBTITLE_FRAME);
+ for ( j = 1; j < gApp->PageCount; j++ )
+ {
+ PageData = (PAGE_DATA*)gApp->PageList[j];
+ if(PageData == NULL)
+ continue;
+ if(PageData->PageData.PageHandle != NULL)
+ {
+ gFrame.Destroy( PageData->FrameList[i], FALSE );
+ StyleInitializeFrame( PageData->FrameList[i], SUBTITLE_FRAME, &PageData->PageData );
+ }
+ }
+
+ // To Maintain the current control
+ if(CurrentPage == gApp->CurrentPage)
+ {
+ fdata = ((PAGE_DATA*)gApp->PageList[gApp->CurrentPage])->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+ // Update Controls
+ if(fdata->ControlCount == tmpControlCount)
+ {
+ fdata->CurrentControl=tmpCurrentControl;
+ fdata->FirstVisibleCtrl=tmpFirstVisibleCtrl;
+ _FrameSetControlFocus( fdata, tmpCurrentControl );
+ }
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: GetUpdatedControlData
+//
+// Description: Try to get the updated control.
+//
+// Input: CONTROL_DATA * ControlData,UINT16 ControlType,VOID *Handle,UINT16 Key
+//
+// Output: controlData. Null if not found.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+CONTROL_DATA * GetUpdatedControlData(CONTROL_DATA * ControlData,UINT16 ControlType,VOID *Handle,UINT16 Key)
+{
+ FRAME_DATA *frame;
+ UINT32 i;
+ CONTROL_DATA **control;
+
+ if ( NULL == ((PAGE_DATA*)gApp->PageList[gApp->CurrentPage]) )//Setup crashes on clicking submenu when PageList is NULL
+ return NULL;
+
+ frame = ((PAGE_DATA*)gApp->PageList[gApp->CurrentPage])->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+
+ control = frame->ControlList;
+ for ( i = 0; i < frame->ControlCount; i++, control++ )
+ {
+ if(((*control)->ControlData.ControlHandle == Handle) && ((*control)->ControlData.ControlType == ControlType))
+ {
+ if(UefiGetControlKey(&((*control)->ControlData)) == Key)
+ return *control;
+ }
+ }
+ return NULL;
+}
+
+BOOLEAN IsActiveControlPresent(PAGE_DATA *page)
+{
+ BOOLEAN ControlActive=FALSE;
+ CONTROL_DATA **control;
+ FRAME_DATA * pFrame;
+ UINTN i;
+
+ for ( i = 0; i < page->FrameCount; i++ )
+ {
+ pFrame = page->FrameList[StyleFrameIndexOf((UINT32)i)];
+ if(pFrame->CurrentControl != FRAME_NONE_FOCUSED)
+ {
+ control = &pFrame->ControlList[pFrame->CurrentControl];
+ if((*control)->ControlActive == TRUE )
+ {
+ ControlActive = TRUE;
+ break;
+ }
+ }
+ }
+ return ControlActive;
+}
+
+//<AMI_PHDR_START>
+//-----------------------------------------------------------------------------------------
+// Procedure: UpdategScreenParams
+//
+// Description: Verifies and corrects the gScreen params with the current uni strings
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//-----------------------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID UpdategScreenParams (VOID)
+{
+ if (STR_MAIN_TITLE != gScreen->MainTitle)
+ {
+ gScreen->MainTitle = STR_MAIN_TITLE;
+ }
+ if (STR_MAIN_COPYRIGHT != gScreen->MainCopyright)
+ {
+ gScreen->MainCopyright = STR_MAIN_COPYRIGHT;
+ }
+ if (STR_EVAL_MSG != gScreen->MainHelpTitle)
+ {
+ gScreen->MainHelpTitle = STR_EVAL_MSG;
+ }
+}
+//EIP: 58925 Start
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: GetParentFormID
+//
+// Description: Gets the parent page ID from given child page ID
+//
+// Input: UINT16 ChildID - Child page ID
+// UINT16 *ParentID - Parent page ID
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else EFI_ERROR
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS GetParentFormID(UINT16 ChildID, UINT16 *ParentID, UINT32 *StackIndex)
+{
+ EFI_STATUS Status = EFI_NOT_FOUND;
+ UINT32 navCount = 0, gAppPageCount = 0;
+
+ *StackIndex = 0xFFFFFFFF;
+
+ if(gApp->PageList[ChildID] == NULL){
+ Status = EFI_ABORTED;
+ goto DONE;
+ }
+
+ Status = EFI_NOT_FOUND;
+ for(navCount = 0; navCount < gPageNavCount; navCount++){ //Check in the navigated page stack
+ if((NavPageStack[navCount].PageFormID == gApp->PageList[ChildID]->PageData.PageFormID)
+ && (NavPageStack[navCount].PageHandle == gApp->PageList[ChildID]->PageData.PageHandle))
+ {
+ if((NavPageStack[navCount].PageParentFormID == 0) && (NavPageStack[navCount].ParentPageHandle == NULL)){ //If the parent page and parent handle is invalid
+ *StackIndex = 0;
+ break;
+ }
+ for(gAppPageCount = gNavStartPage; gAppPageCount < gApp->PageCount; gAppPageCount++){ //Check against the application page list
+ if((gApp->PageList[gAppPageCount]->PageData.PageFormID == (UINT16)NavPageStack[navCount].PageParentFormID)
+ && (gApp->PageList[gAppPageCount]->PageData.PageHandle == NavPageStack[navCount].ParentPageHandle))
+ {
+ *ParentID = gApp->PageList[gAppPageCount]->PageData.PageID;
+ *StackIndex = navCount;
+ Status = EFI_SUCCESS;
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+DONE:
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SetParentFormID
+//
+// Description: Updated NAV_PAGE_STACK with current page and parent page info
+//
+// Input: UINT16 ParentID - Current/Parent Page ID
+// UINT16 TargetID - Target/child page ID
+//
+// Output: EFI_STATUS Status - EFI_SUCCESS if successful, else EFI_ERROR
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SetParentFormID(UINT16 ParentID, UINT16 TargetID)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT32 StackIndex = 0xFFFFFFFF;
+ UINT16 ParID = 0; //Temporary variable for finding the parent page ID of the target page
+
+ if(ParentID == TargetID){
+ return Status;
+ }
+
+ if(NavPageStack == NULL){
+ NavPageStackSize = gApp->PageCount + MAX_NAVIGATION_DEPTH;
+ NavPageStack = (NAV_PAGE_STACK *)EfiLibAllocateZeroPool(sizeof(NAV_PAGE_STACK) * (NavPageStackSize));
+ if(NavPageStack == NULL){
+ Status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+ gNavStartPage = TargetID; //Sets the start page of the formset
+ }
+
+ Status = GetParentFormID(TargetID, &ParID, &StackIndex);
+ if(Status == EFI_ABORTED){
+ goto DONE;
+ }
+ if((Status == EFI_SUCCESS) && (StackIndex < NavPageStackSize)){
+ gPageNavCount = StackIndex + 1; //Decrement the total number of pages navigated
+ if(gPageNavCount < NavPageStackSize){
+ MemSet(&NavPageStack[gPageNavCount], (NavPageStackSize - gPageNavCount) * sizeof(NAV_PAGE_STACK), 0); //Remove the child page information from NAV_PAGE_STACK
+ }
+ goto DONE;
+ } else if((Status != EFI_SUCCESS) && (StackIndex < NavPageStackSize) && (ParID == 0)){
+ gPageNavCount = 1; //Because the navigation root is not found
+ if(gPageNavCount < NavPageStackSize){
+ MemSet(&NavPageStack[gPageNavCount], (NavPageStackSize - gPageNavCount) * sizeof(NAV_PAGE_STACK), 0); //Remove the child page information from NAV_PAGE_STACK
+ }
+ goto DONE;
+ }
+
+ //Adds the child page info in the NAV_PAGE_STACK
+ if(NavPageStackSize <= gPageNavCount)
+ {
+ NavPageStackSize += MAX_NAVIGATION_DEPTH;
+ NavPageStack = MemReallocateZeroPool( NavPageStack, NavPageStackSize-MAX_NAVIGATION_DEPTH, NavPageStackSize );
+ if(NavPageStack == NULL){
+ Status = EFI_OUT_OF_RESOURCES;
+ gPageNavCount=0;
+ goto DONE;
+ }
+ }
+
+ NavPageStack[gPageNavCount].PageHandle = gApp->PageList[TargetID]->PageData.PageHandle;
+ NavPageStack[gPageNavCount].PageFormID = gApp->PageList[TargetID]->PageData.PageFormID;
+ if(gPageNavCount){
+ NavPageStack[gPageNavCount].ParentPageHandle = NavPageStack[gPageNavCount - 1].PageHandle;
+ NavPageStack[gPageNavCount].PageParentFormID = NavPageStack[gPageNavCount - 1].PageFormID;
+ }
+ gPageNavCount++; //Increment the total number of pages navigated
+
+
+DONE:
+ return Status;
+}
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: ResetNavStack
+//
+// Description: Resets the navigation stack
+//
+// Input: None
+//
+// Output: VOID
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID ResetNavStack()
+{
+ if(NavPageStack){
+ MemFreePointer(&NavPageStack);
+ NavPageStack = (NAV_PAGE_STACK *)NULL; //Resets the navigated page info
+ }
+ gPageNavCount = 0; //Resets the navigated page count
+ gNavStartPage = 0; //Resets the start page of the formset
+ gDisplayPageId = 0; //Reset the displayed page ID
+}
+//EIP: 58925 End
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: CheckEnableQuietBoot
+//
+// Description: Function to check the quick boot enable option
+//
+// Input: void
+//
+// Output: void
+//
+// Notes : if NVRAM variable field AMISilentBoot = 0, then disable silent
+// mode else enable In case of error reading the Setup variable,
+// then return as silent boot disable
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID CheckEnableQuietBoot( VOID )
+{
+#ifndef STANDALONE_APPLICATION
+ if(ItkSupport())
+ gQuietBoot = TRUE;
+ else
+ {
+ UINT8 *setupvar=NULL;
+ UINT8 *setup=NULL;
+ UINTN size = 0;
+ UINTN offset;
+
+ GetAMITSEVariable((AMITSESETUP**)&setup,&setupvar,&size);
+
+ offset = STRUCT_OFFSET( AMITSESETUP, AMISilentBoot );
+ if ( ( setup == NULL ) || ( size < offset ) )
+ gQuietBoot = FALSE;
+ else
+ gQuietBoot = (BOOLEAN)setup[offset];
+
+ if(setupvar)
+ MemFreePointer( (VOID **)&setupvar );
+ else
+ MemFreePointer( (VOID **)&setup );
+ }
+#endif //#ifndef STANDALONE_APPLICATION
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: GetAMITSEVariableLocal
+//
+// Description: function to get the local NvRam variable
+//
+// Input: AMITSESETUP **mSysConf, UINT8 **setup, UINTN *VarSize
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID GetAMITSEVariableLocal(AMITSESETUP **mSysConf, UINT8 **setup, UINTN *VarSize)
+{
+ *mSysConf = VarGetVariable( VARIABLE_ID_AMITSESETUP, VarSize );
+ if ( ( *mSysConf == NULL ) || ( *VarSize != sizeof(AMITSESETUP) ) )
+ *mSysConf = VarGetNvram( VARIABLE_ID_AMITSESETUP, VarSize );
+}
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/minisetupext.h b/EDK/MiniSetup/TseLite/minisetupext.h
new file mode 100644
index 0000000..d829aed
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/minisetupext.h
@@ -0,0 +1,537 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2012, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/minisetupext.h $
+//
+// $Author: Premkumara $
+//
+// $Revision: 30 $
+//
+// $Date: 8/28/14 3:07p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/minisetupext.h $
+//
+// 30 8/28/14 3:07p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 29 8/28/14 6:06a Premkumara
+// EIP-135253 Updating file name proper in #include
+//
+// 28 5/02/14 9:28p Arunsb
+// EIP141986 changes reverted.
+//
+// 27 5/02/14 10:59a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 26 2/11/14 8:23p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 24 3/12/13 7:02a Rajashakerg
+// [TAG] EIP105167
+// [Category] Improvement
+// [Description] Making the specify setup items departing from F2/F3
+// effect.
+// [Files] AMITSE.sdl, CommonHelper.c, callback.c, minisetupext.h,
+// PopupPassword.c, SubMenu.c, HiiCallback.c
+//
+// 23 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 14 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 22 5/28/12 12:32p Premkumara
+// [TAG] EIP67049 & 90224
+// [Category] New Feature
+// [Description] Support mouse drag operation in frame and list box
+// [Files] CommonHelper.c, Frame.c, ListBox.c, Minisetupext.h
+//
+// 21 5/28/12 11:45a Premkumara
+// [TAG] EIP89272
+// [Category] Improvement
+// [Description] Change softkbd layout for numeric control
+// [Files] CommonHelper.c, Mouse.c, Minisetup.h, C, Numeric.c
+//
+// 20 4/05/12 7:16a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 19 1/24/12 4:40a Arunsb
+// [TAG] EIP81581
+// [Category] Improvement
+// [Description] Default driver order support
+// [Files] globals.c, addbootoption.c, callback.c, minisetupext.h and
+// variable.c
+//
+// 18 11/20/11 7:55a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 17 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 16 11/13/11 1:00p Arunsb
+// [TAG] EIP70421
+// [Category] New Feature
+// [Description] Support for driver order in TSE
+// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
+// boot.c,
+// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
+// addbootoption.c,
+// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
+// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
+// TseElink.h, variable.h,
+// setup.h, Boot.vfr and Setup.uni
+//
+// 15 10/20/11 12:25p Blaines
+// Correct the comments.
+//
+// 14 10/20/11 11:48a Blaines
+// [TAG] EIP 72333
+// [Category] Sighting
+// [Symptom] Some SAS controller card HII Screen Titles are displaying
+// the wrong information
+// [RootCause] Menu tab always displays the root page title when
+// navigating submenu pages. TSE did not support the display of Formset
+// Help.
+//
+// [Solution] Display Formset Help for Dynamic page, Display page title of
+// submenu pages in the menu tab.
+//
+// [Files Changed]
+// - AMITSE.sdl, CommonHelper.c, special.c, Menu.c, minisetupext.h,
+// TseUefiHii.h, Uefi21Wapper.c
+//
+// 13 6/23/11 3:55p Rajashakerg
+// [TAG] EIP55762, 58925, 59971
+// [Category] New Feature
+// [Description] Support REF2,REF3 and REF4 in AMITSE
+// Support direct form navigation path
+// Improper layout of controls in the root page when Dynamic pages are
+// added using the Legacy Setup Style
+//
+// [Files] setupdata.h, CommonHelper.c, AMITSE.sdl, Legacy\Legacy.c,
+// Legacy\style.h, Legacy\style.h, frame.c, minisetupext.c,
+// minisetupext.h, numeric.c, page.c Popupstring.c, Hii.c,
+// Uefi21Wrapper.c, Parse.c Hii.c
+//
+// 12 3/28/11 9:24p Madhans
+// [TAG] EIP41744
+// [Category] Improvement
+// [Description] SoftKeyBoard Support in TSE. and Support to Work with
+// new mouse driver(Label 07).
+// [Files] HookAnchor.h
+// AMITSE.sdl
+// CommonHelper.c
+// commonoem.c
+// commonoem.h
+// HookList.c
+// HookAnchor.c
+// Mouse.c
+// minisetupext.c
+// postmgmtext.c
+// minisetupext.h
+// PopupPassword.c
+// PopupString.c
+// TseLiteCommon.c
+//
+// 11 3/28/11 4:58p Rajashakerg
+// [TAG] EIP56413
+// [Category] Improvement
+// [Description] TSE: Support for EFI_IFR_RESET_BUTTON opcode
+// [Files] ezport.c, minisetupext.h, ResetButton.c, ResetButton.h,
+// Hii.c, TseUefiHii.h, Uefi21Wapper.c, hii.h, Uefi20Wapper.c
+//
+// 10 3/21/11 12:36a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 9 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 8 2/10/11 12:32p Blaines
+// [TAG] - EIP 53146
+// [Category]- New Feature
+// [Description] -Add the support to Move the Dynamic IFR Pages under
+// subpages. It should be customizable to move around.
+//
+// 7 1/06/11 7:44p Madhans
+// [TAG] - EIP 51678
+// [Category]- Enhancment
+// [Severity]- Mordarate
+// [Symptom]- If OEMs override the style module parts, If new tse adds
+// new style hook then
+// if the OEM has different style module, even if they don't need use the
+// hook to avoid
+// compilation issue they need touch their style module to add the new
+// hook.
+// [RootCause] - The Original Style Hooks are part of Style module itself.
+// [Solution]- To create Empty style Hook List in TSE core. This will
+// allows the OEM not
+// to change their style module to update newer TSE.
+// [Files] - StyleHook Module Part under TSE lite sources. StyleHook.lib
+// StyleHookx64.lib tselitebin.sdl
+//
+// 6 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 10 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 9 2/15/10 10:14p Madhans
+// Uefi 2.1 support
+//
+// 8 1/09/10 6:23a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 7 10/28/09 5:38p Madhans
+//
+// 6 9/15/09 9:46a Sudhirv
+// added new definition VARIABLE_ID_OEM_TSE_VAR
+//
+// 5 8/20/09 6:43p Madhans
+// Fix for Mouse click crash issue.
+//
+// 4 8/19/09 12:58p Madhans
+// IsToggleStateKey() function added
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 5 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 3/31/09 4:11p Madhans
+//
+// 3 2/05/09 10:15a Madhans
+// Style Module created.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: MINISETUPEXT.h
+//
+// Description: Header file for FULL TSE specific minisetup entery and exit funtionallies
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _MINISETUPEXT_H_
+#define _MINISETUPEXT_H_
+
+
+#define MINI_SETUP_HPK_DATA_GUID \
+ { 0xDCFBBCA4, 0x2498, 0x48DB, 0x91, 0x22, 0xFF, 0x7E, 0x96, 0x4B, 0xC5, 0x69 }
+//EIP:53480 Defining the Action requests for the callbacks
+#define AMI_CALLBACK_CONTROL_UPDATE 1
+#define AMI_CALLBACK_RETRIEVE 2
+#define AMI_CALLBACK_FORM_OPEN 3
+#define AMI_CALLBACK_FORM_CLOSE 4
+#define AMI_CALLBACK_FORM_DEFAULT_STANDARD 0x1000 //EIP 105167 : Making the specify setup items departing from F2/F3 effect.
+#define AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING 0x1001
+
+#include "setupdata.h"
+#if EFI_SPECIFICATION_VERSION <= 0x20000
+#include "hii.h"
+#else
+#include "TseUefiHii.h"
+#endif /* #if EFI_SPECIFICATION_VERSION <= 0x20000 */
+#include "StyleHook\StyleHook.h"
+#if TSE_STYLE_SOURCES_SUPPORT
+#include "style.h"
+#endif
+#include "application.h"
+#include "action.h"
+#include "MessageBox.h"
+#include "hotkey.h"
+#include "Date.h"
+#include "Text.h"
+#include "edit.h"
+#include "Label.h"
+#include "ListBox.h"
+#include "Memo.h"
+#include "Menu.h" //
+#include "numeric.h"
+#include "popup.h"
+#include "PopupEdit.h"
+#include "PopupPassword.h"
+#include "PopupSel.h"
+#include "PopupString.h"
+#include "SubMenu.h"
+#include "Time.h"
+#include "password.h"
+#include "ordlistbox.h"
+#include "UefiAction.h"
+#include "ResetButton.h"//EIP:56413 Added reset button header file
+
+/*
+#include "special.h"
+*/
+
+extern SETUP_PKG *gSetupPkg;
+extern SCREEN_INFO *gScreen;
+extern PAGE_LIST *gPages;
+extern PAGE_LIST *gToolPages;
+extern CONTROL_INFO *gToolControlInfo;
+extern CONTROL_INFO *gControlInfo;
+extern VARIABLE_LIST *gToolVariables;
+extern VARIABLE_LIST *gVariables;
+extern PAGE_ID_LIST *gPageIdList;
+extern PAGE_ID_LIST *gToolPageIdList;
+extern PAGE_ID_INFO *gPageIdInfo;
+extern PAGE_ID_INFO *gToolPageIdInfo;
+
+extern NVRAM_VARIABLE *gVariableList;
+extern NVRAM_VARIABLE *gFailsafeDefaults;
+extern NVRAM_VARIABLE *gOptimalDefaults;
+
+extern HPK_INFO *gHpkInfo;
+
+extern GUID_LIST *gGuidList;
+
+extern FRAME_DATA *gActiveFrame;
+
+extern ACTION_DATA *gMsgBoxAction;
+extern UINT16 gDynamicParentPage;
+// callback.c
+VOID LoadPreviousValues( BOOLEAN showMsgBox );
+VOID LoadOptimalDefaults( VOID );
+VOID LoadFailsafeDefaults( VOID );
+BOOLEAN SaveAndExit( VOID );
+VOID SaveWithoutExit( VOID );
+BOOLEAN SaveAndReset( VOID );
+BOOLEAN ResetSys( VOID );
+BOOLEAN ExitApplication( VOID );
+VOID ShowHelpMessageBox( VOID );
+UINT8 CallbackShowMessageBox( UINTN data, UINT8 type );
+EFI_STATUS CallFormCallBack(CONTROL_INFO * pControlData, UINT16 Key, UINT8 Flags, UINTN Action);
+VOID UEFICallSetupFormCallBack(UINTN Action );
+
+// Helper
+extern CHAR8 *gPrevLanguage;
+extern UINTN gPrevLangSize;
+
+VARIABLE_INFO *VarGetVariableInfoIndex( UINT32 index );
+VARIABLE_INFO *VarGetVariableInfoId( UINT32 varId, UINT32 *index );
+// variable.h
+extern UINTN gSetupCount;
+VOID *BBSReOrderDefultLegacyDevOrder(BBS_ORDER_TABLE *DefaultLegDevOrder,UINTN DefaultLegDevOrderSize);
+extern EFI_GUID EfiDefaultLegacyDevOrderGuid;
+extern EFI_GUID EfiDefaultBootOrderGuid;
+extern EFI_GUID EfiDefaultDriverOrderGuid; //EIP81581
+//#define SETUP_PASSWORD_LENGTH 20
+extern const UINTN TsePasswordLength;
+VOID InitgProgress( VOID );
+VOID SetHDDPassword(VOID);
+VOID BBSUpdateOrder(UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **buffer);
+VOID BootUpdateOrder (UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **buffer);
+VOID DriverUpdateOrder (UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **buffer); //EIP70421 & 70422 Support for driver order
+
+extern VOID MainSetupLoopInit(VOID) ;
+EFI_STATUS DoBbsPopupInit(VOID) ;
+EFI_STATUS DrawBbsPopupMenu( VOID );
+VOID DrawBootOnlyBbsPopupMenu( VOID ) ;
+VOID BbsBoot(VOID) ;
+
+EFI_STATUS VarBuildAMIDefaults(VOID);
+
+// Mouse Functions
+VOID NumericSoftKbdExit(VOID);
+VOID NumericSoftKbdInit(VOID);
+VOID PrintableKeysSoftKbdInit(VOID);
+VOID PrintableKeysSoftKbdExit(VOID);
+VOID MouseInit(VOID);
+VOID MouseStop(VOID);
+VOID MouseFreeze(VOID);
+VOID MouseRefresh(VOID);
+BOOLEAN IsMouseClickedonSoftkbd(VOID);
+VOID MouseStart(VOID);
+VOID MouseDestroy(VOID);
+EFI_STATUS MouseReadInfo(VOID *MouseInfo);
+EFI_STATUS MouseScrollBarMove(VOID *frame, BOOLEAN bScrollUp, UINT32 Size); //EIP-67049
+EFI_STATUS MouseListBoxScrollBarMove(VOID *listbox, BOOLEAN bScrollUp, UINT32 Size); //EIP-67049
+EFI_STATUS MouseFrameHandleAction( VOID *frame, VOID *action, VOID *control );
+EFI_STATUS MouseSubMenuHandleAction( VOID *submenu, VOID *Data);
+EFI_STATUS MouseMsgBoxHandleAction( VOID *msgbox, VOID *Data,BOOLEAN * pRedraw );
+EFI_STATUS MouseListBoxHandleAction( VOID *listbox, VOID *Data);
+EFI_STATUS MousePopupSelHandleAction( VOID *popupSel, VOID *Data);
+EFI_STATUS MousePopupEditHandleAction( VOID *PopupEdit, VOID *Data,BOOLEAN * pRedraw );
+EFI_STATUS MouseMenuHandleAction( VOID *menu, VOID *Data );
+
+
+VOID ReGroupOptions(UINT16 *optionList,UINT16 *OrgOptionList);
+EFI_STATUS PopupEditHandlePassword( VOID *PopupEdit, VOID *Data);
+EFI_STATUS ActionReadKey( AMI_EFI_KEY_DATA *pAmiKey, UINT64 Timeout );
+EFI_STATUS AMIReadKeyStroke(EFI_INPUT_KEY *Key,AMI_EFI_KEY_DATA *KeyData);
+EFI_STATUS HelperIsPasswordCharValid(EFI_INPUT_KEY *Key,AMI_EFI_KEY_DATA *KeyData,UINTN StrIndex,UINTN PasswordLength, CHAR16 *OutChar);
+VOID FramePasswordAdvancedCallback(CALLBACK_PASSWORD *callbackData,CHAR16 *saveData);
+EFI_STATUS FramePwdCallbackIdePasswordUpdate ( CONTROL_DATA *control,CHAR16 *saveData);
+EFI_STATUS PopupPwdAuthenticateIDEPwd(POPUP_PASSWORD_DATA *popuppassword, BOOLEAN *AbortUpdate,VOID *data);
+VOID PopupPwdUpdateIDEPwd (VOID);
+EFI_STATUS PopupPwdHandleActionOverRide(POPUP_PASSWORD_DATA *popuppassword, ACTION_DATA *Data);
+UINT32 PopupPasswordCheckInstalled(POPUP_PASSWORD_DATA *popuppassword);
+BOOLEAN PopupPasswordAuthenticate( POPUP_PASSWORD_DATA *popuppassword, CHAR16 *Password );
+EFI_STATUS FormBrowserLocateSetupHandles(/*EFI_HII_HANDLE*/VOID* **handleBuffer,UINT16 *count);
+BOOLEAN FormBrowserHandleValid(VOID);
+VOID GetAMITSEVariable(AMITSESETUP **mSysConf,UINT8 **setup,UINTN *VarSize);
+VOID NoVarStoreUpdateSystemAccess(UINT8 sysAccessValue);
+VOID SetSystemAccessValueItk(UINT8 sysAccessValue);
+VOID VarBuildItkDefaults(VOID);
+VOID SpecialUpdatePageControls(UINT32 CurrentPage);
+EFI_STATUS PopupPasswordFormCallback(CONTROL_INFO * pControlData,UINT16 Key,UINT8 Flags);
+BOOLEAN CheckSystemPasswordPolicy(UINT32 PasswordInstalled);
+
+extern UINTN gHpkInfoLength;
+BOOLEAN IsReadOnlyGrayout();
+BOOLEAN IsGrayoutSelectable();
+BOOLEAN IsGroupDynamicPages();
+BOOLEAN IsOrphanPagesAsRootPage();
+BOOLEAN IsLinkHistorySupport();
+BOOLEAN IsSubMenuDisplayTitle();
+
+VOID CsmSaveBBSOrder( VOID *);
+VOID CsmBBSSetDisabled(UINT16 Index, VOID **DisDPs, UINTN *DPSize);
+VOID CsmRearrangeBBSOrderVariable(VOID *popupSel, UINT8 bIncrease,UINT16 *newOption);
+VOID CsmLoadDefaultLegDevOrder(VOID);
+EFI_STATUS CsmBBSUpdateOrder(UINT16 *newOption,UINT32 *offset,UINTN *size, VOID **buffer);
+
+BOOLEAN TseLiteIsSpecialOptionList(CONTROL_DATA *);
+
+
+///IDE Password Hooks
+UINT16 TSEIDEPasswordGetName(UINT16 Index);
+EFI_STATUS TSEIDEPasswordAuthenticate(CHAR16 *Password, VOID* DataPtr, BOOLEAN bCheckUser);
+BOOLEAN TSEIDEPasswordUpdate( UINT32 DeviceIndex, CHAR16 *Password, BOOLEAN bCheckUser);
+VOID* TSEIDEPasswordGetDataPtr( UINTN Index);
+BOOLEAN TSEIDEPasswordGetLocked(UINTN Index);
+VOID TSEIDEPasswordCheck();
+VOID TSEIDEPasswordFreezeDevices();
+VOID TSEUnlockHDD(VOID);
+VOID TSESetHDDPassword(VOID);
+VOID TSEIDEUpdateConfig(VOID *ideSecConfig, UINTN value);
+
+
+UINTN TseGetANSIEscapeCode(CHAR16 *String,UINT8 *Bold,UINT8 *Foreground, UINT8 *Background);
+CHAR16 *TseSkipEscCode(CHAR16 *String);
+
+BOOLEAN TseCheckShiftState(AMI_EFI_KEY_DATA ActionKey, UINT32 HotkeyState);
+
+UINT32 _GetControlVariable(CONTROL_INFO *control);
+
+VOID TseHotkeyPrintScreenSupport();
+BOOLEAN TsePrintScreenEventSupport(UINT16 ScanCode);
+BOOLEAN IsToggleStateKey(ACTION_DATA *Data);
+BOOLEAN IsActiveControlPresent(PAGE_DATA *page);
+VOID TSEStringReadLoopEntryHook(VOID);
+VOID TSEStringReadLoopExitHook(VOID);
+BOOLEAN TSEMouseIgnoreMouseActionHook(VOID);
+VOID TSENumericSoftKbdExit(VOID);
+VOID TSENumericSoftKbdInit(VOID);
+#endif /* _MINISETUP_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/numeric.c b/EDK/MiniSetup/TseLite/numeric.c
new file mode 100644
index 0000000..4526b03
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/numeric.c
@@ -0,0 +1,1430 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/numeric.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 38 $
+//
+// $Date: 8/28/14 3:06p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/numeric.c $
+//
+// 38 8/28/14 3:06p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 37 5/03/14 8:04p Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 36 5/03/14 3:17p Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 35 5/02/14 9:33p Arunsb
+// EIP141986 changes reverted.
+//
+// 34 5/02/14 10:58a Premkumara
+// [TAG] EIP141986
+// [Category] New Feature
+// [Description] Made Grayed controls to focus-able when token
+// TSE_SETUP_GRAYOUT_SELECTABLE
+// is enabled and can't edit the values
+// [Files] AMITSE.sdl,CommonHelper.c,frame.c,Label.c,minisetupext.h,
+// numeric.c,PopupPassword.c,PopupSel.c,PopupString.c,SubMenu.c
+//
+// 33 5/01/14 3:43p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 32 2/11/14 9:02p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 31 12/05/13 1:37a Premkumara
+// [TAG] EIP139608
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] Not able to navigate to other page using Mouse/Clicks when
+// Numeric control is focused. Msgbox, Menu, Listbox is not closing using
+// touch/mouse.
+// [Root Cause] When token SINGLE_CLICK_ACTIVATION is enabled
+// numerichandle action is not returning unsupported. TSE isn't handled
+// ControlActionSelect to close msgbox, menu, listbox when token is
+// enable.
+// [Solution] Handled mouse action properly for numeric control. Handled
+// action properly to close msgbox, listbox, menu.
+// [Files] ListBox.c, Numeic.c, MessageBox.c, MinisetupExt.c
+//
+// 30 12/03/13 1:10p Premkumara
+// [TAG] EIP141986
+// [Category] Improvement
+// [Description] Make grayedout control focusable and this feature is
+// handled by token TSE_SETUP_GRAYOUT_SELECTABLE
+// [Files] AMITSE.sdl, CommonHelper.c, Frame.c, Label.c, Minisetupext.c,
+// Numeric.c, PopupPassword.c, PopupSel.c, PopupString. SubMenu.c
+//
+// 29 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 13 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 28 6/28/12 8:23p Arunsb
+// [TAG] EIP92407
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Shift + "+" key wont respond
+// [RootCause] Shift state not cleared
+// [Solution] Shift state cleared
+// [Files] numeric.c
+//
+// 27 5/29/12 2:41a Premkumara
+// Added missed EIP-88811 changes (TSEMouseIgnoreMouseActionHook()) in
+// numeric.c
+//
+// 26 5/28/12 11:52a Premkumara
+// [TAG] EIP89272
+// [Category] Improvement
+// [Description] Change softkbd layout for numeric control
+// [Files] CommonHelper.c, Mouse.c, Minisetup.h, C, Numeric.c
+//
+// 25 5/28/12 8:27a Arunsb
+// CallbackShowMessageBox commented in NumericDraw
+//
+// 24 5/24/12 7:30a Rajashakerg
+// [TAG] EIP88811
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] When pop-up window is invoked in setup and Click on ESC
+// icon or ESC/Right Click, it will respond as two times ESC is clicked
+// [RootCause] ESC functionality provided for left click on the ESC
+// sting navigation frame .
+// [Solution] Now providing the ESC sequence for left down and double
+// click
+// [Files] ezport.c, numeric.c, MessageBox.c
+//
+// 23 5/09/12 6:23p Premkumara
+// [TAG] EIP83703
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] TSE hangs while clicking on the "link training time out"
+// value [this is happening while trying the specified steps immediate
+// after bios flash
+// [RootCause] When invalid range input is provided for numeric control
+// ESC sequence is not provided if it is handled by the mouse.
+// [Solution] Provided the proper ESC sequence to the control such that
+// it close the Invalid Range Fail MsgBox when handled with the mouse and
+// key.
+// [Files] Numeric.c, CommonHelper.c
+//
+// $/Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/
+// - numeric.c (ver 22)
+//
+// $/Alaska/BIN/Modules/AMITSE2_0/AMITSE/
+// - CommonHelper.c (ver 88)
+//
+// 22 5/09/12 5:04p Premkumara
+// [TAG] EIP83703
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] TSE hangs while clicking on the "link training time out"
+// value [this is happening while trying the specified steps immediate
+// after bios flash
+// [RootCause] When invalid range input is provided for numeric control
+// ESC sequence is not provided if it is handled by the mouse.
+// [Solution] Provided the proper ESC sequence to the control such that
+// it close the Invalid Range Fail MsgBox when handled with the mouse and
+// key.
+// [Files] Numeric.c, CommonHelper.c
+//
+// 21 4/05/12 7:17a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 20 4/03/12 11:57p Rajashakerg
+// [TAG] EIP83703
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] TSE hangs while clicking on the "link training time out"
+// value [this is happening while trying the specified steps immediate
+// after bios flash]
+// [RootCause] Invalid message box handling with in the numeric is not
+// proper which is cauing the hang.
+// [Solution] Invalid message box is handled propely with mouse
+// selection.
+// [Files] numeric.c
+//
+// 19 12/08/11 12:28p Rajashakerg
+// Updated the file to overcome build errors when build for x32 mode.
+//
+// 18 11/21/11 11:23a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 17 11/21/11 12:23a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE.
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 16 11/20/11 8:01a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 15 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 14 10/21/11 2:54a Rajashakerg
+// [TAG] EIP60563
+// [Category] New Feature
+// [Description] Updating the file with fix for issue : maximum 8 byte
+// value shows negative number
+// [Files] numeric.c, numeric.h, string.c, string.h
+//
+// 13 10/10/11 1:32a Arunsb
+// [TAG] EIP66976
+// [Category] Improvement
+// [Description] Provision to change the Numeric string format
+// [Files] commonhelper.c, amitse.sdl and numeric.c
+//
+// 12 6/23/11 3:54p Rajashakerg
+// [TAG] EIP55762, 58925, 59971
+// [Category] New Feature
+// [Description]
+// Support REF2,REF3 and REF4 in AMITSE
+// Support direct form navigation path
+// Improper layout of controls in the root page when Dynamic pages are
+// added using the Legacy Setup Style
+//
+// [Files] setupdata.h, CommonHelper.c, AMITSE.sdl, Legacy\Legacy.c,
+// Legacy\style.h, Legacy\style.h, frame.c, minisetupext.c,
+// minisetupext.h, numeric.c, page.c Popupstring.c, Hii.c,
+// Uefi21Wrapper.c, Parse.c Hii.c
+//
+// 11 6/20/11 12:22p Rajashakerg
+// [TAG] EIP60563
+// [Category] New Feature
+// [Description] Support for signed decimal value for
+// EFI_IFR_NUMERIC_OP.
+// [Files] numeric.c, numeric.h, string.c, string.h, Uefi21Wapper.c
+//
+// 10 6/07/11 2:44p Madhans
+// [TAG] EIP61897
+// [Category] Improvement
+// [Description] To ignore the limit checking for the Suppressed
+// Controls in TSE
+// [Files] numeric.c
+//
+// 9 3/21/11 12:39a Rajashakerg
+// [TAG] EIP53480
+// [Category] Improvement
+// [Description] FormBrowser extended actions support
+// [Files] callback.c, minisetupext.c, minisetupext.h, numeric.c,
+// PopupSel.c, PopupString.c, SubMenu.c, TseLiteCommon.c, UefiAction.c,
+// Hiicallback.c, TseUefiHii.h, Uefi21Wapper.c, HiiCallback.c
+//
+// 8 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 7 12/02/10 6:08p Madhans
+// [TAG] - EIP49562
+// [Category]- Improvment.
+// [Severity]- Mordarate
+// [Symptom]- Need to support UEFI 2.2 requirements related to Calling
+// Formcallback with
+// EFI_BROWSER_ACTION_CHANGING and EFI_BROWSER_ACTION_CHANGED action.
+// [Solution]- Implemented the support.
+// [Files] - submenu.c, numeric.c, popupsel.c, popupString.c,
+// uefi20\hii.h, uefi20\uefi20wrapper.c
+// uefi21\hiicalback.c, uefi21\tseuefihii.h
+//
+// 6 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 5 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 1/09/10 6:45a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 9/15/09 3:54p Madhans
+// // EIP: 26473 Fix To support uppercase Hex numbers
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 2 4/29/09 9:02p Madhans
+// Bug Fixes after unit Testing..
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: numeric.c
+//
+// Description: This file contains code to handle Label operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+NUMERIC_METHODS gNumeric =
+{
+ NumericCreate,
+ NumericDestroy,
+ NumericInitialize,
+ NumericDraw,
+ NumericHandleAction,
+ NumericSetCallback,
+ NumericSetFocus,
+ NumericSetPosition,
+ NumericSetDimensions,
+ NumericSetAttributes,
+ NumericGetControlHeight
+};
+BOOLEAN SingleClickActivation (VOID); //EIP-139608
+extern UINTN gInvalidRangeFailMsgBox;
+static BOOLEAN NumericIncDec = TRUE;
+BOOLEAN CheckKeyinHotKeysList(AMI_EFI_KEY_DATA Key);
+EFI_STATUS NumericHandleActionKeyMouse(NUMERIC_DATA *numeric, ACTION_DATA *Data);
+VOID NumSPrint(NUMERIC_DATA *numeric,NUMERIC_MIN_MAX_BASE Num);
+VOID UpdateNumericDisplayString (CHAR16 **, INT64, UINT8, UINT16, UINT16);
+VOID ClearNumericShiftState (AMI_EFI_KEY_DATA *);//EIP-83703
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericCreate
+//
+// Description: function used for Numeric control Create, which uses the Edit functions.
+//
+// Input: NUMERIC_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericCreate( NUMERIC_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(NUMERIC_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gEdit.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gNumeric;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericDestroy
+//
+// Description: function used to destroy Numeric controls, which uses the Edit functions.
+//
+// Input: NUMERIC_DATA **object, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericDestroy( NUMERIC_DATA *numeric, BOOLEAN freeMem )
+{
+ if(NULL == numeric )
+ return EFI_SUCCESS;
+
+ gEdit.Destroy( numeric, FALSE );
+
+ MemFreePointer( (VOID **)&numeric->Text );
+
+ if( freeMem )
+ MemFreePointer( (VOID **)&numeric );
+
+ return EFI_SUCCESS;
+}
+
+//EIP:60563 to support signed integers for NUMERIC opcode
+//EIP:60563 START
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: CheckForRange
+//
+// Description: function used to check the range for the negative numbers and positive nubmers.
+//
+// Input: NUMERIC_DATA *numeric, NUMERIC_VALUE_BASE *Num
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN CheckForRange(NUMERIC_DATA *numeric, NUMERIC_VALUE_BASE *Num)
+{
+ if(numeric->Base == 32)
+ {
+ if(numeric->ControlData.ControlDataWidth == 1)
+ {
+ if(((INT8)*Num < (INT8)numeric->MinValue) ||((INT8)*Num > (INT8)numeric->MaxValue))
+ return TRUE;
+ }
+ else if(numeric->ControlData.ControlDataWidth == 2)
+ {
+ if(((INT16)*Num < (INT16)numeric->MinValue) ||((INT16)*Num > (INT16)numeric->MaxValue))
+ return TRUE;
+ }
+ else if(numeric->ControlData.ControlDataWidth == 4)
+ {
+ if(((INT32)*Num < (INT32)numeric->MinValue) ||((INT32)*Num > (INT32)numeric->MaxValue))
+ return TRUE;
+ }
+ else if(numeric->ControlData.ControlDataWidth == 8)
+ {
+ if(((INT64)*Num < (INT64)numeric->MinValue) ||((INT64)*Num > (INT64)numeric->MaxValue))
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+ else
+ {
+ if(((*Num) < numeric->MinValue) ||(*Num > numeric->MaxValue))
+ return TRUE;
+ else
+ return FALSE;
+ }
+return FALSE;
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: CheckForRangefromsetup
+//
+// Description: function used to check the range for the negative numbers and positive nubmers from setup.
+//
+// Input: NUMERIC_DATA *numeric, NUMERIC_VALUE_BASE *Num
+//
+// Output: BOOLEAN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN CheckForRangefromsetup(NUMERIC_DATA *numeric, NUMERIC_VALUE_BASE *Num)
+{
+ if(numeric->Base == 32)
+ {
+ if(numeric->ControlData.ControlDataWidth == 1)
+ {
+ if(((INT8)*Num >= (INT8)numeric->MinValue) &&((INT8)*Num <= (INT8)numeric->MaxValue))
+ return TRUE;
+ }
+ else if(numeric->ControlData.ControlDataWidth == 2)
+ {
+ if(((INT16)*Num >= (INT16)numeric->MinValue) &&((INT16)*Num <= (INT16)numeric->MaxValue))
+ return TRUE;
+ }
+ else if(numeric->ControlData.ControlDataWidth == 4)
+ {
+ if(((INT32)*Num >= (INT32)numeric->MinValue) &&((INT32)*Num <= (INT32)numeric->MaxValue))
+ return TRUE;
+ }
+ else if(numeric->ControlData.ControlDataWidth == 8)
+ {
+ if(((INT64)*Num >= (INT64)numeric->MinValue) &&((INT64)*Num <= (INT64)numeric->MaxValue))
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+ else
+ {
+ if(((*Num) >= numeric->MinValue) &&(*Num <= numeric->MaxValue))
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ return FALSE;
+}
+//EIP:60563 END
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericInitialize
+//
+// Description: function used to Initialize the Numeric controls, which uses the Edit functions.
+//
+// Input: NUMERIC_DATA **object, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericInitialize( NUMERIC_DATA *numeric, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ NUMERIC_VALUE_BASE *Num;
+ VOID * ControlPtr = ((CONTROL_INFO *)data)->ControlPtr;
+ UINT16 Size = UefiGetWidth(ControlPtr);
+
+ // If the size 1 (it can hold upto 3 Decimal data +1 for null, is more then one the size * 3 is ok
+ numeric->TextWidth = (Size>1)?(3 * (UINT16)Size):4;
+
+ Status = gEdit.Initialize( numeric, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ //numeric->FGColor = EFI_YELLOW;
+ //numeric->BGColor = EFI_BACKGROUND_BLUE;
+ //numeric->TextWidth = numeric->TextAreaWidth;
+ numeric->Chr = 0x0;
+ numeric->MinValue = UefiGetMinValue(ControlPtr);//EIP:60563 to support signed integers for NUMERIC opcode
+ numeric->MaxValue = UefiGetMaxValue(ControlPtr);
+ numeric->Step = UefiGetStepValue(ControlPtr);
+ numeric->ControlData.ControlDataWidth = Size;
+ numeric->Base = UefiGetBaseValue(ControlPtr); // default base decimal number
+ numeric->Interval = (UINT8)(numeric->ControlData.ControlFlags.ControlRefresh);
+
+ Num = EfiLibAllocateZeroPool( (Size <sizeof(NUMERIC_MIN_MAX_BASE))? sizeof(NUMERIC_MIN_MAX_BASE):Size );
+
+ if ( Num != NULL )
+ {
+ VarGetValue( numeric->ControlData.ControlVariable,
+ UefiGetQuestionOffset(ControlPtr), Size, Num );
+
+ // check that value is in range
+ //EIP:60563 to support signed integers for NUMERIC opcode
+ if(CheckForRange( numeric, Num))
+ {
+ // try to use the default
+ if(numeric->ControlData.ControlDataWidth != 0)
+ {
+ VarGetDefaults( numeric->ControlData.ControlVariable,
+ UefiGetQuestionOffset(ControlPtr),
+ Size, Num );
+ }
+ }
+
+ if(*Num < numeric->MinValue)
+ *Num = numeric->MinValue;//revert to minimum value
+
+ if(*Num > numeric->MaxValue)
+ *Num =numeric->MaxValue;//revert to maximum value
+
+ numeric->Value = *Num;
+
+ MemFreePointer( (VOID **)&Num );
+ }
+
+ NumSPrint(numeric,numeric->Value);
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericDraw
+//
+// Description: function used to draw the numeric controls
+//
+// Input: NUMERIC_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericDraw(NUMERIC_DATA *numeric )
+{
+ NUMERIC_MIN_MAX_BASE *Num;
+ VOID * ControlPtr = numeric->ControlData.ControlPtr;
+
+ if(numeric->ControlActive == TRUE)
+ return gEdit.Draw( numeric );
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( numeric->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &numeric->ControlData ) )
+ {
+ case COND_NONE:
+ case COND_GRAYOUT:
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+
+ Num = EfiLibAllocateZeroPool((numeric->ControlData.ControlDataWidth<sizeof(NUMERIC_MIN_MAX_BASE))?sizeof(NUMERIC_MIN_MAX_BASE):numeric->ControlData.ControlDataWidth);
+
+ if ( Num != NULL )
+ {
+ VarGetValue( numeric->ControlData.ControlVariable,
+ UefiGetQuestionOffset(ControlPtr),
+ numeric->ControlData.ControlDataWidth, Num );
+
+ // check that value is in range
+ //EIP:60563 to support signed integers for NUMERIC opcode
+ if(CheckForRange(numeric, Num))
+ {
+ //Report Message box
+// CallbackShowMessageBox( (UINTN)gInvalidRangeFailMsgBox, MSGBOX_TYPE_OK );
+
+ // try to use the default
+ if(numeric->ControlData.ControlDataWidth != 0)
+ {
+ VarGetDefaults( numeric->ControlData.ControlVariable,
+ UefiGetQuestionOffset(ControlPtr),
+ numeric->ControlData.ControlDataWidth, Num );
+ }
+ if(*Num < numeric->MinValue)
+ *Num = numeric->MinValue;//revert to minimum value
+
+ if(*Num > numeric->MaxValue)
+ *Num =numeric->MaxValue;//revert to maximum value
+ }
+
+ numeric->Value = *Num;
+
+ MemFreePointer( (VOID **)&Num );
+ }
+
+ NumSPrint(numeric,numeric->Value);
+#if 0
+ /*To eliminate leading zeroes*/
+ Num = atoi( numeric->Text, numeric->Base );
+ SPrint( numeric->Text, numeric->TextAreaWidth, L"%d", Num);
+#endif
+ return gEdit.Draw( numeric );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericSetCallback
+//
+// Description: function used for setting Numeric control callback.
+//
+// Input: NUMERIC_DATA *numeric, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericSetCallback( NUMERIC_DATA *numeric, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gEdit.SetCallback( numeric, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericHandleAction
+//
+// Description: function used handle the Numeric controls
+//
+// Input: NUMERIC_DATA *numeric, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericHandleAction( NUMERIC_DATA *numeric, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ if(numeric->ControlActive)
+ return Status;
+
+ if (numeric->Interval == 0)
+ return Status;
+
+ if(IsActiveControlPresent(gApp->PageList[gApp->CurrentPage]))
+ return Status;
+
+ if ( --(numeric->Interval) == 0 )
+ {
+ // initialize the interval
+ numeric->Interval = (UINT8)(numeric->ControlData.ControlFlags.ControlRefresh);
+ return UefiRefershQuestionValueNvRAM(&(numeric->ControlData));
+ }
+ else
+ return Status;
+ }
+
+ if (( Data->Input.Type == ACTION_TYPE_KEY )||(Data->Input.Type == ACTION_TYPE_MOUSE))
+ return NumericHandleActionKeyMouse(numeric, Data);
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: CheckforIncrementandDecreament
+//
+// Description: function used handle the Numeric controls Increment and Decreament operation
+//
+// Input: NUMERIC_MIN_MAX_BASE *Num, NUMERIC_DATA *numeric, CONTROL_ACTION Action,UINT8 *bValueChanged
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID CheckforIncrementandDecreament(NUMERIC_MIN_MAX_BASE *Num, NUMERIC_DATA *numeric, CONTROL_ACTION Action,UINT8 *bValueChanged )
+{
+ if(ControlActionIncreament == Action)
+ {
+ if(AMI_BASE_INT_DEC == numeric->Base)
+ {
+ if(numeric->ControlData.ControlDataWidth == 1)
+ {
+ if ( ((INT8)*Num + (INT8)numeric->Step) <= (INT8)numeric->MaxValue )
+ {
+ *Num = *Num + (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+ }
+ }
+ else if(numeric->ControlData.ControlDataWidth == 2)
+ {
+ if ( ((INT16)*Num + (INT16)numeric->Step) <= (INT16)numeric->MaxValue )
+ {
+ *Num = *Num + (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+
+ }
+ }
+ else if(numeric->ControlData.ControlDataWidth == 4)
+ {
+ if ( ((INT32)*Num + (INT32)numeric->Step) <= (INT32)numeric->MaxValue )
+ {
+ *Num = *Num + (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+
+ }
+ }
+ else
+ {
+ if ( ((INT64)*Num + (INT64)numeric->Step) <= (INT64)numeric->MaxValue )
+ {
+ *Num = *Num + (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+
+ }
+ }
+
+ }
+ else
+ {
+ if ( *Num + numeric->Step <= numeric->MaxValue )
+ {
+ *Num = *Num + (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+ }
+ }
+ }
+ else
+ {
+ if(AMI_BASE_INT_DEC == numeric->Base)
+ {
+ if(numeric->ControlData.ControlDataWidth == 1)
+ {
+ if ( ((INT8)*Num - (INT8)numeric->Step) >= (INT8)numeric->MinValue)
+ {
+ *Num = *Num - (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+
+ }
+ }
+ else if(numeric->ControlData.ControlDataWidth == 2)
+ {
+ if ( ((INT16)*Num - (INT16)numeric->Step) >= (INT16)numeric->MinValue )
+ {
+ *Num = *Num - (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+
+ }
+ }
+ else if(numeric->ControlData.ControlDataWidth == 4)
+ {
+ if ( ((INT32)*Num - (INT32)numeric->Step) >= (INT32)numeric->MinValue)
+ {
+ *Num = *Num - (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+
+ }
+ }
+ else
+ {
+ if ( ((INT64)*Num - (INT64)numeric->Step) >= (INT64)numeric->MinValue )
+ {
+ *Num = *Num - (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+
+ }
+ }
+
+
+ }
+ else
+ {
+ if( *Num - numeric->Step >= numeric->MinValue )
+ {
+ *Num = *Num - (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ *bValueChanged = 1;
+ }
+ }
+
+ }
+
+
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericHandleActionKey
+//
+// Description: function used handle the Numeric control keys
+//
+// Input: NUMERIC_DATA *numeric, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericHandleActionKeyMouse(NUMERIC_DATA *numeric, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ CHAR16 Chr;
+ BOOLEAN DataOk = FALSE;
+ NUMERIC_MIN_MAX_BASE Num;
+ ACTION_DATA TempData;
+ CONTROL_ACTION Action;
+ AMI_EFI_KEY_DATA key;
+ VOID * ControlPtr = numeric->ControlData.ControlPtr;
+ UINT8 u8ChkResult;
+
+ u8ChkResult = CheckControlCondition( &numeric->ControlData );
+
+ //Not to perform action for control when token TSE_SETUP_GRAYOUT_SELECTABLE is enable to set focus for GrayoutIf control
+ if ( IsGrayoutSelectable() && (COND_GRAYOUT == u8ChkResult) ) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if(numeric->ControlData.ControlFlags.ControlReadOnly)
+ return EFI_UNSUPPORTED;
+
+ key = Data->Input.Data.AmiKey;
+ //Get mapping
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ {
+ Action = MapControlKeysHook(key);
+ }
+ else if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+ //EIP-123727 check whether MouseTop is within the Height and Width of Neumeric Control or not
+ if ( (ControlActionSelect == Action) &&
+ ( (Data->Input.Data.MouseInfo.Top >= (UINT32)numeric->Top) &&
+ (Data->Input.Data.MouseInfo.Top < (UINT32)(numeric->Top+numeric->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)numeric->Left) &&
+ (Data->Input.Data.MouseInfo.Left < (UINT32)(numeric->Left+numeric->Width))
+ )//EIP-139608 when mouse is clicked on numeric control and action is ControlActionSelect
+ )
+ {
+ Action = ControlActionSelect;
+ if(!TSEMouseIgnoreMouseActionHook())
+ {
+ if (numeric->Base == AMI_BASE_INT_DEC || numeric->Base == AMI_BASE_DEC)
+ NumericSoftKbdInit();
+ else if (numeric->Base == AMI_BASE_HEX || numeric->Base == AMI_BASE_OCT)
+ {
+ PrintableKeysSoftKbdInit();
+ }
+ }
+ }
+ //EIP-123727 Close softkbd if activatd when clicked/touch outside numeric
+ else if ( ((!((Data->Input.Data.MouseInfo.Top >= (UINT32)numeric->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(numeric->Top+numeric->Height))&& (Data->Input.Data.MouseInfo.Left >= (UINT32)numeric->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(numeric->Left+numeric->Width)))))
+ &&(TSEMouseIgnoreMouseActionHook())&&(( ControlMouseActionLeftDown== Action)||(ControlMouseActionLeftUp == Action))
+ )
+ {
+ if (numeric->Base == AMI_BASE_INT_DEC || numeric->Base == AMI_BASE_DEC)
+ NumericSoftKbdExit();
+ else if (numeric->Base == AMI_BASE_HEX || numeric->Base == AMI_BASE_OCT)
+ {
+ PrintableKeysSoftKbdExit();
+ }
+
+ gAction.ClearAction( Data );
+ return EFI_UNSUPPORTED;
+ }
+
+ //If mouse clicked outside numeric control area
+ else if ( ((Data->Input.Data.MouseInfo.Top < (UINT32)numeric->Top) ||
+ (Data->Input.Data.MouseInfo.Top > (UINT32)(numeric->Top+numeric->Height)) ||
+ (Data->Input.Data.MouseInfo.Left < (UINT32)numeric->Left) ||
+ (Data->Input.Data.MouseInfo.Left > (UINT32)(numeric->Left+numeric->Width))
+ )&& ( (ControlActionSelect == Action) && SingleClickActivation() ) //EIP-139608
+ )
+ {
+ return EFI_UNSUPPORTED;
+ }
+
+ //If mouse clicked in numeric control area including multi-line string also don't consume mouse action in numeric side.
+ else if ((Data->Input.Data.MouseInfo.Top >= (UINT32)numeric->Top) &&
+ (Data->Input.Data.MouseInfo.Top < (UINT32)(numeric->Top+numeric->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)numeric->Left) &&
+ (Data->Input.Data.MouseInfo.Left < (UINT32)(numeric->Left+numeric->Width))&&
+ (numeric->ControlActive)
+ )
+ {
+ return EFI_UNSUPPORTED;
+ }
+
+ }
+
+ switch(Action)
+ {
+ case ControlActionSelect:
+ // check that the data is proper.
+ if((numeric->Text[0] ==0x0)||((numeric->Base == AMI_BASE_INT_DEC)&&(L'-' == numeric->Text[0])&&( EfiStrStr(numeric->Text+1, L"-"))))
+ NumSPrint(numeric,numeric->MinValue);
+
+ Num = (NUMERIC_MIN_MAX_BASE)atoi( numeric->Text, numeric->Base );
+
+ //EIP:60563 to support signed integers for NUMERIC opcode
+ if ( CheckForRangefromsetup( numeric, &Num) )
+ {
+ if ( ( numeric->Callback != NULL ) && ( numeric->Cookie != NULL ) )
+ {
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)numeric->Cookie;
+
+ callbackData->Variable = numeric->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ControlPtr);
+ callbackData->Length = UefiGetWidth(ControlPtr);
+ callbackData->Data = (VOID *)&Num;
+ // To support UEFI 2.1.C spec to Not to update the control when Callback fails.
+ UefiPreControlUpdate(&(numeric->ControlData));
+ numeric->Callback( numeric->Container,numeric, numeric->Cookie );
+ }
+
+ {
+ if(UefiIsInteractive(&numeric->ControlData))
+ {
+ VOID * Handle=numeric->ControlData.ControlHandle;
+ UINT16 Key = UefiGetControlKey(&(numeric->ControlData));
+ CONTROL_DATA *Control;
+
+ Status = CallFormCallBack(&(numeric->ControlData), Key, 0, AMI_CALLBACK_CONTROL_UPDATE);//EIP-53480: Updated the action to AMI_CALLBACK_CONTROL_UPDATE
+ Control = GetUpdatedControlData((CONTROL_DATA*)numeric,CONTROL_TYPE_NUMERIC,Handle,Key);
+
+ if(Control == NULL) // Control deleted ?
+ return EFI_SUCCESS;
+ if(Control != (CONTROL_DATA*)numeric)
+ numeric = (NUMERIC_DATA*)Control; //control Updated
+
+ }
+ }
+
+ Status = EFI_SUCCESS;
+ numeric->ControlActive = FALSE;
+ if(((Data->Input.Type == ACTION_TYPE_KEY))&&(TSEMouseIgnoreMouseActionHook() == TRUE)&& (TRUE == NumericIncDec))
+ {
+ if (numeric->Base == AMI_BASE_INT_DEC || numeric->Base == AMI_BASE_DEC)
+ NumericSoftKbdExit();
+ else if (numeric->Base == AMI_BASE_HEX || numeric->Base == AMI_BASE_OCT)
+ {
+ PrintableKeysSoftKbdExit();
+ }
+ }
+ else if(!NumericIncDec)
+ {
+ NumericIncDec = TRUE;
+ }
+ }
+ else
+ {
+ //Report Message box
+ CallbackShowMessageBox( (UINTN)gInvalidRangeFailMsgBox, MSGBOX_TYPE_OK );
+ Data->Input.Type = ACTION_TYPE_KEY;//EIP 83703 : Providing the input type as key such that it can be consumed in edithandleaction
+ Data->Input.Data.AmiKey.Key.ScanCode = SCAN_ESC;
+ Data->Input.Data.AmiKey.Key.UnicodeChar = L'\0';
+ ClearNumericShiftState(&(Data->Input.Data.AmiKey));//EIP-83703
+ //Data->Input.Data.AmiKey.KeyState.KeyShiftState = 0;//EIP 83703 : providing the key shiftstate
+ DataOk = TRUE;
+ }
+ break;
+
+ case ControlActionBackSpace:
+ DataOk = TRUE;
+ break;
+
+ case ControlActionIncreament:
+ case ControlActionDecreament:
+ if ( ( numeric->Step != 0 ) && ( ! numeric->ControlActive ))
+ {
+ UINT8 bValueChanged = 0;
+
+ Num = (NUMERIC_MIN_MAX_BASE)atoi( numeric->Text, numeric->Base );
+ if ( ControlActionIncreament == Action )
+ {
+ if(Num == numeric->MaxValue);
+ else
+ CheckforIncrementandDecreament(&Num,numeric,Action,&bValueChanged);
+ /* if ( Num + numeric->Step <= numeric->MaxValue )
+ {
+ Num = Num + (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ bValueChanged = 1;
+ }*/
+ }
+ else if ( ControlActionDecreament == Action )
+ {
+ if(Num == numeric->MinValue);
+ else
+ CheckforIncrementandDecreament(&Num,numeric,Action,&bValueChanged);
+ /* if( Num - numeric->Step >= numeric->MinValue )
+ {
+ Num = Num - (NUMERIC_MIN_MAX_BASE)numeric->Step;
+ bValueChanged = 1;
+ }*/
+ }
+
+ NumSPrint(numeric,Num);
+ NumericIncDec = FALSE;
+ if((bValueChanged)&& CheckForRangefromsetup( numeric, &Num))
+ {
+ MemCopy(&TempData,Data,sizeof(ACTION_DATA));
+ TempData.Input.Data.AmiKey.Key.ScanCode = 0;
+ TempData.Input.Data.AmiKey.Key.UnicodeChar = CHAR_CARRIAGE_RETURN;
+ ClearNumericShiftState(&(TempData.Input.Data.AmiKey));//EIP-92407 Clearing the Shiftstate before invoking numerichandleaction with CHAR_CARRIAGE_RETURN
+ gNumeric.HandleAction(numeric,&TempData);
+ }
+ // Data updated to variables Now draw it in the screen.
+ Status = gNumeric.Draw( numeric );
+ }
+ else if( ( numeric->ControlActive )&&(numeric->Base == AMI_BASE_INT_DEC))
+ {
+ DataOk = TRUE;
+ }
+
+ break;
+
+ case ControlActionAlpha:
+ case ControlActionNumeric:
+ Chr = key.Key.UnicodeChar;
+ switch ( numeric->Base )
+ {
+ case AMI_BASE_BIN:
+ if ( ( Chr == L'0' ) || ( Chr == L'1' ) )
+ DataOk = TRUE;
+ break;
+
+ case AMI_BASE_OCT:
+ if ( ( Chr <= L'7' ) && ( Chr >= L'0' ) )
+ DataOk = TRUE;
+ break;
+
+ case AMI_BASE_DEC:
+ case AMI_BASE_INT_DEC:
+ if ( ( Chr <= L'9' ) && ( Chr >= L'0' ) )
+ DataOk = TRUE;
+ break;
+
+ case AMI_BASE_HEX:
+ // EIP: 26473 To support uppercase Hex numbers
+ if ( ( ( Chr <= L'9' ) && ( Chr >= L'0' ) ) || ( ( Chr >= L'a' ) && ( Chr <= L'f' ) ) || ( ( Chr >= L'A' ) && ( Chr <= L'F' ) ))
+
+ DataOk = TRUE;
+ break;
+ }
+ break;
+
+ case ControlActionNextUp:
+ case ControlActionNextDown:
+ case ControlActionNextLeft:
+ case ControlActionNextRight:
+ if ( numeric->ControlActive )
+ {
+ MemCopy(&TempData,Data,sizeof(ACTION_DATA));
+ TempData.Input.Data.AmiKey.Key.ScanCode = 0;
+ TempData.Input.Data.AmiKey.Key.UnicodeChar = CHAR_CARRIAGE_RETURN;
+ ClearNumericShiftState(&(TempData.Input.Data.AmiKey));//EIP-92407 Clearing the Shiftstate before invoking numerichandleaction with CHAR_CARRIAGE_RETURN
+ gNumeric.HandleAction(numeric,&TempData);
+ }
+ break;
+
+ default:
+ if ( numeric->ControlActive )
+ {
+ MemCopy(&TempData,Data,sizeof(ACTION_DATA));
+ TempData.Input.Type = ACTION_TYPE_KEY;
+ TempData.Input.Data.AmiKey.Key.ScanCode = 0;
+ TempData.Input.Data.AmiKey.Key.UnicodeChar = CHAR_CARRIAGE_RETURN;
+ ClearNumericShiftState(&(TempData.Input.Data.AmiKey));//EIP-83703
+ //TempData.Input.Data.AmiKey.KeyState.KeyShiftState = 0;
+ gNumeric.HandleAction(numeric,&TempData);
+ }
+ // Only Alpha Numeric chars are allowed. Other Special printable chars not allowed.
+ if(Data->Input.Data.AmiKey.Key.ScanCode)
+ DataOk = TRUE;
+ break;
+ }
+
+ if ( DataOk )
+ Status = gEdit.HandleAction( numeric, Data );
+
+ if((((!numeric->ControlActive)||(!IsMouseClickedonSoftkbd())) && (TSEMouseIgnoreMouseActionHook() == TRUE) )
+ && (((Data->Input.Type == ACTION_TYPE_KEY) && ((Action == ControlActionNextLeft) ||(Action == ControlActionNextRight) ||(Action == ControlActionNextUp) ||(Action == ControlActionNextDown) ||(Action == ControlActionPageUp) ||(Action == ControlActionPageDown) ||(Action == ControlActionAbort) ||(Action == ControlActionHome) ||(Action == ControlActionEnd) ||(CheckKeyinHotKeysList(key))) )
+ || ((Data->Input.Type == ACTION_TYPE_MOUSE)&&((!((Data->Input.Data.MouseInfo.Top >= (UINT32)numeric->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(numeric->Top+numeric->Height))&& (Data->Input.Data.MouseInfo.Left >= (UINT32)numeric->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(numeric->Left+numeric->Width))))||(Action == ControlActionAbort))))
+ )
+ {
+ if (numeric->Base == AMI_BASE_INT_DEC || numeric->Base == AMI_BASE_DEC)
+ NumericSoftKbdExit();
+ else if (numeric->Base == AMI_BASE_HEX || numeric->Base == AMI_BASE_OCT)
+ {
+ PrintableKeysSoftKbdExit();
+ }
+ }
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: NUMERIC_DATA *numeric, BOOLEAN focus
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericSetFocus( NUMERIC_DATA *numeric, BOOLEAN focus )
+{
+ UINT8 u8ChkResult;
+
+ if(focus != FALSE)
+ {
+ u8ChkResult = CheckControlCondition( &numeric->ControlData );
+
+ //Setting focus to control which has no control-condtion and token TSE_SETUP_GRAYOUT_SELECTABLE is enable to set focus for GrayoutIf control
+ if ( ((u8ChkResult != COND_NONE) && (u8ChkResult != COND_GRAYOUT)) ||
+ (!IsGrayoutSelectable() && (u8ChkResult == COND_GRAYOUT))
+ ){
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+
+ if( !(numeric->ControlFocus && focus) )
+ numeric->ControlFocus = focus;
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericSetPosition
+//
+// Description: Function to set position.
+//
+// Input: NUMERIC_DATA *numeric, UINT16 Left, UINT16 Top
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericSetPosition(NUMERIC_DATA *numeric, UINT16 Left, UINT16 Top )
+{
+ return gEdit.SetPosition( numeric, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericSetDimensions
+//
+// Description: Function to set dimensions.
+//
+// Input: NUMERIC_DATA *numeric, UINT16 Width, UINT16 Height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericSetDimensions(NUMERIC_DATA *numeric, UINT16 Width, UINT16 Height )
+{
+ return gEdit.SetDimensions( numeric, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericSetAttributes
+//
+// Description: Function to set attributes.
+//
+// Input: NUMERIC_DATA *numeric, UINT8 FGColor, UINT8 BGColor
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericSetAttributes(NUMERIC_DATA *numeric, UINT8 FGColor, UINT8 BGColor )
+{
+ return gEdit.SetAttributes( numeric, FGColor, BGColor );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumericGetControlHeight
+//
+// Description: Function to get label height.
+//
+// Input: NUMERIC_DATA *numeric, UINT16 Width, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS NumericGetControlHeight(NUMERIC_DATA *numeric, VOID* frame , UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width;
+
+ Width = (UINT16)(((EDIT_DATA *)numeric)->TextMargin - (((FRAME_DATA*)frame)->FrameData.Left + (UINT8)gControlLeftPad));
+ text = HiiGetString( numeric->ControlData.ControlHandle, UefiGetPromptField((VOID *)numeric->ControlData.ControlPtr));
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ newText = StringWrapText( text, Width, height );
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+ }
+ else
+ {
+ *height =1;
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: NumSPrint
+//
+// Description: Function to print nums.
+//
+// Input: NUMERIC_DATA *numeric,NUMERIC_MIN_MAX_BASE Num
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID NumSPrint(NUMERIC_DATA *numeric,NUMERIC_MIN_MAX_BASE Num)
+{
+ switch(numeric->Base)
+ {
+ case AMI_BASE_HEX:
+ SPrint( numeric->Text, numeric->TextWidth*sizeof(CHAR16), L"%lx", Num );
+ break;
+ case AMI_BASE_INT_DEC:
+ if(numeric->ControlData.ControlDataWidth == 1)
+ {
+ if((INT8)Num < 0)
+ {
+ SPrint( numeric->Text, numeric->TextWidth*sizeof(CHAR16), L"%d", (INT8)Num );
+ break;
+ }
+ }
+ else if(numeric->ControlData.ControlDataWidth == 2)
+ {
+ if((INT16)Num < 0)
+ {
+ SPrint( numeric->Text, numeric->TextWidth*sizeof(CHAR16), L"%d", (INT16)Num );
+ break;
+ }
+ }
+ else if(numeric->ControlData.ControlDataWidth == 4)
+ {
+ if((INT32)Num < 0)
+ {
+ SPrint( numeric->Text, numeric->TextWidth*sizeof(CHAR16), L"%d", (INT32)Num );
+ break;
+ }
+ }
+ else if(numeric->ControlData.ControlDataWidth == 8)
+ {
+ if((INT64)Num < 0)
+ {
+ SPrint( numeric->Text, numeric->TextWidth*sizeof(CHAR16), L"%ld", (INT64)Num );
+ break;
+ }
+ }
+ SPrint( numeric->Text, numeric->TextWidth*sizeof(CHAR16), L"%d", Num );
+ break;
+ case AMI_BASE_DEC:
+ default:
+ SPrint( numeric->Text, numeric->TextWidth*sizeof(CHAR16), L"%ld", Num );
+ break;
+ }
+ UpdateNumericDisplayString (&(numeric->Text), Num, numeric->Base, numeric->ControlData.ControlDataWidth, numeric->TextWidth*sizeof(CHAR16)); //EIP66976 Provision to change the Numeric string format
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/numeric.h b/EDK/MiniSetup/TseLite/numeric.h
new file mode 100644
index 0000000..ccee7d8
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/numeric.h
@@ -0,0 +1,224 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/numeric.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 12 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/numeric.h $
+//
+// 12 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 11 4/05/12 7:18a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 10 11/20/11 8:03a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 9 10/21/11 2:55a Rajashakerg
+// [TAG] EIP60563
+// [Category] New Feature
+// [Description] Updating the file with fix for issue : maximum 8 byte
+// value shows negative number
+// [Files] numeric.c, numeric.h, string.c, string.h
+//
+// 8 6/20/11 12:23p Rajashakerg
+// [TAG] EIP60563
+// [Category] New Feature
+// [Description] Support for signed decimal value for
+// EFI_IFR_NUMERIC_OP.
+// [Files] numeric.c, numeric.h, string.c, string.h, Uefi21Wapper.c
+//
+// 7 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: numeric.h
+//
+// Description: Header file for numeric control
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _NUMERIC_H_
+#define _NUMERIC_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+#include "action.h"
+#include "MessageBox.h"
+
+#define AMI_BASE_BIN 2
+#define AMI_BASE_OCT 8
+#define AMI_BASE_DEC 10
+#define AMI_BASE_HEX 16
+#define AMI_BASE_INT_DEC 32
+
+#define NUMERIC_MIN_MAX_BASE UINT64 //EIP:60563 to support signed integers for NUMERIC opcode
+#define NUMERIC_VALUE_BASE UINT64
+#define NUMERIC_MEMBER_VARIABLES \
+ UINT8 Base; \
+ NUMERIC_MIN_MAX_BASE MinValue; \
+ NUMERIC_MIN_MAX_BASE MaxValue; \
+ NUMERIC_VALUE_BASE Value; \
+ NUMERIC_MIN_MAX_BASE Step; \
+ UINT8 Interval;
+
+
+typedef struct _NUMERIC_METHODS NUMERIC_METHODS;
+
+typedef struct _NUMERIC_DATA
+{
+ NUMERIC_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ EDIT_MEMBER_VARIABLES
+ NUMERIC_MEMBER_VARIABLES
+}
+NUMERIC_DATA;
+#define NUMERIC_METHOD_FUNCTIONS
+
+
+struct _NUMERIC_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ EDIT_METHOD_FUNCTIONS
+ NUMERIC_METHOD_FUNCTIONS
+};
+
+extern NUMERIC_METHODS gNumeric;
+
+// Object Methods
+EFI_STATUS NumericCreate( VOID **object );
+EFI_STATUS NumericDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS NumericInitialize( VOID *object, VOID *data );
+EFI_STATUS NumericDraw( VOID *object );
+EFI_STATUS NumericHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS NumericSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS NumericSetFocus( VOID *object, BOOLEAN focus);
+EFI_STATUS NumericSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS NumericSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS NumericSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS NumericGetControlHeight(VOID *object, VOID *frame, UINT16 *height);
+#endif /* _NUMERIC_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/object.c b/EDK/MiniSetup/TseLite/object.c
new file mode 100644
index 0000000..24461eb
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/object.c
@@ -0,0 +1,211 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/object.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 4 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/object.c $
+//
+// 4 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 6 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 3 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 4 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Object.c
+//
+// Description: This file contains code to handle Objects
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+OBJECT_METHODS gObject =
+{
+ ObjectCreate,
+ ObjectDestroy,
+ ObjectInitialize,
+ ObjectDraw,
+ ObjectHandleAction,
+ ObjectSetCallback
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ObjectCreate
+//
+// Description: function to create an object
+//
+// Input: OBJECT_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ObjectCreate( OBJECT_DATA **object )
+{
+ if ( *object == NULL )
+ *object = EfiLibAllocateZeroPool( sizeof(OBJECT_DATA) );
+
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ (*object)->Methods = &gObject;
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ObjectDestroy
+//
+// Description: function to Destroy an object
+//
+// Input: OBJECT_DATA **object, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ObjectDestroy( OBJECT_DATA *object, BOOLEAN freeMem )
+{
+ if ( freeMem )
+ MemFreePointer( (VOID **)&object );
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ObjectInitialize
+//
+// Description: Function to initialize an object
+//
+// Input: OBJECT_DATA *object, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ObjectInitialize( OBJECT_DATA *object, VOID *data )
+{
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ObjectDraw
+//
+// Description: Function to draw an object
+//
+// Input: OBJECT_DATA *object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ObjectDraw( OBJECT_DATA *object )
+{
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ObjectHandleAction
+//
+// Description: Function to handle object action
+//
+// Input: OBJECT_DATA *object, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ObjectHandleAction( OBJECT_DATA *object, ACTION_DATA *Data )
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ObjectSetCallback
+//
+// Description: Function to set object callback
+//
+// Input: OBJECT_DATA *object, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS ObjectSetCallback( OBJECT_DATA *object, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ object->Callback = callback;
+ object->Container = container,
+ object->Cookie = cookie;
+
+ return EFI_SUCCESS;
+}
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/object.h b/EDK/MiniSetup/TseLite/object.h
new file mode 100644
index 0000000..7045bfd
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/object.h
@@ -0,0 +1,144 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/object.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 5 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/object.h $
+//
+// 5 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 7 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 6/24/09 6:11p Madhans
+// Made TSE_USE_EDK_LIBRARY=OFF to not to refer EDK module.
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Object.h
+//
+// Description: Header file for code to handle Objects
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _OBJECT_H_
+#define _OBJECT_H_
+
+//#include "Tiano.h"
+//#include "EfiDriverLib.h"
+#include "Minisetup.h"
+#include "action.h"
+#include "callback.h"
+
+typedef VOID (*OBJECT_CALLBACK) ( VOID *container, VOID *object, VOID *cookie );
+
+#define OBJECT_MEMBER_VARIABLES \
+ OBJECT_CALLBACK Callback; \
+ VOID *Container; \
+ VOID *Cookie;
+
+typedef struct _OBJECT_METHODS OBJECT_METHODS;
+
+typedef struct _OBJECT_DATA
+{
+ OBJECT_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+}
+OBJECT_DATA;
+
+typedef EFI_STATUS (*OBJECT_METHOD_CREATE) ( VOID **object );
+typedef EFI_STATUS (*OBJECT_METHOD_DESTROY) ( VOID *object, BOOLEAN freeMem );
+typedef EFI_STATUS (*OBJECT_METHOD_INITIALIZE) ( VOID *object, VOID *data );
+typedef EFI_STATUS (*OBJECT_METHOD_DRAW) ( VOID *object );
+typedef EFI_STATUS (*OBJECT_METHOD_HANDLE_ACTION) ( VOID *object, ACTION_DATA *Data );
+typedef EFI_STATUS (*OBJECT_METHOD_SET_CALLBACK) ( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+#define OBJECT_METHOD_FUNCTIONS \
+ OBJECT_METHOD_CREATE Create; \
+ OBJECT_METHOD_DESTROY Destroy; \
+ OBJECT_METHOD_INITIALIZE Initialize; \
+ OBJECT_METHOD_DRAW Draw; \
+ OBJECT_METHOD_HANDLE_ACTION HandleAction; \
+ OBJECT_METHOD_SET_CALLBACK SetCallback;
+
+struct _OBJECT_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+};
+
+extern OBJECT_METHODS gObject;
+
+EFI_STATUS ObjectCreate( VOID **object );
+EFI_STATUS ObjectDestroy( VOID *object, BOOLEAN freeMem );
+
+EFI_STATUS ObjectInitialize( VOID *object, VOID *data );
+EFI_STATUS ObjectDraw( VOID *object );
+EFI_STATUS ObjectHandleAction( VOID *object, ACTION_DATA *Data );
+EFI_STATUS ObjectSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+#endif /* _OBJECT_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/ordlistbox.c b/EDK/MiniSetup/TseLite/ordlistbox.c
new file mode 100644
index 0000000..4d388e1
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/ordlistbox.c
@@ -0,0 +1,1080 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2013, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ordlistbox.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 22 $
+//
+// $Date: 5/01/14 3:44p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ordlistbox.c $
+//
+// 22 5/01/14 3:44p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 21 7/03/13 10:29a Premkumara
+// [TAG] EIP127000
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] After suppressing any of items in orderlist, the listbox is
+// showing blank space. If items are changing using +/- then Empty list
+// item appear
+// [RootCause] Since items are suppressing in listbox and the
+// listbox->ItemCount, listbox->Sel, listbox options value and ptrtoken
+// value are not updated properly
+// [Solution] Handling orderedlistbox items and itemcount properly after
+// items are suppressed
+// [Files] OrdListBox.c
+// -$/Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ordlistbox.c (ver
+// 20)
+//
+// 20 7/02/13 10:19a Premkumara
+// [TAG] EIP127000
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] After suppressing any of items in orderlist, the listbox is
+// showing blank space. If items are changing using +/- then Empty list
+// item appear
+// [RootCause] Since items are suppressing in listbox and the
+// listbox->ItemCount, listbox->Sel, listbox options value and ptrtoken
+// value are not updated properly
+// [Solution] Handling orderedlistbox items and itemcount properly after
+// items are suppressed
+// [Files] OrdListBox.c
+//
+// 19 10/18/12 8:58a Rajashakerg
+// [TAG] EIP103568
+// [Category] Improvement
+// [Description] Help string support for ordered list
+// [Files] Uefi21Wapper.c, ordlistbox.c
+//
+// 18 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 17 5/28/12 12:35p Premkumara
+// [TAG] EIP67049 & 90224
+// [Category] New Feature
+// [Description] Support mouse drag operation in frame and list box
+// [Files] CommonHelper.c, Frame.c, ListBox.c, Minisetupext
+//
+// 16 5/09/12 1:37p Arunsb
+// [TAG] EIP86885
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] ISCSI attempt order is not changing on setup
+// [RootCause] Orderlist maxcontainers value and ordered list size not
+// handled properly
+// [Solution] Orderlist maxcontainers value is 0xff, but TSE changed the
+// cache value for only the added attempts(dynamic orderlist creation)
+// remaining buffer left as is, Now the remaining buffers made as 0.
+// [Files] HiiCallback.c and ordlistbox.
+//
+// 15 2/03/12 4:45a Rajashakerg
+// [TAG] EIP75066
+// [Category] Improvement
+// [Description] _OrdListGetSelection logic changed to support the
+// special controls(Boot Order).
+// [Files] Ordlistbox.c, Uefi21Wapper.c, CtrlCond.c, HiiCallback.c,
+// Parse.c, Uefi20Wapper.c and TseUefihiil.h
+//
+// 14 2/02/12 2:50a Premkumara
+// [TAG] EIP75066
+// [Category] Improvement
+// [Description] Support loading defaults for Ordelist controls
+// [Files] Ordlistbox.c, Uefi21Wapper.c, CtrlCond.c, HiiCallback.c,
+// Parse.c, Uefi20Wapper.c, TseUefihiil.h
+//
+// 13 2/01/12 1:49a Arunsb
+// [TAG] EIP74968
+// [Category] Improvement
+// [Description] Support for mouse drag and drop to rearrange the items
+// in the Orderlist.
+// [Files] Ordlistbox.c, commonoem.c and commonoem.h
+//
+// 12 12/10/11 4:45a Arunsb
+// Header corrected
+//
+// 11 12/01/11 7:42a Arunsb
+// [TAG] EIP70966
+// UefiGetValidOptionSize fnc declaration added for avoiding build error
+// in 2.0.
+//
+// 10 11/28/11 4:59a Rajashakerg
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Callback handling :For interactive controls updating
+// the currnet vaule in cache even when hii callback returns error status.
+// [Files] Date.c, SubMenu.c, ordlistbox.c, time.c, UefiAction.c,
+// hii.h, uefi20Wapper.c, HiiCallback.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 9 11/21/11 11:18a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 8 11/21/11 8:54a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupSel.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 7 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 6 11/03/11 4:29a Premkumara
+// [TAG] EIP70966
+// [Category] Improvement
+// [Description] Hii orderlist item can't update priority from value in
+// Setup menu for both enable and disable TSE_MULTILINE_CONTROLS token
+// [Files] Ordlistbox.c, ordlistbox.h, TseUefiHii.h, Uefi21Wrapper.c
+//
+// 5 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 4 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 3 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 2/17/10 7:03p Madhans
+// To suppor readonly control
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:12p Madhans
+// TSE Lite Special control support
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: orderlistbox.c
+//
+// Description: This file contains code to handle ordered list box controls
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+VOID _PopupSelGetSelection( POPUPSEL_DATA *popupSel );
+EFI_STATUS _OrdListMultiLIneDraw(ORD_LISTBOX_DATA *OrdList);
+UINT16 gOrderlistcount;
+extern BOOLEAN lButtonOnListBoxScroll;//EIP-67049
+
+ORD_LISTBOX_METHODS gOrdListBox =
+{
+ OrdListBoxCreate,
+ OrdListBoxDestroy,
+ OrdListBoxInitialize,
+ OrdListBoxDraw,
+ OrdListBoxHandleAction,
+ OrdListBoxSetCallback,
+ OrdListBoxSetFocus,
+ OrdListBoxSetPosition,
+ OrdListBoxSetDimensions,
+ OrdListBoxSetAttributes,
+ OrdListGetControlHeight
+};
+VOID UefiGetValidOptionType(CONTROL_INFO *CtrlInfo, UINTN *Type, UINT32 *SizeOfData);
+BOOLEAN FirstDownEvent = FALSE; //EIP74968 Change Order in Orderlist using Mouse drag
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxCreate
+//
+// Description: function to Create a Order List Box, which uses the PopupSel Fucntions
+//
+// Input: ORD_LISTBOX_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxCreate( ORD_LISTBOX_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(ORD_LISTBOX_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gPopupSel.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gOrdListBox;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxDestroy
+//
+// Description: function to Destroy a Order List Box, which uses the PopupSel Fucntions
+//
+// Input: ORD_LISTBOX_DATA *listbox, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxDestroy( ORD_LISTBOX_DATA *listbox, BOOLEAN freeMem )
+{
+ if(NULL == listbox)
+ return EFI_SUCCESS;
+
+ gPopupSel.Destroy( listbox, FALSE );
+
+ if( freeMem )
+ {
+ MemFreePointer( (VOID **)&(listbox->PtrTokens) );
+ MemFreePointer( (VOID **)&listbox );
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxDestroy
+//
+// Description: function to initialize a Order List Box, which uses the PopupSel Fucntions
+//
+// Input: ORD_LISTBOX_DATA *listbox, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxInitialize( ORD_LISTBOX_DATA *listbox, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gPopupSel.Initialize( listbox, data );
+// _OrdListGetSelection(listbox); // make sure data is correct.
+ listbox->ControlData.ControlHelp = UefiGetHelpField(listbox->ControlData.ControlPtr);//EIP:103568 Updated the Help field for order list control.
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxDraw
+//
+// Description: function to draw a ordered List Box
+//
+// Input: ORD_LISTBOX_DATA *listbox
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxDraw( ORD_LISTBOX_DATA *listbox )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ Status = _OrdListMultiLIneDraw(listbox); //EIP-70966 Draw OrderListBox
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: UpdateOrderlistcount
+//
+// Description: Function to update the orderlist count.
+//
+// Input: UINT16 ItemCount
+//
+// Output: VOID
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _UpdateOrderlistcount(UINT16 ItemCount)
+{
+ gOrderlistcount = ItemCount;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DoOrdListCallBack
+//
+// Description: Call back function of ordered List Box
+//
+// Input: ORD_LISTBOX_DATA *listbox
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DoOrdListCallBack(ORD_LISTBOX_DATA *listbox)
+{
+ UINT8 i=0;
+ VOID *Data = (VOID *)NULL; //EIP70966
+
+ if ( listbox->Cookie != NULL )
+ {
+ VOID *ifrData = listbox->ControlData.ControlPtr;
+ CALLBACK_VARIABLE *callbackData = (CALLBACK_VARIABLE *)listbox->Cookie;
+
+ callbackData->Variable = listbox->ControlData.ControlVariable;
+ callbackData->Offset = UefiGetQuestionOffset(ifrData);
+ callbackData->Length = UefiGetMaxEntries(ifrData);
+
+ if( (listbox->ControlData.ControlVariable == VARIABLE_ID_BOOT_ORDER) ||
+ (listbox->ControlData.ControlVariable == VARIABLE_ID_BBS_ORDER) )
+ {
+ // Special Handling for Boot Order variable change
+ Data = (UINT8*)EfiLibAllocateZeroPool( listbox->ItemCount * sizeof(UINT16) );
+ for(i=0;i<listbox->ItemCount;i++)
+ ((UINT16*)Data)[i] = (UINT16)(listbox->PtrTokens[i].Value);
+ callbackData->Length = listbox->ItemCount * sizeof(UINT16);
+ }
+ else
+ {
+ //EIP70966_START
+ UINT32 sizeOfData = 0;
+ UINTN type = 0;
+ UINT8 *tempData = (UINT8 *)NULL;
+
+ //To find the Type and Size of OrderList based on EFI_IFR_TYPE
+ UefiGetValidOptionType(&listbox->ControlData, &type, &sizeOfData);
+
+ Data = (UINT8*)EfiLibAllocateZeroPool( listbox->ItemCount * sizeOfData);
+ tempData = Data;
+
+ for(i=0;i<listbox->ItemCount;i++)
+ {
+ //Data[i] = (UINT8)(listbox->PtrTokens[i].Value);
+ //Copy Data based on EFI_IFR_TYPE and Size
+ MemCopy(tempData, &listbox->PtrTokens[i].Value, sizeOfData);
+ tempData = (UINT8 *)tempData + sizeOfData;
+ }
+ //Fix the length of Data based on EFI_IFR_TYPE
+ callbackData->Length = UefiGetMaxEntries(ifrData) * sizeOfData;
+ if (callbackData->Length > (listbox->ItemCount * sizeOfData)) //EIP86885, Filling all the dynamic forming datas with 0's
+ {
+ Data = MemReallocateZeroPool (Data, (listbox->ItemCount * sizeOfData), callbackData->Length);
+ }
+ //EIP70966_END
+ }
+
+ callbackData->Data = Data; //must send actual array of UINT8 values
+ }
+ _UpdateOrderlistcount(listbox->ItemCount); //Initializing gOrderlistcount
+ UefiPreControlUpdate(&(listbox->ControlData));
+ listbox->Callback( listbox->Container, listbox, listbox->Cookie );
+
+ //For interactive orderedlist control invoke the callback functions
+ if(UefiIsInteractive(&listbox->ControlData)){
+ EFI_STATUS Status = EFI_SUCCESS;
+ Status = CallFormCallBack(&listbox->ControlData, UefiGetControlKey(&listbox->ControlData), FALSE, AMI_CALLBACK_CONTROL_UPDATE);
+ }
+ //_OrdListGetSelection(listbox);
+
+ if(Data!=NULL)
+ MemFreePointer((VOID **)&Data);
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxHandleAction
+//
+// Description: Function to handle the ordered List Box actions
+//
+// Input: ORD_LISTBOX_DATA *listbox, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxHandleAction( ORD_LISTBOX_DATA *listbox, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT8 i=0;
+ CONTROL_ACTION Action;
+
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ // List box is active don't refresh
+ if ( listbox->ListBoxCtrl != NULL )
+ return Status;
+
+ if (listbox->Interval == 0)
+ return Status;
+
+ if(IsActiveControlPresent(gApp->PageList[gApp->CurrentPage]))
+ return Status;
+
+ if ( --(listbox->Interval) == 0 )
+ {
+ // initialize the interval
+ listbox->Interval = (UINT8)(listbox->ControlData.ControlFlags.ControlRefresh);
+ return UefiRefershQuestionValueNvRAM(&(listbox->ControlData));
+ }
+ else
+ return Status;
+ }
+
+ if(listbox->ControlData.ControlFlags.ControlReadOnly)
+ return EFI_UNSUPPORTED;
+
+ if(!listbox->ControlFocus)
+ return Status;
+
+ if(Data->Input.Type == ACTION_TYPE_MOUSE) //EIP74968 Change Order in Orderlist using Mouse drag
+ {
+ if((listbox->Top <= (UINT16)Data->Input.Data.MouseInfo.Top ) &&
+ ((listbox->Top + listbox->Height) > (UINT16)Data->Input.Data.MouseInfo.Top )&&
+ (listbox->Left <= Data->Input.Data.MouseInfo.Left) &&
+ ((listbox->Left + listbox->Width) > (UINT16)Data->Input.Data.MouseInfo.Left) )
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+ }
+
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ Action = MapControlKeysHook(Data->Input.Data.AmiKey);
+
+ if ( listbox->ListBoxCtrl != NULL )
+ {
+ Status = gListBox.HandleAction(listbox->ListBoxCtrl,Data);
+ // special case, we need ot get the Sel from the listbox and put it into ordlistbox
+ listbox->Sel = listbox->ListBoxCtrl->Sel;
+ if ( listbox->ListBoxEnd )
+ {
+ gListBox.Destroy(listbox->ListBoxCtrl,TRUE);
+ listbox->ListBoxCtrl = NULL;
+ listbox->ListBoxEnd = FALSE;
+ listbox->ControlActive = FALSE;
+ DoOrdListCallBack(listbox);
+ }
+ }
+ else
+ {
+ if(ControlActionSelect == Action)
+ {
+ if ( gListBox.Create( &(listbox->ListBoxCtrl) ) == EFI_SUCCESS )
+ {
+ UINT16 TempLength=0;
+
+ listbox->ControlActive = TRUE;
+ gListBox.Initialize( listbox->ListBoxCtrl, &(listbox->ControlData) );
+ //The next for loop should not be necessary after the callback
+ //updates NVRAM properly
+ //EIP70966
+ //if(TseLiteIsSpecialOptionList((CONTROL_DATA *)listbox) == TRUE) // EIP70966 -
+ {
+ for( i = 0 ; i < listbox->ItemCount; i++ )
+ {
+ listbox->ListBoxCtrl->PtrTokens[i] = listbox->PtrTokens[i].Option;
+ TempLength = (UINT16)HiiMyGetStringLength( listbox->ListBoxCtrl->ListHandle, listbox->ListBoxCtrl->PtrTokens[i] );
+ TempLength+=5; // to included barders
+ if ( TempLength > listbox->ListBoxCtrl->Width )
+ listbox->ListBoxCtrl->Width = TempLength;
+
+ }
+ }
+ if ( listbox->Sel > (listbox->ItemCount-1) ) //EIP-127000 If selected item is suppresed then reset the focus to first item
+ listbox->ListBoxCtrl->Sel = listbox->Sel = 0;
+ else
+ listbox->ListBoxCtrl->Sel = listbox->Sel;
+ gListBox.SetCallback(listbox->ListBoxCtrl, listbox, _OrdListBoxCallback, NULL);
+ gListBox.Draw( listbox->ListBoxCtrl );
+ }
+
+ Status = EFI_SUCCESS;
+ }
+ }
+
+ if(Data->Input.Type == ACTION_TYPE_MOUSE && !lButtonOnListBoxScroll)//EIP74968 Change Order in Orderlist using Mouse drag && EIP-67049
+ {
+ if ( listbox->ListBoxCtrl != NULL )
+ {
+ Action = MapControlMouseActionHook(&Data->Input.Data.MouseInfo);
+ // Check if the Mouse action is on top of list box.
+ if(
+ (Data->Input.Data.MouseInfo.Top >= (UINT32)(listbox->ListBoxCtrl->Top - 1)) &&
+ (ControlActionSelect != Action) &&
+ (Data->Input.Data.MouseInfo.Top <= (UINT32)(listbox->ListBoxCtrl->Top + listbox->ListBoxCtrl->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= listbox->ListBoxCtrl->Left) &&
+ (Data->Input.Data.MouseInfo.Left <= (UINT32)(listbox->ListBoxCtrl->Left + listbox->ListBoxCtrl->Width - 1))
+ )
+ {
+ //Note MOUSE_LEFT_DOWN position
+ if(Action==ControlMouseActionLeftDown)
+ {
+ if(FirstDownEvent == FALSE )
+ {
+ if(Data->Input.Data.MouseInfo.Top == (UINT32)(listbox->ListBoxCtrl->Top + listbox->Sel - listbox->ListBoxCtrl->FirstVisibleSel + 1))
+ FirstDownEvent = TRUE;
+ }
+ else
+ {
+ if(Data->Input.Data.MouseInfo.Top > (UINT32)(listbox->ListBoxCtrl->Top + listbox->Sel - listbox->ListBoxCtrl->FirstVisibleSel + 1))
+ Action = ControlActionDecreament;
+
+ if(Data->Input.Data.MouseInfo.Top < (UINT32)(listbox->ListBoxCtrl->Top + listbox->Sel - listbox->ListBoxCtrl->FirstVisibleSel + 1))
+ Action = ControlActionIncreament;
+ }
+ }
+ else
+ {
+ FirstDownEvent = FALSE;
+ }
+ }
+ }
+ }
+ switch ( Action )
+ {
+ case ControlActionDecreament:
+ // eip : B12674 Don't allow +/- until it is selected.
+ if ( listbox->ListBoxCtrl != NULL )
+ {
+ if(!EFI_ERROR(_OrdListBoxShift(listbox, FALSE)))
+ {
+ if ( (INTN)(listbox->Sel) < listbox->ItemCount - 1 )
+ listbox->Sel++;
+ }
+ Status = EFI_SUCCESS;
+ }
+ break;
+
+ case ControlActionIncreament:
+ // eip : B12674 Don't allow +/- until it is selected.
+ if ( listbox->ListBoxCtrl != NULL )
+ {
+ if(!EFI_ERROR(_OrdListBoxShift(listbox, TRUE)))
+ {
+ if ( listbox->Sel > 0 )
+ listbox->Sel--;
+ }
+ Status = EFI_SUCCESS;
+ }
+ break;
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxSetCallback
+//
+// Description: Function to set callback for ordered List Box
+//
+// Input: ORD_LISTBOX_DATA *listbox, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxSetCallback( ORD_LISTBOX_DATA *listbox, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gPopupSel.SetCallback( listbox, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxSetFocus
+//
+// Description: Function to set focus for ordered List Box
+//
+// Input: ORD_LISTBOX_DATA *listbox, BOOLEAN focus
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxSetFocus(ORD_LISTBOX_DATA *listbox, BOOLEAN focus)
+{
+ return gPopupSel.SetFocus(listbox,focus);
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxSetPosition
+//
+// Description: Function to set position for ordered List Box
+//
+// Input: ORD_LISTBOX_DATA *listbox, UINT16 Left, UINT16 Top
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxSetPosition(ORD_LISTBOX_DATA *listbox, UINT16 Left, UINT16 Top )
+{
+ return gPopupSel.SetPosition( listbox, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxSetDimensions
+//
+// Description: Function to set dimension for ordered List Box
+//
+// Input: ORD_LISTBOX_DATA *listbox, UINT16 Width, UINT16 Height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxSetDimensions(ORD_LISTBOX_DATA *listbox, UINT16 Width, UINT16 Height )
+{
+ return gPopupSel.SetDimensions( listbox, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListBoxSetAttributes
+//
+// Description: Function to set atributes for ordered List Box
+//
+// Input: ORD_LISTBOX_DATA *listbox, UINT8 FGColor, UINT8 BGColor
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListBoxSetAttributes(ORD_LISTBOX_DATA *listbox, UINT8 FGColor, UINT8 BGColor )
+{
+ return gPopupSel.SetAttributes( listbox, FGColor, BGColor );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _OrdListBoxCallback
+//
+// Description: Ordered List Box callback function
+//
+// Input: ORD_LISTBOX_DATA *container, CONTROL_DATA *listbox, VOID *cookie
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _OrdListBoxCallback( ORD_LISTBOX_DATA *container, CONTROL_DATA *listbox, VOID *cookie )
+{
+ container->ListBoxEnd = TRUE;
+ if ( cookie != NULL )
+ container->Sel = *((UINT16*)cookie);
+}
+
+/*
+ Please note that the following function is non-rotatary or non-circular
+ This is an internal function to ordered list control,so we need to:
+ 1-add underscore to the name
+ 2-do not put it in control_methods
+ This function is not used by any one else outside the control.
+*/
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _OrdListBoxShift
+//
+// Description: Function used in OrdListBoxHandleAction to handle actions
+//
+// Input: ORD_LISTBOX_DATA *listbox, UINT8 bShiftUp
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _OrdListBoxShift(ORD_LISTBOX_DATA *listbox, UINT8 bShiftUp)
+{
+ PTRTOKENS unSwap;
+ UINT8 i=0;
+
+ if(TRUE == bShiftUp)
+ {
+ //move up
+ if ( listbox->Sel > 0 )
+ {
+ unSwap = listbox->PtrTokens[listbox->Sel];
+ listbox->PtrTokens[listbox->Sel] = listbox->PtrTokens[listbox->Sel-1];
+ listbox->PtrTokens[listbox->Sel-1] = unSwap;
+ if( listbox->ListBoxCtrl !=NULL)
+ {
+ // update string tokens into listbox area
+ for( i = 0 ; i < listbox->ItemCount; i++ )
+ listbox->ListBoxCtrl->PtrTokens[i] = listbox->PtrTokens[i].Option;
+ listbox->ListBoxCtrl->Sel--;
+ gPopupSel.Draw(listbox);
+ }
+ return EFI_SUCCESS;
+ }
+ }
+ else
+ {
+ //move dn
+ if ( (INTN)(listbox->Sel) < listbox->ItemCount - 1 )
+ {
+ unSwap = listbox->PtrTokens[listbox->Sel];
+ listbox->PtrTokens[listbox->Sel] = listbox->PtrTokens[listbox->Sel+1];
+ listbox->PtrTokens[listbox->Sel+1] = unSwap;
+ if( listbox->ListBoxCtrl !=NULL)
+ { // update string tokens into listbox area
+ for( i = 0 ; i < listbox->ItemCount; i++ )
+ listbox->ListBoxCtrl->PtrTokens[i] = listbox->PtrTokens[i].Option;
+ listbox->ListBoxCtrl->Sel++;
+ gPopupSel.Draw(listbox);
+ }
+
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OrdListGetControlHeight
+//
+// Description: Function used get the hight of control
+//
+// Input: ORD_LISTBOX_DATA *OrdList, VOID* frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS OrdListGetControlHeight( ORD_LISTBOX_DATA *OrdList, VOID* frame, UINT16 *height )
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width;
+
+ Width = (UINT16)(OrdList->LabelMargin - (((FRAME_DATA*)frame)->FrameData.Left + (UINT8)gLabelLeftMargin));
+
+ text = HiiGetString( OrdList->ControlData.ControlHandle, OrdList->Title );
+ if ( text == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ newText = StringWrapText( text, Width, height );
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+
+ *height = (*height < OrdList->ItemCount)? OrdList->ItemCount : *height ;
+ }
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _OrdListMultiLIneDraw
+//
+// Description: Function used to draw teh Ordered list box
+//
+// Input: ORD_LISTBOX_DATA *OrdList
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _OrdListMultiLIneDraw(ORD_LISTBOX_DATA *OrdList)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 ColorNSel = OrdList->NSelFGColor;
+ UINT8 ColorLabel = (OrdList->ControlFocus) ? OrdList->LabelFGColor : OrdList->NSelLabelFGColor ;
+ CHAR16 *text1, *text;
+ UINTN i=0,Len, oldSize = 0;
+ BOOLEAN MultilineSupport = FALSE;
+ UINT16 *OptionList=NULL, Index = 0;
+ UINT64 *ValueList=NULL;
+
+ //Draw the list box alone if the control is active
+ if( OrdList->ListBoxCtrl != NULL)
+ {
+ gListBox.Draw( OrdList->ListBoxCtrl );
+ }
+ else
+ {
+ // check conditional
+ //EIP 75486 Support grayout condition for readonly controls
+ //if( OrdList->ControlData.ControlConditionalPtr != 0x0)
+ //{
+ switch( CheckControlCondition( &OrdList->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorNSel = ColorLabel = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+ if(TseLiteIsSpecialOptionList((CONTROL_DATA *)OrdList) != TRUE) //EIP-127000 Fix options and option count in listbox if any item is suppressed
+ {
+ oldSize = OrdList->ItemCount;
+
+ Status = UefiGetOneOfOptions(&OrdList->ControlData,&OrdList->PopupSelHandle,
+ &OptionList, &ValueList, &OrdList->ItemCount,NULL,NULL);
+
+ if (OrdList->ItemCount!=oldSize)
+ {
+ OrdList->PtrTokens = MemReallocateZeroPool(OrdList->PtrTokens, oldSize*sizeof(PTRTOKENS), OrdList->ItemCount * sizeof(PTRTOKENS));
+ if (NULL == OrdList->PtrTokens)
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (EFI_ERROR(Status))
+ return Status;
+ for( Index = 0; Index < OrdList->ItemCount; Index++ )
+ {
+ OrdList->PtrTokens[Index].Option = OptionList[Index];
+ OrdList->PtrTokens[Index].Value = ValueList[Index];
+ }
+ MemFreePointer( (VOID **)&(OptionList));
+ MemFreePointer( (VOID **)&(ValueList));
+ }
+ _OrdListGetSelection(OrdList); //EIP70966 To handle OrderList Items
+ //_PopupSelGetSelection((POPUPSEL_DATA *)OrdList);
+
+ //Draw label in left column
+ text1 = HiiGetString( OrdList->ControlData.ControlHandle, OrdList->Title );
+ if ( text1 != NULL )
+ {
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(OrdList->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( OrdList->Left, OrdList->Top,
+ (UINTN)(OrdList->LabelMargin - OrdList->Left),(UINTN) OrdList->Height,
+ text1, OrdList->BGColor | ColorLabel );
+ }
+ else
+ {
+ // boundary overflow check
+ if((TestPrintLength( text1) / (NG_SIZE))> (UINTN)(OrdList->LabelMargin - OrdList->Left ))
+ text1[HiiFindStrPrintBoundary(text1 ,(UINTN)(OrdList->LabelMargin - OrdList->Left ))] = L'\0';
+
+ DrawStringWithAttribute( OrdList->Left , OrdList->Top, (CHAR16*)text1,
+ OrdList->BGColor | ColorLabel );
+ }
+
+ MemFreePointer( (VOID **)&text1 );
+ }
+ if(IsTSEMultilineControlSupported()) //TSE_MULTILINE_CONTROLS moved to binary
+ MultilineSupport = TRUE;
+
+ do
+ {
+ text1 = HiiGetString( OrdList->PopupSelHandle, OrdList->PtrTokens[i].Option);
+
+ if(!text1) //EIP-70966 To handle NULL items in orderlistbox
+ text1 = EfiLibAllocateZeroPool(2);
+
+ Len = TestPrintLength( text1 ) / (NG_SIZE);
+ if ( Len > (UINTN)(OrdList->Width - OrdList->Left - OrdList->LabelMargin -2) )
+ EfiStrCpy(&text1[HiiFindStrPrintBoundary(text1 ,(UINTN)(OrdList->Width - OrdList->Left - OrdList->LabelMargin -4))],L"..." );
+
+ //Enclose the string with [ ]
+ text = EfiLibAllocateZeroPool( (Len+3)*2 );
+ SPrint( text,(UINTN)( (Len+3)*2 ), L"[%s]", text1 );
+ MemFreePointer( (VOID **)&text1 );
+
+ DrawStringWithAttribute(
+ OrdList->Left + OrdList->LabelMargin,
+ OrdList->Top+i,
+ (CHAR16*)text,
+ (UINT8)(OrdList->ControlFocus ? OrdList->SelBGColor|OrdList->SelFGColor : OrdList->BGColor|ColorNSel)
+ );
+ i++;
+ }while(i<OrdList->ItemCount && MultilineSupport);
+
+ /*
+ i=TestPrintLength(text) / (NG_SIZE);
+ MemFreePointer( (VOID **)&text );
+
+ // erase extra spaces if neccessary
+ for(;(UINT16)(popupSel->Left + popupSel->LabelMargin + i+2) <= (popupSel->Width-1);i++)
+ DrawStringWithAttribute( popupSel->Left + popupSel->LabelMargin +i +2 , popupSel->Top, L" ",
+ popupSel->BGColor | ColorNSel );
+ */
+
+ FlushLines( OrdList->Top, OrdList->Top+i-1 );
+ }
+
+ return Status;
+}
+
+// EIP70966_START
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: _OrdListGetSelection
+//
+// Description: Function to ordering the option in OrderList
+//
+// Input: ORD_LISTBOX_DATA *ordlist
+//
+// Output:
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _OrdListGetSelection( ORD_LISTBOX_DATA *ordlist )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ UINT8 *temp=NULL;
+ VOID *ifrData = ordlist->ControlData.ControlPtr;
+ int i=0,j=0;
+ PTRTOKENS *OrdPtrTokens=NULL, TempOrdPtrTokens;
+
+
+
+ UINT32 sizeOfData = 0;
+ UINTN type = 0;
+ UINTN dataLen = 0;
+ //Find the size of OrderList based on EFI_IFR_TYPE of EFI_IFR_ONE_OF_OPTION
+// UefiGetValidOptionSize(&ordlist->ControlData, &sizeOfData);
+// dataLen = ordlist->ItemCount * sizeOfData;
+
+ UefiGetValidOptionType(&ordlist->ControlData, &type, &sizeOfData);
+ dataLen = UefiGetMaxEntries(ifrData) * sizeOfData;
+
+ temp = EfiLibAllocateZeroPool( dataLen );
+ if ( temp == NULL )
+ return;
+
+ OrdPtrTokens = ordlist->PtrTokens;
+
+ Status = VarGetValue( ordlist->ControlData.ControlVariable, UefiGetQuestionOffset(ifrData), dataLen, temp );
+
+ // Check variable data and adjust item order.
+ if ( Status == EFI_SUCCESS )
+ {
+ for (i=0 ; i<ordlist->ItemCount-1 ; i++)
+ {
+ for (j=i+1 ; j<ordlist->ItemCount ; j++)
+ {
+ if ( MemCmp( (VOID *)&(OrdPtrTokens[j].Value),(VOID *)(temp + (i * sizeOfData)), sizeOfData ) == 0)
+ {
+ TempOrdPtrTokens = OrdPtrTokens[i];
+ OrdPtrTokens[i] = OrdPtrTokens[j];
+ OrdPtrTokens[j] = TempOrdPtrTokens;
+ break;
+ }
+ }
+ }
+ }
+ MemFreePointer( (VOID **)&temp );
+
+}
+// EIP70966_END
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/ordlistbox.h b/EDK/MiniSetup/TseLite/ordlistbox.h
new file mode 100644
index 0000000..5c449de
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/ordlistbox.h
@@ -0,0 +1,202 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ordlistbox.h $
+//
+// $Author: Premkumara $
+//
+// $Revision: 9 $
+//
+// $Date: 8/28/14 6:06a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/ordlistbox.h $
+//
+// 9 8/28/14 6:06a Premkumara
+// EIP-135253 Updating file name proper in #include
+//
+// 8 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 11/03/11 4:33a Premkumara
+// [TAG] EIP70966
+// [Category] Improvement
+// [Description] Hii orderlist item can't update priority from value in
+// Setup menu for both enable and disable TSE_MULTILINE_CONTROLS token
+// [Files] Ordlistbox.c, ordlistbox.h, TseUefiHii.h, Uefi21Wrapper.c
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//
+// 8 7/09/07 10:45a Arunkumars
+// - Added multi line support for ordered list
+//
+// 7 6/11/07 9:02p Arunkumars
+// Changed ordered list control to correct invalid value in variables only
+// on refresh of a page and not during initialization.
+//
+// 6 7/06/06 6:37p Arunkumars
+// Include tiano.h instead of efi.h
+//
+// 5 6/22/05 11:17a Franklynd
+// 1- Adding knowledge of dimension to the controls
+// 2- Adding check for boundaries in controls.
+//
+// 4 6/17/05 5:20p Jerryp
+// Code rollback to incorporate bug fixes BEFORE feature enhancements
+//
+// 2 5/25/05 11:56p Franklynd
+// Finalized coding on ordered list control.
+//
+// 1 5/25/05 12:26a Franklynd
+// orderedlistbox controls files
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: orderlistbox.h
+//
+// Description: Header file for code to handle ordered list box controls
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _ORD_LISTBOX_H_
+#define _ORD_LISTBOX_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "PopupSel.h"
+
+//TBD// May be removed if not needed.
+#ifndef TRUE
+ #define TRUE 1
+ #define FALSE 0
+#endif
+
+#define SCAN_PLUS '+'
+#define SCAN_MINUS '-'
+
+#define ORD_LISTBOX_MEMBER_VARIABLES \
+ VOID *ScreenBuf; \
+ /*EFI_HII_HANDLE*/VOID* ListHandle;
+
+/* These variables are defined in PopupSel control
+ UINT16 Sel; \
+ UINT16 ItemCount; \
+ UINT16 *PtrTokens;*/
+
+typedef struct _ORD_LISTBOX_METHODS ORD_LISTBOX_METHODS;
+
+typedef struct _ORD_LISTBOX_DATA
+{
+ ORD_LISTBOX_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ POPUPSEL_MEMBER_VARIABLES
+ ORD_LISTBOX_MEMBER_VARIABLES
+
+}
+ORD_LISTBOX_DATA;
+
+
+#define ORD_LISTBOX_METHOD_FUNCTIONS
+
+
+struct _ORD_LISTBOX_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ ORD_LISTBOX_METHOD_FUNCTIONS
+};
+
+extern ORD_LISTBOX_METHODS gOrdListBox;
+
+// Object Methods
+EFI_STATUS OrdListBoxCreate( VOID **object );
+EFI_STATUS OrdListBoxDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS OrdListBoxInitialize( VOID *object, VOID *data );
+EFI_STATUS OrdListBoxDraw( VOID *object );
+EFI_STATUS OrdListBoxHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS OrdListBoxSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS OrdListBoxSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS OrdListBoxSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS OrdListBoxSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS OrdListBoxSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS OrdListGetControlHeight( VOID *OrdList,VOID* frame, UINT16 *height );
+EFI_STATUS _OrdListBoxShift(ORD_LISTBOX_DATA *listbox, UINT8 bShiftUp);
+
+VOID _OrdListBoxCallback( ORD_LISTBOX_DATA *container, CONTROL_DATA *listbox, VOID *cookie );
+VOID _OrdListGetSelection( ORD_LISTBOX_DATA *ordlist );//EIP-70966
+
+#endif /* _ORD_LISTBOX_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/page.c b/EDK/MiniSetup/TseLite/page.c
new file mode 100644
index 0000000..007e6c7
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/page.c
@@ -0,0 +1,1079 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2013, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/page.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 19 $
+//
+// $Date: 5/02/14 12:40a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/page.c $
+//
+// 19 5/02/14 12:40a Arunsb
+// [TAG] EIP150526
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE hangs on disconnecting and connecting the RAID driver
+// [Root Cause] Process pack updated on processing the existing pack
+// update
+// [Solution] First we getting remove and new pack. On getting this TSE
+// starts processing the pack(ProcessPackNotification) but on processing
+// the pack itself we getting notification again for remove and add. So
+// again process pack happens inside notification
+// itself(IFRChangeNotifyFn), this processing should not happen inside
+// notification so enabled flag gEnableProcessPack in PageHandleAction.
+// [Files] hii.c, minisetupext.c and page.c
+//
+// 18 2/11/14 8:25p Arunsb
+// [TAG] EIP129750
+// [Category] Improvement
+// [Description] Dynamic pages support in ESA
+// [Files] page.c
+//
+// 17 12/03/13 2:13p Premkumara
+// [TAG] EIP130420
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] String is getting truncated
+// [RootCause] The string for messagebox, Popup controls is getting
+// truncated
+// [Solution] Used temp variable to store original string and modify the
+// string temp and used to avoid changing org string.
+// [Files] String.c
+//
+// 16 7/01/13 9:57a Premkumara
+// [TAG] EIP126876
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Printscreen is not captured in H/W Monitor page
+// [RootCause] TSE is trying to create new file with page title name
+// after taking print screen. If page title has special character then
+// file will not create with any of these character so returning
+// FileHandle as NULL
+// [Solution] If page title has any of these character then it will be
+// replace wit hypen character
+// [Files] Page.c
+//
+// 15 5/15/13 4:44a Premkumara
+// [TAG] EIP23310
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Memory leak
+// [RootCause] Memory is not freed after taking printscreen buffer
+// [Solution] Freed memory for BmpBuffer variable after taking
+// printscreen buffer
+// [Files] Page.c
+//
+// 14 4/18/13 9:25a Arunsb
+// Wrapper function introduce to avoid build error in 2.0
+//
+// 13 3/29/13 12:24p Premkumara
+// [TAG] EIP97611
+// [Category] New Feature
+// [Description] PrintScreen Support in TSE
+// [Files] AMITSE.sdl, CommonHelper.c, HotKeyBin.h, AddBootOption.c,
+// Page.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 12 3/14/13 11:46a Premkumara
+// [TAG] EIP85745 & 109814
+// [Category] Improvement
+// [Description] Support for Modal Form Support as per UEFI 2.3.1
+// [Files] Parse.c, Page.c, Menu.c, Hotclick.c
+//
+// 11 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 11 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 10 12/07/11 3:34p Arunsb
+// [TAG] EIP75588
+// [Category] New Feature
+// [Description] Support for queuing UpdatePack notifications
+// [Files] frame.c, page.c, formbrowser2.c, hii.c, hiicallback.c,
+// hiinotificationhandler.c, tseuefihii.h and uefi21wapper.c
+//
+// 9 11/20/11 8:05a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 8 6/23/11 3:53p Rajashakerg
+// [TAG] EIP55762, 58925, 59971
+// [Category] New Feature
+// [Description]
+// Support REF2,REF3 and REF4 in AMITSE
+// Support direct form navigation path
+// Improper layout of controls in the root page when Dynamic pages are
+// added using the Legacy Setup Style
+//
+// [Files] setupdata.h, CommonHelper.c, AMITSE.sdl, Legacy\Legacy.c,
+// Legacy\style.h, Legacy\style.h, frame.c, minisetupext.c,
+// minisetupext.h, numeric.c, page.c Popupstring.c, Hii.c,
+// Uefi21Wrapper.c, Parse.c Hii.c
+//
+// 7 3/01/11 1:56p Blaines
+// Removes Engineer's name [Blaines] from commented code.
+//
+// 6 6/17/10 2:59p Madhans
+// Dynamic parsing support in TSE.
+//
+// 5 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 8 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 7 2/04/10 11:17p Madhans
+// Mouse support related code optimized
+//
+// 6 2/01/10 7:38p Madhans
+// EIP 32501 : Fix to handle the Conditional control Focusing , in the Sub
+// form
+//
+// 5 1/09/10 6:27a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 11/09/09 4:44a Mallikarjunanv
+// Eip-30111 : fixed the issue to update the help if
+// STYLE_PAGE_FIRSTITEM_FOCUS token enabled.
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//
+// 25 9/17/08 7:44p Madhans
+// For Boot only Driver file split changes.
+//
+// 24 8/11/08 7:04p Madhans
+// TSE_PRN_SCRN_EVENT_SUPPORT SDL token created.
+//
+// 23 7/30/08 5:52p Madhans
+// To handle the printscreen hotkey event.
+//
+// 22 3/19/08 4:00p Madhans
+// Shift Tab Support for Date and Time, MapControlKeys takes
+// AMI_EFI_KEY_DATA.
+//
+// 21 10/24/07 11:23a Arunkumars
+// - Moved IDE security code to binary
+// - Fixed build errors under UGA draw support
+// - Added EFI key password support
+// - Added modifier hot key support
+// - Added popup support in From browser protocol
+//
+// 20 7/09/07 1:27p Arunkumars
+// - Added elink hooks for Logo, Password management and Control Keys
+// customizations
+//
+// 19 5/07/07 8:46a Arunkumars
+// - Mouse input support
+// - Message box protocol to display message boxes
+//
+// 18 4/02/07 4:50p Arunkumars
+// - When a control is active Issue draw only to the frame in which the
+// control is present
+//
+// 17 6/16/06 3:40p Madhans
+// 64 Bit Support. Set SDL token TSE_FOR_64BIT for 64 bit support.
+//
+// 16 5/02/06 7:38a Arunkumars
+// Fix for alignment of the controls
+//
+// 15 4/27/06 9:59a Arunkumars
+// Fix to scroll to unfocusable views
+//
+// 14 2/14/06 1:02p Arunkumars
+// 1. Added Inconsistentif feature
+// 2. We publish two events before and after asking for password (see
+// postmgt.c and minisetup.h)
+//
+// 13 9/02/05 1:23p Jerryp
+// fix for incorrect help information being displayed
+//
+// 12 5/25/05 1:38a Jerryp
+// Moved handling of page 0 into the style specific code
+//
+// 11 4/01/05 1:54p Franklynd
+//
+// 10 2/17/05 12:47p Jerryp
+// Reversed draw order to avoid help overwriting current.
+//
+// 9 2/14/05 2:59p Jerryp
+// Renamed some functions for consistency
+//
+// 8 2/06/05 11:15a Jerryp
+// Full hotkey support
+//
+// 7 2/02/05 4:20p Jerryp
+// **WORK IN PROGRESS **
+// Latest changes for Label/Index.
+// Not completely tested
+//
+// 6 1/19/05 6:09p Jerryp
+// Cleaned up header mess
+//
+// 5 1/14/05 7:09p Jerryp
+// First integration code with boot to shell.
+// Still a bug in booting to shell from FV
+//
+// 4 1/13/05 10:37a Jerryp
+// Latest updated
+// Added ifdef for fake HII info
+//
+// 2 1/06/05 11:31a Jerryp
+// Moved callback from Control to Object
+// Better class heirarchy definitions through #define
+//
+// 1 12/30/04 5:35p Jerryp
+// Initial checkin
+// ** Still some debugging code in place
+// ** Not all object/controls work as expected
+//
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: page.c
+//
+// Description: This file contains code to handle page level operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+//////////////////////////////////////////////////
+// Variable Declarations
+//////////////////////////////////////////////////
+PAGE_METHODS gPage =
+{
+ PageCreate,
+ PageDestroy,
+ PageInitialize,
+ PageDraw,
+ PageHandleAction,
+ PageSetCallback
+};
+CHAR16 *gPageTitle = NULL;
+
+//////////////////////////////////////////////////
+// Extern variables
+//////////////////////////////////////////////////
+extern EFI_GRAPHICS_OUTPUT_PROTOCOL *gGOP;
+extern BOOLEAN gPackUpdatePending;
+extern UINT16 gSelIdx;
+extern UINT8 gAddBgrtResolutions;
+
+extern EFI_STATUS FileBrowserLaunchFileSystem (UINT32 Variable);
+//////////////////////////////////////////////////
+// Function Declarations
+//////////////////////////////////////////////////
+EFI_STATUS GetPageSubTitle(UINT32 PgIndex, UINT16 *TitleToken);
+VOID SetGetBgrtCoordinates ( UINTN *DestX, UINTN *DestY, UINTN *Width, UINTN *Height, BOOLEAN Command );
+VOID *ConvertBlt2Bmp ();
+EFI_STATUS ProcessPackNotificationHook (VOID);
+BOOLEAN IsPageModal(UINT32 PgIndex); //EIP-85745 Modal Support
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PageCreate
+//
+// Description: function to create a page
+//
+// Input: PAGE_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PageCreate( PAGE_DATA **object )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool(sizeof(PAGE_DATA));
+ if ( *object == NULL )
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gObject.Create( object );
+
+ if (EFI_ERROR(Status))
+ {
+ MemFreePointer( (VOID **)object );
+ return Status;
+ }
+
+ (*object)->Methods = &gPage;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PageDestroy
+//
+// Description: function to destroy a page, which uses the HotKey Fucntions
+//
+// Input: PAGE_DATA *page, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PageDestroy( PAGE_DATA *page, BOOLEAN freeMem )
+{
+ UINT32 i;
+
+ gObject.Destroy( page, FALSE );
+
+ for ( i = 0; i < page->HotKeyCount; i++ )
+ {
+ gHotKey.Destroy( page->HotKeyList[i], TRUE );
+ }
+
+ MemFreePointer( (VOID **)&page->HotKeyList );
+
+ for ( i = 0; i < page->FrameCount; i++ )
+ {
+ gFrame.Destroy( page->FrameList[i], TRUE );
+ }
+ page->FrameCount = 0;
+ MemFreePointer( (VOID **)&page->FrameList );
+
+ if ( freeMem )
+ MemFreePointer( (VOID **)&page );
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PageInitialize
+//
+// Description: function to initialize a page, which uses the Frame Fucntions
+//
+// Input: PAGE_DATA *page, PAGE_INFO *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PageInitialize( PAGE_DATA *page, PAGE_INFO *data )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT32 i;
+
+ page->CurrentFrame = 0;
+ MemCopy( &page->PageData, data, sizeof(PAGE_INFO) );
+
+ page->FrameCount = StyleGetPageFrames( data->PageID );
+
+ page->FrameList = EfiLibAllocateZeroPool( sizeof(FRAME_DATA *) * page->FrameCount );
+ if ( page->FrameList == NULL )
+ return EFI_OUT_OF_RESOURCES;
+
+ for ( i = 0; i < page->FrameCount; i++ )
+ {
+ if ( gFrame.Create( &page->FrameList[i] ) != EFI_SUCCESS )
+ continue;
+
+ page->FrameList[i]->PageID = data->PageID;
+ gFrame.Initialize( page->FrameList[i], StyleGetFrameInitData( data->PageID, i ) );
+
+ Status = StyleInitializeFrame( page->FrameList[i], page->FrameList[i]->FrameData.FrameType, data );
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PageDraw
+//
+// Description: function to draw a page with attributes
+//
+// Input: PAGE_DATA *page
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PageDraw( PAGE_DATA *page )
+{
+ UINT32 i, PageNum, MainFrameIndex=0, CurrentControl;
+
+ FRAME_DATA *MainFrame = NULL;
+
+ CONTROL_DATA **control;
+
+ MainFrameIndex =StyleFrameIndexOf(MAIN_FRAME);
+ MainFrame = page->FrameList[MainFrameIndex];
+
+ StyleBeforeFrame( MainFrame ) ;
+
+ // update the help for the current selection
+ _PageUpdateHelp( page );
+ _PageUpdateTitle( page );
+ _PageUpdateSubtitle( page );
+ _PageUpdateNavStrings( page );
+ _PageUpdateFrameStrings( page );
+
+ PageNum = gApp->CurrentPage ;
+
+ //Call Oem hooks to decide item focus on complete redraw
+
+ if(gApp->CompleteRedraw && gApp->OnRedraw) {
+
+ if(gApp->OnRedraw == MENU_COMPLETE_REDRAW)
+ StylePageItemFocus(page, MainFrame);
+ else if(gApp->OnRedraw == SUBMENU_COMPLETE_REDRAW)
+ StyleSubPageItemFocus(page, MainFrame);
+
+ gApp->OnRedraw = 0 ;
+
+ }
+
+
+
+ //If there is an active control in Main frame only draw that frame
+ if(MainFrame->CurrentControl == FRAME_NONE_FOCUSED)
+ control = NULL;
+ else
+ control = &MainFrame->ControlList[MainFrame->CurrentControl];
+
+ if ( control != NULL )
+ {
+ //If a control is active only draw that
+ if( (*control)->ControlActive == TRUE )
+ {
+ StyleBeforeFrame( MainFrame ) ;
+ gFrame.Draw( MainFrame );
+
+ return EFI_SUCCESS;
+ }
+ }
+
+ // Backup the MainFrame->CurrentControl
+ CurrentControl = MainFrame->CurrentControl;
+ for ( i = 0; i < page->FrameCount; i++ )
+ {
+ StyleBeforeFrame( page->FrameList[i] ) ;
+ gFrame.Draw( page->FrameList[i] );
+ if(i == MainFrameIndex)
+ {
+ // After expression evalution if current control is affected
+ if(MainFrame->CurrentControl != CurrentControl)
+ {
+ // Help might be updated
+ _PageUpdateHelp( page );
+ CurrentControl = MainFrame->CurrentControl;
+ i = 0; // Redraw all the frames again
+ }
+ }
+ }
+
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PageHandleAction
+//
+// Description: function to handle the page actions
+//
+// Input: PAGE_DATA *page, ACTION_DATA *action
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+extern BOOLEAN gEnableProcessPack;
+EFI_STATUS PageHandleAction( PAGE_DATA *page, ACTION_DATA *action )
+{
+ UINT32 i;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+//EIP: 58925 Start
+ UINT32 stackIndex = 0xFFFFFFFF, tmpcounter = 0;
+ UINT16 parentPgID = 0, TitleToken = 0;
+
+//EIP: 58925 End
+ // On printScreen HotKey, Just return Unsupported and It will handed by Application Hotkey Handler.
+ if( ( action->Input.Type == ACTION_TYPE_KEY ) &&
+ (TsePrintScreenEventSupport(action->Input.Data.AmiKey.Key.ScanCode) ) )
+ {
+ GetPageSubTitle(page->PageData.PageID, &TitleToken);
+ gPageTitle = HiiGetString( page->PageData.PageHandle, TitleToken);
+
+ if (NULL != gPageTitle)
+ {
+ while(gPageTitle[tmpcounter]!= L'\0')
+ {
+ if ( ('/' == gPageTitle[tmpcounter]) ||
+ ('\\' == gPageTitle[tmpcounter]) ||
+ ('<' == gPageTitle[tmpcounter]) ||
+ ('>' == gPageTitle[tmpcounter]) ||
+ ('?' == gPageTitle[tmpcounter]) ||
+ ('*' == gPageTitle[tmpcounter]) ||
+ (':' == gPageTitle[tmpcounter]) ||
+ ('"' == gPageTitle[tmpcounter]) ||
+ ('|' == gPageTitle[tmpcounter])
+ ) //EIP-126876 to avoid create file with special characters. If any of these character found then replace it with '-' character
+ gPageTitle[tmpcounter] = '-';
+ tmpcounter++;
+ }
+ }
+ Status = EFI_UNSUPPORTED;
+ goto DONE;
+
+ }
+/*
+#if TSE_PRN_SCRN_EVENT_SUPPORT
+ if (( action->Input.Type == ACTION_TYPE_KEY ) && ( action->Input.Data.AmiKey.Key.ScanCode == TSE_PRN_SCRN_KEY_SCAN ))
+ return EFI_UNSUPPORTED;
+#endif
+*/
+ for ( i = 0; i < page->FrameCount; i++ )
+ {
+ if ( gFrame.HandleAction( page->FrameList[StyleFrameIndexOf(i)], action ) == EFI_SUCCESS )
+ {
+ Status = EFI_SUCCESS;
+ goto DONE;
+ }
+ }
+
+ //EIP-85745 Modal Support
+ //If Page is Modal do not proceed further
+ if(IsPageModal(page->PageData.PageID))
+ {
+ Status = EFI_UNSUPPORTED; //IF page is Modal
+
+ if( action->Input.Type == ACTION_TYPE_KEY )
+ action->Input.Type = ACTION_TYPE_NULL ;
+ goto DONE;
+ }
+
+ for ( i = 0; i < page->HotKeyCount; i++ )
+ {
+ if ( gHotKey.HandleAction( page->HotKeyList[i], action ) == EFI_SUCCESS )
+ {
+ Status = EFI_SUCCESS;
+ goto DONE;
+ }
+ }
+
+ if(
+ (( action->Input.Type == ACTION_TYPE_KEY ) && (ControlActionAbort == MapControlKeysHook(action->Input.Data.AmiKey)))
+ || ((action->Input.Type == ACTION_TYPE_MOUSE) && (ControlActionAbort == MapControlMouseActionHook(&(action->Input.Data.MouseInfo))) /*(TSEMOUSE_RIGHT_CLICK == action->Input.Data.MouseInfo.ButtonStatus)*/)
+ )
+ {
+ if ( page->PageData.PageParentID == 0 )
+ {
+ Status = EFI_UNSUPPORTED;
+//EIP: 58925 Start
+ if(IsLinkHistorySupport())
+ {
+ Status = GetParentFormID((UINT16)gApp->CurrentPage, &parentPgID, &stackIndex); //Gets the parent page of the current page
+
+ if(Status == EFI_SUCCESS)
+ {
+ gApp->CurrentPage = parentPgID; //Else set the current page to the parent page
+ }
+ }
+//EIP: 58925 End
+
+ goto DONE;
+ }
+
+ if ( page->PageData.PageID != page->PageData.PageParentID )
+ {
+ // check for inconsistency here too.
+ if (CheckInconsistence((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[page->PageData.PageID]))!= TRUE )
+ {
+ // reset focus to first control
+ FRAME_DATA *frame = page->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+ UINT32 i;
+
+ for ( i = 0; i < frame->ControlCount; i++ )
+ {
+ if ( _FrameSetControlFocus( frame, i ) )
+ {
+ frame->FirstVisibleCtrl = 0;
+ break;
+ }
+ }
+//EIP: 58925 Start
+ if(IsLinkHistorySupport())
+ {
+ // tell application that we need to change pages
+ Status = GetParentFormID((UINT16)gApp->CurrentPage, &parentPgID, &stackIndex); //Gets the parent page of the current page
+ if(Status != EFI_SUCCESS)
+ gApp->CurrentPage = page->PageData.PageParentID;
+ else
+ gApp->CurrentPage = parentPgID; //Else set the current page to the parent page
+ }
+ else
+ {
+ gApp->CurrentPage = page->PageData.PageParentID;
+ }
+//EIP: 58925 End
+ gApp->CompleteRedraw = TRUE;
+ gApp->OnRedraw = SUBMENU_COMPLETE_REDRAW;
+ }
+
+ Status = EFI_SUCCESS;
+ }
+ }
+DONE:
+ if (gPackUpdatePending) //EIP75588 Update If any pack pending
+ {
+ if(!IsActiveControlPresent(page))
+ {
+ SETUP_DEBUG_UEFI_NOTIFICATION ("\n\n[TSE] PageHandleAction () calling ProcessPackNotificationHook() \n\n");
+ gEnableProcessPack = TRUE;
+ Status = ProcessPackNotificationHook ();
+ gEnableProcessPack = FALSE;
+ }
+ }
+//EIP: 58925 Start
+ if(IsLinkHistorySupport())
+ {
+ if(Status == EFI_SUCCESS)
+ {
+ SetParentFormID(page->PageData.PageID, (UINT16)gApp->CurrentPage);
+ }
+ }
+//EIP: 58925 End
+ return Status;
+}
+
+EFI_STATUS PageSetCallback( PAGE_DATA *page, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gObject.SetCallback( page, container, callback, cookie );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PageUpdateMemo
+//
+// Description: function to update the memo
+//
+// Input: PAGE_DATA *page, UINT16 frameNumber, VOID* handle, UINT16 token
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PageUpdateMemo( PAGE_DATA *page, UINT32 frameType, /*EFI_HII_HANDLE*/VOID* handle, UINT16 token )
+
+{
+ MEMO_DATA *memo;
+ FRAME_DATA *memoFrame;
+ UINT32 frameIndex;
+
+ frameIndex = StyleFrameIndexOf(frameType);
+ if ( ( page->FrameCount <= frameIndex ) || ( token == 0 ) )
+ return;
+
+ memoFrame = page->FrameList[frameIndex];
+
+
+ if ( memoFrame->ControlCount == 0 )
+ return;
+
+ memo = (MEMO_DATA *)memoFrame->ControlList[0];
+ memo->ControlData.ControlHandle = handle;
+
+ if(memo->ControlData.ControlType == CONTROL_TYPE_MEMO)
+ UefiSetSubTitleField((VOID *)memo->ControlData.ControlPtr,token);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PageUpdateHelp
+//
+// Description: function to update the page help
+//
+// Input: PAGE_DATA *page
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PageUpdateHelp( PAGE_DATA *page )
+{
+ CONTROL_DATA *control;
+ FRAME_DATA *mainFrame;
+
+ mainFrame = page->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+
+ _PageUpdateMemo( page, HELP_FRAME, gHiiHandle, STRING_TOKEN(STR_EMPTY_STRING) );
+ if ( mainFrame->ControlCount == 0 )
+ return;
+
+ if(mainFrame->CurrentControl == FRAME_NONE_FOCUSED)
+ return;
+
+ control = mainFrame->ControlList[mainFrame->CurrentControl];
+
+ if ( control->ControlFocus )
+ _PageUpdateMemo( page, HELP_FRAME, control->ControlData.ControlHandle, control->ControlData.ControlHelp );
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PageUpdateSubtitle
+//
+// Description: function to update the subtitle of the page
+//
+// Input: PAGE_DATA *page
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PageUpdateSubtitle( PAGE_DATA *page )
+{
+ /*EFI_HII_HANDLE*/VOID * hiiHandle = page->PageData.PageHandle;
+ UINT16 token = page->PageData.PageSubTitle;
+
+ if ( token == 0 )
+ {
+ hiiHandle = gHiiHandle;
+ token = gScreen->MainCopyright;
+ }
+
+ _PageUpdateMemo( page, SUBTITLE_FRAME, hiiHandle, token );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PageUpdateTitle
+//
+// Description: function to update the title of the page
+//
+// Input: PAGE_DATA *page
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PageUpdateTitle( PAGE_DATA *page )
+{
+ /*EFI_HII_HANDLE*/VOID * hiiHandle = page->PageData.PageHandle;
+ UINT16 token = page->PageData.PageTitle;
+
+ if ( token == 0 )
+ {
+ hiiHandle = gHiiHandle;
+ token = gScreen->MainTitle;
+ }
+
+ _PageUpdateMemo( page, TITLE_FRAME, hiiHandle, token );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PageUpdateNavStrings
+//
+// Description: function to update the title of the page
+//
+// Input: PAGE_DATA *page
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PageUpdateNavStrings( PAGE_DATA *page )
+{
+ _PageUpdateMemo( page, NAV_FRAME, gHiiHandle, StyleGetNavToken( page->PageData.PageID ) );
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _PageUpdateFrameStrings
+//
+// Description: function to update the title of the page
+//
+// Input: PAGE_DATA *page
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _PageUpdateFrameStrings( PAGE_DATA *page )
+{
+ StyleUpdateFrameStrings(page);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdatePageFocusedItemHelp
+//
+// Description: function to update the Help in case of First Item focus set.
+//
+// Input: PAGE_DATA *page
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID UpdatePageFocusedItemHelp(PAGE_DATA *page)
+{
+ //call the internal function to update the page help
+ _PageUpdateHelp(page);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HotclickESCaction
+//
+// Description: function to handle the left click on ESC in Navigation frame.
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID HotclickESCaction(VOID)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ PAGE_DATA *page;
+ UINT32 stackIndex = 0xFFFFFFFF;
+ UINT16 parentPgID = 0;
+ page = gApp->PageList[gApp->CurrentPage];
+
+ if ( page->PageData.PageParentID == 0 )
+ {
+ gApp->Quit = ExitApplication();
+ return;
+ }
+
+ if ( page->PageData.PageID != page->PageData.PageParentID )
+ {
+ // check for inconsistency here too.
+ if (CheckInconsistence((PAGE_INFO*)((UINTN)gApplicationData + gPages->PageList[page->PageData.PageID]))!= TRUE )
+ {
+ // reset focus to first control
+ FRAME_DATA *frame = page->FrameList[StyleFrameIndexOf(MAIN_FRAME)];
+ UINT32 i;
+
+ for ( i = 0; i < frame->ControlCount; i++ )
+ {
+ if ( _FrameSetControlFocus( frame, i ) )
+ {
+ frame->FirstVisibleCtrl = 0;
+ break;
+ }
+ }
+
+ if(IsLinkHistorySupport())
+ {
+ // tell application that we need to change pages
+ Status = GetParentFormID((UINT16)gApp->CurrentPage, &parentPgID, &stackIndex); //Gets the parent page of the current page
+ if(Status != EFI_SUCCESS)
+ gApp->CurrentPage = page->PageData.PageParentID;
+ //gApp->CurrentPage = gNavStartPage; //If the parent page was not found or invalid, go to the first page
+ else
+ gApp->CurrentPage = parentPgID; //Else set the current page to the parent page
+ }
+ else
+ {
+ gApp->CurrentPage = page->PageData.PageParentID;
+ }
+
+ gApp->CompleteRedraw = TRUE;
+ gApp->OnRedraw = SUBMENU_COMPLETE_REDRAW;
+ }
+
+ Status = EFI_SUCCESS;
+ }
+
+
+ if(IsLinkHistorySupport())
+ {
+ if(Status == EFI_SUCCESS)
+ {
+ SetParentFormID(page->PageData.PageID, (UINT16)gApp->CurrentPage);
+ }
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PrntScrnKeyHandleaction
+//
+// Description: Function to handle PrintScreenKeyto get screen image as BltBuffer and save as BMP file to a available filesystem
+//
+// Input: VOID
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS WriteDataToFileWrapper (CHAR16 *filename, VOID *Data, UINTN length, UINT32 index);
+EFI_STATUS PrntScrnKeyHandleaction()
+{
+ BMP_IMAGE_HEADER *BmpBuffer=NULL;
+ EFI_STATUS Status = EFI_SUCCESS;
+ EFI_TIME time;
+
+ CHAR16 *Title = L"Snap of current page:";
+ CHAR16 *Msg = NULL;
+ CHAR16 *Filename = NULL;
+ UINT8 Sel = 0;
+ UINTN StartX = 0, StartY = 0, Width = 0, Height = 0;
+ UINT32 variable = 0xffff;
+
+
+ gAddBgrtResolutions = 1;
+ Height = (UINTN)(gGOP->Mode->Info->VerticalResolution);
+ Width = (UINTN)(gGOP->Mode->Info->HorizontalResolution);
+
+ SetGetBgrtCoordinates (&StartX,&StartY,&Width,&Height,TRUE);
+
+ //Converting blt buffer to BMP
+ BmpBuffer = ConvertBlt2Bmp ();
+
+ if (BmpBuffer)
+ {
+ //List available FileSystem
+ Status = FileBrowserLaunchFileSystem(variable);
+
+ if (EFI_ERROR(Status))
+ {
+ PostManagerDisplayMsgBox (L"PrintScreen Error!!",L"Screen is not captured",MSGBOX_TYPE_OK,&Sel);
+ goto DONE;
+ }
+
+ gRT->GetTime( &time, NULL );
+
+ if (NULL == gPageTitle)
+ {
+ gPageTitle = EfiLibAllocateZeroPool ( (EfiStrLen(L"TSE_Snap")+1)*sizeof(CHAR16) );
+ EfiStrCpy (gPageTitle, L"TSE_Snap");
+ }
+
+ Filename = EfiLibAllocateZeroPool ( (EfiStrLen(gPageTitle)+16)*sizeof(CHAR16));//length of title and time format (HH-MM-SS) and .BMP character
+ if (NULL == Filename)
+ {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+
+ SPrint(Filename,((EfiStrLen(gPageTitle)+16)*sizeof(CHAR16)),L"%s_[%02d-%02d-%02d].BMP",gPageTitle,time.Hour,time.Minute,time.Second );
+ Status = WriteDataToFileWrapper (Filename,BmpBuffer,BmpBuffer->Size,gSelIdx);
+
+ if (!EFI_ERROR(Status))
+ {
+ Msg = EfiLibAllocateZeroPool( (EfiStrLen(L"Image is stored with name : ") + EfiStrLen (Filename) + 1) * sizeof(CHAR16) );
+
+ if (NULL == Msg)
+ {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+
+ SPrint(Msg,( (EfiStrLen(L"Image is stored with name : ") + EfiStrLen (Filename)+1) * sizeof(CHAR16) ),L"Image is stored with name : %s",Filename);
+ PostManagerDisplayMsgBox (Title,Msg,MSGBOX_TYPE_OK,&Sel);
+ }
+
+ else
+ PostManagerDisplayMsgBox (L"Error Message",L"Failed to save to a file",MSGBOX_TYPE_OK,&Sel);
+ }
+
+DONE:
+ if (BmpBuffer) //EIP-123310 memory leak
+ MemFreePointer((VOID **)&BmpBuffer);
+ if (Filename)
+ MemFreePointer((VOID **)&Filename);
+ if (Msg)
+ MemFreePointer((VOID **)&Msg);
+ if (gPageTitle)
+ MemFreePointer ((VOID **)&gPageTitle);
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PrntScrnKeyNotification
+//
+// Description: PrntScrnKeyNotification Function handle PrntScrnKey action
+//
+// Input: CHAR16 *
+//
+// Output: EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID PrntScrnKeyNotification(APPLICATION_DATA *app, HOTKEY_DATA *hotkey, VOID *cookie )
+{
+ if ( TRUE == TsePrintScreenEventSupport ( ((HOTKEY_DATA*)hotkey)->HotKeyData.Key.ScanCode ) )
+ PrntScrnKeyHandleaction();
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/page.h b/EDK/MiniSetup/TseLite/page.h
new file mode 100644
index 0000000..33abbc9
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/page.h
@@ -0,0 +1,185 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/page.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 6 $
+//
+// $Date: 10/18/12 6:01a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/page.h $
+//
+// 6 10/18/12 6:01a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 8 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//
+// 7 7/06/06 6:37p Arunkumars
+// Include tiano.h instead of efi.h
+//
+// 6 2/06/05 11:15a Jerryp
+// Full hotkey support
+//
+// 5 1/14/05 7:09p Jerryp
+// First integration code with boot to shell.
+// Still a bug in booting to shell from FV
+//
+// 4 1/13/05 7:14p Jerryp
+// Added new method to Control class
+// Added RUNTIME_DEBUG_SUPPORT option
+// Fixed flushing error with memo
+// Added update to help of date control
+// Removed all fake HII stuff
+//
+// 3 1/13/05 10:37a Jerryp
+// Latest updated
+// Added ifdef for fake HII info
+//
+// 2 1/06/05 11:31a Jerryp
+// Moved callback from Control to Object
+// Better class heirarchy definitions through #define
+//
+// 1 12/30/04 5:35p Jerryp
+// Initial checkin
+// ** Still some debugging code in place
+// ** Not all object/controls work as expected
+//
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: page.h
+//
+// Description: Header file for code to handle page level operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _PAGE_H_
+#define _PAGE_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "object.h"
+#include "action.h"
+#include "frame.h"
+#include "hotkey.h"
+
+#define PAGE_MEMBER_VARIABLES \
+ PAGE_INFO PageData; \
+ UINT32 CurrentFrame; \
+ UINT32 FrameCount; \
+ FRAME_DATA **FrameList; \
+ UINT32 HotKeyCount; \
+ HOTKEY_DATA **HotKeyList;
+
+typedef struct _PAGE_METHODS PAGE_METHODS;
+
+typedef struct _PAGE_DATA
+{
+ PAGE_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ PAGE_MEMBER_VARIABLES
+
+}
+PAGE_DATA;
+
+#define PAGE_METHOD_FUNCTIONS
+
+struct _PAGE_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ PAGE_METHOD_FUNCTIONS
+};
+
+extern PAGE_METHODS gPage;
+
+// Object Methods
+EFI_STATUS PageCreate( VOID **object );
+EFI_STATUS PageDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS PageInitialize( VOID *object, VOID *data );
+EFI_STATUS PageDraw( VOID *object );
+EFI_STATUS PageHandleAction( VOID *object, ACTION_DATA *data );
+EFI_STATUS PageSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+VOID _PageUpdateMemo( PAGE_DATA *page, UINT32 frameType, /*EFI_HII_HANDLE*/VOID * handle, UINT16 token );
+
+VOID _PageUpdateHelp( PAGE_DATA *page );
+VOID _PageUpdateSubtitle( PAGE_DATA *page );
+VOID _PageUpdateTitle( PAGE_DATA *page );
+VOID _PageUpdateNavStrings( PAGE_DATA *page );
+VOID _PageUpdateFrameStrings( PAGE_DATA *page );
+
+#endif /* _PAGE_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/popup.c b/EDK/MiniSetup/TseLite/popup.c
new file mode 100644
index 0000000..39ec33d
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/popup.c
@@ -0,0 +1,613 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/popup.c $
+//
+// $Author: Premkumara $
+//
+// $Revision: 14 $
+//
+// $Date: 5/03/14 6:22p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/popup.c $
+//
+// 14 5/03/14 6:22p Premkumara
+// [TAG] EIP135665
+// [Category] Bug Fix
+// Corrected condtion to display multi-line string
+//
+// 13 5/03/14 4:01p Premkumara
+// [TAG] EIP135665
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE get hangs, when long string is given as title for
+// password
+// [Root Cause] TSE is not handling properl when PasswordTitle length
+// exceeds screen width
+// [Solution] Handled password title length based on screen width and
+// given support to display title in multiple lines.
+// [Files] postmgmtext.c, Popup.c, PopupEdit.c, PopupPassword.c
+//
+// 12 5/02/14 1:03p Premkumara
+// [TAG] EIP154407
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] NVMe Driver - AddBootOption Hang
+// [RootCause] System hangs When popup->width(NvMe driver path) is more
+// than
+// gmaxcol.
+// [Solution] Added condition to initialize the popup->width =
+// gmaxcol-10 when
+// it exceeds gmaxcol.
+// [Files] popup.c
+//
+// 11 2/11/14 9:01p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 10 12/06/13 4:49a Premkumara
+// [TAG] EIP135665
+// [Category] Bug Fix
+// [Comments] Corrected condtion properly for password and
+// string type control
+//
+// 9 12/03/13 9:02a Premkumara
+// [TAG] EIP135665
+// [Category] Bug Fix
+// [Severity:] Important
+// [Symptom:] TSE get hangs, when long string is given as title for
+// password
+// [Root Cause] TSE is not handling properl when PasswordTitle length
+// exceeds screen width
+// [Solution] Handled password title length based on screen width and
+// given support to display title in multiple lines.
+// [Files] postmgmtext.c, Popup.c, PopupEdit.c, PopupPassword.c
+//
+// 8 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 10 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 7 12/01/11 1:39a Premkumara
+// [TAG] EIP73236
+// [Category] Improvement
+// [Description] Large amounts of allocated memory are not freed
+// [Files] Expression.c, PopupEdit.c, Popup.c, MessageBox.c, Menu.c,
+// Memo.c,
+//
+// 6 11/21/11 8:55a Rajashakerg
+// [TAG] EIP69104
+// [Category] Improvement
+// [Description] Not to destroy the controls if it is NULL
+// [Files] control.c, edit.c, Label.c, memo.c, menu.c, ordlistbox.c,
+// popup.c, PopupSel.c, PopupString.c, SubMenu.c, Text.c.
+//
+// 5 6/28/11 10:14a Madhans
+// To remove ";" in unwanted case.
+//
+// 4 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 3 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 4 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 3 6/23/09 6:52p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:05p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: popup.c
+//
+// Description: This file contains code to handle popup operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+POPUP_METHODS gPopup =
+{
+ PopupCreate,
+ PopupDestroy,
+ PopupInitialize,
+ PopupDraw,
+ PopupHandleAction,
+ PopupSetCallback,
+ PopupSetFocus,
+ PopupSetPosition,
+ PopupSetDimensions,
+ PopupSetAttributes,
+ PopupGetControlHight
+};
+
+extern BOOLEAN IsShowPromptStringAsTitle(VOID);//EIP-116315 password string
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupCreate
+//
+// Description: this function uses the create function of control
+// and creates the Popup menu
+//
+// Input: POPUP_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupCreate( POPUP_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(POPUP_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create( object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gPopup;
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys the Popup menu
+//
+// Input: POPUP_DATA *popup, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupDestroy( POPUP_DATA *popup, BOOLEAN freeMem )
+{
+ if(NULL == popup)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( popup, FALSE );
+
+ if( freeMem ){
+ MemFreePointer( (VOID **)&popup->Title );//EIP-73236
+ MemFreePointer( (VOID **)&popup->Help1 );
+ MemFreePointer( (VOID **)&popup->Help2 );
+ MemFreePointer( (VOID **)&popup->Help3 );
+ MemFreePointer( (VOID **)&popup );
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupInitialize
+//
+// Description: this function uses the initialize function of control
+// and initializes the Popup menu
+//
+// Input: POPUP_DATA *popup, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupInitialize( POPUP_DATA *popup, VOID *data )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ Status = gControl.Initialize( (CONTROL_DATA *)popup, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ popup->PopupBorder = POPUP_SINGLE_BORDER; //Default border
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: GetLineCount
+//
+// Description: function to get line count and max width.
+//
+// Input: CHAR16 *line, UINT8 *Width
+//
+//
+// Output: UINTN
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN PopupGetLineCount(CHAR16 *line)
+{
+ CHAR16 * text;
+ UINTN i=1;
+ CHAR16 * String=line;
+
+
+ while(1)
+ {
+ CHAR16 save;
+
+ text = String;
+ if ( *String == L'\0' )
+ break;
+
+ while ( ( *String != L'\n' ) &&( *String != L'\r' ) && ( *String != L'\0' ) )
+ String++;
+
+ save = *String;
+ *String = L'\0';
+
+
+ if ( ( *String = save ) != L'\0' )
+ {
+ if ( *String == L'\r' )
+ { String++;
+ i--;
+ }
+ if ( *String == L'\n' )
+ {
+ String++;
+
+ if ( *(String - sizeof(CHAR16)) == L'\r' )
+ i++;
+ }
+ }
+ else
+ break;
+ i++;
+ }
+ return i;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupDrawString
+//
+// Description: function to draw string in a popup menu with attributes
+//
+// Input: POPUP_DATA *popup, CHAR16 *Str,UINT16 Top
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID PopupDrawString(POPUP_DATA *popup, CHAR16 *Str,UINT16 Top)
+{
+ CHAR16 *PadTitle = NULL;
+ UINTN Height = 0;
+ UINT16 OpCode = 0xFF;
+
+
+ if ((EFI_IFR_OP_HEADER*)popup->ControlData.ControlPtr) //If it has valid control pointer
+ {
+ //Skipping ESC code color not to print title in color for Popup controls like OneOf,CheckBox,String,Password(based on token IsShowPromptStringAsTitle)
+ if( (popup->ControlData.ControlType == CONTROL_TYPE_POPUPSEL) ||
+ (((EFI_IFR_OP_HEADER *)popup->ControlData.ControlPtr)->OpCode == EFI_IFR_STRING_OP) ||
+ (((EFI_IFR_OP_HEADER *)popup->ControlData.ControlPtr)->OpCode == CONTROL_TYPE_ORDERED_LIST) ||
+ ( IsShowPromptStringAsTitle() && ((EFI_IFR_OP_HEADER *)popup->ControlData.ControlPtr)->OpCode == EFI_IFR_PASSWORD_OP )
+ )
+ {
+ Str = TseSkipEscCode(Str);
+ }
+ }
+
+ if ((EFI_IFR_OP_HEADER*)popup->ControlData.ControlPtr) //If it has valid control pointer
+ OpCode = ((EFI_IFR_OP_HEADER*)popup->ControlData.ControlPtr)->OpCode;
+
+ //If control is of Password OR String type, and Multiline is supported
+ if ( ( (OpCode == EFI_IFR_PASSWORD_OP ) || (EFI_IFR_STRING_OP == OpCode) ) && IsTSEMultilineControlSupported() )
+ {
+ if (Str)
+ {
+ Height=(EfiStrLen(Str) / popup->Width)+(((EfiStrLen(Str) % popup->Width) > 0)?1:0);
+ DrawMultiLineStringWithAttribute (popup->Left+2, Top, popup->Width-3, Height, Str, 0);
+ }
+ }
+
+ else
+ {
+ if ( Str != NULL )
+ {
+ PadTitle = EfiLibAllocateZeroPool( (popup->Width + 3) * sizeof(CHAR16) );
+
+ //If no multiline support truncating the long string and showing ... at last
+ if((TestPrintLength( Str) / (NG_SIZE)) > popup->Width)
+ {
+ UINTN Index=HiiFindStrPrintBoundary(Str ,popup->Width);
+ Str[Index-4] = L'\0';
+ Str[Index-5] = L'.';
+ Str[Index-6] = L'.';
+ Str[Index-7] = L'.';
+ }
+
+ if ( PadTitle != NULL )
+ SPrint( PadTitle, (EfiStrLen(Str)) * sizeof(CHAR16), L" %s ",Str );
+ }
+
+ if ( PadTitle )
+ {
+ DrawStringJustified( 0, gMaxCols, Top, JUSTIFY_CENTER, PadTitle );
+ MemFreePointer((VOID **)&PadTitle);
+ }
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupDraw
+//
+// Description: function to draw popup menu with attributes
+//
+// Input: POPUP_DATA *popup
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupDraw( POPUP_DATA *popup )
+{
+ UINTN NumOfHelpLines = 0, NumOfTitleLines = 0;
+ CHAR16 *String = NULL, *text = NULL;
+ UINTN i=0;
+
+
+ BOOLEAN bShadow = StyleGetShadowSupport() ;
+ popup->Top = (UINT16)(gMaxRows - popup->Height) / 2;
+ popup->Left = (UINT16)(gMaxCols - popup->Width) / 2;
+
+ //EIP154407 System hangs if popup->Width is more than gMaxCols
+ if( popup->Width > gMaxCols)
+ {
+ popup->Width = (UINT16)(gMaxCols - 10);
+ }
+
+
+ if(popup->Style == POPUP_STYLE_NORMAL)
+ {
+ DrawWindow( popup->Left, popup->Top, popup->Width, popup->Height,
+ (UINT8)(popup->BGColor | popup->FGColor) , popup->Border, bShadow );
+
+ if ( popup->Title != NULL )
+ PopupDrawString(popup,popup->Title,popup->Top);
+ }
+ else
+ {
+#define TITLE_LINES 1
+#define HELP_LINES 3
+
+
+ if ( popup->Title != NULL )
+ NumOfTitleLines = 2 ;
+
+ if ( popup->Help1 != NULL )
+ NumOfHelpLines = PopupGetLineCount(popup->Help1)+1 ;
+
+
+ DrawWindow( popup->Left, popup->Top-NumOfTitleLines, popup->Width, popup->Height+NumOfHelpLines+NumOfTitleLines,
+ (UINT8)(popup->BGColor | popup->FGColor), FALSE, FALSE );
+
+ if(NumOfTitleLines)
+ DrawBorder( popup->Left, popup->Top-NumOfTitleLines, popup->Width, NumOfTitleLines+1 );
+ if(NumOfHelpLines)
+ DrawBorder( popup->Left, popup->Top+popup->Height-1, popup->Width, NumOfHelpLines+1);
+ DrawBorder( popup->Left, popup->Top-NumOfTitleLines, popup->Width, popup->Height+NumOfHelpLines+NumOfTitleLines );
+
+ if ( popup->Title != NULL )
+ PopupDrawString(popup,popup->Title,popup->Top-1);
+
+ //if ( popup->Help1 != NULL )
+ // PopupDrawString(popup,popup->Help1,popup->Top+popup->Height);
+
+ String = popup->Help1 ;
+
+ for(i=0;i<NumOfHelpLines;i++)
+ {
+ CHAR16 save;
+
+ text = String;
+ if ( *String == L'\0' )
+ break;
+
+ while ( ( *String != L'\n' ) &&( *String != L'\r' ) && ( *String != L'\0' ) )
+ String++;
+
+ save = *String;
+ *String = L'\0';
+
+ if((TestPrintLength( text ) / (NG_SIZE)) > (UINTN)(popup->Width-2))
+ EfiStrCpy( &text[HiiFindStrPrintBoundary(text,(UINTN)(popup->Width-5))],L"...");
+
+ PopupDrawString(popup, text, (UINT16)(popup->Top+popup->Height+i));
+
+
+ if ( ( *String = save ) != L'\0' )
+ {
+ String++;
+ if ( ( *String == L'\r' ) || ( *String == L'\n' ) )
+ String++;
+ }
+ }
+ }
+
+ return gControl.Draw( popup );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSetCallback
+//
+// Description: Function to set the Popup callback
+//
+// Input: POPUP_DATA *popup, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSetCallback( POPUP_DATA *popup, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return gControl.SetCallback( popup, container, callback, cookie );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupHandleAction
+//
+// Description: Function to handle the Popup Edit actions
+//
+// Input: POPUP_DATA *popup, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupHandleAction( POPUP_DATA *popup, ACTION_DATA *Data)
+{
+ //do nothing here, the action is handled on the child class either listbox or messagebox
+ return EFI_UNSUPPORTED;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSetFocus
+//
+// Description: Function to set focus
+//
+// Input: POPUP_DATA *popup, BOOLEAN focus
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSetFocus( POPUP_DATA *popup, BOOLEAN focus)
+{
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSetPosition
+//
+// Description: Function to set focus
+//
+// Input: POPUP_DATA *popup, UINT16 Left, UINT16 Top
+//
+// Output: Status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSetPosition( POPUP_DATA *popup, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( popup, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSetDimensions
+//
+// Description: Function to set the dimentions of the editable popup menu
+//
+// Input: POPUP_DATA *popup, UINT16 Width, UINT16 Height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSetDimensions( POPUP_DATA *popup, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( popup, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupSetAttributes
+//
+// Description: Function to set the dimentions of the editable popup menu
+//
+// Input: POPUP_DATA *popup, UINT8 FGColor, UINT8 BGColor
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupSetAttributes( POPUP_DATA *popup, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( popup, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PopupGetControlHight
+//
+// Description: Function unsuppored.
+//
+// Input: VOID *object,VOID *frame, UINT16 *height
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS PopupGetControlHight( VOID *object,VOID *frame, UINT16 *height )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 1985-2014, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Norcross, Suite 200, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+
diff --git a/EDK/MiniSetup/TseLite/popup.h b/EDK/MiniSetup/TseLite/popup.h
new file mode 100644
index 0000000..31768b3
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/popup.h
@@ -0,0 +1,161 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2010, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/popup.h $
+//
+// $Author: Arunsb $
+//
+// $Revision: 7 $
+//
+// $Date: 10/18/12 6:02a $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/popup.h $
+//
+// 7 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 9 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 6 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 5 2/26/10 8:54p Madhans
+// For TSE 2.01.1024. refer changelog.log for file checkin history .
+//
+// 6 2/26/10 1:30p Madhans
+// To avoid build issues with EDK.
+//
+// 5 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 4 8/17/09 12:27p Presannar
+// Removed References to Tiano.h and replaced it with Efi.h
+//
+// 3 6/16/09 2:16p Presannar
+// Added File Headers for Header Files
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:06p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:58p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: popup.h
+//
+// Description: Header file for code to handle popup operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _POPUP_H_
+#define _POPUP_H_
+
+#if TSE_USE_EDK_LIBRARY
+#include "Tiano.h"
+#else
+#include "Efi.h"
+#endif
+
+#include "control.h"
+
+// popup constants
+#define POPUP_SINGLE_BORDER 1
+#define POPUP_DOUBLE_BORDER 2
+
+#define POPUP_STYLE_NORMAL 0
+#define POPUP_STYLE_BBS 1
+
+#define POPUP_MEMBER_VARIABLES \
+ CHAR16 *Title; \
+ UINT16 PopupBorder; \
+ BOOLEAN Border; \
+ BOOLEAN Shadow; \
+ UINT16 Style; \
+ CHAR16 *Help1; \
+ CHAR16 *Help2; \
+ CHAR16 *Help3;
+
+typedef struct _POPUP_METHODS POPUP_METHODS;
+
+typedef struct _POPUP_DATA
+{
+ POPUP_METHODS *Methods;
+
+ OBJECT_MEMBER_VARIABLES
+ CONTROL_MEMBER_VARIABLES
+ POPUP_MEMBER_VARIABLES
+
+}
+POPUP_DATA;
+
+#define POPUP_METHOD_FUNCTIONS
+
+struct _POPUP_METHODS
+{
+ OBJECT_METHOD_FUNCTIONS
+ CONTROL_METHOD_FUNCTIONS
+ POPUP_METHOD_FUNCTIONS
+};
+
+extern POPUP_METHODS gPopup;
+
+// Object Methods
+EFI_STATUS PopupCreate( VOID **object );
+EFI_STATUS PopupDestroy( VOID *object, BOOLEAN freeMem );
+EFI_STATUS PopupInitialize( VOID *object, VOID *data );
+EFI_STATUS PopupDraw( VOID *object );
+EFI_STATUS PopupHandleAction(VOID *object, ACTION_DATA *Data);
+EFI_STATUS PopupSetCallback( VOID *object, VOID *container, OBJECT_CALLBACK callback, VOID *cookie );
+
+// Control Methods
+EFI_STATUS PopupSetFocus(VOID *object, BOOLEAN focus);
+EFI_STATUS PopupSetPosition(VOID *object, UINT16 Left, UINT16 Top);
+EFI_STATUS PopupSetDimensions(VOID *object, UINT16 Width, UINT16 Height);
+EFI_STATUS PopupSetAttributes(VOID *object, UINT8 FGColor, UINT8 BGColor);
+EFI_STATUS PopupGetControlHight( VOID *object,VOID *frame, UINT16 *height );
+
+#endif /* _POPUP_H_ */
+
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/time.c b/EDK/MiniSetup/TseLite/time.c
new file mode 100644
index 0000000..8a55a60
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/time.c
@@ -0,0 +1,1121 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2013, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/time.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 33 $
+//
+// $Date: 5/01/14 11:27p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/time.c $
+//
+// 33 5/01/14 11:27p Arunsb
+// [TAG] EIP128948
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] TSE security code check failure for using uninitialized
+// variable "Action"
+// [RootCause] Action variable in TimeHanldeActionKeyMouse and
+// _PostPopupEditGetValues is not initialized
+// [Solution] Initialized Action variable.
+// [Files] Time.c, TseAdvanced.c
+//
+// 32 5/01/14 3:46p Premkumara
+// [TAG] EIP123727
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Enabling Multiline and in Boot option priorities, Clicking
+// on second or third line of the boot item is not selecting boot options
+// menu
+// [RootCause] Proper Condition was not there to check whether Mouse
+// Click
+// is within the Width and Height of Control or not.
+// [Solution] Added Proper Condition to check whether Mouse Click
+// is within the Width and Height of Control or not.
+// [Files] Date.c, time.c, frame.c, SubMenu.c, numeric.c,
+// PopupString.c, PopupSel.c, ordlistbox.c, PopupPassword.c, UefiAction.c,
+//
+// 31 2/11/14 9:03p Arunsb
+// Changes reverted for 2.16.1243 label
+//
+// 30 11/06/13 1:24a Premkumara
+// [TAG] EIP128948
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] TSE security code check failure for using uninitialized
+// variable "Action"
+// [RootCause] Action variable in TimeHanldeActionKeyMouse and
+// _PostPopupEditGetValues is not initialized
+// [Solution] Initialized Action variable.
+// [Files] Time.c, TseAdvanced.c
+//
+// 29 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 13 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 28 4/05/12 7:26a Rajashakerg
+// [TAG] EIP87122,85508,86449
+// [Category] Improvement
+// [Description] Numeric in old style, softkbd issues
+// [Files] CommonHelper.c, Mouse.c, Date.c, edit.c, frame.c,
+// minisetupext.h, numeric.c, numeric.h, PopupEdit.c, PopupEdit.h, time.c
+//
+// 27 2/02/12 1:18p Premkumara
+// [TAG] EIP75351,75352,75384
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] String.c, boot.c, TseAdvanced.c,Time.c, PopupEdit.c,
+// MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 26 1/11/12 7:41a Arunsb
+// [TAG] EIP79965
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Unable to set the date and time with the soft keyboard and
+// mouse
+// [RootCause] Softkbd disabled even the control is active
+// [Solution] Disabled the softkbd only when control is inactive
+// [Files] Date.c and time.c
+//
+// 25 12/08/11 7:02p Blaines
+// [TAG] - EIP 77070
+// [Category]- Function Request
+// [Synopsis]- "-"key can not loop the time setting..
+// [Files]
+// time.c
+//
+// 24 12/07/11 9:01a Rajashakerg
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Moved the UefiPreControlUpdate function call in time.c
+// and date.c to the appropriate place.
+// [Files] time.c, date.c
+//
+// 23 11/30/11 12:32a Premkumara
+// [TAG] EIP75351
+// [Category] Improvement
+// [Description] Static code analysis.Suppress the warnings from static
+// code analyzer
+// [Files] String.c, HiiString21.c, TseAdvanced.c, Special.c,
+// UefiAction., Time.c, PopupEdit.c, MessageBox.c, Label.c, Edit.c, Date.c
+//
+// 22 11/28/11 5:00a Rajashakerg
+// [TAG] EIP73231
+// [Category] Improvement
+// [Description] Callback handling :For interactive controls updating
+// the currnet vaule in cache even when hii callback returns error status.
+// [Files] Date.c, SubMenu.c, ordlistbox.c, time.c, UefiAction.c,
+// hii.h, uefi20Wapper.c, HiiCallback.c, TseUefiHii.h, Uefi21Wapper.c
+//
+// 21 11/21/11 11:02a Premkumara
+// [TAG] EIP72610
+// [Category] Improvement
+// [Description] Moving TSE_MULTILINE_CONTROLS to Binary
+// [Files] AMITSE-CommonHelper.c, AMITSE.sdl,
+// TSELITE-UefiAction.c, TseLite.sdl, Time.h, Text.c,
+// SubMenu.c, ResetButton.c, PopupString.c, PopupSel.h, PopupSel.c,
+// PopupPassword.c, OrderListBox.c, Numeric.c, Label.c, Frame.c, Edit.c,
+// Date.h, Date.c,
+// LEGACY-Legacy.c,
+// BOOTONLY- Minisetup.h
+//
+// 20 11/20/11 8:20a Rajashakerg
+// [TAG] EIP62763
+// [Category] Improvement
+// [Description] Utilize the Improvements done from mouse driver in
+// AMITSE
+// [Files] HookAnchor.h, TseCommon.h, AMITSE.sdl, CommonHelper.c,
+// commonoem.c, commonoem.h, buffer.c, globals.c, HookAnchor.c,
+// minisetup.h, notify.c, postmgmt.c, protocol.c, ezport.c, stylecommon.c,
+// Mouse.c, Action.c, Date.c, frame.c, MessageBox.c, minisetupext.c,
+// minisetupext.h, numeric.c, numeric.h, page.c, PopupEdit.c, PopupEdit.h,
+// PopupPassword.c, postmgmtext.c, time.c.
+//
+// 19 11/19/11 11:49a Arunsb
+// EIP 65222 changes has been removed for 2.14 release. Now it is added.
+//
+// 18 11/14/11 6:55p Blaines
+// [TAG] - EIP 75486
+// [Category]- Function Request
+// [Synopsis]- Support grayout condition for readonly controls.
+// [Description] - Display readonly controls as grayout, non-selectable.
+// [Files]
+// AMITSE.sdl, CommonHelper.c, Minisetupext.h, stylecommon.c, Legacy.c,
+// date.c, edit.c, label.c, memo.c, menu.c,, numeric.c, ordlistbox.c,
+// PopupPassword.c,
+// PopupSel.c, PopupString.c, ResetButton.c, SubMenu.c, Text.c, Time.c,
+// UefiAction.c, ctrlcond.c,
+//
+// 17 8/26/11 6:34p Blaines
+// [TAG] EIP68354
+// [Category] Bug Fix
+// [Severity] Normal
+// [RootCause] Callback was invoked during periodic update for time and
+// date controls without EFI_IFR_REFRESH_OP.
+// [Solution] Callback is only invoked for interactive controls.
+// [Files] TseLite: Time.c, Date.c,
+// Uefi21: Parese.c, Uefi21Wrapper.c
+//
+// 16 8/18/11 4:13a Arunsb
+// Reverted back to (INT)4.6.2_TSE_2_14_1219 source for making TSE Lite
+// release.
+//
+// 15 8/02/11 9:49a Arunsb
+// EIP 65222 fix uploaded again after the public label
+// 4.6.2_TSE_2_14_1219.
+//
+// 14 8/01/11 6:07a Arunsb
+// Reverted back to (INT)4.6.2_TSE_2_14_1219 source for making public
+// label.
+//
+// 13 7/28/11 10:36a Blaines
+// [TAG] - EIP 65222
+// [Category]- Defect
+// [Synopsis]- [ECS-DT][Acer][Q67H2-AM]Adjust RTC time issue.
+// [Description]- Set Power On by RTC Alarm -> Time(hh:mm:ss) function
+// error. When set 59 at second(ss) column. Press decrease key(-) and the
+// second(ss) value can't be modified.
+// [Solution] - In Case 2, change "if( (Tm.Second > 0) && (Tm.Hour >
+// time->Min ) )" to "if( (Tm.Second > 0) && (Tm.Second > time->Min ) )"
+// [Files changed] - Time.c
+// [Functions changed] - TimeDecrease
+//
+// 12 6/15/11 4:43p Arunsb
+// [TAG] EIP61650
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] Cannot edit time field when using new "time" format
+// [RootCause] Default refresh interval set to all the time variables
+// [Solution] Default refresh interval provided only for RTC time
+// variable
+// [Files] time.c, date.c, parse.c and uefihpktool.exe
+//
+// 11 3/09/11 7:23p Madhans
+// [TAG] EIP48615
+// [Category] Improvement
+// [Description] To support UEFI 2.1 RefreshOp. Based in Refersh Rate
+// Controls are refershed periodically.
+// [Files] minisetupext.h
+// SubMenu.h
+// SubMenu.c
+// Memo.c
+// Memo.h
+// numeric.c
+// numeric.h
+// time.c
+// Date.c
+// PopupSel.c
+// PopupSel.h
+// PopupString.c
+// PopupString.h
+// ordlistbox.c
+// minisetupext.c
+// UefiAction.c
+// hii.h
+// Uefi20wapper.c
+// hiicallback.c
+// Parse.c
+// tseuefihii.h
+// Uefi21wapper.c
+//
+// 10 11/30/10 2:07p Blaines
+// [TAG] - EIP 48979
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- Both Date & Time controls of setup menu do not display
+// gray-out color when the controls are in the gray-out state.
+//
+// [Rootcause] - Improper use of color variable for Date and Time controls
+// in the draw function.
+// [Solution] - Proper use of color variables to handle normal and
+// gray-out state for these controls.
+// [Files] - date.c and time.c
+//
+// 9 11/17/10 3:08p Madhans
+// [TAG] - EIP 48433
+// [Category]- Defect
+// [Severity]- Mordarate
+// [Symptom]- While editing Date and Time control pressing
+// Pageup/PageDown/Home keys
+// causes to leave Date&Time in the Edit state but changes foucs.
+// [Rootcause] - Default case of Action handling not done for Date and
+// Time controls.
+// [Solution] - Add the Default action handle caes for this controls.
+// [Files] - date.c and time.c
+//
+// 7 11/10/10 7:02p Blaines
+// EIP 47037: Add range checks to properly edit and update date/time.
+//
+// 6 6/04/10 12:53p Blaines
+// Add support for UEFI 2.1 date and time controls
+//
+// 5 4/16/10 5:13p Madhans
+// Changes for Tse 2.02. Please see Changelog.log for more details.
+//
+// 4 2/19/10 1:04p Madhans
+// Updated for TSE 2.01. Refer Changelog.log for File change history.
+//
+// 6 2/19/10 8:18a Mallikarjunanv
+// updated year in copyright message
+//
+// 5 2/17/10 7:03p Madhans
+// To suppor readonly control
+//
+// 4 1/09/10 6:46a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 3 6/23/09 6:53p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 3 6/03/09 11:22a Blaines
+// reverting back to alpha labled version
+//
+// 1 4/28/09 11:07p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 5 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 3/31/09 4:07p Madhans
+// Fix for EDK version
+//
+// 3 2/05/09 10:15a Madhans
+// Style Module created.
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Time.c
+//
+// Description: This file contains code to handle Time control operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+TIME_METHODS gTime =
+{
+ TimeCreate,
+ TimeDestroy,
+ TimeInitialize,
+ TimeDraw,
+ TimeHandleAction,
+ TimeSetCallback,
+ TimeSetFocus,
+ TimeSetPosition,
+ TimeSetDimensions,
+ TimeSetAttributes,
+ TimeGetControlHeight
+};
+
+static EFI_TIME EditTime;
+CHAR16 TimeTempNum[3];
+BOOLEAN CheckKeyinHotKeysList(AMI_EFI_KEY_DATA Key);
+VOID _TimeUpdateEntry(TIME_DATA *time);
+EFI_STATUS _TimeHandleActionKeyMouse( TIME_DATA *time, ACTION_DATA *Data);
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _TimeDecrease
+//
+// Description: to decrease the time, i.e. Hours/Mins/Secs based on the selection
+//
+// Input: TIME_DATA *time, UINT16 Selection
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _TimeDecrease(TIME_DATA *time )
+{
+ EFI_TIME Tm;
+
+ time->ControlActive =TRUE;
+ //gRT->GetTime(&Tm,NULL);
+ UefiGetTime(&time->ControlData, &Tm);
+
+
+ switch(time->Sel )
+ {
+ case 0:
+ if((Tm.Hour > 0) && (Tm.Hour > time->Min ))
+ Tm.Hour--;
+ else
+ Tm.Hour = /*(time->Max < 23)? (UINT8)time->Max :*/ 23 ; //EIP 77070
+ StrZeroPad(Tm.Hour, TimeTempNum); //Update the static time string
+ break;
+ case 1:
+ if( (Tm.Minute > 0) && (Tm.Minute > time->Min ))
+ Tm.Minute--;
+ else
+ Tm.Minute = /*(time->Max < 59)? (UINT8)time->Max :*/ 59; //EIP 77070
+ StrZeroPad(Tm.Minute, TimeTempNum); //Update the static time string
+ break;
+ case 2:
+ if( (Tm.Second > 0) && (Tm.Second > time->Min ) )
+ Tm.Second--;
+ else
+ Tm.Second = /*(time->Max < 59)? (UINT8)time->Max :*/ 59; //EIP 77070
+ StrZeroPad(Tm.Second, TimeTempNum); //Update the static time string
+ break;
+ }
+
+ UefiSetTime(&time->ControlData, &Tm);
+ //gRT->SetTime(&Tm);
+ time->ControlActive =FALSE;
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _TimeIncrease
+//
+// Description: to increase the time, i.e. Hours/Mins/Secs based on the selection
+//
+// Input: TIME_DATA *time, UINT16 Selection
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _TimeIncrease(TIME_DATA *time )
+{
+ EFI_TIME Tm;
+ time->ControlActive =TRUE;
+ //gRT->GetTime(&Tm,NULL);
+ UefiGetTime(&time->ControlData, &Tm);
+
+ switch(time->Sel )
+ {
+ case 0:
+ if(Tm.Hour < 23)
+ Tm.Hour++;
+ else
+ Tm.Hour =0;
+ StrZeroPad(Tm.Hour, TimeTempNum); //Update the static time string
+ break;
+ case 1:
+ if(Tm.Minute <59)
+ Tm.Minute++;
+ else
+ Tm.Minute =0;
+ StrZeroPad(Tm.Minute, TimeTempNum); //Update the static time string
+ break;
+ case 2:
+ if(Tm.Second <59)
+ Tm.Second++;
+ else
+ Tm.Second =0;
+ StrZeroPad(Tm.Second, TimeTempNum); //Update the static time string
+ break;
+ }
+
+ //gRT->SetTime(&Tm);
+ UefiSetTime(&time->ControlData, &Tm);
+ time->ControlActive =FALSE;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeCreate
+//
+// Description: this function uses the create function of control
+// and creates and sets the timer
+//
+// Input: TIME_DATA **object
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeCreate( TIME_DATA **object )
+{
+ EFI_STATUS Status = EFI_OUT_OF_RESOURCES;
+
+ if ( *object == NULL )
+ {
+ *object = EfiLibAllocateZeroPool( sizeof(TIME_DATA) );
+
+ if ( *object == NULL )
+ return Status;
+ }
+
+ Status = gControl.Create(object );
+ if ( ! EFI_ERROR(Status) )
+ (*object)->Methods = &gTime;
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeDestroy
+//
+// Description: this function uses the destroy function of control
+// and destroys the timer
+//
+// Input: TIME_DATA *time, BOOLEAN freeMem
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeDestroy( TIME_DATA *time, BOOLEAN freeMem )
+{
+ if(NULL == time)
+ return EFI_SUCCESS;
+
+ gControl.Destroy( (CONTROL_DATA *)time, FALSE );
+
+ if ( freeMem )
+ {
+ MemFreePointer((VOID **)&time->EditTime);
+ MemFreePointer( (VOID **)&time );
+ }
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeInitialize
+//
+// Description: this function uses the Initialize function of control
+// and initializes the time
+//
+// Input: TIME_DATA *time, VOID *data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeInitialize( TIME_DATA *time, VOID *data )
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ Status = gControl.Initialize( (CONTROL_DATA *)time, data );
+ if (EFI_ERROR(Status))
+ return Status;
+
+ // add extra initialization here...
+ time->ControlData.ControlHelp = UefiGetHelpField(time->ControlData.ControlPtr);
+ time->Interval = (UINT8)time->ControlData.ControlFlags.ControlRefresh;
+ time->LabelMargin = (UINT8)gControlLeftMargin;
+ time->Sel=0;
+ time->ControlFocus=FALSE;
+ time->ControlActive = FALSE;
+ time->EditTime = EfiLibAllocateZeroPool( sizeof(EFI_TIME) );
+ if ( time->EditTime == NULL )
+ Status = EFI_OUT_OF_RESOURCES;
+
+ SetControlColorsHook(NULL, NULL,
+ NULL, &(time->FGColor),
+ &(time->SelBGColor), &(time->SelFGColor),
+ &(time->BGColor), &(time->NSelFGColor),
+ NULL, &(time->LabelFGColor),
+ &(time->NSelLabelFGColor),
+ NULL, NULL,
+ NULL, NULL);
+
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeDraw
+//
+// Description: function to draw time with attributes
+//
+// Input: TIME_DATA *time
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeDraw( TIME_DATA *time )
+{
+ CHAR16 *t,text[50];
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 ColorTime = time->NSelFGColor ;
+ UINT8 ColorLabelTime = (time->ControlFocus)? time->LabelFGColor : time->NSelLabelFGColor ;
+ CHAR16 txt[6];
+
+ if(!(time->ControlActive))
+ //Status= gRT->GetTime(&EditTime,NULL);
+ UefiGetTime(&time->ControlData, time->EditTime);
+
+
+ // check conditional ptr if necessary
+ //EIP 75486 Support grayout condition for readonly controls
+ //if ( time->ControlData.ControlConditionalPtr != 0x0 )
+ //{
+ switch( CheckControlCondition( &time->ControlData ) )
+ {
+ case COND_NONE:
+ break;
+ case COND_GRAYOUT:
+ Status = EFI_WARN_WRITE_FAILURE;
+ ColorTime = ColorLabelTime = CONTROL_GRAYOUT_COLOR;
+ break;
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+ //}
+ t = HiiGetString( time->ControlData.ControlHandle, UefiGetPromptField(time->ControlData.ControlPtr));
+ //EIP-75351 Suppress the warnings from static code analyzer
+ if (NULL == t){
+ t = EfiLibAllocateZeroPool(2*sizeof(CHAR16));
+ if(!t)
+ return EFI_OUT_OF_RESOURCES;
+ EfiStrCpy(t,L" ");
+ }
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(time->Height>1 && IsTSEMultilineControlSupported())
+ {
+ DrawMultiLineStringWithAttribute( time->Left , time->Top,
+ (UINTN)(time->LabelMargin - time->Left),(UINTN) time->Height,
+ t,time->BGColor | ColorLabelTime );
+ }
+ else
+ {
+ // boundary overflow check
+ if ( EfiStrLen( t ) > (UINTN)(time->LabelMargin - time->Left )/*21*/ )
+ t[time->LabelMargin - time->Left ] = L'\0';
+
+ DrawStringWithAttribute( time->Left , time->Top, (CHAR16*)t,
+ time->BGColor | ColorLabelTime );
+ }
+ MemFreePointer((VOID **)&t);
+
+ EfiStrCpy(text,L"[ : : ]");
+ DrawStringWithAttribute( time->Left + time->LabelMargin, time->Top, (CHAR16*)text,
+ time->BGColor | ColorTime );
+
+ DrawStringWithAttribute( time->Left + time->LabelMargin +1 , time->Top,
+ ( (time->Sel==0) && (time->ControlActive == TRUE ) ) ? TimeTempNum :StrZeroPad( time->EditTime->Hour,txt),
+ (UINT8)((((time->Sel == 0) && (time->ControlFocus)) ?
+ time->SelBGColor | time->SelFGColor :
+ time->BGColor | ColorTime )) );
+
+ DrawStringWithAttribute( time->Left + time->LabelMargin + 4 , time->Top,
+ ( (time->Sel==1) && (time->ControlActive == TRUE ) ) ? TimeTempNum :StrZeroPad( time->EditTime->Minute,txt),
+ (UINT8)( (((time->Sel == 1) && (time->ControlFocus)) ?
+ time->SelBGColor | time->SelFGColor :
+ time->BGColor | ColorTime )) );
+
+ DrawStringWithAttribute( time->Left + time->LabelMargin +7 , time->Top,
+ ( (time->Sel==2) && (time->ControlActive == TRUE ) ) ? TimeTempNum :StrZeroPad( time->EditTime->Second,txt),
+ (UINT8)( (((time->Sel == 2) && (time->ControlFocus)) ?
+ time->SelBGColor | time->SelFGColor :
+ time->BGColor | ColorTime )) );
+
+ FlushLines(time->Top, time->Top);
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeHandleAction
+//
+// Description: function to handle the actions of time
+//
+// Input: TIME_DATA *time, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeHandleAction( TIME_DATA *time, ACTION_DATA *Data)
+{
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+
+ if ( Data->Input.Type == ACTION_TYPE_TIMER )
+ {
+ if(time->ControlActive)
+ return Status;
+
+ if (0 == time->ControlData.ControlFlags.ControlRefresh) //EIP61650 If control not has refresh no need of proceeding
+ return Status;
+
+ if(IsActiveControlPresent(gApp->PageList[gApp->CurrentPage]))
+ return Status;
+
+ if( --(time->Interval) == 0 )
+ {
+ // initialize the interval
+ time->Interval = (UINT8)(time->ControlData.ControlFlags.ControlRefresh);
+ return UefiRefershQuestionValueNvRAM(&(time->ControlData));
+ }
+ else
+ return Status;
+ }
+
+ if ( ! time->ControlFocus )
+ return Status;
+
+ if (( Data->Input.Type == ACTION_TYPE_KEY )||(Data->Input.Type == ACTION_TYPE_MOUSE))
+ return _TimeHandleActionKeyMouse(time, Data);
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _TimeHandleActionKeyMouse
+//
+// Description: function to handle the action key of time
+//
+// Input: TIME_DATA *time, ACTION_DATA *Data
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _TimeHandleActionKeyMouse(TIME_DATA *time, ACTION_DATA *Data)
+{
+ CONTROL_ACTION Action = ControlActionUnknown;
+ EFI_STATUS Status = EFI_UNSUPPORTED;
+ EFI_TIME Tm;
+ AMI_EFI_KEY_DATA key = Data->Input.Data.AmiKey;
+ if(time->ControlData.ControlFlags.ControlReadOnly)
+ return EFI_UNSUPPORTED;
+
+
+ //Get time
+ //gRT->GetTime( &Tm, NULL );
+ UefiGetTime(&time->ControlData, &Tm);
+
+
+ //Get mapping
+ if(Data->Input.Type == ACTION_TYPE_KEY)
+ {
+ Action = MapControlKeysHook(key);
+ }
+ else if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ {
+ if(ControlActionSelect == MapControlMouseActionHook(&Data->Input.Data.MouseInfo))
+ {
+ //EIP-123727 check whether MouseTop is within the Height and Width of Time Control or not
+ if( (Data->Input.Data.MouseInfo.Top >= (UINT32)time->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(time->Top+time->Height)) &&
+ (Data->Input.Data.MouseInfo.Left >= (UINT32)time->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(time->Left+time->Width))
+ )
+ {
+ Action = ControlActionSelect;
+ }
+ }
+ }
+
+ switch(Action)
+ {
+ case ControlActionNextLeft:
+//#if !SETUP_STYLE_EZPORT
+#if SETUP_STYLE_AWARD
+ if ( time->ControlActive )
+ _TimeUpdateEntry(time);
+
+ if ( time->Sel == 0 )
+ time->Sel = 2;
+ else
+ time->Sel--;
+
+ Status = EFI_SUCCESS;
+ break;
+#endif
+
+ case ControlActionNextRight:
+ if ( time->ControlActive )
+ _TimeUpdateEntry(time);
+
+#if SETUP_STYLE_AWARD
+ if ( time->Sel == 2 )
+ time->Sel = 0;
+ else
+ time->Sel++;
+
+ Status = EFI_SUCCESS;
+#endif
+ break;
+
+ case ControlActionNextUp:
+ case ControlActionNextDown:
+ if ( time->ControlActive )
+ _TimeUpdateEntry(time);
+ break;
+
+ case ControlActionAbort:
+ if ( time->ControlActive )
+ {
+ time->ControlActive = FALSE;
+ Status = EFI_SUCCESS;
+ }
+ break;
+
+ case ControlActionSelect:
+ if(Data->Input.Type == ACTION_TYPE_MOUSE)
+ NumericSoftKbdInit();
+ _TimeUpdateEntry(time);
+ _TimeUpdateHelp( time );
+// for EZPORT: expressely to go to next entry in time control after hitting enter
+//#if ! SETUP_STYLE_EZPORT
+#if SETUP_STYLE_AWARD
+ break;
+#endif
+ case ControlActionNextSelection:
+ if ( time->ControlActive )
+ _TimeUpdateEntry(time);
+
+ if ( time->Sel == 2 )
+ time->Sel = 0;
+ else
+ time->Sel++;
+
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionPrevSelection:
+ if ( time->ControlActive )
+ _TimeUpdateEntry(time);
+
+ if ( time->Sel == 0 )
+ time->Sel = 2;
+ else
+ time->Sel--;
+
+ Status = EFI_SUCCESS;
+ break;
+ case ControlActionDecreament:
+ if(time->ControlActive)
+ {
+ _TimeUpdateEntry(time);
+ }
+ _TimeDecrease( time );
+ time->ControlActive = TRUE; //Set control state to active, so that control string is updated with the static time string
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionIncreament:
+ if(time->ControlActive)
+ {
+ _TimeUpdateEntry(time);
+ }
+ _TimeIncrease( time );
+ time->ControlActive = TRUE; //Set control state to active, so that control string is updated with the static time string
+ Status = EFI_SUCCESS;
+ break;
+
+ case ControlActionNumeric:
+ if( !(time->ControlActive))
+ {
+ time->ControlActive = TRUE;
+ switch(time->Sel)
+ {
+ case 0: //month
+ SPrint(TimeTempNum,sizeof(TimeTempNum),L"%d", time->EditTime->Hour);
+ break;
+ case 1: // day
+ SPrint(TimeTempNum,sizeof(TimeTempNum),L"%d", time->EditTime->Minute);
+ break;
+ case 2: //year
+ SPrint(TimeTempNum,sizeof(TimeTempNum),L"%d", time->EditTime->Second );
+ break;
+ }
+ }
+
+
+ if(EfiStrLen(TimeTempNum)>1)
+ TimeTempNum[0] = TimeTempNum[1];
+
+ TimeTempNum[1] = key.Key.UnicodeChar;
+ Status = gTime.Draw(time);
+ break;
+ default:
+ if ( time->ControlActive )
+ _TimeUpdateEntry(time);
+ break;
+ }
+
+ if( (((!time->ControlActive)||(!IsMouseClickedonSoftkbd())) && (TSEMouseIgnoreMouseActionHook() == TRUE) )&&
+ (((Data->Input.Type == ACTION_TYPE_KEY) &&
+ ((Action == ControlActionNextLeft) ||(Action == ControlActionNextRight) ||(Action == ControlActionNextUp) ||(Action == ControlActionNextDown) ||(Action == ControlActionPageUp) ||(Action == ControlActionPageDown) ||(Action == ControlActionAbort) ||(Action == ControlActionHome) ||(Action == ControlActionEnd) ||(CheckKeyinHotKeysList(key))) ) ||
+ ((Data->Input.Type == ACTION_TYPE_MOUSE)&&((!((Data->Input.Data.MouseInfo.Top >= (UINT32)time->Top) && (Data->Input.Data.MouseInfo.Top < (UINT32)(time->Top+time->Height))&&(Data->Input.Data.MouseInfo.Left >= (UINT32)time->Left) && (Data->Input.Data.MouseInfo.Left < (UINT32)(time->Left+time->Width))))||(Action == ControlActionAbort))))
+ )
+ {
+ NumericSoftKbdExit();//EIP62763 : Check for softkbd presence and existing the numeric softkbd
+ }
+ _TimeUpdateHelp( time );
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeSetCallback
+//
+// Description: Function to set callback.
+//
+// Input: TIME_DATA *time, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeSetCallback( TIME_DATA *time, OBJECT_DATA *container, OBJECT_CALLBACK callback, VOID *cookie )
+{
+ return EFI_UNSUPPORTED;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeSetFocus
+//
+// Description: Function to set focus.
+//
+// Input: TIME_DATA *time, BOOLEAN focus
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeSetFocus(TIME_DATA *time, BOOLEAN focus)
+{
+ if(focus != FALSE)
+ {
+ if ( CheckControlCondition( &time->ControlData ) )
+ return EFI_UNSUPPORTED;
+ }
+
+ if( !(time->ControlFocus && focus) )
+ {
+ time->ControlFocus = focus;
+ // set the selected field to Hour
+ time->Sel = 0;
+ _TimeUpdateHelp( time );
+ }
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeSetPosition
+//
+// Description: Function to set position.
+//
+// Input: TIME_DATA *time, UINT16 Left, UINT16 Top
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeSetPosition(TIME_DATA *time, UINT16 Left, UINT16 Top )
+{
+ return gControl.SetPosition( time, Left, Top );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeSetDimensions
+//
+// Description: Function to set time dimension.
+//
+// Input: TIME_DATA *time, UINT16 Width, UINT16 Height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeSetDimensions(TIME_DATA *time, UINT16 Width, UINT16 Height )
+{
+ return gControl.SetDimensions( time, Width, Height );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeSetAttributes
+//
+// Description: Function to set time attributes.
+//
+// Input: TIME_DATA *time, UINT8 FGColor, UINT8 BGColor
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeSetAttributes(TIME_DATA *time, UINT8 FGColor, UINT8 BGColor )
+{
+ return gControl.SetAttributes( time, FGColor, BGColor );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TimeGetControlHeight
+//
+// Description: Function to set time height.
+//
+// Input: TIME_DATA *time, frame, UINT16 *height
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS TimeGetControlHeight(TIME_DATA *time,VOID *frame , UINT16 *height)
+{
+ //EIP-72610 TSE_MULTILINE_CONTROLS moved to binary
+ if(IsTSEMultilineControlSupported())
+ {
+ CHAR16 *newText = NULL,*text=NULL;
+ UINT16 Width;
+
+ *height = 1;
+ Width = (UINT16)(time->LabelMargin - (((FRAME_DATA*)frame)->FrameData.Left + (UINT8)gControlLeftPad));
+ text = HiiGetString( time->ControlData.ControlHandle, UefiGetPromptField(time->ControlData.ControlPtr));
+
+ newText = StringWrapText( text, Width, height );
+
+ (*height) = (*height) ? (*height):1;
+
+ MemFreePointer( (VOID **)&newText );
+ MemFreePointer( (VOID **)&text );
+ }
+ else
+ {
+ *height = 1;
+ }
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _TimeUpdateHelp
+//
+// Description: function to update the help of time
+//
+// Input: TIME_DATA *time
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _TimeUpdateHelp( TIME_DATA *time )
+{
+ UINT16 helpToken = time->ControlData.ControlHelp;
+
+ switch ( time->Sel )
+ {
+ case 0:
+ UefiGetDateTimeDetails(time->ControlData.ControlPtr,AMI_TIME_HOUR,&helpToken,&time->Min,&time->Max);
+ break;
+
+ case 1:
+ UefiGetDateTimeDetails(time->ControlData.ControlPtr,AMI_TIME_MIN,&helpToken,&time->Min,&time->Max);
+ break;
+
+ case 2:
+ UefiGetDateTimeDetails(time->ControlData.ControlPtr,AMI_TIME_SEC,&helpToken,&time->Min,&time->Max);
+ break;
+ default:
+ break;
+ }
+
+ time->ControlData.ControlHelp = helpToken;
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _TimeUpdateEntry
+//
+// Description: function to update the entries in Time
+//
+// Input: TIME_DATA *time
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _TimeUpdateEntry(TIME_DATA *time)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ if ( time->ControlActive )
+ {
+ // focus stays on the selection becuase we just edited it
+ switch ( time->Sel )
+ {
+ case 0:
+ time->EditTime->Hour = (UINT8)atoi(TimeTempNum, 10);
+ break;
+ case 1:
+ time->EditTime->Minute = (UINT8)atoi(TimeTempNum, 10);
+ break;
+ case 2:
+ time->EditTime->Second = (UINT8)atoi(TimeTempNum, 10);
+ break;
+ }
+
+ UefiPreControlUpdate(&(time->ControlData));
+ UefiSetTime(&time->ControlData, time->EditTime);
+ //For interactive time control invoke the formcallback functions
+ if(UefiIsInteractive(&time->ControlData)){//code for callback based on interactive time control
+ UINT8 Flags = UefiGetFlagsField(time->ControlData.ControlPtr) ;
+
+
+ if(CheckTimeFlags(Flags))
+ {
+ //for storage type QF_TIME_STORAGE_NORMAL generate time in EFI_HII_TIME format
+
+ //Call the callbacks passing the generated input value and value size
+ Status = CallFormCallBack(&time->ControlData, UefiGetControlKey(&time->ControlData), 0, AMI_CALLBACK_CONTROL_UPDATE);
+ } //else {
+ //This case would be handled by UefiSetTime() outside
+ //since this case is directly updated using the runtime services
+ //}
+ }
+ //gRT->SetTime( &EditTime );
+ time->ControlActive = FALSE;
+ }
+}
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/EDK/MiniSetup/TseLite/variable.c b/EDK/MiniSetup/TseLite/variable.c
new file mode 100644
index 0000000..757d324
--- /dev/null
+++ b/EDK/MiniSetup/TseLite/variable.c
@@ -0,0 +1,1488 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/variable.c $
+//
+// $Author: Arunsb $
+//
+// $Revision: 34 $
+//
+// $Date: 2/11/14 8:44p $
+//
+//*****************************************************************//
+//*****************************************************************//
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseLite/variable.c $
+//
+// 34 2/11/14 8:44p Arunsb
+// [TAG] EIP135606
+// [Category] Bug Fix
+// [Symptom:] SAS Driver Issues.
+// [Root Cause] In the function CopyNvramVariableList, the buffered value
+// for DynamicPageCount variable is updated from nvram when copying from
+// one variable list to another variable list.
+// [Solution] In the function CopyNvramVariableList, update the buffered
+// value for DynamicPageCount from the cached value of the variable.
+// [Files] variable.c
+//
+// 33 7/02/13 10:09a Premkumara
+// [TAG] EIP120011
+// [Category] Improvement
+// [Description] Variable BootOrder and LegacyDevOrder need
+// fool-proofing function when TSE load variabled
+// [Files] Bbs.c, Boot.c, Callback.c, TseLiteHelper.c, Variable.c
+//
+// 32 5/22/13 10:47a Arunsb
+// General checks added
+//
+// 31 10/18/12 6:02a Arunsb
+// Updated for 2.16.1235 QA submission
+//
+// 14 10/10/12 12:38p Arunsb
+// Synched the source for v2.16.1232, backup with Aptio
+//
+// 29 9/17/12 6:20a Rajashakerg
+// Updated EIP changes for 2.16 release.
+//
+// 27 9/11/12 3:40p Blaines
+// [TAG] - EIP 100429
+// [Category] - Function Request
+// [Synopsis] - "Save and exit" pop up message appear when viewing BBS
+// priorities in BIOS menu
+// [Root cause] - The function SetupConfigModifiedHook is called whenever
+// a variable is modified from Setup.
+// [Solution] - Prevent calls to SetupConfigModifiedHook for variables
+// that don't affect setup changes.
+// [Files] - Variable.c
+//
+// 26 8/29/12 8:52a Premkumara
+// [TAG] EIP93954
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Boot Options get corrupted on Loading defaults when
+// TseDefaultBootOrder is added.
+// [RootCause] Legacy dev order is not updated properly.
+// [Solution] Restore Default issue
+// [Files] variable.c
+//
+// 25 5/09/12 7:39a Rajashakerg
+// [TAG] EIP71351
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] System hangs with SETUP_RUNTIME_IFR_PROCESSING enabled and
+// Intel GIG Undi driver
+// [RootCause] The issue is occured when driver is loaded from shell the
+// variable is not updated propely in setup
+// [Solution] If the variable ist is null then clearing the cache values
+// and updaitng the cache with new list
+// [Files] variable.c
+//
+// 24 4/27/12 7:52a Premkumara
+// [TAG] EIP81402
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] HDD Port Number is not properly updated after adding
+// "TseDefaultBootOrder"
+// [RootCause] when GROUP_BOOT_OPTIONS_BY_TAG=0 BBSList->Name is not
+// returned properly
+// [Solution] Returned BBSList->Name properly
+// [Files] bbs.c, variable.c
+//
+// 23 1/24/12 4:42a Arunsb
+// [TAG] EIP81581
+// [Category] Improvement
+// [Description] Default driver order support
+// [Files] globals.c, addbootoption.c, callback.c, minisetupext.h and
+// variable.c
+//
+// 22 1/20/12 5:07a Rajashakerg
+// [TAG] EIP77875
+// [Category] Improvement
+// [Description] Minisetup: Memory leaks in text browser
+// [Files] Uefi21Wapper.c, hiistring21.c, variable.c
+//
+// 21 12/16/11 1:36a Arunsb
+// [TAG] EIP76381
+// [Category] Improvement
+// [Description] Performance: Improving variable data load and usage.
+// Upto TSE entering into setup the
+// variables are read from
+// NVRAM in setup it will read from
+// temporary buffer.
+//
+// 20 12/05/11 5:43a Rajashakerg
+// [TAG] EIP76381
+// [Category] Improvement
+// [Description] Performance: Improving variable data load and usage
+// [Files] callback.c, minisetupext.c, variable.c, variable.h,
+// minisetup.h, Hii.c, FormBrowser2.c
+//
+// 19 12/02/11 8:21a Arunsb
+// [TAG] EIP75524
+// [Category] Improvement
+//
+// 18 11/30/11 11:29p Arunsb
+// [TAG] EIP75588
+// Build error correction
+//
+// 17 11/30/11 1:31p Premkumara
+// [TAG] EIP75352
+// [Category] Improvement
+// [Description] Suppress the warnings from static code analyzer
+// [Files] Boot.c, bbs.c, TseAdvanced.c, Special.c, Variable.c,
+// TseLiteHelper.c, PopupSel.c, AddBootOption.c, Hii.c, FormBrowser2.c
+//
+// 16 11/30/11 6:39a Premkumara
+// [TAG] EIP71351
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Setup Crash when iSCSI is loaded
+// [RootCause] Aptio giving length as 0xe(matches size of
+// EFI_IFR_ONE_OF_OPTION) but in latest EDKII driver it is 0x1c.
+// [Solution] change the length as j += ((EFI_IFR_OP_HEADER*)(buff + i +
+// j))->Length;
+// [Files] Parse.c, Hii.c, Variable.c, Minisetupext.c
+//
+// 15 11/23/11 5:11a Rajashakerg
+// [TAG] EIP75473
+// [Category] Improvement
+// [Description] System Time is not updated every second
+// [Files] variable.h, variable.c, FormBrowser2.c, TseUefiHii.h,
+// Uefi21Wapper.c, hii.h, uefi20Wapper.c
+//
+// 14 11/13/11 1:09p Arunsb
+// [TAG] EIP70421
+// [Category] New Feature
+// [Description] Support for driver order in TSE
+// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
+// boot.c,
+// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
+// addbootoption.c,
+// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
+// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
+// TseElink.h, variable.h,
+// setup.h, Boot.vfr and Setup.uni
+//
+// 13 10/31/11 9:37a Rajashakerg
+// [TAG] EIP71120,71512
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] BIOS gets stuck in infinite loop On enabling
+// TSE_LOAD_OPTION_HIDDEN token,In first boot incorrect devices is
+// disabled in Setup & BBS table but in second boot the correct device is
+// disabled in both places.
+// [Solution] Hidden option handled properly.
+// [Files] TseLite\variable.c, TseLite\minisetupext.c, TseAdvanced.c,
+// special.c, BootOnly\minisetup.h,BootOnly\boot.c, BootOnly\bbs.c
+//
+// 12 9/28/11 12:38p Arunsb
+// [TAG] EIP69143
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] CPU exception
+// [RootCause] Accessing gVariableList even it is NULL in
+// VarUpdateVariable function.
+//
+// [Solution] gVariableList initialized by calling VarLoadVariables
+// [Files] TseLite\variable.c
+//
+// 10 8/23/11 1:25p Arunsb
+// In _VarUpdate function if VarGetNvram returns NULL then no need to
+// update the buffer
+//
+// 9 5/11/11 12:07p Madhans
+// [TAG] EIP54219
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Language Popup Control will not update correctly
+// CHINESE_TRAD,CHINESE_SIMP used togather.
+// [RootCause] The Current Language is not read from the NVRAM fully and
+// compared. It was reading only 2 bytes for Lanugage comparition.
+// [Solution] _VarGetRealValue function fixed to compare the Current
+// Lang from NVRAM is read and compared with supported languages.
+// [Files] variable.c
+//
+// 8 3/23/11 8:38p Blaines
+// [TAG] - EIP 23601
+// [Category]- Enhancement
+// [Symptom]- Add support for OEM special controls.
+// [Files] - AmiTse.sdl, CommonHelper.c, Setup.ini, UefiSetup.ini,
+// AmiVfr.h, minisetup.h, minisetup.sdl, variable.c, special.c
+//
+// 7 1/07/11 12:23a Mallikarjunanv
+// [TAG] EIP51619
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Changing the option in the "HDD BBS Priority" option not
+// reflected in the boot options list.
+// [RootCause] Boot page is not updated properly with changes made by
+// BBS HDD BBS Priority
+// [Solution] Updated the boot page with changes made by BBS HDD BBS
+// Priority
+// [Files] special.c, variable.c
+//
+// 6 12/24/10 12:56p Mallikarjunanv
+// [TAG] EIP 46296
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] HDD BBS priority option having two same entries in its list
+// (with 2 SATA HDD, 1 USB drive emulated as FDD)
+// [RootCause] The defaults for BBS order variable not initialized
+// properly.
+// [Solution] Fixed the issue by properly initializing the defaults for
+// BBS order variable.
+//
+// [Files] variable.c
+//
+// 5 9/16/10 8:38p Madhans
+// Update for TSE 2.10. Refer Changelog.log for more details.
+//
+// 9 9/13/10 4:43p Madhans
+// BBSReOrderDefultLegacyDevOrder() function checks if the
+// DefaultLegacyDevOrder can be considered or not. (if the device list is
+// different from LegacyDevOrder then DefaultLegacyDevOrder is ignored.)
+// on that case make the Size of gOptimalDefaults[ VARIABLE_ID_BBS_ORDER ]
+// also 0.
+//
+// 8 2/19/10 8:19a Mallikarjunanv
+// updated year in copyright message
+//
+// 7 2/18/10 8:26p Madhans
+// To take care NOGET and NOSET Attribs from Exetendedflags of
+// VariableInfo
+//
+// 6 1/27/10 9:30a Mallikarjunanv
+// EIP-24971: Tse features without tse sources support update for token
+// SETUP_SUPPORT_PLATFORM_LANG_VAR
+//
+// 5 1/09/10 7:10a Mallikarjunanv
+// Updated TSE2.01 Release sources with coding standards
+//
+// 4 9/15/09 9:52a Sudhirv
+// //to Ignore the DefaultLegacyDevOrder if is size is not matching with
+// LegacyDevOder.
+//
+// 3 6/23/09 6:53p Blaines
+// Coding standard update,
+// Remove spaces from file header to allow proper chm function list
+// creation.
+//
+// 2 6/12/09 7:44p Presannar
+// Initial implementation of coding standards for AMITSE2.0
+//
+// 1 6/04/09 8:05p Madhans
+//
+// 1 4/28/09 11:07p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 4 4/28/09 9:40p Madhans
+// Tse 2.0 Code complete Checkin.
+//
+// 3 3/31/09 4:13p Madhans
+// UEFI 2.1 Support
+//
+// 2 1/30/09 6:06p Madhans
+// Function headers added.
+//
+// 1 12/18/08 7:59p Madhans
+// Intial version of TSE Lite sources
+//*****************************************************************//
+//*****************************************************************//
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: variable.c
+//
+// Description: This file contains code to handle variable operations
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "minisetup.h"
+
+extern UINTN gSetupCount;
+
+//---------------------------------------------------------------------------
+// Variables
+//---------------------------------------------------------------------------
+NVRAM_VARIABLE *gCurrNvramVarList = (NVRAM_VARIABLE *)NULL;
+UINTN gCurrNvramVarCount = 0;
+
+CHAR8 *gPrevLanguage;
+UINTN gPrevLangSize = 0;
+BOOLEAN gSetupUpdated = FALSE;//EIP:51619 Flag which represents the setup update
+
+#if SETUP_OEM_SPECIAL_CONTROL_SUPPORT
+EFI_STATUS OEMSpecialUpdateOneOf(UINT16 newOption,UINT32 *offset,UINTN *size, VOID OUT **buffer);
+#endif // SETUP_OEM_SPECIAL_CONTROL_SUPPORT
+
+UINT8 IsBootOptionsGroupingEnabled (void); //EIP-93954 To Restore BootOption default issue
+
+//EIP 76381 : START
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: GetNvramVariableList
+//
+// Description: Gets all system variables
+//
+// Input: NVRAM_VARIABLE **RetNvramVarList - Returns pointer to the var list
+//
+// Output: EFI_STATUS status - EFI_SUCCESS if successful, else EFI_ERROR
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS GetNvramVariableList(NVRAM_VARIABLE **RetNvramVarList)
+{
+ EFI_STATUS status = EFI_SUCCESS;
+ NVRAM_VARIABLE *nvVarlist = (NVRAM_VARIABLE *)NULL;
+ UINT32 index = 0;
+
+ if ( (gCurrNvramVarList == NULL) || (gVariables->VariableCount != gCurrNvramVarCount) || (gPostStatus <= TSE_POST_STATUS_ENTERING_TSE))
+ {
+ gCurrNvramVarList = EfiLibAllocateZeroPool(gVariables->VariableCount * sizeof(NVRAM_VARIABLE));
+ if(gCurrNvramVarList == NULL)
+ {
+ status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+
+ // Get the Current Values from the NVRAM
+ nvVarlist = gCurrNvramVarList;
+ for(index = 0; index < gVariables->VariableCount; index++, nvVarlist++){
+ nvVarlist->Buffer = VarGetNvram(index, &nvVarlist->Size);
+ if ((0 != nvVarlist->Size) && (NULL == nvVarlist->Buffer))
+ {
+ nvVarlist->Buffer = EfiLibAllocateZeroPool (nvVarlist->Size);
+ }
+ }
+ gCurrNvramVarCount = gVariables->VariableCount;
+ }
+ status = CopyNvramVariableList(gCurrNvramVarList, RetNvramVarList);
+
+DONE:
+ return status;
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: CleanTempNvramVariableList()
+//
+// Description: Clean up the current retrive variable list
+//
+// Input: None
+//
+// Output: VOID
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID CleanTempNvramVariableList()
+{
+ NVRAM_VARIABLE *nvVarlist = (NVRAM_VARIABLE *)NULL;
+ UINT32 index = 0;
+
+ if(gCurrNvramVarList != NULL){
+ nvVarlist = gCurrNvramVarList;
+ for(index = 0; index < gCurrNvramVarCount; index++, nvVarlist++){
+ MemFreePointer(&nvVarlist->Buffer);
+ }
+ }
+ gCurrNvramVarCount = 0;
+ MemFreePointer(&gCurrNvramVarList);
+ gCurrNvramVarList = (NVRAM_VARIABLE *)NULL;
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: CopyNvramVariableList
+//
+// Description: Copies variable buffer from one var list to another var list
+//
+// Input: NVRAM_VARIABLE *SrcVarList - Source variable list
+// NVRAM_VARIABLE **DestVarList - Destination variable list
+//
+// Output: EFI_STATUS status - EFI_SUCCESS if successful, else EFI_ERROR
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS CopyNvramVariableList(NVRAM_VARIABLE *SrcVarList, NVRAM_VARIABLE **DestVarList)
+{
+ EFI_STATUS status = EFI_SUCCESS;
+ UINT32 index = 0;
+ NVRAM_VARIABLE *varPtr = (NVRAM_VARIABLE *)NULL;
+ NVRAM_VARIABLE *currVarPtr = (NVRAM_VARIABLE *)NULL;
+
+ *DestVarList = (NVRAM_VARIABLE *)EfiLibAllocateZeroPool(gVariables->VariableCount * sizeof(NVRAM_VARIABLE));
+ if(*DestVarList == NULL){
+ status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+
+ varPtr = *DestVarList;
+ currVarPtr = SrcVarList;
+ for(index = 0; index < gVariables->VariableCount; index++, varPtr++, currVarPtr++)
+ {
+ if((varPtr->Buffer == NULL) && (currVarPtr != NULL) && (currVarPtr->Size != 0))
+ {
+ varPtr->Buffer = EfiLibAllocatePool(currVarPtr->Size);
+ if(varPtr->Buffer == NULL){
+ status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ } else{
+ if (currVarPtr->Buffer)
+ {
+ //EIP-135606: Update the buffered value for DynamicPageCount from the cache.
+ if(index == VARIABLE_ID_DYNAMIC_PAGE_COUNT)
+ VarGetValue( VARIABLE_ID_DYNAMIC_PAGE_COUNT, 0, sizeof(UINT16), currVarPtr->Buffer );
+ MemCopy( varPtr->Buffer, currVarPtr->Buffer, currVarPtr->Size );
+ }
+ varPtr->Size = currVarPtr->Size;
+ }
+ }
+ }
+DONE:
+ return status;
+}
+//EIP 76381 : END
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarLoadVariables
+//
+// Description: function to load the variables
+//
+// Input: VOID **list, NVRAM_VARIABLE *defaultList
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS VarLoadVariables( VOID **list, NVRAM_VARIABLE *defaultList )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT32 index;
+
+ NVRAM_VARIABLE *varPtr;
+ NVRAM_VARIABLE *defaultVar = defaultList;
+
+ if(*list != NULL)//EIP 71351 : If the list is null then clearing the cache values and updaitng the cache with new list
+ CleanTempNvramVariableList();
+ MemFreePointer( (VOID **)list );
+
+ if( ( ! gVariables ) || ( gVariables->VariableCount == 0 ) ) // fatal error
+ while(1);
+
+ Status = GetNvramVariableList((NVRAM_VARIABLE **)list);
+ if(EFI_ERROR(Status)){
+ goto DONE;//EIP 76381 :Performance Improving of variable data load and usage
+ }
+
+ varPtr = *list;
+ for ( index = 0; index < gVariables->VariableCount; index++, varPtr++, defaultVar++ )
+ {
+ if ( ( varPtr->Buffer == NULL ) && ( defaultList != NULL ) && ( defaultVar->Size != 0 ) )
+ {
+ varPtr->Buffer = EfiLibAllocatePool( defaultVar->Size );
+ if ( varPtr->Buffer == NULL )
+ Status = EFI_OUT_OF_RESOURCES;
+ else
+ {
+ MemCopy( varPtr->Buffer, defaultVar->Buffer, defaultVar->Size );
+ varPtr->Size = defaultVar->Size;
+ }
+ }
+
+ if ( varPtr->Buffer == NULL ) // If varPtr->Buffer is still NULL Skip the variable.
+ continue;
+
+ //Introduce DISABLED_BOOT_OPTION in place of disabled options
+ //for mem copy of BootOrder and BBSOrder
+ if(gBootData && (VARIABLE_ID_BOOT_ORDER == index))
+ {
+ UINT16 *BootOrder = (UINT16 *)varPtr->Buffer;
+ BOOT_DATA *pBootData;
+ UINTN i;
+
+ for(i=0; i<(varPtr->Size / sizeof(UINT16)); i++)
+ {
+ pBootData = BootGetBootData(BootOrder[i]); //Should yield a valid option
+ if(NULL != pBootData) //EIP-75352 Suppress the warnings from static code analyzer
+ {
+ if ( (!(pBootData->Active & LOAD_OPTION_ACTIVE)) && (!(pBootData->Active & LOAD_OPTION_HIDDEN)) )
+ BootOrder[i] = DISABLED_BOOT_OPTION;
+ }
+ }
+ }
+ //Introduce DISABLED_DRIVER_OPTION in place of disabled options
+ //Change the DriverOrder cache
+ else if (gDriverData && (VARIABLE_ID_DRIVER_ORDER == index)) //EIP70421 & 70422 Support for driver order
+ {
+ UINT16 *DriverOrder = (UINT16 *)varPtr->Buffer;
+ BOOT_DATA *pDriverData;
+ UINTN i;
+
+ for (i = 0; i < (varPtr->Size / sizeof (UINT16)); i++)
+ {
+ pDriverData = DriverGetDriverData (DriverOrder[i]); //Should yield a valid option
+ if (pDriverData)
+ {
+ if ( (!(pDriverData->Active & LOAD_OPTION_ACTIVE)) && (!(pDriverData->Active & LOAD_OPTION_HIDDEN)) )
+ DriverOrder [i] = DISABLED_DRIVER_OPTION;
+ }
+ }
+ }
+ else if(VARIABLE_ID_BBS_ORDER == index)
+ {
+ BBS_ORDER_TABLE *TypeEntry, *TSEDevOrder = (BBS_ORDER_TABLE *) varPtr->Buffer;
+ UINTN i,j,count;
+
+ TypeEntry = TSEDevOrder;
+ for(i=0; i < varPtr->Size;)
+ {
+ if ( ( TypeEntry->Length >= varPtr->Size) || (0 == TypeEntry->Length) ) //EIP-120011
+ {
+ break;
+ }
+
+ count = TypeEntry->Length / sizeof(UINT16) - 1;
+
+ for(j=0; j < count; j++)
+ {
+ if(TypeEntry->Data[j] & BBS_ORDER_DISABLE_MASK)
+ TypeEntry->Data[j] = DISABLED_BOOT_OPTION;
+ }
+
+ count = sizeof(UINT32) + TypeEntry->Length;
+ TypeEntry = (BBS_ORDER_TABLE *)((UINTN)TypeEntry + count);
+ i += count;
+ }
+ }
+ }
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarBuildDefaults
+//
+// Description: function to build the default variables
+//
+// Input: VOID
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS VarBuildDefaults( VOID )
+{
+ EFI_STATUS Status;
+
+ UINT8 *newBuffer = NULL;
+ UINT8 *DefDrvBuffer = NULL;
+ UINTN size = 0;
+
+ Status = VarBuildAMIDefaults();
+
+ if(Status == EFI_UNSUPPORTED)
+ {
+ Status = HiiLoadDefaults( (VOID **)&gFailsafeDefaults,(UINT32) HiiGetManufactuingMask() ); // Allocates Space and filles
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ Status = HiiLoadDefaults( (VOID **)&gOptimalDefaults, (UINT32) HiiGetDefaultMask() ); // Allocates Space and filles
+ if ( EFI_ERROR( Status ) )
+ return Status;
+
+ }
+
+ //EIP-46296: reset default values of BBS order variable.
+ if ( gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer != NULL ) {
+ MemFreePointer( (VOID **) &gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer );
+ }
+ if ( gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer != NULL ) { //EIP70421 & 70422 Support for driver order
+ MemFreePointer( (VOID **) &gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer );
+ }
+ gOptimalDefaults[ VARIABLE_ID_BBS_ORDER ].Buffer = gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer = gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer = NULL;
+ gOptimalDefaults[ VARIABLE_ID_BBS_ORDER ].Size = gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Size = gOptimalDefaults[ VARIABLE_ID_DRIVER_ORDER ].Size = 0;
+
+ if ( gFailsafeDefaults[ VARIABLE_ID_BBS_ORDER ].Buffer != NULL ) {
+ MemFreePointer( (VOID **) &gFailsafeDefaults[ VARIABLE_ID_BBS_ORDER ].Buffer );
+ }
+ if ( gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer != NULL ) {
+ MemFreePointer( (VOID **) &gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer );
+ }
+
+ gFailsafeDefaults[ VARIABLE_ID_BBS_ORDER ].Buffer = gFailsafeDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer = gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Buffer = NULL;
+ gFailsafeDefaults[ VARIABLE_ID_BBS_ORDER ].Size = gFailsafeDefaults[ VARIABLE_ID_BOOT_ORDER ].Size = gFailsafeDefaults[ VARIABLE_ID_DRIVER_ORDER ].Size = 0;
+
+ // special provision for language
+ //VarGetValue( VARIABLE_ID_LANGUAGE, 0, 3, gPrevLanguage );
+ gPrevLanguage = VarGetNvram ( VARIABLE_ID_LANGUAGE, &gPrevLangSize );
+
+ //Special provision for "Boot order" and "Legacy dev order"
+ size = 0;
+ newBuffer = VarGetNvramName ( L"DefaultBootOrder", &EfiDefaultBootOrderGuid, NULL, &size );
+ if(newBuffer)
+ {
+ MemFreePointer( (VOID **) &gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer );
+ gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Buffer = (UINT8 *)newBuffer;
+ gOptimalDefaults[ VARIABLE_ID_BOOT_ORDER ].Size = size;
+ }
+ size = 0; //EIP81581 Default driver order support
+ DefDrvBuffer = VarGetNvramName (L"DefaultDriverOrder", &EfiDefaultDriverOrderGuid, NULL, &size);
+ if (DefDrvBuffer)
+ {
+ MemFreePointer ((VOID **) &gOptimalDefaults [VARIABLE_ID_DRIVER_ORDER].Buffer);
+ gOptimalDefaults [VARIABLE_ID_DRIVER_ORDER].Buffer = (UINT8 *)DefDrvBuffer;
+ gOptimalDefaults [VARIABLE_ID_DRIVER_ORDER].Size = size;
+ }
+ CsmLoadDefaultLegDevOrder();
+ LoadedBuildDefaultsHook();
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LoadDefaultLegDevOrder
+//
+// Description: Function to load default legacy boot order
+//
+// Input: VOID
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID LoadDefaultLegDevOrder(VOID)
+{
+ UINT8 *newBuffer = NULL;
+ UINTN size = 0;
+
+ newBuffer = VarGetNvramName( L"DefaultLegacyDevOrder", &EfiDefaultLegacyDevOrderGuid, NULL, &size );
+ if(newBuffer)
+ {
+ MemFreePointer( (VOID **)&gOptimalDefaults[ VARIABLE_ID_BBS_ORDER ].Buffer );
+ gOptimalDefaults[ VARIABLE_ID_BBS_ORDER ].Buffer = BBSReOrderDefultLegacyDevOrder((BBS_ORDER_TABLE *)newBuffer,size);
+ //Ignore the DefaultLegacyDevOrder if is size is not matching with LegacyDevOder.
+ if(gOptimalDefaults[ VARIABLE_ID_BBS_ORDER ].Buffer == NULL)
+ size = 0;
+ gOptimalDefaults[ VARIABLE_ID_BBS_ORDER ].Size = size;
+ MemFreePointer(&newBuffer);
+ }
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarGetNvram
+//
+// Description: function to get the NvRam varible names
+//
+// Input: UINT32 variable, UINTN *size
+//
+// Output: void
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID *VarGetNvram( UINT32 variable, UINTN *size )
+{
+ VOID *buffer = NULL;
+ VARIABLE_INFO *varInfo;
+ EFI_STATUS status = EFI_SUCCESS;
+
+ *size = 0;
+
+ varInfo = VarGetVariableInfoIndex( variable );
+ if ( varInfo == NULL )
+ return buffer;
+
+ if((varInfo->ExtendedAttibutes & AMI_SPECIAL_VARIABLE_NO_GET) == AMI_SPECIAL_VARIABLE_NO_GET)
+ {
+ // Don't read from the NVRAM
+ // But in the Init we may need to take care return empty buffer
+ NVRAM_VARIABLE *list = gVariableList;
+ NVRAM_VARIABLE *nvVar;
+ if(gVariableList != NULL)
+ {
+ nvVar = &list[ variable ];
+ if((nvVar!=NULL)&&(nvVar->Size!=0))
+ {
+ *size = nvVar->Size;
+ //This function Suppose allocate and give the buffer
+ buffer = EfiLibAllocateZeroPool( *size );
+ if(nvVar->Buffer != NULL)
+ MemCopy( buffer, nvVar->Buffer, *size );
+ return buffer;
+ }
+ }
+ // If Local catch is not found Just return null.
+ *size = 0;
+ return buffer;
+ }
+
+ if(UefiIsEfiVariable(variable,varInfo))
+ {
+ *size = 0;
+ if(varInfo->VariableAttributes == 0)
+ varInfo->VariableAttributes = 0x07;
+ buffer = VarGetNvramName( varInfo->VariableName, &varInfo->VariableGuid, &varInfo->VariableAttributes, size );
+ }
+ else
+ {
+ {
+ if((varInfo->ExtendedAttibutes & VARIABLE_ATTRIBUTE_VARSTORE) == VARIABLE_ATTRIBUTE_VARSTORE)
+ *size = varInfo->VariableSize;
+ status = UefiVarGetNvram(varInfo, &buffer, VAR_ZERO_OFFSET, *size);
+ if(EFI_ERROR(status))
+ {
+ *size = 0;
+ }
+ }
+ }
+ return buffer;
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+// Procedure: VarGetNvramQuestionValue
+//
+// Description: Gets the question value buffer from a specific offset of a
+// variable buffer
+//
+// Input: UINT32 variable
+// UINTN offset
+// UINTN *size
+//
+// Output: VOID *buffer - Question value buffer
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID *VarGetNvramQuestionValue(UINT32 variable, UINTN Offset, UINTN Size)
+{
+ VOID *buffer = (VOID *)NULL;
+ VARIABLE_INFO *varInfo = (VARIABLE_INFO *)NULL;
+ EFI_STATUS status = EFI_SUCCESS;
+
+ varInfo = VarGetVariableInfoIndex( variable );
+ if ( varInfo == NULL )
+ return buffer;
+//EIP 77875 : Minisetup: Memory leaks in text browser
+ if(UefiIsEfiVariable(variable,varInfo))
+ {
+ UINTN size = 0;
+ UINT8 *tempBuffer = NULL;
+
+ buffer = EfiLibAllocateZeroPool(Size+1);
+ if(buffer == NULL)
+ {
+ status = EFI_OUT_OF_RESOURCES;
+ goto DONE;
+ }
+
+ if(varInfo->VariableAttributes == 0){
+ varInfo->VariableAttributes = 0x07;
+ }
+ tempBuffer = VarGetNvramName( varInfo->VariableName, &varInfo->VariableGuid, &varInfo->VariableAttributes, &size );
+ if(tempBuffer != NULL && size != 0)
+ {
+ if((Offset + Size) > size)
+ {
+ status = EFI_INVALID_PARAMETER;
+ goto DONE;
+ }
+ MemCopy(buffer, &tempBuffer[Offset], Size);
+ MemFreePointer(&tempBuffer);
+ }
+ }
+ else
+ {
+ {
+ if((varInfo->ExtendedAttibutes & VARIABLE_ATTRIBUTE_VARSTORE) == VARIABLE_ATTRIBUTE_VARSTORE)
+ if((Offset + Size) > varInfo->VariableSize)
+ {
+ status = EFI_INVALID_PARAMETER;
+ goto DONE;
+ }
+ status = UefiVarGetNvram(varInfo, &buffer, Offset, Size);
+ }
+ }
+DONE:
+ return buffer;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarSetNvram
+//
+// Description: function to set the NvRam varible names
+//
+// Input: UINT32 variable, VOID *buffer, UINTN *size
+//
+// Output: status
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS VarSetNvram( UINT32 variable, VOID *buffer, UINTN size )
+{
+ EFI_STATUS Status = EFI_INVALID_PARAMETER;
+ VARIABLE_INFO *varInfo = (VARIABLE_INFO *)NULL;
+
+ if(buffer == NULL)
+ {
+ goto DONE;
+ }
+
+ varInfo = VarGetVariableInfoIndex(variable);
+ if(varInfo == NULL)
+ {
+ goto DONE;
+ }
+
+ if((varInfo->ExtendedAttibutes & AMI_SPECIAL_VARIABLE_NO_SET) == AMI_SPECIAL_VARIABLE_NO_SET)
+ {
+ // Don't save the variable
+ Status = EFI_SUCCESS;
+ }
+ else
+ {
+ if(UefiIsEfiVariable(variable,varInfo))
+ {
+ Status = VarSetNvramName( varInfo->VariableName, &varInfo->VariableGuid, varInfo->VariableAttributes, buffer, size );
+ }
+ else
+ {
+ Status = UefiVarSetNvram(varInfo, buffer, VAR_ZERO_OFFSET, size);
+ }
+ }
+ if ( ! EFI_ERROR( Status ) )
+ {
+ VarUpdateVariable(variable);
+ }
+
+DONE:
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _VarGetRealValue
+//
+// Description: function to get the real value of the variable
+//
+// Input: UINT32 variable, UINTN offset, UINTN size, VOID *buffer
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _VarGetRealValue( UINT32 variable, UINTN offset, UINTN size, VOID *buffer )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINTN i;
+
+ switch ( variable )
+ {
+ case VARIABLE_ID_LANGUAGE:
+ {
+ UINTN varsize=0;
+ VOID * LangBuf = VarGetNvram( variable, &varsize ); // Read the Variable from Variable Service
+ for ( i = 0; i < gLangCount; i++ )
+ {
+ if ( ! EfiCompareMem( LangBuf, gLanguages[i].LangCode, varsize ) )
+ {
+ MemSet( buffer, size, 0 );
+ *(UINT16 *)buffer = (UINT16)i;
+ break;
+ }
+ }
+ MemFreePointer(&LangBuf);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _VarSetRealValue
+//
+// Description: function to set the real value of the variable
+//
+// Input: UINT32 variable, UINT32 *offset, UINTN *size,
+// VOID *buffer, VOID **realBuffer
+//
+// Output: status
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _VarSetRealValue( UINT32 variable, UINT32 *offset, UINTN *size, VOID *buffer, VOID **realBuffer )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT16 index = *(UINT16 *)buffer;
+
+ if ( variable == VARIABLE_ID_SETUP )
+ {
+ Status = EFI_UNSUPPORTED;
+ return Status;
+ }
+ if (VARIABLE_ID_BOOT_ORDER == variable)
+ *size = gBootOptionCount * sizeof(UINT16);
+
+ if (VARIABLE_ID_DRIVER_ORDER == variable) //EIP70421 & 70422 Support for driver order
+ *size = gDriverOptionCount * sizeof(UINT16);
+
+ *realBuffer = EfiLibAllocateZeroPool( *size );
+ if ( *realBuffer == NULL )
+ {
+ Status = EFI_OUT_OF_RESOURCES;
+ return Status;
+ }
+
+ switch ( variable )
+ {
+ case VARIABLE_ID_LANGUAGE:
+ {
+ if ( index > gLangCount )
+ Status = EFI_INVALID_PARAMETER;
+ else
+ {
+ ///EIP-24971:Removed the Token SETUP_SUPPORT_PLATFORM_LANG_VAR dependency from TSE sources
+ if( PlatformLangVerSupport() ) {
+ MemFreePointer( (VOID **)realBuffer );
+ *size = StrLen8(gLanguages[index].LangCode) +1;
+ *realBuffer = EfiLibAllocateZeroPool( *size );
+ }
+ else {
+ *size = 3;
+ }
+
+ MemCopy( *realBuffer, gLanguages[index].LangCode, *size );
+ }
+ }
+ break;
+ case VARIABLE_ID_BOOT_ORDER:
+ MemFreePointer ((VOID **)realBuffer);
+ BootUpdateOrder (buffer, offset, size, realBuffer);
+ break;
+ case VARIABLE_ID_DRIVER_ORDER: //EIP70421 & 70422 Support for driver order
+ MemFreePointer ((VOID **)realBuffer);
+ DriverUpdateOrder (buffer, offset, size, realBuffer);
+ break;
+ case VARIABLE_ID_BBS_ORDER:
+ MemFreePointer( (VOID **)realBuffer );
+ //BBSUpdateOrder( /*index*/buffer, offset, size, realBuffer );
+ Status = CsmBBSUpdateOrder(buffer, offset, size, realBuffer);
+ break;
+
+#if SETUP_OEM_SPECIAL_CONTROL_SUPPORT
+ case VARIABLE_ID_OEM_TSE_VAR:
+ MemFreePointer( (VOID **)realBuffer );
+ Status = OEMSpecialUpdateOneOf( index, offset, size, realBuffer );
+ break;
+#endif
+
+ default:
+ MemFreePointer( (VOID **)realBuffer );
+ Status = EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ return Status;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarGetValue
+//
+// Description: Function to get var value
+//
+// Input: UINT32 variable, UINT32 offset, UINTN size, VOID *buffer
+//
+// Output: STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS VarGetValue( UINT32 variable, UINT32 offset, UINTN size, VOID *buffer )
+{
+ return _VarGetData( variable, offset, size, buffer, FALSE );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarGetDefaults
+//
+// Description: Function to get var defaults
+//
+// Input: UINT32 variable, UINT32 offset, UINTN size, VOID *buffer
+//
+// Output: STATUS
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS VarGetDefaults( UINT32 variable, UINT32 offset, UINTN size, VOID *buffer )
+{
+ return _VarGetData( variable, offset, size, buffer, TRUE );
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _VarGetData
+//
+// Description: function to get variable data
+//
+// Input: UINT32 variable, UINT32 offset, UINTN size,
+// VOID *buffer, BOOLEAN useDefaults
+//
+// Output: status
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _VarGetData( UINT32 variable, UINT32 offset, UINTN size, VOID *buffer, BOOLEAN useDefaults )
+{
+ UINT32 TempOffset =offset;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ NVRAM_VARIABLE *list = gVariableList;
+
+ if ( ( useDefaults ) || ( list == NULL ) )
+ list = gOptimalDefaults;
+
+ Status = _VarGetSetValue( VAR_COMMAND_GET_VALUE, list, variable, TempOffset, size, buffer );
+
+ if ( ! EFI_ERROR( Status ) )
+ Status = _VarGetRealValue( variable, offset,size, buffer );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarSetValue
+//
+// Description: Function to set variable value
+//
+// Input: UINT32 variable, UINT32 offset, UINTN size, VOID *buffer
+//
+//
+// Output: status
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS VarSetValue( UINT32 variable, UINT32 offset, UINTN size, VOID *buffer )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ VOID *realBuffer = (VOID *)NULL;
+
+ Status = _VarSetRealValue( variable, &offset, &size, buffer, &realBuffer );
+ if ( EFI_ERROR( Status ) )
+ realBuffer = buffer;
+
+ Status = _VarGetSetValue( VAR_COMMAND_SET_VALUE, gVariableList, variable, offset, size, realBuffer );
+
+ if ( ( variable == VARIABLE_ID_LANGUAGE ) && ( ! EFI_ERROR( Status ) ) )
+ {
+ if (NULL != gApp)
+ {
+ gApp->CompleteRedraw = TRUE;
+ }
+ Status = VarSetNvram( variable, realBuffer, size );
+ }
+
+ if ( realBuffer != buffer )
+ MemFreePointer( (VOID **)&realBuffer );
+
+ //EIP:100429 Prevent calls to SetupConfigModifiedHook for variables that don't affect setup changes.
+ if(!(
+ //variable == VARIABLE_ID_SETUP ||
+ //variable == VARIABLE_ID_LANGUAGE ||
+ //variable == VARIABLE_ID_BOOT_TIMEOUT ||
+ //variable == VARIABLE_ID_USER_DEFAULTS ||
+ variable == VARIABLE_ID_ERROR_MANAGER ||
+ //variable == VARIABLE_ID_AMITSESETUP ||
+ //variable == VARIABLE_ID_IDE_SECURITY ||
+ //variable == VARIABLE_ID_BOOT_ORDER ||
+ //variable == VARIABLE_ID_BBS_ORDER ||
+ variable == VARIABLE_ID_DEL_BOOT_OPTION ||
+ variable == VARIABLE_ID_ADD_BOOT_OPTION ||
+ variable == VARIABLE_ID_BOOT_MANAGER ||
+ variable == VARIABLE_ID_BOOT_NOW ||
+ variable == VARIABLE_ID_LEGACY_DEV_INFO ||
+ variable == VARIABLE_ID_AMI_CALLBACK ||
+ variable == VARIABLE_ID_LEGACY_GROUP_INFO ||
+ variable == VARIABLE_ID_OEM_TSE_VAR ||
+ variable == VARIABLE_ID_DYNAMIC_PAGE_COUNT ||
+ variable == VARIABLE_ID_DRV_HLTH_ENB ||
+ variable == VARIABLE_ID_DRV_HLTH_COUNT ||
+ variable == VARIABLE_ID_DRIVER_MANAGER ||
+ //variable == VARIABLE_ID_DRIVER_ORDER ||
+ variable == VARIABLE_ID_ADD_DRIVER_OPTION ||
+ variable == VARIABLE_ID_DEL_DRIVER_OPTION ||
+ variable == VARIABLE_ID_PORT_OEM1 ||
+ variable == VARIABLE_ID_PORT_OEM2 ||
+ variable == VARIABLE_ID_PORT_OEM3 ||
+ variable == VARIABLE_ID_PORT_OEM4 ||
+ variable == VARIABLE_ID_PORT_OEM5 ))
+ {
+ /// Hook can be used after a control is modified...
+ SetupConfigModifiedHook();
+ gSetupUpdated = TRUE;//EIP:51619 Flag is Set when any of the setup variable is set
+ }
+
+
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _VarGetSetValue
+//
+// Description: intermediate function for the set and get operations
+//
+// Input: UINTN command, NVRAM_VARIABLE *list, UINT32 variable,
+// UINT32 offset, UINTN size, VOID *buffer
+//
+// Output: status
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS _VarGetSetValue( UINTN command, NVRAM_VARIABLE *list, UINT32 variable, UINT32 offset, UINTN size, VOID *buffer )
+{
+ EFI_STATUS Status = EFI_INVALID_PARAMETER;
+ NVRAM_VARIABLE *varInfo;
+
+ if ( ( variable >= gVariables->VariableCount ) || ( buffer == NULL ) || ( size == 0 ) )
+ return Status;
+
+ varInfo = &list[ variable ];
+
+ if ( ( command == VAR_COMMAND_SET_VALUE ) && ( varInfo->Buffer == NULL ) )
+ {
+ varInfo->Buffer = EfiLibAllocateZeroPool( offset + size );
+ if ( varInfo->Buffer != NULL )
+ varInfo->Size = offset + size;
+ }
+
+ if ( varInfo->Size == 0 )
+ {
+ varInfo->Buffer = VarGetNvram( variable, &varInfo->Size );
+ if ( varInfo->Buffer == NULL )
+ return Status;
+ }
+
+ if ( offset + size > varInfo->Size )
+ {
+ if ( command == VAR_COMMAND_SET_VALUE )
+ {
+ UINT8 *newBuffer;
+
+ newBuffer = EfiLibAllocateZeroPool( offset + size );
+ if ( newBuffer == NULL )
+ return Status;
+ MemCopy( newBuffer, varInfo->Buffer, varInfo->Size );
+ MemFreePointer( (VOID **)&varInfo->Buffer );
+ varInfo->Buffer = newBuffer;
+ varInfo->Size = offset + size;
+ }
+ }
+
+ if ( command == VAR_COMMAND_GET_VALUE )
+ {
+ MemSet( buffer, size, 0 );
+ if ( offset + size > varInfo->Size )
+ size = varInfo->Size - offset;
+ if ( varInfo->Size > offset )
+ MemCopy( buffer, &varInfo->Buffer[offset], size );
+ }
+ else
+ MemCopy( &varInfo->Buffer[offset], buffer, size );
+
+ Status = EFI_SUCCESS;
+
+ return Status;
+
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: _VarUpdate
+//
+// Description: Function to update variable
+//
+// Input: NVRAM_VARIABLE *nvramVar, UINT32 variable
+//
+//
+// Output: VOID
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID _VarUpdate(NVRAM_VARIABLE *nvramVar, UINT32 variable)
+{
+ UINT8 *newBuffer;
+ UINTN nvSize;
+
+ newBuffer = (UINT8 *)VarGetNvram( variable, &nvSize );
+ if (NULL == newBuffer) //No need to update the buffer if it is NULL
+ {
+ return;
+ }
+ MemFreePointer( (VOID **)&nvramVar->Buffer );
+ nvramVar->Buffer = newBuffer;
+ nvramVar->Size = nvSize;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarUpdateVariable
+//
+// Description: Function to update variable
+//
+// Input: UINT32 variable
+//
+//
+// Output: VOID
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID VarUpdateVariable(UINT32 variable)
+{
+ NVRAM_VARIABLE *nvramVar;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if (NULL == gVariableList)
+ Status = VarLoadVariables ((VOID **)&gVariableList, NULL);
+ if (EFI_ERROR (Status))
+ return;
+ nvramVar = &gVariableList[ variable ];
+ _VarUpdate(nvramVar, variable);
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarUpdateDefaults
+//
+// Description: Function to update variable defaults
+//
+// Input: UINT32 variable
+//
+//
+// Output: VOID
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID VarUpdateDefaults(UINT32 variable)
+{
+ NVRAM_VARIABLE *nvramVar;
+ nvramVar = &gFailsafeDefaults[ variable ];
+ _VarUpdate(nvramVar, variable);
+ nvramVar = &gOptimalDefaults[ variable ];
+ _VarUpdate(nvramVar, variable);
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarUpdateDefaults
+//
+// Description: Function to get variable
+//
+// Input: UINT32 variable, UINTN *size
+//
+//
+// Output: VOID*
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID *VarGetVariable( UINT32 variable, UINTN *size )
+{
+ VOID *buffer = NULL;
+ NVRAM_VARIABLE *nvramVar;
+
+ if ( variable >= gVariables->VariableCount )
+ return buffer;
+
+ if(gVariableList == NULL)
+ return buffer;
+
+ nvramVar = &gVariableList[ variable ];
+ if ( nvramVar == NULL )
+ return buffer;
+
+ if ( ( *size == 0 ) || ( *size > nvramVar->Size ) )
+ *size = nvramVar->Size;
+
+ if(*size == 0)
+ return buffer;
+
+ buffer = EfiLibAllocateZeroPool( *size );
+ if ( ( buffer != NULL ) && ( nvramVar->Buffer != NULL ) )
+ MemCopy( buffer, nvramVar->Buffer, *size );
+ else
+ *size = 0;
+
+ return buffer;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarGetVariableInfoIndex
+//
+// Description: Function to get variable info index
+//
+// Input: UINT32 index
+//
+//
+// Output: VARIABLE_INFO *
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VARIABLE_INFO *VarGetVariableInfoIndex( UINT32 index )
+{
+ VARIABLE_INFO *varInfo = NULL;
+
+ if ( index < gVariables->VariableCount )
+ varInfo = (VARIABLE_INFO *)((UINT8 *)gVariables + gVariables->VariableList[index]);
+
+ return varInfo;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: VarGetVariableInfoId
+//
+// Description: function to get the ID of the variable information
+//
+// Input: UINTN command, NVRAM_VARIABLE *list, UINT32 variable,
+// UINT32 offset, UINTN size, VOID *buffer
+//
+// Output: Variable Info
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VARIABLE_INFO *VarGetVariableInfoId( UINT32 varId, UINT32 *index )
+{
+ VARIABLE_INFO *varInfo = NULL;
+ UINT32 i;
+
+ for ( i = 0; i < gVariables->VariableCount; i++, varInfo++ )
+ {
+ varInfo = VarGetVariableInfoIndex( i );
+ if ( NULL != varInfo && varInfo->VariableID == varId)//EIP-75352 Suppress the warnings from static code analyzer
+ {
+ if ( index != NULL )
+ *index = i;
+ return varInfo;
+ }
+ }
+
+ varInfo = NULL;
+ return varInfo;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: BBSReOrderDefultLegacyDevOrder
+//
+// Description: To reoder the DefaultLegacyDevOrder Variable as TSE reorders
+// the LegacyDevOrder based on Boot Order
+//
+// Input: DefaultLegDevOrder and DefaultLegDevOrderSize
+//
+// Output: NewDefultLegacyDevOrder
+// NULL = if DefaultLegDevOrderSize is not Equal with LegacuDevOrderSize
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID *BBSReOrderDefultLegacyDevOrder(BBS_ORDER_TABLE *DefaultLegDevOrder,UINTN DefaultLegDevOrderSize)
+{
+ BBS_ORDER_TABLE * LegacyDevOrder,*NewDefultLegacyDevOrder,*TempDevOrder,*NewDevEntry;
+ UINTN LegacyOrderSize=0;
+ UINTN count=0;
+ UINTN i,j;
+
+ LegacyDevOrder = VarGetNvramName( L"LegacyDevOrder", &gLegacyDevGuid, NULL, &LegacyOrderSize );
+
+ // If the DefaultLegacyDevOrderSize is not Matching with LegacyDevOrderSize (EIP-25288)
+ if(LegacyOrderSize != DefaultLegDevOrderSize)
+ return NULL;
+
+ if(DefaultLegDevOrderSize && LegacyDevOrder)
+ NewDefultLegacyDevOrder = EfiLibAllocateZeroPool( DefaultLegDevOrderSize);
+ else
+ return NULL;
+
+ NewDevEntry = NewDefultLegacyDevOrder;
+ for(j=0; j<LegacyOrderSize; )
+ {
+ TempDevOrder = DefaultLegDevOrder;
+ for(i=0;i<DefaultLegDevOrderSize;)
+ {
+ if ( (0 == TempDevOrder->Length) || (TempDevOrder->Length >= DefaultLegDevOrderSize) ) //EIP-120011
+ {
+ return NULL;
+ }
+
+ count = sizeof(UINT32) + TempDevOrder->Length;
+
+ //If GROUP_BOOT_OPTIONS_BY_TAG is enable
+ if ( LegacyDevOrder->Type == TempDevOrder->Type && IsBootOptionsGroupingEnabled() ) //EIP-93954 To Restore BootOption default issue
+ {
+ MemCopy(NewDevEntry,TempDevOrder,count); //Copying default legacyDevOrder
+ NewDevEntry = (BBS_ORDER_TABLE *)((UINTN)NewDevEntry + count);
+ break;
+ }
+ //If GROUP_BOOT_OPTIONS_BY_TAG is disable
+ else
+ {
+ if ( (LegacyDevOrder->Type == TempDevOrder->Type) && (LegacyDevOrder->Data[0] == TempDevOrder->Data[0]) )
+ {
+ MemCopy(NewDevEntry,TempDevOrder,count); //Copying default legacyDevOrder
+ NewDevEntry = (BBS_ORDER_TABLE *)((UINTN)NewDevEntry + count);
+ break;
+ }
+ }
+
+ TempDevOrder = (BBS_ORDER_TABLE *)((UINTN)TempDevOrder + count);
+ i += count;
+ }
+
+ //Go to next entry
+ count = sizeof(UINT32) + LegacyDevOrder->Length;
+ LegacyDevOrder = (BBS_ORDER_TABLE *)((UINTN)LegacyDevOrder + count);
+ j += count;
+ }
+
+ if(((UINTN)NewDevEntry - (UINTN)NewDefultLegacyDevOrder) != LegacyOrderSize)
+ // Something wrong in the Variables. Lets just use LegacyDevOrder
+ MemCopy(NewDefultLegacyDevOrder,LegacyDevOrder,LegacyOrderSize);
+
+ return NewDefultLegacyDevOrder;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: HelperGetVariable
+//
+// Description: Function helper to get variable
+//
+// Input: UINT32 variable, CHAR16 *name, EFI_GUID *guid, UINT32 *attributes, UINTN *size
+//
+//
+// Output: VOID *
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID * HelperGetVariable( UINT32 variable, CHAR16 *name, EFI_GUID *guid, UINT32 *attributes, UINTN *size )
+{
+ VOID * Buffer;
+ Buffer = VarGetVariable( variable, size );
+ if(Buffer == NULL)
+ Buffer = VarGetNvram( variable, size );
+ return Buffer;
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************