]>
Commit | Line | Data |
---|---|---|
83d26a81 | 1 | /** @file\r |
5f597758 | 2 | Generic BDS library definition, include the data structure and function.\r |
93e3992d | 3 | \r |
83d26a81 | 4 | Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
93e3992d | 9 | \r |
83d26a81 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
93e3992d | 12 | \r |
83d26a81 | 13 | **/\r |
93e3992d | 14 | \r |
15 | #ifndef _GENERIC_BDS_LIB_H_\r | |
16 | #define _GENERIC_BDS_LIB_H_\r | |
17 | \r | |
93e3992d | 18 | #include <PiDxe.h>\r |
19 | #include <Protocol/HiiDatabase.h>\r | |
20 | #include <IndustryStandard/PeImage.h>\r | |
21 | \r | |
22 | \r | |
23 | extern EFI_HANDLE mBdsImageHandle;\r | |
24 | \r | |
25 | //\r | |
26 | // Constants which are variable names used to access variables\r | |
27 | //\r | |
5f597758 | 28 | #define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r |
93e3992d | 29 | \r |
30 | //\r | |
31 | // Data structures and defines\r | |
32 | //\r | |
33 | #define FRONT_PAGE_QUESTION_ID 0x0000\r | |
34 | #define FRONT_PAGE_DATA_WIDTH 0x01\r | |
35 | \r | |
36 | //\r | |
37 | // ConnectType\r | |
38 | //\r | |
39 | #define CONSOLE_OUT 0x00000001\r | |
40 | #define STD_ERROR 0x00000002\r | |
41 | #define CONSOLE_IN 0x00000004\r | |
42 | #define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)\r | |
43 | \r | |
44 | //\r | |
45 | // Load Option Attributes defined in EFI Specification\r | |
46 | //\r | |
47 | #define LOAD_OPTION_ACTIVE 0x00000001\r | |
48 | #define LOAD_OPTION_FORCE_RECONNECT 0x00000002\r | |
49 | \r | |
93e3992d | 50 | #define LOAD_OPTION_HIDDEN 0x00000008\r |
51 | #define LOAD_OPTION_CATEGORY 0x00001F00\r | |
52 | \r | |
53 | #define LOAD_OPTION_CATEGORY_BOOT 0x00000000\r | |
54 | #define LOAD_OPTION_CATEGORY_APP 0x00000100\r | |
55 | \r | |
56 | #define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001\r | |
57 | #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002\r | |
93e3992d | 58 | \r |
59 | #define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)\r | |
60 | \r | |
61 | //\r | |
62 | // Define Maxmim characters that will be accepted\r | |
63 | //\r | |
64 | #define MAX_CHAR 480\r | |
65 | #define MAX_CHAR_SIZE (MAX_CHAR * 2)\r | |
66 | \r | |
67 | #define MIN_ALIGNMENT_SIZE 4\r | |
68 | #define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r | |
69 | \r | |
70 | //\r | |
71 | // Define maximum characters for boot option variable "BootXXXX"\r | |
72 | //\r | |
73 | #define BOOT_OPTION_MAX_CHAR 10\r | |
74 | \r | |
75 | //\r | |
76 | // This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.\r | |
77 | //\r | |
78 | #define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')\r | |
79 | \r | |
80 | typedef struct {\r | |
81 | \r | |
82 | UINTN Signature;\r | |
83 | LIST_ENTRY Link;\r | |
84 | \r | |
85 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
86 | \r | |
87 | CHAR16 *OptionName;\r | |
88 | UINTN OptionNumber;\r | |
89 | UINT16 BootCurrent;\r | |
90 | UINT32 Attribute;\r | |
91 | CHAR16 *Description;\r | |
92 | VOID *LoadOptions;\r | |
93 | UINT32 LoadOptionsSize;\r | |
94 | CHAR16 *StatusString;\r | |
95 | \r | |
96 | } BDS_COMMON_OPTION;\r | |
97 | \r | |
98 | typedef struct {\r | |
99 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
100 | UINTN ConnectType;\r | |
101 | } BDS_CONSOLE_CONNECT_ENTRY;\r | |
102 | \r | |
103 | //\r | |
104 | // Lib Functions\r | |
105 | //\r | |
106 | \r | |
107 | //\r | |
5f597758 | 108 | // Bds boot related lib functions\r |
93e3992d | 109 | //\r |
83d26a81 | 110 | /**\r |
5f597758 | 111 | Boot from the UEFI spec defined "BootNext" variable.\r |
93e3992d | 112 | \r |
83d26a81 | 113 | **/\r |
93e3992d | 114 | VOID\r |
83d26a81 | 115 | EFIAPI\r |
93e3992d | 116 | BdsLibBootNext (\r |
117 | VOID\r | |
118 | );\r | |
119 | \r | |
83d26a81 | 120 | /**\r |
5f597758 | 121 | Process the boot option follow the UEFI specification and\r |
83d26a81 | 122 | special treat the legacy boot option with BBS_DEVICE_PATH.\r |
123 | \r | |
124 | @param Option The boot option need to be processed\r | |
125 | @param DevicePath The device path which describe where to load the\r | |
126 | boot image or the legcy BBS device path to boot\r | |
127 | the legacy OS\r | |
5f597758 LG |
128 | @param ExitDataSize The size of exit data.\r |
129 | @param ExitData Data returned when Boot image failed.\r | |
83d26a81 | 130 | \r |
5f597758 | 131 | @retval EFI_SUCCESS Boot from the input boot option successfully.\r |
83d26a81 | 132 | @retval EFI_NOT_FOUND If the Device Path is not found in the system\r |
133 | \r | |
134 | **/\r | |
93e3992d | 135 | EFI_STATUS\r |
83d26a81 | 136 | EFIAPI\r |
93e3992d | 137 | BdsLibBootViaBootOption (\r |
138 | IN BDS_COMMON_OPTION * Option,\r | |
139 | IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,\r | |
140 | OUT UINTN *ExitDataSize,\r | |
141 | OUT CHAR16 **ExitData OPTIONAL\r | |
142 | );\r | |
143 | \r | |
83d26a81 | 144 | \r |
145 | /**\r | |
146 | This function will enumerate all possible boot device in the system,\r | |
147 | it will only excute once of every boot.\r | |
148 | \r | |
149 | @param BdsBootOptionList The header of the link list which indexed all\r | |
150 | current boot options\r | |
151 | \r | |
152 | @retval EFI_SUCCESS Finished all the boot device enumerate and create\r | |
153 | the boot option base on that boot device\r | |
154 | \r | |
155 | **/\r | |
93e3992d | 156 | EFI_STATUS\r |
83d26a81 | 157 | EFIAPI\r |
93e3992d | 158 | BdsLibEnumerateAllBootOption (\r |
83d26a81 | 159 | IN OUT LIST_ENTRY *BdsBootOptionList\r |
93e3992d | 160 | );\r |
161 | \r | |
83d26a81 | 162 | /**\r |
163 | Build the boot option with the handle parsed in\r | |
164 | \r | |
165 | @param Handle The handle which present the device path to create\r | |
166 | boot option\r | |
167 | @param BdsBootOptionList The header of the link list which indexed all\r | |
168 | current boot options\r | |
5f597758 | 169 | @param String The description of the boot option.\r |
83d26a81 | 170 | \r |
171 | **/\r | |
93e3992d | 172 | VOID\r |
83d26a81 | 173 | EFIAPI\r |
93e3992d | 174 | BdsLibBuildOptionFromHandle (\r |
83d26a81 | 175 | IN EFI_HANDLE Handle,\r |
176 | IN LIST_ENTRY *BdsBootOptionList,\r | |
177 | IN CHAR16 *String\r | |
93e3992d | 178 | );\r |
179 | \r | |
83d26a81 | 180 | \r |
181 | /**\r | |
5f597758 | 182 | Build the on flash shell boot option with the handle parsed in.\r |
83d26a81 | 183 | \r |
184 | @param Handle The handle which present the device path to create\r | |
185 | on flash shell boot option\r | |
186 | @param BdsBootOptionList The header of the link list which indexed all\r | |
187 | current boot options\r | |
188 | \r | |
83d26a81 | 189 | **/\r |
93e3992d | 190 | VOID\r |
83d26a81 | 191 | EFIAPI\r |
93e3992d | 192 | BdsLibBuildOptionFromShell (\r |
83d26a81 | 193 | IN EFI_HANDLE Handle,\r |
194 | IN OUT LIST_ENTRY *BdsBootOptionList\r | |
93e3992d | 195 | );\r |
196 | \r | |
197 | //\r | |
198 | // Bds misc lib functions\r | |
199 | //\r | |
83d26a81 | 200 | /**\r |
201 | Return the default value for system Timeout variable.\r | |
202 | \r | |
203 | @return Timeout value.\r | |
204 | \r | |
205 | **/\r | |
93e3992d | 206 | UINT16\r |
83d26a81 | 207 | EFIAPI\r |
93e3992d | 208 | BdsLibGetTimeout (\r |
209 | VOID\r | |
210 | );\r | |
211 | \r | |
83d26a81 | 212 | /**\r |
213 | Get boot mode by looking up configuration table and parsing HOB list\r | |
214 | \r | |
215 | @param BootMode Boot mode from PEI handoff HOB.\r | |
216 | \r | |
217 | @retval EFI_SUCCESS Successfully get boot mode\r | |
218 | \r | |
219 | **/\r | |
93e3992d | 220 | EFI_STATUS\r |
83d26a81 | 221 | EFIAPI\r |
93e3992d | 222 | BdsLibGetBootMode (\r |
223 | OUT EFI_BOOT_MODE *BootMode\r | |
224 | );\r | |
225 | \r | |
83d26a81 | 226 | \r |
227 | /**\r | |
228 | The function will go through the driver optoin link list, load and start\r | |
229 | every driver the driver optoin device path point to.\r | |
230 | \r | |
231 | @param BdsDriverLists The header of the current driver option link list\r | |
232 | \r | |
233 | **/\r | |
93e3992d | 234 | VOID\r |
83d26a81 | 235 | EFIAPI\r |
93e3992d | 236 | BdsLibLoadDrivers (\r |
83d26a81 | 237 | IN LIST_ENTRY *BdsDriverLists\r |
93e3992d | 238 | );\r |
239 | \r | |
83d26a81 | 240 | \r |
241 | /**\r | |
242 | Process BootOrder, or DriverOrder variables, by calling\r | |
243 | BdsLibVariableToOption () for each UINT16 in the variables.\r | |
244 | \r | |
245 | @param BdsCommonOptionList The header of the option list base on variable\r | |
246 | VariableName\r | |
247 | @param VariableName EFI Variable name indicate the BootOrder or\r | |
248 | DriverOrder\r | |
249 | \r | |
250 | @retval EFI_SUCCESS Success create the boot option or driver option\r | |
251 | list\r | |
252 | @retval EFI_OUT_OF_RESOURCES Failed to get the boot option or driver option list\r | |
253 | \r | |
254 | **/\r | |
93e3992d | 255 | EFI_STATUS\r |
83d26a81 | 256 | EFIAPI\r |
93e3992d | 257 | BdsLibBuildOptionFromVar (\r |
83d26a81 | 258 | IN LIST_ENTRY *BdsCommonOptionList,\r |
259 | IN CHAR16 *VariableName\r | |
93e3992d | 260 | );\r |
261 | \r | |
83d26a81 | 262 | /**\r |
263 | Read the EFI variable (VendorGuid/Name) and return a dynamically allocated\r | |
264 | buffer, and the size of the buffer. If failure return NULL.\r | |
265 | \r | |
266 | @param Name String part of EFI variable name\r | |
267 | @param VendorGuid GUID part of EFI variable name\r | |
268 | @param VariableSize Returns the size of the EFI variable that was read\r | |
269 | \r | |
5f597758 LG |
270 | @return Dynamically allocated memory that contains a copy of the EFI variable\r |
271 | Caller is responsible freeing the buffer.\r | |
83d26a81 | 272 | @retval NULL Variable was not read\r |
273 | \r | |
274 | **/\r | |
275 | VOID *\r | |
276 | EFIAPI\r | |
93e3992d | 277 | BdsLibGetVariableAndSize (\r |
278 | IN CHAR16 *Name,\r | |
279 | IN EFI_GUID *VendorGuid,\r | |
280 | OUT UINTN *VariableSize\r | |
281 | );\r | |
282 | \r | |
83d26a81 | 283 | \r |
284 | /**\r | |
285 | This function prints a series of strings.\r | |
286 | \r | |
287 | @param ConOut Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r | |
288 | @param ... A variable argument list containing series of\r | |
289 | strings, the last string must be NULL.\r | |
290 | \r | |
291 | @retval EFI_SUCCESS Success print out the string using ConOut.\r | |
292 | @retval EFI_STATUS Return the status of the ConOut->OutputString ().\r | |
293 | \r | |
294 | **/\r | |
93e3992d | 295 | EFI_STATUS\r |
83d26a81 | 296 | EFIAPI\r |
93e3992d | 297 | BdsLibOutputStrings (\r |
298 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,\r | |
299 | ...\r | |
300 | );\r | |
301 | \r | |
83d26a81 | 302 | /**\r |
303 | Build the boot#### or driver#### option from the VariableName, the\r | |
5f597758 | 304 | build boot#### or driver#### will also be linked to BdsCommonOptionList.\r |
83d26a81 | 305 | \r |
306 | @param BdsCommonOptionList The header of the boot#### or driver#### option\r | |
307 | link list\r | |
308 | @param VariableName EFI Variable name indicate if it is boot#### or\r | |
309 | driver####\r | |
310 | \r | |
311 | @retval BDS_COMMON_OPTION Get the option just been created\r | |
312 | @retval NULL Failed to get the new option\r | |
313 | \r | |
314 | **/\r | |
315 | BDS_COMMON_OPTION *\r | |
316 | EFIAPI\r | |
93e3992d | 317 | BdsLibVariableToOption (\r |
83d26a81 | 318 | IN OUT LIST_ENTRY *BdsCommonOptionList,\r |
319 | IN CHAR16 *VariableName\r | |
93e3992d | 320 | );\r |
321 | \r | |
83d26a81 | 322 | /**\r |
323 | This function will register the new boot#### or driver#### option base on\r | |
324 | the VariableName. The new registered boot#### or driver#### will be linked\r | |
325 | to BdsOptionList and also update to the VariableName. After the boot#### or\r | |
326 | driver#### updated, the BootOrder or DriverOrder will also be updated.\r | |
327 | \r | |
328 | @param BdsOptionList The header of the boot#### or driver#### link list\r | |
329 | @param DevicePath The device path which the boot#### or driver####\r | |
330 | option present\r | |
331 | @param String The description of the boot#### or driver####\r | |
332 | @param VariableName Indicate if the boot#### or driver#### option\r | |
333 | \r | |
334 | @retval EFI_SUCCESS The boot#### or driver#### have been success\r | |
335 | registered\r | |
336 | @retval EFI_STATUS Return the status of gRT->SetVariable ().\r | |
337 | \r | |
338 | **/\r | |
93e3992d | 339 | EFI_STATUS\r |
83d26a81 | 340 | EFIAPI\r |
93e3992d | 341 | BdsLibRegisterNewOption (\r |
83d26a81 | 342 | IN LIST_ENTRY *BdsOptionList,\r |
93e3992d | 343 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
344 | IN CHAR16 *String,\r | |
345 | IN CHAR16 *VariableName\r | |
346 | );\r | |
347 | \r | |
348 | //\r | |
349 | // Bds connect or disconnect driver lib funcion\r | |
350 | //\r | |
83d26a81 | 351 | /**\r |
352 | Connects all drivers to all controllers.\r | |
353 | This function make sure all the current system driver will manage\r | |
354 | the correspoinding controllers if have. And at the same time, make\r | |
355 | sure all the system controllers have driver to manage it if have.\r | |
356 | \r | |
357 | **/\r | |
93e3992d | 358 | VOID\r |
83d26a81 | 359 | EFIAPI\r |
93e3992d | 360 | BdsLibConnectAllDriversToAllControllers (\r |
361 | VOID\r | |
362 | );\r | |
363 | \r | |
83d26a81 | 364 | /**\r |
365 | This function will connect all the system driver to controller\r | |
366 | first, and then special connect the default console, this make\r | |
367 | sure all the system controller avialbe and the platform default\r | |
368 | console connected.\r | |
369 | \r | |
370 | **/\r | |
93e3992d | 371 | VOID\r |
83d26a81 | 372 | EFIAPI\r |
93e3992d | 373 | BdsLibConnectAll (\r |
374 | VOID\r | |
375 | );\r | |
376 | \r | |
83d26a81 | 377 | /**\r |
378 | This function will create all handles associate with every device\r | |
379 | path node. If the handle associate with one device path node can not\r | |
380 | be created success, then still give one chance to do the dispatch,\r | |
381 | which load the missing drivers if possible.\r | |
382 | \r | |
383 | @param DevicePathToConnect The device path which will be connected, it can be\r | |
384 | a multi-instance device path\r | |
385 | \r | |
386 | @retval EFI_SUCCESS All handles associate with every device path node\r | |
387 | have been created\r | |
388 | @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles\r | |
389 | @retval EFI_NOT_FOUND Create the handle associate with one device path\r | |
390 | node failed\r | |
391 | \r | |
392 | **/\r | |
93e3992d | 393 | EFI_STATUS\r |
83d26a81 | 394 | EFIAPI\r |
93e3992d | 395 | BdsLibConnectDevicePath (\r |
396 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r | |
397 | );\r | |
398 | \r | |
83d26a81 | 399 | /**\r |
400 | This function will connect all current system handles recursively. The\r | |
401 | connection will finish until every handle's child handle created if it have.\r | |
402 | \r | |
403 | @retval EFI_SUCCESS All handles and it's child handle have been\r | |
404 | connected\r | |
405 | @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().\r | |
406 | \r | |
407 | **/\r | |
93e3992d | 408 | EFI_STATUS\r |
83d26a81 | 409 | EFIAPI\r |
93e3992d | 410 | BdsLibConnectAllEfi (\r |
411 | VOID\r | |
412 | );\r | |
413 | \r | |
83d26a81 | 414 | \r |
415 | /**\r | |
416 | This function will disconnect all current system handles. The disconnection\r | |
417 | will finish until every handle have been disconnected.\r | |
418 | \r | |
419 | @retval EFI_SUCCESS All handles have been disconnected\r | |
420 | @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().\r | |
421 | \r | |
422 | **/\r | |
93e3992d | 423 | EFI_STATUS\r |
83d26a81 | 424 | EFIAPI\r |
93e3992d | 425 | BdsLibDisconnectAllEfi (\r |
426 | VOID\r | |
427 | );\r | |
428 | \r | |
429 | //\r | |
5f597758 | 430 | // Bds console related lib functions\r |
93e3992d | 431 | //\r |
83d26a81 | 432 | /**\r |
433 | This function will search every simpletxt devive in current system,\r | |
434 | and make every simpletxt device as pertantial console device.\r | |
435 | \r | |
436 | **/\r | |
93e3992d | 437 | VOID\r |
83d26a81 | 438 | EFIAPI\r |
93e3992d | 439 | BdsLibConnectAllConsoles (\r |
440 | VOID\r | |
441 | );\r | |
442 | \r | |
83d26a81 | 443 | \r |
444 | /**\r | |
445 | This function will connect console device base on the console\r | |
446 | device variable ConIn, ConOut and ErrOut.\r | |
447 | \r | |
448 | @retval EFI_SUCCESS At least one of the ConIn and ConOut device have\r | |
449 | been connected success.\r | |
5f597758 | 450 | @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().\r |
83d26a81 | 451 | \r |
452 | **/\r | |
93e3992d | 453 | EFI_STATUS\r |
83d26a81 | 454 | EFIAPI\r |
93e3992d | 455 | BdsLibConnectAllDefaultConsoles (\r |
456 | VOID\r | |
457 | );\r | |
458 | \r | |
83d26a81 | 459 | /**\r |
460 | This function update console variable based on ConVarName, it can\r | |
461 | add or remove one specific console device path from the variable\r | |
462 | \r | |
463 | @param ConVarName Console related variable name, ConIn, ConOut,\r | |
464 | ErrOut.\r | |
465 | @param CustomizedConDevicePath The console device path which will be added to\r | |
466 | the console variable ConVarName, this parameter\r | |
467 | can not be multi-instance.\r | |
468 | @param ExclusiveDevicePath The console device path which will be removed\r | |
469 | from the console variable ConVarName, this\r | |
470 | parameter can not be multi-instance.\r | |
471 | \r | |
5f597758 | 472 | @retval EFI_UNSUPPORTED The added device path is same to the removed one.\r |
83d26a81 | 473 | @retval EFI_SUCCESS Success add or remove the device path from the\r |
474 | console variable.\r | |
475 | \r | |
476 | **/\r | |
93e3992d | 477 | EFI_STATUS\r |
83d26a81 | 478 | EFIAPI\r |
93e3992d | 479 | BdsLibUpdateConsoleVariable (\r |
480 | IN CHAR16 *ConVarName,\r | |
481 | IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,\r | |
482 | IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath\r | |
483 | );\r | |
484 | \r | |
83d26a81 | 485 | /**\r |
486 | Connect the console device base on the variable ConVarName, if\r | |
487 | device path of the ConVarName is multi-instance device path, if\r | |
488 | anyone of the instances is connected success, then this function\r | |
489 | will return success.\r | |
490 | \r | |
491 | @param ConVarName Console related variable name, ConIn, ConOut,\r | |
492 | ErrOut.\r | |
493 | \r | |
494 | @retval EFI_NOT_FOUND There is not any console devices connected\r | |
495 | success\r | |
496 | @retval EFI_SUCCESS Success connect any one instance of the console\r | |
497 | device path base on the variable ConVarName.\r | |
498 | \r | |
499 | **/\r | |
93e3992d | 500 | EFI_STATUS\r |
83d26a81 | 501 | EFIAPI\r |
93e3992d | 502 | BdsLibConnectConsoleVariable (\r |
503 | IN CHAR16 *ConVarName\r | |
504 | );\r | |
505 | \r | |
506 | //\r | |
5f597758 | 507 | // Bds device path related lib functions\r |
93e3992d | 508 | //\r |
83d26a81 | 509 | /**\r |
510 | Function unpacks a device path data structure so that all the nodes\r | |
511 | of a device path are naturally aligned.\r | |
512 | \r | |
513 | @param DevPath A pointer to a device path data structure\r | |
514 | \r | |
515 | @return If the memory for the device path is successfully allocated, then a\r | |
516 | pointer to the new device path is returned. Otherwise, NULL is returned.\r | |
517 | \r | |
518 | **/\r | |
519 | EFI_DEVICE_PATH_PROTOCOL *\r | |
520 | EFIAPI\r | |
93e3992d | 521 | BdsLibUnpackDevicePath (\r |
522 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r | |
523 | );\r | |
524 | \r | |
83d26a81 | 525 | /**\r |
526 | Delete the instance in Multi which matches partly with Single instance\r | |
527 | \r | |
528 | @param Multi A pointer to a multi-instance device path data\r | |
529 | structure.\r | |
530 | @param Single A pointer to a single-instance device path data\r | |
531 | structure.\r | |
532 | \r | |
533 | @return This function will remove the device path instances in Multi which partly\r | |
534 | match with the Single, and return the result device path. If there is no\r | |
535 | remaining device path as a result, this function will return NULL.\r | |
536 | \r | |
537 | **/\r | |
93e3992d | 538 | EFI_DEVICE_PATH_PROTOCOL *\r |
83d26a81 | 539 | EFIAPI\r |
93e3992d | 540 | BdsLibDelPartMatchInstance (\r |
541 | IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r | |
542 | IN EFI_DEVICE_PATH_PROTOCOL *Single\r | |
543 | );\r | |
544 | \r | |
83d26a81 | 545 | /**\r |
546 | Function compares a device path data structure to that of all the nodes of a\r | |
547 | second device path instance.\r | |
548 | \r | |
549 | @param Multi A pointer to a multi-instance device path data\r | |
550 | structure.\r | |
551 | @param Single A pointer to a single-instance device path data\r | |
552 | structure.\r | |
553 | \r | |
5f597758 LG |
554 | @retval TRUE If the Single device path is contained within Multi device path.\r |
555 | @retval FALSE The Single device path is not match within Multi device path.\r | |
83d26a81 | 556 | \r |
557 | **/\r | |
93e3992d | 558 | BOOLEAN\r |
83d26a81 | 559 | EFIAPI\r |
93e3992d | 560 | BdsLibMatchDevicePaths (\r |
561 | IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r | |
562 | IN EFI_DEVICE_PATH_PROTOCOL *Single\r | |
563 | );\r | |
564 | \r | |
83d26a81 | 565 | /**\r |
566 | This function converts an input device structure to a Unicode string.\r | |
567 | \r | |
568 | @param DevPath A pointer to the device path structure.\r | |
569 | \r | |
570 | @return A new allocated Unicode string that represents the device path.\r | |
571 | \r | |
572 | **/\r | |
573 | CHAR16 *\r | |
574 | EFIAPI\r | |
93e3992d | 575 | DevicePathToStr (\r |
83d26a81 | 576 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r |
93e3992d | 577 | );\r |
578 | \r | |
93e3992d | 579 | \r |
580 | //\r | |
581 | // Internal definitions\r | |
582 | //\r | |
583 | typedef struct {\r | |
584 | CHAR16 *str;\r | |
585 | UINTN len;\r | |
586 | UINTN maxlen;\r | |
587 | } POOL_PRINT;\r | |
588 | \r | |
589 | typedef struct {\r | |
590 | UINT8 Type;\r | |
591 | UINT8 SubType;\r | |
592 | VOID (*Function) (POOL_PRINT *, VOID *);\r | |
593 | } DEVICE_PATH_STRING_TABLE;\r | |
594 | \r | |
595 | extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;\r | |
596 | \r | |
597 | typedef struct {\r | |
598 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
599 | EFI_GUID Guid;\r | |
600 | UINT8 VendorDefinedData[1];\r | |
601 | } VENDOR_DEVICE_PATH_WITH_DATA;\r | |
602 | \r | |
93e3992d | 603 | \r |
604 | extern EFI_GUID mEfiDevicePathMessagingSASGuid;\r | |
605 | \r | |
606 | typedef struct {\r | |
607 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
608 | UINT16 NetworkProtocol;\r | |
609 | UINT16 LoginOption;\r | |
610 | UINT64 Lun;\r | |
611 | UINT16 TargetPortalGroupTag;\r | |
612 | CHAR16 iSCSITargetName[1];\r | |
613 | } ISCSI_DEVICE_PATH_WITH_NAME;\r | |
614 | \r | |
93e3992d | 615 | \r |
93e3992d | 616 | //\r |
617 | // Notes: EFI 64 shadow all option rom\r | |
618 | //\r | |
619 | #if defined (MDE_CPU_IPF)\r | |
620 | #define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();\r | |
93e3992d | 621 | #else\r |
622 | #define EFI64_SHADOW_ALL_LEGACY_ROM()\r | |
623 | #endif\r | |
624 | \r | |
5f597758 LG |
625 | /**\r |
626 | Shadow all Legacy OptionRom. \r | |
627 | \r | |
628 | **/\r | |
629 | VOID\r | |
630 | EFIAPI\r | |
631 | ShadowAllOptionRom (\r | |
632 | VOID\r | |
633 | );\r | |
634 | \r | |
93e3992d | 635 | //\r |
636 | // BBS support macros and functions\r | |
637 | //\r | |
638 | \r | |
639 | #if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)\r | |
640 | #define REFRESH_LEGACY_BOOT_OPTIONS \\r | |
641 | BdsDeleteAllInvalidLegacyBootOptions ();\\r | |
642 | BdsAddNonExistingLegacyBootOptions (); \\r | |
643 | BdsUpdateLegacyDevOrder ()\r | |
644 | #else\r | |
645 | #define REFRESH_LEGACY_BOOT_OPTIONS\r | |
646 | #endif\r | |
647 | \r | |
5f597758 LG |
648 | /**\r |
649 | Delete all the invalid legacy boot options.\r | |
650 | \r | |
651 | @retval EFI_SUCCESS All invalide legacy boot options are deleted.\r | |
652 | @retval EFI_OUT_OF_RESOURCES Fail to allocate necessary memory.\r | |
653 | @retval EFI_NOT_FOUND Fail to retrive variable of boot order.\r | |
654 | \r | |
655 | **/\r | |
93e3992d | 656 | EFI_STATUS\r |
5f597758 | 657 | EFIAPI\r |
93e3992d | 658 | BdsDeleteAllInvalidLegacyBootOptions (\r |
659 | VOID\r | |
660 | );\r | |
661 | \r | |
5f597758 LG |
662 | /**\r |
663 | \r | |
664 | Add the legacy boot options from BBS table if they do not exist.\r | |
665 | \r | |
666 | @retval EFI_SUCCESS The boot options are added successfully \r | |
667 | or they are already in boot options.\r | |
668 | \r | |
669 | **/\r | |
93e3992d | 670 | EFI_STATUS\r |
5f597758 | 671 | EFIAPI\r |
93e3992d | 672 | BdsAddNonExistingLegacyBootOptions (\r |
673 | VOID\r | |
674 | );\r | |
675 | \r | |
5f597758 LG |
676 | /**\r |
677 | \r | |
678 | Add the legacy boot devices from BBS table into \r | |
679 | the legacy device boot order.\r | |
680 | \r | |
681 | @retval EFI_SUCCESS The boot devices are added successfully.\r | |
682 | \r | |
683 | **/\r | |
93e3992d | 684 | EFI_STATUS\r |
5f597758 | 685 | EFIAPI\r |
93e3992d | 686 | BdsUpdateLegacyDevOrder (\r |
687 | VOID\r | |
688 | );\r | |
689 | \r | |
5f597758 LG |
690 | /**\r |
691 | \r | |
692 | Set the boot priority for BBS entries based on boot option entry and boot order.\r | |
693 | \r | |
694 | @param Entry The boot option is to be checked for refresh BBS table.\r | |
695 | \r | |
696 | @retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.\r | |
697 | \r | |
698 | **/\r | |
93e3992d | 699 | EFI_STATUS\r |
5f597758 | 700 | EFIAPI\r |
93e3992d | 701 | BdsRefreshBbsTableForBoot (\r |
702 | IN BDS_COMMON_OPTION *Entry\r | |
703 | );\r | |
704 | \r | |
5f597758 LG |
705 | /**\r |
706 | \r | |
707 | Delete boot option specified by OptionNumber and adjust the boot order.\r | |
708 | \r | |
709 | @param OptionNumber The boot option to be deleted.\r | |
710 | @param BootOrder Boot order list to be adjusted by remove this boot option.\r | |
711 | @param BootOrderSize The size of Boot order list will be modified.\r | |
712 | \r | |
713 | @retval EFI_SUCCESS The boot option is deleted successfully.\r | |
714 | \r | |
715 | **/\r | |
93e3992d | 716 | EFI_STATUS\r |
5f597758 | 717 | EFIAPI\r |
93e3992d | 718 | BdsDeleteBootOption (\r |
719 | IN UINTN OptionNumber,\r | |
720 | IN OUT UINT16 *BootOrder,\r | |
721 | IN OUT UINTN *BootOrderSize\r | |
722 | );\r | |
723 | \r | |
724 | //\r | |
725 | //The interface functions relate with Setup Browser Reset Reminder feature\r | |
726 | //\r | |
83d26a81 | 727 | /**\r |
728 | Enable the setup browser reset reminder feature.\r | |
729 | This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.\r | |
730 | \r | |
731 | **/\r | |
93e3992d | 732 | VOID\r |
83d26a81 | 733 | EFIAPI\r |
93e3992d | 734 | EnableResetReminderFeature (\r |
735 | VOID\r | |
736 | );\r | |
737 | \r | |
83d26a81 | 738 | /**\r |
739 | Disable the setup browser reset reminder feature.\r | |
740 | This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.\r | |
741 | \r | |
742 | **/\r | |
93e3992d | 743 | VOID\r |
83d26a81 | 744 | EFIAPI\r |
93e3992d | 745 | DisableResetReminderFeature (\r |
746 | VOID\r | |
747 | );\r | |
748 | \r | |
83d26a81 | 749 | /**\r |
750 | Record the info that a reset is required.\r | |
751 | A module boolean variable is used to record whether a reset is required.\r | |
752 | \r | |
753 | **/\r | |
93e3992d | 754 | VOID\r |
83d26a81 | 755 | EFIAPI\r |
93e3992d | 756 | EnableResetRequired (\r |
757 | VOID\r | |
758 | );\r | |
759 | \r | |
83d26a81 | 760 | \r |
761 | /**\r | |
762 | Record the info that no reset is required.\r | |
763 | A module boolean variable is used to record whether a reset is required.\r | |
764 | \r | |
765 | **/\r | |
93e3992d | 766 | VOID\r |
83d26a81 | 767 | EFIAPI\r |
93e3992d | 768 | DisableResetRequired (\r |
769 | VOID\r | |
770 | );\r | |
771 | \r | |
83d26a81 | 772 | /**\r |
773 | Check whether platform policy enable the reset reminder feature. The default is enabled.\r | |
774 | \r | |
775 | **/\r | |
93e3992d | 776 | BOOLEAN\r |
83d26a81 | 777 | EFIAPI\r |
93e3992d | 778 | IsResetReminderFeatureEnable (\r |
779 | VOID\r | |
780 | );\r | |
781 | \r | |
83d26a81 | 782 | /**\r |
783 | Check if user changed any option setting which needs a system reset to be effective.\r | |
784 | \r | |
785 | **/\r | |
93e3992d | 786 | BOOLEAN\r |
83d26a81 | 787 | EFIAPI\r |
93e3992d | 788 | IsResetRequired (\r |
789 | VOID\r | |
790 | );\r | |
791 | \r | |
83d26a81 | 792 | /**\r |
793 | Check whether a reset is needed, and finish the reset reminder feature.\r | |
794 | If a reset is needed, Popup a menu to notice user, and finish the feature\r | |
795 | according to the user selection.\r | |
796 | \r | |
797 | **/\r | |
93e3992d | 798 | VOID\r |
83d26a81 | 799 | EFIAPI\r |
93e3992d | 800 | SetupResetReminder (\r |
801 | VOID\r | |
802 | );\r | |
803 | \r | |
83d26a81 | 804 | \r |
805 | /**\r | |
806 | Get the headers (dos, image, optional header) from an image\r | |
807 | \r | |
808 | @param Device SimpleFileSystem device handle\r | |
809 | @param FileName File name for the image\r | |
810 | @param DosHeader Pointer to dos header\r | |
5f597758 | 811 | @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r |
83d26a81 | 812 | \r |
813 | @retval EFI_SUCCESS Successfully get the machine type.\r | |
814 | @retval EFI_NOT_FOUND The file is not found.\r | |
815 | @retval EFI_LOAD_ERROR File is not a valid image file.\r | |
816 | \r | |
817 | **/\r | |
93e3992d | 818 | EFI_STATUS\r |
83d26a81 | 819 | EFIAPI\r |
93e3992d | 820 | BdsLibGetImageHeader (\r |
821 | IN EFI_HANDLE Device,\r | |
822 | IN CHAR16 *FileName,\r | |
823 | OUT EFI_IMAGE_DOS_HEADER *DosHeader,\r | |
824 | OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr\r | |
93e3992d | 825 | );\r |
83d26a81 | 826 | \r |
93e3992d | 827 | //\r |
828 | // Define the boot type which to classify the boot option type\r | |
829 | // Different boot option type could have different boot behavior\r | |
830 | // Use their device path node (Type + SubType) as type value\r | |
831 | // The boot type here can be added according to requirement\r | |
832 | //\r | |
833 | //\r | |
834 | // ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value\r | |
835 | //\r | |
836 | #define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201\r | |
837 | //\r | |
838 | // Message boot type\r | |
839 | // If a device path of boot option only point to a message node, the boot option is message boot type\r | |
840 | //\r | |
841 | #define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01\r | |
842 | #define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02\r | |
843 | #define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05\r | |
844 | #define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF\r | |
845 | //\r | |
846 | // Media boot type\r | |
847 | // If a device path of boot option contain a media node, the boot option is media boot type\r | |
848 | //\r | |
849 | #define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01\r | |
850 | #define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02\r | |
851 | //\r | |
852 | // BBS boot type\r | |
853 | // If a device path of boot option contain a BBS node, the boot option is BBS boot type\r | |
854 | //\r | |
855 | #define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01\r | |
856 | \r | |
857 | #define BDS_EFI_UNSUPPORT 0xFFFF\r | |
858 | \r | |
859 | //\r | |
860 | // USB host controller Programming Interface.\r | |
861 | //\r | |
862 | #define PCI_CLASSC_PI_UHCI 0x00\r | |
863 | #define PCI_CLASSC_PI_EHCI 0x20\r | |
864 | \r | |
83d26a81 | 865 | /**\r |
866 | Check whether there is a instance in BlockIoDevicePath, which contain multi device path\r | |
867 | instances, has the same partition node with HardDriveDevicePath device path\r | |
868 | \r | |
869 | @param BlockIoDevicePath Multi device path instances which need to check\r | |
870 | @param HardDriveDevicePath A device path which starts with a hard drive media\r | |
871 | device path.\r | |
872 | \r | |
5f597758 LG |
873 | @retval TRUE There is a matched device path instance.\r |
874 | @retval FALSE There is no matched device path instance.\r | |
83d26a81 | 875 | \r |
876 | **/\r | |
93e3992d | 877 | BOOLEAN\r |
83d26a81 | 878 | EFIAPI\r |
93e3992d | 879 | MatchPartitionDevicePathNode (\r |
880 | IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath,\r | |
881 | IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r | |
882 | );\r | |
83d26a81 | 883 | \r |
884 | \r | |
885 | /**\r | |
886 | Expand a device path that starts with a hard drive media device path node to be a\r | |
887 | full device path that includes the full hardware path to the device. We need\r | |
888 | to do this so it can be booted. As an optimizaiton the front match (the part point\r | |
889 | to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ) is saved in a variable\r | |
890 | so a connect all is not required on every boot. All successful history device path\r | |
891 | which point to partition node (the front part) will be saved.\r | |
892 | \r | |
893 | @param HardDriveDevicePath EFI Device Path to boot, if it starts with a hard\r | |
894 | drive media device path.\r | |
895 | @return A Pointer to the full device path or NULL if a valid Hard Drive devic path\r | |
896 | cannot be found.\r | |
897 | \r | |
898 | **/\r | |
93e3992d | 899 | EFI_DEVICE_PATH_PROTOCOL *\r |
83d26a81 | 900 | EFIAPI\r |
93e3992d | 901 | BdsExpandPartitionPartialDevicePathToFull (\r |
902 | IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r | |
903 | );\r | |
904 | \r | |
83d26a81 | 905 | /**\r |
906 | Return the bootable media handle.\r | |
907 | First, check the device is connected\r | |
908 | Second, check whether the device path point to a device which support SimpleFileSystemProtocol,\r | |
909 | Third, detect the the default boot file in the Media, and return the removable Media handle.\r | |
910 | \r | |
911 | @param DevicePath Device Path to a bootable device\r | |
912 | \r | |
83d26a81 | 913 | @retval NULL The media on the DevicePath is not bootable\r |
914 | \r | |
915 | **/\r | |
93e3992d | 916 | EFI_HANDLE\r |
83d26a81 | 917 | EFIAPI\r |
93e3992d | 918 | BdsLibGetBootableHandle (\r |
919 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
920 | );\r | |
921 | \r | |
83d26a81 | 922 | \r |
923 | /**\r | |
924 | Check whether the Device path in a boot option point to a valide bootable device,\r | |
925 | And if CheckMedia is true, check the device is ready to boot now.\r | |
926 | \r | |
5f597758 LG |
927 | @param DevPath the Device path in a boot option\r |
928 | @param CheckMedia if true, check the device is ready to boot now.\r | |
83d26a81 | 929 | \r |
5f597758 LG |
930 | @retval TRUE the Device path is valide\r |
931 | @retval FALSE the Device path is invalide .\r | |
83d26a81 | 932 | \r |
933 | **/\r | |
93e3992d | 934 | BOOLEAN\r |
83d26a81 | 935 | EFIAPI\r |
93e3992d | 936 | BdsLibIsValidEFIBootOptDevicePath (\r |
937 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath,\r | |
938 | IN BOOLEAN CheckMedia\r | |
939 | );\r | |
940 | \r | |
83d26a81 | 941 | /**\r |
5f597758 | 942 | For a bootable Device path, return its boot type.\r |
83d26a81 | 943 | \r |
944 | @param DevicePath The bootable device Path to check\r | |
945 | \r | |
946 | @retval BDS_EFI_MEDIA_HD_BOOT If the device path contains any media deviec path node, it is media boot type\r | |
947 | For the floppy node, handle it as media node\r | |
948 | @retval BDS_EFI_MEDIA_CDROM_BOOT If the device path contains any media deviec path node, it is media boot type\r | |
949 | For the floppy node, handle it as media node\r | |
950 | @retval BDS_EFI_ACPI_FLOPPY_BOOT If the device path contains any media deviec path node, it is media boot type\r | |
951 | For the floppy node, handle it as media node\r | |
952 | @retval BDS_EFI_MESSAGE_ATAPI_BOOT If the device path not contains any media deviec path node, and\r | |
953 | its last device path node point to a message device path node, it is\r | |
954 | \r | |
955 | @retval BDS_EFI_MESSAGE_SCSI_BOOT If the device path not contains any media deviec path node, and\r | |
956 | its last device path node point to a message device path node, it is\r | |
957 | @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT If the device path not contains any media deviec path node, and\r | |
958 | its last device path node point to a message device path node, it is\r | |
959 | @retval BDS_EFI_MESSAGE_MISC_BOOT If the device path not contains any media deviec path node, and\r | |
960 | its last device path node point to a message device path node, it is\r | |
961 | @retval BDS_LEGACY_BBS_BOOT Legacy boot type\r | |
962 | @retval BDS_EFI_UNSUPPORT An EFI Removable BlockIO device path not point to a media and message devie, \r | |
963 | \r | |
964 | **/\r | |
93e3992d | 965 | UINT32\r |
83d26a81 | 966 | EFIAPI\r |
93e3992d | 967 | BdsGetBootTypeFromDevicePath (\r |
968 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
969 | );\r | |
83d26a81 | 970 | \r |
971 | \r | |
972 | /**\r | |
5f597758 LG |
973 | This routine register a function to adjust the different type memory page number\r |
974 | just before booting and save the updated info into the variable for next boot to use.\r | |
83d26a81 | 975 | \r |
976 | **/\r | |
93e3992d | 977 | VOID\r |
978 | EFIAPI\r | |
979 | BdsLibSaveMemoryTypeInformation (\r | |
83d26a81 | 980 | VOID\r |
93e3992d | 981 | );\r |
982 | \r | |
83d26a81 | 983 | \r |
984 | /**\r | |
985 | According to a file guild, check a Fv file device path is valid. If it is invalid,\r | |
986 | try to return the valid device path.\r | |
987 | FV address maybe changes for memory layout adjust from time to time, use this funciton\r | |
988 | could promise the Fv file device path is right.\r | |
989 | \r | |
990 | @param DevicePath on input, the Fv file device path need to check on\r | |
991 | output, the updated valid Fv file device path\r | |
992 | @param FileGuid the Fv file guild\r | |
993 | \r | |
994 | @retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid\r | |
995 | parameter\r | |
996 | @retval EFI_UNSUPPORTED the input DevicePath does not contain Fv file\r | |
997 | guild at all\r | |
998 | @retval EFI_ALREADY_STARTED the input DevicePath has pointed to Fv file, it is\r | |
999 | valid\r | |
1000 | @retval EFI_SUCCESS has successfully updated the invalid DevicePath,\r | |
1001 | and return the updated device path in DevicePath\r | |
1002 | \r | |
1003 | **/\r | |
93e3992d | 1004 | EFI_STATUS\r |
1005 | EFIAPI\r | |
1006 | BdsLibUpdateFvFileDevicePath (\r | |
1007 | IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,\r | |
1008 | IN EFI_GUID *FileGuid\r | |
1009 | );\r | |
1010 | \r | |
83d26a81 | 1011 | \r |
1012 | /**\r | |
1013 | Connect the specific Usb device which match the short form device path,\r | |
1014 | and whose bus is determined by Host Controller (Uhci or Ehci)\r | |
1015 | \r | |
1016 | @param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci\r | |
1017 | (0xFF)\r | |
1018 | @param RemainingDevicePath a short-form device path that starts with the first\r | |
5f597758 | 1019 | element being a USB WWID or a USB Class device\r |
83d26a81 | 1020 | path\r |
1021 | \r | |
5f597758 LG |
1022 | @retval EFI_SUCCESS The specific Usb device is connected successfully.\r |
1023 | @retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF) \r | |
1024 | or RemainingDevicePath is not the USB class device path.\r | |
1025 | @retval EFI_NOT_FOUND The device specified by device path is not found.\r | |
83d26a81 | 1026 | \r |
1027 | **/\r | |
93e3992d | 1028 | EFI_STATUS\r |
83d26a81 | 1029 | EFIAPI\r |
1030 | BdsLibConnectUsbDevByShortFormDP(\r | |
25ca163d | 1031 | IN UINT8 HostControllerPI,\r |
93e3992d | 1032 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r |
1033 | );\r | |
1034 | \r | |
93e3992d | 1035 | \r |
1036 | //\r | |
1037 | // The implementation of this function is provided by Platform code.\r | |
1038 | //\r | |
83d26a81 | 1039 | /**\r |
5f597758 | 1040 | Convert Vendor device path to device name.\r |
83d26a81 | 1041 | \r |
1042 | @param Str The buffer store device name\r | |
1043 | @param DevPath Pointer to vendor device path\r | |
1044 | \r | |
83d26a81 | 1045 | **/\r |
93e3992d | 1046 | VOID\r |
83d26a81 | 1047 | EFIAPI\r |
93e3992d | 1048 | DevPathVendor (\r |
1049 | IN OUT POOL_PRINT *Str,\r | |
1050 | IN VOID *DevPath\r | |
1051 | )\r | |
1052 | ;\r | |
1053 | \r | |
83d26a81 | 1054 | /**\r |
1055 | Concatenates a formatted unicode string to allocated pool.\r | |
1056 | The caller must free the resulting buffer.\r | |
1057 | \r | |
5f597758 | 1058 | @param Str Tracks the allocated pool, size in use, and amount of pool allocated.\r |
83d26a81 | 1059 | @param fmt The format string\r |
5f597758 | 1060 | @param ... The data will be printed.\r |
83d26a81 | 1061 | \r |
1062 | @return Allocated buffer with the formatted string printed in it.\r | |
5f597758 LG |
1063 | The caller must free the allocated buffer.\r |
1064 | The buffer allocation is not packed.\r | |
83d26a81 | 1065 | \r |
1066 | **/\r | |
93e3992d | 1067 | CHAR16 *\r |
83d26a81 | 1068 | EFIAPI\r |
93e3992d | 1069 | CatPrint (\r |
1070 | IN OUT POOL_PRINT *Str,\r | |
1071 | IN CHAR16 *fmt,\r | |
1072 | ...\r | |
1073 | )\r | |
1074 | ;\r | |
d1d249a7 | 1075 | #endif\r |
1076 | \r |