From patchwork Sun Jun 17 21:55:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Husemann X-Patchwork-Id: 165380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 70F7EB7084 for ; Mon, 18 Jun 2012 13:07:52 +1000 (EST) Received: from localhost ([::1]:51436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgSJh-0000Aq-Or for incoming@patchwork.ozlabs.org; Sun, 17 Jun 2012 23:07:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgNRT-00049z-Jt for qemu-devel@nongnu.org; Sun, 17 Jun 2012 17:55:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgNRR-0001uO-Tg for qemu-devel@nongnu.org; Sun, 17 Jun 2012 17:55:31 -0400 Received: from mail.duskware.de ([91.199.88.144]:60827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgNRR-0001sD-N0 for qemu-devel@nongnu.org; Sun, 17 Jun 2012 17:55:29 -0400 Received: by mail.duskware.de (Postfix, from userid 205) id 0B766A8054; Sun, 17 Jun 2012 23:55:21 +0200 (CEST) Date: Sun, 17 Jun 2012 23:55:20 +0200 From: Martin Husemann To: qemu-devel@nongnu.org Message-ID: <20120617215520.GA7890@mail.duskware.de> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 91.199.88.144 X-Mailman-Approved-At: Sun, 17 Jun 2012 23:07:41 -0400 Subject: [Qemu-devel] hw/esp.c mishandles commands without dma X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The NetBSD driver sometimes uses commands without DMA (for example a simple TEST_UNIT_READY). On esp hardware, the command has a DMA bit (if dma is to be used), and when writing to the command register, the s->dma status is updated accordingly. When commands with dma are used and dma is disabled, the command is defered untill dma is enabled again. This is all fine. However, the deferal should not happen if the command does not use dma. This can bee seen by booting NetBSD/sparc: for every scsi device attached there will be a 5 second timeout and an error message. Here is a trivial patch wich fixes this problem for me: I filed a ticket in the bugtracker for it: #1014099. Martin Signed-off-by: Martin Husemann --- hw/esp.c.orig 2012-06-01 11:13:13.000000000 +0200 +++ hw/esp.c 2012-06-18 01:43:34.000000000 +0200 @@ -270,7 +270,7 @@ static void handle_satn(ESPState *s) uint8_t buf[32]; int len; - if (!s->dma_enabled) { + if (s->dma && !s->dma_enabled) { s->dma_cb = handle_satn; return; } @@ -284,7 +284,7 @@ static void handle_s_without_atn(ESPStat uint8_t buf[32]; int len; - if (!s->dma_enabled) { + if (s->dma && !s->dma_enabled) { s->dma_cb = handle_s_without_atn; return; } @@ -296,7 +296,7 @@ static void handle_s_without_atn(ESPStat static void handle_satn_stop(ESPState *s) { - if (!s->dma_enabled) { + if (s->dma && !s->dma_enabled) { s->dma_cb = handle_satn_stop; return; }