From patchwork Wed Oct 21 17:34:48 2020 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: 1385669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jFCZPQqJ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CGd8W5cLRz9sPB for ; Thu, 22 Oct 2020 04:41:31 +1100 (AEDT) Received: from localhost ([::1]:38908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVI75-0007jV-UY for incoming@patchwork.ozlabs.org; Wed, 21 Oct 2020 13:41:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVI1Z-000421-VG for qemu-devel@nongnu.org; Wed, 21 Oct 2020 13:35:49 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:35336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVI1Y-0006Hv-Ef for qemu-devel@nongnu.org; Wed, 21 Oct 2020 13:35:45 -0400 Received: by mail-wm1-x32c.google.com with SMTP id q5so3462258wmq.0 for ; Wed, 21 Oct 2020 10:35:44 -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=nLgO4iC9rtoBp7o///HfhJ9kAvL116nD5opOCzZ6+ao=; b=jFCZPQqJ209NEKWXn0BkP4Wuv7Qtgx/48M0Jz/CsKKETc+CqIBhLa339Fpbdy/hlvF VgjHiK20NVHJfvo8PWP0+sbBzOe36FIoOFTPb9ymmkGukT/Mii5obS1Dbv00ZXYnuqqp O5GHuRL5zKuaJCXUIGvqthSrspQUSwccfGD4qilJYf8loPbt8Ds22KDouYhYVFl4wpyq sfj0a7CsBrtUTH2Km2MKe66TQmo3ZK94YavP4Cb4jQfXhrlnw20OByIhDfdPMHnxONeJ igCrnOqKt8HZP3Ph9BpUjEs49PGAVFNn3kSLIInAJ0X3p/y7XWTqUL05BI44uJTuxMgV z2Uw== 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=nLgO4iC9rtoBp7o///HfhJ9kAvL116nD5opOCzZ6+ao=; b=HSORUFX8x84cRHNTt0T/VvQ9RHVFWGTrp3AAdWqTsv44vBru5fOqUEiHSE9nb9Hmgb KW47SLSkmfvyPqwOt1g7apXRiqzNW6qunpkI16G720IsvQfA/m7eUmLVIi0YMLZxk3n2 manSSpFLgBBYculDpdWysdsdFBQqzycuqNn/xN6GSA2gMjb4tGdtKW2sSy3yOuVdaG0m tjnJeG0zVnXchcgPGNKRqq+g778Vwp12S4FBXVNs8TmlEY/QLMQIxPanaWimmsps7Db6 jFVKab+KUcCdSrSP8CFE1Q6NsO1T1rAXGfc5Zo35uJ47a1y39TYQz9fHRPdFQqyFAo/9 lAkw== X-Gm-Message-State: AOAM532QTh+urm4ZyYA/h6EZINQ05mGAEo76SBXqIKH2sMSpdYvH/4SV zDHSAcIKGpwxoy3QmrCUbzWpibVq0Nw= X-Google-Smtp-Source: ABdhPJxXoJ2CcbAWr0w4/cwwBibCbVaK1KDBdRv5MXEg5zmw9vDYjk5LsVSQ87yiPgVxsx/MXTlgRA== X-Received: by 2002:a1c:3d7:: with SMTP id 206mr4828393wmd.155.1603301742991; Wed, 21 Oct 2020 10:35:42 -0700 (PDT) Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id t5sm5109398wrb.21.2020.10.21.10.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 10:35:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 11/13] hw/sd/sdcard: Reset both start/end addresses on error Date: Wed, 21 Oct 2020 19:34:48 +0200 Message-Id: <20201021173450.2616910-12-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201021173450.2616910-1-f4bug@amsat.org> References: <20201021173450.2616910-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From the Spec "4.3.5 Erase": The host should adhere to the following command sequence: ERASE_WR_BLK_START, ERASE_WR_BLK_END and ERASE (CMD38). If an erase (CMD38) or address setting (CMD32, 33) command is received out of sequence, the card shall set the ERASE_SEQ_ERROR bit in the status register and reset the whole sequence. Reset both addresses if the ERASE command occured out of sequence (one of the start/end address is not set). Signed-off-by: Philippe Mathieu-Daudé Tested-by: Alexander Bulekov Message-Id: <20201015063824.212980-5-f4bug@amsat.org> --- hw/sd/sd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 4c05152f189..ee7b64023aa 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -755,6 +755,8 @@ static void sd_erase(SDState *sd) if (sd->erase_start == INVALID_ADDRESS || sd->erase_end == INVALID_ADDRESS) { sd->card_status |= ERASE_SEQ_ERROR; + sd->erase_start = INVALID_ADDRESS; + sd->erase_end = INVALID_ADDRESS; return; }