]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/IndustryStandard/Virtio10.h
OvmfPkg/MemEncryptSevLib: find pages of initial SMRAM save state map
[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/Virtio095.h>
20
21 //
22 // Subsystem Device IDs (to be) introduced in VirtIo 1.0
23 //
24 #define VIRTIO_SUBSYSTEM_GPU_DEVICE 16
25
26 //
27 // Structures for parsing the VirtIo 1.0 specific PCI capabilities from the
28 // config space
29 //
30 #pragma pack (1)
31 typedef struct {
32 UINT8 CapId; // Capability identifier (generic)
33 UINT8 CapNext; // Link to next capability (generic)
34 } VIRTIO_PCI_CAP_LINK;
35
36 typedef struct {
37 UINT8 ConfigType; // Identifies the specific VirtIo 1.0 config structure
38 UINT8 Bar; // The BAR that contains the structure
39 UINT8 Padding[3];
40 UINT32 Offset; // Offset within Bar until the start of the structure
41 UINT32 Length; // Length of the structure
42 } VIRTIO_PCI_CAP;
43 #pragma pack ()
44
45 //
46 // Values for the VIRTIO_PCI_CAP.ConfigType field
47 //
48 #define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration
49 #define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications
50 #define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration
51
52 //
53 // Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is
54 // VIRTIO_PCI_CAP_COMMON_CFG
55 //
56 #pragma pack (1)
57 typedef struct {
58 UINT32 DeviceFeatureSelect;
59 UINT32 DeviceFeature;
60 UINT32 DriverFeatureSelect;
61 UINT32 DriverFeature;
62 UINT16 MsixConfig;
63 UINT16 NumQueues;
64 UINT8 DeviceStatus;
65 UINT8 ConfigGeneration;
66 UINT16 QueueSelect;
67 UINT16 QueueSize;
68 UINT16 QueueMsixVector;
69 UINT16 QueueEnable;
70 UINT16 QueueNotifyOff;
71 UINT64 QueueDesc;
72 UINT64 QueueAvail;
73 UINT64 QueueUsed;
74 } VIRTIO_PCI_COMMON_CFG;
75 #pragma pack ()
76
77 //
78 // VirtIo 1.0 device status bits
79 //
80 #define VSTAT_FEATURES_OK BIT3
81
82 //
83 // VirtIo 1.0 reserved (device-independent) feature bits
84 //
85 #define VIRTIO_F_VERSION_1 BIT32
86 #define VIRTIO_F_IOMMU_PLATFORM BIT33
87
88 #endif // _VIRTIO_1_0_H_