From patchwork Fri Jan 6 06:52:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 90120 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp9321549qgi; Thu, 5 Jan 2017 22:52:53 -0800 (PST) X-Received: by 10.98.60.77 with SMTP id j74mr5075339pfa.142.1483685573440; Thu, 05 Jan 2017 22:52:53 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id l3si78533989pld.333.2017.01.05.22.52.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2017 22:52:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 111CB819FA; Thu, 5 Jan 2017 22:52:53 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6E1AE819F1 for ; Thu, 5 Jan 2017 22:52:52 -0800 (PST) Received: by mail-pf0-x230.google.com with SMTP id f144so2619480pfa.2 for ; Thu, 05 Jan 2017 22:52:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6koncmfCKNQgJ6egA6XYksMb5Jd8ov3xPmAPsEI0Kvo=; b=PPDRyWw7uflEGo6RzNhtO70ubpF0I5SJuvKULp6N9b8E+e9kRf/FryI+0rKA8OmCAE Y4rryUh9CyMMEhtd9YC2eETISK3lWh63ibJ1uLBcA0TA7OT5DMiLDwUprFA2q5jD0Yc/ KRhl/WC73PG4zgzgss+KXvBaKvVJk3sqXNovw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6koncmfCKNQgJ6egA6XYksMb5Jd8ov3xPmAPsEI0Kvo=; b=qi91yjOiQ+Ar++aZKY+hj2OBcq04DRS37Yu5OnOPUADXn/lUtcrcOVkVBUTYvbFay1 y5KwQgG6z4M1h2vsG4jnPVD9BIRyeQ++WGprnNbcGpaY2i975PBHsFs5Ltt7oZ0xNJ3n uP4FKSKlpwOO9JAp6/2J+U/kzmke1c5oG5uhYj2dAerxb5pncFR3Q9D1K6K+DVea4H8K 9PvVz/fJ3dmM4krPek8X7hoQr9v9lRJT0sriNdqrk2brfDAJjLauvHQK1Wlx1L++n/LI 8NLSjObZkOpRDe0dovFFHH/SiaG/zwCcCwVBKdc84y9nMAjBkxerZNu0WHZAlx69ASRW IQoQ== X-Gm-Message-State: AIkVDXJvSVZCmRZgAwAof22jslKiNzTohQc19JO+SKIACcu1IH+jWIXiDDJx+JrJM3/IH6mN X-Received: by 10.99.124.66 with SMTP id l2mr141338282pgn.116.1483685572109; Thu, 05 Jan 2017 22:52:52 -0800 (PST) Received: from localhost.localdomain ([45.56.159.83]) by smtp.gmail.com with ESMTPSA id p13sm159096976pgf.47.2017.01.05.22.52.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Jan 2017 22:52:51 -0800 (PST) From: Haojian Zhuang To: feng.tian@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org Date: Fri, 6 Jan 2017 14:52:18 +0800 Message-Id: <1483685538-11058-10-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483685538-11058-1-git-send-email-haojian.zhuang@linaro.org> References: <1483685538-11058-1-git-send-email-haojian.zhuang@linaro.org> Subject: [edk2] [PATCH 9/9] ScsiDisk: retry if device detected power failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haojian Zhuang MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" If device detected power failure, just retry. This operation is common in linux kernel. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang --- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index b5eff25..a7b62ec 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -2251,6 +2251,12 @@ ScsiDiskTestUnitReady ( if (SenseDataLength != 0) { *NumberOfSenseKeys = SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA); *SenseDataArray = ScsiDiskDevice->SenseData; + if (((*SenseDataArray)->Sense_Key == EFI_SCSI_SK_UNIT_ATTENTION) && + ((*SenseDataArray)->Addnl_Sense_Code == 0x29) && + ((*SenseDataArray)->Addnl_Sense_Code_Qualifier == 0)) { + *NeedRetry = TRUE; + return EFI_NOT_READY; + } return EFI_SUCCESS; }