From patchwork Thu Jun 27 17:10:46 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: 807887 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp913404wrn; Thu, 27 Jun 2024 10:12:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUdfO/ygaVwf4Qhhw+ke5TZtuP5fizBvi3Eqkf8+n2Pvr4wejzhYoueINGjktCRebEHt5vNldSx2UtSf/jQX8ac X-Google-Smtp-Source: AGHT+IEePOTs2ef3EZLdNsRou34/jBuT70DzSreNitjU6Ldrkdq2AjTHieRr5d/3ViigGmESmOg3 X-Received: by 2002:a0c:f051:0:b0:6b0:8789:ae2e with SMTP id 6a1803df08f44-6b5409ca388mr149855686d6.23.1719508366616; Thu, 27 Jun 2024 10:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719508366; cv=none; d=google.com; s=arc-20160816; b=ncG0KvuutXpHnmNjszNesR3wzUS8/zekzDzgR0jZPlV6bXFzy5BkB/cc2vs+X/4tdI fEBwD+UvZNOCCjHvSunQYt8+VnTjMJQqfIzVO/wneWUBFdzVHf2Oydhkdkaq963t2hnU FaJjiJSuyr3ZVuO8oWbqUvOQ0Pmab5Rt4FRFJejeQi/2vowNnK0bCy5mDdoQU70Pikfo YQ2ISaQd/Qrc+/6Virp1U4T8miEgV5ydz3bC40EUUXCG3Wx4ivWKqaepj0iqWWgXPpL/ eS3Q0amFduqif8vGjK3Rpx1S0shRNxeCsfDghKVG0IG2eyedfzdi4OGgXpDgSHwdfnW0 NNhA== 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=/hWIFWqzHiq8lN1HtcaO+N2xCOE2TizGkz4ySULbbEQ=; fh=WUqfD5CNolTLXU3odpyK/irI96uSRBSbw3kHmNv9290=; b=gXo4aMzS2ZtN7Ay3M6GTBWVp08sbObpu656vmSGypMJEus9a6pw2s/AglESnKyDJkp ymjYuTPD1RaoJJmMZ+yB7wUJuRIMBxeXI8VQC0G3xQ4mFf5eR5RS0VaPsjhBd/mUWz+f 9gWOm/Z4AuZlLt9vSbB8+OEyRBeDfDz/kScljFTpkuu+oUfRq7K+4wJvgyCAx9AzXesX rNCZqBpjx1+AJ4AdkNozCLVeCfpHUB1hgM3h37hMO/8tBK9mIkz50V9hk4JQtn8mjsPf 3usXGcmb8TDe9f79w4c1EwwqSb6Y6ZDFjAeuTrhZFNL6gzaHKMIpqhm9EIN47VcSrwqr me2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xqiLKgDN; 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-6b59e607529si688536d6.455.2024.06.27.10.12.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 10:12:46 -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=xqiLKgDN; 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 1sMsfX-000842-50; Thu, 27 Jun 2024 13:12:23 -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 1sMsfR-0007nV-Et for qemu-devel@nongnu.org; Thu, 27 Jun 2024 13:12:17 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMsfP-0002GZ-9F for qemu-devel@nongnu.org; Thu, 27 Jun 2024 13:12:16 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-424a3ccd0c0so27490545e9.1 for ; Thu, 27 Jun 2024 10:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719508332; x=1720113132; 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=/hWIFWqzHiq8lN1HtcaO+N2xCOE2TizGkz4ySULbbEQ=; b=xqiLKgDNLMK6hOQE4KzupANglfgoYU9bUs+VSE3bA/SbFMaL2aXVrTkuXPfN2/3tvU KzemlYOleQVLqOXS+PuTNuwig12sUq4rTV0miUTYF8K160RQX3gXIaP1BX0+RZNCuuBS T3AbKpb2dmoi+DRoENalOKHRvHkgsl0xvfDaU0+8zaHs2FdZsOOS+VOXhYAQMDx1wUPl LCiT2Fhsa+Jba+U2egho+iiKrclkWUWCzBeCM7M8XAyWHJzXErzNKvLtM4vuA1xX0J9g kiw19bCkQ8FxCC6gnxAAoltThABEyaV/DXwlH8pxeC5Roq+JRjL5eO+/AUsDd10t39Rj GneA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719508332; x=1720113132; 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=/hWIFWqzHiq8lN1HtcaO+N2xCOE2TizGkz4ySULbbEQ=; b=DnRuqyG6OJRoADnrHpbK+zLCgGgv91yVwAbhe5LfG4RsGOPvDs6a/69+bieEqwpxMk MDQwktek9rsCXEpMKMp2C6HcjXwkKxlrKI9NImleSEDzF5qSbr6a7+zdAzuJ8bq/N8xi qnwqp0FqL8iwiTA/l+h5ZQpa01rYWfKNKBq+HeqnPYGPzJSd8GWBDt46wFN1u7QKgJtR jUYZs5i/ZqDQLkXZqB1D4NRgTv3dhhkA+UK/Z9i2R9PA9RfgpuBmQR+eojelbGoTTGzE HVqfFtJqoxxnqsFN34jv7X+5pztsJ6z8WjBzBbKsZUipjrppk8h0iIlN0BR47nPH+xzy R2Tw== X-Gm-Message-State: AOJu0Yxy+87WAIzROiuvtDaG8irgjtaGYCRWC+Yf6UW/mtL5bO9heI+0 CM0wDtOdCws6nOO+rDyfVUfWbzRIarf5dXioZJR3Ofi4G59AeKaVHGKqfvu6Vfi+mko+WQKftAh Hw1A= X-Received: by 2002:a05:600c:3b1f:b0:425:672a:766e with SMTP id 5b1f17b1804b1-425672a7804mr14277585e9.0.1719508332472; Thu, 27 Jun 2024 10:12:12 -0700 (PDT) Received: from localhost.localdomain (33.red-95-127-46.staticip.rima-tde.net. [95.127.46.33]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-424a2abcfd0sm52986785e9.1.2024.06.27.10.12.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 10:12:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , Luc Michel , Francisco Iglesias , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Vincent Palatin , Sai Pavan Boddu , Bin Meng , =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH 06/19] hw/sd/sdcard: Add emmc_cmd_SET_RELATIVE_ADDR() handler Date: Thu, 27 Jun 2024 19:10:46 +0200 Message-ID: <20240627171059.84349-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627171059.84349-1-philmd@linaro.org> References: <20240627171059.84349-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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=unavailable 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: Cédric Le Goater Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Cédric Le Goater Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9a2bfeaab6..c6e5c93acb 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1220,6 +1220,20 @@ static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req) } } +static sd_rsp_type_t emmc_cmd_SET_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, req.arg >> 16); + return sd_r1; + + default: + return sd_invalid_state_for_cmd(sd, req); + } +} + /* CMD6 */ static sd_rsp_type_t sd_cmd_SWITCH_FUNCTION(SDState *sd, SDRequest req) { @@ -2385,6 +2399,7 @@ static const SDProto sd_proto_emmc = { .cmd = { [0] = {0, sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [2] = {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, + [3] = {0, sd_ac, "SET_RELATIVE_ADDR", emmc_cmd_SET_RELATIVE_ADDR}, [4] = {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented}, [7] = {0, sd_ac, "(DE)SELECT_CARD", sd_cmd_DE_SELECT_CARD}, [9] = {0, sd_ac, "SEND_CSD", sd_cmd_SEND_CSD},