summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2014-11-10 16:52:55 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2014-11-12 10:27:03 +0100
commitc9cf45c1a475e594c560862d9df35b16e3a42702 (patch)
tree549d5e4e36ef8c474c0e778b175004768ac55822 /hw
parented4b43265d4d0c7ecfbbcb4001f61700756f22b9 (diff)
downloadhqemu-c9cf45c1a475e594c560862d9df35b16e3a42702.zip
hqemu-c9cf45c1a475e594c560862d9df35b16e3a42702.tar.gz
esp: Do not overwrite ESP_TCHI after reset
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. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/scsi/esp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 5ab44d8..272d13d 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -364,7 +364,7 @@ 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->tchi_written = 0;
s->ti_size = 0;
s->ti_rptr = 0;
s->ti_wptr = 0;
@@ -422,6 +422,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->tchi_written) {
+ return s->chip_id;
+ }
default:
break;
}
@@ -432,9 +437,11 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
{
trace_esp_mem_writeb(saddr, s->wregs[saddr], val);
switch (saddr) {
+ case ESP_TCHI:
+ s->tchi_written = true;
+ /* fall through */
case ESP_TCLO:
case ESP_TCMID:
- case ESP_TCHI:
s->rregs[ESP_RSTAT] &= ~STAT_TC;
break;
case ESP_FIFO:
OpenPOWER on IntegriCloud