From: Paolo Bonzini <pbonzini@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Fam Zheng" <fam@euphon.net>,
qemu-block@nongnu.org, "Thomas Huth" <huth@tuxfamily.org>,
"Jason Wang" <jasowang@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
"Max Reitz" <mreitz@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH v15 02/11] esp: move get_cmd() post-DMA code to get_cmd_cb()
Date: Sun, 27 Oct 2019 18:02:36 +0100 [thread overview]
Message-ID: <c5bf404d-a650-8ae5-aeab-9d0c07aea2ae@redhat.com> (raw)
In-Reply-To: <20191026164546.30020-3-laurent@vivier.eu>
On 26/10/19 18:45, Laurent Vivier wrote:
> This will be needed to implement pseudo-DMA
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> hw/scsi/esp.c | 46 +++++++++++++++++++++++++++++-----------------
> 1 file changed, 29 insertions(+), 17 deletions(-)
>
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index 09b28cba17..0230ede21d 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -84,6 +84,34 @@ void esp_request_cancelled(SCSIRequest *req)
> }
> }
>
> +static int get_cmd_cb(ESPState *s)
> +{
> + int target;
> +
> + target = s->wregs[ESP_WBUSID] & BUSID_DID;
> +
> + s->ti_size = 0;
> + s->ti_rptr = 0;
> + s->ti_wptr = 0;
> +
> + if (s->current_req) {
> + /* Started a new command before the old one finished. Cancel it. */
> + scsi_req_cancel(s->current_req);
> + s->async_len = 0;
> + }
> +
> + s->current_dev = scsi_device_find(&s->bus, 0, target, 0);
> + if (!s->current_dev) {
> + /* No such drive */
> + s->rregs[ESP_RSTAT] = 0;
> + s->rregs[ESP_RINTR] = INTR_DC;
> + s->rregs[ESP_RSEQ] = SEQ_0;
> + esp_raise_irq(s);
> + return -1;
> + }
> + return 0;
> +}
> +
> static uint32_t get_cmd(ESPState *s, uint8_t *buf, uint8_t buflen)
> {
> uint32_t dmalen;
> @@ -108,23 +136,7 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf, uint8_t buflen)
> }
> trace_esp_get_cmd(dmalen, target);
>
> - s->ti_size = 0;
> - s->ti_rptr = 0;
> - s->ti_wptr = 0;
> -
> - if (s->current_req) {
> - /* Started a new command before the old one finished. Cancel it. */
> - scsi_req_cancel(s->current_req);
> - s->async_len = 0;
> - }
> -
> - s->current_dev = scsi_device_find(&s->bus, 0, target, 0);
> - if (!s->current_dev) {
> - // No such drive
> - s->rregs[ESP_RSTAT] = 0;
> - s->rregs[ESP_RINTR] = INTR_DC;
> - s->rregs[ESP_RSEQ] = SEQ_0;
> - esp_raise_irq(s);
> + if (get_cmd_cb(s) < 0) {
> return 0;
> }
> return dmalen;
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2019-10-27 17:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 16:45 [PATCH v15 00/11] hw/m68k: add Apple Machintosh Quadra 800 machine Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 01/11] esp: move handle_ti_cmd() cleanup code to esp_do_dma() Laurent Vivier
2019-10-27 17:02 ` Paolo Bonzini
2019-10-26 16:45 ` [PATCH v15 02/11] esp: move get_cmd() post-DMA code to get_cmd_cb() Laurent Vivier
2019-10-26 17:21 ` Philippe Mathieu-Daudé
2019-10-27 17:02 ` Paolo Bonzini [this message]
2019-10-26 16:45 ` [PATCH v15 03/11] esp: add pseudo-DMA as used by Macintosh Laurent Vivier
2019-10-27 17:02 ` Paolo Bonzini
2019-10-26 16:45 ` [PATCH v15 04/11] dp8393x: manage big endian bus Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 05/11] hw/m68k: add VIA support Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 06/11] hw/m68k: implement ADB bus support for via Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 07/11] hw/m68k: add Nubus support Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 08/11] hw/m68k: add Nubus macfb video card Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 09/11] hw/m68k: add a dummy SWIM floppy controller Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 10/11] hw/m68k: define Macintosh Quadra 800 Laurent Vivier
2019-10-26 16:45 ` [PATCH v15 11/11] BootLinuxConsoleTest: Test the " Laurent Vivier
2019-10-27 3:47 ` [PATCH v15 00/11] 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=c5bf404d-a650-8ae5-aeab-9d0c07aea2ae@redhat.com \
--to=pbonzini@redhat.com \
--cc=aurelien@aurel32.net \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=hpoussin@reactos.org \
--cc=huth@tuxfamily.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=philmd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).