1 /* -*- linux-c -*- ------------------------------------------------------- *
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007-2008 rPath, Inc. - All Rights Reserved
6 * This file is part of the Linux kernel, and is made available under
7 * the terms of the GNU General Public License version 2.
9 * ----------------------------------------------------------------------- */
14 * Check for obligatory CPU features and abort if the features are not
19 #ifdef CONFIG_X86_FEATURE_NAMES
23 static char *cpu_name(int level
)
32 sprintf(buf
, "i%d86", level
);
37 static void show_cap_strs(u32
*err_flags
)
40 #ifdef CONFIG_X86_FEATURE_NAMES
41 const unsigned char *msg_strs
= (const unsigned char *)x86_cap_strs
;
42 for (i
= 0; i
< NCAPINTS
; i
++) {
44 for (j
= 0; j
< 32; j
++) {
45 if (msg_strs
[0] < i
||
46 (msg_strs
[0] == i
&& msg_strs
[1] < j
)) {
47 /* Skip to the next string */
53 if (msg_strs
[0] == i
&&
56 printf("%s ", msg_strs
+2);
58 printf("%d:%d ", i
, j
);
64 for (i
= 0; i
< NCAPINTS
; i
++) {
66 for (j
= 0; j
< 32; j
++) {
68 printf("%d:%d ", i
, j
);
75 int validate_cpu(void)
78 int cpu_level
, req_level
;
80 check_cpu(&cpu_level
, &req_level
, &err_flags
);
82 if (cpu_level
< req_level
) {
83 printf("This kernel requires an %s CPU, ",
85 printf("but only detected an %s CPU.\n",
91 puts("This kernel requires the following features "
92 "not present on the CPU:\n");
93 show_cap_strs(err_flags
);
96 } else if (check_knl_erratum()) {