]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/IndustryStandard/Virtio10.h
OvmfPkg: Replace BSD License with BSD+Patent License
[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 Copyright (C) 2017, AMD, Inc.
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8 **/
9
10 #ifndef _VIRTIO_1_0_H_
11 #define _VIRTIO_1_0_H_
12
13 #include <IndustryStandard/Pci23.h>
14 #include <IndustryStandard/Virtio095.h>
15
16 //
17 // Subsystem Device IDs (to be) introduced in VirtIo 1.0
18 //
19 #define VIRTIO_SUBSYSTEM_GPU_DEVICE 16
20
21 //
22 // Structures for parsing the VirtIo 1.0 specific PCI capabilities from the
23 // config space
24 //
25 #pragma pack (1)
26 typedef struct {
27 EFI_PCI_CAPABILITY_VENDOR_HDR VendorHdr;
28 UINT8 ConfigType; // Identifies the specific VirtIo 1.0 config structure
29 UINT8 Bar; // The BAR that contains the structure
30 UINT8 Padding[3];
31 UINT32 Offset; // Offset within Bar until the start of the structure
32 UINT32 Length; // Length of the structure
33 } VIRTIO_PCI_CAP;
34 #pragma pack ()
35
36 //
37 // Values for the VIRTIO_PCI_CAP.ConfigType field
38 //
39 #define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration
40 #define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications
41 #define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration
42
43 //
44 // Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is
45 // VIRTIO_PCI_CAP_COMMON_CFG
46 //
47 #pragma pack (1)
48 typedef struct {
49 UINT32 DeviceFeatureSelect;
50 UINT32 DeviceFeature;
51 UINT32 DriverFeatureSelect;
52 UINT32 DriverFeature;
53 UINT16 MsixConfig;
54 UINT16 NumQueues;
55 UINT8 DeviceStatus;
56 UINT8 ConfigGeneration;
57 UINT16 QueueSelect;
58 UINT16 QueueSize;
59 UINT16 QueueMsixVector;
60 UINT16 QueueEnable;
61 UINT16 QueueNotifyOff;
62 UINT64 QueueDesc;
63 UINT64 QueueAvail;
64 UINT64 QueueUsed;
65 } VIRTIO_PCI_COMMON_CFG;
66 #pragma pack ()
67
68 //
69 // VirtIo 1.0 device status bits
70 //
71 #define VSTAT_FEATURES_OK BIT3
72
73 //
74 // VirtIo 1.0 reserved (device-independent) feature bits
75 //
76 #define VIRTIO_F_VERSION_1 BIT32
77 #define VIRTIO_F_IOMMU_PLATFORM BIT33
78
79 #endif // _VIRTIO_1_0_H_