3737
3838#define chan_num (ch ) ((int)((ch)->reg_base - (ch)->ioat_dma->reg_base) / 0x80)
3939
40+ /* 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+
4048/*
4149 * workaround for IOAT ver.3.0 null descriptor issue
4250 * (channel returns error when size is 0)
@@ -190,15 +198,22 @@ struct ioat_ring_ent {
190198 struct ioat_sed_ent * sed ;
191199};
192200
201+ extern const struct sysfs_ops ioat_sysfs_ops ;
202+ extern struct ioat_sysfs_entry ioat_version_attr ;
203+ extern struct ioat_sysfs_entry ioat_cap_attr ;
204+ extern int ioat_pending_level ;
205+ extern int ioat_ring_alloc_order ;
206+ extern struct kobj_type ioat_ktype ;
207+ extern struct kmem_cache * ioat_cache ;
208+ extern int ioat_ring_max_alloc_order ;
209+ extern struct kmem_cache * ioat_sed_cache ;
210+
193211static inline struct ioatdma_chan * to_ioat_chan (struct dma_chan * c )
194212{
195213 return container_of (c , struct ioatdma_chan , dma_chan );
196214}
197215
198-
199-
200216/* wrapper around hardware descriptor format + additional software fields */
201-
202217#ifdef DEBUG
203218#define set_desc_id (desc , i ) ((desc)->id = (i))
204219#define desc_id (desc ) ((desc)->id)
@@ -381,13 +396,10 @@ ioat_set_chainaddr(struct ioatdma_chan *ioat_chan, u64 addr)
381396 ioat_chan -> reg_base + IOAT2_CHAINADDR_OFFSET_HIGH );
382397}
383398
384- irqreturn_t ioat_dma_do_interrupt (int irq , void * data );
385- irqreturn_t ioat_dma_do_interrupt_msix (int irq , void * data );
386- struct ioat_ring_ent * *
387- ioat_alloc_ring (struct dma_chan * c , int order , gfp_t flags );
388- void ioat_start_null_desc (struct ioatdma_chan * ioat_chan );
389- void ioat_free_ring_ent (struct ioat_ring_ent * desc , struct dma_chan * chan );
390- int ioat_reset_hw (struct ioatdma_chan * ioat_chan );
399+ /* IOAT Prep functions */
400+ struct dma_async_tx_descriptor *
401+ ioat_dma_prep_memcpy_lock (struct dma_chan * c , dma_addr_t dma_dest ,
402+ dma_addr_t dma_src , size_t len , unsigned long flags );
391403struct dma_async_tx_descriptor *
392404ioat_prep_interrupt_lock (struct dma_chan * c , unsigned long flags );
393405struct dma_async_tx_descriptor *
@@ -412,53 +424,38 @@ struct dma_async_tx_descriptor *
412424ioat_prep_pqxor_val (struct dma_chan * chan , dma_addr_t * src ,
413425 unsigned int src_cnt , size_t len ,
414426 enum sum_check_flags * result , unsigned long flags );
427+
428+ /* IOAT Operation functions */
429+ irqreturn_t ioat_dma_do_interrupt (int irq , void * data );
430+ irqreturn_t ioat_dma_do_interrupt_msix (int irq , void * data );
431+ struct ioat_ring_ent * *
432+ ioat_alloc_ring (struct dma_chan * c , int order , gfp_t flags );
433+ void ioat_start_null_desc (struct ioatdma_chan * ioat_chan );
434+ void ioat_free_ring_ent (struct ioat_ring_ent * desc , struct dma_chan * chan );
435+ int ioat_reset_hw (struct ioatdma_chan * ioat_chan );
415436enum dma_status
416437ioat_tx_status (struct dma_chan * c , dma_cookie_t cookie ,
417438 struct dma_tx_state * txstate );
418439void ioat_cleanup_event (unsigned long data );
419440void ioat_timer_event (unsigned long data );
420- bool is_bwd_ioat (struct pci_dev * pdev );
421- int ioat_probe (struct ioatdma_device * ioat_dma );
422- int ioat_register (struct ioatdma_device * ioat_dma );
423- int ioat_dma_self_test (struct ioatdma_device * ioat_dma );
424- void ioat_dma_remove (struct ioatdma_device * ioat_dma );
425- struct dca_provider * ioat_dca_init (struct pci_dev * pdev , void __iomem * iobase );
426- void ioat_init_channel (struct ioatdma_device * ioat_dma ,
427- struct ioatdma_chan * ioat_chan , int idx );
428441enum dma_status ioat_dma_tx_status (struct dma_chan * c , dma_cookie_t cookie ,
429442 struct dma_tx_state * txstate );
430443bool ioat_cleanup_preamble (struct ioatdma_chan * ioat_chan ,
431444 dma_addr_t * phys_complete );
432- void ioat_kobject_add (struct ioatdma_device * ioat_dma , struct kobj_type * type );
433- void ioat_kobject_del (struct ioatdma_device * ioat_dma );
434- int ioat_dma_setup_interrupts (struct ioatdma_device * ioat_dma );
435- void ioat_stop (struct ioatdma_chan * ioat_chan );
436- int ioat_dma_probe (struct ioatdma_device * ioat_dma , int dca );
437- int ioat3_dma_probe (struct ioatdma_device * ioat_dma , int dca );
438- struct dca_provider * ioat3_dca_init (struct pci_dev * pdev , void __iomem * iobase );
439445int ioat_check_space_lock (struct ioatdma_chan * ioat_chan , int num_descs );
440- int ioat_enumerate_channels (struct ioatdma_device * ioat_dma );
441- struct dma_async_tx_descriptor *
442- ioat_dma_prep_memcpy_lock (struct dma_chan * c , dma_addr_t dma_dest ,
443- dma_addr_t dma_src , size_t len , unsigned long flags );
444446void ioat_issue_pending (struct dma_chan * chan );
445- int ioat_alloc_chan_resources (struct dma_chan * c );
446- void ioat_free_chan_resources (struct dma_chan * c );
447- void __ioat_restart_chan (struct ioatdma_chan * ioat_chan );
448447bool reshape_ring (struct ioatdma_chan * ioat , int order );
449448void __ioat_issue_pending (struct ioatdma_chan * ioat_chan );
450449void ioat_timer_event (unsigned long data );
451450int ioat_quiesce (struct ioatdma_chan * ioat_chan , unsigned long tmo );
452451int ioat_reset_sync (struct ioatdma_chan * ioat_chan , unsigned long tmo );
452+ void __ioat_restart_chan (struct ioatdma_chan * ioat_chan );
453453
454- extern const struct sysfs_ops ioat_sysfs_ops ;
455- extern struct ioat_sysfs_entry ioat_version_attr ;
456- extern struct ioat_sysfs_entry ioat_cap_attr ;
457- extern int ioat_pending_level ;
458- extern int ioat_ring_alloc_order ;
459- extern struct kobj_type ioat_ktype ;
460- extern struct kmem_cache * ioat_cache ;
461- extern int ioat_ring_max_alloc_order ;
462- extern struct kmem_cache * ioat_sed_cache ;
463-
454+ /* IOAT Init functions */
455+ bool is_bwd_ioat (struct pci_dev * pdev );
456+ void ioat_kobject_add (struct ioatdma_device * ioat_dma , struct kobj_type * type );
457+ void ioat_kobject_del (struct ioatdma_device * ioat_dma );
458+ int ioat_dma_setup_interrupts (struct ioatdma_device * ioat_dma );
459+ void ioat_stop (struct ioatdma_chan * ioat_chan );
460+ struct dca_provider * ioat3_dca_init (struct pci_dev * pdev , void __iomem * iobase );
464461#endif /* IOATDMA_H */
0 commit comments