]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Csm / LegacyBootMaintUiLib / LegacyBootMaintUi.h
1 /** @file
2 Legacy boot maintenance Ui definition.
3
4 Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _EFI_LEGACY_BOOT_OPTION_H_
10 #define _EFI_LEGACY_BOOT_OPTION_H_
11
12 #include <PiDxe.h>
13
14 #include <Guid/GlobalVariable.h>
15 #include <Guid/LegacyDevOrder.h>
16 #include <Guid/MdeModuleHii.h>
17
18 #include <Protocol/HiiConfigAccess.h>
19 #include <Protocol/HiiConfigRouting.h>
20
21 #include <Protocol/HiiDatabase.h>
22 #include <Protocol/LegacyBios.h>
23
24 #include <Library/UefiDriverEntryPoint.h>
25 #include <Library/UefiBootServicesTableLib.h>
26 #include <Library/UefiRuntimeServicesTableLib.h>
27 #include <Library/BaseLib.h>
28 #include <Library/DevicePathLib.h>
29 #include <Library/DebugLib.h>
30 #include <Library/HiiLib.h>
31 #include <Library/UefiBootManagerLib.h>
32 #include <Library/MemoryAllocationLib.h>
33 #include <Library/UefiLib.h>
34 #include <Library/PrintLib.h>
35 #include <Library/BaseMemoryLib.h>
36
37 #include "LegacyBootMaintUiVfr.h"
38
39 #define CONFIG_OPTION_OFFSET 0x1200
40
41 //
42 // VarOffset that will be used to create question
43 // all these values are computed from the structure
44 // defined below
45 //
46 #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))
47
48 //
49 // Question Id of Zero is invalid, so add an offset to it
50 //
51 #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
52
53 #define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
54 #define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
55 #define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
56 #define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
57 #define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
58
59 //
60 // String Constant
61 //
62 #define STR_FLOPPY L"Floppy Drive #%02x"
63 #define STR_HARDDISK L"HardDisk Drive #%02x"
64 #define STR_CDROM L"ATAPI CDROM Drive #%02x"
65 #define STR_NET L"NET Drive #%02x"
66 #define STR_BEV L"BEV Drive #%02x"
67
68 #define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
69 #define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
70 #define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
71 #define STR_NET_HELP L"NET Drive #%02x"
72 #define STR_BEV_HELP L"BEV Drive #%02x"
73
74 #define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"
75 #define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"
76 #define STR_CDROM_TITLE L"Set Legacy CDROM Drive Order"
77 #define STR_NET_TITLE L"Set Legacy NET Drive Order"
78 #define STR_BEV_TITLE L"Set Legacy BEV Drive Order"
79
80 //
81 // These are the VFR compiler generated data representing our VFR data.
82 //
83 extern UINT8 LegacyBootMaintUiVfrBin[];
84
85 #pragma pack(1)
86
87 ///
88 /// HII specific Vendor Device Path definition.
89 ///
90 typedef struct {
91 VENDOR_DEVICE_PATH VendorDevicePath;
92 EFI_DEVICE_PATH_PROTOCOL End;
93 } HII_VENDOR_DEVICE_PATH;
94
95 //
96 // Variable created with this flag will be "Efi:...."
97 //
98 #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
99
100 #define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')
101
102 typedef struct {
103 UINTN Signature;
104
105 //
106 // HII relative handles
107 //
108 EFI_HII_HANDLE HiiHandle;
109 EFI_HANDLE DriverHandle;
110
111 //
112 // Produced protocols
113 //
114 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
115
116 //
117 // Maintain the data.
118 //
119 LEGACY_BOOT_MAINTAIN_DATA *MaintainMapData;
120 } LEGACY_BOOT_OPTION_CALLBACK_DATA;
121
122 //
123 // All of the signatures that will be used in list structure
124 //
125 #define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
126 #define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
127
128 #define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9
129
130 typedef struct {
131 UINTN Signature;
132 LIST_ENTRY Head;
133 UINTN MenuNumber;
134 } LEGACY_MENU_OPTION;
135
136 typedef struct {
137 UINT16 BbsIndex;
138 CHAR16 *Description;
139 } LEGACY_DEVICE_CONTEXT;
140
141 typedef struct {
142 UINTN Signature;
143 LIST_ENTRY Link;
144 UINTN OptionNumber;
145 UINT16 *DisplayString;
146 UINT16 *HelpString;
147 EFI_STRING_ID DisplayStringToken;
148 EFI_STRING_ID HelpStringToken;
149 VOID *VariableContext;
150 } LEGACY_MENU_ENTRY;
151
152 typedef struct {
153 UINT16 BbsIndex;
154 } LEGACY_BOOT_OPTION_BBS_DATA;
155
156 #pragma pack()
157
158 /**
159 This call back function is registered with Boot Manager formset.
160 When user selects a boot option, this call back function will
161 be triggered. The boot option is saved for later processing.
162
163
164 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
165 @param Action Specifies the type of action taken by the browser.
166 @param QuestionId A unique value which is sent to the original exporting driver
167 so that it can identify the type of data to expect.
168 @param Type The type of value for the question.
169 @param Value A pointer to the data being sent to the original exporting driver.
170 @param ActionRequest On return, points to the action requested by the callback function.
171
172 @retval EFI_SUCCESS The callback successfully handled the action.
173 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
174
175 **/
176 EFI_STATUS
177 EFIAPI
178 LegacyBootOptionCallback (
179 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
180 IN EFI_BROWSER_ACTION Action,
181 IN EFI_QUESTION_ID QuestionId,
182 IN UINT8 Type,
183 IN EFI_IFR_TYPE_VALUE *Value,
184 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
185 );
186
187 /**
188 This function allows a caller to extract the current configuration for one
189 or more named elements from the target driver.
190
191
192 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
193 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
194 @param Progress - On return, points to a character in the Request string.
195 Points to the string's null terminator if request was successful.
196 Points to the most recent '&' before the first failing name/value
197 pair (or the beginning of the string if the failure is in the
198 first name/value pair) if the request was not successful.
199 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
200 has all values filled in for the names in the Request string.
201 String to be allocated by the called function.
202
203 @retval EFI_SUCCESS The Results is filled with the requested values.
204 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
205 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
206 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
207
208 **/
209 EFI_STATUS
210 EFIAPI
211 LegacyBootOptionExtractConfig (
212 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
213 IN CONST EFI_STRING Request,
214 OUT EFI_STRING *Progress,
215 OUT EFI_STRING *Results
216 );
217
218 /**
219 This function processes the results of changes in configuration.
220
221
222 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
223 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
224 @param Progress - A pointer to a string filled in with the offset of the most
225 recent '&' before the first failing name/value pair (or the
226 beginning of the string if the failure is in the first
227 name/value pair) or the terminating NULL if all was successful.
228
229 @retval EFI_SUCCESS The Results is processed successfully.
230 @retval EFI_INVALID_PARAMETER Configuration is NULL.
231 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
232
233 **/
234 EFI_STATUS
235 EFIAPI
236 LegacyBootOptionRouteConfig (
237 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
238 IN CONST EFI_STRING Configuration,
239 OUT EFI_STRING *Progress
240 );
241
242 #endif