From patchwork Tue Jul 16 18:41:39 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: 812793 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp447205wrr; Tue, 16 Jul 2024 11:43:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUgOUkgp6jtwnAGRfH73EiNwn/ShjmjPUs8Dji0oBzOj+/J1hRnL0O/IxVa0OEelGrqFivSLFo2inNHYM1NMHDR X-Google-Smtp-Source: AGHT+IFxEaqrxrVMqcWjeCKWOYc7WL1QNvznf5VpBeb3lFQZHA053rkR3cz9HSaw4w4h94N17s4t X-Received: by 2002:a05:620a:1a86:b0:79e:fb85:5260 with SMTP id af79cd13be357-7a17b723968mr337433785a.73.1721155405013; Tue, 16 Jul 2024 11:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721155404; cv=none; d=google.com; s=arc-20160816; b=bOkw+4/kowlbzyhWAhlV2cm0ljrDusTk19F8QiEuZnK8KJBZPukE2MzKg2hKZzQy0W wa1jNPQ9qzFWRWnaw4I+aKZn+dHgfIcp0Wiw5gWgDMsPsIJj7E1ehs/XOOpzQ0SiFAyG FVM+G7btlKdEP4u4nSq8cpbmD+VbcgVSZw70w1Us/E7wtaT4uawcF3JfRTA/QnHrP/Sg 9pUcHHQHhpXEpt+12uDs3P0YUtN9u61i2/7Kf5liAaqzcEki03wBjsXqt5aPCMSMX4qA uiQU06W9AFr/YnzauSu6AikEXo8fvx8X/GWpiabx5FaxlRCZs8Ym0cGdBXjjXTF4xpdr Y4UQ== 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=Zk51wjPZgnSFKW58/RILvklpvjjZlGceP8tUcpMZ6ZY=; fh=8ly4dktE5qX7scQRc1qmWVsO0MVOdxfDtQTaDzdLLVc=; b=TbV9aVw2Kbjv88BhO9UO2rpFD5S6X+OQYaz4Xu+mXEBio6XDS/tkEJ57tUtRBoY1bI NyZf4RutI91vGeOTby19DC9lcEi8dt/N4uCdQfh76WNlWanXqKAldX19oBx1RdZG94bX AyUo6c9YcQeugcSjCBuC8znPmCFBTQefMdXSXe56asBgL4GFuTsDAu8vKd7Qb9J9PvoM +8Etng35PBd/6fADgyamHh4HFwZU7H8YKl1jTccdGD5wGIZFO25rQNuVQO394Gs4Xet3 1uDGBOfyf3lnBl5ld3kN/UARTw2mgkICXJQQ2h3FU14q454NHi8t7+Of1iuec8704ewu C5iA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zfRbWnCD; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a160b7ba52si808913185a.46.2024.07.16.11.43.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:43:24 -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=zfRbWnCD; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTn8C-00026a-Ll; Tue, 16 Jul 2024 14:42:32 -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 1sTn8A-0001v2-6V for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:42:30 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTn88-0007Nq-LJ for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:42:29 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4266b1f1b21so40569005e9.1 for ; Tue, 16 Jul 2024 11:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721155346; x=1721760146; 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=Zk51wjPZgnSFKW58/RILvklpvjjZlGceP8tUcpMZ6ZY=; b=zfRbWnCDsyFJ1s/hcyaNxk22hFx8jjFzYFVrN50oqVVSU9EdR1yKgKaYFmRtR9AiMQ 3VrhVF6MLCJpbSKJLDxcFCzkXC+J0/ZnWzpmx/aCEc/4oUSOdzr3VrRU5/cOVlqqyqul s4YpU/20dtpTfQomJL1OOMBt+U1H3svy99filwqjKE4PUWLeZmUUEj8wErUvLdoBBNdZ uYOVJcbbH98BbJ47ExH/AgZ2XAS3T0Mf9XT8WgtgJZiAZM8JrlbWO8J/WMM1wTEP6GwU 5IjQmgfdbwaDtYhsiw204+57tQmJW3V71ujWRGGx4NZNQdq/9wTYI6cNGihj2tcuV8DR mhVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721155346; x=1721760146; 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=Zk51wjPZgnSFKW58/RILvklpvjjZlGceP8tUcpMZ6ZY=; b=NSRpjWMa2IGsRxUUpA4Uvq+Wd+a1zB7RYaPNH5CWJIXeOx31nvqUPE+799g06erUg9 XsUQhPyXn6SwpaCluB+Ywuu777MX15pvt99YPOs3rVQHnUSj+jJbvrGnkOA0/LKVwNGf 6wKHfDQgrVYvkxe5plrFGfDDNKXuu/aaLRT+r/nl0UXKpuk4kIVgqSeHwkqsBLN5mB5T JayVYTyUoexlG4Yuh26UO06TGNVk4JzdE21pNHBNEQBrO1OE4zAAy7nR8usWpqzBFBld 2t7uWXoqwFJlRD44KTz+QoZzQFqh47vTc+rahAQc4acNhrhP2MjVMehzXdKPqY4h0shY +lAw== X-Gm-Message-State: AOJu0Yzr1YsK4knKScRwxmSbGro4kxbtY/ZwuDC4ZdjBA36orTnELAEJ ajAMiZf6GfwNBS2WVUqbKukdRFhcZ7vAOD7x2YReX+iprDurhWWzY1B+oFLtbLz6UGk6CMRmE2r zaNWHYw== X-Received: by 2002:a05:600c:c88:b0:426:6089:e503 with SMTP id 5b1f17b1804b1-427ba687cdamr20380745e9.16.1721155345958; Tue, 16 Jul 2024 11:42:25 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5ef57aesm135373525e9.45.2024.07.16.11.42.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:42:25 -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/11] hw/sd/sdcard: Add emmc_cmd_PROGRAM_CID handler (CMD26) Date: Tue, 16 Jul 2024 20:41:39 +0200 Message-ID: <20240716184144.42463-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716184144.42463-1-philmd@linaro.org> References: <20240716184144.42463-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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é Tested-by: Cédric Le Goater Reviewed-by: Cédric Le Goater Tested-by: Andrew Jeffery Message-Id: <20240712162719.88165-7-philmd@linaro.org> --- hw/sd/sd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 09077f0154..a90612af58 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1568,6 +1568,12 @@ static sd_rsp_type_t sd_cmd_WRITE_SINGLE_BLOCK(SDState *sd, SDRequest req) return sd_cmd_to_receivingdata(sd, req, addr, sd->blk_len); } +/* CMD26 */ +static sd_rsp_type_t emmc_cmd_PROGRAM_CID(SDState *sd, SDRequest req) +{ + return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->cid)); +} + /* CMD27 */ static sd_rsp_type_t sd_cmd_PROGRAM_CSD(SDState *sd, SDRequest req) { @@ -1917,9 +1923,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 26: /* CMD26: PROGRAM_CID */ - return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->cid)); - default: qemu_log_mask(LOG_GUEST_ERROR, "SD: Unknown CMD%i\n", req.cmd); return sd_illegal; @@ -2478,6 +2481,7 @@ static const SDProto sd_proto_emmc = { [20] = {3, sd_adtc, "WRITE_DAT_UNTIL_STOP", sd_cmd_unimplemented}, [23] = {2, sd_ac, "SET_BLOCK_COUNT", sd_cmd_SET_BLOCK_COUNT}, [24] = {4, sd_adtc, "WRITE_SINGLE_BLOCK", sd_cmd_WRITE_SINGLE_BLOCK}, + [26] = {4, sd_adtc, "PROGRAM_CID", emmc_cmd_PROGRAM_CID}, [27] = {4, sd_adtc, "PROGRAM_CSD", sd_cmd_PROGRAM_CSD}, [28] = {6, sd_ac, "SET_WRITE_PROT", sd_cmd_SET_WRITE_PROT}, [29] = {6, sd_ac, "CLR_WRITE_PROT", sd_cmd_CLR_WRITE_PROT},