summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2023-05-04 15:11:58 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-05-04 14:26:58 +0000
commit1694b0051138dc121740e47896d165b8b12382c6 (patch)
tree2dedcb27a7a9cc0627b3b9483eb881b7eae5e0b2
parent92da8a154fc0a1b0f42ab0ec4aee7dd2933f1a0a (diff)
downloadedk2-1694b0051138dc121740e47896d165b8b12382c6.tar.gz
edk2-1694b0051138dc121740e47896d165b8b12382c6.tar.bz2
edk2-1694b0051138dc121740e47896d165b8b12382c6.zip
OvmfPkg: add IndustryStandard/VirtioSerial.h
Add header files with structs and defines for the virtio serial device. The virtio serial device also known as virtio console device because initially it had only support for a single tty, intended to be used as console. Support for multiple streams and named data ports has been added later on. https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2900003 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--OvmfPkg/Include/IndustryStandard/VirtioSerial.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/OvmfPkg/Include/IndustryStandard/VirtioSerial.h b/OvmfPkg/Include/IndustryStandard/VirtioSerial.h
new file mode 100644
index 0000000000..ffc8f84d03
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/VirtioSerial.h
@@ -0,0 +1,64 @@
+/** @file
+ Virtio Serial Device specific type and macro definitions.
+
+ Copyright (C) 2013-2016, Red Hat, Inc.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _VIRTIO_SERIAL_H_
+#define _VIRTIO_SERIAL_H_
+
+#include <IndustryStandard/Virtio095.h>
+#include <IndustryStandard/Virtio10.h>
+
+//
+// Device Configuration
+//
+typedef struct {
+ UINT16 Cols;
+ UINT16 Rows;
+ UINT32 MaxPorts;
+ UINT32 EmergWrite;
+} VIRTIO_SERIAL_CONFIG;
+
+//
+// Control Queue
+//
+typedef struct {
+ UINT32 Id;
+ UINT16 Event;
+ UINT16 Value;
+} VIRTIO_SERIAL_CONTROL;
+
+//
+// Queue Identifiers
+//
+#define VIRTIO_SERIAL_Q_RX_PORT0 0
+#define VIRTIO_SERIAL_Q_TX_PORT0 1
+#define VIRTIO_SERIAL_Q_RX_CTRL 2
+#define VIRTIO_SERIAL_Q_TX_CTRL 3
+#define VIRTIO_SERIAL_Q_RX_BASE 4
+#define VIRTIO_SERIAL_Q_TX_BASE 5
+
+//
+// Feature Bits
+//
+#define VIRTIO_SERIAL_F_SIZE BIT0
+#define VIRTIO_SERIAL_F_MULTIPORT BIT1
+#define VIRTIO_SERIAL_F_EMERG_WRITE BIT2
+
+//
+// Events
+//
+#define VIRTIO_SERIAL_DEVICE_READY 0
+#define VIRTIO_SERIAL_DEVICE_ADD 1
+#define VIRTIO_SERIAL_DEVICE_REMOVE 2
+#define VIRTIO_SERIAL_PORT_READY 3
+#define VIRTIO_SERIAL_CONSOLE_PORT 4
+#define VIRTIO_SERIAL_RESIZE 5
+#define VIRTIO_SERIAL_PORT_OPEN 6
+#define VIRTIO_SERIAL_PORT_NAME 7
+
+#endif /* _VIRTIO_SERIAL_H_ */