]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
MdeModulePkg/ResetUtilityLib: Fix GCC build failure
[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
a4098755
DB
117#define MAX_FILE_NAME_LEN 20\r
118#define MAX_FOLDER_NAME_LEN 20\r
119#define NEW_FILE_QUESTION_ID_BASE 0x5000;\r
120#define NEW_FOLDER_QUESTION_ID_BASE 0x6000;\r
4c8274a0
ED
121\r
122/**\r
123 This function processes the results of changes in configuration.\r
124 When user select a interactive opcode, this callback will be triggered.\r
125 Based on the Question(QuestionId) that triggers the callback, the corresponding\r
126 actions is performed. It handles:\r
127\r
128 1) the addition of boot option.\r
129 2) the addition of driver option.\r
130 3) exit from file browser\r
131 4) update of file content if a dir is selected.\r
132 5) boot the file if a file is selected in "boot from file"\r
133\r
134\r
135 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
136 @param Action Specifies the type of action taken by the browser.\r
137 @param QuestionId A unique value which is sent to the original exporting driver\r
138 so that it can identify the type of data to expect.\r
139 @param Type The type of value for the question.\r
140 @param Value A pointer to the data being sent to the original exporting driver.\r
141 @param ActionRequest On return, points to the action requested by the callback function.\r
142\r
143 @retval EFI_SUCCESS The callback successfully handled the action.\r
144 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
145 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
146 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.\r
147\r
148**/\r
149EFI_STATUS\r
150EFIAPI\r
151LibCallback (\r
152 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
153 IN EFI_BROWSER_ACTION Action,\r
154 IN EFI_QUESTION_ID QuestionId,\r
155 IN UINT8 Type,\r
156 IN EFI_IFR_TYPE_VALUE *Value,\r
157 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
158 );\r
159\r
160\r
161/**\r
162 This function allows a caller to extract the current configuration for one\r
163 or more named elements from the target driver.\r
164\r
165\r
166 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
167 @param Request - A null-terminated Unicode string in <ConfigRequest> format.\r
168 @param Progress - On return, points to a character in the Request string.\r
169 Points to the string's null terminator if request was successful.\r
170 Points to the most recent '&' before the first failing name/value\r
171 pair (or the beginning of the string if the failure is in the\r
172 first name/value pair) if the request was not successful.\r
173 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which\r
174 has all values filled in for the names in the Request string.\r
175 String to be allocated by the called function.\r
176\r
177 @retval EFI_SUCCESS The Results is filled with the requested values.\r
178 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
179 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
180 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
181\r
182**/\r
183EFI_STATUS\r
184EFIAPI\r
185LibExtractConfig (\r
186 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
187 IN CONST EFI_STRING Request,\r
188 OUT EFI_STRING *Progress,\r
189 OUT EFI_STRING *Results\r
190 );\r
191\r
192/**\r
193 This function processes the results of changes in configuration.\r
194\r
195\r
196 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
197 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
198 @param Progress - A pointer to a string filled in with the offset of the most\r
199 recent '&' before the first failing name/value pair (or the\r
200 beginning of the string if the failure is in the first\r
201 name/value pair) or the terminating NULL if all was successful.\r
202\r
203 @retval EFI_SUCCESS The Results is processed successfully.\r
204 @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
205 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
206\r
207**/\r
208EFI_STATUS\r
209EFIAPI\r
210LibRouteConfig (\r
211 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
212 IN CONST EFI_STRING Configuration,\r
213 OUT EFI_STRING *Progress\r
214 );\r
215\r
216/**\r
217 Update the file explower page with the refershed file system.\r
218\r
219 @param KeyValue Key value to identify the type of data to expect.\r
220\r
221 @retval EFI_SUCCESS Update the file explorer form success.\r
222 @retval other errors Error occur when parse one directory.\r
223\r
224**/\r
225EFI_STATUS\r
226LibUpdateFileExplorer (\r
227 IN UINT16 KeyValue\r
228 );\r
229 \r
230 \r
231/**\r
232 Get the device path info saved in the menu structure.\r
233\r
234 @param KeyValue Key value to identify the type of data to expect.\r
235\r
236**/\r
237VOID\r
238LibGetDevicePath (\r
239 IN UINT16 KeyValue\r
240 );\r
241\r
242#endif \r