From nobody Tue May 7 01:13:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66550+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66550+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1603416916; cv=none; d=zohomail.com; s=zohoarc; b=QuGXi+6oS858HXuCzfU47uLpkfXwRxFpbZ81NdtlHT4vbMfV//znP1EepSH7N71RznevO/ynk8Q7ZZVrmqC5Wnw5/Fxu0WjJq+e17DK2JqUtRJruPDwLeug/pHnHomhVsHwZSgC2kcFp8KILz6xCDgf6OcfVKkB0Pz1zaabJ8O0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603416916; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=d0h7eMoOYlEv9eT0oe1gB2EDVWWIMoP2DHIsNFulKxY=; b=CK2G5hFnQjq/96lgNKTQ0f4p+fPgZbhpTwrKJvmPn2eeh2DcCnw5J+C6mtF+886/m/Zf0hcKqztx2/EciXFwPkQNGKAmgkTbO+PQ2vumnlnqf+oav8XzkwGfZgRDLDPgp32I5YmxBuQjJBi+bHZmN7jojIl8Ln0fQj5GLYQGQQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66550+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1603416916271133.577584262286; Thu, 22 Oct 2020 18:35:16 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rcSRYY1788612xjkzj0vTSmo; Thu, 22 Oct 2020 18:35:15 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web09.2537.1603416915289708784 for ; Thu, 22 Oct 2020 18:35:15 -0700 IronPort-SDR: 67jyQmr6yoHjFV231Qg7ryLtyXMRZgkLQAI/oABLf2Ey4UW7SuX0W0HVlksIYElMmL3+wo/is/ 0qNQZ8sgSYZg== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="165024634" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="165024634" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 18:35:14 -0700 IronPort-SDR: ZVG+oV12VOZPwlshul3FFfWTDUewbm2fdbt5xXFnstSmZW2aTwYd6rpnpdukEiXHyu24HX7DYY cGISbW0ns60Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="316927432" X-Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.154]) by orsmga003.jf.intel.com with ESMTP; 22 Oct 2020 18:35:13 -0700 From: "Heng Luo" To: devel@edk2.groups.io Cc: Ray Ni , Hao A Wu Subject: [edk2-devel] [Patch V4] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure Date: Fri, 23 Oct 2020 09:26:11 +0800 Message-Id: <20201023012611.4808-1-heng.luo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,heng.luo@intel.com X-Gm-Message-State: 4HZsaxUqiESnYafySunpQneHx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1603416915; bh=JVsveswwM5fR+mQ/9fDV1rlmkQpSu5hfJgzW40lotIY=; h=Cc:Date:From:Reply-To:Subject:To; b=hBcD9kelroSrt+fWw7vDWsSvmCSgApALkOgHtxWQ45WPxcKqRAk2D85tbaCiY5Ql9EH XBl496fZGaFN5MYN5jvPqY5bd6vN0GKctz7Xz3rNa7rYUT+zxtiRF8I/s5yC5WPHpJqWt +Zgcw9G8dNAjiQsrQY7y66DAkScEc+H8MSo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3007 Currently UsbDevContext is not cleaned up if USB slot initialization is failed, the wrong context data will affect next USB devices and the USB devices can not be enumerated. Need to disable slot if USB slot initialization is failed. Below test cases are passed on UpXtreme: a. USB 3.0 thumb drives can be recognized in UEFI shell b. SUT can boot to Puppylinux from USB3.0 mass storage, the storage can be recognized in linux c. Plug in a USB keyboard (hot plug) and enumeration is OK in UEFI shell and linux d. Plug in a USB mouse(hot plug) and enumeration is OK in linux. Cc: Ray Ni Cc: Hao A Wu Signed-off-by: Heng Luo Reviewed-by: Hao A Wu Reviewed-by: Jon Hunter Tested-by: Jon Hunter --- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciSched.c index 9cb115363c..00e9cc63d6 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -2,7 +2,7 @@ =20 XHCI transfer scheduling routines. =20 -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -2279,6 +2279,9 @@ XhcInitializeDeviceSlot ( DeviceAddress =3D (UINT8) ((DEVICE_CONTEXT *) OutputContext)->Slot.Dev= iceAddress; DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAd= dress)); Xhc->UsbDevContext[SlotId].XhciDevAddr =3D DeviceAddress; + } else { + DEBUG ((DEBUG_INFO, " Address %d assigned unsuccessfully\n")); + XhcDisableSlotCmd (Xhc, SlotId); } =20 return Status; @@ -2489,7 +2492,11 @@ XhcInitializeDeviceSlot64 ( DeviceAddress =3D (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)->Slot.= DeviceAddress; DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAd= dress)); Xhc->UsbDevContext[SlotId].XhciDevAddr =3D DeviceAddress; + } else { + DEBUG ((DEBUG_INFO, " Address %d assigned unsuccessfully\n")); + XhcDisableSlotCmd64 (Xhc, SlotId); } + return Status; } =20 --=20 2.24.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66550): https://edk2.groups.io/g/devel/message/66550 Mute This Topic: https://groups.io/mt/77744149/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-