1#ifndef __OF_PCI_H 2#define __OF_PCI_H 3 4#include <linux/pci.h> 5#include <linux/msi.h> 6 7struct pci_dev; 8struct of_phandle_args; 9struct device_node; 10 11#ifdef CONFIG_OF_PCI 12int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq); 13struct device_node *of_pci_find_child_device(struct device_node *parent, 14 unsigned int devfn); 15int of_pci_get_devfn(struct device_node *np); 16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); 17int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 18int of_get_pci_domain_nr(struct device_node *node); 19int of_pci_get_max_link_speed(struct device_node *node); 20void of_pci_check_probe_only(void); 21int of_pci_map_rid(struct device_node *np, u32 rid, 22 const char *map_name, const char *map_mask_name, 23 struct device_node **target, u32 *id_out); 24#else 25static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 26{ 27 return 0; 28} 29 30static inline struct device_node *of_pci_find_child_device(struct device_node *parent, 31 unsigned int devfn) 32{ 33 return NULL; 34} 35 36static inline int of_pci_get_devfn(struct device_node *np) 37{ 38 return -EINVAL; 39} 40 41static inline int 42of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) 43{ 44 return 0; 45} 46 47static inline int 48of_pci_parse_bus_range(struct device_node *node, struct resource *res) 49{ 50 return -EINVAL; 51} 52 53static inline int 54of_get_pci_domain_nr(struct device_node *node) 55{ 56 return -1; 57} 58 59static inline int of_pci_map_rid(struct device_node *np, u32 rid, 60 const char *map_name, const char *map_mask_name, 61 struct device_node **target, u32 *id_out) 62{ 63 return -EINVAL; 64} 65 66static inline int 67of_pci_get_max_link_speed(struct device_node *node) 68{ 69 return -EINVAL; 70} 71 72static inline void of_pci_check_probe_only(void) { } 73#endif 74 75#if defined(CONFIG_OF_ADDRESS) 76int of_pci_get_host_bridge_resources(struct device_node *dev, 77 unsigned char busno, unsigned char bus_max, 78 struct list_head *resources, resource_size_t *io_base); 79#else 80static inline int of_pci_get_host_bridge_resources(struct device_node *dev, 81 unsigned char busno, unsigned char bus_max, 82 struct list_head *resources, resource_size_t *io_base) 83{ 84 return -EINVAL; 85} 86#endif 87 88#endif 89