From patchwork Mon Jun 24 13:14: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: 807040 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp1878680wrt; Mon, 24 Jun 2024 06:19:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUwbWwBa66sQPuE2v6RnlwRPvdpTWc65EEVDQF3kSKZ4FWfMUuCjPmsE9tAXet2ia/jRuCY8552ZRMzR3Ypkh2X X-Google-Smtp-Source: AGHT+IEKETlEZgFGgJ3v+YzoAWAPqRFE+PdlD1NfV057S4blYVMDTqC+QObfbZKZCAXZ6n/WkqVS X-Received: by 2002:a05:6808:1824:b0:3d5:2bb7:850 with SMTP id 5614622812f47-3d54594d8a6mr5176546b6e.5.1719235144892; Mon, 24 Jun 2024 06:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719235144; cv=none; d=google.com; s=arc-20160816; b=eTGnbonA/+u7Q2rBFmKCXg6gdCPjBxIvfrN7A4dxxQbpxPyGAWjBD7ujuLJKjSB5Kh +QMKWt+X9mwPVUZLcOq40dPo1NX3mX5l7BqDtriESgyuUgrxsSC0OuUusE7mzvpwSEzU kLYLlG9w5Y5ulhcbtIrMAKKyZXssX37fLWC4Ffod6WGK4sW0St3vFPsVlZfIQMtCN0WI Fnq7tmWihhi8Y/MTuhJ1CfquB5PjJ9/Im++J/crPxz6TpEA2srqbWQtzyFxNo8M9EEpC 7Mnsoy28LN3t5YXp87muV92e6bgjvgNzrdZaqpbF75RiKhKcVSG8WYyu724fYlww7aDJ /lYg== 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=RqlOEyj+8xJJtMHox3KeLzXAnw9eaudtpJH6jXIsYOM=; fh=/TyiCVzPJVYkT4NtrOYZRXAcrkaiLXA/rwqp4QqIc5M=; b=B4DJkR/qi9tEq1JqkCIw1Pbmi3Hi5s+kOacOh1yc/qYU79dHR+rO6Fuqd+5S1NBkyf wxFv5GTmY0tU+umQg9dvjvxv76zrz2BqkR0COgfxo0gvc8Mpw/QabAQEoGvaACsItABV n+mIaIX75SdPmu+QP1uHaG0+dTWFvqxl4ssOlwU3/eo71FVXuMXbPUcni/w/kHgR4LzW 6NaN9V3aIkn1wKXfzO3N62otP+gmU6iJ2Dpl+6YHLLLoPeCtO35oEdzphNAfl2xsb3+t QsW09jiuTRY8g/7kbj2jPjE5ykweKyNvo/drE5xdwv50kCR+hMKMcCYIqfSqSII3m0Er nM0g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w0e55R1j; 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-444c2b49aeesi82358921cf.108.2024.06.24.06.19.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jun 2024 06:19: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=w0e55R1j; 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 1sLjXr-0002c4-SH; Mon, 24 Jun 2024 09:15:43 -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 1sLjXf-0002Tp-Ua for qemu-devel@nongnu.org; Mon, 24 Jun 2024 09:15:32 -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 1sLjXe-0005LN-9P for qemu-devel@nongnu.org; Mon, 24 Jun 2024 09:15:31 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-421cd1e5f93so32928525e9.0 for ; Mon, 24 Jun 2024 06:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719234927; x=1719839727; 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=RqlOEyj+8xJJtMHox3KeLzXAnw9eaudtpJH6jXIsYOM=; b=w0e55R1jxQgPIHzVaV8IuY/CBhxuRl9AU+O7IwifzRNR3XHo2LxmK2r3qx103Ot2Ez J6jMXIlUSP0OZKyTy5fEXo69zPdklwb8jni5l/7DNffh3sQ1lH3F5f0w0a6IYk71c6Vs kBDXhRrTEdgprWDipP7WXgL2v2CIyZVBcYOl1ZyPTfpgwleiFHWVBd3aE/NwyB7rxQE9 TomomL3lxNLukEC1OI179MXjhDnVWM+fd3BkR4c1+iTEttYnhhDyZgk1aZN+5LoL3rVH Z7yNuZqV1jIGQFQkXHobCB5+gQdK1XcAhAsKzoAHEHI4LvNL1MCbqDxwYGWuz7THobNd olEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719234927; x=1719839727; 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=RqlOEyj+8xJJtMHox3KeLzXAnw9eaudtpJH6jXIsYOM=; b=f5gtK1oSxYfsY/AymIVXtNieF7tPqworGcz3lXYYLJOJ0UTqqpF7xBXUV1uTgStTXc Bp84Xiz+tGN/89qLLxnXtg396mdyhtqRJHucZdCuNs38AgGOjLiURXfpZsWo6QAXmDZB 9EJI/WxSWFO7SU5opjbbaGWtIzkDMzsbSNbGnst/OPs5KuDH5yljJyakGAQ366F/HAzL 2AOUseYN2wZTbKoeLMkcf27SfYrlzFB8FuLenbMdFwbNDMRZex7xJ9uCCXRdSrDG/CMx vhYPshall2xMudRnu6k8U+JSJPpRMryCFpvQ4XE6S4SbQQsYSr/0au22aMdHpJPEeJ8M KlHg== X-Gm-Message-State: AOJu0YyAXDNQuHi0hjsSQsG7lpsRblonjrooae/eRsVsh6u9gJplGHjq AosDWwd7J/7o2lhpV46pleEKAbPRqEMLjrpm9srmPuOh6Aifo7Jt2As7I03HE1CtSEoQnk//1RV g X-Received: by 2002:a05:600c:354a:b0:420:ffe3:8536 with SMTP id 5b1f17b1804b1-4248cc66a8emr36771655e9.37.1719234927498; Mon, 24 Jun 2024 06:15:27 -0700 (PDT) Received: from m1x-phil.lan (bd137-h02-176-184-46-22.dsl.sta.abo.bbox.fr. [176.184.46.22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4248191c5adsm133571485e9.39.2024.06.24.06.15.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 24 Jun 2024 06:15:27 -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 08/19] hw/sd/sdcard: Use Load/Store API to fill some CID/CSD registers Date: Mon, 24 Jun 2024 15:14:29 +0200 Message-ID: <20240624131440.81111-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240624131440.81111-1-philmd@linaro.org> References: <20240624131440.81111-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 The ld/st API helps noticing CID or CSD bytes refer to the same field. Multi-bytes fields are stored MSB first in CID / CSD. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Cédric Le Goater Message-Id: <20240621080554.18986-7-philmd@linaro.org> --- hw/sd/sd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 64270dec0f..6e346e28ca 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -393,10 +393,7 @@ static void sd_set_cid(SDState *sd) sd->cid[6] = PNM[3]; sd->cid[7] = PNM[4]; sd->cid[8] = PRV; /* Fake product revision (PRV) */ - sd->cid[9] = 0xde; /* Fake serial number (PSN) */ - sd->cid[10] = 0xad; - sd->cid[11] = 0xbe; - sd->cid[12] = 0xef; + stl_be_p(&sd->cid[9], 0xdeadbeef); /* Fake serial number (PSN) */ sd->cid[13] = 0x00 | /* Manufacture date (MDT) */ ((MDT_YR - 2000) / 10); sd->cid[14] = ((MDT_YR % 10) << 4) | MDT_MON; @@ -462,9 +459,7 @@ static void sd_set_csd(SDState *sd, uint64_t size) sd->csd[4] = 0x5b; sd->csd[5] = 0x59; sd->csd[6] = 0x00; - sd->csd[7] = (size >> 16) & 0xff; - sd->csd[8] = (size >> 8) & 0xff; - sd->csd[9] = (size & 0xff); + st24_be_p(&sd->csd[7], size); sd->csd[10] = 0x7f; sd->csd[11] = 0x80; sd->csd[12] = 0x0a;