~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/cpufeature.h

Version: ~ [ linux-5.15-rc1 ] ~ [ linux-5.14.5 ] ~ [ linux-5.13.18 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.66 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.147 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.206 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.246 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.282 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.283 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License version 2 as
  6  * published by the Free Software Foundation.
  7  */
  8 
  9 #ifndef __LINUX_CPUFEATURE_H
 10 #define __LINUX_CPUFEATURE_H
 11 
 12 #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
 13 
 14 #include <linux/init.h>
 15 #include <linux/mod_devicetable.h>
 16 #include <asm/cpufeature.h>
 17 
 18 /*
 19  * Macros imported from <asm/cpufeature.h>:
 20  * - cpu_feature(x)             ordinal value of feature called 'x'
 21  * - cpu_have_feature(u32 n)    whether feature #n is available
 22  * - MAX_CPU_FEATURES           upper bound for feature ordinal values
 23  * Optional:
 24  * - CPU_FEATURE_TYPEFMT        format string fragment for printing the cpu type
 25  * - CPU_FEATURE_TYPEVAL        set of values matching the format string above
 26  */
 27 
 28 #ifndef CPU_FEATURE_TYPEFMT
 29 #define CPU_FEATURE_TYPEFMT     "%s"
 30 #endif
 31 
 32 #ifndef CPU_FEATURE_TYPEVAL
 33 #define CPU_FEATURE_TYPEVAL     ELF_PLATFORM
 34 #endif
 35 
 36 /*
 37  * Use module_cpu_feature_match(feature, module_init_function) to
 38  * declare that
 39  * a) the module shall be probed upon discovery of CPU feature 'feature'
 40  *    (typically at boot time using udev)
 41  * b) the module must not be loaded if CPU feature 'feature' is not present
 42  *    (not even by manual insmod).
 43  *
 44  * For a list of legal values for 'feature', please consult the file
 45  * 'asm/cpufeature.h' of your favorite architecture.
 46  */
 47 #define module_cpu_feature_match(x, __initfunc)                 \
 48 static struct cpu_feature const cpu_feature_match_ ## x[] =     \
 49         { { .feature = cpu_feature(x) }, { } };                 \
 50 MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x);              \
 51                                                                 \
 52 static int __init cpu_feature_match_ ## x ## _init(void)        \
 53 {                                                               \
 54         if (!cpu_have_feature(cpu_feature(x)))                  \
 55                 return -ENODEV;                                 \
 56         return __initfunc();                                    \
 57 }                                                               \
 58 module_init(cpu_feature_match_ ## x ## _init)
 59 
 60 #endif
 61 #endif
 62 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp