VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Include/IndustryStandard/Virtio10.h

Last change on this file was 108794, checked in by vboxsync, 4 weeks ago

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
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#define VIRTIO_SUBSYSTEM_INPUT 18
21//
22// Subsystem Device IDs from the VirtIo spec at git commit 87fa6b5d8155;
23// <https://github.com/oasis-tcs/virtio-spec/tree/87fa6b5d8155>.
24//
25#define VIRTIO_SUBSYSTEM_FILESYSTEM 26
26
27//
28// Structures for parsing the VirtIo 1.0 specific PCI capabilities from the
29// config space
30//
31#pragma pack (1)
32typedef 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)
54typedef 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//
86// MMIO VirtIo Header Offsets
87//
88#define VIRTIO_MMIO_OFFSET_QUEUE_READY 0x44
89#define VIRTIO_MMIO_OFFSET_QUEUE_DESC_LO 0x80
90#define VIRTIO_MMIO_OFFSET_QUEUE_DESC_HI 0x84
91#define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_LO 0x90
92#define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_HI 0x94
93#define VIRTIO_MMIO_OFFSET_QUEUE_USED_LO 0xa0
94#define VIRTIO_MMIO_OFFSET_QUEUE_USED_HI 0xa4
95#define VIRTIO_MMIO_OFFSET_CONFIG_GENERATION 0xfc
96
97#endif // _VIRTIO_1_0_H_
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette