From e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 18 Nov 2015 06:28:28 +0100 Subject: Enforce 64-bit dma mask from IPEDMA if supported --- driver/ioctl.c | 30 ++++++++++++++++++++++++++++++ driver/pciDriver.h | 3 +++ 2 files changed, 33 insertions(+) (limited to 'driver') diff --git a/driver/ioctl.c b/driver/ioctl.c index 2d4af73..a78d366 100644 --- a/driver/ioctl.c +++ b/driver/ioctl.c @@ -406,6 +406,33 @@ static int ioctl_clear_ioq(pcidriver_privdata_t *privdata, unsigned long arg) #endif } + +/** + * + * Sets DMA mask for the following DMA mappings. + * + * @param arg Not a pointer, but a number of bits + * + */ +static int ioctl_set_dma_mask(pcidriver_privdata_t *privdata, unsigned long arg) +{ + int err; + + if ((arg < 24) && (arg > 63)) + return -EINVAL; + + err = pci_set_dma_mask(privdata->pdev, DMA_BIT_MASK(arg)); + if (err < 0) { + printk(KERN_ERR "pci_set_dma_mask(%lu) failed\n", arg); + return err; + } + + printk(KERN_ERR "pci_set_dma_mask(%lu) successeded\n", arg); + + return 0; +} + + /** * * This function handles all ioctl file operations. @@ -465,6 +492,9 @@ long pcidriver_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) case PCIDRIVER_IOC_CLEAR_IOQ: return ioctl_clear_ioq(privdata, arg); + case PCIDRIVER_IOC_SET_DMA_MASK: + return ioctl_set_dma_mask(privdata, arg); + default: return -EINVAL; } diff --git a/driver/pciDriver.h b/driver/pciDriver.h index f16b721..845fc15 100644 --- a/driver/pciDriver.h +++ b/driver/pciDriver.h @@ -217,4 +217,7 @@ typedef struct { /* Clear interrupt queues */ #define PCIDRIVER_IOC_CLEAR_IOQ _IO( PCIDRIVER_IOC_MAGIC, PCIDRIVER_IOC_BASE + 13 ) +#define PCIDRIVER_IOC_SET_DMA_MASK _IO( PCIDRIVER_IOC_MAGIC, PCIDRIVER_IOC_BASE + 14 ) + + #endif -- cgit v1.2.3