diff mbox

[edk2,9/9] ScsiDisk: retry if device detected power failure

Message ID 1483685538-11058-10-git-send-email-haojian.zhuang@linaro.org
State New
Headers show

Commit Message

Haojian Zhuang Jan. 6, 2017, 6:52 a.m. UTC
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 <haojian.zhuang@linaro.org>

---
 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

Comments

Haojian Zhuang Jan. 6, 2017, 8:31 a.m. UTC | #1
Hi Feng,

Yes, it's a bit redudant. Let's ignore it.

Best Regards
Haojian

On 6 January 2017 at 16:22, Tian, Feng <feng.tian@intel.com> wrote:
> Hi, Haojian

>

> We have handled ASC code 0x29 at DetectMediaParsingSenseKeys(). TestUnitReady 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]

> Sent: Friday, January 6, 2017 2:52 PM

> To: Tian, Feng <feng.tian@intel.com>; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org; edk2-devel@lists.01.org

> Cc: Haojian Zhuang <haojian.zhuang@linaro.org>

> Subject: [PATCH 9/9] ScsiDisk: retry if device detected power failure

>

> 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 <haojian.zhuang@linaro.org>

> ---

>  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

>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

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;
   }