]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
MdeModulePkg/FileExplorer: Update QuesrionId when Updating FileExplore form
[mirror_edk2.git] / MdeModulePkg / Library / FileExplorerLib / FileExplorer.h
CommitLineData
4c8274a0
ED
1/** @file\r
2 File explorer lib.\r
3\r
d9b64abb 4Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
4c8274a0
ED
5This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12**/\r
13\r
14#ifndef _FILE_EXPLORER_H_\r
15#define _FILE_EXPLORER_H_\r
16\r
17#include <PiDxe.h>\r
18#include <Guid/FileSystemVolumeLabelInfo.h>\r
19#include <Guid/FileInfo.h>\r
20#include <Guid/MdeModuleHii.h>\r
21\r
22#include <Protocol/HiiConfigAccess.h>\r
23#include <Protocol/DevicePath.h>\r
24#include <Protocol/SimpleFileSystem.h>\r
25#include <Protocol/DevicePathToText.h>\r
4c8274a0
ED
26#include <Protocol/FormBrowser2.h>\r
27\r
28#include <Library/DebugLib.h>\r
29#include <Library/BaseMemoryLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32#include <Library/BaseLib.h>\r
33#include <Library/UefiLib.h>\r
34#include <Library/DevicePathLib.h>\r
35#include <Library/FileExplorerLib.h>\r
36#include <Library/HiiLib.h>\r
37#include <Library/PrintLib.h>\r
38\r
39#include "FormGuid.h"\r
40\r
41#define FILE_EXPLORER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('f', 'e', 'c', 'k')\r
42\r
43\r
44#pragma pack(1)\r
45\r
46///\r
47/// HII specific Vendor Device Path definition.\r
48///\r
49typedef struct {\r
50 VENDOR_DEVICE_PATH VendorDevicePath;\r
51 EFI_DEVICE_PATH_PROTOCOL End;\r
52} HII_VENDOR_DEVICE_PATH;\r
53\r
54typedef struct {\r
55 EFI_HANDLE DeviceHandle;\r
56 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
57 EFI_FILE_HANDLE FileHandle;\r
58 UINT16 *FileName;\r
59\r
60 BOOLEAN IsRoot;\r
61 BOOLEAN IsDir;\r
62} FILE_CONTEXT;\r
63\r
64typedef struct {\r
65 UINTN Signature;\r
66 LIST_ENTRY Link;\r
67 UINT16 *DisplayString;\r
68 UINT16 *HelpString;\r
69 EFI_STRING_ID DisplayStringToken;\r
70 EFI_STRING_ID HelpStringToken;\r
71 VOID *VariableContext;\r
72} MENU_ENTRY;\r
73\r
74typedef struct {\r
75 UINTN Signature;\r
76 LIST_ENTRY Head;\r
77 UINTN MenuNumber;\r
78 BOOLEAN Used;\r
79} MENU_OPTION;\r
80\r
81typedef struct {\r
82 //\r
83 // Shared callback data.\r
84 //\r
85 UINTN Signature;\r
86\r
87 //\r
88 // File explorer formset callback data.\r
89 //\r
90 EFI_HII_HANDLE FeHiiHandle;\r
91 EFI_HANDLE FeDriverHandle;\r
92 EFI_HII_CONFIG_ACCESS_PROTOCOL FeConfigAccess;\r
93 EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
94 MENU_OPTION *FsOptionMenu;\r
95 CHAR16 *FileType;\r
96 CHOOSE_HANDLER ChooseHandler;\r
97 EFI_DEVICE_PATH_PROTOCOL *RetDevicePath;\r
98\r
99} FILE_EXPLORER_CALLBACK_DATA;\r
100\r
101#define FILE_EXPLORER_PRIVATE_FROM_THIS(a) CR (a, FILE_EXPLORER_CALLBACK_DATA, FeConfigAccess, FILE_EXPLORER_CALLBACK_DATA_SIGNATURE)\r
102\r
103#pragma pack()\r
104\r
105extern UINT8 FileExplorerVfrBin[];\r
106\r
107#define MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')\r
108#define MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')\r
109\r
110///\r
111/// Define the maximum characters that will be accepted.\r
112///\r
113#define MAX_CHAR 480\r
114#define FILE_OPTION_OFFSET 0x8000\r
115#define FILE_OPTION_MASK 0x7FFF\r
9cf1aa29 116#define QUESTION_ID_UPDATE_STEP 200\r
4c8274a0
ED
117\r
118/**\r
119 This function processes the results of changes in configuration.\r
120 When user select a interactive opcode, this callback will be triggered.\r
121 Based on the Question(QuestionId) that triggers the callback, the corresponding\r
122 actions is performed. It handles:\r
123\r
124 1) the addition of boot option.\r
125 2) the addition of driver option.\r
126 3) exit from file browser\r
127 4) update of file content if a dir is selected.\r
128 5) boot the file if a file is selected in "boot from file"\r
129\r
130\r
131 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
132 @param Action Specifies the type of action taken by the browser.\r
133 @param QuestionId A unique value which is sent to the original exporting driver\r
134 so that it can identify the type of data to expect.\r
135 @param Type The type of value for the question.\r
136 @param Value A pointer to the data being sent to the original exporting driver.\r
137 @param ActionRequest On return, points to the action requested by the callback function.\r
138\r
139 @retval EFI_SUCCESS The callback successfully handled the action.\r
140 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
141 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
142 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.\r
143\r
144**/\r
145EFI_STATUS\r
146EFIAPI\r
147LibCallback (\r
148 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
149 IN EFI_BROWSER_ACTION Action,\r
150 IN EFI_QUESTION_ID QuestionId,\r
151 IN UINT8 Type,\r
152 IN EFI_IFR_TYPE_VALUE *Value,\r
153 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
154 );\r
155\r
156\r
157/**\r
158 This function allows a caller to extract the current configuration for one\r
159 or more named elements from the target driver.\r
160\r
161\r
162 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
163 @param Request - A null-terminated Unicode string in <ConfigRequest> format.\r
164 @param Progress - On return, points to a character in the Request string.\r
165 Points to the string's null terminator if request was successful.\r
166 Points to the most recent '&' before the first failing name/value\r
167 pair (or the beginning of the string if the failure is in the\r
168 first name/value pair) if the request was not successful.\r
169 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which\r
170 has all values filled in for the names in the Request string.\r
171 String to be allocated by the called function.\r
172\r
173 @retval EFI_SUCCESS The Results is filled with the requested values.\r
174 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
175 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
176 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
177\r
178**/\r
179EFI_STATUS\r
180EFIAPI\r
181LibExtractConfig (\r
182 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
183 IN CONST EFI_STRING Request,\r
184 OUT EFI_STRING *Progress,\r
185 OUT EFI_STRING *Results\r
186 );\r
187\r
188/**\r
189 This function processes the results of changes in configuration.\r
190\r
191\r
192 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
193 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
194 @param Progress - A pointer to a string filled in with the offset of the most\r
195 recent '&' before the first failing name/value pair (or the\r
196 beginning of the string if the failure is in the first\r
197 name/value pair) or the terminating NULL if all was successful.\r
198\r
199 @retval EFI_SUCCESS The Results is processed successfully.\r
200 @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
201 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
202\r
203**/\r
204EFI_STATUS\r
205EFIAPI\r
206LibRouteConfig (\r
207 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
208 IN CONST EFI_STRING Configuration,\r
209 OUT EFI_STRING *Progress\r
210 );\r
211\r
212/**\r
213 Update the file explower page with the refershed file system.\r
214\r
215 @param KeyValue Key value to identify the type of data to expect.\r
216\r
217 @retval EFI_SUCCESS Update the file explorer form success.\r
218 @retval other errors Error occur when parse one directory.\r
219\r
220**/\r
221EFI_STATUS\r
222LibUpdateFileExplorer (\r
223 IN UINT16 KeyValue\r
224 );\r
225 \r
226 \r
227/**\r
228 Get the device path info saved in the menu structure.\r
229\r
230 @param KeyValue Key value to identify the type of data to expect.\r
231\r
232**/\r
233VOID\r
234LibGetDevicePath (\r
235 IN UINT16 KeyValue\r
236 );\r
237\r
238#endif \r