linux/arch/mips/ralink/bootrom.c
<<
>>
Prefs
   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
   9#include <linux/debugfs.h>
  10#include <linux/seq_file.h>
  11
  12#define BOOTROM_OFFSET  0x10118000
  13#define BOOTROM_SIZE    0x8000
  14
  15static void __iomem *membase = (void __iomem *) KSEG1ADDR(BOOTROM_OFFSET);
  16
  17static int bootrom_show(struct seq_file *s, void *unused)
  18{
  19        seq_write(s, membase, BOOTROM_SIZE);
  20
  21        return 0;
  22}
  23
  24static int bootrom_open(struct inode *inode, struct file *file)
  25{
  26        return single_open(file, bootrom_show, NULL);
  27}
  28
  29static const struct file_operations bootrom_file_ops = {
  30        .open           = bootrom_open,
  31        .read           = seq_read,
  32        .llseek         = seq_lseek,
  33        .release        = single_release,
  34};
  35
  36static int bootrom_setup(void)
  37{
  38        if (!debugfs_create_file("bootrom", 0444,
  39                        NULL, NULL, &bootrom_file_ops)) {
  40                pr_err("Failed to create bootrom debugfs file\n");
  41
  42                return -EINVAL;
  43        }
  44
  45        return 0;
  46}
  47
  48postcore_initcall(bootrom_setup);
  49