Ported implementation of the Xeon Phi DMA driver to the new DMA library
authorReto Achermann <acreto@student.ethz.ch>
Sun, 27 Jul 2014 12:51:19 +0000 (14:51 +0200)
committerStefan Kaestle <stefan.kaestle@inf.ethz.ch>
Wed, 20 Aug 2014 21:39:56 +0000 (23:39 +0200)
devices/xeon_phi/xeon_phi_dma_chan.dev
include/dma/xeon_phi/xeon_phi_dma_descriptors.h
include/dma/xeon_phi/xeon_phi_dma_device.h
include/dma/xeon_phi/xeon_phi_dma_request.h
lib/dma/include/xeon_phi/xeon_phi_dma_device_internal.h
lib/dma/xeon_phi/xeon_phi_dma_descriptors.c
lib/dma/xeon_phi/xeon_phi_dma_device.c
lib/dma/xeon_phi/xeon_phi_dma_request.c

index 896c7e5..25aefa3 100644 (file)
@@ -80,25 +80,6 @@ device xeon_phi_dma_chan lsbfirst(addr base) "Intel Xeon Phi DMA Channel" {
      * Register Access: CRU
      * Number: 8
      */
-/*
-    register drar rw addr(base, 0xA014) [8; 0x40] "DMA Descriptor Ring Attributes Register Lo" {
-        _        6 "";
-        base    30 "base address";
-        _        2 "";  
-        size    15 "size of the descriptor ring";
-        page     5 "";
-        sysbit   1 "";
-        _        5 "";
-    };
-*/
-    
-    /*
-     * Protection Level: Ring 0
-     * Visibility: Host / Coprocessor
-     * Reset Dmain: GRPB_REset
-     * Register Access: CRU
-     * Number: 8
-     */
     register drar_hi rw addr(base, 0x18) "DMA Descriptor Ring Attributes Register Lo" {
         base     4 "base address hi part";
         _        2 "";  
index 66b5307..9008c9a 100644 (file)
@@ -25,8 +25,17 @@ struct dma_descriptor;
 /// the size of the Xeon Phi descriptor
 #define XEON_PHI_DMA_DESC_ALIGN 16
 
-///
+/*
+ * ----------------------------------------------------------------------------
+ * DMA Descriptor Flags
+ * ----------------------------------------------------------------------------
+ */
 #define XEON_PHI_DMA_DESC_FLAG_INTR 0x01
+#define XEON_PHI_DMA_DESC_FLAG_TWB  0x02
+#define XEON_PHI_DMA_DESC_FLAG_C    0x04
+#define XEON_PHI_DMA_DESC_FLAG_CO   0x08
+#define XEON_PHI_DMA_DESC_FLAG_ECY  0x10
+
 /*
  * ----------------------------------------------------------------------------
  * DMA Descriptor Allocation / Free
@@ -129,3 +138,5 @@ static inline lpaddr_t xdma_desc_ring_host2guest(lpaddr_t host_addr)
 }
 
 #endif  /* LIB_XEON_PHI_DMA_DESCRIPTORS_H */
+
+
index 95d2953..bfd8257 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef LIB_XEON_PHI_DMA_DEVICE_H
 #define LIB_XEON_PHI_DMA_DEVICE_H
 
+#include <dma/dma_device.h>
+
 /// forward declaration of the device
 struct xeon_phi_dma_device;
 struct xeon_phi_dma_channel;
@@ -66,7 +68,7 @@ static inline struct xeon_phi_dma_device *dma_device_to_ioat(struct dma_device *
  * \returns SYS_ERR_OK on success
  *          errval on error
  */
-errval_t xeon_phi_dma_device_init(mackerel_addr_t mmio_base,
+errval_t xeon_phi_dma_device_init(void * mmio_base,
                                   struct xeon_phi_dma_device **dev);
 
 /**
index 0636cb7..d145297 100644 (file)
@@ -36,7 +36,7 @@ static inline struct xeon_phi_dma_request *dma_request_to_xphi(struct dma_reques
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_dma_request_memcpy_chan(struct xeon_phi_dma_channel *chan,
+errval_t xeon_phi_dma_request_memcpy_chan(struct dma_channel *chan,
                                           struct dma_req_setup *setup,
                                           dma_req_id_t *id);
 
@@ -50,9 +50,9 @@ errval_t xeon_phi_dma_request_memcpy_chan(struct xeon_phi_dma_channel *chan,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_request_memcpy(struct xeon_phi_dma_device *dev,
-                                 struct dma_req_setup *setup,
-                                 dma_req_id_t *id);
+errval_t xeon_phi_dma_request_memcpy(struct dma_device *dev,
+                                     struct dma_req_setup *setup,
+                                     dma_req_id_t *id);
 
 /**
  * \brief issues a status request to the given channel
@@ -64,7 +64,7 @@ errval_t xeon_phi_request_memcpy(struct xeon_phi_dma_device *dev,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_dma_request_status_chan(struct xeon_phi_dma_channel *chan,
+errval_t xeon_phi_dma_request_status_chan(struct dma_channel *chan,
                                           struct dma_req_setup *setup,
                                           dma_req_id_t *id);
 
@@ -78,7 +78,7 @@ errval_t xeon_phi_dma_request_status_chan(struct xeon_phi_dma_channel *chan,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_request_status(struct xeon_phi_dma_device *dev,
+errval_t xeon_phi_request_status(struct dma_device *dev,
                                  struct dma_req_setup *setup,
                                  dma_req_id_t *id);
 
@@ -92,7 +92,7 @@ errval_t xeon_phi_request_status(struct xeon_phi_dma_device *dev,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_dma_request_general_chan(struct xeon_phi_dma_channel *chan,
+errval_t xeon_phi_dma_request_general_chan(struct dma_channel *chan,
                                            struct dma_req_setup *setup,
                                            dma_req_id_t *id);
 
@@ -106,7 +106,7 @@ errval_t xeon_phi_dma_request_general_chan(struct xeon_phi_dma_channel *chan,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_request_general(struct xeon_phi_dma_device *dev,
+errval_t xeon_phi_request_general(struct dma_device *dev,
                                   struct dma_req_setup *setup,
                                   dma_req_id_t *id);
 
@@ -120,7 +120,7 @@ errval_t xeon_phi_request_general(struct xeon_phi_dma_device *dev,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_dma_request_keynoncecent_chan(struct xeon_phi_dma_channel *chan,
+errval_t xeon_phi_dma_request_keynoncecent_chan(struct dma_channel *chan,
                                                 struct dma_req_setup *setup,
                                                 dma_req_id_t *id);
 
@@ -134,7 +134,7 @@ errval_t xeon_phi_dma_request_keynoncecent_chan(struct xeon_phi_dma_channel *cha
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_request_keynoncecent(struct xeon_phi_dma_device *dev,
+errval_t xeon_phi_request_keynoncecent(struct dma_device *dev,
                                        struct dma_req_setup *setup,
                                        dma_req_id_t *id);
 
@@ -148,7 +148,7 @@ errval_t xeon_phi_request_keynoncecent(struct xeon_phi_dma_device *dev,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_dma_request_keynoncecent(struct xeon_phi_dma_channel *chan,
+errval_t xeon_phi_dma_request_keynoncecent(struct dma_channel *chan,
                                            struct dma_req_setup *setup,
                                            dma_req_id_t *id);
 
@@ -162,7 +162,7 @@ errval_t xeon_phi_dma_request_keynoncecent(struct xeon_phi_dma_channel *chan,
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-errval_t xeon_phi_request_key(struct xeon_phi_dma_device *dev,
+errval_t xeon_phi_request_key(struct dma_device *dev,
                               struct dma_req_setup *setup,
                               dma_req_id_t *id);
 
@@ -172,7 +172,7 @@ errval_t xeon_phi_request_key(struct xeon_phi_dma_device *dev,
  * \param chan  Xeon Phi DMA channel
  * \param setup request setup information
  */
-void xeon_phi_dma_request_nop_chan(struct xeon_phi_dma_channel *chan);
+void xeon_phi_dma_request_nop_chan(struct dma_channel *chan);
 
 /**
  * \brief issues a NOP / NULL descriptor request on the given device
@@ -183,7 +183,7 @@ void xeon_phi_dma_request_nop_chan(struct xeon_phi_dma_channel *chan);
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-void xeon_phi_dma_request_nop(struct xeon_phi_dma_device *dev);
+void xeon_phi_dma_request_nop(struct dma_device *dev);
 
 /*
  * ----------------------------------------------------------------------------
index 7750bd8..fac7a52 100644 (file)
 
 #include <dev/xeon_phi/xeon_phi_dma_dev.h>
 
+#define XEON_PHI_DMA_DEVICE_DSTAT_SIZE \
+                (XEON_PHI_DMA_DEVICE_CHAN_TOTAL * XEON_PHI_DMA_CHANNEL_DSTAT_SIZE)
+
+#define XEON_PHI_DMA_DEVICE_DSTAT_FLAGS VREGION_FLAGS_READ_WRITE
+
+/**
+ * \brief fills in the memory information structure for the channel's dstat
+ *        address
+ *
+ * \param dev   Xeon Phi DMA device
+ * \param mem   Memory structure to fill in
+ */
+void xeon_phi_dma_device_get_dstat_addr(struct xeon_phi_dma_device *dev,
+                                        struct dma_mem *mem);
+
 /**
  * \brief globally enables the interrupts for the given device
  *
index 2e0ff2c..d67eac0 100644 (file)
@@ -61,10 +61,30 @@ inline void xeon_phi_dma_desc_fill_memcpy(struct dma_descriptor *desc,
     ASSERT_ALIGNED(dst);
     ASSERT_ALIGNED(size);
 
+    if (flags & XEON_PHI_DMA_DESC_FLAG_INTR) {
+        xeon_phi_dma_desc_memcpy_intr_insert(d, 0x1);
+    }
+    if (flags & XEON_PHI_DMA_DESC_FLAG_TWB) {
+        xeon_phi_dma_desc_memcpy_twb_insert(d, 0x1);
+    }
+    if (flags & XEON_PHI_DMA_DESC_FLAG_C) {
+        xeon_phi_dma_desc_memcpy_c_insert(d, 0x1);
+    }
+    if (flags & XEON_PHI_DMA_DESC_FLAG_CO) {
+        xeon_phi_dma_desc_memcpy_co_insert(d, 0x1);
+    }
+    if (flags & XEON_PHI_DMA_DESC_FLAG_ECY) {
+        xeon_phi_dma_desc_memcpy_ecy_insert(d, 0x1);
+    }
+
+    xeon_phi_dma_desc_memcpy_intr_insert(d, 0x1);
+    xeon_phi_dma_desc_memcpy_twb_insert(d, 0x1);
+
     xeon_phi_dma_desc_memcpy_src_insert(d, src);
     xeon_phi_dma_desc_memcpy_dst_insert(d, dst);
     xeon_phi_dma_desc_memcpy_length_insert(d, (size >> XEON_PHI_DMA_ALIGN_SHIFT));
     xeon_phi_dma_desc_memcpy_dtype_insert(d, xeon_phi_dma_desc_memcpy);
+
 }
 
 /**
@@ -99,7 +119,8 @@ inline void xeon_phi_dma_desc_fill_general(struct dma_descriptor *desc,
     xeon_phi_dma_desc_general_data_insert(d, data);
     xeon_phi_dma_desc_general_dst_insert(d, dst);
 
-    xeon_phi_dma_desc_general_dtype_insert(d, xeon_phi_dma_desc_general);
+    xeon_phi_dma_desc_general_dtype_insert(d,
+    xeon_phi_dma_desc_general);
 }
 
 /**
@@ -128,5 +149,6 @@ inline void xeon_phi_dma_desc_fill_status(struct dma_descriptor *desc,
         xeon_phi_dma_desc_status_intr_insert(d, 0x1);
     }
 
-    xeon_phi_dma_desc_status_dtype_insert(d, xeon_phi_dma_desc_status);
+    xeon_phi_dma_desc_status_dtype_insert(d,
+    xeon_phi_dma_desc_status);
 }
index 7d8ec77..018706e 100644 (file)
@@ -26,8 +26,8 @@ struct xeon_phi_dma_device
 {
     struct dma_device common;
 
-    xeon_phi_dma_t device;                  ///< mackerel device base
-
+    xeon_phi_dma_t device;          ///< mackerel device base
+    struct dma_mem dstat;     ///< memory region for channels dstat_wb
     uint32_t flags;
 };
 
@@ -41,6 +41,26 @@ static dma_dev_id_t device_id = 1;
  */
 
 /**
+ * \brief fills in the memory information structure for the channel's dstat
+ *        address
+ *
+ * \param dev   Xeon Phi DMA device
+ * \param mem   Memory structure to fill in
+ */
+void xeon_phi_dma_device_get_dstat_addr(struct xeon_phi_dma_device *dev,
+                                        struct dma_mem *mem)
+{
+    assert(dev->dstat.vaddr);
+
+    *mem = dev->dstat;
+    mem->bytes = XEON_PHI_DMA_CHANNEL_DSTAT_SIZE;
+    mem->paddr += (XEON_PHI_DMA_CHANNEL_DSTAT_SIZE * dev->common.channels.next);
+    mem->frame = NULL_CAP
+    ;
+    mem->vaddr += (XEON_PHI_DMA_CHANNEL_DSTAT_SIZE * dev->common.channels.next++);
+}
+
+/**
  * \brief globally enables the interrupts for the given device
  *
  * \param dev   Xeon Phi DMA device
@@ -66,7 +86,9 @@ errval_t xeon_phi_dma_device_irq_setup(struct xeon_phi_dma_device *dev,
 void *xeon_phi_dma_device_get_channel_vbase(struct xeon_phi_dma_device *dev,
                                             uint8_t idx)
 {
-    return (void *) (dev->common.mmio.vaddr + (idx * 0x80) + XEON_PHI_DMA_OFFSET);
+    XPHIDEV_DEBUG("getting channel vbase for %u, offset=%x\n", dev->common.id,
+                  idx, (idx * 0x40) + XEON_PHI_DMA_OFFSET);
+    return (void *) (dev->common.mmio.vaddr + (idx * 0x40) + XEON_PHI_DMA_OFFSET);
 }
 
 /**
@@ -82,9 +104,10 @@ void xeon_phi_dma_device_set_channel_owner(struct xeon_phi_dma_device *dev,
 {
     uint8_t owner_val;
     if (owner == XEON_PHI_DMA_OWNER_CARD) {
+        XPHIDEV_DEBUG("settings owner of channel %u to card.\n", dev->common.id, idx);
         owner_val = 0;
-
     } else {
+        XPHIDEV_DEBUG("settings owner of channel %u to host.\n", dev->common.id, idx);
         owner_val = 1;
     }
 
@@ -137,10 +160,16 @@ void xeon_phi_dma_device_set_channel_state(struct xeon_phi_dma_device *dev,
 
     uint8_t enabled_val;
     if (enabled) {
-        dev->common.channels.c[id]->state = DMA_CHAN_ST_RUNNING;
+        XPHIDEV_DEBUG("Enabling channel. [%u, %u]\n", dev->common.id, idx, id);
+        if (dev->common.channels.c[id]) {
+            dev->common.channels.c[id]->state = DMA_CHAN_ST_RUNNING;
+        }
         enabled_val = 0x1;
     } else {
-        dev->common.channels.c[id]->state = DMA_CHAN_ST_SUSPENDED;
+        XPHIDEV_DEBUG("Disabling channel. [%u, %u]\n", dev->common.id, idx, id);
+        if (dev->common.channels.c[id]) {
+            dev->common.channels.c[id]->state = DMA_CHAN_ST_SUSPENDED;
+        }
         enabled_val = 0x0;
     }
 
@@ -195,7 +224,7 @@ void xeon_phi_dma_device_set_channel_state(struct xeon_phi_dma_device *dev,
  * \returns SYS_ERR_OK on success
  *          errval on error
  */
-errval_t xeon_phi_dma_device_init(mackerel_addr_t mmio_base,
+errval_t xeon_phi_dma_device_init(void *mmio_base,
                                   struct xeon_phi_dma_device **dev)
 {
     errval_t err;
@@ -207,17 +236,27 @@ errval_t xeon_phi_dma_device_init(mackerel_addr_t mmio_base,
 
     struct dma_device *dma_dev = (struct dma_device *) xdev;
 
-    XPHIDEV_DEBUG("initializing Xeon Phi DMA device @ %p", device_id, mmio_base);
+    XPHIDEV_DEBUG("initializing Xeon Phi DMA device @ %p\n", device_id,
+                  mmio_base);
+
+    err = dma_mem_alloc(XEON_PHI_DMA_DEVICE_DSTAT_SIZE,
+                        XEON_PHI_DMA_DEVICE_DSTAT_FLAGS,
+                        &xdev->dstat);
+    if (err_is_fail(err)) {
+        free(xdev);
+        return err;
+    }
 
     dma_dev->id = device_id++;
     dma_dev->irq_type = DMA_IRQ_DISABLED;
     dma_dev->type = DMA_DEV_TYPE_XEON_PHI;
     dma_dev->mmio.vaddr = (lvaddr_t) mmio_base;
+    dma_dev->f.poll = xeon_phi_dma_device_poll_channels;
 
     xeon_phi_dma_initialize(&xdev->device, mmio_base);
 
-    XPHIDEV_DEBUG("initializing %u channels", device_id,
-                    XEON_PHI_DMA_DEVICE_CHANNELS);
+    XPHIDEV_DEBUG("initializing %u channels\n", device_id,
+                  XEON_PHI_DMA_DEVICE_CHANNELS);
 
     dma_dev->channels.count = XEON_PHI_DMA_DEVICE_CHANNELS;
     dma_dev->channels.c = calloc(XEON_PHI_DMA_DEVICE_CHANNELS,
@@ -239,15 +278,12 @@ errval_t xeon_phi_dma_device_init(mackerel_addr_t mmio_base,
             free(xdev);
             return err;
         }
-
-        /*
-         * set the channel owner
-         */
-
     }
 
     *dev = xdev;
 
+    XPHIDEV_DEBUG("Xeon Phi DMA device initialized\n", dma_dev->id);
+
     return err;
 }
 
@@ -317,14 +353,10 @@ errval_t xeon_phi_dma_device_poll_channels(struct dma_device *dev)
 {
     errval_t err;
 
-    assert(!"CHECK");
-
     uint8_t idle = 0x1;
 
-    struct xeon_phi_dma_channel * chan;
     for (uint8_t i = 0; i < dev->channels.count; ++i) {
-        chan = (struct xeon_phi_dma_channel *) dev->channels.c[i];
-        err = xeon_phi_dma_channel_poll(chan);
+        err = xeon_phi_dma_channel_poll(dev->channels.c[i]);
         switch (err_no(err)) {
             case DMA_ERR_CHAN_IDLE:
                 idle = idle && 0x1;
index 6c7d84b..d42695e 100644 (file)
@@ -5,26 +5,26 @@
  * If you do not find this file, copies can be found by writing to:
  * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
  */
-#if 0
 #include<barrelfish/barrelfish.h>
 
+
 #include <xeon_phi/xeon_phi_dma_internal.h>
 #include <xeon_phi/xeon_phi_dma_device_internal.h>
 #include <xeon_phi/xeon_phi_dma_channel_internal.h>
 #include <xeon_phi/xeon_phi_dma_request_internal.h>
+#include <dma_ring_internal.h>
 #include <xeon_phi/xeon_phi_dma_descriptors_internal.h>
-#include <xeon_phi/xeon_phi_dma_ring_internal.h>
 
 #include <debug.h>
 
 /**
- * represens the IOAT specific DMA requests
+ * represens the Xeon Phi specific DMA requests
  */
 struct xeon_phi_dma_request
 {
     struct dma_request common;
-    struct xeon_phi_dma_descriptor *desc_head;
-    struct xeon_phi_dma_descriptor *desc_tail;
+    struct dma_descriptor *desc_head;
+    struct dma_descriptor *desc_tail;
 };
 
 /*
@@ -37,9 +37,9 @@ struct xeon_phi_dma_request
 static struct dma_request *req_free_list = NULL;
 
 /**
- * \brief allocates a IOAT DMA request structure
+ * \brief allocates a Xeon Phi DMA request structure
  *
- * \returns IOAT DMA request
+ * \returns Xeon Phi DMA request
  *          NULL on failure
  */
 static struct xeon_phi_dma_request *request_alloc(void)
@@ -124,7 +124,7 @@ errval_t xeon_phi_dma_request_process(struct xeon_phi_dma_request *req)
 /**
  * \brief issues a memcpy request to the given channel
  *
- * \param chan  IOAT DMA channel
+ * \param chan  Xeon Phi DMA channel
  * \param setup request setup information
  * \param id    returns the generated request id
  *
@@ -132,44 +132,41 @@ errval_t xeon_phi_dma_request_process(struct xeon_phi_dma_request *req)
  *          errval on failure
  */
 errval_t xeon_phi_dma_request_memcpy_chan(struct dma_channel *chan,
-                                      struct dma_req_setup *setup,
-                                      dma_req_id_t *id)
+                                          struct dma_req_setup *setup,
+                                          dma_req_id_t *id)
 {
-    assert(chan->device->type == DMA_DEV_TYPE_IOAT);
+    assert(chan->device->type == DMA_DEV_TYPE_XEON_PHI);
 
-    struct xeon_phi_dma_channel *xeon_phi_chan = (struct xeon_phi_dma_channel *) chan;
+    struct xeon_phi_dma_channel *xchan = (struct xeon_phi_dma_channel *) chan;
 
-    uint32_t num_desc = req_num_desc_needed(xeon_phi_chan, setup->args.memcpy.bytes);
+    uint32_t num_desc = req_num_desc_needed(xchan, setup->args.memcpy.bytes);
 
-    IOATREQ_DEBUG("DMA Memcpy request: [0x%016lx]->[0x%016lx] of %lu bytes (%u desc)\n",
+    XPHIREQ_DEBUG("DMA Memcpy request: [0x%016lx]->[0x%016lx] of %lu bytes (%u desc)\n",
                   setup->args.memcpy.src, setup->args.memcpy.dst,
                   setup->args.memcpy.bytes, num_desc);
 
-    struct xeon_phi_dma_ring *ring = xeon_phi_dma_channel_get_ring(xeon_phi_chan);
+    struct dma_ring *ring = xeon_phi_dma_channel_get_ring(xchan);
 
-    if (num_desc > xeon_phi_dma_ring_get_space(ring)) {
-        IOATREQ_DEBUG("Too less space in ring: %u / %u\n", num_desc,
-                      xeon_phi_dma_ring_get_space(ring));
+    if (num_desc > dma_ring_get_space(ring)) {
+        XPHIREQ_DEBUG("Too less space in ring: %u / %u\n", num_desc,
+                      dma_ring_get_space(ring));
         return DMA_ERR_NO_DESCRIPTORS;
     }
 
     struct xeon_phi_dma_request *req = request_alloc();
     if (req == NULL) {
-        IOATREQ_DEBUG("No request descriptors for holding request data\n");
+        XPHIREQ_DEBUG("No request descriptors for holding request data\n");
         return DMA_ERR_NO_REQUESTS;
     }
 
-    xeon_phi_dma_desc_ctrl_array_t ctrl = {
-        0
-    };
-
-    struct xeon_phi_dma_descriptor *desc;
+    struct dma_descriptor *desc;
     size_t length = setup->args.memcpy.bytes;
     lpaddr_t src = setup->args.memcpy.src;
     lpaddr_t dst = setup->args.memcpy.dst;
+    uint32_t flags = 0;
     size_t bytes, max_xfer_size = dma_channel_get_max_xfer_size(chan);
     do {
-        desc = xeon_phi_dma_ring_get_next_desc(ring);
+        desc = dma_ring_get_next_desc(ring);
 
         if (!req->desc_head) {
             req->desc_head = desc;
@@ -178,16 +175,11 @@ errval_t xeon_phi_dma_request_memcpy_chan(struct dma_channel *chan,
             /* the last one */
             bytes = length;
             req->desc_tail = desc;
-
-            xeon_phi_dma_desc_ctrl_fence_insert(ctrl, setup->args.memcpy.ctrl_fence);
-            xeon_phi_dma_desc_ctrl_int_en_insert(ctrl, setup->args.memcpy.ctrl_intr);
-            xeon_phi_dma_desc_ctrl_compl_write_insert(ctrl, 0x1);
         } else {
             bytes = max_xfer_size;
         }
-
-        xeon_phi_dma_desc_fill_memcpy(desc, src, dst, bytes, ctrl);
-        xeon_phi_dma_desc_set_request(desc, NULL);
+        xeon_phi_dma_desc_fill_memcpy(desc, src, dst, bytes, flags);
+        dma_desc_set_request(desc, NULL);
 
         length -= bytes;
         src += bytes;
@@ -195,23 +187,26 @@ errval_t xeon_phi_dma_request_memcpy_chan(struct dma_channel *chan,
     } while (length > 0);
 
     req->common.setup = *setup;
-    req->common.id = dma_request_generate_req_id((struct dma_channel *) xeon_phi_chan);
+    req->common.id = dma_request_generate_req_id(chan);
 
     *id = req->common.id;
 
     /* set the request pointer in the last descriptor */
-    xeon_phi_dma_desc_set_request(desc, req);
+    dma_desc_set_request(desc, &req->common);
 
     assert(req->desc_tail);
-    assert(xeon_phi_dma_desc_get_request(req->desc_tail));
+    assert(dma_desc_get_request(req->desc_tail));
 
-    return xeon_phi_dma_channel_submit_request(xeon_phi_chan, req);
+    //desc = dma_ring_get_next_desc(ring);
+    //xeon_phi_dma_desc_fill_status(desc, (512UL * 1024 * 1024 * 1024) + xchan->dstat.paddr, 0xFAFAFAFA, 0);
+
+    return xeon_phi_dma_channel_submit_request(xchan, req);
 }
 
 /**
  * \brief issues a memcpy request to a channel of the given device
  *
- * \param dev   IOAT DMA device
+ * \param dev   Xeon Phi DMA device
  * \param setup request setup information
  * \param id    returns the generated request id
  *
@@ -219,8 +214,8 @@ errval_t xeon_phi_dma_request_memcpy_chan(struct dma_channel *chan,
  *          errval on failure
  */
 errval_t xeon_phi_dma_request_memcpy(struct dma_device *dev,
-                                 struct dma_req_setup *setup,
-                                 dma_req_id_t *id)
+                                     struct dma_req_setup *setup,
+                                     dma_req_id_t *id)
 {
     struct dma_channel *chan = dma_device_get_channel(dev);
     return xeon_phi_dma_request_memcpy_chan(chan, setup, id);
@@ -229,21 +224,21 @@ errval_t xeon_phi_dma_request_memcpy(struct dma_device *dev,
 /**
  * \brief issues a NOP / NULL descriptor request on the given channel
  *
- * \param chan  IOAT DMA channel
+ * \param chan  Xeon Phi DMA channel
  * \param setup request setup information
  *
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-void xeon_phi_dma_request_nop_chan(struct xeon_phi_dma_channel *chan)
+void xeon_phi_dma_request_nop_chan(struct dma_channel *chan)
 {
-
-    struct xeon_phi_dma_ring *ring = xeon_phi_dma_channel_get_ring(chan);
+    struct xeon_phi_dma_channel *xchan = (struct xeon_phi_dma_channel *)chan;
+    struct dma_ring *ring = xeon_phi_dma_channel_get_ring(xchan);
     assert(ring);
 
-    struct xeon_phi_dma_descriptor *desc = xeon_phi_dma_ring_get_next_desc(ring);
+    struct dma_descriptor *desc = dma_ring_get_next_desc(ring);
     assert(desc);
-    IOATREQ_DEBUG("New DMA NOP request: descriptor=%p\n", desc);
+    XPHIREQ_DEBUG("New DMA NOP request: descriptor=%p\n", desc);
 
     xeon_phi_dma_desc_fill_nop(desc);
 }
@@ -251,17 +246,14 @@ void xeon_phi_dma_request_nop_chan(struct xeon_phi_dma_channel *chan)
 /**
  * \brief issues a NOP / NULL descriptor request on the given device
  *
- * \param dev   IOAT DMA device
+ * \param dev   Xeon Phi DMA device
  * \param setup request setup information
  *
  * \returns SYS_ERR_OK on success
  *          errval on failure
  */
-inline void xeon_phi_dma_request_nop(struct xeon_phi_dma_device *dev)
+inline void xeon_phi_dma_request_nop(struct dma_device *dev)
 {
-    struct xeon_phi_dma_channel *chan;
-    struct dma_device *dma_dev = (struct dma_device *)dev;
-    chan = (struct xeon_phi_dma_channel *)dma_device_get_channel(dma_dev);
+    struct dma_channel *chan = dma_device_get_channel(dev);
     xeon_phi_dma_request_nop_chan(chan);
 }
-#endif