From patchwork Tue May 15 14:07:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 135888 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1073048lji; Tue, 15 May 2018 07:13:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1e538E1zGuudQz4TugBa4v/S/IltMv+F6JeZlCVShn/oTLucIoopBKFgLtnTJIf9kG1Xh X-Received: by 2002:a0c:9b8a:: with SMTP id o10-v6mr13545301qve.89.1526393605314; Tue, 15 May 2018 07:13:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526393605; cv=none; d=google.com; s=arc-20160816; b=0mr1XRTlG8b+jcnoUSHp9xAOBe3enCMSmEyv0uYno5NP/0u91pbSZQcUWfCuiLnlYC K7XisCn14eG8QAaBwS57Fx/j/yMjSYpSWPan+ENQSjTAjBMrFkY3S3ovq4bv/hB6bZRL d4vzKaZE/NVfIEGJYgxQJFW9+bUSY4+cwdj2oJ4X6ycugEjDoDyNbqnuK6L3M3/Us5Bz UkKsvPhaxZ5y7uCBn6fUZO6+/a7NoeIqxqbhDxe0i3+LbjY2IRzAdYx1jIESLgoYh3Eh aLNfavCMdvYmGgb9P2mEZKhEJ0Ao4niqooNzFRz5pVYVIsdXnClq8yzEUZ3hp1AQAmM0 2A5Q== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=bb2SUMZznc9hLMgbMiDrbs8LyEkCg7nOmvCV1bcMlpw=; b=Q9HpWNcv4+YXEaOIh3jlfhlOm3f/dMI+hrm62MT/JwiDsTfA5gNUQeKg3Oh5B0OPcW g1nurMhJxWK6N1hjRtSaXlteSmERDURqe2fZabYc62rOFc7Afo9NRIKDxb0LWsi5QMu5 n8i0Uh01KWt2AWZo0xHsVbV8MqGlldem0/C2sRAJMVZTYLJhVv8isToGCZ9W3pFyljTi gdntzmHTqe4MOcQk5Uh3CVqSzR1NZ1j/80/xh/LRybTtjhPFJcDxLAk4CrPKj1r5kY0E vLXbZ2tdebozDHw2SSGcV6ouhwvTJiPgxkl4Df8gIEDADlruAMJNb0mHxESjtvoKT2dd UNzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j10-v6si137328qvk.275.2018.05.15.07.13.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 15 May 2018 07:13:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIahg-0007lw-Jn for patch@linaro.org; Tue, 15 May 2018 10:13:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIabt-0003uW-Tb for qemu-devel@nongnu.org; Tue, 15 May 2018 10:07:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIabn-0002y4-VI for qemu-devel@nongnu.org; Tue, 15 May 2018 10:07:25 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:41690) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fIabn-0002wj-Ow for qemu-devel@nongnu.org; Tue, 15 May 2018 10:07:19 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fIabm-0001Tk-St for qemu-devel@nongnu.org; Tue, 15 May 2018 15:07:18 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 15 May 2018 15:07:06 +0100 Message-Id: <20180515140707.15957-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515140707.15957-1-peter.maydell@linaro.org> References: <20180515140707.15957-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 15/16] 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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 usage. The size of the SD Status is one data block of 512 bit. The content of this 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é Message-id: 20180509060104.4458-3-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/sd/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.0 diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 235e0518d6..7af19fa06c 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -787,7 +787,7 @@ static void sd_function_switch(SDState *sd, uint32_t arg) sd->data[14 + (i >> 1)] = 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)); } static inline bool sd_wp_addr(SDState *sd, uint64_t addr)