From nobody Sat Apr 27 18:37:38 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+66441+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+66441+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1603163807; cv=none; d=zohomail.com; s=zohoarc; b=MWQnlwS6kVzfMb8osqWrIR6+606VkxAQT7ZyybwUjojlGY7LnCpIMsnCzZgkeMyh30oHoG6SdzwqA0CBj1aSa8b2iq+ge726fVugyPfcuPDNlaZfr8Xws/2l3Ep2L/cTd5r1beUCmAZ6TXF6wef6J2+cWGASEiTgPJaWAjJe8CY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603163807; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=DaJciXv+KyRVAbHuT/s/RHsSTqvpJG/DzC2rmGVkydA=; b=joa5YD4WC9XEaU8VbS2zI8T3L0xs7vgPQ0UpXIRrSNb6oFl2BEeTM4crLKIZB/APksmoAL66wHZpzPVYW18nfZ9gOSud0BpwyJJDITuX0scrAH7Q4r/hCt/M3J1RCzmugO+L0Pr8GsDWiYe8sSiZYF/Lxa82VeaaIk8gZtw8eGY= 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+66441+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 1603163807399916.9968693257508; Mon, 19 Oct 2020 20:16:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yHZvYY1788612xbqF3NoL3pw; Mon, 19 Oct 2020 20:16:47 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.11498.1603163806627506141 for ; Mon, 19 Oct 2020 20:16:46 -0700 IronPort-SDR: dya2eEn0wHjwsCdt3WiIub++DfaupQakG0ULHKzkd8F/LH365tjg98yGDne+niZcFi6w33Bbuv NZ57miRPRjpw== X-IronPort-AV: E=McAfee;i="6000,8403,9779"; a="251839335" X-IronPort-AV: E=Sophos;i="5.77,396,1596524400"; d="scan'208";a="251839335" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2020 20:16:46 -0700 IronPort-SDR: BNde0vnK0+dWEbrBC3y9KIKyK7+15uiblzBZq9dw1AJyNtx6hunTLxg2g6abLFa4LFHdm9TwIC C3KLaU9XnFcg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,396,1596524400"; d="scan'208";a="347690846" X-Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.154]) by fmsmga004.fm.intel.com with ESMTP; 19 Oct 2020 20:16:45 -0700 From: "Heng Luo" To: devel@edk2.groups.io Cc: Ray Ni , Hao A Wu Subject: [edk2-devel] [Patch V2] MdeModulePkg/XhciDxe: Error handle for USB slot initialization failure Date: Tue, 20 Oct 2020 11:15:46 +0800 Message-Id: <20201020031546.2430-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: DOo431ciTzZC2tCn4P4RTtGvx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1603163807; bh=37Y8yPg7ZTw/zuOXsFAmM2QSYSjNMIsAuhr6JiKvBRE=; h=Cc:Date:From:Reply-To:Subject:To; b=C7TtCV9rfzqggqYq8HUPeHEmxFP/s2evZMioT8eoMMFRowO53poZ1aFKDft4uWBrD8t ynrzWl4HFtN7eh7TjhkHqOYWj477It++uW+9SDC1LV9euEfvuvBK6PBKf2nr7R6CkMma8 8PioFJUnKZCvvhKu/ocnAFbYAa2fKL1V7fk= 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 --- 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..55f207aec4 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")); + Status =3D 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")); + Status =3D XhcDisableSlotCmd (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 (#66441): https://edk2.groups.io/g/devel/message/66441 Mute This Topic: https://groups.io/mt/77674808/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-