From patchwork Mon Jul 3 13:24:47 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: 698672 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp1750267wrs; Mon, 3 Jul 2023 06:27:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6TlO5XJnqL7JgzjBWtafFFfkopMhsOVoP7838QsnKjqHw1JM8UWoFSnV3SZw4xW4TFffM+ X-Received: by 2002:ac8:7d46:0:b0:3f0:a426:5f29 with SMTP id h6-20020ac87d46000000b003f0a4265f29mr14954694qtb.11.1688390879762; Mon, 03 Jul 2023 06:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688390879; cv=none; d=google.com; s=arc-20160816; b=p8TMq/CyYoDiQIFVAAUaqHcGIsK4/Ond84WjS9WO5XaZA5ucBsbvaFahe3YIRKdbjE kWbbTZWTh15TVnnl+4lhh9koK/24Dh+9FcvYrA2Uu3RmVR4cvsJooS5K3Yio2gar9gLT zlqWqdj/bSb9q8lC1yzc9W9WnXeIvwWdQQ1IxvEi+UuRzM6RTUGqDaSt8AVFSQw5Q054 OqXiFYbL+nZE1ly635ANAonsaNp/XzNUgXVHjCXN7YoOii5Uq/01dDp07d9eodR2rAlT 0RJ19XtD2prlkyv4w9mni+auRS3SpxgeLGeLBptABKrdZwikgqhEpi1/sdSWO1GRADmm N+iQ== 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=+CTTTKQHko9I2Piqkl0LV9I1BDWlxcSVOegYIjRRIco=; fh=r4syDaV3G3LiWeo8FbYKgqn+w8cwBFTOjL41cVc53DU=; b=wIT/S94WfX58iO+inJ/0+g23RreUwT7mR2Oj9A2yxvqZ6cCma7nrTM3hRo70qDp7IM W+MmaSAGajW6tic0DXm2giO7dSnF0Da87IJ3ftsls1sd88NYgwWSjFAvn+OdicNqbUtn 42fbrbLe4nyFpuo7X7wkaFcsV+9vOUXffh5SsNBNC2c2H5ayxTiYaQHYn2pCoNdpz3Vn lGicD3Qp8/8aVz67JbuLvY7uYJYdIQXr81rAf6BTgDxRlUhxDirFsKwYX6CNj7+6KDEd vIjSlHhMIcy1eGzdxpt+SXvgqsVa262C/2XOXoSSpz2mZxxlWuQISI8n3xUWkR5pSRZr xzRQ== 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 ESMTP id e13-20020ac8598d000000b003f3908aec35si11843536qte.660.2023.07.03.06.27.59 for ; Mon, 03 Jul 2023 06:27: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; 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 1qGJZ2-00006L-Ux; Mon, 03 Jul 2023 09:26:01 -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 1qGJYv-0008TT-DJ for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:25:53 -0400 Received: from mail.ozlabs.org ([2404:9400:2221:ea00::3] helo=gandalf.ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGJYs-0000mM-Sk for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:25:52 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Qvmrr2sR1z4wqZ; Mon, 3 Jul 2023 23:25:48 +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 4Qvmrn4x6bz4wZp; Mon, 3 Jul 2023 23:25:45 +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 10/32] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler Date: Mon, 3 Jul 2023 15:24:47 +0200 Message-ID: <20230703132509.2474225-11-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=2404:9400:2221:ea00::3; envelope-from=SRS0=mKPa=CV=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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 From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng Message-Id: <20210624142209.1193073-11-f4bug@amsat.org> Signed-off-by: Cédric Le Goater --- hw/sd/sd.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 33ecff496ade..b46072424108 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1048,6 +1048,20 @@ static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req) return sd_r2_i; } +static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req) +{ + switch (sd->state) { + case sd_identification_state: + case sd_standby_state: + sd->state = sd_standby_state; + sd_set_rca(sd); + return sd_r6; + + default: + return sd_invalid_state_for_cmd(sd, req); + } +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; @@ -1087,19 +1101,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ - case 3: /* CMD3: SEND_RELATIVE_ADDR */ - switch (sd->state) { - case sd_identification_state: - case sd_standby_state: - sd->state = sd_standby_state; - sd_set_rca(sd); - return sd_r6; - - default: - break; - } - break; - case 4: /* CMD4: SEND_DSR */ switch (sd->state) { case sd_standby_state: @@ -2149,6 +2150,7 @@ static const SDProto sd_proto_sd = { [0] = sd_cmd_GO_IDLE_STATE, [1] = sd_cmd_illegal, [2] = sd_cmd_ALL_SEND_CID, + [3] = sd_cmd_SEND_RELATIVE_ADDR, [5] = sd_cmd_illegal, [52 ... 54] = sd_cmd_illegal, [58] = sd_cmd_illegal,