From nobody Tue Apr 30 04:15:52 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 1510178576640810.4129741462884; Wed, 8 Nov 2017 14:02:56 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 74F292035520F; Wed, 8 Nov 2017 13:58:53 -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 A854221B00DCB for ; Wed, 8 Nov 2017 13:58:51 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 08 Nov 2017 14:02:52 -0800 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.40]) by fmsmga002.fm.intel.com with ESMTP; 08 Nov 2017 14:02:52 -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,365,1505804400"; d="scan'208";a="1241706038" From: Michael D Kinney To: edk2-devel@lists.01.org Date: Wed, 8 Nov 2017 14:02:49 -0800 Message-Id: <20171108220249.15404-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 Subject: [edk2] [Patch] MdeModulePkg/UsbMassStorageDxe: Fix USB Mass Storage detection 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=3D766 Update logic to not return an error from UsbBootRequestSense() if a Request Sense command responds with no sense information. It is legal for a USB mass storage device to respond to a Request Sense command with a SenseKey of USB_BOOT_SENSE_NO_SENSE and an Additional Sense Code of USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION. This is described in Section 3.3 of the Universal Serial Bus Mass Storage Specification For Bootability: http://www.usb.org/developers/docs/devclass_docs/usb_msc_boot_1.0.pdf The previous logic returned an error of EFI_NO_RESPONSE and this caused USB mass storage devices such as a USB floppy drive to not be detected. 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 | 11 +++++++++-- MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h | 9 +++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModu= lePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c index 0c46f888eb..2eb30f0c5f 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c @@ -2,7 +2,7 @@ Implementation of the command set of USB Mass Storage Specification for Bootability, Revision 1.0. =20 -Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -80,7 +80,14 @@ UsbBootRequestSense ( switch (USB_BOOT_SENSE_KEY (SenseData.SenseKey)) { =20 case USB_BOOT_SENSE_NO_SENSE: - Status =3D EFI_NO_RESPONSE; + if (SenseData.Asc =3D=3D USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION)= { + // + // It is not an error if a device does not have additional sense inf= ormation + // + Status =3D EFI_SUCCESS; + } else { + Status =3D EFI_NO_RESPONSE; + } break; =20 case USB_BOOT_SENSE_RECOVERED: diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h b/MdeModu= lePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h index c4082558fa..13a926035c 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h @@ -2,7 +2,7 @@ Definition of the command set of USB Mass Storage Specification for Bootability, Revision 1.0. =20 -Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -51,9 +51,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHE= R EXPRESS OR IMPLIED. #define USB_BOOT_SENSE_VOLUME_OVERFLOW 0x0D ///< Partition overflow #define USB_BOOT_SENSE_MISCOMPARE 0x0E ///< Source data mis-match wh= ile verfying. =20 -#define USB_BOOT_ASC_NOT_READY 0x04 -#define USB_BOOT_ASC_NO_MEDIA 0x3A -#define USB_BOOT_ASC_MEDIA_CHANGE 0x28 +#define USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION 0x00 +#define USB_BOOT_ASC_NOT_READY 0x04 +#define USB_BOOT_ASC_NO_MEDIA 0x3A +#define USB_BOOT_ASC_MEDIA_CHANGE 0x28 =20 // // Supported PDT codes, or Peripheral Device Type --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel