Skip to contentSkip to conversation

scsi: Fix SCSI bus reset

PATCH Applied Jan Kiszka 2 participants 2 messages Jul 6, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 scsi: Fix SCSI bus reset

When the controller raises the SCSI reset line, we have to perform the requested reset on all disks attached to the controller's bus. Moreover, reset is edge triggered, so avoid repeating it if the line was already high.

---
 hw/lsi53c895a.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
hw/lsi53c895a.c +13 -2
index 9a37fed..249c6bf 100644
@@ -1590,8 +1590,19 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
             BADF("Immediate Arbritration not implemented\n");
         }
         if (val & LSI_SCNTL1_RST) {
-            s->sstat0 |= LSI_SSTAT0_RST;
-            lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0);
+            if (!(s->sstat0 & LSI_SSTAT0_RST)) {
+                DeviceState *dev;
+                int id;
+
+                for (id = 0; id < s->bus.ndev; id++) {
+                    if (s->bus.devs[id]) {
+                        dev = &s->bus.devs[id]->qdev;
+                        dev->info->reset(dev);
+                    }
+                }
+                s->sstat0 |= LSI_SSTAT0_RST;
+                lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0);
+            }
         } else {
             s->sstat0 &= ~LSI_SSTAT0_RST;
         }
Signature · 1 line
1.7.1
#1 lore raw
Quoted 7 lines · Jan Kiszka

When the controller raises the SCSI reset line, we have to perform the requested reset on all disks attached to the controller's bus. Moreover, reset is edge triggered, so avoid repeating it if the line was already high.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 31 lines
---
  hw/lsi53c895a.c |   15 +++++++++++++--
  1 files changed, 13 insertions(+), 2 deletions(-)
hw/lsi53c895a.c +13 -2
index 9a37fed..249c6bf 100644
@@ -1590,8 +1590,19 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
              BADF("Immediate Arbritration not implemented\n");
          }
          if (val&  LSI_SCNTL1_RST) {
-            s->sstat0 |= LSI_SSTAT0_RST;
-            lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0);
+            if (!(s->sstat0&  LSI_SSTAT0_RST)) {
+                DeviceState *dev;
+                int id;
+
+                for (id = 0; id<  s->bus.ndev; id++) {
+                    if (s->bus.devs[id]) {
+                        dev =&s->bus.devs[id]->qdev;
+                        dev->info->reset(dev);
+                    }
+                }
+                s->sstat0 |= LSI_SSTAT0_RST;
+                lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0);
+            }
          } else {
              s->sstat0&= ~LSI_SSTAT0_RST;
          }