From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.92.64.12; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=marvin.haeuser@outlook.com; receiver=edk2-devel@lists.01.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064012.outbound.protection.outlook.com [40.92.64.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A6D0D21130E41 for ; Thu, 14 Jun 2018 08:45:40 -0700 (PDT) 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=axgqJ42futcyvFwYfh5j0WR9Cd3na1/v8vCL2Yz+CoA=; b=BmRNzqpReXMa/OXJv4fZhAAvVfOy7PKu2J5akjD/XXWHqMy1MzOzvKOjXHp8rZ1jKbaAPmmugSnX/GZSqX4MAx3zivuFufiH0zbHNIRTYr0+4MGeE2CRIxRMrc2CizK+P3nE1fi5wK4NOB6CNMQHIJcUj3L+3hSUlzPENRwZygVYmLYobAXnshOsw+4J3Q2HBXCAoYdP0H6+e0o093WAMJI9h5xr8t8ZBzkC04LWnG/Rxo+t27iNga2F9EOLX6lg/9R+asR/iDy/jnD/RsuqTX3/mhio7DabjP44GynjhXa6nMrXYUzplLB9aF36psjHxUUd3l1kTywpOf8u8KXYnQ== Received: from VE1EUR01FT050.eop-EUR01.prod.protection.outlook.com (10.152.2.51) by VE1EUR01HT234.eop-EUR01.prod.protection.outlook.com (10.152.3.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.863.11; Thu, 14 Jun 2018 15:45:37 +0000 Received: from VI1PR0801MB1790.eurprd08.prod.outlook.com (10.152.2.53) by VE1EUR01FT050.mail.protection.outlook.com (10.152.3.32) 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; Thu, 14 Jun 2018 15:45:37 +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.0841.019; Thu, 14 Jun 2018 15:45:37 +0000 From: =?iso-8859-1?Q?Marvin_H=E4user?= To: "edk2-devel@lists.01.org" , "Wu, Hao A" CC: "ruiyu.ni@intel.com" Thread-Topic: [PATCH v2] SourceLevelDebugPkg/DebugCommunicationLibUsb: Add endpoint configuration. Thread-Index: AQHUA1DQ/mf1XxE7gU6kNmXE15+v2aRfU+fQgACST4A= Date: Thu, 14 Jun 2018 15:45:37 +0000 Message-ID: References: In-Reply-To: Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:5A228334B9C8B803F0B809C564B5233D900D2E3E7411BE669B08E7CEA30A783B; UpperCasedChecksum:267F9F1EEBE85E1EAC7B47B8049AADEDD969817D64EB2554922DA2D9B526FF23; SizeAsReceived:7333; Count:46 x-tmn: [t+L3W+vDjlTICv7nl+HYB/UxOYmnNDnT] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR01HT234; 7:M/Vdpp8Cq/sD2o3tsH+Q1guqP6VI2wKU5a4ktnBkbp7KCSLAfpg5UTH0yawH3I+6B7o+23OeYETjLSzVk04ExXZNaaETODhbr6JRR3ILLMoLzv74XH4rRxdhgWRasl9Gj51qgKPO4UM7o9sOnRFspELl/wEoTy+M0YU1PfGxBgQfR1ewRDTnl7INtjjcZh0BKr0PPBkL6edhMw37W2FuaddJwxar28XXPy+U7Z7kD2p9Mcl8MdKKMBo/0RlDKB/7 x-incomingheadercount: 46 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1601125500)(1603101448)(1701031045); SRVR:VE1EUR01HT234; x-ms-traffictypediagnostic: VE1EUR01HT234: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:VE1EUR01HT234; BCL:0; PCL:0; RULEID:; SRVR:VE1EUR01HT234; x-forefront-prvs: 0703B549E4 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(189003)(199004)(13464003)(51874003)(97736004)(5250100002)(8936002)(14454004)(966005)(81156014)(20460500001)(7696005)(2501003)(76176011)(229853002)(26005)(53546011)(575784001)(2900100001)(86362001)(59450400001)(72206003)(68736007)(3280700002)(446003)(476003)(6246003)(105586002)(106356001)(6306002)(3660700001)(87572001)(99286004)(426003)(55016002)(33656002)(6436002)(4326008)(74316002)(11346002)(6346003)(5660300001)(82202002)(486006)(110136005)(8676002)(305945005)(102836004)(104016004)(25786009); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR01HT234; 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: i72Xwmnihrjvw2J5x2R8w85qNaD2Ydz1S9pMmoisvLVS7iHI7MF7moS4cHvAxyr9LUPlSPL+ziwALcc9nA6Xz8zB6iitrTeb3LSfak9fyj9IME+2L09m91/e5NME3UsifK7AoPNqMduA3N6IFGT9TP34F/mOKraVagSadJ44pB7Bid+l1ObM2Jx+/cOJGyGu 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: 3e4b9b70-b456-40cf-e129-08d5d20de023 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jun 2018 15:45:37.8337 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR01HT234 Subject: Re: [PATCH v2] 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: Thu, 14 Jun 2018 15:45:41 -0000 Content-Language: de-DE Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hey Hao, I don't require hardcoded endpoint information, but I have only one debug d= evice to test with in the first place. The static endpoint option was added in case there are Debug Devices around= which report incorrect information. I assumed that was part of the reason the endpoints were hardcoded in the f= irst place. Do you want me to submit a V2 without the PCDs? Thanks, Marvin. > -----Original Message----- > From: Wu, Hao A > Sent: Thursday, June 14, 2018 9:03 AM > To: Marvin H=E4user ; edk2- > devel@lists.01.org > Cc: Ni, Ruiyu > Subject: RE: [PATCH v2] SourceLevelDebugPkg/DebugCommunicationLibUsb: > Add endpoint configuration. >=20 > Hi Marvin, >=20 > One thing to confirm with you. For your using case, do you need to hard- > code the IN/OUT endpoints for EHCI debug device? >=20 > If not, I think we can just remove the hard-code endpoints settings in th= e > current code. And use the endpoints returned from the USB Device > Descriptor. > By doing so, I think we can avoid adding those 2 PCDs. >=20 > Please let me know your thoughts on this. Thanks in advance. >=20 > Best Regards, > Hao Wu >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Marvin H=E4user > > Sent: Thursday, June 14, 2018 3:58 AM > > To: edk2-devel@lists.01.org > > Cc: Wu, Hao A > > Subject: [edk2] [PATCH v2] > SourceLevelDebugPkg/DebugCommunicationLibUsb: > > Add endpoint configuration. > > > > 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, two PCDs have been introduced to configure the > > in and out endpoints of the EHCI Debug Device. These may be set to 0 > > to retrieve the endpoints from the USB Device Descriptor directly. > > To ensure maximum compatibility, the PCD defaults have been set to the > > former hardcoded values. > > > > V2: > > - Store endpoint data in the USB Debug Port handle sturcture. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marvin Haeuser > > --- > > > > > SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommun > ica > > tionLibUsb.c | 32 ++++++++++++++++++-- > > > > > SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommun > ica > > tionLibUsb.inf | 6 +++- > > SourceLevelDebugPkg/SourceLevelDebugPkg.dec = | 12 > > ++++++++ > > 3 files changed, 47 insertions(+), 3 deletions(-) > > > > diff --git > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > cationLibUsb.c > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > cationLibUsb.c > > index d996f80f59e3..a9a9ea07a39b 100644 > > --- > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > cationLibUsb.c > > +++ > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > 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; > > @@ -603,6 +611,8 @@ InitializeUsbDebugHardware ( > > UINT32 *UsbHCSParam; > > UINT8 DebugPortNumber; > > UINT8 Length; > > + UINT8 InEndpoint; > > + UINT8 OutEndpoint; > > > > UsbDebugPortRegister =3D (USB_DEBUG_PORT_REGISTER > *)((UINTN)Handle- > > >UsbDebugPortMemoryBase + Handle->DebugPortOffset); > > UsbHCSParam =3D (UINT32 *)((UINTN)Handle->EhciMemoryBase + 0x04); > @@ > > -722,6 +732,24 @@ InitializeUsbDebugHardware ( > > return RETURN_DEVICE_ERROR; > > } > > > > + // > > + // Determine the usb debug device endpoints. > > + // > > + InEndpoint =3D PcdGet8 (PcdUsbDebugPortInEndpoint); > > + > > + if (InEndpoint =3D=3D 0) { > > + InEndpoint =3D UsbDebugPortDescriptor.DebugInEndpoint; > > + } > > + > > + OutEndpoint =3D PcdGet8 (PcdUsbDebugPortOutEndpoint); > > + > > + if (OutEndpoint =3D=3D 0) { > > + OutEndpoint =3D UsbDebugPortDescriptor.DebugOutEndpoint; > > + } > > + > > + Handle->InEndpoint =3D InEndpoint; > > + Handle->OutEndpoint =3D OutEndpoint; > > + > > // > > // enable the usb debug feature. > > // > > @@ -879,7 +907,7 @@ DebugPortWriteBuffer ( > > Sent =3D (UINT8)(NumberOfBytes - Total); > > } > > > > - Status =3D UsbDebugPortOut(UsbDebugPortRegister, Buffer + Total, S= ent, > > OUTPUT_PID, 0x7F, 0x01, UsbDebugPortHandle->BulkOutToggle); > > + Status =3D UsbDebugPortOut(UsbDebugPortRegister, Buffer + Total, > > + Sent, > > OUTPUT_PID, 0x7F, UsbDebugPortHandle->OutEndpoint, > UsbDebugPortHandle- > > >BulkOutToggle); > > > > if (RETURN_ERROR(Status)) { > > return Total; > > @@ -959,7 +987,7 @@ DebugPortPollBuffer ( > > UsbDebugPortRegister->SendPid =3D DATA1_PID; > > } > > UsbDebugPortRegister->UsbAddress =3D 0x7F; > > - UsbDebugPortRegister->UsbEndPoint =3D 0x82 & 0x0F; > > + UsbDebugPortRegister->UsbEndPoint =3D UsbDebugPortHandle- > >InEndpoint > > + & > > 0x0F; > > > > // > > // Clearing W/R bit to indicate it's a READ operation diff --git > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > cationLibUsb.inf > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > cationLibUsb.inf > > index 028b04afbf00..eb55e5ee0f63 100644 > > --- > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > cationLibUsb.inf > > +++ > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugComm > uni > > cationLibUsb.inf > > @@ -43,9 +43,13 @@ [Pcd] > > # The pci address of ehci host controller, in which usb debug > > feature is enabled. > > # The format of pci address please refer to SourceLevelDebugPkg.dec > > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbEhciPciAddress > ## > > CONSUMES > > + # The endpoint that should be used for read transactions from the > > + usb debug > > device. > > + gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbDebugPortInEndpoint > > ## CONSUMES > > + # The endpoint that should be used for write transactions to the > > + usb debug > > device. > > + > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbDebugPortOutEndpoint > > ## 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 > > > > [LibraryClasses] > > TimerLib > > diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dec > > b/SourceLevelDebugPkg/SourceLevelDebugPkg.dec > > index b89e9c6ad601..76410444f385 100644 > > --- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dec > > +++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dec > > @@ -72,6 +72,18 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > > # @Expression 0x80000001 | > > (gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbEhciPciAddress & > > 0xF0000FFF) =3D=3D 0 > > > > > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbEhciPciAddress|0x000EF0 > 00| > > UINT32|0x00000003 > > > > + ## The endpoint that should be used for read transactions from the > > + usb > > debug device. > > + # 0: Determine the endpoint dynamically. > > + # other: The endpoint that should be used. > > + # @Prompt Configure the endpoint to read from the usb debug device. > > + > > > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbDebugPortInEndpoint|0x > 82|U > > INT8|0x0000000b > > + > > + ## The endpoint that should be used for write transactions to the > > + usb debug > > device. > > + # 0: Determine the endpoint dynamically. > > + # other: The endpoint that should be used. > > + # @Prompt Configure the endpoint to write to the usb debug device. > > + > > > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdUsbDebugPortOutEndpoint|0 > x01 > > |UINT8|0x0000000c > > + > > ## The mask of exception numbers whose handlers would be ignored > > and cannot be replaced or > > # hooked by Debug Agent Library. Masking INT1/INT3 is invalid. > > # @Prompt Configure exception numbers not to be hooked by Debug > Agent. > > -- > > 2.17.1.windows.2 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel