From patchwork Wed Mar 26 12:24:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 876314 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp3141759wrb; Wed, 26 Mar 2025 05:24:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVfFU+Ow2VtrWjLoVL55zb+F3/H/HDXXNciMXt1nR6/Tnly1M6zvBYTStoGFeIBY7II53Zc7A==@linaro.org X-Google-Smtp-Source: AGHT+IEXBXPiZ6MV72dszQiUcDbmy/3C2dRdlfGYpK9/6T1n4+7in+KRAJVdDTb99WzWuarvl6Nv X-Received: by 2002:a05:6102:8015:b0:4bb:d062:447 with SMTP id ada2fe7eead31-4c50d4821bfmr15211131137.5.1742991866576; Wed, 26 Mar 2025 05:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742991866; cv=none; d=google.com; s=arc-20240605; b=PyDUJKy2Upsiz5gaMyVMNssbIUPWCJA1Eav+I8rmh65gCOjsUr4Nqa71+M9A0V4aHB mRAaJWECJH4Gs1yZ23keLNjxmik4NP1VFDhzRDeYcdYf2cQh932TQ1+Dm5LUREAeN1MH q4kPzWRZ0mJjpJm5yyZnR7zLlIeMpHf9PYkOrnkj5v1HxOUtfhv9kaJwg0IALwStKcCO JMfnqkbqLL/Ltq25Ic9rYrnw2MRwr8VOy8U85js6A6FH5BLBc++DA3R82xCWa9VYxT21 RFAh1MMAfwJXztKmrY1WczpyHcClgHAGmpmCx0FhqDOrkC+9ldvUzDa4vk+Uhdcr4kgD B0hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=cQRr6w0G6zC7ZGJWBs0blumcTdX6WaxdGqlr3sVH2V0=; fh=glFXy22xMejM8ZhZ+W8+k2ujxXGy5AaxjqzLThSObkQ=; b=Wlyi0/tbe5q46Dw5mtvWE/6IndU/QPqIMUjKGSaCBRRivuxsK+nk5l3ydC9h4/27G7 9EEJ6bc1GI/IX5LRStiMySQ5N9cuG+Hf038XRw7wBxM0QR05tmz5EcC0SyxFDtnCHzFt MopY4UO41V7g44tNKtDPckEPNsDRhLWKzIAcsRpMhSQi8jM7a3+NBZXMr35uI9HOtgtj 9eAXHC5s8sG6EYHyhC06ChsVJXgwz9NlDUX0rIO9iHY6nieCnSKnQgJrFKOz0GljUB4m v/773Py06QDHIsIKdZ4eJV7LNTcZ2mOi0BaO6qw4VoN77iNGBGVsvAftrodhGWTFZ2qs 4okA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aiaQMlCF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ada2fe7eead31-4c50bffa456si2569002137.381.2025.03.26.05.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Mar 2025 05:24:26 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aiaQMlCF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3568581D27; Wed, 26 Mar 2025 13:24:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="aiaQMlCF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F8BD81D25; Wed, 26 Mar 2025 13:24:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7FF4780756 for ; Wed, 26 Mar 2025 13:24:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-39ac56756f6so2567273f8f.2 for ; Wed, 26 Mar 2025 05:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742991854; x=1743596654; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cQRr6w0G6zC7ZGJWBs0blumcTdX6WaxdGqlr3sVH2V0=; b=aiaQMlCFOweUF1C4JyZ7ra5OyhCRurytcTTN//s7AZOj3LA2vKrxPnf//1op1N4qv1 TMh7TfHS3yzfhLivlwGro9uAwOlkxW4pZm52BA4XCEBSmqxDI6nwzWWX/PfrsPWef+1k FEnHzODvONUhwnIv5tY98v+5ds1CkenWjEBwibH8cS4pfepJMZZYb+JFHWIY6nkPMyA2 C+VZ0TCp4I2rseqq/yoLg9DfVe3Wv994+iMKQAx+1BSs5cTQyLKV7GnLAE8ZEpvb9vCy ldgycxiW4+EJVcDKEH0a7G/sCAUxHLNDfnTI6DCwgbuKETFKhBcDP+EHPFT4VJruvQ8J Vulw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742991854; x=1743596654; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cQRr6w0G6zC7ZGJWBs0blumcTdX6WaxdGqlr3sVH2V0=; b=eOf2ys3FkhwY1cv7qdzx5GTUqS2MKuzzAJxcBzYy58Fvn0r4wJAVqAtk2gNhXS7pi3 8NL+1mq1CB91ANWa1THolyczs1bY1RzB3ZJvxdwJrDc3pWENERLT90aFnGTZmitVnst7 NiiDHLtK0MJzL7mQTP2idOtHykBjPe/QdMzYkQIy1NQQ2TMQ/yVKbD+aV+OQ6DTyC5HU A0R01C/kNwbeJt6+WZZXcwo2pi3KZRPyTGHD3nJR94Wi/KHVaKmL+CKRtYwDFyZranfo vQ56MHzDRT0xlSnAgG6sNpUDaegi7xwy1fUCvrEJE2+0K09HUsKTzQo8ZtRReEYMzn9J qq2Q== X-Forwarded-Encrypted: i=1; AJvYcCXT6BSKOXUGbCOrh3uqx/HQ4pkT4+/vCg3pgIZHKvvNKQ9KI9rpG2SFyVoAyvO6CB/oL91nRcA=@lists.denx.de X-Gm-Message-State: AOJu0YxApP01Hvx1vWbMKwmwqV6TxOS+bpPeVmIr5lOi0SQnKzQCjP13 M71UviKQNeESk3PnBftIHJwS9BkFJWHLzubnYXOwOGmlrVgxr+4Yn7e34e2b+mU= X-Gm-Gg: ASbGncsveGIXezdgLpNcFl9IdR3/BBzb+0b3nfIEkFDuFsrXGVAfpzoDbo9oS88ff4j z+pXCLJd3VkLKEZSR11QChg3habr81HuE1aHoL+JiU3NhQ7He2mjGOtBDdEybmlRSBC11Fja5m4 fD+v3kOvHceCwaRaO2q7QDlb7eSZk7zmSSiM7HnWmrbR12dKBrOebmxNdRDbUIvzbPL3es+XTrz ZXjL8mmQ97hAuDgkhdRG8H8+PT+rAo8F+ucjHZ2mX+sbhgTYQF2Tmx8NVoR9bVazOSCTL0rb9Zl Hx9Fxmew4VOm+PvgMg9D+3Y6QGP3IhUp2RGJL/BKnCFYv8ED53d+Ji44/UK00TtIKgfI6Q5P4CH RlorWZHq42LcK X-Received: by 2002:a5d:6d82:0:b0:38d:d666:5457 with SMTP id ffacd0b85a97d-3997f9364a0mr17712414f8f.42.1742991853910; Wed, 26 Mar 2025 05:24:13 -0700 (PDT) Received: from toyger.tail248178.ts.net (i5E863BED.versanet.de. [94.134.59.237]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e65casm16923921f8f.69.2025.03.26.05.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Mar 2025 05:24:13 -0700 (PDT) From: Caleb Connolly Date: Wed, 26 Mar 2025 13:24:08 +0100 Subject: [PATCH v2 1/3] scsi: fix typo in setup_read_ext() MIME-Version: 1.0 Message-Id: <20250326-scsi-sync-on-write-v2-1-12ab05bd464b@linaro.org> References: <20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org> In-Reply-To: <20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org> To: Tom Rini Cc: Neil Armstrong , Marek Vasut , u-boot@lists.denx.de, u-boot-qcom@groups.io, Caleb Connolly X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1077; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=HiJHUQ0As//uZbfHPVnNG4S8lluRU1JKy79JCOKudc0=; b=owEBbQKS/ZANAwAKAQWDMSsZX2S2AcsmYgBn4/Hqb05g4H3bMWr2yJPimjbvyZITV2+AGsIpC 0dIKlzUbGiJAjMEAAEKAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZ+Px6gAKCRAFgzErGV9k thjnD/9xkqotWe1lqCDW84w3Z1FIVE4XDsOXmu+dFIX6f2skkfNrqCKURnx4mxQs5EzEuLFilly 3Cs5AH0S9nKNAsMC6EL3pHUq8hS7jVfZvk0z1Sdu1N2oi8WK4UojpnBbjnAtbRFkgcbBDOhphI7 E1RlwvUP4x7x9D4XqONoq1Rp9Pl1z5GiRY2mluYxCx6ffy+CZk68CBSr2LgNXnrglcAUJYBqS+t io66lyK3IytOv+uk5TCoytXwC1eBpn1dbhs0HKqtzE/j4WkRHVLF4SpBWS31klXThqO5XbTR62f YkWjDxsbNfVoSqWQ62TxPUh2CF4k+MTO05A7uwwb9DILR/+NqhTzXdt7mRnEJmLoNs3MVnNW8Ly 0X6OVOUCwHbULQfbevhTEV/Z8ZYjTKT3hgJQI19uAgAfxqqEVNQ3k3XM5CXfbWG4dvAklfY2FZW iNqaRAWr9emNm1hnanDQwHdcoSvoHTSKIT++GP+kvBKkH9fd/LKEHob8INLL2PICe47dZCUylqV f8uvdjzuVQqnf1l+ygDBqlfXj2f8G10zXPDzdKKjNX+5V3ihvIGsXqTyyRNr2elWd5nz7ziipP3 FeDIeGbHMHSTcvsXYZ+QbQZwBP6jZvBNKHBNdcDT3mvk9dB6mY04QTOEOeCRxURSYWLMUjsylEN 0IfujQcoHYbb+6g== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This clears the 6th byte of cmd twice rather than setting the 9th byte to 0. Fix it. The only other command that sets the 9th byte is the 64-bit read, so this likely never caused issues in practise. Signed-off-by: Caleb Connolly Reviewed-by: Neil Armstrong --- drivers/scsi/scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index cd0b84c062252118d250b9305728e03f61736600..34ac47c03ab397ca999abf130d84ccbd3be4c419 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -89,9 +89,9 @@ static void scsi_setup_read_ext(struct scsi_cmd *pccb, lbaint_t start, pccb->cmd[5] = (unsigned char)start & 0xff; pccb->cmd[6] = 0; pccb->cmd[7] = (unsigned char)(blocks >> 8) & 0xff; pccb->cmd[8] = (unsigned char)blocks & 0xff; - pccb->cmd[6] = 0; + pccb->cmd[9] = 0; pccb->cmdlen = 10; pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ debug("scsi_setup_read_ext: cmd: %02X %02X startblk %02X%02X%02X%02X blccnt %02X%02X\n", pccb->cmd[0], pccb->cmd[1], From patchwork Wed Mar 26 12:24:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 876315 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp3141827wrb; Wed, 26 Mar 2025 05:24:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU2UZnWBswV5rSlIVfNXK4hCqXAbxMt/0dvKNy7y5ZeRmhPggZ9wx/X9luEMP88txIBiRMbOg==@linaro.org X-Google-Smtp-Source: AGHT+IE3vtJwJKDLIV2b9O9+9gyRgxhcZ+xlLQzNrU551XMg/I9Ckiyt+Tu2qd4QDn8JcjXuPIjE X-Received: by 2002:a05:6122:2884:b0:50d:39aa:7881 with SMTP id 71dfb90a1353d-525f08a2c62mr3168230e0c.0.1742991875654; Wed, 26 Mar 2025 05:24:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742991875; cv=none; d=google.com; s=arc-20240605; b=G2PEbDA+IYtlhGt1KSkImgbvgaw4iD3V2tPHSJlAAT5d22QzVGlTaEG/FU6jT+mvm8 M0XOPVFQ9yXMnNyJX65SAqoEkYI+Jyw+i4vFuEmFQG3ay/Y/yPqvgR0XlpNUaYk+t1Sb Ck+nFWVFRDzAlVEc8wx3sMyC9Agd0wz9N1W9fEZrBNwndb3MY3QgxqxSsf6Cc4B//Arl LaJI58KNxtXEE+7wbtnUbKQOzPTyzArkVWPnnf3VlWaahUIKRHHZ89iZtBuLjNJmeMBL GHs/WBrJNaFCH7+vxogm0CB27bcFjD8G5hkriroqrFUuaxn6qoxVFLCgWCk3KN7pAYqD 8j5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=grFI+AyTJ1nFnkkagj0GQ+g43+wP0+4Jplv53heM3CA=; fh=iaBe6cohSX+BSDVYaVdGqBsRofmld6IHIiW1JCR8iRo=; b=WbIL9F2XnpojmAS8HSAeZPEmEsbw3bzlylVTkPWHuPfFxfbJZai3Vxsh+5R7Cb9HhT j2182ydbUax5OCp6jDN2kSz+IsNNgjtw73nTPY89bVJoPdci5BY1yRMs4d7rGKIA4aYE Wp8lnMqYdrpU3G25E6+cBccEEyKvVd7EpuHPjVLqPTgVAfB5f4f0cwjndkxHtMZv4B7u d656PPIdVHSdNiqYTIABxjC7jtpFlS8ZzafUwP8s32cfV4aiaSOAxLfGeki/LjqpD/F4 FycWdpU8hRpaXNMpKmOKKBjXQlZETxRp9o4FXic+LIIICpLBCoD3qmDRB9nZPyCzy7tf B9/w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KRZ6FqjM; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 71dfb90a1353d-525a7642898si2866092e0c.119.2025.03.26.05.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Mar 2025 05:24:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KRZ6FqjM; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8759281D25; Wed, 26 Mar 2025 13:24:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KRZ6FqjM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D74A81D25; Wed, 26 Mar 2025 13:24:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F00B381B4B for ; Wed, 26 Mar 2025 13:24:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3912baafc58so5357217f8f.1 for ; Wed, 26 Mar 2025 05:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742991855; x=1743596655; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=grFI+AyTJ1nFnkkagj0GQ+g43+wP0+4Jplv53heM3CA=; b=KRZ6FqjMxwVX/r5+xPDGDOSVIV9SI0tLcRD9923rWnlikx+EFHHlqaG0mHVYJNYFWi VdGa8f3jyNuLcJwQN/x+tHU0bbZskn7Hl2KOgoYNZ28Sg7g9Slmjo3Uwakdbz95nIErs e7CAXAIH88HDred+kOjDito9SWmX/bKzxtR9rSNC0Q97Ds/TsLN0rDsED2OiIUe2YsYS lD0Dcl22nTz7iE+AbH7hijFhRp7pK1jnOx0VGTiilCrOM+qiWqx1kXflw0ftHzLx71n9 K3v076vR83PP/PQXF7gzAMWDD/pk3uAxcN67TDUhMgqNhiNAy44Ds/yvZhnOp4fsr2pW 38uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742991855; x=1743596655; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=grFI+AyTJ1nFnkkagj0GQ+g43+wP0+4Jplv53heM3CA=; b=A3gHHuIN6vRX9jU7sevjAtZ86lCIENGa02r/3MT5nCEcvkcTJH6m2ZbHchKodqikMG YON6UUPOGdXFELBXXpupNNwtxj8QPZ31BXB8MWbz/o/z7h7dH0Rjff3+VCzUwSmrPBKY U7GY2GtBu5EEzFbAIWwEOHQe63IAzjNRhpLbyolMtiYjMIs4GJV6Epo5n2Ky2n1KCLcW 4rGCfNa4X6/+H5T2UxXXQ8GRcLn4+9Jwg1JGjXZI8FCS+CMbHDHOCHEwnMIQ/rIafsxF p3Z4SSX29pMcDZZpN9mYlnB47OEcLhZ4v2r/aDT0Us2toj0XO0T+SSPNIWiJprUz1+x3 BFCg== X-Forwarded-Encrypted: i=1; AJvYcCVdLiinGpgjt2W+N6dEveSgiCDwQmYwrQWXwzuRr7q+Eo/HtApYNbciFw7quScZdWpufTCYp7Q=@lists.denx.de X-Gm-Message-State: AOJu0YyGkbt9bS/C9fU3/TouDhTBe5gaMwIx5tgEJ3EDul+n73xzJAVz wwAz/tC7bmLBAm2hBmMt+CI6YWUE/1EYr5yLplTpLItSMzglcTjqBWAsq5TajfQ= X-Gm-Gg: ASbGncsTKdaCToybLuGDiEcaBhmhtJm0sLxM1xxWgsbH4EkY1C21wgjS1mrGvtxKeie w0abkrI6MBxGT0lVqPpTEsZU0kCi6Gxpzm7+FFtLJLekZ2OxyweVyGb2wq/BIMlhKibmrGIGBEI lDOnAI3sKZBZHvg0Waor47BUPAPT0EYSIzY+H2u2zrcurB1svRhqpjEVMrq1WkD0+gWapWSbhOo ux4Gv2C2EMs4hbqAuqS8WBMxbb3m/FNYmVfc5JPJ9af4zBcV/q79id1PMur0w291w2Q31XaDvmO 6ERDVZQiMCJwtRvEVyXK03N4g9/cA5RfOrJdbbhOex8M2FUKya9/RkSXsjThT+1gQAlFjWgrVSH DfswYaY1gBNFZB1PgS8GCWB8= X-Received: by 2002:a5d:47c1:0:b0:391:13d6:c9f0 with SMTP id ffacd0b85a97d-3997f940829mr19977205f8f.47.1742991855363; Wed, 26 Mar 2025 05:24:15 -0700 (PDT) Received: from toyger.tail248178.ts.net (i5E863BED.versanet.de. [94.134.59.237]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e65casm16923921f8f.69.2025.03.26.05.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Mar 2025 05:24:14 -0700 (PDT) From: Caleb Connolly Date: Wed, 26 Mar 2025 13:24:09 +0100 Subject: [PATCH v2 2/3] scsi: sync cache on write MIME-Version: 1.0 Message-Id: <20250326-scsi-sync-on-write-v2-2-12ab05bd464b@linaro.org> References: <20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org> In-Reply-To: <20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org> To: Tom Rini Cc: Neil Armstrong , Marek Vasut , u-boot@lists.denx.de, u-boot-qcom@groups.io, Caleb Connolly X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2214; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=K1MLG5iZvnzW5TaW3VDS+A8H2nx905ReNYUkQyhxbaw=; b=owEBbQKS/ZANAwAKAQWDMSsZX2S2AcsmYgBn4/HqqWIcnL0qRGwXEKPseS61SsBVaJ+c8lrNr XElimYlVtWJAjMEAAEKAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZ+Px6gAKCRAFgzErGV9k tmXAD/43Lo1kUY8rDtkXUmuvnlh44AWzF0q5eM5glq+4VjZZGwl24BJK6Xy6i0WBbRLESXBBsZI dL2tzpglRxAb1WA2ONU9ExfVSfwa4WJLfmibv+cIeHzm+Z/JZ+60npcYU37r5DHH54SHKCceriW bMNWGYT3NaA3yw41QufX/1RJczIBJ3/ApY8ENhZqk1oCdZzh5SB8FNXMQO11dnXff42jREnC+N8 E7/SK5jRbwJfPsYqKn3D7fhvxPMXi+yJBbDEsXq0flBdE3B+iX0y6V7xFPHArf1su3yOowDRKfX BAgEkPuGb1LLtN/adJK0eiwPrHc1monRTxln7D5r7acqBQHQ5mbsTboRKHPvwt9zSFPCpg8OW3X ne6OwDzreuG9w89GlW9EUVtt1+5F86t0jFH5duwRGLyKzQ8ofyC6cONh235L/2iIp9w/nb1KyDS Apt93S4O5I+nWIEiOmJfX5xSpB5pNZHsPlSpXarmpMwBQ9WTtsN4D1h3kZFLJIeb8dxSjKcld9j XgOrkcPy3mbi9wS8Hcvmxu/DeoQ2MglS41NXwpGCQJcSwC2ehwhtV08YJXav7vfTOD00TV1O6Cx c1ix/5h++tfkDmev9WCxUfdSl3eviq1HBUIbrOXzKD+STStbejEAzD5/vm/oTo801ct1Ha96fyp nwCQPAmjJ+xM7CA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean We don't have a mechanism to safely shutdown block devices prior to a baord reset or driver removal. Prevent data loss by synchronizing the SCSI cache after every write. In particular this solves the issue of capsule updates looping on some devices because the board resets immediately after deleting the capsule file and this write wouldn't be flushed in time. This may impact NAND wear, but should be negligible given the usecases for disk write in U-Boot. Signed-off-by: Caleb Connolly Reviewed-by: Neil Armstrong --- drivers/scsi/scsi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 34ac47c03ab397ca999abf130d84ccbd3be4c419..3e556540cae46734d3b13a72cf279905134336f3 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -77,8 +77,25 @@ static void scsi_setup_inquiry(struct scsi_cmd *pccb) pccb->cmdlen = 6; pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ } +static void scsi_setup_sync_cache(struct scsi_cmd *pccb, lbaint_t start, + unsigned short blocks) +{ + pccb->cmd[0] = SCSI_SYNC_CACHE; + pccb->cmd[1] = 0; + pccb->cmd[2] = (unsigned char)(start >> 24) & 0xff; + pccb->cmd[3] = (unsigned char)(start >> 16) & 0xff; + pccb->cmd[4] = (unsigned char)(start >> 8) & 0xff; + pccb->cmd[5] = (unsigned char)start & 0xff; + pccb->cmd[6] = 0; + pccb->cmd[7] = (unsigned char)(blocks >> 8) & 0xff; + pccb->cmd[8] = (unsigned char)blocks & 0xff; + pccb->cmd[9] = 0; + pccb->cmdlen = 10; + pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ +} + static void scsi_setup_read_ext(struct scsi_cmd *pccb, lbaint_t start, unsigned short blocks) { pccb->cmd[0] = SCSI_READ10; @@ -239,8 +256,14 @@ static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, break; } buf_addr += pccb->datalen; } while (blks != 0); + + /* Flush the SCSI cache so we don't lose data on board reset. */ + scsi_setup_sync_cache(pccb, 0, 0); + if (scsi_exec(bdev, pccb)) + scsi_print_error(pccb); + debug("%s: end startblk " LBAF ", blccnt %x buffer %lX\n", __func__, start, smallblks, buf_addr); return blkcnt; } From patchwork Wed Mar 26 12:24:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 876316 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp3141883wrb; Wed, 26 Mar 2025 05:24:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWEdTBQLE4iw+8ogechl+8OTIEkSI59oZ7wKwP8wep8Wyl8ml9Kn94TR0xq4kxqWF9LeLusyg==@linaro.org X-Google-Smtp-Source: AGHT+IG5DL9ujWMvUtpU329L0JLeqNysS+tKgH0y/efTXDQucYDoSQPt+ciBCVAZkGFwF7txRWRN X-Received: by 2002:a05:6102:14a9:b0:4c1:abaa:ad93 with SMTP id ada2fe7eead31-4c50d515b0amr15495187137.14.1742991884951; Wed, 26 Mar 2025 05:24:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742991884; cv=none; d=google.com; s=arc-20240605; b=dlPMnwqkMvXikm4WC+SReAUaFNCUWflFCnP6sOXsKmwxSjCjRhoOKAURDLzhT7CMcl SaNWLec8VuXcyEKpe3gIxIlBW6CDAFDYDM+2m93AibfQ08GlAyv6DGJjp4rEowsItszv VeBWFBOPDXbndeHMCyGb9eJxIqi9Twp7zW/xVRXVc8G8TNY5XKHeccqFv8wietjyYcNS lxUL7civOhRkYIVwtXhvYquVZ8cHPNld5ENvdJmhEOOxL3lN5cW95kF36g+bqRWXWCaL yXeo9/4/+/olzG9ZtatVkh1z9VelVxq52qb+TwTQ0GWzWNdARdtVjsuAJ+qatcVNsFn0 4AEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Or0qLFxndDL56zEI1o0/SJT9c1VYLS1Cd14lH3rYNAw=; fh=egcJm2IE+KO9/jmzrH+/QB+Zfb8sJ3n+n86Eifb2VBU=; b=Zc+mkbxFKBTM2ZHin/2nDEaOAN4BHR0b9waEyA+1+/Ge0AZ6VHvUr31jCyux0n2hB1 PKbmkfVLb3L5RNJmcDVO8iQn1Eiz18mRiB+tUWGW+UgogjVX4q0nwkvFpuNQVGaQEIZu 8Y3mVuARfXmNBNHPtpRSTzOSXhoQHBN7ekLczi0P8NtEECz+rdQ9/JrC1iBs9qoVcBUn rCgnoPuUO/QG7F3YAQQfY2WdIL2XEEhi2KDamlnc5cWqzWVIZqEHpp+r17U95UtXSqPX AtzpfpmQBP2Ov59DB4gr5ewsOyudQ0dGbyN6TrlFPHix82mwU4oJYH+DZIoDaY1n1LtP RMfA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FPxNiqqR; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ada2fe7eead31-4c555899440si798590137.403.2025.03.26.05.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Mar 2025 05:24:44 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FPxNiqqR; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D690181E1C; Wed, 26 Mar 2025 13:24:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FPxNiqqR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8AD3880BAA; Wed, 26 Mar 2025 13:24:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7AC1580756 for ; Wed, 26 Mar 2025 13:24:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3912c09be7dso4484955f8f.1 for ; Wed, 26 Mar 2025 05:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742991857; x=1743596657; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Or0qLFxndDL56zEI1o0/SJT9c1VYLS1Cd14lH3rYNAw=; b=FPxNiqqRNFJtVSlewNUWiGGcEq+AicOf3dgm4gDRLQy4ij/cg/KOwgjrvmOXTT9HIx N/G+yLkQBUaF8KLvWpTmX7oR4YhhRVY21JQXG/vngYGttfKw4Q7cMfGCerhhfWO+3JdN Jl5/E89JsJN4yJ/PQWt6WfuItl0qCTUo/1JAXPbT62it4Zufm+ha8MBFdK07ZLlAqT4M 0j8ocdumXg7gPWdBrcdfCdwjSSrUgp9QiBVJtDtma/FIsHNIZQV8z1cXNRXgtwfxGO2g NTon3VOe3ziEFz92IUkADkW4gC7YNWi/Hn6AE0fvYlBwyqjAxSI06EfmTtdXNhSVUb4/ z6Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742991857; x=1743596657; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Or0qLFxndDL56zEI1o0/SJT9c1VYLS1Cd14lH3rYNAw=; b=ecljGN5gN1wkIHWAE16qnjCuwWb0j7O8JVngcyU9yasyJbYBLRAarA38H9XZDCoIFt EK9NvkXh1N/aHDwbYWQ6fWTugZaqZ1/FvnMDutquo33GhMxPUAJAq9bbmJG5mHMKsBDV yRgfEbFNVkjtiWs/5blhOn+z/nSamknWjc1s/ZXpPBLWno08cqDbJCrkXdeukbqYflng FJJJWKdx+oMPcjq5TtJNvNzHcN5ML8+JYq2uxoyfo4dQ8jjKy7smJP/n5U37H+SoAJ4E 0iMtjA2WngLjNMQ0fUDcB4C4sqenBEeger6cKF1FXGcPKL/pNFLkgXHRRVzC0SO8W7pB 7jDA== X-Forwarded-Encrypted: i=1; AJvYcCVCVNO1rmuhVihn7rmQ48fBnWd7u9RlPjpVw85IhFrb8576gJsi1lOLAO9SKDyih+pyOrJr6Rc=@lists.denx.de X-Gm-Message-State: AOJu0YzQJJdBEqiZnNM1WG5HCDFoVgkUi8ZRCFEVpLQ1S+UzSOnvUJJq /BSEHrH9+UhNOAwNSyx39Q6nnytH0bnIfT6ZceUMesw1D1jSxqxcjQ/5NNLi5iU= X-Gm-Gg: ASbGnctpGhZGhe0RNGGKwZhJKv404dWDAw4ZFpVzuhMg0p2v+OiLFaTdxZsrAHPl4Xe Kr2P5F6yBTT7mSu3of8okh6Xkcu2z2vL7Oq1PHvGAQSE6KRNPIqQBa3g/l+VaGINa7I5Lsb0z6v EInTsfQ88X3WqcemNfL42MAa5DHibncY82HFnOA0tY0RKag3XOskGwYfUAHAF7P6xJTJAlfbC3f +RGXnFUUwHH9qKKn1jvJuerat5BlBcVI+phzc3IatjzIa7YL0ZO2iaRjrmC/5XI+22LAyjW5JI1 RpkZ+KHD1knIQG/wswA/AYXmMxzJhZrRHMWZw+eKD5Kq72lydu8Eu4B1KULkQLzgrX8IVNM/XOs oxdDTENIzbmSc X-Received: by 2002:a5d:6d81:0:b0:397:8ef9:a143 with SMTP id ffacd0b85a97d-3997f90c860mr15785992f8f.23.1742991856871; Wed, 26 Mar 2025 05:24:16 -0700 (PDT) Received: from toyger.tail248178.ts.net (i5E863BED.versanet.de. [94.134.59.237]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e65casm16923921f8f.69.2025.03.26.05.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Mar 2025 05:24:16 -0700 (PDT) From: Caleb Connolly Date: Wed, 26 Mar 2025 13:24:10 +0100 Subject: [PATCH v2 3/3] ata: ahci: implement SCSI_SYNC_CACHE MIME-Version: 1.0 Message-Id: <20250326-scsi-sync-on-write-v2-3-12ab05bd464b@linaro.org> References: <20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org> In-Reply-To: <20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org> To: Tom Rini Cc: Neil Armstrong , Marek Vasut , u-boot@lists.denx.de, u-boot-qcom@groups.io, Caleb Connolly X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2018; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=V5RueStbr9d92x6h7pIfVh6kG5HW1KQlF0AVP/dL3p0=; b=owEBbQKS/ZANAwAKAQWDMSsZX2S2AcsmYgBn4/Hq5rxIgZOz8cuU7oBlV1CdlFY5k/yRsvVFC zfd2JM1gaGJAjMEAAEKAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZ+Px6gAKCRAFgzErGV9k tgp4EACVb7mayHsonUGBUIKZ6r4bVASnJWmtw8We6kIJooKvn+Z138928SUX6hXo1Q9QIIgVwRq tlt+XuVv7H7dSpoW7NnrS7eGapQMw2/JwmSKxa5d+fzBUn/mF0vS/bMQvCAVukADV1bshTzCHbE tGYNfSr+60aX5jRsIxv1CtdCw6m8fpWeYLMeeMncVu7vzTLEhweEHxCxk6dsVeZemWO2rIJERJM W9X/hkFUh8ODHJwwkPF9B1Jtv4MWye3V9Kq/hQ6kMNmexfOrPBD34R9MqB0rcHL96Vzh9H8/yaT 2rzB3HCsmcikjr6lkyOmvwyYaMLgZ8AOjUln/jReJh0cXr2O7yqzBkhMeh67XlLpHSc3df6zoq2 FHr1vcbGppj17sUIgiUMpvYWqCWOS29IJiiOQ/b4Wi2d6uifu/N6dF2lspf0zH/LfWSMz+C/oNL ZwT10xuEtiXsc7SDbvvlq1JKRZ2I+nZxZ6yXoTeTMhQMzwycjugVyWMy2aEr4FlEby1h0XW7qvk ef2OyvHfVIHYGJlQmw7PSaLav3zBMxNc/u1A+haVyunlBuCu7gm5LmMsdrNAnQoBLygF4iC3jPN Kvc/47C+QuoFWkd+aPID8QqYNIH8SLX9CJRUEj317Rjwd+SHWwgDdsvyTF2CDr8Y347xtqiJ4wR d5xKXZ2VEjh/TpA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The SCSI layer now issues a SYNC_CACHE command after every write to ensure there is no data loss due to a board reset after write. Implement support for this command and remove the same logic from the ATA write path to be consistent with other SCSI backends. Ranges are not supported and the whole cache will be flushed in all cases. This was done per iteration in ata_scsiop_read_write(), but it's not clear why this was the case, calling it once for the entire write ought to achieve the same result. Signed-off-by: Caleb Connolly Reviewed-by: Neil Armstrong --- drivers/ata/ahci.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 8058d5ff1c37f92914f250fa9cc78498a3f27331..deb91efd6d2666016f375feabb16ebc8f68fb697 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -735,19 +735,8 @@ static int ata_scsiop_read_write(struct ahci_uc_priv *uc_priv, debug("scsi_ahci: SCSI %s10 command failure.\n", is_write ? "WRITE" : "READ"); return -EIO; } - - /* If this transaction is a write, do a following flush. - * Writes in u-boot are so rare, and the logic to know when is - * the last write and do a flush only there is sufficiently - * difficult. Just do a flush after every write. This incurs, - * usually, one extra flush when the rare writes do happen. - */ - if (is_write) { - if (-EIO == ata_io_flush(uc_priv, pccb->target)) - return -EIO; - } user_buffer += transfer_size; user_buffer_size -= transfer_size; blocks -= now_blocks; lba += now_blocks; @@ -845,8 +834,11 @@ static int ahci_scsi_exec(struct udevice *dev, struct scsi_cmd *pccb) break; case SCSI_INQUIRY: ret = ata_scsiop_inquiry(uc_priv, pccb); break; + case SCSI_SYNC_CACHE: + ret = ata_io_flush(uc_priv, pccb->target); + break; default: printf("Unsupport SCSI command 0x%02x\n", pccb->cmd[0]); return -ENOTSUPP; }