]>
Commit | Line | Data |
---|---|---|
acb81416 LE |
1 | /** @file\r |
2 | Definitions from the VirtIo 1.0 specification (csprd05).\r | |
3 | \r | |
4 | Copyright (C) 2016, Red Hat, Inc.\r | |
4fb26802 | 5 | Copyright (C) 2017, AMD, Inc.\r |
acb81416 | 6 | \r |
b26f0cf9 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
acb81416 LE |
8 | **/\r |
9 | \r | |
10 | #ifndef _VIRTIO_1_0_H_\r | |
11 | #define _VIRTIO_1_0_H_\r | |
12 | \r | |
5685a243 | 13 | #include <IndustryStandard/Pci23.h>\r |
acb81416 LE |
14 | #include <IndustryStandard/Virtio095.h>\r |
15 | \r | |
92dc5e9d LE |
16 | //\r |
17 | // Subsystem Device IDs (to be) introduced in VirtIo 1.0\r | |
18 | //\r | |
ac0a286f | 19 | #define VIRTIO_SUBSYSTEM_GPU_DEVICE 16\r |
b55d6622 LE |
20 | //\r |
21 | // Subsystem Device IDs from the VirtIo spec at git commit 87fa6b5d8155;\r | |
22 | // <https://github.com/oasis-tcs/virtio-spec/tree/87fa6b5d8155>.\r | |
23 | //\r | |
ac0a286f | 24 | #define VIRTIO_SUBSYSTEM_FILESYSTEM 26\r |
92dc5e9d | 25 | \r |
acb81416 LE |
26 | //\r |
27 | // Structures for parsing the VirtIo 1.0 specific PCI capabilities from the\r | |
28 | // config space\r | |
29 | //\r | |
30 | #pragma pack (1)\r | |
31 | typedef struct {\r | |
ac0a286f MK |
32 | EFI_PCI_CAPABILITY_VENDOR_HDR VendorHdr;\r |
33 | UINT8 ConfigType; // Identifies the specific VirtIo 1.0 config structure\r | |
34 | UINT8 Bar; // The BAR that contains the structure\r | |
35 | UINT8 Padding[3];\r | |
36 | UINT32 Offset; // Offset within Bar until the start of the structure\r | |
37 | UINT32 Length; // Length of the structure\r | |
acb81416 LE |
38 | } VIRTIO_PCI_CAP;\r |
39 | #pragma pack ()\r | |
40 | \r | |
41 | //\r | |
42 | // Values for the VIRTIO_PCI_CAP.ConfigType field\r | |
43 | //\r | |
ac0a286f MK |
44 | #define VIRTIO_PCI_CAP_COMMON_CFG 1 // Common configuration\r |
45 | #define VIRTIO_PCI_CAP_NOTIFY_CFG 2 // Notifications\r | |
46 | #define VIRTIO_PCI_CAP_DEVICE_CFG 4 // Device specific configuration\r | |
acb81416 LE |
47 | \r |
48 | //\r | |
49 | // Structure pointed-to by Bar and Offset in VIRTIO_PCI_CAP when ConfigType is\r | |
50 | // VIRTIO_PCI_CAP_COMMON_CFG\r | |
51 | //\r | |
52 | #pragma pack (1)\r | |
53 | typedef struct {\r | |
ac0a286f MK |
54 | UINT32 DeviceFeatureSelect;\r |
55 | UINT32 DeviceFeature;\r | |
56 | UINT32 DriverFeatureSelect;\r | |
57 | UINT32 DriverFeature;\r | |
58 | UINT16 MsixConfig;\r | |
59 | UINT16 NumQueues;\r | |
60 | UINT8 DeviceStatus;\r | |
61 | UINT8 ConfigGeneration;\r | |
62 | UINT16 QueueSelect;\r | |
63 | UINT16 QueueSize;\r | |
64 | UINT16 QueueMsixVector;\r | |
65 | UINT16 QueueEnable;\r | |
66 | UINT16 QueueNotifyOff;\r | |
67 | UINT64 QueueDesc;\r | |
68 | UINT64 QueueAvail;\r | |
69 | UINT64 QueueUsed;\r | |
acb81416 LE |
70 | } VIRTIO_PCI_COMMON_CFG;\r |
71 | #pragma pack ()\r | |
72 | \r | |
73 | //\r | |
74 | // VirtIo 1.0 device status bits\r | |
75 | //\r | |
ac0a286f | 76 | #define VSTAT_FEATURES_OK BIT3\r |
acb81416 LE |
77 | \r |
78 | //\r | |
79 | // VirtIo 1.0 reserved (device-independent) feature bits\r | |
80 | //\r | |
ac0a286f MK |
81 | #define VIRTIO_F_VERSION_1 BIT32\r |
82 | #define VIRTIO_F_IOMMU_PLATFORM BIT33\r | |
acb81416 | 83 | \r |
94e465e5 GH |
84 | //\r |
85 | // MMIO VirtIo Header Offsets\r | |
86 | //\r | |
ac0a286f MK |
87 | #define VIRTIO_MMIO_OFFSET_QUEUE_READY 0x44\r |
88 | #define VIRTIO_MMIO_OFFSET_QUEUE_DESC_LO 0x80\r | |
89 | #define VIRTIO_MMIO_OFFSET_QUEUE_DESC_HI 0x84\r | |
90 | #define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_LO 0x90\r | |
91 | #define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_HI 0x94\r | |
92 | #define VIRTIO_MMIO_OFFSET_QUEUE_USED_LO 0xa0\r | |
93 | #define VIRTIO_MMIO_OFFSET_QUEUE_USED_HI 0xa4\r | |
94 | #define VIRTIO_MMIO_OFFSET_CONFIG_GENERATION 0xfc\r | |
94e465e5 | 95 | \r |
acb81416 | 96 | #endif // _VIRTIO_1_0_H_\r |