From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7D5D4817B7 for ; Fri, 6 Jan 2017 00:22:23 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP; 06 Jan 2017 00:22:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,323,1477983600"; d="scan'208";a="1090619112" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 06 Jan 2017 00:22:23 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 Jan 2017 00:22:22 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 Jan 2017 00:22:22 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.177]) by SHSMSX103.ccr.corp.intel.com ([10.239.4.69]) with mapi id 14.03.0248.002; Fri, 6 Jan 2017 16:22:20 +0800 From: "Tian, Feng" To: Haojian Zhuang , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [PATCH 9/9] ScsiDisk: retry if device detected power failure Thread-Index: AQHSZ+mMSVIInilVP0OHSFredIMhSaErG4XQ Date: Fri, 6 Jan 2017 08:22:20 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE5699A6090@SHSMSX101.ccr.corp.intel.com> References: <1483685538-11058-1-git-send-email-haojian.zhuang@linaro.org> <1483685538-11058-10-git-send-email-haojian.zhuang@linaro.org> In-Reply-To: <1483685538-11058-10-git-send-email-haojian.zhuang@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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 08:22:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Haojian We have handled ASC code 0x29 at DetectMediaParsingSenseKeys(). TestUnitRea= dy will retry if it's that case. So I don't understand this fix. Thanks Feng -----Original Message----- From: Haojian Zhuang [mailto:haojian.zhuang@linaro.org]=20 Sent: Friday, January 6, 2017 2:52 PM To: Tian, Feng ; leif.lindholm@linaro.org; ard.biesheu= vel@linaro.org; edk2-devel@lists.01.org Cc: Haojian Zhuang Subject: [PATCH 9/9] ScsiDisk: retry if device detected power failure If device detected power failure, just retry. This operation is common in l= inux 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/Bu= s/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 !=3D 0) { *NumberOfSenseKeys =3D SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA); *SenseDataArray =3D ScsiDiskDevice->SenseData; + if (((*SenseDataArray)->Sense_Key =3D=3D EFI_SCSI_SK_UNIT_ATTENTION) &= & + ((*SenseDataArray)->Addnl_Sense_Code =3D=3D 0x29) && + ((*SenseDataArray)->Addnl_Sense_Code_Qualifier =3D=3D 0)) { + *NeedRetry =3D TRUE; + return EFI_NOT_READY; + } return EFI_SUCCESS; } =20 -- 2.7.4