aboutsummaryrefslogtreecommitdiff
path: root/lib/libvirtio/virtio.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-01-13 17:25:00 +1100
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-01-19 17:17:50 +1100
commit44e8d9a57d2e67e5e05d6ae1902eec90db77f752 (patch)
treefe7c574147648842e89e60cf2cc0e9f61d350a41 /lib/libvirtio/virtio.c
parentca610c931e2b0004c44f748cb813580b09c60489 (diff)
downloadSLOF-44e8d9a57d2e67e5e05d6ae1902eec90db77f752.zip
SLOF-44e8d9a57d2e67e5e05d6ae1902eec90db77f752.tar.gz
SLOF-44e8d9a57d2e67e5e05d6ae1902eec90db77f752.tar.bz2
Add virtfs support
Code originally written by Timothy Rule and reworked & bug fixed by myself Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'lib/libvirtio/virtio.c')
-rw-r--r--lib/libvirtio/virtio.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libvirtio/virtio.c b/lib/libvirtio/virtio.c
index 4e70053..29d5dd3 100644
--- a/lib/libvirtio/virtio.c
+++ b/lib/libvirtio/virtio.c
@@ -189,3 +189,25 @@ uint64_t virtio_get_config(struct virtio_device *dev, int offset, int size)
return val;
}
+
+/**
+ * Get config blob
+ */
+int __virtio_read_config(struct virtio_device *dev, void *dst,
+ int offset, int len)
+{
+ void *confbase;
+ unsigned char *buf = dst;
+ int i;
+
+ switch (dev->type) {
+ case VIRTIO_TYPE_PCI:
+ confbase = dev->base+VIRTIOHDR_DEVICE_CONFIG;
+ break;
+ default:
+ return 0;
+ }
+ for (i = 0; i < len; i++)
+ buf[i] = ci_read_8(confbase + offset + i);
+ return len;
+}