diff options
author | Huang, Ying <ying.huang@intel.com> | 2008-01-30 07:32:51 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:51 -0500 |
commit | 6d7d7433750c7c6eec93d7b3206019e329228686 (patch) | |
tree | 994af4318b30f79ab820438c68c8ef7d932d9d01 /arch/x86 | |
parent | 4d022e35fd7e07c522c7863fee6f07e53cf3fc14 (diff) |
x86 boot : export boot_params via debugfs for debugging
This patch export the boot parameters via debugfs for debugging.
The files added are as follow:
boot_params/data : binary file for struct boot_params
boot_params/version : boot protocol version
This patch is based on 2.6.24-rc5-mm1 and has been tested on i386 and
x86_64 platform.
This patch is based on the Peter Anvin's proposal.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/Kconfig.debug | 7 | ||||
-rw-r--r-- | arch/x86/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/kernel/kdebugfs.c | 65 | ||||
-rw-r--r-- | arch/x86/kernel/setup64.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/setup_32.c | 4 |
5 files changed, 81 insertions, 1 deletions
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 660200915baa..15854b53badc 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -185,4 +185,11 @@ config DEFAULT_IO_DELAY_TYPE | |||
185 | default IO_DELAY_TYPE_NONE | 185 | default IO_DELAY_TYPE_NONE |
186 | endif | 186 | endif |
187 | 187 | ||
188 | config DEBUG_BOOT_PARAMS | ||
189 | bool "Debug boot parameters" | ||
190 | depends on DEBUG_KERNEL | ||
191 | depends on DEBUG_FS | ||
192 | help | ||
193 | This option will cause struct boot_params to be exported via debugfs. | ||
194 | |||
188 | endmenu | 195 | endmenu |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index b40bed4baa77..3d23ccd366ea 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -16,7 +16,7 @@ obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o | |||
16 | obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o | 16 | obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o |
17 | obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o setup64.o | 17 | obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o setup64.o |
18 | obj-y += pci-dma_$(BITS).o bootflag.o e820_$(BITS).o | 18 | obj-y += pci-dma_$(BITS).o bootflag.o e820_$(BITS).o |
19 | obj-y += quirks.o i8237.o topology.o | 19 | obj-y += quirks.o i8237.o topology.o kdebugfs.o |
20 | obj-y += alternative.o i8253.o | 20 | obj-y += alternative.o i8253.o |
21 | obj-$(CONFIG_X86_64) += pci-nommu_64.o bugs_64.o | 21 | obj-$(CONFIG_X86_64) += pci-nommu_64.o bugs_64.o |
22 | obj-y += tsc_$(BITS).o io_delay.o rtc.o | 22 | obj-y += tsc_$(BITS).o io_delay.o rtc.o |
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c new file mode 100644 index 000000000000..73354302fda7 --- /dev/null +++ b/arch/x86/kernel/kdebugfs.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Architecture specific debugfs files | ||
3 | * | ||
4 | * Copyright (C) 2007, Intel Corp. | ||
5 | * Huang Ying <ying.huang@intel.com> | ||
6 | * | ||
7 | * This file is released under the GPLv2. | ||
8 | */ | ||
9 | |||
10 | #include <linux/debugfs.h> | ||
11 | #include <linux/stat.h> | ||
12 | #include <linux/init.h> | ||
13 | |||
14 | #include <asm/setup.h> | ||
15 | |||
16 | #ifdef CONFIG_DEBUG_BOOT_PARAMS | ||
17 | static struct debugfs_blob_wrapper boot_params_blob = { | ||
18 | .data = &boot_params, | ||
19 | .size = sizeof(boot_params), | ||
20 | }; | ||
21 | |||
22 | static int __init boot_params_kdebugfs_init(void) | ||
23 | { | ||
24 | int error; | ||
25 | struct dentry *dbp, *version, *data; | ||
26 | |||
27 | dbp = debugfs_create_dir("boot_params", NULL); | ||
28 | if (!dbp) { | ||
29 | error = -ENOMEM; | ||
30 | goto err_return; | ||
31 | } | ||
32 | version = debugfs_create_x16("version", S_IRUGO, dbp, | ||
33 | &boot_params.hdr.version); | ||
34 | if (!version) { | ||
35 | error = -ENOMEM; | ||
36 | goto err_dir; | ||
37 | } | ||
38 | data = debugfs_create_blob("data", S_IRUGO, dbp, | ||
39 | &boot_params_blob); | ||
40 | if (!data) { | ||
41 | error = -ENOMEM; | ||
42 | goto err_version; | ||
43 | } | ||
44 | return 0; | ||
45 | err_version: | ||
46 | debugfs_remove(version); | ||
47 | err_dir: | ||
48 | debugfs_remove(dbp); | ||
49 | err_return: | ||
50 | return error; | ||
51 | } | ||
52 | #endif | ||
53 | |||
54 | static int __init arch_kdebugfs_init(void) | ||
55 | { | ||
56 | int error = 0; | ||
57 | |||
58 | #ifdef CONFIG_DEBUG_BOOT_PARAMS | ||
59 | error = boot_params_kdebugfs_init(); | ||
60 | #endif | ||
61 | |||
62 | return error; | ||
63 | } | ||
64 | |||
65 | arch_initcall(arch_kdebugfs_init); | ||
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c index 3b0ffa31f3c0..8fa0de810d0b 100644 --- a/arch/x86/kernel/setup64.c +++ b/arch/x86/kernel/setup64.c | |||
@@ -24,7 +24,11 @@ | |||
24 | #include <asm/sections.h> | 24 | #include <asm/sections.h> |
25 | #include <asm/setup.h> | 25 | #include <asm/setup.h> |
26 | 26 | ||
27 | #ifndef CONFIG_DEBUG_BOOT_PARAMS | ||
27 | struct boot_params __initdata boot_params; | 28 | struct boot_params __initdata boot_params; |
29 | #else | ||
30 | struct boot_params boot_params; | ||
31 | #endif | ||
28 | 32 | ||
29 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | 33 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; |
30 | 34 | ||
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index 704550fdb84c..3bce4af60bb6 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -194,7 +194,11 @@ unsigned long saved_videomode; | |||
194 | 194 | ||
195 | static char __initdata command_line[COMMAND_LINE_SIZE]; | 195 | static char __initdata command_line[COMMAND_LINE_SIZE]; |
196 | 196 | ||
197 | #ifndef CONFIG_DEBUG_BOOT_PARAMS | ||
197 | struct boot_params __initdata boot_params; | 198 | struct boot_params __initdata boot_params; |
199 | #else | ||
200 | struct boot_params boot_params; | ||
201 | #endif | ||
198 | 202 | ||
199 | #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) | 203 | #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) |
200 | struct edd edd; | 204 | struct edd edd; |