of_pci.h 2.19 KB
Newer Older
1 2 3 4
#ifndef __OF_PCI_H
#define __OF_PCI_H

#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 14
struct device_node *of_pci_find_child_device(struct device_node *parent,
					     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 22 23
int of_pci_map_rid(struct device_node *np, u32 rid,
		   const char *map_name, const char *map_mask_name,
		   struct device_node **target, u32 *id_out);
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#else
static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
{
	return 0;
}

static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
					     unsigned int devfn)
{
	return NULL;
}

static inline int of_pci_get_devfn(struct device_node *np)
{
	return -EINVAL;
}

static inline int
of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
{
	return 0;
}

static inline int
of_pci_parse_bus_range(struct device_node *node, struct resource *res)
{
	return -EINVAL;
}
52 53 54 55 56 57

static inline int
of_get_pci_domain_nr(struct device_node *node)
{
	return -1;
}
58

59 60 61 62 63
static inline int of_pci_map_rid(struct device_node *np, u32 rid,
			const char *map_name, const char *map_mask_name,
			struct device_node **target, u32 *id_out)
{
	return -EINVAL;
64 65 66 67 68 69
}

static inline int
of_pci_get_max_link_speed(struct device_node *node)
{
	return -EINVAL;
70 71
}

72
static inline void of_pci_check_probe_only(void) { }
73
#endif
74

75 76 77 78
#if defined(CONFIG_OF_ADDRESS)
int of_pci_get_host_bridge_resources(struct device_node *dev,
			unsigned char busno, unsigned char bus_max,
			struct list_head *resources, resource_size_t *io_base);
79 80 81 82 83 84 85
#else
static inline int of_pci_get_host_bridge_resources(struct device_node *dev,
			unsigned char busno, unsigned char bus_max,
			struct list_head *resources, resource_size_t *io_base)
{
	return -EINVAL;
}
86 87
#endif

88
#endif