From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.10630.1587906303597885225 for ; Sun, 26 Apr 2020 06:05:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=cJ6j5p/I; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: guomin.jiang@intel.com) IronPort-SDR: CmGmPXI1s4vSn8qruXiTJ5JLyMTVhuUGxpWLfTKpGiK3h/WPDro7LJafk/rHrH+mjPJu/cMwUp UCDYCXn3OMPw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2020 06:05:02 -0700 IronPort-SDR: jSANCYaHOlMNKdaizMbEA9Vs84SQ6a19kTWL1c1q31YqtuHGYIdv46VsQjGkOi1jqS6evwlxVz 4BYfOEuO1/Pw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,320,1583222400"; d="scan'208";a="458020198" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by fmsmga005.fm.intel.com with ESMTP; 26 Apr 2020 06:05:01 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 26 Apr 2020 06:05:01 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 26 Apr 2020 06:05:01 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 26 Apr 2020 06:05:01 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.45) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 26 Apr 2020 06:05:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbmR4dvR4p8YEMVlQZkmqp4zrSPrEwLqAWbv8CK25HQnvjzd+TDY1JT9AARtAj4TcS6mR9Wg6sB0znikZL6ItONjo/UaWNET0qVVd/FdN3orPhOqENHTxf0X278cXjPKeNQO/XWTxt2rs5rQsc0XsiGIXlTqeXe80TkvF7XaS9eh6LyWxB+i1/3ubPxCiCp5quU/pj4NVPfFOW0k+ZR4RxYs9zP2Mq2WrmHNA8sl+ZoY6h1hENUlv5RkyIb75f5OUHTPy+zsSXRCKLen4XsYWrLlAx0Cp9UkJhksy3Ql1YVcJbAjG3XwxyUCDeQ8JYQyzhrKVpBgpZMt5q/XGgIVpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z0mdW7iH/q06cV4IpjpmbyXt7GAR9R8OI8ADTDJXBbc=; b=aQHMkyWc7OWSYTFUZXLLOw4cuYPI0X34od9qbjzRcnGskC1YjRnrHFJnvTatKFLw4Bs275/pmXSXXVD7UaaAsHdldPlh6RNjZC1joiP4BOjR9G/S9ueHE7aq/gDjAua/EUNI6Kta6dW41N1kCV8IfEcKAU8yMOnY23KnhLFbSJTAOg0bAGAjogrDKW2aCLLJx+Q/tJ/U2VE/WoyXEoIXMHfrSvFHTO+ryP6XczUK8ItbH8/TSA6Qi46p+xet8qVmk8ivNphJbiS8p2N9+ypiJKKBN6Ne7vCYEAtIAsL59iuCK2PYciENA04U4rxdJNLnXvdSBYYS4wGuyVJr0gOGxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z0mdW7iH/q06cV4IpjpmbyXt7GAR9R8OI8ADTDJXBbc=; b=cJ6j5p/I+9nhQ/vmfwLL3zDshSbjTGoRY+Nh4njtmfzV5FzgH2ggHh4/l8tx0Zp/PlNHAc6UFSq9dcqF2aFvfNU4DhKt6b4/G8oX26lcDZKosyVakA177Mi++xPoAXF3a01KTR+CZqVkuSx9J6UA0JySX4KLaiB7HOuFsKteo9s= Received: from DM6PR11MB2955.namprd11.prod.outlook.com (2603:10b6:5:65::31) by DM6PR11MB2681.namprd11.prod.outlook.com (2603:10b6:5:bd::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Sun, 26 Apr 2020 13:04:59 +0000 Received: from DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::ccd4:4b0d:535a:58be]) by DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::ccd4:4b0d:535a:58be%7]) with mapi id 15.20.2921.030; Sun, 26 Apr 2020 13:04:58 +0000 From: "Guomin Jiang" To: "Wu, Hao A" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Rebuild the description table after Reset Device Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Rebuild the description table after Reset Device Thread-Index: AQHWGqH+6oJcz8EY40K8DVzwoZo6F6iK2sQggAACMZCAAA8QEIAAHB0QgABHW8A= Date: Sun, 26 Apr 2020 13:04:58 +0000 Message-ID: References: <20200425013620.1159-1-guomin.jiang@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: spf=none (sender IP is ) smtp.mailfrom=guomin.jiang@intel.com; x-originating-ip: [134.191.221.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 959100fa-a104-4e58-e0bb-08d7e9e26c94 x-ms-traffictypediagnostic: DM6PR11MB2681: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 03853D523D x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB2955.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(136003)(376002)(396003)(366004)(39860400002)(346002)(19627235002)(4326008)(7696005)(6506007)(53546011)(55016002)(186003)(86362001)(9686003)(8676002)(8936002)(110136005)(54906003)(107886003)(81156014)(33656002)(52536014)(71200400001)(76116006)(478600001)(66556008)(66946007)(66476007)(66446008)(966005)(64756008)(316002)(30864003)(26005)(5660300002)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tn7jhlJ8qa//G2rOxB3MGMi9ITF8D3f7BXt8vUBpWWO0LylCRNpiquAOOx3tXaZiJqQd1NdUOuTT24X6d4jDPTlv42gsoZJAloYrw4X9VHVmOJUL7r/PLM8IxzVTuQdkLGcwb36tpoOqS8e+4zEHgdtOYBLfGVJ2D3ZpfqwC10OyaHbYObNGXCcexI0LClyfFNiEPx5I2MSsxRrg1Tg3NjhXXd3kaQIS6he4Ui1hN7fNS6QVeYdskfueN8buBeft8FdhfS7XHLX9XvjGPx/ZMv+p1qVlBGpckaJvarJN1eMu0N9jHmWROr3V5RN/TFEQv/9FRXXZlekwtlQqITBHx9ZilLmXjB4KBYR1GiZNsVz+CR2UWW8ZZV3PP/vWRMfnHi/RBFptMhi+UAtISDw543cN2Aw5gmQhsmS1o6aRQlrXSPKon+AwCMark/uiieXB4mC6qqmCKQZZtE42b9t9qH7mNGWLLBxpUZpV0groUE2zA2p8xrMnEl/wKiSR6J0Gv7v6CqBRbIUuljO0aQSW5A== x-ms-exchange-antispam-messagedata: 8kjDxInhrWz4lNv/VmDVN/Mdwp7C60sn4yhX5J8DvP0wpi6MJQAU4jbPAlFmDH2U0ww5AlVi/LL0H0ahbSB/ahR4aMgqmhtygcVfqQ0DKL8NCYMhkm4/1TfuLhzKlcQ0yZ3Xjpi4hN1xu109TznluJhT5DUr8x1v+U5Os38pzfD0XzvsGeZn9W4e5rmbw3TCMDpUCPmyUVo9yqSHyiGPLdi8t6su/sEkKtuCO28+bfrL26rHVwSXObm8VMKfxC9hhR9uGV54lVpZ+GdhiUDOTQSrriYNIxqf8cXfDK6DU8TWLfTwqBv1w48O/3f/Vy2XYR4ESgsh8sECh4xh4OvgQPwXgV/sZZmEHEf03TYQMHPjEpWMrbSo67/0ExCiJooUEpL/Q9a2y0k7pk04+sfellf0JOohdIcpP0a3QIciig3q9jJEqW8Zo4A5z3E1h4k5mPrQntBQs72f6J5TTc5ZA5gvQKxXpHlcc7TrjrZmUyPHSHGLIqAg8a2TBbLK953vPgMznjo/7BA+jgIdf16cxjitArI1unMDVsQ4ccy1uQAv71gzfDWzgd2vR09iFr1e7ElvYy6ef2fHQBuIqHglNfvg0vh2rVF4td8IZUszlDSnTb6tnA3Km/aIMJ5rCCiWViph4DtkZcOEllCBULh6WCVJsHhqQTMOgXqilsYuhkwDIEbCKteT7eCwlbiACiYR/e7AZ4ZcmMXvhLDDQFqko168JjzZe6kZmzwnY8jMgQb+Kkz6VlLsn8QKoKmGax6ZlhCjgF6wJDO0aji4V7jq/lGKGvAR/0bD5VegZrDM+kOFgnVvAwckEHPvVEXL9MUD MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 959100fa-a104-4e58-e0bb-08d7e9e26c94 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2020 13:04:58.8502 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: P9E+QFNuGsMWu8ZUq3PuFpsPPtUZA4JJgYpjLfoLHgD0pIdzp0ikQWNEZ4qKOpeeJJOaxwrdMChbdtzIwMKGPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2681 Return-Path: guomin.jiang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Add comment inline. > -----Original Message----- > From: Wu, Hao A > Sent: Sunday, April 26, 2020 4:04 PM > To: Jiang, Guomin ; devel@edk2.groups.io > Cc: Wang, Jian J ; Ni, Ray > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Rebuild the > description table after Reset Device >=20 > > -----Original Message----- > > From: Jiang, Guomin > > Sent: Sunday, April 26, 2020 2:44 PM > > To: Wu, Hao A; devel@edk2.groups.io > > Cc: Wang, Jian J; Ni, Ray > > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Rebuild > the > > description table after Reset Device > > > > Hi Hao, > > > > Add comments inline. > > > > > -----Original Message----- > > > From: Wu, Hao A > > > Sent: Sunday, April 26, 2020 1:12 PM > > > To: devel@edk2.groups.io; Wu, Hao A ; Jiang, > > Guomin > > > > > > Cc: Wang, Jian J ; Ni, Ray > > > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Rebuild > > > the description table after Reset Device > > > > > > > -----Original Message----- > > > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf > > Of > > > > Wu, Hao A > > > > Sent: Sunday, April 26, 2020 1:10 PM > > > > To: Jiang, Guomin; devel@edk2.groups.io > > > > Cc: Wang, Jian J; Ni, Ray > > > > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: > Rebuild > > > the > > > > description table after Reset Device > > > > > > > > > -----Original Message----- > > > > > From: Jiang, Guomin > > > > > Sent: Saturday, April 25, 2020 9:36 AM > > > > > To: devel@edk2.groups.io > > > > > Cc: Wang, Jian J; Wu, Hao A; Ni, Ray > > > > > Subject: [PATCH] MdeModulePkg/UsbBusDxe: Rebuild the > description > > > > > table after Reset Device > > > > > > > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2694 > > > > > > > > > > When the USB fail and then Reset Device, it should rebuild descr= iption. > > > > > > > > > > Signed-off-by: Guomin Jiang > > > > > Cc: Jian J Wang > > > > > Cc: Hao A Wu > > > > > Cc: Ray Ni > > > > > --- > > > > > MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 5 +++++ > > > > > 1 file changed, 5 insertions(+) > > > > > > > > > > diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c > > > > > b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c > > > > > index 4b4915c019..9f2d2cc87f 100644 > > > > > --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c > > > > > +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c > > > > > @@ -869,6 +869,11 @@ UsbIoPortReset ( > > > > > > > > > > > > > > > DEBUG (( EFI_D_INFO, "UsbIoPortReset: device is now ADDRESSED > > > > > at %d\n", Dev->Address)); > > > > > > > > > > > > > > > > > > > > + // > > > > > > > > > > + // The description will be invalid after reset, should rebuil= d it as well. > > > > > > > > > > + // > > > > > > > > > > + UsbBuildDescTable (Dev); > > > > > > > > > > > > Hello Guomin, > > > > > > > > Thanks for the proposed patch. > > > > > > > > Could you help to explain in more detail for the above fix with > > > > regard to the transfer ring not being set properly in the XHCI dri= ver? > Thanks. > > > > When I debug, I dump the below data structure and found that before > > UsbMassReset, the corresponding slot transfer ring is normal and > > invalid after UsbMassReset. > > USB_DEV_CONTEXT =3D 0x148 > > +0x0 Enabled > > +0x1 SlotId > > +0x4 RouteString > > +0x8 ParentRouteString > > +0xC XhciDevAddr > > +0xD BusDevAddr > > +0x10 InputContext > > +0x18 OutputContext > > +0x20 EndpointTransferRing[31] > > +0x118 DevDesc > > +0x130 ConfDesc > > +0x138 ActiveConfiguration > > +0x140 ActiveAlternateSetting > > > > Before UsbMassReset > > 000002D0: -01 01 00 00 00 0= 0 10 10 > > 000002E0: 00 00 00 00 01 01 00 00-80 02 FA 06 00 00 00 00 > > 000002F0: C0 16 FA 06 00 00 00 00-98 27 FC 06 00 00 00 00 > > 00000300: 00 00 00 00 00 00 00 00-98 26 FC 06 00 00 00 00 > > 00000310: 98 BE F9 06 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000320: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000330: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000340: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000350: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000360: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000370: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000380: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000390: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003A0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003B0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003C0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003D0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003E0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003F0: 12 01 00 03 00 00 00 09-F4 46 01 00 00 00 01 02 > > 00000400: 03 01 00 00 00 00 00 00-98 CD F9 06 00 00 00 00 > > 00000410: 01 00 00 00 00 00 00 00-18 24 FC 06 00 00 00 00 > > > > After UsbMassReset > > 000002D0: -01 01 00 00 00 00= 10 10 > > 000002E0: 00 00 00 00 01 01 00 00-80 02 FA 06 00 00 00 00 > > 000002F0: C0 16 FA 06 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000300: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000310: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000320: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000330: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000340: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000350: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000360: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000370: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000380: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000390: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003A0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003B0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003C0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003D0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003E0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 000003F0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000400: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > 00000410: 01 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 > > > > After Reset Finished, it will try to get data again by sending command > > to Usb Mass Device and it will use USB_DEV_CONTEXT. > EndpointTransferRing[4]. > > But it haven't been initialized after reset, and ASSERT will trigger > > when access the USB_DEV_CONTEXT. EndpointTransferRing and will show > > ASSERT > > > c:\users\guominji\dcg10nm\edk2\MdeModulePkg\Bus\Pci\XhciDxe\XhciSch > e > > d.c(1909): TrsRing !=3D ((void *) 0) > > > > The EndpointTranferRing should be initialized by UsbBuildDescTable() > > but seem that it is omitted in Reset branch, so I add it. >=20 >=20 > Sorry Guomin, I still do not fully understand the link between calling t= he > UsbBuildDescTable() in UsbBusDxe and the re-initialization of the > 'EndpointTranferRing' in the XhciDxe. Could you help to provide more det= ail? I am sorry that make confusion to you, I will explain it in detail now. 1. The critical call flow as below UsbMassReset() --> UsbMass->Transport->Reset() =3D=3D UsbBotResetDevice() --> UsbBot->UsbIo->UsbPortReset() =3D=3D UsbIoPortReset() --> UsbIf->Device->ParentIf->HubApi->ResetPort() =3D=3D UsbRoot= HubResetPort() --> UsbHcGetRootHubPortStatus() --> UsbBus->Usb2Hc-GetRootHubPortStatus() =3D=3D Xh= cGetRootHubPortStatus() --> XhcPollPortStatusChange() --> XhcDisableSlotCmd() or XhcDisableSlo= tCmd64() [Very very critical routine 1] --> XhcInitializeDeviceSlot() or XhcInit= ializeDeviceSlot64() [Very very critical routine 2] --> UsbSetAddress() --> UsbSetConfig() --> UsbBus->Usb2Hc->ControlTransfer() =3D=3D XhcControlT= ransfer() --> XhcSetConfigCmd() or XhcSetConfigCmd64() [Very= very critical routine 3] There are three very very critical routine, 1. XhcDisableSlotCmd() or XhcDisableSlotCmd64() will disable the slot cont= ext and free the allocated memory. 2. XhcInitializeDeviceSlot() or XhcInitializeDeviceSlot() will initialize = the basic control and slot endpoint transfer ring. 3. XhcSetConfigCmd() or XhcSetConfigCmd64() will configure the other trans= fer ring. It depend on Xhc->UsbDevContext[Slot].DevDesc.NumConfigurations,= unfortunately, the DevDesc haven't benn initialized by UsbBuildDescTable a= nd it is 0. So XhcSetConfigCmd() or XhcSetConfigCmd64() haven't run. After run below 3 critical routine, the device is initialize but EndpointT= ransferRing of Input and Output haven't been initialized and still keep NUL= L. When UsbMassReadBlocks, it will use uninitialized EndpointTransferRing and= will ASSERT. > Another thing I found (if current proposed fix is a proper solution) is = that in > UsbBuildDescTable() , several memory allocations will be made to store t= he > device descriptor/config descriptor. Could you help to double check if t= heir > old values are properly freed in order to avoid memory leak? >=20 I will investigate it and give you feedback. =20 > Best Regards, > Hao Wu >=20 >=20 > > > > > > > > > > Also, judging from the function description comments in > > > UsbBuildDescTable(): > > > > |> /** > > > > |> Build the whole array of descriptors. This function must > > > > |> be called after UsbGetMaxPacketSize0 returns the max packet > > > > |> size correctly for endpoint 0. > > > > |> ... > > > > |> **/ > > > > |> EFI_STATUS > > > > |> UsbBuildDescTable ( > > > > |> IN USB_DEVICE *UsbDev > > > > |> ) > > > > > > > > Does function UsbGetMaxPacketSize0() need to be called before > > > > UsbBuildDescTable() in the proposed fix? > > > > I ignored it and will double check it. > > > > > > > > > > > One more thing, could you help to add the information for what tests > > > have been done for the proposed patch as well? > > > > > > Thanks in advance. > > > > > > > Have test OVMF and test pass, detail as below I use qemu-w64-2020020, > > you should install it first and add it to PATH environment, the > > procedure as below 1. Import the test patch from > > https://bugzilla.tianocore.org/attachment.cgi?id=3D508 > > 2. type ```build -p OvmfPkg\OvmfPkgX64.dsc -b DEBUG -a X64``` to > > generate OVMF.fd 3. type ```qemu-img create file.img 1G``` to create > > test image. > > 4. type ```qemu-system-x86_64 -bios OVMF.fd -drive > > if=3Dnone,id=3Dstick,file=3Dfile.img -device nec-usb-xhci,id=3Dxhci, -= device > > usb- storage,bus=3Dxhci.0,drive=3Dstick -global isa-debugcon.iobase=3D= 0x402 > > - debugcon file:xhci.log``` 5. you will see hang currently and will > > see ASSERT when check xhci.log. > > 6. import proposal patch, the symptom disappear. > > > > > > > > > > > > > Best Regards, > > > > Hao Wu > > > > > > > > > > > > > > > > > > + > > > > > > > > > > // > > > > > > > > > > // Reset the current active configure, after this device > > > > > > > > > > // is in CONFIGURED state. > > > > > > > > > > -- > > > > > 2.25.1.windows.1 > > > > > > > > > > > >=20 > > > > > >=20