WIP FPC-III support
[linux/fpc-iii.git] / arch / x86 / include / asm / cpu_device_id.h
blobeb8fcede9e3bf4365e3d5347b5ff27783b4a7c11
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_CPU_DEVICE_ID
3 #define _ASM_X86_CPU_DEVICE_ID
5 /*
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
23 #define X86_STEPPINGS(mins, maxs) GENMASK(maxs, mins)
24 /**
25 * X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE - Base macro for CPU matching
26 * @_vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
27 * The name is expanded to X86_VENDOR_@_vendor
28 * @_family: The family number or X86_FAMILY_ANY
29 * @_model: The model number, model constant or X86_MODEL_ANY
30 * @_steppings: Bitmask for steppings, stepping constant or X86_STEPPING_ANY
31 * @_feature: A X86_FEATURE bit or X86_FEATURE_ANY
32 * @_data: Driver specific data or NULL. The internal storage
33 * format is unsigned long. The supplied value, pointer
34 * etc. is casted to unsigned long internally.
36 * Use only if you need all selectors. Otherwise use one of the shorter
37 * macros of the X86_MATCH_* family. If there is no matching shorthand
38 * macro, consider to add one. If you really need to wrap one of the macros
39 * into another macro at the usage site for good reasons, then please
40 * start this local macro with X86_MATCH to allow easy grepping.
42 #define X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(_vendor, _family, _model, \
43 _steppings, _feature, _data) { \
44 .vendor = X86_VENDOR_##_vendor, \
45 .family = _family, \
46 .model = _model, \
47 .steppings = _steppings, \
48 .feature = _feature, \
49 .driver_data = (unsigned long) _data \
52 /**
53 * X86_MATCH_VENDOR_FAM_MODEL_FEATURE - Macro for CPU matching
54 * @_vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
55 * The name is expanded to X86_VENDOR_@_vendor
56 * @_family: The family number or X86_FAMILY_ANY
57 * @_model: The model number, model constant or X86_MODEL_ANY
58 * @_feature: A X86_FEATURE bit or X86_FEATURE_ANY
59 * @_data: Driver specific data or NULL. The internal storage
60 * format is unsigned long. The supplied value, pointer
61 * etc. is casted to unsigned long internally.
63 * The steppings arguments of X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE() is
64 * set to wildcards.
66 #define X86_MATCH_VENDOR_FAM_MODEL_FEATURE(vendor, family, model, feature, data) \
67 X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(vendor, family, model, \
68 X86_STEPPING_ANY, feature, data)
70 /**
71 * X86_MATCH_VENDOR_FAM_FEATURE - Macro for matching vendor, family and CPU feature
72 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
73 * The name is expanded to X86_VENDOR_@vendor
74 * @family: The family number or X86_FAMILY_ANY
75 * @feature: A X86_FEATURE bit
76 * @data: Driver specific data or NULL. The internal storage
77 * format is unsigned long. The supplied value, pointer
78 * etc. is casted to unsigned long internally.
80 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
81 * set to wildcards.
83 #define X86_MATCH_VENDOR_FAM_FEATURE(vendor, family, feature, data) \
84 X86_MATCH_VENDOR_FAM_MODEL_FEATURE(vendor, family, \
85 X86_MODEL_ANY, feature, data)
87 /**
88 * X86_MATCH_VENDOR_FEATURE - Macro for matching vendor and CPU feature
89 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
90 * The name is expanded to X86_VENDOR_@vendor
91 * @feature: A X86_FEATURE bit
92 * @data: Driver specific data or NULL. The internal storage
93 * format is unsigned long. The supplied value, pointer
94 * etc. is casted to unsigned long internally.
96 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
97 * set to wildcards.
99 #define X86_MATCH_VENDOR_FEATURE(vendor, feature, data) \
100 X86_MATCH_VENDOR_FAM_FEATURE(vendor, X86_FAMILY_ANY, feature, data)
103 * X86_MATCH_FEATURE - Macro for matching a CPU feature
104 * @feature: A X86_FEATURE bit
105 * @data: Driver specific data or NULL. The internal storage
106 * format is unsigned long. The supplied value, pointer
107 * etc. is casted to unsigned long internally.
109 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
110 * set to wildcards.
112 #define X86_MATCH_FEATURE(feature, data) \
113 X86_MATCH_VENDOR_FEATURE(ANY, feature, data)
116 * X86_MATCH_VENDOR_FAM_MODEL - Match vendor, family and model
117 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
118 * The name is expanded to X86_VENDOR_@vendor
119 * @family: The family number or X86_FAMILY_ANY
120 * @model: The model number, model constant or X86_MODEL_ANY
121 * @data: Driver specific data or NULL. The internal storage
122 * format is unsigned long. The supplied value, pointer
123 * etc. is casted to unsigned long internally.
125 * All other missing arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
126 * set to wildcards.
128 #define X86_MATCH_VENDOR_FAM_MODEL(vendor, family, model, data) \
129 X86_MATCH_VENDOR_FAM_MODEL_FEATURE(vendor, family, model, \
130 X86_FEATURE_ANY, data)
133 * X86_MATCH_VENDOR_FAM - Match vendor and family
134 * @vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
135 * The name is expanded to X86_VENDOR_@vendor
136 * @family: The family number or X86_FAMILY_ANY
137 * @data: Driver specific data or NULL. The internal storage
138 * format is unsigned long. The supplied value, pointer
139 * etc. is casted to unsigned long internally.
141 * All other missing arguments to X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are
142 * set of wildcards.
144 #define X86_MATCH_VENDOR_FAM(vendor, family, data) \
145 X86_MATCH_VENDOR_FAM_MODEL(vendor, family, X86_MODEL_ANY, data)
148 * X86_MATCH_INTEL_FAM6_MODEL - Match vendor INTEL, family 6 and model
149 * @model: The model name without the INTEL_FAM6_ prefix or ANY
150 * The model name is expanded to INTEL_FAM6_@model internally
151 * @data: Driver specific data or NULL. The internal storage
152 * format is unsigned long. The supplied value, pointer
153 * etc. is casted to unsigned long internally.
155 * The vendor is set to INTEL, the family to 6 and all other missing
156 * arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are set to wildcards.
158 * See X86_MATCH_VENDOR_FAM_MODEL_FEATURE() for further information.
160 #define X86_MATCH_INTEL_FAM6_MODEL(model, data) \
161 X86_MATCH_VENDOR_FAM_MODEL(INTEL, 6, INTEL_FAM6_##model, data)
163 #define X86_MATCH_INTEL_FAM6_MODEL_STEPPINGS(model, steppings, data) \
164 X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(INTEL, 6, INTEL_FAM6_##model, \
165 steppings, X86_FEATURE_ANY, data)
168 * Match specific microcode revisions.
170 * vendor/family/model/stepping must be all set.
172 * Only checks against the boot CPU. When mixed-stepping configs are
173 * valid for a CPU model, add a quirk for every valid stepping and
174 * do the fine-tuning in the quirk handler.
177 struct x86_cpu_desc {
178 u8 x86_family;
179 u8 x86_vendor;
180 u8 x86_model;
181 u8 x86_stepping;
182 u32 x86_microcode_rev;
185 #define INTEL_CPU_DESC(model, stepping, revision) { \
186 .x86_family = 6, \
187 .x86_vendor = X86_VENDOR_INTEL, \
188 .x86_model = (model), \
189 .x86_stepping = (stepping), \
190 .x86_microcode_rev = (revision), \
193 extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
194 extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
196 #endif /* _ASM_X86_CPU_DEVICE_ID */