Refactor StandardSignatureIsAuthenticAMD into BaseUefiCpuLib from
separate copies in BaseXApicLib, BaseXApicX2ApicLib, and MpInitLib.
This allows for future use of StandarSignatureIsAuthinticAMD without
creating more instances in other modules.
This function allows IA32/X64 code to determine if it is running on an
AMD brand processor.
UefiCpuLib is already included directly or indirectly in all modified
modules. Complete move is made in this change.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Garrett Kirkendall <garrett.kirkendall@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Message-Id: <
20200622131825.1352-4-Garrett.Kirkendall@amd.com>
to be UEFI specification compliant.\r
\r
Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2020, AMD Inc. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
VOID\r
);\r
\r
+/**\r
+ Determine if the standard CPU signature is "AuthenticAMD".\r
+\r
+ @retval TRUE The CPU signature matches.\r
+ @retval FALSE The CPU signature does not match.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+StandardSignatureIsAuthenticAMD (\r
+ VOID\r
+ );\r
+\r
#endif\r
--- /dev/null
+/** @file\r
+ This library defines some routines that are generic for IA32 family CPU.\r
+\r
+ The library routines are UEFI specification compliant.\r
+\r
+ Copyright (c) 2020, AMD Inc. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Register/Intel/Cpuid.h>\r
+#include <Register/Amd/Cpuid.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/UefiCpuLib.h>\r
+\r
+/**\r
+ Determine if the standard CPU signature is "AuthenticAMD".\r
+\r
+ @retval TRUE The CPU signature matches.\r
+ @retval FALSE The CPU signature does not match.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+StandardSignatureIsAuthenticAMD (\r
+ VOID\r
+ )\r
+{\r
+ UINT32 RegEbx;\r
+ UINT32 RegEcx;\r
+ UINT32 RegEdx;\r
+\r
+ AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);\r
+ return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&\r
+ RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&\r
+ RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);\r
+}\r
# The library routines are UEFI specification compliant.\r
#\r
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2020, AMD Inc. All rights reserved.<BR>\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
##\r
[Sources.X64]\r
X64/InitializeFpu.nasm\r
\r
+[Sources]\r
+ BaseUefiCpuLib.c\r
+\r
[Packages]\r
MdePkg/MdePkg.dec\r
UefiCpuPkg/UefiCpuPkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
This local APIC library instance supports xAPIC mode only.\r
\r
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>\r
- Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
+ Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.<BR>\r
\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
#include <Library/IoLib.h>\r
#include <Library/TimerLib.h>\r
#include <Library/PcdLib.h>\r
+#include <Library/UefiCpuLib.h>\r
\r
//\r
// Library internal functions\r
//\r
\r
-/**\r
- Determine if the standard CPU signature is "AuthenticAMD".\r
-\r
- @retval TRUE The CPU signature matches.\r
- @retval FALSE The CPU signature does not match.\r
-\r
-**/\r
-BOOLEAN\r
-StandardSignatureIsAuthenticAMD (\r
- VOID\r
- )\r
-{\r
- UINT32 RegEbx;\r
- UINT32 RegEcx;\r
- UINT32 RegEdx;\r
-\r
- AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);\r
- return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&\r
- RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&\r
- RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);\r
-}\r
-\r
/**\r
Determine if the CPU supports the Local APIC Base Address MSR.\r
\r
# where local APIC is disabled.\r
#\r
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2020, AMD Inc. All rights reserved.<BR>\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
##\r
TimerLib\r
IoLib\r
PcdLib\r
+ UefiCpuLib\r
\r
[Pcd]\r
gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds ## SOMETIMES_CONSUMES\r
which have xAPIC and x2APIC modes.\r
\r
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>\r
- Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
+ Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.<BR>\r
\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
#include <Library/IoLib.h>\r
#include <Library/TimerLib.h>\r
#include <Library/PcdLib.h>\r
+#include <Library/UefiCpuLib.h>\r
\r
//\r
// Library internal functions\r
//\r
\r
-/**\r
- Determine if the standard CPU signature is "AuthenticAMD".\r
-\r
- @retval TRUE The CPU signature matches.\r
- @retval FALSE The CPU signature does not match.\r
-\r
-**/\r
-BOOLEAN\r
-StandardSignatureIsAuthenticAMD (\r
- VOID\r
- )\r
-{\r
- UINT32 RegEbx;\r
- UINT32 RegEcx;\r
- UINT32 RegEdx;\r
-\r
- AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);\r
- return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&\r
- RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&\r
- RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);\r
-}\r
-\r
/**\r
Determine if the CPU supports the Local APIC Base Address MSR.\r
\r
# where local APIC is disabled.\r
#\r
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2020, AMD Inc. All rights reserved.<BR>\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
##\r
TimerLib\r
IoLib\r
PcdLib\r
+ UefiCpuLib\r
\r
[Pcd]\r
gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds ## SOMETIMES_CONSUMES\r
EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;\r
\r
\r
-/**\r
- Determine if the standard CPU signature is "AuthenticAMD".\r
-\r
- @retval TRUE The CPU signature matches.\r
- @retval FALSE The CPU signature does not match.\r
-\r
-**/\r
-STATIC\r
-BOOLEAN\r
-StandardSignatureIsAuthenticAMD (\r
- VOID\r
- )\r
-{\r
- UINT32 RegEbx;\r
- UINT32 RegEcx;\r
- UINT32 RegEdx;\r
-\r
- AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);\r
- return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&\r
- RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&\r
- RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);\r
-}\r
-\r
/**\r
The function will check if BSP Execute Disable is enabled.\r
\r