pci.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* Changed from asm-m68k version, Lineo Inc. May 2001 */
  2. #ifndef _ASM_BFIN_PCI_H
  3. #define _ASM_BFIN_PCI_H
  4. #include <asm/scatterlist.h>
  5. /*
  6. *
  7. * Written by Wout Klaren.
  8. */
  9. /* Added by Chang Junxiao */
  10. #define PCIBIOS_MIN_IO 0x00001000
  11. #define PCIBIOS_MIN_MEM 0x10000000
  12. #define PCI_DMA_BUS_IS_PHYS (1)
  13. struct pci_ops;
  14. /*
  15. * Structure with hardware dependent information and functions of the
  16. * PCI bus.
  17. */
  18. struct pci_bus_info {
  19. /*
  20. * Resources of the PCI bus.
  21. */
  22. struct resource mem_space;
  23. struct resource io_space;
  24. /*
  25. * System dependent functions.
  26. */
  27. struct pci_ops *bfin_pci_ops;
  28. void (*fixup) (int pci_modify);
  29. void (*conf_device) (unsigned char bus, unsigned char device_fn);
  30. };
  31. #define pcibios_assign_all_busses() 0
  32. static inline void pcibios_set_master(struct pci_dev *dev)
  33. {
  34. /* No special bus mastering setup handling */
  35. }
  36. static inline void pcibios_penalize_isa_irq(int irq)
  37. {
  38. /* We don't do dynamic PCI IRQ allocation */
  39. }
  40. static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
  41. size_t size, int direction)
  42. {
  43. if (direction == PCI_DMA_NONE)
  44. BUG();
  45. /* return virt_to_bus(ptr); */
  46. return (dma_addr_t) ptr;
  47. }
  48. /* Unmap a single streaming mode DMA translation. The dma_addr and size
  49. * must match what was provided for in a previous pci_map_single call. All
  50. * other usages are undefined.
  51. *
  52. * After this call, reads by the cpu to the buffer are guarenteed to see
  53. * whatever the device wrote there.
  54. */
  55. static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
  56. size_t size, int direction)
  57. {
  58. if (direction == PCI_DMA_NONE)
  59. BUG();
  60. /* Nothing to do */
  61. }
  62. /* Map a set of buffers described by scatterlist in streaming
  63. * mode for DMA. This is the scather-gather version of the
  64. * above pci_map_single interface. Here the scatter gather list
  65. * elements are each tagged with the appropriate dma address
  66. * and length. They are obtained via sg_dma_{address,length}(SG).
  67. *
  68. * NOTE: An implementation may be able to use a smaller number of
  69. * DMA address/length pairs than there are SG table elements.
  70. * (for example via virtual mapping capabilities)
  71. * The routine returns the number of addr/length pairs actually
  72. * used, at most nents.
  73. *
  74. * Device ownership issues as mentioned above for pci_map_single are
  75. * the same here.
  76. */
  77. static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
  78. int nents, int direction)
  79. {
  80. if (direction == PCI_DMA_NONE)
  81. BUG();
  82. return nents;
  83. }
  84. /* Unmap a set of streaming mode DMA translations.
  85. * Again, cpu read rules concerning calls here are the same as for
  86. * pci_unmap_single() above.
  87. */
  88. static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
  89. int nents, int direction)
  90. {
  91. if (direction == PCI_DMA_NONE)
  92. BUG();
  93. /* Nothing to do */
  94. }
  95. /* Make physical memory consistent for a single
  96. * streaming mode DMA translation after a transfer.
  97. *
  98. * If you perform a pci_map_single() but wish to interrogate the
  99. * buffer using the cpu, yet do not wish to teardown the PCI dma
  100. * mapping, you must call this function before doing so. At the
  101. * next point you give the PCI dma address back to the card, the
  102. * device again owns the buffer.
  103. */
  104. static inline void pci_dma_sync_single(struct pci_dev *hwdev,
  105. dma_addr_t dma_handle, size_t size,
  106. int direction)
  107. {
  108. if (direction == PCI_DMA_NONE)
  109. BUG();
  110. /* Nothing to do */
  111. }
  112. /* Make physical memory consistent for a set of streaming
  113. * mode DMA translations after a transfer.
  114. *
  115. * The same as pci_dma_sync_single but for a scatter-gather list,
  116. * same rules and usage.
  117. */
  118. static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
  119. struct scatterlist *sg, int nelems,
  120. int direction)
  121. {
  122. if (direction == PCI_DMA_NONE)
  123. BUG();
  124. /* Nothing to do */
  125. }
  126. #endif /* _ASM_BFIN_PCI_H */