From patchwork Fri Aug 21 17:28:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0CB7C433E1 for ; Fri, 21 Aug 2020 17:31:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D3F220FC3 for ; Fri, 21 Aug 2020 17:31:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ItaX6zxw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D3F220FC3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9Asp-0003t8-Fc for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:31:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9Ar0-0000zD-5G; Fri, 21 Aug 2020 13:29:26 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:36655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9Aqy-00019C-Kx; Fri, 21 Aug 2020 13:29:25 -0400 Received: by mail-wr1-x430.google.com with SMTP id 88so2660981wrh.3; Fri, 21 Aug 2020 10:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xUpjhtTxpzUTDOloVL0txBsx/e4JrhuPXdmZU+sQCYU=; b=ItaX6zxwiYGbYVQZh+rDu7WGLAUUqU648AnuWIat1pItXko/TB3zJtO45hVTbMqeD8 C36idWBjhnKjLkct9P/sxhdZxPbBPnJCThFY41Q0GeQyvFbtYW1Cy4xG5yjE7csP8NST B73KWwgGWwyL2JwLXTMEoyecCd8o0Qc26QHFdXZ1opJuEMdY2RtSG3V7aYYisXhCPFA5 FuAViNbuEynGO2QTT2AtE844XlHgqLY30t1vl/2KBQzA3jUKrYlKnirx3/JlnATTcCWB JgbSNpGSnMavorjHg9TOeu8a0V5pGqOjFEnWOoVwS9vTRXmMu3Fz1mzUOjTsKX3aaoZ7 SuUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xUpjhtTxpzUTDOloVL0txBsx/e4JrhuPXdmZU+sQCYU=; b=r6Q1zvJ0n12hwWiBHu4T2lHwRPKr8LyzN+rMPoJDNuT7y8DBCGOYczYJUup5PvUG+g jdA1RD3qRQIoVnK7LbciRa973Cenp3vWvx6HTGpeWttaRfVnlxKTz5sYXD9sszi7hGsU Vv/w5qwjjeRI5mJg75hi1KxDWfKPocfMJ8Dt03hCs5KSj0JDlDtt2jDZ6JKq8zA2bdBa YdYVNru7jTXMe7CQtEDq7gXSwz6Z7Dgp4ftjdh6ZuPVIeGMVGjNdh/HCCOyQ/3BUjiTv geJU/YQ3nXxBL7mJV9B70T9qgMStnwfJ4OJYw/AUhp1MxYztwuShvzHACVepzwr/NCnx Xp+g== X-Gm-Message-State: AOAM532JRJMN88mwukrHJsbt113PJQtSYlzlleZu0EC/yoxZlwFgqfNw D38sOqM4Kdy2yS4XcNslQrbKJBEIwTg= X-Google-Smtp-Source: ABdhPJzMzy4VWt6szX+Hhwqj5xqFQEB7hSgYPD3BQiIeWy/mPcHKzVZHbU80nfp3sq8gC8doIqezYQ== X-Received: by 2002:adf:90d1:: with SMTP id i75mr3489277wri.278.1598030962138; Fri, 21 Aug 2020 10:29:22 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:21 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 02/23] hw/sd/pxa2xx_mmci: Trivial simplification Date: Fri, 21 Aug 2020 19:28:55 +0200 Message-Id: <20200821172916.1260954-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x430.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, "open list:Trivial patches" , Michael Tokarev , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Laurent Vivier , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org, Alistair Francis Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Avoid declaring PXA2xxMMCIState local variable, return it directly. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Reviewed-by: Laurent Vivier Acked-by: Peter Maydell Message-Id: <20200705213350.24725-3-f4bug@amsat.org> --- hw/sd/pxa2xx_mmci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 9482b9212dd..2996a2ef177 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -480,10 +480,8 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, { DeviceState *dev; SysBusDevice *sbd; - PXA2xxMMCIState *s; dev = qdev_new(TYPE_PXA2XX_MMCI); - s = PXA2XX_MMCI(dev); sbd = SYS_BUS_DEVICE(dev); sysbus_mmio_map(sbd, 0, base); sysbus_connect_irq(sbd, 0, irq); @@ -491,7 +489,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma); sysbus_realize_and_unref(sbd, &error_fatal); - return s; + return PXA2XX_MMCI(dev); } static void pxa2xx_mmci_set_inserted(DeviceState *dev, bool inserted) From patchwork Fri Aug 21 17:28:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A29C433DF for ; Fri, 21 Aug 2020 17:32:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0C7E20702 for ; Fri, 21 Aug 2020 17:32:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XOs8EEQS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0C7E20702 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9AuL-0006qk-0V for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:32:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9Ar1-00013T-Kb; Fri, 21 Aug 2020 13:29:27 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9Ar0-00019S-43; Fri, 21 Aug 2020 13:29:27 -0400 Received: by mail-wr1-x442.google.com with SMTP id z18so2625650wrm.12; Fri, 21 Aug 2020 10:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MF7ZA/p+idAn4SvK+rkvL+g7qzoSAv8079JD7F/Jx7o=; b=XOs8EEQS24hJnGKjsNLLt8hx5jXjk/iGXAXjELZKOc0BR4jj/ndRvgYlgvkOTEv85O lXVeA53QdFaoQKNzDmceb0x/u0Us4qujZZQA2Vzmu9iyn6ONPxMZbesA6VfiM1dvPwjv EEb+sa6FgiPFtlS/yt5dlVSsq+b11eJD60cAGLo0ecgxNzB/MqkRxPkrfOpebNZpIr+u NftgaWQTI0vpoGjiGDj0CqCviyFEprEGByhVQ419p5ZbtnnvnNeysNODm7xoHu6aY5QQ NA6ttHw5Tbq8nZ5ebEbsqsbwEvufXTQj0LRoN0RqPLKSXdHAbkNUxSFUKo+BpUmLjiUI EDpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=MF7ZA/p+idAn4SvK+rkvL+g7qzoSAv8079JD7F/Jx7o=; b=pgDf7/CU/Wz3XS7ZQ3s5DVVnyiqUYAL0llf6DtZ7yOMIit/oApcvqGv5Nfmk+C9EEN 9EegfkwHhXm8EZ5/t9gYlWYSCV3kToNO8F2PssnA/ZkxWwpBAsQ2/RZVNm/IubgOHG2G jZ9xntsMlrDXNP3hNbwWv0wHGVmhu06hQDxQ2sFOJNBiaUfSHwE0NZAvvWQR/bbhFH0M SwZH5JssfuVcUe69qrOWUmQTlqiK8HL9GQDPRrZ/QUddGhiXsEqIaPg5zUJlW6ke2BRU dwtiK/otuX7ni3O/fdrmKJBNbkAUTHzEua+dQ0omfPco/7z8jfDC17vd9ZNIht2OK24g lD+Q== X-Gm-Message-State: AOAM530VNrSPX38oy0gA1/Ag81smVD3GEKO2PCTOc55n1VC1a/HjcWue RLTDRjvfQ3EfAO6HTKtkSgfCrZ1bCXE= X-Google-Smtp-Source: ABdhPJx/I0FfIcQOeH2n2r5e8UHBb21Kr0xxpzEu1Lz4X3Uu7bc57tHiSaO0j2jte138CJSMThnX3w== X-Received: by 2002:adf:c401:: with SMTP id v1mr3481858wrf.379.1598030963449; Fri, 21 Aug 2020 10:29:23 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 03/23] hw/lm32/milkymist: Un-inline milkymist_memcard_create() Date: Fri, 21 Aug 2020 19:28:56 +0200 Message-Id: <20200821172916.1260954-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org, Alistair Francis Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" As we will modify milkymist_memcard_create(), move it first to the source file where it is used. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-Id: <20200705211016.15241-2-f4bug@amsat.org> --- hw/lm32/milkymist-hw.h | 11 ----------- hw/lm32/milkymist.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/lm32/milkymist-hw.h b/hw/lm32/milkymist-hw.h index 05e2c2a5a75..5dca5d52f57 100644 --- a/hw/lm32/milkymist-hw.h +++ b/hw/lm32/milkymist-hw.h @@ -31,17 +31,6 @@ static inline DeviceState *milkymist_hpdmc_create(hwaddr base) return dev; } -static inline DeviceState *milkymist_memcard_create(hwaddr base) -{ - DeviceState *dev; - - dev = qdev_new("milkymist-memcard"); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - - return dev; -} - static inline DeviceState *milkymist_vgafb_create(hwaddr base, uint32_t fb_offset, uint32_t fb_mask) { diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 85913bb68b6..469e3c43225 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -80,6 +80,17 @@ static void main_cpu_reset(void *opaque) env->deba = reset_info->flash_base; } +static DeviceState *milkymist_memcard_create(hwaddr base) +{ + DeviceState *dev; + + dev = qdev_new("milkymist-memcard"); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + + return dev; +} + static void milkymist_init(MachineState *machine) { From patchwork Fri Aug 21 17:28:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C306C433E1 for ; Fri, 21 Aug 2020 17:34:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A5A020702 for ; Fri, 21 Aug 2020 17:34:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rLO4jrHJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A5A020702 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9Avm-0001D1-GM for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:34:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9Ar4-0001C5-KI; Fri, 21 Aug 2020 13:29:30 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36102) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9Ar2-0001A6-Ro; Fri, 21 Aug 2020 13:29:30 -0400 Received: by mail-wr1-x443.google.com with SMTP id 88so2661226wrh.3; Fri, 21 Aug 2020 10:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C3Tm4+Z7Q6QefXOq9EkMkmgI6/oXsxZYry3NIouzDNA=; b=rLO4jrHJsWAFfmg2Z8Errv0TBHcSlFqQUtEQ+SGmWS0RACjrZmLF8co5n0IPMVJ582 6HErzaj5pb9jgvDqc+0e9f9iAUFbX399xrEvEnBJhmp791LxnsQ7YNbz0gADaDPpcIpr QIGmi+7JOjPID0AoIjxoDFYqgRfNbV0Ks8OZel74Y/8etDACe8GmyMAVIlFrpKKkUKui hOHIu5RicTPQkirjNQ6U86btgXHsn1RyQusuTpvNCUbzk1QCxRhPe/RIcb1oTHcH2hFx IwKYXIePsmSmadBtKzo6/WR8kjAilqcnFh9pxS63wYhhBxqeh7HOZd4umtxQeJGH5piJ kl4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=C3Tm4+Z7Q6QefXOq9EkMkmgI6/oXsxZYry3NIouzDNA=; b=E4AZcf0Kr4EA5byAtUtZiFFJxKgUR2EECtm1Lkc4TjxHdTbE8e5K5xXBozBhG0+Z9m 3KDUq+aHjQRSv0FUICALEhKQSRkFU8DWZ/WEr1ArVFdeLWt4s77IpUk8ZuJoRmfSJBv/ LGcY6YXXO6PA7eGsBLGouHX2SFJAAy0NpG10ij46zL5pyeRoKtpnhoMAYqcJsmdq1+JN FCtA42nRODRQBew2qSiBl8JMLRW3FR3V5fyOe4ORuZ1IHl2brd989aRr4qZgfIOWe5aC ZeusMJi5hB0fKcY1a9Ewv62zFgHd1bKIxNEnS5D1JAInHloO5G+vEKcLlH/TJen+eo2R NKCw== X-Gm-Message-State: AOAM531/RtJrS12QYzyy9tQxy1K1PqWwDaPuAxO/vmwQEFQGz4uM+Kdf E5Y8pIfaBr3Ah0mZtfPtMKl+OAzVams= X-Google-Smtp-Source: ABdhPJx+ieDBKktPaikWNv6XVHWQHhwzt9bfX42KsNUsgaIU8ks0HOo7m3Vj95Umvu4aGeU2wCX2+g== X-Received: by 2002:adf:a1c6:: with SMTP id v6mr3610233wrv.197.1598030966515; Fri, 21 Aug 2020 10:29:26 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 05/23] hw/sd/milkymist: Do not create SD card within the SD host controller Date: Fri, 21 Aug 2020 19:28:58 +0200 Message-Id: <20200821172916.1260954-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org, Alistair Francis Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" SD/MMC host controllers provide a SD Bus to plug SD cards, but don't come with SD card plugged in :) Let the machine/board model create and plug the SD cards when required. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-Id: <20200705211016.15241-5-f4bug@amsat.org> --- hw/lm32/milkymist.c | 13 +++++++++ hw/sd/milkymist-memcard.c | 55 +++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 469e3c43225..9f8fe9fef15 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -34,6 +34,7 @@ #include "elf.h" #include "milkymist-hw.h" #include "hw/display/milkymist_tmu2.h" +#include "hw/sd/sd.h" #include "lm32.h" #include "exec/address-spaces.h" #include "qemu/cutils.h" @@ -83,11 +84,23 @@ static void main_cpu_reset(void *opaque) static DeviceState *milkymist_memcard_create(hwaddr base) { DeviceState *dev; + DriveInfo *dinfo; dev = qdev_new("milkymist-memcard"); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + dinfo = drive_get_next(IF_SD); + if (dinfo) { + DeviceState *card; + + card = qdev_new(TYPE_SD_CARD); + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo), + &error_fatal); + qdev_realize_and_unref(card, qdev_get_child_bus(dev, "sd-bus"), + &error_fatal); + } + return dev; } diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 747c5c6136b..e9f5db5e22d 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -66,6 +66,8 @@ enum { #define MILKYMIST_MEMCARD(obj) \ OBJECT_CHECK(MilkymistMemcardState, (obj), TYPE_MILKYMIST_MEMCARD) +#define TYPE_MILKYMIST_SDBUS "milkymist-sdbus" + struct MilkymistMemcardState { SysBusDevice parent_obj; @@ -253,6 +255,19 @@ static void milkymist_memcard_reset(DeviceState *d) } } +static void milkymist_memcard_set_readonly(DeviceState *dev, bool level) +{ + qemu_log_mask(LOG_UNIMP, + "milkymist_memcard: read-only mode not supported\n"); +} + +static void milkymist_memcard_set_inserted(DeviceState *dev, bool level) +{ + MilkymistMemcardState *s = MILKYMIST_MEMCARD(dev); + + s->enabled = !!level; +} + static void milkymist_memcard_init(Object *obj) { MilkymistMemcardState *s = MILKYMIST_MEMCARD(obj); @@ -266,27 +281,6 @@ static void milkymist_memcard_init(Object *obj) DEVICE(obj), "sd-bus"); } -static void milkymist_memcard_realize(DeviceState *dev, Error **errp) -{ - MilkymistMemcardState *s = MILKYMIST_MEMCARD(dev); - DeviceState *carddev; - BlockBackend *blk; - DriveInfo *dinfo; - Error *err = NULL; - - /* Create and plug in the sd card */ - /* FIXME use a qdev drive property instead of drive_get_next() */ - dinfo = drive_get_next(IF_SD); - blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL; - carddev = qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk); - if (!qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err)) { - error_propagate_prepend(errp, err, "failed to init SD card"); - return; - } - s->enabled = blk && blk_is_inserted(blk); -} - static const VMStateDescription vmstate_milkymist_memcard = { .name = "milkymist-memcard", .version_id = 1, @@ -308,10 +302,9 @@ static void milkymist_memcard_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - dc->realize = milkymist_memcard_realize; dc->reset = milkymist_memcard_reset; dc->vmsd = &vmstate_milkymist_memcard; - /* Reason: init() method uses drive_get_next() */ + /* Reason: output IRQs should be wired up */ dc->user_creatable = false; } @@ -323,9 +316,25 @@ static const TypeInfo milkymist_memcard_info = { .class_init = milkymist_memcard_class_init, }; +static void milkymist_sdbus_class_init(ObjectClass *klass, void *data) +{ + SDBusClass *sbc = SD_BUS_CLASS(klass); + + sbc->set_inserted = milkymist_memcard_set_inserted; + sbc->set_readonly = milkymist_memcard_set_readonly; +} + +static const TypeInfo milkymist_sdbus_info = { + .name = TYPE_MILKYMIST_SDBUS, + .parent = TYPE_SD_BUS, + .instance_size = sizeof(SDBus), + .class_init = milkymist_sdbus_class_init, +}; + static void milkymist_memcard_register_types(void) { type_register_static(&milkymist_memcard_info); + type_register_static(&milkymist_sdbus_info); } type_init(milkymist_memcard_register_types) From patchwork Fri Aug 21 17:29:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09DD9C433E1 for ; Fri, 21 Aug 2020 17:36:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D214120855 for ; Fri, 21 Aug 2020 17:36:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GOFJCEte" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D214120855 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9AxT-0005AS-UY for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:36:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9Ar7-0001MO-Mq; Fri, 21 Aug 2020 13:29:33 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:53007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9Ar6-0001Ao-02; Fri, 21 Aug 2020 13:29:33 -0400 Received: by mail-wm1-x343.google.com with SMTP id x5so2641302wmi.2; Fri, 21 Aug 2020 10:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2uqKLIwnsolMGUBAKKhtdES03ym0NQX3Xf3uXXgGuNI=; b=GOFJCEte6vgw1DpRYWrf+Q0HHyQ6jO6cdeleJDLpiiak/0YzCONV0KKBNnURzWG8fQ Noa1jHIdqpTidGIrnVlHoS+AxzTt7HWna4Mp7/bHy27Z0rZ/Wq+3NdFXWUtOMDXIVqay RJ9sMD5FQ1lIdBFC6Vuy4rQVkfx43hWUxnZUMiz0NR9bWYv55JXYYPSoMJujEuu8L0yu eGX+MeJ3dsymOQRTyNySkvi4Iy1FZDZQe+mkRl3OtjtqjteEkZEInHN9XN2eVvDOmELB iu8M7ZsBpLQ3q3lHtnU8Sh9pdKlaVbnl/cPwSTGOK7KyASmv1QWx+zCU6e0QlV/IksAM JfFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2uqKLIwnsolMGUBAKKhtdES03ym0NQX3Xf3uXXgGuNI=; b=lSJeGsRFVadnf3H2L1ZB0zxcD/w8uu5bVvb03Y5fj1uYtmSEmfuHoPaUrVW/ECCtXQ TqOTdUoYbiGS3orI4aCYO/9NW9FkR2QTc2G9Id8JOijKhzIb9us9ZbD5g7FpJkDWGvNo 4i6isE2qzpprD8RLNftT0ThNS05NXBl/phopiRz5s+hnJFoXERt3HutWpLk6lwmdR4vX JOpnE5bENWHzU+6HHjaG5Fnqfy5gLML2uEr6it/m32vj2hdlLXmrZQ5zN+9co1Nxbbsh E9UDxJ8tv/BWFgE0oza4+KdHeohxgJzB9/+TrlJanLH8fdS9hOisL3NKYzdWcQALqjbr YUUQ== X-Gm-Message-State: AOAM533eKjun2ctbFAEX0gtSDJk8jIySuO6rQw7WS4vB4TYHzUsK9BRH 3vIG+/9IhsNGm7FMjC7FGXxI2BQDc5Q= X-Google-Smtp-Source: ABdhPJw8bSU0cDBYdXqx/w2ehEAFcH9OK9YmzU55s8zc4gGZ4LsyDpqb9+azdLjq7uzK77ZngB1fYA== X-Received: by 2002:a7b:cf22:: with SMTP id m2mr5009939wmg.46.1598030969538; Fri, 21 Aug 2020 10:29:29 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 07/23] hw/sd/pl181: Rename pl181_send_command() as pl181_do_command() Date: Fri, 21 Aug 2020 19:29:00 +0200 Message-Id: <20200821172916.1260954-8-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org, Alistair Francis Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" pl181_send_command() do a bus transaction (send or receive), rename it as pl181_do_command(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Acked-by: Peter Maydell Message-Id: <20200705204630.4133-3-f4bug@amsat.org> --- hw/sd/pl181.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 649386ec3d1..3fc2cdd71a1 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -173,7 +173,7 @@ static uint32_t pl181_fifo_pop(PL181State *s) return value; } -static void pl181_send_command(PL181State *s) +static void pl181_do_command(PL181State *s) { SDRequest request; uint8_t response[16]; @@ -402,7 +402,7 @@ static void pl181_write(void *opaque, hwaddr offset, qemu_log_mask(LOG_UNIMP, "pl181: Pending commands not implemented\n"); } else { - pl181_send_command(s); + pl181_do_command(s); pl181_fifo_run(s); } /* The command has completed one way or the other. */ From patchwork Fri Aug 21 17:29:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0F97C433E1 for ; Fri, 21 Aug 2020 17:34:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C28D020702 for ; Fri, 21 Aug 2020 17:34:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oLcG7w90" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C28D020702 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9AwA-00024s-1R for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:34:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9Ar9-0001QU-07; Fri, 21 Aug 2020 13:29:35 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9Ar7-0001C7-9Y; Fri, 21 Aug 2020 13:29:34 -0400 Received: by mail-wm1-x344.google.com with SMTP id p14so2654141wmg.1; Fri, 21 Aug 2020 10:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FL3RGx9So1PYwbmJZxkxf3xii197YkK6iJeT4N72p9Y=; b=oLcG7w90YGFmB9a2Vm9a/Yw5jIUcEzd5Nsng1cl0rlJ3x/iwTDhABGLHLsrbLw7wYu MpOcDbg1xxQWmHcySiGu3B0GENJfa9MK6Rh4lqO6AA+5vFO2ik+yCS1y32hpbl45qcTl bEnT0HM4TTYyG6Nt8Gz2qFipQQ9vRVhgUTHm3d+eggnTBYLmfy+KJmKiK4e+Z3H23jQs TNOx050PCZPcSeXJb3fv1hyjrJb7n1VN/TgahsTbgXlKCiUmyu+sXIiychVco1Axs+Mj BB6gZuZid0ZJtPBJGOqa8SCNaMBdyhDpu460D5v/q2MTE9+5hB74T+dANsMWaFNg6o0q yjUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FL3RGx9So1PYwbmJZxkxf3xii197YkK6iJeT4N72p9Y=; b=FpJH7eNSDtub4iriUqTt7DYB1dRR+ZK4y0/JxNg3OeIyEt2dmyuSO3wvwrqc0VVyzf DHH+q/36moez6AxXTblta7GKRU/Dd9aSUr5Lb8m83l7umyOEr5ErU4LPSKs9aNkCnFSX 9NaJGPJMJwKgpITf9vUVgRtzUWe9Sti23gjPFxgh0Yo17ZEwfF+qgJ1uBViLbemHpwxi fdUt6eQ6m7ivyPpu/EpETqqKU1Dr2R1MV5A2I993f58ciUjmlOanwc5y+hF2rNfgXVD0 bBG3W53D+RG+vgqi2dvmg6d5VzxXBnKeyM63R5szpQf1NZpk6gSpRkUal+ZXgIj9A8hs FcKA== X-Gm-Message-State: AOAM530NU8c08jtnKs4RbzYYJ+A+2I+Eb4Jt/pDeVOq9/5+eGiQeDkcm RegFyOK16zlBpRPeai44rGocAViSRZ8= X-Google-Smtp-Source: ABdhPJwgXE6ppeAyUl1pmNq/eugkNGT9B3qua0qCyzyAuBLtbiFQ7nMQxTNNpqS9tu+vJKZWf0QXyw== X-Received: by 2002:a7b:c7d6:: with SMTP id z22mr327094wmk.186.1598030970826; Fri, 21 Aug 2020 10:29:30 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:30 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 08/23] hw/sd/pl181: Add TODO to use Fifo32 API Date: Fri, 21 Aug 2020 19:29:01 +0200 Message-Id: <20200821172916.1260954-9-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add TODO to use Fifo32 API from "qemu/fifo32.h". Signed-off-by: Philippe Mathieu-Daudé Acked-by: Peter Maydell Message-Id: <20200705204630.4133-4-f4bug@amsat.org> --- hw/sd/pl181.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 3fc2cdd71a1..86219c851d3 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -57,7 +57,7 @@ typedef struct PL181State { http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=4446/1 */ int32_t linux_hack; - uint32_t fifo[PL181_FIFO_LEN]; + uint32_t fifo[PL181_FIFO_LEN]; /* TODO use Fifo32 */ qemu_irq irq[2]; /* GPIO outputs for 'card is readonly' and 'card inserted' */ qemu_irq cardstatus[2]; From patchwork Fri Aug 21 17:29:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3680C433DF for ; Fri, 21 Aug 2020 17:37:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD82520702 for ; Fri, 21 Aug 2020 17:37:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HNK34CCm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD82520702 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9AzB-0000uD-SW for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:37:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9ArB-0001Wf-Sp; Fri, 21 Aug 2020 13:29:39 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:33894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9Ar9-0001CT-8k; Fri, 21 Aug 2020 13:29:37 -0400 Received: by mail-wr1-x441.google.com with SMTP id f7so2682047wrw.1; Fri, 21 Aug 2020 10:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lykAkn6UTO3Stw/k4IPgQ27dBq94/1nvpoZuk0CH5Q8=; b=HNK34CCmqLr0UOvHsPmHh/a2pJfj54ITiFLI7I7czL4hk8JWY9/Ao5qnFnXZp6jRoW qQ7uAWME8GnkpX4Ym9fMkweu9gpESfy5EvEAfzJo+fHFBHpHP3Y7NC4oyNd3KlRRWNDm Lvsgp/YiVc21TSmNeYhYQ3oKKyga4r2/b+QdcU1l35ZM3Tq4abEHRqSr0e+r/IJP72on 9GDK9M9cx/QSmNeHCLS2DuYGS969bdCwl07/q7oxGvLxxTYW+QdjxDo9knZy1gBnY2UO 5wYc3VCI3pvaWC9ilPQBovzIxmhOZCK9nvhhdGJDHE74fVRMHc2F7luvA/+PEBeTxp5M brIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lykAkn6UTO3Stw/k4IPgQ27dBq94/1nvpoZuk0CH5Q8=; b=uUhkwfl0cu8yvhqn1IzKKPh7czAwMFU9rzEGnrxRauD8Gc10yfTWTogYuXnPQ6DmmF syp6bBn7hcxVxttkMfvHpAjFaRTB+FHfzmrCAzok8gyV8XagnCFgEMjG2+uTvlHWwVkr uSmixBo17FK3aXl+j4JosI5fDJVufOvraP/1omEirU51fLDMeRnHs3NvKOvC5ils8m0w Rvqa9Xoy1uUtJxDCQGBFdnCCFk3a0iXa8CPjVZsSbkvpr7JRiG84svyQNKv+LkRwe3Aw Igwt14ZMPlkitJMmlOA5d59qiBtlaF2yfCYNHHXCLeGq34a8tLqZph3LnymlF6c1R67s g95w== X-Gm-Message-State: AOAM532TNcewIjrdsHTnymQtc8S5ucoHryxnjaA/y/DTBjlzqXqCxQnn 02nlw9nl9vLhkX/KVPZMP5bULSm/BWc= X-Google-Smtp-Source: ABdhPJxspM9bnlzj01PPJEsgfHmRCauouJrQ1nozrN39+lFkFXjdwZUlmM8uCNUGTvip3cgeWou3Qw== X-Received: by 2002:adf:b34a:: with SMTP id k10mr3626495wrd.402.1598030972917; Fri, 21 Aug 2020 10:29:32 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 09/23] hw/sd/pl181: Use named GPIOs Date: Fri, 21 Aug 2020 19:29:02 +0200 Message-Id: <20200821172916.1260954-10-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org, Alistair Francis Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" To make the code easier to manage/review/use, rename the cardstatus[0] variable as 'card_readonly' and name the GPIO "card-read-only". Similarly with cardstatus[1], renamed as 'card_inserted' and name its GPIO "card-inserted". Adapt the users accordingly by using the qdev_init_gpio_out_named() function. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Acked-by: Peter Maydell Message-Id: <20200705204630.4133-6-f4bug@amsat.org> --- hw/arm/integratorcp.c | 4 ++-- hw/arm/realview.c | 4 ++-- hw/arm/vexpress.c | 4 ++-- hw/sd/pl181.c | 8 +++++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index f304c2b4f03..16c4d750a4f 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -645,9 +645,9 @@ static void integratorcp_init(MachineState *machine) sysbus_create_simple(TYPE_INTEGRATOR_DEBUG, 0x1a000000, 0); dev = sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL); - qdev_connect_gpio_out(dev, 0, + qdev_connect_gpio_out_named(dev, "card-read-only", 0, qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_WPROT, 0)); - qdev_connect_gpio_out(dev, 1, + qdev_connect_gpio_out_named(dev, "card-inserted", 0, qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_CARDIN, 0)); sysbus_create_varargs("pl041", 0x1d000000, pic[25], NULL); diff --git a/hw/arm/realview.c b/hw/arm/realview.c index c1ff172b136..3e2360c261f 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -234,8 +234,8 @@ static void realview_init(MachineState *machine, mmc_irq[1] = qemu_irq_split( qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), qemu_irq_invert(qdev_get_gpio_in(gpio2, 0))); - qdev_connect_gpio_out(dev, 0, mmc_irq[0]); - qdev_connect_gpio_out(dev, 1, mmc_irq[1]); + qdev_connect_gpio_out_named(dev, "card-read-only", 0, mmc_irq[0]); + qdev_connect_gpio_out_named(dev, "card-inserted", 0, mmc_irq[1]); sysbus_create_simple("pl031", 0x10017000, pic[10]); diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 1dc971c34f2..049a0ec2c73 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -624,9 +624,9 @@ static void vexpress_common_init(MachineState *machine) dev = sysbus_create_varargs("pl181", map[VE_MMCI], pic[9], pic[10], NULL); /* Wire up MMC card detect and read-only signals */ - qdev_connect_gpio_out(dev, 0, + qdev_connect_gpio_out_named(dev, "card-read-only", 0, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT)); - qdev_connect_gpio_out(dev, 1, + qdev_connect_gpio_out_named(dev, "card-inserted", 0, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN)); sysbus_create_simple("pl050_keyboard", map[VE_KMI0], pic[12]); diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 86219c851d3..ab4cd733a4d 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -60,7 +60,8 @@ typedef struct PL181State { uint32_t fifo[PL181_FIFO_LEN]; /* TODO use Fifo32 */ qemu_irq irq[2]; /* GPIO outputs for 'card is readonly' and 'card inserted' */ - qemu_irq cardstatus[2]; + qemu_irq card_readonly; + qemu_irq card_inserted; } PL181State; static const VMStateDescription vmstate_pl181 = { @@ -479,7 +480,7 @@ static void pl181_reset(DeviceState *d) s->mask[1] = 0; /* We can assume our GPIO outputs have been wired up now */ - sd_set_cb(s->card, s->cardstatus[0], s->cardstatus[1]); + sd_set_cb(s->card, s->card_readonly, s->card_inserted); /* Since we're still using the legacy SD API the card is not plugged * into any bus, and we must reset it manually. */ @@ -496,7 +497,8 @@ static void pl181_init(Object *obj) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq[0]); sysbus_init_irq(sbd, &s->irq[1]); - qdev_init_gpio_out(dev, s->cardstatus, 2); + qdev_init_gpio_out_named(dev, &s->card_readonly, "card-read-only", 1); + qdev_init_gpio_out_named(dev, &s->card_inserted, "card-inserted", 1); } static void pl181_realize(DeviceState *dev, Error **errp) From patchwork Fri Aug 21 17:29:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCFF0C433E1 for ; Fri, 21 Aug 2020 17:36:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABD2C20702 for ; Fri, 21 Aug 2020 17:36:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Htm26PR3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABD2C20702 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9Ay0-0006ZO-Rv for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:36:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9ArG-0001aj-PL; Fri, 21 Aug 2020 13:29:42 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:37745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9ArF-0001DO-9A; Fri, 21 Aug 2020 13:29:42 -0400 Received: by mail-wm1-x331.google.com with SMTP id k8so2576481wma.2; Fri, 21 Aug 2020 10:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ArJcEdqJX+vmqubLA63riTsSiUZwEENuCNY6yovraRY=; b=Htm26PR3I+xSImMZ+2D5dPBeSWaQvQgzPuKkTiSIZuaeUTlV0FGpc6j7sYDmOPv1GP B/O2qWhIKbPgoE9K3QCnpzE75gJj9R7w1Sr9Fd45b62nFDwKhJz18Vw88Jt8CJuArmGe zpOtCVmm6pqRZlhVD9MwaAC3nQdhrTJN9HENpfIguK8uVtOYUVo9zsZ7yNQERhhyrOlD TAzucIqmUK25X57KlzLIxLw1w2XH3pyl2l6qoDJr9hP6vszpiq8TyMKTNt1dT5gUevzA y9jSmkQ663R06kVc2Czw7HSsUVOYpG+hvilQ7VSjo6C0qeTLQoa3rqpNeJoYG4PisUeA ydZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ArJcEdqJX+vmqubLA63riTsSiUZwEENuCNY6yovraRY=; b=G0pSXNqLmQ2PAb1t62I8DeDJBLdwwWEommUiEsUE/cZRtl7JjvlxsMzHIP9I2+ZC0+ n5HMyGVMAkyO3SY/m1wEMYj/f+UAC8qaTgq+r3yKAM6WGSj2csII7lBILns/XgkFX9B4 X57ya9spSNmDFpGyjoQ+DCXoqhv8iK98+K+0DpdQFoxX4fq00w0IHC+BKpuKbqdPO/YR +yeJNcJPI+WASSYEZomv2thTWBDPE6nkLjNyt+qWs999RL1oILttT9Q3b09XtLNqFaG9 Uf0XTdf1/7/tpzQpPPMnPZ+ybhdrBQccJn/zdPpd33BSzFNz8redxfnVp8nCvFmjwgtX TXjA== X-Gm-Message-State: AOAM532E6LlTH32vhmSM3LpsyBPTAj/vZ9VSPXtK+XfJO5CwBpnIGtmU ee2LqhajcQh2DaVZfKSpIgQlorz4euM= X-Google-Smtp-Source: ABdhPJyljEwfRG8mMFpdG2S9PmkHKqJ6NS2f3dmboL4emFFyg7z2Fj469HX9DY6Eh/+bJ18+xDZEvQ== X-Received: by 2002:a1c:1d92:: with SMTP id d140mr3993892wmd.157.1598030978727; Fri, 21 Aug 2020 10:29:38 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 13/23] hw/sd/sdcard: Make sd_data_ready() static Date: Fri, 21 Aug 2020 19:29:06 +0200 Message-Id: <20200821172916.1260954-14-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x331.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Alistair Francis , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" sd_data_ready() belongs to the legacy API. As its last user has been converted to the SDBus API, make it static. Reviewed-by: Alistair Francis Message-Id: <20180216022933.10945-7-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé Acked-by: Peter Maydell --- include/hw/sd/sd.h | 1 - hw/sd/sd.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index a84b8e274a3..ace350e0e83 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -143,7 +143,6 @@ int sd_do_command(SDState *sd, SDRequest *req, void sd_write_data(SDState *sd, uint8_t value); uint8_t sd_read_data(SDState *sd); void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert); -bool sd_data_ready(SDState *sd); /* sd_enable should not be used -- it is only used on the nseries boards, * where it is part of a broken implementation of the MMC card slot switch * (there should be two card slots which are multiplexed to a single MMC diff --git a/hw/sd/sd.c b/hw/sd/sd.c index fad9cf1ee7a..a5ae5dccbe5 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2082,7 +2082,7 @@ uint8_t sd_read_data(SDState *sd) return ret; } -bool sd_data_ready(SDState *sd) +static bool sd_data_ready(SDState *sd) { return sd->state == sd_sendingdata_state; } From patchwork Fri Aug 21 17:29:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C52EC433DF for ; Fri, 21 Aug 2020 17:42:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D38620738 for ; Fri, 21 Aug 2020 17:42:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OcTQNH9S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D38620738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9B43-00086v-Hd for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:42:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9ArN-0001ij-EO; Fri, 21 Aug 2020 13:29:49 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:39451) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9ArL-0001EQ-8s; Fri, 21 Aug 2020 13:29:49 -0400 Received: by mail-wr1-x430.google.com with SMTP id a5so2656454wrm.6; Fri, 21 Aug 2020 10:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HEwX79oo8D7n/oZUencYO6rP85LqJ2NQ5PmlyfVwwIE=; b=OcTQNH9S1Lompx5HoQZj6DQH1bKC6QNN30kM2SLDoF3vL0MLI9KrjvBmla1PIv/gqu gYPM4hL78cUXKtqea0i69sLFg252dmfu1TDbvRrJmUU5CcurUPYGV4VYH0Zd5/L1T8MS d0/jpTQiZ/0dLZkao3O0LzEmBpMLQKEVNh2eaH0HCxXOz83onV+zpEibgrU6fVof6edk mCsf29RjRHFpQggm/ssxva9P92yKiOYpu+rwDg/syqo7rYZ4OMApl7sYfJhQ/tpBKQZp RU1MrNZ0BFEFORLXT5nZ3lR+p3I9w/3XU1iGPkQwr4DFDSn23VIATPQGaR55Ll55tcA8 bwUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=HEwX79oo8D7n/oZUencYO6rP85LqJ2NQ5PmlyfVwwIE=; b=LQDLcErY1z/ODYyZqFlY0hpm81W/Jrkf1JdZvc3ORviFpVq880njI3JyQIDQqr/fBp vDXiIAgvL35BvenwVy7BrbN8iHaneSrb6KnF1pJlZKsnqD5lWHyVTXQeEvkZdVyclnN0 HBCyRrHns22mhtZYl1C371ROX0qhlo/suWmUIy3rSanFx2/otwEbkWWpbZ6nVYCE+1EH RgKnw3qn+CsfKKvzyC9CxyYZpeUlEshlxFJT8gL1uY8hdKRZP4xqZlwSpovNn8wrMgrI L2HI2KcHRjKKncSiQba3c/1sB+wOCDbJwqa9W1WSyJaDcjewvxpEhJZEye77p9WHqO67 Scvw== X-Gm-Message-State: AOAM530cAG3pq6q0lIYFBvwxc5RZa7oZPw9z7Dp674rQLC6CSTGcY9uf IprvDQymuEDBiAiBSlusfLsFDNo0jMs= X-Google-Smtp-Source: ABdhPJxkJL+KUn1JgAXaH10ibQ8TDhJ1vAVUUlQGnWsEQ+TviIwXo6Usfsr4zY/sWAmXbAigCBatxA== X-Received: by 2002:adf:ed49:: with SMTP id u9mr3604205wro.408.1598030983806; Fri, 21 Aug 2020 10:29:43 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 16/23] hw/sd: Rename sdbus_write_data() as sdbus_write_byte() Date: Fri, 21 Aug 2020 19:29:09 +0200 Message-Id: <20200821172916.1260954-17-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x430.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The sdbus_write_data() method do a single byte access on the data line of a SD bus. Rename it as sdbus_write_byte() and document it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200814092346.21825-3-f4bug@amsat.org> --- include/hw/sd/sd.h | 9 ++++++++- hw/sd/allwinner-sdhost.c | 10 +++++----- hw/sd/bcm2835_sdhost.c | 2 +- hw/sd/core.c | 2 +- hw/sd/milkymist-memcard.c | 8 ++++---- hw/sd/pl181.c | 2 +- hw/sd/pxa2xx_mmci.c | 2 +- hw/sd/sdhci.c | 8 ++++---- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index b58b5a19afe..1e5ac955d05 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -158,7 +158,14 @@ void sdbus_set_voltage(SDBus *sdbus, uint16_t millivolts); uint8_t sdbus_get_dat_lines(SDBus *sdbus); bool sdbus_get_cmd_line(SDBus *sdbus); int sdbus_do_command(SDBus *sd, SDRequest *req, uint8_t *response); -void sdbus_write_data(SDBus *sd, uint8_t value); +/** + * Write a byte to a SD bus. + * @sd: bus + * @value: byte to write + * + * Write a byte on the data lines of a SD bus. + */ +void sdbus_write_byte(SDBus *sd, uint8_t value); uint8_t sdbus_read_data(SDBus *sd); bool sdbus_data_ready(SDBus *sd); bool sdbus_get_inserted(SDBus *sd); diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index f404e1fdb45..e05e8a3864c 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -335,7 +335,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, buf, buf_bytes); for (uint32_t i = 0; i < buf_bytes; i++) { - sdbus_write_data(&s->sdbus, buf[i]); + sdbus_write_byte(&s->sdbus, buf[i]); } /* Read from SD bus */ @@ -654,10 +654,10 @@ static void allwinner_sdhost_write(void *opaque, hwaddr offset, s->startbit_detect = value; break; case REG_SD_FIFO: /* Read/Write FIFO */ - sdbus_write_data(&s->sdbus, value & 0xff); - sdbus_write_data(&s->sdbus, (value >> 8) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 16) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 24) & 0xff); + sdbus_write_byte(&s->sdbus, value & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 8) & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 16) & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 24) & 0xff); allwinner_sdhost_update_transfer_cnt(s, sizeof(uint32_t)); allwinner_sdhost_auto_stop(s); allwinner_sdhost_update_irq(s); diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index 4a80fbcc861..16aba7cc92b 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -223,7 +223,7 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) } n--; s->datacnt--; - sdbus_write_data(&s->sdbus, value & 0xff); + sdbus_write_byte(&s->sdbus, value & 0xff); value >>= 8; } } diff --git a/hw/sd/core.c b/hw/sd/core.c index 79d96576ead..13b5ca03169 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -102,7 +102,7 @@ int sdbus_do_command(SDBus *sdbus, SDRequest *req, uint8_t *response) return 0; } -void sdbus_write_data(SDBus *sdbus, uint8_t value) +void sdbus_write_byte(SDBus *sdbus, uint8_t value) { SDState *card = get_card(sdbus); diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index e9f5db5e22d..4128109c047 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -209,10 +209,10 @@ static void memcard_write(void *opaque, hwaddr addr, uint64_t value, if (!s->enabled) { break; } - sdbus_write_data(&s->sdbus, (value >> 24) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 16) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 8) & 0xff); - sdbus_write_data(&s->sdbus, value & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 24) & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 16) & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 8) & 0xff); + sdbus_write_byte(&s->sdbus, value & 0xff); break; case R_ENABLE: s->regs[addr] = value; diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 574500ce600..771bae193f5 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -244,7 +244,7 @@ static void pl181_fifo_run(PL181State *s) } n--; s->datacnt--; - sdbus_write_data(&s->sdbus, value & 0xff); + sdbus_write_byte(&s->sdbus, value & 0xff); value >>= 8; } } diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 2996a2ef177..07ddc2eba3e 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -184,7 +184,7 @@ static void pxa2xx_mmci_fifo_update(PXA2xxMMCIState *s) if (s->cmdat & CMDAT_WR_RD) { while (s->bytesleft && s->tx_len) { - sdbus_write_data(&s->sdbus, s->tx_fifo[s->tx_start++]); + sdbus_write_byte(&s->sdbus, s->tx_fifo[s->tx_start++]); s->tx_start &= 0x1f; s->tx_len --; s->bytesleft --; diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index deac1818650..4bf1ee88b2a 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -515,7 +515,7 @@ static void sdhci_write_block_to_card(SDHCIState *s) } for (index = 0; index < (s->blksize & BLOCK_SIZE_MASK); index++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[index]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[index]); } /* Next data can be written through BUFFER DATORT register */ @@ -642,7 +642,7 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s) s->sdmasysad += s->data_count - begin; if (s->data_count == block_size) { for (n = 0; n < block_size; n++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); } s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { @@ -679,7 +679,7 @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s) } else { dma_memory_read(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); for (n = 0; n < datacnt; n++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); } } s->blkcnt--; @@ -815,7 +815,7 @@ static void sdhci_do_adma(SDHCIState *s) dscr.addr += s->data_count - begin; if (s->data_count == block_size) { for (n = 0; n < block_size; n++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); } s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { From patchwork Fri Aug 21 17:29:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA7DDC433DF for ; Fri, 21 Aug 2020 17:44:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9C29920738 for ; Fri, 21 Aug 2020 17:44:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KIQUhZk9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C29920738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9B5x-0002Ms-Tb for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:44:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9ArN-0001j6-Qm; Fri, 21 Aug 2020 13:29:50 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:40829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9ArL-0001Eo-VG; Fri, 21 Aug 2020 13:29:49 -0400 Received: by mail-wm1-x343.google.com with SMTP id k20so2552630wmi.5; Fri, 21 Aug 2020 10:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=adI/YavBgi2qoodwO44IjMe4dKZqce82IasdICJ8F9M=; b=KIQUhZk9+qo960TP9tPKu4RDi5n6B2i7iWqBTvFLR+x3oav3oOd/fAr9mbp3YJROdd r4IwCAXIRPJUWrG6Nc8YLo2AnzxiWCIS/NWc+3rhU9fz5OFc40NaesLpjq+zxIIkLjAb guTjks7sXET5cfv7lb3MWvkWqa3X9RYDBsM12Zw9v98757pl4l2R94PlqV06FoXy8pwH J+YrXC2SvxpKT0pJrlsLQiJTMhpmgK4C7WngkM50msuIRsZgjBH3fvs5cXJKndoPS1MT PmVLU8vTN9YB56agqyTis/XwABGgj9ruMGJttm1cLWX9JAS/4vphN/vIoSkgcTF/L0C5 kRAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=adI/YavBgi2qoodwO44IjMe4dKZqce82IasdICJ8F9M=; b=ObgQ2RdVszJU/wgUdUGZZsc9GU2H84mZ9yK+DDIWBjag6niQkHGTuSEtKnTuj8wef4 KciYWaX1aqDBCG5uysS5rKk2hPs0kZpKpDHNJ674aNLN0HaHdCrIcnVfetOdUllhn8ux MVsn8af+kGASsZ+StPvrQHkP2hxAgyePyknYmm1hb7Hz3Q3YNxgNo3/YubDNp0oHpi+m XPFcBLZIdkVDMC1tRf299FMb/KeXsury67+yi4P4JTzfGh3IpTf64ecOwdYnFvoO3SvW x1z1d3nH5MxETNiHA9k2bGJDuh8/jtrtzJYWRyiVnJip8qDKDk4w4/wozzqtrtcNRXa3 n9Sw== X-Gm-Message-State: AOAM530Tn+krv3FnVpnKtJHsN1EW5ibV2rpHhBVQPOrUcARdbdCmKAws xo8HOrsKRVWXdJyJmIPY1CaAFABNBW4= X-Google-Smtp-Source: ABdhPJznC659IiREBjZWjQ71nrYI/b7RKqXsDNkbqxt3OsaimmJ5Hd1Cm+Z6UYUX9Q8BununvL5nVg== X-Received: by 2002:a7b:c4d9:: with SMTP id g25mr4679961wmk.135.1598030985441; Fri, 21 Aug 2020 10:29:45 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 17/23] hw/sd: Rename sdbus_read_data() as sdbus_read_byte() Date: Fri, 21 Aug 2020 19:29:10 +0200 Message-Id: <20200821172916.1260954-18-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The sdbus_read_data() method do a single byte access on the data line of a SD bus. Rename it as sdbus_read_byte() and document it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200814092346.21825-4-f4bug@amsat.org> --- include/hw/sd/sd.h | 10 +++++++++- hw/sd/allwinner-sdhost.c | 10 +++++----- hw/sd/bcm2835_sdhost.c | 2 +- hw/sd/core.c | 2 +- hw/sd/milkymist-memcard.c | 8 ++++---- hw/sd/pl181.c | 2 +- hw/sd/pxa2xx_mmci.c | 2 +- hw/sd/sdhci.c | 8 ++++---- hw/sd/ssi-sd.c | 2 +- 9 files changed, 27 insertions(+), 19 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 1e5ac955d05..14ffc7f4758 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -166,7 +166,15 @@ int sdbus_do_command(SDBus *sd, SDRequest *req, uint8_t *response); * Write a byte on the data lines of a SD bus. */ void sdbus_write_byte(SDBus *sd, uint8_t value); -uint8_t sdbus_read_data(SDBus *sd); +/** + * Read a byte from a SD bus. + * @sd: bus + * + * Read a byte from the data lines of a SD bus. + * + * Return: byte value read + */ +uint8_t sdbus_read_byte(SDBus *sd); bool sdbus_data_ready(SDBus *sd); bool sdbus_get_inserted(SDBus *sd); bool sdbus_get_readonly(SDBus *sd); diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index e05e8a3864c..c004aa39da6 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -341,7 +341,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, /* Read from SD bus */ } else { for (uint32_t i = 0; i < buf_bytes; i++) { - buf[i] = sdbus_read_data(&s->sdbus); + buf[i] = sdbus_read_byte(&s->sdbus); } cpu_physical_memory_write((desc->addr & DESC_SIZE_MASK) + num_done, buf, buf_bytes); @@ -521,10 +521,10 @@ static uint64_t allwinner_sdhost_read(void *opaque, hwaddr offset, break; case REG_SD_FIFO: /* Read/Write FIFO */ if (sdbus_data_ready(&s->sdbus)) { - res = sdbus_read_data(&s->sdbus); - res |= sdbus_read_data(&s->sdbus) << 8; - res |= sdbus_read_data(&s->sdbus) << 16; - res |= sdbus_read_data(&s->sdbus) << 24; + res = sdbus_read_byte(&s->sdbus); + res |= sdbus_read_byte(&s->sdbus) << 8; + res |= sdbus_read_byte(&s->sdbus) << 16; + res |= sdbus_read_byte(&s->sdbus) << 24; allwinner_sdhost_update_transfer_cnt(s, sizeof(uint32_t)); allwinner_sdhost_auto_stop(s); allwinner_sdhost_update_irq(s); diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index 16aba7cc92b..2c7a675a2d8 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -190,7 +190,7 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) if (is_read) { n = 0; while (s->datacnt && s->fifo_len < BCM2835_SDHOST_FIFO_LEN) { - value |= (uint32_t)sdbus_read_data(&s->sdbus) << (n * 8); + value |= (uint32_t)sdbus_read_byte(&s->sdbus) << (n * 8); s->datacnt--; n++; if (n == 4) { diff --git a/hw/sd/core.c b/hw/sd/core.c index 13b5ca03169..a3b620b802b 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -114,7 +114,7 @@ void sdbus_write_byte(SDBus *sdbus, uint8_t value) } } -uint8_t sdbus_read_data(SDBus *sdbus) +uint8_t sdbus_read_byte(SDBus *sdbus) { SDState *card = get_card(sdbus); uint8_t value = 0; diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 4128109c047..e8d055bb895 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -152,10 +152,10 @@ static uint64_t memcard_read(void *opaque, hwaddr addr, r = 0xffffffff; } else { r = 0; - r |= sdbus_read_data(&s->sdbus) << 24; - r |= sdbus_read_data(&s->sdbus) << 16; - r |= sdbus_read_data(&s->sdbus) << 8; - r |= sdbus_read_data(&s->sdbus); + r |= sdbus_read_byte(&s->sdbus) << 24; + r |= sdbus_read_byte(&s->sdbus) << 16; + r |= sdbus_read_byte(&s->sdbus) << 8; + r |= sdbus_read_byte(&s->sdbus); } break; case R_CLK2XDIV: diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 771bae193f5..579d68ad83e 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -223,7 +223,7 @@ static void pl181_fifo_run(PL181State *s) if (is_read) { n = 0; while (s->datacnt && s->fifo_len < PL181_FIFO_LEN) { - value |= (uint32_t)sdbus_read_data(&s->sdbus) << (n * 8); + value |= (uint32_t)sdbus_read_byte(&s->sdbus) << (n * 8); s->datacnt--; n++; if (n == 4) { diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 07ddc2eba3e..04f0a98f813 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -194,7 +194,7 @@ static void pxa2xx_mmci_fifo_update(PXA2xxMMCIState *s) } else while (s->bytesleft && s->rx_len < 32) { s->rx_fifo[(s->rx_start + (s->rx_len ++)) & 0x1f] = - sdbus_read_data(&s->sdbus); + sdbus_read_byte(&s->sdbus); s->bytesleft --; s->intreq |= INT_RXFIFO_REQ; } diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 4bf1ee88b2a..b897b1121b8 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -409,7 +409,7 @@ static void sdhci_read_block_from_card(SDHCIState *s) } for (index = 0; index < blk_size; index++) { - data = sdbus_read_data(&s->sdbus); + data = sdbus_read_byte(&s->sdbus); if (!FIELD_EX32(s->hostctl2, SDHC_HOSTCTL2, EXECUTE_TUNING)) { /* Device is not in tuning */ s->fifo_buffer[index] = data; @@ -601,7 +601,7 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s) while (s->blkcnt) { if (s->data_count == 0) { for (n = 0; n < block_size; n++) { - s->fifo_buffer[n] = sdbus_read_data(&s->sdbus); + s->fifo_buffer[n] = sdbus_read_byte(&s->sdbus); } } begin = s->data_count; @@ -673,7 +673,7 @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s) if (s->trnmod & SDHC_TRNS_READ) { for (n = 0; n < datacnt; n++) { - s->fifo_buffer[n] = sdbus_read_data(&s->sdbus); + s->fifo_buffer[n] = sdbus_read_byte(&s->sdbus); } dma_memory_write(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); } else { @@ -774,7 +774,7 @@ static void sdhci_do_adma(SDHCIState *s) while (length) { if (s->data_count == 0) { for (n = 0; n < block_size; n++) { - s->fifo_buffer[n] = sdbus_read_data(&s->sdbus); + s->fifo_buffer[n] = sdbus_read_byte(&s->sdbus); } } begin = s->data_count; diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index 9210ef567f1..a7ef9cb9225 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -190,7 +190,7 @@ static uint32_t ssi_sd_transfer(SSISlave *dev, uint32_t val) s->mode = SSI_SD_DATA_READ; return 0xfe; case SSI_SD_DATA_READ: - val = sdbus_read_data(&s->sdbus); + val = sdbus_read_byte(&s->sdbus); if (!sdbus_data_ready(&s->sdbus)) { DPRINTF("Data read end\n"); s->mode = SSI_SD_CMD; From patchwork Fri Aug 21 17:29:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7940CC433E3 for ; Fri, 21 Aug 2020 17:38:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B2B920702 for ; Fri, 21 Aug 2020 17:38:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EIL+UrZN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B2B920702 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9AzS-0001eT-KB for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:38:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9ArP-0001la-AZ; Fri, 21 Aug 2020 13:29:51 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:39457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9ArN-0001FA-Hm; Fri, 21 Aug 2020 13:29:50 -0400 Received: by mail-wr1-x436.google.com with SMTP id a5so2656579wrm.6; Fri, 21 Aug 2020 10:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o8w6wmSgnQZxUMQrLBvgypybp2LPlBahTHmviCZweW0=; b=EIL+UrZNlIKBqKhjGZf6MOhXspOgCc3ooxC7sMWJRkDmEePPAr1jS/QHXyxaIu2lRk gyuVT023ZRD4zBBJTYoi7dQwj3gtMijgaMYxHUW/d7+yd/nKkEhFAY2lEjkuAHpwQsH4 TNLLdGTC/rK09EvsPW/+YMC1fuccCPVahAFcSOeAcvu/+6Rvp1w8gSFLE33XS+sG5F5Y dO+/aFMHeu2WtB9pawKr5oAqTs4EQ/tI99ur4bf08Yy/Lc0h3XYJzGy4oGokAACeTGmb evz5k8rebbUBhf/+9v9PJXKtHDTKfOD/rdkQT8OQJqDZpeuaHh8809Dj/U7otC+BQkYF 6png== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=o8w6wmSgnQZxUMQrLBvgypybp2LPlBahTHmviCZweW0=; b=ZlvbPZVhBlnsaMftkbJYmJ3AMTYgzrHbcyk4W59cqZKZyeWczVptQ7FKbIQDaaaIEC 4OCQDnLt8FpzZ4nmB+Nm0UEaL7yvilUzChy3sS9ekbWUtp0vZUGiwhOVeL6wUyZhg564 f/Xi9/z7WvBAguVdCjFNTeYktb5cHEwI3wAA9EW9cyuVKFhmI1JtfhOVtfLHIFct7dG6 Zvwz+pYoxKa2uBIeebkebKeuw8kn4p2hJTP1hkjpI8AqqhvMvb8q+hQYK2Glzgv4F2cx w8HSQdGtD8V97Nh/5r6ny/rc4/+rdy6Jk3s+5PNKqdcVDUEfUb/4UpVeOfmp0SrJfhma 3FLA== X-Gm-Message-State: AOAM531RqHeuHF0DFiepW8cK/65G99p96x3lFUG+QOADK2IVdX0/QxaQ dBpxj9b9kVw5y6lJ8Q1OTLi9u4inJlg= X-Google-Smtp-Source: ABdhPJzv0mSHHRzhMj/j6X1Avbud4ktNPifKB+JNw77BFbmxxJmyW4EI7rkJOXUDGnndfyRa5MqD8Q== X-Received: by 2002:a5d:6a8d:: with SMTP id s13mr3899434wru.201.1598030986974; Fri, 21 Aug 2020 10:29:46 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 18/23] hw/sd: Add sdbus_write_data() to write multiples bytes on the data line Date: Fri, 21 Aug 2020 19:29:11 +0200 Message-Id: <20200821172916.1260954-19-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x436.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add a sdbus_write_data() method to write multiple bytes on the data line of a SD bus. We might improve the tracing later, for now keep logging each byte individually. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200814092346.21825-5-f4bug@amsat.org> --- include/hw/sd/sd.h | 9 +++++++++ hw/sd/core.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 14ffc7f4758..3ae3e8939b3 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -175,6 +175,15 @@ void sdbus_write_byte(SDBus *sd, uint8_t value); * Return: byte value read */ uint8_t sdbus_read_byte(SDBus *sd); +/** + * Write data to a SD bus. + * @sdbus: bus + * @buf: data to write + * @length: number of bytes to write + * + * Write multiple bytes of data on the data lines of a SD bus. + */ +void sdbus_write_data(SDBus *sdbus, const void *buf, size_t length); bool sdbus_data_ready(SDBus *sd); bool sdbus_get_inserted(SDBus *sd); bool sdbus_get_readonly(SDBus *sd); diff --git a/hw/sd/core.c b/hw/sd/core.c index a3b620b802b..9c2781ebf96 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -114,6 +114,21 @@ void sdbus_write_byte(SDBus *sdbus, uint8_t value) } } +void sdbus_write_data(SDBus *sdbus, const void *buf, size_t length) +{ + SDState *card = get_card(sdbus); + const uint8_t *data = buf; + + if (card) { + SDCardClass *sc = SD_CARD_GET_CLASS(card); + + for (size_t i = 0; i < length; i++) { + trace_sdbus_write(sdbus_name(sdbus), data[i]); + sc->write_byte(card, data[i]); + } + } +} + uint8_t sdbus_read_byte(SDBus *sdbus) { SDState *card = get_card(sdbus); From patchwork Fri Aug 21 17:29:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57A87C433E1 for ; Fri, 21 Aug 2020 17:40:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 263A320738 for ; Fri, 21 Aug 2020 17:40:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LVskKQev" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 263A320738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9B1z-0004v8-D6 for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:40:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9ArQ-0001n2-PD; Fri, 21 Aug 2020 13:29:52 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:40828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9ArO-0001Fq-ST; Fri, 21 Aug 2020 13:29:52 -0400 Received: by mail-wm1-x341.google.com with SMTP id k20so2552757wmi.5; Fri, 21 Aug 2020 10:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TqTIxuRtm4sptcwb0q3ps8yrfFdshkuOQSKdgdGLCbE=; b=LVskKQevTLlpTWc7mgvJK1215ZYdYB1on62r85IKOsI0Arw31EzKNY4TOTuUYLgxJv dSam/nb8D4gFULetlU0LpNhG8PtdZ5y+vjGE3XuHfzyCQX7W7L9TKrApM0HErh0ft4jJ oaKuqx8a4C5FlgUyqDfSfKIFQNcrqTMCze4HvqACdYvMlQ4dOU7z/e1TwPWBlqMXCrk5 +b8dlBReEQKV62xCnMN6U6jjCwcIvs3YcFtuwhvVInrzMs6uLBiGtozdCCIyeoX+q4Dy N69k6F8StgTXRgsfsjfpby02Am7sYa2c0t+V7G0I3uO0RGUyq24ojuhF8FY6dQ+NscE4 T3Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TqTIxuRtm4sptcwb0q3ps8yrfFdshkuOQSKdgdGLCbE=; b=ccwmipoP3J6wiXSjrMof3sVRxzA+bU5Bl++jk1fzTIQmgrOQF4j8/MObhj87qik7jR DI2+rCNr2FHX2SgQeP7RqvhqUueUKnZ2br8WAQrKuBXmki5VG3FmFc9c537o79ecs6bi u/lli3vz3BUlpd2nIvPTj7wh456Ess0Yvu23nTfVPbzv6+p4s5tzDZHclDp90Kufd2Jv 5wSdC2pn+L2tnndhlRmJSzF1yF/VcKiwN8LQgoKoVywLbBsKkarLl0PTdJFCE5evKdbN aKsyRUkTzhUojtgAG+4v/UUDBg8YBYyVrmnWEXe/CHomnAj/89wrmapTCwy7w0dqjDNh sdRw== X-Gm-Message-State: AOAM533Jdk9w1XiuYbMpcdFBZ9RmT76USDtzya0wW6YFCEQKYG/Fgfo8 2J7IvwsVOoq9+AKbs5O13FpqIoFd6uQ= X-Google-Smtp-Source: ABdhPJzylqp+5TD4ux4jfJqoHS7QooRigClosyRuRqdsn2UTsJYDImY8h0I56EAkbzPFvLKSP0Tkrw== X-Received: by 2002:a1c:2041:: with SMTP id g62mr4156856wmg.172.1598030988637; Fri, 21 Aug 2020 10:29:48 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 19/23] hw/sd: Use sdbus_write_data() instead of sdbus_write_byte when possible Date: Fri, 21 Aug 2020 19:29:12 +0200 Message-Id: <20200821172916.1260954-20-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use the recently added sdbus_write_data() to write multiple bytes at once, instead of looping calling sdbus_write_byte(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200814092346.21825-6-f4bug@amsat.org> --- hw/sd/allwinner-sdhost.c | 14 +++++--------- hw/sd/milkymist-memcard.c | 7 +++---- hw/sd/sdhci.c | 18 ++++-------------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index c004aa39da6..eea5659c5f1 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -333,10 +333,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, if (is_write) { cpu_physical_memory_read((desc->addr & DESC_SIZE_MASK) + num_done, buf, buf_bytes); - - for (uint32_t i = 0; i < buf_bytes; i++) { - sdbus_write_byte(&s->sdbus, buf[i]); - } + sdbus_write_data(&s->sdbus, buf, buf_bytes); /* Read from SD bus */ } else { @@ -548,6 +545,7 @@ static void allwinner_sdhost_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { AwSdHostState *s = AW_SDHOST(opaque); + uint32_t u32; trace_allwinner_sdhost_write(offset, value, size); @@ -654,11 +652,9 @@ static void allwinner_sdhost_write(void *opaque, hwaddr offset, s->startbit_detect = value; break; case REG_SD_FIFO: /* Read/Write FIFO */ - sdbus_write_byte(&s->sdbus, value & 0xff); - sdbus_write_byte(&s->sdbus, (value >> 8) & 0xff); - sdbus_write_byte(&s->sdbus, (value >> 16) & 0xff); - sdbus_write_byte(&s->sdbus, (value >> 24) & 0xff); - allwinner_sdhost_update_transfer_cnt(s, sizeof(uint32_t)); + u32 = cpu_to_le32(value); + sdbus_write_data(&s->sdbus, &u32, sizeof(u32)); + allwinner_sdhost_update_transfer_cnt(s, sizeof(u32)); allwinner_sdhost_auto_stop(s); allwinner_sdhost_update_irq(s); break; diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index e8d055bb895..12e091a46e7 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -181,6 +181,7 @@ static void memcard_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { MilkymistMemcardState *s = opaque; + uint32_t val32; trace_milkymist_memcard_memory_write(addr, value); @@ -209,10 +210,8 @@ static void memcard_write(void *opaque, hwaddr addr, uint64_t value, if (!s->enabled) { break; } - sdbus_write_byte(&s->sdbus, (value >> 24) & 0xff); - sdbus_write_byte(&s->sdbus, (value >> 16) & 0xff); - sdbus_write_byte(&s->sdbus, (value >> 8) & 0xff); - sdbus_write_byte(&s->sdbus, value & 0xff); + val32 = cpu_to_be32(value); + sdbus_write_data(&s->sdbus, &val32, sizeof(val32)); break; case R_ENABLE: s->regs[addr] = value; diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index b897b1121b8..ddf36915619 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -496,8 +496,6 @@ static uint32_t sdhci_read_dataport(SDHCIState *s, unsigned size) /* Write data from host controller FIFO to card */ static void sdhci_write_block_to_card(SDHCIState *s) { - int index = 0; - if (s->prnsts & SDHC_SPACE_AVAILABLE) { if (s->norintstsen & SDHC_NISEN_WBUFRDY) { s->norintsts |= SDHC_NIS_WBUFRDY; @@ -514,9 +512,7 @@ static void sdhci_write_block_to_card(SDHCIState *s) } } - for (index = 0; index < (s->blksize & BLOCK_SIZE_MASK); index++) { - sdbus_write_byte(&s->sdbus, s->fifo_buffer[index]); - } + sdbus_write_data(&s->sdbus, s->fifo_buffer, s->blksize & BLOCK_SIZE_MASK); /* Next data can be written through BUFFER DATORT register */ s->prnsts |= SDHC_SPACE_AVAILABLE; @@ -641,9 +637,7 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s) &s->fifo_buffer[begin], s->data_count - begin); s->sdmasysad += s->data_count - begin; if (s->data_count == block_size) { - for (n = 0; n < block_size; n++) { - sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); - } + sdbus_write_data(&s->sdbus, s->fifo_buffer, block_size); s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { s->blkcnt--; @@ -678,9 +672,7 @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s) dma_memory_write(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); } else { dma_memory_read(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); - for (n = 0; n < datacnt; n++) { - sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); - } + sdbus_write_data(&s->sdbus, s->fifo_buffer, datacnt); } s->blkcnt--; @@ -814,9 +806,7 @@ static void sdhci_do_adma(SDHCIState *s) s->data_count - begin); dscr.addr += s->data_count - begin; if (s->data_count == block_size) { - for (n = 0; n < block_size; n++) { - sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); - } + sdbus_write_data(&s->sdbus, s->fifo_buffer, block_size); s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { s->blkcnt--; From patchwork Fri Aug 21 17:29:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 275839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEB13C433E1 for ; Fri, 21 Aug 2020 17:45:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 901C02075E for ; Fri, 21 Aug 2020 17:45:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MW7F0ENT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 901C02075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9B6R-0003Dg-S8 for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 13:45:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9ArX-0001uO-6e; Fri, 21 Aug 2020 13:29:59 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:38062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9ArU-0001Gw-CF; Fri, 21 Aug 2020 13:29:58 -0400 Received: by mail-wr1-x431.google.com with SMTP id w13so2335082wrk.5; Fri, 21 Aug 2020 10:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7MDjqCYoGN9RsgmgtLGjf6jZggXntu+eUZw2U4ch4n0=; b=MW7F0ENTmRAsnb35u56Sy4I7+q5C1nGvAV68vJlxQAT2lLQcSrTDTLzTCMcDgxs84p wcd2WW24QQpd6254CONOUocMG3gt0ymPzcvfhGOwpIOBZpx9cxmBShRBrblh1ltCLFSv PhVTJxWDQyqja2yuhfN04Z3/7xwFve2UsI9NgFqluRF5TCTZ3EjBXLj+HOraG4Ezeswj QBjXkf3DWSnhIwIgkVYCzur/0f+eNMGthxmNpMj/n7Dl+KhY09WrCG9YBApxqDlkrMTu RaOL+Nje3k+k8ilR1kfSAnghsH7x+oajKFOdVhuvIVBWNs8xTCwu0NRrjhF666fhHIt+ peHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7MDjqCYoGN9RsgmgtLGjf6jZggXntu+eUZw2U4ch4n0=; b=ddSX3nzSU97/CB3QmVRGJcAEoGu99z1qjcb73jMFk/TIy4mZipm9Uq8mebMB/1UDHx dj9J7y6Iqf1yqLcF/Qpydm62XJcBk7UTqs66cTa3ScL8YiteXMccpFxXxdZqJ4jnlh2o VBW0o/ToHhF+3pUYLNRaxmV/3CSB5cLddAjnqAwVS3oBlsMdMyZQUjwCTzh030hnClXs NvzIcrr533rnjBU3s3Yexx52VKCQ5qIXcWu24OuaeqMkIIDeFRT0LxmVYM10qsM3nylO SnEBppTbuVDyLh2XRiM6VsCWmcaxKdb/JVdT4AZzPtVip/iJhucXpy8f2O/VFzY/caFe Cslw== X-Gm-Message-State: AOAM530UGvsYVZWKUwpA9gNXeN1uO9d9Kx+TjD9vHqJOdRQ+UsUBCXuP GLU3O2DtpCdI7CIOW2N8ifXXUtIg8CQ= X-Google-Smtp-Source: ABdhPJxBX/2wYha+rIGx/AQJx4hoy7a3lGS+JtbJLmoGscR0j9TxuodKjYsi+xtTrHwS2zRQ0kNT0A== X-Received: by 2002:adf:ab57:: with SMTP id r23mr1834762wrc.386.1598030993404; Fri, 21 Aug 2020 10:29:53 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id 32sm5315471wrn.86.2020.08.21.10.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 10:29:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 22/23] hw/sd: Fix incorrect populated function switch status data structure Date: Fri, 21 Aug 2020 19:29:15 +0200 Message-Id: <20200821172916.1260954-23-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200821172916.1260954-1-f4bug@amsat.org> References: <20200821172916.1260954-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x431.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, Sai Pavan Boddu , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , Andrew Baumann , Beniamino Galvani , Michael Walle , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng At present the function switch status data structure bit [399:376] are wrongly pupulated. These 3 bytes encode function switch status for the 6 function groups, with 4 bits per group, starting from function group 6 at bit 399, then followed by function group 5 at bit 395, and so on. However the codes mistakenly fills in the function group 1 status at bit 399. This fixes the code logic. Fixes: a1bb27b1e9 ("SD card emulation (initial implementation)") Signed-off-by: Bin Meng Reviewed-by: Philippe Mathieu-Daudé Tested-by: Sai Pavan Boddu Message-Id: <1598021136-49525-1-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7c9d956f113..805e21fc883 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -807,11 +807,12 @@ static void sd_function_switch(SDState *sd, uint32_t arg) sd->data[11] = 0x43; sd->data[12] = 0x80; /* Supported group 1 functions */ sd->data[13] = 0x03; + for (i = 0; i < 6; i ++) { new_func = (arg >> (i * 4)) & 0x0f; if (mode && new_func != 0x0f) sd->function_group[i] = new_func; - sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4); + sd->data[16 - (i >> 1)] |= new_func << ((i % 2) * 4); } memset(&sd->data[17], 0, 47); stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));