From nobody Fri May 17 10:34:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+112049+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112049+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1701715694; cv=none; d=zohomail.com; s=zohoarc; b=AHlzF7+y+10/3E8Y7oEkO2ZZcTwkvqFwrxk9P6n+dWlmxY7epSjNVMwTBf4iONdeBfhdl05MpsODNqqPl9N8hG3jKiE8gpdXtRrJ2lCTL8pGm+oJkmbtv3J6uP3v5TNWZzqgnUAIDYF68PrbDu/d/M+Vbo/lhSjIdHePvKMnLFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701715694; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=Szi72rB9gtjwtOJ+N+m/LhgLG7LmJpo4bpLZaNNMQiU=; b=bKSebT8F+gOujqK7zCd/tq2MfNdCirZrFxbqzKiVY8iR1KmQ338crTm4uoEmvDof+hkKVztNZgKxm08nxOP47KLdzc4yOY76DbfosGVDheGIDcnH1wSdVO3nOtUQ+5xDTKTax1HXJ1ZQqzuNau2Hb7hfootHFB6MvNTVIkAJSUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112049+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1701715694131614.7627909162378; Mon, 4 Dec 2023 10:48:14 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=n3RqYOSu/CATXe/kMZWEvux7W3k1TJo35/xZTnxoCMs=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701715693; v=1; b=gVkYaz4UGgB2w15Eogju81gBTevEtr2E2Re2eCUcBYqBrfT8aHkhs5mg9LScJVo1tyumMjAC qiT7emy6lLUU9q/FIAU91SXJqo9lSStfr6Wrq8B29gXVKVGu/XrhjCR99qEyQ6dqi9hiAlnoXbK DbSjSqF7QwUyeAOWIX1cfv4U= X-Received: by 127.0.0.2 with SMTP id gWMbYY1788612xjObZPe95Ib; Mon, 04 Dec 2023 10:48:13 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.77545.1701715692760815282 for ; Mon, 04 Dec 2023 10:48:13 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="378808707" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="378808707" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 10:48:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="914534220" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="914534220" X-Received: from nldesimo-desk.amr.corp.intel.com ([10.241.240.67]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 10:48:10 -0800 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Ray Ni , Michael D Kinney Subject: [edk2-devel] [PATCH v2] MdeModulePkg/Bus: Fix XhciDxe Linker Issues Date: Mon, 4 Dec 2023 10:47:50 -0800 Message-Id: <20231204184751.348-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: BoGP1HCaloxLtygCkIYAba1zx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1701715694617100001 Content-Type: text/plain; charset="utf-8" The DXE & MM standalone variant of AcpiTimerLib defines a global named mPerformanceCounterFrequency. A global with an identical name is also present in MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c Since XhciDxe has a dependency on TimerLib, this can cause link errors due to the same symbol being defined twice if the platform DSC chooses to use AcpiTimerLib as the TimerLib implementation for any given platform. To resolve this, I noted that some of the globals in Xhci.c are not used outside of the Xhci.c compilation unit: - mPerformanceCounterStartValue - mPerformanceCounterEndValue - mPerformanceCounterFrequency - mPerformanceCounterValuesCached I have changed the definition for all of these to static and added an Xhci prefix. Since they are not used outside of the Xhci.c compilation unit, there is no reason to have them exported as globals. Cc: Ray Ni Cc: Michael D Kinney Signed-off-by: Nate DeSimone --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/Xhc= iDxe/Xhci.c index 7a2e32a9dd..f4e61d223c 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -2,7 +2,7 @@ The XHCI controller driver. =20 (C) Copyright 2023 Hewlett Packard Enterprise Development LP
-Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -86,10 +86,10 @@ EFI_USB2_HC_PROTOCOL gXhciUsb2HcTemplate =3D { 0x0 }; =20 -UINT64 mPerformanceCounterStartValue; -UINT64 mPerformanceCounterEndValue; -UINT64 mPerformanceCounterFrequency; -BOOLEAN mPerformanceCounterValuesCached =3D FALSE; +static UINT64 mXhciPerformanceCounterStartValue; +static UINT64 mXhciPerformanceCounterEndValue; +static UINT64 mXhciPerformanceCounterFrequency; +static BOOLEAN mXhciPerformanceCounterValuesCached =3D FALSE; =20 /** Retrieves the capability of root hub ports. @@ -2318,17 +2318,17 @@ XhcConvertTimeToTicks ( UINTN Shift; =20 // Cache the return values to avoid repeated calls to GetPerformanceCoun= terProperties () - if (!mPerformanceCounterValuesCached) { - mPerformanceCounterFrequency =3D GetPerformanceCounterProperties ( - &mPerformanceCounterStartValue, - &mPerformanceCounterEndValue - ); + if (!mXhciPerformanceCounterValuesCached) { + mXhciPerformanceCounterFrequency =3D GetPerformanceCounterProperties ( + &mXhciPerformanceCounterStartValu= e, + &mXhciPerformanceCounterEndValue + ); =20 - mPerformanceCounterValuesCached =3D TRUE; + mXhciPerformanceCounterValuesCached =3D TRUE; } =20 // Prevent returning a tick value of 0, unless Time is already 0 - if (0 =3D=3D mPerformanceCounterFrequency) { + if (0 =3D=3D mXhciPerformanceCounterFrequency) { return Time; } =20 @@ -2342,7 +2342,7 @@ XhcConvertTimeToTicks ( // Ticks =3D MultU64x64 ( DivU64x64Remainder ( - mPerformanceCounterFrequency, + mXhciPerformanceCounterFrequency, Divisor, &Remainder ), @@ -2384,12 +2384,12 @@ XhcGetElapsedTicks ( // // Determine if the counter is counting up or down // - if (mPerformanceCounterStartValue < mPerformanceCounterEndValue) { + if (mXhciPerformanceCounterStartValue < mXhciPerformanceCounterEndValue)= { // // Counter counts upwards, check for an overflow condition // if (*PreviousTick > CurrentTick) { - Delta =3D (mPerformanceCounterEndValue - *PreviousTick) + CurrentTic= k; + Delta =3D (mXhciPerformanceCounterEndValue - *PreviousTick) + Curren= tTick; } else { Delta =3D CurrentTick - *PreviousTick; } @@ -2398,7 +2398,7 @@ XhcGetElapsedTicks ( // Counter counts downwards, check for an underflow condition // if (*PreviousTick < CurrentTick) { - Delta =3D (mPerformanceCounterStartValue - CurrentTick) + *PreviousT= ick; + Delta =3D (mXhciPerformanceCounterStartValue - CurrentTick) + *Previ= ousTick; } else { Delta =3D *PreviousTick - CurrentTick; } --=20 2.39.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112049): https://edk2.groups.io/g/devel/message/112049 Mute This Topic: https://groups.io/mt/102976787/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-