ioatdma.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
  3. *
  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. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc., 59
  16. * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called COPYING.
  20. */
  21. #ifndef IOATDMA_H
  22. #define IOATDMA_H
  23. #include <linux/dmaengine.h>
  24. #include "ioatdma_hw.h"
  25. #include <linux/init.h>
  26. #include <linux/dmapool.h>
  27. #include <linux/cache.h>
  28. #include <linux/pci_ids.h>
  29. #define IOAT_LOW_COMPLETION_MASK 0xffffffc0
  30. extern struct list_head dma_device_list;
  31. extern struct list_head dma_client_list;
  32. /**
  33. * struct ioat_device - internal representation of a IOAT device
  34. * @pdev: PCI-Express device
  35. * @reg_base: MMIO register space base address
  36. * @dma_pool: for allocating DMA descriptors
  37. * @common: embedded struct dma_device
  38. * @msi: Message Signaled Interrupt number
  39. */
  40. struct ioat_device {
  41. struct pci_dev *pdev;
  42. void __iomem *reg_base;
  43. struct pci_pool *dma_pool;
  44. struct pci_pool *completion_pool;
  45. struct dma_device common;
  46. u8 msi;
  47. };
  48. /**
  49. * struct ioat_dma_chan - internal representation of a DMA channel
  50. * @device:
  51. * @reg_base:
  52. * @sw_in_use:
  53. * @completion:
  54. * @completion_low:
  55. * @completion_high:
  56. * @completed_cookie: last cookie seen completed on cleanup
  57. * @cookie: value of last cookie given to client
  58. * @last_completion:
  59. * @xfercap:
  60. * @desc_lock:
  61. * @free_desc:
  62. * @used_desc:
  63. * @resource:
  64. * @device_node:
  65. */
  66. struct ioat_dma_chan {
  67. void __iomem *reg_base;
  68. dma_cookie_t completed_cookie;
  69. unsigned long last_completion;
  70. u32 xfercap; /* XFERCAP register value expanded out */
  71. spinlock_t cleanup_lock;
  72. spinlock_t desc_lock;
  73. struct list_head free_desc;
  74. struct list_head used_desc;
  75. int pending;
  76. struct ioat_device *device;
  77. struct dma_chan common;
  78. dma_addr_t completion_addr;
  79. union {
  80. u64 full; /* HW completion writeback */
  81. struct {
  82. u32 low;
  83. u32 high;
  84. };
  85. } *completion_virt;
  86. };
  87. /* wrapper around hardware descriptor format + additional software fields */
  88. /**
  89. * struct ioat_desc_sw - wrapper around hardware descriptor
  90. * @hw: hardware DMA descriptor
  91. * @node:
  92. * @cookie:
  93. * @phys:
  94. */
  95. struct ioat_desc_sw {
  96. struct ioat_dma_descriptor *hw;
  97. struct list_head node;
  98. dma_cookie_t cookie;
  99. dma_addr_t phys;
  100. DECLARE_PCI_UNMAP_ADDR(src)
  101. DECLARE_PCI_UNMAP_LEN(src_len)
  102. DECLARE_PCI_UNMAP_ADDR(dst)
  103. DECLARE_PCI_UNMAP_LEN(dst_len)
  104. };
  105. #endif /* IOATDMA_H */