pci.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * include/asm-v850/pci.h -- PCI support
  3. *
  4. * Copyright (C) 2001,02,05 NEC Corporation
  5. * Copyright (C) 2001,02,05 Miles Bader <miles@gnu.org>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General
  8. * Public License. See the file COPYING in the main directory of this
  9. * archive for more details.
  10. *
  11. * Written by Miles Bader <miles@gnu.org>
  12. */
  13. #ifndef __V850_PCI_H__
  14. #define __V850_PCI_H__
  15. /* Get any platform-dependent definitions. */
  16. #include <asm/machdep.h>
  17. #define pcibios_scan_all_fns(a, b) 0
  18. /* Generic declarations. */
  19. struct scatterlist;
  20. extern void pcibios_set_master (struct pci_dev *dev);
  21. /* `Grant' to PDEV the memory block at CPU_ADDR, for doing DMA. The
  22. 32-bit PCI bus mastering address to use is returned. the device owns
  23. this memory until either pci_unmap_single or pci_dma_sync_single_for_cpu is
  24. performed. */
  25. extern dma_addr_t
  26. pci_map_single (struct pci_dev *pdev, void *cpu_addr, size_t size, int dir);
  27. /* Return to the CPU the PCI DMA memory block previously `granted' to
  28. PDEV, at DMA_ADDR. */
  29. extern void
  30. pci_unmap_single (struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
  31. int dir);
  32. /* Make physical memory consistent for a single streaming mode DMA
  33. translation after a transfer.
  34. If you perform a pci_map_single() but wish to interrogate the
  35. buffer using the cpu, yet do not wish to teardown the PCI dma
  36. mapping, you must call this function before doing so. At the next
  37. point you give the PCI dma address back to the card, you must first
  38. perform a pci_dma_sync_for_device, and then the device again owns
  39. the buffer. */
  40. extern void
  41. pci_dma_sync_single_for_cpu (struct pci_dev *dev, dma_addr_t dma_addr,
  42. size_t size, int dir);
  43. extern void
  44. pci_dma_sync_single_for_device (struct pci_dev *dev, dma_addr_t dma_addr,
  45. size_t size, int dir);
  46. /* Do multiple DMA mappings at once. */
  47. extern int
  48. pci_map_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len, int dir);
  49. /* Unmap multiple DMA mappings at once. */
  50. extern void
  51. pci_unmap_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len,
  52. int dir);
  53. /* SG-list versions of pci_dma_sync functions. */
  54. extern void
  55. pci_dma_sync_sg_for_cpu (struct pci_dev *dev,
  56. struct scatterlist *sg, int sg_len,
  57. int dir);
  58. extern void
  59. pci_dma_sync_sg_for_device (struct pci_dev *dev,
  60. struct scatterlist *sg, int sg_len,
  61. int dir);
  62. #define pci_map_page(dev, page, offs, size, dir) \
  63. pci_map_single(dev, (page_address(page) + (offs)), size, dir)
  64. #define pci_unmap_page(dev,addr,sz,dir) \
  65. pci_unmap_single(dev, addr, sz, dir)
  66. /* Test for pci_map_single or pci_map_page having generated an error. */
  67. static inline int
  68. pci_dma_mapping_error (dma_addr_t dma_addr)
  69. {
  70. return dma_addr == 0;
  71. }
  72. /* Allocate and map kernel buffer using consistent mode DMA for PCI
  73. device. Returns non-NULL cpu-view pointer to the buffer if
  74. successful and sets *DMA_ADDR to the pci side dma address as well,
  75. else DMA_ADDR is undefined. */
  76. extern void *
  77. pci_alloc_consistent (struct pci_dev *pdev, size_t size, dma_addr_t *dma_addr);
  78. /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
  79. be values that were returned from pci_alloc_consistent. SIZE must be
  80. the same as what as passed into pci_alloc_consistent. References to
  81. the memory and mappings assosciated with CPU_ADDR or DMA_ADDR past
  82. this call are illegal. */
  83. extern void
  84. pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
  85. dma_addr_t dma_addr);
  86. #ifdef CONFIG_PCI
  87. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  88. enum pci_dma_burst_strategy *strat,
  89. unsigned long *strategy_parameter)
  90. {
  91. *strat = PCI_DMA_BURST_INFINITY;
  92. *strategy_parameter = ~0UL;
  93. }
  94. #endif
  95. extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
  96. extern void pci_iounmap (struct pci_dev *dev, void __iomem *addr);
  97. static inline void pcibios_add_platform_entries(struct pci_dev *dev)
  98. {
  99. }
  100. #endif /* __V850_PCI_H__ */