New upstream version 18.02
[deb_dpdk.git] / config / arm / armv8_machine.py
diff --git a/config/arm/armv8_machine.py b/config/arm/armv8_machine.py
new file mode 100755 (executable)
index 0000000..404866d
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2017 Cavium, Inc
+
+ident = []
+fname = '/sys/devices/system/cpu/cpu0/regs/identification/midr_el1'
+with open(fname) as f:
+    content = f.read()
+
+midr_el1 = (int(content.rstrip('\n'), 16))
+
+ident.append(hex((midr_el1 >> 24) & 0xFF))  # Implementer
+ident.append(hex((midr_el1 >> 20) & 0xF))   # Variant
+ident.append(hex((midr_el1 >> 16) & 0XF))   # Architecture
+ident.append(hex((midr_el1 >> 4) & 0xFFF))  # Primary Part number
+ident.append(hex(midr_el1 & 0xF))           # Revision
+
+print(' '.join(ident))