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 | |
Krzysztof Wilczynski | bbd8810d | 2019-09-03 13:30:59 +0200 | [diff] [blame] | 5 | #include <linux/types.h> |
| 6 | #include <linux/errno.h> |
Sebastian Andrzej Siewior | 04bea68 | 2011-01-24 09:58:55 +0530 | [diff] [blame] | 7 | |
| 8 | struct pci_dev; |
Benjamin Herrenschmidt | 98d9f30c8 | 2011-04-11 11:37:07 +1000 | [diff] [blame] | 9 | struct device_node; |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 10 | |
Rob Herring | 4670d61 | 2018-01-17 17:36:39 -0600 | [diff] [blame] | 11 | #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI) |
Benjamin Herrenschmidt | 98d9f30c8 | 2011-04-11 11:37:07 +1000 | [diff] [blame] | 12 | struct device_node *of_pci_find_child_device(struct device_node *parent, |
| 13 | unsigned int devfn); |
Thierry Reding | 45ab970 | 2013-05-16 17:55:18 +0200 | [diff] [blame] | 14 | int of_pci_get_devfn(struct device_node *np); |
Marc Zyngier | f81c11a | 2015-09-04 17:50:08 +0100 | [diff] [blame] | 15 | void of_pci_check_probe_only(void); |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 16 | #else |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 17 | static inline struct device_node *of_pci_find_child_device(struct device_node *parent, |
| 18 | unsigned int devfn) |
| 19 | { |
| 20 | return NULL; |
| 21 | } |
| 22 | |
| 23 | static inline int of_pci_get_devfn(struct device_node *np) |
| 24 | { |
| 25 | return -EINVAL; |
| 26 | } |
| 27 | |
Marc Zyngier | f81c11a | 2015-09-04 17:50:08 +0100 | [diff] [blame] | 28 | static inline void of_pci_check_probe_only(void) { } |
Arnd Bergmann | 64c5c75 | 2014-06-04 04:40:19 -0500 | [diff] [blame] | 29 | #endif |
Benjamin Herrenschmidt | 98d9f30c8 | 2011-04-11 11:37:07 +1000 | [diff] [blame] | 30 | |
Guenter Roeck | a6f1086 | 2018-03-05 15:22:30 -0800 | [diff] [blame] | 31 | #if IS_ENABLED(CONFIG_OF_IRQ) |
| 32 | int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); |
| 33 | #else |
| 34 | static inline int |
| 35 | of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) |
| 36 | { |
| 37 | return 0; |
| 38 | } |
| 39 | #endif |
| 40 | |
Sebastian Andrzej Siewior | 04bea68 | 2011-01-24 09:58:55 +0530 | [diff] [blame] | 41 | #endif |