4 Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #ifndef _FILE_EXPLORER_H_
15 #define _FILE_EXPLORER_H_
18 #include <Guid/FileSystemVolumeLabelInfo.h>
19 #include <Guid/FileInfo.h>
20 #include <Guid/MdeModuleHii.h>
22 #include <Protocol/HiiConfigAccess.h>
23 #include <Protocol/DevicePath.h>
24 #include <Protocol/SimpleFileSystem.h>
25 #include <Protocol/DevicePathToText.h>
26 #include <Protocol/FormBrowser2.h>
28 #include <Library/DebugLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/BaseLib.h>
33 #include <Library/UefiLib.h>
34 #include <Library/DevicePathLib.h>
35 #include <Library/FileExplorerLib.h>
36 #include <Library/HiiLib.h>
37 #include <Library/PrintLib.h>
41 #define FILE_EXPLORER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('f', 'e', 'c', 'k')
47 /// HII specific Vendor Device Path definition.
50 VENDOR_DEVICE_PATH VendorDevicePath
;
51 EFI_DEVICE_PATH_PROTOCOL End
;
52 } HII_VENDOR_DEVICE_PATH
;
55 EFI_HANDLE DeviceHandle
;
56 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
57 EFI_FILE_HANDLE FileHandle
;
67 UINT16
*DisplayString
;
69 EFI_STRING_ID DisplayStringToken
;
70 EFI_STRING_ID HelpStringToken
;
71 VOID
*VariableContext
;
83 // Shared callback data.
88 // File explorer formset callback data.
90 EFI_HII_HANDLE FeHiiHandle
;
91 EFI_HANDLE FeDriverHandle
;
92 EFI_HII_CONFIG_ACCESS_PROTOCOL FeConfigAccess
;
93 EFI_FORM_BROWSER2_PROTOCOL
*FormBrowser2
;
94 MENU_OPTION
*FsOptionMenu
;
96 CHOOSE_HANDLER ChooseHandler
;
97 EFI_DEVICE_PATH_PROTOCOL
*RetDevicePath
;
99 } FILE_EXPLORER_CALLBACK_DATA
;
101 #define FILE_EXPLORER_PRIVATE_FROM_THIS(a) CR (a, FILE_EXPLORER_CALLBACK_DATA, FeConfigAccess, FILE_EXPLORER_CALLBACK_DATA_SIGNATURE)
105 extern UINT8 FileExplorerVfrBin
[];
107 #define MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
108 #define MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
111 /// Define the maximum characters that will be accepted.
114 #define FILE_OPTION_OFFSET 0x8000
115 #define FILE_OPTION_MASK 0x7FFF
116 #define QUESTION_ID_UPDATE_STEP 200
117 #define MAX_FILE_NAME_LEN 20
118 #define MAX_FOLDER_NAME_LEN 20
119 #define NEW_FILE_QUESTION_ID_BASE 0x5000;
120 #define NEW_FOLDER_QUESTION_ID_BASE 0x6000;
123 This function processes the results of changes in configuration.
124 When user select a interactive opcode, this callback will be triggered.
125 Based on the Question(QuestionId) that triggers the callback, the corresponding
126 actions is performed. It handles:
128 1) the addition of boot option.
129 2) the addition of driver option.
130 3) exit from file browser
131 4) update of file content if a dir is selected.
132 5) boot the file if a file is selected in "boot from file"
135 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
136 @param Action Specifies the type of action taken by the browser.
137 @param QuestionId A unique value which is sent to the original exporting driver
138 so that it can identify the type of data to expect.
139 @param Type The type of value for the question.
140 @param Value A pointer to the data being sent to the original exporting driver.
141 @param ActionRequest On return, points to the action requested by the callback function.
143 @retval EFI_SUCCESS The callback successfully handled the action.
144 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
145 @retval EFI_DEVICE_ERROR The variable could not be saved.
146 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
152 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
153 IN EFI_BROWSER_ACTION Action
,
154 IN EFI_QUESTION_ID QuestionId
,
156 IN EFI_IFR_TYPE_VALUE
*Value
,
157 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
162 This function allows a caller to extract the current configuration for one
163 or more named elements from the target driver.
166 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
167 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
168 @param Progress - On return, points to a character in the Request string.
169 Points to the string's null terminator if request was successful.
170 Points to the most recent '&' before the first failing name/value
171 pair (or the beginning of the string if the failure is in the
172 first name/value pair) if the request was not successful.
173 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
174 has all values filled in for the names in the Request string.
175 String to be allocated by the called function.
177 @retval EFI_SUCCESS The Results is filled with the requested values.
178 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
179 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
180 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
186 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
187 IN CONST EFI_STRING Request
,
188 OUT EFI_STRING
*Progress
,
189 OUT EFI_STRING
*Results
193 This function processes the results of changes in configuration.
196 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
197 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
198 @param Progress - A pointer to a string filled in with the offset of the most
199 recent '&' before the first failing name/value pair (or the
200 beginning of the string if the failure is in the first
201 name/value pair) or the terminating NULL if all was successful.
203 @retval EFI_SUCCESS The Results is processed successfully.
204 @retval EFI_INVALID_PARAMETER Configuration is NULL.
205 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
211 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
212 IN CONST EFI_STRING Configuration
,
213 OUT EFI_STRING
*Progress
217 Update the file explower page with the refershed file system.
219 @param KeyValue Key value to identify the type of data to expect.
221 @retval EFI_SUCCESS Update the file explorer form success.
222 @retval other errors Error occur when parse one directory.
226 LibUpdateFileExplorer (
232 Get the device path info saved in the menu structure.
234 @param KeyValue Key value to identify the type of data to expect.