From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: Haojian Zhuang 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: [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: , X-List-Received-Date: Fri, 06 Jan 2017 06:52:52 -0000 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(+) 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; } -- 2.7.4