Skip to contentSkip to conversation

esp: Do not overwrite ESP_TCHI after reset

PATCH Superseded Hannes Reinecke 1 participant 2 messages Nov 10, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.
The code never checks if the transfer count has been set, so the unique ID will always be overwritten if the driver sends a DMA NOP after reset.

---
 hw/scsi/esp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/scsi/esp.c +3 -1
index 5ab44d8..9798180 100644
@@ -454,7 +454,9 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
             /* 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];
+            if (s->wregs[ESP_TCHI]) {
+                    s->rregs[ESP_TCHI] = s->wregs[ESP_TCHI];
+            }
         } else {
             s->dma = 0;
         }
Signature · 1 line
1.7.12.4
#1 lore raw
Quoted 19 lines · Hannes Reinecke

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.
The code never checks if the transfer count has been set, so the unique ID will always be overwritten if the driver sends a DMA NOP after reset.

---
 hw/scsi/esp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/scsi/esp.c +0 -0
index 5ab44d8..9798180 100644

hw/scsi/esp.c void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) · line 462

Quoted 10 lines
hw/scsi/esp.c +3 -1
@@ -454,7 +454,9 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
             /* 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];
+            if (s->wregs[ESP_TCHI]) {
+                    s->rregs[ESP_TCHI] = s->wregs[ESP_TCHI];
+            }
         } else {
             s->dma = 0;
         }

Hmm.
This is actually not quite correct.
I'll be sending an updated patch.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)