]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/IndustryStandard/Virtio10.h
de692c1d1ee9bbfbef299a2ff3b6b4a494de241b
[mirror_edk2.git] / OvmfPkg / Include / IndustryStandard / Virtio10.h
1 /** @file
2 Definitions from the VirtIo 1.0 specification (csprd05).
3
4 Copyright (C) 2016, Red Hat, Inc.
5
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
12 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 **/
14
15 #ifndef _VIRTIO_1_0_H_
16 #define _VIRTIO_1_0_H_
17
18 #include <IndustryStandard/Virtio095.h>
19
20 //
21 // Structures for parsing the VirtIo 1.0 specific PCI capabilities from the
22 // config space
23 //
24 #pragma pack (1)
25 typedef struct {
26 UINT8 CapId; // Capability identifier (generic)
27 UINT8 CapNext; // Link to next capability (generic)
28 } VIRTIO_PCI_CAP_LINK;
29
30 typedef struct {
31 UINT8 ConfigType; // Identifies the specific VirtIo 1.0 config structure
32 UINT8 Bar; // The BAR that contains the structure
33 UINT8 Padding[3];
34 UINT32 Offset; // Offset within Bar until the start of the structure
35 UINT32 Length; // Length of the structure
36 } VIRTIO_PCI_CAP;
37 #pragma pack ()
38
39 //
40 // Values for the VIRTIO_PCI_CAP.ConfigType field
41 //
42 #define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration
43 #define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications
44 #define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration
45
46 //
47 // Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is
48 // VIRTIO_PCI_CAP_COMMON_CFG
49 //
50 #pragma pack (1)
51 typedef struct {
52 UINT32 DeviceFeatureSelect;
53 UINT32 DeviceFeature;
54 UINT32 DriverFeatureSelect;
55 UINT32 DriverFeature;
56 UINT16 MsixConfig;
57 UINT16 NumQueues;
58 UINT8 DeviceStatus;
59 UINT8 ConfigGeneration;
60 UINT16 QueueSelect;
61 UINT16 QueueSize;
62 UINT16 QueueMsixVector;
63 UINT16 QueueEnable;
64 UINT16 QueueNotifyOff;
65 UINT64 QueueDesc;
66 UINT64 QueueAvail;
67 UINT64 QueueUsed;
68 } VIRTIO_PCI_COMMON_CFG;
69 #pragma pack ()
70
71 //
72 // VirtIo 1.0 device status bits
73 //
74 #define VSTAT_FEATURES_OK BIT3
75
76 //
77 // VirtIo 1.0 reserved (device-independent) feature bits
78 //
79 #define VIRTIO_F_VERSION_1 BIT32
80
81 #endif // _VIRTIO_1_0_H_