From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0711.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe46::711]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5A0C481EBD for ; Tue, 15 Nov 2016 18:01:00 -0800 (PST) Received: from AT5PR84MB0276.NAMPRD84.PROD.OUTLOOK.COM (10.162.138.22) by AT5PR84MB0276.NAMPRD84.PROD.OUTLOOK.COM (10.162.138.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10; Wed, 16 Nov 2016 02:00:48 +0000 Received: from AT5PR84MB0276.NAMPRD84.PROD.OUTLOOK.COM ([10.162.138.22]) by AT5PR84MB0276.NAMPRD84.PROD.OUTLOOK.COM ([10.162.138.22]) with mapi id 15.01.0721.015; Wed, 16 Nov 2016 02:00:48 +0000 From: "Anbazhagan, Baraneedharan" To: "Tian, Feng" , "edk2-devel@lists.01.org" Thread-Topic: USB hub port reset Thread-Index: AdI9P9a4p+GKnaQeTV6wi4G+bYD8YgA2K+ggAABY8XAABZq8YAARLQ7QAB6ZSoAAKoHsEAAEJAywAABir1A= Date: Wed, 16 Nov 2016 02:00:48 +0000 Message-ID: References: <7F1BAD85ADEA444D97065A60D2E97EE566E4F108@SHSMSX101.ccr.corp.intel.com> <7F1BAD85ADEA444D97065A60D2E97EE566E4F285@SHSMSX101.ccr.corp.intel.com> <7F1BAD85ADEA444D97065A60D2E97EE566E4FADD@SHSMSX101.ccr.corp.intel.com> <7F1BAD85ADEA444D97065A60D2E97EE566E5120B@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <7F1BAD85ADEA444D97065A60D2E97EE566E5120B@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=anbazhagan@hp.com; x-originating-ip: [66.135.176.178] x-microsoft-exchange-diagnostics: 1; AT5PR84MB0276; 7:xjYKzq0yi+h+vujit9GtzJ4n3Ezq3z9vu7qShsQ77Y2O+VRt0NsoIvZEBLrraN86ni+aWeEDlTFRmBI+oSIvC1szABW+Qa+Nz2m/A+y9DQvjvV3eWCcx0X/76LjYIPwfO+HBI3ODAvDoK5CyF1avc80QWibw+8O1kzbm5W0ZUnomBD3RDX7AAb6d+CNKRh3cjOAmtutaeEr7uJk86yZ8coMzseKdUpYCy3TAx6LsGIusQurlxE+bimXEP2VmNvf9yMxNAOlZ8wleH0WQrUlQEOVSkQkyvbYMBN0fFhxYnsJJsYxZYkYFMJEnshBP0oJsSuFjsFcgR/KHzAk48CfDyVYhcymb6eZpTH6ALERsAu0= x-ms-office365-filtering-correlation-id: 410bfa58-f643-46bc-ff10-08d40dc462ce x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:AT5PR84MB0276; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(166708455590820)(162533806227266)(228905959029699)(73583498263828); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6060326)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6061324); SRVR:AT5PR84MB0276; BCL:0; PCL:0; RULEID:; SRVR:AT5PR84MB0276; x-forefront-prvs: 01283822F8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(377454003)(6602003)(13464003)(189002)(199003)(92566002)(9686002)(3660700001)(8936002)(3280700002)(33656002)(7696004)(305945005)(107886002)(5001770100001)(97736004)(6506003)(68736007)(122556002)(102836003)(6116002)(87936001)(2906002)(229853002)(3846002)(7846002)(2501003)(7736002)(81156014)(3480700004)(93886004)(66066001)(2950100002)(74316002)(77096005)(5660300001)(76176999)(54356999)(99286002)(189998001)(50986999)(106356001)(2900100001)(86362001)(8676002)(105586002)(81166006)(101416001)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:AT5PR84MB0276; H:AT5PR84MB0276.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: hp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2016 02:00:48.8006 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: ca7981a2-785a-463d-b82a-3db87dfc3ce6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AT5PR84MB0276 Subject: Re: USB hub port reset X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2016 02:01:00 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Am OK with that. Need similar change in XhcPeiInitializeDeviceSlot and XhcP= eiInitializeDeviceSlot64 for PEI. -Baranee > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ti= an, > Feng > Sent: Tuesday, November 15, 2016 7:45 PM > To: Anbazhagan, Baraneedharan ; edk2- > devel@lists.01.org > Cc: Tian, Feng > Subject: Re: [edk2] USB hub port reset >=20 > I would prefer to keep the logic in UsbHubResetPort() unchanged to avoid = bring > other device identification impacts. >=20 > Thanks > Feng >=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Anbazhagan, Baraneedharan > Sent: Wednesday, November 16, 2016 7:56 AM > To: Tian, Feng ; edk2-devel@lists.01.org > Subject: Re: [edk2] USB hub port reset >=20 > Feng, > Below change solves the problem with a device behind the hub. Do we still= need the > 10ms delay in UsbHubResetPort function for manual port reset in case of X= HCI? >=20 > Thanks, > Baranee >=20 > -----Original Message----- > From: Tian, Feng [mailto:feng.tian@intel.com] > Sent: Monday, November 14, 2016 10:28 PM > To: Anbazhagan, Baraneedharan ; edk2- > devel@lists.01.org > Cc: Tian, Feng > Subject: RE: USB hub port reset >=20 > Baranee >=20 > Supposing are using latest usb code in EdkII trunk. >=20 > We send ADDRESS DEVICE CMD in XhcInitializeDeviceSlot(), which will cause= XHC > issue a USB SET_ADDRESS request to the USB Device. >=20 > There are two possible paths: > 1. Reset_Change bit gets set after connection without manually port reset= . > UsbHubGetPortStatus()->XhcPollPortStatusChange()->(if RESET_C bit is set)= - > >XhcInitializeDeviceSlot() 2. Reset_Change bit gets set after manually Re= set Port > operation. > UsbHubResetPort()->UsbHubSetPortFeature()->Stall(20)-> > UsbHubGetPortStatus()->(invoke above code in XHCI)->(if RESET_C bit is se= t)- > >Stall(10) >=20 > According to your info, it looks like we need add 10ms delay to > XhcInitializeDeviceSlot() like below: >=20 > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > index e37f674..bb68f34 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > @@ -2115,6 +2115,7 @@ XhcInitializeDeviceSlot ( > // 8) Issue an Address Device Command for the Device Slot, where the c= ommand > points to the Input > // Context data structure described above. > // > + gBS->Stall (10 * 1000); > ZeroMem (&CmdTrbAddr, sizeof (CmdTrbAddr)); > PhyAddr =3D UsbHcGetPciAddrForHostAddr (Xhc->MemPool, Xhc- > >UsbDevContext[SlotId].InputContext, sizeof (INPUT_CONTEXT)); > CmdTrbAddr.PtrLo =3D XHC_LOW_32BIT (PhyAddr); > @@ -2321,6 +2322,7 @@ XhcInitializeDeviceSlot64 ( > // 8) Issue an Address Device Command for the Device Slot, where the c= ommand > points to the Input > // Context data structure described above. > // > + gBS->Stall (10 * 1000); > ZeroMem (&CmdTrbAddr, sizeof (CmdTrbAddr)); > PhyAddr =3D UsbHcGetPciAddrForHostAddr (Xhc->MemPool, Xhc- > >UsbDevContext[SlotId].InputContext, sizeof (INPUT_CONTEXT_64)); > CmdTrbAddr.PtrLo =3D XHC_LOW_32BIT (PhyAddr); >=20 > Could you please have a try to see if it solves your problem? >=20 > Thanks > Feng >=20 > -----Original Message----- > From: Anbazhagan, Baraneedharan [mailto:anbazhagan@hp.com] > Sent: Monday, November 14, 2016 9:46 PM > To: Tian, Feng ; edk2-devel@lists.01.org > Subject: RE: USB hub port reset >=20 > In case of XHCI, TRB_TYPE_ADDRESS_DEV/SetAddress occurs within > XhcPollPortStatusChange. Seem we don't have 10ms/TRSTRCY for the devices > behind hub connected to XHCI or am missing something here? >=20 > In EDK2, 10ms(TRSTRCY) delay occurs before clear port status and in case = of Linux > TRSTRCY delay is after clearing port status. >=20 > Thanks > Baranee >=20 >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Tian, Feng > > Sent: Sunday, November 13, 2016 10:38 PM > > To: Anbazhagan, Baraneedharan ; edk2- > > devel@lists.01.org > > Cc: Tian, Feng > > Subject: Re: [edk2] USB hub port reset > > > > I don't catch what you mean. We have had 10ms delay for port reset. > > Which line of UsbHub.c do you think there is problem? > > > > Quote from USB2.0 spec: > > "Hubs must be able to accept all hub requests and devices must be able > > to accept a > > SetAddress() request (refer to Section 11.24.2 and Section 9.4 > > respectively) after the reset recovery time 10 ms (TRSTRCY) after the r= eset is > removed." > > > > Thanks > > Feng > > > > -----Original Message----- > > From: Anbazhagan, Baraneedharan [mailto:anbazhagan@hp.com] > > Sent: Monday, November 14, 2016 11:33 AM > > To: Tian, Feng ; edk2-devel@lists.01.org > > Subject: RE: USB hub port reset > > > > I didn't mean to have extra delays. Am asking whether EDKII have to be > > updated for 10ms reset recovery time regardless of port status to align= with spec? > > > > > > >From: Tian, Feng [mailto:feng.tian@intel.com] > > >Sent: Sunday, November 13, 2016 7:46 PM > > >To: Anbazhagan, Baraneedharan ; > > >edk2-devel@lists.01.org > > >Cc: Tian, Feng > > >Subject: RE: USB hub port reset > > > > > >Hi, Baranee > > > > > >Linux wait 10 + 40 ms (TRSTRCY =3D 10 ms, plus extra 40 ms). Do you > > >mean EDKII > > should be same with linux to wait more time? > > > > > >Thanks > > >Feng > > > > > >From: Anbazhagan, Baraneedharan [mailto:anbazhagan@hp.com] > > >Sent: Sunday, November 13, 2016 11:53 AM > > >To: mailto:edk2-devel@lists.01.org; Tian, Feng > > > > > >Subject: USB hub port reset > > > > > >EDK2 have reset recovery time of 10ms for hub port based on port > > >status reset bit > > but USB spec doesn't mention that port status can be used for t6/reset > > recovery time. Could you please clarify? > > > > > >USB vendor mentions EDK2 doesn't have reset recovery time on hub port > > >reset and also highlighting EDK2 hub port reset differs from > > >https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.c# > > >L2 > > >789 > > > > > >-Baranee > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel