// SPDX-License-Identifier: GPL-2.0 #include <asm/cpu_device_id.h> #include <asm/cpufeature.h> #include <linux/cpu.h> #include <linux/export.h> #include <linux/slab.h> /** * x86_match_cpu - match current CPU again an array of x86_cpu_ids * @match: Pointer to array of x86_cpu_ids. Last entry terminated with * {}. * * Return the entry if the current CPU matches the entries in the * passed x86_cpu_id match table. Otherwise NULL. The match table * contains vendor (X86_VENDOR_*), family, model and feature bits or * respective wildcard entries. * * A typical table entry would be to match a specific CPU * * X86_MATCH_VFM_FEATURE(INTEL_BROADWELL, X86_FEATURE_ANY, NULL); * * Fields can be wildcarded with %X86_VENDOR_ANY, %X86_FAMILY_ANY, * %X86_MODEL_ANY, %X86_FEATURE_ANY (except for vendor) * * asm/cpu_device_id.h contains a set of useful macros which are shortcuts * for various common selections. The above can be shortened to: * * X86_MATCH_VFM(INTEL_BROADWELL, NULL); * * Arrays used to match for this should also be declared using * MODULE_DEVICE_TABLE(x86cpu, ...) * * This always matches against the boot cpu, assuming models and features are * consistent over all CPUs. */ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match) { … } EXPORT_SYMBOL(…); static const struct x86_cpu_desc * x86_match_cpu_with_stepping(const struct x86_cpu_desc *match) { … } bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table) { … } EXPORT_SYMBOL_GPL(…);