Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Helpers for Intel SoC model detection
0004  *
0005  * Copyright (c) 2019, Intel Corporation.
0006  */
0007 
0008 #ifndef __PLATFORM_DATA_X86_SOC_H
0009 #define __PLATFORM_DATA_X86_SOC_H
0010 
0011 #if IS_ENABLED(CONFIG_X86)
0012 
0013 #include <asm/cpu_device_id.h>
0014 #include <asm/intel-family.h>
0015 
0016 #define SOC_INTEL_IS_CPU(soc, type)             \
0017 static inline bool soc_intel_is_##soc(void)         \
0018 {                               \
0019     static const struct x86_cpu_id soc##_cpu_ids[] = {  \
0020         X86_MATCH_INTEL_FAM6_MODEL(type, NULL),     \
0021         {}                      \
0022     };                          \
0023     const struct x86_cpu_id *id;                \
0024                                 \
0025     id = x86_match_cpu(soc##_cpu_ids);          \
0026     if (id)                         \
0027         return true;                    \
0028     return false;                       \
0029 }
0030 
0031 SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT);
0032 SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT);
0033 SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT);
0034 SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS);
0035 SOC_INTEL_IS_CPU(cml, KABYLAKE_L);
0036 
0037 #else /* IS_ENABLED(CONFIG_X86) */
0038 
0039 static inline bool soc_intel_is_byt(void)
0040 {
0041     return false;
0042 }
0043 
0044 static inline bool soc_intel_is_cht(void)
0045 {
0046     return false;
0047 }
0048 
0049 static inline bool soc_intel_is_apl(void)
0050 {
0051     return false;
0052 }
0053 
0054 static inline bool soc_intel_is_glk(void)
0055 {
0056     return false;
0057 }
0058 
0059 static inline bool soc_intel_is_cml(void)
0060 {
0061     return false;
0062 }
0063 #endif /* IS_ENABLED(CONFIG_X86) */
0064 
0065 #endif /* __PLATFORM_DATA_X86_SOC_H */