summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/kdebugfs.c
blob: 73354302fda76c3ee5a326e63deed6f37acca3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * Architecture specific debugfs files
 *
 * Copyright (C) 2007, Intel Corp.
 *	Huang Ying <ying.huang@intel.com>
 *
 * This file is released under the GPLv2.
 */

#include <linux/debugfs.h>
#include <linux/stat.h>
#include <linux/init.h>

#include <asm/setup.h>

#ifdef CONFIG_DEBUG_BOOT_PARAMS
static struct debugfs_blob_wrapper boot_params_blob = {
	.data = &boot_params,
	.size = sizeof(boot_params),
};

static int __init boot_params_kdebugfs_init(void)
{
	int error;
	struct dentry *dbp, *version, *data;

	dbp = debugfs_create_dir("boot_params", NULL);
	if (!dbp) {
		error = -ENOMEM;
		goto err_return;
	}
	version = debugfs_create_x16("version", S_IRUGO, dbp,
				     &boot_params.hdr.version);
	if (!version) {
		error = -ENOMEM;
		goto err_dir;
	}
	data = debugfs_create_blob("data", S_IRUGO, dbp,
				   &boot_params_blob);
	if (!data) {
		error = -ENOMEM;
		goto err_version;
	}
	return 0;
err_version:
	debugfs_remove(version);
err_dir:
	debugfs_remove(dbp);
err_return:
	return error;
}
#endif

static int __init arch_kdebugfs_init(void)
{
	int error = 0;

#ifdef CONFIG_DEBUG_BOOT_PARAMS
	error = boot_params_kdebugfs_init();
#endif

	return error;
}

arch_initcall(arch_kdebugfs_init);