aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-07-28 17:44:04 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:29:55 -0400
commitc7984f4e4e3af3bf8027d636283ea8658c7f80b9 (patch)
tree81fb1adc44173505d447aa93142cc96a4bf03044
parent77867fff033ea549096c49d863c564ad7d8be36f (diff)
ioat: define descriptor control bit-field
This cleans up a mess of and'ing and or'ing bit definitions, and allows simple assignments from the specified dma_ctrl_flags parameter. Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/dma/ioat/dma.c28
-rw-r--r--drivers/dma/ioat/hw.h38
2 files changed, 34 insertions, 32 deletions
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index b7508041c6d7..4840d4805d8c 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -472,9 +472,9 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
472 return -ENOMEM; 472 return -ENOMEM;
473 } 473 }
474 474
475 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 475 hw->ctl_f.compl_write = 1;
476 if (first->txd.callback) { 476 if (first->txd.callback) {
477 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; 477 hw->ctl_f.int_en = 1;
478 if (first != new) { 478 if (first != new) {
479 /* move callback into to last desc */ 479 /* move callback into to last desc */
480 new->txd.callback = first->txd.callback; 480 new->txd.callback = first->txd.callback;
@@ -563,9 +563,9 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx)
563 return -ENOMEM; 563 return -ENOMEM;
564 } 564 }
565 565
566 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 566 hw->ctl_f.compl_write = 1;
567 if (first->txd.callback) { 567 if (first->txd.callback) {
568 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; 568 hw->ctl_f.int_en = 1;
569 if (first != new) { 569 if (first != new) {
570 /* move callback into to last desc */ 570 /* move callback into to last desc */
571 new->txd.callback = first->txd.callback; 571 new->txd.callback = first->txd.callback;
@@ -878,7 +878,8 @@ ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
878 noop_desc = to_ioat_desc(ioat_chan->used_desc.next); 878 noop_desc = to_ioat_desc(ioat_chan->used_desc.next);
879 /* set size to non-zero value (channel returns error when size is 0) */ 879 /* set size to non-zero value (channel returns error when size is 0) */
880 noop_desc->hw->size = NULL_DESC_BUFFER_SIZE; 880 noop_desc->hw->size = NULL_DESC_BUFFER_SIZE;
881 noop_desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL; 881 noop_desc->hw->ctl = 0;
882 noop_desc->hw->ctl_f.null = 1;
882 noop_desc->hw->src_addr = 0; 883 noop_desc->hw->src_addr = 0;
883 noop_desc->hw->dst_addr = 0; 884 noop_desc->hw->dst_addr = 0;
884 885
@@ -1230,6 +1231,7 @@ ioat_dma_is_complete(struct dma_chan *chan, dma_cookie_t cookie,
1230static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) 1231static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
1231{ 1232{
1232 struct ioat_desc_sw *desc; 1233 struct ioat_desc_sw *desc;
1234 struct ioat_dma_descriptor *hw;
1233 1235
1234 spin_lock_bh(&ioat_chan->desc_lock); 1236 spin_lock_bh(&ioat_chan->desc_lock);
1235 1237
@@ -1242,17 +1244,19 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
1242 return; 1244 return;
1243 } 1245 }
1244 1246
1245 desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL 1247 hw = desc->hw;
1246 | IOAT_DMA_DESCRIPTOR_CTL_INT_GN 1248 hw->ctl = 0;
1247 | IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 1249 hw->ctl_f.null = 1;
1250 hw->ctl_f.int_en = 1;
1251 hw->ctl_f.compl_write = 1;
1248 /* set size to non-zero value (channel returns error when size is 0) */ 1252 /* set size to non-zero value (channel returns error when size is 0) */
1249 desc->hw->size = NULL_DESC_BUFFER_SIZE; 1253 hw->size = NULL_DESC_BUFFER_SIZE;
1250 desc->hw->src_addr = 0; 1254 hw->src_addr = 0;
1251 desc->hw->dst_addr = 0; 1255 hw->dst_addr = 0;
1252 async_tx_ack(&desc->txd); 1256 async_tx_ack(&desc->txd);
1253 switch (ioat_chan->device->version) { 1257 switch (ioat_chan->device->version) {
1254 case IOAT_VER_1_2: 1258 case IOAT_VER_1_2:
1255 desc->hw->next = 0; 1259 hw->next = 0;
1256 list_add_tail(&desc->node, &ioat_chan->used_desc); 1260 list_add_tail(&desc->node, &ioat_chan->used_desc);
1257 1261
1258 writel(((u64) desc->txd.phys) & 0x00000000FFFFFFFF, 1262 writel(((u64) desc->txd.phys) & 0x00000000FFFFFFFF,
diff --git a/drivers/dma/ioat/hw.h b/drivers/dma/ioat/hw.h
index 1438fa5c4d1a..e13f3ed47763 100644
--- a/drivers/dma/ioat/hw.h
+++ b/drivers/dma/ioat/hw.h
@@ -40,7 +40,24 @@
40 40
41struct ioat_dma_descriptor { 41struct ioat_dma_descriptor {
42 uint32_t size; 42 uint32_t size;
43 uint32_t ctl; 43 union {
44 uint32_t ctl;
45 struct {
46 unsigned int int_en:1;
47 unsigned int src_snoop_dis:1;
48 unsigned int dest_snoop_dis:1;
49 unsigned int compl_write:1;
50 unsigned int fence:1;
51 unsigned int null:1;
52 unsigned int src_brk:1;
53 unsigned int dest_brk:1;
54 unsigned int bundle:1;
55 unsigned int dest_dca:1;
56 unsigned int hint:1;
57 unsigned int rsvd2:13;
58 unsigned int op:8;
59 } ctl_f;
60 };
44 uint64_t src_addr; 61 uint64_t src_addr;
45 uint64_t dst_addr; 62 uint64_t dst_addr;
46 uint64_t next; 63 uint64_t next;
@@ -49,23 +66,4 @@ struct ioat_dma_descriptor {
49 uint64_t user1; 66 uint64_t user1;
50 uint64_t user2; 67 uint64_t user2;
51}; 68};
52
53#define IOAT_DMA_DESCRIPTOR_CTL_INT_GN 0x00000001
54#define IOAT_DMA_DESCRIPTOR_CTL_SRC_SN 0x00000002
55#define IOAT_DMA_DESCRIPTOR_CTL_DST_SN 0x00000004
56#define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008
57#define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010
58#define IOAT_DMA_DESCRIPTOR_NUL 0x00000020
59#define IOAT_DMA_DESCRIPTOR_CTL_SP_BRK 0x00000040
60#define IOAT_DMA_DESCRIPTOR_CTL_DP_BRK 0x00000080
61#define IOAT_DMA_DESCRIPTOR_CTL_BNDL 0x00000100
62#define IOAT_DMA_DESCRIPTOR_CTL_DCA 0x00000200
63#define IOAT_DMA_DESCRIPTOR_CTL_BUFHINT 0x00000400
64
65#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_CONTEXT 0xFF000000
66#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_DMA 0x00000000
67
68#define IOAT_DMA_DESCRIPTOR_CTL_CONTEXT_DCA 0x00000001
69#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_MASK 0xFF000000
70
71#endif 69#endif