diff options
-rw-r--r-- | arch/x86/boot/Makefile | 16 | ||||
-rw-r--r-- | arch/x86/boot/cpu.c | 26 | ||||
-rw-r--r-- | arch/x86/boot/mkcpustr.c | 49 |
3 files changed, 82 insertions, 9 deletions
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 254a58398a67..f88458e83ef0 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -26,7 +26,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA | |||
26 | #RAMDISK := -DRAMDISK=512 | 26 | #RAMDISK := -DRAMDISK=512 |
27 | 27 | ||
28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage | 28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage |
29 | subdir- := compressed | 29 | subdir- := compressed |
30 | 30 | ||
31 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o | 31 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o |
32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o | 32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o |
@@ -43,9 +43,17 @@ setup-y += video-vesa.o | |||
43 | setup-y += video-bios.o | 43 | setup-y += video-bios.o |
44 | 44 | ||
45 | targets += $(setup-y) | 45 | targets += $(setup-y) |
46 | hostprogs-y := tools/build | 46 | hostprogs-y := mkcpustr tools/build |
47 | 47 | ||
48 | HOSTCFLAGS_build.o := $(LINUXINCLUDE) | 48 | HOST_EXTRACFLAGS += $(LINUXINCLUDE) |
49 | |||
50 | $(obj)/cpu.o: $(obj)/cpustr.h | ||
51 | |||
52 | quiet_cmd_cpustr = CPUSTR $@ | ||
53 | cmd_cpustr = $(obj)/mkcpustr > $@ | ||
54 | targets += cpustr.h | ||
55 | $(obj)/cpustr.h: $(obj)/mkcpustr FORCE | ||
56 | $(call if_changed,cpustr) | ||
49 | 57 | ||
50 | # --------------------------------------------------------------------------- | 58 | # --------------------------------------------------------------------------- |
51 | 59 | ||
@@ -98,7 +106,7 @@ $(obj)/compressed/vmlinux: FORCE | |||
98 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ | 106 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ |
99 | 107 | ||
100 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel | 108 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel |
101 | FDARGS = | 109 | FDARGS = |
102 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel | 110 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel |
103 | FDINITRD = | 111 | FDINITRD = |
104 | 112 | ||
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c index 2a5c32da5852..00e19edd852c 100644 --- a/arch/x86/boot/cpu.c +++ b/arch/x86/boot/cpu.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* -*- linux-c -*- ------------------------------------------------------- * | 1 | /* -*- linux-c -*- ------------------------------------------------------- * |
2 | * | 2 | * |
3 | * Copyright (C) 1991, 1992 Linus Torvalds | 3 | * Copyright (C) 1991, 1992 Linus Torvalds |
4 | * Copyright 2007 rPath, Inc. - All Rights Reserved | 4 | * Copyright 2007-2008 rPath, Inc. - All Rights Reserved |
5 | * | 5 | * |
6 | * This file is part of the Linux kernel, and is made available under | 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. | 7 | * the terms of the GNU General Public License version 2. |
@@ -9,7 +9,7 @@ | |||
9 | * ----------------------------------------------------------------------- */ | 9 | * ----------------------------------------------------------------------- */ |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * arch/i386/boot/cpu.c | 12 | * arch/x86/boot/cpu.c |
13 | * | 13 | * |
14 | * Check for obligatory CPU features and abort if the features are not | 14 | * Check for obligatory CPU features and abort if the features are not |
15 | * present. | 15 | * present. |
@@ -19,6 +19,8 @@ | |||
19 | #include "bitops.h" | 19 | #include "bitops.h" |
20 | #include <asm/cpufeature.h> | 20 | #include <asm/cpufeature.h> |
21 | 21 | ||
22 | #include "cpustr.h" | ||
23 | |||
22 | static char *cpu_name(int level) | 24 | static char *cpu_name(int level) |
23 | { | 25 | { |
24 | static char buf[6]; | 26 | static char buf[6]; |
@@ -35,6 +37,7 @@ int validate_cpu(void) | |||
35 | { | 37 | { |
36 | u32 *err_flags; | 38 | u32 *err_flags; |
37 | int cpu_level, req_level; | 39 | int cpu_level, req_level; |
40 | const unsigned char *msg_strs; | ||
38 | 41 | ||
39 | check_cpu(&cpu_level, &req_level, &err_flags); | 42 | check_cpu(&cpu_level, &req_level, &err_flags); |
40 | 43 | ||
@@ -51,13 +54,26 @@ int validate_cpu(void) | |||
51 | puts("This kernel requires the following features " | 54 | puts("This kernel requires the following features " |
52 | "not present on the CPU:\n"); | 55 | "not present on the CPU:\n"); |
53 | 56 | ||
57 | msg_strs = (const unsigned char *)x86_cap_strs; | ||
58 | |||
54 | for (i = 0; i < NCAPINTS; i++) { | 59 | for (i = 0; i < NCAPINTS; i++) { |
55 | u32 e = err_flags[i]; | 60 | u32 e = err_flags[i]; |
56 | 61 | ||
57 | for (j = 0; j < 32; j++) { | 62 | for (j = 0; j < 32; j++) { |
58 | if (e & 1) | 63 | int n = (i << 5)+j; |
59 | printf("%d:%d ", i, j); | 64 | if (*msg_strs < n) { |
60 | 65 | /* Skip to the next string */ | |
66 | do { | ||
67 | msg_strs++; | ||
68 | } while (*msg_strs); | ||
69 | msg_strs++; | ||
70 | } | ||
71 | if (e & 1) { | ||
72 | if (*msg_strs == n && msg_strs[1]) | ||
73 | printf("%s ", msg_strs+1); | ||
74 | else | ||
75 | printf("%d:%d ", i, j); | ||
76 | } | ||
61 | e >>= 1; | 77 | e >>= 1; |
62 | } | 78 | } |
63 | } | 79 | } |
diff --git a/arch/x86/boot/mkcpustr.c b/arch/x86/boot/mkcpustr.c new file mode 100644 index 000000000000..bbe76953bae9 --- /dev/null +++ b/arch/x86/boot/mkcpustr.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* ----------------------------------------------------------------------- * | ||
2 | * | ||
3 | * Copyright 2008 rPath, Inc. - All Rights Reserved | ||
4 | * | ||
5 | * This file is part of the Linux kernel, and is made available under | ||
6 | * the terms of the GNU General Public License version 2 or (at your | ||
7 | * option) any later version; incorporated herein by reference. | ||
8 | * | ||
9 | * ----------------------------------------------------------------------- */ | ||
10 | |||
11 | /* | ||
12 | * This is a host program to preprocess the CPU strings into a | ||
13 | * compact format suitable for the setup code. | ||
14 | */ | ||
15 | |||
16 | #include <stdio.h> | ||
17 | |||
18 | #include "../kernel/cpu/feature_names.c" | ||
19 | |||
20 | #if NCAPFLAGS > 8 | ||
21 | # error "Need to adjust the boot code handling of CPUID strings" | ||
22 | #endif | ||
23 | |||
24 | int main(void) | ||
25 | { | ||
26 | int i; | ||
27 | const char *str; | ||
28 | |||
29 | printf("static const char x86_cap_strs[] = \n"); | ||
30 | |||
31 | for (i = 0; i < NCAPINTS*32; i++) { | ||
32 | str = x86_cap_flags[i]; | ||
33 | |||
34 | if (i == NCAPINTS*32-1) { | ||
35 | /* The last entry must be unconditional; this | ||
36 | also consumes the compiler-added null character */ | ||
37 | if (!str) | ||
38 | str = ""; | ||
39 | printf("\t\"\\x%02x\"\"%s\"\n", i, str); | ||
40 | } else if (str) { | ||
41 | printf("#if REQUIRED_MASK%d & (1 << %d)\n" | ||
42 | "\t\"\\x%02x\"\"%s\\0\"\n" | ||
43 | "#endif\n", | ||
44 | i >> 5, i & 31, i, str); | ||
45 | } | ||
46 | } | ||
47 | printf("\t;\n"); | ||
48 | return 0; | ||
49 | } | ||