qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 10/42] esp: introduce esp_get_stc()


From: Laurent Vivier
Subject: Re: [PATCH v2 10/42] esp: introduce esp_get_stc()
Date: Mon, 1 Mar 2021 22:28:57 +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 :
> This simplifies reading the STC register value without having to manually 
> shift
> each individual 8-bit value.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/scsi/esp.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index 3a39450930..a1acc2c9bd 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -116,6 +116,17 @@ static void esp_set_tc(ESPState *s, uint32_t dmalen)
>      s->rregs[ESP_TCHI] = dmalen >> 16;
>  }
>  
> +static uint32_t esp_get_stc(ESPState *s)
> +{
> +    uint32_t dmalen;
> +
> +    dmalen = s->wregs[ESP_TCLO];
> +    dmalen |= s->wregs[ESP_TCMID] << 8;
> +    dmalen |= s->wregs[ESP_TCHI] << 16;
> +
> +    return dmalen;
> +}
> +
>  static void set_pdma(ESPState *s, enum pdma_origin_id origin,
>                       uint32_t index, uint32_t len)
>  {
> @@ -688,9 +699,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t 
> val)
>          if (val & CMD_DMA) {
>              s->dma = 1;
>              /* Reload DMA counter.  */
> -            s->rregs[ESP_TCLO] = s->wregs[ESP_TCLO];
> -            s->rregs[ESP_TCMID] = s->wregs[ESP_TCMID];
> -            s->rregs[ESP_TCHI] = s->wregs[ESP_TCHI];
> +            esp_set_tc(s, esp_get_stc(s));
>          } else {
>              s->dma = 0;
>          }
> 

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



reply via email to

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