1 | /** @file
|
---|
2 | Header file for boot maintenance module.
|
---|
3 |
|
---|
4 | Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _BOOT_MAINT_H_
|
---|
10 | #define _BOOT_MAINT_H_
|
---|
11 |
|
---|
12 | #include "FormGuid.h"
|
---|
13 |
|
---|
14 | #include <Guid/TtyTerm.h>
|
---|
15 | #include <Guid/MdeModuleHii.h>
|
---|
16 | #include <Guid/FileSystemVolumeLabelInfo.h>
|
---|
17 | #include <Guid/GlobalVariable.h>
|
---|
18 | #include <Guid/HiiBootMaintenanceFormset.h>
|
---|
19 |
|
---|
20 | #include <Protocol/LoadFile.h>
|
---|
21 | #include <Protocol/HiiConfigAccess.h>
|
---|
22 | #include <Protocol/SimpleFileSystem.h>
|
---|
23 | #include <Protocol/SerialIo.h>
|
---|
24 | #include <Protocol/DevicePathToText.h>
|
---|
25 | #include <Protocol/FormBrowserEx2.h>
|
---|
26 |
|
---|
27 | #include <Library/PrintLib.h>
|
---|
28 | #include <Library/DebugLib.h>
|
---|
29 | #include <Library/BaseMemoryLib.h>
|
---|
30 | #include <Library/UefiBootServicesTableLib.h>
|
---|
31 | #include <Library/UefiLib.h>
|
---|
32 | #include <Library/MemoryAllocationLib.h>
|
---|
33 | #include <Library/UefiRuntimeServicesTableLib.h>
|
---|
34 | #include <Library/DevicePathLib.h>
|
---|
35 | #include <Library/HiiLib.h>
|
---|
36 | #include <Library/UefiHiiServicesLib.h>
|
---|
37 | #include <Library/UefiBootManagerLib.h>
|
---|
38 | #include <Library/FileExplorerLib.h>
|
---|
39 | #include "BootMaintenanceManagerCustomizedUi.h"
|
---|
40 |
|
---|
41 | #pragma pack(1)
|
---|
42 |
|
---|
43 | ///
|
---|
44 | /// HII specific Vendor Device Path definition.
|
---|
45 | ///
|
---|
46 | typedef struct {
|
---|
47 | VENDOR_DEVICE_PATH VendorDevicePath;
|
---|
48 | EFI_DEVICE_PATH_PROTOCOL End;
|
---|
49 | } HII_VENDOR_DEVICE_PATH;
|
---|
50 | #pragma pack()
|
---|
51 |
|
---|
52 | //
|
---|
53 | // Constants which are variable names used to access variables
|
---|
54 | //
|
---|
55 |
|
---|
56 | #define VAR_CON_OUT_MODE L"ConOutMode"
|
---|
57 |
|
---|
58 | //
|
---|
59 | // Variable created with this flag will be "Efi:...."
|
---|
60 | //
|
---|
61 | #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
|
---|
62 |
|
---|
63 | extern EFI_GUID mBootMaintGuid;
|
---|
64 | extern CHAR16 mBootMaintStorageName[];
|
---|
65 | //
|
---|
66 | // These are the VFR compiler generated data representing our VFR data.
|
---|
67 | //
|
---|
68 | extern UINT8 BootMaintenanceManagerBin[];
|
---|
69 |
|
---|
70 | //
|
---|
71 | // Below are the number of options in Baudrate, Databits,
|
---|
72 | // Parity and Stopbits selection for serial ports.
|
---|
73 | //
|
---|
74 | #define BM_COM_ATTR_BUADRATE 19
|
---|
75 | #define BM_COM_ATTR_DATABITS 4
|
---|
76 | #define BM_COM_ATTR_PARITY 5
|
---|
77 | #define BM_COM_ATTR_STOPBITS 3
|
---|
78 |
|
---|
79 | //
|
---|
80 | // Callback function helper
|
---|
81 | //
|
---|
82 | #define BMM_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('C', 'b', 'c', 'k')
|
---|
83 | #define BMM_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, BmmConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)
|
---|
84 |
|
---|
85 | //
|
---|
86 | // Enumeration type definition
|
---|
87 | //
|
---|
88 | typedef UINT8 BBS_TYPE;
|
---|
89 |
|
---|
90 | typedef enum _TYPE_OF_TERMINAL {
|
---|
91 | TerminalTypePcAnsi = 0,
|
---|
92 | TerminalTypeVt100,
|
---|
93 | TerminalTypeVt100Plus,
|
---|
94 | TerminalTypeVtUtf8,
|
---|
95 | TerminalTypeTtyTerm,
|
---|
96 | TerminalTypeLinux,
|
---|
97 | TerminalTypeXtermR6,
|
---|
98 | TerminalTypeVt400,
|
---|
99 | TerminalTypeSCO
|
---|
100 | } TYPE_OF_TERMINAL;
|
---|
101 |
|
---|
102 | //
|
---|
103 | // All of the signatures that will be used in list structure
|
---|
104 | //
|
---|
105 | #define BM_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
|
---|
106 | #define BM_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('l', 'o', 'a', 'd')
|
---|
107 | #define BM_CONSOLE_OPTION_SIGNATURE SIGNATURE_32 ('c', 'n', 's', 'l')
|
---|
108 | #define BM_FILE_OPTION_SIGNATURE SIGNATURE_32 ('f', 'i', 'l', 'e')
|
---|
109 | #define BM_HANDLE_OPTION_SIGNATURE SIGNATURE_32 ('h', 'n', 'd', 'l')
|
---|
110 | #define BM_TERMINAL_OPTION_SIGNATURE SIGNATURE_32 ('t', 'r', 'm', 'l')
|
---|
111 | #define BM_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
|
---|
112 |
|
---|
113 | #define BM_LOAD_CONTEXT_SELECT 0x0
|
---|
114 | #define BM_CONSOLE_CONTEXT_SELECT 0x1
|
---|
115 | #define BM_FILE_CONTEXT_SELECT 0x2
|
---|
116 | #define BM_HANDLE_CONTEXT_SELECT 0x3
|
---|
117 | #define BM_TERMINAL_CONTEXT_SELECT 0x5
|
---|
118 |
|
---|
119 | #define BM_CONSOLE_IN_CONTEXT_SELECT 0x6
|
---|
120 | #define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7
|
---|
121 | #define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8
|
---|
122 |
|
---|
123 | //
|
---|
124 | // Buffer size for update data
|
---|
125 | //
|
---|
126 | #define UPDATE_DATA_SIZE 0x100000
|
---|
127 |
|
---|
128 | //
|
---|
129 | // Namespace of callback keys used in display and file system navigation
|
---|
130 | //
|
---|
131 | #define MAX_BBS_OFFSET 0xE000
|
---|
132 | #define NET_OPTION_OFFSET 0xD800
|
---|
133 | #define BEV_OPTION_OFFSET 0xD000
|
---|
134 | #define FD_OPTION_OFFSET 0xC000
|
---|
135 | #define HD_OPTION_OFFSET 0xB000
|
---|
136 | #define CD_OPTION_OFFSET 0xA000
|
---|
137 | #define FILE_OPTION_OFFSET 0x8000
|
---|
138 | #define FILE_OPTION_MASK 0x7FFF
|
---|
139 | #define HANDLE_OPTION_OFFSET 0x7000
|
---|
140 | #define CONSOLE_OPTION_OFFSET 0x6000
|
---|
141 | #define TERMINAL_OPTION_OFFSET 0x5000
|
---|
142 | #define CONFIG_OPTION_OFFSET 0x1200
|
---|
143 | #define KEY_VALUE_OFFSET 0x1100
|
---|
144 | #define FORM_ID_OFFSET 0x1000
|
---|
145 |
|
---|
146 | //
|
---|
147 | // VarOffset that will be used to create question
|
---|
148 | // all these values are computed from the structure
|
---|
149 | // defined below
|
---|
150 | //
|
---|
151 | #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field)))
|
---|
152 |
|
---|
153 | //
|
---|
154 | // Question Id of Zero is invalid, so add an offset to it
|
---|
155 | //
|
---|
156 | #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
|
---|
157 |
|
---|
158 | #define BOOT_TIME_OUT_VAR_OFFSET VAR_OFFSET (BootTimeOut)
|
---|
159 | #define BOOT_NEXT_VAR_OFFSET VAR_OFFSET (BootNext)
|
---|
160 | #define COM1_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM1BaudRate)
|
---|
161 | #define COM1_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM1DataRate)
|
---|
162 | #define COM1_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM1StopBits)
|
---|
163 | #define COM1_PARITY_VAR_OFFSET VAR_OFFSET (COM1Parity)
|
---|
164 | #define COM1_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
|
---|
165 | #define COM2_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM2BaudRate)
|
---|
166 | #define COM2_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM2DataRate)
|
---|
167 | #define COM2_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM2StopBits)
|
---|
168 | #define COM2_PARITY_VAR_OFFSET VAR_OFFSET (COM2Parity)
|
---|
169 | #define COM2_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
|
---|
170 | #define DRV_ADD_HANDLE_DESC_VAR_OFFSET VAR_OFFSET (DriverAddHandleDesc)
|
---|
171 | #define DRV_ADD_ACTIVE_VAR_OFFSET VAR_OFFSET (DriverAddActive)
|
---|
172 | #define DRV_ADD_RECON_VAR_OFFSET VAR_OFFSET (DriverAddForceReconnect)
|
---|
173 | #define CON_IN_COM1_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM1)
|
---|
174 | #define CON_IN_COM2_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM2)
|
---|
175 | #define CON_OUT_COM1_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM1)
|
---|
176 | #define CON_OUT_COM2_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM2)
|
---|
177 | #define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)
|
---|
178 | #define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)
|
---|
179 | #define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)
|
---|
180 | #define CON_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleCheck)
|
---|
181 | #define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)
|
---|
182 | #define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)
|
---|
183 | #define CON_ERR_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleErrCheck)
|
---|
184 | #define BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)
|
---|
185 | #define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)
|
---|
186 | #define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)
|
---|
187 | #define DRIVER_OPTION_DEL_VAR_OFFSET VAR_OFFSET (DriverOptionDel)
|
---|
188 | #define DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)
|
---|
189 | #define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)
|
---|
190 | #define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate)
|
---|
191 | #define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
|
---|
192 | #define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
|
---|
193 | #define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
|
---|
194 | #define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)
|
---|
195 |
|
---|
196 | #define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
|
---|
197 | #define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
|
---|
198 | #define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)
|
---|
199 | #define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)
|
---|
200 | #define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)
|
---|
201 | #define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)
|
---|
202 | #define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
|
---|
203 | #define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)
|
---|
204 | #define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)
|
---|
205 | #define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)
|
---|
206 | #define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)
|
---|
207 | #define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
|
---|
208 | #define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)
|
---|
209 | #define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)
|
---|
210 | #define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)
|
---|
211 | #define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)
|
---|
212 | #define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)
|
---|
213 | #define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)
|
---|
214 | #define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)
|
---|
215 | #define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
|
---|
216 | #define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
|
---|
217 | #define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)
|
---|
218 | #define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)
|
---|
219 | #define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)
|
---|
220 | #define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)
|
---|
221 | #define CON_ERR_DEVICE_QUESTION_ID QUESTION_ID (ConsoleErrCheck)
|
---|
222 | #define BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)
|
---|
223 | #define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)
|
---|
224 | #define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
|
---|
225 | #define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
|
---|
226 | #define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
|
---|
227 | #define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
|
---|
228 | #define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
|
---|
229 | #define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
|
---|
230 | #define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
|
---|
231 | #define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
|
---|
232 | #define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)
|
---|
233 |
|
---|
234 | #define STRING_DEPOSITORY_NUMBER 8
|
---|
235 |
|
---|
236 | #define NONE_BOOTNEXT_VALUE (0xFFFF + 1)
|
---|
237 |
|
---|
238 | ///
|
---|
239 | /// Serial Ports attributes, first one is the value for
|
---|
240 | /// return from callback function, stringtoken is used to
|
---|
241 | /// display the value properly
|
---|
242 | ///
|
---|
243 | typedef struct {
|
---|
244 | UINTN Value;
|
---|
245 | UINT16 StringToken;
|
---|
246 | } COM_ATTR;
|
---|
247 |
|
---|
248 | typedef struct {
|
---|
249 | UINT64 BaudRate;
|
---|
250 | UINT8 DataBits;
|
---|
251 | UINT8 Parity;
|
---|
252 | UINT8 StopBits;
|
---|
253 |
|
---|
254 | UINT8 BaudRateIndex;
|
---|
255 | UINT8 DataBitsIndex;
|
---|
256 | UINT8 ParityIndex;
|
---|
257 | UINT8 StopBitsIndex;
|
---|
258 |
|
---|
259 | UINT8 FlowControl;
|
---|
260 |
|
---|
261 | UINT8 IsConIn;
|
---|
262 | UINT8 IsConOut;
|
---|
263 | UINT8 IsStdErr;
|
---|
264 | UINT8 TerminalType;
|
---|
265 |
|
---|
266 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
267 | } BM_TERMINAL_CONTEXT;
|
---|
268 |
|
---|
269 | typedef struct {
|
---|
270 | BOOLEAN IsBootNext;
|
---|
271 | BOOLEAN Deleted;
|
---|
272 |
|
---|
273 | BOOLEAN IsLegacy;
|
---|
274 |
|
---|
275 | UINT32 Attributes;
|
---|
276 | UINT16 FilePathListLength;
|
---|
277 | UINT16 *Description;
|
---|
278 | EFI_DEVICE_PATH_PROTOCOL *FilePathList;
|
---|
279 | UINT8 *OptionalData;
|
---|
280 | } BM_LOAD_CONTEXT;
|
---|
281 |
|
---|
282 | typedef struct {
|
---|
283 | BOOLEAN IsActive;
|
---|
284 |
|
---|
285 | BOOLEAN IsTerminal;
|
---|
286 |
|
---|
287 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
288 | } BM_CONSOLE_CONTEXT;
|
---|
289 |
|
---|
290 | typedef struct {
|
---|
291 | UINTN Column;
|
---|
292 | UINTN Row;
|
---|
293 | } CONSOLE_OUT_MODE;
|
---|
294 |
|
---|
295 | typedef struct {
|
---|
296 | EFI_HANDLE Handle;
|
---|
297 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
298 | EFI_FILE_HANDLE FHandle;
|
---|
299 | UINT16 *FileName;
|
---|
300 | EFI_FILE_SYSTEM_VOLUME_LABEL *Info;
|
---|
301 |
|
---|
302 | BOOLEAN IsRoot;
|
---|
303 | BOOLEAN IsDir;
|
---|
304 | BOOLEAN IsRemovableMedia;
|
---|
305 | BOOLEAN IsLoadFile;
|
---|
306 | BOOLEAN IsBootLegacy;
|
---|
307 | } BM_FILE_CONTEXT;
|
---|
308 |
|
---|
309 | typedef struct {
|
---|
310 | EFI_HANDLE Handle;
|
---|
311 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
312 | } BM_HANDLE_CONTEXT;
|
---|
313 |
|
---|
314 | typedef struct {
|
---|
315 | UINTN Signature;
|
---|
316 | LIST_ENTRY Head;
|
---|
317 | UINTN MenuNumber;
|
---|
318 | } BM_MENU_OPTION;
|
---|
319 |
|
---|
320 | typedef struct {
|
---|
321 | UINTN Signature;
|
---|
322 | LIST_ENTRY Link;
|
---|
323 | UINTN OptionNumber;
|
---|
324 | UINT16 *DisplayString;
|
---|
325 | UINT16 *HelpString;
|
---|
326 | EFI_STRING_ID DisplayStringToken;
|
---|
327 | EFI_STRING_ID HelpStringToken;
|
---|
328 | UINTN ContextSelection;
|
---|
329 | VOID *VariableContext;
|
---|
330 | } BM_MENU_ENTRY;
|
---|
331 |
|
---|
332 | typedef struct {
|
---|
333 | UINTN Signature;
|
---|
334 |
|
---|
335 | EFI_HII_HANDLE BmmHiiHandle;
|
---|
336 | EFI_HANDLE BmmDriverHandle;
|
---|
337 | ///
|
---|
338 | /// Boot Maintenance Manager Produced protocols
|
---|
339 | ///
|
---|
340 | EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess;
|
---|
341 | EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
---|
342 |
|
---|
343 | BM_MENU_ENTRY *MenuEntry;
|
---|
344 | BM_HANDLE_CONTEXT *HandleContext;
|
---|
345 | BM_FILE_CONTEXT *FileContext;
|
---|
346 | BM_LOAD_CONTEXT *LoadContext;
|
---|
347 | BM_TERMINAL_CONTEXT *TerminalContext;
|
---|
348 | UINTN CurrentTerminal;
|
---|
349 | BBS_TYPE BbsType;
|
---|
350 |
|
---|
351 | //
|
---|
352 | // BMM main formset callback data.
|
---|
353 | //
|
---|
354 |
|
---|
355 | EFI_FORM_ID BmmCurrentPageId;
|
---|
356 | EFI_FORM_ID BmmPreviousPageId;
|
---|
357 | BOOLEAN BmmAskSaveOrNot;
|
---|
358 | BMM_FAKE_NV_DATA BmmFakeNvData;
|
---|
359 | BMM_FAKE_NV_DATA BmmOldFakeNVData;
|
---|
360 | } BMM_CALLBACK_DATA;
|
---|
361 |
|
---|
362 | /**
|
---|
363 |
|
---|
364 | Find drivers that will be added as Driver#### variables from handles
|
---|
365 | in current system environment
|
---|
366 | All valid handles in the system except those consume SimpleFs, LoadFile
|
---|
367 | are stored in DriverMenu for future use.
|
---|
368 |
|
---|
369 | @retval EFI_SUCCESS The function complets successfully.
|
---|
370 | @return Other value if failed to build the DriverMenu.
|
---|
371 |
|
---|
372 | **/
|
---|
373 | EFI_STATUS
|
---|
374 | BOpt_FindDrivers (
|
---|
375 | VOID
|
---|
376 | );
|
---|
377 |
|
---|
378 | /**
|
---|
379 |
|
---|
380 | Build the BootOptionMenu according to BootOrder Variable.
|
---|
381 | This Routine will access the Boot#### to get EFI_LOAD_OPTION.
|
---|
382 |
|
---|
383 | @param CallbackData The BMM context data.
|
---|
384 |
|
---|
385 | @return The number of the Var Boot####.
|
---|
386 |
|
---|
387 | **/
|
---|
388 | EFI_STATUS
|
---|
389 | BOpt_GetBootOptions (
|
---|
390 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
391 | );
|
---|
392 |
|
---|
393 | /**
|
---|
394 |
|
---|
395 | Build up all DriverOptionMenu
|
---|
396 |
|
---|
397 | @param CallbackData The BMM context data.
|
---|
398 |
|
---|
399 | @return EFI_SUCESS The functin completes successfully.
|
---|
400 | @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.
|
---|
401 |
|
---|
402 |
|
---|
403 | **/
|
---|
404 | EFI_STATUS
|
---|
405 | BOpt_GetDriverOptions (
|
---|
406 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
407 | );
|
---|
408 |
|
---|
409 | /**
|
---|
410 | Free resources allocated in Allocate Rountine.
|
---|
411 |
|
---|
412 | @param FreeMenu Menu to be freed
|
---|
413 |
|
---|
414 | **/
|
---|
415 | VOID
|
---|
416 | BOpt_FreeMenu (
|
---|
417 | BM_MENU_OPTION *FreeMenu
|
---|
418 | );
|
---|
419 |
|
---|
420 | /**
|
---|
421 |
|
---|
422 | Get the Option Number that has not been allocated for use.
|
---|
423 |
|
---|
424 | @param Type The type of Option.
|
---|
425 |
|
---|
426 | @return The available Option Number.
|
---|
427 |
|
---|
428 | **/
|
---|
429 | UINT16
|
---|
430 | BOpt_GetOptionNumber (
|
---|
431 | CHAR16 *Type
|
---|
432 | );
|
---|
433 |
|
---|
434 | /**
|
---|
435 |
|
---|
436 | Get the Option Number for Boot#### that does not used.
|
---|
437 |
|
---|
438 | @return The available Option Number.
|
---|
439 |
|
---|
440 | **/
|
---|
441 | UINT16
|
---|
442 | BOpt_GetBootOptionNumber (
|
---|
443 | VOID
|
---|
444 | );
|
---|
445 |
|
---|
446 | /**
|
---|
447 |
|
---|
448 | Get the Option Number for Driver#### that does not used.
|
---|
449 |
|
---|
450 | @return The unused Option Number.
|
---|
451 |
|
---|
452 | **/
|
---|
453 | UINT16
|
---|
454 | BOpt_GetDriverOptionNumber (
|
---|
455 | VOID
|
---|
456 | );
|
---|
457 |
|
---|
458 | /**
|
---|
459 | Create a menu entry give a Menu type.
|
---|
460 |
|
---|
461 | @param MenuType The Menu type to be created.
|
---|
462 |
|
---|
463 |
|
---|
464 | @retval NULL If failed to create the menu.
|
---|
465 | @return The menu.
|
---|
466 |
|
---|
467 | **/
|
---|
468 | BM_MENU_ENTRY *
|
---|
469 | BOpt_CreateMenuEntry (
|
---|
470 | UINTN MenuType
|
---|
471 | );
|
---|
472 |
|
---|
473 | /**
|
---|
474 | Free up all resource allocated for a BM_MENU_ENTRY.
|
---|
475 |
|
---|
476 | @param MenuEntry A pointer to BM_MENU_ENTRY.
|
---|
477 |
|
---|
478 | **/
|
---|
479 | VOID
|
---|
480 | BOpt_DestroyMenuEntry (
|
---|
481 | BM_MENU_ENTRY *MenuEntry
|
---|
482 | );
|
---|
483 |
|
---|
484 | /**
|
---|
485 | Get the Menu Entry from the list in Menu Entry List.
|
---|
486 |
|
---|
487 | If MenuNumber is great or equal to the number of Menu
|
---|
488 | Entry in the list, then ASSERT.
|
---|
489 |
|
---|
490 | @param MenuOption The Menu Entry List to read the menu entry.
|
---|
491 | @param MenuNumber The index of Menu Entry.
|
---|
492 |
|
---|
493 | @return The Menu Entry.
|
---|
494 |
|
---|
495 | **/
|
---|
496 | BM_MENU_ENTRY *
|
---|
497 | BOpt_GetMenuEntry (
|
---|
498 | BM_MENU_OPTION *MenuOption,
|
---|
499 | UINTN MenuNumber
|
---|
500 | );
|
---|
501 |
|
---|
502 | /**
|
---|
503 | Get option number according to Boot#### and BootOrder variable.
|
---|
504 | The value is saved as #### + 1.
|
---|
505 |
|
---|
506 | @param CallbackData The BMM context data.
|
---|
507 | **/
|
---|
508 | VOID
|
---|
509 | GetBootOrder (
|
---|
510 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
511 | );
|
---|
512 |
|
---|
513 | /**
|
---|
514 | Get driver option order from globalc DriverOptionMenu.
|
---|
515 |
|
---|
516 | @param CallbackData The BMM context data.
|
---|
517 |
|
---|
518 | **/
|
---|
519 | VOID
|
---|
520 | GetDriverOrder (
|
---|
521 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
522 | );
|
---|
523 |
|
---|
524 | //
|
---|
525 | // Locate all serial io devices for console
|
---|
526 | //
|
---|
527 |
|
---|
528 | /**
|
---|
529 | Build a list containing all serial devices.
|
---|
530 |
|
---|
531 | @retval EFI_SUCCESS The function complete successfully.
|
---|
532 | @retval EFI_UNSUPPORTED No serial ports present.
|
---|
533 |
|
---|
534 | **/
|
---|
535 | EFI_STATUS
|
---|
536 | LocateSerialIo (
|
---|
537 | VOID
|
---|
538 | );
|
---|
539 |
|
---|
540 | //
|
---|
541 | // Initializing Console menu
|
---|
542 | //
|
---|
543 |
|
---|
544 | /**
|
---|
545 | Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
---|
546 |
|
---|
547 | @retval EFI_SUCCESS The function always complete successfully.
|
---|
548 |
|
---|
549 | **/
|
---|
550 | EFI_STATUS
|
---|
551 | GetAllConsoles (
|
---|
552 | VOID
|
---|
553 | );
|
---|
554 |
|
---|
555 | //
|
---|
556 | // Get current mode information
|
---|
557 | //
|
---|
558 |
|
---|
559 | /**
|
---|
560 | Get mode number according to column and row
|
---|
561 |
|
---|
562 | @param CallbackData The BMM context data.
|
---|
563 | **/
|
---|
564 | VOID
|
---|
565 | GetConsoleOutMode (
|
---|
566 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
567 | );
|
---|
568 |
|
---|
569 | //
|
---|
570 | // Cleaning up console menu
|
---|
571 | //
|
---|
572 |
|
---|
573 | /**
|
---|
574 | Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
---|
575 |
|
---|
576 | @retval EFI_SUCCESS The function always complete successfully.
|
---|
577 | **/
|
---|
578 | EFI_STATUS
|
---|
579 | FreeAllConsoles (
|
---|
580 | VOID
|
---|
581 | );
|
---|
582 |
|
---|
583 | /**
|
---|
584 | Update the device path that describing a terminal device
|
---|
585 | based on the new BaudRate, Data Bits, parity and Stop Bits
|
---|
586 | set.
|
---|
587 |
|
---|
588 | @param DevicePath The devicepath protocol instance wanted to be updated.
|
---|
589 |
|
---|
590 | **/
|
---|
591 | VOID
|
---|
592 | ChangeVariableDevicePath (
|
---|
593 | IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
594 | );
|
---|
595 |
|
---|
596 | /**
|
---|
597 | Update the multi-instance device path of Terminal Device based on
|
---|
598 | the global TerminalMenu. If ChangeTernimal is TRUE, the terminal
|
---|
599 | device path in the Terminal Device in TerminalMenu is also updated.
|
---|
600 |
|
---|
601 | @param DevicePath The multi-instance device path.
|
---|
602 | @param ChangeTerminal TRUE, then device path in the Terminal Device
|
---|
603 | in TerminalMenu is also updated; FALSE, no update.
|
---|
604 |
|
---|
605 | @return EFI_SUCCESS The function completes successfully.
|
---|
606 |
|
---|
607 | **/
|
---|
608 | EFI_STATUS
|
---|
609 | ChangeTerminalDevicePath (
|
---|
610 | IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
---|
611 | IN BOOLEAN ChangeTerminal
|
---|
612 | );
|
---|
613 |
|
---|
614 | //
|
---|
615 | // Variable operation by menu selection
|
---|
616 | //
|
---|
617 |
|
---|
618 | /**
|
---|
619 | This function create a currently loaded Boot Option from
|
---|
620 | the BMM. It then appends this Boot Option to the end of
|
---|
621 | the "BootOrder" list. It also append this Boot Opotion to the end
|
---|
622 | of BootOptionMenu.
|
---|
623 |
|
---|
624 | @param CallbackData The BMM context data.
|
---|
625 |
|
---|
626 | @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
|
---|
627 | @retval EFI_SUCCESS If function completes successfully.
|
---|
628 |
|
---|
629 | **/
|
---|
630 | EFI_STATUS
|
---|
631 | Var_UpdateBootOption (
|
---|
632 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
633 | );
|
---|
634 |
|
---|
635 | /**
|
---|
636 | Delete Boot Option that represent a Deleted state in BootOptionMenu.
|
---|
637 |
|
---|
638 | @retval EFI_SUCCESS If all boot load option EFI Variables corresponding to
|
---|
639 | BM_LOAD_CONTEXT marked for deletion is deleted
|
---|
640 | @return Others If failed to update the "BootOrder" variable after deletion.
|
---|
641 |
|
---|
642 | **/
|
---|
643 | EFI_STATUS
|
---|
644 | Var_DelBootOption (
|
---|
645 | VOID
|
---|
646 | );
|
---|
647 |
|
---|
648 | /**
|
---|
649 | This function create a currently loaded Drive Option from
|
---|
650 | the BMM. It then appends this Driver Option to the end of
|
---|
651 | the "DriverOrder" list. It append this Driver Opotion to the end
|
---|
652 | of DriverOptionMenu.
|
---|
653 |
|
---|
654 | @param CallbackData The BMM context data.
|
---|
655 | @param HiiHandle The HII handle associated with the BMM formset.
|
---|
656 | @param DescriptionData The description of this driver option.
|
---|
657 | @param OptionalData The optional load option.
|
---|
658 | @param ForceReconnect If to force reconnect.
|
---|
659 |
|
---|
660 | @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
|
---|
661 | @retval EFI_SUCCESS If function completes successfully.
|
---|
662 |
|
---|
663 | **/
|
---|
664 | EFI_STATUS
|
---|
665 | Var_UpdateDriverOption (
|
---|
666 | IN BMM_CALLBACK_DATA *CallbackData,
|
---|
667 | IN EFI_HII_HANDLE HiiHandle,
|
---|
668 | IN UINT16 *DescriptionData,
|
---|
669 | IN UINT16 *OptionalData,
|
---|
670 | IN UINT8 ForceReconnect
|
---|
671 | );
|
---|
672 |
|
---|
673 | /**
|
---|
674 | Delete Load Option that represent a Deleted state in DriverOptionMenu.
|
---|
675 |
|
---|
676 | @retval EFI_SUCCESS Load Option is successfully updated.
|
---|
677 | @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI
|
---|
678 | Variable.
|
---|
679 |
|
---|
680 | **/
|
---|
681 | EFI_STATUS
|
---|
682 | Var_DelDriverOption (
|
---|
683 | VOID
|
---|
684 | );
|
---|
685 |
|
---|
686 | /**
|
---|
687 | This function delete and build multi-instance device path ConIn
|
---|
688 | console device.
|
---|
689 |
|
---|
690 | @retval EFI_SUCCESS The function complete successfully.
|
---|
691 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
692 | **/
|
---|
693 | EFI_STATUS
|
---|
694 | Var_UpdateConsoleInpOption (
|
---|
695 | VOID
|
---|
696 | );
|
---|
697 |
|
---|
698 | /**
|
---|
699 | This function delete and build multi-instance device path ConOut console device.
|
---|
700 |
|
---|
701 | @retval EFI_SUCCESS The function complete successfully.
|
---|
702 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
703 | **/
|
---|
704 | EFI_STATUS
|
---|
705 | Var_UpdateConsoleOutOption (
|
---|
706 | VOID
|
---|
707 | );
|
---|
708 |
|
---|
709 | /**
|
---|
710 | This function delete and build multi-instance device path ErrOut console device.
|
---|
711 |
|
---|
712 | @retval EFI_SUCCESS The function complete successfully.
|
---|
713 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
714 | **/
|
---|
715 | EFI_STATUS
|
---|
716 | Var_UpdateErrorOutOption (
|
---|
717 | VOID
|
---|
718 | );
|
---|
719 |
|
---|
720 | /**
|
---|
721 | This function delete and build Out of Band console device.
|
---|
722 |
|
---|
723 | @param MenuIndex Menu index which user select in the terminal menu list.
|
---|
724 |
|
---|
725 | @retval EFI_SUCCESS The function complete successfully.
|
---|
726 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
727 | **/
|
---|
728 | EFI_STATUS
|
---|
729 | Var_UpdateOutOfBandOption (
|
---|
730 | IN UINT16 MenuIndex
|
---|
731 | );
|
---|
732 |
|
---|
733 | /**
|
---|
734 | This function update the "BootNext" EFI Variable. If there is no "BootNex" specified in BMM,
|
---|
735 | this EFI Variable is deleted.
|
---|
736 | It also update the BMM context data specified the "BootNext" value.
|
---|
737 |
|
---|
738 | @param CallbackData The BMM context data.
|
---|
739 |
|
---|
740 | @retval EFI_SUCCESS The function complete successfully.
|
---|
741 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
742 |
|
---|
743 | **/
|
---|
744 | EFI_STATUS
|
---|
745 | Var_UpdateBootNext (
|
---|
746 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
747 | );
|
---|
748 |
|
---|
749 | /**
|
---|
750 | This function update the "BootOrder" EFI Variable based on BMM Formset's NV map. It then refresh
|
---|
751 | BootOptionMenu with the new "BootOrder" list.
|
---|
752 |
|
---|
753 | @param CallbackData The BMM context data.
|
---|
754 |
|
---|
755 | @retval EFI_SUCCESS The function complete successfully.
|
---|
756 | @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
|
---|
757 | @return not The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
758 |
|
---|
759 | **/
|
---|
760 | EFI_STATUS
|
---|
761 | Var_UpdateBootOrder (
|
---|
762 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
763 | );
|
---|
764 |
|
---|
765 | /**
|
---|
766 | This function update the "DriverOrder" EFI Variable based on
|
---|
767 | BMM Formset's NV map. It then refresh DriverOptionMenu
|
---|
768 | with the new "DriverOrder" list.
|
---|
769 |
|
---|
770 | @param CallbackData The BMM context data.
|
---|
771 |
|
---|
772 | @retval EFI_SUCCESS The function complete successfully.
|
---|
773 | @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
|
---|
774 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
775 |
|
---|
776 | **/
|
---|
777 | EFI_STATUS
|
---|
778 | Var_UpdateDriverOrder (
|
---|
779 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
780 | );
|
---|
781 |
|
---|
782 | /**
|
---|
783 | Update the Text Mode of Console.
|
---|
784 |
|
---|
785 | @param CallbackData The context data for BMM.
|
---|
786 |
|
---|
787 | @retval EFI_SUCCSS If the Text Mode of Console is updated.
|
---|
788 | @return Other value if the Text Mode of Console is not updated.
|
---|
789 |
|
---|
790 | **/
|
---|
791 | EFI_STATUS
|
---|
792 | Var_UpdateConMode (
|
---|
793 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
794 | );
|
---|
795 |
|
---|
796 | //
|
---|
797 | // Following are page create and refresh functions
|
---|
798 | //
|
---|
799 |
|
---|
800 | /**
|
---|
801 | Create the global UpdateData structure.
|
---|
802 |
|
---|
803 | **/
|
---|
804 | VOID
|
---|
805 | CreateUpdateData (
|
---|
806 | VOID
|
---|
807 | );
|
---|
808 |
|
---|
809 | /**
|
---|
810 | Refresh the global UpdateData structure.
|
---|
811 |
|
---|
812 | **/
|
---|
813 | VOID
|
---|
814 | RefreshUpdateData (
|
---|
815 | VOID
|
---|
816 | );
|
---|
817 |
|
---|
818 | /**
|
---|
819 | Clean up the dynamic opcode at label and form specified by
|
---|
820 | both LabelId.
|
---|
821 |
|
---|
822 | @param LabelId It is both the Form ID and Label ID for
|
---|
823 | opcode deletion.
|
---|
824 | @param CallbackData The BMM context data.
|
---|
825 |
|
---|
826 | **/
|
---|
827 | VOID
|
---|
828 | CleanUpPage (
|
---|
829 | IN UINT16 LabelId,
|
---|
830 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
831 | );
|
---|
832 |
|
---|
833 | /**
|
---|
834 | Create a lit of boot option from global BootOptionMenu. It
|
---|
835 | allow user to delete the boot option.
|
---|
836 |
|
---|
837 | @param CallbackData The BMM context data.
|
---|
838 |
|
---|
839 | **/
|
---|
840 | VOID
|
---|
841 | UpdateBootDelPage (
|
---|
842 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
843 | );
|
---|
844 |
|
---|
845 | /**
|
---|
846 | Create a lit of driver option from global DriverMenu.
|
---|
847 |
|
---|
848 | @param CallbackData The BMM context data.
|
---|
849 | **/
|
---|
850 | VOID
|
---|
851 | UpdateDrvAddHandlePage (
|
---|
852 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
853 | );
|
---|
854 |
|
---|
855 | /**
|
---|
856 | Create a lit of driver option from global DriverOptionMenu. It
|
---|
857 | allow user to delete the driver option.
|
---|
858 |
|
---|
859 | @param CallbackData The BMM context data.
|
---|
860 | **/
|
---|
861 | VOID
|
---|
862 | UpdateDrvDelPage (
|
---|
863 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
864 | );
|
---|
865 |
|
---|
866 | /**
|
---|
867 | Prepare the page to allow user to add description for a Driver Option.
|
---|
868 |
|
---|
869 | @param CallbackData The BMM context data.
|
---|
870 | **/
|
---|
871 | VOID
|
---|
872 | UpdateDriverAddHandleDescPage (
|
---|
873 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
874 | );
|
---|
875 |
|
---|
876 | /**
|
---|
877 | Dispatch the correct update page function to call based on the UpdatePageId.
|
---|
878 |
|
---|
879 | @param UpdatePageId The form ID.
|
---|
880 | @param CallbackData The BMM context data.
|
---|
881 | **/
|
---|
882 | VOID
|
---|
883 | UpdatePageBody (
|
---|
884 | IN UINT16 UpdatePageId,
|
---|
885 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
886 | );
|
---|
887 |
|
---|
888 | /**
|
---|
889 | Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
|
---|
890 | Parity, Stop Bits, Terminal Type.
|
---|
891 |
|
---|
892 | @param CallbackData The BMM context data.
|
---|
893 | **/
|
---|
894 | VOID
|
---|
895 | UpdateTerminalPage (
|
---|
896 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
897 | );
|
---|
898 |
|
---|
899 | /**
|
---|
900 | Refresh the text mode page
|
---|
901 |
|
---|
902 | @param CallbackData The BMM context data.
|
---|
903 | **/
|
---|
904 | VOID
|
---|
905 | UpdateConModePage (
|
---|
906 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
907 | );
|
---|
908 |
|
---|
909 | /**
|
---|
910 | Create a list of Goto Opcode for all terminal devices logged
|
---|
911 | by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
|
---|
912 |
|
---|
913 | @param CallbackData The BMM context data.
|
---|
914 | **/
|
---|
915 | VOID
|
---|
916 | UpdateConCOMPage (
|
---|
917 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
918 | );
|
---|
919 |
|
---|
920 | /**
|
---|
921 | Update add boot/driver option page.
|
---|
922 |
|
---|
923 | @param CallbackData The BMM context data.
|
---|
924 | @param FormId The form ID to be updated.
|
---|
925 | @param DevicePath Device path.
|
---|
926 |
|
---|
927 | **/
|
---|
928 | VOID
|
---|
929 | UpdateOptionPage (
|
---|
930 | IN BMM_CALLBACK_DATA *CallbackData,
|
---|
931 | IN EFI_FORM_ID FormId,
|
---|
932 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
933 | );
|
---|
934 |
|
---|
935 | /**
|
---|
936 | Function deletes the variable specified by VarName and VarGuid.
|
---|
937 |
|
---|
938 |
|
---|
939 | @param VarName A Null-terminated Unicode string that is
|
---|
940 | the name of the vendor's variable.
|
---|
941 |
|
---|
942 | @param VarGuid A unique identifier for the vendor.
|
---|
943 |
|
---|
944 | @retval EFI_SUCCESS The variable was found and removed
|
---|
945 | @retval EFI_UNSUPPORTED The variable store was inaccessible
|
---|
946 | @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available
|
---|
947 | @retval EFI_NOT_FOUND The variable was not found
|
---|
948 |
|
---|
949 | **/
|
---|
950 | EFI_STATUS
|
---|
951 | EfiLibDeleteVariable (
|
---|
952 | IN CHAR16 *VarName,
|
---|
953 | IN EFI_GUID *VarGuid
|
---|
954 | );
|
---|
955 |
|
---|
956 | /**
|
---|
957 | Function is used to determine the number of device path instances
|
---|
958 | that exist in a device path.
|
---|
959 |
|
---|
960 |
|
---|
961 | @param DevicePath A pointer to a device path data structure.
|
---|
962 |
|
---|
963 | @return This function counts and returns the number of device path instances
|
---|
964 | in DevicePath.
|
---|
965 |
|
---|
966 | **/
|
---|
967 | UINTN
|
---|
968 | EfiDevicePathInstanceCount (
|
---|
969 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
970 | );
|
---|
971 |
|
---|
972 | /**
|
---|
973 | Get a string from the Data Hub record based on
|
---|
974 | a device path.
|
---|
975 |
|
---|
976 | @param DevPath The device Path.
|
---|
977 |
|
---|
978 | @return A string located from the Data Hub records based on
|
---|
979 | the device path.
|
---|
980 | @retval NULL If failed to get the String from Data Hub.
|
---|
981 |
|
---|
982 | **/
|
---|
983 | UINT16 *
|
---|
984 | EfiLibStrFromDatahub (
|
---|
985 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
---|
986 | );
|
---|
987 |
|
---|
988 | /**
|
---|
989 | Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type
|
---|
990 | specified by DeviceType.
|
---|
991 |
|
---|
992 | @param DeviceType The legacy device type. It can be floppy, network, harddisk, cdrom,
|
---|
993 | etc.
|
---|
994 | @param OptionIndex Returns the index number (#### in Boot####).
|
---|
995 | @param OptionSize Return the size of the Boot### variable.
|
---|
996 |
|
---|
997 | **/
|
---|
998 | VOID *
|
---|
999 | GetLegacyBootOptionVar (
|
---|
1000 | IN UINTN DeviceType,
|
---|
1001 | OUT UINTN *OptionIndex,
|
---|
1002 | OUT UINTN *OptionSize
|
---|
1003 | );
|
---|
1004 |
|
---|
1005 | /**
|
---|
1006 | Discard all changes done to the BMM pages such as Boot Order change,
|
---|
1007 | Driver order change.
|
---|
1008 |
|
---|
1009 | @param Private The BMM context data.
|
---|
1010 | @param CurrentFakeNVMap The current Fack NV Map.
|
---|
1011 |
|
---|
1012 | **/
|
---|
1013 | VOID
|
---|
1014 | DiscardChangeHandler (
|
---|
1015 | IN BMM_CALLBACK_DATA *Private,
|
---|
1016 | IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
|
---|
1017 | );
|
---|
1018 |
|
---|
1019 | /**
|
---|
1020 | This function is to clean some useless data before submit changes.
|
---|
1021 |
|
---|
1022 | @param Private The BMM context data.
|
---|
1023 |
|
---|
1024 | **/
|
---|
1025 | VOID
|
---|
1026 | CleanUselessBeforeSubmit (
|
---|
1027 | IN BMM_CALLBACK_DATA *Private
|
---|
1028 | );
|
---|
1029 |
|
---|
1030 | /**
|
---|
1031 | Dispatch the display to the next page based on NewPageId.
|
---|
1032 |
|
---|
1033 | @param Private The BMM context data.
|
---|
1034 | @param NewPageId The original page ID.
|
---|
1035 |
|
---|
1036 | **/
|
---|
1037 | VOID
|
---|
1038 | UpdatePageId (
|
---|
1039 | BMM_CALLBACK_DATA *Private,
|
---|
1040 | UINT16 NewPageId
|
---|
1041 | );
|
---|
1042 |
|
---|
1043 | /**
|
---|
1044 | Remove the installed BootMaint and FileExplorer HiiPackages.
|
---|
1045 |
|
---|
1046 | **/
|
---|
1047 | VOID
|
---|
1048 | FreeBMPackage (
|
---|
1049 | VOID
|
---|
1050 | );
|
---|
1051 |
|
---|
1052 | /**
|
---|
1053 | Install BootMaint and FileExplorer HiiPackages.
|
---|
1054 |
|
---|
1055 | **/
|
---|
1056 | VOID
|
---|
1057 | InitBootMaintenance (
|
---|
1058 | VOID
|
---|
1059 | );
|
---|
1060 |
|
---|
1061 | /**
|
---|
1062 |
|
---|
1063 | Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
|
---|
1064 | in BMM_FAKE_NV_DATA structure.
|
---|
1065 |
|
---|
1066 | @param CallbackData The BMM context data.
|
---|
1067 |
|
---|
1068 | **/
|
---|
1069 | VOID
|
---|
1070 | GetConsoleInCheck (
|
---|
1071 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1072 | );
|
---|
1073 |
|
---|
1074 | /**
|
---|
1075 |
|
---|
1076 | Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
|
---|
1077 | in BMM_FAKE_NV_DATA structure.
|
---|
1078 |
|
---|
1079 | @param CallbackData The BMM context data.
|
---|
1080 |
|
---|
1081 | **/
|
---|
1082 | VOID
|
---|
1083 | GetConsoleOutCheck (
|
---|
1084 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1085 | );
|
---|
1086 |
|
---|
1087 | /**
|
---|
1088 |
|
---|
1089 | Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
|
---|
1090 | in BMM_FAKE_NV_DATA structure.
|
---|
1091 |
|
---|
1092 | @param CallbackData The BMM context data.
|
---|
1093 |
|
---|
1094 | **/
|
---|
1095 | VOID
|
---|
1096 | GetConsoleErrCheck (
|
---|
1097 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1098 | );
|
---|
1099 |
|
---|
1100 | /**
|
---|
1101 |
|
---|
1102 | Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
|
---|
1103 | to BMM_FAKE_NV_DATA structure.
|
---|
1104 |
|
---|
1105 | @param CallbackData The BMM context data.
|
---|
1106 |
|
---|
1107 | **/
|
---|
1108 | VOID
|
---|
1109 | GetTerminalAttribute (
|
---|
1110 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1111 | );
|
---|
1112 |
|
---|
1113 | /**
|
---|
1114 | This function will change video resolution and text mode
|
---|
1115 | according to defined setup mode or defined boot mode
|
---|
1116 |
|
---|
1117 | @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
|
---|
1118 |
|
---|
1119 | @retval EFI_SUCCESS Mode is changed successfully.
|
---|
1120 | @retval Others Mode failed to be changed.
|
---|
1121 |
|
---|
1122 | **/
|
---|
1123 | EFI_STATUS
|
---|
1124 | BmmSetConsoleMode (
|
---|
1125 | BOOLEAN IsSetupMode
|
---|
1126 | );
|
---|
1127 |
|
---|
1128 | /**
|
---|
1129 | This function converts an input device structure to a Unicode string.
|
---|
1130 |
|
---|
1131 | @param DevPath A pointer to the device path structure.
|
---|
1132 |
|
---|
1133 | @return A new allocated Unicode string that represents the device path.
|
---|
1134 |
|
---|
1135 | **/
|
---|
1136 | CHAR16 *
|
---|
1137 | UiDevicePathToStr (
|
---|
1138 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
---|
1139 | );
|
---|
1140 |
|
---|
1141 | /**
|
---|
1142 | Extract filename from device path. The returned buffer is allocated using AllocateCopyPool.
|
---|
1143 | The caller is responsible for freeing the allocated buffer using FreePool().
|
---|
1144 |
|
---|
1145 | @param DevicePath Device path.
|
---|
1146 |
|
---|
1147 | @return A new allocated string that represents the file name.
|
---|
1148 |
|
---|
1149 | **/
|
---|
1150 | CHAR16 *
|
---|
1151 | ExtractFileNameFromDevicePath (
|
---|
1152 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
1153 | );
|
---|
1154 |
|
---|
1155 | /**
|
---|
1156 | This function allows a caller to extract the current configuration for one
|
---|
1157 | or more named elements from the target driver.
|
---|
1158 |
|
---|
1159 | @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
---|
1160 | @param Request A null-terminated Unicode string in <ConfigRequest> format.
|
---|
1161 | @param Progress On return, points to a character in the Request string.
|
---|
1162 | Points to the string's null terminator if request was successful.
|
---|
1163 | Points to the most recent '&' before the first failing name/value
|
---|
1164 | pair (or the beginning of the string if the failure is in the
|
---|
1165 | first name/value pair) if the request was not successful.
|
---|
1166 | @param Results A null-terminated Unicode string in <ConfigAltResp> format which
|
---|
1167 | has all values filled in for the names in the Request string.
|
---|
1168 | String to be allocated by the called function.
|
---|
1169 |
|
---|
1170 | @retval EFI_SUCCESS The Results is filled with the requested values.
|
---|
1171 | @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
|
---|
1172 | @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
|
---|
1173 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
---|
1174 |
|
---|
1175 | **/
|
---|
1176 | EFI_STATUS
|
---|
1177 | EFIAPI
|
---|
1178 | BootMaintExtractConfig (
|
---|
1179 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
1180 | IN CONST EFI_STRING Request,
|
---|
1181 | OUT EFI_STRING *Progress,
|
---|
1182 | OUT EFI_STRING *Results
|
---|
1183 | );
|
---|
1184 |
|
---|
1185 | /**
|
---|
1186 | This function applies changes in a driver's configuration.
|
---|
1187 | Input is a Configuration, which has the routing data for this
|
---|
1188 | driver followed by name / value configuration pairs. The driver
|
---|
1189 | must apply those pairs to its configurable storage. If the
|
---|
1190 | driver's configuration is stored in a linear block of data
|
---|
1191 | and the driver's name / value pairs are in <BlockConfig>
|
---|
1192 | format, it may use the ConfigToBlock helper function (above) to
|
---|
1193 | simplify the job. Currently not implemented.
|
---|
1194 |
|
---|
1195 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
---|
1196 | @param[in] Configuration A null-terminated Unicode string in
|
---|
1197 | <ConfigString> format.
|
---|
1198 | @param[out] Progress A pointer to a string filled in with the
|
---|
1199 | offset of the most recent '&' before the
|
---|
1200 | first failing name / value pair (or the
|
---|
1201 | beginn ing of the string if the failure
|
---|
1202 | is in the first name / value pair) or
|
---|
1203 | the terminating NULL if all was
|
---|
1204 | successful.
|
---|
1205 |
|
---|
1206 | @retval EFI_SUCCESS The results have been distributed or are
|
---|
1207 | awaiting distribution.
|
---|
1208 | @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
|
---|
1209 | parts of the results that must be
|
---|
1210 | stored awaiting possible future
|
---|
1211 | protocols.
|
---|
1212 | @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
|
---|
1213 | Results parameter would result
|
---|
1214 | in this type of error.
|
---|
1215 | @retval EFI_NOT_FOUND Target for the specified routing data
|
---|
1216 | was not found.
|
---|
1217 | **/
|
---|
1218 | EFI_STATUS
|
---|
1219 | EFIAPI
|
---|
1220 | BootMaintRouteConfig (
|
---|
1221 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
1222 | IN CONST EFI_STRING Configuration,
|
---|
1223 | OUT EFI_STRING *Progress
|
---|
1224 | );
|
---|
1225 |
|
---|
1226 | /**
|
---|
1227 | This function processes the results of changes in configuration.
|
---|
1228 |
|
---|
1229 |
|
---|
1230 | @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
---|
1231 | @param Action Specifies the type of action taken by the browser.
|
---|
1232 | @param QuestionId A unique value which is sent to the original exporting driver
|
---|
1233 | so that it can identify the type of data to expect.
|
---|
1234 | @param Type The type of value for the question.
|
---|
1235 | @param Value A pointer to the data being sent to the original exporting driver.
|
---|
1236 | @param ActionRequest On return, points to the action requested by the callback function.
|
---|
1237 |
|
---|
1238 | @retval EFI_SUCCESS The callback successfully handled the action.
|
---|
1239 | @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
---|
1240 | @retval EFI_DEVICE_ERROR The variable could not be saved.
|
---|
1241 | @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
|
---|
1242 | @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.
|
---|
1243 | **/
|
---|
1244 | EFI_STATUS
|
---|
1245 | EFIAPI
|
---|
1246 | BootMaintCallback (
|
---|
1247 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
1248 | IN EFI_BROWSER_ACTION Action,
|
---|
1249 | IN EFI_QUESTION_ID QuestionId,
|
---|
1250 | IN UINT8 Type,
|
---|
1251 | IN EFI_IFR_TYPE_VALUE *Value,
|
---|
1252 | OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
---|
1253 | );
|
---|
1254 |
|
---|
1255 | /**
|
---|
1256 | Create boot option base on the input file path info.
|
---|
1257 |
|
---|
1258 | @param FilePath Point to the file path.
|
---|
1259 |
|
---|
1260 | @retval TRUE Exit caller function.
|
---|
1261 | @retval FALSE Not exit caller function.
|
---|
1262 |
|
---|
1263 | **/
|
---|
1264 | BOOLEAN
|
---|
1265 | EFIAPI
|
---|
1266 | CreateBootOptionFromFile (
|
---|
1267 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath
|
---|
1268 | );
|
---|
1269 |
|
---|
1270 | /**
|
---|
1271 | Create driver option base on the input file path info.
|
---|
1272 |
|
---|
1273 | @param FilePath Point to the file path.
|
---|
1274 |
|
---|
1275 | @retval TRUE Exit caller function.
|
---|
1276 | @retval FALSE Not exit caller function.
|
---|
1277 | **/
|
---|
1278 | BOOLEAN
|
---|
1279 | EFIAPI
|
---|
1280 | CreateDriverOptionFromFile (
|
---|
1281 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath
|
---|
1282 | );
|
---|
1283 |
|
---|
1284 | /**
|
---|
1285 | Boot the file specified by the input file path info.
|
---|
1286 |
|
---|
1287 | @param FilePath Point to the file path.
|
---|
1288 |
|
---|
1289 | @retval TRUE Exit caller function.
|
---|
1290 | @retval FALSE Not exit caller function.
|
---|
1291 |
|
---|
1292 | **/
|
---|
1293 | BOOLEAN
|
---|
1294 | EFIAPI
|
---|
1295 | BootFromFile (
|
---|
1296 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath
|
---|
1297 | );
|
---|
1298 |
|
---|
1299 | //
|
---|
1300 | // Global variable in this program (defined in data.c)
|
---|
1301 | //
|
---|
1302 | extern BM_MENU_OPTION BootOptionMenu;
|
---|
1303 | extern BM_MENU_OPTION DriverOptionMenu;
|
---|
1304 | extern BM_MENU_OPTION ConsoleInpMenu;
|
---|
1305 | extern BM_MENU_OPTION ConsoleOutMenu;
|
---|
1306 | extern BM_MENU_OPTION ConsoleErrMenu;
|
---|
1307 | extern BM_MENU_OPTION DriverMenu;
|
---|
1308 | extern BM_MENU_OPTION TerminalMenu;
|
---|
1309 | extern UINT16 TerminalType[9];
|
---|
1310 | extern COM_ATTR BaudRateList[19];
|
---|
1311 | extern COM_ATTR DataBitsList[4];
|
---|
1312 | extern COM_ATTR ParityList[5];
|
---|
1313 | extern COM_ATTR StopBitsList[3];
|
---|
1314 | extern EFI_GUID TerminalTypeGuid[9];
|
---|
1315 | extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
|
---|
1316 | extern UINT16 mFlowControlType[2];
|
---|
1317 | extern UINT32 mFlowControlValue[2];
|
---|
1318 |
|
---|
1319 | //
|
---|
1320 | // Shared IFR form update data
|
---|
1321 | //
|
---|
1322 | extern VOID *mStartOpCodeHandle;
|
---|
1323 | extern VOID *mEndOpCodeHandle;
|
---|
1324 | extern EFI_IFR_GUID_LABEL *mStartLabel;
|
---|
1325 | extern EFI_IFR_GUID_LABEL *mEndLabel;
|
---|
1326 | extern BMM_CALLBACK_DATA gBootMaintenancePrivate;
|
---|
1327 | extern BMM_CALLBACK_DATA *mBmmCallbackInfo;
|
---|
1328 |
|
---|
1329 | #endif
|
---|