aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarat Dukhan <marat@fb.com>2017-11-27 14:54:43 -0800
committerMarat Dukhan <marat@fb.com>2017-11-27 14:54:43 -0800
commit166ce4c078beba4eaf9d4a4f84a29c10196ecc12 (patch)
treebab39b19c4d727a172b600bd896b09c408972c8a /src
parent5315276ab0f31d65dc08b97d263862519a0df803 (diff)
downloadcpuinfo-166ce4c078beba4eaf9d4a4f84a29c10196ecc12.tar.gz
Recognize new HiSilicon Kirin signature in ro.board.platform
Diffstat (limited to 'src')
-rw-r--r--src/arm/linux/chipset.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/arm/linux/chipset.c b/src/arm/linux/chipset.c
index 6481058..a8f2c56 100644
--- a/src/arm/linux/chipset.c
+++ b/src/arm/linux/chipset.c
@@ -601,7 +601,7 @@ static bool match_mt(
}
/**
- * Tries to match /Kirin\s?\d{3}$/ signature for HiSilicon Kirin chipsets.
+ * Tries to match /[Kk]irin\s?\d{3}$/ signature for HiSilicon Kirin chipsets.
* If match successful, extracts model information into \p chipset argument.
*
* @param start - start of the /proc/cpuinfo Hardware string to match.
@@ -624,10 +624,11 @@ static bool match_kirin(
return false;
}
- /* Check that the string starts with "Kirin". Symbols 1-5 are loaded and compared as little-endian 32-bit word. */
- if (start[0] != 'K') {
+ /* Check that the string starts with "Kirin" or "kirin". */
+ if (((uint8_t) start[0] | UINT8_C(0x20)) != (uint8_t) 'k') {
return false;
}
+ /* Symbols 1-5 are loaded and compared as little-endian 32-bit word. */
const uint32_t irin = load_u32le(start + 1);
if (irin != UINT32_C(0x6E697269) /* "niri" = reverse("irin") */) {
return false;
@@ -2637,6 +2638,13 @@ struct cpuinfo_arm_chipset cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_ha
return chipset;
}
+ /* Check HiSilicon Kirin signature */
+ if (match_kirin(platform, platform_end, &chipset)) {
+ cpuinfo_log_debug(
+ "matched HiSilicon Kirin signature in ro.board.platform string \"%.*s\"", (int) platform_length, platform);
+ return chipset;
+ }
+
/* Check Spreadtrum SC signature */
if (match_sc(platform, platform_end, &chipset)) {
cpuinfo_log_debug(