blob: df569d810b8fb13f9ce4bae37d628118411fc194 [file] [log] [blame]
Chris Leech0bbd5f42006-05-23 17:35:34 -07001/*
Maciej Sosnowski211a22c2009-02-26 11:05:43 +01002 * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
Chris Leech0bbd5f42006-05-23 17:35:34 -07003 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
Chris Leech0bbd5f42006-05-23 17:35:34 -070014 * The full GNU General Public License is included in this distribution in the
15 * file called COPYING.
16 */
17#ifndef IOATDMA_H
18#define IOATDMA_H
19
20#include <linux/dmaengine.h>
Chris Leech0bbd5f42006-05-23 17:35:34 -070021#include <linux/init.h>
22#include <linux/dmapool.h>
23#include <linux/cache.h>
David S. Miller57c651f2006-05-23 17:39:49 -070024#include <linux/pci_ids.h>
Dave Jiang885b2012015-08-11 08:48:32 -070025#include <linux/circ_buf.h>
26#include <linux/interrupt.h>
27#include "registers.h"
28#include "hw.h"
Chris Leech0bbd5f42006-05-23 17:35:34 -070029
Dan Williams3208ca52009-09-10 11:27:36 -070030#define IOAT_DMA_VERSION "4.00"
Shannon Nelson5149fd02007-10-18 03:07:13 -070031
Shannon Nelson7bb67c12007-11-14 16:59:51 -080032#define IOAT_DMA_DCA_ANY_CPU ~0
33
Dave Jiang55f878e2015-08-11 08:48:27 -070034#define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, dma_dev)
35#define to_dev(ioat_chan) (&(ioat_chan)->ioat_dma->pdev->dev)
36#define to_pdev(ioat_chan) ((ioat_chan)->ioat_dma->pdev)
Dan Williams1f27adc22009-09-08 17:29:02 -070037
Dave Jiang55f878e2015-08-11 08:48:27 -070038#define chan_num(ch) ((int)((ch)->reg_base - (ch)->ioat_dma->reg_base) / 0x80)
Dan Williams1f27adc22009-09-08 17:29:02 -070039
Dave Jiang599d49d2015-08-11 08:48:49 -070040/* ioat hardware assumes at least two sources for raid operations */
41#define src_cnt_to_sw(x) ((x) + 2)
42#define src_cnt_to_hw(x) ((x) - 2)
43#define ndest_to_sw(x) ((x) + 1)
44#define ndest_to_hw(x) ((x) - 1)
45#define src16_cnt_to_sw(x) ((x) + 9)
46#define src16_cnt_to_hw(x) ((x) - 9)
47
Dan Williams1f27adc22009-09-08 17:29:02 -070048/*
49 * workaround for IOAT ver.3.0 null descriptor issue
50 * (channel returns error when size is 0)
51 */
52#define NULL_DESC_BUFFER_SIZE 1
53
Dave Jiang8a52b9f2013-03-26 15:42:47 -070054enum ioat_irq_mode {
55 IOAT_NOIRQ = 0,
56 IOAT_MSIX,
Dave Jiang8a52b9f2013-03-26 15:42:47 -070057 IOAT_MSI,
58 IOAT_INTX
59};
60
Chris Leech0bbd5f42006-05-23 17:35:34 -070061/**
Shannon Nelson8ab89562007-10-16 01:27:39 -070062 * struct ioatdma_device - internal representation of a IOAT device
Chris Leech0bbd5f42006-05-23 17:35:34 -070063 * @pdev: PCI-Express device
64 * @reg_base: MMIO register space base address
65 * @dma_pool: for allocating DMA descriptors
Dave Jiang55f878e2015-08-11 08:48:27 -070066 * @dma_dev: embedded struct dma_device
Shannon Nelson8ab89562007-10-16 01:27:39 -070067 * @version: version of ioatdma device
Shannon Nelson7bb67c12007-11-14 16:59:51 -080068 * @msix_entries: irq handlers
69 * @idx: per channel data
Dan Williamsf2427e22009-07-28 14:42:38 -070070 * @dca: direct cache access context
Chris Leech0bbd5f42006-05-23 17:35:34 -070071 */
Shannon Nelson8ab89562007-10-16 01:27:39 -070072struct ioatdma_device {
Chris Leech0bbd5f42006-05-23 17:35:34 -070073 struct pci_dev *pdev;
Al Viro47b16532006-10-10 22:45:47 +010074 void __iomem *reg_base;
Chris Leech0bbd5f42006-05-23 17:35:34 -070075 struct pci_pool *dma_pool;
76 struct pci_pool *completion_pool;
Dave Jiang7727eaa2013-04-15 10:25:56 -070077#define MAX_SED_POOLS 5
78 struct dma_pool *sed_hw_pool[MAX_SED_POOLS];
Dave Jiang55f878e2015-08-11 08:48:27 -070079 struct dma_device dma_dev;
Shannon Nelson8ab89562007-10-16 01:27:39 -070080 u8 version;
Shannon Nelson3e037452007-10-16 01:27:40 -070081 struct msix_entry msix_entries[4];
Dave Jiang5a976882015-08-11 08:48:21 -070082 struct ioatdma_chan *idx[4];
Dan Williamsf2427e22009-07-28 14:42:38 -070083 struct dca_provider *dca;
Dave Jiang8a52b9f2013-03-26 15:42:47 -070084 enum ioat_irq_mode irq_mode;
Dave Jiang75c6f0a2013-04-10 16:44:39 -070085 u32 cap;
Chris Leech0bbd5f42006-05-23 17:35:34 -070086};
87
Dave Jiang5a976882015-08-11 08:48:21 -070088struct ioatdma_chan {
89 struct dma_chan dma_chan;
Al Viro47b16532006-10-10 22:45:47 +010090 void __iomem *reg_base;
Dan Williams27502932012-03-23 13:36:42 -070091 dma_addr_t last_completion;
Chris Leech0bbd5f42006-05-23 17:35:34 -070092 spinlock_t cleanup_lock;
Dan Williams09c8a5b2009-09-08 12:01:49 -070093 unsigned long state;
94 #define IOAT_COMPLETION_PENDING 0
95 #define IOAT_COMPLETION_ACK 1
96 #define IOAT_RESET_PENDING 2
Dan Williams5669e312009-09-08 17:42:56 -070097 #define IOAT_KOBJ_INIT_FAIL 3
Dan Williams074cc472010-05-01 15:22:55 -070098 #define IOAT_RESHAPE_PENDING 4
Dan Williams556ab452010-07-23 15:47:56 -070099 #define IOAT_RUN 5
Dave Jiang4dec23d2013-02-07 14:38:32 -0700100 #define IOAT_CHAN_ACTIVE 6
Dan Williams09c8a5b2009-09-08 12:01:49 -0700101 struct timer_list timer;
102 #define COMPLETION_TIMEOUT msecs_to_jiffies(100)
Dan Williamsa3092182009-09-08 12:02:01 -0700103 #define IDLE_TIMEOUT msecs_to_jiffies(2000)
Dan Williams09c8a5b2009-09-08 12:01:49 -0700104 #define RESET_DELAY msecs_to_jiffies(100)
Dave Jiang55f878e2015-08-11 08:48:27 -0700105 struct ioatdma_device *ioat_dma;
Dan Williams4fb9b9e2009-09-08 12:01:04 -0700106 dma_addr_t completion_dma;
107 u64 *completion;
Shannon Nelson3e037452007-10-16 01:27:40 -0700108 struct tasklet_struct cleanup_task;
Dan Williams5669e312009-09-08 17:42:56 -0700109 struct kobject kobj;
Dave Jiang5a976882015-08-11 08:48:21 -0700110
111/* ioat v2 / v3 channel attributes
112 * @xfercap_log; log2 of channel max transfer length (for fast division)
113 * @head: allocated index
114 * @issued: hardware notification point
115 * @tail: cleanup index
116 * @dmacount: identical to 'head' except for occasionally resetting to zero
117 * @alloc_order: log2 of the number of allocated descriptors
118 * @produce: number of descriptors to produce at submit time
119 * @ring: software ring buffer implementation of hardware ring
120 * @prep_lock: serializes descriptor preparation (producers)
121 */
122 size_t xfercap_log;
123 u16 head;
124 u16 issued;
125 u16 tail;
126 u16 dmacount;
127 u16 alloc_order;
128 u16 produce;
129 struct ioat_ring_ent **ring;
130 spinlock_t prep_lock;
Chris Leech0bbd5f42006-05-23 17:35:34 -0700131};
132
Dan Williams5669e312009-09-08 17:42:56 -0700133struct ioat_sysfs_entry {
134 struct attribute attr;
135 ssize_t (*show)(struct dma_chan *, char *);
136};
Dan Williams5cbafa62009-08-26 13:01:44 -0700137
Dan Williamsdcbc8532009-07-28 14:44:50 -0700138/**
Dave Jiang7727eaa2013-04-15 10:25:56 -0700139 * struct ioat_sed_ent - wrapper around super extended hardware descriptor
140 * @hw: hardware SED
141 * @sed_dma: dma address for the SED
142 * @list: list member
143 * @parent: point to the dma descriptor that's the parent
144 */
145struct ioat_sed_ent {
146 struct ioat_sed_raw_descriptor *hw;
147 dma_addr_t dma;
148 struct ioat_ring_ent *parent;
149 unsigned int hw_pool;
150};
151
Dave Jiang885b2012015-08-11 08:48:32 -0700152/**
153 * struct ioat_ring_ent - wrapper around hardware descriptor
154 * @hw: hardware DMA descriptor (for memcpy)
155 * @fill: hardware fill descriptor
156 * @xor: hardware xor descriptor
157 * @xor_ex: hardware xor extension descriptor
158 * @pq: hardware pq descriptor
159 * @pq_ex: hardware pq extension descriptor
160 * @pqu: hardware pq update descriptor
161 * @raw: hardware raw (un-typed) descriptor
162 * @txd: the generic software descriptor for all engines
163 * @len: total transaction length for unmap
164 * @result: asynchronous result of validate operations
165 * @id: identifier for debug
166 */
167
168struct ioat_ring_ent {
169 union {
170 struct ioat_dma_descriptor *hw;
171 struct ioat_xor_descriptor *xor;
172 struct ioat_xor_ext_descriptor *xor_ex;
173 struct ioat_pq_descriptor *pq;
174 struct ioat_pq_ext_descriptor *pq_ex;
175 struct ioat_pq_update_descriptor *pqu;
176 struct ioat_raw_descriptor *raw;
177 };
178 size_t len;
179 struct dma_async_tx_descriptor txd;
180 enum sum_check_flags *result;
181 #ifdef DEBUG
182 int id;
183 #endif
184 struct ioat_sed_ent *sed;
185};
186
Dave Jiang599d49d2015-08-11 08:48:49 -0700187extern const struct sysfs_ops ioat_sysfs_ops;
188extern struct ioat_sysfs_entry ioat_version_attr;
189extern struct ioat_sysfs_entry ioat_cap_attr;
190extern int ioat_pending_level;
191extern int ioat_ring_alloc_order;
192extern struct kobj_type ioat_ktype;
193extern struct kmem_cache *ioat_cache;
194extern int ioat_ring_max_alloc_order;
195extern struct kmem_cache *ioat_sed_cache;
196
Dave Jiang5a976882015-08-11 08:48:21 -0700197static inline struct ioatdma_chan *to_ioat_chan(struct dma_chan *c)
Dan Williamsdcbc8532009-07-28 14:44:50 -0700198{
Dave Jiang5a976882015-08-11 08:48:21 -0700199 return container_of(c, struct ioatdma_chan, dma_chan);
Dan Williamsdcbc8532009-07-28 14:44:50 -0700200}
201
Chris Leech0bbd5f42006-05-23 17:35:34 -0700202/* wrapper around hardware descriptor format + additional software fields */
Dan Williams6df91832009-09-08 12:00:55 -0700203#ifdef DEBUG
204#define set_desc_id(desc, i) ((desc)->id = (i))
205#define desc_id(desc) ((desc)->id)
206#else
207#define set_desc_id(desc, i)
208#define desc_id(desc) (0)
209#endif
210
211static inline void
Dave Jiang5a976882015-08-11 08:48:21 -0700212__dump_desc_dbg(struct ioatdma_chan *ioat_chan, struct ioat_dma_descriptor *hw,
Dan Williams6df91832009-09-08 12:00:55 -0700213 struct dma_async_tx_descriptor *tx, int id)
214{
Dave Jiang5a976882015-08-11 08:48:21 -0700215 struct device *dev = to_dev(ioat_chan);
Dan Williams6df91832009-09-08 12:00:55 -0700216
217 dev_dbg(dev, "desc[%d]: (%#llx->%#llx) cookie: %d flags: %#x"
Dave Jiang50f9f972013-03-04 10:59:54 -0700218 " ctl: %#10.8x (op: %#x int_en: %d compl: %d)\n", id,
Dan Williams6df91832009-09-08 12:00:55 -0700219 (unsigned long long) tx->phys,
220 (unsigned long long) hw->next, tx->cookie, tx->flags,
221 hw->ctl, hw->ctl_f.op, hw->ctl_f.int_en, hw->ctl_f.compl_write);
222}
223
224#define dump_desc_dbg(c, d) \
Dave Jiang5a976882015-08-11 08:48:21 -0700225 ({ if (d) __dump_desc_dbg(c, d->hw, &d->txd, desc_id(d)); 0; })
Dan Williams6df91832009-09-08 12:00:55 -0700226
Dave Jiang5a976882015-08-11 08:48:21 -0700227static inline struct ioatdma_chan *
Dave Jiang55f878e2015-08-11 08:48:27 -0700228ioat_chan_by_index(struct ioatdma_device *ioat_dma, int index)
Dan Williams5cbafa62009-08-26 13:01:44 -0700229{
Dave Jiang55f878e2015-08-11 08:48:27 -0700230 return ioat_dma->idx[index];
Dan Williams5cbafa62009-08-26 13:01:44 -0700231}
232
Dave Jiang5a976882015-08-11 08:48:21 -0700233static inline u64 ioat_chansts_32(struct ioatdma_chan *ioat_chan)
Dan Williams09c8a5b2009-09-08 12:01:49 -0700234{
Dave Jiang55f878e2015-08-11 08:48:27 -0700235 u8 ver = ioat_chan->ioat_dma->version;
Dan Williams09c8a5b2009-09-08 12:01:49 -0700236 u64 status;
237 u32 status_lo;
238
239 /* We need to read the low address first as this causes the
240 * chipset to latch the upper bits for the subsequent read
241 */
Dave Jiang5a976882015-08-11 08:48:21 -0700242 status_lo = readl(ioat_chan->reg_base + IOAT_CHANSTS_OFFSET_LOW(ver));
243 status = readl(ioat_chan->reg_base + IOAT_CHANSTS_OFFSET_HIGH(ver));
Dan Williams09c8a5b2009-09-08 12:01:49 -0700244 status <<= 32;
245 status |= status_lo;
246
247 return status;
248}
249
Dave Jiangd92a8d72013-03-26 15:42:41 -0700250#if BITS_PER_LONG == 64
251
Dave Jiang5a976882015-08-11 08:48:21 -0700252static inline u64 ioat_chansts(struct ioatdma_chan *ioat_chan)
Dave Jiangd92a8d72013-03-26 15:42:41 -0700253{
Dave Jiang55f878e2015-08-11 08:48:27 -0700254 u8 ver = ioat_chan->ioat_dma->version;
Dave Jiangd92a8d72013-03-26 15:42:41 -0700255 u64 status;
256
257 /* With IOAT v3.3 the status register is 64bit. */
258 if (ver >= IOAT_VER_3_3)
Dave Jiang5a976882015-08-11 08:48:21 -0700259 status = readq(ioat_chan->reg_base + IOAT_CHANSTS_OFFSET(ver));
Dave Jiangd92a8d72013-03-26 15:42:41 -0700260 else
Dave Jiang5a976882015-08-11 08:48:21 -0700261 status = ioat_chansts_32(ioat_chan);
Dave Jiangd92a8d72013-03-26 15:42:41 -0700262
263 return status;
264}
265
266#else
267#define ioat_chansts ioat_chansts_32
268#endif
269
Dan Williams09c8a5b2009-09-08 12:01:49 -0700270static inline u64 ioat_chansts_to_addr(u64 status)
271{
272 return status & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR;
273}
274
Dave Jiang5a976882015-08-11 08:48:21 -0700275static inline u32 ioat_chanerr(struct ioatdma_chan *ioat_chan)
Dan Williams09c8a5b2009-09-08 12:01:49 -0700276{
Dave Jiang5a976882015-08-11 08:48:21 -0700277 return readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
Dan Williams09c8a5b2009-09-08 12:01:49 -0700278}
279
Dave Jiang5a976882015-08-11 08:48:21 -0700280static inline void ioat_suspend(struct ioatdma_chan *ioat_chan)
Dan Williams09c8a5b2009-09-08 12:01:49 -0700281{
Dave Jiang55f878e2015-08-11 08:48:27 -0700282 u8 ver = ioat_chan->ioat_dma->version;
Dan Williams09c8a5b2009-09-08 12:01:49 -0700283
Dave Jiang5a976882015-08-11 08:48:21 -0700284 writeb(IOAT_CHANCMD_SUSPEND,
285 ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
Dan Williams09c8a5b2009-09-08 12:01:49 -0700286}
287
Dave Jiang5a976882015-08-11 08:48:21 -0700288static inline void ioat_reset(struct ioatdma_chan *ioat_chan)
Dan Williamsa6d52d72009-12-19 15:36:02 -0700289{
Dave Jiang55f878e2015-08-11 08:48:27 -0700290 u8 ver = ioat_chan->ioat_dma->version;
Dan Williamsa6d52d72009-12-19 15:36:02 -0700291
Dave Jiang5a976882015-08-11 08:48:21 -0700292 writeb(IOAT_CHANCMD_RESET,
293 ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
Dan Williamsa6d52d72009-12-19 15:36:02 -0700294}
295
Dave Jiang5a976882015-08-11 08:48:21 -0700296static inline bool ioat_reset_pending(struct ioatdma_chan *ioat_chan)
Dan Williamsa6d52d72009-12-19 15:36:02 -0700297{
Dave Jiang55f878e2015-08-11 08:48:27 -0700298 u8 ver = ioat_chan->ioat_dma->version;
Dan Williamsa6d52d72009-12-19 15:36:02 -0700299 u8 cmd;
300
Dave Jiang5a976882015-08-11 08:48:21 -0700301 cmd = readb(ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
Dan Williamsa6d52d72009-12-19 15:36:02 -0700302 return (cmd & IOAT_CHANCMD_RESET) == IOAT_CHANCMD_RESET;
303}
304
Dan Williams09c8a5b2009-09-08 12:01:49 -0700305static inline bool is_ioat_active(unsigned long status)
306{
307 return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_ACTIVE);
308}
309
310static inline bool is_ioat_idle(unsigned long status)
311{
312 return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_DONE);
313}
314
315static inline bool is_ioat_halted(unsigned long status)
316{
317 return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_HALTED);
318}
319
320static inline bool is_ioat_suspended(unsigned long status)
321{
322 return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_SUSPENDED);
323}
324
325/* channel was fatally programmed */
326static inline bool is_ioat_bug(unsigned long err)
327{
Dan Williamsb57014d2009-11-19 17:10:07 -0700328 return !!err;
Dan Williams09c8a5b2009-09-08 12:01:49 -0700329}
330
Dave Jiang885b2012015-08-11 08:48:32 -0700331#define IOAT_MAX_ORDER 16
332#define ioat_get_alloc_order() \
333 (min(ioat_ring_alloc_order, IOAT_MAX_ORDER))
334#define ioat_get_max_alloc_order() \
335 (min(ioat_ring_max_alloc_order, IOAT_MAX_ORDER))
336
337static inline u32 ioat_ring_size(struct ioatdma_chan *ioat_chan)
338{
339 return 1 << ioat_chan->alloc_order;
340}
341
342/* count of descriptors in flight with the engine */
343static inline u16 ioat_ring_active(struct ioatdma_chan *ioat_chan)
344{
345 return CIRC_CNT(ioat_chan->head, ioat_chan->tail,
346 ioat_ring_size(ioat_chan));
347}
348
349/* count of descriptors pending submission to hardware */
350static inline u16 ioat_ring_pending(struct ioatdma_chan *ioat_chan)
351{
352 return CIRC_CNT(ioat_chan->head, ioat_chan->issued,
353 ioat_ring_size(ioat_chan));
354}
355
356static inline u32 ioat_ring_space(struct ioatdma_chan *ioat_chan)
357{
358 return ioat_ring_size(ioat_chan) - ioat_ring_active(ioat_chan);
359}
360
361static inline u16
362ioat_xferlen_to_descs(struct ioatdma_chan *ioat_chan, size_t len)
363{
364 u16 num_descs = len >> ioat_chan->xfercap_log;
365
366 num_descs += !!(len & ((1 << ioat_chan->xfercap_log) - 1));
367 return num_descs;
368}
369
370static inline struct ioat_ring_ent *
371ioat_get_ring_ent(struct ioatdma_chan *ioat_chan, u16 idx)
372{
373 return ioat_chan->ring[idx & (ioat_ring_size(ioat_chan) - 1)];
374}
375
376static inline void
377ioat_set_chainaddr(struct ioatdma_chan *ioat_chan, u64 addr)
378{
379 writel(addr & 0x00000000FFFFFFFF,
380 ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_LOW);
381 writel(addr >> 32,
382 ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH);
383}
384
Dave Jiang599d49d2015-08-11 08:48:49 -0700385/* IOAT Prep functions */
386struct dma_async_tx_descriptor *
387ioat_dma_prep_memcpy_lock(struct dma_chan *c, dma_addr_t dma_dest,
388 dma_addr_t dma_src, size_t len, unsigned long flags);
Dave Jiangc0f28ce2015-08-11 08:48:43 -0700389struct dma_async_tx_descriptor *
390ioat_prep_interrupt_lock(struct dma_chan *c, unsigned long flags);
391struct dma_async_tx_descriptor *
392ioat_prep_xor(struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
393 unsigned int src_cnt, size_t len, unsigned long flags);
394struct dma_async_tx_descriptor *
395ioat_prep_xor_val(struct dma_chan *chan, dma_addr_t *src,
396 unsigned int src_cnt, size_t len,
397 enum sum_check_flags *result, unsigned long flags);
398struct dma_async_tx_descriptor *
399ioat_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
400 unsigned int src_cnt, const unsigned char *scf, size_t len,
401 unsigned long flags);
402struct dma_async_tx_descriptor *
403ioat_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
404 unsigned int src_cnt, const unsigned char *scf, size_t len,
405 enum sum_check_flags *pqres, unsigned long flags);
406struct dma_async_tx_descriptor *
407ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
408 unsigned int src_cnt, size_t len, unsigned long flags);
409struct dma_async_tx_descriptor *
410ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
411 unsigned int src_cnt, size_t len,
412 enum sum_check_flags *result, unsigned long flags);
Dave Jiang599d49d2015-08-11 08:48:49 -0700413
414/* IOAT Operation functions */
415irqreturn_t ioat_dma_do_interrupt(int irq, void *data);
416irqreturn_t ioat_dma_do_interrupt_msix(int irq, void *data);
417struct ioat_ring_ent **
418ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags);
419void ioat_start_null_desc(struct ioatdma_chan *ioat_chan);
420void ioat_free_ring_ent(struct ioat_ring_ent *desc, struct dma_chan *chan);
421int ioat_reset_hw(struct ioatdma_chan *ioat_chan);
Dave Jiangc0f28ce2015-08-11 08:48:43 -0700422enum dma_status
423ioat_tx_status(struct dma_chan *c, dma_cookie_t cookie,
424 struct dma_tx_state *txstate);
425void ioat_cleanup_event(unsigned long data);
426void ioat_timer_event(unsigned long data);
Dave Jiang885b2012015-08-11 08:48:32 -0700427int ioat_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs);
Dave Jiang885b2012015-08-11 08:48:32 -0700428void ioat_issue_pending(struct dma_chan *chan);
Dave Jiang885b2012015-08-11 08:48:32 -0700429void ioat_timer_event(unsigned long data);
Dave Jiang885b2012015-08-11 08:48:32 -0700430
Dave Jiang599d49d2015-08-11 08:48:49 -0700431/* IOAT Init functions */
432bool is_bwd_ioat(struct pci_dev *pdev);
Dave Jiang3372de52015-08-11 08:48:55 -0700433struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase);
Dave Jiang599d49d2015-08-11 08:48:49 -0700434void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type);
435void ioat_kobject_del(struct ioatdma_device *ioat_dma);
436int ioat_dma_setup_interrupts(struct ioatdma_device *ioat_dma);
437void ioat_stop(struct ioatdma_chan *ioat_chan);
Chris Leech0bbd5f42006-05-23 17:35:34 -0700438#endif /* IOATDMA_H */