]>
Commit | Line | Data |
---|---|---|
04bea68b SAS |
1 | #ifndef __OF_PCI_H |
2 | #define __OF_PCI_H | |
3 | ||
4 | #include <linux/pci.h> | |
0d5a6db3 | 5 | #include <linux/msi.h> |
04bea68b SAS |
6 | |
7 | struct pci_dev; | |
530210c7 | 8 | struct of_phandle_args; |
98d9f30c | 9 | struct device_node; |
64c5c759 | 10 | |
5c1d3310 | 11 | #ifdef CONFIG_OF_PCI |
64c5c759 | 12 | int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq); |
98d9f30c BH |
13 | struct device_node *of_pci_find_child_device(struct device_node *parent, |
14 | unsigned int devfn); | |
45ab9702 | 15 | int of_pci_get_devfn(struct device_node *np); |
64c5c759 | 16 | int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); |
4e23d3f5 | 17 | int of_pci_parse_bus_range(struct device_node *node, struct resource *res); |
41e5c0f8 | 18 | int of_get_pci_domain_nr(struct device_node *node); |
9a1dc389 | 19 | int of_pci_get_max_link_speed(struct device_node *node); |
f81c11af | 20 | void of_pci_check_probe_only(void); |
987068fc RM |
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); | |
64c5c759 AB |
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 | } | |
41e5c0f8 LD |
52 | |
53 | static inline int | |
54 | of_get_pci_domain_nr(struct device_node *node) | |
55 | { | |
56 | return -1; | |
57 | } | |
c49b8fc2 | 58 | |
987068fc RM |
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; | |
9a1dc389 SL |
64 | } |
65 | ||
66 | static inline int | |
67 | of_pci_get_max_link_speed(struct device_node *node) | |
68 | { | |
69 | return -EINVAL; | |
987068fc RM |
70 | } |
71 | ||
f81c11af | 72 | static inline void of_pci_check_probe_only(void) { } |
64c5c759 | 73 | #endif |
98d9f30c | 74 | |
cbe4097f LD |
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); | |
40704b12 AB |
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 | } | |
cbe4097f LD |
86 | #endif |
87 | ||
0d5a6db3 | 88 | #if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) |
c2791b80 YW |
89 | int of_pci_msi_chip_add(struct msi_controller *chip); |
90 | void of_pci_msi_chip_remove(struct msi_controller *chip); | |
91 | struct msi_controller *of_pci_find_msi_chip_by_node(struct device_node *of_node); | |
0d5a6db3 | 92 | #else |
c2791b80 YW |
93 | static inline int of_pci_msi_chip_add(struct msi_controller *chip) { return -EINVAL; } |
94 | static inline void of_pci_msi_chip_remove(struct msi_controller *chip) { } | |
95 | static inline struct msi_controller * | |
0d5a6db3 TP |
96 | of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; } |
97 | #endif | |
98 | ||
04bea68b | 99 | #endif |