aboutsummaryrefslogtreecommitdiff
path: root/hw/misc
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-08-30 11:24:47 +0100
committerLaurent Vivier <laurent@vivier.eu>2021-09-08 15:37:41 +0200
commitdde602ae539910c3579952834b713e2f360ec34a (patch)
treec139a0f3d90cbe7fb16baab5e77cffc39b6ce19a /hw/misc
parent812f06995bfe47aa7d6d358cee456e722032687b (diff)
mac_via: add qdev gpios for nubus slot interrupts to VIA2
These will soon be required to enable nubus devices to support interrupts. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210830102447.10806-13-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/misc')
-rw-r--r--hw/misc/mac_via.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
index f093f7388e..d1abcd97b5 100644
--- a/hw/misc/mac_via.c
+++ b/hw/misc/mac_via.c
@@ -1123,6 +1123,26 @@ static void mos6522_q800_via2_reset(DeviceState *dev)
ms->dirb = 0;
ms->b = 0;
+ ms->dira = 0;
+ ms->a = 0x7f;
+}
+
+static void via2_nubus_irq_request(void *opaque, int irq, int level)
+{
+ MOS6522Q800VIA2State *v2s = opaque;
+ MOS6522State *s = MOS6522(v2s);
+ MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
+
+ if (level) {
+ /* Port A nubus IRQ inputs are active LOW */
+ s->a &= ~(1 << irq);
+ s->ifr |= 1 << VIA2_IRQ_NUBUS_BIT;
+ } else {
+ s->a |= (1 << irq);
+ s->ifr &= ~(1 << VIA2_IRQ_NUBUS_BIT);
+ }
+
+ mdc->update_irq(s);
}
static void mos6522_q800_via2_init(Object *obj)
@@ -1135,6 +1155,9 @@ static void mos6522_q800_via2_init(Object *obj)
sysbus_init_mmio(sbd, &v2s->via_mem);
qdev_init_gpio_in(DEVICE(obj), via2_irq_request, VIA2_IRQ_NB);
+
+ qdev_init_gpio_in_named(DEVICE(obj), via2_nubus_irq_request, "nubus-irq",
+ VIA2_NUBUS_IRQ_NB);
}
static const VMStateDescription vmstate_q800_via2 = {