From patchwork Wed Jan 6 16:08:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 42307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E3B23B6EEB for ; Thu, 7 Jan 2010 03:12:41 +1100 (EST) Received: from localhost ([127.0.0.1]:41942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSYUw-0001ge-SN for incoming@patchwork.ozlabs.org; Wed, 06 Jan 2010 11:12:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSYQi-0006Ys-Is for qemu-devel@nongnu.org; Wed, 06 Jan 2010 11:08:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSYQd-0006VP-OW for qemu-devel@nongnu.org; Wed, 06 Jan 2010 11:08:16 -0500 Received: from [199.232.76.173] (port=54225 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSYQd-0006VA-Ih for qemu-devel@nongnu.org; Wed, 06 Jan 2010 11:08:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54855) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSYQc-0002PZ-W9 for qemu-devel@nongnu.org; Wed, 06 Jan 2010 11:08:11 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o06G8A9W023029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Jan 2010 11:08:10 -0500 Received: from zweiblum.home.kraxel.org (vpn2-11-33.ams2.redhat.com [10.36.11.33]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o06G878b027735; Wed, 6 Jan 2010 11:08:07 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id DC48370FCF; Wed, 6 Jan 2010 17:08:05 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 6 Jan 2010 17:08:02 +0100 Message-Id: <1262794084-8020-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1262794084-8020-1-git-send-email-kraxel@redhat.com> References: <1262794084-8020-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 3/5] lsi: move current_dev into lsi_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/lsi53c895a.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index e6c13eb..8715b99 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -175,6 +175,7 @@ do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__);} while (0) typedef struct lsi_request { uint32_t tag; + SCSIDevice *dev; uint32_t pending; int out; QTAILQ_ENTRY(lsi_request) next; @@ -199,7 +200,7 @@ typedef struct { * 3 if a DMA operation is in progress. */ int waiting; SCSIBus bus; - SCSIDevice *current_dev; + SCSIDevice *select_dev; int current_lun; /* The tag is a combination of the device ID and the SCSI tag. */ uint32_t select_tag; @@ -533,8 +534,8 @@ static void lsi_do_dma(LSIState *s, int out) s->dbc -= count; if (s->dma_buf == NULL) { - s->dma_buf = s->current_dev->info->get_buf(s->current_dev, - s->current->tag); + s->dma_buf = s->current->dev->info->get_buf(s->current->dev, + s->current->tag); } /* ??? Set SFBR to first data byte. */ @@ -548,10 +549,10 @@ static void lsi_do_dma(LSIState *s, int out) s->dma_buf = NULL; if (out) { /* Write the data. */ - s->current_dev->info->write_data(s->current_dev, s->current->tag); + s->current->dev->info->write_data(s->current->dev, s->current->tag); } else { /* Request any remaining data. */ - s->current_dev->info->read_data(s->current_dev, s->current->tag); + s->current->dev->info->read_data(s->current->dev, s->current->tag); } } else { s->dma_buf += count; @@ -610,7 +611,6 @@ static void lsi_reselect(LSIState *s, uint32_t tag) s->sfbr = 1 << (id & 0x7); } DPRINTF("Reselected target %d\n", id); - s->current_dev = s->bus.devs[id]; s->scntl1 |= LSI_SCNTL1_CON; lsi_set_phase(s, PHASE_MI); s->msg_action = p->out ? 2 : 3; @@ -721,15 +721,16 @@ static void lsi_do_command(LSIState *s) assert(s->current == NULL); s->current = qemu_mallocz(sizeof(lsi_request)); s->current->tag = s->select_tag; + s->current->dev = s->select_dev; - n = s->current_dev->info->send_command(s->current_dev, s->current->tag, buf, - s->current_lun); + n = s->current->dev->info->send_command(s->current->dev, s->current->tag, buf, + s->current_lun); if (n > 0) { lsi_set_phase(s, PHASE_DI); - s->current_dev->info->read_data(s->current_dev, s->current->tag); + s->current->dev->info->read_data(s->current->dev, s->current->tag); } else if (n < 0) { lsi_set_phase(s, PHASE_DO); - s->current_dev->info->write_data(s->current_dev, s->current->tag); + s->current->dev->info->write_data(s->current->dev, s->current->tag); } if (!s->command_complete) { @@ -1096,7 +1097,7 @@ again: /* ??? Linux drivers compain when this is set. Maybe it only applies in low-level mode (unimplemented). lsi_script_scsi_interrupt(s, LSI_SIST0_CMP, 0); */ - s->current_dev = s->bus.devs[id]; + s->select_dev = s->bus.devs[id]; s->select_tag = id << 8; s->scntl1 |= LSI_SCNTL1_CON; if (insn & (1 << 3)) {