VirtIODevice *vdev = dev->vdev;
uint32_t features;
- vdev->status = ldub_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS);
+ virtio_set_status(vdev, ldub_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS));
/* Update guest supported feature bitmap */
virtio_queue_notify(vdev, value);
break;
case SYBORG_VIRTIO_STATUS:
- vdev->status = value & 0xFF;
+ virtio_set_status(vdev, value & 0xFF);
if (vdev->status == 0)
virtio_reset(vdev);
break;
virtio_queue_notify(vdev, val);
break;
case VIRTIO_PCI_STATUS:
- vdev->status = val & 0xFF;
+ virtio_set_status(vdev, val & 0xFF);
if (vdev->status == 0) {
virtio_reset(proxy->vdev);
msix_unuse_all_vectors(&proxy->pci_dev);
if (PCI_COMMAND == address) {
if (!(val & PCI_COMMAND_MASTER)) {
if (!(proxy->bugs & VIRTIO_PCI_BUG_BUS_MASTER)) {
- proxy->vdev->status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
+ virtio_set_status(proxy->vdev,
+ proxy->vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK);
}
}
}
void (*get_config)(VirtIODevice *vdev, uint8_t *config);
void (*set_config)(VirtIODevice *vdev, const uint8_t *config);
void (*reset)(VirtIODevice *vdev);
+ void (*set_status)(VirtIODevice *vdev, uint8_t val);
VirtQueue *vq;
const VirtIOBindings *binding;
void *binding_opaque;
uint16_t device_id;
};
+static inline void virtio_set_status(VirtIODevice *vdev, uint8_t val)
+{
+ if (vdev->set_status) {
+ vdev->set_status(vdev, val);
+ }
+ vdev->status = val;
+}
+
VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
void (*handle_output)(VirtIODevice *,
VirtQueue *));