1 // SPDX-License-Identifier: GPL-2.0-only
2 /* -*- linux-c -*- ------------------------------------------------------- *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright 2007-2008 rPath, Inc. - All Rights Reserved
7 * ----------------------------------------------------------------------- */
12 * Check for obligatory CPU features and abort if the features are not
19 static char *cpu_name(int level)
28 sprintf(buf, "i%d86", level);
33 static void show_cap_strs(u32 *err_flags)
36 const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs;
37 for (i = 0; i < NCAPINTS; i++) {
39 for (j = 0; j < 32; j++) {
40 if (msg_strs[0] < i ||
41 (msg_strs[0] == i && msg_strs[1] < j)) {
42 /* Skip to the next string */
48 if (msg_strs[0] == i &&
51 printf("%s ", msg_strs+2);
53 printf("%d:%d ", i, j);
60 int validate_cpu(void)
63 int cpu_level, req_level;
65 check_cpu(&cpu_level, &req_level, &err_flags);
67 if (cpu_level < req_level) {
68 printf("This kernel requires an %s CPU, ",
70 printf("but only detected an %s CPU.\n",
76 puts("This kernel requires the following features "
77 "not present on the CPU:\n");
78 show_cap_strs(err_flags);
81 } else if (check_knl_erratum()) {