]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioFsDxe/VirtioFsDxe.h
OvmfPkg/VirtioFsDxe: add a scatter-gather list data type
[mirror_edk2.git] / OvmfPkg / VirtioFsDxe / VirtioFsDxe.h
index 2aae96ecd79ac3d0384d3b55e66efcb743fe4889..12acbd6dc35900a8b5d253e3dbf55de01f0c878d 100644 (file)
@@ -51,6 +51,52 @@ typedef struct {
 #define VIRTIO_FS_FROM_SIMPLE_FS(SimpleFsReference) \\r
   CR (SimpleFsReference, VIRTIO_FS, SimpleFs, VIRTIO_FS_SIG);\r
 \r
+//\r
+// Structure for describing a contiguous buffer, potentially mapped for Virtio\r
+// transfer.\r
+//\r
+typedef struct {\r
+  //\r
+  // The following fields originate from the owner of the buffer.\r
+  //\r
+  VOID  *Buffer;\r
+  UINTN Size;\r
+  //\r
+  // All of the fields below, until the end of the structure, are\r
+  // zero-initialized when the structure is initially validated.\r
+  //\r
+  // Mapped, MappedAddress and Mapping are updated when the buffer is mapped\r
+  // for VirtioOperationBusMasterRead or VirtioOperationBusMasterWrite. They\r
+  // are again updated when the buffer is unmapped.\r
+  //\r
+  BOOLEAN              Mapped;\r
+  EFI_PHYSICAL_ADDRESS MappedAddress;\r
+  VOID                 *Mapping;\r
+  //\r
+  // Transferred is updated after VirtioFlush() returns successfully:\r
+  // - for VirtioOperationBusMasterRead, Transferred is set to Size;\r
+  // - for VirtioOperationBusMasterWrite, Transferred is calculated from the\r
+  //   UsedLen output parameter of VirtioFlush().\r
+  //\r
+  UINTN Transferred;\r
+} VIRTIO_FS_IO_VECTOR;\r
+\r
+//\r
+// Structure for describing a list of IO Vectors.\r
+//\r
+typedef struct {\r
+  //\r
+  // The following fields originate from the owner of the buffers.\r
+  //\r
+  VIRTIO_FS_IO_VECTOR *IoVec;\r
+  UINTN               NumVec;\r
+  //\r
+  // TotalSize is calculated when the scatter-gather list is initially\r
+  // validated.\r
+  //\r
+  UINT32 TotalSize;\r
+} VIRTIO_FS_SCATTER_GATHER_LIST;\r
+\r
 //\r
 // Initialization and helper routines for the Virtio Filesystem device.\r
 //\r
@@ -72,6 +118,20 @@ VirtioFsExitBoot (
   IN VOID      *VirtioFsAsVoid\r
   );\r
 \r
+EFI_STATUS\r
+VirtioFsSgListsValidate (\r
+  IN     VIRTIO_FS                     *VirtioFs,\r
+  IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *RequestSgList,\r
+  IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *ResponseSgList OPTIONAL\r
+  );\r
+\r
+EFI_STATUS\r
+VirtioFsSgListsSubmit (\r
+  IN OUT VIRTIO_FS                     *VirtioFs,\r
+  IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *RequestSgList,\r
+  IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *ResponseSgList OPTIONAL\r
+  );\r
+\r
 //\r
 // EFI_SIMPLE_FILE_SYSTEM_PROTOCOL member functions for the Virtio Filesystem\r
 // driver.\r