qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCHv2] esp: Do not overwrite ESP_TCHI after reset


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCHv2] esp: Do not overwrite ESP_TCHI after reset
Date: Mon, 10 Nov 2014 19:32:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 10/11/2014 16:52, Hannes Reinecke wrote:
> After a reset ESP_TCHI should contain the unique ID
> of the chip. This value will be overwritten with the
> current tranfer count if the transfer count has
> previously been set.
> So we should always return the chip id if ESP_TCHI
> has never been written to.

What if ESP_TCHI was written 0?  Why should it return the chip id?

Can you explain exactly what sequence of register reads/writes leads to
the bug?

Paolo

> Signed-off-by: Hannes Reinecke <address@hidden>
> ---
>  hw/scsi/esp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index 5ab44d8..2caac1c 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -364,7 +364,6 @@ void esp_hard_reset(ESPState *s)
>  {
>      memset(s->rregs, 0, ESP_REGS);
>      memset(s->wregs, 0, ESP_REGS);
> -    s->rregs[ESP_TCHI] = s->chip_id;
>      s->ti_size = 0;
>      s->ti_rptr = 0;
>      s->ti_wptr = 0;
> @@ -422,6 +421,11 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
>          esp_lower_irq(s);
>  
>          return old_val;
> +    case ESP_TCHI:
> +        /* Return the unique id if the value has never been written */
> +        if (!s->wregs[ESP_TCHI]) {
> +            return s->chip_id;
> +        }
>      default:
>          break;
>      }
> 



reply via email to

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