pci.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef __ASM_POWERPC_PCI_H
  3. #define __ASM_POWERPC_PCI_H
  4. #ifdef __KERNEL__
  5. /*
  6. */
  7. #include <linux/types.h>
  8. #include <linux/slab.h>
  9. #include <linux/string.h>
  10. #include <linux/dma-map-ops.h>
  11. #include <linux/scatterlist.h>
  12. #include <asm/machdep.h>
  13. #include <asm/io.h>
  14. #include <asm/pci-bridge.h>
  15. /* Return values for pci_controller_ops.probe_mode function */
  16. #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
  17. #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
  18. #define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
  19. #define PCIBIOS_MIN_IO 0x1000
  20. #define PCIBIOS_MIN_MEM 0x10000000
  21. /* Values for the `which' argument to sys_pciconfig_iobase syscall. */
  22. #define IOBASE_BRIDGE_NUMBER 0
  23. #define IOBASE_MEMORY 1
  24. #define IOBASE_IO 2
  25. #define IOBASE_ISA_IO 3
  26. #define IOBASE_ISA_MEM 4
  27. /*
  28. * Set this to 1 if you want the kernel to re-assign all PCI
  29. * bus numbers (don't do that on ppc64 yet !)
  30. */
  31. #define pcibios_assign_all_busses() \
  32. (pci_has_flag(PCI_REASSIGN_ALL_BUS))
  33. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  34. {
  35. if (ppc_md.pci_get_legacy_ide_irq)
  36. return ppc_md.pci_get_legacy_ide_irq(dev, channel);
  37. return channel ? 15 : 14;
  38. }
  39. #ifdef CONFIG_PCI
  40. void __init set_pci_dma_ops(const struct dma_map_ops *dma_ops);
  41. #else /* CONFIG_PCI */
  42. #define set_pci_dma_ops(d)
  43. #endif
  44. #ifdef CONFIG_PPC64
  45. /*
  46. * We want to avoid touching the cacheline size or MWI bit.
  47. * pSeries firmware sets the cacheline size (which is not the cpu cacheline
  48. * size in all cases) and hardware treats MWI the same as memory write.
  49. */
  50. #define PCI_DISABLE_MWI
  51. #endif /* CONFIG_PPC64 */
  52. extern int pci_domain_nr(struct pci_bus *bus);
  53. /* Decide whether to display the domain number in /proc */
  54. extern int pci_proc_domain(struct pci_bus *bus);
  55. struct vm_area_struct;
  56. /* Tell PCI code what kind of PCI resource mappings we support */
  57. #define HAVE_PCI_MMAP 1
  58. #define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
  59. #define arch_can_pci_mmap_io() 1
  60. #define arch_can_pci_mmap_wc() 1
  61. extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
  62. size_t count);
  63. extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
  64. size_t count);
  65. extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
  66. struct vm_area_struct *vma,
  67. enum pci_mmap_state mmap_state);
  68. #define HAVE_PCI_LEGACY 1
  69. extern void pcibios_claim_one_bus(struct pci_bus *b);
  70. extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
  71. extern void pcibios_resource_survey(void);
  72. extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
  73. extern int remove_phb_dynamic(struct pci_controller *phb);
  74. extern struct pci_dev *of_create_pci_dev(struct device_node *node,
  75. struct pci_bus *bus, int devfn);
  76. extern unsigned int pci_parse_of_flags(u32 addr0, int bridge);
  77. extern void of_scan_pci_bridge(struct pci_dev *dev);
  78. extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
  79. extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
  80. struct file;
  81. extern pgprot_t pci_phys_mem_access_prot(struct file *file,
  82. unsigned long pfn,
  83. unsigned long size,
  84. pgprot_t prot);
  85. extern resource_size_t pcibios_io_space_offset(struct pci_controller *hose);
  86. extern void pcibios_setup_bus_self(struct pci_bus *bus);
  87. extern void pcibios_setup_phb_io_space(struct pci_controller *hose);
  88. extern void pcibios_scan_phb(struct pci_controller *hose);
  89. #endif /* __KERNEL__ */
  90. #endif /* __ASM_POWERPC_PCI_H */