From nobody Wed Oct 29 22:58:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525846056844631.6095683845248; Tue, 8 May 2018 23:07:36 -0700 (PDT) Received: from localhost ([::1]:54699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGIGD-0004ry-C0 for importer@patchew.org; Wed, 09 May 2018 02:07:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGIAA-0008TB-DM for qemu-devel@nongnu.org; Wed, 09 May 2018 02:01:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGIA9-0005VM-JZ for qemu-devel@nongnu.org; Wed, 09 May 2018 02:01:18 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:39461) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGIA9-0005UH-F2 for qemu-devel@nongnu.org; Wed, 09 May 2018 02:01:17 -0400 Received: by mail-qk0-x244.google.com with SMTP id z75so26655339qkb.6 for ; Tue, 08 May 2018 23:01:17 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id 42-v6sm1707217qte.41.2018.05.08.23.01.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 23:01:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sySHqbdW4+jK0YcFeme9hY4GVz00i4tR/AeeOAE6L34=; b=gvI062mwi2Qjcn9bPYpA5KYoZ3+PHqv0TMJNZfKBri+xeV2xbxgauGlJtJyBpvgg6o gHuv8HhLloOKB/9ckWCyACUgoONoNiP+1LolAo0z6f3mMXGm7VMEQUZfmyLo7PZ4mYF3 4k+8jNHkV6kj1x3NJ/1xlHLEWwIpb/4JDSZ1ntnAmzDAWdCQaFGYR3AUUy2ekr2AS8lF ykxLRXZDsIDqXGHRg6LTLCO+TaJWdwfFyC7QNS1dT6XWtjSnAuFAM6eJZFhUujZFaW7b bn7wzYkb1kXR/840AtmY1eiH9qdaEZnGG9h25UPdc0TTOVVoksFt78AXky+5d2HYFDJJ AGkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=sySHqbdW4+jK0YcFeme9hY4GVz00i4tR/AeeOAE6L34=; b=faHGOJoU8ou4L3EYE9352dUTfUlYT/P5ifE2N1dNd239t8cz7my+XIJ13hZe7XisAs /fxdrI8EWdM/UqNQxr4oTaNVTCVOUz6F/DLAedkae23ce2T96nziEfCsQLleu/dCNN7f G8jjde0aOgnA+eVhs/CTX7hS96HU563j6qO9EoVakLwE+MJhc0fGMdPWjdeWVFS9ZOuj 03Jz87KBfw20YgkfQGjlBNilK31Sma/XMbhwPulde1hVhh2kTEgRqQC8QCc7uYTB/eEU n5qYV3xRs4FV7rK/IatgkuCGMqfkM0PGrqLQTmGq/cA39INUxx1HIxPCZUTx6Ge/lUM9 Vw1Q== X-Gm-Message-State: ALQs6tAwsi8nUfa8un945r/mqENf4wabvLaN55oBOENJjqlNc5SexqUW 9LH/wcxCXhFNq3x59CUtfCg= X-Google-Smtp-Source: AB8JxZpx1ss0Ck4T2xy2KCsir8SN5q7f4CsuvBAYdyZMby2O61g/3AxCUk2ykrjmf7PkMi2CI6oWUA== X-Received: by 10.55.132.130 with SMTP id g124mr38743512qkd.226.1525845676694; Tue, 08 May 2018 23:01:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Peter Maydell , "Edgar E . Iglesias" , Alistair Francis Date: Wed, 9 May 2018 03:01:02 -0300 Message-Id: <20180509060104.4458-3-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509060104.4458-1-f4bug@amsat.org> References: <20180509060104.4458-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH v2 2/4] sdcard: Correct CRC16 offset in sd_function_switch() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Per the Physical Layer Simplified Spec. "4.3.10.4 Switch Function Status": The block length is predefined to 512 bits and "4.10.2 SD Status": The SD Status contains status bits that are related to the SD Memory Card proprietary features and may be used for future application-specific usag= e. The size of the SD Status is one data block of 512 bit. The content of th= is register is transmitted to the Host over the DAT bus along with a 16-bit = CRC. Thus the 16-bit CRC goes at offset 64. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 5fb4787671..24aaf0c767 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -791,7 +791,7 @@ static void sd_function_switch(SDState *sd, uint32_t ar= g) sd->data[14 + (i >> 1)] =3D new_func << ((i * 4) & 4); } memset(&sd->data[17], 0, 47); - stw_be_p(sd->data + 65, sd_crc16(sd->data, 64)); + stw_be_p(sd->data + 64, sd_crc16(sd->data, 64)); } =20 static inline bool sd_wp_addr(SDState *sd, uint64_t addr) --=20 2.17.0