]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib
[mirror_edk2.git] / UefiCpuPkg / Library / BaseUefiCpuLib / BaseUefiCpuLib.c
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
new file mode 100644 (file)
index 0000000..c2cc3ff
--- /dev/null
@@ -0,0 +1,38 @@
+/** @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