Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


modified pci io hooks to not use the dev_io hooks, which are too constrictive
[palacios.git] / palacios / src / devices / lnx_virtio_blk.c
index 0720e93..f71b559 100644 (file)
 #include <devices/pci.h>
 
 
-/*
-#ifndef DEBUG_VIRTIO_BLK
+
+#ifndef CONFIG_DEBUG_VIRTIO_BLK
 #undef PrintDebug
 #define PrintDebug(fmt, args...)
 #endif
-*/
+
 
 #define BLK_CAPACITY_PORT     20
 #define BLK_MAX_SIZE_PORT     28
@@ -340,7 +340,8 @@ static int handle_kick(struct vm_device * dev) {
     return 0;
 }
 
-static int virtio_io_write(uint16_t port, void * src, uint_t length, struct vm_device * dev) {
+static int virtio_io_write(uint16_t port, void * src, uint_t length, void * private_data) {
+    struct vm_device * dev = (struct vm_device *)private_data;
     struct virtio_blk_state * virtio = (struct virtio_blk_state *)dev->private_data;
     int port_idx = port % virtio->io_range_size;
 
@@ -447,7 +448,8 @@ static int virtio_io_write(uint16_t port, void * src, uint_t length, struct vm_d
 }
 
 
-static int virtio_io_read(uint16_t port, void * dst, uint_t length, struct vm_device * dev) {
+static int virtio_io_read(uint16_t port, void * dst, uint_t length, void * private_data) {
+    struct vm_device * dev = (struct vm_device *)private_data;
     struct virtio_blk_state * virtio = (struct virtio_blk_state *)dev->private_data;
     int port_idx = port % virtio->io_range_size;
 
@@ -621,6 +623,7 @@ static int virtio_init(struct guest_info * vm, void * cfg_data) {
 
        bars[0].io_read = virtio_io_read;
        bars[0].io_write = virtio_io_write;
+       bars[0].private_data = dev;
 
        pci_dev = v3_pci_register_device(pci_bus, PCI_STD_DEVICE, 
                                         0, PCI_AUTO_DEV_NUM, 0,