Changeset 100400 in vbox for trunk/src/VBox/Devices/VirtIO/VirtioCore.h
- Timestamp:
- Jul 6, 2023 8:58:02 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VirtIO/VirtioCore.h
r100372 r100400 70 70 #define VIRTIO_PAGE_SIZE 4096 /**< Page size used by VirtIO specification */ 71 71 72 /** Virtio-over-MMIO transport region size, excluding the device specific configuration area. */ 73 #define VIRTIO_MMIO_SIZE 256 74 /** Register containing a magic value identifying a VirtIO over MMIO device - readonly. */ 75 #define VIRTIO_MMIO_REG_MAGIC_OFF 0 76 /** Magic value read from the register. */ 77 # define VIRTIO_MMIO_REG_MAGIC_VALUE UINT32_C(0x74726976) 78 /** Register containing th version of the MMIO transport - readonly. */ 79 #define VIRTIO_MMIO_REG_VERSION_OFF 4 80 /** Version value read from the register. */ 81 # define VIRTIO_MMIO_REG_VERSION_VALUE UINT32_C(0x2) 82 /** Register containing the device ID of the device - readonly. */ 83 #define VIRTIO_MMIO_REG_DEVICEID_OFF 8 84 /** Register containing the vendor ID of the device - readonly. */ 85 #define VIRTIO_MMIO_REG_VENDORID_OFF 12 86 /** Register containing the features the device supports - readonly. */ 87 #define VIRTIO_MMIO_REG_DEVICEFEAT_OFF 16 88 /** Device features selection - writeonly. */ 89 #define VIRTIO_MMIO_REG_DEVICEFEATSEL_OFF 20 90 /** Features of the device selected by the driver - writeonly. */ 91 #define VIRTIO_MMIO_REG_DRIVERFEAT_OFF 32 92 /** - writeonly. */ 93 #define VIRTIO_MMIO_REG_DRIVERFEATSEL_OFF 36 94 /** Virtual queue selection - writeonly. */ 95 #define VIRTIO_MMIO_REG_QUEUESEL_OFF 48 96 /** - readonly */ 97 #define VIRTIO_MMIO_REG_QUEUENUMMAX_OFF 52 98 /** - writeonly */ 99 #define VIRTIO_MMIO_REG_QUEUENUM_OFF 56 100 /** - read/write. */ 101 #define VIRTIO_MMIO_REG_QUEUEALIGN_LEGACY_OFF 60 102 /** - read/write. */ 103 #define VIRTIO_MMIO_REG_QUEUERDY_OFF 68 104 /** - writeonly */ 105 #define VIRTIO_MMIO_REG_QUEUENOTIFY_OFF 80 106 /** - readonly */ 107 #define VIRTIO_MMIO_REG_INTRSTATUS_OFF 96 108 /** - writeonly */ 109 #define VIRTIO_MMIO_REG_INTRACK_OFF 100 110 /** - read/write */ 111 #define VIRTIO_MMIO_REG_DEVSTATUS_OFF 112 112 /** - writeonly */ 113 #define VIRTIO_MMIO_REG_QUEUEDESCLOW_OFF 128 114 /** - writeonly */ 115 #define VIRTIO_MMIO_REG_QUEUEDESCHIGH_OFF 132 116 /** - writeonly */ 117 #define VIRTIO_MMIO_REG_QUEUEDRVLOW_OFF 144 118 /** - writeonly */ 119 #define VIRTIO_MMIO_REG_QUEUEDRVHIGH_OFF 148 120 /** - writeonly */ 121 #define VIRTIO_MMIO_REG_QUEUEDEVLOW_OFF 160 122 /** - writeonly */ 123 #define VIRTIO_MMIO_REG_QUEUEDEVHIGH_OFF 164 124 /** - readonly */ 125 #define VIRTIO_MMIO_REG_CFGGEN_OFF 252 126 127 72 128 /** 73 129 * @todo Move the following virtioCoreGCPhysChain*() functions mimic the functionality of the related … … 154 210 uint16_t uInterruptLine; /**< PCI Cfg Interrupt line */ 155 211 uint16_t uInterruptPin; /**< PCI Cfg Interrupt pin */ 212 uint8_t uDeviceType; /**< Device type (used for Virtio-over-MMIO) */ 156 213 } VIRTIOPCIPARAMS, *PVIRTIOPCIPARAMS; 157 214 … … 207 264 */ 208 265 #define DEVICE_PCI_DEVICE_ID_VIRTIO_BASE 0x1040 266 267 /** 268 * @name Virtio Device types as outlined in chapter 5. 269 * @{ */ 270 #define VIRTIO_DEVICE_TYPE_INVALID 0 271 #define VIRTIO_DEVICE_TYPE_NETWORK 1 272 #define VIRTIO_DEVICE_TYPE_BLOCK 2 273 #define VIRTIO_DEVICE_TYPE_CONSOLE 3 274 #define VIRTIO_DEVICE_TYPE_ENTROPY_SOURCE 4 275 #define VIRTIO_DEVICE_TYPE_MEMORY_BALLOONING_TRAD 5 276 #define VIRTIO_DEVICE_TYPE_IOMEM 6 277 #define VIRTIO_DEVICE_TYPE_RPMSG 7 278 #define VIRTIO_DEVICE_TYPE_SCSI_HOST 8 279 #define VIRTIO_DEVICE_TYPE_9P_TRANSPORT 9 280 #define VIRTIO_DEVICE_TYPE_MAC80211_WLAN 10 281 #define VIRTIO_DEVICE_TYPE_RPROC_SERIAL 11 282 #define VIRTIO_DEVICE_TYPE_CAIF 12 283 #define VIRTIO_DEVICE_TYPE_MEMORY_BALLOONING 13 284 #define VIRTIO_DEVICE_TYPE_GPU 16 285 #define VIRTIO_DEVICE_TYPE_TIMER 17 286 #define VIRTIO_DEVICE_TYPE_INPUT 18 287 #define VIRTIO_DEVICE_TYPE_SOCKET 19 288 #define VIRTIO_DEVICE_TYPE_CRYPTO 20 289 #define VIRTIO_DEVICE_TYPE_SIGNAL_DIST_MOD 21 290 #define VIRTIO_DEVICE_TYPE_PSTORE 22 291 #define VIRTIO_DEVICE_TYPE_IOMMU 23 292 #define VIRTIO_DEVICE_TYPE_MEMORY 24 293 /** @} */ 209 294 210 295 /** Reserved (*negotiated*) Feature Bits (e.g. device independent features, VirtIO 1.0 spec,section 6) */ … … 371 456 uint32_t fLegacyDriver; /**< Set if guest drv < VirtIO 1.0 and allowed */ 372 457 uint32_t fOfferLegacy; /**< Set at init call from dev-specific code */ 458 uint16_t uIrqMmio; /**< The interrupt number when Virtio-over-MMIO is used */ 459 uint8_t uDeviceType; /**< The implemented device type for Virtio-over-MMIO */ 373 460 374 461 /** @name The locations of the capability structures in PCI config space and the BAR. … … 860 947 { 861 948 int rc; 862 if (virtioCoreIsLegacyMode(pVirtio)) 949 if ( virtioCoreIsLegacyMode(pVirtio) 950 || pVirtio->uIrqMmio) 863 951 rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, pvBuf, cbWrite); 864 952 else … … 870 958 { 871 959 int rc; 872 if (virtioCoreIsLegacyMode(pVirtio)) 960 if ( virtioCoreIsLegacyMode(pVirtio) 961 || pVirtio->uIrqMmio) 873 962 rc = PDMDevHlpPhysRead(pDevIns, GCPhys, pvBuf, cbRead); 874 963 else … … 1076 1165 size_t cbSeg = cbLim; 1077 1166 RTGCPHYS GCPhys = virtioCoreGCPhysChainGetNextSeg(pVirtqBuf->pSgPhysSend, &cbSeg); 1078 PDMDevHlpPCIPhysRead(pVirtio->pDevInsR3, GCPhys, pb, cbSeg); 1167 if (pVirtio->uIrqMmio) 1168 PDMDevHlpPhysRead(pVirtio->pDevInsR3, GCPhys, pb, cbSeg); 1169 else 1170 PDMDevHlpPCIPhysRead(pVirtio->pDevInsR3, GCPhys, pb, cbSeg); 1079 1171 pb += cbSeg; 1080 1172 cbLim -= cbSeg;
Note:
See TracChangeset
for help on using the changeset viewer.