Message ID | 20210209193018.31339-13-mark.cave-ayland@ilande.co.uk |
---|---|
State | New |
Headers | show |
Series | esp: consolidate PDMA transfer buffers and other fixes | expand |
On 2/9/21 8:29 PM, Mark Cave-Ayland wrote: > 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 | 4 +--- > include/hw/scsi/esp.h | 3 --- > 2 files changed, 1 insertion(+), 6 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Le 09/02/2021 à 20:29, Mark Cave-Ayland a écrit : > 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 | 4 +--- > include/hw/scsi/esp.h | 3 --- > 2 files changed, 1 insertion(+), 6 deletions(-) > > diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c > index 02b7876394..6c495b29c0 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 { > @@ -543,7 +542,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 (s->ti_size <= 0) { > /* > * If this was the last part of a DMA transfer then the > * completion interrupt is deferred to here. > @@ -562,7 +561,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 7d92471c5b..b313ef27f2 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; > Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 02b7876394..6c495b29c0 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 { @@ -543,7 +542,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 (s->ti_size <= 0) { /* * If this was the last part of a DMA transfer then the * completion interrupt is deferred to here. @@ -562,7 +561,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 7d92471c5b..b313ef27f2 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;
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 | 4 +--- include/hw/scsi/esp.h | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-)