1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 /* 3 * Copyright (C) 2017 Linaro Ltd. <ard.biesheu 4 */ 5 6 #ifndef __ASM_CPUFEATURE_H 7 #define __ASM_CPUFEATURE_H 8 9 #include <linux/log2.h> 10 #include <asm/hwcap.h> 11 12 /* 13 * Due to the fact that ELF_HWCAP is a 32-bit 14 * of optional CPU features it defines, ARM's 15 * been distributed over separate elf_hwcap an 16 * which covers a subset of the available CPU 17 * 18 * Currently, only a few of those are suitable 19 * (which is the primary use case of this faci 20 * covered by HWCAP2. So let's only cover thos 21 * convenience macro for now (which is used by 22 * However, all capabilities are exposed via t 23 * using an explicit MODULE_DEVICE_TABLE() tha 24 */ 25 #define MAX_CPU_FEATURES 64 26 #define __hwcap_feature(x) ilog2(HWCAP_ # 27 #define __hwcap2_feature(x) (32 + ilog2(HW 28 #define cpu_feature(x) __hwcap2_featu 29 30 static inline bool cpu_have_feature(unsigned i 31 { 32 return num < 32 ? elf_hwcap & BIT(num) 33 } 34 35 #endif 36
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.