pci.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * arch/arm/include/asm/mach/pci.h
  4. *
  5. * Copyright (C) 2000 Russell King
  6. */
  7. #ifndef __ASM_MACH_PCI_H
  8. #define __ASM_MACH_PCI_H
  9. #include <linux/ioport.h>
  10. struct pci_sys_data;
  11. struct pci_ops;
  12. struct pci_bus;
  13. struct pci_host_bridge;
  14. struct device;
  15. struct hw_pci {
  16. struct pci_ops *ops;
  17. int nr_controllers;
  18. void **private_data;
  19. int (*setup)(int nr, struct pci_sys_data *);
  20. int (*scan)(int nr, struct pci_host_bridge *);
  21. void (*preinit)(void);
  22. void (*postinit)(void);
  23. u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
  24. int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
  25. };
  26. /*
  27. * Per-controller structure
  28. */
  29. struct pci_sys_data {
  30. struct list_head node;
  31. int busnr; /* primary bus number */
  32. u64 mem_offset; /* bus->cpu memory mapping offset */
  33. unsigned long io_offset; /* bus->cpu IO mapping offset */
  34. struct pci_bus *bus; /* PCI bus */
  35. struct list_head resources; /* root bus resources (apertures) */
  36. struct resource io_res;
  37. char io_res_name[12];
  38. /* Bridge swizzling */
  39. u8 (*swizzle)(struct pci_dev *, u8 *);
  40. /* IRQ mapping */
  41. int (*map_irq)(const struct pci_dev *, u8, u8);
  42. void *private_data; /* platform controller private data */
  43. };
  44. /*
  45. * Call this with your hw_pci struct to initialise the PCI system.
  46. */
  47. void pci_common_init_dev(struct device *, struct hw_pci *);
  48. /*
  49. * Compatibility wrapper for older platforms that do not care about
  50. * passing the parent device.
  51. */
  52. static inline void pci_common_init(struct hw_pci *hw)
  53. {
  54. pci_common_init_dev(NULL, hw);
  55. }
  56. /*
  57. * Setup early fixed I/O mapping.
  58. */
  59. #if defined(CONFIG_PCI)
  60. extern void pci_map_io_early(unsigned long pfn);
  61. #else
  62. static inline void pci_map_io_early(unsigned long pfn) {}
  63. #endif
  64. /*
  65. * PCI controllers
  66. */
  67. extern struct pci_ops iop3xx_ops;
  68. extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
  69. extern void iop3xx_pci_preinit(void);
  70. extern void iop3xx_pci_preinit_cond(void);
  71. extern struct pci_ops dc21285_ops;
  72. extern int dc21285_setup(int nr, struct pci_sys_data *);
  73. extern void dc21285_preinit(void);
  74. extern void dc21285_postinit(void);
  75. #endif /* __ASM_MACH_PCI_H */