From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 7CCBF211158F5 for ; Mon, 18 Jun 2018 18:27:37 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2018 18:27:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,241,1526367600"; d="scan'208";a="64329622" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 18 Jun 2018 18:27:29 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Jun 2018 18:27:29 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Jun 2018 18:27:29 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.87]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Tue, 19 Jun 2018 09:27:27 +0800 From: "Wu, Hao A" To: =?iso-8859-1?Q?Marvin_H=E4user?= , "edk2-devel@lists.01.org" Thread-Topic: [PATCH v3] SourceLevelDebugPkg/DebugCommunicationLibUsb: Add endpoint configuration. Thread-Index: AQHUBY1fcSMWymdf90OLtgOrETvi8qRmzXrg Date: Tue, 19 Jun 2018 01:27:26 +0000 Message-ID: References: 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: [PATCH v3] SourceLevelDebugPkg/DebugCommunicationLibUsb: Add endpoint configuration. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2018 01:27:38 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu Pushed at 73ae70db0f7a2ccada149e9dd03fda30923fdd75. Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Marvin H=E4user > Sent: Sunday, June 17, 2018 12:16 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A > Subject: [edk2] [PATCH v3] SourceLevelDebugPkg/DebugCommunicationLibUsb: > Add endpoint configuration. >=20 > Currently, DebugCommunicationLibUsb uses the hardcoded endpoints 0x82 > and 0x01 to communicate with the EHCI Debug Device. These, however, > are not standardized and may vary across different hardware. > To solve this problem, the endpoints are retrieved from the > USB Device Descriptor directly. >=20 > V2: > - Store endpoint data in the USB Debug Port handle sturcture. >=20 > V3: > - Remove the static endpoint PCDs as requested. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marvin Haeuser > --- >=20 > SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunica > tionLibUsb.c | 18 ++++++++++++++++-- >=20 > SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunica > tionLibUsb.inf | 2 +- > 2 files changed, 17 insertions(+), 3 deletions(-) >=20 > diff --git > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.c > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.c > index d996f80f59e3..1836c055267b 100644 > --- > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.c > +++ > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.c > @@ -132,6 +132,14 @@ typedef struct _USB_DEBUG_PORT_HANDLE{ > // > UINT32 EhciMemoryBase; > // > + // The usb debug device In endpoint. > + // > + UINT8 InEndpoint; > + // > + // The usb debug device Out endpoint. > + // > + UINT8 OutEndpoint; > + // > // The Bulk In endpoint toggle bit. > // > UINT8 BulkInToggle; > @@ -722,6 +730,12 @@ InitializeUsbDebugHardware ( > return RETURN_DEVICE_ERROR; > } >=20 > + // > + // Determine the usb debug device endpoints. > + // > + Handle->InEndpoint =3D UsbDebugPortDescriptor.DebugInEndpoint; > + Handle->OutEndpoint =3D UsbDebugPortDescriptor.DebugOutEndpoint; > + > // > // enable the usb debug feature. > // > @@ -879,7 +893,7 @@ DebugPortWriteBuffer ( > Sent =3D (UINT8)(NumberOfBytes - Total); > } >=20 > - Status =3D UsbDebugPortOut(UsbDebugPortRegister, Buffer + Total, Sen= t, > OUTPUT_PID, 0x7F, 0x01, UsbDebugPortHandle->BulkOutToggle); > + Status =3D UsbDebugPortOut(UsbDebugPortRegister, Buffer + Total, Sen= t, > OUTPUT_PID, 0x7F, UsbDebugPortHandle->OutEndpoint, UsbDebugPortHandle- > >BulkOutToggle); >=20 > if (RETURN_ERROR(Status)) { > return Total; > @@ -959,7 +973,7 @@ DebugPortPollBuffer ( > UsbDebugPortRegister->SendPid =3D DATA1_PID; > } > UsbDebugPortRegister->UsbAddress =3D 0x7F; > - UsbDebugPortRegister->UsbEndPoint =3D 0x82 & 0x0F; > + UsbDebugPortRegister->UsbEndPoint =3D UsbDebugPortHandle->InEndpoint & > 0x0F; >=20 > // > // Clearing W/R bit to indicate it's a READ operation > diff --git > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.inf > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.inf > index 028b04afbf00..8009f62075ff 100644 > --- > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.inf > +++ > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommuni > cationLibUsb.inf > @@ -45,7 +45,7 @@ [Pcd] > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbEhciPciAddress = ## > CONSUMES > # The value of data buffer size used for USB debug port handle. > # It should be equal to sizeof (USB_DEBUG_PORT_HANDLE). > - gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugPortHandleBufferSize|23 > ## SOMETIMES_CONSUMES > + > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugPortHandleBufferSize|25 > ## SOMETIMES_CONSUMES >=20 > [LibraryClasses] > TimerLib > -- > 2.17.1.windows.2 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel