2 Header file for boot maintenance module.
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #define _BOOT_MAINT_H_
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>
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>
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"
44 /// HII specific Vendor Device Path definition.
47 VENDOR_DEVICE_PATH VendorDevicePath
;
48 EFI_DEVICE_PATH_PROTOCOL End
;
49 } HII_VENDOR_DEVICE_PATH
;
53 // Constants which are variable names used to access variables
56 #define VAR_CON_OUT_MODE L"ConOutMode"
59 // Variable created with this flag will be "Efi:...."
61 #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
63 extern EFI_GUID mBootMaintGuid
;
64 extern CHAR16 mBootMaintStorageName
[];
66 // These are the VFR compiler generated data representing our VFR data.
68 extern UINT8 BootMaintenanceManagerBin
[];
71 // Below are the number of options in Baudrate, Databits,
72 // Parity and Stopbits selection for serial ports.
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
80 // Callback function helper
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)
86 // Enumeration type definition
88 typedef UINT8 BBS_TYPE
;
90 typedef enum _TYPE_OF_TERMINAL
{
91 TerminalTypePcAnsi
= 0,
93 TerminalTypeVt100Plus
,
99 // All of the signatures that will be used in list structure
101 #define BM_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
102 #define BM_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('l', 'o', 'a', 'd')
103 #define BM_CONSOLE_OPTION_SIGNATURE SIGNATURE_32 ('c', 'n', 's', 'l')
104 #define BM_FILE_OPTION_SIGNATURE SIGNATURE_32 ('f', 'i', 'l', 'e')
105 #define BM_HANDLE_OPTION_SIGNATURE SIGNATURE_32 ('h', 'n', 'd', 'l')
106 #define BM_TERMINAL_OPTION_SIGNATURE SIGNATURE_32 ('t', 'r', 'm', 'l')
107 #define BM_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
109 #define BM_LOAD_CONTEXT_SELECT 0x0
110 #define BM_CONSOLE_CONTEXT_SELECT 0x1
111 #define BM_FILE_CONTEXT_SELECT 0x2
112 #define BM_HANDLE_CONTEXT_SELECT 0x3
113 #define BM_TERMINAL_CONTEXT_SELECT 0x5
115 #define BM_CONSOLE_IN_CONTEXT_SELECT 0x6
116 #define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7
117 #define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8
120 // Buffer size for update data
122 #define UPDATE_DATA_SIZE 0x100000
125 // Namespace of callback keys used in display and file system navigation
127 #define MAX_BBS_OFFSET 0xE000
128 #define NET_OPTION_OFFSET 0xD800
129 #define BEV_OPTION_OFFSET 0xD000
130 #define FD_OPTION_OFFSET 0xC000
131 #define HD_OPTION_OFFSET 0xB000
132 #define CD_OPTION_OFFSET 0xA000
133 #define FILE_OPTION_OFFSET 0x8000
134 #define FILE_OPTION_MASK 0x7FFF
135 #define HANDLE_OPTION_OFFSET 0x7000
136 #define CONSOLE_OPTION_OFFSET 0x6000
137 #define TERMINAL_OPTION_OFFSET 0x5000
138 #define CONFIG_OPTION_OFFSET 0x1200
139 #define KEY_VALUE_OFFSET 0x1100
140 #define FORM_ID_OFFSET 0x1000
143 // VarOffset that will be used to create question
144 // all these values are computed from the structure
147 #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field)))
150 // Question Id of Zero is invalid, so add an offset to it
152 #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
154 #define BOOT_TIME_OUT_VAR_OFFSET VAR_OFFSET (BootTimeOut)
155 #define BOOT_NEXT_VAR_OFFSET VAR_OFFSET (BootNext)
156 #define COM1_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM1BaudRate)
157 #define COM1_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM1DataRate)
158 #define COM1_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM1StopBits)
159 #define COM1_PARITY_VAR_OFFSET VAR_OFFSET (COM1Parity)
160 #define COM1_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
161 #define COM2_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM2BaudRate)
162 #define COM2_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM2DataRate)
163 #define COM2_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM2StopBits)
164 #define COM2_PARITY_VAR_OFFSET VAR_OFFSET (COM2Parity)
165 #define COM2_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
166 #define DRV_ADD_HANDLE_DESC_VAR_OFFSET VAR_OFFSET (DriverAddHandleDesc)
167 #define DRV_ADD_ACTIVE_VAR_OFFSET VAR_OFFSET (DriverAddActive)
168 #define DRV_ADD_RECON_VAR_OFFSET VAR_OFFSET (DriverAddForceReconnect)
169 #define CON_IN_COM1_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM1)
170 #define CON_IN_COM2_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM2)
171 #define CON_OUT_COM1_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM1)
172 #define CON_OUT_COM2_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM2)
173 #define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)
174 #define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)
175 #define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)
176 #define CON_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleCheck)
177 #define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)
178 #define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)
179 #define CON_ERR_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleErrCheck)
180 #define BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)
181 #define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)
182 #define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)
183 #define DRIVER_OPTION_DEL_VAR_OFFSET VAR_OFFSET (DriverOptionDel)
184 #define DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)
185 #define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)
186 #define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate)
187 #define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
188 #define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
189 #define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
190 #define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)
192 #define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
193 #define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
194 #define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)
195 #define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)
196 #define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)
197 #define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)
198 #define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
199 #define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)
200 #define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)
201 #define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)
202 #define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)
203 #define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
204 #define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)
205 #define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)
206 #define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)
207 #define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)
208 #define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)
209 #define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)
210 #define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)
211 #define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
212 #define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
213 #define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)
214 #define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)
215 #define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)
216 #define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)
217 #define CON_ERR_DEVICE_QUESTION_ID QUESTION_ID (ConsoleErrCheck)
218 #define BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)
219 #define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)
220 #define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
221 #define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
222 #define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
223 #define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
224 #define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
225 #define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
226 #define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
227 #define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
228 #define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)
230 #define STRING_DEPOSITORY_NUMBER 8
232 #define NONE_BOOTNEXT_VALUE (0xFFFF + 1)
235 /// Serial Ports attributes, first one is the value for
236 /// return from callback function, stringtoken is used to
237 /// display the value properly
262 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
263 } BM_TERMINAL_CONTEXT
;
272 UINT16 FilePathListLength
;
274 EFI_DEVICE_PATH_PROTOCOL
*FilePathList
;
284 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
285 } BM_CONSOLE_CONTEXT
;
294 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
295 EFI_FILE_HANDLE FHandle
;
297 EFI_FILE_SYSTEM_VOLUME_LABEL
*Info
;
301 BOOLEAN IsRemovableMedia
;
303 BOOLEAN IsBootLegacy
;
308 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
321 UINT16
*DisplayString
;
323 EFI_STRING_ID DisplayStringToken
;
324 EFI_STRING_ID HelpStringToken
;
325 UINTN ContextSelection
;
326 VOID
*VariableContext
;
333 EFI_HII_HANDLE BmmHiiHandle
;
334 EFI_HANDLE BmmDriverHandle
;
336 /// Boot Maintenance Manager Produced protocols
338 EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess
;
339 EFI_FORM_BROWSER2_PROTOCOL
*FormBrowser2
;
341 BM_MENU_ENTRY
*MenuEntry
;
342 BM_HANDLE_CONTEXT
*HandleContext
;
343 BM_FILE_CONTEXT
*FileContext
;
344 BM_LOAD_CONTEXT
*LoadContext
;
345 BM_TERMINAL_CONTEXT
*TerminalContext
;
346 UINTN CurrentTerminal
;
350 // BMM main formset callback data.
353 EFI_FORM_ID BmmCurrentPageId
;
354 EFI_FORM_ID BmmPreviousPageId
;
355 BOOLEAN BmmAskSaveOrNot
;
356 BMM_FAKE_NV_DATA BmmFakeNvData
;
357 BMM_FAKE_NV_DATA BmmOldFakeNVData
;
363 Find drivers that will be added as Driver#### variables from handles
364 in current system environment
365 All valid handles in the system except those consume SimpleFs, LoadFile
366 are stored in DriverMenu for future use.
368 @retval EFI_SUCCESS The function complets successfully.
369 @return Other value if failed to build the DriverMenu.
379 Build the BootOptionMenu according to BootOrder Variable.
380 This Routine will access the Boot#### to get EFI_LOAD_OPTION.
382 @param CallbackData The BMM context data.
384 @return The number of the Var Boot####.
388 BOpt_GetBootOptions (
389 IN BMM_CALLBACK_DATA
*CallbackData
394 Build up all DriverOptionMenu
396 @param CallbackData The BMM context data.
398 @return EFI_SUCESS The functin completes successfully.
399 @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.
404 BOpt_GetDriverOptions (
405 IN BMM_CALLBACK_DATA
*CallbackData
409 Free resources allocated in Allocate Rountine.
411 @param FreeMenu Menu to be freed
416 BM_MENU_OPTION
*FreeMenu
421 Get the Option Number that has not been allocated for use.
423 @param Type The type of Option.
425 @return The available Option Number.
429 BOpt_GetOptionNumber (
435 Get the Option Number for Boot#### that does not used.
437 @return The available Option Number.
441 BOpt_GetBootOptionNumber (
447 Get the Option Number for Driver#### that does not used.
449 @return The unused Option Number.
453 BOpt_GetDriverOptionNumber (
458 Create a menu entry give a Menu type.
460 @param MenuType The Menu type to be created.
463 @retval NULL If failed to create the menu.
468 BOpt_CreateMenuEntry (
473 Free up all resource allocated for a BM_MENU_ENTRY.
475 @param MenuEntry A pointer to BM_MENU_ENTRY.
479 BOpt_DestroyMenuEntry (
480 BM_MENU_ENTRY
*MenuEntry
484 Get the Menu Entry from the list in Menu Entry List.
486 If MenuNumber is great or equal to the number of Menu
487 Entry in the list, then ASSERT.
489 @param MenuOption The Menu Entry List to read the menu entry.
490 @param MenuNumber The index of Menu Entry.
492 @return The Menu Entry.
497 BM_MENU_OPTION
*MenuOption
,
502 Get option number according to Boot#### and BootOrder variable.
503 The value is saved as #### + 1.
505 @param CallbackData The BMM context data.
509 IN BMM_CALLBACK_DATA
*CallbackData
513 Get driver option order from globalc DriverOptionMenu.
515 @param CallbackData The BMM context data.
520 IN BMM_CALLBACK_DATA
*CallbackData
524 // Locate all serial io devices for console
527 Build a list containing all serial devices.
529 @retval EFI_SUCCESS The function complete successfully.
530 @retval EFI_UNSUPPORTED No serial ports present.
539 // Initializing Console menu
542 Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
544 @retval EFI_SUCCESS The function always complete successfully.
553 // Get current mode information
556 Get mode number according to column and row
558 @param CallbackData The BMM context data.
562 IN BMM_CALLBACK_DATA
*CallbackData
566 // Cleaning up console menu
569 Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
571 @retval EFI_SUCCESS The function always complete successfully.
579 Update the device path that describing a terminal device
580 based on the new BaudRate, Data Bits, parity and Stop Bits
583 @param DevicePath The devicepath protocol instance wanted to be updated.
587 ChangeVariableDevicePath (
588 IN OUT EFI_DEVICE_PATH_PROTOCOL
*DevicePath
592 Update the multi-instance device path of Terminal Device based on
593 the global TerminalMenu. If ChangeTernimal is TRUE, the terminal
594 device path in the Terminal Device in TerminalMenu is also updated.
596 @param DevicePath The multi-instance device path.
597 @param ChangeTerminal TRUE, then device path in the Terminal Device
598 in TerminalMenu is also updated; FALSE, no update.
600 @return EFI_SUCCESS The function completes successfully.
604 ChangeTerminalDevicePath (
605 IN OUT EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
606 IN BOOLEAN ChangeTerminal
610 // Variable operation by menu selection
613 This function create a currently loaded Boot Option from
614 the BMM. It then appends this Boot Option to the end of
615 the "BootOrder" list. It also append this Boot Opotion to the end
618 @param CallbackData The BMM context data.
620 @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
621 @retval EFI_SUCCESS If function completes successfully.
625 Var_UpdateBootOption (
626 IN BMM_CALLBACK_DATA
*CallbackData
630 Delete Boot Option that represent a Deleted state in BootOptionMenu.
632 @retval EFI_SUCCESS If all boot load option EFI Variables corresponding to
633 BM_LOAD_CONTEXT marked for deletion is deleted
634 @return Others If failed to update the "BootOrder" variable after deletion.
643 This function create a currently loaded Drive Option from
644 the BMM. It then appends this Driver Option to the end of
645 the "DriverOrder" list. It append this Driver Opotion to the end
648 @param CallbackData The BMM context data.
649 @param HiiHandle The HII handle associated with the BMM formset.
650 @param DescriptionData The description of this driver option.
651 @param OptionalData The optional load option.
652 @param ForceReconnect If to force reconnect.
654 @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
655 @retval EFI_SUCCESS If function completes successfully.
659 Var_UpdateDriverOption (
660 IN BMM_CALLBACK_DATA
*CallbackData
,
661 IN EFI_HII_HANDLE HiiHandle
,
662 IN UINT16
*DescriptionData
,
663 IN UINT16
*OptionalData
,
664 IN UINT8 ForceReconnect
668 Delete Load Option that represent a Deleted state in DriverOptionMenu.
670 @retval EFI_SUCCESS Load Option is successfully updated.
671 @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI
676 Var_DelDriverOption (
681 This function delete and build multi-instance device path ConIn
684 @retval EFI_SUCCESS The function complete successfully.
685 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
688 Var_UpdateConsoleInpOption (
693 This function delete and build multi-instance device path ConOut console device.
695 @retval EFI_SUCCESS The function complete successfully.
696 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
699 Var_UpdateConsoleOutOption (
704 This function delete and build multi-instance device path ErrOut console device.
706 @retval EFI_SUCCESS The function complete successfully.
707 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
710 Var_UpdateErrorOutOption (
715 This function delete and build Out of Band console device.
717 @param MenuIndex Menu index which user select in the terminal menu list.
719 @retval EFI_SUCCESS The function complete successfully.
720 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
723 Var_UpdateOutOfBandOption (
728 This function update the "BootNext" EFI Variable. If there is no "BootNex" specified in BMM,
729 this EFI Variable is deleted.
730 It also update the BMM context data specified the "BootNext" value.
732 @param CallbackData The BMM context data.
734 @retval EFI_SUCCESS The function complete successfully.
735 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
740 IN BMM_CALLBACK_DATA
*CallbackData
744 This function update the "BootOrder" EFI Variable based on BMM Formset's NV map. It then refresh
745 BootOptionMenu with the new "BootOrder" list.
747 @param CallbackData The BMM context data.
749 @retval EFI_SUCCESS The function complete successfully.
750 @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
751 @return not The EFI variable can not be saved. See gRT->SetVariable for detail return information.
755 Var_UpdateBootOrder (
756 IN BMM_CALLBACK_DATA
*CallbackData
760 This function update the "DriverOrder" EFI Variable based on
761 BMM Formset's NV map. It then refresh DriverOptionMenu
762 with the new "DriverOrder" list.
764 @param CallbackData The BMM context data.
766 @retval EFI_SUCCESS The function complete successfully.
767 @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
768 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
772 Var_UpdateDriverOrder (
773 IN BMM_CALLBACK_DATA
*CallbackData
777 Update the Text Mode of Console.
779 @param CallbackData The context data for BMM.
781 @retval EFI_SUCCSS If the Text Mode of Console is updated.
782 @return Other value if the Text Mode of Console is not updated.
787 IN BMM_CALLBACK_DATA
*CallbackData
791 // Following are page create and refresh functions
794 Create the global UpdateData structure.
803 Refresh the global UpdateData structure.
812 Clean up the dynamic opcode at label and form specified by
815 @param LabelId It is both the Form ID and Label ID for
817 @param CallbackData The BMM context data.
823 IN BMM_CALLBACK_DATA
*CallbackData
827 Create a lit of boot option from global BootOptionMenu. It
828 allow user to delete the boot option.
830 @param CallbackData The BMM context data.
835 IN BMM_CALLBACK_DATA
*CallbackData
839 Create a lit of driver option from global DriverMenu.
841 @param CallbackData The BMM context data.
844 UpdateDrvAddHandlePage (
845 IN BMM_CALLBACK_DATA
*CallbackData
849 Create a lit of driver option from global DriverOptionMenu. It
850 allow user to delete the driver option.
852 @param CallbackData The BMM context data.
856 IN BMM_CALLBACK_DATA
*CallbackData
860 Prepare the page to allow user to add description for a Driver Option.
862 @param CallbackData The BMM context data.
865 UpdateDriverAddHandleDescPage (
866 IN BMM_CALLBACK_DATA
*CallbackData
870 Dispatch the correct update page function to call based on the UpdatePageId.
872 @param UpdatePageId The form ID.
873 @param CallbackData The BMM context data.
877 IN UINT16 UpdatePageId
,
878 IN BMM_CALLBACK_DATA
*CallbackData
882 Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
883 Parity, Stop Bits, Terminal Type.
885 @param CallbackData The BMM context data.
889 IN BMM_CALLBACK_DATA
*CallbackData
893 Refresh the text mode page
895 @param CallbackData The BMM context data.
899 IN BMM_CALLBACK_DATA
*CallbackData
903 Create a list of Goto Opcode for all terminal devices logged
904 by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
906 @param CallbackData The BMM context data.
910 IN BMM_CALLBACK_DATA
*CallbackData
914 Update add boot/driver option page.
916 @param CallbackData The BMM context data.
917 @param FormId The form ID to be updated.
918 @param DevicePath Device path.
923 IN BMM_CALLBACK_DATA
*CallbackData
,
924 IN EFI_FORM_ID FormId
,
925 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
929 Function deletes the variable specified by VarName and VarGuid.
932 @param VarName A Null-terminated Unicode string that is
933 the name of the vendor's variable.
935 @param VarGuid A unique identifier for the vendor.
937 @retval EFI_SUCCESS The variable was found and removed
938 @retval EFI_UNSUPPORTED The variable store was inaccessible
939 @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available
940 @retval EFI_NOT_FOUND The variable was not found
944 EfiLibDeleteVariable (
950 Function is used to determine the number of device path instances
951 that exist in a device path.
954 @param DevicePath A pointer to a device path data structure.
956 @return This function counts and returns the number of device path instances
961 EfiDevicePathInstanceCount (
962 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
966 Get a string from the Data Hub record based on
969 @param DevPath The device Path.
971 @return A string located from the Data Hub records based on
973 @retval NULL If failed to get the String from Data Hub.
977 EfiLibStrFromDatahub (
978 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
982 Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type
983 specified by DeviceType.
985 @param DeviceType The legacy device type. It can be floppy, network, harddisk, cdrom,
987 @param OptionIndex Returns the index number (#### in Boot####).
988 @param OptionSize Return the size of the Boot### variable.
992 GetLegacyBootOptionVar (
994 OUT UINTN
*OptionIndex
,
995 OUT UINTN
*OptionSize
999 Discard all changes done to the BMM pages such as Boot Order change,
1000 Driver order change.
1002 @param Private The BMM context data.
1003 @param CurrentFakeNVMap The current Fack NV Map.
1007 DiscardChangeHandler (
1008 IN BMM_CALLBACK_DATA
*Private
,
1009 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
1014 This function is to clean some useless data before submit changes.
1016 @param Private The BMM context data.
1020 CleanUselessBeforeSubmit (
1021 IN BMM_CALLBACK_DATA
*Private
1025 Dispatch the display to the next page based on NewPageId.
1027 @param Private The BMM context data.
1028 @param NewPageId The original page ID.
1033 BMM_CALLBACK_DATA
*Private
,
1038 Remove the installed BootMaint and FileExplorer HiiPackages.
1047 Install BootMaint and FileExplorer HiiPackages.
1051 InitBootMaintenance(
1057 Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
1058 in BMM_FAKE_NV_DATA structure.
1060 @param CallbackData The BMM context data.
1065 IN BMM_CALLBACK_DATA
*CallbackData
1070 Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
1071 in BMM_FAKE_NV_DATA structure.
1073 @param CallbackData The BMM context data.
1077 GetConsoleOutCheck (
1078 IN BMM_CALLBACK_DATA
*CallbackData
1083 Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
1084 in BMM_FAKE_NV_DATA structure.
1086 @param CallbackData The BMM context data.
1090 GetConsoleErrCheck (
1091 IN BMM_CALLBACK_DATA
*CallbackData
1096 Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
1097 to BMM_FAKE_NV_DATA structure.
1099 @param CallbackData The BMM context data.
1103 GetTerminalAttribute (
1104 IN BMM_CALLBACK_DATA
*CallbackData
1108 This function will change video resolution and text mode
1109 according to defined setup mode or defined boot mode
1111 @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
1113 @retval EFI_SUCCESS Mode is changed successfully.
1114 @retval Others Mode failed to be changed.
1124 This function converts an input device structure to a Unicode string.
1126 @param DevPath A pointer to the device path structure.
1128 @return A new allocated Unicode string that represents the device path.
1133 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
1137 Extract filename from device path. The returned buffer is allocated using AllocateCopyPool.
1138 The caller is responsible for freeing the allocated buffer using FreePool().
1140 @param DevicePath Device path.
1142 @return A new allocated string that represents the file name.
1146 ExtractFileNameFromDevicePath (
1147 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
1151 This function allows a caller to extract the current configuration for one
1152 or more named elements from the target driver.
1154 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
1155 @param Request A null-terminated Unicode string in <ConfigRequest> format.
1156 @param Progress On return, points to a character in the Request string.
1157 Points to the string's null terminator if request was successful.
1158 Points to the most recent '&' before the first failing name/value
1159 pair (or the beginning of the string if the failure is in the
1160 first name/value pair) if the request was not successful.
1161 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
1162 has all values filled in for the names in the Request string.
1163 String to be allocated by the called function.
1165 @retval EFI_SUCCESS The Results is filled with the requested values.
1166 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
1167 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
1168 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
1173 BootMaintExtractConfig (
1174 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
1175 IN CONST EFI_STRING Request
,
1176 OUT EFI_STRING
*Progress
,
1177 OUT EFI_STRING
*Results
1181 This function applies changes in a driver's configuration.
1182 Input is a Configuration, which has the routing data for this
1183 driver followed by name / value configuration pairs. The driver
1184 must apply those pairs to its configurable storage. If the
1185 driver's configuration is stored in a linear block of data
1186 and the driver's name / value pairs are in <BlockConfig>
1187 format, it may use the ConfigToBlock helper function (above) to
1188 simplify the job. Currently not implemented.
1190 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
1191 @param[in] Configuration A null-terminated Unicode string in
1192 <ConfigString> format.
1193 @param[out] Progress A pointer to a string filled in with the
1194 offset of the most recent '&' before the
1195 first failing name / value pair (or the
1196 beginn ing of the string if the failure
1197 is in the first name / value pair) or
1198 the terminating NULL if all was
1201 @retval EFI_SUCCESS The results have been distributed or are
1202 awaiting distribution.
1203 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
1204 parts of the results that must be
1205 stored awaiting possible future
1207 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
1208 Results parameter would result
1209 in this type of error.
1210 @retval EFI_NOT_FOUND Target for the specified routing data
1215 BootMaintRouteConfig (
1216 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
1217 IN CONST EFI_STRING Configuration
,
1218 OUT EFI_STRING
*Progress
1222 This function processes the results of changes in configuration.
1225 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
1226 @param Action Specifies the type of action taken by the browser.
1227 @param QuestionId A unique value which is sent to the original exporting driver
1228 so that it can identify the type of data to expect.
1229 @param Type The type of value for the question.
1230 @param Value A pointer to the data being sent to the original exporting driver.
1231 @param ActionRequest On return, points to the action requested by the callback function.
1233 @retval EFI_SUCCESS The callback successfully handled the action.
1234 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
1235 @retval EFI_DEVICE_ERROR The variable could not be saved.
1236 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
1237 @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.
1242 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
1243 IN EFI_BROWSER_ACTION Action
,
1244 IN EFI_QUESTION_ID QuestionId
,
1246 IN EFI_IFR_TYPE_VALUE
*Value
,
1247 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
1251 Create boot option base on the input file path info.
1253 @param FilePath Point to the file path.
1255 @retval TRUE Exit caller function.
1256 @retval FALSE Not exit caller function.
1261 CreateBootOptionFromFile (
1262 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
1266 Create driver option base on the input file path info.
1268 @param FilePath Point to the file path.
1270 @retval TRUE Exit caller function.
1271 @retval FALSE Not exit caller function.
1275 CreateDriverOptionFromFile (
1276 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
1280 Boot the file specified by the input file path info.
1282 @param FilePath Point to the file path.
1284 @retval TRUE Exit caller function.
1285 @retval FALSE Not exit caller function.
1291 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
1295 // Global variable in this program (defined in data.c)
1297 extern BM_MENU_OPTION BootOptionMenu
;
1298 extern BM_MENU_OPTION DriverOptionMenu
;
1299 extern BM_MENU_OPTION ConsoleInpMenu
;
1300 extern BM_MENU_OPTION ConsoleOutMenu
;
1301 extern BM_MENU_OPTION ConsoleErrMenu
;
1302 extern BM_MENU_OPTION DriverMenu
;
1303 extern BM_MENU_OPTION TerminalMenu
;
1304 extern UINT16 TerminalType
[5];
1305 extern COM_ATTR BaudRateList
[19];
1306 extern COM_ATTR DataBitsList
[4];
1307 extern COM_ATTR ParityList
[5];
1308 extern COM_ATTR StopBitsList
[3];
1309 extern EFI_GUID TerminalTypeGuid
[5];
1310 extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath
[];
1311 extern UINT16 mFlowControlType
[2];
1312 extern UINT32 mFlowControlValue
[2];
1315 // Shared IFR form update data
1317 extern VOID
*mStartOpCodeHandle
;
1318 extern VOID
*mEndOpCodeHandle
;
1319 extern EFI_IFR_GUID_LABEL
*mStartLabel
;
1320 extern EFI_IFR_GUID_LABEL
*mEndLabel
;
1321 extern BMM_CALLBACK_DATA gBootMaintenancePrivate
;
1322 extern BMM_CALLBACK_DATA
*mBmmCallbackInfo
;