--- /dev/null
+/** @file\r
+ Load a kernel image and command line passed to QEMU via\r
+ the command line\r
+\r
+ Copyright (C) 2020, Arm, Limited.\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#ifndef QEMU_LOAD_IMAGE_LIB_H__\r
+#define QEMU_LOAD_IMAGE_LIB_H__\r
+\r
+#include <Uefi/UefiBaseType.h>\r
+#include <Base.h>\r
+\r
+#include <Protocol/LoadedImage.h>\r
+\r
+/**\r
+ Download the kernel, the initial ramdisk, and the kernel command line from\r
+ QEMU's fw_cfg. The kernel will be instructed via its command line to load\r
+ the initrd from the same Simple FileSystem where the kernel was loaded from.\r
+\r
+ @param[out] ImageHandle The image handle that was allocated for\r
+ loading the image\r
+\r
+ @retval EFI_SUCCESS The image was loaded successfully.\r
+ @retval EFI_NOT_FOUND Kernel image was not found.\r
+ @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
+ @retval EFI_PROTOCOL_ERROR Unterminated kernel command line.\r
+ @retval EFI_ACCESS_DENIED The underlying LoadImage boot service call\r
+ returned EFI_SECURITY_VIOLATION, and the image\r
+ was unloaded again.\r
+\r
+ @return Error codes from any of the underlying\r
+ functions.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+QemuLoadKernelImage (\r
+ OUT EFI_HANDLE *ImageHandle\r
+ );\r
+\r
+/**\r
+ Transfer control to a kernel image loaded with QemuLoadKernelImage ()\r
+\r
+ @param[in,out] ImageHandle Handle of image to be started. May assume a\r
+ different value on return if the image was\r
+ reloaded.\r
+\r
+ @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle\r
+ or the image has already been initialized with\r
+ StartImage\r
+ @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the\r
+ image should not be started.\r
+\r
+ @return Error codes returned by the started image.\r
+ On success, the function doesn't return.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+QemuStartKernelImage (\r
+ IN OUT EFI_HANDLE *ImageHandle\r
+ );\r
+\r
+/**\r
+ Unloads an image loaded with QemuLoadKernelImage ().\r
+\r
+ @param ImageHandle Handle that identifies the image to be\r
+ unloaded.\r
+\r
+ @retval EFI_SUCCESS The image has been unloaded.\r
+ @retval EFI_UNSUPPORTED The image has been started, and does not\r
+ support unload.\r
+ @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r
+\r
+ @return Exit code from the image's unload function.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+QemuUnloadKernelImage (\r
+ IN EFI_HANDLE ImageHandle\r
+ );\r
+\r
+#endif\r