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