]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/QemuLoadImageLib.h
OvmfPkg: introduce QemuLoadImageLib library class
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuLoadImageLib.h
1 /** @file
2 Load a kernel image and command line passed to QEMU via
3 the command line
4
5 Copyright (C) 2020, Arm, Limited.
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8 **/
9
10 #ifndef QEMU_LOAD_IMAGE_LIB_H__
11 #define QEMU_LOAD_IMAGE_LIB_H__
12
13 #include <Uefi/UefiBaseType.h>
14 #include <Base.h>
15
16 #include <Protocol/LoadedImage.h>
17
18 /**
19 Download the kernel, the initial ramdisk, and the kernel command line from
20 QEMU's fw_cfg. The kernel will be instructed via its command line to load
21 the initrd from the same Simple FileSystem where the kernel was loaded from.
22
23 @param[out] ImageHandle The image handle that was allocated for
24 loading the image
25
26 @retval EFI_SUCCESS The image was loaded successfully.
27 @retval EFI_NOT_FOUND Kernel image was not found.
28 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
29 @retval EFI_PROTOCOL_ERROR Unterminated kernel command line.
30 @retval EFI_ACCESS_DENIED The underlying LoadImage boot service call
31 returned EFI_SECURITY_VIOLATION, and the image
32 was unloaded again.
33
34 @return Error codes from any of the underlying
35 functions.
36 **/
37 EFI_STATUS
38 EFIAPI
39 QemuLoadKernelImage (
40 OUT EFI_HANDLE *ImageHandle
41 );
42
43 /**
44 Transfer control to a kernel image loaded with QemuLoadKernelImage ()
45
46 @param[in,out] ImageHandle Handle of image to be started. May assume a
47 different value on return if the image was
48 reloaded.
49
50 @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle
51 or the image has already been initialized with
52 StartImage
53 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the
54 image should not be started.
55
56 @return Error codes returned by the started image.
57 On success, the function doesn't return.
58 **/
59 EFI_STATUS
60 EFIAPI
61 QemuStartKernelImage (
62 IN OUT EFI_HANDLE *ImageHandle
63 );
64
65 /**
66 Unloads an image loaded with QemuLoadKernelImage ().
67
68 @param ImageHandle Handle that identifies the image to be
69 unloaded.
70
71 @retval EFI_SUCCESS The image has been unloaded.
72 @retval EFI_UNSUPPORTED The image has been started, and does not
73 support unload.
74 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
75
76 @return Exit code from the image's unload function.
77 **/
78 EFI_STATUS
79 EFIAPI
80 QemuUnloadKernelImage (
81 IN EFI_HANDLE ImageHandle
82 );
83
84 #endif