From: Dan Williams <dan.j.williams@intel.com>
To: linux-kernel@vger.kernel.org
Cc: linux-raid@vger.kernel.org, netdev@vger.kernel.org,
Maciej Sosnowski <maciej.sosnowski@intel.com>
Subject: [PATCH 08/29] ioat: define descriptor control bit-field
Date: Thu, 03 Sep 2009 19:31:10 -0700 [thread overview]
Message-ID: <20090904023110.32667.71782.stgit@dwillia2-linux.ch.intel.com> (raw)
In-Reply-To: <20090904022733.32667.77626.stgit@dwillia2-linux.ch.intel.com>
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>
---
drivers/dma/ioat/dma.c | 28 ++++++++++++++++------------
drivers/dma/ioat/hw.h | 38 ++++++++++++++++++--------------------
2 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index b750804..4840d48 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)
return -ENOMEM;
}
- hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
+ hw->ctl_f.compl_write = 1;
if (first->txd.callback) {
- hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
+ hw->ctl_f.int_en = 1;
if (first != new) {
/* move callback into to last desc */
new->txd.callback = first->txd.callback;
@@ -563,9 +563,9 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx)
return -ENOMEM;
}
- hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
+ hw->ctl_f.compl_write = 1;
if (first->txd.callback) {
- hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
+ hw->ctl_f.int_en = 1;
if (first != new) {
/* move callback into to last desc */
new->txd.callback = first->txd.callback;
@@ -878,7 +878,8 @@ ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
noop_desc = to_ioat_desc(ioat_chan->used_desc.next);
/* set size to non-zero value (channel returns error when size is 0) */
noop_desc->hw->size = NULL_DESC_BUFFER_SIZE;
- noop_desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL;
+ noop_desc->hw->ctl = 0;
+ noop_desc->hw->ctl_f.null = 1;
noop_desc->hw->src_addr = 0;
noop_desc->hw->dst_addr = 0;
@@ -1230,6 +1231,7 @@ ioat_dma_is_complete(struct dma_chan *chan, dma_cookie_t cookie,
static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
{
struct ioat_desc_sw *desc;
+ struct ioat_dma_descriptor *hw;
spin_lock_bh(&ioat_chan->desc_lock);
@@ -1242,17 +1244,19 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
return;
}
- desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL
- | IOAT_DMA_DESCRIPTOR_CTL_INT_GN
- | IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
+ hw = desc->hw;
+ hw->ctl = 0;
+ hw->ctl_f.null = 1;
+ hw->ctl_f.int_en = 1;
+ hw->ctl_f.compl_write = 1;
/* set size to non-zero value (channel returns error when size is 0) */
- desc->hw->size = NULL_DESC_BUFFER_SIZE;
- desc->hw->src_addr = 0;
- desc->hw->dst_addr = 0;
+ hw->size = NULL_DESC_BUFFER_SIZE;
+ hw->src_addr = 0;
+ hw->dst_addr = 0;
async_tx_ack(&desc->txd);
switch (ioat_chan->device->version) {
case IOAT_VER_1_2:
- desc->hw->next = 0;
+ hw->next = 0;
list_add_tail(&desc->node, &ioat_chan->used_desc);
writel(((u64) desc->txd.phys) & 0x00000000FFFFFFFF,
diff --git a/drivers/dma/ioat/hw.h b/drivers/dma/ioat/hw.h
index 1438fa5..e13f3ed 100644
--- a/drivers/dma/ioat/hw.h
+++ b/drivers/dma/ioat/hw.h
@@ -40,7 +40,24 @@
struct ioat_dma_descriptor {
uint32_t size;
- uint32_t ctl;
+ union {
+ uint32_t ctl;
+ struct {
+ unsigned int int_en:1;
+ unsigned int src_snoop_dis:1;
+ unsigned int dest_snoop_dis:1;
+ unsigned int compl_write:1;
+ unsigned int fence:1;
+ unsigned int null:1;
+ unsigned int src_brk:1;
+ unsigned int dest_brk:1;
+ unsigned int bundle:1;
+ unsigned int dest_dca:1;
+ unsigned int hint:1;
+ unsigned int rsvd2:13;
+ unsigned int op:8;
+ } ctl_f;
+ };
uint64_t src_addr;
uint64_t dst_addr;
uint64_t next;
@@ -49,23 +66,4 @@ struct ioat_dma_descriptor {
uint64_t user1;
uint64_t user2;
};
-
-#define IOAT_DMA_DESCRIPTOR_CTL_INT_GN 0x00000001
-#define IOAT_DMA_DESCRIPTOR_CTL_SRC_SN 0x00000002
-#define IOAT_DMA_DESCRIPTOR_CTL_DST_SN 0x00000004
-#define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008
-#define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010
-#define IOAT_DMA_DESCRIPTOR_NUL 0x00000020
-#define IOAT_DMA_DESCRIPTOR_CTL_SP_BRK 0x00000040
-#define IOAT_DMA_DESCRIPTOR_CTL_DP_BRK 0x00000080
-#define IOAT_DMA_DESCRIPTOR_CTL_BNDL 0x00000100
-#define IOAT_DMA_DESCRIPTOR_CTL_DCA 0x00000200
-#define IOAT_DMA_DESCRIPTOR_CTL_BUFHINT 0x00000400
-
-#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_CONTEXT 0xFF000000
-#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_DMA 0x00000000
-
-#define IOAT_DMA_DESCRIPTOR_CTL_CONTEXT_DCA 0x00000001
-#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_MASK 0xFF000000
-
#endif
next prev parent reply other threads:[~2009-09-04 2:31 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 2:30 [PATCH 00/29] ioatdma: towards raid support Dan Williams
2009-09-04 2:30 ` [PATCH 01/29] ioat: move to drivers/dma/ioat/ Dan Williams
2009-09-04 2:30 ` [PATCH 02/29] ioat: move definitions to dma.h Dan Williams
2009-09-04 2:30 ` [PATCH 03/29] ioat: convert ioat_probe to pcim/devm Dan Williams
2009-09-04 2:30 ` [PATCH 04/29] ioat: cleanup some long deref chains and 80 column collisions Dan Williams
2009-09-04 2:30 ` [PATCH 05/29] ioat: kill function prototype ifdef guards Dan Williams
2009-09-04 2:31 ` [PATCH 06/29] ioat: split ioat_dma_probe into core/version-specific routines Dan Williams
2009-09-04 2:31 ` [PATCH 07/29] ioat: fix type mismatch for ->dmacount Dan Williams
2009-09-04 2:31 ` Dan Williams [this message]
2009-09-04 2:31 ` [PATCH 09/29] ioat1: move descriptor allocation from submit to prep Dan Williams
2009-09-04 2:31 ` [PATCH 10/29] ioat: fix self test interrupts Dan Williams
2009-09-04 2:31 ` [PATCH 11/29] ioat: prepare the code for ioat[12]_dma_chan split Dan Williams
2009-09-04 2:31 ` [PATCH 12/29] ioat2,3: convert to a true ring buffer Dan Williams
2009-09-04 2:31 ` [PATCH 13/29] ioat1: kill unused unmap parameters Dan Williams
2009-09-04 2:31 ` [PATCH 14/29] ioat: add some dev_dbg() calls Dan Williams
2009-09-04 2:31 ` [PATCH 15/29] ioat: cleanup completion status reads Dan Williams
2009-09-04 2:31 ` [PATCH 16/29] ioat: ignore reserved bits for chancnt and xfercap Dan Williams
2009-09-04 2:31 ` [PATCH 17/29] ioat: preserve chanctrl bits when re-arming interrupts Dan Williams
2009-09-04 2:32 ` [PATCH 18/29] ioat: ___devinit annotate the initialization paths Dan Williams
2009-09-04 2:32 ` [PATCH 19/29] ioat1: trim ioat_dma_desc_sw Dan Williams
2009-09-14 14:55 ` Sosnowski, Maciej
2009-09-04 2:32 ` [PATCH 20/29] ioat: switch watchdog and reset handler from workqueue to timer Dan Williams
2009-09-14 14:59 ` Sosnowski, Maciej
2009-09-04 2:32 ` [PATCH 21/29] ioat2,3: dynamically resize descriptor ring Dan Williams
2009-09-14 15:00 ` Sosnowski, Maciej
2009-09-15 23:07 ` Dan Williams
2009-09-04 2:32 ` [PATCH 22/29] net_dma: poll for a descriptor after allocation failure Dan Williams
2009-09-14 15:00 ` Sosnowski, Maciej
2009-09-04 2:32 ` [PATCH 23/29] dw_dmac: implement a private tx_list Dan Williams
2009-09-04 2:32 ` [PATCH 24/29] fsldma: " Dan Williams
2009-09-04 19:42 ` Dan Williams
2009-09-04 2:32 ` [PATCH 25/29] iop-adma: " Dan Williams
2009-09-04 2:32 ` [PATCH 26/29] ioat: " Dan Williams
2009-09-14 15:01 ` Sosnowski, Maciej
2009-09-04 2:32 ` [PATCH 27/29] mv_xor: " Dan Williams
2009-09-04 2:32 ` [PATCH 28/29] dmaengine: kill tx_list Dan Williams
2009-09-14 15:01 ` Sosnowski, Maciej
2009-09-04 2:32 ` [PATCH 29/29] ioat2, 3: cacheline align software descriptor allocations Dan Williams
2009-09-14 15:02 ` Sosnowski, Maciej
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090904023110.32667.71782.stgit@dwillia2-linux.ch.intel.com \
--to=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=maciej.sosnowski@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).