-/* $OpenBSD: i8259.c,v 1.21 2022/11/10 18:58:02 mbuhl Exp $ */
+/* $OpenBSD: i8259.c,v 1.22 2023/09/01 19:42:26 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
{
mutex_lock(&pic_mtx);
if (irq <= 7) {
- if (!ISSET(pics[MASTER].imr, 1 << irq)) {
- SET(pics[MASTER].irr, 1 << irq);
- pics[MASTER].asserted = 1;
- }
+ SET(pics[MASTER].irr, 1 << irq);
+ pics[MASTER].asserted = 1;
} else {
irq -= 8;
- if (!ISSET(pics[SLAVE].imr, 1 << irq)) {
- SET(pics[SLAVE].irr, 1 << irq);
- pics[SLAVE].asserted = 1;
+ SET(pics[SLAVE].irr, 1 << irq);
+ pics[SLAVE].asserted = 1;
- /* Assert cascade IRQ on master PIC */
- SET(pics[MASTER].irr, 1 << 2);
- pics[MASTER].asserted = 1;
- }
+ /* Assert cascade IRQ on master PIC */
+ SET(pics[MASTER].irr, 1 << 2);
+ pics[MASTER].asserted = 1;
}
mutex_unlock(&pic_mtx);
}
-/* $OpenBSD: vioblk.c,v 1.4 2023/05/28 05:28:50 asou Exp $ */
+/* $OpenBSD: vioblk.c,v 1.5 2023/09/01 19:42:26 dv Exp $ */
/*
* Copyright (c) 2023 Dave Voutila <dv@openbsd.org>
extern struct vmd_vm *current_vm;
static const char *disk_type(int);
-static uint32_t handle_io_read(struct viodev_msg *, struct virtio_dev *);
+static uint32_t handle_io_read(struct viodev_msg *, struct virtio_dev *,
+ int8_t *);
static int handle_io_write(struct viodev_msg *, struct virtio_dev *);
void vioblk_notify_rx(struct vioblk_dev *);
int vioblk_notifyq(struct vioblk_dev *);
struct viodev_msg msg;
struct imsg imsg;
ssize_t n;
+ int8_t intr = INTR_STATE_NOOP;
if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
}
case VIODEV_MSG_IO_READ:
/* Read IO: make sure to send a reply */
- msg.data = handle_io_read(&msg, dev);
+ msg.data = handle_io_read(&msg, dev, &intr);
msg.data_valid = 1;
+ msg.state = intr;
imsg_compose_event(iev, IMSG_DEVOP_MSG, 0, 0, -1, &msg,
sizeof(msg));
break;
}
static uint32_t
-handle_io_read(struct viodev_msg *msg, struct virtio_dev *dev)
+handle_io_read(struct viodev_msg *msg, struct virtio_dev *dev, int8_t *intr)
{
struct vioblk_dev *vioblk = &dev->vioblk;
uint8_t sz = msg->io_sz;
case VIRTIO_CONFIG_ISR_STATUS:
data = vioblk->cfg.isr_status;
vioblk->cfg.isr_status = 0;
- virtio_deassert_pic_irq(dev, 0);
+ if (intr != NULL)
+ *intr = INTR_STATE_DEASSERT;
break;
default:
return (0xFFFFFFFF);
-/* $OpenBSD: vionet.c,v 1.3 2023/05/13 23:15:28 dv Exp $ */
+/* $OpenBSD: vionet.c,v 1.4 2023/09/01 19:42:26 dv Exp $ */
/*
* Copyright (c) 2023 Dave Voutila <dv@openbsd.org>
static int vionet_rx(struct vionet_dev *);
static void vionet_rx_event(int, short, void *);
-static uint32_t handle_io_read(struct viodev_msg *, struct virtio_dev *);
+static uint32_t handle_io_read(struct viodev_msg *, struct virtio_dev *,
+ int8_t *);
static int handle_io_write(struct viodev_msg *, struct virtio_dev *);
void vionet_notify_rx(struct virtio_dev *);
int vionet_notifyq(struct virtio_dev *);
struct viodev_msg msg;
struct imsg imsg;
ssize_t n;
+ int8_t intr = INTR_STATE_NOOP;
if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
}
case VIODEV_MSG_IO_READ:
/* Read IO: make sure to send a reply */
- msg.data = handle_io_read(&msg, dev);
+ msg.data = handle_io_read(&msg, dev, &intr);
msg.data_valid = 1;
+ msg.state = intr;
imsg_compose_event(iev, IMSG_DEVOP_MSG, 0, 0, -1, &msg,
sizeof(msg));
break;
}
static uint32_t
-handle_io_read(struct viodev_msg *msg, struct virtio_dev *dev)
+handle_io_read(struct viodev_msg *msg, struct virtio_dev *dev, int8_t *intr)
{
struct vionet_dev *vionet = &dev->vionet;
uint32_t data;
case VIRTIO_CONFIG_ISR_STATUS:
data = vionet->cfg.isr_status;
vionet->cfg.isr_status = 0;
- virtio_deassert_pic_irq(dev, 0);
+ if (intr != NULL)
+ *intr = INTR_STATE_DEASSERT;
break;
default:
return (0xFFFFFFFF);