From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O7oz5-00053c-7Q for qemu-devel@nongnu.org; Fri, 30 Apr 2010 08:06:19 -0400 Received: from [140.186.70.92] (port=35352 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7oz3-000536-Jt for qemu-devel@nongnu.org; Fri, 30 Apr 2010 08:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O7oz1-0007My-Td for qemu-devel@nongnu.org; Fri, 30 Apr 2010 08:06:17 -0400 Received: from thoth.sbs.de ([192.35.17.2]:21346) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O7oz1-0007MY-Ea for qemu-devel@nongnu.org; Fri, 30 Apr 2010 08:06:15 -0400 Message-ID: <4BDAC7B4.2040006@siemens.com> Date: Fri, 30 Apr 2010 14:06:12 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2 1/2] lsi: Purge request queue on soft reset List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Gerd Hoffmann Avoid keeping zombie requests across controller reset by purging the queue and also dropping the currently active request. Signed-off-by: Jan Kiszka --- hw/lsi53c895a.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 98b7f54..ad23ece 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -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)