Commit 55f878ec authored by Dave Jiang's avatar Dave Jiang Committed by Vinod Koul

dmaengine: ioatdma: fixup ioatdma_device namings

Changing the variable names for ioatdma_device to be consistently named
ioat_dma instead of device/dma in order to avoid confusion and distinct
from struct device. This will clearly indicate that it is an
ioatdma_device. This also make all the naming consistent that the dma
device is ioat_dma and all the channels are ioat_chan.
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 5a976888
This diff is collapsed.
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
#define IOAT_DMA_DCA_ANY_CPU ~0 #define IOAT_DMA_DCA_ANY_CPU ~0
#define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, common) #define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, dma_dev)
#define to_dev(ioat_chan) (&(ioat_chan)->device->pdev->dev) #define to_dev(ioat_chan) (&(ioat_chan)->ioat_dma->pdev->dev)
#define to_pdev(ioat_chan) ((ioat_chan)->device->pdev) #define to_pdev(ioat_chan) ((ioat_chan)->ioat_dma->pdev)
#define chan_num(ch) ((int)((ch)->reg_base - (ch)->device->reg_base) / 0x80) #define chan_num(ch) ((int)((ch)->reg_base - (ch)->ioat_dma->reg_base) / 0x80)
/* /*
* workaround for IOAT ver.3.0 null descriptor issue * workaround for IOAT ver.3.0 null descriptor issue
...@@ -54,7 +54,7 @@ enum ioat_irq_mode { ...@@ -54,7 +54,7 @@ enum ioat_irq_mode {
* @pdev: PCI-Express device * @pdev: PCI-Express device
* @reg_base: MMIO register space base address * @reg_base: MMIO register space base address
* @dma_pool: for allocating DMA descriptors * @dma_pool: for allocating DMA descriptors
* @common: embedded struct dma_device * @dma_dev: embedded struct dma_device
* @version: version of ioatdma device * @version: version of ioatdma device
* @msix_entries: irq handlers * @msix_entries: irq handlers
* @idx: per channel data * @idx: per channel data
...@@ -75,19 +75,19 @@ struct ioatdma_device { ...@@ -75,19 +75,19 @@ struct ioatdma_device {
struct pci_pool *completion_pool; struct pci_pool *completion_pool;
#define MAX_SED_POOLS 5 #define MAX_SED_POOLS 5
struct dma_pool *sed_hw_pool[MAX_SED_POOLS]; struct dma_pool *sed_hw_pool[MAX_SED_POOLS];
struct dma_device common; struct dma_device dma_dev;
u8 version; u8 version;
struct msix_entry msix_entries[4]; struct msix_entry msix_entries[4];
struct ioatdma_chan *idx[4]; struct ioatdma_chan *idx[4];
struct dca_provider *dca; struct dca_provider *dca;
enum ioat_irq_mode irq_mode; enum ioat_irq_mode irq_mode;
u32 cap; u32 cap;
void (*intr_quirk)(struct ioatdma_device *device); void (*intr_quirk)(struct ioatdma_device *ioat_dma);
int (*enumerate_channels)(struct ioatdma_device *device); int (*enumerate_channels)(struct ioatdma_device *ioat_dma);
int (*reset_hw)(struct ioatdma_chan *ioat_chan); int (*reset_hw)(struct ioatdma_chan *ioat_chan);
void (*cleanup_fn)(unsigned long data); void (*cleanup_fn)(unsigned long data);
void (*timer_fn)(unsigned long data); void (*timer_fn)(unsigned long data);
int (*self_test)(struct ioatdma_device *device); int (*self_test)(struct ioatdma_device *ioat_dma);
}; };
struct ioatdma_chan { struct ioatdma_chan {
...@@ -107,7 +107,7 @@ struct ioatdma_chan { ...@@ -107,7 +107,7 @@ struct ioatdma_chan {
#define COMPLETION_TIMEOUT msecs_to_jiffies(100) #define COMPLETION_TIMEOUT msecs_to_jiffies(100)
#define IDLE_TIMEOUT msecs_to_jiffies(2000) #define IDLE_TIMEOUT msecs_to_jiffies(2000)
#define RESET_DELAY msecs_to_jiffies(100) #define RESET_DELAY msecs_to_jiffies(100)
struct ioatdma_device *device; struct ioatdma_device *ioat_dma;
dma_addr_t completion_dma; dma_addr_t completion_dma;
u64 *completion; u64 *completion;
struct tasklet_struct cleanup_task; struct tasklet_struct cleanup_task;
...@@ -188,14 +188,14 @@ __dump_desc_dbg(struct ioatdma_chan *ioat_chan, struct ioat_dma_descriptor *hw, ...@@ -188,14 +188,14 @@ __dump_desc_dbg(struct ioatdma_chan *ioat_chan, struct ioat_dma_descriptor *hw,
({ if (d) __dump_desc_dbg(c, d->hw, &d->txd, desc_id(d)); 0; }) ({ if (d) __dump_desc_dbg(c, d->hw, &d->txd, desc_id(d)); 0; })
static inline struct ioatdma_chan * static inline struct ioatdma_chan *
ioat_chan_by_index(struct ioatdma_device *device, int index) ioat_chan_by_index(struct ioatdma_device *ioat_dma, int index)
{ {
return device->idx[index]; return ioat_dma->idx[index];
} }
static inline u64 ioat_chansts_32(struct ioatdma_chan *ioat_chan) static inline u64 ioat_chansts_32(struct ioatdma_chan *ioat_chan)
{ {
u8 ver = ioat_chan->device->version; u8 ver = ioat_chan->ioat_dma->version;
u64 status; u64 status;
u32 status_lo; u32 status_lo;
...@@ -214,7 +214,7 @@ static inline u64 ioat_chansts_32(struct ioatdma_chan *ioat_chan) ...@@ -214,7 +214,7 @@ static inline u64 ioat_chansts_32(struct ioatdma_chan *ioat_chan)
static inline u64 ioat_chansts(struct ioatdma_chan *ioat_chan) static inline u64 ioat_chansts(struct ioatdma_chan *ioat_chan)
{ {
u8 ver = ioat_chan->device->version; u8 ver = ioat_chan->ioat_dma->version;
u64 status; u64 status;
/* With IOAT v3.3 the status register is 64bit. */ /* With IOAT v3.3 the status register is 64bit. */
...@@ -242,7 +242,7 @@ static inline u32 ioat_chanerr(struct ioatdma_chan *ioat_chan) ...@@ -242,7 +242,7 @@ static inline u32 ioat_chanerr(struct ioatdma_chan *ioat_chan)
static inline void ioat_suspend(struct ioatdma_chan *ioat_chan) static inline void ioat_suspend(struct ioatdma_chan *ioat_chan)
{ {
u8 ver = ioat_chan->device->version; u8 ver = ioat_chan->ioat_dma->version;
writeb(IOAT_CHANCMD_SUSPEND, writeb(IOAT_CHANCMD_SUSPEND,
ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
...@@ -250,7 +250,7 @@ static inline void ioat_suspend(struct ioatdma_chan *ioat_chan) ...@@ -250,7 +250,7 @@ static inline void ioat_suspend(struct ioatdma_chan *ioat_chan)
static inline void ioat_reset(struct ioatdma_chan *ioat_chan) static inline void ioat_reset(struct ioatdma_chan *ioat_chan)
{ {
u8 ver = ioat_chan->device->version; u8 ver = ioat_chan->ioat_dma->version;
writeb(IOAT_CHANCMD_RESET, writeb(IOAT_CHANCMD_RESET,
ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
...@@ -258,7 +258,7 @@ static inline void ioat_reset(struct ioatdma_chan *ioat_chan) ...@@ -258,7 +258,7 @@ static inline void ioat_reset(struct ioatdma_chan *ioat_chan)
static inline bool ioat_reset_pending(struct ioatdma_chan *ioat_chan) static inline bool ioat_reset_pending(struct ioatdma_chan *ioat_chan)
{ {
u8 ver = ioat_chan->device->version; u8 ver = ioat_chan->ioat_dma->version;
u8 cmd; u8 cmd;
cmd = readb(ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); cmd = readb(ioat_chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
...@@ -291,20 +291,20 @@ static inline bool is_ioat_bug(unsigned long err) ...@@ -291,20 +291,20 @@ static inline bool is_ioat_bug(unsigned long err)
return !!err; return !!err;
} }
int ioat_probe(struct ioatdma_device *device); int ioat_probe(struct ioatdma_device *ioat_dma);
int ioat_register(struct ioatdma_device *device); int ioat_register(struct ioatdma_device *ioat_dma);
int ioat_dma_self_test(struct ioatdma_device *device); int ioat_dma_self_test(struct ioatdma_device *ioat_dma);
void ioat_dma_remove(struct ioatdma_device *device); void ioat_dma_remove(struct ioatdma_device *ioat_dma);
struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase); struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase);
void ioat_init_channel(struct ioatdma_device *device, void ioat_init_channel(struct ioatdma_device *ioat_dma,
struct ioatdma_chan *ioat_chan, int idx); struct ioatdma_chan *ioat_chan, int idx);
enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie,
struct dma_tx_state *txstate); struct dma_tx_state *txstate);
bool ioat_cleanup_preamble(struct ioatdma_chan *ioat_chan, bool ioat_cleanup_preamble(struct ioatdma_chan *ioat_chan,
dma_addr_t *phys_complete); dma_addr_t *phys_complete);
void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type);
void ioat_kobject_del(struct ioatdma_device *device); void ioat_kobject_del(struct ioatdma_device *ioat_dma);
int ioat_dma_setup_interrupts(struct ioatdma_device *device); int ioat_dma_setup_interrupts(struct ioatdma_device *ioat_dma);
void ioat_stop(struct ioatdma_chan *ioat_chan); void ioat_stop(struct ioatdma_chan *ioat_chan);
extern const struct sysfs_ops ioat_sysfs_ops; extern const struct sysfs_ops ioat_sysfs_ops;
extern struct ioat_sysfs_entry ioat_version_attr; extern struct ioat_sysfs_entry ioat_version_attr;
......
...@@ -187,25 +187,25 @@ int ioat2_reset_sync(struct ioatdma_chan *ioat_chan, unsigned long tmo) ...@@ -187,25 +187,25 @@ int ioat2_reset_sync(struct ioatdma_chan *ioat_chan, unsigned long tmo)
/** /**
* ioat2_enumerate_channels - find and initialize the device's channels * ioat2_enumerate_channels - find and initialize the device's channels
* @device: the device to be enumerated * @ioat_dma: the ioat dma device to be enumerated
*/ */
int ioat2_enumerate_channels(struct ioatdma_device *device) int ioat2_enumerate_channels(struct ioatdma_device *ioat_dma)
{ {
struct ioatdma_chan *ioat_chan; struct ioatdma_chan *ioat_chan;
struct device *dev = &device->pdev->dev; struct device *dev = &ioat_dma->pdev->dev;
struct dma_device *dma = &device->common; struct dma_device *dma = &ioat_dma->dma_dev;
u8 xfercap_log; u8 xfercap_log;
int i; int i;
INIT_LIST_HEAD(&dma->channels); INIT_LIST_HEAD(&dma->channels);
dma->chancnt = readb(device->reg_base + IOAT_CHANCNT_OFFSET); dma->chancnt = readb(ioat_dma->reg_base + IOAT_CHANCNT_OFFSET);
dma->chancnt &= 0x1f; /* bits [4:0] valid */ dma->chancnt &= 0x1f; /* bits [4:0] valid */
if (dma->chancnt > ARRAY_SIZE(device->idx)) { if (dma->chancnt > ARRAY_SIZE(ioat_dma->idx)) {
dev_warn(dev, "(%d) exceeds max supported channels (%zu)\n", dev_warn(dev, "(%d) exceeds max supported channels (%zu)\n",
dma->chancnt, ARRAY_SIZE(device->idx)); dma->chancnt, ARRAY_SIZE(ioat_dma->idx));
dma->chancnt = ARRAY_SIZE(device->idx); dma->chancnt = ARRAY_SIZE(ioat_dma->idx);
} }
xfercap_log = readb(device->reg_base + IOAT_XFERCAP_OFFSET); xfercap_log = readb(ioat_dma->reg_base + IOAT_XFERCAP_OFFSET);
xfercap_log &= 0x1f; /* bits [4:0] valid */ xfercap_log &= 0x1f; /* bits [4:0] valid */
if (xfercap_log == 0) if (xfercap_log == 0)
return 0; return 0;
...@@ -216,10 +216,10 @@ int ioat2_enumerate_channels(struct ioatdma_device *device) ...@@ -216,10 +216,10 @@ int ioat2_enumerate_channels(struct ioatdma_device *device)
if (!ioat_chan) if (!ioat_chan)
break; break;
ioat_init_channel(device, ioat_chan, i); ioat_init_channel(ioat_dma, ioat_chan, i);
ioat_chan->xfercap_log = xfercap_log; ioat_chan->xfercap_log = xfercap_log;
spin_lock_init(&ioat_chan->prep_lock); spin_lock_init(&ioat_chan->prep_lock);
if (device->reset_hw(ioat_chan)) { if (ioat_dma->reset_hw(ioat_chan)) {
i = 0; i = 0;
break; break;
} }
...@@ -258,18 +258,18 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t f ...@@ -258,18 +258,18 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t f
{ {
struct ioat_dma_descriptor *hw; struct ioat_dma_descriptor *hw;
struct ioat_ring_ent *desc; struct ioat_ring_ent *desc;
struct ioatdma_device *dma; struct ioatdma_device *ioat_dma;
dma_addr_t phys; dma_addr_t phys;
dma = to_ioatdma_device(chan->device); ioat_dma = to_ioatdma_device(chan->device);
hw = pci_pool_alloc(dma->dma_pool, flags, &phys); hw = pci_pool_alloc(ioat_dma->dma_pool, flags, &phys);
if (!hw) if (!hw)
return NULL; return NULL;
memset(hw, 0, sizeof(*hw)); memset(hw, 0, sizeof(*hw));
desc = kmem_cache_zalloc(ioat2_cache, flags); desc = kmem_cache_zalloc(ioat2_cache, flags);
if (!desc) { if (!desc) {
pci_pool_free(dma->dma_pool, hw, phys); pci_pool_free(ioat_dma->dma_pool, hw, phys);
return NULL; return NULL;
} }
...@@ -282,10 +282,10 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t f ...@@ -282,10 +282,10 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t f
static void ioat2_free_ring_ent(struct ioat_ring_ent *desc, struct dma_chan *chan) static void ioat2_free_ring_ent(struct ioat_ring_ent *desc, struct dma_chan *chan)
{ {
struct ioatdma_device *dma; struct ioatdma_device *ioat_dma;
dma = to_ioatdma_device(chan->device); ioat_dma = to_ioatdma_device(chan->device);
pci_pool_free(dma->dma_pool, desc->hw, desc->txd.phys); pci_pool_free(ioat_dma->dma_pool, desc->hw, desc->txd.phys);
kmem_cache_free(ioat2_cache, desc); kmem_cache_free(ioat2_cache, desc);
} }
...@@ -348,7 +348,7 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) ...@@ -348,7 +348,7 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
/* allocate a completion writeback area */ /* allocate a completion writeback area */
/* doing 2 32bit writes to mmio since 1 64b write doesn't work */ /* doing 2 32bit writes to mmio since 1 64b write doesn't work */
ioat_chan->completion = ioat_chan->completion =
pci_pool_alloc(ioat_chan->device->completion_pool, pci_pool_alloc(ioat_chan->ioat_dma->completion_pool,
GFP_KERNEL, &ioat_chan->completion_dma); GFP_KERNEL, &ioat_chan->completion_dma);
if (!ioat_chan->completion) if (!ioat_chan->completion)
return -ENOMEM; return -ENOMEM;
...@@ -554,10 +554,10 @@ int ioat2_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs) ...@@ -554,10 +554,10 @@ int ioat2_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs)
*/ */
if (time_is_before_jiffies(ioat_chan->timer.expires) if (time_is_before_jiffies(ioat_chan->timer.expires)
&& timer_pending(&ioat_chan->timer)) { && timer_pending(&ioat_chan->timer)) {
struct ioatdma_device *device = ioat_chan->device; struct ioatdma_device *ioat_dma = ioat_chan->ioat_dma;
mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT); mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT);
device->timer_fn((unsigned long)ioat_chan); ioat_dma->timer_fn((unsigned long)ioat_chan);
} }
return -ENOMEM; return -ENOMEM;
...@@ -617,7 +617,7 @@ ioat2_dma_prep_memcpy_lock(struct dma_chan *c, dma_addr_t dma_dest, ...@@ -617,7 +617,7 @@ ioat2_dma_prep_memcpy_lock(struct dma_chan *c, dma_addr_t dma_dest,
void ioat2_free_chan_resources(struct dma_chan *c) void ioat2_free_chan_resources(struct dma_chan *c)
{ {
struct ioatdma_chan *ioat_chan = to_ioat_chan(c); struct ioatdma_chan *ioat_chan = to_ioat_chan(c);
struct ioatdma_device *device = ioat_chan->device; struct ioatdma_device *ioat_dma = ioat_chan->ioat_dma;
struct ioat_ring_ent *desc; struct ioat_ring_ent *desc;
const int total_descs = 1 << ioat_chan->alloc_order; const int total_descs = 1 << ioat_chan->alloc_order;
int descs; int descs;
...@@ -630,7 +630,7 @@ void ioat2_free_chan_resources(struct dma_chan *c) ...@@ -630,7 +630,7 @@ void ioat2_free_chan_resources(struct dma_chan *c)
return; return;
ioat_stop(ioat_chan); ioat_stop(ioat_chan);
device->reset_hw(ioat_chan); ioat_dma->reset_hw(ioat_chan);
spin_lock_bh(&ioat_chan->cleanup_lock); spin_lock_bh(&ioat_chan->cleanup_lock);
spin_lock_bh(&ioat_chan->prep_lock); spin_lock_bh(&ioat_chan->prep_lock);
...@@ -654,7 +654,7 @@ void ioat2_free_chan_resources(struct dma_chan *c) ...@@ -654,7 +654,7 @@ void ioat2_free_chan_resources(struct dma_chan *c)
kfree(ioat_chan->ring); kfree(ioat_chan->ring);
ioat_chan->ring = NULL; ioat_chan->ring = NULL;
ioat_chan->alloc_order = 0; ioat_chan->alloc_order = 0;
pci_pool_free(device->completion_pool, ioat_chan->completion, pci_pool_free(ioat_dma->completion_pool, ioat_chan->completion,
ioat_chan->completion_dma); ioat_chan->completion_dma);
spin_unlock_bh(&ioat_chan->prep_lock); spin_unlock_bh(&ioat_chan->prep_lock);
spin_unlock_bh(&ioat_chan->cleanup_lock); spin_unlock_bh(&ioat_chan->cleanup_lock);
......
...@@ -121,11 +121,11 @@ ioat2_set_chainaddr(struct ioatdma_chan *ioat_chan, u64 addr) ...@@ -121,11 +121,11 @@ ioat2_set_chainaddr(struct ioatdma_chan *ioat_chan, u64 addr)
ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH); ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH);
} }
int ioat2_dma_probe(struct ioatdma_device *dev, int dca); int ioat2_dma_probe(struct ioatdma_device *ioat_dma, int dca);
int ioat3_dma_probe(struct ioatdma_device *dev, int dca); int ioat3_dma_probe(struct ioatdma_device *ioat_dma, int dca);
struct dca_provider *ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase); struct dca_provider *ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase);
int ioat2_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs); int ioat2_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs);
int ioat2_enumerate_channels(struct ioatdma_device *device); int ioat2_enumerate_channels(struct ioatdma_device *ioat_dma);
struct dma_async_tx_descriptor * struct dma_async_tx_descriptor *
ioat2_dma_prep_memcpy_lock(struct dma_chan *c, dma_addr_t dma_dest, ioat2_dma_prep_memcpy_lock(struct dma_chan *c, dma_addr_t dma_dest,
dma_addr_t dma_src, size_t len, unsigned long flags); dma_addr_t dma_src, size_t len, unsigned long flags);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment