2 Legacy boot maintainence Ui definition.
4 Copyright (c) 2004 - 2015, 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.
16 #ifndef _EFI_LEGACY_BOOT_OPTION_H_
17 #define _EFI_LEGACY_BOOT_OPTION_H_
22 #include <Guid/GlobalVariable.h>
23 #include <Guid/LegacyDevOrder.h>
24 #include <Guid/MdeModuleHii.h>
26 #include <Protocol/HiiConfigAccess.h>
27 #include <Protocol/HiiConfigRouting.h>
29 #include <Protocol/HiiDatabase.h>
30 #include <Protocol/LegacyBios.h>
32 #include <Library/UefiDriverEntryPoint.h>
33 #include <Library/UefiBootServicesTableLib.h>
34 #include <Library/UefiRuntimeServicesTableLib.h>
35 #include <Library/BaseLib.h>
36 #include <Library/DevicePathLib.h>
37 #include <Library/DebugLib.h>
38 #include <Library/HiiLib.h>
39 #include <Library/UefiBootManagerLib.h>
40 #include <Library/MemoryAllocationLib.h>
41 #include <Library/UefiLib.h>
42 #include <Library/PrintLib.h>
43 #include <Library/BaseMemoryLib.h>
45 #include "LegacyBootMaintUiVfr.h"
47 #define CONFIG_OPTION_OFFSET 0x1200
50 // VarOffset that will be used to create question
51 // all these values are computed from the structure
54 #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))
57 // Question Id of Zero is invalid, so add an offset to it
59 #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
62 #define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
63 #define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
64 #define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
65 #define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
66 #define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
72 #define STR_FLOPPY L"Floppy Drive #%02x"
73 #define STR_HARDDISK L"HardDisk Drive #%02x"
74 #define STR_CDROM L"ATAPI CDROM Drive #%02x"
75 #define STR_NET L"NET Drive #%02x"
76 #define STR_BEV L"BEV Drive #%02x"
78 #define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
79 #define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
80 #define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
81 #define STR_NET_HELP L"NET Drive #%02x"
82 #define STR_BEV_HELP L"BEV Drive #%02x"
84 #define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"
85 #define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"
86 #define STR_CDROM_TITLE L"Set Legacy CDROM Drive Order"
87 #define STR_NET_TITLE L"Set Legacy NET Drive Order"
88 #define STR_BEV_TITLE L"Set Legacy BEV Drive Order"
91 // These are the VFR compiler generated data representing our VFR data.
93 extern UINT8 LegacyBootMaintUiVfrBin
[];
98 /// HII specific Vendor Device Path definition.
101 VENDOR_DEVICE_PATH VendorDevicePath
;
102 EFI_DEVICE_PATH_PROTOCOL End
;
103 } HII_VENDOR_DEVICE_PATH
;
108 // Variable created with this flag will be "Efi:...."
110 #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
113 #define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')
119 // HII relative handles
121 EFI_HII_HANDLE HiiHandle
;
122 EFI_HANDLE DriverHandle
;
125 // Produced protocols
127 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
130 // Maintain the data.
132 LEGACY_BOOT_MAINTAIN_DATA
*MaintainMapData
;
133 } LEGACY_BOOT_OPTION_CALLBACK_DATA
;
136 // All of the signatures that will be used in list structure
138 #define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
139 #define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
141 #define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9
147 } LEGACY_MENU_OPTION
;
152 } LEGACY_DEVICE_CONTEXT
;
158 UINT16
*DisplayString
;
160 EFI_STRING_ID DisplayStringToken
;
161 EFI_STRING_ID HelpStringToken
;
162 VOID
*VariableContext
;
167 } LEGACY_BOOT_OPTION_BBS_DATA
;
172 This call back function is registered with Boot Manager formset.
173 When user selects a boot option, this call back function will
174 be triggered. The boot option is saved for later processing.
177 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
178 @param Action Specifies the type of action taken by the browser.
179 @param QuestionId A unique value which is sent to the original exporting driver
180 so that it can identify the type of data to expect.
181 @param Type The type of value for the question.
182 @param Value A pointer to the data being sent to the original exporting driver.
183 @param ActionRequest On return, points to the action requested by the callback function.
185 @retval EFI_SUCCESS The callback successfully handled the action.
186 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
191 LegacyBootOptionCallback (
192 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
193 IN EFI_BROWSER_ACTION Action
,
194 IN EFI_QUESTION_ID QuestionId
,
196 IN EFI_IFR_TYPE_VALUE
*Value
,
197 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
201 This function allows a caller to extract the current configuration for one
202 or more named elements from the target driver.
205 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
206 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
207 @param Progress - On return, points to a character in the Request string.
208 Points to the string's null terminator if request was successful.
209 Points to the most recent '&' before the first failing name/value
210 pair (or the beginning of the string if the failure is in the
211 first name/value pair) if the request was not successful.
212 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
213 has all values filled in for the names in the Request string.
214 String to be allocated by the called function.
216 @retval EFI_SUCCESS The Results is filled with the requested values.
217 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
218 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
219 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
224 LegacyBootOptionExtractConfig (
225 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
226 IN CONST EFI_STRING Request
,
227 OUT EFI_STRING
*Progress
,
228 OUT EFI_STRING
*Results
232 This function processes the results of changes in configuration.
235 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
236 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
237 @param Progress - A pointer to a string filled in with the offset of the most
238 recent '&' before the first failing name/value pair (or the
239 beginning of the string if the failure is in the first
240 name/value pair) or the terminating NULL if all was successful.
242 @retval EFI_SUCCESS The Results is processed successfully.
243 @retval EFI_INVALID_PARAMETER Configuration is NULL.
244 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
249 LegacyBootOptionRouteConfig (
250 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
251 IN CONST EFI_STRING Configuration
,
252 OUT EFI_STRING
*Progress