TianoCore EDK2 master
|
Go to the source code of this file.
Functions | |
EFI_STATUS | VirtioGpuInit (IN OUT VGPU_DEV *VgpuDev) |
VOID | VirtioGpuUninit (IN OUT VGPU_DEV *VgpuDev) |
EFI_STATUS | VirtioGpuAllocateZeroAndMapBackingStore (IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping) |
VOID | VirtioGpuUnmapAndFreeBackingStore (IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, IN VOID *HostAddress, IN VOID *Mapping) |
VOID EFIAPI | VirtioGpuExitBoot (IN EFI_EVENT Event, IN VOID *Context) |
STATIC EFI_STATUS | VirtioGpuSendCommandWithReply (IN OUT VGPU_DEV *VgpuDev, IN VIRTIO_GPU_CONTROL_TYPE RequestType, IN BOOLEAN Fence, IN OUT volatile VIRTIO_GPU_CONTROL_HEADER *Header, IN UINTN RequestSize, IN VIRTIO_GPU_CONTROL_TYPE ResponseType, IN OUT volatile VIRTIO_GPU_CONTROL_HEADER *Response, IN UINTN ResponseSize) |
STATIC EFI_STATUS | VirtioGpuSendCommand (IN OUT VGPU_DEV *VgpuDev, IN VIRTIO_GPU_CONTROL_TYPE RequestType, IN BOOLEAN Fence, IN OUT volatile VIRTIO_GPU_CONTROL_HEADER *Header, IN UINTN RequestSize) |
EFI_STATUS | VirtioGpuResourceCreate2d (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN VIRTIO_GPU_FORMATS Format, IN UINT32 Width, IN UINT32 Height) |
EFI_STATUS | VirtioGpuResourceUnref (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuResourceAttachBacking (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN EFI_PHYSICAL_ADDRESS BackingStoreDeviceAddress, IN UINTN NumberOfPages) |
EFI_STATUS | VirtioGpuResourceDetachBacking (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuSetScanout (IN OUT VGPU_DEV *VgpuDev, IN UINT32 X, IN UINT32 Y, IN UINT32 Width, IN UINT32 Height, IN UINT32 ScanoutId, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuTransferToHost2d (IN OUT VGPU_DEV *VgpuDev, IN UINT32 X, IN UINT32 Y, IN UINT32 Width, IN UINT32 Height, IN UINT64 Offset, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuResourceFlush (IN OUT VGPU_DEV *VgpuDev, IN UINT32 X, IN UINT32 Y, IN UINT32 Width, IN UINT32 Height, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuGetDisplayInfo (IN OUT VGPU_DEV *VgpuDev, volatile VIRTIO_GPU_RESP_DISPLAY_INFO *Response) |
VirtIo GPU initialization, and commands (primitives) for the GPU device.
Copyright (C) 2016, Red Hat, Inc. Copyright (c) 2017, AMD Inc, All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Commands.c.
EFI_STATUS VirtioGpuAllocateZeroAndMapBackingStore | ( | IN VGPU_DEV * | VgpuDev, |
IN UINTN | NumberOfPages, | ||
OUT VOID ** | HostAddress, | ||
OUT EFI_PHYSICAL_ADDRESS * | DeviceAddress, | ||
OUT VOID ** | Mapping | ||
) |
Allocate, zero and map memory, for bus master common buffer operation, to be attached as backing store to a host-side VirtIo GPU resource.
[in] | VgpuDev | The VGPU_DEV object that represents the VirtIo GPU device. |
[in] | NumberOfPages | The number of whole pages to allocate and map. |
[out] | HostAddress | The system memory address of the allocated area. |
[out] | DeviceAddress | The bus master device address of the allocated area. The VirtIo GPU device may be programmed to access the allocated area through DeviceAddress; DeviceAddress is to be passed to the VirtioGpuResourceAttachBacking() function, as the BackingStoreDeviceAddress parameter. |
[out] | Mapping | A resulting token to pass to VirtioGpuUnmapAndFreeBackingStore(). |
EFI_SUCCESS | The requested number of pages has been allocated, zeroed and mapped. |
Definition at line 244 of file Commands.c.
EFI_EVENT_NOTIFY function for the VGPU_DEV.ExitBoot event. It resets the VirtIo device, causing it to release its resources and to forget its configuration.
This function may only be called (that is, VGPU_DEV.ExitBoot may only be signaled) after VirtioGpuInit() returns and before VirtioGpuUninit() is called.
[in] | Event | Event whose notification function is being invoked. |
[in] | Context | Pointer to the associated VGPU_DEV object. |
Definition at line 350 of file Commands.c.
EFI_STATUS VirtioGpuGetDisplayInfo | ( | IN OUT VGPU_DEV * | VgpuDev, |
volatile VIRTIO_GPU_RESP_DISPLAY_INFO * | Response | ||
) |
Definition at line 833 of file Commands.c.
EFI_STATUS VirtioGpuInit | ( | IN OUT VGPU_DEV * | VgpuDev | ) |
Configure the VirtIo GPU device that underlies VgpuDev.
[in,out] | VgpuDev | The VGPU_DEV object to set up VirtIo messaging for. On input, the caller is responsible for having initialized VgpuDev->VirtIo. On output, VgpuDev->Ring has been initialized, and synchronous VirtIo GPU commands (primitives) can be submitted to the device. |
EFI_SUCCESS | VirtIo GPU configuration successful. |
EFI_UNSUPPORTED | The host-side configuration of the VirtIo GPU is not supported by this driver. |
Error | codes from underlying functions. |
Definition at line 33 of file Commands.c.
EFI_STATUS VirtioGpuResourceAttachBacking | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId, | ||
IN EFI_PHYSICAL_ADDRESS | BackingStoreDeviceAddress, | ||
IN UINTN | NumberOfPages | ||
) |
Definition at line 675 of file Commands.c.
EFI_STATUS VirtioGpuResourceCreate2d | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId, | ||
IN VIRTIO_GPU_FORMATS | Format, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height | ||
) |
The following functions send requests to the VirtIo GPU device model, await the answer from the host, and return a status. They share the following interface details:
[in,out] | VgpuDev | The VGPU_DEV object that represents the VirtIo GPU device. The caller is responsible to have successfully invoked VirtioGpuInit() on VgpuDev previously, while VirtioGpuUninit() must not have been called on VgpuDev. |
EFI_INVALID_PARAMETER | Invalid command-specific parameters were detected by this driver. |
EFI_SUCCESS | Operation successful. |
EFI_DEVICE_ERROR | The host rejected the request. The host error code has been logged on the DEBUG_ERROR level. |
For the command-specific parameters, please consult the GPU Device section of the VirtIo 1.0 specification (see references in "OvmfPkg/Include/IndustryStandard/VirtioGpu.h").
Definition at line 622 of file Commands.c.
EFI_STATUS VirtioGpuResourceDetachBacking | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId | ||
) |
Definition at line 704 of file Commands.c.
EFI_STATUS VirtioGpuResourceFlush | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | X, | ||
IN UINT32 | Y, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height, | ||
IN UINT32 | ResourceId | ||
) |
Definition at line 801 of file Commands.c.
EFI_STATUS VirtioGpuResourceUnref | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId | ||
) |
Definition at line 651 of file Commands.c.
STATIC EFI_STATUS VirtioGpuSendCommand | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN VIRTIO_GPU_CONTROL_TYPE | RequestType, | ||
IN BOOLEAN | Fence, | ||
IN OUT volatile VIRTIO_GPU_CONTROL_HEADER * | Header, | ||
IN UINTN | RequestSize | ||
) |
Simplified version of VirtioGpuSendCommandWithReply() for commands which do not send back any data.
Definition at line 573 of file Commands.c.
STATIC EFI_STATUS VirtioGpuSendCommandWithReply | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN VIRTIO_GPU_CONTROL_TYPE | RequestType, | ||
IN BOOLEAN | Fence, | ||
IN OUT volatile VIRTIO_GPU_CONTROL_HEADER * | Header, | ||
IN UINTN | RequestSize, | ||
IN VIRTIO_GPU_CONTROL_TYPE | ResponseType, | ||
IN OUT volatile VIRTIO_GPU_CONTROL_HEADER * | Response, | ||
IN UINTN | ResponseSize | ||
) |
Internal utility function that sends a request to the VirtIo GPU device model, awaits the answer from the host, and returns a status.
[in,out] | VgpuDev | The VGPU_DEV object that represents the VirtIo GPU device. The caller is responsible to have successfully invoked VirtioGpuInit() on VgpuDev previously, while VirtioGpuUninit() must not have been called on VgpuDev. |
[in] | RequestType | The type of the request. The caller is responsible for providing a VirtioGpuCmd* RequestType which, on success, elicits a VirtioGpuRespOkNodata response from the host. |
[in] | Fence | Whether to enable fencing for this request. Fencing forces the host to complete the command before producing a response. If Fence is TRUE, then VgpuDev->FenceId is consumed, and incremented. |
[in,out] | Header | Pointer to the caller-allocated request object. The request must start with VIRTIO_GPU_CONTROL_HEADER. This function overwrites all fields of Header before submitting the request to the host: |
[in] | RequestSize | Size of the entire caller-allocated request object, including the leading VIRTIO_GPU_CONTROL_HEADER. |
[in] | ResponseType | The type of the response (VirtioGpuResp*). |
[in,out] | Response | Pointer to the caller-allocated response object. The request must start with VIRTIO_GPU_CONTROL_HEADER. |
[in] | ResponseSize | Size of the entire caller-allocated response object, including the leading VIRTIO_GPU_CONTROL_HEADER. |
EFI_SUCCESS | Operation successful. |
EFI_DEVICE_ERROR | The host rejected the request. The host error code has been logged on the DEBUG_ERROR level. |
Definition at line 415 of file Commands.c.
EFI_STATUS VirtioGpuSetScanout | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | X, | ||
IN UINT32 | Y, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height, | ||
IN UINT32 | ScanoutId, | ||
IN UINT32 | ResourceId | ||
) |
Definition at line 734 of file Commands.c.
EFI_STATUS VirtioGpuTransferToHost2d | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | X, | ||
IN UINT32 | Y, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height, | ||
IN UINT64 | Offset, | ||
IN UINT32 | ResourceId | ||
) |
Definition at line 767 of file Commands.c.
De-configure the VirtIo GPU device that underlies VgpuDev.
[in,out] | VgpuDev | The VGPU_DEV object to tear down VirtIo messaging for. On input, the caller is responsible for having called VirtioGpuInit(). On output, VgpuDev->Ring has been uninitialized; VirtIo GPU commands (primitives) can no longer be submitted to the device. |
Definition at line 202 of file Commands.c.
VOID VirtioGpuUnmapAndFreeBackingStore | ( | IN VGPU_DEV * | VgpuDev, |
IN UINTN | NumberOfPages, | ||
IN VOID * | HostAddress, | ||
IN VOID * | Mapping | ||
) |
Unmap and free memory originally allocated and mapped with VirtioGpuAllocateZeroAndMapBackingStore().
If the memory allocated and mapped with VirtioGpuAllocateZeroAndMapBackingStore() was attached to a host-side VirtIo GPU resource with VirtioGpuResourceAttachBacking(), then the caller is responsible for detaching the backing store from the same resource, with VirtioGpuResourceDetachBacking(), before calling this function.
[in] | VgpuDev | The VGPU_DEV object that represents the VirtIo GPU device. |
[in] | NumberOfPages | The NumberOfPages parameter originally passed to VirtioGpuAllocateZeroAndMapBackingStore(). |
[in] | HostAddress | The HostAddress value originally output by VirtioGpuAllocateZeroAndMapBackingStore(). |
[in] | Mapping | The token that was originally output by VirtioGpuAllocateZeroAndMapBackingStore(). |
Definition at line 317 of file Commands.c.