Linux-libre 5.4.49-gnu
[librecmc/linux-libre.git] / arch / x86 / include / asm / cpu_device_id.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_CPU_DEVICE_ID
3 #define _ASM_X86_CPU_DEVICE_ID
4
5 /*
6  * Declare drivers belonging to specific x86 CPUs
7  * Similar in spirit to pci_device_id and related PCI functions
8  */
9
10 #include <linux/mod_devicetable.h>
11
12 #define X86_CENTAUR_FAM6_C7_D           0xd
13 #define X86_CENTAUR_FAM6_NANO           0xf
14
15 #define X86_STEPPINGS(mins, maxs)    GENMASK(maxs, mins)
16
17 /**
18  * X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE - Base macro for CPU matching
19  * @_vendor:    The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
20  *              The name is expanded to X86_VENDOR_@_vendor
21  * @_family:    The family number or X86_FAMILY_ANY
22  * @_model:     The model number, model constant or X86_MODEL_ANY
23  * @_steppings: Bitmask for steppings, stepping constant or X86_STEPPING_ANY
24  * @_feature:   A X86_FEATURE bit or X86_FEATURE_ANY
25  * @_data:      Driver specific data or NULL. The internal storage
26  *              format is unsigned long. The supplied value, pointer
27  *              etc. is casted to unsigned long internally.
28  *
29  * Backport version to keep the SRBDS pile consistant. No shorter variants
30  * required for this.
31  */
32 #define X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(_vendor, _family, _model, \
33                                                     _steppings, _feature, _data) { \
34         .vendor         = X86_VENDOR_##_vendor,                         \
35         .family         = _family,                                      \
36         .model          = _model,                                       \
37         .steppings      = _steppings,                                   \
38         .feature        = _feature,                                     \
39         .driver_data    = (unsigned long) _data                         \
40 }
41
42 /*
43  * Match specific microcode revisions.
44  *
45  * vendor/family/model/stepping must be all set.
46  *
47  * Only checks against the boot CPU.  When mixed-stepping configs are
48  * valid for a CPU model, add a quirk for every valid stepping and
49  * do the fine-tuning in the quirk handler.
50  */
51
52 struct x86_cpu_desc {
53         u8      x86_family;
54         u8      x86_vendor;
55         u8      x86_model;
56         u8      x86_stepping;
57         u32     x86_microcode_rev;
58 };
59
60 #define INTEL_CPU_DESC(model, stepping, revision) {             \
61         .x86_family             = 6,                            \
62         .x86_vendor             = X86_VENDOR_INTEL,             \
63         .x86_model              = (model),                      \
64         .x86_stepping           = (stepping),                   \
65         .x86_microcode_rev      = (revision),                   \
66 }
67
68 extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
69 extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
70
71 #endif /* _ASM_X86_CPU_DEVICE_ID */