Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 44 → Rev 362

/pcivme-3.2/driver/fops.c
67,11 → 67,7
 
#include <linux/sched.h>
#include <linux/fs.h>
#if HAVE_UNLOCKED_IOCTL
#include <linux/mutex.h>
#else
#include <linux/smp_lock.h>
#endif
#include <linux/mutex.h>
 
 
#include "fops.h"
730,9 → 726,9
 
// check for accessible user buffer
if (_IOC_DIR(cmd) & _IOC_READ)
err = !access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd));
err = !access_ok( (void *)arg, _IOC_SIZE(cmd));
if (_IOC_DIR(cmd) & _IOC_WRITE)
err = !access_ok(VERIFY_READ, (void *)arg, _IOC_SIZE(cmd));
err = !access_ok( (void *)arg, _IOC_SIZE(cmd));
if (err)
return -EFAULT;
 
812,22 → 808,14
long retval=0;
 
 
#if HAVE_UNLOCKED_IOCTL
struct mutex fs_mutex;
mutex_init(&fs_mutex);
mutex_lock(&fs_mutex);
#else
lock_kernel();
#endif
 
PRINTK(KERN_DEBUG "%s : pcivme_unlocked_ioctl(0x%08x), size = %d\n", DEVICE_NAME, cmd, _IOC_SIZE(cmd));
retval = pcivme_ioctl(NULL, pFile, cmd,arg);
 
#if HAVE_UNLOCKED_IOCTL
mutex_unlock(&fs_mutex);
#else
unlock_kernel();
#endif
 
return retval;
}
957,7 → 945,7
return -EFAULT;
 
// check for free access to user buffer
if (!access_ok(VERIFY_WRITE, pcBuffer, count))
if (!access_ok( pcBuffer, count))
return -EFAULT;
 
// do I still have the same modifier?
999,7 → 987,7
return -EFAULT;
 
// check for free access to user buffer
if (!access_ok(VERIFY_READ, pcBuffer, count))
if (!access_ok( pcBuffer, count))
return -EFAULT;
 
// do I still have the same modifier?
/pcivme-3.2/driver/main.c
145,28 → 145,27
 
static int request_io_memory(PCIConfig *pPch)
{
if (check_mem_region(pci_resource_start(pPch->pciDev, 0), LCR_SPACE))
{
PRINTK(KERN_DEBUG "%s : LCR 0x%08lx\n", DEVICE_NAME, (long unsigned int) pci_resource_start(pPch->pciDev, 0));
return -EBUSY;
}
if (!request_mem_region(pci_resource_start(pPch->pciDev, 0), LCR_SPACE, DEVICE_NAME) ) {
PRINTK(KERN_WARNING "%s: LCR memory region %llx-%llx already in use\n", DEVICE_NAME,
pci_resource_start(pPch->pciDev, 0), pci_resource_start(pPch->pciDev, 0) + LCR_SPACE );
kfree(pPch);
return EBUSY;
 
if (check_mem_region(pci_resource_start(pPch->pciDev, 2), CTL_SPACE))
{
PRINTK(KERN_DEBUG "%s : CTL 0x%08lx\n", DEVICE_NAME, (long unsigned int) pci_resource_start(pPch->pciDev, 2));
return -EBUSY;
}
};
if (!request_mem_region(pci_resource_start(pPch->pciDev, 2), CTL_SPACE, DEVICE_NAME) ){
PRINTK(KERN_WARNING "%s: CTL memory region %llx-%llx already in use\n", DEVICE_NAME,
pci_resource_start(pPch->pciDev, 0), pci_resource_start(pPch->pciDev, 2) + CTL_SPACE );
kfree(pPch);
return EBUSY;
 
if (check_mem_region(pci_resource_start(pPch->pciDev, 2) + CTL_SPACE, VME_SPACE))
{
PRINTK(KERN_DEBUG "%s : VME 0x%08lx\n", DEVICE_NAME, (long unsigned int) pci_resource_start(pPch->pciDev, 2) + CTL_SPACE);
return -EBUSY;
}
if (!request_mem_region(pci_resource_start(pPch->pciDev, 2) + CTL_SPACE, VME_SPACE, DEVICE_NAME) ){
PRINTK(KERN_WARNING "%s: VME memory region %llx-%llx already in use\n", DEVICE_NAME,
pci_resource_start(pPch->pciDev, 0)+CTL_SPACE, pci_resource_start(pPch->pciDev, 0) + LCR_SPACE+VME_SPACE );
kfree(pPch);
return EBUSY;
 
request_mem_region(pci_resource_start(pPch->pciDev, 0), LCR_SPACE, DEVICE_NAME);
request_mem_region(pci_resource_start(pPch->pciDev, 2), CTL_SPACE, DEVICE_NAME);
request_mem_region(pci_resource_start(pPch->pciDev, 2) + CTL_SPACE, VME_SPACE, DEVICE_NAME);
 
};
return 0;
}
 
367,12 → 366,8
return found;
}
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
static int pcivme_read_proc(char *buf, char **start, off_t offset, int len)
#else
//static int pcivme_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *data)
static int pcivme_read_proc(struct file *filp,char *buf,size_t count,loff_t *offp )
#endif
static ssize_t pcivme_read_proc(struct file *filp,char *buf,size_t count,loff_t *offp )
{
int pos = 0;
DEVICE_OBJ *pd;
383,7 → 378,7
PRINTK(KERN_DEBUG "%s : pcivme_read_proc()\n",DEVICE_NAME);
if (*offp != 0) return 0;
pos += sprintf(buf + pos, "\nPCIVME information. Version %d.%d of %s from Klaus Hitschler.\n", VERSION_HI, VERSION_LO, __DATE__);
pos += sprintf(buf + pos, "\nPCIVME information. Version %d.%d from Klaus Hitschler.\n", VERSION_HI, VERSION_LO);
 
pos += sprintf(buf + pos, " ---------------------\n");
pos += sprintf(buf + pos, " Interfaces found : %d\n", drv.count);
429,31 → 424,14
pos=count;
}
PRINTK(KERN_DEBUG "%s : pcivme_read_proc() end count=%d\n",DEVICE_NAME, pos);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
//*eof = 1;
#endif
*offp = pos;
return pos;
}
 
 
 
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
struct proc_dir_entry pcimod_proc_entry =
{
namelen: 7, /* len of name */
name: DEVICE_NAME, /* entry name */
mode: S_IFREG | S_IRUGO, /* mode */
nlink: 1, /* nlinks */
get_info: pcivme_read_proc, /* function used to read data */
static const struct proc_ops pcivme_read_proc_fops = {
proc_read: pcivme_read_proc
};
#else
struct file_operations pcivme_read_proc_fops = {
read: pcivme_read_proc
};
#endif
 
static void deleteMyLists(void)
{
531,7 → 509,8
pd->pPCIADACntrl = pd->pLCR + PLX9050_CNTRL;
pd->pPCIADAIntCSR = pd->pLCR + PLX9050_INTCSR;
 
if (request_irq(pd->pPch->pciDev->irq, pcivme_irqhandler, IRQF_DISABLED| IRQF_SHARED, DEVICE_NAME, pd))
//if (request_irq(pd->pPch->pciDev->irq, pcivme_irqhandler, IRQF_DISABLED| IRQF_SHARED, DEVICE_NAME, pd))
if (request_irq(pd->pPch->pciDev->irq, pcivme_irqhandler, IRQF_SHARED, DEVICE_NAME, pd))
{
printk(KERN_ERR "%s : can't get irq @ %d\n", DEVICE_NAME, pd->pPch->pciDev->irq);
kfree_s(pd, sizeof(*pd)); // FREE(pd);
605,11 → 584,7
unregister_chrdev(drv.nMajor, DEVICE_NAME);
 
/* unregister the proc device */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
proc_unregister(&proc_root, pcimod_proc_entry.low_ino);
#else
remove_proc_entry(DEVICE_NAME, NULL);
#endif
 
/* redo all */
for (ptr = drv.devList.next; ptr != &drv.devList; ptr = ptr->next)
/pcivme-3.2/driver/modules.order
1,0 → 0,0
kernel//home/f9daq/pcivme-3.2/driver/pcivme.ko
/home/rok/pcivme-3.2/driver/pcivme.ko
/pcivme-3.2/driver/pcivme.mod.c
1,11 → 1,16
#include <linux/module.h>
#define INCLUDE_VERMAGIC
#include <linux/build-salt.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
 
BUILD_SALT;
 
MODULE_INFO(vermagic, VERMAGIC_STRING);
MODULE_INFO(name, KBUILD_MODNAME);
 
__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
__section(".gnu.linkonce.this_module") = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
14,48 → 19,59
.arch = MODULE_ARCH_INIT,
};
 
#ifdef CONFIG_RETPOLINE
MODULE_INFO(retpoline, "Y");
#endif
 
static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0x11c92bdf, __VMLINUX_SYMBOL_STR(module_layout) },
{ 0x6bc3fbc0, __VMLINUX_SYMBOL_STR(__unregister_chrdev) },
{ 0x1fedf0f4, __VMLINUX_SYMBOL_STR(__request_region) },
{ 0x7f457a3b, __VMLINUX_SYMBOL_STR(kmalloc_caches) },
{ 0x69a358a6, __VMLINUX_SYMBOL_STR(iomem_resource) },
{ 0x6acfb74e, __VMLINUX_SYMBOL_STR(pci_disable_device) },
{ 0x7cc137e5, __VMLINUX_SYMBOL_STR(remove_proc_entry) },
{ 0x40851225, __VMLINUX_SYMBOL_STR(__register_chrdev) },
{ 0x728d8849, __VMLINUX_SYMBOL_STR(mutex_unlock) },
{ 0x91715312, __VMLINUX_SYMBOL_STR(sprintf) },
{ 0x68dfc59f, __VMLINUX_SYMBOL_STR(__init_waitqueue_head) },
{ 0xa22311d0, __VMLINUX_SYMBOL_STR(__mutex_init) },
{ 0x50eedeb8, __VMLINUX_SYMBOL_STR(printk) },
{ 0xb4390f9a, __VMLINUX_SYMBOL_STR(mcount) },
{ 0x5427e6db, __VMLINUX_SYMBOL_STR(pci_bus_write_config_dword) },
{ 0xfe57f7e2, __VMLINUX_SYMBOL_STR(mutex_lock) },
{ 0x2072ee9b, __VMLINUX_SYMBOL_STR(request_threaded_irq) },
{ 0xa8a6f639, __VMLINUX_SYMBOL_STR(__check_region) },
{ 0x42c8de35, __VMLINUX_SYMBOL_STR(ioremap_nocache) },
{ 0x51e5c030, __VMLINUX_SYMBOL_STR(pci_bus_read_config_word) },
{ 0x979b6d54, __VMLINUX_SYMBOL_STR(pci_bus_read_config_dword) },
{ 0x4292364c, __VMLINUX_SYMBOL_STR(schedule) },
{ 0x7c61340c, __VMLINUX_SYMBOL_STR(__release_region) },
{ 0xd3813bef, __VMLINUX_SYMBOL_STR(kmem_cache_alloc_trace) },
{ 0xe45f60d8, __VMLINUX_SYMBOL_STR(__wake_up) },
{ 0xa56d356, __VMLINUX_SYMBOL_STR(prepare_to_wait_event) },
{ 0x8bc20274, __VMLINUX_SYMBOL_STR(proc_create_data) },
{ 0x37a0cba, __VMLINUX_SYMBOL_STR(kfree) },
{ 0xedc03953, __VMLINUX_SYMBOL_STR(iounmap) },
{ 0x82f3c0af, __VMLINUX_SYMBOL_STR(pci_get_device) },
{ 0x75bb675a, __VMLINUX_SYMBOL_STR(finish_wait) },
{ 0x29079661, __VMLINUX_SYMBOL_STR(pci_enable_device) },
{ 0xf20dabd8, __VMLINUX_SYMBOL_STR(free_irq) },
__used __section("__versions") = {
{ 0x19fdd0c3, "module_layout" },
{ 0x6bc3fbc0, "__unregister_chrdev" },
{ 0x85bd1608, "__request_region" },
{ 0x5f3af44c, "kmalloc_caches" },
{ 0x6049f091, "pci_write_config_dword" },
{ 0x77358855, "iomem_resource" },
{ 0x5367b4b4, "boot_cpu_data" },
{ 0x28cb89c6, "pci_disable_device" },
{ 0x8d6aff89, "__put_user_nocheck_4" },
{ 0xe8d4e6f7, "remove_proc_entry" },
{ 0xd7a7096b, "__register_chrdev" },
{ 0x3a099605, "__get_user_nocheck_4" },
{ 0x409bcb62, "mutex_unlock" },
{ 0x3c3ff9fd, "sprintf" },
{ 0xd9a5ea54, "__init_waitqueue_head" },
{ 0x977f511b, "__mutex_init" },
{ 0xc5850110, "printk" },
{ 0xde80cd09, "ioremap" },
{ 0x65df35ca, "__put_user_nocheck_2" },
{ 0xa1c76e0a, "_cond_resched" },
{ 0xbd30a84c, "pci_read_config_word" },
{ 0x2ab7989d, "mutex_lock" },
{ 0xd2bc5c46, "__get_user_nocheck_2" },
{ 0x92d5838e, "request_threaded_irq" },
{ 0x4b5e3a47, "__get_user_nocheck_1" },
{ 0xfe487975, "init_wait_entry" },
{ 0xfc3d53cb, "__put_user_nocheck_1" },
{ 0x7cd8d75e, "page_offset_base" },
{ 0xc959d152, "__stack_chk_fail" },
{ 0x1000e51, "schedule" },
{ 0x2ea2c95c, "__x86_indirect_thunk_rax" },
{ 0xdcb54fb, "pci_read_config_dword" },
{ 0xbdfb6dbb, "__fentry__" },
{ 0x1035c7c2, "__release_region" },
{ 0xd1ff3d1f, "kmem_cache_alloc_trace" },
{ 0x3eeb2322, "__wake_up" },
{ 0x8c26d495, "prepare_to_wait_event" },
{ 0xececfcd9, "proc_create_data" },
{ 0x37a0cba, "kfree" },
{ 0xedc03953, "iounmap" },
{ 0x5852c575, "pci_get_device" },
{ 0x92540fbf, "finish_wait" },
{ 0x807cd017, "pci_enable_device" },
{ 0xc1514a3b, "free_irq" },
};
 
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
MODULE_INFO(depends, "");
 
 
MODULE_INFO(srcversion, "FFA7008531B9F92A3590EA1");
MODULE_INFO(srcversion, "C9945A49BE713AE1046C032");