of_pci.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #else
  17. static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
  18. {
  19. return 0;
  20. }
  21. static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
  22. unsigned int devfn)
  23. {
  24. return NULL;
  25. }
  26. static inline int of_pci_get_devfn(struct device_node *np)
  27. {
  28. return -EINVAL;
  29. }
  30. static inline int
  31. of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
  32. {
  33. return 0;
  34. }
  35. static inline int
  36. of_pci_parse_bus_range(struct device_node *node, struct resource *res)
  37. {
  38. return -EINVAL;
  39. }
  40. static inline int
  41. of_get_pci_domain_nr(struct device_node *node)
  42. {
  43. return -1;
  44. }
  45. #endif
  46. #if defined(CONFIG_OF_ADDRESS)
  47. int of_pci_get_host_bridge_resources(struct device_node *dev,
  48. unsigned char busno, unsigned char bus_max,
  49. struct list_head *resources, resource_size_t *io_base);
  50. #endif
  51. #if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
  52. int of_pci_msi_chip_add(struct msi_chip *chip);
  53. void of_pci_msi_chip_remove(struct msi_chip *chip);
  54. struct msi_chip *of_pci_find_msi_chip_by_node(struct device_node *of_node);
  55. #else
  56. static inline int of_pci_msi_chip_add(struct msi_chip *chip) { return -EINVAL; }
  57. static inline void of_pci_msi_chip_remove(struct msi_chip *chip) { }
  58. static inline struct msi_chip *
  59. of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; }
  60. #endif
  61. #endif