pci.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* pci.h: FR-V specific PCI declarations
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. * - Derived from include/asm-m68k/pci.h
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #ifndef ASM_PCI_H
  13. #define ASM_PCI_H
  14. #include <linux/config.h>
  15. #include <linux/mm.h>
  16. #include <asm/scatterlist.h>
  17. #include <asm-generic/pci-dma-compat.h>
  18. #include <asm-generic/pci.h>
  19. struct pci_dev;
  20. #define pcibios_assign_all_busses() 0
  21. static inline void pcibios_add_platform_entries(struct pci_dev *dev)
  22. {
  23. }
  24. extern void pcibios_set_master(struct pci_dev *dev);
  25. extern void pcibios_penalize_isa_irq(int irq);
  26. #ifdef CONFIG_MMU
  27. extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle);
  28. extern void consistent_free(void *vaddr);
  29. extern void consistent_sync(void *vaddr, size_t size, int direction);
  30. extern void consistent_sync_page(struct page *page, unsigned long offset,
  31. size_t size, int direction);
  32. #endif
  33. extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
  34. dma_addr_t *dma_handle);
  35. extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
  36. void *vaddr, dma_addr_t dma_handle);
  37. /* This is always fine. */
  38. #define pci_dac_dma_supported(pci_dev, mask) (1)
  39. /* Return the index of the PCI controller for device PDEV. */
  40. #define pci_controller_num(PDEV) (0)
  41. /* The PCI address space does equal the physical memory
  42. * address space. The networking and block device layers use
  43. * this boolean for bounce buffer decisions.
  44. */
  45. #define PCI_DMA_BUS_IS_PHYS (1)
  46. #ifdef CONFIG_PCI
  47. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  48. enum pci_dma_burst_strategy *strat,
  49. unsigned long *strategy_parameter)
  50. {
  51. *strat = PCI_DMA_BURST_INFINITY;
  52. *strategy_parameter = ~0UL;
  53. }
  54. #endif
  55. /*
  56. * These are pretty much arbitary with the CoMEM implementation.
  57. * We have the whole address space to ourselves.
  58. */
  59. #define PCIBIOS_MIN_IO 0x100
  60. #define PCIBIOS_MIN_MEM 0x00010000
  61. /* Make physical memory consistent for a single
  62. * streaming mode DMA translation after a transfer.
  63. *
  64. * If you perform a pci_map_single() but wish to interrogate the
  65. * buffer using the cpu, yet do not wish to teardown the PCI dma
  66. * mapping, you must call this function before doing so. At the
  67. * next point you give the PCI dma address back to the card, the
  68. * device again owns the buffer.
  69. */
  70. static inline void pci_dma_sync_single(struct pci_dev *hwdev,
  71. dma_addr_t dma_handle,
  72. size_t size, int direction)
  73. {
  74. if (direction == PCI_DMA_NONE)
  75. BUG();
  76. frv_cache_wback_inv((unsigned long)bus_to_virt(dma_handle),
  77. (unsigned long)bus_to_virt(dma_handle) + size);
  78. }
  79. /* Make physical memory consistent for a set of streaming
  80. * mode DMA translations after a transfer.
  81. *
  82. * The same as pci_dma_sync_single but for a scatter-gather list,
  83. * same rules and usage.
  84. */
  85. static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
  86. struct scatterlist *sg,
  87. int nelems, int direction)
  88. {
  89. int i;
  90. if (direction == PCI_DMA_NONE)
  91. BUG();
  92. for (i = 0; i < nelems; i++)
  93. frv_cache_wback_inv(sg_dma_address(&sg[i]),
  94. sg_dma_address(&sg[i])+sg_dma_len(&sg[i]));
  95. }
  96. #endif