pci.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #ifndef __PPC_PCI_H
  2. #define __PPC_PCI_H
  3. #ifdef __KERNEL__
  4. #include <linux/types.h>
  5. #include <linux/slab.h>
  6. #include <linux/string.h>
  7. #include <linux/mm.h>
  8. #include <asm/scatterlist.h>
  9. #include <asm/io.h>
  10. #include <asm/pci-bridge.h>
  11. #include <asm-generic/pci-dma-compat.h>
  12. struct pci_dev;
  13. /* Values for the `which' argument to sys_pciconfig_iobase syscall. */
  14. #define IOBASE_BRIDGE_NUMBER 0
  15. #define IOBASE_MEMORY 1
  16. #define IOBASE_IO 2
  17. #define IOBASE_ISA_IO 3
  18. #define IOBASE_ISA_MEM 4
  19. /*
  20. * Set this to 1 if you want the kernel to re-assign all PCI
  21. * bus numbers
  22. */
  23. extern int pci_assign_all_buses;
  24. #define pcibios_assign_all_busses() (pci_assign_all_buses)
  25. #define pcibios_scan_all_fns(a, b) 0
  26. #define PCIBIOS_MIN_IO 0x1000
  27. #define PCIBIOS_MIN_MEM 0x10000000
  28. extern inline void pcibios_set_master(struct pci_dev *dev)
  29. {
  30. /* No special bus mastering setup handling */
  31. }
  32. extern inline void pcibios_penalize_isa_irq(int irq, int active)
  33. {
  34. /* We don't do dynamic PCI IRQ allocation */
  35. }
  36. extern unsigned long pci_resource_to_bus(struct pci_dev *pdev, struct resource *res);
  37. /*
  38. * The PCI bus bridge can translate addresses issued by the processor(s)
  39. * into a different address on the PCI bus. On 32-bit cpus, we assume
  40. * this mapping is 1-1, but on 64-bit systems it often isn't.
  41. *
  42. * Obsolete ! Drivers should now use pci_resource_to_bus
  43. */
  44. extern unsigned long phys_to_bus(unsigned long pa);
  45. extern unsigned long pci_phys_to_bus(unsigned long pa, int busnr);
  46. extern unsigned long pci_bus_to_phys(unsigned int ba, int busnr);
  47. /* The PCI address space does equal the physical memory
  48. * address space. The networking and block device layers use
  49. * this boolean for bounce buffer decisions.
  50. */
  51. #define PCI_DMA_BUS_IS_PHYS (1)
  52. /* pci_unmap_{page,single} is a nop so... */
  53. #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
  54. #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
  55. #define pci_unmap_addr(PTR, ADDR_NAME) (0)
  56. #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
  57. #define pci_unmap_len(PTR, LEN_NAME) (0)
  58. #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
  59. #ifdef CONFIG_PCI
  60. static inline void pci_dma_burst_advice(struct pci_dev *pdev,
  61. enum pci_dma_burst_strategy *strat,
  62. unsigned long *strategy_parameter)
  63. {
  64. *strat = PCI_DMA_BURST_INFINITY;
  65. *strategy_parameter = ~0UL;
  66. }
  67. #endif
  68. /*
  69. * At present there are very few 32-bit PPC machines that can have
  70. * memory above the 4GB point, and we don't support that.
  71. */
  72. #define pci_dac_dma_supported(pci_dev, mask) (0)
  73. /* Return the index of the PCI controller for device PDEV. */
  74. #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
  75. /* Set the name of the bus as it appears in /proc/bus/pci */
  76. static inline int pci_proc_domain(struct pci_bus *bus)
  77. {
  78. return 0;
  79. }
  80. /* Map a range of PCI memory or I/O space for a device into user space */
  81. int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
  82. enum pci_mmap_state mmap_state, int write_combine);
  83. /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
  84. #define HAVE_PCI_MMAP 1
  85. extern void
  86. pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
  87. struct resource *res);
  88. extern void
  89. pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
  90. struct pci_bus_region *region);
  91. static inline struct resource *
  92. pcibios_select_root(struct pci_dev *pdev, struct resource *res)
  93. {
  94. struct resource *root = NULL;
  95. if (res->flags & IORESOURCE_IO)
  96. root = &ioport_resource;
  97. if (res->flags & IORESOURCE_MEM)
  98. root = &iomem_resource;
  99. return root;
  100. }
  101. extern void pcibios_add_platform_entries(struct pci_dev *dev);
  102. struct file;
  103. extern pgprot_t pci_phys_mem_access_prot(struct file *file,
  104. unsigned long pfn,
  105. unsigned long size,
  106. pgprot_t prot);
  107. #define HAVE_ARCH_PCI_RESOURCE_TO_USER
  108. extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
  109. const struct resource *rsrc,
  110. u64 *start, u64 *end);
  111. #endif /* __KERNEL__ */
  112. #endif /* __PPC_PCI_H */