4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 #ifndef _FILE_EXPLORER_H_
9 #define _FILE_EXPLORER_H_
12 #include <Guid/FileSystemVolumeLabelInfo.h>
13 #include <Guid/FileInfo.h>
14 #include <Guid/MdeModuleHii.h>
16 #include <Protocol/HiiConfigAccess.h>
17 #include <Protocol/DevicePath.h>
18 #include <Protocol/SimpleFileSystem.h>
19 #include <Protocol/DevicePathToText.h>
20 #include <Protocol/FormBrowser2.h>
22 #include <Library/DebugLib.h>
23 #include <Library/BaseMemoryLib.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/MemoryAllocationLib.h>
26 #include <Library/BaseLib.h>
27 #include <Library/UefiLib.h>
28 #include <Library/DevicePathLib.h>
29 #include <Library/FileExplorerLib.h>
30 #include <Library/HiiLib.h>
31 #include <Library/PrintLib.h>
35 #define FILE_EXPLORER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('f', 'e', 'c', 'k')
41 /// HII specific Vendor Device Path definition.
44 VENDOR_DEVICE_PATH VendorDevicePath
;
45 EFI_DEVICE_PATH_PROTOCOL End
;
46 } HII_VENDOR_DEVICE_PATH
;
51 EFI_HANDLE DeviceHandle
;
52 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
53 EFI_FILE_HANDLE FileHandle
;
63 UINT16
*DisplayString
;
65 EFI_STRING_ID DisplayStringToken
;
66 EFI_STRING_ID HelpStringToken
;
67 VOID
*VariableContext
;
79 // Shared callback data.
84 // File explorer formset callback data.
86 EFI_HII_HANDLE FeHiiHandle
;
87 EFI_HANDLE FeDriverHandle
;
88 EFI_HII_CONFIG_ACCESS_PROTOCOL FeConfigAccess
;
89 EFI_FORM_BROWSER2_PROTOCOL
*FormBrowser2
;
90 MENU_OPTION
*FsOptionMenu
;
92 CHOOSE_HANDLER ChooseHandler
;
93 EFI_DEVICE_PATH_PROTOCOL
*RetDevicePath
;
95 } FILE_EXPLORER_CALLBACK_DATA
;
97 #define FILE_EXPLORER_PRIVATE_FROM_THIS(a) CR (a, FILE_EXPLORER_CALLBACK_DATA, FeConfigAccess, FILE_EXPLORER_CALLBACK_DATA_SIGNATURE)
99 extern UINT8 FileExplorerVfrBin
[];
101 #define MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
102 #define MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
105 /// Define the maximum characters that will be accepted.
108 #define FILE_OPTION_OFFSET 0x8000
109 #define FILE_OPTION_MASK 0x7FFF
110 #define QUESTION_ID_UPDATE_STEP 200
111 #define MAX_FILE_NAME_LEN 20
112 #define MAX_FOLDER_NAME_LEN 20
113 #define NEW_FILE_QUESTION_ID_BASE 0x5000;
114 #define NEW_FOLDER_QUESTION_ID_BASE 0x6000;
117 This function processes the results of changes in configuration.
118 When user select a interactive opcode, this callback will be triggered.
119 Based on the Question(QuestionId) that triggers the callback, the corresponding
120 actions is performed. It handles:
122 1) the addition of boot option.
123 2) the addition of driver option.
124 3) exit from file browser
125 4) update of file content if a dir is selected.
126 5) boot the file if a file is selected in "boot from file"
129 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
130 @param Action Specifies the type of action taken by the browser.
131 @param QuestionId A unique value which is sent to the original exporting driver
132 so that it can identify the type of data to expect.
133 @param Type The type of value for the question.
134 @param Value A pointer to the data being sent to the original exporting driver.
135 @param ActionRequest On return, points to the action requested by the callback function.
137 @retval EFI_SUCCESS The callback successfully handled the action.
138 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
139 @retval EFI_DEVICE_ERROR The variable could not be saved.
140 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
146 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
147 IN EFI_BROWSER_ACTION Action
,
148 IN EFI_QUESTION_ID QuestionId
,
150 IN EFI_IFR_TYPE_VALUE
*Value
,
151 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
156 This function allows a caller to extract the current configuration for one
157 or more named elements from the target driver.
160 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
161 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
162 @param Progress - On return, points to a character in the Request string.
163 Points to the string's null terminator if request was successful.
164 Points to the most recent '&' before the first failing name/value
165 pair (or the beginning of the string if the failure is in the
166 first name/value pair) if the request was not successful.
167 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
168 has all values filled in for the names in the Request string.
169 String to be allocated by the called function.
171 @retval EFI_SUCCESS The Results is filled with the requested values.
172 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
173 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
174 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
180 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
181 IN CONST EFI_STRING Request
,
182 OUT EFI_STRING
*Progress
,
183 OUT EFI_STRING
*Results
187 This function processes the results of changes in configuration.
190 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
191 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
192 @param Progress - A pointer to a string filled in with the offset of the most
193 recent '&' before the first failing name/value pair (or the
194 beginning of the string if the failure is in the first
195 name/value pair) or the terminating NULL if all was successful.
197 @retval EFI_SUCCESS The Results is processed successfully.
198 @retval EFI_INVALID_PARAMETER Configuration is NULL.
199 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
205 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
206 IN CONST EFI_STRING Configuration
,
207 OUT EFI_STRING
*Progress
211 Update the file explower page with the refershed file system.
213 @param KeyValue Key value to identify the type of data to expect.
215 @retval EFI_SUCCESS Update the file explorer form success.
216 @retval other errors Error occur when parse one directory.
220 LibUpdateFileExplorer (
226 Get the device path info saved in the menu structure.
228 @param KeyValue Key value to identify the type of data to expect.