Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Sebastian Andrzej Siewior | 04bea68 | 2011-01-24 09:58:55 +0530 | [diff] [blame] | 2 | #ifndef __OF_PCI_H |
| 3 | #define __OF_PCI_H |
| 4 | |
| 5 | #include <linux/pci.h> |
Thomas Petazzoni | 0d5a6db | 2013-08-09 22:27:09 +0200 | [diff] [blame] | 6 | #include <linux/msi.h> |
Sebastian Andrzej Siewior | 04bea68 | 2011-01-24 09:58:55 +0530 | [diff] [blame] | 7 | |
| 8 | struct pci_dev; |
Grant Likely | 530210c | 2013-09-15 16:39:11 +0100 | [diff] [blame] | 9 | struct of_phandle_args; |
Benjamin Herrenschmidt | 98d9f30c8 | 2011-04-11 11:37:07 +1000 | [diff] [blame] | 10 | struct device_node; |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 11 | |
Rob Herring | 4670d61 | 2018-01-17 17:36:39 -0600 | [diff] [blame] | 12 | #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI) |
Benjamin Herrenschmidt | 98d9f30c8 | 2011-04-11 11:37:07 +1000 | [diff] [blame] | 13 | struct device_node *of_pci_find_child_device(struct device_node *parent, |
| 14 | unsigned int devfn); |
Thierry Reding | 45ab970 | 2013-05-16 17:55:18 +0200 | [diff] [blame] | 15 | int of_pci_get_devfn(struct device_node *np); |
Marc Zyngier | f81c11a | 2015-09-04 17:50:08 +0100 | [diff] [blame] | 16 | void of_pci_check_probe_only(void); |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 17 | #else |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 18 | static inline struct device_node *of_pci_find_child_device(struct device_node *parent, |
| 19 | unsigned int devfn) |
| 20 | { |
| 21 | return NULL; |
| 22 | } |
| 23 | |
| 24 | static inline int of_pci_get_devfn(struct device_node *np) |
| 25 | { |
| 26 | return -EINVAL; |
| 27 | } |
| 28 | |
Marc Zyngier | f81c11a | 2015-09-04 17:50:08 +0100 | [diff] [blame] | 29 | static inline void of_pci_check_probe_only(void) { } |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 30 | #endif |
Benjamin Herrenschmidt | 98d9f30c8 | 2011-04-11 11:37:07 +1000 | [diff] [blame] | 31 | |
Guenter Roeck | a6f1086 | 2018-03-05 15:22:30 -0800 | [diff] [blame] | 32 | #if IS_ENABLED(CONFIG_OF_IRQ) |
| 33 | int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); |
| 34 | #else |
| 35 | static inline int |
| 36 | of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) |
| 37 | { |
| 38 | return 0; |
| 39 | } |
| 40 | #endif |
| 41 | |
Sebastian Andrzej Siewior | 04bea68 | 2011-01-24 09:58:55 +0530 | [diff] [blame] | 42 | #endif |