From 84fbefedfecafba2b339d17c9133225467b90c2e Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:23 +0000 Subject: esp: rename existing ESP QOM type to SYSBUS_ESP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing ESP QOM type currently represents a sysbus device with an embedded ESP state. Rename the type to SYSBUS_ESP accordingly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-3-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index d8a6263..8a0740e 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -65,8 +65,8 @@ struct ESPState { void (*pdma_cb)(ESPState *s); }; -#define TYPE_ESP "esp" -OBJECT_DECLARE_SIMPLE_TYPE(SysBusESPState, ESP) +#define TYPE_SYSBUS_ESP "sysbus-esp" +OBJECT_DECLARE_SIMPLE_TYPE(SysBusESPState, SYSBUS_ESP) struct SysBusESPState { /*< private >*/ -- cgit v1.1 From eb169c76d092b289a6a150b725e8fb2de990379b Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:24 +0000 Subject: esp: QOMify the internal ESP device state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make this new QOM device state a child device of both the sysbus-esp and esp-pci implementations. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-4-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 8a0740e..af23f81 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -22,7 +22,12 @@ enum pdma_origin_id { ASYNC, }; +#define TYPE_ESP "esp" +OBJECT_DECLARE_SIMPLE_TYPE(ESPState, ESP) + struct ESPState { + DeviceState parent_obj; + uint8_t rregs[ESP_REGS]; uint8_t wregs[ESP_REGS]; qemu_irq irq; -- cgit v1.1 From 0bd005be782d9492afe3cc6fc494d8c3b477e5b8 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:25 +0000 Subject: esp: add vmstate_esp version to embedded ESPState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QOM object representing ESPState is currently embedded within both the SYSBUS_ESP and PCI_ESP devices with migration state handled by embedding vmstate_esp within each device using VMSTATE_STRUCT. Since the vmstate_esp fields are embedded directly within the migration stream, the incoming vmstate_esp version_id is lost. The only version information available is that from vmstate_sysbus_esp_scsi and vmstate_esp_pci_scsi, but those versions represent their respective devices and not that of the underlying ESPState. Resolve this by adding a new version-dependent field in vmstate_sysbus_esp_scsi and vmstate_esp_pci_scsi which stores the vmstate_esp version_id field within ESPState to be used to allow migration from older QEMU versions. Finally bump the vmstate_esp version to 5 to cover the upcoming ESPState changes within this patch series. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-5-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index af23f81..9d149cb 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -68,6 +68,8 @@ struct ESPState { uint32_t pdma_start; uint32_t pdma_cur; void (*pdma_cb)(ESPState *s); + + uint8_t mig_version_id; }; #define TYPE_SYSBUS_ESP "sysbus-esp" -- cgit v1.1 From 5eb7a23fb22f10f09cecba61e7bf61cecaee3f96 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:33 +0000 Subject: esp: remove dma_counter from ESPState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The value of dma_counter is set once at the start of the transfer and remains the same until the transfer is complete. This allows the check in esp_transfer_data to be simplified since dma_left will always be non-zero until the transfer is completed. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-13-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 9d149cb..ff13729 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -50,9 +50,6 @@ struct ESPState { /* The amount of data left in the current DMA transfer. */ uint32_t dma_left; - /* The size of the current DMA transfer. Zero if no transfer is in - progress. */ - uint32_t dma_counter; int dma_enabled; uint32_t async_len; -- cgit v1.1 From 6cc88d6bf932a905ce36e933dc078eeb6b54ac92 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:34 +0000 Subject: esp: remove dma_left from ESPState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ESP device already keeps track of the remaining bytes left to transfer via its TC (transfer counter) register which is decremented for each byte that is transferred across the SCSI bus. Switch the transfer logic to use the value of TC instead of dma_left and then remove dma_left completely, adding logic to the vmstate_esp post_load() function to transfer the old dma_left value to the TC register during migration from older versions. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-14-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index ff13729..ff50c9e 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -48,8 +48,6 @@ struct ESPState { uint32_t cmdlen; uint32_t do_cmd; - /* The amount of data left in the current DMA transfer. */ - uint32_t dma_left; int dma_enabled; uint32_t async_len; @@ -67,6 +65,9 @@ struct ESPState { void (*pdma_cb)(ESPState *s); uint8_t mig_version_id; + + /* Legacy fields for vmstate_esp version < 5 */ + uint32_t mig_dma_left; }; #define TYPE_SYSBUS_ESP "sysbus-esp" -- cgit v1.1 From bb0bc7bbc9764a5e9e81756819838c5db88652b8 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:39 +0000 Subject: esp: accumulate SCSI commands for PDMA transfers in cmdbuf instead of pdma_buf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ESP SCSI commands are already accumulated in cmdbuf and so there is no need to keep a separate pdma_buf buffer. Accumulate SCSI commands for PDMA transfers in cmdbuf instead of pdma_buf so update cmdlen accordingly and change pdma_origin for PDMA transfers to CMD which allows the PDMA origin to be removed. This commit also removes a stray memcpy() from get_cmd() which is a no-op because cmdlen is always zero at the start of a command. Notionally the removal of pdma_buf from vmstate_esp_pdma also breaks migration compatibility for the PDMA subsection until its complete removal by the end of the series. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-19-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index ff50c9e..600d0c3 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -16,7 +16,6 @@ typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len); typedef struct ESPState ESPState; enum pdma_origin_id { - PDMA, TI, CMD, ASYNC, @@ -57,7 +56,6 @@ struct ESPState { ESPDMAMemoryReadWriteFunc dma_memory_write; void *dma_opaque; void (*dma_cb)(ESPState *s); - uint8_t pdma_buf[32]; int pdma_origin; uint32_t pdma_len; uint32_t pdma_start; -- cgit v1.1 From 2c573cfe19cd3f4cad7540ec542c40e54305d56a Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:42 +0000 Subject: esp: remove redundant pdma_start from ESPState Now that PDMA SCSI commands are accumulated in cmdbuf in the same way as normal commands, the existing logic for locating the start of the SCSI command in cmdbuf via cmdlen can be used. This enables the PDMA-specific pdma_start and also get_pdma_buf() to be removed. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-22-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 600d0c3..55b0aee 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -58,7 +58,6 @@ struct ESPState { void (*dma_cb)(ESPState *s); int pdma_origin; uint32_t pdma_len; - uint32_t pdma_start; uint32_t pdma_cur; void (*pdma_cb)(ESPState *s); -- cgit v1.1 From ad7f468c4252ee83f6e150c11ae02f71f6d467ef Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:44 +0000 Subject: esp: use ti_wptr/ti_rptr to manage the current FIFO position for PDMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This eliminates the last user of the PDMA-specific pdma_cur variable which can now be removed. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-24-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 55b0aee..26bd015 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -58,7 +58,6 @@ struct ESPState { void (*dma_cb)(ESPState *s); int pdma_origin; uint32_t pdma_len; - uint32_t pdma_cur; void (*pdma_cb)(ESPState *s); uint8_t mig_version_id; -- cgit v1.1 From 3c421400fff80054aec9b805a0622b63e372f572 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:45 +0000 Subject: esp: use in-built TC to determine PDMA transfer length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Real hardware simply counts down using the in-built TC to determine when the the PDMA request is complete. Use the TC to determine the PDMA transfer length which then enables us to remove the redundant pdma_len variable. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-25-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 26bd015..1be4586 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -57,7 +57,6 @@ struct ESPState { void *dma_opaque; void (*dma_cb)(ESPState *s); int pdma_origin; - uint32_t pdma_len; void (*pdma_cb)(ESPState *s); uint8_t mig_version_id; -- cgit v1.1 From 02abe246889398a108a3f92428b9f1f87e32de81 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:46 +0000 Subject: esp: remove CMD pdma_origin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cmdbuf is really just a copy of FIFO data (including extra message phase bytes) so its pdma_origin is effectively TI. Fortunately we already know when we are receiving a SCSI command since do_cmd == 1 which enables us to distinguish between the two cases in esp_pdma_read()/esp_pdma_write(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-26-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 1be4586..dbbbb3f 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -17,7 +17,6 @@ typedef struct ESPState ESPState; enum pdma_origin_id { TI, - CMD, ASYNC, }; -- cgit v1.1 From 43d02df31b8679dcc69c4ffcdb6cc658e1d348f7 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:50 +0000 Subject: esp: remove pdma_origin from ESPState Now that all data is transferred via the FIFO (ti_buf) there is no need to track the source buffer being used for the data transfer. This also eliminates the need for a separate subsection for PDMA state migration. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-30-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index dbbbb3f..91f8ffd 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -15,11 +15,6 @@ typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len); typedef struct ESPState ESPState; -enum pdma_origin_id { - TI, - ASYNC, -}; - #define TYPE_ESP "esp" OBJECT_DECLARE_SIMPLE_TYPE(ESPState, ESP) @@ -55,7 +50,6 @@ struct ESPState { ESPDMAMemoryReadWriteFunc dma_memory_write; void *dma_opaque; void (*dma_cb)(ESPState *s); - int pdma_origin; void (*pdma_cb)(ESPState *s); uint8_t mig_version_id; -- cgit v1.1 From 4e78f3bf357e0ef2f67e372097f2be8fe0521814 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:54 +0000 Subject: esp: defer command completion interrupt on incoming data transfers The MacOS toolbox ROM issues a command to the ESP controller as part of its "FAST" SCSI routines and then proceeds to read the incoming data soon after receiving the command completion interrupt. Unfortunately due to SCSI block transfers being asynchronous the incoming data may not yet be present causing an underflow error. Resolve this by waiting for the SCSI subsystem transfer_data callback before raising the command completion interrupt. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-34-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 91f8ffd..61bc317 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -41,6 +41,7 @@ struct ESPState { uint32_t cmdlen; uint32_t do_cmd; + bool data_in_ready; int dma_enabled; uint32_t async_len; -- cgit v1.1 From 4aaa6ac38393e6657869da528ad8c35657e23f84 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:55 +0000 Subject: esp: remove old deferred command completion mechanism Commit ea84a44250 "scsi: esp: Defer command completion until previous interrupts have been handled" provided a mechanism to delay the command completion interrupt until ESP_RINTR is read after the command has completed. With the previous fixes for latching the ESP_RINTR bits and deferring the setting of the command completion interrupt for incoming data to the SCSI callback, this workaround is no longer required and can be removed. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-35-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 61bc317..7d88fa0 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -30,8 +30,6 @@ struct ESPState { int32_t ti_size; uint32_t ti_rptr, ti_wptr; uint32_t status; - uint32_t deferred_status; - bool deferred_complete; uint32_t dma; uint8_t ti_buf[TI_BUFSZ]; SCSIBus bus; @@ -57,6 +55,8 @@ struct ESPState { /* Legacy fields for vmstate_esp version < 5 */ uint32_t mig_dma_left; + uint32_t mig_deferred_status; + bool mig_deferred_complete; }; #define TYPE_SYSBUS_ESP "sysbus-esp" -- cgit v1.1 From 799d90d818ba38997e9f5de2163bbfc96256ac0b Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:58 +0000 Subject: esp: transition to message out phase after SATN and stop command The SCSI bus should remain in the message out phase after the SATN and stop command rather than transitioning to the command phase. A new ESPState variable cmdbuf_cdb_offset is added which stores the offset of the CDB from the start of cmdbuf when accumulating extended message out phase data. Currently any extended message out data is discarded in do_cmd() before the CDB is processed in do_busid_cmd(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-38-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 7d88fa0..f697645 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -37,6 +37,7 @@ struct ESPState { SCSIRequest *current_req; uint8_t cmdbuf[ESP_CMDBUF_SZ]; uint32_t cmdlen; + uint8_t cmdbuf_cdb_offset; uint32_t do_cmd; bool data_in_ready; @@ -136,6 +137,7 @@ struct SysBusESPState { #define INTR_RST 0x80 #define SEQ_0 0x0 +#define SEQ_MO 0x1 #define SEQ_CD 0x4 #define CFG1_RESREPT 0x40 -- cgit v1.1 From 042879fc3fc02b67d907b462020c975f6fb1f5ae Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:10:59 +0000 Subject: esp: convert ti_buf from array to Fifo8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename TI_BUFSZ to ESP_FIFO_SZ since this constant is really describing the size of the FIFO and is not directly related to the TI size. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-39-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index f697645..eb4e8ba 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -3,6 +3,7 @@ #include "hw/scsi/scsi.h" #include "hw/sysbus.h" +#include "qemu/fifo8.h" #include "qom/object.h" /* esp.c */ @@ -10,7 +11,7 @@ typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len); #define ESP_REGS 16 -#define TI_BUFSZ 16 +#define ESP_FIFO_SZ 16 #define ESP_CMDBUF_SZ 32 typedef struct ESPState ESPState; @@ -28,10 +29,9 @@ struct ESPState { uint8_t chip_id; bool tchi_written; int32_t ti_size; - uint32_t ti_rptr, ti_wptr; uint32_t status; uint32_t dma; - uint8_t ti_buf[TI_BUFSZ]; + Fifo8 fifo; SCSIBus bus; SCSIDevice *current_dev; SCSIRequest *current_req; @@ -58,6 +58,8 @@ struct ESPState { uint32_t mig_dma_left; uint32_t mig_deferred_status; bool mig_deferred_complete; + uint32_t mig_ti_rptr, mig_ti_wptr; + uint8_t mig_ti_buf[ESP_FIFO_SZ]; }; #define TYPE_SYSBUS_ESP "sysbus-esp" -- cgit v1.1 From 023666da792ac465e43dee3bacb21bb781de5cdb Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:11:00 +0000 Subject: esp: convert cmdbuf from array to Fifo8 Rename ESP_CMDBUF_SZ to ESP_CMDFIFO_SZ and cmdbuf_cdb_offset to cmdfifo_cdb_offset to indicate that the command buffer type has changed from an array to a Fifo8. This also enables us to remove the ESPState field cmdlen since the command length is now simply the number of elements used in cmdfifo. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-40-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index eb4e8ba..2fe8d20 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -12,7 +12,7 @@ typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len); #define ESP_REGS 16 #define ESP_FIFO_SZ 16 -#define ESP_CMDBUF_SZ 32 +#define ESP_CMDFIFO_SZ 32 typedef struct ESPState ESPState; @@ -35,9 +35,8 @@ struct ESPState { SCSIBus bus; SCSIDevice *current_dev; SCSIRequest *current_req; - uint8_t cmdbuf[ESP_CMDBUF_SZ]; - uint32_t cmdlen; - uint8_t cmdbuf_cdb_offset; + Fifo8 cmdfifo; + uint8_t cmdfifo_cdb_offset; uint32_t do_cmd; bool data_in_ready; @@ -60,6 +59,8 @@ struct ESPState { bool mig_deferred_complete; uint32_t mig_ti_rptr, mig_ti_wptr; uint8_t mig_ti_buf[ESP_FIFO_SZ]; + uint8_t mig_cmdbuf[ESP_CMDFIFO_SZ]; + uint32_t mig_cmdlen; }; #define TYPE_SYSBUS_ESP "sysbus-esp" -- cgit v1.1 From 1b9e48a5bdbc96833113f249909af0d30a76cc25 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Mar 2021 22:11:02 +0000 Subject: esp: implement non-DMA transfers in PDMA mode The MacOS toolbox ROM uses non-DMA TI commands to handle the first/last byte of an unaligned 16-bit transfer to memory. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210304221103.6369-42-mark.cave-ayland@ilande.co.uk> --- include/hw/scsi/esp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 2fe8d20..9508849 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -40,6 +40,7 @@ struct ESPState { uint32_t do_cmd; bool data_in_ready; + uint8_t ti_cmd; int dma_enabled; uint32_t async_len; -- cgit v1.1