Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/hw/virtio-blk.c | 6 ++++-- src/hw/virtio-scsi.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index 2dfd0c3..dca7855 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -15,6 +15,7 @@ #include "pcidevice.h" // foreachpci #include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK #include "pci_regs.h" // PCI_VENDOR_ID +#include "stacks.h" // run_thread #include "std/disk.h" // DISK_RET_SUCCESS #include "string.h" // memset #include "util.h" // usleep @@ -93,8 +94,9 @@ virtio_blk_process_op(struct disk_op_s *op) }
static void -init_virtio_blk(struct pci_device *pci) +init_virtio_blk(void *data) { + struct pci_device *pci = data; u8 status = VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER; dprintf(1, "found virtio-blk at %pP\n", pci); struct virtiodrive_s *vdrive = malloc_fseg(sizeof(*vdrive)); @@ -203,6 +205,6 @@ virtio_blk_setup(void) (pci->device != PCI_DEVICE_ID_VIRTIO_BLK_09 && pci->device != PCI_DEVICE_ID_VIRTIO_BLK_10)) continue; - init_virtio_blk(pci); + run_thread(init_virtio_blk, pci); } } diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c index 322d469..5fb9409 100644 --- a/src/hw/virtio-scsi.c +++ b/src/hw/virtio-scsi.c @@ -16,6 +16,7 @@ #include "pcidevice.h" // foreachpci #include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK #include "pci_regs.h" // PCI_VENDOR_ID +#include "stacks.h" // run_thread #include "std/disk.h" // DISK_RET_SUCCESS #include "string.h" // memset #include "util.h" // usleep @@ -132,8 +133,9 @@ virtio_scsi_scan_target(struct pci_device *pci, struct vp_device *vp, }
static void -init_virtio_scsi(struct pci_device *pci) +init_virtio_scsi(void *data) { + struct pci_device *pci = data; dprintf(1, "found virtio-scsi at %pP\n", pci); struct vring_virtqueue *vq = NULL; struct vp_device *vp = malloc_high(sizeof(*vp)); @@ -199,6 +201,6 @@ virtio_scsi_setup(void) (pci->device != PCI_DEVICE_ID_VIRTIO_SCSI_09 && pci->device != PCI_DEVICE_ID_VIRTIO_SCSI_10)) continue; - init_virtio_scsi(pci); + run_thread(init_virtio_scsi, pci); } }