qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 11/42] esp: apply transfer length adjustment when STC is z


From: Laurent Vivier
Subject: Re: [PATCH v2 11/42] esp: apply transfer length adjustment when STC is zero at TC load time
Date: Mon, 1 Mar 2021 22:35:54 +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 :
> Perform the length adjustment whereby a value of 0 in the STC represents
> a transfer length of 0x10000 at the point where the TC is loaded at the
> start of a DMA command rather than just when a TI (Transfer Information)
> command is executed. This better matches the description as given in the
> datasheet.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/scsi/esp.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index a1acc2c9bd..02b7876394 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -562,9 +562,6 @@ static void handle_ti(ESPState *s)
>      }
>  
>      dmalen = esp_get_tc(s);
> -    if (dmalen == 0) {
> -        dmalen = 0x10000;
> -    }
>      s->dma_counter = dmalen;
>  
>      if (s->do_cmd) {
> @@ -699,7 +696,11 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t 
> val)
>          if (val & CMD_DMA) {
>              s->dma = 1;
>              /* Reload DMA counter.  */
> -            esp_set_tc(s, esp_get_stc(s));
> +            if (esp_get_stc(s) == 0) {
> +                esp_set_tc(s, 0x10000);
> +            } else {
> +                esp_set_tc(s, esp_get_stc(s));
> +            }

More fun?

    esp_set_tc(s, esp_get_stc(s) ?: 0x10000);

>          } else {
>              s->dma = 0;
>          }
> 

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



reply via email to

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