From patchwork Thu Aug 4 17:14:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 108544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A1DB4B6F72 for ; Fri, 5 Aug 2011 03:15:14 +1000 (EST) Received: from localhost ([::1]:38733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp1Vm-0004hF-9Q for incoming@patchwork.ozlabs.org; Thu, 04 Aug 2011 13:15:10 -0400 Received: from eggs.gnu.org ([140.186.70.92]:53486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp1Va-0004d7-4O for qemu-devel@nongnu.org; Thu, 04 Aug 2011 13:14:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qp1VY-0001KR-SL for qemu-devel@nongnu.org; Thu, 04 Aug 2011 13:14:58 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:47246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp1VY-0001KE-IX for qemu-devel@nongnu.org; Thu, 04 Aug 2011 13:14:56 -0400 Received: by wwf26 with SMTP id 26so1933681wwf.10 for ; Thu, 04 Aug 2011 10:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=214KPI3/wdtlYNF/wsaeM9SZJ3uOXBfXCVZIPNAe6kQ=; b=lhpve/rOuH0yYkH4QQOfT2/pjQtetnFTdfO08ZS/hVVd1oTtrM4sNbwY7pNw+LjGhn 3v5JGJKGNeeEtBG0TcDSXuBLMg99KWCy2n/iA9AexrnS8RtsqnCQaE2RdmFH6fGmPmPr qetY0FTsRDtBGY1kjcN8zkvhTHd2YiR2s8+gA= Received: by 10.216.137.92 with SMTP id x70mr2002424wei.62.1312478095853; Thu, 04 Aug 2011 10:14:55 -0700 (PDT) Received: from localhost.localdomain (93-34-199-31.ip51.fastwebnet.it [93.34.199.31]) by mx.google.com with ESMTPS id m46sm1322771weq.5.2011.08.04.10.14.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 04 Aug 2011 10:14:54 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 4 Aug 2011 19:14:39 +0200 Message-Id: <1312478089-806-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1312478089-806-1-git-send-email-pbonzini@redhat.com> References: <1312478089-806-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.53 Subject: [Qemu-devel] [PATCH 01/10] dma-helpers: allow including from target-independent code 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 Target-independent code cannot construct sglists, but it can take them from the outside as a black box. Allow this. Signed-off-by: Paolo Bonzini --- dma.h | 12 ++++++++---- qemu-common.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dma.h b/dma.h index 3d8324b..f7e0142 100644 --- a/dma.h +++ b/dma.h @@ -15,22 +15,26 @@ #include "hw/hw.h" #include "block.h" -typedef struct { +typedef struct ScatterGatherEntry ScatterGatherEntry; + +#if defined(TARGET_PHYS_ADDR_BITS) +struct ScatterGatherEntry { target_phys_addr_t base; target_phys_addr_t len; -} ScatterGatherEntry; +}; -typedef struct { +struct QEMUSGList { ScatterGatherEntry *sg; int nsg; int nalloc; target_phys_addr_t size; -} QEMUSGList; +}; void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint); void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base, target_phys_addr_t len); void qemu_sglist_destroy(QEMUSGList *qsg); +#endif typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *iov, int nb_sectors, diff --git a/qemu-common.h b/qemu-common.h index 1e3c665..69c6595 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -18,6 +18,7 @@ typedef struct DeviceState DeviceState; struct Monitor; typedef struct Monitor Monitor; +typedef struct QEMUSGList QEMUSGList; /* we put basic includes here to avoid repeating them in device drivers */ #include