summaryrefslogtreecommitdiff
path: root/src/dev/virtio/pci.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-10-12 05:06:26 -0700
committerGabe Black <gabeblack@google.com>2018-10-17 20:17:44 +0000
commit2bcb2b031d4419e87337b25936a09228955dc715 (patch)
tree1da2953b4764a66bca23dfcf1656f4af205206d5 /src/dev/virtio/pci.cc
parent2701fcb2ffe76e2cb087807e87a9114d0009b7db (diff)
downloadgem5-2bcb2b031d4419e87337b25936a09228955dc715.tar.xz
dev: Explicitly specify the endianness for packet accessors.
Generally speaking, the endianness of the data devices provide or accept is dependent on the device and not the ISA the system executes. This change makes the devices in dev pick an endianness rather than using the guest's. For the ISA bus and the UART, accesses are byte sized and so endianness doesn't matter. The ISA and PCI busses and the devices which use them are defined to be little endian. Change-Id: Ib0aa70f192e1d6f3b886d9f3ad41ae03bddb583f Reviewed-on: https://gem5-review.googlesource.com/c/13462 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/dev/virtio/pci.cc')
-rw-r--r--src/dev/virtio/pci.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/dev/virtio/pci.cc b/src/dev/virtio/pci.cc
index 783b43e65..d1b8ea117 100644
--- a/src/dev/virtio/pci.cc
+++ b/src/dev/virtio/pci.cc
@@ -88,43 +88,43 @@ PciVirtIO::read(PacketPtr pkt)
case OFF_DEVICE_FEATURES:
DPRINTF(VIOIface, " DEVICE_FEATURES request\n");
assert(size == sizeof(uint32_t));
- pkt->set<uint32_t>(vio.deviceFeatures);
+ pkt->setLE<uint32_t>(vio.deviceFeatures);
break;
case OFF_GUEST_FEATURES:
DPRINTF(VIOIface, " GUEST_FEATURES request\n");
assert(size == sizeof(uint32_t));
- pkt->set<uint32_t>(vio.getGuestFeatures());
+ pkt->setLE<uint32_t>(vio.getGuestFeatures());
break;
case OFF_QUEUE_ADDRESS:
DPRINTF(VIOIface, " QUEUE_ADDRESS request\n");
assert(size == sizeof(uint32_t));
- pkt->set<uint32_t>(vio.getQueueAddress());
+ pkt->setLE<uint32_t>(vio.getQueueAddress());
break;
case OFF_QUEUE_SIZE:
DPRINTF(VIOIface, " QUEUE_SIZE request\n");
assert(size == sizeof(uint16_t));
- pkt->set<uint16_t>(vio.getQueueSize());
+ pkt->setLE<uint16_t>(vio.getQueueSize());
break;
case OFF_QUEUE_SELECT:
DPRINTF(VIOIface, " QUEUE_SELECT\n");
assert(size == sizeof(uint16_t));
- pkt->set<uint16_t>(vio.getQueueSelect());
+ pkt->setLE<uint16_t>(vio.getQueueSelect());
break;
case OFF_QUEUE_NOTIFY:
DPRINTF(VIOIface, " QUEUE_NOTIFY request\n");
assert(size == sizeof(uint16_t));
- pkt->set<uint16_t>(queueNotify);
+ pkt->setLE<uint16_t>(queueNotify);
break;
case OFF_DEVICE_STATUS:
DPRINTF(VIOIface, " DEVICE_STATUS request\n");
assert(size == sizeof(uint8_t));
- pkt->set<uint8_t>(vio.getDeviceStatus());
+ pkt->setLE<uint8_t>(vio.getDeviceStatus());
break;
case OFF_ISR_STATUS: {
@@ -135,7 +135,7 @@ PciVirtIO::read(PacketPtr pkt)
interruptDeliveryPending = false;
intrClear();
}
- pkt->set<uint8_t>(isr_status);
+ pkt->setLE<uint8_t>(isr_status);
} break;
default:
@@ -173,13 +173,13 @@ PciVirtIO::write(PacketPtr pkt)
case OFF_GUEST_FEATURES:
DPRINTF(VIOIface, " WRITE GUEST_FEATURES request\n");
assert(size == sizeof(uint32_t));
- vio.setGuestFeatures(pkt->get<uint32_t>());
+ vio.setGuestFeatures(pkt->getLE<uint32_t>());
break;
case OFF_QUEUE_ADDRESS:
DPRINTF(VIOIface, " WRITE QUEUE_ADDRESS\n");
assert(size == sizeof(uint32_t));
- vio.setQueueAddress(pkt->get<uint32_t>());
+ vio.setQueueAddress(pkt->getLE<uint32_t>());
break;
case OFF_QUEUE_SIZE:
@@ -189,19 +189,19 @@ PciVirtIO::write(PacketPtr pkt)
case OFF_QUEUE_SELECT:
DPRINTF(VIOIface, " WRITE QUEUE_SELECT\n");
assert(size == sizeof(uint16_t));
- vio.setQueueSelect(pkt->get<uint16_t>());
+ vio.setQueueSelect(pkt->getLE<uint16_t>());
break;
case OFF_QUEUE_NOTIFY:
DPRINTF(VIOIface, " WRITE QUEUE_NOTIFY\n");
assert(size == sizeof(uint16_t));
- queueNotify = pkt->get<uint16_t>();
+ queueNotify = pkt->getLE<uint16_t>();
vio.onNotify(queueNotify);
break;
case OFF_DEVICE_STATUS: {
assert(size == sizeof(uint8_t));
- uint8_t status(pkt->get<uint8_t>());
+ uint8_t status(pkt->getLE<uint8_t>());
DPRINTF(VIOIface, "VirtIO set status: 0x%x\n", status);
vio.setDeviceStatus(status);
} break;