[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 02/10] esp: add pseudo-DMA as used by Macinto
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH v7 02/10] esp: add pseudo-DMA as used by Macintosh |
Date: |
Sun, 26 May 2019 18:20:41 +0200 |
Am Sun, 26 May 2019 00:50:05 +0200
schrieb Laurent Vivier <address@hidden>:
> There is no DMA in Quadra 800, so the CPU reads/writes the data from
> the PDMA register (offset 0x100, ESP_PDMA in hw/m68k/q800.c) and
> copies them to/from the memory.
>
> There is a nice assembly loop in the kernel to do that, see
> linux/drivers/scsi/mac_esp.c:MAC_ESP_PDMA_LOOP().
>
> The start of the transfer is triggered by the DREQ interrupt (see
> linux mac_esp_send_pdma_cmd()), the CPU polls on the IRQ flag to
> start the transfer after a SCSI command has been sent (in Quadra 800
> it goes through the VIA2, the via2-irq line and the vIFR register)
>
> The Macintosh hardware includes hardware handshaking to prevent the
> CPU from reading invalid data or writing data faster than the
> peripheral device can accept it.
>
> This is the "blind mode", and from the doc:
> "Approximate maximum SCSI transfer rates within a blocks are 1.4 MB
> per second for blind transfers in the Macintosh II"
>
> Some references can be found in:
> Apple Macintosh Family Hardware Reference, ISBN 0-201-19255-1
> Guide to the Macintosh Family Hardware, ISBN-0-201-52405-8
>
> Co-developed-by: Mark Cave-Ayland <address@hidden>
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
> hw/scsi/esp.c | 293
> +++++++++++++++++++++++++++++++++++++----- include/hw/scsi/esp.h |
> 7 + 2 files changed, 271 insertions(+), 29 deletions(-)
[...]
> @@ -162,6 +196,15 @@ static void do_cmd(ESPState *s, uint8_t *buf)
> do_busid_cmd(s, &buf[1], busid);
> }
>
> +static void satn_pdma_cb(ESPState *s)
> +{
> + if (get_cmd_cb(s) < 0) {
> + return;
> + }
> + if (s->pdma_cur != s->pdma_start)
> + do_cmd(s, s->pdma_start);
Curly braces, please.
> +}
> +
> static void handle_satn(ESPState *s)
> {
> uint8_t buf[32];
> @@ -171,11 +214,21 @@ static void handle_satn(ESPState *s)
> s->dma_cb = handle_satn;
> return;
> }
> + s->pdma_cb = satn_pdma_cb;
> len = get_cmd(s, buf, sizeof(buf));
> if (len)
> do_cmd(s, buf);
> }
>
> +static void s_without_satn_pdma_cb(ESPState *s)
> +{
> + if (get_cmd_cb(s) < 0) {
> + return;
> + }
> + if (s->pdma_cur != s->pdma_start)
> + do_busid_cmd(s, s->pdma_start, 0);
dito.
> +}
> +
> static void handle_s_without_atn(ESPState *s)
> {
> uint8_t buf[32];
[...]
> @@ -370,14 +526,14 @@ static void handle_ti(ESPState *s)
> s->dma_left = minlen;
> s->rregs[ESP_RSTAT] &= ~STAT_TC;
> esp_do_dma(s);
> - }
> - if (s->do_cmd) {
> + } else if (s->do_cmd) {
> trace_esp_handle_ti_cmd(s->cmdlen);
> s->ti_size = 0;
> s->cmdlen = 0;
> s->do_cmd = 0;
> do_cmd(s, s->cmdbuf);
> }
> +
> }
Superfluous empty line.
Apart from those nits (which can be fixed when you apply the patches),
the patch looks fine to me.
Thomas
- [Qemu-devel] [PATCH v7 07/10] hw/m68k: add Nubus support, (continued)
- [Qemu-devel] [PATCH v7 07/10] hw/m68k: add Nubus support, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 09/10] hw/m68k: add a dummy SWIM floppy controller, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 05/10] hw/m68k: implement ADB bus support for via, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 04/10] hw/m68k: add via support, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 03/10] dp8393x: manage big endian bus, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 08/10] hw/m68k: add Nubus support for macfb video card, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 06/10] hw/m68k: add macfb video card, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 01/10] escc: introduce a selector for the register bit, Laurent Vivier, 2019/05/25
- [Qemu-devel] [PATCH v7 02/10] esp: add pseudo-DMA as used by Macintosh, Laurent Vivier, 2019/05/25
- Re: [Qemu-devel] [PATCH v7 02/10] esp: add pseudo-DMA as used by Macintosh,
Thomas Huth <=
- Re: [Qemu-devel] [PATCH v7 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine, no-reply, 2019/05/25