[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/25] esp: remove dma_counter from ESPState
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 09/25] esp: remove dma_counter from ESPState |
Date: |
Wed, 30 Dec 2020 15:37:29 +0000 |
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 <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 5 ++---
include/hw/scsi/esp.h | 3 ---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index f38b4a2ecd..5b47d035ab 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -229,7 +229,6 @@ static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t
busid)
if (datalen != 0) {
s->rregs[ESP_RSTAT] = STAT_TC;
s->dma_left = 0;
- s->dma_counter = 0;
if (datalen > 0) {
s->rregs[ESP_RSTAT] |= STAT_DI;
} else {
@@ -538,6 +537,7 @@ void esp_command_complete(SCSIRequest *req, uint32_t status,
void esp_transfer_data(SCSIRequest *req, uint32_t len)
{
ESPState *s = req->hba_private;
+ int to_device = ((s->rregs[ESP_RSTAT] & 7) == STAT_DO);
assert(!s->do_cmd);
trace_esp_transfer_data(s->dma_left, s->ti_size);
@@ -545,7 +545,7 @@ void esp_transfer_data(SCSIRequest *req, uint32_t len)
s->async_buf = scsi_req_get_buf(req);
if (s->dma_left) {
esp_do_dma(s);
- } else if (s->dma_counter != 0 && s->ti_size <= 0) {
+ } else if (to_device) {
/*
* If this was the last part of a DMA transfer then the
* completion interrupt is deferred to here.
@@ -564,7 +564,6 @@ static void handle_ti(ESPState *s)
}
dmalen = esp_get_tc(s);
- s->dma_counter = dmalen;
if (s->do_cmd) {
minlen = (dmalen < ESP_CMDBUF_SZ) ? dmalen : ESP_CMDBUF_SZ;
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index 60cc3047a5..b307f5d261 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -45,9 +45,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;
--
2.20.1
- [PATCH 00/25] esp: consolidate PDMA transfer buffers, Mark Cave-Ayland, 2020/12/30
- [PATCH 02/25] esp: add trace event when receiving a TI command, Mark Cave-Ayland, 2020/12/30
- [PATCH 01/25] esp: checkpatch fixes, Mark Cave-Ayland, 2020/12/30
- [PATCH 03/25] esp: fix esp_reg_read() trace event, Mark Cave-Ayland, 2020/12/30
- [PATCH 04/25] esp: add PDMA trace events, Mark Cave-Ayland, 2020/12/30
- [PATCH 07/25] esp: introduce esp_get_stc(), Mark Cave-Ayland, 2020/12/30
- [PATCH 05/25] esp: determine transfer direction directly from SCSI phase, Mark Cave-Ayland, 2020/12/30
- [PATCH 06/25] esp: introduce esp_get_tc() and esp_set_tc(), Mark Cave-Ayland, 2020/12/30
- [PATCH 08/25] esp: apply transfer length adjustment when STC is zero at TC load time, Mark Cave-Ayland, 2020/12/30
- [PATCH 09/25] esp: remove dma_counter from ESPState,
Mark Cave-Ayland <=
- [PATCH 10/25] esp: remove dma_left from ESPState, Mark Cave-Ayland, 2020/12/30
- [PATCH 11/25] esp: remove minlen restriction in handle_ti, Mark Cave-Ayland, 2020/12/30
- [PATCH 12/25] esp: introduce esp_pdma_read() and esp_pdma_write() functions, Mark Cave-Ayland, 2020/12/30
- [PATCH 14/25] esp: move pdma_len and TC logic into esp_pdma_read()/esp_pdma_write(), Mark Cave-Ayland, 2020/12/30
- [PATCH 13/25] esp: use pdma_origin directly in esp_pdma_read()/esp_pdma_write(), Mark Cave-Ayland, 2020/12/30
- [PATCH 16/25] esp: remove redundant pdma_start from ESPState, Mark Cave-Ayland, 2020/12/30
- [PATCH 15/25] esp: accumulate SCSI commands for PDMA transfers in cmdbuf instead of pdma_buf, Mark Cave-Ayland, 2020/12/30
- [PATCH 17/25] esp: move PDMA length adjustments into esp_pdma_read()/esp_pdma_write(), Mark Cave-Ayland, 2020/12/30
- [PATCH 18/25] esp: use ti_wptr/ti_rptr to manage the current FIFO position for PDMA, Mark Cave-Ayland, 2020/12/30
- [PATCH 19/25] esp: use in-built TC to determine PDMA transfer length, Mark Cave-Ayland, 2020/12/30