new ISA memory mapped IO

This commit is contained in:
Karsten Keil 1999-11-15 14:06:47 +00:00
parent 9e05954589
commit bb18d3ac38
2 changed files with 46 additions and 9 deletions

View File

@ -37,6 +37,9 @@
#include <linux/isdnif.h>
#include <asm/string.h>
#include <asm/io.h>
#ifdef COMPAT_HAS_ISA_IOREMAP
#include <linux/ioport.h>
#endif
#include "pcbit.h"
#include "edss1.h"
@ -90,9 +93,25 @@ int pcbit_init_dev(int board, int mem_base, int irq)
init_waitqueue_head(&dev->set_running_wq);
#endif
if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF )
if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) {
dev->ph_mem = mem_base;
#ifdef COMPAT_HAS_ISA_IOREMAP
if (check_mem_region(dev->ph_mem, 4096)) {
printk(KERN_WARNING
"PCBIT: memory region %lx-%lx already in use\n",
dev->ph_mem, dev->ph_mem + 4096);
kfree(dev);
dev_pcbit[board] = NULL;
return -EACCES;
} else {
request_mem_region(dev->ph_mem, 4096, "PCBIT mem");
}
dev->sh_mem = (unsigned char*)ioremap(dev->ph_mem, 4096);
#else
dev->sh_mem = (unsigned char*) mem_base;
else
#endif
}
else
{
printk("memory address invalid");
kfree(dev);
@ -104,6 +123,10 @@ int pcbit_init_dev(int board, int mem_base, int irq)
if (!dev->b1) {
printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
kfree(dev);
#ifdef COMPAT_HAS_ISA_IOREMAP
iounmap((unsigned char*)dev->sh_mem);
release_mem_region(dev->ph_mem, 4096);
#endif
return -ENOMEM;
}
@ -112,6 +135,10 @@ int pcbit_init_dev(int board, int mem_base, int irq)
printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
kfree(dev->b1);
kfree(dev);
#ifdef COMPAT_HAS_ISA_IOREMAP
iounmap((unsigned char*)dev->sh_mem);
release_mem_region(dev->ph_mem, 4096);
#endif
return -ENOMEM;
}
@ -134,6 +161,10 @@ int pcbit_init_dev(int board, int mem_base, int irq)
kfree(dev->b1);
kfree(dev->b2);
kfree(dev);
#ifdef COMPAT_HAS_ISA_IOREMAP
iounmap((unsigned char*)dev->sh_mem);
release_mem_region(dev->ph_mem, 4096);
#endif
dev_pcbit[board] = NULL;
return -EIO;
}
@ -154,6 +185,10 @@ int pcbit_init_dev(int board, int mem_base, int irq)
kfree(dev->b1);
kfree(dev->b2);
kfree(dev);
#ifdef COMPAT_HAS_ISA_IOREMAP
iounmap((unsigned char*)dev->sh_mem);
release_mem_region(dev->ph_mem, 4096);
#endif
dev_pcbit[board] = NULL;
return -EIO;
}
@ -183,6 +218,10 @@ int pcbit_init_dev(int board, int mem_base, int irq)
kfree(dev->b1);
kfree(dev->b2);
kfree(dev);
#ifdef COMPAT_HAS_ISA_IOREMAP
iounmap((unsigned char*)dev->sh_mem);
release_mem_region(dev->ph_mem, 4096);
#endif
dev_pcbit[board] = NULL;
return -EIO;
}
@ -219,6 +258,10 @@ void pcbit_terminate(int board)
kfree(dev->b1);
kfree(dev->b2);
kfree(dev);
#ifdef COMPAT_HAS_ISA_IOREMAP
iounmap((unsigned char*)dev->sh_mem);
release_mem_region(dev->ph_mem, 4096);
#endif
}
}
#endif

View File

@ -46,6 +46,7 @@ struct pcbit_dev {
/* board */
volatile unsigned char* sh_mem; /* RDP address */
unsigned long ph_mem;
unsigned int irq;
unsigned int id;
unsigned int interrupt; /* set during interrupt
@ -170,10 +171,3 @@ struct pcbit_ioctl {
#define L2_ERROR 6
#endif