From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>
Cc: "Ni, Ray" <ray.ni@intel.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH v2] PcAtChipsetPkg: Fix AcpiTimerLib incompatibility with XhciDxe
Date: Wed, 6 Dec 2023 22:50:07 +0000 [thread overview]
Message-ID: <MW4PR11MB582112ED5D125C4434D15F16CD84A@MW4PR11MB5821.namprd11.prod.outlook.com> (raw)
In-Reply-To: <179DB5683F38928F.24600@groups.io>
Pushed as df2ec2a
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nate DeSimone
Sent: Monday, December 4, 2023 10:48 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [edk2-devel] [PATCH v2] PcAtChipsetPkg: Fix AcpiTimerLib incompatibility with XhciDxe
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 have changed made the definition of mPerformanceCounterFrequency to static and renamed it to mAcpiTimerLibTscFrequency. Since this variable is not used outside of the DxeStandaloneMmAcpiTimerLib.c compilation unit, there is no reason to have it exported as a global.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
.../AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
index 16ac48938f..ccceb8a649 100644
--- a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
+++ b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
@@ -1,7 +1,7 @@
/** @file
ACPI Timer implements one instance of Timer Library.
- Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2013 - 2023, Intel Corporation. All rights
+ reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -11,6 +11,11 @@
#include <Library/BaseLib.h>
#include <Library/HobLib.h>
+//
+// Cached performance counter frequency // static UINT64
+mAcpiTimerLibTscFrequency = 0;
+
extern GUID mFrequencyHobGuid;
/**
@@ -48,11 +53,6 @@ InternalCalculateTscFrequency (
VOID
);
-//
-// Cached performance counter frequency -//
-UINT64 mPerformanceCounterFrequency = 0;
-
/**
Internal function to retrieves the 64-bit frequency in Hz.
@@ -66,7 +66,7 @@ InternalGetPerformanceCounterFrequency (
VOID
)
{
- return mPerformanceCounterFrequency;
+ return mAcpiTimerLibTscFrequency;
}
/**
@@ -92,9 +92,9 @@ CommonAcpiTimerLibConstructor (
//
GuidHob = GetFirstGuidHob (&mFrequencyHobGuid);
if (GuidHob != NULL) {
- mPerformanceCounterFrequency = *(UINT64 *)GET_GUID_HOB_DATA (GuidHob);
+ mAcpiTimerLibTscFrequency = *(UINT64 *)GET_GUID_HOB_DATA (GuidHob);
} else {
- mPerformanceCounterFrequency = InternalCalculateTscFrequency ();
+ mAcpiTimerLibTscFrequency = InternalCalculateTscFrequency ();
}
return EFI_SUCCESS;
--
2.39.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112141): https://edk2.groups.io/g/devel/message/112141
Mute This Topic: https://groups.io/mt/103024047/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
prev parent reply other threads:[~2023-12-06 22:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 18:47 [edk2-devel] [PATCH v2] MdeModulePkg/Bus: Fix XhciDxe Linker Issues Nate DeSimone
2023-12-04 18:47 ` [edk2-devel] [PATCH v2] PcAtChipsetPkg: Fix AcpiTimerLib incompatibility with XhciDxe Nate DeSimone
2023-12-04 19:59 ` Pedro Falcato
2023-12-04 22:13 ` Nate DeSimone
2023-12-05 8:18 ` Ni, Ray
[not found] ` <179DB5683F38928F.24600@groups.io>
2023-12-06 22:50 ` Nate DeSimone [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW4PR11MB582112ED5D125C4434D15F16CD84A@MW4PR11MB5821.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox