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
17 #ifdef CONFIG_X86_FEATURE_NAMES
21 static char *cpu_name(int level
)
30 sprintf(buf
, "i%d86", level
);
35 static void show_cap_strs(u32
*err_flags
)
38 #ifdef CONFIG_X86_FEATURE_NAMES
39 const unsigned char *msg_strs
= (const unsigned char *)x86_cap_strs
;
40 for (i
= 0; i
< NCAPINTS
; i
++) {
42 for (j
= 0; j
< 32; j
++) {
43 if (msg_strs
[0] < i
||
44 (msg_strs
[0] == i
&& msg_strs
[1] < j
)) {
45 /* Skip to the next string */
51 if (msg_strs
[0] == i
&&
54 printf("%s ", msg_strs
+2);
56 printf("%d:%d ", i
, j
);
62 for (i
= 0; i
< NCAPINTS
; i
++) {
64 for (j
= 0; j
< 32; j
++) {
66 printf("%d:%d ", i
, j
);
73 int validate_cpu(void)
76 int cpu_level
, req_level
;
78 check_cpu(&cpu_level
, &req_level
, &err_flags
);
80 if (cpu_level
< req_level
) {
81 printf("This kernel requires an %s CPU, ",
83 printf("but only detected an %s CPU.\n",
89 puts("This kernel requires the following features "
90 "not present on the CPU:\n");
91 show_cap_strs(err_flags
);
94 } else if (check_knl_erratum()) {