]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[virtio] Fix implementation of vpm_ioread32() 1028/head
authorAlexander Eichner <github@aeichner.de>
Fri, 18 Aug 2023 11:32:15 +0000 (13:32 +0200)
committerMichael Brown <mcb30@ipxe.org>
Tue, 22 Aug 2023 12:45:44 +0000 (13:45 +0100)
The current implementation of vpm_ioread32() erroneously reads only 16
bits of data, which fails when used with the (stricter) virtio device
emulation in VirtualBox.

Fix by using the correct readl()/inl() I/O wrappers.

Reworded-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/bus/virtio-pci.c

index 8b34c72777f538a95314e4e9f4cac1243f5d6067..3fc93a906c3c91c7dd7c463c75419e46bb38c32c 100644 (file)
@@ -230,10 +230,10 @@ u32 vpm_ioread32(struct virtio_pci_modern_device *vdev,
     uint32_t data;
     switch (region->flags & VIRTIO_PCI_REGION_TYPE_MASK) {
     case VIRTIO_PCI_REGION_MEMORY:
-        data = readw(region->base + offset);
+        data = readl(region->base + offset);
         break;
     case VIRTIO_PCI_REGION_PORT:
-        data = inw(region->base + offset);
+        data = inl(region->base + offset);
         break;
     case VIRTIO_PCI_REGION_PCI_CONFIG:
         prep_pci_cfg_cap(vdev, region, offset, 4);