]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/Library/VirtioLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / Include / Library / VirtioLib.h
index 547b4ee497b85b2168ebec8dce25db895f2ff0ad..085e719b08753b3d4be7e6d7ed0fea8c287ff467 100644 (file)
@@ -5,13 +5,7 @@
   Copyright (C) 2012-2016, Red Hat, Inc.\r
   Copyright (C) 2017, AMD Inc, All rights reserved.<BR>\r
 \r
-  This program and the accompanying materials are licensed and made available\r
-  under the terms and conditions of the BSD License which accompanies this\r
-  distribution. The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
-  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -22,7 +16,6 @@
 \r
 #include <IndustryStandard/Virtio.h>\r
 \r
-\r
 /**\r
 \r
   Configure a virtio ring.\r
 EFI_STATUS\r
 EFIAPI\r
 VirtioRingInit (\r
-  IN  VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
-  IN  UINT16                 QueueSize,\r
-  OUT VRING                  *Ring\r
+  IN  VIRTIO_DEVICE_PROTOCOL  *VirtIo,\r
+  IN  UINT16                  QueueSize,\r
+  OUT VRING                   *Ring\r
   );\r
 \r
-\r
 /**\r
 \r
   Map the ring buffer so that it can be accessed equally by both guest\r
@@ -79,10 +71,10 @@ VirtioRingInit (
 EFI_STATUS\r
 EFIAPI\r
 VirtioRingMap (\r
-  IN  VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
-  IN  VRING                  *Ring,\r
-  OUT UINT64                 *RingBaseShift,\r
-  OUT VOID                   **Mapping\r
+  IN  VIRTIO_DEVICE_PROTOCOL  *VirtIo,\r
+  IN  VRING                   *Ring,\r
+  OUT UINT64                  *RingBaseShift,\r
+  OUT VOID                    **Mapping\r
   );\r
 \r
 /**\r
@@ -101,21 +93,19 @@ VirtioRingMap (
 VOID\r
 EFIAPI\r
 VirtioRingUninit (\r
-  IN     VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
-  IN OUT VRING                  *Ring\r
+  IN     VIRTIO_DEVICE_PROTOCOL  *VirtIo,\r
+  IN OUT VRING                   *Ring\r
   );\r
 \r
-\r
 //\r
 // Internal use structure for tracking the submission of a multi-descriptor\r
 // request.\r
 //\r
 typedef struct {\r
-  UINT16 HeadDescIdx;\r
-  UINT16 NextDescIdx;\r
+  UINT16    HeadDescIdx;\r
+  UINT16    NextDescIdx;\r
 } DESC_INDICES;\r
 \r
-\r
 /**\r
 \r
   Turn off interrupt notifications from the host, and prepare for appending\r
@@ -131,11 +121,10 @@ typedef struct {
 VOID\r
 EFIAPI\r
 VirtioPrepare (\r
-  IN OUT VRING        *Ring,\r
-  OUT    DESC_INDICES *Indices\r
+  IN OUT VRING         *Ring,\r
+  OUT    DESC_INDICES  *Indices\r
   );\r
 \r
-\r
 /**\r
 \r
   Append a contiguous buffer for transmission / reception via the virtio ring.\r
@@ -151,39 +140,39 @@ VirtioPrepare (
   The caller is responsible for initializing *Indices with VirtioPrepare()\r
   first.\r
 \r
-  @param[in,out] Ring        The virtio ring to append the buffer to, as a\r
-                             descriptor.\r
+  @param[in,out] Ring               The virtio ring to append the buffer to,\r
+                                    as a descriptor.\r
 \r
-  @param[in] BufferPhysAddr  (Guest pseudo-physical) start address of the\r
-                             transmit / receive buffer.\r
+  @param[in] BufferDeviceAddress    (Bus master device) start address of the\r
+                                    transmit / receive buffer.\r
 \r
-  @param[in] BufferSize      Number of bytes to transmit or receive.\r
+  @param[in] BufferSize             Number of bytes to transmit or receive.\r
 \r
-  @param[in] Flags           A bitmask of VRING_DESC_F_* flags. The caller\r
-                             computes this mask dependent on further buffers to\r
-                             append and transfer direction.\r
-                             VRING_DESC_F_INDIRECT is unsupported. The\r
-                             VRING_DESC.Next field is always set, but the host\r
-                             only interprets it dependent on VRING_DESC_F_NEXT.\r
+  @param[in] Flags                  A bitmask of VRING_DESC_F_* flags. The\r
+                                    caller computes this mask dependent on\r
+                                    further buffers to append and transfer\r
+                                    direction. VRING_DESC_F_INDIRECT is\r
+                                    unsupported. The VRING_DESC.Next field is\r
+                                    always set, but the host only interprets\r
+                                    it dependent on VRING_DESC_F_NEXT.\r
 \r
-  @param[in,out] Indices     Indices->HeadDescIdx is not accessed.\r
-                             On input, Indices->NextDescIdx identifies the next\r
-                             descriptor to carry the buffer. On output,\r
-                             Indices->NextDescIdx is incremented by one, modulo\r
-                             2^16.\r
+  @param[in,out] Indices            Indices->HeadDescIdx is not accessed.\r
+                                    On input, Indices->NextDescIdx identifies\r
+                                    the next descriptor to carry the buffer.\r
+                                    On output, Indices->NextDescIdx is\r
+                                    incremented by one, modulo 2^16.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 VirtioAppendDesc (\r
-  IN OUT VRING        *Ring,\r
-  IN     UINTN        BufferPhysAddr,\r
-  IN     UINT32       BufferSize,\r
-  IN     UINT16       Flags,\r
-  IN OUT DESC_INDICES *Indices\r
+  IN OUT VRING         *Ring,\r
+  IN     UINT64        BufferDeviceAddress,\r
+  IN     UINT32        BufferSize,\r
+  IN     UINT16        Flags,\r
+  IN OUT DESC_INDICES  *Indices\r
   );\r
 \r
-\r
 /**\r
 \r
   Notify the host about the descriptor chain just built, and wait until the\r
@@ -214,14 +203,13 @@ VirtioAppendDesc (
 EFI_STATUS\r
 EFIAPI\r
 VirtioFlush (\r
-  IN     VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
-  IN     UINT16                 VirtQueueId,\r
-  IN OUT VRING                  *Ring,\r
-  IN     DESC_INDICES           *Indices,\r
-  OUT    UINT32                 *UsedLen    OPTIONAL\r
+  IN     VIRTIO_DEVICE_PROTOCOL  *VirtIo,\r
+  IN     UINT16                  VirtQueueId,\r
+  IN OUT VRING                   *Ring,\r
+  IN     DESC_INDICES            *Indices,\r
+  OUT    UINT32                  *UsedLen    OPTIONAL\r
   );\r
 \r
-\r
 /**\r
 \r
   Report the feature bits to the VirtIo 1.0 device that the VirtIo 1.0 driver\r
@@ -262,9 +250,9 @@ VirtioFlush (
 EFI_STATUS\r
 EFIAPI\r
 Virtio10WriteFeatures (\r
-  IN     VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
-  IN     UINT64                 Features,\r
-  IN OUT UINT8                  *DeviceStatus\r
+  IN     VIRTIO_DEVICE_PROTOCOL  *VirtIo,\r
+  IN     UINT64                  Features,\r
+  IN OUT UINT8                   *DeviceStatus\r
   );\r
 \r
 /**\r
@@ -297,7 +285,7 @@ Virtio10WriteFeatures (
                                   VIRTIO_UNMAP_SHARED.\r
 \r
 \r
-  @retval EFI_SUCCESS             The NumberOfBytes is succesfully mapped.\r
+  @retval EFI_SUCCESS             The NumberOfBytes is successfully mapped.\r
   @retval EFI_UNSUPPORTED         The HostAddress cannot be mapped as a\r
                                   common buffer.\r
   @retval EFI_INVALID_PARAMETER   One or more parameters are invalid.\r
@@ -318,4 +306,5 @@ VirtioMapAllBytesInSharedBuffer (
   OUT EFI_PHYSICAL_ADDRESS    *DeviceAddress,\r
   OUT VOID                    **Mapping\r
   );\r
+\r
 #endif // _VIRTIO_LIB_H_\r