Skip to contentSkip to conversation

lsi: Purge request queue on soft reset

PATCH Applied Jan Kiszka 2 participants 2 messages Apr 30, 2010 – May 3, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH v2 1/2 lsi: Purge request queue on soft reset

Avoid keeping zombie requests across controller reset by purging the queue and also dropping the currently active request.

---
 hw/lsi53c895a.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
hw/lsi53c895a.c +11 -0
index 98b7f54..ad23ece 100644
@@ -283,6 +283,8 @@ static inline int lsi_irq_on_rsl(LSIState *s)
 
 static void lsi_soft_reset(LSIState *s)
 {
+    lsi_request *p;
+
     DPRINTF("Reset\n");
     s->carry = 0;
 
@@ -345,6 +347,15 @@ static void lsi_soft_reset(LSIState *s)
     s->sbc = 0;
     s->csbc = 0;
     s->sbr = 0;
+    while (!QTAILQ_EMPTY(&s->queue)) {
+        p = QTAILQ_FIRST(&s->queue);
+        QTAILQ_REMOVE(&s->queue, p, next);
+        qemu_free(p);
+    }
+    if (s->current) {
+        qemu_free(s->current);
+        s->current = NULL;
+    }
 }
 
 static int lsi_dma_40bit(LSIState *s)
#1 lore raw
Quoted 5 lines · Jan Kiszka

Avoid keeping zombie requests across controller reset by purging the queue and also dropping the currently active request.

Applied all. Thanks.

Regards,

Anthony Liguori

Quoted 37 lines
---
  hw/lsi53c895a.c |   11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)
hw/lsi53c895a.c +11 -0
index 98b7f54..ad23ece 100644
@@ -283,6 +283,8 @@ static inline int lsi_irq_on_rsl(LSIState *s)
 
  static void lsi_soft_reset(LSIState *s)
  {
+    lsi_request *p;
+
      DPRINTF("Reset\n");
      s->carry = 0;
 
@@ -345,6 +347,15 @@ static void lsi_soft_reset(LSIState *s)
      s->sbc = 0;
      s->csbc = 0;
      s->sbr = 0;
+    while (!QTAILQ_EMPTY(&s->queue)) {
+        p = QTAILQ_FIRST(&s->queue);
+        QTAILQ_REMOVE(&s->queue, p, next);
+        qemu_free(p);
+    }
+    if (s->current) {
+        qemu_free(s->current);
+        s->current = NULL;
+    }
  }
 
  static int lsi_dma_40bit(LSIState *s)