diff options
author | Suzuki K. Poulose <suzuki.poulose@arm.com> | 2015-10-19 14:24:44 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-10-21 15:34:00 +0100 |
commit | ce98a677d897dbaac86905652292fab1eeeb2b93 (patch) | |
tree | 9eae65a188b49dab12b0494ed7e64caeb14230f2 /arch/arm64 | |
parent | 12d11817eaafa414eeb47af684093eb2165ebe37 (diff) | |
download | linux-ce98a677d897dbaac86905652292fab1eeeb2b93.tar.gz linux-ce98a677d897dbaac86905652292fab1eeeb2b93.tar.bz2 linux-ce98a677d897dbaac86905652292fab1eeeb2b93.zip |
arm64: Handle width of a cpuid feature
Introduce a helper to extract cpuid feature for any given
width.
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Tested-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/include/asm/cpufeature.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index b5f313d42d79..85507fecf287 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -76,10 +76,16 @@ static inline void cpus_set_cap(unsigned int num) __set_bit(num, cpu_hwcaps); } -static inline int __attribute_const__ cpuid_feature_extract_field(u64 features, - int field) +static inline int __attribute_const__ +cpuid_feature_extract_field_width(u64 features, int field, int width) { - return (s64)(features << (64 - 4 - field)) >> (64 - 4); + return (s64)(features << (64 - width - field)) >> (64 - width); +} + +static inline int __attribute_const__ +cpuid_feature_extract_field(u64 features, int field) +{ + return cpuid_feature_extract_field_width(features, field, 4); } static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0) |