TianoCore EDK2 master
Loading...
Searching...
No Matches
X86QemuLoadImageLib.c File Reference

Go to the source code of this file.

Data Structures

struct  KERNEL_FILE_DEVPATH
 
struct  KERNEL_VENMEDIA_FILE_DEVPATH
 

Functions

STATIC VOID FreeLegacyImage (IN OVMF_LOADED_X86_LINUX_KERNEL *LoadedImage)
 
STATIC EFI_STATUS QemuLoadLegacyImage (OUT EFI_HANDLE *ImageHandle)
 
STATIC EFI_STATUS QemuStartLegacyImage (IN EFI_HANDLE ImageHandle)
 
STATIC EFI_STATUS QemuUnloadLegacyImage (IN EFI_HANDLE ImageHandle)
 
EFI_STATUS EFIAPI QemuLoadKernelImage (OUT EFI_HANDLE *ImageHandle)
 
EFI_STATUS EFIAPI QemuStartKernelImage (IN OUT EFI_HANDLE *ImageHandle)
 
EFI_STATUS EFIAPI QemuUnloadKernelImage (IN EFI_HANDLE ImageHandle)
 

Variables

STATIC CONST KERNEL_VENMEDIA_FILE_DEVPATH mKernelDevicePath
 

Detailed Description

X86 specific implementation of QemuLoadImageLib library class interface with support for loading mixed mode images and non-EFI stub images

Note that this implementation reads the cmdline (and possibly kernel, setup data, and initrd in the legacy boot mode) from fw_cfg directly.

Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
Copyright (c) 2020, ARM Ltd. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file X86QemuLoadImageLib.c.

Function Documentation

◆ FreeLegacyImage()

STATIC VOID FreeLegacyImage ( IN OVMF_LOADED_X86_LINUX_KERNEL LoadedImage)

Definition at line 62 of file X86QemuLoadImageLib.c.

◆ QemuLoadKernelImage()

EFI_STATUS EFIAPI QemuLoadKernelImage ( OUT EFI_HANDLE ImageHandle)

Download the kernel, the initial ramdisk, and the kernel command line from QEMU's fw_cfg. The kernel will be instructed via its command line to load the initrd from the same Simple FileSystem where the kernel was loaded from.

Parameters
[out]ImageHandleThe image handle that was allocated for loading the image
Return values
EFI_SUCCESSThe image was loaded successfully.
EFI_NOT_FOUNDKernel image was not found.
EFI_OUT_OF_RESOURCESMemory allocation failed.
EFI_PROTOCOL_ERRORUnterminated kernel command line.
Returns
Error codes from any of the underlying functions.

Definition at line 332 of file X86QemuLoadImageLib.c.

◆ QemuLoadLegacyImage()

STATIC EFI_STATUS QemuLoadLegacyImage ( OUT EFI_HANDLE ImageHandle)

Definition at line 97 of file X86QemuLoadImageLib.c.

◆ QemuStartKernelImage()

EFI_STATUS EFIAPI QemuStartKernelImage ( IN OUT EFI_HANDLE ImageHandle)

Transfer control to a kernel image loaded with QemuLoadKernelImage ()

Parameters
[in,out]ImageHandleHandle of image to be started. May assume a different value on return if the image was reloaded.
Return values
EFI_INVALID_PARAMETERImageHandle is either an invalid image handle or the image has already been initialized with StartImage
EFI_SECURITY_VIOLATIONThe current platform policy specifies that the image should not be started.
Returns
Error codes returned by the started image

Definition at line 533 of file X86QemuLoadImageLib.c.

◆ QemuStartLegacyImage()

STATIC EFI_STATUS QemuStartLegacyImage ( IN EFI_HANDLE  ImageHandle)

Definition at line 259 of file X86QemuLoadImageLib.c.

◆ QemuUnloadKernelImage()

EFI_STATUS EFIAPI QemuUnloadKernelImage ( IN EFI_HANDLE  ImageHandle)

Unloads an image loaded with QemuLoadKernelImage ().

Parameters
ImageHandleHandle that identifies the image to be unloaded.
Return values
EFI_SUCCESSThe image has been unloaded.
EFI_UNSUPPORTEDThe image has been started, and does not support unload.
EFI_INVALID_PARAMETERImageHandle is not a valid image handle.
Returns
Exit code from the image's unload function.

Definition at line 605 of file X86QemuLoadImageLib.c.

◆ QemuUnloadLegacyImage()

STATIC EFI_STATUS QemuUnloadLegacyImage ( IN EFI_HANDLE  ImageHandle)

Definition at line 283 of file X86QemuLoadImageLib.c.

Variable Documentation

◆ mKernelDevicePath

Initial value:
= {
{
{
MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,
{ sizeof (VENDOR_DEVICE_PATH) }
},
QEMU_KERNEL_LOADER_FS_MEDIA_GUID
}, {
{
MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP,
{ sizeof (KERNEL_FILE_DEVPATH) }
},
L"kernel",
}, {
END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
}
}
#define MEDIA_FILEPATH_DP
Definition: DevicePath.h:1098
#define MEDIA_VENDOR_DP
Media vendor device path subtype.
Definition: DevicePath.h:1093

Definition at line 41 of file X86QemuLoadImageLib.c.