2 Legacy boot maintainence Ui definition.
4 Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _EFI_LEGACY_BOOT_OPTION_H_
11 #define _EFI_LEGACY_BOOT_OPTION_H_
16 #include <Guid/GlobalVariable.h>
17 #include <Guid/LegacyDevOrder.h>
18 #include <Guid/MdeModuleHii.h>
20 #include <Protocol/HiiConfigAccess.h>
21 #include <Protocol/HiiConfigRouting.h>
23 #include <Protocol/HiiDatabase.h>
24 #include <Protocol/LegacyBios.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/UefiRuntimeServicesTableLib.h>
29 #include <Library/BaseLib.h>
30 #include <Library/DevicePathLib.h>
31 #include <Library/DebugLib.h>
32 #include <Library/HiiLib.h>
33 #include <Library/UefiBootManagerLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/UefiLib.h>
36 #include <Library/PrintLib.h>
37 #include <Library/BaseMemoryLib.h>
39 #include "LegacyBootMaintUiVfr.h"
41 #define CONFIG_OPTION_OFFSET 0x1200
44 // VarOffset that will be used to create question
45 // all these values are computed from the structure
48 #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))
51 // Question Id of Zero is invalid, so add an offset to it
53 #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
56 #define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
57 #define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
58 #define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
59 #define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
60 #define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
66 #define STR_FLOPPY L"Floppy Drive #%02x"
67 #define STR_HARDDISK L"HardDisk Drive #%02x"
68 #define STR_CDROM L"ATAPI CDROM Drive #%02x"
69 #define STR_NET L"NET Drive #%02x"
70 #define STR_BEV L"BEV Drive #%02x"
72 #define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
73 #define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
74 #define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
75 #define STR_NET_HELP L"NET Drive #%02x"
76 #define STR_BEV_HELP L"BEV Drive #%02x"
78 #define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"
79 #define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"
80 #define STR_CDROM_TITLE L"Set Legacy CDROM Drive Order"
81 #define STR_NET_TITLE L"Set Legacy NET Drive Order"
82 #define STR_BEV_TITLE L"Set Legacy BEV Drive Order"
85 // These are the VFR compiler generated data representing our VFR data.
87 extern UINT8 LegacyBootMaintUiVfrBin
[];
92 /// HII specific Vendor Device Path definition.
95 VENDOR_DEVICE_PATH VendorDevicePath
;
96 EFI_DEVICE_PATH_PROTOCOL End
;
97 } HII_VENDOR_DEVICE_PATH
;
102 // Variable created with this flag will be "Efi:...."
104 #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
107 #define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')
113 // HII relative handles
115 EFI_HII_HANDLE HiiHandle
;
116 EFI_HANDLE DriverHandle
;
119 // Produced protocols
121 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
124 // Maintain the data.
126 LEGACY_BOOT_MAINTAIN_DATA
*MaintainMapData
;
127 } LEGACY_BOOT_OPTION_CALLBACK_DATA
;
130 // All of the signatures that will be used in list structure
132 #define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
133 #define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
135 #define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9
141 } LEGACY_MENU_OPTION
;
146 } LEGACY_DEVICE_CONTEXT
;
152 UINT16
*DisplayString
;
154 EFI_STRING_ID DisplayStringToken
;
155 EFI_STRING_ID HelpStringToken
;
156 VOID
*VariableContext
;
161 } LEGACY_BOOT_OPTION_BBS_DATA
;
166 This call back function is registered with Boot Manager formset.
167 When user selects a boot option, this call back function will
168 be triggered. The boot option is saved for later processing.
171 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
172 @param Action Specifies the type of action taken by the browser.
173 @param QuestionId A unique value which is sent to the original exporting driver
174 so that it can identify the type of data to expect.
175 @param Type The type of value for the question.
176 @param Value A pointer to the data being sent to the original exporting driver.
177 @param ActionRequest On return, points to the action requested by the callback function.
179 @retval EFI_SUCCESS The callback successfully handled the action.
180 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
185 LegacyBootOptionCallback (
186 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
187 IN EFI_BROWSER_ACTION Action
,
188 IN EFI_QUESTION_ID QuestionId
,
190 IN EFI_IFR_TYPE_VALUE
*Value
,
191 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
195 This function allows a caller to extract the current configuration for one
196 or more named elements from the target driver.
199 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
200 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
201 @param Progress - On return, points to a character in the Request string.
202 Points to the string's null terminator if request was successful.
203 Points to the most recent '&' before the first failing name/value
204 pair (or the beginning of the string if the failure is in the
205 first name/value pair) if the request was not successful.
206 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
207 has all values filled in for the names in the Request string.
208 String to be allocated by the called function.
210 @retval EFI_SUCCESS The Results is filled with the requested values.
211 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
212 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
213 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
218 LegacyBootOptionExtractConfig (
219 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
220 IN CONST EFI_STRING Request
,
221 OUT EFI_STRING
*Progress
,
222 OUT EFI_STRING
*Results
226 This function processes the results of changes in configuration.
229 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
230 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
231 @param Progress - A pointer to a string filled in with the offset of the most
232 recent '&' before the first failing name/value pair (or the
233 beginning of the string if the failure is in the first
234 name/value pair) or the terminating NULL if all was successful.
236 @retval EFI_SUCCESS The Results is processed successfully.
237 @retval EFI_INVALID_PARAMETER Configuration is NULL.
238 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
243 LegacyBootOptionRouteConfig (
244 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
245 IN CONST EFI_STRING Configuration
,
246 OUT EFI_STRING
*Progress