aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Eichner <github@aeichner.de>2023-08-18 13:32:15 +0200
committerMichael Brown <mcb30@ipxe.org>2023-08-22 13:45:44 +0100
commit9e99a55b317f5da66f5110891b154084b337a031 (patch)
tree8c64b9a6b046ca90fd445197831278485a079b33
parentc1834f323f4f6b9b46cd5895b1457a117381363f (diff)
downloadipxe-9e99a55b317f5da66f5110891b154084b337a031.zip
ipxe-9e99a55b317f5da66f5110891b154084b337a031.tar.gz
ipxe-9e99a55b317f5da66f5110891b154084b337a031.tar.bz2
[virtio] Fix implementation of vpm_ioread32()
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>
-rw-r--r--src/drivers/bus/virtio-pci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drivers/bus/virtio-pci.c b/src/drivers/bus/virtio-pci.c
index 8b34c72..3fc93a9 100644
--- a/src/drivers/bus/virtio-pci.c
+++ b/src/drivers/bus/virtio-pci.c
@@ -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);