enum dio200_model model;
enum dio200_layout layout;
unsigned char mainbar;
+ unsigned int mainsize;
} dio200_board;
static const dio200_board dio200_boards[] = {
bustype: isa_bustype,
model: pc212e_model,
layout: pc212_layout,
+ mainsize: DIO200_IO_SIZE,
},
{
name: "pc214e",
bustype: isa_bustype,
model: pc214e_model,
layout: pc214_layout,
+ mainsize: DIO200_IO_SIZE,
},
{
name: "pc215e",
bustype: isa_bustype,
model: pc215e_model,
layout: pc215_layout,
+ mainsize: DIO200_IO_SIZE,
},
#ifdef CONFIG_COMEDI_PCI
{
bustype: pci_bustype,
model: pci215_model,
layout: pc215_layout,
+ mainsize: DIO200_IO_SIZE,
mainbar: 2,
},
#endif
bustype: isa_bustype,
model: pc218e_model,
layout: pc218_layout,
+ mainsize: DIO200_IO_SIZE,
},
{
name: "pc272e",
bustype: isa_bustype,
model: pc272e_model,
layout: pc272_layout,
+ mainsize: DIO200_IO_SIZE,
},
#ifdef CONFIG_COMEDI_PCI
{
bustype: pci_bustype,
model: pci272_model,
layout: pc272_layout,
+ mainsize: DIO200_IO_SIZE,
mainbar: 2,
},
#endif
/* Enable device and reserve I/O spaces. */
#ifdef CONFIG_COMEDI_PCI
if (pci_dev) {
- resource_size_t base;
+ resource_size_t base, len;
unsigned int bar;
ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME);
}
bar = thisboard->mainbar;
base = pci_resource_start(pci_dev, bar);
+ len = pci_resource_len(pci_dev, bar);
+ if (len < thisboard->mainsize) {
+ printk(KERN_ERR
+ "comedi%d: error! PCI region size too small!\n",
+ dev->minor);
+ return -EINVAL;
+ }
if ((pci_resource_flags(pci_dev, bar) & IORESOURCE_MEM) != 0) {
- resource_size_t len = pci_resource_len(pci_dev, bar);
devpriv->io.u.membase = ioremap_nocache(base, len);
if (!devpriv->io.u.membase) {
printk(KERN_ERR
} else
#endif
{
- ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
+ ret = dio200_request_region(dev->minor, iobase,
+ thisboard->mainsize);
if (ret < 0) {
return ret;
}
{
if (devpriv->io.regtype == io_regtype) {
release_region(devpriv->io.u.iobase,
- DIO200_IO_SIZE);
+ thisboard->mainsize);
}
}
}