From nobody Fri May 3 14:43:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=outlook.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1529165790121874.48694236512; Sat, 16 Jun 2018 09:16:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5A930210C1EE3; Sat, 16 Jun 2018 09:16:29 -0700 (PDT) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069101.outbound.protection.outlook.com [40.92.69.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 50F0C2098EA6F for ; Sat, 16 Jun 2018 09:16:27 -0700 (PDT) Received: from VE1EUR02FT056.eop-EUR02.prod.protection.outlook.com (10.152.12.58) by VE1EUR02HT018.eop-EUR02.prod.protection.outlook.com (10.152.13.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.863.11; Sat, 16 Jun 2018 16:16:25 +0000 Received: from VI1PR0801MB1790.eurprd08.prod.outlook.com (10.152.12.52) by VE1EUR02FT056.mail.protection.outlook.com (10.152.13.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.863.11 via Frontend Transport; Sat, 16 Jun 2018 16:16:25 +0000 Received: from VI1PR0801MB1790.eurprd08.prod.outlook.com ([fe80::b8fa:4bfe:9d63:439c]) by VI1PR0801MB1790.eurprd08.prod.outlook.com ([fe80::b8fa:4bfe:9d63:439c%2]) with mapi id 15.20.0863.016; Sat, 16 Jun 2018 16:16:25 +0000 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.92.69.101; helo=eur02-ve1-obe.outbound.protection.outlook.com; envelope-from=marvin.haeuser@outlook.com; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I449o73YSVtfKtocQpVYsItc6mPlsUXIXDOx7uU/08Q=; b=XQFwLSdZfmUmAynYVtyWHI7q2VniSoxtItZYxKQjIXtDxpBZXHcqjUa3LtHiKughn6iwPPulZ69yikh7k4C0vFLaL+HY4as7X/ByeiwxXt0EzQZgEqfNP+KarOb9YSjQTC8TiTLijVHYZtLasQV/8zIiFFuJqpEPNd4xu+z/QyXROSqrvxiFsaMcRy4DbiEKm99NXqFgAimFPQvMlZKPSj0JlIa8H70wHpv46j3tr2PXs6j98CM1qnYYTExBDGjSrHQgibPifeh8MzVA4D0TDS33NqNvcQOwGk+heB0T6OjfxNEYyJlaJvrp9YbVDEj2zrGfJ4hpvVOr4hsRPrZgEg== From: =?iso-8859-1?Q?Marvin_H=E4user?= To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH v3] SourceLevelDebugPkg/DebugCommunicationLibUsb: Add endpoint configuration. Thread-Index: AQHUBY1fcSMWymdf90OLtgOrETvi8g== Date: Sat, 16 Jun 2018 16:16:24 +0000 Message-ID: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5PR0602CA0024.eurprd06.prod.outlook.com (2603:10a6:203:a3::34) To VI1PR0801MB1790.eurprd08.prod.outlook.com (2603:10a6:800:5b::15) x-incomingtopheadermarker: OriginalChecksum:9DF496303564411770140B663C2F035FF985FA2F29312BCA5170B3C78885E7DC; UpperCasedChecksum:83B7F3E6CBE57367FF2C35A630B229445DD6A4E7F7DF06B4BC221065AD25ECDF; SizeAsReceived:7456; Count:48 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Tk9YYBaRIcNH8Rncj9lMlgRLIk62m+jk] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR02HT018; 7:+b/Ej73LVwdJm4ZGOyZ4Np1vxZ9OwYk/FW22sZvms087DL9gAdQSlZbR4XtC3RgAv70SCU2G0d97AqnHGE0iBAj5n5I9YhJM3Cvav3DQPwuauOwJF8DJI09q8TSFYcfSoRanQWOMloCcBLVkcYWEGfCanPU2Y01iNFi+eAZpKyacnIFQJmEHL3VT9eW5PBF96+jVephzNoB6izAWr3QS0EijWfwrkgCFZ7ZAsuWloROdflpH1P7er0myVQwlCYYY x-incomingheadercount: 48 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125500)(1701031045); SRVR:VE1EUR02HT018; x-ms-traffictypediagnostic: VE1EUR02HT018: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:VE1EUR02HT018; BCL:0; PCL:0; RULEID:; SRVR:VE1EUR02HT018; x-forefront-prvs: 0705EB1700 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(189003)(199004)(20460500001)(486006)(426003)(97736004)(104016004)(26005)(476003)(72206003)(87572001)(8936002)(6346003)(33656002)(2351001)(5250100002)(3660700001)(82202002)(14454004)(68736007)(8676002)(4326008)(3280700002)(86362001)(106356001)(575784001)(2501003)(25786009)(102836004)(55016002)(99286004)(386003)(7696005)(81156014)(2900100001)(305945005)(105586002)(5640700003)(6436002)(74316002)(6916009)(5660300001); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR02HT018; H:VI1PR0801MB1790.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:; received-spf: None (protection.outlook.com: outlook.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Marvin.Haeuser@outlook.com; x-microsoft-antispam-message-info: JaM8Pal+vycKcjVZUB0xxDElEOWFiaQxZLo8Obkzk1wpRhTt+PnxvL4tVS2KgEu+eQWTwBSGTFZGxUfHwv4fsQtGXxaSJk6RSQvR8zoH3+/YXqOpMwiz/avCqoBL8tuv0aToWUjia1eCZ5+uMtDtSaib1m8TWVlnlmuXLaweCG+EfPZEBgJvxss5RJv9v6Pe MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-Network-Message-Id: b37388e8-47ad-4e40-7ba3-08d5d3a48197 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jun 2018 16:16:25.0043 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR02HT018 Subject: [edk2] [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: , Cc: "hao.a.wu@intel.com" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. V2: - Store endpoint data in the USB Debug Port handle sturcture. V3: - Remove the static endpoint PCDs as requested. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marvin Haeuser Reviewed-by: Hao Wu --- SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLib= Usb.c | 18 ++++++++++++++++-- SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLib= Usb.inf | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm= unicationLibUsb.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/De= bugCommunicationLibUsb.c index d996f80f59e3..1836c055267b 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicati= onLibUsb.c +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicati= onLibUsb.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, Sent,= OUTPUT_PID, 0x7F, 0x01, UsbDebugPortHandle->BulkOutToggle); + Status =3D UsbDebugPortOut(UsbDebugPortRegister, Buffer + Total, Sent,= OUTPUT_PID, 0x7F, UsbDebugPortHandle->OutEndpoint, UsbDebugPortHandle->Bul= kOutToggle); =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 & 0= x0F; =20 // // Clearing W/R bit to indicate it's a READ operation diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm= unicationLibUsb.inf b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/= DebugCommunicationLibUsb.inf index 028b04afbf00..8009f62075ff 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicati= onLibUsb.inf +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicati= onLibUsb.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 --=20 2.17.1.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel