summaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-11-18 06:28:28 +0100
committerSuren A. Chilingaryan <csa@suren.me>2015-11-18 06:28:28 +0100
commite30eddc0aeb368814d2bbe0031e6b6ed768bdfcf (patch)
treedf52925dedd955f40b7f861fc223a9766ae3fe15 /driver
parent815924bac97aed5e4b662d5aafeed9634b82af4a (diff)
downloadpcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.tar.gz
pcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.tar.bz2
pcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.tar.xz
pcitool-e30eddc0aeb368814d2bbe0031e6b6ed768bdfcf.zip
Enforce 64-bit dma mask from IPEDMA if supported
Diffstat (limited to 'driver')
-rw-r--r--driver/ioctl.c30
-rw-r--r--driver/pciDriver.h3
2 files changed, 33 insertions, 0 deletions
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