]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/SetupBrowser.c
Code scrub for Universal\Console\GraphicsConsoleDxe.
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / FrameworkHiiToUefiHiiThunk / SetupBrowser.c
CommitLineData
0368663f 1/**@file\r
2Framework to UEFI 2.1 Setup Browser Thunk. The file consume EFI_FORM_BROWSER2_PROTOCOL\r
3to produce a EFI_FORM_BROWSER_PROTOCOL.\r
4\r
5Copyright (c) 2008, Intel Corporation\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "HiiDatabase.h"\r
17\r
a9d85320 18/**\r
19 This is the Framework Setup Browser interface which displays a FormSet.\r
20\r
21 @param This The EFI_FORM_BROWSER_PROTOCOL context.\r
22 @param UseDatabase TRUE if the FormSet is from HII database. The Thunk implementation\r
23 only support UseDatabase is TRUE.\r
24 @param Handle The Handle buffer.\r
25 @param HandleCount The number of Handle in the Handle Buffer. It must be 1 for this implementation.\r
26 @param Packet The pointer to data buffer containing IFR and String package. Not supported.\r
27 @param CallbackHandle Not supported.\r
28 @param NvMapOverride The buffer is used only when there is no NV variable to define the \r
29 current settings and the caller needs to provide to the browser the\r
30 current settings for the the "fake" NV variable. If used, no saving of\r
31 an NV variable is possbile. This parameter is also ignored if Handle is NULL.\r
32\r
33 @retval EFI_SUCCESS If the Formset is displayed correctly.\r
34 @retval EFI_UNSUPPORTED If UseDatabase is FALSE or HandleCount is not 1.\r
35 @retval EFI_INVALID_PARAMETER If the *Handle passed in is not found in the database.\r
36**/\r
37\r
0368663f 38EFI_STATUS\r
39EFIAPI \r
40ThunkSendForm (\r
41 IN EFI_FORM_BROWSER_PROTOCOL *This,\r
42 IN BOOLEAN UseDatabase,\r
43 IN FRAMEWORK_EFI_HII_HANDLE *Handle,\r
44 IN UINTN HandleCount,\r
45 IN FRAMEWORK_EFI_IFR_PACKET *Packet, OPTIONAL\r
46 IN EFI_HANDLE CallbackHandle, OPTIONAL\r
47 IN UINT8 *NvMapOverride, OPTIONAL\r
48 IN FRAMEWORK_EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL\r
49 OUT BOOLEAN *ResetRequired OPTIONAL\r
50 )\r
51{\r
52 EFI_STATUS Status;\r
53 EFI_BROWSER_ACTION_REQUEST ActionRequest;\r
54 HII_THUNK_CONTEXT *ThunkContext;\r
55 HII_THUNK_PRIVATE_DATA *Private;\r
56 EFI_FORMBROWSER_THUNK_PRIVATE_DATA *BrowserPrivate;\r
57\r
58 if (!UseDatabase) {\r
59 //\r
a3318eaf 60 // ThunkSendForm only support displays forms registered into the HII database.\r
0368663f 61 //\r
62 return EFI_UNSUPPORTED;\r
63 }\r
64\r
65 if (HandleCount != 1 ) {\r
66 return EFI_UNSUPPORTED;\r
67 }\r
68\r
69 BrowserPrivate = EFI_FORMBROWSER_THUNK_PRIVATE_DATA_FROM_THIS (This);\r
70 Private = BrowserPrivate->ThunkPrivate;\r
71\r
72 ThunkContext = FwHiiHandleToThunkContext (Private, *Handle);\r
73 if (ThunkContext == NULL) {\r
74 return EFI_INVALID_PARAMETER;\r
75 }\r
76\r
77 if (NvMapOverride != NULL) {\r
78 ThunkContext->NvMapOverride = NvMapOverride;\r
79 }\r
80\r
81 Status = mFormBrowser2Protocol->SendForm (\r
82 mFormBrowser2Protocol,\r
83 &ThunkContext->UefiHiiHandle,\r
84 1,\r
85 NULL,\r
86 0,\r
87 (EFI_SCREEN_DESCRIPTOR *) ScreenDimensions,\r
88 &ActionRequest\r
89 );\r
90\r
91 if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {\r
92 *ResetRequired = TRUE;\r
93 }\r
94 \r
95 return Status;\r
96}\r
97\r
a9d85320 98/** \r
99\r
100 Rountine used to display a generic dialog interface and return \r
101 the Key or Input from user input.\r
102\r
103 @param NumberOfLines The number of lines for the dialog box.\r
104 @param HotKey Defines if a single character is parsed (TRUE) and returned in KeyValue\r
105 or if a string is returned in StringBuffer.\r
106 @param MaximumStringSize The maximum size in bytes of a typed-in string.\r
107 @param StringBuffer On return contains the typed-in string if HotKey\r
108 is FALSE.\r
109 @param KeyValue The EFI_INPUT_KEY value returned if HotKey is TRUE.\r
110 @param String The pointer to the first string in the list of strings\r
111 that comprise the dialog box.\r
112 @param ... A series of NumberOfLines text strings that will be used\r
113 to construct the dialog box.\r
114 @retval EFI_SUCCESS The dialog is created successfully and user interaction was received.\r
115 @retval EFI_DEVICE_ERROR The user typed in an ESC.\r
116 @retval EFI_INVALID_PARAMETER One of the parameters was invalid.(StringBuffer == NULL && HotKey == FALSE).\r
117**/\r
0368663f 118EFI_STATUS\r
119EFIAPI \r
120ThunkCreatePopUp (\r
121 IN UINTN NumberOfLines,\r
122 IN BOOLEAN HotKey,\r
123 IN UINTN MaximumStringSize,\r
124 OUT CHAR16 *StringBuffer,\r
125 OUT EFI_INPUT_KEY *KeyValue,\r
126 IN CHAR16 *String,\r
127 ...\r
128 )\r
129{\r
130 EFI_STATUS Status;\r
131 VA_LIST Marker;\r
132\r
133 if (HotKey != TRUE) {\r
134 return EFI_UNSUPPORTED;\r
135 }\r
136\r
70d72ba9 137 VA_START (Marker, String);\r
0368663f 138 \r
70d72ba9 139 Status = IfrLibCreatePopUp2 (NumberOfLines, KeyValue, String, Marker);\r
0368663f 140\r
141 VA_END (Marker);\r
142 \r
143 return Status;\r
144}\r
145\r