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