summaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
Diffstat (limited to 'driver')
-rw-r--r--driver/compat.h6
-rw-r--r--driver/kmem.c17
-rw-r--r--driver/pciDriver.h2
-rw-r--r--driver/sysfs.c11
4 files changed, 26 insertions, 10 deletions
diff --git a/driver/compat.h b/driver/compat.h
index 80f232b..25e402a 100644
--- a/driver/compat.h
+++ b/driver/compat.h
@@ -10,6 +10,12 @@
#ifndef _COMPAT_H
#define _COMPAT_H
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+# define __devinit
+# define __devexit
+# define __devinitdata
+#endif
+
/* dev_name is the wrapper one needs to use to access what was formerly called
* bus_id in struct device. However, before 2.6.27, direct access was necessary,
* so we provide our own version. */
diff --git a/driver/kmem.c b/driver/kmem.c
index b8ce0d0..4f36e79 100644
--- a/driver/kmem.c
+++ b/driver/kmem.c
@@ -24,6 +24,11 @@
#include "kmem.h" /* prototypes for kernel memory */
#include "sysfs.h" /* prototypes for sysfs */
+/* VM_RESERVED is removed in 3.7-rc1 */
+#ifndef VM_RESERVED
+# define VM_RESERVED (VM_DONTEXPAND | VM_DONTDUMP)
+#endif
+
/**
*
* Allocates new kernel memory including the corresponding management structure, makes
@@ -32,6 +37,7 @@
*/
int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_handle)
{
+ int flags;
pcidriver_kmem_entry_t *kmem_entry;
void *retptr;
@@ -139,12 +145,17 @@ int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_han
}
break;
case PCILIB_KMEM_TYPE_PAGE:
+ flags = GFP_KERNEL;
+
+ if ((kmem_entry->type == PCILIB_KMEM_TYPE_DMA_S2C_PAGE)||(kmem_entry->type == PCILIB_KMEM_TYPE_DMA_C2S_PAGE))
+ flags |= __GFP_DMA;
+
if (kmem_handle->size == 0)
kmem_handle->size = PAGE_SIZE;
else if (kmem_handle->size%PAGE_SIZE)
goto kmem_alloc_mem_fail;
- retptr = (void*)__get_free_pages(GFP_KERNEL|__GFP_DMA, get_order(kmem_handle->size));
+ retptr = (void*)__get_free_pages(flags, get_order(kmem_handle->size));
kmem_entry->dma_handle = 0;
if (retptr) {
@@ -621,10 +632,6 @@ int pcidriver_mmap_kmem(pcidriver_privdata_t *privdata, struct vm_area_struct *v
page_to_pfn(virt_to_page((void*)kmem_entry->cpua)));
if ((kmem_entry->type&PCILIB_KMEM_TYPE_MASK) == PCILIB_KMEM_TYPE_REGION) {
- mod_info("Mapping address %08lx / Size %08lx\n",
- (unsigned long)kmem_entry->dma_handle,
- (vma_size < kmem_entry->size)?vma_size:kmem_entry->size);
-
ret = remap_pfn_range_compat(
vma,
vma->vm_start,
diff --git a/driver/pciDriver.h b/driver/pciDriver.h
index d548765..8e9c0bc 100644
--- a/driver/pciDriver.h
+++ b/driver/pciDriver.h
@@ -61,7 +61,7 @@
/* Identifies the PCI-E Xilinx ML605 */
#define PCIE_XILINX_VENDOR_ID 0x10ee
-#define PCIE_ML605_DEVICE_ID 0x04a0
+#define PCIE_ML605_DEVICE_ID 0x6024
/* Identifies the PCI-E IPE Camera */
#define PCIE_IPECAMERA_DEVICE_ID 0x6081
diff --git a/driver/sysfs.c b/driver/sysfs.c
index 37cf362..04bfdf3 100644
--- a/driver/sysfs.c
+++ b/driver/sysfs.c
@@ -100,13 +100,16 @@ static SYSFS_GET_FUNCTION(pcidriver_show_kmem_entry)
* sanity checks but can directly call simple_strtol() */
int id = simple_strtol(attr->attr.name + strlen("kbuf"), NULL, 10);
pcidriver_kmem_entry_t *entry = pcidriver_kmem_find_entry_id(privdata, id);
- if (entry)
+ if (entry) {
+ unsigned long addr = entry->cpua;
+ unsigned long dma_addr = entry->dma_handle;
+
if (entry->size >= 16) {
pcidriver_kmem_sync_entry(privdata, entry, PCILIB_KMEM_SYNC_FROMDEVICE);
- return snprintf(buf, PAGE_SIZE, "buffer: %d\ntype: %lx\nuse: 0x%lx\nitem: %lu\nsize: %lu\nrefs: %lu\nhw ref: %i\nmode: 0x%lx\ndata: %8x %8x %8x %8x\n", id, entry->type, entry->use, entry->item, entry->size, entry->refs&KMEM_REF_COUNT, (entry->refs&KMEM_REF_HW)?1:0, entry->mode, *(u32*)(entry->cpua), *(u32*)(entry->cpua + 4), *(u32*)(entry->cpua + 8), *(u32*)(entry->cpua + 12));
+ return snprintf(buf, PAGE_SIZE, "buffer: %d\naddr: %lx\nhw addr: %lx\nbus addr: %lx\ntype: %lx\nuse: 0x%lx\nitem: %lu\nsize: %lu\nrefs: %lu\nhw ref: %i\nmode: 0x%lx\ndata: %8x %8x %8x %8x\n", id, addr, virt_to_phys(addr), dma_addr, entry->type, entry->use, entry->item, entry->size, entry->refs&KMEM_REF_COUNT, (entry->refs&KMEM_REF_HW)?1:0, entry->mode, *(u32*)(entry->cpua), *(u32*)(entry->cpua + 4), *(u32*)(entry->cpua + 8), *(u32*)(entry->cpua + 12));
} else
- return snprintf(buf, PAGE_SIZE, "buffer: %d\ntype: %lx\nuse: 0x%lx\nitem: %lu\nsize: %lu\nrefs: %lu\nhw ref: %i\nmode: 0x%lx\n", id, entry->type, entry->use, entry->item, entry->size, entry->refs&KMEM_REF_COUNT, (entry->refs&KMEM_REF_HW)?1:0, entry->mode);
- else
+ return snprintf(buf, PAGE_SIZE, "buffer: %d\naddr: %lx\nhw addr: %lx\nbus addr: %lx\ntype: %lx\nuse: 0x%lx\nitem: %lu\nsize: %lu\nrefs: %lu\nhw ref: %i\nmode: 0x%lx\n", id, addr, virt_to_phys(addr), dma_addr, entry->type, entry->use, entry->item, entry->size, entry->refs&KMEM_REF_COUNT, (entry->refs&KMEM_REF_HW)?1:0, entry->mode);
+ } else
return snprintf(buf, PAGE_SIZE, "I am in the kmem_entry show function for buffer %d\n", id);
#else
return 0;