1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_CPU_DEVICE_ID
3 #define _ASM_X86_CPU_DEVICE_ID
6 * Declare drivers belonging to specific x86 CPUs
7 * Similar in spirit to pci_device_id and related PCI functions
9 * The wildcard initializers are in mod_devicetable.h because
10 * file2alias needs them. Sigh.
12 #include <linux/mod_devicetable.h>
13 /* Get the INTEL_FAM* model defines */
14 #include <asm/intel-family.h>
15 /* And the X86_VENDOR_* ones */
16 #include <asm/processor.h>
18 /* Centaur FAM6 models */
19 #define X86_CENTAUR_FAM6_C7_A 0xa
20 #define X86_CENTAUR_FAM6_C7_D 0xd
21 #define X86_CENTAUR_FAM6_NANO 0xf
24 * X86_MATCH_VENDOR_FAM_MODEL_FEATURE - Base macro for CPU matching
25 * @_vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
26 * The name is expanded to X86_VENDOR_@_vendor
27 * @_family: The family number or X86_FAMILY_ANY
28 * @_model: The model number, model constant or X86_MODEL_ANY
29 * @_feature: A X86_FEATURE bit or X86_FEATURE_ANY
30 * @_data: Driver specific data or NULL. The internal storage
31 * format is unsigned long. The supplied value, pointer
32 * etc. is casted to unsigned long internally.
34 * Use only if you need all selectors. Otherwise use one of the shorter
35 * macros of the X86_MATCH_* family. If there is no matching shorthand
36 * macro, consider to add one. If you really need to wrap one of the macros
37 * into another macro at the usage site for good reasons, then please
38 * start this local macro with X86_MATCH to allow easy grepping.
40 #define X86_MATCH_VENDOR_FAM_MODEL_FEATURE(_vendor, _family, _model, \
42 .vendor = X86_VENDOR_##_vendor, \
45 .feature = _feature, \
46 .driver_data = (unsigned long) _data \
50 * X86_MATCH_VENDOR_FAM_FEATURE - Macro for matching vendor, family and CPU feature
51 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
52 * The name is expanded to X86_VENDOR_@vendor
53 * @family: The family number or X86_FAMILY_ANY
54 * @feature: A X86_FEATURE bit
55 * @data: Driver specific data or NULL. The internal storage
56 * format is unsigned long. The supplied value, pointer
57 * etc. is casted to unsigned long internally.
59 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
62 #define X86_MATCH_VENDOR_FAM_FEATURE(vendor, family, feature, data) \
63 X86_MATCH_VENDOR_FAM_MODEL_FEATURE(vendor, family, \
64 X86_MODEL_ANY, feature, data)
67 * X86_MATCH_VENDOR_FEATURE - Macro for matching vendor and CPU feature
68 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
69 * The name is expanded to X86_VENDOR_@vendor
70 * @feature: A X86_FEATURE bit
71 * @data: Driver specific data or NULL. The internal storage
72 * format is unsigned long. The supplied value, pointer
73 * etc. is casted to unsigned long internally.
75 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
78 #define X86_MATCH_VENDOR_FEATURE(vendor, feature, data) \
79 X86_MATCH_VENDOR_FAM_FEATURE(vendor, X86_FAMILY_ANY, feature, data)
82 * X86_MATCH_FEATURE - Macro for matching a CPU feature
83 * @feature: A X86_FEATURE bit
84 * @data: Driver specific data or NULL. The internal storage
85 * format is unsigned long. The supplied value, pointer
86 * etc. is casted to unsigned long internally.
88 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
91 #define X86_MATCH_FEATURE(feature, data) \
92 X86_MATCH_VENDOR_FEATURE(ANY, feature, data)
95 * X86_MATCH_VENDOR_FAM_MODEL - Match vendor, family and model
96 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
97 * The name is expanded to X86_VENDOR_@vendor
98 * @family: The family number or X86_FAMILY_ANY
99 * @model: The model number, model constant or X86_MODEL_ANY
100 * @data: Driver specific data or NULL. The internal storage
101 * format is unsigned long. The supplied value, pointer
102 * etc. is casted to unsigned long internally.
104 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
107 #define X86_MATCH_VENDOR_FAM_MODEL(vendor, family, model, data) \
108 X86_MATCH_VENDOR_FAM_MODEL_FEATURE(vendor, family, model, \
109 X86_FEATURE_ANY, data)
112 * X86_MATCH_VENDOR_FAM - Match vendor and family
113 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
114 * The name is expanded to X86_VENDOR_@vendor
115 * @family: The family number or X86_FAMILY_ANY
116 * @data: Driver specific data or NULL. The internal storage
117 * format is unsigned long. The supplied value, pointer
118 * etc. is casted to unsigned long internally.
120 * All other missing arguments to X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
123 #define X86_MATCH_VENDOR_FAM(vendor, family, data) \
124 X86_MATCH_VENDOR_FAM_MODEL(vendor, family, X86_MODEL_ANY, data)
127 * X86_MATCH_INTEL_FAM6_MODEL - Match vendor INTEL, family 6 and model
128 * @model: The model name without the INTEL_FAM6_ prefix or ANY
129 * The model name is expanded to INTEL_FAM6_@model internally
130 * @data: Driver specific data or NULL. The internal storage
131 * format is unsigned long. The supplied value, pointer
132 * etc. is casted to unsigned long internally.
134 * The vendor is set to INTEL, the family to 6 and all other missing
135 * arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are set to wildcards.
137 * See X86_MATCH_VENDOR_FAM_MODEL_FEATURE() for further information.
139 #define X86_MATCH_INTEL_FAM6_MODEL(model, data) \
140 X86_MATCH_VENDOR_FAM_MODEL(INTEL, 6, INTEL_FAM6_##model, data)
143 * Match specific microcode revisions.
145 * vendor/family/model/stepping must be all set.
147 * Only checks against the boot CPU. When mixed-stepping configs are
148 * valid for a CPU model, add a quirk for every valid stepping and
149 * do the fine-tuning in the quirk handler.
152 struct x86_cpu_desc {
157 u32 x86_microcode_rev;
160 #define INTEL_CPU_DESC(model, stepping, revision) { \
162 .x86_vendor = X86_VENDOR_INTEL, \
163 .x86_model = (model), \
164 .x86_stepping = (stepping), \
165 .x86_microcode_rev = (revision), \
168 extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
169 extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
171 #endif /* _ASM_X86_CPU_DEVICE_ID */