From patchwork Fri Jul 5 22:04:19 2024 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: 810437 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1774965wru; Fri, 5 Jul 2024 15:05:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXaGaEC/LunIo1mRcqLA6MePHUzgNIZqgHv6oSskjobbUl0XMwwCKl70fJkyRTUs58tWA4yIFKAUUAA95uWDGA4 X-Google-Smtp-Source: AGHT+IH/x3a9vj/tnjFuggl0w7V70qa0p6QgdpHfxoMtABTwmhbCnoWyXqZBIyuPJBvomw1jHtUF X-Received: by 2002:ac8:5210:0:b0:447:dc5c:fc60 with SMTP id d75a77b69052e-447dc5cffd3mr16723481cf.28.1720217099943; Fri, 05 Jul 2024 15:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217099; cv=none; d=google.com; s=arc-20160816; b=YOgENxqOOq8/Ge5VykhxYgVsfMPu3ZpHbO8iznrTgoV+qTRM5QeMAC7AqPlHBshn3q 5m7cFXObiuqI/1SwiqDoaUoxTTJmh7YTUotiut/hdFZYwb4HYoJtISm0AJQN2yt+Yk8u cdGysNtTOYQ2XeK9BYPqZiPaRbnUr8k/Dz8I2qKz4ET47001HR5olZM5m6US5jgse1Ps KDghNPnagYBtiSygYClYlVFOdRsOShoZ1oU74Zg97AZrA4YK1t0sPzEMuUBu9XKR+ChU 9g7btt96U/D7Bpo2Ms6tjjBac7HTCUcYPvP1FwrbeTqSawIfL9kwkd1q3p704udbnr+6 cT0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GfXglVFItdMvYp2Ch/WZz6ab4++EfcJpsrja1IJfWWk=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=aJXclNCoDMQmgpyYd4XpF0q+bLaar1keNj3Kn7nJ9NifUpaxx4GaKg1OetnPWXZ0j5 xXfln/p77fUqfasFCOzT07XFZc9COpZOE2zKP1z3eVHTIYisqYnmKCVIG0hD8TSUuDWt NdHsEbvrbCV0sM0KI6rWcPNKr050ShP3vhELXsOVMvhB/dCfTS8Qh81vrLDnr1m57h2D DNKwZyYjigY7wAztezqyJ64JwpZ8qtOv/M30ZbrOqZkg/19N/pkJh4CgJsfTiSPvoc7F Fl/Q3Mpn86U2pMjSdjd61Qlc2W4tSy1RWjwSHW92zPYT3yGfRjn7BeeyGtHrPyI0XZIX Xbng==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P0kAaTzO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-447dd232d3esi10379471cf.757.2024.07.05.15.04.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:04:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P0kAaTzO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr2t-0001Wn-Ug; Fri, 05 Jul 2024 18:04:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr2r-0001WE-Rt for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:45 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr2q-0007A9-4n for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:45 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42567ddf099so14159495e9.3 for ; Fri, 05 Jul 2024 15:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217082; x=1720821882; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GfXglVFItdMvYp2Ch/WZz6ab4++EfcJpsrja1IJfWWk=; b=P0kAaTzOb7/WQubpeDPsbYBAUj+5TooA0UFtSfWOzP0ThsWx4xuUJI6N+WoZwqjYp1 2xtvtkv+lBnqeCJvAHFSGji8rWjWYJ4qQqt92Tut0gRQVTc+7pXP00XI7OT2nAQcpwUY CmXOzj3tnhQw8OrQ150erRAun386Ioq5TlrD8qMau1jbS+wzKKdDsw8e5e7IhZXuBgff UCd9qbwNk8EhMZt/4L3ERnmYHqET4QnlANQipJRpxSSIvMw4vjFkToaBxRFrJ96HMqUO L3fQ6b9cRn5NKpd/X40YJXCJXLNywB2ABgHTg8o9p64hf97eDr0Aaf6zN45mN0GbxAMo AkLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217082; x=1720821882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GfXglVFItdMvYp2Ch/WZz6ab4++EfcJpsrja1IJfWWk=; b=Ve7vJMiWHwmftIdt6bLdGwGoCl/sU9GAHO32kRFgxr2Z0gjov4Dv6kn4rorztK/jnD TRjd0QqRTasR6cyL5J4jN6aWfgQSy6Z5JZhoqZrOe7TjRjCDgqopaBK7vYaEpJOFh/5j qwtTQIEpAy76SoFNnYwRfiKndfLyUvBmE2munKW04LWIgaUEUCWiGZTv9uh22fSF+aQX 5qF5popHXTfgV2gliasK/TPgz4yy/aXZJi3DwHbCQY6EvIXsplVYQOhfg51uolRQIXuz YAUf+3M0uI18QqLQ9s5skf98YGjR4vuP7aM2bH0IqgUr+iyG/D/Nt9g+qHxu3G6+C5PU 9Y1w== X-Gm-Message-State: AOJu0YyVdFK/11u0AIWny+mfxC1EwqFexB8xmEjbose6I9uLyDig7z1O bNLayyphohJtnBdDR379dvZZXpqPKZxSWyOFKblXb27qKMzA7mB4M61FkUzmJBQIhBrQ6vYcwOW s X-Received: by 2002:a05:600c:3217:b0:425:6fe4:5472 with SMTP id 5b1f17b1804b1-4264a3d978cmr38039775e9.2.1720217082522; Fri, 05 Jul 2024 15:04:42 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a28327fsm74533965e9.39.2024.07.05.15.04.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:04:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 01/16] hw/sd/sdhci: Log non-sequencial access as GUEST_ERROR Date: Sat, 6 Jul 2024 00:04:19 +0200 Message-ID: <20240705220435.15415-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Message-Id: <20240702140842.54242-3-philmd@linaro.org> --- hw/sd/sdhci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 27673e1c70..d02c3e3963 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -983,8 +983,9 @@ static inline bool sdhci_buff_access_is_sequential(SDHCIState *s, unsigned byte_num) { if ((s->data_count & 0x3) != byte_num) { - trace_sdhci_error("Non-sequential access to Buffer Data Port register" - "is prohibited\n"); + qemu_log_mask(LOG_GUEST_ERROR, + "SDHCI: Non-sequential access to Buffer Data Port" + " register is prohibited\n"); return false; } return true; From patchwork Fri Jul 5 22:04:20 2024 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: 810438 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775023wru; Fri, 5 Jul 2024 15:05:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmb4MTSkrNED53OqkoolbVmYMC8bZS8OaThZpAYcU13B5yTEeBBSTeZUIXREykjrx2TCiJtD7cfK6Jd1a2oU5V X-Google-Smtp-Source: AGHT+IHKR/2dB1HVrhhzIeGsVLaed4XVJ4YDZX0E7Cel2zkSJ5xR6wxl7dNLWWWFRlznssVNGb53 X-Received: by 2002:ac8:5d43:0:b0:43b:173e:ce1b with SMTP id d75a77b69052e-447ccf7f229mr77021431cf.32.1720217109935; Fri, 05 Jul 2024 15:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217109; cv=none; d=google.com; s=arc-20160816; b=Pbi+cQxU1CHAnRnEdnV7XU9bTkIWxy96gsNGU1NYncTiWEXPN/11gR5FmQH+THGJNQ rYgOsBKmvSbCKU+ZUJlZegUqBcw3YmFME6+mJHU4/t3xa7eOUkEEPwnaUQl9GOxiHJyo Q1E0AaVBLh7u6RZeXrqTxcNMWr0qDn/m5gQnDaYK1fHB1rMB+whx6A3F8jsCURA7Mlkr YhAQfJTBnivrO91Ytu0EUBtApZednx3myDLaQfXGoHGSu5WR7bdpX0CebCBh3YTfi42/ nfnuBfjIrUuCOVvPo/JulQcMztjHKMSMXYnTshfun7oDd8rNr9501RmF+tqL6bnDeeFs Yr7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n4MUhhhcXCJmOjITmXxH8sb428buFk6h9v9ZsvqgcZw=; fh=/TyiCVzPJVYkT4NtrOYZRXAcrkaiLXA/rwqp4QqIc5M=; b=zpCmQ0sV3J3Ywo4apJTRMudHnU9ccw+b0qipbmqTzFkwQr5fDanuTXlP6jq7odTkAu AQViP0zVA+PMzQaDxX74H1ZC9lCsuwnyooDliT0HoVB5hHAEvK2oM1i1Yki86fQobcME d4/Sq9cTZUdGbwghRXTMRgNustnqzV51gKnLBQKhBmQDx+5iuBA3fCYiainetRcQtIoA CwOA1kpg0J1dxeB9ie89WSitVy+tNZHd915l5JgsMcuedCnTCL+TRp5fwM5iVVdRMWoh QEFKx/KGP8XeSxcDR1bBrErZiGoTF/ouFRm9ONEpCwZrebaB1TcL3EcZbAbDi4AdPGo5 JEfg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TE1Lj2oj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4466428556csi144836921cf.599.2024.07.05.15.05.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:05:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TE1Lj2oj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr2z-0001aW-JF; Fri, 05 Jul 2024 18:04:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr2x-0001XH-OJ for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:51 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr2w-0007An-9R for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:51 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-35f06861ae6so1218101f8f.2 for ; Fri, 05 Jul 2024 15:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217087; x=1720821887; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n4MUhhhcXCJmOjITmXxH8sb428buFk6h9v9ZsvqgcZw=; b=TE1Lj2ojcE+6jeUlN37BadakwUyZEMzQbA0+OxutMTqkxchQdliMUbrJY6COuaz7DR FH19y1V5ywk9HRHzi6x6Rwu194LCgtcVF7l+ihYyY/zBtcP0XcJsdKH5JFLE149JuRI1 QA/q3s17Sd+qi4z4EKww65w+df2lePBcsU9zwzulwGXcwY7Z57yTN9oYb6cr7lbDcyuj zpn/tvEypaGvJuIDGvaH00QXVeL3n2OSFcAgRbsZkdFAzFrzpAHj+cK3tSUi+RDfOP0M M5mkUp78eH2WTgELEdNxloQ0ZU0Iq9oPU+uGngVK3Ztc2ZpkyNuk5IOvGSqT3mUa2x5a OIHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217087; x=1720821887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n4MUhhhcXCJmOjITmXxH8sb428buFk6h9v9ZsvqgcZw=; b=HfG4KVVvQugqa32EWY+GYx8Zqlewt9HuKOYYbIMuDgiGLLVP5xIBlTgKnn06rXjh4Z HNiFqYu4UeIHl2lxY5KGGQvmEKAHYFAhY5Po5Ukn2i4G4ahUckUe0qTo5SDRQ/PX5pCR Xlqx0nkBZekREMU9M94vqplOxig8yakbnaHUfag1CPyQ4JDOrgChfhKDEk543rHN+7vU b/xDDKaJmxWDy2qqwWrLZJFZGaxWsCEK6sHsL/9J34ed1TOFtL0Jjqtf9UQ65dLrHjmc eoX8PDsCEwaRQ6Sjm/WQePJ/MggWv9R9TUvmB3Jdur7SRjI0yXH/eXLnZLqZkgCihaGC pr1A== X-Gm-Message-State: AOJu0YxTSv2a8fXnPx1UDsJVsw+/iHtbqvw9tE+nss48b08I4iatnHSd X91iZapqctyx5Ua9Oovu4y7WuMLg68ajA78FGAkvi9y9AdebqfPpLkM164EpEW85pNjTykj0Gp/ 0 X-Received: by 2002:a5d:5407:0:b0:360:89a3:5293 with SMTP id ffacd0b85a97d-3679db88a10mr4268703f8f.0.1720217087570; Fri, 05 Jul 2024 15:04:47 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a1d6123sm74888065e9.12.2024.07.05.15.04.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:04:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PULL 02/16] hw/sd/npcm7xx_sdhci: Use TYPE_SYSBUS_SDHCI definition Date: Sat, 6 Jul 2024 00:04:20 +0200 Message-ID: <20240705220435.15415-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the macro instead of two explicit string literals. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Message-Id: <20240702140842.54242-2-philmd@linaro.org> --- hw/sd/npcm7xx_sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c index e93dab8dbd..fb51821e11 100644 --- a/hw/sd/npcm7xx_sdhci.c +++ b/hw/sd/npcm7xx_sdhci.c @@ -16,6 +16,7 @@ #include "qemu/osdep.h" +#include "hw/sd/sdhci.h" #include "hw/sd/npcm7xx_sdhci.h" #include "migration/vmstate.h" #include "sdhci-internal.h" @@ -162,7 +163,7 @@ static void npcm7xx_sdhci_instance_init(Object *obj) { NPCM7xxSDHCIState *s = NPCM7XX_SDHCI(obj); - object_initialize_child(OBJECT(s), "generic-sdhci", &s->sdhci, + object_initialize_child(OBJECT(s), TYPE_SYSBUS_SDHCI, &s->sdhci, TYPE_SYSBUS_SDHCI); } From patchwork Fri Jul 5 22:04:21 2024 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: 810451 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775503wru; Fri, 5 Jul 2024 15:06:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVUcrKYW9xXVIeVWrwoPSYfWOAmlmdBk5oYLp5G+hrY7utkBcZcSn2beFVmZu7phy2lH9SJUNnnRlY+d2Mgvb3m X-Google-Smtp-Source: AGHT+IHq4ojywoXy8JSMnfXZSVlxdBFwGNkuWv0Gwt434uLuOs2RNuR7WWNsu4Rw6/z1mtosuva5 X-Received: by 2002:a05:6808:3c92:b0:3d9:22df:8e0d with SMTP id 5614622812f47-3d922df8f46mr1497346b6e.18.1720217212487; Fri, 05 Jul 2024 15:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217212; cv=none; d=google.com; s=arc-20160816; b=lNxrkvFGWamx5XoSh2T6/+LzBmKlEqGpv1ofw1/wzUfOwitoAcIVwbZaUCIhUIIYa5 UT/tvh+khkbDvirdqVTtbBUpWhgmlVv7ERXtxhZjTdWPSwuqLVYWDr1nZbUalgM+touR BAQ3y8/yAjfWdxVNYN6noR/kMyT6BSMY1dluNAs7dgrZhcMmL2pIGAHn5X0nk3EKn+rZ QMiALAU7ueZNBowaV650vFWZY8OKeEFtKwTXxRYqfiY3CqJEQJR6uysgEdbkaTBSIWzy 0ubFMh0Eg0m+UKT+N6D2o8X3quRweZAc8HeEaY03SrDHBO7me/zQqxoBOEpoqS06UlMK GBcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uDcwrWNYcnZcMeZ/8KRw8egv2ZLimv3SUep7b6VkVhI=; fh=/TyiCVzPJVYkT4NtrOYZRXAcrkaiLXA/rwqp4QqIc5M=; b=IaP0LwNUjogojpbObIa9cgOS43K1z7RVL65clKvLOP3iMnErCsYzMrpGNikfrZRSKm rFdmtxfF/KBsFGqx+bQnajdFjZ16Urp2hv0zFGKQ/LGPwfcozQyGW9bmVOt9a2FzL/bk zNCsmWVSEQMwF78V6jxb7Hs8sJaZRZWOGmjyE/ovqIDDGOVN9jatwx+IQdNwOqZZcBL8 5ipEnBX6SkijcfjoMRz07+jSR2vvkfpKAUPIWcWYwVvYmeargmfeCjSq3kPnpAVBjFfT 2CLpFr1zYnzTbbd4NBqm2yvW1o42+Jk88Go3e0MaN4Uz7jDnyOQlrbSzqiJ5l0VHIN7c Bb2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSFv5lrU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-44651487616si195923181cf.348.2024.07.05.15.06.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSFv5lrU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr35-0001f1-C5; Fri, 05 Jul 2024 18:04:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr33-0001bS-W7 for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:58 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr31-0007B9-Mr for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:57 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42562e4b5d1so14194465e9.1 for ; Fri, 05 Jul 2024 15:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217093; x=1720821893; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uDcwrWNYcnZcMeZ/8KRw8egv2ZLimv3SUep7b6VkVhI=; b=eSFv5lrUqg6iPQxnQIA2470Hz3T3ZSIFlRtReW1ZYMLoxFiEouUk8DnSq3bLYdIym9 o79Aer9xK6tANtIlD5U+Sy8Il8wi+Iep04CHn41StVmiyEeQrGeN5KQNqB8JjwgEBx/m I+HNUwVYif46tj3/be33xGFVafhP/ALk8z0VYDPhQMftou+aFKMbS5oC/9knIKVKT7dq r+d1+XZkaPlvZ7MuwYcLOvtUf+Ccc6WNyOAP1oW9Zn2YI3/fm4XlTfYcgZ/tEj7oISXv 9Il1BnJGDM3VaWVmqmI1S8NnJ9CRGQl8aePbs5/dcd0u8qphaxuc4gK73RrKiRzE1PVs QbZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217093; x=1720821893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uDcwrWNYcnZcMeZ/8KRw8egv2ZLimv3SUep7b6VkVhI=; b=l6EB0qbwXrHx+VWeq/FIgBa128gWmaJ8wNzt/FFRcRvY7oZujrNcZlpJmwR2RLXw2o O2UjWwHADNpUlyxuKF6UsfiZP6ZPiaxhM9wIrrz5KhCVwk4z0ZnZcUVLmWP93oGuMLh5 Mij8vmZvfwi8+o62bJvCsi141kns8O12gTmd0xfmWicCJ/ujjkT81DdNsI2o0R1Brw8G Iaf1u+H8qj6LvyFg9jl4lylNY/WUiE4BiPZ1r7GtOuFDG4nWXufflaWg5EDEY0nss/3m P45zg5tg7RfjjDcg0pgQFSxo0mPRLb4omOE91nm7INkGKRr1yi33MRw8k4N/X9YRghbs JNXQ== X-Gm-Message-State: AOJu0Yxghs5bVB21tSDyDVebfNITlDUpbA5uKsFN89xbUFbvFirskqjY b4crmQMrcuzzFgwpFRTIgLskfWhZAqY2/EKXUPm7/s2U2LQd8pJBTz1a5NU7CHs1d0YhQVUbmzx S X-Received: by 2002:a05:600c:45c9:b0:425:632b:b924 with SMTP id 5b1f17b1804b1-4264a3e3520mr40787315e9.16.1720217092790; Fri, 05 Jul 2024 15:04:52 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d6d41cesm61526645e9.16.2024.07.05.15.04.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:04:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PULL 03/16] tests/qtest/npcm7xx_sdhci: Access the card using its published address Date: Sat, 6 Jul 2024 00:04:21 +0200 Message-ID: <20240705220435.15415-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Currently setup_sd_card() asks the card its address, but discard the response and use hardcoded 0x4567. Set the SDHC_CMD_RESPONSE bit to have the controller record the bus response, and read the response from the RSPREG0 register. Then we can select the card with its real address. Signed-off-by: Philippe Mathieu-Daudé Tested-by: Cédric Le Goater Reviewed-by: Cédric Le Goater Message-Id: <20240702140842.54242-4-philmd@linaro.org> --- tests/qtest/libqos/sdhci-cmd.h | 2 ++ tests/qtest/npcm7xx_sdhci-test.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/qtest/libqos/sdhci-cmd.h b/tests/qtest/libqos/sdhci-cmd.h index 9e61dd4944..90efa028ef 100644 --- a/tests/qtest/libqos/sdhci-cmd.h +++ b/tests/qtest/libqos/sdhci-cmd.h @@ -22,6 +22,7 @@ #define SDHC_ARGUMENT 0x08 #define SDHC_TRNMOD 0x0C #define SDHC_CMDREG 0x0E +#define SDHC_RSPREG0 0x10 #define SDHC_BDATA 0x20 #define SDHC_PRNSTS 0x24 #define SDHC_BLKGAP 0x2A @@ -38,6 +39,7 @@ #define SDHC_TRNS_MULTI 0x0020 /* CMD Reg */ +#define SDHC_CMD_RESPONSE (3 << 0) #define SDHC_CMD_DATA_PRESENT (1 << 5) #define SDHC_ALL_SEND_CID (2 << 8) #define SDHC_SEND_RELATIVE_ADDR (3 << 8) diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-test.c index 5d68540e52..01f237a816 100644 --- a/tests/qtest/npcm7xx_sdhci-test.c +++ b/tests/qtest/npcm7xx_sdhci-test.c @@ -30,6 +30,8 @@ char *sd_path; static QTestState *setup_sd_card(void) { + uint16_t rca; + QTestState *qts = qtest_initf( "-machine kudo-bmc " "-device sd-card,drive=drive0 " @@ -43,8 +45,10 @@ static QTestState *setup_sd_card(void) sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_APP_CMD); sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x41200000, 0, (41 << 8)); sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_ALL_SEND_CID); - sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR); - sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x45670000, 0, + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR + | SDHC_CMD_RESPONSE); + rca = qtest_readl(qts, NPCM7XX_MMC_BA + SDHC_RSPREG0) >> 16; + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, rca << 16, 0, SDHC_SELECT_DESELECT_CARD); return qts; From patchwork Fri Jul 5 22:04:22 2024 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: 810439 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775095wru; Fri, 5 Jul 2024 15:05:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUHRpJchKZLsYbHu6Jdu6kMYBZyGKVzHF6AtZdzXKx9kPu+wjgN80/P1HUyOHUwFptLYciWfltzy36T4IY3L0Fz X-Google-Smtp-Source: AGHT+IG5aWI6vgxoXs7tjRRcdsVfPVfYLKCiMMSyuLEtaF8hUtwv560+e6BrzUE5n6IV5Ts4h+I3 X-Received: by 2002:a05:6214:1253:b0:6b5:d311:962 with SMTP id 6a1803df08f44-6b5ecfa8604mr75443526d6.22.1720217123513; Fri, 05 Jul 2024 15:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217123; cv=none; d=google.com; s=arc-20160816; b=sF8m92uhbNo+W4spDRUlzZPm7cjr6Vn/ltqGXE9EeCv0dEKtWvBPeklpcwYMgfsMPm 2+irsL8EVYUFcTlDB8SkyTjyaTDaMJM10vrze4rowlo/ZWSvp6KTqw/Xz84P6MPQNuWz T46DyQdQClA6KlbTXIWIRhNIQjISA7TQxvYCWSwzw1+xcEIhq1EUvhzsr8Es2ZhsVzkE vQ/wmdDBCtt5SbFS5bIr7EuS+wcfFia7QaHhAb+eSPT90pwoo7Oq/8rCz+VVZxkga9vp cpCVgGwN6PdyYgGPwBljpHWXZQP1eqZvBSAynxay9st8Wjh9WXVrl3PxJh2xkQbZPOZo toug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E7r9/bwMA7Y9aC77VYKrC6dcppuacEWAp1H+HkEgQaQ=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=1H9oMzQYhlc63InImtoJrQIitDipmnIYrQng1axDALgBKbVMCJhZbvmliYy9mUDy/i uJJ0Rg3kgF0zU+tANIlwfV7ke84auFn2NWmHN+/J36mEScKeTnc/UOR6omIlOm1yerAp fbzPnUQaJHYWJ2MnaK8rIGeAJ7gb++d1QHKxlOJDpyO+GW1s+esW4Wt6qlRZ86Hem+F+ n7R6WwGqE5yyztA23YG8IcnqiSZ2a5O2IoWAS79fZtRJa7hilGN2o0+Fo1TCCjK+YzVX K/dJ2IHrurkc0YNflvBC6tIqfYqTLdswOpdJ0xkgqZYoSYRStfR0lUEOrkGLKflEqfPH QE+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nE6thAv/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b5f2cc873asi31869276d6.113.2024.07.05.15.05.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nE6thAv/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3B-0001si-Pa; Fri, 05 Jul 2024 18:05:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr39-0001qH-Mu for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:03 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr37-0007Bm-CF for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:02 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-367963ea053so1574076f8f.2 for ; Fri, 05 Jul 2024 15:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217098; x=1720821898; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E7r9/bwMA7Y9aC77VYKrC6dcppuacEWAp1H+HkEgQaQ=; b=nE6thAv/gtU5DRGDUnUYdqpI9zF8utS6clazL6K6RAMMdYJG+zW4r/Yre5hZ3DrRB/ i/fR5mQxrmpNKc4YfOtirXxHlnM2sUC2XaZJilvMuxlRUGUvULrNteoEfB5d1okoTul+ EoUsv5pBJe3hFwVwpfMN3TUKdOZcFJXSXv2n0XlwZJoBh7JqDGMOOi8nTzTjNcnRN9CQ ZPW4EuEdyGpwD0q2xh2q06peLJTr4JjHG1KOXJCwus+J2d7QBnMBXy7Hi6wuf2YG/ICs s4W53EJl/E+i/gNyuo+usjsKqmmm5DWZM3vgbqquvJIcYF2ySAi8Xpyb1MXtLEDGkkMK toOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217098; x=1720821898; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E7r9/bwMA7Y9aC77VYKrC6dcppuacEWAp1H+HkEgQaQ=; b=DYiBruBF8BSZ1g1bQDoVVa+O387B16gNdyolpLlpiqmLpKErdZg2FXjJRuqy9gux2G XsmjEsagX/q15uMbqiE4Md8BqMSKiwUCzmIynlvk4DB7hscNywqEoN044F4olVh7wKh0 d1BEHE/baiSyDZeYtf5UueUDboRea9PIqnpZXrZ8rbl1lUI0y6F+70snzEMK6HvBlGMz w6IXkrrxmj69peYFjIlwcQBVK7Nd3/ZZAj/gNm5Ct0aA4/Lxh6WytPjwEWDWVZR5djwB EQ5qjZ+uBRlKdM1ZN15zPfJWr3L1bDbdCuSWNjJEMD4NF/DoTaduZS0zSyVD6m2VKakO 15og== X-Gm-Message-State: AOJu0Yx4ZBSOPT71josD8lRwrG+jqebclYLe8+foEF8y3IvSvkQpqToi cWYBf1GShpE+xtYtcK0wMQXmBIV8jh+GVseqVyAb4rKkULW0eqK2czF09nRrEQf1wP1UkDBNszM 5 X-Received: by 2002:a5d:4745:0:b0:367:8de4:84ef with SMTP id ffacd0b85a97d-3679dd31158mr4923237f8f.30.1720217098129; Fri, 05 Jul 2024 15:04:58 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367a8d74e0bsm2700480f8f.52.2024.07.05.15.04.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:04:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 04/16] hw/sd/sdcard: Generate random RCA value Date: Sat, 6 Jul 2024 00:04:22 +0200 Message-ID: <20240705220435.15415-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than using the obscure 0x4567 magic value, use a real random one. Signed-off-by: Philippe Mathieu-Daudé Tested-by: Cédric Le Goater Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Message-Id: <20240702140842.54242-5-philmd@linaro.org> --- hw/sd/sd.c | 11 ++++++++--- hw/sd/trace-events | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 552957b2e5..b158402704 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -46,6 +46,7 @@ #include "qemu/error-report.h" #include "qemu/timer.h" #include "qemu/log.h" +#include "qemu/guest-random.h" #include "qemu/module.h" #include "sdmmc-internal.h" #include "trace.h" @@ -515,9 +516,10 @@ static void sd_set_csd(SDState *sd, uint64_t size) /* Relative Card Address register */ -static void sd_set_rca(SDState *sd) +static void sd_set_rca(SDState *sd, uint16_t value) { - sd->rca += 0x4567; + trace_sdcard_set_rca(value); + sd->rca = value; } static uint16_t sd_req_get_rca(SDState *s, SDRequest req) @@ -1212,11 +1214,14 @@ static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req) /* CMD3 */ static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req) { + uint16_t random_rca; + switch (sd->state) { case sd_identification_state: case sd_standby_state: sd->state = sd_standby_state; - sd_set_rca(sd); + qemu_guest_getrandom_nofail(&random_rca, sizeof(random_rca)); + sd_set_rca(sd, random_rca); return sd_r6; default: diff --git a/hw/sd/trace-events b/hw/sd/trace-events index 43eaeba149..6a51b0e906 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -43,6 +43,7 @@ sdcard_response(const char *rspdesc, int rsplen) "%s (sz:%d)" sdcard_powerup(void) "" sdcard_inquiry_cmd41(void) "" sdcard_reset(void) "" +sdcard_set_rca(uint16_t value) "new RCA: 0x%04x" sdcard_set_blocklen(uint16_t length) "block len 0x%03x" sdcard_set_block_count(uint32_t cnt) "block cnt 0x%"PRIx32 sdcard_inserted(bool readonly) "read_only: %u" From patchwork Fri Jul 5 22:04:23 2024 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: 810440 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775116wru; Fri, 5 Jul 2024 15:05:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU97YhyCWHdY/3quthU9xfVn+h+2r0dpehD0fr4dmENvmpqp6y/obFgOJ+Dfh5V187ZCejg/cRYE9vc3+uv2XSe X-Google-Smtp-Source: AGHT+IFioMNXZnGR0xgaZt9gHNvbTmMaqNac7gwl5bWmqYClzwOFNSqCxqcAyv23Br4jHm9MKhiB X-Received: by 2002:ad4:5bc3:0:b0:6b5:e7e5:e62d with SMTP id 6a1803df08f44-6b5ed09c46dmr61745226d6.43.1720217127977; Fri, 05 Jul 2024 15:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217127; cv=none; d=google.com; s=arc-20160816; b=Sf477ajHN+yUqGvzTcTVnyr3lYKG8YJILxSCjJGV8lksYO87gJzkWQO65wJSbK/6ke uYXe/efHSSONMwsvhiAtWxYFXdA/QWX+YjUyheNw52zSSsi5DUA6K5vrGhGJzBNFUzW1 cxN9jJ6l01kI+FyRFXkHl+KrCpjQ21KPnfoGpYHBfreyiKIO73tV9cTBtcyC2uL2d3fB rQtywtCHDINH2ZiQNP3ATwJlII+GyYWUVnFWYsp45qfQhJO4cZh2qdRClVgmJUn/Rp9U qWxYmQkhBWhiWalRqPs30xyTut0IeXWH+XAkqztC0WCod44F+mhSGcvqyukPEXvkXybK 720A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/s1ufWIHKbT/k12bZcQ9O/yldWRsZCWWOQ+K9vyl63I=; fh=AS0ZhjRP5gspK/Y7r8QULWgzTkmLoSz6lI5pR5rNUe8=; b=ZZLOrrun/vQV7bUgUVRLfJKL8l3tBRZ15kK+cYP8QJ4PP3PhP+5nyqiS/1uuZHZyNu GDc0/7p0nvX4v5OAe2smDVMmSSZgClYZ+l50JxQOY7Qs+To0V4Au1/0EReA5K2VFPbWO lx9xFWPre9Lu+aeYK0Z01/Sh4lXRvOx9cw4zg+0bOKgNSUYfIQLFFE3BFZkPM1XTVqxe v7daiKm2EmDaDLQSG2aqCcrUWRBcepLCEWM/S4rL8JJKv90HfrYJPKI39xvu20mY8a/E ygaSBnPmuJ2ps01o4pq4PHg12ApB8l4S/jpHvWjXaMgJXfwp11+lB3BzMp0PAoTHMhe6 AY+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OKTOQm8f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b59e36c60csi179335326d6.171.2024.07.05.15.05.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:05:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OKTOQm8f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3I-00020O-G3; Fri, 05 Jul 2024 18:05:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3D-0001vC-K7 for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:07 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3B-0007Pj-IW for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:07 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-52ea952ce70so357139e87.3 for ; Fri, 05 Jul 2024 15:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217103; x=1720821903; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/s1ufWIHKbT/k12bZcQ9O/yldWRsZCWWOQ+K9vyl63I=; b=OKTOQm8f2OqHyH9Kf4dIkaW/dN+MHFMBTtJ0NlCcLZ9vwtincgrW9OLAZZ0ohcocA6 7gTI2NFgO4QsrRuh7el9kSTtMl+Zjx0xnl7YozoSEhJbr5iK17ilRNmPlzOPFzjgOZ2B jiElmbaxAtpKLZ1Dd9r0RMRwH8fuNR2nnI854NYRGwD+Je6AKKlS4vqQ+w0Gbe89QxMm cTmibziqKb2w++vZTFHxljuyoFTrchUHV5aG9FR0VJRhmmjNh51cpxHRwS0mWV9fVN72 z7BuzFc02vusln4Tm9G7sPwC7aDt6ZaaLKOYX9zIpJ57Chm4mabCL9bwA/gOph1OnwzM OPjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217103; x=1720821903; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/s1ufWIHKbT/k12bZcQ9O/yldWRsZCWWOQ+K9vyl63I=; b=HHjQk2xolyOdx0AyXHekTwYLQgMWSsolPM4Hp5uMDjneT2clq6hcAPOjAWogeMH9bZ pbl7X8RVsdY+u7MTAUCzXJI5k2kBVmT8YfJc6sdjMy8hiriCnBzPXlm4IORugBMD5DhE +RCsimLf9AVPcvad+BNoSLAmPFuj/OldZboSbPoftgqr25QNXHRQ/WPonGusWCCtvQvF 3hddGaaqg0+QNc40Sf6O/EaX4k+8BMfVa0dmU7mUAE65C4WrAhqE+QMSO+Gp1MirKEww sAYi4trJGjKMaQ0JHmbnR2uBrL9/wn9dRL8T7xndAhKte+3yQ2wBJrDKA6LKRvPoAp9l UZBA== X-Gm-Message-State: AOJu0YzJsL/E9jcmCgWp+2WTzAD2BJJamaC/80AjmD8hh1HcJ5mxdmEX jTB14JsRoxhRUly/Nx2gF8yJyKHrwT7Aq64nv0Ftgr95kx0flujUfvBeT/o5eMBzpCh/4Bh6+hf R X-Received: by 2002:a19:ca19:0:b0:52e:9ad2:a311 with SMTP id 2adb3069b0e04-52ea0628a8dmr4084315e87.19.1720217103253; Fri, 05 Jul 2024 15:05:03 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a28d3dasm76262025e9.46.2024.07.05.15.05.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Andrew Jeffery Subject: [PULL 05/16] hw/sd/sdcard: Remove leftover comment about removed 'spi' Property Date: Sat, 6 Jul 2024 00:04:23 +0200 Message-ID: <20240705220435.15415-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=philmd@linaro.org; helo=mail-lf1-x12a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit c3287c0f70 ("hw/sd: Introduce a "sd-card" SPI variant model") removed the 'spi' property. Remove the comment left over. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Tested-by: Andrew Jeffery Message-Id: <20240703085907.66775-2-philmd@linaro.org> --- hw/sd/sd.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index b158402704..53767beaf8 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2473,10 +2473,6 @@ static Property sd_properties[] = { DEFINE_PROP_UINT8("spec_version", SDState, spec_version, SD_PHY_SPECv2_00_VERS), DEFINE_PROP_DRIVE("drive", SDState, blk), - /* We do not model the chip select pin, so allow the board to select - * whether card should be in SSI or MMC/SD mode. It is also up to the - * board to ensure that ssi transfers only occur when the chip select - * is asserted. */ DEFINE_PROP_END_OF_LIST() }; From patchwork Fri Jul 5 22:04:24 2024 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: 810443 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775288wru; Fri, 5 Jul 2024 15:06:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVk4Z9booMO72uG4nuuqSct4lZRG+No15/gVUzrMFz/NVV410uRBM5jExt1apX6zaxONEHcTXMp60BV9/C0mX8Y X-Google-Smtp-Source: AGHT+IFyXKRwXdhZDc6Qc0g1iviWk4dqX5zmJUjznl77TRzN5+ATV+xfNI3ymcsyEavS6jcOV79W X-Received: by 2002:a05:6808:1646:b0:3d6:32a5:66f1 with SMTP id 5614622812f47-3d914eaa843mr6542134b6e.52.1720217161735; Fri, 05 Jul 2024 15:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217161; cv=none; d=google.com; s=arc-20160816; b=irK6Xw6y4Gq9pHpxt0UiwhqQDwieC2KWlAVOQN/Qqkr6NdzZBDj5/+ycfefBEFHN69 IwJ7MhELURVxXAthGlO2ovyx+EkHJNSjTt/nixkenCRWLFJDTdA/fKcrlcuWa+OoVZ5P iGb59Qyk8oUnRi8L6yJJS9EvOMebQL4xXCcApSl0YivuCFquH/OOF/+to3wRFeWhXM18 zrbX0pZsPwiFsInxkdgFMPJy4dyKWohMWec7MpHKHM6ERynAqRNUZuEOYXX44KC1Q8f6 IRlK8Wbdwa5eWrFAyKakcoeaV6zs40rt0jlV3W/8DIexo0s6N7Josldr9EM/xUN72k/f /yNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=036Texer6I+pO+uIuAaEx1pn0gbXODeKzXhWPzvzsi0=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=yoxb+e2l3abklYyyU+wbp5J2KShP3P0rzO16m2/9o1njep13O2naYgz6cNwsVWfhUI ONqFk6ENCUsupx1pr7KAIo+Y5AUse8A67KYh78CFn60zg2y+00UxTU8hL16dg1tYOe9n 5U2b/etjPEpSQM5LGaGeWGro2utBQYrKyBlgwv3i0pCP9C0mgrUM52Fhass3JbN+9peA yEBE5E9E7ss/fB7f/rMwxIGYMlpvJy+zGe4PzKA0zggY3j5QwPrfPzcDZY+O0mb8T9op K9yhYeMsSK/rzwMuDy2GQ+XNf+hf27nWEugAdXj0lHM0wKO6GMGr53uDI36KfmK4hgOg KCXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q8cqFcEq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-44664adf0dbsi155438771cf.730.2024.07.05.15.06.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q8cqFcEq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3M-00024h-Ci; Fri, 05 Jul 2024 18:05:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3L-00024T-19 for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:15 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3G-0007Ry-6B for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:14 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-424ad289912so14167325e9.2 for ; Fri, 05 Jul 2024 15:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217108; x=1720821908; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=036Texer6I+pO+uIuAaEx1pn0gbXODeKzXhWPzvzsi0=; b=q8cqFcEqk2jWzO6zpaDCjEsM+qLOQwqg+sKgDdYYxXdpuLATQqtqJi7gcK0aKF2fKE yEmdVYfzLidAt7SC1GTSb3Gksr+s+lVZRn4HbNOIo38uBMB7iC1vCmJqhdQBj+rxp6fw 28n2kL9RUPFkLzFMK+8dWgFJptfR//jD8wKq8luCnI7Z1Zt8+oI9Eij42MM3ahL/NBc2 qQsBOKfN6Ut3uVxUeGJ2AHjVICJx/7KV4Tbw1jitr7+c2nV/6qEs+JnWvnkQAmE632LH tqZup6bVHKDrkUaL+ml4AAsua9N9iJGMEvhpysJgOr5Mlj40vJ3dWL7H9AyWmHtQts2t 5n2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217108; x=1720821908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=036Texer6I+pO+uIuAaEx1pn0gbXODeKzXhWPzvzsi0=; b=GGa5jFjEM/nk/UiI2Scm3zfYN3qMvhZK9k51v2a/hlX5jwZeLL4CD2ErtRLeJBptq/ icVHodM1HW6GnETsi7O8Uh7H5rgCv5/4hheEplbCf8RKN5FE8JTQKUAkdw42Ewu6dzkz 43BcH7CTEdva8gQw4pQGxYHxB1FoMc9m/ZFejOt6fAhyYALZXzJP4DjLp/jWYKtNshPt 5VEA+s665lYwei9AL+VEejFxpYgDawuTbayjhL6atsYDkSWQC6HOjIcvW70DviDIbhVd Lto64J5zWpywvAnmNHFkV204fFkpE/axo7qvmmnh1tIpubBqsjY+FnBfP0f9SxicpcU8 7ruQ== X-Gm-Message-State: AOJu0Yy8orCRQQTmo2XVs+lDJpmzss182dWey5/JwA3iVRyGmjx6qNZy vzdyi0ijv8HmFCoDC8OcvxRkbe3b5TrTO3STGPDzPsEoXFxMZXT/3rhRKtVBsiCrw+MIQk7IxaC 6 X-Received: by 2002:a05:600c:8a2:b0:426:5b3e:daa1 with SMTP id 5b1f17b1804b1-4265b3ede5dmr11710995e9.29.1720217108468; Fri, 05 Jul 2024 15:05:08 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a2fc942sm75450655e9.42.2024.07.05.15.05.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 06/16] hw/sd/sdcard: Use spec v3.01 by default Date: Sat, 6 Jul 2024 00:04:24 +0200 Message-ID: <20240705220435.15415-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Recent SDHCI expect cards to support the v3.01 spec to negociate lower I/O voltage. Select it by default. Versioned machine types with a version of 9.0 or earlier retain the old default (spec v2.00). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240703134356.85972-2-philmd@linaro.org> --- hw/core/machine.c | 1 + hw/sd/sd.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index f4cba6496c..bc38cad7f2 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -39,6 +39,7 @@ GlobalProperty hw_compat_9_0[] = { {"scsi-disk-base", "migrate-emulated-scsi-request", "false" }, {"vfio-pci", "skip-vsc-check", "false" }, { "virtio-pci", "x-pcie-pm-no-soft-reset", "off" }, + {"sd-card", "spec_version", "2" }, }; const size_t hw_compat_9_0_len = G_N_ELEMENTS(hw_compat_9_0); diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 53767beaf8..a08a452d81 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2471,7 +2471,7 @@ static void sd_realize(DeviceState *dev, Error **errp) static Property sd_properties[] = { DEFINE_PROP_UINT8("spec_version", SDState, - spec_version, SD_PHY_SPECv2_00_VERS), + spec_version, SD_PHY_SPECv3_01_VERS), DEFINE_PROP_DRIVE("drive", SDState, blk), DEFINE_PROP_END_OF_LIST() }; From patchwork Fri Jul 5 22:04:25 2024 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: 810441 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775183wru; Fri, 5 Jul 2024 15:05:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0YZEWu/U+aGOk9FnafQ+0AITt2keB/uybCSwmBE1fKW+KxjfJ3VlUXOxk/aOKNk84Y6Hf/O2xP+6MWPMfHh/T X-Google-Smtp-Source: AGHT+IEEJ2DNkRexAU+ocaleOYBlwSr56PEdthpLfDDmtvdDxoVQIFznENGNJl/Y9P6hbMI2jHvP X-Received: by 2002:a05:6214:2525:b0:6b5:e761:73ce with SMTP id 6a1803df08f44-6b5ee60a02amr96653116d6.16.1720217140376; Fri, 05 Jul 2024 15:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217140; cv=none; d=google.com; s=arc-20160816; b=ge0iNbf8041PLvOJ9SVq5bjBWjpx9QopNrLKwGhpApyVsugAGxg8Ipkw5mEjwZBYmO xWsEWFju3HPsCwrstz196WyxzhCCsUGDyPcdrcR1bFDT3g8qdkvYm/bi2/eft9HBgXKR +ymOoBp6bePLh2XC+3aoXvPOqPOkIdcFEd0XsRebhWRcA9lyuFS7nFXR+dAFi/DgeTuN pJZpsDC+9jlnrMMCUlSVXJCUz4mcYSL295wJnnoHK9pgqR7EVLADJNxc2iAtDmlkMitu ZRI1/qQG1sbNbww+1e6cVkt8t9S1Z4c8B8mFf9FsIqzH9Aq3vUN6VSbIAHkdPvD+b6dk NcHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u+mjxHhy7ag9Jj4h5zPA6KSJtKNU8/EmUeNgyh9wt48=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=EdDMJsRlDflXRgQzEajitdbukdUUeSVWAdnm0ei2QpbXKsgRm2bwt9/rO7PmbTbg+l t4Xb0t2nlpymAbU22t2fwLKmlMhevv0L50Lm8PuF88mbPIfafA1WbjF5CMEDeOn/Zh6D TYLDbVLcwTmVisjC9nPWxGERgtBvyZNjQwqm4H6YSnB5ki/1LN1zuLEDXit3GwgkhXjm V3EvC2MLq3CW72uhHccmg8CVDDGDVAyoUt5kJ8Dt5y24w9ljeGNg5WM1ZDWxeu5C0PL7 skRpfDAn1b8i0jOk2G3qVIhfjNGe/74GtEQTOnuC+B/yNnfj/7hdVUrzn8JqB1fG59v0 tZnA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r3Ff95cy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b5f6b3f77asi24734616d6.279.2024.07.05.15.05.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:05:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r3Ff95cy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3R-0002F1-11; Fri, 05 Jul 2024 18:05:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3O-00025Q-SF for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:18 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3N-0007aE-Ac for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:18 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42565670e20so19377125e9.0 for ; Fri, 05 Jul 2024 15:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217114; x=1720821914; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u+mjxHhy7ag9Jj4h5zPA6KSJtKNU8/EmUeNgyh9wt48=; b=r3Ff95cyFCCiApiPyd+18BKgKEAvhR1AkHoQCYvTknsavYsH2Mr9eci8PcE4wCGVe9 gxcgvD23k3zM7fUvDAGxj98FUNn3rAmYFzkoMyXxZAGbNlJWPOAJxESNa5zysCbCRtNT zm9Nj7dPOmi82yD+rSUxRzvf4gfWIe2Ec9CrDxxFNoaAnnrx2+3OrgAUmOoaffi/8kgu 4l0t+Qf+LkO/v/Z/bLT/F/uuQLAWnlHr49gJvP7roZdDH8zsJ7CpUUSQyWGMo1Co9cNa 3TPJ3dWKad41P7kLEqha6w56BM7ek1FkiZQ7BJ+hV85tmLVH9tyby7UEJ2o41nalaDDF sr/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217114; x=1720821914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u+mjxHhy7ag9Jj4h5zPA6KSJtKNU8/EmUeNgyh9wt48=; b=j2yaI+M6r+g/A6gtUdu4rBoaHfBzmHs8Xm827wL1wz3X5ZwTWVT/JoXyi6vTJckstg wv5a1oe4SjOmzYWS54rPxh0224Cp4OX4SfH4BA674X8A/5Ph4NsceUbfdDkn4ys1nULV PCTGhFw/44Xo46E7qHJrBe/zuK3nrAIvybxxOztUivsf2x51e5mNmqAzO4GCx5kAZhgR uGMHZASw+GEEE+ekyYXbdFJla2fnxjCdgcYOAXgMrtajjcVPr5aUTZtKkfD4g1VClfeA tBoZ6NALr9Vqrm9LdH7gE9gFIjqraAWVoJxVBYvo1D9RhioL1VOdzOTddM5l0Z/o/LOK r5dA== X-Gm-Message-State: AOJu0Yzjb2MV5CrnH9N18oKUt36RlpJlNSovEBtomGzSa7UVFzO6gQd5 BuEmPOO6wst5ECT5S2wph6WlKcjK1+qdxKRKP9QwskYoYQV2w5UU35Zgtlsk5fKaCiIT8S0QQfa 5 X-Received: by 2002:a7b:cc87:0:b0:424:7895:dd45 with SMTP id 5b1f17b1804b1-4264f2ae75fmr38669035e9.17.1720217114092; Fri, 05 Jul 2024 15:05:14 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4265f84cd44sm1830465e9.18.2024.07.05.15.05.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 07/16] hw/sd/sdcard: Rename sd_cmd_SEND_OP_COND handler Date: Sat, 6 Jul 2024 00:04:25 +0200 Message-ID: <20240705220435.15415-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The correct command name is 'SD SEND_OP_COND', rename accordingly. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240703134356.85972-4-philmd@linaro.org> --- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a08a452d81..8618c2bcf0 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1689,7 +1689,7 @@ static sd_rsp_type_t sd_acmd_SET_WR_BLK_ERASE_COUNT(SDState *sd, SDRequest req) } /* ACMD41 */ -static sd_rsp_type_t sd_acmd_SD_APP_OP_COND(SDState *sd, SDRequest req) +static sd_rsp_type_t sd_cmd_SEND_OP_COND(SDState *sd, SDRequest req) { if (sd->state != sd_idle_state) { return sd_invalid_state_for_cmd(sd, req); @@ -2392,7 +2392,7 @@ static const SDProto sd_proto_sd = { [13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, [22] = {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, [23] = {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, - [41] = {8, sd_bcr, "SD_APP_OP_COND", sd_acmd_SD_APP_OP_COND}, + [41] = {8, sd_bcr, "SEND_OP_COND", sd_cmd_SEND_OP_COND}, [42] = {8, sd_ac, "SET_CLR_CARD_DETECT", sd_acmd_SET_CLR_CARD_DETECT}, [51] = {8, sd_adtc, "SEND_SCR", sd_acmd_SEND_SCR}, }, From patchwork Fri Jul 5 22:04:26 2024 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: 810450 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775499wru; Fri, 5 Jul 2024 15:06:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWrivh37M3EfgBtcgLv5ZfPtpfjHD3x5gE/lUk77BNCpykNLpEbuZwCRcuP/ofvfON3mRyueecfOUyzpAVvaZs1 X-Google-Smtp-Source: AGHT+IEngXJTTlhXlJCCJgpAQHfa+U6/Owf/MHo2dMxO70yAb/F88ZM/MCXxJ9Igrt6r7H+sd95T X-Received: by 2002:a05:620a:94f:b0:79e:ff22:b23c with SMTP id af79cd13be357-79eff22b492mr149882685a.9.1720217210127; Fri, 05 Jul 2024 15:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217210; cv=none; d=google.com; s=arc-20160816; b=LPcjyGzUxBKqG31R9IMlvOw1NXnPr37nv6mtO5VKD61Z+mo6EGq+zr38WfclHHZeqh fOq2hzf60uejYwnj22ejd36pvG+t1Czgtizg7e5+xX5XO458rrFairfsN1OgiIdTJCcR mdVTf5pwwsp2AIbIT/aBOoF3zXyrC20K+O8HmQpcBjUel3vYJMx/WKuuzKxoD8zfaCaB k9UGNq59FagA6ADF5KrWS8LNNdF03wn1s5n3QvPYZ1Pe02JyyWCGYqarYHGtPuc680X+ Js1eLJEh/Fg3P9B478VxKdr1btHqt5ersXtRcaeMiiESItY8EkQq/RVkls61oU4e3sNe m1zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u9D/WC7IdxNIJk6AHwWA75pe1sGPv4JT8i2Sn6RjhLY=; fh=3VrPp9zX0iEOxFH/83rsiNzPU9So5JaMP+Zo+luzn+g=; b=X488KHzfHPNhrDH41yh7Nt0ul8nvala039AOYFqrMmKhbWDnAnNiosKMi4iGL4+wRS w2GxY2sRtPpTUqN1ng9XauaD2sugzf21wQEjfDcorlNbbZpceFgzxVRdv3KDU4PKCyu5 uVGUtvFOvXuzUkBdUVq9MbLyn6Md3z+YXnqZtRhmWSMhZWhENom/5axjS+NWpV09YvHC RYCHnOQSFBmKcgeacufpqfj9PbZ3WRI/Htx2rGvzrR2uCEM6T3IybdiN8EL6Q/kvA1oi RNvE2Qen1AmRqS0EHB5gXK/JuQIc7ET/p0v19X+HIsvOwlCvWgFdppdxYtl6QeFcZqZH utQQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UPJVTWig; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d69308d99si1990130085a.508.2024.07.05.15.06.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UPJVTWig; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3V-0002lw-EV; Fri, 05 Jul 2024 18:05:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3T-0002b7-UN for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:23 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3R-0007ao-Ti for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:23 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2ee4ae13aabso21280081fa.2 for ; Fri, 05 Jul 2024 15:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217119; x=1720821919; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u9D/WC7IdxNIJk6AHwWA75pe1sGPv4JT8i2Sn6RjhLY=; b=UPJVTWigr1nz7qhxhxMLkMl1QnA3dyjWaAoAJRDVuFg+kaT1u1+/TSDXnZNAH33Ihi mAGrRfvHpr21hmPYvQ4UHbJTsjXaC1XIIbllppPpMAQHhLKaRBoykH70EIr2zII+ndGs dgpTXwgpYEd8sCBNNXZWIIK7eMYGsRfhb6CNSAJLv+KYPHF6XjC+rR1Zgz5NkhLA1EOF SJzldqAPgZ1iJc0GUK2tNm8nsebRJLEvA9Fzj7TqTGre2qr7SWdCoPAxBeRABpDEZf2J ILODxWy4R9b8EYcfQuPZjk66pC/UUbucbnrL9NBr+9uX2QuhSjirDz2SBUlebsCFhLA5 KHKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217119; x=1720821919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u9D/WC7IdxNIJk6AHwWA75pe1sGPv4JT8i2Sn6RjhLY=; b=Pc+uhe3DOiS7RMHW4WNmu9yFTuuGYqk581HFv1zRpFFjLl9NLCf2l7x6dkZW5wB7Eh C/FZ/kOsbHvTCyxlJ+M+7Aih1ijxIa1jhYj4k1G8VsIL+JGsJtM0w6pnDuM5tzazNzVf dkBnR7unoJj4NNf/SFgrwqPTKA4PTgFi+ec4Y8jK5pIUHJBAXGrdBK+LmvIbVqmUpAf+ uVFKmn84X+b6pPNuZwGLVLjsf0ky8RCpaMe9cn3AbXblMgkRbijfnaR4TpplQHVrh+O+ 3CBivt4jgg7RTIYCak20rFkPBg5CxkRoVSvv+HxAhmQBn1O+Cyu0bU3fiFuK07M0u6jF qVUA== X-Gm-Message-State: AOJu0YxzB3oswiKJaR7/xYC7BzMdEvgZkzB7STE3SJqyYzzw6ETIBipA B27rSw2u0QiMANOYJ72SLwzFgoPfRIvGwhFOGf3gwt/j/hAM4VwLE0sVJ4WV9SvipWzUJzzX6u+ F X-Received: by 2002:a2e:bb85:0:b0:2ee:8817:422b with SMTP id 38308e7fff4ca-2ee8ed8f728mr32341751fa.19.1720217119568; Fri, 05 Jul 2024 15:05:19 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a1f23c1sm75363905e9.28.2024.07.05.15.05.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Jeffery , =?utf-8?q?C=C3=A9dric_Le_Goat?= =?utf-8?q?er?= Subject: [PULL 08/16] hw/sd/sdcard: Add sd_cmd_GEN_CMD handler (CMD56) Date: Sat, 6 Jul 2024 00:04:26 +0200 Message-ID: <20240705220435.15415-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org "General command" (GEN_CMD, CMD56) is described as: GEN_CMD is the same as the single block read or write commands (CMD24 or CMD17). The difference is that [...] the data block is not a memory payload data but has a vendor specific format and meaning. Thus this block must not be stored overwriting data block on underlying storage drive. Handle as RAZ/WI. Signed-off-by: Philippe Mathieu-Daudé Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240703134356.85972-3-philmd@linaro.org> --- hw/sd/sd.c | 54 ++++++++++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 8618c2bcf0..10f2764a53 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -243,7 +243,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) [25] = "WRITE_MULTIPLE_BLOCK", [26] = "MANUF_RSVD", [40] = "DPS_spec", - [56] = "GEN_CMD", [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", }; @@ -902,9 +901,6 @@ static void sd_blk_write(SDState *sd, uint64_t addr, uint32_t len) } } -#define APP_READ_BLOCK(a, len) memset(sd->data, 0xec, len) -#define APP_WRITE_BLOCK(a, len) - static void sd_erase(SDState *sd) { uint64_t erase_start = sd->erase_start; @@ -1641,6 +1637,22 @@ static sd_rsp_type_t sd_cmd_APP_CMD(SDState *sd, SDRequest req) return sd_r1; } +/* CMD56 */ +static sd_rsp_type_t sd_cmd_GEN_CMD(SDState *sd, SDRequest req) +{ + if (sd->state != sd_transfer_state) { + return sd_invalid_state_for_cmd(sd, req); + } + + /* Vendor specific command: our model is RAZ/WI */ + if (req.arg & 1) { + memset(sd->data, 0, sizeof(sd->data)); + return sd_cmd_to_sendingdata(sd, req, 0, NULL, 0); + } else { + return sd_cmd_to_receivingdata(sd, req, 0, 0); + } +} + /* CMD58 */ static sd_rsp_type_t spi_cmd_READ_OCR(SDState *sd, SDRequest req) { @@ -1836,22 +1848,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) case 26: /* CMD26: PROGRAM_CID */ return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->cid)); - /* Application specific commands (Class 8) */ - case 56: /* CMD56: GEN_CMD */ - switch (sd->state) { - case sd_transfer_state: - sd->data_offset = 0; - if (req.arg & 1) - sd->state = sd_sendingdata_state; - else - sd->state = sd_receivingdata_state; - return sd_r1; - - default: - break; - } - break; - default: qemu_log_mask(LOG_GUEST_ERROR, "SD: Unknown CMD%i\n", req.cmd); return sd_illegal; @@ -2187,11 +2183,7 @@ void sd_write_byte(SDState *sd, uint8_t value) break; case 56: /* CMD56: GEN_CMD */ - sd->data[sd->data_offset ++] = value; - if (sd->data_offset >= sd->blk_len) { - APP_WRITE_BLOCK(sd->data_start, sd->data_offset); - sd->state = sd_transfer_state; - } + sd_generic_write_byte(sd, value); break; default: @@ -2233,6 +2225,7 @@ uint8_t sd_read_byte(SDState *sd) case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ case 30: /* CMD30: SEND_WRITE_PROT */ case 51: /* ACMD51: SEND_SCR */ + case 56: /* CMD56: GEN_CMD */ sd_generic_read_byte(sd, &ret); break; @@ -2260,15 +2253,6 @@ uint8_t sd_read_byte(SDState *sd) } break; - case 56: /* CMD56: GEN_CMD */ - if (sd->data_offset == 0) - APP_READ_BLOCK(sd->data_start, sd->blk_len); - ret = sd->data[sd->data_offset ++]; - - if (sd->data_offset >= sd->blk_len) - sd->state = sd_transfer_state; - break; - default: qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); return 0x00; @@ -2323,6 +2307,7 @@ static const SDProto sd_proto_spi = { [52] = {9, sd_spi, "IO_RW_DIRECT", sd_cmd_optional}, [53] = {9, sd_spi, "IO_RW_EXTENDED", sd_cmd_optional}, [55] = {8, sd_spi, "APP_CMD", sd_cmd_APP_CMD}, + [56] = {8, sd_spi, "GEN_CMD", sd_cmd_GEN_CMD}, [57] = {10, sd_spi, "DIRECT_SECURE_WRITE", sd_cmd_optional}, [58] = {0, sd_spi, "READ_OCR", spi_cmd_READ_OCR}, [59] = {0, sd_spi, "CRC_ON_OFF", spi_cmd_CRC_ON_OFF}, @@ -2383,6 +2368,7 @@ static const SDProto sd_proto_sd = { [52] = {9, sd_bc, "IO_RW_DIRECT", sd_cmd_optional}, [53] = {9, sd_bc, "IO_RW_EXTENDED", sd_cmd_optional}, [55] = {8, sd_ac, "APP_CMD", sd_cmd_APP_CMD}, + [56] = {8, sd_adtc, "GEN_CMD", sd_cmd_GEN_CMD}, [57] = {10, sd_adtc, "DIRECT_SECURE_WRITE", sd_cmd_optional}, [58] = {11, sd_adtc, "READ_EXTR_MULTI", sd_cmd_optional}, [59] = {11, sd_adtc, "WRITE_EXTR_MULTI", sd_cmd_optional}, From patchwork Fri Jul 5 22:04:27 2024 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: 810448 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775436wru; Fri, 5 Jul 2024 15:06:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOuIew5EX3L6P9czFROaGJTRY5s6LZwQqoOUTtMRu/QJjE1Panvxa1EmrVkJIFkDRp4podgiTprFQPA7N75Y0K X-Google-Smtp-Source: AGHT+IEVlXoq8l2ZIn0Q7azUR56zxI8pMv9dJdxcbogtgAoj5EZpjzz3BB6FQL22FhjXzxUHB075 X-Received: by 2002:ac8:7f86:0:b0:446:493b:d2b6 with SMTP id d75a77b69052e-447cbf7a8efmr75657371cf.49.1720217193740; Fri, 05 Jul 2024 15:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217193; cv=none; d=google.com; s=arc-20160816; b=jDxwvUxXHHMxa3hfpLq3EJrLGqNF5OqW5G0fotuM52QY46mM28yr4pOj5ClNMSkmJ5 NlwLt+Ie2g333HG0M5OOwL0X2HRivoPw3c08AgcogpPmJs2+vTCp9wjBXnj8X51GByYS UtqoDny0CD4QR38rqOjoW5Jo28hW5FvuMG+unp+EMdYUTzq1CHs3/bs5F0CDwqqh6Lgp tLYlPDWoyD/9Dt0wXM+4wBwf3GDmHKNw8WV60L4bzyWwA/ZQHJY13OaWfUggXS9Hk+Gt feNBKViP3f2sAAoZQO8kFoCuo5xL7PuL/PCEjhueLjqCneO4MGaxfmQ3htnV7eiWX0/U L6rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fniJoDv0JvGQIrVVzQXHvMIti3h9L7JHmKwMnT7C6s8=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=cRmVcjrZB42cdiTbAnQm2RBriBzMqlXY3WmTDuXE1wK6A245+PYquSMlSkMCBUCDeG fZ1mPqiX/A0prqFcf1Bc2Vyw/ZckMqbhjiPwfHiPKGM4Bn1N0Hgh/Lq7wqOLdTehiv2J nugU8BMwHTVIlTnf5GQwrAAsYQ0uRiIdP7BqabzzIQ7L5oi3s+OTunyeQITZO+NI0t20 aJskcpO4RFl2ycBgQhJomf/DXuUXTEgZ2nEmoWBiCKajoQUZUaXohnWwaOg+tQsXst3u 0h8TYUIINuQIol/NwDd+E7q4+pOciYQRrfSTUe5yPK6bGTcfC+pNB5HjEqVtt8srYu7O Ni8g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="S+iG/9fl"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-446513f7954si175595631cf.207.2024.07.05.15.06.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="S+iG/9fl"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3b-0003KW-4V; Fri, 05 Jul 2024 18:05:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3a-0003JB-4M for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:30 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3X-0007c9-Ok for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:29 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-424ad289912so14168625e9.2 for ; Fri, 05 Jul 2024 15:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217125; x=1720821925; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fniJoDv0JvGQIrVVzQXHvMIti3h9L7JHmKwMnT7C6s8=; b=S+iG/9flDDq0GPoeMxaLsAOHmOXxxHISjQlHHfjs5/jnV80zJTedWiGCYTb5nRSUYJ DzAZyTmpCDlDtFMHzX921/+kENKPBLgC7yM4zA+27D4pJsPthDr+kEvyvvkhU8Y3MJGM LATZfW4X5t/zPlZDp9RA7COd+pm2MV5LJkqRK3q85CmHIkae9RwN+fAedA+6b9ybkQ9S 1XL/Cav2bEFX2e30at66XsfI7qidAXDRV1ZM3xP3VGCvHnPnFERDXlsnb5zoeALLWg8B ycVb1ahKd/E/w/MaRg10ef3gu3NohDUI1mkyPyqzqe026EU0Ofb9v+PCMSC9ST9W7csI n3Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217125; x=1720821925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fniJoDv0JvGQIrVVzQXHvMIti3h9L7JHmKwMnT7C6s8=; b=dA+6KfDhzbdFLbcbgjpMUSOfD31K6s7ryb++2NHe11H/5rZJTdN2bB1YwEMfDKDQ3t DAhBc4YeYOL2xq6EjdQYzhe7o1iUf64tX8udimKPYoS8EJu2+44q3m8OBF0FjJ7JSTd2 1Busiri5Lzgy4qAeQReVnA94pD/tBs1mVbcXQqI1o3oU19mQbeyYxGA+JXLz4Kg/D6mE 05cQfgYiSZWKhLR2rEAaHGrBzZgTBSwHtgE09iFvct64zVS+IN0xkrWUQzH6wl7WRHCY 0s9wVo4Lo/AHmzcUotCac3hlmoudvD9Ze7YdGYi6pbQVOTUcLJEW4cnBuvn3G9X2gqTw IaWw== X-Gm-Message-State: AOJu0YyIbGicN3CWvK9QG5lhNgQRS5kJpBaTr4om+zplebw2xvbjvkJe 0tPVa1kmNTRdZeU1q/s9Q8KmWwmvl1sSI//VUvlW3ZJBGMTtq9jwAslzwMTTOb+InXqHVK8Hdqc o X-Received: by 2002:a05:600c:5126:b0:424:bb93:7aad with SMTP id 5b1f17b1804b1-4264a36eebbmr45998925e9.0.1720217124877; Fri, 05 Jul 2024 15:05:24 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a1f23c1sm75365555e9.28.2024.07.05.15.05.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 09/16] hw/sd/sdcard: Remove sd_none enum from sd_cmd_type_t Date: Sat, 6 Jul 2024 00:04:27 +0200 Message-ID: <20240705220435.15415-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org All handlers using the 'sd_none' enum got converted, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240628070216.92609-76-philmd@linaro.org> --- include/hw/sd/sd.h | 1 - hw/sd/sd.c | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 29c76935a0..c1a35ab420 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -76,7 +76,6 @@ typedef enum { } sd_uhs_mode_t; typedef enum { - sd_none = 0, sd_spi, sd_bc, /* broadcast -- no response */ sd_bcr, /* broadcast with response */ diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 10f2764a53..43f60cf089 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -524,17 +524,12 @@ static void sd_set_rca(SDState *sd, uint16_t value) static uint16_t sd_req_get_rca(SDState *s, SDRequest req) { switch (s->proto->cmd[req.cmd].type) { - case sd_none: - /* Called from legacy code not ported to SDProto array */ - assert(!s->proto->cmd[req.cmd].handler); - /* fall-through */ case sd_ac: case sd_adtc: return req.arg >> 16; case sd_spi: - g_assert_not_reached(); default: - return 0; + g_assert_not_reached(); } } From patchwork Fri Jul 5 22:04:28 2024 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: 810445 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775308wru; Fri, 5 Jul 2024 15:06:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVUdz+GniPgQ9llZrAGN8eO+7iJLaHF3q9LZWNQ8RG4Tc06c3eueliHsAUmOACbZDlNyrT/CP6vHaMi2x0r0A0Q X-Google-Smtp-Source: AGHT+IHGJXXKZ5cYlSvrt5IL5U7PZKVJkcM3DyjTyUy3NQTMlG7l9FaZcbsUr0LBo/bzsmXLpEmo X-Received: by 2002:a05:6830:1685:b0:701:ff09:659c with SMTP id 46e09a7af769-7034a76a375mr5719653a34.12.1720217164816; Fri, 05 Jul 2024 15:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217164; cv=none; d=google.com; s=arc-20160816; b=D2XuSl9eGJaxjn7Shx1eupi4Mf4zE0Dv/nhymb4CCVbw40VEK154w4cl1J6xWzAsIb 7LQou+nieI4iraFtDs5wx0vAv4dzp3iyv1a2Sn2vKPpsEId7L1m705LJ0bqqqOXTClxr o6KcPqg4mk4Th1vMRgNzFsYnAGGZZaRSw+gWL+iupfL7bdnMfec0K7937AXc4K8qtglv nKw4R5vw47eos4Mpx05CNP5lqoqUOsQSfn+Jh3LRNlvkxsXkeGIR/WBdfYoZ5QQmk45o G6Hz+o9lbJMi9lgYdUxgN9nXoAJNeCOysqUnSy7ZdA53aDkh9kFSOeagNLD+RwHmRJ4j LXNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jAlAjAi0la7DLkTry/Utfy2iNkVhe1yyhErZWeYwj/w=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=jp2HqIhOCrBy5ZiyF4XRR1bLA8fGfMqCapY4IJmOxkSC01BVoMkQLo8wWFWDEJlg1l S39r10ytAl3OtNEiwCF96K0CbvAxrCSm8OVTLG7OqNuBvC//HnD1yt/Ogx7Wu+G1zX5f 6hneDj2dqybRfvqd54p+JHok9k84evbI6qsc8W36meZSpbAHuvrx3Aq98TwKOOJcAp/m 7iY/DqTalyBbuYNmQVynUemgCLCj0tf1tVhabNIs+dOk3+k8YH7HF1R45hIXYUjSNLPH T7H84CplX80w5AShoIcagScbs8SRktSbrIZW46HDCq4/8LYPP03i9OdmHRHuQFxwXxdC WXBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UasUh2Pv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d692881c5si1755113985a.167.2024.07.05.15.06.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UasUh2Pv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3f-0003Wi-OG; Fri, 05 Jul 2024 18:05:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3d-0003OF-Nh for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:33 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3c-0007go-46 for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:33 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2eabd22d3f4so22910761fa.1 for ; Fri, 05 Jul 2024 15:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217130; x=1720821930; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jAlAjAi0la7DLkTry/Utfy2iNkVhe1yyhErZWeYwj/w=; b=UasUh2Pv/GJ91TzRNbf/X69usZT2IR5k0Jmoolq8xEE9PQfD+K/x/zLif45SF3i5P9 CE1Ff96VjRChiyVvmV1v9Jy6rx3eVD87nwaPaOPW9VJUjeL4UlMEpjKKo/bnWUqgl54L rCCQd/gBmIXrJ7zwaucp32ixHUmtCUhTMcNWDQThfZXDl/geQ8D6J4BhCVw0xdCFBVin Mn6Mp0XeWEsR/RowznjlZGzlxxaYA70CQJt+MYIfoXEdFPvx27wQefo/KXMEA26Kch3F 3i/QxCzsvX7jYxsd3sLShw+TQgLl7GNLPPpzDoRCAnax25RohbQtNWfVtz+UXagHQYek A1yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217130; x=1720821930; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jAlAjAi0la7DLkTry/Utfy2iNkVhe1yyhErZWeYwj/w=; b=jRiJU4fxwDUobuQoTtThVDvPsmpOLpIOdwVxC+1qCKzMKAewMPdiRQGUYImMDMwh0L p9wQQNgShvyW3yS+I7P0WETS3J1m7MDcry4n7EpIQPwESZfkL+1v72yOzSvd2KCZ4sRd vyhygSxEJRcUoNp3ofxZml8Xn4P7tMPBgbIh6ZzI/sC8dhegxnRXqUfdlSVj2ML1VYq3 ANiQefdX88eoOsNVP5mHIlvl0vtNR1rr6NimKL3dM6Uje/iIjxZqmbGULRQoeg0UIVde EkhgIwOZ56wH7i1/zU+MEUs/nlN7GG3tEVpGijaQK83tuU2uDTkPRf0Qix9bByypT88R wHXA== X-Gm-Message-State: AOJu0YxBgmFoxPl+ci9ajLat+ULE2upkzCR6wjO0WRKj+sdCIQEFt+QN aUGMfdjREMpPZNIMuuJLD+Vss20te4w5G2eTNV/ewJ3LVa1B7QzDMS0CPHE98groc0TC3ujRpK8 x X-Received: by 2002:a2e:b52b:0:b0:2ec:4428:b6fd with SMTP id 38308e7fff4ca-2ee8ed22717mr37493891fa.9.1720217130092; Fri, 05 Jul 2024 15:05:30 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a2ca4b7sm75203255e9.37.2024.07.05.15.05.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 10/16] hw/sd/sdcard: Remove noise from sd_acmd_name() Date: Sat, 6 Jul 2024 00:04:28 +0200 Message-ID: <20240705220435.15415-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=philmd@linaro.org; helo=mail-lj1-x22a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org These ACMD names weren't really useful, "UNKNOWN_ACMD" is simpler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240628070216.92609-77-philmd@linaro.org> --- hw/sd/sd.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 43f60cf089..274a917ba6 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -257,23 +257,13 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) static const char *sd_acmd_name(SDState *sd, uint8_t cmd) { - static const char *acmd_abbrev[SDMMC_CMD_MAX] = { - [14] = "DPS_spec", [15] = "DPS_spec", - [16] = "DPS_spec", - [18] = "SECU_spec", - [52] = "SECU_spec", [53] = "SECU_spec", - [54] = "SECU_spec", - [56] = "SECU_spec", [57] = "SECU_spec", - [58] = "SECU_spec", [59] = "SECU_spec", - }; const SDProto *sdp = sd->proto; if (sdp->acmd[cmd].handler) { - assert(!acmd_abbrev[cmd]); return sdp->acmd[cmd].name; } - return acmd_abbrev[cmd] ? acmd_abbrev[cmd] : "UNKNOWN_ACMD"; + return "UNKNOWN_ACMD"; } static uint8_t sd_get_dat_lines(SDState *sd) From patchwork Fri Jul 5 22:04:29 2024 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: 810442 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775284wru; Fri, 5 Jul 2024 15:06:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUIBCWguqxlZ8+SxiHJelKnE84sEIDWo7HLSE6TLx+AZlmaEsbzJhsBsDCy4ESLifSnaiAP9F3DhkfuMqtlg5X4 X-Google-Smtp-Source: AGHT+IFYQrvCaXBEcaV22pC2CJ2A9bYJ7R5+NW+WFThJxyuYLRYaaPjMWPUXR6rUKJCSU3jwvnf3 X-Received: by 2002:a05:620a:5614:b0:79d:67f3:d0a2 with SMTP id af79cd13be357-79eee1ef348mr666191185a.29.1720217161437; Fri, 05 Jul 2024 15:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217161; cv=none; d=google.com; s=arc-20160816; b=p1+9LsNq9UvZjf99JRm4iXcDlLG7lvjs/sC3FUAmYuGm9UB2JJppyzF/3zJOQWZ2Lk ezXz2muNxsDmVyDOyK7mXXxyFIG1aTK2CIlWAfXHv0me2cdp3ARCh31pRTCfnBfoCwro 1St+ogcTdLZEMJFA2Ku6wGfS6jJgBU1TBWCTM7X51t2SYW/FfFnxe3t+WwAoRThHCn5O bzJKdeIYTfVAYjp6Ugcy/atEbEK+GwliF7rLT49IPFz+ZnxS8aYbhbsZ9XuwVu7a4eNc DPDRT6MrgFb9Zj9rB77dK9ZWfBTtNTYTIxf0n2WmEe0C7fBh/+pJSgxx8tazAIgHv5fF gYRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fNqSp0iQz07nPZVO9KsMulPxDcXpDCHlv5P9X5kScC8=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=U7WWRWUszdmEnFGOeKkX/UqDThDf4qyIrm9V6dUCYN6lSuwjmAXfuiAm8xsctSB/UB pTptS3GrtAMuetQ6naOoi9NDQxXPylc9jqzeVXG6kFD/9LRl6juj0dJufs2tzKFo26OY auVhxNSjqvbKuCcR1Fyfz8jowQsFoTR1x/c3dDl62kZ5WG8GBTOQnbENNYzNDT80Q85G 3pOqKQmV8+glGQI8GbLXAgBHTC8oRzbidJkD/nAYEbrAIlcGuxBphMMPJesNg+wGEj59 s0syv1ElqmoRdFaDkRAbFsgluPgTuyIAXSGLJXa54Lr6fmNNr1kwCRCKncp0RBWguH5K 23rg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LMGRJu07; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79f02c517e2si8741685a.497.2024.07.05.15.06.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LMGRJu07; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3l-0004Gu-DP; Fri, 05 Jul 2024 18:05:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3j-00043P-SH for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:40 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3h-0007i0-7H for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:38 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-424aa70fbc4so14096655e9.1 for ; Fri, 05 Jul 2024 15:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217135; x=1720821935; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fNqSp0iQz07nPZVO9KsMulPxDcXpDCHlv5P9X5kScC8=; b=LMGRJu07vEfw/T+m9ERuNxP+r8pt+K2goOSkIRveK/xQDXghdk8SlggA9CwN8DTsWo OiY90nmin3vLlJxKzG85yoOZiHMRM4OhnSb//2msMK+7mB3gJXMl9upbaRMIhQVK9+Xo de6XK9s1peGj12nERPo1Swj3prd75zPketbFk03IAVuIEKcdlkPKV5v2b5CIobR3N/XI 79XsbTL2PsPS/69ypQm+vYIYTsj8dzBkeXnCxi72PWcdADhRjNzIovOBotv/NRwo61QS QJjhQk0hkh0uygsF1jFHHUJUMXrSXXGkAcSccavA2r4Xht5nNPLg4GinZjkZKlmELT7+ oKxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217135; x=1720821935; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fNqSp0iQz07nPZVO9KsMulPxDcXpDCHlv5P9X5kScC8=; b=IvNT9y82ZWmaxERZ/CJ8lYZXPCofwG9ZdmYXsbcx2H+6XsNOxKF7AcAyk3u5ihbJM2 NTnbi4qoMi1BKI9kg+5OFjZECgBnlYQ9Sbk2Mi+BB6XjIwOm0QUGLBgMsoKwKJ+5Z2P6 YfzhEJjXIbfywwhdLX43FLPuoErpZPHEEK9ONSAX/EwQoU7EZuOfwtLEj7nHAdLl1JZS JaFV4QWIMd1p0LN0t4/h6YzKO20YZkT/7m7teSEXTUH22uREi1V6MBWjEMwb2mR72/s6 arauOd1qZEI/rHZb5LqP/WqlrHH5Y+qTqUXs5Mt/9idXFKJoH8ZAHb8D4u5vhM2beijA dhOA== X-Gm-Message-State: AOJu0Yw92fLPBqER3bOUpHyaal3d9IrPxqJiQgXyyeIqvEPbSvBDvztV dzJ5JVdsp0IbqLcp2r1KeS5pPIZQvOGy/6aN+JwJMTmFDG52AkjBkrOOBIkmjY69Ro6x1zNXc91 8 X-Received: by 2002:a05:600c:470e:b0:425:7c5f:1bac with SMTP id 5b1f17b1804b1-4264a3e7a16mr44928575e9.21.1720217135298; Fri, 05 Jul 2024 15:05:35 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a2fc882sm76511795e9.41.2024.07.05.15.05.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 11/16] hw/sd/sdcard: Remove noise from sd_cmd_name() Date: Sat, 6 Jul 2024 00:04:29 +0200 Message-ID: <20240705220435.15415-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org These CMD names weren't really useful, "UNKNOWN_CMD" is simpler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240628070216.92609-78-philmd@linaro.org> --- hw/sd/sd.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 274a917ba6..bc1a574b62 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -239,12 +239,7 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { [18] = "READ_MULTIPLE_BLOCK", - [21] = "DPS_spec", [25] = "WRITE_MULTIPLE_BLOCK", - [26] = "MANUF_RSVD", - [40] = "DPS_spec", - [60] = "MANUF_RSVD", [61] = "MANUF_RSVD", - [62] = "MANUF_RSVD", [63] = "MANUF_RSVD", }; const SDProto *sdp = sd->proto; From patchwork Fri Jul 5 22:04:30 2024 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: 810444 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775301wru; Fri, 5 Jul 2024 15:06:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUcTbhiwLUnt1Vq4Cv+zMxwfvLyTxbo5FvE+h/+ho0PMbJRnzLxVvV/1bqkOnUqOntmRrqZf9pjjyS6y+xf6GnU X-Google-Smtp-Source: AGHT+IGthrjVuWFhSMlvxaVpAhrZ96L0lyw2RIMDc89NdpG0JfwI3M7fEVapVrrD0B9uglU7VGOR X-Received: by 2002:a05:622a:50c:b0:446:425a:e721 with SMTP id d75a77b69052e-447cbf028a8mr71473401cf.15.1720217163645; Fri, 05 Jul 2024 15:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217163; cv=none; d=google.com; s=arc-20160816; b=N/S6pJ12m4ORRoM+EEcbRqXSDQabQaACqPvB/1055HmZAGjIiQmxUABkPOqPe8VXO1 68NJWYegD4bWxkF3p/IxbBqaQ0oHvYsLtylMr3mjwAgR2Q4MlfbiRDJ2QIybHD5xjOT3 dXr9g1HlaqChzM6XEaQsp/pGQRFROqA9eNXpiCNQqBmbk4/beu4xJXviG7VS5LdZVkde kZQPIi/p6hFm4n2Opif4w0oB9B36gKHU/z2pQN3wM4AAWYKo/xhBjUQf6Q0aLYKxjhw7 3zZ2Fou86z9Kde9+eLfmhOwW32Klnyj7qWsxAisslHA6+YRJg+5DbMq914Uqk3zcd20+ VsnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h1jfIIRixH/o9kg5Ph3jE8g2N5lQ7LfdnVdUl4+XtOc=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=Pqh4/YuXf3Z9mygU5J6ppei8aZ1tdgpZKbTuNL5TbVnMXp/5KGIZfQWf5tiu7t5aQc N0Sm2uJAFKeZ3wRMWAWDsZhGYbi/0i/NOr8HIZhybSHtaVqV03+YkKV30rih7rXi3kdR SQodXM/wj9jpf3RrVSmxlgejdJrwqlabd1J4u+FZeNIkpGro2v1oGC7biufTTqZkwt8/ Q5q+3TwipOEAmnU+1D5HF26jkEWzikPtUVJLLT8RenSuBKeZ0XvCy5bwuJLqV2PESxGq 2Rl7939Is5MkyzaAIvF/yQ3lZUaQq5LjcaKlTCEX3i+hzjnFBuWagT0VmpOp0WtKnMS6 ZI4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WhW/ykly"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-44662ed530esi159837921cf.55.2024.07.05.15.06.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WhW/ykly"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3q-0004b0-9Q; Fri, 05 Jul 2024 18:05:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3o-0004WX-UD for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:44 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3n-0007kI-Ae for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:44 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2ebe40673d8so25813021fa.3 for ; Fri, 05 Jul 2024 15:05:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217141; x=1720821941; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h1jfIIRixH/o9kg5Ph3jE8g2N5lQ7LfdnVdUl4+XtOc=; b=WhW/yklyoExYYGpH6HetoLIDCKF2J5yLSKXAutbjpLeQ10YF0F+lLSNAnKTQj4o6po nIzNsbiWZesDW2HFZo61kqcuk70/m1l4qMGtxfP5Vm2+Ug77nFxvj5MLrbeGTb/aLq7J EBWWZ2d7U177xDpu8lVfpxCJi8MozLniIcHIY0ktvW/FkeKlteqE+NB3Z6L3BULy0pRK HKzDl/RZtsIgeEn8qDOFcpEr8YtfCqWyLWSWDRBroLYUghmA6W3+j7TGeWbVbI8nx5nl vugGD/LY8gbGmXd5hD83Fnr5hQqNQ3RYao2AbJT6kfu1fVgD6eb20wVKz8X7I/Sle5Nr jjAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217141; x=1720821941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h1jfIIRixH/o9kg5Ph3jE8g2N5lQ7LfdnVdUl4+XtOc=; b=EnE70VakZF/zH1vjxjv45Q2tr5pfvuNACUjyb+VU21LCRCxSwYmAtwbN3iXhZuf4xi OwUrnA1Uc7vz/ZVqpVpEQMk9kqYtDwOtEmjKfhO3GnER6Rjq8tFA+Lt7rLmsUyUr8Ws2 jThKXn7LK6tk2iOsuzroM79g0IsXDf+9QYYeGZ+XaAV1hrbB2TKBu+F3MgfjXVAeYwEc UL8gCKTT/vH2x3tuEnYQHzneVkUD6fl8YO76whwDOz+eN+4xoTy2/wKcZAPfOIWhV9Eg rPZVjKmCJ1Edv7ZrqpaMJIArUIrF2JLWK9TgUQysa+dbSl40buFapYDikTGZTYdKA8ci rjuQ== X-Gm-Message-State: AOJu0Yzr8o3OLoF+TEcJl61GcfWKuO7shzZcVPXRtQQDfrxQl8EJx2Lg U6CwYqGCD17zsemPLHC04YAwFrYcbj8COXn1s7hD6weVrdGASNojH2Noavuvlsk8OlJhc4ZaXwg i X-Received: by 2002:a2e:b049:0:b0:2ec:56d2:de6e with SMTP id 38308e7fff4ca-2ee8edf1be2mr39205461fa.46.1720217140899; Fri, 05 Jul 2024 15:05:40 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a1e727asm74016985e9.18.2024.07.05.15.05.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 12/16] hw/sd/sdcard: Remove default case in read/write on DAT lines Date: Sat, 6 Jul 2024 00:04:30 +0200 Message-ID: <20240705220435.15415-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=philmd@linaro.org; helo=mail-lj1-x232.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org All read/write on DAT lines are explicitly handled. Reaching this point would be a programming error: replace by an assertion. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240628070216.92609-79-philmd@linaro.org> --- hw/sd/sd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index bc1a574b62..3f495f91fe 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1949,7 +1949,6 @@ int sd_do_command(SDState *sd, SDRequest *req, /* Valid command, we can update the 'state before command' bits. * (Do this now so they appear in r1 responses.) */ - sd->current_cmd = req->cmd; sd->card_status = FIELD_DP32(sd->card_status, CSR, CURRENT_STATE, last_state); } @@ -2014,6 +2013,8 @@ send_response: qemu_hexdump(stderr, "Response", response, rsplen); #endif + sd->current_cmd = rtype == sd_illegal ? 0 : req->cmd; + return rsplen; } @@ -2167,8 +2168,7 @@ void sd_write_byte(SDState *sd, uint8_t value) break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); - break; + g_assert_not_reached(); } } @@ -2234,8 +2234,7 @@ uint8_t sd_read_byte(SDState *sd) break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command\n", __func__); - return 0x00; + g_assert_not_reached(); } return ret; From patchwork Fri Jul 5 22:04:31 2024 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: 810446 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775347wru; Fri, 5 Jul 2024 15:06:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV8b25h1GhgQpC609/7fxcPF9kfwWsZnwOsN/g8Y48on/sDcOWX8Uj7KX8Nyi/J2HFiHoAm5r4RRgWXhvqtAz0G X-Google-Smtp-Source: AGHT+IHmVYEme+1WHOlA2b6xkdrt8FtQPKO+Fj9V/y0CWVZfO93FWjF0SkDzk/kgE8o0fL3qCeHK X-Received: by 2002:a05:620a:29c3:b0:79d:6860:4d83 with SMTP id af79cd13be357-79eee1de535mr662709685a.16.1720217175097; Fri, 05 Jul 2024 15:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217175; cv=none; d=google.com; s=arc-20160816; b=Cr9sB5OT0FqP2wk6yXAgGeyH9943ckyalc7LIWohe/jjnaK4+kHakStkAt1tf49ixo 3yBapL8ERpu+34AX/Wxlk1TbpfR8oxgaHVSn97kDtr1dgs7wg5EQYTQa4zmOAbcH0fdI NIDqwh4a/HW3X2qey4cqYsqDmWq+t5f7WGcIlx7zPCDiZCZlVKLyAdEjDEcx+0akxH66 VG1azcPRcl4qXxeh+YU07lmHcMGTYuQ5sAJBPHJFSL72FJ9yJ+2xheRQYE1y1IlEVbOd FTr8YVsc02VExXl0BIGhrwGnPH8KJsmRkQqWrUtEHDM0AsgiFt+S7wR1eluLQ8+5tXfc yfUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Fo92bzXq4eAEZevJy+NJbZOPajl0wf8VkKPf0JYwAk=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=huBgfZ1PBkvPvtm81eJJav4l3G8hOINaLf6bQWRitUXxjojbn4vc+WB00csPpB+e+8 jpaQub8JhP2aCmVCykpaQRNY5/9q6wKhU1C+ymJnXqzJznKfRmNl3NqswB5Gs5LQe7gq MO7CTN1oKYRzxZEHZcNq+20v77zdxv/DRKiyWFBMup9HyfVUtJi9k2kHcDima2lxP4qA i1mAJnS8YuZbvZ+zEYx0bPYf1NQwxUmchGDxDbAP/tJq27EfsR9gaWWje2aNVjEG9bhM oQo8AM8HnDP+rQENduQglJWHVSBl7Z1NTiI/tE27hAJfHpgBmORt6KgB7sq0lkZ6q6x5 QWUg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AAwaXhnk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d692f0cc1si1888533585a.312.2024.07.05.15.06.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AAwaXhnk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr40-0005ZP-Ky; Fri, 05 Jul 2024 18:05:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3z-0005W2-Nu for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:55 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3r-0007kd-Pt for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:55 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-367a3d1a378so1067750f8f.1 for ; Fri, 05 Jul 2024 15:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217146; x=1720821946; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7Fo92bzXq4eAEZevJy+NJbZOPajl0wf8VkKPf0JYwAk=; b=AAwaXhnkXFpSujaa1CT/6ogU45jwfaCLwvNlRkuXOuxirg/rt4rgYl6ggPsoJpPb3f 3rvbLxbhVfD92vA/I3R382Ydj0XKZjNj0yItrF//uETe4fhR3+qO/L1/TfWFqUWe9LAd ZIEacLW/+cwKl1TQpsAzSUmk9956p5dUO4SfdRo4Ccijw7olKME5HOpWJk0wbSdf50hy RO2m/fG6QvTeWkL+QH1VGKkc83k8rBxttKcsslScwBr5EK+JoViExmxK+C0OaEGccRv+ go3bdzXowlRSMse4SyCfuT+PaKXNX+7PmH6HvxeRhdlCLX18hVLi//KJ40CHIiWydcU6 sg1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217146; x=1720821946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Fo92bzXq4eAEZevJy+NJbZOPajl0wf8VkKPf0JYwAk=; b=myUJ/Y4GCl4ayN+15R4Ut98W0UINJkdMFaAFqcGyxPKqe3e4rNJnbVu8hpBSORsyX8 TSyPx27C5mIf+79sOg9nb5SJQtIJhPJVR2mpNnUUtRgbMSxogOa0ShBi9/FYKrp4Pnex VUsT5RuAfkLxVzKBv4NmQ4XOh+VjFgezBC+gnRwMtDCm1aVw4ZpTx7JP1/Fwa8mDyqgA JVuadnfusH53dYfLcUGqsK1/pK2YWQ7Y/agO1y3DRbA3hVvbH1j6G4aF+zPXVXf7CRFd pp/DOm13qggQsulBp5acv18UCoFloY/gDLiAF6OGa2MfOFQz+asvnclv2V23AlmssxoW K4Ww== X-Gm-Message-State: AOJu0YycKbzQkaO+ugqFqGWpUKUxDXWEZMWaGCpHymkvi72aAKnwd6ev mWmDrFjcy7w7kNx1kiYGrC4aSxXb3S3W0OX50qugcebCIDxhdzNSGEAuVudQKc33KdH4EqO+HNk D X-Received: by 2002:adf:e34c:0:b0:367:9b1e:7b3b with SMTP id ffacd0b85a97d-3679dd7192dmr4987912f8f.59.1720217146052; Fri, 05 Jul 2024 15:05:46 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264aa07a95sm73359535e9.1.2024.07.05.15.05.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 13/16] hw/sd/sdcard: Trace length of data read on DAT lines Date: Sat, 6 Jul 2024 00:04:31 +0200 Message-ID: <20240705220435.15415-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Some commands expect less than BLOCK_LENGTH. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240628070216.92609-80-philmd@linaro.org> --- hw/sd/sd.c | 4 ++-- hw/sd/trace-events | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 3f495f91fe..9e6b9c9c63 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2193,8 +2193,8 @@ uint8_t sd_read_byte(SDState *sd) io_len = sd_blk_len(sd); trace_sdcard_read_data(sd->proto->name, - sd->last_cmd_name, - sd->current_cmd, sd->data_offset, io_len); + sd->last_cmd_name, sd->current_cmd, + sd->data_offset, sd->data_size, io_len); switch (sd->current_cmd) { case 6: /* CMD6: SWITCH_FUNCTION */ case 9: /* CMD9: SEND_CSD */ diff --git a/hw/sd/trace-events b/hw/sd/trace-events index 6a51b0e906..5dfe6be7b7 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -55,7 +55,7 @@ sdcard_req_addr(uint32_t req_arg, uint64_t addr) "req 0x%" PRIx32 " addr 0x%" PR sdcard_read_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x%x" sdcard_write_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x%x" sdcard_write_data(const char *proto, const char *cmd_desc, uint8_t cmd, uint32_t offset, uint8_t value) "%s %20s/ CMD%02d ofs %"PRIu32" value 0x%02x" -sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, uint32_t offset, uint32_t length) "%s %20s/ CMD%02d ofs %"PRIu32" len %" PRIu32 +sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, uint32_t offset, uint64_t size, uint32_t blklen) "%s %20s/ CMD%02d ofs %"PRIu32" size %"PRIu64" blklen %" PRIu32 sdcard_set_voltage(uint16_t millivolts) "%u mV" # pxa2xx_mmci.c From patchwork Fri Jul 5 22:04:32 2024 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: 810447 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775376wru; Fri, 5 Jul 2024 15:06:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUes+XnJXndZzY35qvD7AKEyFmlojGi0otDuH4Ew25yvqCQSFnR18w2J51mNroE2QXfCUGm+vgmJGiXBzG1zmQg X-Google-Smtp-Source: AGHT+IHSJZFcWzswSgpIX4Vo3XrY615dMggO34UhOvGPHqWV/GshD83vWU7+4B1cYSpb1xaYHr9y X-Received: by 2002:a05:620a:2197:b0:79f:2b:3865 with SMTP id af79cd13be357-79f002b39eemr83279585a.77.1720217183435; Fri, 05 Jul 2024 15:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217183; cv=none; d=google.com; s=arc-20160816; b=wMIBdl6p3OrUHcLyWQvfcfaQqoBxEXY7i7kF1s94kHgnMX/hagTzmNr4qZdQAu3fP7 uUhYS+YYfKk+EPxpbrJs3ty0cSN+As9x5MO1BkwllKAwQ0yVr5qIP5Pt5dKG9mWzXhXD L5+/Y01leknFm7XLUTDO0rFwrYs3WWeor3Z5KKRvB664IKYWxQI3RfUMI/6hNHj1wY2t YKE/ZVLtAGW1TBftERhPOsqiwc1XoUzUrQzdFImlt0HhkoI3WtjmfgHcqQi1gzVxsTuv zTVH/0vnF9mw73Kn6jctOKL1rGL3tJUPIE8Uxn0lGwjj9Q9Xj70nEOKgCRp75FBzJkcI 9/Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Th3CS4MKIZyT42kt1vOQOIlX1Ja0EBFyU/d3ve8Oa9s=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=KevgBorPm3s6AKBFWA0zCCeOeMrTEMmYJzZkn82VkVWjVldPNt03Gra5sZRv+B+3Jf BNzNePFK02hLeTlpzd8xUnTqGgbIZUAUhlq+g+HAGD2W7RojqaAeQhpRKYgK4A6k6w2R 7t/i6L6Z6VlqAPYqUGITy5jkXMAnDGHzYb7kSIVKLk7z7H3HFOTqxnCBIkHON253MMIp z9UB8/IRDpP3DSA4RNJ22pTCIhZyy8jA0DuvcqPtpEsRt5R49x2SiAz4eu4bjvi/EYdB P/HJ/+kAQjl0b3p49BMFAnPQIoXFcXYkH7O0ZdNfwg11aYOk6a1DGNk0gFivBlwgDzEu VpOA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qznj61u3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79eff67b11bsi90525485a.451.2024.07.05.15.06.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qznj61u3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr3z-0005Ui-Ge; Fri, 05 Jul 2024 18:05:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr3y-0005Qe-II for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:54 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr3w-0007kx-TU for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:54 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42573d3f7e4so14029075e9.0 for ; Fri, 05 Jul 2024 15:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217151; x=1720821951; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Th3CS4MKIZyT42kt1vOQOIlX1Ja0EBFyU/d3ve8Oa9s=; b=Qznj61u35OyR2k/3HZPmCamZQ9pGXNd5lvYBXUqaeVKB8D1AVWOdD1Nfb091diXQnj mauVPz/3YZcXxkBGBukFl/vjCHeGSNu6sBCCxKjmcKil8KTiC+YFD3ZQe0CG935UtvoV Wh4dxHbYGWQf95vOf0TB2PU718ds9EWaVKr3qoU1blZbuhOHdOzpa9MsGHvQIng35nFT YmNWy0ZlL8MPhEWucikwK390t74CmIn+DYQpNwM3sEhmZNWx8Q6qxYT7B/WaUCLeGlGW ZTYLPbx4DtJTeDmn+fSavy230trQYsRlKi/qji7cfOPDFTABIpQh0sRV/xiiQavwgeR4 o66A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217151; x=1720821951; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Th3CS4MKIZyT42kt1vOQOIlX1Ja0EBFyU/d3ve8Oa9s=; b=Cfq9Qyp5cyExb4Iinoi9RAMA5fOoQMe695DOQC6+fAvEK1PghFJpcvXNmyiuMrXAas n06S5hznkr4EAq6bZAOfdp0nZ0olwhWuB5TO3H8ZwbRfScaQXvr7uPEO+icEiWQIkLyr 8ljYqbiSIf5eb5xay/ala4kqRjUMIfxLYg7IYWPrmnLKHtPFyYrvZ+sqYbUwRFoxi7GM BvXJ9bKxEkRQ+qYOPQhMRvfy6xZvH9gqQmSJqVkVmF/cRTGRwXw9Ni48XbiMXx8txbp0 EXM9Z2IFoeH36FLugTYLUn7lKDMvP04EAyuRCmOfHyxMGnO4ypJDNh2IcvQ9mDvVer5q LBcg== X-Gm-Message-State: AOJu0YyTnVoYJgvJ1n6XjBn5NnTzdV9BYOG8BOldSlhQP6Scu5eOf3Hc dDcBO8zE+kMBItvmtR2z3emsTxp59te7hrooDUMJMbO+uQXyZq1/PBpFewAiULx24Cxa7sdMBQa m X-Received: by 2002:a05:600c:28c:b0:425:618b:3a4a with SMTP id 5b1f17b1804b1-4264a468bdemr44202955e9.25.1720217151203; Fri, 05 Jul 2024 15:05:51 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678fbe89cdsm8568941f8f.61.2024.07.05.15.05.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:50 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 14/16] hw/sd/sdcard: Cover more SDCardStates Date: Sat, 6 Jul 2024 00:04:32 +0200 Message-ID: <20240705220435.15415-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org So far eMMC will only use sd_sleep_state, but all all states specified for completeness. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240628070216.92609-81-philmd@linaro.org> --- hw/sd/sd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9e6b9c9c63..ecb1b2f405 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -76,7 +76,9 @@ enum SDCardModes { }; enum SDCardStates { + sd_waitirq_state = -2, /* emmc */ sd_inactive_state = -1, + sd_idle_state = 0, sd_ready_state = 1, sd_identification_state = 2, @@ -86,6 +88,9 @@ enum SDCardStates { sd_receivingdata_state = 6, sd_programming_state = 7, sd_disconnect_state = 8, + sd_bus_test_state = 9, /* emmc */ + sd_sleep_state = 10, /* emmc */ + sd_io_state = 15 /* sd */ }; #define SDMMC_CMD_MAX 64 @@ -203,13 +208,19 @@ static const char *sd_state_name(enum SDCardStates state) [sd_standby_state] = "standby", [sd_transfer_state] = "transfer", [sd_sendingdata_state] = "sendingdata", + [sd_bus_test_state] = "bus-test", [sd_receivingdata_state] = "receivingdata", [sd_programming_state] = "programming", [sd_disconnect_state] = "disconnect", + [sd_sleep_state] = "sleep", + [sd_io_state] = "i/o" }; if (state == sd_inactive_state) { return "inactive"; } + if (state == sd_waitirq_state) { + return "wait-irq"; + } assert(state < ARRAY_SIZE(state_name)); return state_name[state]; } From patchwork Fri Jul 5 22:04:33 2024 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: 810449 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775450wru; Fri, 5 Jul 2024 15:06:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9mpvCy/U/Xf17MJ4lB4u2TiXpq0jOwFgvTKZJLWXCAG909inclnpROOZ7xLyFUp1quFeUHVmCIuvQzfZ4jcb6 X-Google-Smtp-Source: AGHT+IEtmrAHz+N9f4IvAG4gPlpf+j5Q/BcMMBm1PmMkgZTh16sZNX36zHC7woSHeb8h4/khhu8I X-Received: by 2002:a05:6214:21e8:b0:6b4:e702:56ee with SMTP id 6a1803df08f44-6b5ecf9bbd7mr62577846d6.11.1720217197376; Fri, 05 Jul 2024 15:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217197; cv=none; d=google.com; s=arc-20160816; b=TCQ4ZjrMTnVO5/6AGzfoW8NcLebW0GApq5/1zq8s3SnXt7pyJL3/cKkJ3NVx720fVq dAxSAv/5b/5b2C4LIajh/cr2OlfdR/B5xt38e+IM0tiLfK9iY8ZDFL33d87Pu0Q08tJN KNbxBkjXBl+mUb0LfUU/DUWURFycFcC8AXo8sXg5pA1WH+fUnfswE/RDDWpdV+sIME3Q V7jnMHjJHjsTjoiLFowpz2zkuABdgeYAfkkAdNlMK3H8uLv95B7VCxCSGscxGmJtvydM q/aMUdi0BIJdJqJXVVDujHwQriyNN8jw9wfsg9t14TLSpXDTk3QkuMb6eaYtgIAUQK5B BDSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T4UAMy7AOQu07GDl9UFhL5hUw6gaC2lnWy/fQbMyhnE=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=KD2HgzCKbzdy6OB3UEhrV2kEgFVXQM7MdYNXPfdhYLzDkYIGNGL1Ip9ELbXPlconD1 wVYHUD6sqcvARnnzAG4Wuq3ipO/c7ETi5sz3eoYFj+FVc9MsDkzQx4Xbe06S5J8b1hWA gwv4rhtjRPsvF09z3lGCQJhFx/WTmXZuialqZRfNAslImqPfe5eziw3vQpFhGcvqTkEn ltUMe5IuiUcAgn3kDt55SFVDHX5F+wY9ZGjurggj2ojkPmpEFaQ2bVClwb/IioXtI0fW d2nldJ71gMQf9XzLGG+MJ9IPLGzxqkhASGq/QB2/FC5a43B5OAu7MxNpgvRdYqT+A3VH rW0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJQUXmLp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b5f56b4911si26277156d6.407.2024.07.05.15.06.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJQUXmLp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr47-00067q-1d; Fri, 05 Jul 2024 18:06:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr43-0005pJ-RL for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:59 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr42-0007la-7K for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:05:59 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-36786081ac8so1222402f8f.0 for ; Fri, 05 Jul 2024 15:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217156; x=1720821956; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T4UAMy7AOQu07GDl9UFhL5hUw6gaC2lnWy/fQbMyhnE=; b=tJQUXmLpIHusjrVWHM8uyRxrT1GtqSvO5vNBs/9sZEKiTHD30Hyxblafeha4a0Negf pgu4VcnBmFliGS3zNk+3rlQjEP95ntz2VUlAS6yxEVXE+ME8KTKKzSQCIkrL4K4v8EZZ wsHoWiY7rGtEQ76pG0DWTHUcrrvE1n7U/LJYRCgeM8ScZJD5cnrCXxKs5zHwrp++tjt0 yoAzahpdDm+4dmPU4qzYn/xJhlT1eVBjZ/FjHV7IKu92bPoJJH+V2wyNnbF2EIFJRnPZ FYlU6sfK1EINpEZQ4R4tubJ5A7gL8fat4cW+hbDFxYYB7iJMMhY2JocrilVTpwrYc+IF BFOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217156; x=1720821956; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T4UAMy7AOQu07GDl9UFhL5hUw6gaC2lnWy/fQbMyhnE=; b=GxryvWWMAH1uRV4MIsaLrekZ273vSBfW9v/YokHKaWE+tysmQslLjR/B5ioCcdU1Un JwVJIdYnpWMBbZ4GTczppzIZ+7Cdh5V1aFbfBHDNJGhwfCgvHq9+Wii6a/37lotx5+++ Knob5CtANy1uyrjdGdO20IvUv1xvb+bTl3KWj6h9xJqlsxMD5ZkKhDMfqJgIZ2mpii4H 65111uCnK9mbgKp7iYXAVJw+3PfzuV7xR8tSTwvbHgJVS/LeXI1SaljcPIfGct2pstsI AVTJxhxD8NVpoh45AFFnHrDm1kb4vQfxPn5RLP/ZqZKKu/Q/A14a9Y0qOoLjboynyHBL cRpQ== X-Gm-Message-State: AOJu0Yyt9BguTa47liHJ3xU1sEWunIcuwIna03c3ILVG7WFBocwtHmlE njlHCVAaYPZHehZiOanwrCY/8AcJ8vAIaiDvMhJS772sn+rJ/rI8B+4rAbr+BWVQ9VTJjETKoqi L X-Received: by 2002:adf:a1da:0:b0:367:4dd7:288b with SMTP id ffacd0b85a97d-3679dd34fe1mr4351503f8f.29.1720217156537; Fri, 05 Jul 2024 15:05:56 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367a494e7a1sm3353630f8f.112.2024.07.05.15.05.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:05:56 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 15/16] hw/sd/sdcard: Introduce set_csd/set_cid handlers Date: Sat, 6 Jul 2024 00:04:33 +0200 Message-ID: <20240705220435.15415-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In preparation of introducing eMMC support which have different CSD/CID structures, introduce a pair of handlers in SDCardClass. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240628070216.92609-82-philmd@linaro.org> --- include/hw/sd/sd.h | 2 ++ hw/sd/sd.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index c1a35ab420..0d6d9e452b 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -127,6 +127,8 @@ struct SDCardClass { void (*enable)(SDState *sd, bool enable); bool (*get_inserted)(SDState *sd); bool (*get_readonly)(SDState *sd); + void (*set_cid)(SDState *sd); + void (*set_csd)(SDState *sd, uint64_t size); const struct SDProto *proto; }; diff --git a/hw/sd/sd.c b/hw/sd/sd.c index ecb1b2f405..058a70a0f8 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -680,6 +680,7 @@ static inline uint64_t sd_addr_to_wpnum(uint64_t addr) static void sd_reset(DeviceState *dev) { SDState *sd = SD_CARD(dev); + SDCardClass *sc = SD_CARD_GET_CLASS(sd); uint64_t size; uint64_t sect; @@ -700,8 +701,8 @@ static void sd_reset(DeviceState *dev) sd->size = size; sd_set_ocr(sd); sd_set_scr(sd); - sd_set_cid(sd); - sd_set_csd(sd, size); + sc->set_cid(sd); + sc->set_csd(sd, size); sd_set_cardstatus(sd); sd_set_sdstatus(sd); @@ -2475,6 +2476,8 @@ static void sd_class_init(ObjectClass *klass, void *data) sc->enable = sd_enable; sc->get_inserted = sd_get_inserted; sc->get_readonly = sd_get_readonly; + sc->set_cid = sd_set_cid; + sc->set_csd = sd_set_csd; sc->proto = &sd_proto_sd; } From patchwork Fri Jul 5 22:04:34 2024 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: 810452 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775524wru; Fri, 5 Jul 2024 15:06:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUY4pCvFM+3xTWFKYT8rOiRg+pbsCah+t6nniB7ICfqojH4HGdOXn2dJt+Zn+ei89Eeq67FsSgsd/owUPxuhmC0 X-Google-Smtp-Source: AGHT+IHPQKs+OaCjZKrOQyVcFp8Dw1HFdeeus/8whSdYel+aUu9Jz+8SimMebjBTh0EZAiAaOoL3 X-Received: by 2002:ac8:5a8a:0:b0:441:3bf6:d5cb with SMTP id d75a77b69052e-447cbec6d4cmr76145701cf.6.1720217218401; Fri, 05 Jul 2024 15:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217218; cv=none; d=google.com; s=arc-20160816; b=k0Cl5Y+v6xbyewNpn1km2BF6a0Urb5kkZA7l0Ma+ebrt2LCdsMs09J37po4Ex6k3dx entVNoDN/wxwBrzA95c9qjVRpspVc7df6G5QKA0U2WTvmwYt9OXaEnSLQF4vsrix82Om 8qRcybGOQE0ytLVNF7WHiVJ2mGqPTZ5oMWnIk1lyvbjAbGN0+h3aOo0/xbTc8Rtm0c0L uYz/dyHopF2RkhmeWkUL1hiwugyPV2gRjx+JU39gf4ja3hjEXz0NVokVG1OyDjFCZX21 21iYlysOUWqz5YpZtwsM5W53ShKIr+eD8VT+IJ+ixea06CXGOulpltdHNXVA8P20QbAV 9wAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Hlkz3clXDCDO3v5Iog6G74XdcZ10dv/Csn6ZB+lh8og=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=g7xsYI2Oorh026BwVsa1CHXcur++S+iqHSrEv49GlXlTN6P9pDnxpUanbiRwjX9zne jm8Oobs1hLvsJWhU3kT4gaELHCc80gm3Pwt3LJ3DkNuk5PGl20bGv146N6SB+N6vk50L WnCORcHf+jC2ZbPoQjkNnGn9KoYyqivulI/WMgNYsebw9HVS1UOgTTNuWRITPoaGW6rD wv6QzHPnP9LUZ4f0JSXkWnLGSEFIFL7/hNuAqb8mroSmhJbKp22o97UEvDo370O4XLbx geHiSGLNaruhOTssBcKEbRgQYCCihsmJjgewSnh61expwSLvCgQQl+NcFirQOjHxzebM mWEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UsHAcBr2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-446513c23fesi173388711cf.16.2024.07.05.15.06.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UsHAcBr2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPr4G-0006cU-GJ; Fri, 05 Jul 2024 18:06:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPr4A-0006MU-Vy for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:06:08 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPr47-0007lm-D5 for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:06:06 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-424a3ccd0c0so13648485e9.1 for ; Fri, 05 Jul 2024 15:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217162; x=1720821962; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Hlkz3clXDCDO3v5Iog6G74XdcZ10dv/Csn6ZB+lh8og=; b=UsHAcBr2IX/k15lCaYs7K6Ke1R1mTfTe6HPPVlKUbC/FFe+WSO68SJpgpvSmjnHHjr 8nmvFr7+lvNrzM+tYYJm/ftP0eUW613DZB9cSLzmo1C+HKttegJNKhxROeXYfvrDXg8b aJiknz5UNsSWyw3IAE/g2ABurZMRT1KdhRtN6bM9A1AN92pysY+oz2MbYpbJ/BkCN+Li 1ZMIiOkmfU4B1oZvHtexkR+XCb64PjPcmFH6ur4Iz3LPI7R8uOhG1Arc6cG8w0gIzG+B CsIKTH9jKGTMdhCSfLRc5YP/HL18DulVAhty7O1/FkbieMyFv5BgcWZ/6kin/mbVeKbE Wj4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217162; x=1720821962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hlkz3clXDCDO3v5Iog6G74XdcZ10dv/Csn6ZB+lh8og=; b=nMUMtMrEk7Y89N5+NqZGFEPJfVgYYZJ1OSmHk/MB2sdzNW1bBrhEsmkf4RzlNkP0lU mKol1AITvKIn3sP9Rm0cWnpRbXS9U4HUc2q+oA4eDND1btcM9MfsLQBCBrSDAIEtJK85 SgFcKlidg2BejojO8xI1mzX8yB1iaV7gkZslBIrwLO73cfSQWvAkv3zdzLLJHrbdlhB5 xKvyX59r1WJk7pnwe0EY2gex8bi9vQ/MlrMNQaVyHmIyHEy61RWDUc0H1jSJIYUeCAoz lBCgPdTcEr8o9ECqggsP2f6ekvU2ZzqSJTrdIAB7Q/2l8+TtUhIECrwZkNUWrl5oKMdu QT3g== X-Gm-Message-State: AOJu0YwL0Rkq3yeCsh7f9akWFn44GC41mL+rQX7uL6qOEH7yUfbfMeEk OEa5HdyTnK4MbmxgjZ7+NYu8iVAjGDkK+30TTdI3AyTFHROEQ8lufUY1Qv0PWtdK7pd+qX/ZO3G 1 X-Received: by 2002:a05:600c:158b:b0:422:62db:5a02 with SMTP id 5b1f17b1804b1-4264a4561d7mr39828355e9.32.1720217161638; Fri, 05 Jul 2024 15:06:01 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a1d510bsm76253755e9.3.2024.07.05.15.06.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:06:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Andrew Jeffery Subject: [PULL 16/16] hw/sd/sdcard: Extract TYPE_SDMMC_COMMON from TYPE_SD_CARD Date: Sat, 6 Jul 2024 00:04:34 +0200 Message-ID: <20240705220435.15415-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In order to keep eMMC model simpler to maintain, extract common properties and the common code from class_init to the (internal) TYPE_SDMMC_COMMON. Update the corresponding QOM cast macros. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Tested-by: Cédric Le Goater Message-Id: <20240703134356.85972-6-philmd@linaro.org> --- hw/sd/sdmmc-internal.h | 3 +++ hw/sd/core.c | 29 ++++++++++++------------ hw/sd/sd.c | 51 +++++++++++++++++++++++++++++------------- 3 files changed, 53 insertions(+), 30 deletions(-) diff --git a/hw/sd/sdmmc-internal.h b/hw/sd/sdmmc-internal.h index cc0b69e834..91eb5b6b2f 100644 --- a/hw/sd/sdmmc-internal.h +++ b/hw/sd/sdmmc-internal.h @@ -11,6 +11,9 @@ #ifndef SDMMC_INTERNAL_H #define SDMMC_INTERNAL_H +#define TYPE_SDMMC_COMMON "sdmmc-common" +DECLARE_OBJ_CHECKERS(SDState, SDCardClass, SDMMC_COMMON, TYPE_SDMMC_COMMON) + /* * EXT_CSD Modes segment * diff --git a/hw/sd/core.c b/hw/sd/core.c index 52d5d90045..4b30218b52 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -24,6 +24,7 @@ #include "hw/sd/sd.h" #include "qemu/module.h" #include "qapi/error.h" +#include "sdmmc-internal.h" #include "trace.h" static inline const char *sdbus_name(SDBus *sdbus) @@ -39,7 +40,7 @@ static SDState *get_card(SDBus *sdbus) if (!kid) { return NULL; } - return SD_CARD(kid->child); + return SDMMC_COMMON(kid->child); } uint8_t sdbus_get_dat_lines(SDBus *sdbus) @@ -48,7 +49,7 @@ uint8_t sdbus_get_dat_lines(SDBus *sdbus) uint8_t dat_lines = 0b1111; /* 4 bit bus width */ if (slave) { - SDCardClass *sc = SD_CARD_GET_CLASS(slave); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(slave); if (sc->get_dat_lines) { dat_lines = sc->get_dat_lines(slave); @@ -65,7 +66,7 @@ bool sdbus_get_cmd_line(SDBus *sdbus) bool cmd_line = true; if (slave) { - SDCardClass *sc = SD_CARD_GET_CLASS(slave); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(slave); if (sc->get_cmd_line) { cmd_line = sc->get_cmd_line(slave); @@ -82,7 +83,7 @@ void sdbus_set_voltage(SDBus *sdbus, uint16_t millivolts) trace_sdbus_set_voltage(sdbus_name(sdbus), millivolts); if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); assert(sc->set_voltage); sc->set_voltage(card, millivolts); @@ -95,7 +96,7 @@ int sdbus_do_command(SDBus *sdbus, SDRequest *req, uint8_t *response) trace_sdbus_command(sdbus_name(sdbus), req->cmd, req->arg); if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); return sc->do_command(card, req, response); } @@ -109,7 +110,7 @@ void sdbus_write_byte(SDBus *sdbus, uint8_t value) trace_sdbus_write(sdbus_name(sdbus), value); if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); sc->write_byte(card, value); } @@ -121,7 +122,7 @@ void sdbus_write_data(SDBus *sdbus, const void *buf, size_t length) const uint8_t *data = buf; if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); for (size_t i = 0; i < length; i++) { trace_sdbus_write(sdbus_name(sdbus), data[i]); @@ -136,7 +137,7 @@ uint8_t sdbus_read_byte(SDBus *sdbus) uint8_t value = 0; if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); value = sc->read_byte(card); } @@ -151,7 +152,7 @@ void sdbus_read_data(SDBus *sdbus, void *buf, size_t length) uint8_t *data = buf; if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); for (size_t i = 0; i < length; i++) { data[i] = sc->read_byte(card); @@ -165,7 +166,7 @@ bool sdbus_receive_ready(SDBus *sdbus) SDState *card = get_card(sdbus); if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); return sc->receive_ready(card); } @@ -178,7 +179,7 @@ bool sdbus_data_ready(SDBus *sdbus) SDState *card = get_card(sdbus); if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); return sc->data_ready(card); } @@ -191,7 +192,7 @@ bool sdbus_get_inserted(SDBus *sdbus) SDState *card = get_card(sdbus); if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); return sc->get_inserted(card); } @@ -204,7 +205,7 @@ bool sdbus_get_readonly(SDBus *sdbus) SDState *card = get_card(sdbus); if (card) { - SDCardClass *sc = SD_CARD_GET_CLASS(card); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(card); return sc->get_readonly(card); } @@ -250,7 +251,7 @@ void sdbus_reparent_card(SDBus *from, SDBus *to) return; } - sc = SD_CARD_GET_CLASS(card); + sc = SDMMC_COMMON_GET_CLASS(card); readonly = sc->get_readonly(card); sdbus_set_inserted(from, false); diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 058a70a0f8..d6a07f0ade 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -679,8 +679,8 @@ static inline uint64_t sd_addr_to_wpnum(uint64_t addr) static void sd_reset(DeviceState *dev) { - SDState *sd = SD_CARD(dev); - SDCardClass *sc = SD_CARD_GET_CLASS(sd); + SDState *sd = SDMMC_COMMON(dev); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(sd); uint64_t size; uint64_t sect; @@ -2377,8 +2377,8 @@ static const SDProto sd_proto_sd = { static void sd_instance_init(Object *obj) { - SDState *sd = SD_CARD(obj); - SDCardClass *sc = SD_CARD_GET_CLASS(sd); + SDState *sd = SDMMC_COMMON(obj); + SDCardClass *sc = SDMMC_COMMON_GET_CLASS(sd); sd->proto = sc->proto; sd->last_cmd_name = "UNSET"; @@ -2388,14 +2388,14 @@ static void sd_instance_init(Object *obj) static void sd_instance_finalize(Object *obj) { - SDState *sd = SD_CARD(obj); + SDState *sd = SDMMC_COMMON(obj); timer_free(sd->ocr_power_timer); } static void sd_realize(DeviceState *dev, Error **errp) { - SDState *sd = SD_CARD(dev); + SDState *sd = SDMMC_COMMON(dev); int ret; switch (sd->spec_version) { @@ -2446,20 +2446,23 @@ static void sd_realize(DeviceState *dev, Error **errp) } } -static Property sd_properties[] = { - DEFINE_PROP_UINT8("spec_version", SDState, - spec_version, SD_PHY_SPECv3_01_VERS), +static Property sdmmc_common_properties[] = { DEFINE_PROP_DRIVE("drive", SDState, blk), DEFINE_PROP_END_OF_LIST() }; -static void sd_class_init(ObjectClass *klass, void *data) +static Property sd_properties[] = { + DEFINE_PROP_UINT8("spec_version", SDState, + spec_version, SD_PHY_SPECv3_01_VERS), + DEFINE_PROP_END_OF_LIST() +}; + +static void sdmmc_common_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SDCardClass *sc = SD_CARD_CLASS(klass); + SDCardClass *sc = SDMMC_COMMON_CLASS(klass); - dc->realize = sd_realize; - device_class_set_props(dc, sd_properties); + device_class_set_props(dc, sdmmc_common_properties); dc->vmsd = &sd_vmstate; dc->reset = sd_reset; dc->bus_type = TYPE_SD_BUS; @@ -2476,6 +2479,16 @@ static void sd_class_init(ObjectClass *klass, void *data) sc->enable = sd_enable; sc->get_inserted = sd_get_inserted; sc->get_readonly = sd_get_readonly; +} + +static void sd_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + SDCardClass *sc = SDMMC_COMMON_CLASS(klass); + + dc->realize = sd_realize; + device_class_set_props(dc, sd_properties); + sc->set_cid = sd_set_cid; sc->set_csd = sd_set_csd; sc->proto = &sd_proto_sd; @@ -2490,7 +2503,7 @@ static void sd_class_init(ObjectClass *klass, void *data) static void sd_spi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SDCardClass *sc = SD_CARD_CLASS(klass); + SDCardClass *sc = SDMMC_COMMON_CLASS(klass); dc->desc = "SD SPI"; sc->proto = &sd_proto_spi; @@ -2498,14 +2511,20 @@ static void sd_spi_class_init(ObjectClass *klass, void *data) static const TypeInfo sd_types[] = { { - .name = TYPE_SD_CARD, + .name = TYPE_SDMMC_COMMON, .parent = TYPE_DEVICE, + .abstract = true, .instance_size = sizeof(SDState), .class_size = sizeof(SDCardClass), - .class_init = sd_class_init, + .class_init = sdmmc_common_class_init, .instance_init = sd_instance_init, .instance_finalize = sd_instance_finalize, }, + { + .name = TYPE_SD_CARD, + .parent = TYPE_SDMMC_COMMON, + .class_init = sd_class_init, + }, { .name = TYPE_SD_CARD_SPI, .parent = TYPE_SD_CARD,