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