From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 7C3AD81E31 for ; Tue, 29 Nov 2016 21:32:27 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 29 Nov 2016 21:32:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,720,1473145200"; d="scan'208";a="792431780" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 29 Nov 2016 21:32:26 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 29 Nov 2016 21:32:25 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.142]) with mapi id 14.03.0248.002; Wed, 30 Nov 2016 13:32:24 +0800 From: "Zeng, Star" To: "Tian, Feng" , "edk2-devel@lists.01.org" CC: Mike Turner , "Zeng, Star" Thread-Topic: [patch] MdeModulePkg/Ehci: don't clear port status bits during init Thread-Index: AQHSSsjWOV0CaLEcfE6RxK0ipfu+EKDxAI5w Date: Wed, 30 Nov 2016 05:32:23 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB048310395BC2FE@shsmsx102.ccr.corp.intel.com> References: <2693f04758f5aa5ae2819aaba72c42dae1d5552a.1480482893.git.feng.tian@intel.com> In-Reply-To: <2693f04758f5aa5ae2819aaba72c42dae1d5552a.1480482893.git.feng.tian@intel.com> 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: [patch] MdeModulePkg/Ehci: don't clear port status bits during init 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, 30 Nov 2016 05:32:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Tian, Feng=20 Sent: Wednesday, November 30, 2016 1:16 PM To: edk2-devel@lists.01.org Cc: Zeng, Star ; Mike Turner Subject: [patch] MdeModulePkg/Ehci: don't clear port status bits during ini= t Port status bits are clear in original code, so no enumeration takes place. Changing this to prevent the status bits from being cleared allows enumerat= ion to proceed normally. Cc: Star Zeng Cc: Mike Turner Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Mike Turner Signed-off-by: Feng Tian --- MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c | 10 +++++++++- MdeModulePkg/Bus/P= ci/EhciPei/EhcPeim.c | 18 +++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c b/MdeModulePkg/Bus/Pci/= EhciDxe/EhciReg.c index 88a66ae..3a6ed02 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c @@ -591,6 +591,7 @@ EhcInitHC ( { EFI_STATUS Status; UINT32 Index; + UINT32 RegVal; =20 // This ASSERT crashes the BeagleBoard. There is some issue in the USB s= tack. // This ASSERT needs to be removed so the BeagleBoard will boot. When we= fix @@ -626,7 +627,14 @@ EhcInitHC ( // if (Ehc->HcStructParams & HCSP_PPC) { for (Index =3D 0; Index < (UINT8) (Ehc->HcStructParams & HCSP_NPORTS);= Index++) { - EhcSetOpRegBit (Ehc, (UINT32) (EHC_PORT_STAT_OFFSET + (4 * Index)), = PORTSC_POWER); + // + // Do not clear port status bits on initialization. Otherwise devic= es will + // not enumerate properly at startup. + // + RegVal =3D EhcReadOpReg(Ehc, (UINT32)(EHC_PORT_STAT_OFFSET + (4 * I= ndex))); + RegVal &=3D ~PORTSC_CHANGE_MASK; + RegVal |=3D PORTSC_POWER; + EhcWriteOpReg (Ehc, (UINT32) (EHC_PORT_STAT_OFFSET + (4 *=20 + Index)), RegVal); } } =20 diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c b/MdeModulePkg/Bus/Pci/= EhciPei/EhcPeim.c index 09769ea..31647ff 100644 --- a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c +++ b/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c @@ -2,7 +2,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPp= iGuid which is used to enable recovery function from USB Drivers. =20 -Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made availab= le under the terms and conditions @@ -411,12 +411,20 @@ EhcPowerOnAllPorts = ( IN PEI_USB2_HC_DEV *Ehc ) { - UINT8 PortNumber; - UINT8 Index; - + UINT8 PortNumber; + UINT8 Index; + UINT32 RegVal; + =20 PortNumber =3D (UINT8)(Ehc->HcStructParams & HCSP_NPORTS); for (Index =3D 0; Index < PortNumber; Index++) { - EhcSetOpRegBit (Ehc, EHC_PORT_STAT_OFFSET + 4 * Index, PORTSC_POWER); + // + // Do not clear port status bits on initialization. Otherwise devices= will + // not enumerate properly at startup. + // + RegVal =3D EhcReadOpReg(Ehc, EHC_PORT_STAT_OFFSET + 4 * Index); + RegVal &=3D ~PORTSC_CHANGE_MASK; + RegVal |=3D PORTSC_POWER; + EhcWriteOpReg (Ehc, EHC_PORT_STAT_OFFSET + 4 * Index, RegVal); } } =20 -- 2.7.1.windows.2