public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Dong, Eric" <eric.dong@intel.com>, "Zeng, Star" <star.zeng@intel.com>
Subject: Re: [Patch] MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Handling
Date: Thu, 16 Nov 2017 10:59:07 +0000	[thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9B63C9@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20171115012758.6820-1-michael.d.kinney@intel.com>

Mike,

Returning EFI_NOT_READY for USB_BOOT_ASC_NO_MEDIA seems a little confusing, but based on the real case, I am ok with the patch.

Reviewed-by: Star Zeng <star.zeng@intel.com>


Thanks,
Star
-----Original Message-----
From: Kinney, Michael D 
Sent: Wednesday, November 15, 2017 9:28 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>
Subject: [Patch] MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Handling

https://bugzilla.tianocore.org/show_bug.cgi?id=782

Update the Request Sense check for the Request Sense Key of USB_BOOT_SENSE_UNIT_ATTENTION.  For this Sense Key, the Additional Sense Key to EFI_STATUS mappings are:

USB_BOOT_ASC_MEDIA_CHANGE -> EFI_MEDIA_CHANGE
USB_BOOT_ASC_NOT_READY    -> EFI_NOT_READY
USB_BOOT_ASC_NO_MEDIA     -> EFI_NOT_READY
All others                -> EFI_DEVICE_ERROR

A USB flash drive is returning Request Sense Key of USB_BOOT_SENSE_UNIT_ATTENTION and an Additional Sense Key of USB_BOOT_ASC_NO_MEDIA for a few seconds before returning an Additional Sense Key of USB_BOOT_ASC_MEDIA_CHANGE.

The current logic treats this initial Request Sense info as an error and reties the command 5 times before failing completely.

With this change the USB Flash Drive works correctly.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
index 2eb30f0c5f..a8b6a1c5f1 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
@@ -120,6 +120,10 @@ UsbBootRequestSense (
       Status = EFI_MEDIA_CHANGED;
       Media->ReadOnly = FALSE;
       Media->MediaId++;
+    } else if (SenseData.Asc == USB_BOOT_ASC_NOT_READY) {
+      Status = EFI_NOT_READY;
+    } else if (SenseData.Asc == USB_BOOT_ASC_NO_MEDIA) {
+      Status = EFI_NOT_READY;
     }
     break;
 
--
2.14.2.windows.3



      reply	other threads:[~2017-11-16 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15  1:27 [Patch] MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Handling Michael D Kinney
2017-11-16 10:59 ` Zeng, Star [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0C09AFA07DD0434D9E2A0C6AEB0483103B9B63C9@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox