summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Include/IndustryStandard/VirtioSerial.h
blob: ffc8f84d03ccb7643fcb3a6a2af3a88eea270067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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_ */