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