From nobody Sat May 4 18:13:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510709285930540.3632651820691; Tue, 14 Nov 2017 17:28:05 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B2A8420349DAA; Tue, 14 Nov 2017 17:23:55 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 B3EE221A134A8 for ; Tue, 14 Nov 2017 17:23:54 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 17:28:02 -0800 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.51]) by fmsmga006.fm.intel.com with ESMTP; 14 Nov 2017 17:28:02 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,397,1505804400"; d="scan'208";a="176301732" From: Michael D Kinney To: edk2-devel@lists.01.org Date: Tue, 14 Nov 2017 17:27:58 -0800 Message-Id: <20171115012758.6820-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 Subject: [edk2] [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: , Cc: Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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_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 Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney Reviewed-by: Star Zeng --- 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 --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel