]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/IndustryStandard/Virtio.h
OvmfPkg/QemuFwCfgS3Lib: Fix VS tool chain build failure
[mirror_edk2.git] / OvmfPkg / Include / IndustryStandard / Virtio.h
index 05c658fa548633acae7fe455695c2953a4ede4d8..dddec388318e6274c3123aaaef6346a516c2eded 100644 (file)
@@ -1,9 +1,10 @@
 /** @file\r
 \r
-  Generic type and macro definitions corresponding to the virtio-0.9.5\r
-  specification.\r
+  Generic type and macro definitions corresponding to the virtio\r
+  specifications.\r
 \r
-  Copyright (C) 2012, Red Hat, Inc.\r
+  Copyright (C) 2012-2016, Red Hat, Inc.\r
+  Portion of Copyright (C) 2013, ARM Ltd.\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
 #ifndef _VIRTIO_H_\r
 #define _VIRTIO_H_\r
 \r
-#include <Base.h>\r
-\r
-\r
-//\r
-// Data in the communication area is defined as packed and accessed as\r
-// volatile.\r
-//\r
-// Some structures contain arrays with dynamically determined size. In such\r
-// cases the array and its sibling fields are replaced with pointers.\r
-//\r
-// All indices (variables and fields named *Idx) are free-running and wrap\r
-// around after 0xFFFF. The queue size reported by the host is always an\r
-// integral power of 2, not greater than 32768. Actual array indices are\r
-// consistently calculated by taking the remainder of a given Idx object modulo\r
-// QueueSize. Since 0x10000 is an integral multiple of the QueueSize, UINT16\r
-// wraparound is a correct wraparound modulo QueueSize too (it doesn't offset\r
-// the remainder class).\r
-//\r
-// virtio-0.9.5, 2.3.4 Available Ring\r
-//\r
-#define VRING_AVAIL_F_NO_INTERRUPT BIT0\r
-\r
-typedef struct {\r
-  volatile UINT16 *Flags;\r
-  volatile UINT16 *Idx;\r
-\r
-  volatile UINT16 *Ring;      // QueueSize elements\r
-  volatile UINT16 *UsedEvent; // unused as per negotiation\r
-} VRING_AVAIL;\r
-\r
-\r
-//\r
-// virtio-0.9.5, 2.3.5 Used Ring\r
-//\r
-#define VRING_USED_F_NO_NOTIFY BIT0\r
-\r
-#pragma pack(1)\r
-typedef struct {\r
-  UINT32 Id;\r
-  UINT32 Len;\r
-} VRING_USED_ELEM;\r
-#pragma pack()\r
-\r
-typedef struct {\r
-  volatile UINT16          *Flags;\r
-  volatile UINT16          *Idx;\r
-  volatile VRING_USED_ELEM *UsedElem;   // QueueSize elements\r
-  volatile UINT16          *AvailEvent; // unused as per negotiation\r
-} VRING_USED;\r
-\r
-\r
-//\r
-// virtio-0.9.5, 2.3.2 Descriptor Table\r
-//\r
-#define VRING_DESC_F_NEXT     BIT0 // more descriptors in this request\r
-#define VRING_DESC_F_WRITE    BIT1 // buffer to be written *by the host*\r
-#define VRING_DESC_F_INDIRECT BIT2 // unused\r
-\r
-#pragma pack(1)\r
-typedef struct {\r
-  UINT64 Addr;\r
-  UINT32 Len;\r
-  UINT16 Flags;\r
-  UINT16 Next;\r
-} VRING_DESC;\r
-#pragma pack()\r
-\r
-typedef struct {\r
-  UINTN               NumPages;\r
-  VOID                *Base;     // deallocate only this field\r
-  volatile VRING_DESC *Desc;     // QueueSize elements\r
-  VRING_AVAIL         Avail;\r
-  VRING_USED          Used;\r
-  UINT16              QueueSize;\r
-} VRING;\r
-\r
-\r
-//\r
-// virtio-0.9.5, 2.2.2 Virtio Header -- no MSI-X\r
-//\r
-#pragma pack(1)\r
-typedef struct {\r
-  UINT32 VhdrDeviceFeatureBits;\r
-  UINT32 VhdrGuestFeatureBits;\r
-  UINT32 VhdrQueueAddress;\r
-  UINT16 VhdrQueueSize;\r
-  UINT16 VhdrQueueSelect;\r
-  UINT16 VhdrQueueNotify;\r
-  UINT8  VhdrDeviceStatus;\r
-  UINT8  VhdrISR;\r
-} VIRTIO_HDR;\r
-#pragma pack()\r
-\r
-\r
-//\r
-// virtio-0.9.5, 2.2.2.1 Device Status\r
-//\r
-#define VSTAT_ACK       BIT0\r
-#define VSTAT_DRIVER    BIT1\r
-#define VSTAT_DRIVER_OK BIT2\r
-#define VSTAT_FAILED    BIT7\r
-\r
-//\r
-// virtio-0.9.5, Appendix B: Reserved (Device-Independent) Feature Bits\r
-//\r
-#define VIRTIO_F_NOTIFY_ON_EMPTY    BIT24\r
-#define VIRTIO_F_RING_INDIRECT_DESC BIT28\r
-#define VIRTIO_F_RING_EVENT_IDX     BIT29\r
-\r
+#include <IndustryStandard/Virtio10.h>\r
 \r
 #endif // _VIRTIO_H_\r