|
From: | Philippe Mathieu-Daudé |
Subject: | Re: [PATCH v13 1/9] esp: add pseudo-DMA as used by Macintosh |
Date: | Wed, 2 Oct 2019 17:03:30 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
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 <address@hidden> 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 | 338 ++++++++++++++++++++++++++++++++++++++---- include/hw/scsi/esp.h | 15 ++I recommend you to install the scripts/git.orderfile file.done2 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.
[Prev in Thread] | Current Thread | [Next in Thread] |