1 #ifndef __OF_PCI_H 2 #define __OF_PCI_H 3 4 #include <linux/pci.h> 5 #include <linux/msi.h> 6 7 struct pci_dev; 8 struct of_phandle_args; 9 struct device_node; 10 11 #ifdef CONFIG_OF_PCI 12 int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq); 13 struct device_node *of_pci_find_child_device(struct device_node *parent, 14 unsigned int devfn); 15 int of_pci_get_devfn(struct device_node *np); 16 int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); 17 int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 18 int of_get_pci_domain_nr(struct device_node *node); 19 int of_pci_get_max_link_speed(struct device_node *node); 20 void of_pci_check_probe_only(void); 21 int 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 25 static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 26 { 27 return 0; 28 } 29 30 static inline struct device_node *of_pci_find_child_device(struct device_node *parent, 31 unsigned int devfn) 32 { 33 return NULL; 34 } 35 36 static inline int of_pci_get_devfn(struct device_node *np) 37 { 38 return -EINVAL; 39 } 40 41 static inline int 42 of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) 43 { 44 return 0; 45 } 46 47 static inline int 48 of_pci_parse_bus_range(struct device_node *node, struct resource *res) 49 { 50 return -EINVAL; 51 } 52 53 static inline int 54 of_get_pci_domain_nr(struct device_node *node) 55 { 56 return -1; 57 } 58 59 static 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 66 static inline int 67 of_pci_get_max_link_speed(struct device_node *node) 68 { 69 return -EINVAL; 70 } 71 72 static inline void of_pci_check_probe_only(void) { } 73 #endif 74 75 #if defined(CONFIG_OF_ADDRESS) 76 int 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 80 static 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