bootrom.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 <blogic@openwrt.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);