diff options
author | Laszlo Ersek <lersek@redhat.com> | 2016-03-11 20:51:12 +0100 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2016-04-06 19:21:39 +0200 |
commit | acb81416cceda0da2f1d89137d70d167f2a83ca4 (patch) | |
tree | dba5f1e51d11380bf7ae38f52b35f4a0f2248701 /OvmfPkg/Include | |
parent | 0bad4cb6f654ed4a3383b8a2ce68508ae7cf0ded (diff) | |
download | edk2-acb81416cceda0da2f1d89137d70d167f2a83ca4.tar.gz edk2-acb81416cceda0da2f1d89137d70d167f2a83ca4.tar.bz2 edk2-acb81416cceda0da2f1d89137d70d167f2a83ca4.zip |
OvmfPkg: IndustryStandard: add definitions from the VirtIo 1.0 spec
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>
Diffstat (limited to 'OvmfPkg/Include')
-rw-r--r-- | OvmfPkg/Include/IndustryStandard/Virtio.h | 2 | ||||
-rw-r--r-- | OvmfPkg/Include/IndustryStandard/Virtio10.h | 81 | ||||
-rw-r--r-- | OvmfPkg/Include/IndustryStandard/Virtio10Net.h | 32 | ||||
-rw-r--r-- | OvmfPkg/Include/IndustryStandard/VirtioNet.h | 2 |
4 files changed, 115 insertions, 2 deletions
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio.h b/OvmfPkg/Include/IndustryStandard/Virtio.h index e1682fc69a..dddec38831 100644 --- a/OvmfPkg/Include/IndustryStandard/Virtio.h +++ b/OvmfPkg/Include/IndustryStandard/Virtio.h @@ -19,6 +19,6 @@ #ifndef _VIRTIO_H_
#define _VIRTIO_H_
-#include <IndustryStandard/Virtio095.h>
+#include <IndustryStandard/Virtio10.h>
#endif // _VIRTIO_H_
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/IndustryStandard/Virtio10.h new file mode 100644 index 0000000000..de692c1d1e --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h @@ -0,0 +1,81 @@ +/** @file
+ Definitions from the VirtIo 1.0 specification (csprd05).
+
+ Copyright (C) 2016, Red Hat, Inc.
+
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef _VIRTIO_1_0_H_
+#define _VIRTIO_1_0_H_
+
+#include <IndustryStandard/Virtio095.h>
+
+//
+// Structures for parsing the VirtIo 1.0 specific PCI capabilities from the
+// config space
+//
+#pragma pack (1)
+typedef struct {
+ UINT8 CapId; // Capability identifier (generic)
+ UINT8 CapNext; // Link to next capability (generic)
+} VIRTIO_PCI_CAP_LINK;
+
+typedef struct {
+ UINT8 ConfigType; // Identifies the specific VirtIo 1.0 config structure
+ UINT8 Bar; // The BAR that contains the structure
+ UINT8 Padding[3];
+ UINT32 Offset; // Offset within Bar until the start of the structure
+ UINT32 Length; // Length of the structure
+} VIRTIO_PCI_CAP;
+#pragma pack ()
+
+//
+// Values for the VIRTIO_PCI_CAP.ConfigType field
+//
+#define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration
+#define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications
+#define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration
+
+//
+// Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is
+// VIRTIO_PCI_CAP_COMMON_CFG
+//
+#pragma pack (1)
+typedef struct {
+ UINT32 DeviceFeatureSelect;
+ UINT32 DeviceFeature;
+ UINT32 DriverFeatureSelect;
+ UINT32 DriverFeature;
+ UINT16 MsixConfig;
+ UINT16 NumQueues;
+ UINT8 DeviceStatus;
+ UINT8 ConfigGeneration;
+ UINT16 QueueSelect;
+ UINT16 QueueSize;
+ UINT16 QueueMsixVector;
+ UINT16 QueueEnable;
+ UINT16 QueueNotifyOff;
+ UINT64 QueueDesc;
+ UINT64 QueueAvail;
+ UINT64 QueueUsed;
+} VIRTIO_PCI_COMMON_CFG;
+#pragma pack ()
+
+//
+// VirtIo 1.0 device status bits
+//
+#define VSTAT_FEATURES_OK BIT3
+
+//
+// VirtIo 1.0 reserved (device-independent) feature bits
+//
+#define VIRTIO_F_VERSION_1 BIT32
+
+#endif // _VIRTIO_1_0_H_
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10Net.h b/OvmfPkg/Include/IndustryStandard/Virtio10Net.h new file mode 100644 index 0000000000..cfd25fc414 --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/Virtio10Net.h @@ -0,0 +1,32 @@ +/** @file
+ Definitions from the VirtIo 1.0 specification (csprd05), specifically for the
+ network device.
+
+ Copyright (C) 2016, Red Hat, Inc.
+
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef _VIRTIO_1_0_NET_H_
+#define _VIRTIO_1_0_NET_H_
+
+#include <IndustryStandard/Virtio10.h>
+#include <IndustryStandard/Virtio095Net.h>
+
+//
+// VirtIo 1.0 packet header
+//
+#pragma pack (1)
+typedef struct {
+ VIRTIO_NET_REQ V0_9_5;
+ UINT16 NumBuffers;
+} VIRTIO_1_0_NET_REQ;
+#pragma pack ()
+
+#endif // _VIRTIO_1_0_NET_H_
diff --git a/OvmfPkg/Include/IndustryStandard/VirtioNet.h b/OvmfPkg/Include/IndustryStandard/VirtioNet.h index db4882abae..9b0bfdc585 100644 --- a/OvmfPkg/Include/IndustryStandard/VirtioNet.h +++ b/OvmfPkg/Include/IndustryStandard/VirtioNet.h @@ -17,6 +17,6 @@ #ifndef _VIRTIO_NET_H_
#define _VIRTIO_NET_H_
-#include <IndustryStandard/Virtio095Net.h>
+#include <IndustryStandard/Virtio10Net.h>
#endif // _VIRTIO_NET_H_
|