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