]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec
authorLaszlo Ersek <lersek@redhat.com>
Fri, 11 Mar 2016 19:51:12 +0000 (20:51 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 6 Apr 2016 17:21:39 +0000 (19:21 +0200)
These header files are intentionally minimal, and intentionally kept apart
from the VirtIo 0.9.5 headers.

The header inclusion chains end up like this (the Virtio10*.h header files
in the middle are new):

  Virtio.h    -> Virtio10.h    -> Virtio095.h

                     ^                 ^
                     |                 |

  VirtioNet.h -> Virtio10Net.h -> Virtio095Net.h

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/Include/IndustryStandard/Virtio.h
OvmfPkg/Include/IndustryStandard/Virtio10.h [new file with mode: 0644]
OvmfPkg/Include/IndustryStandard/Virtio10Net.h [new file with mode: 0644]
OvmfPkg/Include/IndustryStandard/VirtioNet.h

index e1682fc69a42ce7661f42621b61203fc8cfecc56..dddec388318e6274c3123aaaef6346a516c2eded 100644 (file)
@@ -19,6 +19,6 @@
 #ifndef _VIRTIO_H_\r
 #define _VIRTIO_H_\r
 \r
-#include <IndustryStandard/Virtio095.h>\r
+#include <IndustryStandard/Virtio10.h>\r
 \r
 #endif // _VIRTIO_H_\r
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/IndustryStandard/Virtio10.h
new file mode 100644 (file)
index 0000000..de692c1
--- /dev/null
@@ -0,0 +1,81 @@
+/** @file\r
+  Definitions from the VirtIo 1.0 specification (csprd05).\r
+\r
+  Copyright (C) 2016, Red Hat, Inc.\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
+**/\r
+\r
+#ifndef _VIRTIO_1_0_H_\r
+#define _VIRTIO_1_0_H_\r
+\r
+#include <IndustryStandard/Virtio095.h>\r
+\r
+//\r
+// Structures for parsing the VirtIo 1.0 specific PCI capabilities from the\r
+// config space\r
+//\r
+#pragma pack (1)\r
+typedef struct {\r
+  UINT8 CapId;   // Capability identifier (generic)\r
+  UINT8 CapNext; // Link to next capability (generic)\r
+} VIRTIO_PCI_CAP_LINK;\r
+\r
+typedef struct {\r
+  UINT8  ConfigType; // Identifies the specific VirtIo 1.0 config structure\r
+  UINT8  Bar;        // The BAR that contains the structure\r
+  UINT8  Padding[3];\r
+  UINT32 Offset;     // Offset within Bar until the start of the structure\r
+  UINT32 Length;     // Length of the structure\r
+} VIRTIO_PCI_CAP;\r
+#pragma pack ()\r
+\r
+//\r
+// Values for the VIRTIO_PCI_CAP.ConfigType field\r
+//\r
+#define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration\r
+#define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications\r
+#define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration\r
+\r
+//\r
+// Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is\r
+// VIRTIO_PCI_CAP_COMMON_CFG\r
+//\r
+#pragma pack (1)\r
+typedef struct {\r
+  UINT32 DeviceFeatureSelect;\r
+  UINT32 DeviceFeature;\r
+  UINT32 DriverFeatureSelect;\r
+  UINT32 DriverFeature;\r
+  UINT16 MsixConfig;\r
+  UINT16 NumQueues;\r
+  UINT8  DeviceStatus;\r
+  UINT8  ConfigGeneration;\r
+  UINT16 QueueSelect;\r
+  UINT16 QueueSize;\r
+  UINT16 QueueMsixVector;\r
+  UINT16 QueueEnable;\r
+  UINT16 QueueNotifyOff;\r
+  UINT64 QueueDesc;\r
+  UINT64 QueueAvail;\r
+  UINT64 QueueUsed;\r
+} VIRTIO_PCI_COMMON_CFG;\r
+#pragma pack ()\r
+\r
+//\r
+// VirtIo 1.0 device status bits\r
+//\r
+#define VSTAT_FEATURES_OK BIT3\r
+\r
+//\r
+// VirtIo 1.0 reserved (device-independent) feature bits\r
+//\r
+#define VIRTIO_F_VERSION_1 BIT32\r
+\r
+#endif // _VIRTIO_1_0_H_\r
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10Net.h b/OvmfPkg/Include/IndustryStandard/Virtio10Net.h
new file mode 100644 (file)
index 0000000..cfd25fc
--- /dev/null
@@ -0,0 +1,32 @@
+/** @file\r
+  Definitions from the VirtIo 1.0 specification (csprd05), specifically for the\r
+  network device.\r
+\r
+  Copyright (C) 2016, Red Hat, Inc.\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
+**/\r
+\r
+#ifndef _VIRTIO_1_0_NET_H_\r
+#define _VIRTIO_1_0_NET_H_\r
+\r
+#include <IndustryStandard/Virtio10.h>\r
+#include <IndustryStandard/Virtio095Net.h>\r
+\r
+//\r
+// VirtIo 1.0 packet header\r
+//\r
+#pragma pack (1)\r
+typedef struct {\r
+  VIRTIO_NET_REQ V0_9_5;\r
+  UINT16         NumBuffers;\r
+} VIRTIO_1_0_NET_REQ;\r
+#pragma pack ()\r
+\r
+#endif // _VIRTIO_1_0_NET_H_\r
index db4882abaef36c515bc4bf780959d28167eb42ee..9b0bfdc585d03ec98249b7dbf70b8c888010744d 100644 (file)
@@ -17,6 +17,6 @@
 #ifndef _VIRTIO_NET_H_\r
 #define _VIRTIO_NET_H_\r
 \r
-#include <IndustryStandard/Virtio095Net.h>\r
+#include <IndustryStandard/Virtio10Net.h>\r
 \r
 #endif // _VIRTIO_NET_H_\r