]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/QemuBootOrderLib.h
OvmfPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuBootOrderLib.h
1 /** @file
2 Rewrite the BootOrder NvVar based on QEMU's "bootorder" fw_cfg file --
3 include file.
4
5 Copyright (C) 2012-2014, Red Hat, Inc.
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8 **/
9
10 #ifndef __QEMU_BOOT_ORDER_LIB_H__
11 #define __QEMU_BOOT_ORDER_LIB_H__
12
13 #include <Uefi/UefiBaseType.h>
14 #include <Base.h>
15
16
17 /**
18 Connect devices based on the boot order retrieved from QEMU.
19
20 Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the
21 OpenFirmware device paths therein to UEFI device path fragments. Connect the
22 devices identified by the UEFI devpath prefixes as narrowly as possible, then
23 connect all their child devices, recursively.
24
25 If this function fails, then platform BDS should fall back to
26 EfiBootManagerConnectAll(), or some other method for connecting any expected
27 boot devices.
28
29 @retval RETURN_SUCCESS The "bootorder" fw_cfg file has been
30 parsed, and the referenced device-subtrees
31 have been connected.
32
33 @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported.
34
35 @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg
36 file.
37
38 @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg file.
39
40 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.
41
42 @return Error statuses propagated from underlying
43 functions.
44 **/
45 RETURN_STATUS
46 EFIAPI
47 ConnectDevicesFromQemu (
48 VOID
49 );
50
51
52 /**
53
54 Set the boot order based on configuration retrieved from QEMU.
55
56 Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the
57 OpenFirmware device paths therein to UEFI device path fragments. Match the
58 translated fragments against the current list of boot options, and rewrite
59 the BootOrder NvVar so that it corresponds to the order described in fw_cfg.
60
61 Platform BDS should call this function after connecting any expected boot
62 devices and calling EfiBootManagerRefreshAllBootOption ().
63
64 @retval RETURN_SUCCESS BootOrder NvVar rewritten.
65
66 @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported.
67
68 @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg
69 file, or no match found between the
70 "bootorder" fw_cfg file and BootOptionList.
71
72 @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg file.
73
74 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.
75
76 @return Values returned by gBS->LocateProtocol ()
77 or gRT->SetVariable ().
78
79 **/
80 RETURN_STATUS
81 EFIAPI
82 SetBootOrderFromQemu (
83 VOID
84 );
85
86
87 /**
88 Calculate the number of seconds we should be showing the FrontPage progress
89 bar for.
90
91 @return The TimeoutDefault argument for PlatformBdsEnterFrontPage().
92 **/
93 UINT16
94 EFIAPI
95 GetFrontPageTimeoutFromQemu (
96 VOID
97 );
98
99 #endif