summaryrefslogtreecommitdiff
path: root/drivers/misc/mei/dma-ring.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2018-11-22 13:11:38 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-26 16:59:48 +0100
commit2513eb0dd7ba8a8766b9642075c19ac5f2d5463b (patch)
tree034c9a02290754acfcddd8341eb5249015c32221 /drivers/misc/mei/dma-ring.c
parentc55bf542e91b5c9156d57fd0461aa257b7d20858 (diff)
mei: hw: add dma ring control block
The DMA ring control block contains write and read indices for host and device circular buffers. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/dma-ring.c')
-rw-r--r--drivers/misc/mei/dma-ring.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/misc/mei/dma-ring.c b/drivers/misc/mei/dma-ring.c
index 56f4c0882a20..b73d5ab54070 100644
--- a/drivers/misc/mei/dma-ring.c
+++ b/drivers/misc/mei/dma-ring.c
@@ -97,3 +97,23 @@ bool mei_dma_ring_is_allocated(struct mei_device *dev)
{
return !!dev->dr_dscr[DMA_DSCR_HOST].vaddr;
}
+
+static inline
+struct hbm_dma_ring_ctrl *mei_dma_ring_ctrl(struct mei_device *dev)
+{
+ return (struct hbm_dma_ring_ctrl *)dev->dr_dscr[DMA_DSCR_CTRL].vaddr;
+}
+
+/**
+ * mei_dma_ring_reset() - reset the dma control block
+ * @dev: mei device
+ */
+void mei_dma_ring_reset(struct mei_device *dev)
+{
+ struct hbm_dma_ring_ctrl *ctrl = mei_dma_ring_ctrl(dev);
+
+ if (!ctrl)
+ return;
+
+ memset(ctrl, 0, sizeof(*ctrl));
+}