[PATCH v3 00/12] mos6522: switch to gpios, add control line edge-triggering and extra debugging

Mark Cave-Ayland posted 12 patches 2 years, 2 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220305141044.31911-1-mark.cave-ayland@ilande.co.uk
Maintainers: "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
There is a newer version of this series
hmp-commands-info.hx         |  15 +++
hw/m68k/q800.c               |   9 +-
hw/misc/mac_via.c            |  87 ++++++--------
hw/misc/macio/cuda.c         |   8 +-
hw/misc/macio/pmu.c          |  40 +------
hw/misc/mos6522.c            | 226 ++++++++++++++++++++++++++++++++---
hw/misc/trace-events         |   4 +-
include/hw/misc/mac_via.h    |  46 ++++---
include/hw/misc/macio/pmu.h  |   2 -
include/hw/misc/mos6522.h    |  46 +++++--
include/monitor/hmp-target.h |   1 +
11 files changed, 337 insertions(+), 147 deletions(-)
[PATCH v3 00/12] mos6522: switch to gpios, add control line edge-triggering and extra debugging
Posted by Mark Cave-Ayland 2 years, 2 months ago
Here is another patchset taken from my series to enable MacOS to boot on the q800
machine.

Patches 1-3 define the IFR bit flags in terms of the physical control lines and
update mac_via to use them.

Patch 4 does the main switch from custom methods in MOS6522DeviceClass to using
standard gpios whilst patch 5 removes these now-obsolete methods.

Patch 6 updates mos6522 instances to use the recommended method of calling
device_class_set_parent_reset() to propagate the device reset to the parent.

Patches 7 and 8 add more support for debugging guests using the mos6522 devices
by adding register names into the trace-event output and implementing a new
"info via" HMP command to give detailed information about the registers and timer
states.

Patch 9 introduces a new last_irq_levels field within MOS6522State to enable detection
of edge transitions, which is also a migration break for the q800 and g3beige/mac99
machines.

Patch 10 ensures that the SCSI_DATA (DRQ) bit in VIA2 is unlatched since in the q800
machine VIA2 is integrated within the on-board logic, and analysis of the MacOS
toolbox ROM suggests that the DRQ bit is expected to be live compared with older
Macs which use a real (latched) VIA.

Patches 11 implement edge-triggering for the CA1/2 and CB1/2 control lines as
documented in the datasheet, including updating the relevant inputs for negative
edge-triggering if required.

Finally patch 12 removes some old code in the PMU mos6522 instance which is now no
longer required with these latest changes.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

v3:
- Rebase onto master
- Add R-B tags from Laurent
- Introduce MOS6522_NUM_REGS in patch 7 as suggested by Phil

v2:
- Update patches 1-3 to use the BIT() macro
- Add R-B tags from Peter
- Update "info via" patch to use a target-specific HMP command as discussed on-list
- Add patch 10 "mac_via: make SCSI_DATA (DRQ) bit live rather than latched"


Mark Cave-Ayland (12):
  mos6522: add defines for IFR bit flags
  mac_via: use IFR bit flag constants for VIA1 IRQs
  mac_via: use IFR bit flag constants for VIA2 IRQs
  mos6522: switch over to use qdev gpios for IRQs
  mos6522: remove update_irq() and set_sr_int() methods from
    MOS6522DeviceClass
  mos6522: use device_class_set_parent_reset() to propagate reset to
    parent
  mos6522: add register names to register read/write trace events
  mos6522: add "info via" HMP command for debugging
  mos6522: record last_irq_levels in mos6522_set_irq()
  mac_via: make SCSI_DATA (DRQ) bit live rather than latched
  mos6522: implement edge-triggering for CA1/2 and CB1/2 control line
    IRQs
  macio/pmu.c: remove redundant code

 hmp-commands-info.hx         |  15 +++
 hw/m68k/q800.c               |   9 +-
 hw/misc/mac_via.c            |  87 ++++++--------
 hw/misc/macio/cuda.c         |   8 +-
 hw/misc/macio/pmu.c          |  40 +------
 hw/misc/mos6522.c            | 226 ++++++++++++++++++++++++++++++++---
 hw/misc/trace-events         |   4 +-
 include/hw/misc/mac_via.h    |  46 ++++---
 include/hw/misc/macio/pmu.h  |   2 -
 include/hw/misc/mos6522.h    |  46 +++++--
 include/monitor/hmp-target.h |   1 +
 11 files changed, 337 insertions(+), 147 deletions(-)

-- 
2.20.1
Re: [PATCH v3 00/12] mos6522: switch to gpios, add control line edge-triggering and extra debugging
Posted by Philippe Mathieu-Daudé 2 years, 2 months ago
On 5/3/22 15:10, Mark Cave-Ayland wrote:
> Here is another patchset taken from my series to enable MacOS to boot on the q800
> machine.

> v3:
> - Rebase onto master
> - Add R-B tags from Laurent

It seems you missed all my R-b...

> - Introduce MOS6522_NUM_REGS in patch 7 as suggested by Phil
> 
> v2:
> - Update patches 1-3 to use the BIT() macro
> - Add R-B tags from Peter
> - Update "info via" patch to use a target-specific HMP command as discussed on-list
> - Add patch 10 "mac_via: make SCSI_DATA (DRQ) bit live rather than latched"
Re: [PATCH v3 00/12] mos6522: switch to gpios, add control line edge-triggering and extra debugging
Posted by Mark Cave-Ayland 2 years, 2 months ago
On 05/03/2022 14:34, Philippe Mathieu-Daudé wrote:

> On 5/3/22 15:10, Mark Cave-Ayland wrote:
>> Here is another patchset taken from my series to enable MacOS to boot on the q800
>> machine.
> 
>> v3:
>> - Rebase onto master
>> - Add R-B tags from Laurent
> 
> It seems you missed all my R-b...

Apologies Phil, looks like I missed a couple. Patch 7 already has your R-B with your 
suggested change, so it's just patches 1 and 3 that I think I missed?


ATB,

Mark.

Re: [PATCH v3 00/12] mos6522: switch to gpios, add control line edge-triggering and extra debugging
Posted by Mark Cave-Ayland 2 years, 2 months ago
On 05/03/2022 14:51, Mark Cave-Ayland wrote:

> On 05/03/2022 14:34, Philippe Mathieu-Daudé wrote:
> 
>> On 5/3/22 15:10, Mark Cave-Ayland wrote:
>>> Here is another patchset taken from my series to enable MacOS to boot on the q800
>>> machine.
>>
>>> v3:
>>> - Rebase onto master
>>> - Add R-B tags from Laurent
>>
>> It seems you missed all my R-b...
> 
> Apologies Phil, looks like I missed a couple. Patch 7 already has your R-B with your 
> suggested change, so it's just patches 1 and 3 that I think I missed?

Looks like it's 1, 3 and 10 which I missed your R-b tags for. I'll send as a v4 
shortly, and sorry once again.


ATB,

Mark.