summaryrefslogtreecommitdiff
path: root/EDK/MiniSetup/uefi2.1/HiiCallback.c
blob: b78fa496cac4c76674f9b682621df8ada4d5210b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
//**                                                             **//
//**         (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/Uefi2.1/HiiCallback.c $
//
// $Author: Arunsb $
//
// $Revision: 41 $
//
// $Date: 7/03/13 11:25a $
//
//*****************************************************************//
//*****************************************************************//
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/Uefi2.1/HiiCallback.c $
// 
// 41    7/03/13 11:25a Arunsb
// Validated gApplicationData to NULL. In some case gApplicationData is
// NULL then it leading to hang.
// 
// 40    5/22/13 11:02a Arunsb
// [TAG]  		EIP123047
// Password retrieved only for its string not for entire size. So password
// not validated properly, changed upto entire size.
// 
// 39    4/17/13 2:37p Arunsb
// [TAG]  		EIP109812, 107774
// [Category]  	Improvement
// [Description]  	Provide support for EFI_IFR_TYPE_REF and EFI_IFR_REF5
// [Files]  		Hii.c, HiiCallback.c, Parse.c and TseUefiHii.h
// 
// 38    4/16/13 11:44a Arunsb
// EFI_IFR_TYPE_UNDEFINED declaration moved to tseuefihii.h
// 
// 37    3/12/13 11:35p 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
// 
// 36    3/12/13 7:05a 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
// 
// 35    3/08/13 1:39a Rajashakerg
// [TAG]  		EIP113085
// [Category]  	Improvement
// [Description]  	 Modify callback function behavior to match UEFI SPEC.
// [Files]  		HiiCallback.c, PopupPassword.c, SubMenu.c
// 
// 34    10/18/12 6:04a Arunsb
// Updated for 2.16.1235 QA submission
// 
// 11    10/10/12 12:41p Arunsb
// Synched the source for v2.16.1232, backup with Aptio
// 
// 32    9/17/12 6:22a Rajashakerg
// Updated EIP changes for 2.16 release.
// 
// 30    9/10/12 10:38a Arunsb
// [TAG]  		EIP90372
// [Category]  	Bug Fix
// [Severity]  	Normal
// [Symptom]  	Setup browser handling of
// EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD
// [RootCause]  	For discard action current value is saved
// [Solution]  	Introduced a global variable which will set for discard
// action for that current value will not be saved
// [Files]  		HiiCallback.c and Uefi21Wapper.c
// 
// 29    5/29/12 4:46a Arunsb
// [TAG]  		EIP91109
// [Category]  	Improvement
// [Description]  	Sync the Aptio IV source for AptioV
// 
// 28    5/26/12 5:21a Arunsb
// [TAG]  		EIP90895
// [Category]  	Bug Fix
// [Severity]  	Normal
// [Symptom]  	Setup hangs when retrieve callback produces
// add/remove/update forms
// [RootCause]  	Callback with retrieve action produces add/remove/update
// form
// [Solution]  	If retrieve callback produces add/remove/update form then
// TSE will print debug messages and assert.
// [Files]  		HiiNotificationHandler.c, HiiCallback.c and FormBrowser2.c
// 
// 27    5/09/12 1:32p 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.c
// 
// 26    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,
// 
// 25    4/05/12 12:49p Arunsb
// [TAG]  		EIP83252
// [Category]  	Bug Fix
// [Severity]  	Important
// [Symptom]  	System hangs with onboard SAS Option ROM
// [RootCause]  	ProcessPackNotification not invoked properly
// [Solution]  	gEnableDrvNotification flag handled properly to invoke
// ProcessPackNotification
// [Files]  		uefi2.1\hiicallback.c and uefi2.1\uefi21wapper.c
// 
// 24    2/02/12 3:00a 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
// 
// 23    12/16/11 2:01a Arunsb
// [TAG]  		EIP78100
// [Category]  	Bug Fix
// [Severity]  	Critical
// [Symptom]  	TSE 2.15 can't enter Setup menu
// [RootCause]  	Tried to access the NULL controldata 
// [Solution]  	Controldata validated for NULL
// [Files]  		Hiicallback.c and uefihpktool.exe
// 
// 22    12/08/11 4:33p Arunsb
// [TAG]  		EIP75536
// [Category]  	Improvement
// [Description]  	String handling inside the callbacks in Minisetup
// [Files]  		Hiicallback.c and hiistring21.c
// 
// 21    12/08/11 12:29a Arunsb
// ProcessBrowserActionRequestHook declaration changed
// 
// 20    12/07/11 3:02p 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
// 
// 19    12/07/11 2:22p Rajashakerg
// [TAG]  		EIP75572 
// [Category]  	Improvement
// [Description]  	Callback for Date and Time doesn't pass the new value
// [Files]  		HiiCallback.c
// 
// 18    12/07/11 9:31a Rajashakerg
// [TAG]  		EIP77108 
// [Category]  	Improvement
// [Description]  	Make ProcessBrowserActionRequest as board module hook
// [Files]  		AMITSE.sdl, CommonHelper.c, HiiCallback.c
// 
// 17    12/07/11 8:14a 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
// 
// 16    12/01/11 12:38p Premkumara
// [TAG]  		EIP75536
// [Category]  	Improvement
// [Description]  	1.String handling inside the callbacks in
// Minisetup.Adding Null termination for String and Password control type.
// 2.Iterate to check the available language and add/change the string
// only for the passed language.
// [Files]  		HiiCallback.c, hiistring21.c
// 
// 15    12/01/11 11:22a Rajashakerg
// UefiGetValidOptionSize() function  declared  to resolve build error.
// 
// 14    12/01/11 7:44a Rajashakerg
// [TAG]  		EIP75464 
// [Category]  	Improvement
// [Description]  	Improper handling of action controls
// [Files]  		SubMenu.c, UefiAction.c, HiiCallback.c, Uefi21Wapper.c
// 
// 13    11/28/11 5:10a 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  
// 
// 12    11/14/11 2:43p Blaines
// [TAG] - EIP 75481
// [Category]- Function Request
// [Synopsis]- TSE debug print infrastructure.
// [Description]- Add TSE debug print info for basic functions such as
// Hiiparsing, HiiNotifications, HiiCallbacks. Variables, and Ifrforms
// data. 
// [Files]
// AMITSE.sdl, AmiTSEStr.uni,  CommonHelper.c, commonoem.c, FakeTokens.c
// Globals.c, Minisetup.cif, Minisetup.h, print.c, FormBrowser2.c, Hii.c,
// HiiCallback.c, HiiNotificationHandler.c, Parse.c, TseUefiHii.h,
// Uefi21Wrapper.c, setupdbg.h
// 
// 11    7/19/11 2:33p Arunsb
// Suppressing the callback for AMI_CALLBACK_FORM_OPEN action
// 
// 10    4/22/11 5:31p Arunsb
// [TAG]  		EIP58009
// [Category]  	Bug Fix
// [Severity]  	Normal
// [RootCause]  	Certain controls not compatible with UEFI 2.3 version
// [Solution]  	The UEFI 2.3 features will be added only if core supports
// it
// [Files]  		HiiCallback.c and commonhelper.c
// 
// 9     3/21/11 12:58a 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:26p Madhans
// [TAG]  		EIPEIP48615 
// [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:09p 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 8:50p Madhans
// 
// 4     11/30/09 1:10p Presannar
// Modified ConfigAccessCallback EFI_BROWSER_ACTION from pass by reference
// to pass by value
// 
// 3     11/19/09 5:31p Presannar
// Updated TSE include file name to not clash with CORE file
// 
// 2     8/11/09 2:49p Presannar
// Added code to FormCallBack by calling FixSetupData after
// ConfigAccess->Callback to handle dynamic removal of IFR data
// Added code to handle callback for EFI_IFR_REF_OP opcode
// 
// 1     7/24/09 6:54p Presannar
// 
// 5     4/24/09 7:54p Presannar
// TSE 2.0 UEFI 2.1 Code Complete
// 
// 4     4/14/09 12:41p Presannar
// Added Fn SpecialActionCallBack
// Modified fn signature FormCallBack
// 
// 3     3/31/09 4:15p Madhans
// UEFI Wrapper improvments.
//
// 2     1/29/09 6:08p Presannar
// Added Function Header comments
// Modified implementation for fn CallFormCallBack and CallTextCallBack
//
// 1     1/09/09 2:38p Presannar
// UEFI 2.1 Hii Related Code - Initial Drop
//
// 1     12/29/08 4:45p Presannar
// Initial draft Form Callback handler
//
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:          HiiCallback.c
//
// Description:  Contains Hii related Functions
//
//<AMI_FHDR_END>
//*************************************************************************

//----------------------------------------------------------------------------
#include "Minisetup.h"
#include "FormBrowser2.h"
#include "TseUefiHii.h"
//----------------------------------------------------------------------------

//----------------------------------------------------------------------------
static UINT8 *gPrevControlValue = NULL;
static CHAR16 *gCurPswdString = NULL;
extern UINT16 gOrderlistcount;
extern BOOLEAN gEnableDrvNotification; //TRUE if allow notification function to process action, FALSE to ignore the notification
extern BOOLEAN gBrowserCallbackEnabled; //Allow external drivers to change cache only if it's TRUE; ignore browser callback otherwise
extern EFI_BROWSER_ACTION gBrowserCallbackAction ; //Contains the BrowserCallback action when a callback is in progress.
EFI_STATUS ProcessBrowserActionRequestHook(EFI_BROWSER_ACTION_REQUEST actionReq);//EIP77108 : Modified  ProcessBrowserActionRequest as board module hook
//----------------------------------------------------------------------------

UINT32 GetUefiSpecVersion (VOID);
VOID UefiGetValidOptionSize(CONTROL_INFO *CtrlInfo, UINT32 *SizeOfData);

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     FormCallBack
//
// Description:   
//
// Parameter:     EFI_HII_HANDLE Handle, EFI_QUESTION_ID QuestionID,
//		  UINT8 Type, EFI_IFR_TYPE_VALUE *Value
//
// Return Value:  EFI_STATUS
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
EFI_STATUS FormCallBack(EFI_HII_HANDLE Handle, EFI_QUESTION_ID QuestionID, UINT8 Type, EFI_IFR_TYPE_VALUE *Value, EFI_BROWSER_ACTION action)
{
  EFI_HANDLE DriverHandle;
  EFI_GUID EfiHiiConfigAccessProtocolGuid = EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID;
  EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess;
  EFI_BROWSER_ACTION_REQUEST actionReq = EFI_BROWSER_ACTION_REQUEST_NONE;
  //EFI_BROWSER_ACTION action = EFI_BROWSER_ACTION_CHANGED; //EFI_BROWSER_ACTION_CHANGING;
  EFI_STATUS status = EFI_SUCCESS;
  BOOLEAN PreservegEnableDrvNotification = FALSE;
	
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Entering FormCallBack()\n\n" );
  SETUP_DEBUG_UEFI_CALLBACK (  "Handle = 0x%x \nQuestionID = %d \nType = 0x%x \nValue = 0x%x \naction = 0x%x\n\n" , Handle, QuestionID, Type, *Value, action );   

  //
  //  Get Driver Handle that installed this Hii Form
  //
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Getting Driver Handle\n" );   
  status = gHiiDatabase->GetPackageListHandle(gHiiDatabase, Handle, &DriverHandle);
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Getting Driver Handle returned, status = 0x%x \n\n", status );   
  if(EFI_ERROR(status))
  {
    goto DONE;
  }

  //
  //  Get ConfigAccess protocol handle
  //
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Getting ConfigAccess protocol handle\n" );    
  status = gBS->HandleProtocol( DriverHandle, &EfiHiiConfigAccessProtocolGuid , &ConfigAccess );
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Getting ConfigAccess protocol handle returned,  status = 0x%x \n\n" , status );    
  if(EFI_ERROR(status))
  {
    goto DONE;
  }

  //
  //  Invoke Config Access Protocol
  //
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] ConfigAccess->Callback()\n\n" );

  PreservegEnableDrvNotification = gEnableDrvNotification;
  gEnableDrvNotification = TRUE; //Set to enable notification processing
  gBrowserCallbackEnabled = TRUE;
  gBrowserCallbackAction = action ; //Save the current BrowserCallback action
  status = ConfigAccess->Callback(ConfigAccess, action, QuestionID, Type, Value, &actionReq);
  gBrowserCallbackAction = 0 ;		//Clear the current BrowserCallback action
  gBrowserCallbackEnabled = FALSE;
  if (!PreservegEnableDrvNotification) // If gEnableDrvNotification is already True Don't touch it
	  gEnableDrvNotification = FALSE; //Reset to disable notification processing

  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] ConfigAccess->Callback returned,   status = 0x%x \n\n" , status );   
  if(EFI_ERROR(status))
  {
    goto DONE;
  }

  // Clean up PAGE_INFO struct with Handle set to 0xFFFF
  status = FixSetupData();
  if(EFI_ERROR(status))
  {
  }

  if(actionReq)
  {
    SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] ProcessBrowserActionRequestHook()\n" );
    status = ProcessBrowserActionRequestHook(actionReq);//EIP77108 : Modified  ProcessBrowserActionRequest as board module hook
    SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] ProcessBrowserActionRequestHook returned,   status = 0x%x \n\n" , status );
  }

DONE:
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Exiting FormCallBack()\n\n" );
  return status;
}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     CallFormCallBack
//
// Description:   
//
// Parameter:     CONTROL_INFO * ControlData, UINT16 Key , UINT8 Flags, UINTN Action
//
// Return Value:  EFI_STATUS
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
BOOLEAN BrowserActionDiscard = FALSE;
EFI_STATUS CallFormCallBack(CONTROL_INFO * ControlData, UINT16 Key ,UINT8 Flags, UINTN Action)//EIP-53480: Implementation of FormBrowser with actions support 
{
  EFI_STATUS status = EFI_SUCCESS;
  EFI_IFR_TYPE_VALUE value;
  EFI_IFR_OP_HEADER *OpHeader = (EFI_IFR_OP_HEADER *)ControlData->ControlPtr;
  EFI_BROWSER_ACTION action ;
  EFI_HII_HANDLE hiiHandle;
  UINT16 ControlType = 0;
  UINT8	type = 0;
  UINT16 tok = 0;
  UINTN size = 0;
  UINT32 offset = 0;
  VOID *ctrlValue = NULL, *FullCtrlValue = NULL;
  UINT32 UefiSpecVer = 0;
  UINT32 tempVariable = 0;     
  MemSet( &value, sizeof(value), 0 );

  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Entering CallFormCallBack()\n\n" ); 

  UefiSpecVer = GetUefiSpecVersion ();
  if (UefiSpecVer <= 0x2000A)     //If spec version is 2.0 suppressing other actions
  {
    if (AMI_CALLBACK_CONTROL_UPDATE != Action)
    {
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Exiting CallFormCallBack()\n\n" );
        status = EFI_UNSUPPORTED;
		goto DONE;
    }
  }
  else if (UefiSpecVer >= 0x2001E)   //If spec version is greater than 2.30 then suppressing other actions
  {
    if (
        (AMI_CALLBACK_CONTROL_UPDATE != Action) &&  
        (AMI_CALLBACK_RETRIEVE != Action) &&
        (AMI_CALLBACK_FORM_OPEN != Action) &&
        (AMI_CALLBACK_FORM_CLOSE != Action) &&
        (AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING != Action)&&
  		  (AMI_CALLBACK_FORM_DEFAULT_STANDARD != Action)	)//EIP 105167 : Making the specify setup items departing from F2/F3 effect.
    {
       switch(Action)
	    {
	        case AMI_CALLBACK_FORM_OPEN:
                SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_FORM_OPEN Unsupported\n\n" );         
                break;
            case AMI_CALLBACK_FORM_CLOSE:
                SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_FORM_CLOSE Unsupported\n\n" );
                break;
            case AMI_CALLBACK_RETRIEVE:
                SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_RETRIEVE Unsupported\n\n" );
                break;
            case AMI_CALLBACK_CONTROL_UPDATE:            
                SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_CHANGING Unsupported\n\n" );
                break;
				case AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING : 
					SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING Unsupported\n\n" );
               break;
				case AMI_CALLBACK_FORM_DEFAULT_STANDARD : 
					SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] AMI_CALLBACK_FORM_DEFAULT_STANDARD Unsupported\n\n" );//EIP 105167 : Making the specify setup items departing from F2/F3 effect.
               break;
    	    default:
    	        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Callback Action Unsupported\n\n" ); 
    	    break;
        }
        
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Exiting CallFormCallBack()\n\n" );
        status = EFI_UNSUPPORTED;
		goto DONE;
    }
  }        
  action = UefiGetActionWapper(Action);
    
  if(ControlData->ControlHandle == INVALID_HANDLE)
  {  
	SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] INVALID_HANDLE\n\n" ); 
    SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Exiting CallFormCallBack()\n\n" );
   	goto DONE;
  }  
  
  hiiHandle = ControlData->ControlHandle;
  ControlType = ControlData->ControlType;
  tempVariable = ControlData->ControlVariable;

  if(AMI_CALLBACK_FORM_OPEN != Action)
  {
	  if(OpHeader->OpCode != EFI_IFR_ACTION_OP && OpHeader->OpCode != EFI_IFR_REF_OP)
	  {
	    offset = UefiGetQuestionOffset(ControlData->ControlPtr);
	//If the control is Ordered list then we are calculating the actual size
		if(ControlData->ControlType == CONTROL_TYPE_ORDERED_LIST)
		{
			UINTN Type=0;
			UefiGetValidOptionType( ControlData, &Type, (UINT32 *)&size);
			size = gOrderlistcount * size;
		}
		else
			size = UefiGetWidth(ControlData->ControlPtr);

		if ((EFI_IFR_PASSWORD_OP == OpHeader->OpCode) || (EFI_IFR_STRING_OP == OpHeader->OpCode))
		{
			ctrlValue = EfiLibAllocateZeroPool (size + sizeof (CHAR16));		//If max character reached then the string should have NULL at last
		}
		else
		{
			ctrlValue = EfiLibAllocateZeroPool (size);
		}
	    if(ctrlValue == NULL)
	    {
	      status = EFI_OUT_OF_RESOURCES;
	      goto DONE;
	    }
	
		if((EFI_IFR_PASSWORD_OP == OpHeader->OpCode)&&(NULL != gCurPswdString) )
		{
			MemCopy( ctrlValue, gCurPswdString, size);
		}
		else
	    status = VarGetValue(ControlData->ControlVariable, offset, size, ctrlValue );

	    if(EFI_ERROR(status))
	    {
	      goto DONE;
	    }
		//Checking the Previous value presence and updateing the cache with the previous value
		if(NULL != gPrevControlValue)
			status = VarSetValue(ControlData->ControlVariable, offset, size, gPrevControlValue );
		if(EFI_ERROR(status))
	    {
	      goto DONE;
	    }
	  }
	
	  switch(OpHeader->OpCode)
	  {
	  case EFI_IFR_NUMERIC_OP:
	    type = ((EFI_IFR_NUMERIC *)(ControlData->ControlPtr))->Flags & EFI_IFR_NUMERIC_SIZE;
	    MemCopy(&(value), ctrlValue, size);
	    break;
	  case EFI_IFR_REF_OP:
        //type = EFI_IFR_TYPE_UNDEFINED; //REF_OP uses type EFI_IFR_TYPE_UNDEFINED
		  //EIP109812, 107774
        if ((GetUefiSpecVersion ()) >= 0x2001E)			//If spec version is greater than or equals 2.3 then type will be buffer
        {
            type = EFI_IFR_TYPE_REF;
        }
        else
        {
            type = EFI_IFR_TYPE_UNDEFINED;
        }	
	    break;
	  case EFI_IFR_ONE_OF_OP:
	    type = ((EFI_IFR_ONE_OF *)(ControlData->ControlPtr))->Flags & EFI_IFR_NUMERIC_SIZE;
	    MemCopy(&(value), ctrlValue, size);
	    break;
	  case EFI_IFR_ORDERED_LIST_OP:
		 if ((GetUefiSpecVersion ()) >= 0x2001E)			//If spec version is greater than or equals 2.3 then type will be buffer
		 {
	    	type = EFI_IFR_TYPE_BUFFER;
		 }
		 else
		 {
			type = EFI_IFR_TYPE_OTHER;
		 }		
	    MemCopy(&(value), ctrlValue, size);
	    break;
	  case EFI_IFR_CHECKBOX_OP:
	    type = EFI_IFR_TYPE_BOOLEAN;
	    MemCopy(&(value), ctrlValue, size);
	    break;
	  case EFI_IFR_ACTION_OP:
	    type = EFI_IFR_TYPE_OTHER;
	    tok = ((EFI_IFR_ACTION*)ControlData->ControlPtr)->QuestionConfig;
	    MemCopy(&(value), &tok, sizeof(EFI_STRING_ID));
	    break;
	  case EFI_IFR_STRING_OP:
	  case EFI_IFR_PASSWORD_OP:
	    type = EFI_IFR_TYPE_STRING;
	    tok = HiiAddString(hiiHandle, ctrlValue);
	    MemCopy(&(value), &tok, sizeof(EFI_STRING_ID));
	    break;
	  case EFI_IFR_DATE_OP:
		type = EFI_IFR_TYPE_DATE;
		MemCopy(&(value), ctrlValue, size);
		break;
  	  case EFI_IFR_TIME_OP:
		type = EFI_IFR_TYPE_TIME;
		MemCopy(&(value), ctrlValue, size);
		break;

	  default:
	    goto DONE;
	    break;
	  }
  }
  else
  {
  	type = EFI_IFR_TYPE_UNDEFINED;
  }

 SetCallBackControlInfo(hiiHandle, tempVariable);

  switch(Action)
  {
    case AMI_CALLBACK_FORM_OPEN:
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_FORM_OPEN \n\n" );         
        break;
    case AMI_CALLBACK_FORM_CLOSE:
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_FORM_CLOSE \n\n" );
        break;
    case AMI_CALLBACK_RETRIEVE:
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_RETRIEVE \n\n" );
        break;
    case AMI_CALLBACK_CONTROL_UPDATE:            
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_CHANGING \n\n" );
        break;
		case AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING : 
			SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING \n\n" );
         break;
		case AMI_CALLBACK_FORM_DEFAULT_STANDARD : 
			SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_DEFAULT_STANDARD \\n\n" );//EIP 105167 : Making the specify setup items departing from F2/F3 effect.
         break;
    default:
       
       break;
  }   
  BrowserActionDiscard = FALSE;	
  status = FormCallBack(hiiHandle, Key, type, &value, action);

  switch(Action)
  {
    case AMI_CALLBACK_FORM_OPEN:
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_FORM_OPEN returned,  status = 0x%x \n\n" , status );          
        break;
    case AMI_CALLBACK_FORM_CLOSE:
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_FORM_CLOSE returned,  status = 0x%x \n\n" , status ); 
        break;
    case AMI_CALLBACK_RETRIEVE:
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_RETRIEVE returned,  status = 0x%x \n\n" , status ); 
        break;
    case AMI_CALLBACK_CONTROL_UPDATE:            
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_CHANGING returned,  status = 0x%x \n\n" , status ); 
        break;
		case AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING : 
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING returned,  status = 0x%x \n\n" , status ); 
        break; 
		case AMI_CALLBACK_FORM_DEFAULT_STANDARD : 
        SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] AMI_CALLBACK_FORM_DEFAULT_STANDARD returned,  status = 0x%x \n\n" , status ); //EIP 105167 : Making the specify setup items departing from F2/F3 effect.
        break;
   default:
       
       break;
  }     
    
  SetCallBackControlInfo(NULL, 0);

  if(CONTROL_TYPE_SUBMENU == ControlType) { //Skip rest of the step for REF / Submenu control
    goto DONE;
  }
  //For the action EFI_BROWSER_ACTION_CHANGING update the cache and invoke callback with EFI_BROWSER_ACTION_CHANGED
	if((!EFI_ERROR(status))&&(OpHeader->OpCode != EFI_IFR_ACTION_OP && OpHeader->OpCode != EFI_IFR_REF_OP))
	{
		if (FALSE == BrowserActionDiscard)
	 	{
			if((OpHeader->OpCode == EFI_IFR_STRING_OP)||(OpHeader->OpCode == EFI_IFR_PASSWORD_OP))
			{
				if ( NULL != ctrlValue )
					MemFreePointer( (VOID **)&ctrlValue );
				ctrlValue = HiiGetString( hiiHandle, value.string );
				FullCtrlValue = EfiLibAllocateZeroPool (size);
				if (NULL == FullCtrlValue)
				{
					status = EFI_OUT_OF_RESOURCES;
					goto DONE;
				}
				MemCopy (FullCtrlValue, ctrlValue, EfiStrLen (ctrlValue) * sizeof (CHAR16));	//If not allocated with full size then junk will be store after original string

				if ((EFI_IFR_PASSWORD_OP == OpHeader->OpCode) && IsPasswordEncodeEnabled (ControlData))
				{
					ctrlValue = PasswordUpdate (FullCtrlValue, size);
				}
				VarSetValue (tempVariable, offset, size, FullCtrlValue);//EIP 105167 : Making the specify setup items departing from F2/F3 effect.
				MemFreePointer ((VOID **)&FullCtrlValue);
			}
			else
			{
			 VarSetValue(tempVariable, offset, size, &value );//EIP 105167 : Making the specify setup items departing from F2/F3 effect.
			}
		}
	}
	BrowserActionDiscard = FALSE;
  
 if( (action == EFI_BROWSER_ACTION_CHANGING ) && (/*(status == EFI_UNSUPPORTED) ||*/ (status == EFI_SUCCESS)) )
  {
	switch(OpHeader->OpCode)
	{
	case EFI_IFR_NUMERIC_OP:
	case EFI_IFR_ONE_OF_OP:
	case EFI_IFR_ORDERED_LIST_OP:
	case EFI_IFR_CHECKBOX_OP:
	case EFI_IFR_ACTION_OP:
	case EFI_IFR_STRING_OP:
	case EFI_IFR_PASSWORD_OP:
	case EFI_IFR_DATE_OP:
	case EFI_IFR_TIME_OP:
		if(hiiHandle != NULL)
		{
			SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_CHANGING Success\n\n" ); 
            
            action = EFI_BROWSER_ACTION_CHANGED;
		 	SetCallBackControlInfo(hiiHandle, tempVariable);

            
            SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_CHANGED \n\n" ); 

			status = FormCallBack(hiiHandle, Key, type, &value,action);

            SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_CHANGED returned,  status = 0x%x \n\n" , status ); 
            
	  		SetCallBackControlInfo(NULL, 0);
		}
		status = EFI_SUCCESS;
		break;
	default:
		break;
	}
  }
  if(OpHeader->OpCode == EFI_IFR_STRING_OP || OpHeader->OpCode == EFI_IFR_PASSWORD_OP)
  {
    HiiRemoveString(hiiHandle, tok);
  }

DONE:
  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Exiting CallFormCallBack()\n\n" ); 
  if(gPrevControlValue)
	MemFreePointer( (VOID **)&gPrevControlValue );
  if(gCurPswdString)
	MemFreePointer( (VOID **)&gCurPswdString );
  MemFreePointer( (VOID **)&ctrlValue );
  return status;
}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     CallTextCallBack
//
// Description:   
//
// Parameter:     TEXT_DATA *text, ACTION_DATA *Data
//
// Return Value:  EFI_STATUS
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
EFI_STATUS CallTextCallBack(TEXT_DATA *text, ACTION_DATA *Data)
{
	EFI_STATUS Status = EFI_UNSUPPORTED;

	if (text->Interval == 0)
		return Status;
	if ( --(text->Interval) == 0 )
	{
		// initialize the interval
		text->Interval = (UINT8)(text->ControlData.ControlFlags.ControlRefresh);
		return EFI_SUCCESS;
	}
	else
		return Status;

}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     SpecialActionCallBack
//
// Description:   
//
// Parameter:     CONTROL_INFO * ControlData, UINT16 Key
//
// Return Value:  EFI_STATUS
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
EFI_STATUS SpecialActionCallBack(CONTROL_INFO * ControlData, UINT16 Key)
{
  EFI_STATUS status = EFI_SUCCESS;
  EFI_IFR_TYPE_VALUE value;

  UINT16 tok = 0;
  UINT8	type = 0;

  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Entering SpecialActionCallBack()\n\n" );   

  MemSet( &value, sizeof(value), 0 );
  type = EFI_IFR_TYPE_OTHER;
  tok = ((EFI_IFR_ACTION*)ControlData->ControlPtr)->Question.Header.Prompt;
  MemCopy(&(value), &tok, sizeof(EFI_STRING_ID));

  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Sending EFI_BROWSER_ACTION_CHANGING \n\n" ); 

  SetCallBackControlInfo(ControlData->ControlHandle, ControlData->ControlVariable);
  status = FormCallBack(ControlData->ControlHandle, Key, type, &value,EFI_BROWSER_ACTION_CHANGING);
  SetCallBackControlInfo(NULL, 0);

  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] EFI_BROWSER_ACTION_CHANGING returned,  status = 0x%x \n\n" , status );   

  SETUP_DEBUG_UEFI_CALLBACK (  "[TSE] Exiting SpecialActionCallBack()\n\n" );    

  return status;
}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     UefiPreControlUpdate
//
// Description:   store the Control value before updating and calling the callback.
//
// Parameter:     CONTROL_INFO * ControlData
//
// Return Value:  EFI_STATUS
//----------------------------------------------------------------------------
//<AMI_PHDR_END>

VOID UefiPreControlUpdate (CONTROL_INFO *ControlData)
{
	EFI_STATUS status = EFI_SUCCESS;

	if(gPrevControlValue)
		MemFreePointer( (VOID **)&gPrevControlValue );

	if (NULL == ControlData)			//UefiPreControlUpdate will be called with NULL for clearing gPrevControlValue. So returning from here if it is NULL.
	{
		return;
	}	
	if(UefiIsInteractive(ControlData))
	{
		UINT32 size = 0;
		UINT32 offset = 0;
		offset = UefiGetQuestionOffset(ControlData->ControlPtr);
		if(ControlData->ControlType == CONTROL_TYPE_ORDERED_LIST)
		{
			UINTN Type=0;
			UefiGetValidOptionType( ControlData, &Type, &size);
			size = gOrderlistcount * size;
		}
		else
			size = UefiGetWidth(ControlData->ControlPtr);
		gPrevControlValue = EfiLibAllocateZeroPool(size);
		if(gPrevControlValue == NULL)
		{
			//EFI_OUT_OF_RESOURCES;
			return;
		}

		status = VarGetValue(ControlData->ControlVariable, offset, size, gPrevControlValue );
	}
}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     SavePswdString
//
// Description:   fucntion to save the password string.
//
// Parameter:     CONTROL_INFO * ControlData, CHAR16 *String
//
// Return Value:  VOID
//----------------------------------------------------------------------------
//<AMI_PHDR_END>

VOID SavePswdString (CONTROL_INFO *ControlData, CHAR16 *String)
{
	EFI_STATUS status = EFI_SUCCESS;

	if(gCurPswdString)
		MemFreePointer( (VOID **)&gCurPswdString );

	if (NULL == ControlData)			//UefiPreControlUpdate will be called with NULL for clearing gPrevControlValue. So returning from here if it is NULL.
	{
		return;
	}	
	if(UefiIsInteractive(ControlData))
	{
		UINT32 size = 0;
		size = UefiGetWidth(ControlData->ControlPtr);
		gCurPswdString = EfiLibAllocateZeroPool(size);
		if ( NULL == gCurPswdString )
        	return ;
		MemCopy(gCurPswdString, String, size);
	}
}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     UefiIsProceedWithPageChange
//
// Description:   	If the Formcallback returns status is EFI_UNSUPPORTED or EFI_SUCCESS.
//					Change page is allowed. Otherwise changeing of page should not happen
//					For UEFI 2.0 Just return EFI_SUCCESS;
//
// Parameter:     EFI_STATUS
//
// Return Value:  EFI_STATUS
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
EFI_STATUS UefiIsProceedWithPageChange(EFI_STATUS Status)
{
	// For Submenu if the status is EFI_UNSUPPORTED or EFI_SUCCESS.
	// Change page is allowed.
	if((Status == EFI_UNSUPPORTED) || (Status == EFI_SUCCESS))
	{
		return EFI_SUCCESS;
	}
	else
		return Status;
}
//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     UEFICallSetupFormCallBack
//
// Description:	  The Wrapper function function which calls the CallFormCallBack() if the control is Interactive    	
//
// Parameter:     UINTN Action 
//
// Return Value:  VOID
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
VOID UEFICallSetupFormCallBack(UINTN Action )
{
//EIP-53480: Implementation of FormBrowser with actions support 
	UINT32	page, control;
	gBrowserCallbackEnabled = TRUE;

	if (NULL != gApplicationData)
	{
		for ( page = 0; page < gPages->PageCount; page++ )
		{
			PAGE_INFO *pageInfo = (PAGE_INFO *)((UINTN)gApplicationData + gPages->PageList[page]);

			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 (UefiIsInteractive(controlInfo))
				{
					// EIP88031 : Allow BROWSER_ACTION_RETRIEVE for all Interactive controls on MiniSetupEntry
					//if((Action == EFI_BROWSER_ACTION_RETRIEVE)&&(controlInfo->ControlType == CONTROL_TYPE_SUBMENU))
					//	continue;
				
					UefiPreControlUpdate(NULL);	//EIP 75464 : Updating the gPrevControlValue buffer to NULLL before invoking CallFormCallBack 
					CallFormCallBack(controlInfo, UefiGetControlKey(controlInfo), FALSE,Action);
				}

			}
		}
	}
	gBrowserCallbackEnabled = FALSE;
}

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
//
// Procedure:     UefiGetActionWapper
//
// Description:	  The Wrapper function to get the actual action for the driver   	
//
// Parameter:     UINTN Action 
//
// Return Value:  EFI_BROWSER_ACTION 
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
EFI_BROWSER_ACTION UefiGetActionWapper(UINTN Action)
{
	if(Action == AMI_CALLBACK_CONTROL_UPDATE)
	  return EFI_BROWSER_ACTION_CHANGING;
	  
	if(Action == AMI_CALLBACK_RETRIEVE)
	  return EFI_BROWSER_ACTION_RETRIEVE;
	  
	if(Action == AMI_CALLBACK_FORM_OPEN)
	  return EFI_BROWSER_ACTION_FORM_OPEN;
	  
	if(Action == AMI_CALLBACK_FORM_CLOSE)
	  return EFI_BROWSER_ACTION_FORM_CLOSE;

	if(Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING)
	  return  EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING;//EIP 105167 : Making the specify setup items departing from F2/F3 effect.

	if(Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD)
	  return  EFI_BROWSER_ACTION_DEFAULT_STANDARD;
	  
	return Action;

}


//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2013, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**     5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093     **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************