qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@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>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH v13 1/9] esp: add pseudo-DMA as used by Macintosh
Date: Wed, 2 Oct 2019 17:03:30 +0200	[thread overview]
Message-ID: <85676490-43a7-5348-ecf3-c5654eb111ff@redhat.com> (raw)
In-Reply-To: <e62b699d-6e05-1914-65b6-683e81b7640d@vivier.eu>

On 10/2/19 2:33 PM, Laurent Vivier wrote:
> Le 02/10/2019 à 13:10, Philippe Mathieu-Daudé a écrit :
>> On 9/27/19 11:04 AM, Laurent Vivier wrote:
>>> 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
>>>
>>> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>>> 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         | 338 ++++++++++++++++++++++++++++++++++++++----
>>>    include/hw/scsi/esp.h |  15 ++
>>
>> I recommend you to install the scripts/git.orderfile file.
> 
> done
> 
>>
>>>    2 files changed, 324 insertions(+), 29 deletions(-)
>>>
> ...
>>> --- a/include/hw/scsi/esp.h
>>> +++ b/include/hw/scsi/esp.h
>>> @@ -14,10 +14,18 @@ typedef void (*ESPDMAMemoryReadWriteFunc)(void
>>> *opaque, uint8_t *buf, int len);
>>>      typedef struct ESPState ESPState;
>>>    +enum pdma_origin_id {
>>> +    PDMA,
>>> +    TI,
>>> +    CMD,
>>> +    ASYNC,
>>> +};
>>> +
>>>    struct ESPState {
>>>        uint8_t rregs[ESP_REGS];
>>>        uint8_t wregs[ESP_REGS];
>>>        qemu_irq irq;
>>> +    qemu_irq irq_data;
>>>        uint8_t chip_id;
>>>        bool tchi_written;
>>>        int32_t ti_size;
>>> @@ -48,6 +56,12 @@ struct ESPState {
>>>        ESPDMAMemoryReadWriteFunc dma_memory_write;
>>>        void *dma_opaque;
>>>        void (*dma_cb)(ESPState *s);
>>> +    uint8_t pdma_buf[32];
>>> +    int pdma_origin;
>>
>> 'int' -> 'enum pdma_origin_id'
>>
>> You can also declare the enum in place:
>>
>>         enum pdma_origin_id {
>>             PDMA,
>>             TI,
>>             CMD,
>>             ASYNC,
>>         } pdma_origin;
> 
> If I remember correctly I put an "int" here because I didn't find the
> VMSTATE_XXX() to use and VMSTATE_INT32() doesn't like the enum type
> (which should be treated as an int).

Yes you are correct, I didn't check this was a migrated enum.

Regards,

Phil.


  reply	other threads:[~2019-10-02 15:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27  9:04 [PATCH v13 0/9] hw/m68k: add Apple Machintosh Quadra 800 machine Laurent Vivier
2019-09-27  9:04 ` [PATCH v13 1/9] esp: add pseudo-DMA as used by Macintosh Laurent Vivier
2019-10-01 19:11   ` Laurent Vivier
2019-10-02 11:10   ` Philippe Mathieu-Daudé
2019-10-02 12:33     ` Laurent Vivier
2019-10-02 15:03       ` Philippe Mathieu-Daudé [this message]
2019-09-27  9:04 ` [PATCH v13 2/9] dp8393x: manage big endian bus Laurent Vivier
2019-09-27  9:04 ` [PATCH v13 3/9] hw/m68k: add VIA support Laurent Vivier
2019-09-27  9:04 ` [PATCH v13 4/9] hw/m68k: implement ADB bus support for via Laurent Vivier
2019-09-27  9:04 ` [PATCH v13 5/9] hw/m68k: add Nubus support Laurent Vivier
2019-09-27  9:04 ` [PATCH v13 6/9] hw/m68k: add Nubus macfb video card Laurent Vivier
2019-09-27  9:04 ` [PATCH v13 7/9] hw/m68k: add a dummy SWIM floppy controller Laurent Vivier
2019-09-27  9:24   ` Philippe Mathieu-Daudé
2019-09-27  9:04 ` [PATCH v13 8/9] hw/m68k: define Macintosh Quadra 800 Laurent Vivier
2019-09-27  9:04 ` [PATCH v13 9/9] BootLinuxConsoleTest: Test the " Laurent Vivier
2019-09-27  9:32 ` [PATCH v13 0/9] hw/m68k: add Apple Machintosh Quadra 800 machine Philippe Mathieu-Daudé
2019-09-27 23:41 ` 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=85676490-43a7-5348-ecf3-c5654eb111ff@redhat.com \
    --to=philmd@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=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 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).