3 #include <linux/ioport.h>
4 #include <linux/errno.h>
7 struct of_pci_range_parser
{
8 struct device_node
*node
;
23 #define for_each_of_pci_range(parser, range) \
24 for (; of_pci_range_parser_one(parser, range);)
26 /* Translate a DMA address from device space to CPU space */
27 extern u64
of_translate_dma_address(struct device_node
*dev
,
28 const __be32
*in_addr
);
30 #ifdef CONFIG_OF_ADDRESS
31 extern u64
of_translate_address(struct device_node
*np
, const __be32
*addr
);
32 extern int of_address_to_resource(struct device_node
*dev
, int index
,
34 extern struct device_node
*of_find_matching_node_by_address(
35 struct device_node
*from
,
36 const struct of_device_id
*matches
,
38 extern void __iomem
*of_iomap(struct device_node
*device
, int index
);
40 /* Extract an address from a device, returns the region size and
41 * the address space flags too. The PCI version uses a BAR number
42 * instead of an absolute index
44 extern const __be32
*of_get_address(struct device_node
*dev
, int index
,
45 u64
*size
, unsigned int *flags
);
47 extern int pci_register_io_range(phys_addr_t addr
, resource_size_t size
);
48 extern unsigned long pci_address_to_pio(phys_addr_t addr
);
49 extern phys_addr_t
pci_pio_to_address(unsigned long pio
);
51 extern int of_pci_range_parser_init(struct of_pci_range_parser
*parser
,
52 struct device_node
*node
);
53 extern struct of_pci_range
*of_pci_range_parser_one(
54 struct of_pci_range_parser
*parser
,
55 struct of_pci_range
*range
);
56 extern int of_dma_get_range(struct device_node
*np
, u64
*dma_addr
,
57 u64
*paddr
, u64
*size
);
58 extern bool of_dma_is_coherent(struct device_node
*np
);
59 #else /* CONFIG_OF_ADDRESS */
60 static inline struct device_node
*of_find_matching_node_by_address(
61 struct device_node
*from
,
62 const struct of_device_id
*matches
,
68 static inline const __be32
*of_get_address(struct device_node
*dev
, int index
,
69 u64
*size
, unsigned int *flags
)
74 static inline phys_addr_t
pci_pio_to_address(unsigned long pio
)
79 static inline int of_pci_range_parser_init(struct of_pci_range_parser
*parser
,
80 struct device_node
*node
)
85 static inline struct of_pci_range
*of_pci_range_parser_one(
86 struct of_pci_range_parser
*parser
,
87 struct of_pci_range
*range
)
92 static inline int of_dma_get_range(struct device_node
*np
, u64
*dma_addr
,
93 u64
*paddr
, u64
*size
)
98 static inline bool of_dma_is_coherent(struct device_node
*np
)
102 #endif /* CONFIG_OF_ADDRESS */
105 extern int of_address_to_resource(struct device_node
*dev
, int index
,
107 void __iomem
*of_iomap(struct device_node
*node
, int index
);
108 void __iomem
*of_io_request_and_map(struct device_node
*device
,
109 int index
, const char *name
);
112 #include <linux/io.h>
114 static inline int of_address_to_resource(struct device_node
*dev
, int index
,
120 static inline void __iomem
*of_iomap(struct device_node
*device
, int index
)
125 static inline void __iomem
*of_io_request_and_map(struct device_node
*device
,
126 int index
, const char *name
)
128 return IOMEM_ERR_PTR(-EINVAL
);
132 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
133 extern const __be32
*of_get_pci_address(struct device_node
*dev
, int bar_no
,
134 u64
*size
, unsigned int *flags
);
135 extern int of_pci_address_to_resource(struct device_node
*dev
, int bar
,
137 extern int of_pci_range_to_resource(struct of_pci_range
*range
,
138 struct device_node
*np
,
139 struct resource
*res
);
140 #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
141 static inline int of_pci_address_to_resource(struct device_node
*dev
, int bar
,
147 static inline const __be32
*of_get_pci_address(struct device_node
*dev
,
148 int bar_no
, u64
*size
, unsigned int *flags
)
152 static inline int of_pci_range_to_resource(struct of_pci_range
*range
,
153 struct device_node
*np
,
154 struct resource
*res
)
158 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
160 #endif /* __OF_ADDRESS_H */
This page took 0.034103 seconds and 5 git commands to generate.