提交 3df59529 编写于 作者: J Jeff Dike 提交者: Linus Torvalds

[PATCH] uml: make the emulated iomem driver work on 2.6

This makes the minimal fixes needed to make the UML iomem driver work in 2.6.
Signed-off-by: NJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a3813329
...@@ -204,5 +204,11 @@ config UML_RANDOM ...@@ -204,5 +204,11 @@ config UML_RANDOM
http://sourceforge.net/projects/gkernel/). rngd periodically reads http://sourceforge.net/projects/gkernel/). rngd periodically reads
/dev/hwrng and injects the entropy into /dev/random. /dev/hwrng and injects the entropy into /dev/random.
config MMAPPER
tristate "iomem emulation driver"
help
This driver allows a host file to be used as emulated IO memory inside
UML.
endmenu endmenu
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -117,24 +118,39 @@ static struct file_operations mmapper_fops = { ...@@ -117,24 +118,39 @@ static struct file_operations mmapper_fops = {
.release = mmapper_release, .release = mmapper_release,
}; };
static struct miscdevice mmapper_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "mmapper",
.fops = &mmapper_fops
};
static int __init mmapper_init(void) static int __init mmapper_init(void)
{ {
int err;
printk(KERN_INFO "Mapper v0.1\n"); printk(KERN_INFO "Mapper v0.1\n");
v_buf = (char *) find_iomem("mmapper", &mmapper_size); v_buf = (char *) find_iomem("mmapper", &mmapper_size);
if(mmapper_size == 0){ if(mmapper_size == 0){
printk(KERN_ERR "mmapper_init - find_iomem failed\n"); printk(KERN_ERR "mmapper_init - find_iomem failed\n");
return(0); goto out;
} }
p_buf = __pa(v_buf); err = misc_register(&mmapper_dev);
if(err){
printk(KERN_ERR "mmapper - misc_register failed, err = %d\n",
err);
goto out;
}
devfs_mk_cdev(MKDEV(30, 0), S_IFCHR|S_IRUGO|S_IWUGO, "mmapper"); p_buf = __pa(v_buf);
return(0); out:
return 0;
} }
static void mmapper_exit(void) static void mmapper_exit(void)
{ {
misc_deregister(&mmapper_dev);
} }
module_init(mmapper_init); module_init(mmapper_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册