From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9BA8581ECD for ; Tue, 15 Nov 2016 17:45:03 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 15 Nov 2016 17:45:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,497,1473145200"; d="scan'208";a="1059963541" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 15 Nov 2016 17:45:07 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 15 Nov 2016 17:45:07 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 15 Nov 2016 17:45:07 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.239]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.138]) with mapi id 14.03.0248.002; Wed, 16 Nov 2016 09:45:05 +0800 From: "Tian, Feng" To: "Anbazhagan, Baraneedharan" , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: USB hub port reset Thread-Index: AdI9P9a4p+GKnaQeTV6wi4G+bYD8YgA2K+ggAABY8XAABZq8YAARLQ7QAB6ZSoAAKoHsEAAEJAyw Date: Wed, 16 Nov 2016 01:45:04 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE566E5120B@SHSMSX101.ccr.corp.intel.com> References: <7F1BAD85ADEA444D97065A60D2E97EE566E4F108@SHSMSX101.ccr.corp.intel.com> <7F1BAD85ADEA444D97065A60D2E97EE566E4F285@SHSMSX101.ccr.corp.intel.com> <7F1BAD85ADEA444D97065A60D2E97EE566E4FADD@SHSMSX101.ccr.corp.intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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 01:45:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I would prefer to keep the logic in UsbHubResetPort() unchanged to avoid br= ing other device identification impacts. Thanks Feng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Anba= zhagan, Baraneedharan Sent: Wednesday, November 16, 2016 7:56 AM To: Tian, Feng ; edk2-devel@lists.01.org Subject: Re: [edk2] USB hub port reset Feng, Below change solves the problem with a device behind the hub. Do we still n= eed the 10ms delay in UsbHubResetPort function for manual port reset in cas= e of XHCI? Thanks, Baranee -----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 Baranee Supposing are using latest usb code in EdkII trunk. We send ADDRESS DEVICE CMD in XhcInitializeDeviceSlot(), which will cause X= HC issue a USB SET_ADDRESS request to the USB Device. 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 Reset= Port operation. UsbHubResetPort()->UsbHubSetPortFeature()->Stall(20)-> UsbHubGetPortStatus(= )->(invoke above code in XHCI)->(if RESET_C bit is set)->Stall(10) According to your info, it looks like we need add 10ms delay to XhcInitiali= zeDeviceSlot() like below: diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pc= i/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 com= mand 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 com= mand 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); Could you please have a try to see if it solves your problem? Thanks Feng -----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 In case of XHCI, TRB_TYPE_ADDRESS_DEV/SetAddress occurs within XhcPollPortS= tatusChange. Seem we don't have 10ms/TRSTRCY for the devices behind hub con= nected to XHCI or am missing something here? In EDK2, 10ms(TRSTRCY) delay occurs before clear port status and in case of= Linux TRSTRCY delay is after clearing port status. Thanks Baranee > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Tian, Feng > Sent: Sunday, November 13, 2016 10:38 PM > To: Anbazhagan, Baraneedharan ; edk2-=20 > devel@lists.01.org > Cc: Tian, Feng > Subject: Re: [edk2] USB hub port reset >=20 > I don't catch what you mean. We have had 10ms delay for port reset.=20 > Which line of UsbHub.c do you think there is problem? >=20 > Quote from USB2.0 spec: > "Hubs must be able to accept all hub requests and devices must be able=20 > 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 res= et is removed." >=20 > Thanks > Feng >=20 > -----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 >=20 > I didn't mean to have extra delays. Am asking whether EDKII have to be=20 > updated for 10ms reset recovery time regardless of port status to align w= ith spec? >=20 >=20 > >From: Tian, Feng [mailto:feng.tian@intel.com] > >Sent: Sunday, November 13, 2016 7:46 PM > >To: Anbazhagan, Baraneedharan ;=20 > >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=20 > >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=20 > > > >Subject: USB hub port reset > > > >EDK2 have reset recovery time of 10ms for hub port based on port=20 > >status reset bit > but USB spec doesn't mention that port status can be used for t6/reset=20 > recovery time. Could you please clarify? > > > >USB vendor mentions EDK2 doesn't have reset recovery time on hub port=20 > >reset and also highlighting EDK2 hub port reset differs from=20 > >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