Remove all blanks lines to avoid build errors.
[mirror_edk2.git] / EdkNt32Pkg / Include / Library / EdkGenericBdsLib.h
CommitLineData
878ddf1f 1/*++\r
2\r
59e9a365 3Copyright (c) 2006 - 2007, Intel Corporation\r
878ddf1f 4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 BdsLib.h\r
15\r
16Abstract:\r
17\r
18 BDS library definition, include the file and data structure\r
19\r
20--*/\r
21\r
22#ifndef _BDS_LIB_H_\r
23#define _BDS_LIB_H_\r
24\r
25extern EFI_HANDLE mBdsImageHandle;\r
26\r
27//\r
28// Constants which are variable names used to access variables\r
29//\r
30#define VarLegacyDevOrder L"LegacyDevOrder"\r
31\r
32//\r
33// Data structures and defines\r
34//\r
35#define FRONT_PAGE_QUESTION_ID 0x0000\r
36#define FRONT_PAGE_DATA_WIDTH 0x01\r
37\r
38//\r
39// ConnectType\r
40//\r
41#define CONSOLE_OUT 0x00000001\r
42#define STD_ERROR 0x00000002\r
43#define CONSOLE_IN 0x00000004\r
44#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)\r
45\r
46//\r
47// Load Option Attributes defined in EFI Specification\r
48//\r
49#define LOAD_OPTION_ACTIVE 0x00000001\r
50#define LOAD_OPTION_FORCE_RECONNECT 0x00000002\r
51#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)\r
52\r
53//\r
54// Define Maxmim characters that will be accepted\r
55//\r
56#define MAX_CHAR 480\r
57#define MAX_CHAR_SIZE (MAX_CHAR * 2)\r
58\r
59#define MIN_ALIGNMENT_SIZE 4\r
60#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r
61\r
9e0e49fc 62//\r
63// Define maximum characters for boot option variable "BootXXXX"\r
64//\r
65#define BOOT_OPTION_MAX_CHAR 10\r
66\r
878ddf1f 67//\r
68// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.\r
69//\r
70#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')\r
71\r
72typedef struct {\r
73\r
74 UINTN Signature;\r
75 LIST_ENTRY Link;\r
76\r
77 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
78\r
79 CHAR16 *OptionName;\r
80 UINTN OptionNumber;\r
81 UINT16 BootCurrent;\r
82 UINT32 Attribute;\r
83 CHAR16 *Description;\r
84 VOID *LoadOptions;\r
85 UINT32 LoadOptionsSize;\r
86\r
87} BDS_COMMON_OPTION;\r
88\r
89typedef struct {\r
90 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
91 UINTN ConnectType;\r
92} BDS_CONSOLE_CONNECT_ENTRY;\r
93\r
94//\r
95// Lib Functions\r
96//\r
97\r
98//\r
99// Bds boot relate lib functions\r
100//\r
101EFI_STATUS\r
102BdsLibUpdateBootOrderList (\r
103 IN LIST_ENTRY *BdsOptionList,\r
104 IN CHAR16 *VariableName\r
105 );\r
106\r
107VOID\r
108BdsLibBootNext (\r
109 VOID\r
110 );\r
111\r
112EFI_STATUS\r
113BdsLibBootViaBootOption (\r
114 IN BDS_COMMON_OPTION * Option,\r
115 IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,\r
116 OUT UINTN *ExitDataSize,\r
117 OUT CHAR16 **ExitData OPTIONAL\r
118 );\r
119\r
120EFI_STATUS\r
121BdsLibEnumerateAllBootOption (\r
122 IN OUT LIST_ENTRY *BdsBootOptionList\r
123 );\r
124\r
125VOID\r
126BdsLibBuildOptionFromHandle (\r
127 IN EFI_HANDLE Handle,\r
128 IN LIST_ENTRY *BdsBootOptionList\r
129 );\r
130\r
131VOID\r
132BdsLibBuildOptionFromShell (\r
133 IN EFI_HANDLE Handle,\r
134 IN LIST_ENTRY *BdsBootOptionList\r
135 );\r
136\r
137//\r
138// Bds misc lib functions\r
139//\r
140UINT16\r
141BdsLibGetTimeout (\r
142 VOID\r
143 );\r
144\r
878ddf1f 145VOID\r
146BdsLibLoadDrivers (\r
147 IN LIST_ENTRY *BdsDriverLists\r
148 );\r
149\r
150EFI_STATUS\r
151BdsLibBuildOptionFromVar (\r
152 IN LIST_ENTRY *BdsCommonOptionList,\r
153 IN CHAR16 *VariableName\r
154 );\r
155\r
156VOID *\r
157BdsLibGetVariableAndSize (\r
158 IN CHAR16 *Name,\r
159 IN EFI_GUID *VendorGuid,\r
160 OUT UINTN *VariableSize\r
161 );\r
162\r
163EFI_STATUS\r
164BdsLibOutputStrings (\r
165 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut,\r
166 ...\r
167 );\r
168\r
169BDS_COMMON_OPTION *\r
170BdsLibVariableToOption (\r
171 IN OUT LIST_ENTRY *BdsCommonOptionList,\r
172 IN CHAR16 *VariableName\r
173 );\r
174\r
175EFI_STATUS\r
176BdsLibRegisterNewOption (\r
177 IN LIST_ENTRY *BdsOptionList,\r
178 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
179 IN CHAR16 *String,\r
180 IN CHAR16 *VariableName\r
181 );\r
182\r
183//\r
184// Bds connect or disconnect driver lib funcion\r
185//\r
186VOID\r
187BdsLibConnectAllDriversToAllControllers (\r
188 VOID\r
189 );\r
190\r
191VOID\r
192BdsLibConnectAll (\r
193 VOID\r
194 );\r
195\r
196EFI_STATUS\r
197BdsLibConnectDevicePath (\r
198 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r
199 );\r
200\r
201EFI_STATUS\r
202BdsLibConnectAllEfi (\r
203 VOID\r
204 );\r
205\r
206EFI_STATUS\r
207BdsLibDisconnectAllEfi (\r
208 VOID\r
209 );\r
210\r
211//\r
212// Bds console relate lib functions\r
213//\r
214VOID\r
215BdsLibConnectAllConsoles (\r
216 VOID\r
217 );\r
218\r
219EFI_STATUS\r
220BdsLibConnectAllDefaultConsoles (\r
221 VOID\r
222 );\r
223\r
224EFI_STATUS\r
225BdsLibUpdateConsoleVariable (\r
226 IN CHAR16 *ConVarName,\r
227 IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,\r
228 IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath\r
229 );\r
230\r
231EFI_STATUS\r
232BdsLibConnectConsoleVariable (\r
233 IN CHAR16 *ConVarName\r
234 );\r
235\r
236//\r
237// Bds device path relate lib functions\r
238//\r
239EFI_DEVICE_PATH_PROTOCOL *\r
240BdsLibUnpackDevicePath (\r
241 IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
242 );\r
243\r
d02ea958 244VOID\r
245BdsLibSafeFreePool (\r
246 IN VOID *Buffer\r
247 );\r
248\r
249EFI_DEVICE_PATH_PROTOCOL *\r
250BdsLibDelPartMatchInstance (\r
251 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
252 IN EFI_DEVICE_PATH_PROTOCOL *Single\r
253 );\r
254\r
878ddf1f 255BOOLEAN\r
256BdsLibMatchDevicePaths (\r
257 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
258 IN EFI_DEVICE_PATH_PROTOCOL *Single\r
259 );\r
260\r
261CHAR16 *\r
262DevicePathToStr (\r
263 EFI_DEVICE_PATH_PROTOCOL *DevPath\r
264 );\r
265\r
266VOID *\r
267EfiLibGetVariable (\r
268 IN CHAR16 *Name,\r
269 IN EFI_GUID *VendorGuid\r
270 );\r
271\r
272//\r
273// Internal definitions\r
274//\r
275typedef struct {\r
276 CHAR16 *str;\r
277 UINTN len;\r
278 UINTN maxlen;\r
279} POOL_PRINT;\r
280\r
281typedef struct {\r
282 UINT8 Type;\r
283 UINT8 SubType;\r
284 VOID (*Function) (POOL_PRINT *, VOID *);\r
285} DEVICE_PATH_STRING_TABLE;\r
286\r
287//\r
288// Internal functions\r
289//\r
290EFI_STATUS\r
291BdsBootByDiskSignatureAndPartition (\r
292 IN BDS_COMMON_OPTION * Option,\r
293 IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,\r
294 IN UINT32 LoadOptionsSize,\r
295 IN VOID *LoadOptions,\r
296 OUT UINTN *ExitDataSize,\r
297 OUT CHAR16 **ExitData OPTIONAL\r
298 );\r
299\r
300//\r
301// Notes: EFI 64 shadow all option rom\r
302//\r
59e9a365 303#if defined (MDE_CPU_IPF)\r
878ddf1f 304#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();\r
305VOID\r
306ShadowAllOptionRom();\r
307#else\r
308#define EFI64_SHADOW_ALL_LEGACY_ROM()\r
309#endif\r
310\r
311//\r
312// BBS support macros and functions\r
313//\r
59e9a365 314#if defined (MDE_CPU_IA32)\r
878ddf1f 315#define REFRESH_LEGACY_BOOT_OPTIONS \\r
316 BdsDeleteAllInvalidLegacyBootOptions ();\\r
317 BdsAddNonExistingLegacyBootOptions (); \\r
318 BdsUpdateLegacyDevOrder ()\r
319#else\r
320#define REFRESH_LEGACY_BOOT_OPTIONS\r
321#endif\r
322\r
323EFI_STATUS\r
324BdsDeleteAllInvalidLegacyBootOptions (\r
325 VOID\r
326 );\r
327\r
328EFI_STATUS\r
329BdsAddNonExistingLegacyBootOptions (\r
330 VOID\r
331 );\r
332\r
333EFI_STATUS\r
334BdsUpdateLegacyDevOrder (\r
335 VOID\r
336 );\r
337\r
338EFI_STATUS\r
339BdsRefreshBbsTableForBoot (\r
340 IN BDS_COMMON_OPTION *Entry\r
341 );\r
342\r
9e0e49fc 343EFI_STATUS\r
344BdsDeleteBootOption (\r
345 IN UINTN OptionNumber,\r
346 IN OUT UINT16 *BootOrder,\r
347 IN OUT UINTN *BootOrderSize\r
348 );\r
349\r
350//\r
351//The interface functions relate with Setup Browser Reset Reminder feature\r
352//\r
353VOID\r
354EnableResetReminderFeature (\r
355 VOID\r
356 );\r
357\r
358VOID\r
359DisableResetReminderFeature (\r
360 VOID\r
361 );\r
362\r
363VOID\r
364EnableResetRequired (\r
365 VOID\r
366 );\r
367\r
368VOID\r
369DisableResetRequired (\r
370 VOID\r
371 );\r
372\r
373BOOLEAN\r
374IsResetReminderFeatureEnable (\r
375 VOID\r
376 );\r
377\r
378BOOLEAN\r
379IsResetRequired (\r
380 VOID\r
381 );\r
382\r
383VOID\r
384SetupResetReminder (\r
385 VOID\r
386 );\r
387 \r
0e7bfce8 388EFI_STATUS\r
389BdsLibGetHiiHandles (\r
390 IN EFI_HII_PROTOCOL *Hii,\r
391 IN OUT UINT16 *HandleBufferLength,\r
392 OUT EFI_HII_HANDLE **HiiHandles\r
393 );\r
394\r
878ddf1f 395#endif // _BDS_LIB_H_\r