GNU Linux-libre 4.19.264-gnu1
[releases.git] / arch / x86 / include / asm / cpu_device_id.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _CPU_DEVICE_ID
3 #define _CPU_DEVICE_ID 1
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_STEPPINGS(mins, maxs)    GENMASK(maxs, mins)
13
14 /**
15  * X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE - Base macro for CPU matching
16  * @_vendor:    The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY
17  *              The name is expanded to X86_VENDOR_@_vendor
18  * @_family:    The family number or X86_FAMILY_ANY
19  * @_model:     The model number, model constant or X86_MODEL_ANY
20  * @_steppings: Bitmask for steppings, stepping constant or X86_STEPPING_ANY
21  * @_feature:   A X86_FEATURE bit or X86_FEATURE_ANY
22  * @_data:      Driver specific data or NULL. The internal storage
23  *              format is unsigned long. The supplied value, pointer
24  *              etc. is casted to unsigned long internally.
25  *
26  * Backport version to keep the SRBDS pile consistant. No shorter variants
27  * required for this.
28  */
29 #define X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(_vendor, _family, _model, \
30                                                     _steppings, _feature, _data) { \
31         .vendor         = X86_VENDOR_##_vendor,                         \
32         .family         = _family,                                      \
33         .model          = _model,                                       \
34         .steppings      = _steppings,                                   \
35         .feature        = _feature,                                     \
36         .driver_data    = (unsigned long) _data                         \
37 }
38
39 extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
40
41 #endif