bootrom.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License version 2 as published
  4. * by the Free Software Foundation.
  5. *
  6. * Copyright (C) 2013 John Crispin <john@phrozen.org>
  7. */
  8. #include <linux/debugfs.h>
  9. #include <linux/seq_file.h>
  10. #define BOOTROM_OFFSET 0x10118000
  11. #define BOOTROM_SIZE 0x8000
  12. static void __iomem *membase = (void __iomem *) KSEG1ADDR(BOOTROM_OFFSET);
  13. static int bootrom_show(struct seq_file *s, void *unused)
  14. {
  15. seq_write(s, membase, BOOTROM_SIZE);
  16. return 0;
  17. }
  18. static int bootrom_open(struct inode *inode, struct file *file)
  19. {
  20. return single_open(file, bootrom_show, NULL);
  21. }
  22. static const struct file_operations bootrom_file_ops = {
  23. .open = bootrom_open,
  24. .read = seq_read,
  25. .llseek = seq_lseek,
  26. .release = single_release,
  27. };
  28. static int bootrom_setup(void)
  29. {
  30. if (!debugfs_create_file("bootrom", 0444,
  31. NULL, NULL, &bootrom_file_ops)) {
  32. pr_err("Failed to create bootrom debugfs file\n");
  33. return -EINVAL;
  34. }
  35. return 0;
  36. }
  37. postcore_initcall(bootrom_setup);