diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-01-10 22:40:33 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2012-01-11 11:54:24 +1100 |
commit | c90d5abd0d047acb7c37fc5b67ccc9f3a9a942e5 (patch) | |
tree | a5ca6284c30a3e07396c8a1d17c3605260bce108 | |
parent | 59f6d802f39f733e79850cb71eeeeecaa46a2347 (diff) | |
download | SLOF-c90d5abd0d047acb7c37fc5b67ccc9f3a9a942e5.zip SLOF-c90d5abd0d047acb7c37fc5b67ccc9f3a9a942e5.tar.gz SLOF-c90d5abd0d047acb7c37fc5b67ccc9f3a9a942e5.tar.bz2 |
Fix virtio access sizeqemu-slof-20120111
We don't support 8-bytes PIO
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | lib/libhvcall/virtio.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/libhvcall/virtio.c b/lib/libhvcall/virtio.c index 91d60d2..0a3e91b 100644 --- a/lib/libhvcall/virtio.c +++ b/lib/libhvcall/virtio.c @@ -49,7 +49,8 @@ int virtio_get_qsize(struct virtio_device *dev, int queue) int size = 0; if (dev->type == VIRTIO_TYPE_PCI) { - ci_write_16(dev->base+VIRTIOHDR_QUEUE_SELECT, cpu_to_le16(queue)); + ci_write_16(dev->base+VIRTIOHDR_QUEUE_SELECT, + cpu_to_le16(queue)); eieio(); size = le16_to_cpu(ci_read_16(dev->base+VIRTIOHDR_QUEUE_SIZE)); } @@ -69,10 +70,11 @@ struct vring_desc *virtio_get_vring_desc(struct virtio_device *dev, int queue) struct vring_desc *desc = 0; if (dev->type == VIRTIO_TYPE_PCI) { - ci_write_16(dev->base+VIRTIOHDR_QUEUE_SELECT, cpu_to_le16(queue)); + ci_write_16(dev->base+VIRTIOHDR_QUEUE_SELECT, + cpu_to_le16(queue)); eieio(); desc = (void*)(4096L * - le32_to_cpu(ci_read_32(dev->base+VIRTIOHDR_QUEUE_ADDRESS))); + le32_to_cpu(ci_read_32(dev->base+VIRTIOHDR_QUEUE_ADDRESS))); } return desc; @@ -166,7 +168,6 @@ uint64_t virtio_get_config(struct virtio_device *dev, int offset, int size) default: return ~0ULL; } - switch (size) { case 1: val = ci_read_8(confbase+offset); @@ -178,7 +179,12 @@ uint64_t virtio_get_config(struct virtio_device *dev, int offset, int size) val = ci_read_32(confbase+offset); break; case 8: - val = ci_read_64(confbase+offset); + /* We don't support 8 bytes PIO accesses + * in qemu and this is all PIO + */ + val = ci_read_32(confbase+offset); + val <<= 32; + val |= ci_read_32(confbase+offset+4); break; } |