2 Definitions from the VirtIo 1.0 specification (csprd05).
4 Copyright (C) 2016, Red Hat, Inc.
5 Copyright (C) 2017, AMD, Inc.
7 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _VIRTIO_1_0_H_
11 #define _VIRTIO_1_0_H_
13 #include <IndustryStandard/Pci23.h>
14 #include <IndustryStandard/Virtio095.h>
17 // Subsystem Device IDs (to be) introduced in VirtIo 1.0
19 #define VIRTIO_SUBSYSTEM_GPU_DEVICE 16
21 // Subsystem Device IDs from the VirtIo spec at git commit 87fa6b5d8155;
22 // <https://github.com/oasis-tcs/virtio-spec/tree/87fa6b5d8155>.
24 #define VIRTIO_SUBSYSTEM_FILESYSTEM 26
27 // Structures for parsing the VirtIo 1.0 specific PCI capabilities from the
32 EFI_PCI_CAPABILITY_VENDOR_HDR VendorHdr
;
33 UINT8 ConfigType
; // Identifies the specific VirtIo 1.0 config structure
34 UINT8 Bar
; // The BAR that contains the structure
36 UINT32 Offset
; // Offset within Bar until the start of the structure
37 UINT32 Length
; // Length of the structure
42 // Values for the VIRTIO_PCI_CAP.ConfigType field
44 #define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration
45 #define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications
46 #define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration
49 // Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is
50 // VIRTIO_PCI_CAP_COMMON_CFG
54 UINT32 DeviceFeatureSelect
;
56 UINT32 DriverFeatureSelect
;
61 UINT8 ConfigGeneration
;
64 UINT16 QueueMsixVector
;
66 UINT16 QueueNotifyOff
;
70 } VIRTIO_PCI_COMMON_CFG
;
74 // VirtIo 1.0 device status bits
76 #define VSTAT_FEATURES_OK BIT3
79 // VirtIo 1.0 reserved (device-independent) feature bits
81 #define VIRTIO_F_VERSION_1 BIT32
82 #define VIRTIO_F_IOMMU_PLATFORM BIT33
85 // MMIO VirtIo Header Offsets
87 #define VIRTIO_MMIO_OFFSET_QUEUE_READY 0x44
88 #define VIRTIO_MMIO_OFFSET_QUEUE_DESC_LO 0x80
89 #define VIRTIO_MMIO_OFFSET_QUEUE_DESC_HI 0x84
90 #define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_LO 0x90
91 #define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_HI 0x94
92 #define VIRTIO_MMIO_OFFSET_QUEUE_USED_LO 0xa0
93 #define VIRTIO_MMIO_OFFSET_QUEUE_USED_HI 0xa4
94 #define VIRTIO_MMIO_OFFSET_CONFIG_GENERATION 0xfc
96 #endif // _VIRTIO_1_0_H_