From patchwork Sat Oct 19 09:33:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe PLAGNIOL-VILLARD X-Patchwork-Id: 284860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 134D42C011C for ; Sat, 19 Oct 2013 20:31:56 +1100 (EST) Received: from localhost ([::1]:60878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXSsy-0005j6-Rh for incoming@patchwork.ozlabs.org; Sat, 19 Oct 2013 05:31:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXSsd-0005ip-7M for qemu-devel@nongnu.org; Sat, 19 Oct 2013 05:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXSsV-0006nE-A0 for qemu-devel@nongnu.org; Sat, 19 Oct 2013 05:31:31 -0400 Received: from 2.mo5.mail-out.ovh.net ([178.33.109.111]:40951 helo=mo5.mail-out.ovh.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXSsV-0006kP-4W for qemu-devel@nongnu.org; Sat, 19 Oct 2013 05:31:23 -0400 Received: from mail31.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo5.mail-out.ovh.net (Postfix) with SMTP id 9A998FF8CB4 for ; Sat, 19 Oct 2013 11:31:37 +0200 (CEST) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 19 Oct 2013 11:28:51 +0200 Received: from ns203013.ovh.net (HELO localhost) (plagnioj%jcrosoft.com@91.121.171.124) by ns0.ovh.net with SMTP; 19 Oct 2013 11:28:50 +0200 From: Jean-Christophe PLAGNIOL-VILLARD To: qemu-devel@nongnu.org Date: Sat, 19 Oct 2013 11:33:03 +0200 Message-Id: <1382175183-27090-1-git-send-email-plagnioj@jcrosoft.com> X-Mailer: git-send-email 1.8.4.rc3 X-Ovh-Tracer-Id: 5823717269629676353 X-Ovh-Remote: 91.121.171.124 (ns203013.ovh.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: 0 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeiledrfeegucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecu X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeiledrfeegucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecu X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 178.33.109.111 Cc: Jean-Christophe PLAGNIOL-VILLARD Subject: [Qemu-devel] [PATCH 1/1] sd: pl181: fix fifo count read support 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 as it's depend on current direction Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- hw/sd/pl181.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 03875bf..91adbbd 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -344,7 +344,11 @@ static uint64_t pl181_read(void *opaque, hwaddr offset, data engine. DataCnt is decremented after each byte is transferred between the serial engine and the card. We don't emulate this level of detail, so both can be the same. */ - tmp = (s->datacnt + 3) >> 2; + if (s->datactrl & PL181_DATA_DIRECTION) + tmp = s->fifo_len; + else + tmp = s->datacnt; + tmp = (tmp + 3) >> 2; if (s->linux_hack) { s->linux_hack = 0; pl181_fifo_run(s);