// SPDX-License-Identifier: GPL-2.0-only /* -*- linux-c -*- ------------------------------------------------------- * * * Copyright (C) 1991, 1992 Linus Torvalds * Copyright 2007 rPath, Inc. - All Rights Reserved * * ----------------------------------------------------------------------- */ /* * Check for obligatory CPU features and abort if the features are not * present. This code should be compilable as 16-, 32- or 64-bit * code, so be very careful with types and inline assembly. * * This code should not contain any messages; that requires an * additional wrapper. * * As written, this code is not safe for inclusion into the kernel * proper (after FPU initialization, in particular). */ #ifdef _SETUP # include "boot.h" #endif #include <linux/types.h> #include <asm/intel-family.h> #include <asm/processor-flags.h> #include <asm/required-features.h> #include <asm/msr-index.h> #include "string.h" #include "msr.h" static u32 err_flags[NCAPINTS]; static const int req_level = …; static const u32 req_flags[NCAPINTS] = …; #define A32(a, b, c, d) … static int is_amd(void) { … } static int is_centaur(void) { … } static int is_transmeta(void) { … } static int is_intel(void) { … } /* Returns a bitmask of which words we have error bits in */ static int check_cpuflags(void) { … } /* * Returns -1 on error. * * *cpu_level is set to the current CPU level; *req_level to the required * level. x86-64 is considered level 64 for this purpose. * * *err_flags_ptr is set to the flags error array if there are flags missing. */ int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr) { … } int check_knl_erratum(void) { … }