of_pci.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef __OF_PCI_H
  2. #define __OF_PCI_H
  3. #include <linux/pci.h>
  4. #include <linux/msi.h>
  5. struct pci_dev;
  6. struct of_phandle_args;
  7. struct device_node;
  8. #ifdef CONFIG_OF
  9. int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
  10. struct device_node *of_pci_find_child_device(struct device_node *parent,
  11. unsigned int devfn);
  12. int of_pci_get_devfn(struct device_node *np);
  13. int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
  14. int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
  15. int of_get_pci_domain_nr(struct device_node *node);
  16. void of_pci_check_probe_only(void);
  17. #else
  18. static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
  19. {
  20. return 0;
  21. }
  22. static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
  23. unsigned int devfn)
  24. {
  25. return NULL;
  26. }
  27. static inline int of_pci_get_devfn(struct device_node *np)
  28. {
  29. return -EINVAL;
  30. }
  31. static inline int
  32. of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
  33. {
  34. return 0;
  35. }
  36. static inline int
  37. of_pci_parse_bus_range(struct device_node *node, struct resource *res)
  38. {
  39. return -EINVAL;
  40. }
  41. static inline int
  42. of_get_pci_domain_nr(struct device_node *node)
  43. {
  44. return -1;
  45. }
  46. static inline void of_pci_check_probe_only(void) { }
  47. #endif
  48. #if defined(CONFIG_OF_ADDRESS)
  49. int of_pci_get_host_bridge_resources(struct device_node *dev,
  50. unsigned char busno, unsigned char bus_max,
  51. struct list_head *resources, resource_size_t *io_base);
  52. #endif
  53. #if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
  54. int of_pci_msi_chip_add(struct msi_controller *chip);
  55. void of_pci_msi_chip_remove(struct msi_controller *chip);
  56. struct msi_controller *of_pci_find_msi_chip_by_node(struct device_node *of_node);
  57. #else
  58. static inline int of_pci_msi_chip_add(struct msi_controller *chip) { return -EINVAL; }
  59. static inline void of_pci_msi_chip_remove(struct msi_controller *chip) { }
  60. static inline struct msi_controller *
  61. of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; }
  62. #endif
  63. #endif