From patchwork Mon Jul 3 13:24:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 698669 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp1749660wrs; Mon, 3 Jul 2023 06:26:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Nv0V8C59fdiO+XGZR280nfKtbtG5+GM4cSeHVQEF4V8Z78PT4tDxTsk9euPiC9H1r1fTz X-Received: by 2002:a05:622a:15d6:b0:403:38a4:4cb3 with SMTP id d22-20020a05622a15d600b0040338a44cb3mr12240931qty.17.1688390787530; Mon, 03 Jul 2023 06:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688390787; cv=none; d=google.com; s=arc-20160816; b=VIzpQXUln8B6ieXqsfWmHnFFycREYJSNaRT9CzuStuma/cQpQMrje/y+GSXy4z/q9M MUAs/x5luoDk/poTEKfw5D3pgv1s8oyAdLmDZm4IEB/3CH6Cig80zgybcGN4jtDKe8pp o7PyQzl2xtq6Zgj9znl+nwsSD0QYwVZmxg1j30YHzF3PF0JZDYG/cBTWRRigplpMD87g uxg9ulnSDrRMQxSnH4UWHvc8zex1S7kZYMXRaWreVhzmXjmRgD9w8wYv46Nv/5sQmtIa 0DZVySSGOOFuSdNI3E0rfEeXR5ZAYKuwh+5d5sdQUQrRU3NrWbRQO4yBQOrABWRK9+XJ GzeA== 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; bh=qSahDTvOpdP8Uwj86S4Y6134kWqo8gH4wa+x+/ijE9w=; fh=r4syDaV3G3LiWeo8FbYKgqn+w8cwBFTOjL41cVc53DU=; b=di1anN0xHKXkyaHxIARnZhCHQ4sWMVzSH3ovcQlnU2ggpkAfYI88OXyx2n+aJqXZKi ADersCt1RmnWAq2/GxpC+xdP50EE0GZc1q8gVL9maRXFeBY+50+zMwRIJ+l8WviLaVYe 6nZcboluK1RWn3+xeyiUGXNcGYo3mwIF1g2aLPJVWzxUJcNf6zpB0YjIK+oOQfRIiAof YPR5RRJjH9Ou6NJdlkaJpATGFSlbSPcRZB0YydbEpTjWNJp62vuH0Q5jpvLyFQkX80fZ FPOHY8tFcqPZyqBWwbzQ487pwyjjzmN+NcyEiOroOPPn1ulqTQzZLzOcug1sKiLmWCwI eN2A== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z11-20020a05622a060b00b003ff2606751dsi12019862qta.177.2023.07.03.06.26.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jul 2023 06:26: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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGJYz-0008Uv-7A; Mon, 03 Jul 2023 09:25:57 -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 1qGJYq-0008Sn-Rc for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:25:51 -0400 Received: from gandalf.ozlabs.org ([150.107.74.76]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGJYp-0000lr-5I for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:25:48 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Qvmrn17K6z4wqX; Mon, 3 Jul 2023 23:25:45 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Qvmrk36Lkz4wZp; Mon, 3 Jul 2023 23:25:42 +1000 (AEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng , Peter Maydell , Lucien Murray-Pitts , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Bin Meng , =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH 09/32] hw/sd: Add sd_cmd_ALL_SEND_CID() handler Date: Mon, 3 Jul 2023 15:24:46 +0200 Message-ID: <20230703132509.2474225-10-clg@kaod.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703132509.2474225-1-clg@kaod.org> References: <20230703132509.2474225-1-clg@kaod.org> MIME-Version: 1.0 Received-SPF: pass client-ip=150.107.74.76; envelope-from=SRS0=mKPa=CV=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org 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, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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 From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng Message-Id: <20210624142209.1193073-10-f4bug@amsat.org> Signed-off-by: Cédric Le Goater --- hw/sd/sd.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index bd67c50894fe..33ecff496ade 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1037,6 +1037,17 @@ static sd_rsp_type_t sd_cmd_SEND_OP_CMD(SDState *sd, SDRequest req) return sd_r1; } +static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req) +{ + if (sd->state != sd_ready_state) { + return sd_invalid_state_for_cmd(sd, req); + } + + sd->state = sd_identification_state; + + return sd_r2_i; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; @@ -1076,17 +1087,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ - case 2: /* CMD2: ALL_SEND_CID */ - switch (sd->state) { - case sd_ready_state: - sd->state = sd_identification_state; - return sd_r2_i; - - default: - break; - } - break; - case 3: /* CMD3: SEND_RELATIVE_ADDR */ switch (sd->state) { case sd_identification_state: @@ -2148,6 +2148,7 @@ static const SDProto sd_proto_sd = { .cmd = { [0] = sd_cmd_GO_IDLE_STATE, [1] = sd_cmd_illegal, + [2] = sd_cmd_ALL_SEND_CID, [5] = sd_cmd_illegal, [52 ... 54] = sd_cmd_illegal, [58] = sd_cmd_illegal,