#define _VIRTIO_GPU_DXE_H_\r
\r
#include <IndustryStandard/VirtioGpu.h>\r
+#include <Library/BaseMemoryLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/UefiLib.h>\r
#include <Protocol/GraphicsOutput.h>\r
//\r
UINT32 *BackingStore;\r
UINTN NumberOfPages;\r
+\r
+ //\r
+ // Token associated with BackingStore's mapping for bus master common\r
+ // buffer operation. BackingStoreMap is valid if, and only if,\r
+ // BackingStore is non-NULL.\r
+ //\r
+ VOID *BackingStoreMap;\r
};\r
\r
//\r
IN OUT VGPU_DEV *VgpuDev\r
);\r
\r
+/**\r
+ Allocate, zero and map memory, for bus master common buffer operation, to be\r
+ attached as backing store to a host-side VirtIo GPU resource.\r
+\r
+ @param[in] VgpuDev The VGPU_DEV object that represents the VirtIo GPU\r
+ device.\r
+\r
+ @param[in] NumberOfPages The number of whole pages to allocate and map.\r
+\r
+ @param[out] HostAddress The system memory address of the allocated area.\r
+\r
+ @param[out] DeviceAddress The bus master device address of the allocated\r
+ area. The VirtIo GPU device may be programmed to\r
+ access the allocated area through DeviceAddress;\r
+ DeviceAddress is to be passed to the\r
+ VirtioGpuResourceAttachBacking() function, as the\r
+ BackingStoreDeviceAddress parameter.\r
+\r
+ @param[out] Mapping A resulting token to pass to\r
+ VirtioGpuUnmapAndFreeBackingStore().\r
+\r
+ @retval EFI_SUCCESS The requested number of pages has been allocated, zeroed\r
+ and mapped.\r
+\r
+ @return Status codes propagated from\r
+ VgpuDev->VirtIo->AllocateSharedPages() and\r
+ VirtioMapAllBytesInSharedBuffer().\r
+**/\r
+EFI_STATUS\r
+VirtioGpuAllocateZeroAndMapBackingStore (\r
+ IN VGPU_DEV *VgpuDev,\r
+ IN UINTN NumberOfPages,\r
+ OUT VOID **HostAddress,\r
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
+ OUT VOID **Mapping\r
+ );\r
+\r
+/**\r
+ Unmap and free memory originally allocated and mapped with\r
+ VirtioGpuAllocateZeroAndMapBackingStore().\r
+\r
+ If the memory allocated and mapped with\r
+ VirtioGpuAllocateZeroAndMapBackingStore() was attached to a host-side VirtIo\r
+ GPU resource with VirtioGpuResourceAttachBacking(), then the caller is\r
+ responsible for detaching the backing store from the same resource, with\r
+ VirtioGpuResourceDetachBacking(), before calling this function.\r
+\r
+ @param[in] VgpuDev The VGPU_DEV object that represents the VirtIo GPU\r
+ device.\r
+\r
+ @param[in] NumberOfPages The NumberOfPages parameter originally passed to\r
+ VirtioGpuAllocateZeroAndMapBackingStore().\r
+\r
+ @param[in] HostAddress The HostAddress value originally output by\r
+ VirtioGpuAllocateZeroAndMapBackingStore().\r
+\r
+ @param[in] Mapping The token that was originally output by\r
+ VirtioGpuAllocateZeroAndMapBackingStore().\r
+**/\r
+VOID\r
+VirtioGpuUnmapAndFreeBackingStore (\r
+ IN VGPU_DEV *VgpuDev,\r
+ IN UINTN NumberOfPages,\r
+ IN VOID *HostAddress,\r
+ IN VOID *Mapping\r
+ );\r
+\r
/**\r
EFI_EVENT_NOTIFY function for the VGPU_DEV.ExitBoot event. It resets the\r
VirtIo device, causing it to release its resources and to forget its\r
\r
EFI_STATUS\r
VirtioGpuResourceAttachBacking (\r
- IN OUT VGPU_DEV *VgpuDev,\r
- IN UINT32 ResourceId,\r
- IN VOID *FirstBackingPage,\r
- IN UINTN NumberOfPages\r
+ IN OUT VGPU_DEV *VgpuDev,\r
+ IN UINT32 ResourceId,\r
+ IN EFI_PHYSICAL_ADDRESS BackingStoreDeviceAddress,\r
+ IN UINTN NumberOfPages\r
);\r
\r
EFI_STATUS\r