kdebugfs.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include <linux/debugfs.h>
  10. #include <linux/stat.h>
  11. #include <linux/init.h>
  12. #include <asm/setup.h>
  13. #ifdef CONFIG_DEBUG_BOOT_PARAMS
  14. static struct debugfs_blob_wrapper boot_params_blob = {
  15. .data = &boot_params,
  16. .size = sizeof(boot_params),
  17. };
  18. static int __init boot_params_kdebugfs_init(void)
  19. {
  20. int error;
  21. struct dentry *dbp, *version, *data;
  22. dbp = debugfs_create_dir("boot_params", NULL);
  23. if (!dbp) {
  24. error = -ENOMEM;
  25. goto err_return;
  26. }
  27. version = debugfs_create_x16("version", S_IRUGO, dbp,
  28. &boot_params.hdr.version);
  29. if (!version) {
  30. error = -ENOMEM;
  31. goto err_dir;
  32. }
  33. data = debugfs_create_blob("data", S_IRUGO, dbp,
  34. &boot_params_blob);
  35. if (!data) {
  36. error = -ENOMEM;
  37. goto err_version;
  38. }
  39. return 0;
  40. err_version:
  41. debugfs_remove(version);
  42. err_dir:
  43. debugfs_remove(dbp);
  44. err_return:
  45. return error;
  46. }
  47. #endif
  48. static int __init arch_kdebugfs_init(void)
  49. {
  50. int error = 0;
  51. #ifdef CONFIG_DEBUG_BOOT_PARAMS
  52. error = boot_params_kdebugfs_init();
  53. #endif
  54. return error;
  55. }
  56. arch_initcall(arch_kdebugfs_init);