12 #define NVRAM_VERSION "1.1"
14 #include <linux/module.h>
16 #include <linux/types.h>
17 #include <linux/errno.h>
20 #include <linux/fcntl.h>
23 #include <asm/uaccess.h>
24 #include <asm/nvram.h>
25 #ifdef CONFIG_PPC_PMAC
26 #include <asm/machdep.h>
29 #define NVRAM_SIZE 8192
40 offset += file->
f_pos;
56 static ssize_t read_nvram(
struct file *file,
char __user *
buf,
57 size_t count, loff_t *ppos)
64 if (*ppos >= nvram_len)
66 for (i = *ppos; count > 0 && i < nvram_len; ++
i, ++
p, --
count)
73 static ssize_t write_nvram(
struct file *file,
const char __user *buf,
74 size_t count, loff_t *ppos)
82 if (*ppos >= nvram_len)
84 for (i = *ppos; count > 0 && i < nvram_len; ++
i, ++
p, --
count) {
93 static int nvram_ioctl(
struct file *file,
unsigned int cmd,
unsigned long arg)
96 #ifdef CONFIG_PPC_PMAC
102 if (!machine_is(powermac))
109 if (
copy_to_user((
void __user*)arg, &offset,
sizeof(offset)) != 0)
124 static long nvram_unlocked_ioctl(
struct file *file,
unsigned int cmd,
unsigned long arg)
129 ret = nvram_ioctl(file, cmd, arg);
137 .llseek = nvram_llseek,
139 .write = write_nvram,
140 .unlocked_ioctl = nvram_unlocked_ioctl,