From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 6762A2034EE26 for ; Thu, 16 Nov 2017 02:55:01 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Nov 2017 02:59:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,402,1505804400"; d="scan'208";a="2469946" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 16 Nov 2017 02:59:09 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 16 Nov 2017 02:59:09 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Thu, 16 Nov 2017 18:59:08 +0800 From: "Zeng, Star" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Zeng, Star" Thread-Topic: [Patch] MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Handling Thread-Index: AQHTXbD+WNatE9BFKkCFbj74eYjWb6MW1/oQ Date: Thu, 16 Nov 2017 10:59:07 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9B63C9@shsmsx102.ccr.corp.intel.com> References: <20171115012758.6820-1-michael.d.kinney@intel.com> In-Reply-To: <20171115012758.6820-1-michael.d.kinney@intel.com> 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] MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Handling X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2017 10:55:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 Thanks, Star -----Original Message----- From: Kinney, Michael D=20 Sent: Wednesday, November 15, 2017 9:28 AM To: edk2-devel@lists.01.org Cc: Zeng, Star ; Dong, Eric Subject: [Patch] MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Hand= ling https://bugzilla.tianocore.org/show_bug.cgi?id=3D782 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_ATT= ENTION and an Additional Sense Key of USB_BOOT_ASC_NO_MEDIA for a few secon= ds 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 re= ties the command 5 times before failing completely. With this change the USB Flash Drive works correctly. Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney --- MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModu= lePkg/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 =3D EFI_MEDIA_CHANGED; Media->ReadOnly =3D FALSE; Media->MediaId++; + } else if (SenseData.Asc =3D=3D USB_BOOT_ASC_NOT_READY) { + Status =3D EFI_NOT_READY; + } else if (SenseData.Asc =3D=3D USB_BOOT_ASC_NO_MEDIA) { + Status =3D EFI_NOT_READY; } break; =20 -- 2.14.2.windows.3