All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <huth@tuxfamily.org>
To: Laurent Vivier <laurent@vivier.eu>
Cc: "Fam Zheng" <fam@euphon.net>, "Kevin Wolf" <kwolf@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	qemu-block@nongnu.org, "Jason Wang" <jasowang@redhat.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org, "Max Reitz" <mreitz@redhat.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
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	[thread overview]
Message-ID: <20190526182041.3a41e568@thl530.multi.box> (raw)
In-Reply-To: <20190525225013.13916-3-laurent@vivier.eu>

Am Sun, 26 May 2019 00:50:05 +0200
schrieb Laurent Vivier <laurent@vivier.eu>:

> 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 <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  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


  reply	other threads:[~2019-05-26 16:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-25 22:50 [Qemu-devel] [PATCH v7 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 01/10] escc: introduce a selector for the register bit Laurent Vivier
2019-05-26 16:05   ` Thomas Huth
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 02/10] esp: add pseudo-DMA as used by Macintosh Laurent Vivier
2019-05-26 16:20   ` Thomas Huth [this message]
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 03/10] dp8393x: manage big endian bus Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 04/10] hw/m68k: add via support Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 05/10] hw/m68k: implement ADB bus support for via Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 06/10] hw/m68k: add macfb video card Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 07/10] hw/m68k: add Nubus support Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 08/10] hw/m68k: add Nubus support for macfb video card Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 09/10] hw/m68k: add a dummy SWIM floppy controller Laurent Vivier
2019-05-25 22:50 ` [Qemu-devel] [PATCH v7 10/10] hw/m68k: define Macintosh Quadra 800 Laurent Vivier
2019-05-26 17:00   ` Thomas Huth
2019-05-27 12:17   ` Mark Cave-Ayland
2019-05-27 13:32   ` Aleksandar Markovic
2019-05-27 13:36     ` Laurent Vivier
2019-05-27 14:18     ` Aleksandar Markovic
2019-05-25 23:21 ` [Qemu-devel] [PATCH v7 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190526182041.3a41e568@thl530.multi.box \
    --to=huth@tuxfamily.org \
    --cc=aurelien@aurel32.net \
    --cc=dgilbert@redhat.com \
    --cc=fam@euphon.net \
    --cc=hpoussin@reactos.org \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.