OvmfPkg/QemuBootOrderLib: add ConnectDevicesFromQemu()
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuBootOrderLib.h
CommitLineData
2cd086a6 1/** @file\r
2 Rewrite the BootOrder NvVar based on QEMU's "bootorder" fw_cfg file --\r
3 include file.\r
4\r
cca7475b 5 Copyright (C) 2012-2014, Red Hat, Inc.\r
2cd086a6 6\r
7 This program and the accompanying materials are licensed and made available\r
8 under the terms and conditions of the BSD License which accompanies this\r
9 distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14**/\r
15\r
cca7475b
LE
16#ifndef __QEMU_BOOT_ORDER_LIB_H__\r
17#define __QEMU_BOOT_ORDER_LIB_H__\r
2cd086a6 18\r
19#include <Uefi/UefiBaseType.h>\r
20#include <Base.h>\r
21\r
22\r
51bd1f76
LE
23/**\r
24 Connect devices based on the boot order retrieved from QEMU.\r
25\r
26 Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the\r
27 OpenFirmware device paths therein to UEFI device path fragments. Connect the\r
28 devices identified by the UEFI devpath prefixes as narrowly as possible, then\r
29 connect all their child devices, recursively.\r
30\r
31 If this function fails, then platform BDS should fall back to\r
32 EfiBootManagerConnectAll(), or some other method for connecting any expected\r
33 boot devices.\r
34\r
35 @retval RETURN_SUCCESS The "bootorder" fw_cfg file has been\r
36 parsed, and the referenced device-subtrees\r
37 have been connected.\r
38\r
39 @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported.\r
40\r
41 @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg\r
42 file.\r
43\r
44 @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg file.\r
45\r
46 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r
47\r
48 @return Error statuses propagated from underlying\r
49 functions.\r
50**/\r
51RETURN_STATUS\r
52EFIAPI\r
53ConnectDevicesFromQemu (\r
54 VOID\r
55 );\r
56\r
57\r
2cd086a6 58/**\r
59\r
60 Set the boot order based on configuration retrieved from QEMU.\r
61\r
62 Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the\r
63 OpenFirmware device paths therein to UEFI device path fragments. Match the\r
2542feea
LE
64 translated fragments against the current list of boot options, and rewrite\r
65 the BootOrder NvVar so that it corresponds to the order described in fw_cfg.\r
2cd086a6 66\r
51bd1f76
LE
67 Platform BDS should call this function after connecting any expected boot\r
68 devices and calling EfiBootManagerRefreshAllBootOption ().\r
2cd086a6 69\r
70 @retval RETURN_SUCCESS BootOrder NvVar rewritten.\r
71\r
72 @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported.\r
73\r
74 @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg\r
75 file, or no match found between the\r
76 "bootorder" fw_cfg file and BootOptionList.\r
77\r
78 @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg file.\r
79\r
80 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r
81\r
82 @return Values returned by gBS->LocateProtocol ()\r
83 or gRT->SetVariable ().\r
84\r
85**/\r
86RETURN_STATUS\r
5851b825 87EFIAPI\r
2cd086a6 88SetBootOrderFromQemu (\r
2542feea 89 VOID\r
2cd086a6 90 );\r
cca7475b 91\r
9253c14d
LE
92\r
93/**\r
94 Calculate the number of seconds we should be showing the FrontPage progress\r
95 bar for.\r
96\r
97 @return The TimeoutDefault argument for PlatformBdsEnterFrontPage().\r
98**/\r
99UINT16\r
5851b825 100EFIAPI\r
9253c14d
LE
101GetFrontPageTimeoutFromQemu (\r
102 VOID\r
103 );\r
104\r
cca7475b 105#endif\r