Commit | Line | Data |
---|---|---|
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 |
b26f0cf9 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
2cd086a6 | 8 | **/\r |
9 | \r | |
cca7475b LE |
10 | #ifndef __QEMU_BOOT_ORDER_LIB_H__\r |
11 | #define __QEMU_BOOT_ORDER_LIB_H__\r | |
2cd086a6 | 12 | \r |
13 | #include <Uefi/UefiBaseType.h>\r | |
14 | #include <Base.h>\r | |
15 | \r | |
51bd1f76 LE |
16 | /**\r |
17 | Connect devices based on the boot order retrieved from QEMU.\r | |
18 | \r | |
19 | Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the\r | |
20 | OpenFirmware device paths therein to UEFI device path fragments. Connect the\r | |
21 | devices identified by the UEFI devpath prefixes as narrowly as possible, then\r | |
22 | connect all their child devices, recursively.\r | |
23 | \r | |
24 | If this function fails, then platform BDS should fall back to\r | |
25 | EfiBootManagerConnectAll(), or some other method for connecting any expected\r | |
26 | boot devices.\r | |
27 | \r | |
28 | @retval RETURN_SUCCESS The "bootorder" fw_cfg file has been\r | |
29 | parsed, and the referenced device-subtrees\r | |
30 | have been connected.\r | |
31 | \r | |
32 | @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported.\r | |
33 | \r | |
34 | @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg\r | |
35 | file.\r | |
36 | \r | |
37 | @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg file.\r | |
38 | \r | |
39 | @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r | |
40 | \r | |
41 | @return Error statuses propagated from underlying\r | |
42 | functions.\r | |
43 | **/\r | |
44 | RETURN_STATUS\r | |
45 | EFIAPI\r | |
46 | ConnectDevicesFromQemu (\r | |
47 | VOID\r | |
48 | );\r | |
49 | \r | |
5eeb088a GH |
50 | /**\r |
51 | Write qemu boot order to uefi variables.\r | |
52 | \r | |
53 | Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate\r | |
54 | the OpenFirmware device paths therein to UEFI device path fragments.\r | |
55 | \r | |
56 | On Success store the device path in QemuBootOrderNNNN variables.\r | |
57 | **/\r | |
58 | VOID\r | |
59 | EFIAPI\r | |
60 | StoreQemuBootOrder (\r | |
61 | VOID\r | |
62 | );\r | |
63 | \r | |
2cd086a6 | 64 | /**\r |
65 | \r | |
66 | Set the boot order based on configuration retrieved from QEMU.\r | |
67 | \r | |
68 | Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the\r | |
69 | OpenFirmware device paths therein to UEFI device path fragments. Match the\r | |
2542feea LE |
70 | translated fragments against the current list of boot options, and rewrite\r |
71 | the BootOrder NvVar so that it corresponds to the order described in fw_cfg.\r | |
2cd086a6 | 72 | \r |
51bd1f76 LE |
73 | Platform BDS should call this function after connecting any expected boot\r |
74 | devices and calling EfiBootManagerRefreshAllBootOption ().\r | |
2cd086a6 | 75 | \r |
76 | @retval RETURN_SUCCESS BootOrder NvVar rewritten.\r | |
77 | \r | |
78 | @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported.\r | |
79 | \r | |
80 | @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg\r | |
81 | file, or no match found between the\r | |
82 | "bootorder" fw_cfg file and BootOptionList.\r | |
83 | \r | |
84 | @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg file.\r | |
85 | \r | |
86 | @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r | |
87 | \r | |
88 | @return Values returned by gBS->LocateProtocol ()\r | |
89 | or gRT->SetVariable ().\r | |
90 | \r | |
91 | **/\r | |
92 | RETURN_STATUS\r | |
5851b825 | 93 | EFIAPI\r |
2cd086a6 | 94 | SetBootOrderFromQemu (\r |
2542feea | 95 | VOID\r |
2cd086a6 | 96 | );\r |
cca7475b | 97 | \r |
9253c14d LE |
98 | /**\r |
99 | Calculate the number of seconds we should be showing the FrontPage progress\r | |
100 | bar for.\r | |
101 | \r | |
102 | @return The TimeoutDefault argument for PlatformBdsEnterFrontPage().\r | |
103 | **/\r | |
104 | UINT16\r | |
5851b825 | 105 | EFIAPI\r |
9253c14d LE |
106 | GetFrontPageTimeoutFromQemu (\r |
107 | VOID\r | |
108 | );\r | |
109 | \r | |
cca7475b | 110 | #endif\r |