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<BR> -Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.<BR> 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; }