]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source files not applicable to open-vm-tools.
authorKruti <kpendharkar@vmware.com>
Mon, 27 May 2024 06:55:32 +0000 (23:55 -0700)
committerKruti <kpendharkar@vmware.com>
Mon, 27 May 2024 06:55:32 +0000 (23:55 -0700)
open-vm-tools/lib/include/vmcheck.h
open-vm-tools/lib/vmCheck/vmcheck.c

index adbdf18f359f04f6073d2a8436649a99aabcbf6c..9d3285c517cd3cbb1741858f59432b5a472b0d39 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 2006-2017 VMware, Inc. All rights reserved.
+ * Copyright (c) 2006-2024 Broadcom. All rights reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
  *
  *********************************************************/
 
-
 /*
  * vmcheck.h --
  *
- *    Utility functions for discovering our virtualization status.
+ *      Utility functions for discovering our virtualization status.
  */
 
-
 #ifndef __VMCHECK_H__
 #   define __VMCHECK_H__
 
@@ -37,6 +36,9 @@ Bool
 VmCheck_GetVersion(uint32 *version, // OUT
                    uint32 *type);   // OUT
 
+Bool
+VmCheck_GetHWVersion(uint32 *hwversion); // OUT
+
 Bool
 VmCheck_IsVirtualWorld(void);
 
index 0e296be5a0e5b4b61fd47c438c04f82a215f6b01..153e33034e9d1e4564e2d472ad38c547c777e239 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (c) 2006-2021, 2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 2006-2024 Broadcom. All rights reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -20,7 +21,7 @@
 /*
  * vmcheck.c --
  *
- *    Utility functions for discovering our virtualization status.
+ *      Utility functions for discovering our virtualization status.
  */
 
 #include <stdlib.h>
@@ -197,7 +198,7 @@ VmCheckSafe(SafeCheckFn checkFn)
 
 Bool
 VmCheck_GetVersion(uint32 *version, // OUT
-                    uint32 *type)    // OUT
+                   uint32 *type)    // OUT
 {
    Backdoor_proto bp;
 
@@ -243,6 +244,53 @@ VmCheck_GetVersion(uint32 *version, // OUT
 }
 
 
+/*
+ *----------------------------------------------------------------------
+ *
+ * VmCheck_GetHWVersion --
+ *
+ *    Retrieve the VM's hardware version.
+ *
+ * Return value:
+ *    TRUE on success
+ *       *hwversion contains the VM hardware version
+ *    FALSE on failure
+ *
+ * Side effects:
+ *    None
+ *
+ *----------------------------------------------------------------------
+ */
+
+Bool
+VmCheck_GetHWVersion(uint32 *hwversion) // OUT
+{
+   Backdoor_proto bp;
+   ASSERT(hwversion);
+
+   /* Make sure EBX does not contain BDOOR_MAGIC */
+   bp.in.size = (size_t)~BDOOR_MAGIC;
+   /* send backdoor command to get hw version */
+   bp.in.cx.halfs.low = BDOOR_CMD_GETHWVERSION;
+   Backdoor(&bp);
+
+   if (bp.out.ax.word == 0xFFFFFFFF) {
+      /*
+       * No backdoor device there. This code is not executing in a VMware
+       * virtual machine.
+       */
+      return FALSE;
+   }
+
+   if (bp.out.bx.word != BDOOR_MAGIC) {
+      return FALSE;
+   }
+
+   *hwversion = bp.out.ax.word;
+   return TRUE;
+}
+
+
 /*
  *----------------------------------------------------------------------
  *