]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
ARM: Better decode CPU Model Name
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)
Instead of always returning "ARM64", the CPU model name will now be the
CPU vendor followed by the core name and revisio, eg.

ARM Limited Cortex-A57 r1p2

hostinfoPosix arm64 hack to always return "armv8 unknown" is removed,
and will forward the CPU Model Name.

open-vm-tools/lib/misc/hostinfoPosix.c

index 6c7bf358f91a0351e5e8fa5de3f4613fd60b2f50..ca161e23edf0c71ea308c89b69e0e19708ae6873 100644 (file)
@@ -2433,28 +2433,19 @@ Hostinfo_GetCpuDescription(uint32 cpuNumber)  // IN:
    return HostinfoGetSysctlStringAlloc("machdep.cpu.brand_string");
 #elif defined(__FreeBSD__)
    return HostinfoGetSysctlStringAlloc("hw.model");
-#else
-#ifdef VMX86_SERVER
-#ifdef VM_ARM_64
-   return strdup("armv8 unknown");
-#else
-   if (HostType_OSIsVMK()) {
-      char mName[48];
+#elif defined VMX86_SERVER
+   /* VMKernel treats mName as an in/out parameter so terminate it. */
+   char mName[64] = { 0 };
 
-      /* VMKernel treats mName as an in/out parameter so terminate it. */
-      mName[0] = '\0';
-      if (VMKernel_GetCPUModelName(cpuNumber, mName,
-                                   sizeof(mName)) == VMK_OK) {
-         mName[sizeof(mName) - 1] = '\0';
+   if (VMKernel_GetCPUModelName(cpuNumber, mName,
+                                sizeof(mName)) == VMK_OK) {
+      mName[sizeof(mName) - 1] = '\0';
 
-         return strdup(mName);
-      }
-
-      return NULL;
+      return strdup(mName);
    }
-#endif // VM_ARM_64
-#endif // VMX86_SERVER
 
+   return NULL;
+#else
    return HostinfoGetCpuInfo(cpuNumber, "model name");
 #endif
 }