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