From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 68726D80A14 for ; Mon, 4 Dec 2023 18:48:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=t3WJ49b0wkxK3pfPy8fvHX9k7w5PEqSDUGexJU+9/gc=; 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=1701715694; v=1; b=Lt7LPn7/NSx2NetkrdcMJUcX0dgtgFGcxq83DXvXxpDTTFkspV9Cy5qa7Ne2wSNI9l8c41du hwg/DAx84ejIG6YD8gCXfHNDpXOxV9bGkXWdtaOsGGGri5NXzm23867xhZdgWb+ugbfpBwyTdNL JZFmusc74zjpBOZU2ziZ2g78= X-Received: by 127.0.0.2 with SMTP id t437YY7687511xYfvOMX0LYI; Mon, 04 Dec 2023 10:48:14 -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: 9CMkSS76U9leqRKIpeDbetfNx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="Lt7LPn7/"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) 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/XhciDxe/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. (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 **/ @@ -86,10 +86,10 @@ EFI_USB2_HC_PROTOCOL gXhciUsb2HcTemplate = { 0x0 }; -UINT64 mPerformanceCounterStartValue; -UINT64 mPerformanceCounterEndValue; -UINT64 mPerformanceCounterFrequency; -BOOLEAN mPerformanceCounterValuesCached = FALSE; +static UINT64 mXhciPerformanceCounterStartValue; +static UINT64 mXhciPerformanceCounterEndValue; +static UINT64 mXhciPerformanceCounterFrequency; +static BOOLEAN mXhciPerformanceCounterValuesCached = FALSE; /** Retrieves the capability of root hub ports. @@ -2318,17 +2318,17 @@ XhcConvertTimeToTicks ( UINTN Shift; // Cache the return values to avoid repeated calls to GetPerformanceCounterProperties () - if (!mPerformanceCounterValuesCached) { - mPerformanceCounterFrequency = GetPerformanceCounterProperties ( - &mPerformanceCounterStartValue, - &mPerformanceCounterEndValue - ); + if (!mXhciPerformanceCounterValuesCached) { + mXhciPerformanceCounterFrequency = GetPerformanceCounterProperties ( + &mXhciPerformanceCounterStartValue, + &mXhciPerformanceCounterEndValue + ); - mPerformanceCounterValuesCached = TRUE; + mXhciPerformanceCounterValuesCached = TRUE; } // Prevent returning a tick value of 0, unless Time is already 0 - if (0 == mPerformanceCounterFrequency) { + if (0 == mXhciPerformanceCounterFrequency) { return Time; } @@ -2342,7 +2342,7 @@ XhcConvertTimeToTicks ( // Ticks = 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 = (mPerformanceCounterEndValue - *PreviousTick) + CurrentTick; + Delta = (mXhciPerformanceCounterEndValue - *PreviousTick) + CurrentTick; } else { Delta = CurrentTick - *PreviousTick; } @@ -2398,7 +2398,7 @@ XhcGetElapsedTicks ( // Counter counts downwards, check for an underflow condition // if (*PreviousTick < CurrentTick) { - Delta = (mPerformanceCounterStartValue - CurrentTick) + *PreviousTick; + Delta = (mXhciPerformanceCounterStartValue - CurrentTick) + *PreviousTick; } else { Delta = *PreviousTick - CurrentTick; } -- 2.39.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-