qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 22/42] esp: move PDMA length adjustments into esp_pdma_rea


From: Laurent Vivier
Subject: Re: [PATCH v2 22/42] esp: move PDMA length adjustments into esp_pdma_read()/esp_pdma_write()
Date: Tue, 2 Mar 2021 22:44:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

Le 09/02/2021 à 20:29, Mark Cave-Ayland a écrit :
> Here the updates to async_len and ti_size are moved into the corresponding
> esp_pdma_read()/esp_pdma_write() function to eliminate the reference to
> pdma_cur in do_dma_pdma_cb().
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/scsi/esp.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index 91f65a5d9b..691a2f4bdc 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -153,12 +153,18 @@ static uint8_t esp_pdma_read(ESPState *s)
>          s->pdma_cur++;
>          break;
>      case ASYNC:
> -        val = s->async_buf[s->pdma_cur++];
> +        val = s->async_buf[0];
> +        if (s->async_len > 0) {
> +            s->async_len--;
> +            s->async_buf++;
> +        }
> +        s->pdma_cur++;
>          break;
>      default:
>          g_assert_not_reached();
>      }
>  
> +    s->ti_size--;
>      s->pdma_len--;
>      dmalen--;
>      esp_set_tc(s, dmalen);
> @@ -183,12 +189,18 @@ static void esp_pdma_write(ESPState *s, uint8_t val)
>          s->pdma_cur++;
>          break;
>      case ASYNC:
> -        s->async_buf[s->pdma_cur++] = val;
> +        s->async_buf[0] = val;
> +        if (s->async_len > 0) {
> +            s->async_len--;
> +            s->async_buf++;
> +        }
> +        s->pdma_cur++;
>          break;
>      default:
>          g_assert_not_reached();
>      }
>  
> +    s->ti_size++;
>      s->pdma_len--;
>      dmalen--;
>      esp_set_tc(s, dmalen);
> @@ -427,7 +439,6 @@ static void esp_dma_done(ESPState *s)
>  static void do_dma_pdma_cb(ESPState *s)
>  {
>      int to_device = ((s->rregs[ESP_RSTAT] & 7) == STAT_DO);
> -    int len = s->pdma_cur;
>  
>      if (s->do_cmd) {
>          s->ti_size = 0;
> @@ -436,13 +447,6 @@ static void do_dma_pdma_cb(ESPState *s)
>          do_cmd(s);
>          return;
>      }
> -    s->async_buf += len;
> -    s->async_len -= len;
> -    if (to_device) {
> -        s->ti_size += len;
> -    } else {
> -        s->ti_size -= len;
> -    }
>      if (s->async_len == 0) {
>          scsi_req_continue(s->current_req);
>          /*
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]