REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2556
The StandardSignatureIsAuthenticAMD function was introduced locally to help divert code paths pertinent (or not) to AMD processors. This patch exports that function so that it may serve the same purpose in other modules that consume LocalApicLib. Cc: Eric Dong <eric.d...@intel.com> Cc: Ray Ni <ray...@intel.com> Cc: Laszlo Ersek <ler...@redhat.com> Signed-off-by: Leo Duran <leo.du...@amd.com> --- UefiCpuPkg/Include/Library/LocalApicLib.h | 15 +++++++ UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 47 +++++++++++----------- .../BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 47 +++++++++++----------- 3 files changed, 63 insertions(+), 46 deletions(-) diff --git a/UefiCpuPkg/Include/Library/LocalApicLib.h b/UefiCpuPkg/Include/Library/LocalApicLib.h index 96b93aa..a6e9dc6 100644 --- a/UefiCpuPkg/Include/Library/LocalApicLib.h +++ b/UefiCpuPkg/Include/Library/LocalApicLib.h @@ -5,6 +5,8 @@ handles cases where local APIC is disabled. Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2020, AMD Inc. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -16,6 +18,19 @@ #define LOCAL_APIC_MODE_X2APIC 0x2 ///< x2APIC mode. /** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ); + +/** Retrieve the base address of local APIC. @return The base address of local APIC. diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c index 33ea15c..cebf1b3 100644 --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c @@ -4,7 +4,7 @@ This local APIC library instance supports xAPIC mode only. Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR> - Copyright (c) 2017, AMD Inc. All rights reserved.<BR> + Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -27,28 +27,6 @@ // /** - Determine if the standard CPU signature is "AuthenticAMD". - - @retval TRUE The CPU signature matches. - @retval FALSE The CPU signature does not match. - -**/ -BOOLEAN -StandardSignatureIsAuthenticAMD ( - VOID - ) -{ - UINT32 RegEbx; - UINT32 RegEcx; - UINT32 RegEdx; - - AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && - RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && - RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); -} - -/** Determine if the CPU supports the Local APIC Base Address MSR. @retval TRUE The CPU supports the Local APIC Base Address MSR. @@ -76,6 +54,29 @@ LocalApicBaseAddressMsrSupported ( } /** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ) +{ + UINT32 RegEbx; + UINT32 RegEcx; + UINT32 RegEdx; + + AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); + return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && + RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && + RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); +} + +/** Retrieve the base address of local APIC. @return The base address of local APIC. diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c index d0f92b3..01996b1 100644 --- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c @@ -5,7 +5,7 @@ which have xAPIC and x2APIC modes. Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR> - Copyright (c) 2017, AMD Inc. All rights reserved.<BR> + Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -28,28 +28,6 @@ // /** - Determine if the standard CPU signature is "AuthenticAMD". - - @retval TRUE The CPU signature matches. - @retval FALSE The CPU signature does not match. - -**/ -BOOLEAN -StandardSignatureIsAuthenticAMD ( - VOID - ) -{ - UINT32 RegEbx; - UINT32 RegEcx; - UINT32 RegEdx; - - AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && - RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && - RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); -} - -/** Determine if the CPU supports the Local APIC Base Address MSR. @retval TRUE The CPU supports the Local APIC Base Address MSR. @@ -77,6 +55,29 @@ LocalApicBaseAddressMsrSupported ( } /** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ) +{ + UINT32 RegEbx; + UINT32 RegEcx; + UINT32 RegEdx; + + AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); + return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && + RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && + RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); +} + +/** Retrieve the base address of local APIC. @return The base address of local APIC. -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#54798): https://edk2.groups.io/g/devel/message/54798 Mute This Topic: https://groups.io/mt/71541518/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-