diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2021-08-30 11:24:47 +0100 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2021-09-08 15:37:41 +0200 |
commit | dde602ae539910c3579952834b713e2f360ec34a (patch) | |
tree | c139a0f3d90cbe7fb16baab5e77cffc39b6ce19a | |
parent | 812f06995bfe47aa7d6d358cee456e722032687b (diff) | |
download | qemu-dde602ae539910c3579952834b713e2f360ec34a.zip qemu-dde602ae539910c3579952834b713e2f360ec34a.tar.gz qemu-dde602ae539910c3579952834b713e2f360ec34a.tar.bz2 |
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>
-rw-r--r-- | hw/misc/mac_via.c | 23 | ||||
-rw-r--r-- | include/hw/misc/mac_via.h | 10 |
2 files changed, 33 insertions, 0 deletions
diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index f093f73..d1abcd9 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 = { diff --git a/include/hw/misc/mac_via.h b/include/hw/misc/mac_via.h index 5168e3c..4506abe 100644 --- a/include/hw/misc/mac_via.h +++ b/include/hw/misc/mac_via.h @@ -93,6 +93,16 @@ struct MOS6522Q800VIA1State { #define VIA2_IRQ_SCSI (1 << VIA2_IRQ_UNUSED_BIT) #define VIA2_IRQ_ASC (1 << VIA2_IRQ_ASC_BIT) +#define VIA2_NUBUS_IRQ_NB 7 + +#define VIA2_NUBUS_IRQ_9 0 +#define VIA2_NUBUS_IRQ_A 1 +#define VIA2_NUBUS_IRQ_B 2 +#define VIA2_NUBUS_IRQ_C 3 +#define VIA2_NUBUS_IRQ_D 4 +#define VIA2_NUBUS_IRQ_E 5 +#define VIA2_NUBUS_IRQ_INTVIDEO 6 + #define TYPE_MOS6522_Q800_VIA2 "mos6522-q800-via2" OBJECT_DECLARE_SIMPLE_TYPE(MOS6522Q800VIA2State, MOS6522_Q800_VIA2) |