MAX_POOL_SIZE was hardcoded to 0xFFFFFF00. MAX_POOL_SIZE was replaced with MAX_ADDRES...
[mirror_edk2.git] / EdkNt32Pkg / Include / library / EdkGenericBdsLib.h
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
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
62//\r
63// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.\r
64//\r
65#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')\r
66\r
67typedef struct {\r
68\r
69 UINTN Signature;\r
70 LIST_ENTRY Link;\r
71\r
72 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
73\r
74 CHAR16 *OptionName;\r
75 UINTN OptionNumber;\r
76 UINT16 BootCurrent;\r
77 UINT32 Attribute;\r
78 CHAR16 *Description;\r
79 VOID *LoadOptions;\r
80 UINT32 LoadOptionsSize;\r
81\r
82} BDS_COMMON_OPTION;\r
83\r
84typedef struct {\r
85 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
86 UINTN ConnectType;\r
87} BDS_CONSOLE_CONNECT_ENTRY;\r
88\r
89//\r
90// Lib Functions\r
91//\r
92\r
93//\r
94// Bds boot relate lib functions\r
95//\r
96EFI_STATUS\r
97BdsLibUpdateBootOrderList (\r
98 IN LIST_ENTRY *BdsOptionList,\r
99 IN CHAR16 *VariableName\r
100 );\r
101\r
102VOID\r
103BdsLibBootNext (\r
104 VOID\r
105 );\r
106\r
107EFI_STATUS\r
108BdsLibBootViaBootOption (\r
109 IN BDS_COMMON_OPTION * Option,\r
110 IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,\r
111 OUT UINTN *ExitDataSize,\r
112 OUT CHAR16 **ExitData OPTIONAL\r
113 );\r
114\r
115EFI_STATUS\r
116BdsLibEnumerateAllBootOption (\r
117 IN OUT LIST_ENTRY *BdsBootOptionList\r
118 );\r
119\r
120VOID\r
121BdsLibBuildOptionFromHandle (\r
122 IN EFI_HANDLE Handle,\r
123 IN LIST_ENTRY *BdsBootOptionList\r
124 );\r
125\r
126VOID\r
127BdsLibBuildOptionFromShell (\r
128 IN EFI_HANDLE Handle,\r
129 IN LIST_ENTRY *BdsBootOptionList\r
130 );\r
131\r
132//\r
133// Bds misc lib functions\r
134//\r
135UINT16\r
136BdsLibGetTimeout (\r
137 VOID\r
138 );\r
139\r
140EFI_STATUS\r
141BdsLibGetBootMode (\r
142 OUT EFI_BOOT_MODE *BootMode\r
143 );\r
144\r
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
244BOOLEAN\r
245BdsLibMatchDevicePaths (\r
246 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
247 IN EFI_DEVICE_PATH_PROTOCOL *Single\r
248 );\r
249\r
250CHAR16 *\r
251DevicePathToStr (\r
252 EFI_DEVICE_PATH_PROTOCOL *DevPath\r
253 );\r
254\r
255VOID *\r
256EfiLibGetVariable (\r
257 IN CHAR16 *Name,\r
258 IN EFI_GUID *VendorGuid\r
259 );\r
260\r
261//\r
262// Internal definitions\r
263//\r
264typedef struct {\r
265 CHAR16 *str;\r
266 UINTN len;\r
267 UINTN maxlen;\r
268} POOL_PRINT;\r
269\r
270typedef struct {\r
271 UINT8 Type;\r
272 UINT8 SubType;\r
273 VOID (*Function) (POOL_PRINT *, VOID *);\r
274} DEVICE_PATH_STRING_TABLE;\r
275\r
276//\r
277// Internal functions\r
278//\r
279EFI_STATUS\r
280BdsBootByDiskSignatureAndPartition (\r
281 IN BDS_COMMON_OPTION * Option,\r
282 IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,\r
283 IN UINT32 LoadOptionsSize,\r
284 IN VOID *LoadOptions,\r
285 OUT UINTN *ExitDataSize,\r
286 OUT CHAR16 **ExitData OPTIONAL\r
287 );\r
288\r
289//\r
290// Notes: EFI 64 shadow all option rom\r
291//\r
292#ifdef EFI64\r
293#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();\r
294VOID\r
295ShadowAllOptionRom();\r
296#else\r
297#define EFI64_SHADOW_ALL_LEGACY_ROM()\r
298#endif\r
299\r
300//\r
301// BBS support macros and functions\r
302//\r
303#ifdef EFI32\r
304#define REFRESH_LEGACY_BOOT_OPTIONS \\r
305 BdsDeleteAllInvalidLegacyBootOptions ();\\r
306 BdsAddNonExistingLegacyBootOptions (); \\r
307 BdsUpdateLegacyDevOrder ()\r
308#else\r
309#define REFRESH_LEGACY_BOOT_OPTIONS\r
310#endif\r
311\r
312EFI_STATUS\r
313BdsDeleteAllInvalidLegacyBootOptions (\r
314 VOID\r
315 );\r
316\r
317EFI_STATUS\r
318BdsAddNonExistingLegacyBootOptions (\r
319 VOID\r
320 );\r
321\r
322EFI_STATUS\r
323BdsUpdateLegacyDevOrder (\r
324 VOID\r
325 );\r
326\r
327EFI_STATUS\r
328BdsRefreshBbsTableForBoot (\r
329 IN BDS_COMMON_OPTION *Entry\r
330 );\r
331\r
332#endif // _BDS_LIB_H_\r