[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/22] mac_via: make SCSI_DATA (DRQ) bit live rather than latched
From: |
Mark Cave-Ayland |
Subject: |
[PULL 10/22] mac_via: make SCSI_DATA (DRQ) bit live rather than latched |
Date: |
Wed, 9 Mar 2022 11:08:19 +0000 |
The VIA2 on the Q800 machine is not a separate chip as in older Macs but instead
is integrated into the on-board logic. From analysing the SCSI routines in the
MacOS toolbox ROM (and to a lesser extent NetBSD and Linux) the expectation
seems
to be that the SCSI_DATA (DRQ) bit is live on the Q800 and not latched.
Fortunately we can use the recently introduced mos6522 last_irq_levels variable
which tracks the edge-triggered state to return the SCSI_DATA (DRQ) bit live to
the guest OS.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220305150957.5053-11-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/misc/mac_via.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
index 3f473c3fcf..d8b35e6ca6 100644
--- a/hw/misc/mac_via.c
+++ b/hw/misc/mac_via.c
@@ -906,9 +906,24 @@ static uint64_t mos6522_q800_via2_read(void *opaque,
hwaddr addr, unsigned size)
{
MOS6522Q800VIA2State *s = MOS6522_Q800_VIA2(opaque);
MOS6522State *ms = MOS6522(s);
+ uint64_t val;
addr = (addr >> 9) & 0xf;
- return mos6522_read(ms, addr, size);
+ val = mos6522_read(ms, addr, size);
+
+ switch (addr) {
+ case VIA_REG_IFR:
+ /*
+ * On a Q800 an emulated VIA2 is integrated into the onboard logic. The
+ * expectation of most OSs is that the DRQ bit is live, rather than
+ * latched as it would be on a real VIA so do the same here.
+ */
+ val &= ~VIA2_IRQ_SCSI_DATA;
+ val |= (ms->last_irq_levels & VIA2_IRQ_SCSI_DATA);
+ break;
+ }
+
+ return val;
}
static void mos6522_q800_via2_write(void *opaque, hwaddr addr, uint64_t val,
--
2.20.1
- [PULL 01/22] mos6522: add defines for IFR bit flags, (continued)
- [PULL 01/22] mos6522: add defines for IFR bit flags, Mark Cave-Ayland, 2022/03/09
- [PULL 02/22] mac_via: use IFR bit flag constants for VIA1 IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 03/22] mac_via: use IFR bit flag constants for VIA2 IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 04/22] mos6522: switch over to use qdev gpios for IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 05/22] mos6522: remove update_irq() and set_sr_int() methods from MOS6522DeviceClass, Mark Cave-Ayland, 2022/03/09
- [PULL 07/22] mos6522: add register names to register read/write trace events, Mark Cave-Ayland, 2022/03/09
- [PULL 06/22] mos6522: use device_class_set_parent_reset() to propagate reset to parent, Mark Cave-Ayland, 2022/03/09
- [PULL 08/22] mos6522: add "info via" HMP command for debugging, Mark Cave-Ayland, 2022/03/09
- [PULL 09/22] mos6522: record last_irq_levels in mos6522_set_irq(), Mark Cave-Ayland, 2022/03/09
- [PULL 11/22] mos6522: implement edge-triggering for CA1/2 and CB1/2 control line IRQs, Mark Cave-Ayland, 2022/03/09
- [PULL 10/22] mac_via: make SCSI_DATA (DRQ) bit live rather than latched,
Mark Cave-Ayland <=
- [PULL 12/22] macio/pmu.c: remove redundant code, Mark Cave-Ayland, 2022/03/09
- [PULL 13/22] macfb: add VMStateDescription for MacfbNubusState and MacfbSysBusState, Mark Cave-Ayland, 2022/03/09
- [PULL 14/22] macfb: don't use special irq_state and irq_mask variables in MacfbState, Mark Cave-Ayland, 2022/03/09
- [PULL 15/22] macfb: increase number of registers saved in MacfbState, Mark Cave-Ayland, 2022/03/09
- [PULL 19/22] esp: introduce esp_pdma_cb() function, Mark Cave-Ayland, 2022/03/09
- [PULL 16/22] macfb: add VMStateDescription fields for display type and VBL timer, Mark Cave-Ayland, 2022/03/09
- [PULL 17/22] macfb: set initial value of mode control registers in macfb_common_realize(), Mark Cave-Ayland, 2022/03/09
- [PULL 18/22] esp: introduce esp_set_pdma_cb() function, Mark Cave-Ayland, 2022/03/09
- [PULL 21/22] esp: include the current PDMA callback in the migration stream, Mark Cave-Ayland, 2022/03/09
- [PULL 22/22] esp: recreate ESPState current_req after migration, Mark Cave-Ayland, 2022/03/09