[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/13] esp: Do not overwrite ESP_TCHI after reset
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/13] esp: Do not overwrite ESP_TCHI after reset |
Date: |
Thu, 13 Nov 2014 16:40:20 +0100 |
From: Hannes Reinecke <address@hidden>
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 <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/esp.c | 11 +++++++++--
include/hw/scsi/esp.h | 1 +
2 files changed, 10 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:
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index e079fb8..6c79527 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -22,6 +22,7 @@ struct ESPState {
uint8_t wregs[ESP_REGS];
qemu_irq irq;
uint8_t chip_id;
+ bool tchi_written;
int32_t ti_size;
uint32_t ti_rptr, ti_wptr;
uint32_t status;
--
1.8.3.1
- [Qemu-devel] [PULL 00/13] x86 and SCSI patches for QEMU 2.2.0-rc2, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 01/13] esp-pci: fixup deadlock with linux, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 02/13] virtio-scsi: work around bug in old BIOSes, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 03/13] esp: fix coding standards, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 04/13] virtio-scsi: dataplane: fix allocation for 'cmd_vrings', Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 05/13] esp: Do not overwrite ESP_TCHI after reset,
Paolo Bonzini <=
- [Qemu-devel] [PULL 06/13] virtio-scsi: dataplane: suppress guest notification, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 09/13] apic_common: migrate missing fields, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 11/13] kvmclock: Add comment explaining why we need cpu_clean_all_dirty(), Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 07/13] virtio-scsi: Fix comment for VirtIOSCSIReq, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 08/13] target-i386: eliminate dead code and hoist common code out of "if", Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 12/13] smbios: change 'ram_addr_t' variables to 'uint64_t', Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 10/13] target-i386: fix Coverity complaints about overflows, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 13/13] acpi: accurate overflow check, Paolo Bonzini, 2014/11/13
- Re: [Qemu-devel] [PULL 00/13] x86 and SCSI patches for QEMU 2.2.0-rc2, Peter Maydell, 2014/11/13