Re: [Qemu-devel] [PATCH v4 01/11] hw/m68k: add via support

2018-10-25 Thread Mark Cave-Ayland
On 23/10/2018 07:22, Thomas Huth wrote:

> On 2018-10-18 19:28, Mark Cave-Ayland wrote:
>> From: Laurent Vivier 
>>
>> Co-developed-by: Mark Cave-Ayland 
>> Signed-off-by: Mark Cave-Ayland 
>> Signed-off-by: Laurent Vivier 
>> ---
> [...]
>> diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
>> new file mode 100644
>> index 00..084974a24d
>> --- /dev/null
>> +++ b/hw/misc/mac_via.c
>> @@ -0,0 +1,668 @@
>> +/*
>> + * QEMU m68k Macintosh VIA device support
>> + *
>> + * Copyright (c) 2011-2018 Laurent Vivier
> 
> Should Mark be listed here, too? (since it has been co-developed?)

I don't mind so much as I have the tag above, but FWIW I've added my copyright 
here too.

>> + *
>> + * Some parts from hw/cuda.c
> 
> That's hw/misc/macio/cuda.c now.

Fixed.

>> + *
>> + * Copyright (c) 2004-2007 Fabrice Bellard
>> + * Copyright (c) 2007 Jocelyn Mayer
>> + *
>> + * some parts from linux-2.6.29, arch/m68k/include/asm/mac_via.h
>> + *
>> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
>> + * See the COPYING file in the top-level directory.
>> + *
> 
> Maybe remove the empty line?
> 
>> + */
>> +
>> +#include "qemu/osdep.h"
>> +#include "hw/sysbus.h"
>> +#include "qemu/timer.h"
>> +#include "hw/misc/mac_via.h"
>> +#include "hw/misc/mos6522.h"
>> +#include "hw/input/adb.h"
>> +#include "sysemu/sysemu.h"
>> +#include "qapi/error.h"
>> +#include "qemu/cutils.h"
>> +
>> +
>> +/*
>> + * VIAs: There are two in every machine,
> 
> Remove the comma at the end. And maybe add a very short description what
> a "VIA" is (for those who don't know this chip)
> 
>> + */
>> +
>> +#define VIA_SIZE (0x2000)
>> +
>> +/*
>> + * Not all of these are true post MacII I think.
>> + * CSA: probably the ones CHRP marks as 'unused' change purposes
> 
> What is CSA?
> 
>> + * when the IWM becomes the SWIM.
>> + * http://www.rs6000.ibm.com/resource/technology/chrpio/via5.mak.html
>> + * 
>> ftp://ftp.austin.ibm.com/pub/technology/spec/chrp/inwork/CHRP_IORef_1.0.pdf
>> + *
>> + * also, http://developer.apple.com/technotes/hw/hw_09.html claims the
> 
> All three URLs seem to be dead. Use archive.org?
> 
>> + * following changes for IIfx:
>> + * VIA1A_vSccWrReq not available and that VIA1A_vSync has moved to an IOP.
>> + * Also, "All of the functionality of VIA2 has been moved to other chips".
>> + */
>> +
>> +#define VIA1A_vSccWrReq 0x80   /* SCC write. (input)
>> +* [CHRP] SCC WREQ: Reflects the state of the
>> +* Wait/Request pins from the SCC.
>> +* [Macintosh Family Hardware]
>> +* as CHRP on SE/30,II,IIx,IIcx,IIci.
>> +* on IIfx, "0 means an active request"
>> +*/
>> +#define VIA1A_vRev8 0x40   /* Revision 8 board ???
>> +* [CHRP] En WaitReqB: Lets the WaitReq_L
>> +* signal from port B of the SCC appear on
>> +* the PA7 input pin. Output.
>> +* [Macintosh Family] On the SE/30, this
>> +* is the bit to flip screen buffers.
>> +* 0=alternate, 1=main.
>> +* on II,IIx,IIcx,IIci,IIfx this is a bit
>> +* for Rev ID. 0=II,IIx, 1=IIcx,IIci,IIfx
>> +*/
>> +#define VIA1A_vHeadSel  0x20   /* Head select for IWM.
>> +* [CHRP] unused.
>> +* [Macintosh Family] "Floppy disk
>> +* state-control line SEL" on all but IIfx
>> +*/
>> +#define VIA1A_vOverlay  0x10   /* [Macintosh Family] On SE/30,II,IIx,IIcx
>> +* this bit enables the "Overlay" address
>> +* map in the address decoders as it is on
>> +* reset for mapping the ROM over the reset
>> +* vector. 1=use overlay map.
>> +* On the IIci,IIfx it is another bit of the
>> +* CPU ID: 0=normal IIci, 1=IIci with parity
>> +* feature or IIfx.
>> +* [CHRP] En WaitReqA: Lets the WaitReq_L
>> +* signal from port A of the SCC appear
>> +* on the PA7 input pin (CHRP). Output.
>> +* [MkLinux] "Drive Select"
>> +*  (with 0x20 being 'disk head select')
>> +*/
>> +#define VIA1A_vSync 0x08   /* [CHRP] Sync Modem: modem clock select:
>> +* 1: select the external serial clock to
>> +*drive the SCC's /RTxCA 

Re: [Qemu-devel] [PATCH v4 01/11] hw/m68k: add via support

2018-10-23 Thread Thomas Huth
On 2018-10-18 19:28, Mark Cave-Ayland wrote:
> From: Laurent Vivier 
> 
> Co-developed-by: Mark Cave-Ayland 
> Signed-off-by: Mark Cave-Ayland 
> Signed-off-by: Laurent Vivier 
> ---
[...]
> diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
> new file mode 100644
> index 00..084974a24d
> --- /dev/null
> +++ b/hw/misc/mac_via.c
> @@ -0,0 +1,668 @@
> +/*
> + * QEMU m68k Macintosh VIA device support
> + *
> + * Copyright (c) 2011-2018 Laurent Vivier

Should Mark be listed here, too? (since it has been co-developed?)

> + *
> + * Some parts from hw/cuda.c

That's hw/misc/macio/cuda.c now.

> + *
> + * Copyright (c) 2004-2007 Fabrice Bellard
> + * Copyright (c) 2007 Jocelyn Mayer
> + *
> + * some parts from linux-2.6.29, arch/m68k/include/asm/mac_via.h
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *

Maybe remove the empty line?

> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/sysbus.h"
> +#include "qemu/timer.h"
> +#include "hw/misc/mac_via.h"
> +#include "hw/misc/mos6522.h"
> +#include "hw/input/adb.h"
> +#include "sysemu/sysemu.h"
> +#include "qapi/error.h"
> +#include "qemu/cutils.h"
> +
> +
> +/*
> + * VIAs: There are two in every machine,

Remove the comma at the end. And maybe add a very short description what
a "VIA" is (for those who don't know this chip)

> + */
> +
> +#define VIA_SIZE (0x2000)
> +
> +/*
> + * Not all of these are true post MacII I think.
> + * CSA: probably the ones CHRP marks as 'unused' change purposes

What is CSA?

> + * when the IWM becomes the SWIM.
> + * http://www.rs6000.ibm.com/resource/technology/chrpio/via5.mak.html
> + * 
> ftp://ftp.austin.ibm.com/pub/technology/spec/chrp/inwork/CHRP_IORef_1.0.pdf
> + *
> + * also, http://developer.apple.com/technotes/hw/hw_09.html claims the

All three URLs seem to be dead. Use archive.org?

> + * following changes for IIfx:
> + * VIA1A_vSccWrReq not available and that VIA1A_vSync has moved to an IOP.
> + * Also, "All of the functionality of VIA2 has been moved to other chips".
> + */
> +
> +#define VIA1A_vSccWrReq 0x80   /* SCC write. (input)
> +* [CHRP] SCC WREQ: Reflects the state of the
> +* Wait/Request pins from the SCC.
> +* [Macintosh Family Hardware]
> +* as CHRP on SE/30,II,IIx,IIcx,IIci.
> +* on IIfx, "0 means an active request"
> +*/
> +#define VIA1A_vRev8 0x40   /* Revision 8 board ???
> +* [CHRP] En WaitReqB: Lets the WaitReq_L
> +* signal from port B of the SCC appear on
> +* the PA7 input pin. Output.
> +* [Macintosh Family] On the SE/30, this
> +* is the bit to flip screen buffers.
> +* 0=alternate, 1=main.
> +* on II,IIx,IIcx,IIci,IIfx this is a bit
> +* for Rev ID. 0=II,IIx, 1=IIcx,IIci,IIfx
> +*/
> +#define VIA1A_vHeadSel  0x20   /* Head select for IWM.
> +* [CHRP] unused.
> +* [Macintosh Family] "Floppy disk
> +* state-control line SEL" on all but IIfx
> +*/
> +#define VIA1A_vOverlay  0x10   /* [Macintosh Family] On SE/30,II,IIx,IIcx
> +* this bit enables the "Overlay" address
> +* map in the address decoders as it is on
> +* reset for mapping the ROM over the reset
> +* vector. 1=use overlay map.
> +* On the IIci,IIfx it is another bit of the
> +* CPU ID: 0=normal IIci, 1=IIci with parity
> +* feature or IIfx.
> +* [CHRP] En WaitReqA: Lets the WaitReq_L
> +* signal from port A of the SCC appear
> +* on the PA7 input pin (CHRP). Output.
> +* [MkLinux] "Drive Select"
> +*  (with 0x20 being 'disk head select')
> +*/
> +#define VIA1A_vSync 0x08   /* [CHRP] Sync Modem: modem clock select:
> +* 1: select the external serial clock to
> +*drive the SCC's /RTxCA pin.
> +* 0: Select the 3.6864MHz clock to drive
> +*the SCC cell.
> +* [Macintosh Family] Correct on all but IIfx
> +*/
> +
> +/* Macintosh 

[Qemu-devel] [PATCH v4 01/11] hw/m68k: add via support

2018-10-18 Thread Mark Cave-Ayland
From: Laurent Vivier 

Co-developed-by: Mark Cave-Ayland 
Signed-off-by: Mark Cave-Ayland 
Signed-off-by: Laurent Vivier 
---
 hw/misc/Makefile.objs |   1 +
 hw/misc/mac_via.c | 668 ++
 include/hw/misc/mac_via.h | 106 
 3 files changed, 775 insertions(+)
 create mode 100644 hw/misc/mac_via.c
 create mode 100644 include/hw/misc/mac_via.h

diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 6d50b03cfd..122ec40f65 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -74,4 +74,5 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o
 obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
 obj-$(CONFIG_AUX) += auxbus.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
+obj-$(CONFIG_MAC_VIA) += mac_via.o
 obj-$(CONFIG_MSF2) += msf2-sysreg.o
diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
new file mode 100644
index 00..084974a24d
--- /dev/null
+++ b/hw/misc/mac_via.c
@@ -0,0 +1,668 @@
+/*
+ * QEMU m68k Macintosh VIA device support
+ *
+ * Copyright (c) 2011-2018 Laurent Vivier
+ *
+ * Some parts from hw/cuda.c
+ *
+ * Copyright (c) 2004-2007 Fabrice Bellard
+ * Copyright (c) 2007 Jocelyn Mayer
+ *
+ * some parts from linux-2.6.29, arch/m68k/include/asm/mac_via.h
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "hw/sysbus.h"
+#include "qemu/timer.h"
+#include "hw/misc/mac_via.h"
+#include "hw/misc/mos6522.h"
+#include "hw/input/adb.h"
+#include "sysemu/sysemu.h"
+#include "qapi/error.h"
+#include "qemu/cutils.h"
+
+
+/*
+ * VIAs: There are two in every machine,
+ */
+
+#define VIA_SIZE (0x2000)
+
+/*
+ * Not all of these are true post MacII I think.
+ * CSA: probably the ones CHRP marks as 'unused' change purposes
+ * when the IWM becomes the SWIM.
+ * http://www.rs6000.ibm.com/resource/technology/chrpio/via5.mak.html
+ * ftp://ftp.austin.ibm.com/pub/technology/spec/chrp/inwork/CHRP_IORef_1.0.pdf
+ *
+ * also, http://developer.apple.com/technotes/hw/hw_09.html claims the
+ * following changes for IIfx:
+ * VIA1A_vSccWrReq not available and that VIA1A_vSync has moved to an IOP.
+ * Also, "All of the functionality of VIA2 has been moved to other chips".
+ */
+
+#define VIA1A_vSccWrReq 0x80   /* SCC write. (input)
+* [CHRP] SCC WREQ: Reflects the state of the
+* Wait/Request pins from the SCC.
+* [Macintosh Family Hardware]
+* as CHRP on SE/30,II,IIx,IIcx,IIci.
+* on IIfx, "0 means an active request"
+*/
+#define VIA1A_vRev8 0x40   /* Revision 8 board ???
+* [CHRP] En WaitReqB: Lets the WaitReq_L
+* signal from port B of the SCC appear on
+* the PA7 input pin. Output.
+* [Macintosh Family] On the SE/30, this
+* is the bit to flip screen buffers.
+* 0=alternate, 1=main.
+* on II,IIx,IIcx,IIci,IIfx this is a bit
+* for Rev ID. 0=II,IIx, 1=IIcx,IIci,IIfx
+*/
+#define VIA1A_vHeadSel  0x20   /* Head select for IWM.
+* [CHRP] unused.
+* [Macintosh Family] "Floppy disk
+* state-control line SEL" on all but IIfx
+*/
+#define VIA1A_vOverlay  0x10   /* [Macintosh Family] On SE/30,II,IIx,IIcx
+* this bit enables the "Overlay" address
+* map in the address decoders as it is on
+* reset for mapping the ROM over the reset
+* vector. 1=use overlay map.
+* On the IIci,IIfx it is another bit of the
+* CPU ID: 0=normal IIci, 1=IIci with parity
+* feature or IIfx.
+* [CHRP] En WaitReqA: Lets the WaitReq_L
+* signal from port A of the SCC appear
+* on the PA7 input pin (CHRP). Output.
+* [MkLinux] "Drive Select"
+*  (with 0x20 being 'disk head select')
+*/
+#define VIA1A_vSync 0x08   /* [CHRP] Sync Modem: modem clock select:
+* 1: select the external serial clock to
+*drive the SCC's /RTxCA pin.
+* 0: Select the 3.6864MHz clock to drive
+*the SCC cell.
+