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