From nobody Fri Apr 19 14:45:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+66232+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+66232+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1602726605; cv=none; d=zohomail.com; s=zohoarc; b=H90IARzXnQ9ew7PoKCVXDP/NpXC/e+UGamAJd8GNNJsfMgQ0w5DqDsbww3RsawWJA1e0It+h7/lSPTW9O8nFl4kVaclIeidA/dcRVz8Nfj7ZrRqstqgaiLnBCYx96xYjKaZLz8zbNDSu1x5h8uAXKXRnRTLo5dxE1iDENaKcF9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602726605; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=x8y3PQEkkhT2tHrEsonYXKW4VE7Nhk97p4ahuKLtGHc=; b=itbpqME8AY8KDZ44TdsAHqLximu9vNRY0RaVHO7C78cwkT8wjiV+vtwG5QgUv06N6LXa+w96wgh7URRssnEuWDNQELLXINndDpRj12rLytt4ZHAMHqhx+dpRhX3dhmkQleHDjkB2Lfu6xDsR37apLFKTb253FIhzXNWQDpTy+CY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+66232+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1602726605755322.52543067907834; Wed, 14 Oct 2020 18:50:05 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id j5dDYY1788612xEjZCbFdEyT; Wed, 14 Oct 2020 18:50:05 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.3398.1602726604225638273 for ; Wed, 14 Oct 2020 18:50:04 -0700 IronPort-SDR: dS8kgdwRi72jZA0Hhxpp7HoNHkqsID6iYfbmaDPtHrvCdcsKiwbLktGgaPSZu9FR+taxVOdr0e RQ8sLHD0b2cw== X-IronPort-AV: E=McAfee;i="6000,8403,9774"; a="154063496" X-IronPort-AV: E=Sophos;i="5.77,376,1596524400"; d="scan'208";a="154063496" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 18:50:03 -0700 IronPort-SDR: SDfGPiY+8B7evixUOQ2aNpBV9oCSWg0MwNPyTSrITOmnThEIp4bTO6NZah8udOXJqM/Q7kk/XJ BvF8zkRRgaYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,376,1596524400"; d="scan'208";a="531065319" X-Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.154]) by orsmga005.jf.intel.com with ESMTP; 14 Oct 2020 18:50:02 -0700 From: "Heng Luo" To: devel@edk2.groups.io Cc: Ray Ni , Hao A Wu Subject: [edk2-devel] [PATCH] XhciDxe: Clean up UsbDevContext if USB slot initialization is failed Date: Thu, 15 Oct 2020 09:49:00 +0800 Message-Id: <20201015014901.1154-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: v75sa3MxHsPcwQwcHpnaylyBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602726605; bh=FMy8Goe9BC6U1+GUOJOHkIaWPXMf24SwSm7bZsCEV7k=; h=Cc:Date:From:Reply-To:Subject:To; b=rgMUNoMVDdGYiQTubA/i7Abh7LpidXAzhc09FmT9GEExAZQPJdOFxnGCZaDQi4o6IE1 Hz28yNyMHyin+nP6B74PK7mD6JZQkPqFFmDow5N/W7v42UgHOl8outzQtam0+OV3VFLJk jNi1/ZX94ZqZBbYO627uTCgi4h3T40b3Z94= 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 clean up UsbDevContext if USB slot initialization is failed. 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..1e8430ac34 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, clean up = context data.\n")); + ZeroMem (&Xhc->UsbDevContext[SlotId], sizeof (USB_DEV_CONTEXT)); } =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, clean up = context data.\n")); + ZeroMem (&Xhc->UsbDevContext[SlotId], sizeof (USB_DEV_CONTEXT)); } + 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 (#66232): https://edk2.groups.io/g/devel/message/66232 Mute This Topic: https://groups.io/mt/77519924/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-